diff options
| author | Scott Shawcroft <scott@tannewt.org> | 2017-09-22 18:05:51 -0700 |
|---|---|---|
| committer | Dan Halbert <halbert@halwitz.org> | 2017-09-22 21:05:51 -0400 |
| commit | 6839fff31303463d5c7942387fa498895edf1abf (patch) | |
| tree | f4c5b94c6534c8d5c65ea6b7209cd2d681508f5f /atmel-samd/asf/sam0/drivers | |
| parent | 3ad01ddb04b160b74b4baee9fce043da17dbcef5 (diff) | |
Move to ASF4 and introduce SAMD51 support. (#258)3.0.0-alpha.0
* atmel-samd: Remove ASF3. This will break builds.
* atmel-samd: Add ASF4 for the SAMD21 and SAMD51.
* Introduce the supervisor concept to facilitate porting.
The supervisor is the code which runs individual MicroPython VMs. By
splitting it out we make it more consistent and easier to find.
This also adds very basic SAMD21 and SAMD51 support using the
supervisor. Only the REPL currently works.
This begins the work for #178.
Diffstat (limited to 'atmel-samd/asf/sam0/drivers')
116 files changed, 0 insertions, 71986 deletions
diff --git a/atmel-samd/asf/sam0/drivers/adc/adc.h b/atmel-samd/asf/sam0/drivers/adc/adc.h deleted file mode 100644 index a31bff722..000000000 --- a/atmel-samd/asf/sam0/drivers/adc/adc.h +++ /dev/null @@ -1,1155 +0,0 @@ -/** - * \file - * - * \brief SAM Peripheral Analog-to-Digital Converter Driver - * - * Copyright (C) 2012-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef ADC_H_INCLUDED -#define ADC_H_INCLUDED - -/** - * \defgroup asfdoc_sam0_adc_group SAM Analog-to-Digital Converter (ADC) Driver - * - * This driver for Atmel® | SMART ARM®-based microcontrollers provides an interface for the configuration - * and management of the device's Analog-to-Digital Converter functionality, for - * the conversion of analog voltages into a corresponding digital form. - * The following driver Application Programming Interface (API) modes are covered by this manual: - * - Polled APIs - * \if ADC_CALLBACK_MODE - * - Callback APIs - * \endif - * - * The following peripheral is used by this module: - * - ADC (Analog-to-Digital Converter) - * - * The following devices can use this module: - * \if DEVICE_SAML21_SUPPORT - * - Atmel | SMART SAM L21/L22 - * - Atmel | SMART SAM C20/C21 - * \else - * - Atmel | SMART SAM D20/D21 - * - Atmel | SMART SAM R21 - * - Atmel | SMART SAM D09/D10/D11 - * - Atmel | SMART SAM DA1 - * \endif - * - * The outline of this documentation is as follows: - * - \ref asfdoc_sam0_adc_prerequisites - * - \ref asfdoc_sam0_adc_module_overview - * - \ref asfdoc_sam0_adc_special_considerations - * - \ref asfdoc_sam0_adc_extra_info - * - \ref asfdoc_sam0_adc_examples - * - \ref asfdoc_sam0_adc_api_overview - * - * - * \section asfdoc_sam0_adc_prerequisites Prerequisites - * - * There are no prerequisites for this module. - * - * - * \section asfdoc_sam0_adc_module_overview Module Overview - * - * This driver provides an interface for the Analog-to-Digital conversion - * functions on the device, to convert analog voltages to a corresponding - * digital value. The ADC has up to 12-bit resolution, and is capable of - * \if DEVICE_SAML21_SUPPORT - * converting up to 1,000,000 samples per second (MSPS). - * \else - * converting up to 500K samples per second (KSPS). - * \endif - * - * The ADC has a compare function for accurate monitoring of user defined - * thresholds with minimum software intervention required. - * The ADC may be configured for 8-, 10-, or 12-bit result, reducing the - * conversion time. ADC conversion results are provided left or right adjusted - * which eases calculation when the result is represented as a signed integer. - * - * The input selection is flexible, and both single-ended and differential - * measurements can be made. For differential measurements, an optional gain - * stage is available to increase the dynamic range. In addition, several - * internal signal inputs are available. The ADC can provide both signed and - * unsigned results. - * - * The ADC measurements can either be started by application software or an - * incoming event from another peripheral in the device, and both internal and - * external reference voltages can be selected. - * - * \note Internal references will be enabled by the driver, but not disabled. - * Any reference not used by the application should be disabled by the application. - * - * A simplified block diagram of the ADC can be seen in - * \ref asfdoc_sam0_adc_module_block_diagram "the figure below". - * - * \anchor asfdoc_sam0_adc_module_block_diagram - * \dot - * digraph overview { - * splines = false; - * rankdir=LR; - * - * mux1 [label="Positive input", shape=box]; - * mux2 [label="Negative input", shape=box]; - * - * - * mux3 [label="Reference", shape=box]; - * - * adc [label="ADC", shape=polygon, sides=5, orientation=90, distortion=-0.6, style=filled, fillcolor=darkolivegreen1, height=1, width=1]; - * prescaler [label="PRESCALER", shape=box, style=filled, fillcolor=lightblue]; - * - * mux1 -> adc; - * mux2 -> adc; - * mux3 -> adc:sw; - * prescaler -> adc; - * - * postproc [label="Post processing", shape=box]; - * result [label="RESULT", shape=box, style=filled, fillcolor=lightblue]; - * - * adc:e -> postproc:w; - * postproc:e -> result:w; - * - * {rank=same; mux1 mux2} - * {rank=same; prescaler adc} - * - * } - * \enddot - * - * - * \subsection asfdoc_sam0_adc_module_overview_prescaler Sample Clock Prescaler - * The ADC features a prescaler, which enables conversion at lower clock rates - * than the input Generic Clock to the ADC module. This feature can be used to - * lower the synchronization time of the digital interface to the ADC module - * via a high speed Generic Clock frequency, while still allowing the ADC - * sampling rate to be reduced. - * - * \subsection asfdoc_sam0_adc_module_overview_resolution ADC Resolution - * The ADC supports full 8-, 10-, or 12-bit resolution. Hardware - * oversampling and decimation can be used to increase the - * effective resolution at the expense of throughput. Using oversampling and - * decimation mode the ADC resolution is increased from 12-bit to an effective - * 13-, 14-, 15-, or 16-bit. In these modes the conversion rate is reduced, as - * a greater number of samples is used to achieve the increased resolution. The - * available resolutions and effective conversion rate is listed in - * \ref asfdoc_sam0_adc_module_conversion_rate "the table below". - * - * \anchor asfdoc_sam0_adc_module_conversion_rate - * <table> - * <caption>Effective ADC Conversion Speed Using Oversampling</caption> - * <tr> - * <th>Resolution</th> - * <th>Effective conversion rate</th> - * </tr> - * <tr> - * <td>13-bit</td> - * <td>Conversion rate divided by 4</td> - * </tr> - * <tr> - * <td>14-bit</td> - * <td>Conversion rate divided by 16</td> - * </tr> - * <tr> - * <td>15-bit</td> - * <td>Conversion rate divided by 64</td> - * </tr> - * <tr> - * <td>16-bit</td> - * <td>Conversion rate divided by 256</td> - * </tr> - * </table> - * - * \subsection asfdoc_sam0_adc_module_overview_conversion Conversion Modes - * ADC conversions can be software triggered on demand by the user application, - * if continuous sampling is not required. It is also possible to configure the - * ADC in free running mode, where new conversions are started as soon as the - * previous conversion is completed, or configure the ADC to scan across a - * number of input pins (see \ref asfdoc_sam0_adc_module_overview_pin_scan). - * - * \subsection asfdoc_sam0_adc_module_overview_diff_mode Differential and Single-ended Conversion - * The ADC has two conversion modes; differential and single-ended. When - * measuring signals where the positive input pin is always at a higher voltage - * than the negative input pin, the single-ended conversion mode should be used - * in order to achieve a full 12-bit output resolution. - * - * If however the positive input pin voltage may drop below the negative input - * pin the signed differential mode should be used. - * - * \subsection asfdoc_sam0_adc_module_overview_sample_time Sample Time - * The sample time for each ADC conversion is configurable as a number of half - * prescaled ADC clock cycles (depending on the prescaler value), allowing the - * user application to achieve faster or slower sampling depending on the - * source impedance of the ADC input channels. For applications with high - * impedance inputs the sample time can be increased to give the ADC an adequate - * time to sample and convert the input channel. - * - * The resulting sampling time is given by the following equation: - * \f[ - * t_{SAMPLE} = (sample\_length+1) \times \frac{ADC_{CLK}} {2} - * \f] - * - * \subsection asfdoc_sam0_adc_module_overview_averaging Averaging - * The ADC can be configured to trade conversion speed for accuracy by averaging - * multiple samples in hardware. This feature is suitable when operating in - * noisy conditions. - * - * You can specify any number of samples to accumulate (up to 1024) and the - * divide ratio to use (up to divide by 128). To modify these settings the - * ADC_RESOLUTION_CUSTOM needs to be set as the resolution. When this is set - * the number of samples to accumulate and the division ratio can be set by - * the configuration struct members \ref adc_config.accumulate_samples and - * \ref adc_config.divide_result. When using this mode the ADC result register - * will be set to be 16-bit wide to accommodate the larger result sizes - * produced by the accumulator. - * - * The effective ADC conversion rate will be reduced by a factor of the number - * of accumulated samples; - * however, the effective resolution will be increased according to - * \ref asfdoc_sam0_adc_module_hw_av_resolution "the table below". - * - * \anchor asfdoc_sam0_adc_module_hw_av_resolution - * <table> - * <caption>Effective ADC Resolution From Various Hardware Averaging Modes</caption> - * <tr> - * <th>Number of samples</tr> - * <th>Final result</tr> - * </tr> - * <tr> - * <td>1</td> - * <td>12-bit</td> - * </tr> - * <tr> - * <td>2</td> - * <td>13-bit</td> - * </tr> - * <tr> - * <td>4</td> - * <td>14-bit</td> - * </tr> - * <tr> - * <td>8</td> - * <td>15-bit</td> - * </tr> - * <tr> - * <td>16</td> - * <td>16-bit</td> - * </tr> - * <tr> - * <td>32</td> - * <td>16-bit</td> - * </tr> - * <tr> - * <td>64</td> - * <td>16-bit</td> - * </tr> - * <tr> - * <td>128</td> - * <td>16-bit</td> - * </tr> - * <tr> - * <td>256</td> - * <td>16-bit</td> - * </tr> - * <tr> - * <td>512</td> - * <td>16-bit</td> - * </tr> - * <tr> - * <td>1024</td> - * <td>16-bit</td> - * </tr> - * </table> - * - * - * \subsection asfdoc_sam0_adc_module_overview_offset_corr Offset and Gain Correction - * Inherent gain and offset errors affect the absolute accuracy of the ADC. - * - * The offset error is defined as the deviation of the ADC's actual transfer - * function from ideal straight line at zero input voltage. - * - * The gain error is defined as the deviation of the last output step's - * midpoint from the ideal straight line, after compensating for offset error. - * - * The offset correction value is subtracted from the converted data before the - * result is ready. The gain correction value is multiplied with the offset - * corrected value. - * - * The equation for both offset and gain error compensation is shown below: - * \f[ - * ADC_{RESULT} = (VALUE_{CONV} + CORR_{OFFSET}) \times CORR_{GAIN} - * \f] - * - * When enabled, a given set of offset and gain correction values can be applied - * to the sampled data in hardware, giving a corrected stream of sample data to - * the user application at the cost of an increased sample latency. - * - * In single conversion, a latency of 13 ADC Generic Clock cycles is added for - * the final sample result availability. As the correction time is always less - * than the propagation delay, in free running mode this latency appears only - * during the first conversion. After the first conversion is complete, future - * conversion results are available at the defined sampling rate. - * - * \subsection asfdoc_sam0_adc_module_overview_pin_scan Pin Scan - * In pin scan mode, the first ADC conversion will begin from the configured - * positive channel, plus the requested starting offset. When the first - * conversion is completed, the next conversion will start at the next positive - * input channel and so on, until all requested pins to scan have been sampled - * and converted. - * SAM L21/L22 has automatic sequences feature instead of pin scan mode. In automatic - * sequence mode, all of 32 positives inputs can be included in a sequence. The - * sequence starts from the lowest input, and go to the next enabled input - * automatically. - * - * Pin scanning gives a simple mechanism to sample a large number of physical - * input channel samples, using a single physical ADC channel. - * - * \subsection asfdoc_sam0_adc_module_overview_window_monitor Window Monitor - * The ADC module window monitor function can be used to automatically compare - * the conversion result against a preconfigured pair of upper and lower - * threshold values. - * - * The threshold values are evaluated differently, depending on whether - * differential or single-ended mode is selected. In differential mode, the - * upper and lower thresholds are evaluated as signed values for the comparison, - * while in single-ended mode the comparisons are made as a set of unsigned - * values. - * - * The significant bits of the lower window monitor threshold and upper window - * monitor threshold values are user-configurable, and follow the overall ADC - * sampling bit precision set when the ADC is configured by the user application. - * For example, only the eight lower bits of the window threshold values will be - * compared to the sampled data whilst the ADC is configured in 8-bit mode. - * In addition, if using differential mode, the 8<SUP>th</SUP> bit will be considered as - * the sign bit even if bit 9 is zero. - * - * \subsection asfdoc_sam0_adc_module_overview_events Events - * Event generation and event actions are configurable in the ADC. - * - * The ADC has two actions that can be triggered upon event reception: - * \li Start conversion - * \li Flush pipeline and start conversion - * - * The ADC can generate two events: - * \li Window monitor - * \li Result ready - * - * If the event actions are enabled in the configuration, any incoming event - * will trigger the action. - * - * If the window monitor event is enabled, an event will be generated - * when the configured window condition is detected. - * - * If the result ready event is enabled, an event will be generated when a - * conversion is completed. - * - * \note The connection of events between modules requires the use of the - * \ref asfdoc_sam0_events_group "SAM Event System Driver (EVENTS)" - * to route output event of one module to the input event of another. - * For more information on event routing, refer to the event driver - * documentation. - * - * - * \section asfdoc_sam0_adc_special_considerations Special Considerations - * - * An integrated analog temperature sensor is available for use with the ADC. - * The bandgap voltage, as well as the scaled I/O and core voltages can also be - * measured by the ADC. For internal ADC inputs, the internal source(s) may need - * to be manually enabled by the user application before they can be measured. - * - * - * \section asfdoc_sam0_adc_extra_info Extra Information - * - * For extra information, see \ref asfdoc_sam0_adc_extra. This includes: - * - \ref asfdoc_sam0_adc_extra_acronyms - * - \ref asfdoc_sam0_adc_extra_dependencies - * - \ref asfdoc_sam0_adc_extra_errata - * - \ref asfdoc_sam0_adc_extra_history - * - * - * \section asfdoc_sam0_adc_examples Examples - * - * For a list of examples related to this driver, see - * \ref asfdoc_sam0_adc_exqsg. - * - * - * \section asfdoc_sam0_adc_api_overview API Overview - * @{ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include <compiler.h> -#include <system.h> -#include <adc_feature.h> - -/** - * \name Module Status Flags - * - * ADC status flags, returned by \ref adc_get_status() and cleared by - * \ref adc_clear_status(). - * - * @{ - */ - -/** ADC result ready. */ -#define ADC_STATUS_RESULT_READY (1UL << 0) -/** Window monitor match. */ -#define ADC_STATUS_WINDOW (1UL << 1) -/** ADC result overwritten before read. */ -#define ADC_STATUS_OVERRUN (1UL << 2) - -/** @} */ - -#if ADC_CALLBACK_MODE == true -# if (ADC_INST_NUM > 1) -# define _ADC_INTERRUPT_VECT_NUM(n, unused) \ - SYSTEM_INTERRUPT_MODULE_ADC##n, -/** - * \internal Get the interrupt vector for the given device instance - * - * \param[in] The ADC module instance number - * - * \return Interrupt vector for of the given ADC module instance. - */ -static enum system_interrupt_vector _adc_interrupt_get_interrupt_vector( - uint32_t inst_num) -{ - static uint8_t adc_interrupt_vectors[ADC_INST_NUM] = { - MREPEAT(ADC_INST_NUM, _ADC_INTERRUPT_VECT_NUM, 0) - }; - - return (enum system_interrupt_vector)adc_interrupt_vectors[inst_num]; -} -# endif -#endif - -#if !defined(__DOXYGEN__) -uint8_t _adc_get_inst_index( - Adc *const hw); -#endif - -/** - * \name Driver Initialization and Configuration - * @{ - */ -enum status_code adc_init( - struct adc_module *const module_inst, - Adc *hw, - struct adc_config *config); - -void adc_get_config_defaults( - struct adc_config *const config); - -#if (SAMD) || (SAMR21) -void adc_regular_ain_channel( - uint32_t *pin_array, uint8_t size); -#endif - -/** @} */ - -/** - * \name Status Management - * @{ - */ - -/** - * \brief Retrieves the current module status. - * - * Retrieves the status of the module, giving overall state information. - * - * \param[in] module_inst Pointer to the ADC software instance struct - * - * \return Bitmask of \c ADC_STATUS_* flags. - * - * \retval ADC_STATUS_RESULT_READY ADC result is ready to be read - * \retval ADC_STATUS_WINDOW ADC has detected a value inside the set - * window range - * \retval ADC_STATUS_OVERRUN ADC result has overrun - */ -static inline uint32_t adc_get_status( - struct adc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - Adc *const adc_module = module_inst->hw; - - uint32_t int_flags = adc_module->INTFLAG.reg; - - uint32_t status_flags = 0; - - /* Check for ADC Result Ready */ - if (int_flags & ADC_INTFLAG_RESRDY) { - status_flags |= ADC_STATUS_RESULT_READY; - } - - /* Check for ADC Window Match */ - if (int_flags & ADC_INTFLAG_WINMON) { - status_flags |= ADC_STATUS_WINDOW; - } - - /* Check for ADC Overrun */ - if (int_flags & ADC_INTFLAG_OVERRUN) { - status_flags |= ADC_STATUS_OVERRUN; - } - - return status_flags; -} - -/** - * \brief Clears a module status flag. - * - * Clears the given status flag of the module. - * - * \param[in] module_inst Pointer to the ADC software instance struct - * \param[in] status_flags Bitmask of \c ADC_STATUS_* flags to clear - */ -static inline void adc_clear_status( - struct adc_module *const module_inst, - const uint32_t status_flags) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - Adc *const adc_module = module_inst->hw; - - uint32_t int_flags = 0; - - /* Check for ADC Result Ready */ - if (status_flags & ADC_STATUS_RESULT_READY) { - int_flags |= ADC_INTFLAG_RESRDY; - } - - /* Check for ADC Window Match */ - if (status_flags & ADC_STATUS_WINDOW) { - int_flags |= ADC_INTFLAG_WINMON; - } - - /* Check for ADC Overrun */ - if (status_flags & ADC_STATUS_OVERRUN) { - int_flags |= ADC_INTFLAG_OVERRUN; - } - - /* Clear interrupt flag */ - adc_module->INTFLAG.reg = int_flags; -} -/** @} */ - -/** - * \name Enable, Disable, and Reset ADC Module, Start Conversion and Read Result - * @{ - */ - -/** - * \brief Enables the ADC module. - * - * Enables an ADC module that has previously been configured. If any internal reference - * is selected it will be enabled. - * - * \param[in] module_inst Pointer to the ADC software instance struct - */ -static inline enum status_code adc_enable( - struct adc_module *const module_inst) -{ - Assert(module_inst); - Assert(module_inst->hw); - - Adc *const adc_module = module_inst->hw; - - while (adc_is_syncing(module_inst)) { - /* Wait for synchronization */ - } - -#if ADC_CALLBACK_MODE == true -# if (ADC_INST_NUM > 1) - system_interrupt_enable(_adc_interrupt_get_interrupt_vector( - _adc_get_inst_index(adc_module))); -# elif (SAMC20) - system_interrupt_enable(SYSTEM_INTERRUPT_MODULE_ADC0); -# else - system_interrupt_enable(SYSTEM_INTERRUPT_MODULE_ADC); -# endif -#endif - - /* Disbale interrupt */ - adc_module->INTENCLR.reg = ADC_INTENCLR_MASK; - /* Clear interrupt flag */ - adc_module->INTFLAG.reg = ADC_INTFLAG_MASK; - - adc_module->CTRLA.reg |= ADC_CTRLA_ENABLE; - - while (adc_is_syncing(module_inst)) { - /* Wait for synchronization */ - } - return STATUS_OK; -} - -/** - * \brief Disables the ADC module. - * - * Disables an ADC module that was previously enabled. - * - * \param[in] module_inst Pointer to the ADC software instance struct - */ -static inline enum status_code adc_disable( - struct adc_module *const module_inst) -{ - Assert(module_inst); - Assert(module_inst->hw); - - Adc *const adc_module = module_inst->hw; - -#if ADC_CALLBACK_MODE == true -# if (ADC_INST_NUM > 1) - system_interrupt_disable(_adc_interrupt_get_interrupt_vector( - _adc_get_inst_index(adc_module))); -# elif (SAMC20) - system_interrupt_disable(SYSTEM_INTERRUPT_MODULE_ADC0); -# else - system_interrupt_disable(SYSTEM_INTERRUPT_MODULE_ADC); -# endif -#endif - - while (adc_is_syncing(module_inst)) { - /* Wait for synchronization */ - } - - /* Disbale interrupt */ - adc_module->INTENCLR.reg = ADC_INTENCLR_MASK; - /* Clear interrupt flag */ - adc_module->INTFLAG.reg = ADC_INTFLAG_MASK; - - adc_module->CTRLA.reg &= ~ADC_CTRLA_ENABLE; - - while (adc_is_syncing(module_inst)) { - /* Wait for synchronization */ - } - return STATUS_OK; -} - -/** - * \brief Resets the ADC module. - * - * Resets an ADC module, clearing all module state, and registers to their - * default values. - * - * \param[in] module_inst Pointer to the ADC software instance struct - */ -static inline enum status_code adc_reset( - struct adc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - Adc *const adc_module = module_inst->hw; - - /* Disable to make sure the pipeline is flushed before reset */ - adc_disable(module_inst); - - /* Software reset the module */ - adc_module->CTRLA.reg |= ADC_CTRLA_SWRST; - - while (adc_is_syncing(module_inst)) { - /* Wait for synchronization */ - } - return STATUS_OK; -} - - -/** - * \brief Enables an ADC event input or output. - * - * Enables one or more input or output events to or from the ADC module. See - * \ref adc_events "Struct adc_events" for a list of events this module supports. - * - * \note Events cannot be altered while the module is enabled. - * - * \param[in] module_inst Software instance for the ADC peripheral - * \param[in] events Struct containing flags of events to enable - */ -static inline void adc_enable_events( - struct adc_module *const module_inst, - struct adc_events *const events) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - Assert(events); - - Adc *const adc_module = module_inst->hw; - - uint32_t event_mask = 0; - - /* Configure Window Monitor event */ - if (events->generate_event_on_window_monitor) { - event_mask |= ADC_EVCTRL_WINMONEO; - } - - /* Configure Result Ready event */ - if (events->generate_event_on_conversion_done) { - event_mask |= ADC_EVCTRL_RESRDYEO; - } - - adc_module->EVCTRL.reg |= event_mask; -} - -/** - * \brief Disables an ADC event input or output. - * - * Disables one or more input or output events to or from the ADC module. See - * \ref adc_events "Struct adc_events" for a list of events this module supports. - * - * \note Events cannot be altered while the module is enabled. - * - * \param[in] module_inst Software instance for the ADC peripheral - * \param[in] events Struct containing flags of events to disable - */ -static inline void adc_disable_events( - struct adc_module *const module_inst, - struct adc_events *const events) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - Assert(events); - - Adc *const adc_module = module_inst->hw; - - uint32_t event_mask = 0; - - /* Configure Window Monitor event */ - if (events->generate_event_on_window_monitor) { - event_mask |= ADC_EVCTRL_WINMONEO; - } - - /* Configure Result Ready event */ - if (events->generate_event_on_conversion_done) { - event_mask |= ADC_EVCTRL_RESRDYEO; - } - - adc_module->EVCTRL.reg &= ~event_mask; -} - -/** - * \brief Starts an ADC conversion. - * - * Starts a new ADC conversion. - * - * \param[in] module_inst Pointer to the ADC software instance struct - */ -static inline void adc_start_conversion( - struct adc_module *const module_inst) -{ - Assert(module_inst); - Assert(module_inst->hw); - - Adc *const adc_module = module_inst->hw; - - while (adc_is_syncing(module_inst)) { - /* Wait for synchronization */ - } - - adc_module->SWTRIG.reg |= ADC_SWTRIG_START; - - while (adc_is_syncing(module_inst)) { - /* Wait for synchronization */ - } -} - -/** - * \brief Reads the ADC result. - * - * Reads the result from an ADC conversion that was previously started. - * - * \param[in] module_inst Pointer to the ADC software instance struct - * \param[out] result Pointer to store the result value in - * - * \return Status of the ADC read request. - * \retval STATUS_OK The result was retrieved successfully - * \retval STATUS_BUSY A conversion result was not ready - * \retval STATUS_ERR_OVERFLOW The result register has been overwritten by the - * ADC module before the result was read by the software - */ -static inline enum status_code adc_read( - struct adc_module *const module_inst, - uint16_t *result) -{ - Assert(module_inst); - Assert(module_inst->hw); - Assert(result); - - if (!(adc_get_status(module_inst) & ADC_STATUS_RESULT_READY)) { - /* Result not ready */ - return STATUS_BUSY; - } - - Adc *const adc_module = module_inst->hw; - -#if (SAMD) || (SAMR21) - while (adc_is_syncing(module_inst)) { - /* Wait for synchronization */ - } -#endif - - /* Get ADC result */ - *result = adc_module->RESULT.reg; - - /* Reset ready flag */ - adc_clear_status(module_inst, ADC_STATUS_RESULT_READY); - - if (adc_get_status(module_inst) & ADC_STATUS_OVERRUN) { - adc_clear_status(module_inst, ADC_STATUS_OVERRUN); - return STATUS_ERR_OVERFLOW; - } - - return STATUS_OK; -} - -/** @} */ - -/** - * \name Runtime Changes of ADC Module - * @{ - */ - -/** - * \brief Flushes the ADC pipeline. - * - * Flushes the pipeline and restarts the ADC clock on the next peripheral clock - * edge. All conversions in progress will be lost. When flush is complete, the - * module will resume where it left off. - * - * \param[in] module_inst Pointer to the ADC software instance struct - */ -static inline void adc_flush( - struct adc_module *const module_inst) -{ - Assert(module_inst); - Assert(module_inst->hw); - - Adc *const adc_module = module_inst->hw; - - while (adc_is_syncing(module_inst)) { - /* Wait for synchronization */ - } - - adc_module->SWTRIG.reg |= ADC_SWTRIG_FLUSH; - - while (adc_is_syncing(module_inst)) { - /* Wait for synchronization */ - } -} -void adc_set_window_mode( - struct adc_module *const module_inst, - const enum adc_window_mode window_mode, - const int16_t window_lower_value, - const int16_t window_upper_value); - -/** - * \brief Sets positive ADC input pin. - * - * Sets the positive ADC input pin selection. - * - * \param[in] module_inst Pointer to the ADC software instance struct - * \param[in] positive_input Positive input pin - */ -static inline void adc_set_positive_input( - struct adc_module *const module_inst, - const enum adc_positive_input positive_input) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - Adc *const adc_module = module_inst->hw; - - while (adc_is_syncing(module_inst)) { - /* Wait for synchronization */ - } - - /* Set positive input pin */ - adc_module->INPUTCTRL.reg = - (adc_module->INPUTCTRL.reg & ~ADC_INPUTCTRL_MUXPOS_Msk) | - (positive_input); - - while (adc_is_syncing(module_inst)) { - /* Wait for synchronization */ - } -} - - -/** - * \brief Sets negative ADC input pin for differential mode. - * - * Sets the negative ADC input pin, when the ADC is configured in differential - * mode. - * - * \param[in] module_inst Pointer to the ADC software instance struct - * \param[in] negative_input Negative input pin - */ -static inline void adc_set_negative_input( - struct adc_module *const module_inst, - const enum adc_negative_input negative_input) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - Adc *const adc_module = module_inst->hw; - - while (adc_is_syncing(module_inst)) { - /* Wait for synchronization */ - } - - /* Set negative input pin */ - adc_module->INPUTCTRL.reg = - (adc_module->INPUTCTRL.reg & ~ADC_INPUTCTRL_MUXNEG_Msk) | - (negative_input); - - while (adc_is_syncing(module_inst)) { - /* Wait for synchronization */ - } -} - -/** @} */ - -#if ADC_CALLBACK_MODE == true -/** - * \name Enable and Disable Interrupts - * @{ - */ - -/** - * \brief Enable interrupt. - * - * Enable the given interrupt request from the ADC module. - * - * \param[in] module_inst Pointer to the ADC software instance struct - * \param[in] interrupt Interrupt to enable - */ -static inline void adc_enable_interrupt(struct adc_module *const module_inst, - enum adc_interrupt_flag interrupt) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - Adc *const adc_module = module_inst->hw; - /* Enable interrupt */ - adc_module->INTENSET.reg = interrupt; -} - -/** - * \brief Disable interrupt. - * - * Disable the given interrupt request from the ADC module. - * - * \param[in] module_inst Pointer to the ADC software instance struct - * \param[in] interrupt Interrupt to disable - */ -static inline void adc_disable_interrupt(struct adc_module *const module_inst, - enum adc_interrupt_flag interrupt) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - Adc *const adc_module = module_inst->hw; - /* Enable interrupt */ - adc_module->INTENCLR.reg = interrupt; -} - -/** @} */ -#endif /* ADC_CALLBACK_MODE == true */ - -#ifdef __cplusplus -} -#endif - -/** @} */ - - -/** - * \page asfdoc_sam0_adc_extra Extra Information for ADC Driver - * - * \section asfdoc_sam0_adc_extra_acronyms Acronyms - * Below is a table listing the acronyms used in this module, along with their - * intended meanings. - * - * <table> - * <tr> - * <th>Acronym</th> - * <th>Description</th> - * </tr> - * <tr> - * <td>ADC</td> - * <td>Analog-to-Digital Converter</td> - * </tr> - * <tr> - * <td>DAC</td> - * <td>Digital-to-Analog Converter</td> - * </tr> - * <tr> - * <td>LSB</td> - * <td>Least Significant Bit</td> - * </tr> - * <tr> - * <td>MSB</td> - * <td>Most Significant Bit</td> - * </tr> - * <tr> - * <td>DMA</td> - * <td>Direct Memory Access</td> - * </tr> - * </table> - * - * - * \section asfdoc_sam0_adc_extra_dependencies Dependencies - * This driver has the following dependencies: - * - * - \ref asfdoc_sam0_system_pinmux_group "System Pin Multiplexer Driver" - * - * - * \section asfdoc_sam0_adc_extra_errata Errata - * There are no errata related to this driver. - * - * - * \section asfdoc_sam0_adc_extra_history Module History - * An overview of the module history is presented in the table below, with - * details on the enhancements and fixes made to the module since its first - * release. The current version of this corresponds to the newest version in - * the table. - * - * <table> - * <tr> - * <th>Changelog</th> - * </tr> - * \if DEVICE_SAML21_SUPPORT - * <tr> - * <td>Initial Release</td> - * </tr> - * \else - * <tr> - * <td>Added support for SAM R21</td> - * </tr> - * <tr> - * <td>Added support for SAM D21 and new DMA quick start guide</td> - * </tr> - * <tr> - * <td>Added ADC calibration constant loading from the device signature - * row when the module is initialized</td> - * </tr> - * <tr> - * <td>Initial Release</td> - * </tr> - * \endif - * </table> - */ - -/** - * \page asfdoc_sam0_adc_exqsg Examples for ADC Driver - * - * This is a list of the available Quick Start guides (QSGs) and example - * applications for \ref asfdoc_sam0_adc_group. QSGs are simple examples with - * step-by-step instructions to configure and use this driver in a selection of - * use cases. Note that a QSG can be compiled as a standalone application or be - * added to the user application. - * - * - \subpage asfdoc_sam0_adc_basic_use_case - * \if ADC_CALLBACK_MODE - * - \subpage asfdoc_sam0_adc_basic_use_case_callback - * \endif - * - \subpage asfdoc_sam0_adc_dma_use_case - * - * \page asfdoc_sam0_adc_document_revision_history Document Revision History - * - * <table> - * <tr> - * <th>Doc. Rev.</th> - * <th>Date</th> - * <th>Comments</th> - * </tr> - * \if DEVICE_SAML21_SUPPORT - * <tr> - * <td>42451B</td> - * <td>12/2015</td> - * <td>Added support for SAM L22</td> - * </tr> - * <tr> - * <td>42451A</td> - * <td>07/2015</td> - * <td>Initial document release</td> - * </tr> - * \else - * <tr> - * <td>42109E</td> - * <td>12/2015</td> - * <td>Added support for SAM DA1 and SAM D09</td> - * </tr> - * <tr> - * <td>42109D</td> - * <td>12/2014</td> - * <td>Added support for SAM R21 and SAM D10/D11</td> - * </tr> - * <tr> - * <td>42109C</td> - * <td>01/2014</td> - * <td>Added support for SAM D21</td> - * </tr> - * <tr> - * <td>42109B</td> - * <td>06/2013</td> - * <td>Added additional documentation on the event system. Corrected - * documentation typos.</td> - * </tr> - * <tr> - * <td>42109A</td> - * <td>06/2013</td> - * <td>Initial release</td> - * </tr> - * \endif - * </table> - */ - -#endif /* ADC_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/adc/adc_callback.h b/atmel-samd/asf/sam0/drivers/adc/adc_callback.h deleted file mode 100644 index f6b30e86e..000000000 --- a/atmel-samd/asf/sam0/drivers/adc/adc_callback.h +++ /dev/null @@ -1,182 +0,0 @@ -/** - * \file - * - * \brief SAM Peripheral Analog-to-Digital Converter Driver - * - * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef ADC_CALLBACK_H_INCLUDED -#define ADC_CALLBACK_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \addtogroup asfdoc_sam0_adc_group - * - * @{ - */ - -#include <adc.h> - -/** - * Enum for the possible types of ADC asynchronous jobs that may be issued to - * the driver. - */ -enum adc_job_type { - /** Asynchronous ADC read into a user provided buffer */ - ADC_JOB_READ_BUFFER, -}; - -/** - * \name Callback Management - * @{ - */ -void adc_register_callback( - struct adc_module *const module, - adc_callback_t callback_func, - enum adc_callback callback_type); - -void adc_unregister_callback( - struct adc_module *module, - enum adc_callback callback_type); - -/** - * \brief Enables callback. - * - * Enables the callback function registered by \ref - * adc_register_callback. The callback function will be called from the - * interrupt handler when the conditions for the callback type are met. - * - * \param[in] module Pointer to ADC software instance struct - * \param[in] callback_type Callback type given by an enum - * - * \return Status of the operation. - * \retval STATUS_OK If operation was completed - * \retval STATUS_ERR_INVALID If operation was not completed, - * due to invalid callback_type - * - */ -static inline void adc_enable_callback( - struct adc_module *const module, - enum adc_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module); - - /* Enable callback */ - module->enabled_callback_mask |= (1 << callback_type); - - /* Enable window interrupt if this is a window callback */ - if (callback_type == ADC_CALLBACK_WINDOW) { - adc_enable_interrupt(module, ADC_INTERRUPT_WINDOW); - } - /* Enable overrun interrupt if error callback is registered */ - if (callback_type == ADC_CALLBACK_ERROR) { - adc_enable_interrupt(module, ADC_INTERRUPT_OVERRUN); - } -} - -/** - * \brief Disables callback. - * - * Disables the callback function registered by the \ref - * adc_register_callback. - * - * \param[in] module Pointer to ADC software instance struct - * \param[in] callback_type Callback type given by an enum - * - * \return Status of the operation. - * \retval STATUS_OK If operation was completed - * \retval STATUS_ERR_INVALID If operation was not completed, - * due to invalid callback_type - * - */ -static inline void adc_disable_callback( - struct adc_module *const module, - enum adc_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module); - - /* Disable callback */ - module->enabled_callback_mask &= ~(1 << callback_type); - - /* Disable window interrupt if this is a window callback */ - if (callback_type == ADC_CALLBACK_WINDOW) { - adc_disable_interrupt(module, ADC_INTERRUPT_WINDOW); - } - /* Disable overrun interrupt if this is the error callback */ - if (callback_type == ADC_CALLBACK_ERROR) { - adc_disable_interrupt(module, ADC_INTERRUPT_OVERRUN); - } -} - -/** @} */ - - -/** - * \name Job Management - * @{ - */ -enum status_code adc_read_buffer_job( - struct adc_module *const module_inst, - uint16_t *buffer, - uint16_t samples); - -enum status_code adc_get_job_status( - struct adc_module *module_inst, - enum adc_job_type type); - -void adc_abort_job( - struct adc_module *module_inst, - enum adc_job_type type); -/** @} */ - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* ADC_CALLBACK_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/adc/adc_sam_b.h b/atmel-samd/asf/sam0/drivers/adc/adc_sam_b.h deleted file mode 100644 index 5323ad92a..000000000 --- a/atmel-samd/asf/sam0/drivers/adc/adc_sam_b.h +++ /dev/null @@ -1,426 +0,0 @@ -/** - * \file - * - * \brief SAMB Peripheral Analog-to-Digital Converter Driver - * - * Copyright (C) 2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef ADC_SAM_B_H_INCLUDED -#define ADC_SAM_B_H_INCLUDED - -/** - * \defgroup asfdoc_samb_adc_group SAM Analog-to-Digital Converter (ADC) Driver - * - * This driver for Atmel® | SMART SAM devices provides an interface for the - * configuration and management of the device's Analog-to-Digital Converter - * functionality, for the conversion of analog voltages into a corresponding - * digital form. - * - * The following peripheral is used by this module: - * - ADC (Analog-to-Digital Converter) - * - * The following devices can use this module: - * - Atmel | SMART SAM B11 - * - * The outline of this documentation is as follows: - * - \ref asfdoc_samb_adc_prerequisites - * - \ref asfdoc_samb_adc_module_overview - * - \ref asfdoc_samb_adc_special_considerations - * - \ref asfdoc_samb_adc_extra_info - * - \ref asfdoc_samb_adc_examples - * - \ref asfdoc_samb_adc_api_overview - * - * - * \section asfdoc_samb_adc_prerequisites Prerequisites - * - * There are no prerequisites for this module. - * - * - * \section asfdoc_samb_adc_module_overview Module Overview - * - * This driver provides an interface for the Analog-to-Digital conversion - * functions on the device, to convert analog voltages to a corresponding - * digital value. The ADC has up to 12-bit resolution. - * - * \subsection asfdoc_samb_adc_module_overview_prescaler Sample Clock Prescaler - * \f[ - * F_{clk} = N + 2 \times {(throughput\_frequency)} - * \f] - * \f[ - * (N = ADC resolution) - * \f] - * - * Example: For throughput of 100KS/s use sampling clock (Fclk=1.3MHz) - * - * \subsection asfdoc_samb_adc_module_overview_resolution ADC Resolution - * There are two ADC resolution of operation: - * - \b High Resolution (11-bit) - * - * Set the reference voltage to half the supply voltage or below. In this - * mode the input signal dynamic range equals twice the reference voltage. - * - * Example: If supply voltage =3V and reference voltage= 1.4V, input signal - * dynamic range can be from ground to 2*reference voltage (0~2.8V). - * - \b Medium Resolution (10-bit) - * - * Set the reference voltage to any value below supply voltage (up to - * supply voltage - 300mV) and in this condition the input dynamic range is - * from zero to reference voltage. - * - * Example: If supply voltage =3V and reference voltage= 2.7V, input signal - * dynamic range can be from ground to reference voltage (0~2.7V). - * - * \subsection asfdoc_samb_adc_module_overview_conversion Channel Modes - * There are two modes for input channel selection: - * - Either to assign a specific input channel - * - Time domain multiplexing between 4 input channels - * - Channel1 to channel4 - * - channel5 to channel8 - * - * \section asfdoc_samb_adc_special_considerations Special Considerations - * An integrated analog temperature sensor is available for use with the ADC. - * The internal specific voltage can also be measured by the ADC. For internal - * ADC inputs, the internal source(s) may need to be manually enabled by the - * user application before they can be measured. - * - * - * \section asfdoc_samb_adc_extra_info Extra Information - * - * For extra information, see \ref asfdoc_samb_adc_extra. This includes: - * - \ref asfdoc_samb_adc_extra_acronyms - * - \ref asfdoc_samb_adc_extra_dependencies - * - \ref asfdoc_samb_adc_extra_errata - * - \ref asfdoc_samb_adc_extra_history - * - * - * \section asfdoc_samb_adc_examples Examples - * - * For a list of examples related to this driver, see - * \ref asfdoc_samb_adc_exqsg. - * - * - * \section asfdoc_samb_adc_api_overview API Overview - * @{ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include <compiler.h> -#include <system_sam_b.h> - -/** - * \brief ADC internal reference voltage level enum - * - * Enum for the possible internal reference voltage level for the ADC. - * - */ -enum adc_internal_buf { - /** Internal buffer voltage level: 0.5V */ - ADC_INTERNAL_BUF_0_5 = 0, - /** Internal buffer voltage level: 0.6V */ - ADC_INTERNAL_BUF_0_6, - /** Internal buffer voltage level: 0.7V */ - ADC_INTERNAL_BUF_0_7, - /** Internal buffer voltage level: 0.8V */ - ADC_INTERNAL_BUF_0_8, - /** Internal buffer voltage level: 0.9V */ - ADC_INTERNAL_BUF_0_9, - /** Internal buffer voltage level: 1.0V */ - ADC_INTERNAL_BUF_1_0, - /** Internal buffer voltage level: 1.1V */ - ADC_INTERNAL_BUF_1_1, - /** Internal buffer voltage level: 1.2V */ - ADC_INTERNAL_BUF_1_2, - /** Internal buffer voltage level: 1.3V */ - ADC_INTERNAL_BUF_1_3, - /** Internal buffer voltage level: 1.4V */ - ADC_INTERNAL_BUF_1_4, - /** Internal buffer voltage level: 1.5V */ - ADC_INTERNAL_BUF_1_5, - /** Internal buffer voltage level: 1.6V */ - ADC_INTERNAL_BUF_1_6, - /** Internal buffer voltage level: 1.7V */ - ADC_INTERNAL_BUF_1_7, - /** Internal buffer voltage level: 1.8V */ - ADC_INTERNAL_BUF_1_8, - /** Internal buffer voltage level: 1.9V */ - ADC_INTERNAL_BUF_1_9, - /** Internal buffer voltage level: 2.0V */ - ADC_INTERNAL_BUF_2_0, -}; - -/** - * \brief ADC reference voltage enum - * - * Enum for the possible reference voltages for the ADC. - * - */ -enum adc_reference { - /** Internal form buffer reference */ - ADC_REFERENCE_INTERNAL_BUF = 0, - /** Internal from IxR reference */ - ADC_REFERENCE_INTERNAL_IR, - /** VBATT/2 reference */ - ADC_REFERENCE_VBATT_2, - /** GPIO_MS1 reference */ - ADC_REFERENCE_GPIO_MS1, - /** GPIO_MS2 reference */ - ADC_REFERENCE_GPIO_MS2, - /** GPIO_MS3 reference */ - ADC_REFERENCE_GPIO_MS3, - /** GPIO_MS4 reference */ - ADC_REFERENCE_GPIO_MS4, - /** VBATTERY reference */ - ADC_REFERENCE_VBATT, -}; - -/** - * \brief ADC input channel selection enum - * - * Enum for the possible input channel selections for the ADC. - * - */ -enum adc_input_channel { - /** GPIO_MS1 input */ - ADC_INPUT_CH_GPIO_MS1 = 0, - /** GPIO_MS2 input */ - ADC_INPUT_CH_GPIO_MS2, - /** GPIO_MS3 input */ - ADC_INPUT_CH_GPIO_MS3, - /** GPIO_MS4 input */ - ADC_INPUT_CH_GPIO_MS4, - /** On chip temperature measurement input */ - ADC_INPUT_CH_TEMPERATURE, - /** VBATT divided by 4 voltage level */ - ADC_INPUT_CH_VBATT_4, - /** LP_LDO_OUT_1P2 low power domain voltage */ - ADC_INPUT_CH_LPD0_LDO, - /** ADC reference voltage level */ - ADC_INPUT_CH_VREF, -}; - -/** - * \brief ADC input channel time multiplexing selection mode enum - * - * Enum for the possible channel time multiplexing mode for the ADC. - * - */ -enum adc_channel_mode { - /** - * Input channels time multiplexing is between channel 0 to channel 3. - * In this mode, ADC input channel selection is invalid. - */ - ADC_CH_MODE_CH0_TO_CH3, - /** - * Input channels time multiplexing is between channel 4 to channel 7. - * In this mode, ADC input channel selection is invalid. - */ - ADC_CH_MODE_CH4_TO_CH7, - /** Assign a specific input channel using \ref adc_input_channel */ - ADC_CH_MODE_ASSIGN, -}; - -/** - * \brief ADC input dynamic range selection enum - * - * Enum for the possible input dynamic range for the ADC. - * - */ -enum adc_input_dynamic_range{ - /** Input dynamic range from 0V to VBATT voltage level */ - ADC_INPUT_DYNAMIC_RANGE_0 = 0, - /** Input dynamic range from 0.08*VBATT to 0.92*VBATT voltage level */ - ADC_INPUT_DYNAMIC_RANGE_1, - /** Input dynamic range from 0.17*VBATT to 0.83*VBATT voltage level */ - ADC_INPUT_DYNAMIC_RANGE_2, - /** Input dynamic range from 0.25*VBATT to 0.75*VBATT voltage level */ - ADC_INPUT_DYNAMIC_RANGE_3, -}; - -/** - * \brief ADC comparator biasing current enum - * - * Enum for the possible comparator biasing current for the ADC different - * sampling rates. - * - */ -enum adc_bias_current { - /** Comparator bias current is 4uA for throughput 100KS/s */ - ADC_BIAS_CURRENT_0 = 0, - /** Comparator bias current is 8uA */ - ADC_BIAS_CURRENT_1, - /** Comparator bias current is 20uA */ - ADC_BIAS_CURRENT_2, - /** Comparator bias current is 24uA for throughput 1MS/s */ - ADC_BIAS_CURRENT_3, -}; - -/** - * \brief ADC configuration structure - * - * Configuration structure for an ADC instance. This structure should be - * initialized by the \ref adc_get_config_defaults() - * function before being modified by the user application. - */ -struct adc_config { - /** Voltage reference */ - enum adc_reference reference; - /** Internal reference voltage level */ - enum adc_internal_buf internal_vref; - /** Input channel */ - enum adc_input_channel input_channel; - /** Input channel selection */ - enum adc_channel_mode channel_mode; - /** Input channel time multiplexing selection mode */ - enum adc_input_dynamic_range input_dynamic_range; - /** Comparator biasing current selection */ - enum adc_bias_current bias_current; - /** Invert ADC Clock */ - bool invert_clock; - /** Fractional part for the clock divider */ - uint8_t frac_part; - /** Integer part for the clock divider */ - uint16_t int_part; -}; - -/** \name Configuration, initialization and get status - * @{ - */ -void adc_get_config_defaults(struct adc_config *const config); -void adc_init(struct adc_config *config); -uint32_t adc_get_status(void); -/** @}*/ - -/** \name Enable/Disable and Reset - * @{ - */ -void adc_enable(void); -void adc_disable(void); -void adc_reset(void); -/** @}*/ - -/** \name Read Result - * @{ - */ -enum status_code adc_read(enum adc_input_channel input_channel, uint16_t *result); -/** @}*/ - -/** @}*/ - -#ifdef __cplusplus -} -#endif - - -/** - * \page asfdoc_samb_adc_extra Extra Information for ADC Driver - * - * \section asfdoc_samb_adc_extra_acronyms Acronyms - * Below is a table listing the acronyms used in this module, along with their - * intended meanings. - * - * <table> - * <tr> - * <th>Acronym</th> - * <th>Description</th> - * </tr> - * <tr> - * <td>ADC</td> - * <td>Analog-to-Digital Converter</td> - * </tr> - * </table> - * - * - * \section asfdoc_samb_adc_extra_dependencies Dependencies - * There are no dependencies related to this driver. - * - * - * \section asfdoc_samb_adc_extra_errata Errata - * There are no errata related to this driver. - * - * - * \section asfdoc_samb_adc_extra_history Module History - * An overview of the module history is presented in the table below, with - * details on the enhancements and fixes made to the module since its first - * release. The current version of this corresponds to the newest version in - * the table. - * - * <table> - * <tr> - * <th>Changelog</th> - * </tr> - * <tr> - * <td>Initial Release</td> - * </tr> - * </table> - */ - -/** - * \page asfdoc_samb_adc_exqsg Examples for ADC Driver - * - * This is a list of the available Quick Start guides (QSGs) and example - * applications for \ref asfdoc_samb_adc_group. QSGs are simple examples with - * step-by-step instructions to configure and use this driver in a selection of - * use cases. Note that a QSG can be compiled as a standalone application or be - * added to the user application. - * - * - \subpage asfdoc_samb_adc_basic_use_case - * - * \page asfdoc_samb_adc_document_revision_history Document Revision History - * - * <table> - * <tr> - * <th>Doc. Rev.</td> - * <th>Date</td> - * <th>Comments</td> - * </tr> - * <tr> - * <td>A</td> - * <td>09/2015</td> - * <td>Initial document release</td> - * </tr> - * </table> - */ - -#endif /* ADC_SAM_B_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/adc/adc_sam_d_r/adc.c b/atmel-samd/asf/sam0/drivers/adc/adc_sam_d_r/adc.c deleted file mode 100644 index 1565c8625..000000000 --- a/atmel-samd/asf/sam0/drivers/adc/adc_sam_d_r/adc.c +++ /dev/null @@ -1,715 +0,0 @@ -/** - * \file - * - * \brief SAM Peripheral Analog-to-Digital Converter Driver - * - * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#include "asf/sam0/drivers/adc/adc.h" - -#if SAMD20 -/* The Die revision D number */ -#define REVISON_D_NUM 3 -#endif - -/** - * \brief Initializes an ADC configuration structure to defaults - * - * Initializes a given ADC configuration struct to a set of known default - * values. This function should be called on any new instance of the - * configuration struct before being modified by the user application. - * - * The default configuration is as follows: - * \li GCLK generator 0 (GCLK main) clock source - * \li 1V from internal bandgap reference - * \li Div 4 clock prescaler - * \li 12-bit resolution - * \li Window monitor disabled - * \li No gain - * \li Positive input on ADC PIN 0 - * \li Negative input on ADC PIN 1 - * \li Averaging disabled - * \li Oversampling disabled - * \li Right adjust data - * \li Single-ended mode - * \li Free running disabled - * \li All events (input and generation) disabled - * \li Sleep operation disabled - * \li No reference compensation - * \li No gain/offset correction - * \li No added sampling time - * \li Pin scan mode disabled - * - * \param[out] config Pointer to configuration struct to initialize to - * default values - */ -void adc_get_config_defaults(struct adc_config *const config) -{ - Assert(config); - config->clock_source = GCLK_GENERATOR_0; - config->reference = ADC_REFERENCE_INT1V; - config->clock_prescaler = ADC_CLOCK_PRESCALER_DIV4; - config->resolution = ADC_RESOLUTION_12BIT; - config->window.window_mode = ADC_WINDOW_MODE_DISABLE; - config->window.window_upper_value = 0; - config->window.window_lower_value = 0; - config->gain_factor = ADC_GAIN_FACTOR_1X; -#if SAMR21 - config->positive_input = ADC_POSITIVE_INPUT_PIN6 ; -#else - config->positive_input = ADC_POSITIVE_INPUT_PIN0 ; -#endif - config->negative_input = ADC_NEGATIVE_INPUT_GND ; - config->accumulate_samples = ADC_ACCUMULATE_DISABLE; - config->divide_result = ADC_DIVIDE_RESULT_DISABLE; - config->left_adjust = false; - config->differential_mode = false; - config->freerunning = false; - config->event_action = ADC_EVENT_ACTION_DISABLED; - config->run_in_standby = false; - config->reference_compensation_enable = false; - config->correction.correction_enable = false; - config->correction.gain_correction = ADC_GAINCORR_RESETVALUE; - config->correction.offset_correction = ADC_OFFSETCORR_RESETVALUE; - config->sample_length = 0; - config->pin_scan.offset_start_scan = 0; - config->pin_scan.inputs_to_scan = 0; -} - -/** - * \brief Sets the ADC window mode - * - * Sets the ADC window mode to a given mode and value range. - * - * \param[in] module_inst Pointer to the ADC software instance struct - * \param[in] window_mode Window monitor mode to set - * \param[in] window_lower_value Lower window monitor threshold value - * \param[in] window_upper_value Upper window monitor threshold value - */ -void adc_set_window_mode( - struct adc_module *const module_inst, - const enum adc_window_mode window_mode, - const int16_t window_lower_value, - const int16_t window_upper_value) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - Adc *const adc_module = module_inst->hw; - - while (adc_is_syncing(module_inst)) { - /* Wait for synchronization */ - } - - /* Set window mode */ - adc_module->WINCTRL.reg = window_mode << ADC_WINCTRL_WINMODE_Pos; - - while (adc_is_syncing(module_inst)) { - /* Wait for synchronization */ - } - - /* Set lower window monitor threshold value */ - adc_module->WINLT.reg = window_lower_value << ADC_WINLT_WINLT_Pos; - - while (adc_is_syncing(module_inst)) { - /* Wait for synchronization */ - } - - /* Set upper window monitor threshold value */ - adc_module->WINUT.reg = window_upper_value << ADC_WINUT_WINUT_Pos; -} - -/** -* \internal Configure MUX settings for the analog pins -* -* This function will set the given ADC input pins -* to the analog function in the pinmux, giving -* the ADC access to the analog signal -* -* \param [in] pin AINxx pin to configure -*/ -static inline void _adc_configure_ain_pin(uint32_t pin) -{ -#define PIN_INVALID_ADC_AIN 0xFFFFUL - - /* Pinmapping table for AINxx -> GPIO pin number */ - const uint32_t pinmapping[] = { -#if (SAMD20E) || (SAMD21E)|| (SAMDA1E) - PIN_PA02B_ADC_AIN0, PIN_PA03B_ADC_AIN1, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_PA04B_ADC_AIN4, PIN_PA05B_ADC_AIN5, - PIN_PA06B_ADC_AIN6, PIN_PA07B_ADC_AIN7, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_PA08B_ADC_AIN16, PIN_PA09B_ADC_AIN17, - PIN_PA10B_ADC_AIN18, PIN_PA11B_ADC_AIN19, -#elif (SAMD20G) || (SAMD21G)|| (SAMDA1G) - PIN_PA02B_ADC_AIN0, PIN_PA03B_ADC_AIN1, - PIN_PB08B_ADC_AIN2, PIN_PB09B_ADC_AIN3, - PIN_PA04B_ADC_AIN4, PIN_PA05B_ADC_AIN5, - PIN_PA06B_ADC_AIN6, PIN_PA07B_ADC_AIN7, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_PB02B_ADC_AIN10, PIN_PB03B_ADC_AIN11, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_PA08B_ADC_AIN16, PIN_PA09B_ADC_AIN17, - PIN_PA10B_ADC_AIN18, PIN_PA11B_ADC_AIN19, -#elif (SAMD20J) || (SAMD21J)|| (SAMDA1J) - PIN_PA02B_ADC_AIN0, PIN_PA03B_ADC_AIN1, - PIN_PB08B_ADC_AIN2, PIN_PB09B_ADC_AIN3, - PIN_PA04B_ADC_AIN4, PIN_PA05B_ADC_AIN5, - PIN_PA06B_ADC_AIN6, PIN_PA07B_ADC_AIN7, - PIN_PB00B_ADC_AIN8, PIN_PB01B_ADC_AIN9, - PIN_PB02B_ADC_AIN10, PIN_PB03B_ADC_AIN11, - PIN_PB04B_ADC_AIN12, PIN_PB05B_ADC_AIN13, - PIN_PB06B_ADC_AIN14, PIN_PB07B_ADC_AIN15, - PIN_PA08B_ADC_AIN16, PIN_PA09B_ADC_AIN17, - PIN_PA10B_ADC_AIN18, PIN_PA11B_ADC_AIN19, -#elif SAMR21E - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_PA06B_ADC_AIN6, PIN_PA07B_ADC_AIN7, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_PA08B_ADC_AIN16, PIN_PA09B_ADC_AIN17, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, -#elif SAMR21G - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_PA04B_ADC_AIN4, PIN_PA05B_ADC_AIN5, - PIN_PA06B_ADC_AIN6, PIN_PA07B_ADC_AIN7, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_PB02B_ADC_AIN10, PIN_PB03B_ADC_AIN11, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_PA08B_ADC_AIN16, PIN_PA09B_ADC_AIN17, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, -#elif (SAMD09C) || (SAMD10C) || (SAMD11C) - PIN_PA02B_ADC_AIN0, PIN_INVALID_ADC_AIN, - PIN_PA04B_ADC_AIN2, PIN_PA05B_ADC_AIN3, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_PA14B_ADC_AIN6, PIN_PA15B_ADC_AIN7, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, -#elif (SAMD09D) - PIN_PA02B_ADC_AIN0, PIN_PA03B_ADC_AIN1, - PIN_PA04B_ADC_AIN2, PIN_PA05B_ADC_AIN3, - PIN_PA06B_ADC_AIN4, PIN_PA07B_ADC_AIN5, - PIN_PA14B_ADC_AIN6, PIN_PA15B_ADC_AIN7, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, -#elif (SAMD10DS) || (SAMD10DU) || (SAMD11DS) || (SAMD11DU) - PIN_PA02B_ADC_AIN0, PIN_INVALID_ADC_AIN, - PIN_PA04B_ADC_AIN2, PIN_PA05B_ADC_AIN3, - PIN_PA06B_ADC_AIN4, PIN_PA07B_ADC_AIN5, - PIN_PA14B_ADC_AIN6, PIN_PA15B_ADC_AIN7, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, -#elif (SAMD10DM) || (SAMD11DM) - PIN_PA02B_ADC_AIN0, PIN_PA03B_ADC_AIN1, - PIN_PA04B_ADC_AIN2, PIN_PA05B_ADC_AIN3, - PIN_PA06B_ADC_AIN4, PIN_PA07B_ADC_AIN5, - PIN_PA14B_ADC_AIN6, PIN_PA15B_ADC_AIN7, - PIN_PA10B_ADC_AIN8, PIN_PA11B_ADC_AIN9, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, - PIN_INVALID_ADC_AIN, PIN_INVALID_ADC_AIN, -#else -# error ADC pin mappings are not defined for this device. -#endif - }; - - uint32_t pin_map_result = PIN_INVALID_ADC_AIN; - - if (pin <= ADC_EXTCHANNEL_MSB) { - pin_map_result = pinmapping[pin >> ADC_INPUTCTRL_MUXPOS_Pos]; - - Assert(pin_map_result != PIN_INVALID_ADC_AIN); - - struct system_pinmux_config config; - system_pinmux_get_config_defaults(&config); - - /* Analog functions are all on MUX setting B */ - config.input_pull = SYSTEM_PINMUX_PIN_PULL_NONE; - config.mux_position = 1; - - system_pinmux_pin_set_config(pin_map_result, &config); - } -} - -/** - * \internal Writes an ADC configuration to the hardware module - * - * Writes out a given ADC module configuration to the hardware module. - * - * \param[out] module_inst Pointer to the ADC software instance struct - * \param[in] config Pointer to configuration struct - * - * \return Status of the configuration procedure - * \retval STATUS_OK The configuration was successful - * \retval STATUS_ERR_INVALID_ARG Invalid argument(s) were provided - */ -static enum status_code _adc_set_config( - struct adc_module *const module_inst, - struct adc_config *const config) -{ - uint8_t adjres = 0; - uint32_t resolution = ADC_RESOLUTION_16BIT; - enum adc_accumulate_samples accumulate = ADC_ACCUMULATE_DISABLE; -#if SAMD20 - uint8_t revision_num = ((REG_DSU_DID & DSU_DID_DIE_Msk) >> DSU_DID_DIE_Pos); -#endif - - /* Get the hardware module pointer */ - Adc *const adc_module = module_inst->hw; - - /* Configure GCLK channel and enable clock */ - struct system_gclk_chan_config gclk_chan_conf; - system_gclk_chan_get_config_defaults(&gclk_chan_conf); - gclk_chan_conf.source_generator = config->clock_source; - system_gclk_chan_set_config(ADC_GCLK_ID, &gclk_chan_conf); - system_gclk_chan_enable(ADC_GCLK_ID); - - /* Setup pinmuxing for analog inputs */ - if (config->pin_scan.inputs_to_scan != 0) { - uint8_t offset = config->pin_scan.offset_start_scan; - uint8_t start_pin = - offset +(uint8_t)config->positive_input; - uint8_t end_pin = - start_pin + config->pin_scan.inputs_to_scan; - - while (start_pin < end_pin) { - _adc_configure_ain_pin((offset % 16)+(uint8_t)config->positive_input); - start_pin++; - offset++; - } - _adc_configure_ain_pin(config->negative_input); - } else { - _adc_configure_ain_pin(config->positive_input); - _adc_configure_ain_pin(config->negative_input); - } - - /* Configure run in standby */ - adc_module->CTRLA.reg = (config->run_in_standby << ADC_CTRLA_RUNSTDBY_Pos); - - /* Configure reference */ - adc_module->REFCTRL.reg = - (config->reference_compensation_enable << ADC_REFCTRL_REFCOMP_Pos) | - (config->reference); - - /* Set adjusting result and number of samples */ - switch (config->resolution) { - - case ADC_RESOLUTION_CUSTOM: - adjres = config->divide_result; - accumulate = config->accumulate_samples; - /* 16-bit result register */ - resolution = ADC_RESOLUTION_16BIT; - break; - - case ADC_RESOLUTION_13BIT: - /* Increase resolution by 1 bit */ - adjres = ADC_DIVIDE_RESULT_2; - accumulate = ADC_ACCUMULATE_SAMPLES_4; - /* 16-bit result register */ - resolution = ADC_RESOLUTION_16BIT; - break; - - case ADC_RESOLUTION_14BIT: - /* Increase resolution by 2 bit */ - adjres = ADC_DIVIDE_RESULT_4; - accumulate = ADC_ACCUMULATE_SAMPLES_16; - /* 16-bit result register */ - resolution = ADC_RESOLUTION_16BIT; - break; -#if SAMD20 - /* See $35.1.8 for ADC errata of SAM D20. - The revisions before D have this issue.*/ - case ADC_RESOLUTION_15BIT: - /* Increase resolution by 3 bit */ - if(revision_num < REVISON_D_NUM) { - adjres = ADC_DIVIDE_RESULT_8; - } else { - adjres = ADC_DIVIDE_RESULT_2; - } - accumulate = ADC_ACCUMULATE_SAMPLES_64; - /* 16-bit result register */ - resolution = ADC_RESOLUTION_16BIT; - break; - - case ADC_RESOLUTION_16BIT: - if(revision_num < REVISON_D_NUM) { - /* Increase resolution by 4 bit */ - adjres = ADC_DIVIDE_RESULT_16; - } else { - adjres = ADC_DIVIDE_RESULT_DISABLE; - } - accumulate = ADC_ACCUMULATE_SAMPLES_256; - /* 16-bit result register */ - resolution = ADC_RESOLUTION_16BIT; - break; -#else - case ADC_RESOLUTION_15BIT: - /* Increase resolution by 3 bit */ - adjres = ADC_DIVIDE_RESULT_2; - accumulate = ADC_ACCUMULATE_SAMPLES_64; - /* 16-bit result register */ - resolution = ADC_RESOLUTION_16BIT; - break; - - case ADC_RESOLUTION_16BIT: - /* Increase resolution by 4 bit */ - adjres = ADC_DIVIDE_RESULT_DISABLE; - accumulate = ADC_ACCUMULATE_SAMPLES_256; - /* 16-bit result register */ - resolution = ADC_RESOLUTION_16BIT; - break; -#endif - case ADC_RESOLUTION_8BIT: - /* 8-bit result register */ - resolution = ADC_RESOLUTION_8BIT; - break; - case ADC_RESOLUTION_10BIT: - /* 10-bit result register */ - resolution = ADC_RESOLUTION_10BIT; - break; - case ADC_RESOLUTION_12BIT: - /* 12-bit result register */ - resolution = ADC_RESOLUTION_12BIT; - break; - - default: - /* Unknown. Abort. */ - return STATUS_ERR_INVALID_ARG; - } - - adc_module->AVGCTRL.reg = ADC_AVGCTRL_ADJRES(adjres) | accumulate; - - /* Check validity of sample length value */ - if (config->sample_length > 63) { - return STATUS_ERR_INVALID_ARG; - } else { - /* Configure sample length */ - adc_module->SAMPCTRL.reg = - (config->sample_length << ADC_SAMPCTRL_SAMPLEN_Pos); - } - - while (adc_is_syncing(module_inst)) { - /* Wait for synchronization */ - } - - /* Configure CTRLB */ - adc_module->CTRLB.reg = - config->clock_prescaler | - resolution | - (config->correction.correction_enable << ADC_CTRLB_CORREN_Pos) | - (config->freerunning << ADC_CTRLB_FREERUN_Pos) | - (config->left_adjust << ADC_CTRLB_LEFTADJ_Pos) | - (config->differential_mode << ADC_CTRLB_DIFFMODE_Pos); - - /* Check validity of window thresholds */ - if (config->window.window_mode != ADC_WINDOW_MODE_DISABLE) { - switch (resolution) { - case ADC_RESOLUTION_8BIT: - if (config->differential_mode && - (config->window.window_lower_value > 127 || - config->window.window_lower_value < -128 || - config->window.window_upper_value > 127 || - config->window.window_upper_value < -128)) { - /* Invalid value */ - return STATUS_ERR_INVALID_ARG; - } else if (config->window.window_lower_value > 255 || - config->window.window_upper_value > 255){ - /* Invalid value */ - return STATUS_ERR_INVALID_ARG; - } - break; - case ADC_RESOLUTION_10BIT: - if (config->differential_mode && - (config->window.window_lower_value > 511 || - config->window.window_lower_value < -512 || - config->window.window_upper_value > 511 || - config->window.window_upper_value < -512)) { - /* Invalid value */ - return STATUS_ERR_INVALID_ARG; - } else if (config->window.window_lower_value > 1023 || - config->window.window_upper_value > 1023){ - /* Invalid value */ - return STATUS_ERR_INVALID_ARG; - } - break; - case ADC_RESOLUTION_12BIT: - if (config->differential_mode && - (config->window.window_lower_value > 2047 || - config->window.window_lower_value < -2048 || - config->window.window_upper_value > 2047 || - config->window.window_upper_value < -2048)) { - /* Invalid value */ - return STATUS_ERR_INVALID_ARG; - } else if (config->window.window_lower_value > 4095 || - config->window.window_upper_value > 4095){ - /* Invalid value */ - return STATUS_ERR_INVALID_ARG; - } - break; - case ADC_RESOLUTION_16BIT: - if (config->differential_mode && - (config->window.window_lower_value > 32767 || - config->window.window_lower_value < -32768 || - config->window.window_upper_value > 32767 || - config->window.window_upper_value < -32768)) { - /* Invalid value */ - return STATUS_ERR_INVALID_ARG; - } else if (config->window.window_lower_value > 65535 || - config->window.window_upper_value > 65535){ - /* Invalid value */ - return STATUS_ERR_INVALID_ARG; - } - break; - } - } - - while (adc_is_syncing(module_inst)) { - /* Wait for synchronization */ - } - - /* Configure window mode */ - adc_module->WINCTRL.reg = config->window.window_mode; - - while (adc_is_syncing(module_inst)) { - /* Wait for synchronization */ - } - - /* Configure lower threshold */ - adc_module->WINLT.reg = - config->window.window_lower_value << ADC_WINLT_WINLT_Pos; - - while (adc_is_syncing(module_inst)) { - /* Wait for synchronization */ - } - - /* Configure lower threshold */ - adc_module->WINUT.reg = config->window.window_upper_value << - ADC_WINUT_WINUT_Pos; - - uint8_t inputs_to_scan = config->pin_scan.inputs_to_scan; - if (inputs_to_scan > 0) { - /* - * Number of input sources included is the value written to INPUTSCAN - * plus 1. - */ - inputs_to_scan--; - } - - if (inputs_to_scan > (ADC_INPUTCTRL_INPUTSCAN_Msk >> ADC_INPUTCTRL_INPUTSCAN_Pos) || - config->pin_scan.offset_start_scan > (ADC_INPUTCTRL_INPUTOFFSET_Msk >> ADC_INPUTCTRL_INPUTOFFSET_Pos)) { - /* Invalid number of input pins or input offset */ - return STATUS_ERR_INVALID_ARG; - } - - while (adc_is_syncing(module_inst)) { - /* Wait for synchronization */ - } - - /* Configure pin scan mode and positive and negative input pins */ - adc_module->INPUTCTRL.reg = - config->gain_factor | - (config->pin_scan.offset_start_scan << - ADC_INPUTCTRL_INPUTOFFSET_Pos) | - (inputs_to_scan << ADC_INPUTCTRL_INPUTSCAN_Pos) | - config->negative_input | - config->positive_input; - - /* Configure events */ - adc_module->EVCTRL.reg = config->event_action; - - /* Disable all interrupts */ - adc_module->INTENCLR.reg = - (1 << ADC_INTENCLR_SYNCRDY_Pos) | (1 << ADC_INTENCLR_WINMON_Pos) | - (1 << ADC_INTENCLR_OVERRUN_Pos) | (1 << ADC_INTENCLR_RESRDY_Pos); - - if (config->correction.correction_enable){ - /* Make sure gain_correction value is valid */ - if (config->correction.gain_correction > ADC_GAINCORR_GAINCORR_Msk) { - return STATUS_ERR_INVALID_ARG; - } else { - /* Set gain correction value */ - adc_module->GAINCORR.reg = config->correction.gain_correction << - ADC_GAINCORR_GAINCORR_Pos; - } - - /* Make sure offset correction value is valid */ - if (config->correction.offset_correction > 2047 || - config->correction.offset_correction < -2048) { - return STATUS_ERR_INVALID_ARG; - } else { - /* Set offset correction value */ - adc_module->OFFSETCORR.reg = config->correction.offset_correction << - ADC_OFFSETCORR_OFFSETCORR_Pos; - } - } - - /* Load in the fixed device ADC calibration constants */ - adc_module->CALIB.reg = - ADC_CALIB_BIAS_CAL( - (*(uint32_t *)ADC_FUSES_BIASCAL_ADDR >> ADC_FUSES_BIASCAL_Pos) - ) | - ADC_CALIB_LINEARITY_CAL( - (*(uint64_t *)ADC_FUSES_LINEARITY_0_ADDR >> ADC_FUSES_LINEARITY_0_Pos) - ); - - return STATUS_OK; -} - -/** - * \brief Initializes the ADC channel sequence - * - * Like SAMD and SAMR21 the INPUTOFFSET register will be incremented one - * automatically after a conversion done, causing the next conversion - * to be done with the positive input equal to MUXPOS + INPUTOFFSET, - * it is scanning continuously one by one even ADC channels are not continuous. - * - * Initializes the ADC channel sequence by the sequence of pin_array. - * - * \param[in] pin_array The array of the Mux selection for the positive ADC input - * \param[in] size The size of pin_array - */ -void adc_regular_ain_channel(uint32_t *pin_array, uint8_t size) -{ - for (int i = 0; i < size; i++) { - _adc_configure_ain_pin(pin_array[i]); - } -} - -/** - * \brief Initializes the ADC - * - * Initializes the ADC device struct and the hardware module based on the - * given configuration struct values. - * - * \param[out] module_inst Pointer to the ADC software instance struct - * \param[in] hw Pointer to the ADC module instance - * \param[in] config Pointer to the configuration struct - * - * \return Status of the initialization procedure. - * \retval STATUS_OK The initialization was successful - * \retval STATUS_ERR_INVALID_ARG Invalid argument(s) were provided - * \retval STATUS_BUSY The module is busy with a reset operation - * \retval STATUS_ERR_DENIED The module is enabled - */ -enum status_code adc_init( - struct adc_module *const module_inst, - Adc *hw, - struct adc_config *config) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(hw); - Assert(config); - - /* Associate the software module instance with the hardware module */ - module_inst->hw = hw; - - /* Turn on the digital interface clock */ - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBC, PM_APBCMASK_ADC); - - if (hw->CTRLA.reg & ADC_CTRLA_SWRST) { - /* We are in the middle of a reset. Abort. */ - return STATUS_BUSY; - } - - if (hw->CTRLA.reg & ADC_CTRLA_ENABLE) { - /* Module must be disabled before initialization. Abort. */ - return STATUS_ERR_DENIED; - } - - /* Store the selected reference for later use */ - module_inst->reference = config->reference; - - /* Make sure bandgap is enabled if requested by the config */ - if (module_inst->reference == ADC_REFERENCE_INT1V) { - system_voltage_reference_enable(SYSTEM_VOLTAGE_REFERENCE_BANDGAP); - } - -#if ADC_CALLBACK_MODE == true - for (uint8_t i = 0; i < ADC_CALLBACK_N; i++) { - module_inst->callback[i] = NULL; - }; - - module_inst->registered_callback_mask = 0; - module_inst->enabled_callback_mask = 0; - module_inst->remaining_conversions = 0; - module_inst->job_status = STATUS_OK; - - _adc_instances[0] = module_inst; - - if (config->event_action == ADC_EVENT_ACTION_DISABLED && - !config->freerunning) { - module_inst->software_trigger = true; - } else { - module_inst->software_trigger = false; - } -#endif - - /* Write configuration to module */ - return _adc_set_config(module_inst, config); -} diff --git a/atmel-samd/asf/sam0/drivers/adc/adc_sam_d_r/adc_callback.c b/atmel-samd/asf/sam0/drivers/adc/adc_sam_d_r/adc_callback.c deleted file mode 100644 index 6f673dd34..000000000 --- a/atmel-samd/asf/sam0/drivers/adc/adc_sam_d_r/adc_callback.c +++ /dev/null @@ -1,255 +0,0 @@ -/** - * \file - * - * \brief SAM Peripheral Analog-to-Digital Converter Driver - * - * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#include "adc_callback.h" - -struct adc_module *_adc_instances[ADC_INST_NUM]; - -static void _adc_interrupt_handler(const uint8_t instance) -{ - struct adc_module *module = _adc_instances[instance]; - - /* get interrupt flags and mask out enabled callbacks */ - uint32_t flags = module->hw->INTFLAG.reg; - - if (flags & ADC_INTFLAG_RESRDY) { - if ((module->enabled_callback_mask & (1 << ADC_CALLBACK_READ_BUFFER)) && - (module->registered_callback_mask & (1 << ADC_CALLBACK_READ_BUFFER))) { - /* clear interrupt flag */ - module->hw->INTFLAG.reg = ADC_INTFLAG_RESRDY; - - while (adc_is_syncing(module)) { - /* Wait for synchronization */ - } - - /* store ADC result in job buffer */ - *(module->job_buffer++) = module->hw->RESULT.reg; - - if (--module->remaining_conversions > 0) { - if (module->software_trigger == true) { - adc_start_conversion(module); - } - } else { - if (module->job_status == STATUS_BUSY) { - /* job is complete. update status,disable interrupt - *and call callback */ - module->job_status = STATUS_OK; - adc_disable_interrupt(module, ADC_INTERRUPT_RESULT_READY); - - (module->callback[ADC_CALLBACK_READ_BUFFER])(module); - } - } - } - } - - if (flags & ADC_INTFLAG_WINMON) { - module->hw->INTFLAG.reg = ADC_INTFLAG_WINMON; - if ((module->enabled_callback_mask & (1 << ADC_CALLBACK_WINDOW)) && - (module->registered_callback_mask & (1 << ADC_CALLBACK_WINDOW))) { - (module->callback[ADC_CALLBACK_WINDOW])(module); - } - - } - - if (flags & ADC_INTFLAG_OVERRUN) { - module->hw->INTFLAG.reg = ADC_INTFLAG_OVERRUN; - if ((module->enabled_callback_mask & (1 << ADC_CALLBACK_ERROR)) && - (module->registered_callback_mask & (1 << ADC_CALLBACK_ERROR))) { - (module->callback[ADC_CALLBACK_ERROR])(module); - } - } -} - -/** Interrupt handler for the ADC module. */ -void ADC_Handler(void) -{ - _adc_interrupt_handler(0); -} - -/** - * \brief Registers a callback - * - * Registers a callback function which is implemented by the user. - * - * \note The callback must be enabled by for the interrupt handler to call it - * when the condition for the callback is met. - * - * \param[in] module Pointer to ADC software instance struct - * \param[in] callback_func Pointer to callback function - * \param[in] callback_type Callback type given by an enum - * - */ -void adc_register_callback( - struct adc_module *const module, - adc_callback_t callback_func, - enum adc_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module); - Assert(callback_func); - - /* Register callback function */ - module->callback[callback_type] = callback_func; - - /* Set the bit corresponding to the callback_type */ - module->registered_callback_mask |= (1 << callback_type); -} - -/** - * \brief Unregisters a callback - * - * Unregisters a callback function which is implemented by the user. - * - * \param[in] module Pointer to ADC software instance struct - * \param[in] callback_type Callback type given by an enum - * - */ -void adc_unregister_callback( - struct adc_module *const module, - enum adc_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module); - - /* Unregister callback function */ - module->callback[callback_type] = NULL; - - /* Clear the bit corresponding to the callback_type */ - module->registered_callback_mask &= ~(1 << callback_type); -} - -/** - * \brief Read multiple samples from ADC - * - * Read \c samples samples from the ADC into the buffer \c buffer. - * If there is no hardware trigger defined (event action) the - * driver will retrigger the ADC conversion whenever a conversion - * is complete until \c samples samples has been acquired. To avoid - * jitter in the sampling frequency using an event trigger is advised. - * - * \param[in] module_inst Pointer to the ADC software instance struct - * \param[in] samples Number of samples to acquire - * \param[out] buffer Buffer to store the ADC samples - * - * \return Status of the job start. - * \retval STATUS_OK The conversion job was started successfully and is - * in progress - * \retval STATUS_BUSY The ADC is already busy with another job - */ -enum status_code adc_read_buffer_job( - struct adc_module *const module_inst, - uint16_t *buffer, - uint16_t samples) -{ - Assert(module_inst); - Assert(samples); - Assert(buffer); - - if(module_inst->remaining_conversions != 0 || - module_inst->job_status == STATUS_BUSY){ - return STATUS_BUSY; - } - - module_inst->job_status = STATUS_BUSY; - module_inst->remaining_conversions = samples; - module_inst->job_buffer = buffer; - - adc_enable_interrupt(module_inst, ADC_INTERRUPT_RESULT_READY); - - if(module_inst->software_trigger == true) { - adc_start_conversion(module_inst); - } - - return STATUS_OK; -} - -/** - * \brief Gets the status of a job - * - * Gets the status of an ongoing or the last job. - * - * \param [in] module_inst Pointer to the ADC software instance struct - * \param [in] type Type of job to get status - * - * \return Status of the job. - */ -enum status_code adc_get_job_status( - struct adc_module *module_inst, - enum adc_job_type type) -{ - /* Sanity check arguments */ - Assert(module_inst); - - if (type == ADC_JOB_READ_BUFFER ) { - return module_inst->job_status; - } else { - return STATUS_ERR_INVALID_ARG; - } -} - -/** - * \brief Aborts an ongoing job - * - * Aborts an ongoing job. - * - * \param [in] module_inst Pointer to the ADC software instance struct - * \param [in] type Type of job to abort - */ -void adc_abort_job( - struct adc_module *module_inst, - enum adc_job_type type) -{ - /* Sanity check arguments */ - Assert(module_inst); - - if (type == ADC_JOB_READ_BUFFER) { - /* Disable interrupt */ - adc_disable_interrupt(module_inst, ADC_INTERRUPT_RESULT_READY); - /* Mark job as aborted */ - module_inst->job_status = STATUS_ABORTED; - module_inst->remaining_conversions = 0; - } -} - diff --git a/atmel-samd/asf/sam0/drivers/adc/adc_sam_d_r/adc_feature.h b/atmel-samd/asf/sam0/drivers/adc/adc_sam_d_r/adc_feature.h deleted file mode 100644 index 9635a190d..000000000 --- a/atmel-samd/asf/sam0/drivers/adc/adc_sam_d_r/adc_feature.h +++ /dev/null @@ -1,728 +0,0 @@ -/** - * \file - * - * \brief SAM ADC functionality - * - * Copyright (C) 2014-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef ADC_FEATURE_H_INCLUDED -#define ADC_FEATURE_H_INCLUDED - -/** - * \addtogroup asfdoc_sam0_adc_group - * @{ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#if ADC_CALLBACK_MODE == true -# include <system_interrupt.h> - -#if !defined(__DOXYGEN__) -extern struct adc_module *_adc_instances[ADC_INST_NUM]; -#endif - -/** Forward definition of the device instance. */ -struct adc_module; - -/** Type of the callback functions. */ -typedef void (*adc_callback_t)(struct adc_module *const module); - -/** - * \brief ADC Callback enum - * - * Callback types for ADC callback driver. - * - */ -enum adc_callback { - /** Callback for buffer received */ - ADC_CALLBACK_READ_BUFFER, - /** Callback when window is hit */ - ADC_CALLBACK_WINDOW, - /** Callback for error */ - ADC_CALLBACK_ERROR, -# if !defined(__DOXYGEN__) - /** Number of available callbacks */ - ADC_CALLBACK_N, -# endif -}; - -#endif - -/** - * \brief ADC reference voltage enum - * - * Enum for the possible reference voltages for the ADC. - * - */ -enum adc_reference { - /** 1.0V voltage reference */ - ADC_REFERENCE_INT1V = ADC_REFCTRL_REFSEL_INT1V, - /** 1/1.48V<SUB>CC</SUB> reference */ - ADC_REFERENCE_INTVCC0 = ADC_REFCTRL_REFSEL_INTVCC0, - /** 1/2V<SUB>CC</SUB> (only for internal V<SUB>CC</SUB> > 2.1V) */ - ADC_REFERENCE_INTVCC1 = ADC_REFCTRL_REFSEL_INTVCC1, - /** External reference A */ - ADC_REFERENCE_AREFA = ADC_REFCTRL_REFSEL_AREFA, - /** External reference B */ - ADC_REFERENCE_AREFB = ADC_REFCTRL_REFSEL_AREFB, -}; - -/** - * \brief ADC clock prescaler enum - * - * Enum for the possible clock prescaler values for the ADC. - * - */ -enum adc_clock_prescaler { - /** ADC clock division factor 4 */ - ADC_CLOCK_PRESCALER_DIV4 = ADC_CTRLB_PRESCALER_DIV4, - /** ADC clock division factor 8 */ - ADC_CLOCK_PRESCALER_DIV8 = ADC_CTRLB_PRESCALER_DIV8, - /** ADC clock division factor 16 */ - ADC_CLOCK_PRESCALER_DIV16 = ADC_CTRLB_PRESCALER_DIV16, - /** ADC clock division factor 32 */ - ADC_CLOCK_PRESCALER_DIV32 = ADC_CTRLB_PRESCALER_DIV32, - /** ADC clock division factor 64 */ - ADC_CLOCK_PRESCALER_DIV64 = ADC_CTRLB_PRESCALER_DIV64, - /** ADC clock division factor 128 */ - ADC_CLOCK_PRESCALER_DIV128 = ADC_CTRLB_PRESCALER_DIV128, - /** ADC clock division factor 256 */ - ADC_CLOCK_PRESCALER_DIV256 = ADC_CTRLB_PRESCALER_DIV256, - /** ADC clock division factor 512 */ - ADC_CLOCK_PRESCALER_DIV512 = ADC_CTRLB_PRESCALER_DIV512, -}; - -/** - * \brief ADC resolution enum - * - * Enum for the possible resolution values for the ADC. - * - */ -enum adc_resolution { - /** ADC 12-bit resolution */ - ADC_RESOLUTION_12BIT = ADC_CTRLB_RESSEL_12BIT, - /** ADC 16-bit resolution using oversampling and decimation */ - ADC_RESOLUTION_16BIT = ADC_CTRLB_RESSEL_16BIT, - /** ADC 10-bit resolution */ - ADC_RESOLUTION_10BIT = ADC_CTRLB_RESSEL_10BIT, - /** ADC 8-bit resolution */ - ADC_RESOLUTION_8BIT = ADC_CTRLB_RESSEL_8BIT, - /** ADC 13-bit resolution using oversampling and decimation */ - ADC_RESOLUTION_13BIT, - /** ADC 14-bit resolution using oversampling and decimation */ - ADC_RESOLUTION_14BIT, - /** ADC 15-bit resolution using oversampling and decimation */ - ADC_RESOLUTION_15BIT, - /** ADC 16-bit result register for use with averaging. When using this mode - * the ADC result register will be set to 16-bit wide, and the number of - * samples to accumulate and the division factor is configured by the - * \ref adc_config.accumulate_samples and \ref adc_config.divide_result - * members in the configuration struct. - */ - ADC_RESOLUTION_CUSTOM, -}; - -/** - * \brief ADC window monitor mode enum - * - * Enum for the possible window monitor modes for the ADC. - * - */ -enum adc_window_mode { - /** No window mode */ - ADC_WINDOW_MODE_DISABLE = ADC_WINCTRL_WINMODE_DISABLE, - /** RESULT > WINLT */ - ADC_WINDOW_MODE_ABOVE_LOWER = ADC_WINCTRL_WINMODE_MODE1, - /** RESULT < WINUT */ - ADC_WINDOW_MODE_BELOW_UPPER = ADC_WINCTRL_WINMODE_MODE2, - /** WINLT < RESULT < WINUT */ - ADC_WINDOW_MODE_BETWEEN = ADC_WINCTRL_WINMODE_MODE3, - /** !(WINLT < RESULT < WINUT) */ - ADC_WINDOW_MODE_BETWEEN_INVERTED = ADC_WINCTRL_WINMODE_MODE4, -}; - -/** - * \brief ADC gain factor selection enum - * - * Enum for the possible gain factor values for the ADC. - * - */ -enum adc_gain_factor { - /** 1x gain */ - ADC_GAIN_FACTOR_1X = ADC_INPUTCTRL_GAIN_1X, - /** 2x gain */ - ADC_GAIN_FACTOR_2X = ADC_INPUTCTRL_GAIN_2X, - /** 4x gain */ - ADC_GAIN_FACTOR_4X = ADC_INPUTCTRL_GAIN_4X, - /** 8x gain */ - ADC_GAIN_FACTOR_8X = ADC_INPUTCTRL_GAIN_8X, - /** 16x gain */ - ADC_GAIN_FACTOR_16X = ADC_INPUTCTRL_GAIN_16X, - /** 1/2x gain */ - ADC_GAIN_FACTOR_DIV2 = ADC_INPUTCTRL_GAIN_DIV2, -}; - -/** - * \brief ADC event action enum - * - * Enum for the possible actions to take on an incoming event. - * - */ -enum adc_event_action { - /** Event action disabled */ - ADC_EVENT_ACTION_DISABLED = 0, - /** Flush ADC and start conversion */ - ADC_EVENT_ACTION_FLUSH_START_CONV = ADC_EVCTRL_SYNCEI, - /** Start conversion */ - ADC_EVENT_ACTION_START_CONV = ADC_EVCTRL_STARTEI, -}; - -/** - * \brief ADC positive MUX input selection enum - * - * Enum for the possible positive MUX input selections for the ADC. - * - */ -enum adc_positive_input { - /** ADC0 pin */ - ADC_POSITIVE_INPUT_PIN0 = ADC_INPUTCTRL_MUXPOS_PIN0, - /** ADC1 pin */ - ADC_POSITIVE_INPUT_PIN1 = ADC_INPUTCTRL_MUXPOS_PIN1, - /** ADC2 pin */ - ADC_POSITIVE_INPUT_PIN2 = ADC_INPUTCTRL_MUXPOS_PIN2, - /** ADC3 pin */ - ADC_POSITIVE_INPUT_PIN3 = ADC_INPUTCTRL_MUXPOS_PIN3, - /** ADC4 pin */ - ADC_POSITIVE_INPUT_PIN4 = ADC_INPUTCTRL_MUXPOS_PIN4, - /** ADC5 pin */ - ADC_POSITIVE_INPUT_PIN5 = ADC_INPUTCTRL_MUXPOS_PIN5, - /** ADC6 pin */ - ADC_POSITIVE_INPUT_PIN6 = ADC_INPUTCTRL_MUXPOS_PIN6, - /** ADC7 pin */ - ADC_POSITIVE_INPUT_PIN7 = ADC_INPUTCTRL_MUXPOS_PIN7, - /** ADC8 pin */ - ADC_POSITIVE_INPUT_PIN8 = ADC_INPUTCTRL_MUXPOS_PIN8, - /** ADC9 pin */ - ADC_POSITIVE_INPUT_PIN9 = ADC_INPUTCTRL_MUXPOS_PIN9, - /** ADC10 pin */ - ADC_POSITIVE_INPUT_PIN10 = ADC_INPUTCTRL_MUXPOS_PIN10, - /** ADC11 pin */ - ADC_POSITIVE_INPUT_PIN11 = ADC_INPUTCTRL_MUXPOS_PIN11, - /** ADC12 pin */ - ADC_POSITIVE_INPUT_PIN12 = ADC_INPUTCTRL_MUXPOS_PIN12, - /** ADC13 pin */ - ADC_POSITIVE_INPUT_PIN13 = ADC_INPUTCTRL_MUXPOS_PIN13, - /** ADC14 pin */ - ADC_POSITIVE_INPUT_PIN14 = ADC_INPUTCTRL_MUXPOS_PIN14, - /** ADC15 pin */ - ADC_POSITIVE_INPUT_PIN15 = ADC_INPUTCTRL_MUXPOS_PIN15, - /** ADC16 pin */ - ADC_POSITIVE_INPUT_PIN16 = ADC_INPUTCTRL_MUXPOS_PIN16, - /** ADC17 pin */ - ADC_POSITIVE_INPUT_PIN17 = ADC_INPUTCTRL_MUXPOS_PIN17, - /** ADC18 pin */ - ADC_POSITIVE_INPUT_PIN18 = ADC_INPUTCTRL_MUXPOS_PIN18, - /** ADC19 pin */ - ADC_POSITIVE_INPUT_PIN19 = ADC_INPUTCTRL_MUXPOS_PIN19, - /** Temperature reference */ - ADC_POSITIVE_INPUT_TEMP = ADC_INPUTCTRL_MUXPOS_TEMP, - /** Bandgap voltage */ - ADC_POSITIVE_INPUT_BANDGAP = ADC_INPUTCTRL_MUXPOS_BANDGAP, - /** 1/4 scaled core supply */ - ADC_POSITIVE_INPUT_SCALEDCOREVCC = ADC_INPUTCTRL_MUXPOS_SCALEDCOREVCC, - /** 1/4 scaled I/O supply */ - ADC_POSITIVE_INPUT_SCALEDIOVCC = ADC_INPUTCTRL_MUXPOS_SCALEDIOVCC, - /** DAC input */ - ADC_POSITIVE_INPUT_DAC = ADC_INPUTCTRL_MUXPOS_DAC, -}; - -/** - * \brief ADC negative Multiplexer(MUX) input selection enum - * - * Enum for the possible negative Multiplexer(MUX) input selections for the ADC. - * - */ -enum adc_negative_input { - /** ADC0 pin */ - ADC_NEGATIVE_INPUT_PIN0 = ADC_INPUTCTRL_MUXNEG_PIN0, - /** ADC1 pin */ - ADC_NEGATIVE_INPUT_PIN1 = ADC_INPUTCTRL_MUXNEG_PIN1, - /** ADC2 pin */ - ADC_NEGATIVE_INPUT_PIN2 = ADC_INPUTCTRL_MUXNEG_PIN2, - /** ADC3 pin */ - ADC_NEGATIVE_INPUT_PIN3 = ADC_INPUTCTRL_MUXNEG_PIN3, - /** ADC4 pin */ - ADC_NEGATIVE_INPUT_PIN4 = ADC_INPUTCTRL_MUXNEG_PIN4, - /** ADC5 pin */ - ADC_NEGATIVE_INPUT_PIN5 = ADC_INPUTCTRL_MUXNEG_PIN5, - /** ADC6 pin */ - ADC_NEGATIVE_INPUT_PIN6 = ADC_INPUTCTRL_MUXNEG_PIN6, - /** ADC7 pin */ - ADC_NEGATIVE_INPUT_PIN7 = ADC_INPUTCTRL_MUXNEG_PIN7, - /** Internal ground */ - ADC_NEGATIVE_INPUT_GND = ADC_INPUTCTRL_MUXNEG_GND, - /** I/O ground */ - ADC_NEGATIVE_INPUT_IOGND = ADC_INPUTCTRL_MUXNEG_IOGND, -}; - -/** - * \brief ADC number of accumulated samples enum - * - * Enum for the possible numbers of ADC samples to accumulate. - * This setting is only used when the \ref ADC_RESOLUTION_CUSTOM - * resolution setting is used. - * - */ -enum adc_accumulate_samples { - /** No averaging */ - ADC_ACCUMULATE_DISABLE = ADC_AVGCTRL_SAMPLENUM_1, - /** Average 2 samples */ - ADC_ACCUMULATE_SAMPLES_2 = ADC_AVGCTRL_SAMPLENUM_2, - /** Average 4 samples */ - ADC_ACCUMULATE_SAMPLES_4 = ADC_AVGCTRL_SAMPLENUM_4, - /** Average 8 samples */ - ADC_ACCUMULATE_SAMPLES_8 = ADC_AVGCTRL_SAMPLENUM_8, - /** Average 16 samples */ - ADC_ACCUMULATE_SAMPLES_16 = ADC_AVGCTRL_SAMPLENUM_16, - /** Average 32 samples */ - ADC_ACCUMULATE_SAMPLES_32 = ADC_AVGCTRL_SAMPLENUM_32, - /** Average 64 samples */ - ADC_ACCUMULATE_SAMPLES_64 = ADC_AVGCTRL_SAMPLENUM_64, - /** Average 128 samples */ - ADC_ACCUMULATE_SAMPLES_128 = ADC_AVGCTRL_SAMPLENUM_128, - /** Average 256 samples */ - ADC_ACCUMULATE_SAMPLES_256 = ADC_AVGCTRL_SAMPLENUM_256, - /** Average 512 samples */ - ADC_ACCUMULATE_SAMPLES_512 = ADC_AVGCTRL_SAMPLENUM_512, - /** Average 1024 samples */ - ADC_ACCUMULATE_SAMPLES_1024 = ADC_AVGCTRL_SAMPLENUM_1024, -}; - -/** - * \brief ADC possible dividers for the result register - * - * Enum for the possible division factors to use when accumulating - * multiple samples. To keep the same resolution for the averaged - * result and the actual input value, the division factor must - * be equal to the number of samples accumulated. This setting is only - * used when the \ref ADC_RESOLUTION_CUSTOM resolution setting is used. - */ -enum adc_divide_result { - /** Don't divide result register after accumulation */ - ADC_DIVIDE_RESULT_DISABLE = 0, - /** Divide result register by 2 after accumulation */ - ADC_DIVIDE_RESULT_2 = 1, - /** Divide result register by 4 after accumulation */ - ADC_DIVIDE_RESULT_4 = 2, - /** Divide result register by 8 after accumulation */ - ADC_DIVIDE_RESULT_8 = 3, - /** Divide result register by 16 after accumulation */ - ADC_DIVIDE_RESULT_16 = 4, - /** Divide result register by 32 after accumulation */ - ADC_DIVIDE_RESULT_32 = 5, - /** Divide result register by 64 after accumulation */ - ADC_DIVIDE_RESULT_64 = 6, - /** Divide result register by 128 after accumulation */ - ADC_DIVIDE_RESULT_128 = 7, -}; - -#if ADC_CALLBACK_MODE == true -/** - * Enum for the possible ADC interrupt flags. - */ -enum adc_interrupt_flag { - /** ADC result ready */ - ADC_INTERRUPT_RESULT_READY = ADC_INTFLAG_RESRDY, - /** Window monitor match */ - ADC_INTERRUPT_WINDOW = ADC_INTFLAG_WINMON, - /** ADC result overwritten before read */ - ADC_INTERRUPT_OVERRUN = ADC_INTFLAG_OVERRUN, -}; -#endif - -/** - * \brief ADC oversampling and decimation enum - * - * Enum for the possible numbers of bits resolution can be increased by when - * using oversampling and decimation. - * - */ -enum adc_oversampling_and_decimation { - /** Don't use oversampling and decimation mode */ - ADC_OVERSAMPLING_AND_DECIMATION_DISABLE = 0, - /** 1-bit resolution increase */ - ADC_OVERSAMPLING_AND_DECIMATION_1BIT, - /** 2-bit resolution increase */ - ADC_OVERSAMPLING_AND_DECIMATION_2BIT, - /** 3-bit resolution increase */ - ADC_OVERSAMPLING_AND_DECIMATION_3BIT, - /** 4-bit resolution increase */ - ADC_OVERSAMPLING_AND_DECIMATION_4BIT -}; - -/** - * \brief Window monitor configuration structure - * - * Window monitor configuration structure. - */ -struct adc_window_config { - /** Selected window mode */ - enum adc_window_mode window_mode; - /** Lower window value */ - int32_t window_lower_value; - /** Upper window value */ - int32_t window_upper_value; -}; - -/** - * \brief ADC event enable/disable structure. - * - * Event flags for the ADC module. This is used to enable and - * disable events via \ref adc_enable_events() and \ref adc_disable_events(). - */ -struct adc_events { - /** Enable event generation on conversion done */ - bool generate_event_on_conversion_done; - /** Enable event generation on window monitor */ - bool generate_event_on_window_monitor; -}; - -/** - * \brief Gain and offset correction configuration structure - * - * Gain and offset correction configuration structure. - * Part of the \ref adc_config struct and will be initialized by - * \ref adc_get_config_defaults. - */ -struct adc_correction_config { - /** - * Enables correction for gain and offset based on values of gain_correction and - * offset_correction if set to true - */ - bool correction_enable; - /** - * This value defines how the ADC conversion result is compensated for gain - * error before written to the result register. This is a fractional value, - * 1-bit integer plus an 11-bit fraction, therefore - * 1/2 <= gain_correction < 2. Valid \c gain_correction values ranges from - * \c 0b010000000000 to \c 0b111111111111. - */ - uint16_t gain_correction; - /** - * This value defines how the ADC conversion result is compensated for - * offset error before written to the result register. This is a 12-bit - * value in two's complement format. - */ - int16_t offset_correction; -}; - -/** - * \brief Pin scan configuration structure - * - * Pin scan configuration structure. Part of the \ref adc_config struct and will - * be initialized by \ref adc_get_config_defaults. - */ -struct adc_pin_scan_config { - /** - * Offset (relative to selected positive input) of the first input pin to be - * used in pin scan mode - */ - uint8_t offset_start_scan; - /** - * Number of input pins to scan in pin scan mode. A value below two will - * disable pin scan mode. - */ - uint8_t inputs_to_scan; -}; - -/** - * \brief ADC configuration structure - * - * Configuration structure for an ADC instance. This structure should be - * initialized by the \ref adc_get_config_defaults() - * function before being modified by the user application. - */ -struct adc_config { - /** GCLK generator used to clock the peripheral */ - enum gclk_generator clock_source; - /** Voltage reference */ - enum adc_reference reference; - /** Clock prescaler */ - enum adc_clock_prescaler clock_prescaler; - /** Result resolution */ - enum adc_resolution resolution; - /** Gain factor */ - enum adc_gain_factor gain_factor; - /** Positive Multiplexer (MUX) input */ - enum adc_positive_input positive_input; - /** Negative MUX input. For singled-ended conversion mode, the negative - * input must be connected to ground. This ground could be the internal - * GND, IOGND or an external ground connected to a pin. */ - enum adc_negative_input negative_input; - /** Number of ADC samples to accumulate when using the - * \c ADC_RESOLUTION_CUSTOM mode. Note: if the result width increases, - * result resolution will be changed accordingly. - */ - enum adc_accumulate_samples accumulate_samples; - /** Division ration when using the ADC_RESOLUTION_CUSTOM mode */ - enum adc_divide_result divide_result; - /** Left adjusted result */ - bool left_adjust; - /** Enables differential mode if true. - * if false, ADC will run in singled-ended mode. */ - bool differential_mode; - /** Enables free running mode if true */ - bool freerunning; - /** Enables ADC in standby sleep mode if true */ - bool run_in_standby; - /** - * Enables reference buffer offset compensation if true. - * This will increase the accuracy of the gain stage, but decreases the input - * impedance; therefore the startup time of the reference must be increased. - */ - bool reference_compensation_enable; - /** - * This value (0-63) control the ADC sampling time in number of half ADC - * prescaled clock cycles (depends of \c ADC_PRESCALER value), thus - * controlling the ADC input impedance. Sampling time is set according to - * the formula: - * Sample time = (sample_length+1) * (ADCclk / 2). - */ - uint8_t sample_length; - /** Window monitor configuration structure */ - struct adc_window_config window; - /** Gain and offset correction configuration structure */ - struct adc_correction_config correction; - /** Event action to take on incoming event */ - enum adc_event_action event_action; - /** Pin scan configuration structure */ - struct adc_pin_scan_config pin_scan; -}; - -/** - * \brief ADC software device instance structure. - * - * ADC software instance structure, used to retain software state information - * of an associated hardware module instance. - * - * \note The fields of this structure should not be altered by the user - * application; they are reserved for module-internal use only. - */ -struct adc_module { -#if !defined(__DOXYGEN__) - /** Pointer to ADC hardware module */ - Adc *hw; - /** Keep reference configuration so we know when enable is called */ - enum adc_reference reference; -# if ADC_CALLBACK_MODE == true - /** Array to store callback functions */ - adc_callback_t callback[ADC_CALLBACK_N]; - /** Pointer to buffer used for ADC results */ - volatile uint16_t *job_buffer; - /** Remaining number of conversions in current job */ - volatile uint16_t remaining_conversions; - /** Bit mask for callbacks registered */ - uint8_t registered_callback_mask; - /** Bit mask for callbacks enabled */ - uint8_t enabled_callback_mask; - /** Holds the status of the ongoing or last conversion job */ - volatile enum status_code job_status; - /** If software triggering is needed */ - bool software_trigger; -# endif -#endif -}; - -#if !defined(__DOXYGEN__) - -/** - * \brief Determines if the hardware module(s) are currently synchronizing to the bus. - * - * Checks to see if the underlying hardware peripheral module(s) are currently - * synchronizing across multiple clock domains to the hardware bus. This - * function can be used to delay further operations on a module until such time - * that it is ready, to prevent blocking delays for synchronization in the - * user application. - * - * \param[in] module_inst Pointer to the ADC software instance struct - * - * \return Synchronization status of the underlying hardware module(s). - * - * \retval true if the module synchronization is ongoing - * \retval false if the module has completed synchronization - */ -static inline bool adc_is_syncing( - struct adc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - - Adc *const adc_module = module_inst->hw; - - if (adc_module->STATUS.reg & ADC_STATUS_SYNCBUSY) { - return true; - } - - return false; -} -#endif - -/** - * \name ADC Gain and Pin Scan Mode - * @{ - */ - -/** - * \brief Sets ADC gain factor - * - * Sets the ADC gain factor to a specified gain setting. - * - * \param[in] module_inst Pointer to the ADC software instance struct - * \param[in] gain_factor Gain factor value to set - */ -static inline void adc_set_gain( - struct adc_module *const module_inst, - const enum adc_gain_factor gain_factor) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - Adc *const adc_module = module_inst->hw; - - while (adc_is_syncing(module_inst)) { - /* Wait for synchronization */ - } - - /* Set new gain factor */ - adc_module->INPUTCTRL.reg = - (adc_module->INPUTCTRL.reg & ~ADC_INPUTCTRL_GAIN_Msk) | - (gain_factor); -} - -/** - * \brief Sets the ADC pin scan mode - * - * Configures the pin scan mode of the ADC module. In pin scan mode, the first - * conversion will start at the configured positive input + start_offset. When - * a conversion is done, a conversion will start on the next input, until - * \c inputs_to_scan number of conversions are made. - * - * \param[in] module_inst Pointer to the ADC software instance struct - * \param[in] inputs_to_scan Number of input pins to perform a conversion on - * (must be two or more) - * \param[in] start_offset Offset of first pin to scan (relative to - * configured positive input) - * - * \return Status of the pin scan configuration set request. - * - * \retval STATUS_OK Pin scan mode has been set successfully - * \retval STATUS_ERR_INVALID_ARG Number of input pins to scan or offset has - * an invalid value - */ -static inline enum status_code adc_set_pin_scan_mode( - struct adc_module *const module_inst, - uint8_t inputs_to_scan, - const uint8_t start_offset) - -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - Adc *const adc_module = module_inst->hw; - - if (inputs_to_scan > 0) { - /* - * Number of input sources included is the value written to INPUTSCAN - * plus 1. - */ - inputs_to_scan--; - } - - if (inputs_to_scan > (ADC_INPUTCTRL_INPUTSCAN_Msk >> ADC_INPUTCTRL_INPUTSCAN_Pos) || - start_offset > (ADC_INPUTCTRL_INPUTOFFSET_Msk >> ADC_INPUTCTRL_INPUTOFFSET_Pos)) { - /* Invalid number of input pins */ - return STATUS_ERR_INVALID_ARG; - } - - while (adc_is_syncing(module_inst)) { - /* Wait for synchronization */ - } - - /* Set pin scan mode */ - adc_module->INPUTCTRL.reg = - (adc_module->INPUTCTRL.reg & - ~(ADC_INPUTCTRL_INPUTSCAN_Msk | ADC_INPUTCTRL_INPUTOFFSET_Msk)) | - (start_offset << ADC_INPUTCTRL_INPUTOFFSET_Pos) | - (inputs_to_scan << ADC_INPUTCTRL_INPUTSCAN_Pos); - - return STATUS_OK; -} - -/** - * \brief Disables pin scan mode - * - * Disables pin scan mode. The next conversion will be made on only one pin - * (the configured positive input pin). - * - * \param[in] module_inst Pointer to the ADC software instance struct - */ -static inline void adc_disable_pin_scan_mode( - struct adc_module *const module_inst) -{ - /* Disable pin scan mode */ - adc_set_pin_scan_mode(module_inst, 0, 0); -} - -/** @} */ - -#ifdef __cplusplus -} -#endif - -/** @} */ - -#endif /* ADC_FEATURE_H_INCLUDED */ - diff --git a/atmel-samd/asf/sam0/drivers/dac/dac.h b/atmel-samd/asf/sam0/drivers/dac/dac.h deleted file mode 100644 index f26e08e5a..000000000 --- a/atmel-samd/asf/sam0/drivers/dac/dac.h +++ /dev/null @@ -1,207 +0,0 @@ -/** - * \file - * - * \brief SAM Peripheral Digital-to-Analog Converter Driver - * - * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef DAC_H_INCLUDED -#define DAC_H_INCLUDED - - -#ifdef __cplusplus -extern "C" { -#endif - -#include <compiler.h> -#include <clock.h> -#include <gclk.h> - -/** - * \addtogroup asfdoc_sam0_dac_group - * - * @{ - */ - -/** - * Define DAC features set according to different device families. - * @{ - */ -#if (SAMD21 || SAMD10 || SAMD11 || SAMDA1) -# define FEATURE_DAC_DATABUF_WRITE_PROTECTION -#endif -/**@}*/ - -#ifndef DAC_TIMEOUT -# define DAC_TIMEOUT 0xFFFF -#endif - -#if DAC_CALLBACK_MODE == true -# include <system_interrupt.h> - -/** Forward definition of the device instance. */ -struct dac_module; - -#if !defined(__DOXYGEN__) -extern struct dac_module *_dac_instances[DAC_INST_NUM]; -#endif - -/** Type definition for a DAC module callback function. */ -typedef void (*dac_callback_t)(uint8_t channel); - -/** Enum for the possible callback types for the DAC module. */ -enum dac_callback { - /** Callback type for when a DAC channel data empty condition occurs - * (requires event triggered mode) */ - DAC_CALLBACK_DATA_EMPTY, - - /** Callback type for when a DAC channel data underrun condition occurs - * (requires event triggered mode) */ - DAC_CALLBACK_DATA_UNDERRUN, - - /** Callback type for when a DAC channel write buffer job complete (requires - * event triggered mode) */ - DAC_CALLBACK_TRANSFER_COMPLETE, -#if !defined(__DOXYGEN__) - DAC_CALLBACK_N, -#endif -}; - -#endif - -#include <dac_feature.h> - -/** - * \name Configuration and Initialization - * @{ - */ - -bool dac_is_syncing( - struct dac_module *const dev_inst); - -void dac_get_config_defaults( - struct dac_config *const config); - -enum status_code dac_init( - struct dac_module *const dev_inst, - Dac *const module, - struct dac_config *const config); - -void dac_reset( - struct dac_module *const dev_inst); - -void dac_enable( - struct dac_module *const dev_inst); - -void dac_disable( - struct dac_module *const dev_inst); - -void dac_enable_events( - struct dac_module *const module_inst, - struct dac_events *const events); - -void dac_disable_events( - struct dac_module *const module_inst, - struct dac_events *const events); - -/** @} */ - -/** - * \name Configuration and Initialization (Channel) - * @{ - */ - -void dac_chan_get_config_defaults( - struct dac_chan_config *const config); - -void dac_chan_set_config( - struct dac_module *const dev_inst, - const enum dac_channel channel, - struct dac_chan_config *const config); - -void dac_chan_enable( - struct dac_module *const dev_inst, - enum dac_channel channel); - -void dac_chan_disable( - struct dac_module *const dev_inst, - enum dac_channel channel); - -/** @} */ - -/** - * \name Channel Data Management - * @{ - */ - -enum status_code dac_chan_write( - struct dac_module *const dev_inst, - enum dac_channel channel, - const uint16_t data); - -enum status_code dac_chan_write_buffer_wait( - struct dac_module *const module_inst, - enum dac_channel channel, - uint16_t *buffer, - uint32_t length); - -/** @} */ - -/** - * \name Status Management - * @{ - */ -uint32_t dac_get_status( - struct dac_module *const module_inst); -void dac_clear_status( - struct dac_module *const module_inst, - uint32_t status_flags); - -/** @} */ - -#ifdef __cplusplus -} -#endif - -/** @} */ - - -#endif /* DAC_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/dac/dac_callback.h b/atmel-samd/asf/sam0/drivers/dac/dac_callback.h deleted file mode 100644 index 0de73056b..000000000 --- a/atmel-samd/asf/sam0/drivers/dac/dac_callback.h +++ /dev/null @@ -1,119 +0,0 @@ -/** - * \file - * - * \brief SAM Digital-to-Analog Interrupt Driver - * - * Copyright (C) 2013-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef DAC_CALLBACK_H_INCLUDED -#define DAC_CALLBACK_H_INCLUDED - -#include <compiler.h> -#include "dac.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \addtogroup asfdoc_sam0_dac_group - * - * @{ - */ - -/** \name Callback Configuration and Initialization - * @{ - */ -enum status_code dac_chan_write_buffer_job( - struct dac_module *const module_inst, - const enum dac_channel channel, - uint16_t *buffer, - uint32_t buffer_size); - -enum status_code dac_chan_write_job( - struct dac_module *const module_inst, - const enum dac_channel channel, - uint16_t data); - -enum status_code dac_register_callback( - struct dac_module *const module, - const enum dac_channel channel, - const dac_callback_t callback, - const enum dac_callback type); - -enum status_code dac_unregister_callback( - struct dac_module *const module, - const enum dac_channel channel, - const enum dac_callback type); - -/** @} */ - -/** \name Callback Enabling and Disabling (Channel) - * @{ - */ - -enum status_code dac_chan_enable_callback( - struct dac_module *const module, - const enum dac_channel channel, - const enum dac_callback type); - -enum status_code dac_chan_disable_callback( - struct dac_module *const module, - const enum dac_channel channel, - const enum dac_callback type); - -enum status_code dac_chan_get_job_status( - struct dac_module *module_inst, - const enum dac_channel channel); - -void dac_chan_abort_job( - struct dac_module *module_inst, - const enum dac_channel channel); - -/** @} */ - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/atmel-samd/asf/sam0/drivers/dac/dac_sam_d_c/dac.c b/atmel-samd/asf/sam0/drivers/dac/dac_sam_d_c/dac.c deleted file mode 100644 index aa73badd3..000000000 --- a/atmel-samd/asf/sam0/drivers/dac/dac_sam_d_c/dac.c +++ /dev/null @@ -1,779 +0,0 @@ -/** - * \file - * - * \brief SAM Peripheral Digital-to-Analog Converter Driver - * - * Copyright (C) 2012-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#include "dac.h" -#include <system.h> -#include <pinmux.h> - -/** - * \internal Writes a DAC configuration to the hardware module. - * - * Writes out a given configuration to the hardware module. - * - * \param[out] module_inst Pointer to the DAC software instance struct - * \param[in] config Pointer to the configuration struct - * - */ -static void _dac_set_config( - struct dac_module *const module_inst, - struct dac_config *const config) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(config); - Assert(module_inst->hw); - - Dac *const dac_module = module_inst->hw; - - /* Set selected DAC output to be enabled when enabling the module */ - module_inst->output = config->output; - module_inst->start_on_event = false; - - uint32_t new_ctrla = 0; - uint32_t new_ctrlb = 0; - - /* Enable DAC in standby sleep mode if configured */ - if (config->run_in_standby) { - new_ctrla |= DAC_CTRLA_RUNSTDBY; - } - - /* Set reference voltage */ - new_ctrlb |= config->reference; - - /* Left adjust data if configured */ - if (config->left_adjust) { - new_ctrlb |= DAC_CTRLB_LEFTADJ; - } - -#ifdef FEATURE_DAC_DATABUF_WRITE_PROTECTION - /* Bypass DATABUF write protection if configured */ - if (config->databuf_protection_bypass) { - new_ctrlb |= DAC_CTRLB_BDWP; - } -#endif - - /* Voltage pump disable if configured */ - if (config->voltage_pump_disable) { - new_ctrlb |= DAC_CTRLB_VPD; - } - - /* Apply the new configuration to the hardware module */ - dac_module->CTRLA.reg = new_ctrla; - - while (dac_is_syncing(module_inst)) { - /* Wait until the synchronization is complete */ - } - - dac_module->CTRLB.reg = new_ctrlb; -} - -/** - * \brief Determines if the hardware module(s) are currently synchronizing to the bus. - * - * Checks to see if the underlying hardware peripheral module(s) are currently - * synchronizing across multiple clock domains to the hardware bus. This - * function can be used to delay further operations on a module until such time - * that it is ready, to prevent blocking delays for synchronization in the - * user application. - * - * \param[in] dev_inst Pointer to the DAC software instance struct - * - * \return Synchronization status of the underlying hardware module(s). - * - * \retval true If the module synchronization is ongoing - * \retval false If the module has completed synchronization - */ -bool dac_is_syncing( - struct dac_module *const dev_inst) -{ - /* Sanity check arguments */ - Assert(dev_inst); - - Dac *const dac_module = dev_inst->hw; - -#if (SAMC21) - if (dac_module->SYNCBUSY.reg) { -#else - if (dac_module->STATUS.reg & DAC_STATUS_SYNCBUSY) { -#endif - return true; - } - - return false; -} - -/** - * \brief Initializes a DAC configuration structure to defaults. - * - * Initializes a given DAC configuration structure to a set of - * known default values. This function should be called on any new - * instance of the configuration structures before being modified by the - * user application. - * - * The default configuration is as follows: - * \li 1V from internal bandgap reference - * \li Drive the DAC output to the VOUT pin - * \li Right adjust data - * \li GCLK generator 0 (GCLK main) clock source - * \li The output buffer is disabled when the chip enters STANDBY sleep - * mode - * - * \param[out] config Configuration structure to initialize to default values - */ -void dac_get_config_defaults( - struct dac_config *const config) -{ - /* Sanity check arguments */ - Assert(config); - - /* Default configuration values */ - config->reference = DAC_REFERENCE_INT1V; - config->output = DAC_OUTPUT_EXTERNAL; - config->left_adjust = false; -#ifdef FEATURE_DAC_DATABUF_WRITE_PROTECTION - config->databuf_protection_bypass = false; -#endif - config->voltage_pump_disable = false; - config->clock_source = GCLK_GENERATOR_0; - config->run_in_standby = false; -#if (SAMC21) - config->dither_mode = false; -#endif -} - -/** - * \brief Initialize the DAC device struct. - * - * Use this function to initialize the Digital to Analog Converter. Resets the - * underlying hardware module and configures it. - * - * \note The DAC channel must be configured separately. - * - * \param[out] module_inst Pointer to the DAC software instance struct - * \param[in] module Pointer to the DAC module instance - * \param[in] config Pointer to the config struct, created by the user - * application - * - * \return Status of initialization. - * \retval STATUS_OK Module initiated correctly - * \retval STATUS_ERR_DENIED If module is enabled - * \retval STATUS_BUSY If module is busy resetting - */ -enum status_code dac_init( - struct dac_module *const module_inst, - Dac *const module, - struct dac_config *const config) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module); - Assert(config); - - /* Initialize device instance */ - module_inst->hw = module; - - /* Turn on the digital interface clock */ -#if (SAMC21) - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBC, MCLK_APBCMASK_DAC); -#else - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBC, PM_APBCMASK_DAC); -#endif - - /* Check if module is enabled. */ - if (module->CTRLA.reg & DAC_CTRLA_ENABLE) { - return STATUS_ERR_DENIED; - } - - /* Check if reset is in progress. */ - if (module->CTRLA.reg & DAC_CTRLA_SWRST) { - return STATUS_BUSY; - } - - /* Configure GCLK channel and enable clock */ - struct system_gclk_chan_config gclk_chan_conf; - system_gclk_chan_get_config_defaults(&gclk_chan_conf); - gclk_chan_conf.source_generator = config->clock_source; - system_gclk_chan_set_config(DAC_GCLK_ID, &gclk_chan_conf); - system_gclk_chan_enable(DAC_GCLK_ID); - - /* MUX the DAC VOUT pin */ - struct system_pinmux_config pin_conf; - system_pinmux_get_config_defaults(&pin_conf); - - /* Set up the DAC VOUT pin */ - pin_conf.mux_position = MUX_PA02B_DAC_VOUT; - pin_conf.direction = SYSTEM_PINMUX_PIN_DIR_INPUT; - pin_conf.input_pull = SYSTEM_PINMUX_PIN_PULL_NONE; - system_pinmux_pin_set_config(PIN_PA02B_DAC_VOUT, &pin_conf); - - /* Write configuration to module */ - _dac_set_config(module_inst, config); - - /* Store reference selection for later use */ - module_inst->reference = config->reference; - -#if DAC_CALLBACK_MODE == true - for (uint8_t i = 0; i < DAC_CALLBACK_N; i++) { - module_inst->callback[i] = NULL; - }; - - _dac_instances[0] = module_inst; -#endif - - return STATUS_OK; -} - -/** - * \brief Resets the DAC module. - * - * This function will reset the DAC module to its power on default values and - * disable it. - * - * \param[in] module_inst Pointer to the DAC software instance struct - */ -void dac_reset( - struct dac_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - Dac *const dac_module = module_inst->hw; - - while (dac_is_syncing(module_inst)) { - /* Wait until the synchronization is complete */ - } - - /* Software reset the module */ - dac_module->CTRLA.reg |= DAC_CTRLA_SWRST; -} - -/** - * \brief Enable the DAC module. - * - * Enables the DAC interface and the selected output. If any internal reference - * is selected it will be enabled. - * - * \param[in] module_inst Pointer to the DAC software instance struct - * - */ -void dac_enable( - struct dac_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - Dac *const dac_module = module_inst->hw; - - /* Enable selected output */ - dac_module->CTRLB.reg |= module_inst->output; - - while (dac_is_syncing(module_inst)) { - /* Wait until the synchronization is complete */ - } - - /* Enable the module */ - dac_module->CTRLA.reg |= DAC_CTRLA_ENABLE; - - /* Enable internal bandgap reference if selected in the configuration */ - if (module_inst->reference == DAC_REFERENCE_INT1V) { -#if (SAMC21) - system_voltage_reference_enable(SYSTEM_VOLTAGE_REFERENCE_OUTPUT); - } - - if(dac_module->CTRLA.reg & DAC_CTRLA_ENABLE) { - while(! (dac_module->STATUS.reg & DAC_STATUS_READY)) { - }; - } -#else - system_voltage_reference_enable(SYSTEM_VOLTAGE_REFERENCE_BANDGAP); - } - -#endif -} - -/** - * \brief Disable the DAC module. - * - * Disables the DAC interface and the output buffer. - * - * \param[in] module_inst Pointer to the DAC software instance struct - * - */ -void dac_disable( - struct dac_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - Dac *const dac_module = module_inst->hw; - - /* Wait until the synchronization is complete */ - while (dac_is_syncing(module_inst)) { - }; - - /* Disbale interrupt */ - dac_module->INTENCLR.reg = DAC_INTENCLR_MASK; - /* Clear interrupt flag */ - dac_module->INTFLAG.reg = DAC_INTFLAG_MASK; - - /* Disable DAC */ - dac_module->CTRLA.reg &= ~DAC_CTRLA_ENABLE; -} - -/** - * \brief Enables a DAC event input or output. - * - * Enables one or more input or output events to or from the DAC module. See - * \ref dac_events "dac_events" for a list of events this module supports. - * - * \note Events cannot be altered while the module is enabled. - * - * \param[in] module_inst Software instance for the DAC peripheral - * \param[in] events Struct containing flags of events to enable - */ -void dac_enable_events( - struct dac_module *const module_inst, - struct dac_events *const events) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - Assert(events); - - Dac *const dac_module = module_inst->hw; - - uint32_t event_mask = 0; - -#if(SAMC21) - /* Configure Enable Inversion of input event */ - if (events->generate_event_on_chan_falling_edge) { - event_mask |= DAC_EVCTRL_INVEI; - } -#endif - - /* Configure Buffer Empty event */ - if (events->generate_event_on_buffer_empty) { - event_mask |= DAC_EVCTRL_EMPTYEO; - } - - /* Configure Conversion Start event */ - if (events->on_event_start_conversion) { - event_mask |= DAC_EVCTRL_STARTEI; - module_inst->start_on_event = true; - } - - dac_module->EVCTRL.reg |= event_mask; -} - -/** - * \brief Disables a DAC event input or output. - * - * Disables one or more input or output events to or from the DAC module. See - * \ref dac_events "dac_events" for a list of events this module supports. - * - * \note Events cannot be altered while the module is enabled. - * - * \param[in] module_inst Software instance for the DAC peripheral - * \param[in] events Struct containing flags of events to disable - */ -void dac_disable_events( - struct dac_module *const module_inst, - struct dac_events *const events) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - Assert(events); - - Dac *const dac_module = module_inst->hw; - - uint32_t event_mask = 0; - - /* Configure Buffer Empty event */ - if (events->generate_event_on_buffer_empty) { - event_mask |= DAC_EVCTRL_EMPTYEO; - } - - /* Configure Conversion Start event */ - if (events->on_event_start_conversion) { - event_mask |= DAC_EVCTRL_STARTEI; - module_inst->start_on_event = false; - } - - dac_module->EVCTRL.reg &= ~event_mask; -} - -/** - * \brief Initializes a DAC channel configuration structure to defaults. - * - * Initializes a given DAC channel configuration structure to a set of - * known default values. This function should be called on any new - * instance of the configuration structures before being modified by the - * user application. - * - * The default configuration is as follows: - * \li Start Conversion Event Input enabled - * \li Start Data Buffer Empty Event Output disabled - * - * \param[out] config Configuration structure to initialize to default values - */ -void dac_chan_get_config_defaults( - struct dac_chan_config *const config) -{ - /* Sanity check arguments */ - Assert(config); -} - -/** - * \brief Writes a DAC channel configuration to the hardware module. - * - * Writes a given channel configuration to the hardware module. - * - * \note The DAC device instance structure must be initialized before calling - * this function. - * - * \param[in] module_inst Pointer to the DAC software instance struct - * \param[in] channel Channel to configure - * \param[in] config Pointer to the configuration struct - * - */ -void dac_chan_set_config( - struct dac_module *const module_inst, - const enum dac_channel channel, - struct dac_chan_config *const config) -{ - /* No channel support yet */ - UNUSED(channel); -} - -/** - * \brief Enable a DAC channel. - * - * Enables the selected DAC channel. - * - * \param[in] module_inst Pointer to the DAC software instance struct - * \param[in] channel Channel to enable - * - */ -void dac_chan_enable( - struct dac_module *const module_inst, - enum dac_channel channel) -{ - /* No channel support yet */ - UNUSED(channel); -} - -/** - * \brief Disable a DAC channel. - * - * Disables the selected DAC channel. - * - * \param[in] module_inst Pointer to the DAC software instance struct - * \param[in] channel Channel to disable - * - */ -void dac_chan_disable( - struct dac_module *const module_inst, - enum dac_channel channel) -{ - /* No channel support yet */ - UNUSED(channel); -} - -/** - * \brief Enable the output buffer. - * - * Enables the output buffer and drives the DAC output to the VOUT pin. - * - * \param[in] module_inst Pointer to the DAC software instance struct - * \param[in] channel DAC channel to alter - */ -void dac_chan_enable_output_buffer( - struct dac_module *const module_inst, - enum dac_channel channel) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* No channel support yet */ - UNUSED(channel); - - Dac *const dac_module = module_inst->hw; - - /* Enable output buffer */ - dac_module->CTRLB.reg |= DAC_OUTPUT_EXTERNAL; -} - -/** - * \brief Disable the output buffer. - * - * Disables the output buffer. - * - * \note The output buffer(s) should be disabled when a channel's output is not - * currently needed, as it will draw current even if the system is in - * sleep mode. - * - * \param[in] module_inst Pointer to the DAC software instance struct - * \param[in] channel DAC channel to alter - */ -void dac_chan_disable_output_buffer( - struct dac_module *const module_inst, - enum dac_channel channel) -{ - /* Sanity check arguments*/ - Assert(module_inst); - Assert(module_inst->hw); - - /* No channel support yet */ - UNUSED(channel); - - Dac *const dac_module = module_inst->hw; - - /* Disable output buffer */ - dac_module->CTRLB.reg &= ~DAC_OUTPUT_EXTERNAL; -} - -/** - * \brief Write to the DAC. - * - * This function writes to the DATA or DATABUF register. - * If the conversion is not event-triggered, the data will be written to - * the DATA register and the conversion will start. - * If the conversion is event-triggered, the data will be written to DATABUF - * and transferred to the DATA register and converted when a Start Conversion - * Event is issued. - * Conversion data must be right or left adjusted according to configuration - * settings. - * \note To be event triggered, the enable_start_on_event must be - * enabled in the configuration. - * - * \param[in] module_inst Pointer to the DAC software device struct - * \param[in] channel DAC channel to write to - * \param[in] data Conversion data - * - * \return Status of the operation. - * \retval STATUS_OK If the data was written - */ -enum status_code dac_chan_write( - struct dac_module *const module_inst, - enum dac_channel channel, - const uint16_t data) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* No channel support yet */ - UNUSED(channel); - - Dac *const dac_module = module_inst->hw; - - /* Wait until the synchronization is complete */ - while (dac_is_syncing(module_inst)) { - }; - - if (module_inst->start_on_event) { - /* Write the new value to the buffered DAC data register */ - dac_module->DATABUF.reg = data; - } else { - /* Write the new value to the DAC data register */ - dac_module->DATA.reg = data; - } - - return STATUS_OK; -} - -/** - * \brief Write to the DAC. - * - * This function converts a specific number of digital data. - * The conversion should be event-triggered, the data will be written to DATABUF - * and transferred to the DATA register and converted when a Start Conversion - * Event is issued. - * Conversion data must be right or left adjusted according to configuration - * settings. - * \note To be event triggered, the enable_start_on_event must be - * enabled in the configuration. - * - * \param[in] module_inst Pointer to the DAC software device struct - * \param[in] channel DAC channel to write to - * \param[in] buffer Pointer to the digital data write buffer to be converted - * \param[in] length Length of the write buffer - * - * \return Status of the operation. - * \retval STATUS_OK If the data was written or no data conversion required - * \retval STATUS_ERR_UNSUPPORTED_DEV The DAC is not configured as using event trigger - * \retval STATUS_BUSY The DAC is busy to convert - */ -enum status_code dac_chan_write_buffer_wait( - struct dac_module *const module_inst, - enum dac_channel channel, - uint16_t *buffer, - uint32_t length) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* No channel support yet */ - UNUSED(channel); - - Dac *const dac_module = module_inst->hw; - - /* Wait until the synchronization is complete */ - while (dac_is_syncing(module_inst)) { - }; - - /* Zero length request */ - if (length == 0) { - /* No data to be converted */ - return STATUS_OK; - } - -#if DAC_CALLBACK_MODE == true - /* Check if busy */ - if (module_inst->job_status == STATUS_BUSY) { - return STATUS_BUSY; - } -#endif - - /* Only support event triggered conversion */ - if (module_inst->start_on_event == false) { - return STATUS_ERR_UNSUPPORTED_DEV; - } - - /* Blocks while buffer is being transferred */ - while (length--) { - /* Convert one data */ - dac_chan_write(module_inst, channel, buffer[length]); - - /* Wait until Transmit is complete or timeout */ - for (uint32_t i = 0; i <= DAC_TIMEOUT; i++) { - if (dac_module->INTFLAG.reg & DAC_INTFLAG_EMPTY) { - break; - } else if (i == DAC_TIMEOUT) { - return STATUS_ERR_TIMEOUT; - } - } - } - - return STATUS_OK; -} - -/** - * \brief Retrieves the current module status - * - * Checks the status of the module and returns it as a bitmask of status - * flags. - * - * \param[in] module_inst Pointer to the DAC software device struct - * - * \return Bitmask of status flags. - * - * \retval DAC_STATUS_CHANNEL_0_EMPTY Data has been transferred from DATABUF - * to DATA by a start conversion event - * and DATABUF is ready for new data - * \retval DAC_STATUS_CHANNEL_0_UNDERRUN A start conversion event has occurred - * when DATABUF is empty - * - */ -uint32_t dac_get_status( - struct dac_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - Dac *const dac_module = module_inst->hw; - - uint8_t intflags = dac_module->INTFLAG.reg; - uint32_t status_flags = 0; - - if (intflags & DAC_INTFLAG_EMPTY) { - status_flags |= DAC_STATUS_CHANNEL_0_EMPTY; - } - - if (intflags & DAC_INTFLAG_UNDERRUN) { - status_flags |= DAC_STATUS_CHANNEL_0_UNDERRUN; - } - - return status_flags; -} - -/** - * \brief Clears a module status flag - * - * Clears the given status flag of the module. - * - * \param[in] module_inst Pointer to the DAC software device struct - * \param[in] status_flags Bit mask of status flags to clear - * - */ -void dac_clear_status( - struct dac_module *const module_inst, - uint32_t status_flags) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - Dac *const dac_module = module_inst->hw; - - uint32_t intflags = 0; - - if (status_flags & DAC_STATUS_CHANNEL_0_EMPTY) { - intflags |= DAC_INTFLAG_EMPTY; - } - - if (status_flags & DAC_STATUS_CHANNEL_0_UNDERRUN) { - intflags |= DAC_INTFLAG_UNDERRUN; - } - - dac_module->INTFLAG.reg = intflags; -} diff --git a/atmel-samd/asf/sam0/drivers/dac/dac_sam_d_c/dac_callback.c b/atmel-samd/asf/sam0/drivers/dac/dac_sam_d_c/dac_callback.c deleted file mode 100644 index d49fc09cb..000000000 --- a/atmel-samd/asf/sam0/drivers/dac/dac_sam_d_c/dac_callback.c +++ /dev/null @@ -1,435 +0,0 @@ -/** - * \file - * - * \brief SAM Digital-to-Analog Interrupt Driver - * - * Copyright (C) 2013-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#include "dac.h" -#include "dac_callback.h" - -struct dac_module *_dac_instances[DAC_INST_NUM]; - -/** - * \brief Convert a specific number digital data to analog through DAC. - * - * This function will perform a conversion of specific number of digital data. - * The conversion should be event-triggered, the data will be written to DATABUF - * and transferred to the DATA register and converted when a Start Conversion - * Event is issued. - * Conversion data must be right or left adjusted according to configuration - * settings. - * \note To be event triggered, the enable_start_on_event must be - * enabled in the configuration. - * - * \param[in] module_inst Pointer to the DAC software device struct - * \param[in] channel DAC channel to write to - * \param[in] buffer Pointer to the digital data write buffer to be converted - * \param[in] length Size of the write buffer - * - * \return Status of the operation. - * \retval STATUS_OK If the data was written - * \retval STATUS_ERR_UNSUPPORTED_DEV If a callback that requires event driven - * mode was specified with a DAC instance - * configured in non-event mode - * \retval STATUS_BUSY The DAC is busy to accept new job - */ -enum status_code dac_chan_write_buffer_job( - struct dac_module *const module_inst, - const enum dac_channel channel, - uint16_t *buffer, - uint32_t length) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - Assert(buffer); - - UNUSED(channel); - - Dac *const dac_module = module_inst->hw; - - /* DAC interrupts require it to be driven by events to work, fail if in - * unbuffered (polled) mode */ - if (module_inst->start_on_event == false) { - return STATUS_ERR_UNSUPPORTED_DEV; - } - - if(module_inst->remaining_conversions != 0 || - module_inst->job_status == STATUS_BUSY){ - return STATUS_BUSY; - } - - /* Wait until the synchronization is complete */ - while (dac_is_syncing(module_inst)) { - }; - - module_inst->job_status = STATUS_BUSY; - - module_inst->remaining_conversions = length; - module_inst->job_buffer = buffer; - module_inst->transferred_conversions = 0; - - /* Enable interrupt */ - system_interrupt_enable(SYSTEM_INTERRUPT_MODULE_DAC); - dac_module->INTFLAG.reg = DAC_INTFLAG_UNDERRUN | DAC_INTFLAG_EMPTY; - dac_module->INTENSET.reg = DAC_INTENSET_UNDERRUN | DAC_INTENSET_EMPTY; - - return STATUS_OK; -} - -/** - * \brief Convert one digital data job. - * - * This function will perform a conversion of specfic number of digital data. - * The conversion is event-triggered, the data will be written to DATABUF - * and transferred to the DATA register and converted when a Start Conversion - * Event is issued. - * Conversion data must be right or left adjusted according to configuration - * settings. - * \note To be event triggered, the enable_start_on_event must be - * enabled in the configuration. - * - * \param[in] module_inst Pointer to the DAC software device struct - * \param[in] channel DAC channel to write to - * \param[in] data Digital data to be converted - * - * \return Status of the operation. - * \retval STATUS_OK If the data was written - * \retval STATUS_ERR_UNSUPPORTED_DEV If a callback that requires event driven - * mode was specified with a DAC instance - * configured in non-event mode - * \retval STATUS_BUSY The DAC is busy to accept new job - */ -enum status_code dac_chan_write_job( - struct dac_module *const module_inst, - const enum dac_channel channel, - uint16_t data) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - UNUSED(channel); - - /* DAC interrupts require it to be driven by events to work, fail if in - * unbuffered (polled) mode */ - if (module_inst->start_on_event == false) { - return STATUS_ERR_UNSUPPORTED_DEV; - } - - if(module_inst->remaining_conversions != 0 || - module_inst->job_status == STATUS_BUSY){ - return STATUS_BUSY; - } - - dac_chan_write_buffer_job(module_inst, channel, &data, 1); - - return STATUS_OK; -} - -/** - * \brief Registers an asynchronous callback function with the driver. - * - * Registers an asynchronous callback with the DAC driver, fired when a callback - * condition occurs. - * - * \param[in,out] module_inst Pointer to the DAC software instance struct - * \param[in] callback Pointer to the callback function to register - * \param[in] channel Logical channel to register callback function - * \param[in] type Type of callback function to register - * - * \return Status of the registration operation. - * \retval STATUS_OK The callback was registered successfully - * \retval STATUS_ERR_INVALID_ARG If an invalid callback type was supplied - * \retval STATUS_ERR_UNSUPPORTED_DEV If a callback that requires event driven - * mode was specified with a DAC instance - * configured in non-event mode - */ -enum status_code dac_register_callback( - struct dac_module *const module_inst, - const enum dac_channel channel, - const dac_callback_t callback, - const enum dac_callback type) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(callback); - - UNUSED(channel); - - /* DAC interrupts require it to be driven by events to work, fail if in - * unbuffered (polled) mode */ - if (module_inst->start_on_event == false) { - return STATUS_ERR_UNSUPPORTED_DEV; - } - - if ((uint8_t)type < DAC_CALLBACK_N) { - module_inst->callback[(uint8_t)type] = callback; - return STATUS_OK; - } - - return STATUS_ERR_INVALID_ARG; -} - -/** - * \brief Unregisters an asynchronous callback function with the driver. - * - * Unregisters an asynchronous callback with the DAC driver, removing it - * from the internal callback registration table. - * - * \param[in,out] module_inst Pointer to the DAC software instance struct - * \param[in] channel Logical channel to unregister callback function - * \param[in] type Type of callback function to unregister - * - * \return Status of the de-registration operation. - * \retval STATUS_OK The callback was unregistered successfully - * \retval STATUS_ERR_INVALID_ARG If an invalid callback type was supplied - * \retval STATUS_ERR_UNSUPPORTED_DEV If a callback that requires event driven - * mode was specified with a DAC instance - * configured in non-event mode - */ -enum status_code dac_unregister_callback( - struct dac_module *const module_inst, - const enum dac_channel channel, - const enum dac_callback type) -{ - /* Sanity check arguments */ - Assert(module_inst); - - UNUSED(channel); - - /* DAC interrupts require it to be driven by events to work, fail if in - * unbuffered (polled) mode */ - if (module_inst->start_on_event == false) { - return STATUS_ERR_UNSUPPORTED_DEV; - } - - if ((uint8_t)type < DAC_CALLBACK_N) { - module_inst->callback[(uint8_t)type] = NULL; - return STATUS_OK; - } - - return STATUS_ERR_INVALID_ARG; -} - -/** - * \brief Enables asynchronous callback generation for a given channel and type. - * - * Enables asynchronous callbacks for a given logical DAC channel and type. This - * must be called before a DAC channel will generate callback events. - * - * \param[in,out] dac_module Pointer to the DAC software instance struct - * \param[in] channel Logical channel to enable callback function - * \param[in] type Type of callback function callbacks to enable - * - * \return Status of the callback enable operation. - * \retval STATUS_OK The callback was enabled successfully - * \retval STATUS_ERR_UNSUPPORTED_DEV If a callback that requires event driven - * mode was specified with a DAC instance - * configured in non-event mode - */ -enum status_code dac_chan_enable_callback( - struct dac_module *const module_inst, - const enum dac_channel channel, - const enum dac_callback type) -{ - /* Sanity check arguments */ - Assert(module_inst); - - UNUSED(channel); - - /* DAC interrupts require it to be driven by events to work, fail if in - * unbuffered (polled) mode */ - if (module_inst->start_on_event == false) { - return STATUS_ERR_UNSUPPORTED_DEV; - } - - module_inst->callback_enable[type] = true; - - return STATUS_OK; -} - -/** - * \brief Disables asynchronous callback generation for a given channel and type. - * - * Disables asynchronous callbacks for a given logical DAC channel and type. - * - * \param[in,out] dac_module Pointer to the DAC software instance struct - * \param[in] channel Logical channel to disable callback function - * \param[in] type Type of callback function callbacks to disable - * - * \return Status of the callback disable operation. - * \retval STATUS_OK The callback was disabled successfully - * \retval STATUS_ERR_UNSUPPORTED_DEV If a callback that requires event driven - * mode was specified with a DAC instance - * configured in non-event mode - */ -enum status_code dac_chan_disable_callback( - struct dac_module *const module_inst, - const enum dac_channel channel, - const enum dac_callback type) -{ - /* Sanity check arguments */ - Assert(module_inst); - - UNUSED(channel); - - /* DAC interrupts require it to be driven by events to work, fail if in - * unbuffered (polled) mode */ - if (module_inst->start_on_event == false) { - return STATUS_ERR_UNSUPPORTED_DEV; - } - - module_inst->callback_enable[type] = false; - - return STATUS_OK; -} - -/** \internal - * Internal handler for DAC module interrupts. - * - * \param[in] instance DAC instance number - */ -static void _dac_interrupt_handler(const uint8_t instance) -{ - struct dac_module *module = _dac_instances[instance]; - Dac *const dac_hw = module->hw; - - if (dac_hw->INTFLAG.reg & DAC_INTFLAG_UNDERRUN) { - dac_hw->INTFLAG.reg = DAC_INTFLAG_UNDERRUN; - - if ((module->callback) && - (module->callback_enable[DAC_CALLBACK_DATA_UNDERRUN])){ - module->callback[DAC_CALLBACK_DATA_UNDERRUN](0); - } - } - - if (dac_hw->INTFLAG.reg & DAC_INTFLAG_EMPTY) { - dac_hw->INTFLAG.reg = DAC_INTFLAG_EMPTY; - - /* If in a write buffer job */ - if (module->remaining_conversions) { - - /* Fill the data buffer with next data in write buffer */ - dac_hw->DATABUF.reg = - module->job_buffer[module->transferred_conversions++]; - - /* Write buffer size decrement */ - module->remaining_conversions --; - - /* If in a write buffer job and all the data are converted */ - if (module->remaining_conversions == 0) { - module->job_status = STATUS_OK; - - /* Disable interrupt */ - dac_hw->INTENCLR.reg = DAC_INTENCLR_EMPTY; - dac_hw->INTFLAG.reg = DAC_INTFLAG_EMPTY; - system_interrupt_disable(SYSTEM_INTERRUPT_MODULE_DAC); - - if ((module->callback) && - (module->callback_enable[DAC_CALLBACK_TRANSFER_COMPLETE])) { - module->callback[DAC_CALLBACK_TRANSFER_COMPLETE](0); - } - } - } - - if ((module->callback) && - (module->callback_enable[DAC_CALLBACK_DATA_EMPTY])) { - module->callback[DAC_CALLBACK_DATA_EMPTY](0); - } - } -} - -/** Handler for the DAC hardware module interrupt. */ -void DAC_Handler(void) -{ - _dac_interrupt_handler(0); -} - -/** - * \brief Gets the status of a job - * - * Gets the status of an ongoing or the last job. - * - * \param[in] module_inst Pointer to the DAC software instance struct - * \param[in] channel Logical channel to enable callback function - * - * \return Status of the job. - */ -enum status_code dac_chan_get_job_status( - struct dac_module *module_inst, - const enum dac_channel channel) -{ - /* Sanity check arguments */ - Assert(module_inst); - - UNUSED(channel); - - return module_inst->job_status; -} - -/** - * \brief Aborts an ongoing job - * - * Aborts an ongoing job. - * - * \param[in] module_inst Pointer to the DAC software instance struct - * \param[in] channel Logical channel to enable callback function - */ -void dac_chan_abort_job( - struct dac_module *module_inst, - const enum dac_channel channel) -{ - /* Sanity check arguments */ - Assert(module_inst); - - UNUSED(channel); - - /* Disable interrupt */ - module_inst->hw->INTFLAG.reg = DAC_INTFLAG_UNDERRUN | DAC_INTFLAG_EMPTY; - module_inst->hw->INTENCLR.reg = DAC_INTENCLR_UNDERRUN | DAC_INTENCLR_EMPTY; - - /* Mark job as aborted */ - module_inst->job_status = STATUS_ABORTED; - module_inst->remaining_conversions = 0; - -} diff --git a/atmel-samd/asf/sam0/drivers/dac/dac_sam_d_c/dac_feature.h b/atmel-samd/asf/sam0/drivers/dac/dac_sam_d_c/dac_feature.h deleted file mode 100644 index ae7ce8d65..000000000 --- a/atmel-samd/asf/sam0/drivers/dac/dac_sam_d_c/dac_feature.h +++ /dev/null @@ -1,634 +0,0 @@ -/** - * \file - * - * \brief SAM Peripheral Digital-to-Analog Converter Driver - * - * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef DAC_FEATURE_H_INCLUDED -#define DAC_FEATURE_H_INCLUDED - -/** - * \defgroup asfdoc_sam0_dac_group SAM Digital-to-Analog (DAC) Driver - * - * This driver for Atmel® | SMART ARM®-based microcontrollers provides an interface for the conversion of - * digital values to analog voltage. The following driver API modes are covered - * by this manual: - * - * - Polled APIs - * \if DAC_CALLBACK_MODE - * - Callback APIs - * \endif - * - * The following peripheral is used by this module: - * - DAC (Digital-to-Analog Converter) - * - * The following devices can use this module: - * - Atmel | SMART SAM D20/D21 - * - Atmel | SMART SAM D10/D11 - * - Atmel | SMART SAM DA1 - * - Atmel | SMART SAM C21 - * - * The outline of this documentation is as follows: - * - \ref asfdoc_sam0_dac_prerequisites - * - \ref asfdoc_sam0_dac_module_overview - * - \ref asfdoc_sam0_dac_special_considerations - * - \ref asfdoc_sam0_dac_extra_info - * - \ref asfdoc_sam0_dac_examples - * - \ref asfdoc_sam0_dac_api_overview - * - * - * \section asfdoc_sam0_dac_prerequisites Prerequisites - * - * There are no prerequisites for this module. - * - * - * \section asfdoc_sam0_dac_module_overview Module Overview - * - * The Digital-to-Analog converter converts a digital value to analog voltage. - * The SAM DAC module has one channel with 10-bit resolution, - * and is capable of converting up to 350k samples per second (ksps). - * - * A common use of DAC is to generate audio signals by connecting the DAC - * output to a speaker, or to generate a reference voltage; either for an - * external circuit or an internal peripheral such as the Analog Comparator. - * - * After being set up, the DAC will convert new digital values written to the - * conversion data register (DATA) to an analog value either on the VOUT pin of - * the device, or internally for use as an input to the AC, ADC, and other analog - * modules. - * - * Writing the DATA register will start a new conversion. It is also possible - * to trigger the conversion from the event system. - * - * A simplified block diagram of the DAC can be seen in - * \ref asfdoc_sam0_dac_module_block_diagram "the figure below". - * - * \anchor asfdoc_sam0_dac_module_block_diagram - * \image html dac_block_diagram.svg "DAC Block Diagram" - * - * \subsection asfdoc_sam0_dac_conversion_range Conversion Range - * The conversion range is between GND and the selected voltage reference. - * Available voltage references are: - * \li AVCC voltage reference - * \li Internal 1V reference (INT1V) - * \li External voltage reference (AREF) - * - * \note Internal references will be enabled by the driver, but not disabled. - * Any reference not used by the application should be disabled by the application. - * - * The output voltage from a DAC channel is given as: - * \f[ - * V_{OUT} = \frac{DATA}{0x3FF} \times VREF - * \f] - * - * \subsection asfdoc_sam0_dac_conversion Conversion - * The digital value written to the conversion data register (DATA) will be - * converted to an analog value. - * Writing the DATA register will start a new conversion. - * It is also possible to write the conversion data to the DATABUF register, - * the writing of the DATA register can then be triggered from the event - * system, which will load the value from DATABUF to DATA. - * - * \subsection asfdoc_sam0_dac_analog_output Analog Output - * The analog output value can be output to either the VOUT pin or internally, - * but not both at the same time. - * - * \subsubsection asfdoc_sam0_dac_analog_output_external External Output - * The output buffer must be enabled in order to drive the DAC output to the - * VOUT pin. Due to the output buffer, the DAC has high drive strength, and is - * capable of driving both resistive and capacitive loads, as well as loads - * which combine both. - * - * \subsubsection asfdoc_sam0_dac_analog_output_internal Internal Output - * The analog value can be internally available for use as input to the - * AC or ADC modules. - * - * \subsection asfdoc_sam0_dac_events Events - * Events generation and event actions are configurable in the DAC. - * The DAC has one event line input and one event output: <i>Start Conversion</i> - * and <i>Data Buffer Empty</i>. - * - * If the Start Conversion input event is enabled in the module configuration, - * an incoming event will load data from the data buffer to the data register - * and start a new conversion. This method synchronizes conversions with - * external events (such as those from a timer module) and ensures regular and - * fixed conversion intervals. - * - * If the Data Buffer Empty output event is enabled in the module configuration, - * events will be generated when the DAC data buffer register becomes empty and - * new data can be loaded to the buffer. - * - * \note The connection of events between modules requires the use of the event - * driver to route output event of one module to the input event of another. - * For more information on event routing, refer to the documentation - * \ref asfdoc_sam0_events_group "SAM Event System (EVENTS) Driver". - * - * \subsection asfdoc_sam0_dac_data_adjust Left and Right Adjusted Values - * The 10-bit input value to the DAC is contained in a 16-bit register. This - * can be configured to be either left or right adjusted. In - * \ref asfdoc_sam0_dac_module_adj_modes "the figure below" both options are - * shown, and the position of the most (MSB) and the least (LSB) significant bits - * are indicated. The unused bits should always be written to zero. - * - * \anchor asfdoc_sam0_dac_module_adj_modes - * \dot - * digraph { - * subgraph cluster_right { - * msbl [label="MSB", shape=none, group="msbl"]; - * lsbl [label="LSB", shape=none]; - * node [shape=none]; - * color="white"; - * reg_left [label=< - * <table cellspacing="0" cellpadding="2" width="100%"> - * <tr> - * <td port="msb">15</td> - * <td>14</td> - * <td>13</td> - * <td>12</td> - * <td>11</td> - * <td>10</td> - * <td>9</td> - * <td>8</td> - * <td>7</td> - * <td port="lsb">6</td> - * <td>5</td> - * <td>4</td> - * <td>3</td> - * <td>2</td> - * <td>1</td> - * <td>0</td> - * </tr> - * <tr> - * <td COLSPAN="10"> DATA[9:0] </td> - * <td BGCOLOR="lightgray"> </td> - * <td BGCOLOR="lightgray"> </td> - * <td BGCOLOR="lightgray"> </td> - * <td BGCOLOR="lightgray"> </td> - * <td BGCOLOR="lightgray"> </td> - * <td BGCOLOR="lightgray"> </td> - * </tr> - * </table> - * >]; - * msbl -> reg_left:msb:n; - * lsbl -> reg_left:lsb; - * label ="Left adjusted.\n"; - * } - * subgraph cluster_left { - * rankdir=TB; - * msb [label="MSB", shape=none]; - * lsb [label="LSB", shape=none]; - * color="white"; - * node [shape=none]; - * reg_right [label=< - * <table cellspacing="0" cellpadding="2"> - * <tr> - * <td>15</td> - * <td>14</td> - * <td>13</td> - * <td>12</td> - * <td>11</td> - * <td>10</td> - * <td port="msb">9</td> - * <td>8</td> - * <td>7</td> - * <td>6</td> - * <td>5</td> - * <td>4</td> - * <td>3</td> - * <td>2</td> - * <td>1</td> - * <td port="lsb">0</td> - * </tr> - * <tr> - * <td BGCOLOR="lightgray"></td> - * <td BGCOLOR="lightgray"></td> - * <td BGCOLOR="lightgray"></td> - * <td BGCOLOR="lightgray"></td> - * <td BGCOLOR="lightgray"></td> - * <td BGCOLOR="lightgray"></td> - * <td COLSPAN="10"> DATA[9:0] </td> - * </tr> - * </table> - * >]; - * msb -> reg_right:msb; - * lsb -> reg_right:lsb:n; - * label = "Right adjusted.\n"; - * graph [shape=none]; - * } - * } - * \enddot - * - * \subsection asfdoc_sam0_dac_clk_sources Clock Sources - * The clock for the DAC interface (CLK_DAC) is generated by the Power Manager. - * This clock is turned on by default, and can be enabled and disabled in the - * Power Manager. - * - * Additionally, an asynchronous clock source (GCLK_DAC) is required. - * These clocks are normally disabled by default. The selected clock source - * must be enabled in the Power Manager before it can be used by the DAC. - * The DAC core operates asynchronously from the user interface and - * peripheral bus. As a consequence, the DAC needs two clock cycles of both - * CLK_DAC and GCLK_DAC to synchronize the values written to some of the - * control and data registers. - * The oscillator source for the GCLK_DAC clock is selected in the System - * Control Interface (SCIF). - * - * \section asfdoc_sam0_dac_special_considerations Special Considerations - * - * \subsection asfdoc_sam0_dac_special_considerations_output_buffer Output Driver - * The DAC can only do conversions in Active or Idle modes. However, if the - * output buffer is enabled it will draw current even if the system is in - * sleep mode. Therefore, always make sure that the output buffer is not - * enabled when it is not needed, to ensure minimum power consumption. - * - * \subsection asfdoc_sam0_dac_special_considerations_conversion_time Conversion Time - * DAC conversion time is approximately 2.85µs. The user must ensure that new - * data is not written to the DAC before the last conversion is complete. - * Conversions should be triggered by a periodic event from a Timer/Counter or - * another peripheral. - * - * - * \section asfdoc_sam0_dac_extra_info Extra Information - * - * For extra information, see \ref asfdoc_sam0_dac_extra. This includes: - * - \ref asfdoc_sam0_dac_extra_acronyms - * - \ref asfdoc_sam0_dac_extra_dependencies - * - \ref asfdoc_sam0_dac_extra_errata - * - \ref asfdoc_sam0_dac_extra_history - * - * - * \section asfdoc_sam0_dac_examples Examples - * - * For a list of examples related to this driver, see - * \ref asfdoc_sam0_dac_exqsg. - * - * - * \section asfdoc_sam0_dac_api_overview API Overview - * @{ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include <compiler.h> -#include <clock.h> -#include <gclk.h> - - -/** - * \name DAC Status Flags - * - * DAC status flags, returned by \ref dac_get_status() and cleared by - * \ref dac_clear_status(). - * @{ - */ - -/** Data Buffer Empty Channel 0 - Set when data is transferred from DATABUF - * to DATA by a start conversion event and DATABUF is ready for new data. - */ -#define DAC_STATUS_CHANNEL_0_EMPTY (1UL << 0) - -/** Under-run Channel 0 - Set when a start conversion event occurs when - * DATABUF is empty. - */ -#define DAC_STATUS_CHANNEL_0_UNDERRUN (1UL << 1) - -/** @} */ - -/** - * \brief DAC reference voltage enum. - * - * Enum for the possible reference voltages for the DAC. - */ -enum dac_reference { - /** 1V from the internal band-gap reference*/ - DAC_REFERENCE_INT1V = DAC_CTRLB_REFSEL(0), - /** Analog V<SUB>CC</SUB> as reference */ - DAC_REFERENCE_AVCC = DAC_CTRLB_REFSEL(1), - /** External reference on AREF */ - DAC_REFERENCE_AREF = DAC_CTRLB_REFSEL(2), -}; - -/** - * \brief DAC output selection enum. - * - * Enum for the DAC output selection. - */ -enum dac_output { - /** DAC output to VOUT pin */ - DAC_OUTPUT_EXTERNAL = DAC_CTRLB_EOEN, - /** DAC output as internal reference */ - DAC_OUTPUT_INTERNAL = DAC_CTRLB_IOEN, - /** No output */ - DAC_OUTPUT_NONE = 0, -}; - -/** - * \brief DAC channel selection enum. - * - * Enum for the DAC channel selection. - */ -enum dac_channel { - /** DAC output channel 0 */ - DAC_CHANNEL_0, -}; - -/** - * \brief DAC software device instance structure. - * - * DAC software instance structure, used to retain software state information - * of an associated hardware module instance. - * - * \note The fields of this structure should not be altered by the user - * application; they are reserved for module-internal use only. - */ -struct dac_module { -#if !defined(__DOXYGEN__) - /** DAC hardware module */ - Dac *hw; - /** DAC output selection */ - enum dac_output output; - /** Reference selection */ - enum dac_reference reference; - /** DAC event selection */ - bool start_on_event; -# if DAC_CALLBACK_MODE == true - /** Pointer to buffer used for ADC results */ - volatile uint16_t *job_buffer; - /** Remaining number of conversions in current job */ - volatile uint16_t remaining_conversions; - /** Transferred number of conversions in current job */ - volatile uint16_t transferred_conversions; - /** DAC callback enable */ - bool callback_enable[DAC_CALLBACK_N]; - /** DAC registered callback functions */ - dac_callback_t callback[DAC_CALLBACK_N]; - /** Holds the status of the ongoing or last conversion job */ - volatile enum status_code job_status; -# endif -#endif -}; - -/** - * \brief DAC configuration structure. - * - * Configuration structure for a DAC instance. This structure should be - * initialized by the \ref dac_get_config_defaults() - * function before being modified by the user application. - */ -struct dac_config { - /** Reference voltage */ - enum dac_reference reference; - /** Select DAC output */ - enum dac_output output; - /** Left adjusted data */ - bool left_adjust; - /** GCLK generator used to clock the peripheral */ - enum gclk_generator clock_source; -#ifdef FEATURE_DAC_DATABUF_WRITE_PROTECTION - /** Bypass DATABUF write protection */ - bool databuf_protection_bypass; -#endif - /** Voltage pump disable */ - bool voltage_pump_disable; - /** - * The DAC behaves as in normal mode when the chip enters STANDBY sleep - * mode - */ - bool run_in_standby; -#if (SAMC21) - /** Dither mode enable data */ - bool dither_mode; -#endif -}; - -/** - * \brief DAC event enable/disable structure. - * - * Event flags for the DAC module. This is used to enable and - * disable events via \ref dac_enable_events() and \ref dac_disable_events(). - */ -struct dac_events { - /** Start a new DAC conversion */ - bool on_event_start_conversion; - /** Enable event generation on data buffer empty */ - bool generate_event_on_buffer_empty; -#if (SAMC21) - /** Enable the falling edge of the input event for DAC1 */ - bool generate_event_on_chan_falling_edge; -#endif -}; - -/** - * \brief DAC channel configuration structure - * - * Configuration for a DAC channel. This structure should be initialized by the - * \ref dac_chan_get_config_defaults() function before being modified by the - * user application. - */ -struct dac_chan_config { -#if !defined(__DOXYGEN__) - /** Dummy value to ensure the struct has at least one member */ - uint8_t _dummy; -#endif -}; - -/** - * \name Configuration and Initialization (Channel) - * @{ - */ - -void dac_chan_enable_output_buffer( - struct dac_module *const dev_inst, - const enum dac_channel channel); - -void dac_chan_disable_output_buffer( - struct dac_module *const dev_inst, - const enum dac_channel channel); - -/** @} */ - -/** @} */ - -/** - * \page asfdoc_sam0_dac_extra Extra Information for DAC Driver - * - * \section asfdoc_sam0_dac_extra_acronyms Acronyms - * The table below presents the acronyms used in this module: - * - * <table> - * <tr> - * <th>Acronym</th> - * <th>Description</th> - * </tr> - * <tr> - * <td>ADC</td> - * <td>Analog-to-Digital Converter</td> - * </tr> - * <tr> - * <td>AC</td> - * <td>Analog Comparator</td> - * </tr> - * <tr> - * <td>DAC</td> - * <td>Digital-to-Analog Converter</td> - * </tr> - * <tr> - * <td>LSB</td> - * <td>Least Significant Bit</td> - * </tr> - * <tr> - * <td>MSB</td> - * <td>Most Significant Bit</td> - * </tr> - * <tr> - * <td>DMA</td> - * <td>Direct Memory Access</td> - * </tr> - * </table> - * - * - * \section asfdoc_sam0_dac_extra_dependencies Dependencies - * This driver has the following dependencies: - * - * - \ref asfdoc_sam0_system_pinmux_group "System Pin Multiplexer Driver" - * - * - * \section asfdoc_sam0_dac_extra_errata Errata - * There are no errata related to this driver. - * - * - * \section asfdoc_sam0_dac_extra_history Module History - * An overview of the module history is presented in the table below, with - * details on the enhancements and fixes made to the module since its first - * release. The current version of this corresponds to the newest version in - * the table. - * - * <table> - * <tr> - * <th>Changelog</th> - * </tr> - * <tr> - * <td>Add configuration for using 14-bit hardware dithering (SAMC21 support)</td> - * </tr> - * <tr> - * <td>Added new configuration parameters \c databuf_protection_bypass, - * \c voltage_pump_disable. Added new callback functions - * \c dac_chan_write_buffer_wait, - * \c dac_chan_write_buffer_job, \c dac_chan_write_job, - * \c dac_get_job_status, \c dac_abort_job and new callback type - * \c DAC_CALLBACK_TRANSFER_COMPLETE for DAC conversion job</td> - * </tr> - * <tr> - * <td>Initial Release</td> - * </tr> - * </table> - */ - -/** - * \page asfdoc_sam0_dac_exqsg Examples for DAC Driver - * - * This is a list of the available Quick Start guides (QSGs) and example - * applications for \ref asfdoc_sam0_dac_group. QSGs are simple examples with - * step-by-step instructions to configure and use this driver in a selection of - * use cases. Note that a QSG can be compiled as a standalone application or be - * added to the user application. - * - * - \subpage asfdoc_sam0_dac_basic_use_case - * \if DAC_CALLBACK_MODE - * - \subpage asfdoc_sam0_dac_basic_use_case_callback - * \endif - * \if DAC_DMA_USE_MODE_SELECTION - * - \subpage asfdoc_sam0_adc_dma_use_case_dac_in_dma - * \endif - * - * \if DAC_DMA_USE_MODE_SELECTION - * \page asfdoc_sam0_adc_dma_use_case_dac_in_dma Quick Start Guide for Using DMA with ADC/DAC - * For this examples, see - * \ref asfdoc_sam0_adc_dma_use_case - * \endif - * - * \page asfdoc_sam0_dac_document_revision_history Document Revision History - * - * <table> - * <tr> - * <th>Doc. Rev.</td> - * <th>Date</td> - * <th>Comments</td> - * </tr> - * <tr> - * <td>42110E</td> - * <td>09/2015</td> - * <td>Add SAM C21 and SAM DA1 support</td> - * </tr> - * <tr> - * <td>42110D</td> - * <td>12/2014</td> - * <td>Add SAM D10/D11 support</td> - * </tr> - * <tr> - * <td>42110C</td> - * <td>01/2014</td> - * <td>Add SAM D21 support</td> - * </tr> - * <tr> - * <td>42110B</td> - * <td>06/2013</td> - * <td>Added additional documentation on the event system. Corrected - * documentation typos.</td> - * </tr> - * <tr> - * <td>42110A</td> - * <td>06/2013</td> - * <td>Initial document release</td> - * </tr> - * </table> - */ - -#ifdef __cplusplus -} -#endif - - -#endif /* DAC_FEATURE_H_INCLUDED */ - diff --git a/atmel-samd/asf/sam0/drivers/dac/docimg/dac_block_diagram.svg b/atmel-samd/asf/sam0/drivers/dac/docimg/dac_block_diagram.svg deleted file mode 100644 index 0b064257a..000000000 --- a/atmel-samd/asf/sam0/drivers/dac/docimg/dac_block_diagram.svg +++ /dev/null @@ -1,218 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> - -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - id="svg2985" - version="1.1" - inkscape:version="0.48.4 r9939" - width="500" - height="290" - sodipodi:docname="dac_block_diagram.gif"> - <metadata - id="metadata2991"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> - </cc:Work> - </rdf:RDF> - </metadata> - <defs - id="defs2989" /> - <sodipodi:namedview - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1" - objecttolerance="10" - gridtolerance="10" - guidetolerance="10" - inkscape:pageopacity="0" - inkscape:pageshadow="2" - inkscape:window-width="1397" - inkscape:window-height="1023" - id="namedview2987" - showgrid="false" - inkscape:zoom="2.168" - inkscape:cx="250" - inkscape:cy="145" - inkscape:window-x="0" - inkscape:window-y="100" - inkscape:window-maximized="0" - inkscape:current-layer="svg2985" /> - <image - width="500" - height="290" - xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAAEiCAIAAACA07fvAAAAA3NCSVQICAjb4U/gAAAgAElEQVR4 -nO3dL5Ta2t4+8Ce/9RMHV3eQu4pUlaqOG1yD46hBjroEdXGXUW3VcF2OIrxqJKOKI3UZN68qVc2o -ieS6urmOVwRCgAQCE/Jn5/msrq6ZsBMCAw9fdnZ2lMViASIiksv/y3oHiIgoeQx3IiIJMdyJiCTE -cCcikhDDnYhIQgx3IiIJMdyJiCTEcCcikhDDnYhIQgx3IiIJMdyJiCTEcCcikhDDnYhIQgx3IiIJ -MdypBFyzoWxomK6/fPmzx9IVRdGt3VV0a3crqxs272hjAVFWGO5UDpfD58WarYvV8kuMLXfVypo4 -l5chqzwPnabu6Pbyl8v1TdNFs7NKc9e8HrefTS29R0UU6ehwDyld5HWOZ5xP9Ssl/TS326qf7tbE -abfVkEZCa186rhty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cCxGVT3SmR0+4vzNXv26FLFzOzb/b2Nxaoqc5hi+VcL8w1r3hzQoetYhBLBZG9Y2bLnS4 -g9WYyCAVxjd8XW1wVIfRi30vRCSng1V5RF0v9H5nNAkErzUZdfrLifkvh89+n87z0Gnq1tbCxWI9 -h//mclPbWOKvnY60umVaNloRN4nealyjhulWL4oKw95p5jfeGQ+z516oHA5+MSe5RXXOHHhhaK1/ -NL/5l1OxJqNOy0x834TWvhy7LiAS33QYnqFKkkhrShnKu936PcZHfvSE+w/dt363ytuuOjW1rYXB -3pbg8p0i3bXGD2p6ncUMdyo8P9bLNhyCogTzPeaXucgJ91f9KtMOLofPyyuw7Ha/YGe5tzQQ9/5H -QzoY7iQDxjrtOu7L3KEJ9zVzqnbfHt1nvvExkGK0cz53ykqyI9LYIUNb/BdY7E/9gxPua/3h5duB -2b9Lah/Pi5U7ZYblNuXKwQn3hX43RPd6MNvqc1+NhcwXzucehvO5p+71pTf/XqUVWqH7Xe27fe5H -VvRFxcqdcuE1Vby3LkfLkG93tExWe5IhhjvlSCIRn+wuUeFsFeaLwPV1S+XUbpkSkP5bW87Ff6Xx -L1VywTSP6nKJ00YyrNzDSf+Hzz8ebqVj7UntEr6Wjh4KWcLniDJU2u/UdJo9ARU1M4GsWLlTAbCK -p4NiVgDlKRQY7lQYjHja7+DLo1SvH56hSgXDjhqKwldFUIl6oIiIyoPdMkREEmK4ExFJiOFORCQh -hjsRkYQY7kREEmK4ExFJiOFORCQhhjsRkYQY7kREEmK4ExFJ6P8AiPh3kkqHPTkAAAAASUVORK5C -YII= -" - id="image2993" - x="0" - y="0" /> -</svg> diff --git a/atmel-samd/asf/sam0/drivers/dac/docimg/dac_block_diagram_saml.svg b/atmel-samd/asf/sam0/drivers/dac/docimg/dac_block_diagram_saml.svg deleted file mode 100644 index 0ed3f88e7..000000000 --- a/atmel-samd/asf/sam0/drivers/dac/docimg/dac_block_diagram_saml.svg +++ /dev/null @@ -1,1303 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> - -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - id="svg2985" - version="1.1" - inkscape:version="0.48.4 r9939" - width="792" - height="421" - sodipodi:docname="dac_block_diagram_saml.gif"> - <metadata - id="metadata2991"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> - </cc:Work> - </rdf:RDF> - </metadata> - <defs - id="defs2989" /> - <sodipodi:namedview - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1" - objecttolerance="10" - gridtolerance="10" - guidetolerance="10" - inkscape:pageopacity="0" - inkscape:pageshadow="2" - inkscape:window-width="945" - inkscape:window-height="1005" - id="namedview2987" - showgrid="false" - inkscape:zoom="0.4280303" - inkscape:cx="396" - inkscape:cy="210.5" - inkscape:window-x="0" - inkscape:window-y="100" - inkscape:window-maximized="0" - inkscape:current-layer="svg2985" /> - <image - width="792" - height="421" - xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAxgAAAGlCAYAAAB5tlDmAAAABHNCSVQICAgIfAhkiAAAIABJREFU -eJzsXdl54zqzrLnfHw05b3AqcghUGJbDEEOwUjHejpjO3AeggeoGKG/SWOZ0nW8OLRA7ty70gl9/ -/vz5A4fD4XA4HA6Hw+G4Av7vuzvgcDgcDofD4XA4tgMnGA6Hw+FwOBwOh+NqcILhcDgcDofD4XA4 -rgYnGA6Hw+FwOBwOh+NqcILhcDgcDofD4XA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mCC -" - id="image2993" - x="0" - y="0" /> -</svg> diff --git a/atmel-samd/asf/sam0/drivers/dma/dma.c b/atmel-samd/asf/sam0/drivers/dma/dma.c deleted file mode 100644 index 23592cda3..000000000 --- a/atmel-samd/asf/sam0/drivers/dma/dma.c +++ /dev/null @@ -1,654 +0,0 @@ -/* - * \file - * - * \brief SAM Direct Memory Access Controller Driver - * - * Copyright (C) 2014-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#include <string.h> -#include "dma.h" -#include "clock.h" -#include "system_interrupt.h" - -struct _dma_module { - volatile bool _dma_init; - volatile uint32_t allocated_channels; - uint8_t free_channels; -}; - -struct _dma_module _dma_inst = { - ._dma_init = false, - .allocated_channels = 0, - .free_channels = CONF_MAX_USED_CHANNEL_NUM, -}; - -/** Maximum retry counter for resuming a job transfer. */ -#define MAX_JOB_RESUME_COUNT 10000 - -/** DMA channel mask. */ -#define DMA_CHANNEL_MASK (0x1f) - -COMPILER_ALIGNED(16) -DmacDescriptor descriptor_section[CONF_MAX_USED_CHANNEL_NUM] SECTION_DMAC_DESCRIPTOR; - -/** Initial write back memory section. */ -COMPILER_ALIGNED(16) -static DmacDescriptor _write_back_section[CONF_MAX_USED_CHANNEL_NUM] SECTION_DMAC_DESCRIPTOR; - -/** Internal DMA resource pool. */ -static struct dma_resource* _dma_active_resource[CONF_MAX_USED_CHANNEL_NUM]; - -/* DMA channel interrup flag. */ -uint8_t g_chan_interrupt_flag[CONF_MAX_USED_CHANNEL_NUM]={0}; - -/** - * \brief Find a free channel for a DMA resource. - * - * Find a channel for the requested DMA resource. - * - * \return Status of channel allocation. - * \retval DMA_INVALID_CHANNEL No channel available - * \retval count Allocated channel for the DMA resource - */ -static uint8_t _dma_find_first_free_channel_and_allocate(void) -{ - uint8_t count; - uint32_t tmp; - bool allocated = false; - - system_interrupt_enter_critical_section(); - - tmp = _dma_inst.allocated_channels; - - for (count = 0; count < CONF_MAX_USED_CHANNEL_NUM; ++count) { - if (!(tmp & 0x00000001)) { - /* If free channel found, set as allocated and return - *number */ - - _dma_inst.allocated_channels |= 1 << count; - _dma_inst.free_channels--; - allocated = true; - - break; - } - - tmp = tmp >> 1; - } - - system_interrupt_leave_critical_section(); - - if (!allocated) { - return DMA_INVALID_CHANNEL; - } else { - return count; - } -} - -/** - * \brief Release an allocated DMA channel. - * - * \param[in] channel Channel id to be released - * - */ -static void _dma_release_channel(uint8_t channel) -{ - _dma_inst.allocated_channels &= ~(1 << channel); - _dma_inst.free_channels++; -} - -/** - * \brief Configure the DMA resource. - * - * \param[in] dma_resource Pointer to a DMA resource instance - * \param[out] resource_config Configurations of the DMA resource - * - */ -static void _dma_set_config(struct dma_resource *resource, - struct dma_resource_config *resource_config) -{ - Assert(resource); - Assert(resource_config); - uint32_t temp_CHCTRLB_reg; - system_interrupt_enter_critical_section(); - - /** Select the DMA channel and clear software trigger */ - DMAC->CHID.reg = DMAC_CHID_ID(resource->channel_id); - DMAC->SWTRIGCTRL.reg &= (uint32_t)(~(1 << resource->channel_id)); - - temp_CHCTRLB_reg = DMAC_CHCTRLB_LVL(resource_config->priority) | \ - DMAC_CHCTRLB_TRIGSRC(resource_config->peripheral_trigger) | \ - DMAC_CHCTRLB_TRIGACT(resource_config->trigger_action); - - - if(resource_config->event_config.input_action){ - temp_CHCTRLB_reg |= DMAC_CHCTRLB_EVIE | DMAC_CHCTRLB_EVACT( - resource_config->event_config.input_action); - } - - /** Enable event output, the event output selection is configured in - * each transfer descriptor */ - if (resource_config->event_config.event_output_enable) { - temp_CHCTRLB_reg |= DMAC_CHCTRLB_EVOE; - } - - /* Write config to CTRLB register */ - DMAC->CHCTRLB.reg = temp_CHCTRLB_reg; - - - - system_interrupt_leave_critical_section(); -} - -/** - * \brief DMA interrupt service routine. - * - */ -void DMAC_Handler( void ) -{ - uint8_t active_channel; - struct dma_resource *resource; - uint8_t isr; - uint32_t write_size; - uint32_t total_size; - - system_interrupt_enter_critical_section(); - - /* Get Pending channel */ - active_channel = DMAC->INTPEND.reg & DMAC_INTPEND_ID_Msk; - - Assert(_dma_active_resource[active_channel]); - - /* Get active DMA resource based on channel */ - resource = _dma_active_resource[active_channel]; - - /* Select the active channel */ - DMAC->CHID.reg = DMAC_CHID_ID(resource->channel_id); - isr = DMAC->CHINTFLAG.reg; - - /* Calculate block transfer size of the DMA transfer */ - total_size = descriptor_section[resource->channel_id].BTCNT.reg; - write_size = _write_back_section[resource->channel_id].BTCNT.reg; - resource->transfered_size = total_size - write_size; - - /* DMA channel interrupt handler */ - if (isr & DMAC_CHINTENCLR_TERR) { - /* Clear transfer error flag */ - DMAC->CHINTFLAG.reg = DMAC_CHINTENCLR_TERR; - - /* Set I/O ERROR status */ - resource->job_status = STATUS_ERR_IO; - - /* Execute the callback function */ - if ((resource->callback_enable & (1<<DMA_CALLBACK_TRANSFER_ERROR)) && - (resource->callback[DMA_CALLBACK_TRANSFER_ERROR])) { - resource->callback[DMA_CALLBACK_TRANSFER_ERROR](resource); - } - } else if (isr & DMAC_CHINTENCLR_TCMPL) { - /* Clear the transfer complete flag */ - DMAC->CHINTFLAG.reg = DMAC_CHINTENCLR_TCMPL; - - /* Set job status */ - resource->job_status = STATUS_OK; - - /* Execute the callback function */ - if ((resource->callback_enable & (1 << DMA_CALLBACK_TRANSFER_DONE)) && - (resource->callback[DMA_CALLBACK_TRANSFER_DONE])) { - resource->callback[DMA_CALLBACK_TRANSFER_DONE](resource); - } - } else if (isr & DMAC_CHINTENCLR_SUSP) { - /* Clear channel suspend flag */ - DMAC->CHINTFLAG.reg = DMAC_CHINTENCLR_SUSP; - - /* Set job status */ - resource->job_status = STATUS_SUSPEND; - - /* Execute the callback function */ - if ((resource->callback_enable & (1 << DMA_CALLBACK_CHANNEL_SUSPEND)) && - (resource->callback[DMA_CALLBACK_CHANNEL_SUSPEND])){ - resource->callback[DMA_CALLBACK_CHANNEL_SUSPEND](resource); - } - } - - system_interrupt_leave_critical_section(); -} - -/** - * \brief Initializes config with predefined default values. - * - * This function will initialize a given DMA configuration structure to - * a set of known default values. This function should be called on - * any new instance of the configuration structure before being - * modified by the user application. - * - * The default configuration is as follows: - * \li Software trigger is used as the transfer trigger - * \li Priority level 0 - * \li Only software/event trigger - * \li Requires a trigger for each transaction - * \li No event input /output - * \li DMA channel is disabled during sleep mode (if has the feature) - * \param[out] config Pointer to the configuration - * - */ -void dma_get_config_defaults(struct dma_resource_config *config) -{ - Assert(config); - /* Set as priority 0 */ - config->priority = DMA_PRIORITY_LEVEL_0; - /* Only software/event trigger */ - config->peripheral_trigger = 0; - /* Transaction trigger */ - config->trigger_action = DMA_TRIGGER_ACTION_TRANSACTION; - - /* Event configurations, no event input/output */ - config->event_config.input_action = DMA_EVENT_INPUT_NOACT; - config->event_config.event_output_enable = false; -#ifdef FEATURE_DMA_CHANNEL_STANDBY - config->run_in_standby = false; -#endif -} - -/** - * \brief Allocate a DMA with configurations. - * - * This function will allocate a proper channel for a DMA transfer request. - * - * \param[in,out] dma_resource Pointer to a DMA resource instance - * \param[in] transfer_config Configurations of the DMA transfer - * - * \return Status of the allocation procedure. - * - * \retval STATUS_OK The DMA resource was allocated successfully - * \retval STATUS_ERR_NOT_FOUND DMA resource allocation failed - */ -enum status_code dma_allocate(struct dma_resource *resource, - struct dma_resource_config *config) -{ - uint8_t new_channel; - - Assert(resource); - - system_interrupt_enter_critical_section(); - - if (!_dma_inst._dma_init) { - /* Initialize clocks for DMA */ -#if (SAML21) || (SAML22) || (SAMC20) || (SAMC21) || (SAMR30) - system_ahb_clock_set_mask(MCLK_AHBMASK_DMAC); -#else - system_ahb_clock_set_mask(PM_AHBMASK_DMAC); - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBB, - PM_APBBMASK_DMAC); -#endif - - /* Perform a software reset before enable DMA controller */ - DMAC->CTRL.reg &= ~DMAC_CTRL_DMAENABLE; - DMAC->CTRL.reg = DMAC_CTRL_SWRST; - - /* Setup descriptor base address and write back section base - * address */ - DMAC->BASEADDR.reg = (uint32_t)descriptor_section; - DMAC->WRBADDR.reg = (uint32_t)_write_back_section; - - /* Enable all priority level at the same time */ - DMAC->CTRL.reg = DMAC_CTRL_DMAENABLE | DMAC_CTRL_LVLEN(0xf); - - _dma_inst._dma_init = true; - } - - /* Find the proper channel */ - new_channel = _dma_find_first_free_channel_and_allocate(); - - /* If no channel available, return not found */ - if (new_channel == DMA_INVALID_CHANNEL) { - system_interrupt_leave_critical_section(); - - return STATUS_ERR_NOT_FOUND; - } - - /* Set the channel */ - resource->channel_id = new_channel; - - /** Perform a reset for the allocated channel */ - DMAC->CHID.reg = DMAC_CHID_ID(resource->channel_id); - DMAC->CHCTRLA.reg &= ~DMAC_CHCTRLA_ENABLE; - DMAC->CHCTRLA.reg = DMAC_CHCTRLA_SWRST; - -#ifdef FEATURE_DMA_CHANNEL_STANDBY - if(config->run_in_standby){ - DMAC->CHCTRLA.reg |= DMAC_CHCTRLA_RUNSTDBY; - } -#endif - - /** Configure the DMA control,channel registers and descriptors here */ - _dma_set_config(resource, config); - - resource->descriptor = NULL; - - /* Log the DMA resource into the internal DMA resource pool */ - _dma_active_resource[resource->channel_id] = resource; - - system_interrupt_leave_critical_section(); - - return STATUS_OK; -} - -/** - * \brief Free an allocated DMA resource. - * - * This function will free an allocated DMA resource. - * - * \param[in,out] resource Pointer to the DMA resource - * - * \return Status of the free procedure. - * - * \retval STATUS_OK The DMA resource was freed successfully - * \retval STATUS_BUSY The DMA resource was busy and can't be freed - * \retval STATUS_ERR_NOT_INITIALIZED DMA resource was not initialized - */ -enum status_code dma_free(struct dma_resource *resource) -{ - Assert(resource); - Assert(resource->channel_id != DMA_INVALID_CHANNEL); - - system_interrupt_enter_critical_section(); - - /* Check if channel is busy */ - if (dma_is_busy(resource)) { - system_interrupt_leave_critical_section(); - return STATUS_BUSY; - } - - /* Check if DMA resource was not allocated */ - if (!(_dma_inst.allocated_channels & (1 << resource->channel_id))) { - system_interrupt_leave_critical_section(); - return STATUS_ERR_NOT_INITIALIZED; - } - - /* Release the DMA resource */ - _dma_release_channel(resource->channel_id); - - /* Reset the item in the DMA resource pool */ - _dma_active_resource[resource->channel_id] = NULL; - - system_interrupt_leave_critical_section(); - - return STATUS_OK; -} - -/** - * \brief Start a DMA transfer. - * - * This function will start a DMA transfer through an allocated DMA resource. - * - * \param[in,out] resource Pointer to the DMA resource - * - * \return Status of the transfer start procedure. - * - * \retval STATUS_OK The transfer was started successfully - * \retval STATUS_BUSY The DMA resource was busy and the transfer was not started - * \retval STATUS_ERR_INVALID_ARG Transfer size is 0 and transfer was not started - */ -enum status_code dma_start_transfer_job(struct dma_resource *resource) -{ - Assert(resource); - Assert(resource->channel_id != DMA_INVALID_CHANNEL); - - system_interrupt_enter_critical_section(); - - /* Check if resource was busy */ - if (resource->job_status == STATUS_BUSY) { - system_interrupt_leave_critical_section(); - return STATUS_BUSY; - } - - /* Check if transfer size is valid */ - if (resource->descriptor->BTCNT.reg == 0) { - system_interrupt_leave_critical_section(); - return STATUS_ERR_INVALID_ARG; - } - - /* Enable DMA interrupt */ - system_interrupt_enable(SYSTEM_INTERRUPT_MODULE_DMA); - - /* Set the interrupt flag */ - DMAC->CHID.reg = DMAC_CHID_ID(resource->channel_id); - DMAC->CHINTENSET.reg = (DMAC_CHINTENSET_MASK & g_chan_interrupt_flag[resource->channel_id]); - /* Set job status */ - resource->job_status = STATUS_BUSY; - - /* Set channel x descriptor 0 to the descriptor base address */ - memcpy(&descriptor_section[resource->channel_id], resource->descriptor, - sizeof(DmacDescriptor)); - - /* Enable the transfer channel */ - DMAC->CHCTRLA.reg |= DMAC_CHCTRLA_ENABLE; - - system_interrupt_leave_critical_section(); - - return STATUS_OK; -} - -/** - * \brief Abort a DMA transfer. - * - * This function will abort a DMA transfer. The DMA channel used for the DMA - * resource will be disabled. - * The block transfer count will also be calculated and written to the DMA - * resource structure. - * - * \note The DMA resource will not be freed after calling this function. - * The function \ref dma_free() can be used to free an allocated resource. - * - * \param[in,out] resource Pointer to the DMA resource - * - */ -void dma_abort_job(struct dma_resource *resource) -{ - uint32_t write_size; - uint32_t total_size; - - Assert(resource); - Assert(resource->channel_id != DMA_INVALID_CHANNEL); - - system_interrupt_enter_critical_section(); - - DMAC->CHID.reg = DMAC_CHID_ID(resource->channel_id); - DMAC->CHCTRLA.reg = 0; - - system_interrupt_leave_critical_section(); - - /* Get transferred size */ - total_size = descriptor_section[resource->channel_id].BTCNT.reg; - write_size = _write_back_section[resource->channel_id].BTCNT.reg; - resource->transfered_size = total_size - write_size; - - resource->job_status = STATUS_ABORTED; -} - -/** - * \brief Suspend a DMA transfer. - * - * This function will request to suspend the transfer of the DMA resource. - * The channel is kept enabled, can receive transfer triggers (the transfer - * pending bit will be set), but will be removed from the arbitration scheme. - * The channel operation can be resumed by calling \ref dma_resume_job(). - * - * \note This function sets the command to suspend the DMA channel - * associated with a DMA resource. The channel suspend interrupt flag - * indicates whether the transfer is truly suspended. - * - * \param[in] resource Pointer to the DMA resource - * - */ -void dma_suspend_job(struct dma_resource *resource) -{ - Assert(resource); - Assert(resource->channel_id != DMA_INVALID_CHANNEL); - - system_interrupt_enter_critical_section(); - - /* Select the channel */ - DMAC->CHID.reg = DMAC_CHID_ID(resource->channel_id); - - /* Send the suspend request */ - DMAC->CHCTRLB.reg |= DMAC_CHCTRLB_CMD_SUSPEND; - - system_interrupt_leave_critical_section(); -} - -/** - * \brief Resume a suspended DMA transfer. - * - * This function try to resume a suspended transfer of a DMA resource. - * - * \param[in] resource Pointer to the DMA resource - * - */ -void dma_resume_job(struct dma_resource *resource) -{ - uint32_t bitmap_channel; - uint32_t count = 0; - - Assert(resource); - Assert(resource->channel_id != DMA_INVALID_CHANNEL); - - /* Get bitmap of the allocated DMA channel */ - bitmap_channel = (1 << resource->channel_id); - - /* Check if channel was suspended */ - if (resource->job_status != STATUS_SUSPEND) { - return; - } - - system_interrupt_enter_critical_section(); - - /* Send resume request */ - DMAC->CHID.reg = DMAC_CHID_ID(resource->channel_id); - DMAC->CHCTRLB.reg |= DMAC_CHCTRLB_CMD_RESUME; - - system_interrupt_leave_critical_section(); - - /* Check if transfer job resumed */ - for (count = 0; count < MAX_JOB_RESUME_COUNT; count++) { - if ((DMAC->BUSYCH.reg & bitmap_channel) == bitmap_channel) { - break; - } - } - - if (count < MAX_JOB_RESUME_COUNT) { - /* Job resumed */ - resource->job_status = STATUS_BUSY; - } else { - /* Job resume timeout */ - resource->job_status = STATUS_ERR_TIMEOUT; - } -} - -/** - * \brief Create a DMA transfer descriptor with configurations. - * - * This function will set the transfer configurations to the DMA transfer - * descriptor. - * - * \param[in] descriptor Pointer to the DMA transfer descriptor - * \param[in] config Pointer to the descriptor configuration structure - * - */ -void dma_descriptor_create(DmacDescriptor* descriptor, - struct dma_descriptor_config *config) -{ - /* Set block transfer control */ - descriptor->BTCTRL.bit.VALID = config->descriptor_valid; - descriptor->BTCTRL.bit.EVOSEL = config->event_output_selection; - descriptor->BTCTRL.bit.BLOCKACT = config->block_action; - descriptor->BTCTRL.bit.BEATSIZE = config->beat_size; - descriptor->BTCTRL.bit.SRCINC = config->src_increment_enable; - descriptor->BTCTRL.bit.DSTINC = config->dst_increment_enable; - descriptor->BTCTRL.bit.STEPSEL = config->step_selection; - descriptor->BTCTRL.bit.STEPSIZE = config->step_size; - - /* Set transfer size, source address and destination address */ - descriptor->BTCNT.reg = config->block_transfer_count; - descriptor->SRCADDR.reg = config->source_address; - descriptor->DSTADDR.reg = config->destination_address; - - /* Set next transfer descriptor address */ - descriptor->DESCADDR.reg = config->next_descriptor_address; -} - -/** - * \brief Add a DMA transfer descriptor to a DMA resource. - * - * This function will add a DMA transfer descriptor to a DMA resource. - * If there was a transfer descriptor already allocated to the DMA resource, - * the descriptor will be linked to the next descriptor address. - * - * \param[in] resource Pointer to the DMA resource - * \param[in] descriptor Pointer to the transfer descriptor - * - * \retval STATUS_OK The descriptor is added to the DMA resource - * \retval STATUS_BUSY The DMA resource was busy and the descriptor is not added - */ -enum status_code dma_add_descriptor(struct dma_resource *resource, - DmacDescriptor* descriptor) -{ - DmacDescriptor* desc = resource->descriptor; - - if (resource->job_status == STATUS_BUSY) { - return STATUS_BUSY; - } - - /* Look up for an empty space for the descriptor */ - if (desc == NULL) { - resource->descriptor = descriptor; - } else { - /* Looking for end of descriptor link */ - while(desc->DESCADDR.reg != 0) { - desc = (DmacDescriptor*)(desc->DESCADDR.reg); - } - - /* Set to the end of descriptor list */ - desc->DESCADDR.reg = (uint32_t)descriptor; - } - - return STATUS_OK; -} diff --git a/atmel-samd/asf/sam0/drivers/dma/dma.h b/atmel-samd/asf/sam0/drivers/dma/dma.h deleted file mode 100644 index 1cf3498d9..000000000 --- a/atmel-samd/asf/sam0/drivers/dma/dma.h +++ /dev/null @@ -1,882 +0,0 @@ -/** - * \file - * - * \brief SAM Direct Memory Access Controller Driver - * - * Copyright (C) 2014-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef DMA_H_INCLUDED -#define DMA_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \defgroup asfdoc_sam0_dma_group SAM Direct Memory Access Controller (DMAC) Driver - * - * This driver for Atmel® | SMART ARM®-based microcontrollers provides an interface for the configuration - * and management of the Direct Memory Access Controller(DMAC) module within - * the device. The DMAC can transfer data between memories and peripherals, and - * thus off-load these tasks from the CPU. The module supports peripheral to - * peripheral, peripheral to memory, memory to peripheral, and memory to memory - * transfers. - * - * The following peripheral is used by the DMAC Driver: - * - DMAC (Direct Memory Access Controller) - * - * The following devices can use this module: - * - Atmel | SMART SAM D21 - * - Atmel | SMART SAM R21 - * - Atmel | SMART SAM D09/D10/D11 - * - Atmel | SMART SAM L21/L22 - * - Atmel | SMART SAM DA1 - * - Atmel | SMART SAM C20/C21 - * - Atmel | SMART SAM R30 - * - * The outline of this documentation is as follows: - * - \ref asfdoc_sam0_dma_prerequisites - * - \ref asfdoc_sam0_dma_module_overview - * - \ref asfdoc_sam0_dma_special_considerations - * - \ref asfdoc_sam0_dma_extra_info - * - \ref asfdoc_sam0_dma_examples - * - \ref asfdoc_sam0_dma_api_overview - * - * - * \section asfdoc_sam0_dma_prerequisites Prerequisites - * - * There are no prerequisites for this module. - * - * - * \section asfdoc_sam0_dma_module_overview Module Overview - * - * SAM devices with DMAC enables high data transfer rates with minimum - * CPU intervention and frees up CPU time. With access to all peripherals, - * the DMAC can handle automatic transfer of data to/from modules. - * It supports static and incremental addressing for both source and - * destination. - * - * The DMAC when used with Event System or peripheral triggers, provides a - * considerable advantage by reducing the power consumption and performing - * data transfer in the background. - * For example, if the ADC is configured to generate an event, it can trigger - * the DMAC to transfer the data into another peripheral or SRAM. - * The CPU can remain in sleep during this time to reduce the power consumption. - * - * <table> - * <tr> - * <th>Device</th> - * <th>Dma channel number</th> - * </tr> - * <tr> - * <td>SAM D21/R21/C20/C21</td> - * <td>12</td> - * </tr> - * <tr> - * <td>SAM D09/D10/D11</td> - * <td>6</td> - * </tr> - * <tr> - * <td>SAM L21,SAMR30</td> - * <td>16</td> - * </tr> - * </table> - * The DMA channel operation can be suspended at any time by software, by events - * from event system, or after selectable descriptor execution. The operation - * can be resumed by software or by events from the event system. - * The DMAC driver for SAM supports four types of transfers such as - * peripheral to peripheral, peripheral to memory, memory to peripheral, and - * memory to memory. - * - * The basic transfer unit is a beat, which is defined as a single bus access. - * There can be multiple beats in a single block transfer and multiple block - * transfers in a DMA transaction. - * DMA transfer is based on descriptors, which holds transfer properties - * such as the source and destination addresses, transfer counter, and other - * additional transfer control information. - * The descriptors can be static or linked. When static, a single block transfer - * is performed. When linked, a number of transfer descriptors can be used to - * enable multiple block transfers within a single DMA transaction. - * - * The implementation of the DMA driver is based on the idea that the DMA channel - * is a finite resource of entities with the same abilities. A DMA channel resource - * is able to move a defined set of data from a source address to destination - * address triggered by a transfer trigger. On the SAM devices there are 12 - * DMA resources available for allocation. Each of these DMA resources can trigger - * interrupt callback routines and peripheral events. - * The other main features are: - * - * - Selectable transfer trigger source - * - Software - * - Event System - * - Peripheral - * - Event input and output is supported for the four lower channels - * - Four level channel priority - * - Optional interrupt generation on transfer complete, channel error, or channel suspend - * - Supports multi-buffer or circular buffer mode by linking multiple descriptors - * - Beat size configurable as 8-bit, 16-bit, or 32-bit - * - * A simplified block diagram of the DMA Resource can be seen in - * \ref asfdoc_sam0_dma_module_block_diagram "the figure below". - * - * \anchor asfdoc_sam0_dma_module_block_diagram - * \dot - * digraph overview { - * splines = false; - * rankdir=LR; - * - * mux1 [label="Transfer Trigger", shape=box]; - * - * dma [label="DMA Channel", shape=polygon, sides=6, orientation=60, style=filled, fillcolor=darkolivegreen1, height=1, width=1]; - * descriptor [label="Transfer Descriptor", shape=box, style=filled, fillcolor=lightblue]; - * - * mux1 -> dma; - * descriptor -> dma; - * - * interrupt [label="Interrupt", shape=box]; - * events [label="Events", shape=box]; - * - * dma:e -> interrupt:w; - * dma:e -> events:w; - * - * {rank=same; descriptor dma} - * - * } - * \enddot - * - * \subsection asfdoc_sam0_dma_features Driver Feature Macro Definition - * <table> - * <tr> - * <th>Driver Feature Macro</th> - * <th>Supported devices</th> - * </tr> - * <tr> - * <td>FEATURE_DMA_CHANNEL_STANDBY</td> - * <td>SAM L21/L22/C20/C21/R30</td> - * </tr> - * </table> - * \note The specific features are only available in the driver when the - * selected device supports those features. - * - * \subsection asfdoc_sam0_dma_module_overview_dma_transf_term Terminology Used in DMAC Transfers - * - * <table border="0" cellborder="1" cellspacing="0" > - * <tr> - * <th> Name </th> <th> Description </th> - * </tr> - * <tr> - * <td > Beat </td> - * <td > It is a single bus access by the DMAC. - * Configurable as 8-bit, 16-bit, or 32-bit. - * </td> - * </tr> - * <tr> - * <td > Burst </td> - * <td> It is a transfer of n-beats (n=1,4,8,16). - * For the DMAC module in SAM, the burst size is one beat. - * Arbitration takes place each time a burst transfer is completed. - * </td> - * </tr> - * <tr> - * <td > Block transfer </td> - * <td> A single block transfer is a configurable number of (1 to 64k) - * beat transfers - * </td> - * </tr> - * </table> - * - * \subsection asfdoc_sam0_dma_module_overview_dma_channels DMA Channels - * The DMAC in each device consists of several DMA channels, which - * along with the transfer descriptors defines the data transfer properties. - * - The transfer control descriptor defines the source and destination - * addresses, source and destination address increment settings, the - * block transfer count, and event output condition selection - * - Dedicated channel registers control the peripheral trigger source, - * trigger mode settings, event input actions, and channel priority level - * settings - * - * With a successful DMA resource allocation, a dedicated - * DMA channel will be assigned. The channel will be occupied until the - * DMA resource is freed. A DMA resource handle is used to identify the specific - * DMA resource. - * When there are multiple channels with active requests, the arbiter prioritizes - * the channels requesting access to the bus. - * - * \subsection asfdoc_sam0_dma_module_overview_dma_trigger DMA Triggers - * DMA transfer can be started only when a DMA transfer request is acknowledged/granted by the arbiter. A - * transfer request can be triggered from software, peripheral, or an event. There - * are dedicated source trigger selections for each DMA channel usage. - - * - * \subsection asfdoc_sam0_dma_module_overview_dma_transfer_descriptor DMA Transfer Descriptor - * The transfer descriptor resides in the SRAM and - * defines these channel properties. - * <table border="0" cellborder="1" cellspacing="0" > - * <tr> - * <th> Field name </th> <th> Field width </th> - * </tr> - * <tr> - * <td > Descriptor Next Address </td> <td > 32 bits </td> - * </tr> - * <tr> - * <td > Destination Address </td> <td> 32 bits </td> - * </tr> - * <tr> - * <td > Source Address </td> <td> 32 bits </td> - * </tr> - * <tr> - * <td > Block Transfer Counter </td> <td> 16 bits </td> - * </tr> - * <tr> - * <td > Block Transfer Control </td> <td> 16 bits </td> - * </tr> - * </table> - * - * Before starting a transfer, at least one descriptor should be configured. - * After a successful allocation of a DMA channel, the transfer descriptor can - * be added with a call to \ref dma_add_descriptor(). If there is a transfer - * descriptor already allocated to the DMA resource, the descriptor will - * be linked to the next descriptor address. - * - * \subsection asfdoc_sam0_dma_module_overview_dma_output DMA Interrupts/Events - * Both an interrupt callback and an peripheral event can be triggered by the - * DMA transfer. Three types of callbacks are supported by the DMA driver: - * transfer complete, channel suspend, and transfer error. Each of these callback - * types can be registered and enabled for each channel independently through - * the DMA driver API. - * - * The DMAC module can also generate events on transfer complete. Event - * generation is enabled through the DMA channel, event channel configuration, - * and event user multiplexing is done through the events driver. - * - * The DMAC can generate events in the below cases: - * - * - When a block transfer is complete - * - * - When each beat transfer within a block transfer is complete - * - * \section asfdoc_sam0_dma_special_considerations Special Considerations - * - * There are no special considerations for this module. - * - * - * \section asfdoc_sam0_dma_extra_info Extra Information - * - * For extra information, see \ref asfdoc_sam0_dma_extra. This includes: - * - \ref asfdoc_sam0_dma_extra_acronyms - * - \ref asfdoc_sam0_dma_extra_dependencies - * - \ref asfdoc_sam0_dma_extra_errata - * - \ref asfdoc_sam0_dma_extra_history - * - * - * \section asfdoc_sam0_dma_examples Examples - * - * For a list of examples related to this driver, see - * \ref asfdoc_sam0_dma_exqsg. - * - * - * \section asfdoc_sam0_dma_api_overview API Overview - * @{ - */ - -#include <compiler.h> -#include "conf_dma.h" - -#if (SAML21) || (SAML22) || (SAMC20) || (SAMC21) || (SAMR30) || defined(__DOXYGEN__) -#define FEATURE_DMA_CHANNEL_STANDBY -#endif - -/** DMA invalid channel number. */ -#define DMA_INVALID_CHANNEL 0xff - -/** ExInitial description section. */ -extern DmacDescriptor descriptor_section[CONF_MAX_USED_CHANNEL_NUM]; - -/* DMA channel interrup flag. */ -extern uint8_t g_chan_interrupt_flag[CONF_MAX_USED_CHANNEL_NUM]; - -/** DMA priority level. */ -enum dma_priority_level { - /** Priority level 0. */ - DMA_PRIORITY_LEVEL_0, - /** Priority level 1. */ - DMA_PRIORITY_LEVEL_1, - /** Priority level 2. */ - DMA_PRIORITY_LEVEL_2, - /** Priority level 3. */ - DMA_PRIORITY_LEVEL_3, -}; - -/** DMA input actions. */ -enum dma_event_input_action { - /** No action. */ - DMA_EVENT_INPUT_NOACT, - /** Normal transfer and periodic transfer trigger. */ - DMA_EVENT_INPUT_TRIG, - /** Conditional transfer trigger. */ - DMA_EVENT_INPUT_CTRIG, - /** Conditional block transfer. */ - DMA_EVENT_INPUT_CBLOCK, - /** Channel suspend operation. */ - DMA_EVENT_INPUT_SUSPEND, - /** Channel resume operation. */ - DMA_EVENT_INPUT_RESUME, - /** Skip next block suspend action. */ - DMA_EVENT_INPUT_SSKIP, -}; - -/** - * Address increment step size. These bits select the address increment step - * size. The setting apply to source or destination address, depending on - * STEPSEL setting. - */ -enum dma_address_increment_stepsize { - /** The address is incremented by (beat size * 1). */ - DMA_ADDRESS_INCREMENT_STEP_SIZE_1 = 0, - /** The address is incremented by (beat size * 2). */ - DMA_ADDRESS_INCREMENT_STEP_SIZE_2, - /** The address is incremented by (beat size * 4). */ - DMA_ADDRESS_INCREMENT_STEP_SIZE_4, - /** The address is incremented by (beat size * 8). */ - DMA_ADDRESS_INCREMENT_STEP_SIZE_8, - /** The address is incremented by (beat size * 16). */ - DMA_ADDRESS_INCREMENT_STEP_SIZE_16, - /** The address is incremented by (beat size * 32). */ - DMA_ADDRESS_INCREMENT_STEP_SIZE_32, - /** The address is incremented by (beat size * 64). */ - DMA_ADDRESS_INCREMENT_STEP_SIZE_64, - /** The address is incremented by (beat size * 128). */ - DMA_ADDRESS_INCREMENT_STEP_SIZE_128, -}; - -/** - * DMA step selection. This bit determines whether the step size setting - * is applied to source or destination address. - */ -enum dma_step_selection { - /** Step size settings apply to the destination address. */ - DMA_STEPSEL_DST = 0, - /** Step size settings apply to the source address. */ - DMA_STEPSEL_SRC, -}; - -/** The basic transfer unit in DMAC is a beat, which is defined as a - * single bus access. Its size is configurable and applies to both read - * and write. */ -enum dma_beat_size { - /** 8-bit access. */ - DMA_BEAT_SIZE_BYTE = 0, - /** 16-bit access. */ - DMA_BEAT_SIZE_HWORD, - /** 32-bit access. */ - DMA_BEAT_SIZE_WORD, -}; - -/** - * Block action definitions. - */ -enum dma_block_action { - /** No action. */ - DMA_BLOCK_ACTION_NOACT = 0, - /** Channel in normal operation and sets transfer complete interrupt flag - * after block transfer. */ - DMA_BLOCK_ACTION_INT, - /** Trigger channel suspend after block transfer and sets channel - * suspend interrupt flag once the channel is suspended. */ - DMA_BLOCK_ACTION_SUSPEND, - /** Sets transfer complete interrupt flag after a block transfer and - * trigger channel suspend. The channel suspend interrupt flag will be set - * once the channel is suspended. */ - DMA_BLOCK_ACTION_BOTH, -}; - -/** Event output selection. */ -enum dma_event_output_selection { - /** Event generation disable. */ - DMA_EVENT_OUTPUT_DISABLE = 0, - /** Event strobe when block transfer complete. */ - DMA_EVENT_OUTPUT_BLOCK, - /** Event output reserved. */ - DMA_EVENT_OUTPUT_RESERVED, - /** Event strobe when beat transfer complete. */ - DMA_EVENT_OUTPUT_BEAT, -}; - -/** DMA trigger action type. */ -enum dma_transfer_trigger_action{ - /** Perform a block transfer when triggered. */ - DMA_TRIGGER_ACTION_BLOCK = DMAC_CHCTRLB_TRIGACT_BLOCK_Val, - /** Perform a beat transfer when triggered. */ - DMA_TRIGGER_ACTION_BEAT = DMAC_CHCTRLB_TRIGACT_BEAT_Val, - /** Perform a transaction when triggered. */ - DMA_TRIGGER_ACTION_TRANSACTION = DMAC_CHCTRLB_TRIGACT_TRANSACTION_Val, -}; - -/** - * Callback types for DMA callback driver. - */ -enum dma_callback_type { - /** Callback for any of transfer errors. A transfer error is flagged - * if a bus error is detected during an AHB access or when the DMAC - * fetches an invalid descriptor. */ - DMA_CALLBACK_TRANSFER_ERROR, - /** Callback for transfer complete. */ - DMA_CALLBACK_TRANSFER_DONE, - /** Callback for channel suspend. */ - DMA_CALLBACK_CHANNEL_SUSPEND, - /** Number of available callbacks. */ - DMA_CALLBACK_N, -}; - -/** - * DMA transfer descriptor configuration. When the source or destination address - * increment is enabled, the addresses stored into the configuration structure - * must correspond to the end of the transfer. - * - */ -struct dma_descriptor_config { - /** Descriptor valid flag used to identify whether a descriptor is - valid or not */ - bool descriptor_valid; - /** This is used to generate an event on specific transfer action in - a channel. Supported only in four lower channels. */ - enum dma_event_output_selection event_output_selection; - /** Action taken when a block transfer is completed */ - enum dma_block_action block_action; - /** Beat size is configurable as 8-bit, 16-bit, or 32-bit */ - enum dma_beat_size beat_size; - /** Used for enabling the source address increment */ - bool src_increment_enable; - /** Used for enabling the destination address increment */ - bool dst_increment_enable; - /** This bit selects whether the source or destination address is - using the step size settings */ - enum dma_step_selection step_selection; - /** The step size for source/destination address increment. - The next address is calculated - as next_addr = addr + (2^step_size * beat size). */ - enum dma_address_increment_stepsize step_size; - /** It is the number of beats in a block. This count value is - * decremented by one after each beat data transfer. */ - uint16_t block_transfer_count; - /** Transfer source address */ - uint32_t source_address; - /** Transfer destination address */ - uint32_t destination_address; - /** Set to zero for static descriptors. This must have a valid memory - address for linked descriptors. */ - uint32_t next_descriptor_address; -}; - -/** Configurations for DMA events. */ -struct dma_events_config { - /** Event input actions */ - enum dma_event_input_action input_action; - /** Enable DMA event output */ - bool event_output_enable; -}; - -/** DMA configurations for transfer. */ -struct dma_resource_config { - /** DMA transfer priority */ - enum dma_priority_level priority; - /**DMA peripheral trigger index */ - uint8_t peripheral_trigger; - /** DMA trigger action */ - enum dma_transfer_trigger_action trigger_action; -#ifdef FEATURE_DMA_CHANNEL_STANDBY - /** Keep DMA channel enabled in standby sleep mode if true */ - bool run_in_standby; -#endif - /** DMA events configurations */ - struct dma_events_config event_config; -}; - -/** Forward definition of the DMA resource. */ -struct dma_resource; -/** Type definition for a DMA resource callback function. */ -typedef void (*dma_callback_t)(struct dma_resource *const resource); - -/** Structure for DMA transfer resource. */ -struct dma_resource { - /** Allocated DMA channel ID */ - uint8_t channel_id; - /** Array of callback functions for DMA transfer job */ - dma_callback_t callback[DMA_CALLBACK_N]; - /** Bit mask for enabled callbacks */ - uint8_t callback_enable; - /** Status of the last job */ - volatile enum status_code job_status; - /** Transferred data size */ - uint32_t transfered_size; - /** DMA transfer descriptor */ - DmacDescriptor* descriptor; -}; - -/** - * \brief Get DMA resource status. - * - * \param[in] resource Pointer to the DMA resource - * - * \return Status of the DMA resource. - */ -static inline enum status_code dma_get_job_status(struct dma_resource *resource) -{ - Assert(resource); - - return resource->job_status; -} - -/** - * \brief Check if the given DMA resource is busy. - * - * \param[in] resource Pointer to the DMA resource - * - * \return Status which indicates whether the DMA resource is busy. - * - * \retval true The DMA resource has an on-going transfer - * \retval false The DMA resource is not busy - */ -static inline bool dma_is_busy(struct dma_resource *resource) -{ - Assert(resource); - - return (resource->job_status == STATUS_BUSY); -} - -/** - * \brief Enable a callback function for a dedicated DMA resource. - * - * \param[in] resource Pointer to the DMA resource - * \param[in] type Callback function type - * - */ -static inline void dma_enable_callback(struct dma_resource *resource, - enum dma_callback_type type) -{ - Assert(resource); - - resource->callback_enable |= 1 << type; - g_chan_interrupt_flag[resource->channel_id] |= (1UL << type); -} - -/** - * \brief Disable a callback function for a dedicated DMA resource. - * - * \param[in] resource Pointer to the DMA resource - * \param[in] type Callback function type - * - */ -static inline void dma_disable_callback(struct dma_resource *resource, - enum dma_callback_type type) -{ - Assert(resource); - - resource->callback_enable &= ~(1 << type); - g_chan_interrupt_flag[resource->channel_id] &= (~(1UL << type) & DMAC_CHINTENSET_MASK); - DMAC->CHINTENCLR.reg = (1UL << type); -} - -/** - * \brief Register a callback function for a dedicated DMA resource. - * - * There are three types of callback functions, which can be registered: - * - Callback for transfer complete - * - Callback for transfer error - * - Callback for channel suspend - * - * \param[in] resource Pointer to the DMA resource - * \param[in] callback Pointer to the callback function - * \param[in] type Callback function type - * - */ -static inline void dma_register_callback(struct dma_resource *resource, - dma_callback_t callback, enum dma_callback_type type) -{ - Assert(resource); - - resource->callback[type] = callback; -} - -/** - * \brief Unregister a callback function for a dedicated DMA resource. - * - * There are three types of callback functions: - * - Callback for transfer complete - * - Callback for transfer error - * - Callback for channel suspend - * - * The application can unregister any of the callback functions which - * are already registered and are no longer needed. - * - * \param[in] resource Pointer to the DMA resource - * \param[in] type Callback function type - * - */ -static inline void dma_unregister_callback(struct dma_resource *resource, - enum dma_callback_type type) -{ - Assert(resource); - - resource->callback[type] = NULL; -} - -/** - * \brief Will set a software trigger for resource. - * - * This function is used to set a software trigger on the DMA channel - * associated with resource. If a trigger is already pending no new trigger - * will be generated for the channel. - * - * \param[in] resource Pointer to the DMA resource - */ -static inline void dma_trigger_transfer(struct dma_resource *resource) { - Assert(resource); - - DMAC->SWTRIGCTRL.reg |= (1 << resource->channel_id); -} - -/** - * \brief Initializes DMA transfer configuration with predefined default values. - * - * This function will initialize a given DMA descriptor configuration structure to - * a set of known default values. This function should be called on - * any new instance of the configuration structure before being - * modified by the user application. - * - * The default configuration is as follows: - * \li Set the descriptor as valid - * \li Disable event output - * \li No block action - * \li Set beat size as byte - * \li Enable source increment - * \li Enable destination increment - * \li Step size is applied to the destination address - * \li Address increment is beat size multiplied by 1 - * \li Default transfer size is set to 0 - * \li Default source address is set to NULL - * \li Default destination address is set to NULL - * \li Default next descriptor not available - * \param[out] config Pointer to the configuration - * - */ -static inline void dma_descriptor_get_config_defaults(struct dma_descriptor_config *config) -{ - Assert(config); - - /* Set descriptor as valid */ - config->descriptor_valid = true; - /* Disable event output */ - config->event_output_selection = DMA_EVENT_OUTPUT_DISABLE; - /* No block action */ - config->block_action = DMA_BLOCK_ACTION_NOACT; - /* Set beat size to one byte */ - config->beat_size = DMA_BEAT_SIZE_BYTE; - /* Enable source increment */ - config->src_increment_enable = true; - /* Enable destination increment */ - config->dst_increment_enable = true; - /* Step size is applied to the destination address */ - config->step_selection = DMA_STEPSEL_DST; - /* Address increment is beat size multiplied by 1*/ - config->step_size = DMA_ADDRESS_INCREMENT_STEP_SIZE_1; - /* Default transfer size is set to 0 */ - config->block_transfer_count = 0; - /* Default source address is set to NULL */ - config->source_address = (uint32_t)NULL; - /* Default destination address is set to NULL */ - config->destination_address = (uint32_t)NULL; - /** Next descriptor address set to 0 */ - config->next_descriptor_address = 0; -} - -/** - * \brief Update DMA descriptor. - * - * This function can update the descriptor of an allocated DMA resource. - * - */ -static inline void dma_update_descriptor(struct dma_resource *resource, - DmacDescriptor* descriptor) -{ - Assert(resource); - - resource->descriptor = descriptor; -} - -/** - * \brief Reset DMA descriptor. - * - * This function will clear the DESCADDR register of an allocated DMA resource. - * - */ -static inline void dma_reset_descriptor(struct dma_resource *resource) -{ - Assert(resource); - - resource->descriptor = NULL; -} - -void dma_get_config_defaults(struct dma_resource_config *config); -enum status_code dma_allocate(struct dma_resource *resource, - struct dma_resource_config *config); -enum status_code dma_free(struct dma_resource *resource); -enum status_code dma_start_transfer_job(struct dma_resource *resource); -void dma_abort_job(struct dma_resource *resource); -void dma_suspend_job(struct dma_resource *resource); -void dma_resume_job(struct dma_resource *resource); -void dma_descriptor_create(DmacDescriptor* descriptor, - struct dma_descriptor_config *config); -enum status_code dma_add_descriptor(struct dma_resource *resource, - DmacDescriptor* descriptor); - -/** @} */ - -/** - * \page asfdoc_sam0_dma_extra Extra Information for DMAC Driver - * - * \section asfdoc_sam0_dma_extra_acronyms Acronyms - * Below is a table listing the acronyms used in this module, along with their - * intended meanings. - * - * <table> - * <tr> - * <th>Acronym</th> - * <th>Description</th> - * </tr> - * <tr> - * <td>DMA</td> - * <td>Direct Memory Access</td> - * </tr> - * <tr> - * <td>DMAC</td> - * <td>Direct Memory Access Controller </td> - * </tr> - * <tr> - * <td>CPU</td> - * <td>Central Processing Unit</td> - * </tr> - * </table> - * - * - * \section asfdoc_sam0_dma_extra_dependencies Dependencies - * This driver has the following dependencies: - * - * - \ref asfdoc_sam0_system_clock_group "System Clock Driver" - * - * - * \section asfdoc_sam0_dma_extra_errata Errata - * There are no errata related to this driver. - * - * - * \section asfdoc_sam0_dma_extra_history Module History - * An overview of the module history is presented in the table below, with - * details on the enhancements and fixes made to the module since its first - * release. The current version of this corresponds to the newest version in - * the table. - * - * <table> - * <tr> - * <th>Changelog</th> - * </tr> - * <tr> - * <td>Add SAM C21 support</td> - * </tr> - * <tr> - * <td>Add SAM L21 support</td> - * </tr> - * <tr> - * <td>Add SAM R30 support</td> - * </tr> - * <tr> - * <td>Initial Release</td> - * </tr> - * </table> - */ - - /** - * \page asfdoc_sam0_dma_exqsg Examples for DMAC Driver - * - * This is a list of the available Quick Start Guides (QSGs) and example - * applications for \ref asfdoc_sam0_dma_group. QSGs are simple examples with - * step-by-step instructions to configure and use this driver in a selection of - * use cases. Note that a QSG can be compiled as a standalone application or be - * added to the user application. - * - * - \subpage asfdoc_sam0_dma_basic_use_case - * - * \note More DMA usage examples are available in peripheral QSGs. - * A quick start guide for TC/TCC - * shows the usage of DMA event trigger; SERCOM SPI/USART/I<SUP>2</SUP>C has example for - * DMA transfer from peripheral to memory or from memory to peripheral; - * ADC/DAC shows peripheral to peripheral transfer. - * - * \page asfdoc_sam0_dma_document_revision_history Document Revision History - * - * <table> - * <tr> - * <th>Doc. Rev.</th> - * <th>Date</th> - * <th>Comments</th> - * </tr> - * <tr> - * <td>42257C</td> - * <td>12/2015</td> - * <td>Added suppport for SAM L21/L22, SAM C21, SAM D09, SAMR30 and SAM DA1</td> - * </tr> - * <tr> - * <td>42257B</td> - * <td>12/2014</td> - * <td>Added support for SAM R21 and SAM D10/D11</td> - * </tr> - * <tr> - * <td>42257A</td> - * <td>02/2014</td> - * <td>Initial release</td> - * </tr> - * </table> - */ - -#ifdef __cplusplus -} -#endif - -#endif /* DMA_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/dma/dma_crc.h b/atmel-samd/asf/sam0/drivers/dma/dma_crc.h deleted file mode 100644 index 3d8c27c19..000000000 --- a/atmel-samd/asf/sam0/drivers/dma/dma_crc.h +++ /dev/null @@ -1,230 +0,0 @@ -/** - * \file - * - * \brief SAM DMA cyclic redundancy check (CRC) Driver - * - * Copyright (C) 2014-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef DMA_CRC_H_INCLUDED -#define DMA_CRC_H_INCLUDED - -#include <compiler.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** DMA channel n offset. */ -#define DMA_CRC_CHANNEL_N_OFFSET 0x20 - -/** CRC Polynomial Type. */ -enum crc_polynomial_type { - /** CRC16 (CRC-CCITT). */ - CRC_TYPE_16, - /** CRC32 (IEEE 802.3). */ - CRC_TYPE_32, -}; - -/** CRC Beat Type. */ -enum crc_beat_size { - /** Byte bus access. */ - CRC_BEAT_SIZE_BYTE, - /** Half-word bus access. */ - CRC_BEAT_SIZE_HWORD, - /** Word bus access. */ - CRC_BEAT_SIZE_WORD, -}; - -/** Configurations for CRC calculation. */ -struct dma_crc_config { - /** CRC polynomial type. */ - enum crc_polynomial_type type; - /** CRC beat size. */ - enum crc_beat_size size; -}; - -/** - * \brief Get DMA CRC default configurations. - * - * The default configuration is as follows: - * \li Polynomial type is set to CRC-16(CRC-CCITT) - * \li CRC Beat size: BYTE - * - * \param[in] config default configurations - */ -static inline void dma_crc_get_config_defaults(struct dma_crc_config *config) -{ - Assert(config); - - config->type = CRC_TYPE_16; - config->size = CRC_BEAT_SIZE_BYTE; -} - -/** - * \brief Enable DMA CRC module with an DMA channel. - * - * This function enables a CRC calculation with an allocated DMA channel. This channel ID - * can be gotten from a successful \ref dma_allocate. - * - * \param[in] channel_id DMA channel expected with CRC calculation - * \param[in] config CRC calculation configurations - * - * \return Status of the DMC CRC. - * \retval STATUS_OK Get the DMA CRC module - * \retval STATUS_BUSY DMA CRC module is already taken and not ready yet - */ -static inline enum status_code dma_crc_channel_enable(uint32_t channel_id, - struct dma_crc_config *config) -{ - if (DMAC->CRCSTATUS.reg & DMAC_CRCSTATUS_CRCBUSY) { - return STATUS_BUSY; - } - - DMAC->CRCCTRL.reg = DMAC_CRCCTRL_CRCBEATSIZE(config->size) | - DMAC_CRCCTRL_CRCPOLY(config->type) | - DMAC_CRCCTRL_CRCSRC(channel_id+DMA_CRC_CHANNEL_N_OFFSET); - - DMAC->CTRL.reg |= DMAC_CTRL_CRCENABLE; - - return STATUS_OK; -} - -/** - * \brief Disable DMA CRC module. - * - */ -static inline void dma_crc_disable(void) -{ - DMAC->CTRL.reg &= ~DMAC_CTRL_CRCENABLE; - DMAC->CRCCTRL.reg = 0; -} - -/** - * \brief Get DMA CRC checksum value. - * - * \return Calculated CRC checksum. - */ -static inline uint32_t dma_crc_get_checksum(void) -{ - if (DMAC->CRCCTRL.bit.CRCSRC == DMAC_CRCCTRL_CRCSRC_IO_Val) { - DMAC->CRCSTATUS.reg = DMAC_CRCSTATUS_CRCBUSY; - } - - return DMAC->CRCCHKSUM.reg; -} - -/** - * \brief Enable DMA CRC module with I/O. - * - * This function enables a CRC calculation with I/O mode. - * - * \param[in] config CRC calculation configurations. - * - * \return Status of the DMC CRC. - * \retval STATUS_OK Get the DMA CRC module - * \retval STATUS_BUSY DMA CRC module is already taken and not ready yet - */ -static inline enum status_code dma_crc_io_enable( - struct dma_crc_config *config) -{ - if (DMAC->CRCSTATUS.reg & DMAC_CRCSTATUS_CRCBUSY) { - return STATUS_BUSY; - } - - if (DMAC->CTRL.reg & DMAC_CTRL_CRCENABLE) { - return STATUS_BUSY; - } - - DMAC->CRCCTRL.reg = DMAC_CRCCTRL_CRCBEATSIZE(config->size) | - DMAC_CRCCTRL_CRCPOLY(config->type) | - DMAC_CRCCTRL_CRCSRC_IO; - - if (config->type == CRC_TYPE_32) { - DMAC->CRCCHKSUM.reg = 0xFFFFFFFF; - } - - DMAC->CTRL.reg |= DMAC_CTRL_CRCENABLE; - - return STATUS_OK; -} - -/** - * \brief Calculate CRC with I/O. - * - * This function calculate the CRC of the input data buffer. - * - * \param[in] buffer CRC Pointer to calculation buffer - * \param[in] total_beat_size Total beat size to be calculated - * - * \return Calculated CRC checksum value. - */ -static inline void dma_crc_io_calculation(void *buffer, - uint32_t total_beat_size) -{ - uint32_t counter = total_beat_size; - uint8_t *buffer_8; - uint16_t *buffer_16; - uint32_t *buffer_32; - - for (counter=0; counter<total_beat_size; counter++) { - if (DMAC->CRCCTRL.bit.CRCBEATSIZE == CRC_BEAT_SIZE_BYTE) { - buffer_8 = buffer; - DMAC->CRCDATAIN.reg = buffer_8[counter]; - } else if (DMAC->CRCCTRL.bit.CRCBEATSIZE == CRC_BEAT_SIZE_HWORD) { - buffer_16 = buffer; - DMAC->CRCDATAIN.reg = buffer_16[counter]; - } else if (DMAC->CRCCTRL.bit.CRCBEATSIZE == CRC_BEAT_SIZE_WORD) { - buffer_32 = buffer; - DMAC->CRCDATAIN.reg = buffer_32[counter]; - } - /* Wait several cycle to make sure CRC complete */ - nop(); - nop(); - nop(); - nop(); - } -} - -#ifdef __cplusplus -} -#endif - -#endif /* DMA_CRC_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/dma/dma_sam_b.c b/atmel-samd/asf/sam0/drivers/dma/dma_sam_b.c deleted file mode 100644 index d14f0e5ee..000000000 --- a/atmel-samd/asf/sam0/drivers/dma/dma_sam_b.c +++ /dev/null @@ -1,557 +0,0 @@ -/* - * \file - * - * \brief Direct Memory Access Controller Driver for SAMB - * - * Copyright (C) 2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#include <string.h> -#include "dma_sam_b.h" - -struct _dma_module { - volatile bool _dma_init; - volatile uint32_t allocated_channels; - uint8_t free_channels; -}; - -struct _dma_module _dma_inst = { - ._dma_init = false, - .allocated_channels = 0, - .free_channels = CONF_MAX_USED_CHANNEL_NUM, -}; - -/** Internal DMA resource pool. */ -static struct dma_resource* _dma_active_resource[CONF_MAX_USED_CHANNEL_NUM]; - -/** - * \brief Get the assigned channel DMA value. - * - * \param[in] channel DMA channel index - * \param[in] DMA register address - * - * \return The value of DMA register. - */ -static uint32_t get_channel_reg_val(uint8_t channel, uint32_t reg) -{ - return *(uint32_t*)(reg + 0x100*channel); -} - -/** - * \brief Set the assigned channel DMA value. - * - * \param[in] channel DMA channel index - * \param[in] DMA register address - * \param[in] The value to be set - * - */ -static void set_channel_reg_val(uint8_t channel, uint32_t reg, uint32_t val) -{ - *(uint32_t*)(reg + 0x100*channel) = val; -} - -/** - * \brief Get the DMA status. - * - * \param[in] channel DMA channel index - * - * \return The status of DMA - */ -uint8_t dma_get_status(uint8_t channel) -{ - return (uint8_t)get_channel_reg_val(channel, (uint32_t)&PROV_DMA_CTRL0->CH0_INT_RAWSTAT_REG.reg); -} - -/** - * \brief Get the DMA interrupt status. - * - * \param[in] channel DMA channel index - * - * \return The interrupt of status DMA - */ -uint8_t dma_get_interrupt_status(uint8_t channel) -{ - return get_channel_reg_val(channel, (uint32_t)&PROV_DMA_CTRL0->CH0_INT_STATUS_REG.reg); -} - -/** - * \brief Get the DMA interrupt status. - * - * \param[in] channel DMA channel index - * \param[in] flag The interrupt flag want to clear - * - */ -void dma_clear_interrupt_status(uint8_t channel, uint8_t flag) -{ - set_channel_reg_val(channel, (uint32_t)&PROV_DMA_CTRL0->CH0_INT_CLEAR_REG.reg, 1 << flag); -} - -/** - * \brief Find a free channel for a DMA resource. - * - * Find a channel for the requested DMA resource. - * - * \return Status of channel allocation. - * \retval DMA_INVALID_CHANNEL No channel available - * \retval count Allocated channel for the DMA resource - */ -static uint8_t _dma_find_first_free_channel_and_allocate(void) -{ - uint8_t count; - uint32_t tmp; - bool allocated = false; - - tmp = _dma_inst.allocated_channels; - - for (count = 0; count < CONF_MAX_USED_CHANNEL_NUM; ++count) { - if (!(tmp & 0x00000001)) { - /* If free channel found, set as allocated and return - *number */ - - _dma_inst.allocated_channels |= 1 << count; - _dma_inst.free_channels--; - allocated = true; - - break; - } - - tmp = tmp >> 1; - } - - if (!allocated) { - return DMA_INVALID_CHANNEL; - } else { - return count; - } -} - -/** - * \brief Release an allocated DMA channel. - * - * \param[in] channel Channel id to be released - * - */ -static void _dma_release_channel(uint8_t channel) -{ - _dma_inst.allocated_channels &= ~(1 << channel); - _dma_inst.free_channels++; -} - -/** - * \brief Initializes config with predefined default values. - * - * This function will initialize a given DMA configuration structure to - * a set of known default values. This function should be called on - * any new instance of the configuration structure before being - * modified by the user application. - * - * The default configuration is as follows: - * \li Set source max burst number as 1 - * \li Set source tokens as 1 - * \li Set source peripheral as memory - * \li Set source peripheral delay as 0 - * \li Disable source top priority - * \li Set source top priority channel as 0 - * \li Disable source high priority - * \li Set source high priority channel as 0 - * \li Set destination max burst number as 1 - * \li Set destination tokens as 1 - * \li Set destination peripheral as memory - * \li Set destination peripheral delay as 0 - * \li Disable destination top priority - * \li Set destination top priority channel as 0 - * \li Disable destination high priority - * \li Set destination high priority channel as 0 - * \li Disable the joint mode - * \li Disable the endian swap - * \param[out] config Pointer to the configuration - * - */ -void dma_get_config_defaults(struct dma_resource_config *config) -{ - /* DMA source configuration */ - config->src.max_burst = 1; - config->src.tokens = 1; - config->src.enable_inc_addr = true; - config->src.periph = MEMORY_DMA_PERIPHERAL; - config->src.periph_delay = 0; - config->src.enable_proi_top = false; - config->src.proi_top_index = 0; - config->src.enable_proi_high = false; - config->src.proi_high_index = 0; - /* DMA destination configuration */ - config->des.max_burst = 1; - config->des.tokens = 1; - config->des.enable_inc_addr = true; - config->des.periph = MEMORY_DMA_PERIPHERAL; - config->des.periph_delay = 0; - config->des.enable_proi_top = false; - config->des.proi_top_index = 0; - config->des.enable_proi_high = false; - config->des.proi_high_index = 0; - /* DMA channel configuration */ - config->enable_joint_mode = false; - config->swap = DMA_ENDIAN_NO_SWAP; -} - -/** - * \brief Configure the DMA resource. - * - * \param[in] dma_resource Pointer to a DMA resource instance - * \param[out] config Configurations of the DMA resource - * - */ -static void _dma_set_config(struct dma_resource *resource, - struct dma_resource_config *config) -{ - uint32_t regval = 0; - - /* Static register configuration */ - regval = PROV_DMA_CTRL_CH0_STATIC_REG0_RD_BURST_MAX_SIZE(config->src.max_burst)| - PROV_DMA_CTRL_CH0_STATIC_REG0_RD_TOKENS(config->src.tokens) | - (config->src.enable_inc_addr << PROV_DMA_CTRL_CH0_STATIC_REG0_RD_INCR_Pos); - set_channel_reg_val(resource->channel_id, (uint32_t)&PROV_DMA_CTRL0->CH0_STATIC_REG0.reg, regval); - /* Static register1 configuration */ - regval = PROV_DMA_CTRL_CH0_STATIC_REG1_WR_BURST_MAX_SIZE(config->des.max_burst) | - PROV_DMA_CTRL_CH0_STATIC_REG1_WR_TOKENS(config->des.tokens) | - (config->des.enable_inc_addr << PROV_DMA_CTRL_CH0_STATIC_REG0_RD_INCR_Pos); - set_channel_reg_val(resource->channel_id, (uint32_t)&PROV_DMA_CTRL0->CH0_STATIC_REG1.reg, regval); - /* Static register2 configuration */ - regval = (config->enable_joint_mode << PROV_DMA_CTRL_CH0_STATIC_REG2_JOINT_Pos) | - PROV_DMA_CTRL_CH0_STATIC_REG2_END_SWAP(config->swap); - set_channel_reg_val(resource->channel_id, (uint32_t)&PROV_DMA_CTRL0->CH0_STATIC_REG2.reg, regval); - /* Static register4 configuration */ - regval = PROV_DMA_CTRL_CH0_STATIC_REG4_RD_PERIPH_NUM(config->src.periph) | - PROV_DMA_CTRL_CH0_STATIC_REG4_RD_PERIPH_DELAY(config->src.periph_delay) | - PROV_DMA_CTRL_CH0_STATIC_REG4_WR_PERIPH_NUM(config->des.periph) | - PROV_DMA_CTRL_CH0_STATIC_REG4_WR_PERIPH_DELAY(config->des.periph_delay); - set_channel_reg_val(resource->channel_id, (uint32_t)&PROV_DMA_CTRL0->CH0_STATIC_REG4.reg, regval); - /* Priority channels configuration */ - regval = PROV_DMA_CTRL_CORE_PRIORITY_RD_PRIO_TOP_NUM(config->src.proi_top_index) | - (PROV_DMA_CTRL_CORE_PRIORITY_RD_PRIO_TOP << config->src.enable_proi_top) | - PROV_DMA_CTRL_CORE_PRIORITY_RD_PRIO_HIGH_NUM(config->src.proi_high_index) | - (PROV_DMA_CTRL_CORE_PRIORITY_RD_PRIO_HIGH << config->src.enable_proi_high) | - PROV_DMA_CTRL_CORE_PRIORITY_WR_PRIO_TOP_NUM(config->des.proi_top_index) | - (PROV_DMA_CTRL_CORE_PRIORITY_WR_PRIO_TOP << config->des.enable_proi_top) | - PROV_DMA_CTRL_CORE_PRIORITY_WR_PRIO_HIGH_NUM(config->des.proi_high_index) | - (PROV_DMA_CTRL_CORE_PRIORITY_WR_PRIO_HIGH << config->des.enable_proi_high); - set_channel_reg_val(resource->channel_id, (uint32_t)&PROV_DMA_CTRL0->CORE_PRIORITY.reg, regval); - /* Initial the global variety */ - for (int i = 0; i < DMA_CALLBACK_N; i++) { - resource->callback[i] = NULL; - } - resource->callback_enable = 0; -} - -/** - * \brief Free an allocated DMA resource. - * - * This function will free an allocated DMA resource. - * - * \param[in,out] resource Pointer to the DMA resource - * - * \return Status of the free procedure. - * - * \retval STATUS_OK The DMA resource was freed successfully - * \retval STATUS_BUSY The DMA resource was busy and can't be freed - * \retval STATUS_ERR_NOT_INITIALIZED DMA resource was not initialized - */ -enum status_code dma_free(struct dma_resource *resource) -{ - /* Check if channel is busy */ - if (dma_get_job_status(resource) == STATUS_BUSY) { - return STATUS_BUSY; - } - - /* Check if DMA resource was not allocated */ - if (!(_dma_inst.allocated_channels & (1 << resource->channel_id))) { - return STATUS_ERR_NOT_INITIALIZED; - } - - /* Release the DMA resource */ - _dma_release_channel(resource->channel_id); - - /* Reset the item in the DMA resource pool */ - _dma_active_resource[resource->channel_id] = NULL; - - return STATUS_OK; -} - -/** - * \brief Add a DMA transfer descriptor to a DMA resource. - * - * This function will add a DMA transfer descriptor to a DMA resource. - * If there was a transfer descriptor already allocated to the DMA resource, - * the descriptor will be linked to the next descriptor address. - * - * \param[in] resource Pointer to the DMA resource - * \param[in] descriptor Pointer to the transfer descriptor - * - * \retval STATUS_OK The descriptor is added to the DMA resource - * \retval STATUS_BUSY The DMA resource was busy and the descriptor is not added - */ -enum status_code dma_add_descriptor(struct dma_resource *resource, - struct dma_descriptor *descriptor) -{ - struct dma_descriptor *desc = resource->descriptor; - - /* Check if channel is busy */ - if (dma_get_job_status(resource) == STATUS_BUSY) { - return STATUS_BUSY; - } - - /* Look up for an empty space for the descriptor */ - if (desc == NULL) { - resource->descriptor = descriptor; - set_channel_reg_val(resource->channel_id, (uint32_t)&PROV_DMA_CTRL0->CH0_CMD_REG0.reg, descriptor->read_start_addr); - set_channel_reg_val(resource->channel_id, (uint32_t)&PROV_DMA_CTRL0->CH0_CMD_REG1.reg, descriptor->write_start_addr); - set_channel_reg_val(resource->channel_id, (uint32_t)&PROV_DMA_CTRL0->CH0_CMD_REG2.reg, descriptor->buffer_size); - set_channel_reg_val(resource->channel_id, (uint32_t)&PROV_DMA_CTRL0->CH0_CMD_REG3.reg, 3); - } else { - /* Looking for end of descriptor link */ - while(((uint32_t)desc->cmd.next_addr) != 0) { - desc = (struct dma_descriptor*)((uint32_t)desc->next); - } - if (resource->descriptor->cmd.next_addr == 0x0) { - set_channel_reg_val(resource->channel_id, (uint32_t)&PROV_DMA_CTRL0->CH0_CMD_REG3.reg, ((uint32_t)descriptor & (~0x3))); - } - /* Set to the end of descriptor list */ - desc->next = (uint32_t)descriptor; - /* The end of list should point to 0 */ - if (descriptor->cmd.next_addr != 0) { - /* Enable transferred interrupt, and channel stops when buffer done */ - descriptor->next = 0x3; - } - } - - return STATUS_OK; -} - -/** - * \brief Start a DMA transfer. - * - * This function will start a DMA transfer through an allocated DMA resource. - * - * \param[in,out] resource Pointer to the DMA resource - * - * \return Status of the transfer start procedure. - * - * \retval STATUS_OK The transfer was started successfully - * \retval STATUS_BUSY The DMA resource was busy and the transfer was not started - * \retval STATUS_ERR_INVALID_ARG Transfer size is 0 and transfer was not started - */ -enum status_code dma_start_transfer_job(struct dma_resource *resource) -{ - volatile uint32_t regval; - - /* Check if resource was busy */ - if (resource->job_status == STATUS_BUSY) { - return STATUS_BUSY; - } - - /* Check if transfer size is valid */ - if (resource->descriptor->buffer_size == 0) { - return STATUS_ERR_INVALID_ARG; - } - - /* Clear the interrupt flag */ - regval = get_channel_reg_val(resource->channel_id, (uint32_t)&PROV_DMA_CTRL0->CH0_INT_STATUS_REG.reg); - set_channel_reg_val(resource->channel_id, (uint32_t)&PROV_DMA_CTRL0->CH0_INT_CLEAR_REG.reg, regval); - /* Set the interrupt flag */ - regval = PROV_DMA_CTRL_CH0_INT_ENABLE_REG_MASK & resource->callback_enable; - set_channel_reg_val(resource->channel_id, (uint32_t)&PROV_DMA_CTRL0->CH0_INT_ENABLE_REG.reg, regval); - /* Set job status */ - resource->job_status = STATUS_BUSY; - - /* Enable the transfer channel */ - set_channel_reg_val(resource->channel_id, (uint32_t)&PROV_DMA_CTRL0->CH0_CH_ENABLE_REG.reg, 1); - /* Start the transfer channel */ - set_channel_reg_val(resource->channel_id, (uint32_t)&PROV_DMA_CTRL0->CH0_CH_START_REG.reg, 1); - - return STATUS_OK; -} -/** - * \brief Get the channel index - * - * \param[in] channel Channel active - * - */ -static uint8_t get_channel_index(uint8_t channel) -{ - uint8_t index = 0; - - channel = channel & 0x0f; - do { - channel = channel >> 1; - index++; - } while (channel); - - return (index - 1); -} - -/** - * \brief DMA interrupt service routine. - * - */ -static void dma_isr_handler( void ) -{ - uint8_t active_channel; - static uint8_t channel_index; // - struct dma_resource *resource; - uint8_t isr; - uint8_t isr_flag = 0; - - /* Get active channel */ - active_channel = PROV_DMA_CTRL0->CORE_INT_STATUS.reg & - PROV_DMA_CTRL_CORE_INT_STATUS_CHANNEL__Msk; - - do { - channel_index = get_channel_index(active_channel); - /* Get active DMA resource based on channel */ - resource = _dma_active_resource[channel_index]; - isr = get_channel_reg_val(resource->channel_id, (uint32_t)&PROV_DMA_CTRL0->CH0_INT_STATUS_REG.reg); - /* Calculate block transfer size of the DMA transfer */ - resource->transfered_size = get_channel_reg_val(resource->channel_id, (uint32_t)&PROV_DMA_CTRL0->CH0_COUNT_REG.reg); - - /* DMA channel interrupt handler */ - if (isr & (1 << DMA_CALLBACK_TRANSFER_DONE)) { - /* Transfer complete flag */ - isr_flag = DMA_CALLBACK_TRANSFER_DONE; - /* Set job status */ - resource->job_status = STATUS_OK; - } else if (isr & (1 << DMA_CALLBACK_READ_ERR)) { - /* Read error flag */ - isr_flag = DMA_CALLBACK_READ_ERR; - /* Set I/O ERROR status */ - resource->job_status = STATUS_ERR_IO; - } else if (isr & (1 << DMA_CALLBACK_WRITE_ERR)) { - /* Write error flag */ - isr_flag = DMA_CALLBACK_WRITE_ERR; - /* Set I/O ERROR status */ - resource->job_status = STATUS_ERR_IO; - } else if (isr & (1 << DMA_CALLBACK_FIFO_OVERFLOW)) { - /* Overflow flag */ - isr_flag = DMA_CALLBACK_FIFO_OVERFLOW; - /* Set I/O ERROR status */ - resource->job_status = STATUS_ERR_IO; - } else if (isr & (1 << DMA_CALLBACK_FIFO_UNDERFLOW)) { - /* Underflow flag */ - isr_flag = DMA_CALLBACK_FIFO_UNDERFLOW; - /* Set I/O ERROR status */ - resource->job_status = STATUS_ERR_IO; - } else if (isr & (1 << DMA_CALLBACK_READ_TIMEOUT)) { - /* Read timeout flag */ - isr_flag = DMA_CALLBACK_READ_TIMEOUT; - /* Set I/O ERROR status */ - resource->job_status = STATUS_ERR_IO; - } else if (isr & (1 << DMA_CALLBACK_WRITE_TIMEOUT)) { - /* Write timeout flag */ - isr_flag = DMA_CALLBACK_WRITE_TIMEOUT; - /* Set I/O ERROR status */ - resource->job_status = STATUS_ERR_IO; - } else if (isr & (1 << DMA_CALLBACK_WDT_TRIGGER)) { - /* Watchdog error flag */ - isr_flag = DMA_CALLBACK_WDT_TRIGGER; - /* Set I/O ERROR status */ - resource->job_status = STATUS_ERR_IO; - } - - if (isr) { - /* Clear the watch dog error flag */ - set_channel_reg_val(resource->channel_id, (uint32_t)&PROV_DMA_CTRL0->CH0_INT_CLEAR_REG.reg, 1<<isr_flag); - /* Execute the callback function */ - if ((resource->callback_enable & (1<<isr_flag)) && - (resource->callback[isr_flag])) { - resource->callback[isr_flag](resource); - } - } - isr &= ~(1<<isr_flag); - } while (isr); - - NVIC_ClearPendingIRQ(PROV_DMA_CTRL0_IRQn); -} - -/** - * \brief Allocate a DMA with configurations. - * - * This function will allocate a proper channel for a DMA transfer request. - * - * \param[in,out] dma_resource Pointer to a DMA resource instance - * \param[in] transfer_config Configurations of the DMA transfer - * - * \return Status of the allocation procedure. - * - * \retval STATUS_OK The DMA resource was allocated successfully - * \retval STATUS_ERR_NOT_FOUND DMA resource allocation failed - */ -enum status_code dma_allocate(struct dma_resource *resource, - struct dma_resource_config *config) -{ - uint8_t new_channel; - - if (!_dma_inst._dma_init) { - /* Perform a reset before enable DMA controller */ - system_peripheral_reset(PERIPHERAL_DMA); - /* Select Mux 15 as PROV_DMA_CTRL0 interrupt source */ - LPMCU_MISC_REGS0->IRQ_MUX_IO_SEL_3.bit.MUX_15 = LPMCU_MISC_REGS_IRQ_MUX_IO_SEL_3_MUX_15_16_Val; - system_register_isr(31, (uint32_t)dma_isr_handler); - - _dma_inst._dma_init = true; - } - - new_channel = _dma_find_first_free_channel_and_allocate(); - /* If no channel available, return not found */ - if (new_channel == DMA_INVALID_CHANNEL) { - return STATUS_ERR_NOT_FOUND; - } - - /* Set the channel */ - resource->channel_id = new_channel; - /* Configure the DMA control,channel registers and descriptors here */ - _dma_set_config(resource, config); - - resource->descriptor = NULL; - - /* Log the DMA resource into the internal DMA resource pool */ - _dma_active_resource[resource->channel_id] = resource; - - return STATUS_OK; -}
\ No newline at end of file diff --git a/atmel-samd/asf/sam0/drivers/dma/dma_sam_b.h b/atmel-samd/asf/sam0/drivers/dma/dma_sam_b.h deleted file mode 100644 index ae3ecede8..000000000 --- a/atmel-samd/asf/sam0/drivers/dma/dma_sam_b.h +++ /dev/null @@ -1,650 +0,0 @@ -/** - * \file - * - * \brief Direct Memory Access Controller Driver for SAMB - * - * Copyright (C) 2015-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef DMA_H_INCLUDED -#define DMA_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \defgroup asfdoc_samb_dma_group SAM Direct Memory Access Controller Driver (DMAC) - * - * This driver for Atmel® | SMART SAM devices provides an interface for the configuration - * and management of the Direct Memory Access Controller(DMAC) module within - * the device. The DMAC can transfer data between memories and peripherals, and - * thus off-load these tasks from the CPU. The module supports peripheral to - * peripheral, peripheral to memory, memory to peripheral, and memory to memory - * transfers. - * - * The following peripherals are used by the DMAC Driver: - * - DMAC (Direct Memory Access Controller) - * - * The following devices can use this module: - * - Atmel | SMART SAM B11 - * - * The outline of this documentation is as follows: - * - \ref asfdoc_samb_dma_prerequisites - * - \ref asfdoc_samb_dma_module_overview - * - \ref asfdoc_samb_dma_special_considerations - * - \ref asfdoc_samb_dma_extra_info - * - \ref asfdoc_samb_dma_examples - * - \ref asfdoc_samb_dma_api_overview - * - * - * \section asfdoc_samb_dma_prerequisites Prerequisites - * - * There are no prerequisites for this module. - * - * - * \section asfdoc_samb_dma_module_overview Module Overview - * - * SAM devices with DMAC enables high data transfer rates with minimum - * CPU intervention and frees up CPU time. With access to all peripherals, - * the DMAC can handle automatic transfer of data to/from modules. - * It supports static and incremental addressing for both source and - * destination. - * - * The DMAC when used with peripheral triggers, provides a - * considerable advantage by reducing the power consumption and performing - * data transfer in the background. - * The CPU can remain in sleep during this time to reduce power consumption. - * - * <table> - * <tr> - * <th>Device</th> - * <th>Dma channel number</th> - * </tr> - * <tr> - * <td>SAMB11</td> - * <td>4</td> - * </tr> - * </table> - * The DMA channel operation can be suspended at any time by software, - * or after selectable descriptor execution. The DMAC driver for SAM - * supports four types of transfers such as peripheral to peripheral, - * peripheral to memory, memory to peripheral, and memory to memory. - * - * The basic transfer unit is a beat which is defined as a single bus access. - * There can be multiple beats in a single block transfer and multiple block - * transfers in a DMA transaction. - * DMA transfer is based on descriptors, which holds transfer properties - * such as the source and destination addresses, transfer counter, and other - * additional transfer control information. - * The descriptors can be static or linked. When static, a single block transfer - * is performed. When linked, a number of transfer descriptors can be used to - * enable multiple block transfers within a single DMA transaction. - * - * The implementation of the DMA driver is based on the idea that DMA channel - * is a finite resource of entities with the same abilities. A DMA channel resource - * is able to move a defined set of data from a source address to destination - * address triggered by a transfer trigger. On the SAM devices there are 12 - * DMA resources available for allocation. Each of these DMA resources can trigger - * interrupt callback routines. - * The other main features are: - * - * - Selectable transfer trigger source - * - Software - * - Peripheral - * - Tree level channel priority - * - Normal level - * - High level - * - Top level - * - Optional interrupt generation on transfer complete, channel error - * - Supports multi-buffer or circular buffer mode by linking multiple descriptors - * - Beat size configurable as 8-bit, 16-bit, or 32-bit - * - * A simplified block diagram of the DMA Resource can be seen in - * \ref asfdoc_samb_dma_module_block_diagram "the figure below". - * - * \anchor asfdoc_samb_dma_module_block_diagram - * \dot - * digraph overview { - * splines = false; - * rankdir=LR; - * - * mux1 [label="Transfer Trigger", shape=box]; - * - * dma [label="DMA Channel", shape=polygon, sides=6, orientation=60, style=filled, fillcolor=darkolivegreen1, height=1, width=1]; - * descriptor [label="Transfer Descriptor", shape=box, style=filled, fillcolor=lightblue]; - * - * mux1 -> dma; - * descriptor -> dma; - * - * interrupt [label="Interrupt", shape=box]; - * events [label="Events", shape=box]; - * - * dma:e -> interrupt:w; - * dma:e -> events:w; - * - * {rank=same; descriptor dma} - * - * } - * \enddot - * - * \subsection asfdoc_samb_dma_module_overview_dma_channels DMA Channels - * The DMAC in each device consists of several DMA channels, which - * along with the transfer descriptors defines the data transfer properties. - * - The transfer control descriptor defines the source and destination - * addresses, source and destination address increment settings, the - * block transfer count - * - Dedicated channel registers control the peripheral trigger source, - * trigger mode settings, and channel priority level settings - * - * With a successful DMA resource allocation, a dedicated - * DMA channel will be assigned. The channel will be occupied until the - * DMA resource is freed. A DMA resource handle is used to identify the specific - * DMA resource. - * When there are multiple channels with active requests, the arbiter prioritizes - * the channels requesting access to the bus. - * - * \subsection asfdoc_samb_dma_module_overview_dma_trigger DMA Triggers - * DMA transfer can be started only when a DMA transfer request is acknowledged/granted by the arbiter. A - * transfer request can be triggered from software, peripheral. There - * are dedicated source trigger selections for each DMA channel usage. - * - * \subsection asfdoc_samb_dma_module_overview_dma_transfer_descriptor DMA Transfer Descriptor - * The transfer descriptor resides in the SRAM and - * defines these channel properties. - * - * <table> - * <tr> - * <th>Field name</th> - * <th>Field width</th> - * </tr> - * <tr> - * <td>Source Address</td> - * <td>32 bits</td> - * </tr> - * <tr> - * <td>Destination Address</td> - * <td>32 bits</td> - * </tr> - * <tr> - * <td>Block Transfer Counter</td> - * <td>32 bits</td> - * </tr> - * <tr> - * <td>Descriptor Next Address</td> - * <td>30 bits</td> - * </tr> - * <tr> - * <td>Block Transfer Interrupt</td> - * <td>1 bit</td> - * </tr> - * <tr> - * <td>Block Transfer Stop Control</td> - * <td>1 bit</td> - * </tr> - * </table> - * - * Before starting a transfer, at least one descriptor should be configured. - * After a successful allocation of a DMA channel, the transfer descriptor can - * be added with a call to \ref dma_add_descriptor(). If there is a transfer - * descriptor already allocated to the DMA resource, the descriptor will - * be linked to the next descriptor address. - * - * \subsection asfdoc_samb_dma_module_overview_dma_output DMA Interrupts - * Both an interrupt callback and an peripheral can be triggered by the - * DMA transfer. Three types of callbacks are supported by the DMA driver: - * transfer complete, channel suspend, and transfer error. Each of these callback - * types can be registered and enabled for each channel independently through - * the DMA driver API. - * - * - * \section asfdoc_samb_dma_special_considerations Special Considerations - * - * There are no special considerations for this module. - * - * - * \section asfdoc_samb_dma_extra_info Extra Information - * - * For extra information, see \ref asfdoc_samb_dma_extra. This includes: - * - \ref asfdoc_samb_dma_extra_acronyms - * - \ref asfdoc_samb_dma_extra_dependencies - * - \ref asfdoc_samb_dma_extra_errata - * - \ref asfdoc_samb_dma_extra_history - * - * - * \section asfdoc_samb_dma_examples Examples - * - * For a list of examples related to this driver, see - * \ref asfdoc_samb_dma_exqsg. - * - * - * \section asfdoc_samb_dma_api_overview API Overview - * @{ - */ - -#include <compiler.h> -#include <system_sam_b.h> -#include "conf_dma.h" - -/** DMA IRQn number. */ -#define PROV_DMA_CTRL0_IRQn 15 - -/** DMA invalid channel number. */ -#define DMA_INVALID_CHANNEL 0xff - -/** DMA peripheral index */ -enum dma_peripheral_index { - MEMORY_DMA_PERIPHERAL = 0, - UART0RX_DMA_PERIPHERAL, - UART0TX_DMA_PERIPHERAL, - UART1RX_DMA_PERIPHERAL, - UART1TX_DMA_PERIPHERAL, - SPI0RX_DMA_PERIPHERAL, - SPI0TX_DMA_PERIPHERAL, - SPI1RX_DMA_PERIPHERAL, - SPI1TX_DMA_PERIPHERAL, - I2C0RX_DMA_PERIPHERAL, - I2C0TX_DMA_PERIPHERAL, - I2C1RX_DMA_PERIPHERAL, - I2C1TX_DMA_PERIPHERAL, - DUALTIMER0_DMA_PERIPHERAL = 15, - TIMER0_DMA_PERIPHERAL, -}; - -/** DMA channel index */ -enum dma_ch_index { - /** DMA channel 0 */ - DMA_CHANNEL_0 = 0, - /** DMA channel 1 */ - DMA_CHANNEL_1, - /** DMA channel 2 */ - DMA_CHANNEL_2, - /** DMA channel 3 */ - DMA_CHANNEL_3, -}; - -enum dma_endian_swap { - /** DMA endian no swap */ - DMA_ENDIAN_NO_SWAP, - /** DMA endian 16-bit */ - DMA_ENDIAN_SIZE_16, - /** DMA endian 32-bit */ - DMA_ENDIAN_SIZE_32, - /** DMA endian 64-bit */ - DMA_ENDIAN_SIZE_64, -}; - -/** - * Callback types for DMA callback driver. - */ -enum dma_callback_type { - /** Callback for transfer complete */ - DMA_CALLBACK_TRANSFER_DONE, - /** AHB read slave error */ - DMA_CALLBACK_READ_ERR, - /** AHB write slave error */ - DMA_CALLBACK_WRITE_ERR, - /** FIFO has been overflown */ - DMA_CALLBACK_FIFO_OVERFLOW, - /** FIFO has been underflows */ - DMA_CALLBACK_FIFO_UNDERFLOW, - /** Read timeout on AHB bus (timeout value fixed at 1024 cycles) */ - DMA_CALLBACK_READ_TIMEOUT, - /** Write timeout on AHB bus (timeout value fixed at 1024 cycles) */ - DMA_CALLBACK_WRITE_TIMEOUT, - /** Channel active but did not start a burst for 2048 cycles */ - DMA_CALLBACK_WDT_TRIGGER, - /** Number of available callbacks */ - DMA_CALLBACK_N, -}; - -/** - * DMA transfer descriptor configuration. When the source or destination address - * increment is enabled, the addresses stored into the configuration structure - * must correspond to the end of the transfer. - */ -struct dma_descriptor { - /** Start address of read buffer */ - uint32_t read_start_addr; - /** Start address of write buffer */ - uint32_t write_start_addr; - /** Size (in bytes) of buffer to transfer */ - uint32_t buffer_size; - union { - struct { - /** Active high interrupt enable once buffer has been transferred */ - uint32_t set_interrupt:1; - /** If set, channel stops when buffer done, otherwise load from cmd_next_addr */ - uint32_t last:1; - /** Address of next command if cmd_last is not set */ - uint32_t next_addr:30; - } cmd; - uint32_t next; - }; -}; -/** Structure for DMA source/description */ -struct dma_config { - /** Maximum number of bytes of an AHB read/write burst */ - uint8_t max_burst; - /** Number of AHB read/write commands to issue before channel is released */ - uint8_t tokens; - /** If true, the controller will increment the next burst address */ - bool enable_inc_addr; - /** Index of peripheral to read/write from (0 if memory or no peripheral flow control) */ - enum dma_peripheral_index periph; - /** - * Number of cycles to wait for read/write request signal to update - * after issuing the read/write clear signal - */ - uint8_t periph_delay; - /** Top priority enable */ - bool enable_proi_top; - /** Top priority channel index */ - uint8_t proi_top_index; - /** High priority enable */ - bool enable_proi_high; - /** High priority channel index */ - uint8_t proi_high_index; -}; - -/** Structure for DMA transfer resource */ -struct dma_resource_config { - struct dma_config src; - struct dma_config des; - /** If true, channel will work in joint mode */ - bool enable_joint_mode; - /** Endian Byte Swapping */ - enum dma_endian_swap swap; -}; - -/** Forward definition of the DMA resource */ -struct dma_resource; -/** Type definition for a DMA resource callback function */ -typedef void (*dma_callback_t)(struct dma_resource *const resource); - -/** Structure for DMA transfer resource */ -struct dma_resource { - /** Allocated DMA channel ID */ - uint8_t channel_id; - /** Array of callback functions for DMA transfer job */ - dma_callback_t callback[DMA_CALLBACK_N]; - /** Bit mask for enabled callbacks */ - uint8_t callback_enable; - /** Status of the last job */ - volatile enum status_code job_status; - /** Transferred data size */ - uint32_t transfered_size; - /** DMA transfer descriptor */ - struct dma_descriptor* descriptor; -}; - -/** - * \brief Get DMA resource status. - * - * \param[in] resource Pointer to the DMA resource - * - * \return Status of the DMA resource. - */ -static inline enum status_code dma_get_job_status(struct dma_resource *resource) -{ - return resource->job_status; -} - -/** - * \brief Enable a callback function for a dedicated DMA resource. - * - * \param[in] resource Pointer to the DMA resource - * \param[in] type Callback function type - * - */ -static inline void dma_enable_callback(struct dma_resource *resource, - enum dma_callback_type type) -{ - resource->callback_enable |= 1 << type; -} - -/** - * \brief Disable a callback function for a dedicated DMA resource. - * - * \param[in] resource Pointer to the DMA resource - * \param[in] type Callback function type - * - */ -static inline void dma_disable_callback(struct dma_resource *resource, - enum dma_callback_type type) -{ - resource->callback_enable &= ~(1 << type); -} - -/** - * \brief Register a callback function for a dedicated DMA resource. - * - * There are three types of callback functions, which can be registered: - * - Callback for transfer complete - * - Callback for transfer error - * - Callback for channel suspend - * - * \param[in] resource Pointer to the DMA resource - * \param[in] callback Pointer to the callback function - * \param[in] type Callback function type - * - */ -static inline void dma_register_callback(struct dma_resource *resource, - dma_callback_t callback, enum dma_callback_type type) -{ - resource->callback[type] = callback; -} - -/** - * \brief Unregister a callback function for a dedicated DMA resource. - * - * There are three types of callback functions: - * - Callback for transfer complete - * - Callback for transfer error - * - Callback for channel suspend - * - * The application can unregister any of the callback functions which - * are already registered and are no longer needed. - * - * \param[in] resource Pointer to the DMA resource - * \param[in] type Callback function type - * - */ -static inline void dma_unregister_callback(struct dma_resource *resource, - enum dma_callback_type type) -{ - resource->callback[type] = NULL; -} - -/** - * \brief Initializes DMA transfer configuration with predefined default values. - * - * This function will initialize a given DMA descriptor configuration structure to - * a set of known default values. This function should be called on - * any new instance of the configuration structure before being - * modified by the user application. - * - * The default configuration is as follows: - * \li Set the read start address as 0 - * \li Set the write start address as 0 - * \li Set buffer size as 1 - * \li Set beat size as byte - * \li Enable the interrupt - * \li Enable the channel stops when buffer done - * \li Set next command address to 0 - * \param[out] config Pointer to the configuration - * - */ -static inline void dma_descriptor_get_config_defaults(struct dma_descriptor *config) -{ - /* Default read buffer size is set to 0 */ - config->read_start_addr = 0; - /* Default write buffer size is set to 0 */ - config->write_start_addr = 0; - /* Set beat size to one byte */ - config->buffer_size = 1; - /* Enable transferred interrupt */ - config->cmd.set_interrupt = 1; - /* Channel stops when buffer done */ - config->cmd.last = 1; - /* Set next command to 0 */ - config->cmd.next_addr = 0; -} - -/** - * \brief Update DMA descriptor. - * - * This function can update the descriptor of an allocated DMA resource. - * - */ -static inline void dma_update_descriptor(struct dma_resource *resource, - struct dma_descriptor* descriptor) -{ - resource->descriptor = descriptor; -} - -/** - * \brief Reset DMA descriptor. - * - * This function will clear the DESCADDR register of an allocated DMA resource. - * - */ -static inline void dma_reset_descriptor(struct dma_resource *resource) -{ - resource->descriptor = NULL; -} - -void dma_get_config_defaults(struct dma_resource_config *config); -enum status_code dma_allocate(struct dma_resource *resource, - struct dma_resource_config *config); -enum status_code dma_add_descriptor(struct dma_resource *resource, - struct dma_descriptor* descriptor); -enum status_code dma_start_transfer_job(struct dma_resource *resource); -enum status_code dma_free(struct dma_resource *resource); -uint8_t dma_get_status(uint8_t channel); -uint8_t dma_get_interrupt_status(uint8_t channel); -void dma_clear_interrupt_status(uint8_t channel, uint8_t flag); -/** @} */ - -/** - * \page asfdoc_samb_dma_extra Extra Information for DMAC Driver - * - * \section asfdoc_samb_dma_extra_acronyms Acronyms - * Below is a table listing the acronyms used in this module, along with their - * intended meanings. - * - * <table> - * <tr> - * <th>Acronym</th> - * <th>Description</th> - * </tr> - * <tr> - * <td>DMA</td> - * <td>Direct Memory Access</td> - * </tr> - * <tr> - * <td>DMAC</td> - * <td>Direct Memory Access Controller </td> - * </tr> - * <tr> - * <td>CPU</td> - * <td>Central Processing Unit</td> - * </tr> - * </table> - * - * - * \section asfdoc_samb_dma_extra_dependencies Dependencies - * There are no dependencies related to this driver. - * - * - * \section asfdoc_samb_dma_extra_errata Errata - * There are no errata related to this driver. - * - * - * \section asfdoc_samb_dma_extra_history Module History - * An overview of the module history is presented in the table below, with - * details on the enhancements and fixes made to the module since its first - * release. The current version of this corresponds to the newest version in - * the table. - * - * <table> - * <tr> - * <th>Changelog</th> - * </tr> - * <tr> - * <td>Initial Release</td> - * </tr> - * </table> - */ - - /** - * \page asfdoc_samb_dma_exqsg Examples for DMAC Driver - * - * This is a list of the available Quick Start Guides (QSGs) and example - * applications for \ref asfdoc_samb_dma_group. QSGs are simple examples with - * step-by-step instructions to configure and use this driver in a selection of - * use cases. Note that QSGs can be compiled as a standalone application or be - * added to the user application. - * - * - \subpage asfdoc_samb_dma_basic_use_case - * - * \note More DMA usage examples are available in peripheral QSGs. - * - * \page asfdoc_samb_dma_document_revision_history Document Revision History - * - * <table> - * <tr> - * <th>Doc. Rev.</td> - * <th>Date</td> - * <th>Comments</td> - * </tr> - * <tr> - * <td>A</td> - * <td>09/2015</td> - * <td>Initial release</td> - * </tr> - * </table> - */ - -#ifdef __cplusplus -} -#endif - -#endif /* DMA_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/dma/module_config/conf_dma.h b/atmel-samd/asf/sam0/drivers/dma/module_config/conf_dma.h deleted file mode 100644 index fff0a2c81..000000000 --- a/atmel-samd/asf/sam0/drivers/dma/module_config/conf_dma.h +++ /dev/null @@ -1,51 +0,0 @@ -/** - * \file - * - * \brief SAM Direct Memory Access Driver Configuration Header - * - * Copyright (C) 2013-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef CONF_DMA_H_INCLUDED -#define CONF_DMA_H_INCLUDED - -# define CONF_MAX_USED_CHANNEL_NUM 5 - -#endif diff --git a/atmel-samd/asf/sam0/drivers/events/events.h b/atmel-samd/asf/sam0/drivers/events/events.h deleted file mode 100644 index 318b89a4c..000000000 --- a/atmel-samd/asf/sam0/drivers/events/events.h +++ /dev/null @@ -1,729 +0,0 @@ -/** - * \file - * - * \brief SAM Event System Driver - * - * Copyright (C) 2012-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef EVENTS_H_INCLUDED -#define EVENTS_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \defgroup asfdoc_sam0_events_group SAM Event System (EVENTS) Driver - * - * This driver for Atmel® | SMART ARM®-based microcontrollers provides - * an interface for the configuration and management of the device's peripheral - * event resources and users within the device, including enabling and disabling - * of peripheral source selection and synchronization of clock domains between - * various modules. The following API modes is covered by this manual: - * - Polled API - * \if EVENTS_INTERRUPT_HOOK_MODE - * - Interrupt hook API - * \endif - * - * The following peripheral is used by this module: - * - EVSYS (Event System Management) - * - * The following devices can use this module: - * - Atmel | SMART SAM D20/D21 - * - Atmel | SMART SAM R21 - * - Atmel | SMART SAM D09/D10/D11 - * - Atmel | SMART SAM L21/L22 - * - Atmel | SMART SAM DA1 - * - Atmel | SMART SAM C20/C21 - * - Atmel | SMART SAM R30 - * - * The outline of this documentation is as follows: - * - \ref asfdoc_sam0_events_prerequisites - * - \ref asfdoc_sam0_events_module_overview - * - \ref asfdoc_sam0_events_special_considerations - * - \ref asfdoc_sam0_events_extra_info - * - \ref asfdoc_sam0_events_examples - * - \ref asfdoc_sam0_events_api_overview - * - * - * \section asfdoc_sam0_events_prerequisites Prerequisites - * - * There are no prerequisites for this module. - * - * - * \section asfdoc_sam0_events_module_overview Module Overview - * - * Peripherals within the SAM devices are capable of generating two types of - * actions in response to given stimulus; set a register flag for later - * intervention by the CPU (using interrupt or polling methods), or generate - * event signals, which can be internally routed directly to other - * peripherals within the device. The use of events allows for direct actions - * to be performed in one peripheral in response to a stimulus in another - * without CPU intervention. This can lower the overall power consumption of the - * system if the CPU is able to remain in sleep modes for longer periods - * (SleepWalking), and lowers the latency of the system response. - * - * The event system is comprised of a number of freely configurable Event - * resources, plus a number of fixed Event Users. Each Event resource can be - * configured to select the input peripheral that will generate the events - * signal, as well as the synchronization path and edge detection mode. - * The fixed-function Event Users, connected to peripherals within the device, - * can then subscribe to an Event resource in a one-to-many relationship in order - * to receive events as they are generated. An overview of the event system - * chain is shown in - * \ref asfdoc_sam0_events_module_overview_fig "the figure below". - * - * \anchor asfdoc_sam0_events_module_overview_fig - * \dot - * digraph overview { - * rankdir=LR; - * node [label="Source\nPeripheral\n(Generator)" shape=ellipse style=filled fillcolor=lightgray] src_peripheral; - * node [label="Event\nResource A" shape=square style=""] event_gen0; - * node [label="Event\nUser X" shape=square style=""] event_user0; - * node [label="Event\nUser Y" shape=square style=""] event_user1; - * node [label="Destination\nPeripheral\n(User)" shape=ellipse style=filled fillcolor=lightgray] dst_peripheral0; - * node [label="Destination\nPeripheral\n(User)" shape=ellipse style=filled fillcolor=lightgray] dst_peripheral1; - * - * src_peripheral -> event_gen0; - * event_gen0 -> event_user0; - * event_gen0 -> event_user1; - * event_user0 -> dst_peripheral0; - * event_user1 -> dst_peripheral1; - * } - * \enddot - * - * There are many different events that can be routed in the device, which can - * then trigger many different actions. For example, an Analog Comparator module - * could be configured to generate an event when the input signal rises above - * the compare threshold, which then triggers a Timer Counter module to capture - * the current count value for later use. - * - * \subsection asfdoc_sam0_events_module_overview_event_channels Event Channels - * The Event module in each device consists of several channels, which can be - * freely linked to an event generator (i.e. a peripheral within the device - * that is capable of generating events). Each channel can be individually - * configured to select the generator peripheral, signal path, and edge detection - * applied to the input event signal, before being passed to any event user(s). - * - * Event channels can support multiple users within the device in a standardized - * manner. When an Event User is linked to an Event Channel, the channel will - * automatically handshake with all attached users to ensure that all modules - * correctly receive and acknowledge the event. - * - * \subsection asfdoc_sam0_events_module_overview_event_users Event Users - * Event Users are able to subscribe to an Event Channel, once it has been - * configured. Each Event User consists of a fixed connection to one of the - * peripherals within the device (for example, an ADC module, or Timer module) - * and is capable of being connected to a single Event Channel. - * - * \subsection asfdoc_sam0_events_module_overview_edge_detection Edge Detection - * For asynchronous events, edge detection on the event input is not possible, - * and the event signal must be passed directly between the event generator and - * event user. For synchronous and re-synchronous events, the input signal from - * the event generator must pass through an edge detection unit, so that only - * the rising, falling, or both edges of the event signal triggers an action in - * the event user. - * - * \subsection asfdoc_sam0_events_module_overview_path_selection Path Selection - * The event system in the SAM devices supports three signal path types from - * the event generator to Event Users: asynchronous, synchronous, and - * re-synchronous events. - * - * \subsubsection asfdoc_sam0_events_module_overview_path_selection_async Asynchronous Paths - * Asynchronous event paths allow for an asynchronous connection between the - * event generator and Event Users, when the source and destination - * peripherals share the same \ref asfdoc_sam0_system_clock_group "Generic Clock" - * channel. In this mode the event is propagated between the source and - * destination directly to reduce the event latency, thus no edge detection is - * possible. The asynchronous event chain is shown in - * \ref asfdoc_sam0_events_module_async_path_fig "the figure below". - * - * \anchor asfdoc_sam0_events_module_async_path_fig - * \dot - * digraph overview { - * rankdir=LR; - * node [label="Source\nPeripheral" shape=ellipse style=filled fillcolor=lightgray] src_peripheral; - * node [label="<f0> EVSYS | <f1> Event\nChannel/User" fillcolor=white style="dashed" shape=record] events_chan; - * node [label="Destination\nPeripheral" shape=ellipse style=filled fillcolor=lightgray] dst_peripheral; - * - * src_peripheral -> events_chan; - * events_chan -> dst_peripheral; - * - * } - * \enddot - * \note Identically shaped borders in the diagram indicate a shared generic clock channel. - * - * \subsubsection asfdoc_sam0_events_module_overview_path_selection_sync Synchronous Paths - * The Synchronous event path should be used when edge detection or interrupts - * from the event channel are required, and the source event generator and the - * event channel shares the same Generic Clock channel. The synchronous event - * chain is shown in - * \ref asfdoc_sam0_events_module_sync_path_fig "the figure below". - * - * Not all peripherals support Synchronous event paths; refer to the device datasheet. - * - * \anchor asfdoc_sam0_events_module_sync_path_fig - * \dot - * digraph overview { - * rankdir=LR; - * node [label="Source\nPeripheral" shape=ellipse style="filled, dashed" fillcolor=lightgray] src_peripheral; - * node [label="<f0> EVSYS | <f1> Event\nChannel/User" fillcolor=white shape=record style="dashed"] events_chan; - * node [label="Destination\nPeripheral" shape=ellipse style="filled, solid" fillcolor=lightgray] dst_peripheral; - * - * src_peripheral -> events_chan; - * events_chan -> dst_peripheral; - * - * } - * \enddot - * \note Identically shaped borders in the diagram indicate a shared generic clock channel. - * - * \subsubsection asfdoc_sam0_events_module_overview_path_selection_resync Re-synchronous Paths - * Re-synchronous event paths are a special form of synchronous events, where - * when edge detection or interrupts from the event channel are required, but - * the event generator and the event channel use different Generic Clock - * channels. The re-synchronous path allows the Event System to synchronize the - * incoming event signal from the Event Generator to the clock of the Event - * System module to avoid missed events, at the cost of a higher latency due to - * the re-synchronization process. The re-synchronous event chain is shown in - * \ref asfdoc_sam0_events_module_resync_path_fig "the figure below". - * - * Not all peripherals support re-synchronous event paths; refer to the device datasheet. - * \anchor asfdoc_sam0_events_module_resync_path_fig - * \dot - * digraph overview { - * rankdir=LR; - * node [label="Source\nPeripheral" shape=ellipse style="filled, dotted" fillcolor=lightgray] src_peripheral; - * node [label="<f0> EVSYS | <f1> Event\nChannel/User" fillcolor=white shape=record style="dashed"] events_chan; - * node [label="Destination\nPeripheral" shape=ellipse style=filled fillcolor=lightgray] dst_peripheral; - * - * src_peripheral -> events_chan; - * events_chan -> dst_peripheral; - * - * } - * \enddot - * \note Identically shaped borders in the diagram indicate a shared generic clock channel. - * - * \subsection asfdoc_sam0_events_module_overview_physical Physical Connection - * - * \ref asfdoc_sam0_events_module_int_connections_fig "The diagram below" - * shows how this module is interconnected within the device. - * - * \anchor asfdoc_sam0_events_module_int_connections_fig - * \dot - * digraph overview { - * rankdir=LR; - * node [label="Source\nPeripherals" shape=ellipse style=filled fillcolor=lightgray] src_peripheral; - * - * subgraph driver { - * node [label="<f0> EVSYS | <f1> Event Channels" fillcolor=white shape=record] events_chan; - * node [label="<f0> EVSYS | <f1> Event Users" fillcolor=white shape=record] events_user; - * } - * - * node [label="Destination\nPeripherals" shape=ellipse style=filled fillcolor=lightgray] dst_peripheral; - * - * src_peripheral -> events_chan:f1 [label="Source\nMUXs"]; - * events_chan:f1 -> events_user:f1 [label="Channel\nMUXs"]; - * events_user:f1 -> dst_peripheral; - * } - * \enddot - * - * \subsection asfdoc_sam0_events_module_overview_config Configuring Events - * For SAM devices, several steps are required to properly configure an - * event chain, so that hardware peripherals can respond to events generated by - * each other, as listed below. - * - * \subsubsection asfdoc_sam0_events_module_overview_config_src Source Peripheral - * -# The source peripheral (that will generate events) must be configured and - * enabled. - * -# The source peripheral (that will generate events) must have an output - * event enabled. - - * \subsubsection asfdoc_sam0_events_module_overview_config_evsys Event System - * -# An event system channel must be allocated and configured with the - * correct source peripheral selected as the channel's event generator. - * -# The event system user must be configured and enabled, and attached to - # event channel previously allocated. - - * \subsubsection asfdoc_sam0_events_module_overview_config_dst Destination Peripheral - * -# The destination peripheral (that will receive events) must be configured - * and enabled. - * -# The destination peripheral (that will receive events) must have an input - * event enabled. - * - * - * \section asfdoc_sam0_events_special_considerations Special Considerations - * - * There are no special considerations for this module. - * - * - * \section asfdoc_sam0_events_extra_info Extra Information - * - * For extra information, see \ref asfdoc_sam0_events_extra. This includes: - * - \ref asfdoc_sam0_events_extra_acronyms - * - \ref asfdoc_sam0_events_extra_dependencies - * - \ref asfdoc_sam0_events_extra_errata - * - \ref asfdoc_sam0_events_extra_history - * - * - * \section asfdoc_sam0_events_examples Examples - * - * For a list of examples related to this driver, see - * \ref asfdoc_sam0_events_exqsg. - * - * - * \section asfdoc_sam0_events_api_overview API Overview - * @{ - */ - -#include <compiler.h> -#include "events_common.h" - -/** - * \brief Edge detect enum. - * - * Event channel edge detect setting. - * - */ -enum events_edge_detect { - /** No event output */ - EVENTS_EDGE_DETECT_NONE, - /** Event on rising edge */ - EVENTS_EDGE_DETECT_RISING, - /** Event on falling edge */ - EVENTS_EDGE_DETECT_FALLING, - /** Event on both edges */ - EVENTS_EDGE_DETECT_BOTH, -}; - -/** - * \brief Path selection enum. - * - * Event channel path selection. - * - */ -enum events_path_selection { - /** Select the synchronous path for this event channel */ - EVENTS_PATH_SYNCHRONOUS, - /** Select the resynchronizer path for this event channel */ - EVENTS_PATH_RESYNCHRONIZED, - /** Select the asynchronous path for this event channel */ - EVENTS_PATH_ASYNCHRONOUS, -}; - -/** - * \brief Events configuration struct. - * - * This event configuration struct is used to configure each of the channels. - * - */ -struct events_config { - /** Select edge detection mode */ - enum events_edge_detect edge_detect; - /** Select events channel path */ - enum events_path_selection path; - /** Set event generator for the channel */ - uint8_t generator; - /** Clock source for the event channel */ - uint8_t clock_source; -#if (SAML21) || (SAML22) || (SAMC20) || (SAMC21) || (SAMR30) - /** Run in standby mode for the channel */ - bool run_in_standby; - /** Run On Demand */ - bool on_demand; -#endif -}; - -/** - * \brief No event generator definition. - * - * Use this to disable any peripheral event input to a channel. This can be useful - * if you only want to use a channel for software generated events. - * - */ - -///@cond INTERNAL -/** - * \internal - * Status bit offsets in the status register/interrupt register. - * - * @{ - */ -#if (SAML21) || (SAML22) || (SAMC20) || (SAMC21) || (SAMR30) -# define _EVENTS_START_OFFSET_BUSY_BITS 16 -# define _EVENTS_START_OFFSET_USER_READY_BIT 0 -# define _EVENTS_START_OFFSET_DETECTION_BIT 16 -# define _EVENTS_START_OFFSET_OVERRUN_BIT 0 -#else /* SAM D/R */ -# define _EVENTS_START_OFFSET_BUSY_BITS 8 -# define _EVENTS_START_OFFSET_USER_READY_BIT 0 -# define _EVENTS_START_OFFSET_DETECTION_BIT 8 -# define _EVENTS_START_OFFSET_OVERRUN_BIT 0 -#endif -/** @} */ -///@endcond - -/** -* Definition for no generator selection. -*/ -#define EVSYS_ID_GEN_NONE 0 - -/** - * \brief Event channel resource. - * - * Event resource structure. - * - * \note The fields in this structure should not be altered by the user application; - * they are reserved for driver internals only. - */ -struct events_resource { -#if !defined(__DOXYGEN__) - /** Channel allocated for the event resource */ - uint8_t channel; - /** Channel setting in CHANNEL register */ - uint32_t channel_reg; -#endif -}; - -#if EVENTS_INTERRUPT_HOOKS_MODE == true -typedef void (*events_interrupt_hook)(struct events_resource *resource); - -/** - * \brief Event hook. - * - * Event hook structure. - * - */ -struct events_hook { - /** Event resource */ - struct events_resource *resource; - /** Event hook function */ - events_interrupt_hook hook_func; - /** Next event hook */ - struct events_hook *next; -}; -#endif - -/** - * \brief Initializes an event configurations struct to defaults. - * - * Initailizes an event configuration struct to predefined safe default settings. - * - * \param[in] config Pointer to an instance of \ref struct events_config - * - */ -void events_get_config_defaults(struct events_config *config); - -/** - * \brief Allocate an event channel and set configuration. - * - * Allocates an event channel from the event channel pool and sets - * the channel configuration. - * - * \param[out] resource Pointer to a \ref events_resource struct instance - * \param[in] config Pointer to a \ref events_config struct - * - * \return Status of the configuration procedure. - * \retval STATUS_OK Allocation and configuration went successful - * \retval STATUS_ERR_NOT_FOUND No free event channel found - * - */ -enum status_code events_allocate(struct events_resource *resource, struct events_config *config); - -/** - * \brief Attach user to the event channel. - * - * Attach a user peripheral to the event channel to receive events. - * - * \param[in] resource Pointer to an \ref events_resource struct instance - * \param[in] user_id A number identifying the user peripheral found in the device header file - * - * \return Status of the user attach procedure. - * \retval STATUS_OK No errors detected when attaching the event user - */ -enum status_code events_attach_user(struct events_resource *resource, uint8_t user_id); - -/** - * \brief Detach a user peripheral from the event channel. - * - * Deattach a user peripheral from the event channels so it does not receive any more events. - * - * \param[in] resource Pointer to an \ref event_resource struct instance - * \param[in] user_id A number identifying the user peripheral found in the device header file - * - * \return Status of the user detach procedure. - * \retval STATUS_OK No errors detected when detaching the event user - */ -enum status_code events_detach_user(struct events_resource *resource, uint8_t user_id); - -/** - * \brief Check if a channel is busy. - * - * Check if a channel is busy, a channel stays busy until all users connected to the channel - * has handled an event. - * - * \param[in] resource Pointer to a \ref events_resource struct instance - * - * \return Status of the channels busy state. - * \retval true One or more users connected to the channel has not handled the last event - * \retval false All users are ready to handle new events - */ -bool events_is_busy(struct events_resource *resource); - -/** - * \brief Trigger software event. - * - * Trigger an event by software. - * - * \note Software event works on either a synchronous path or resynchronized path, and - * edge detection must be configured to rising-edge detection. - * - * \param[in] resource Pointer to an \ref events_resource struct - * - * \return Status of the event software procedure. - * \retval STATUS_OK No error was detected when the software tigger signal was issued - * \retval STATUS_ERR_UNSUPPORTED_DEV If the channel path is asynchronous and/or the - * edge detection is not set to RISING - */ -enum status_code events_trigger(struct events_resource *resource); - -/** - * \brief Check if all users connected to the channel are ready. - * - * Check if all users connected to the channel are ready to handle incoming events. - * - * \param[in] resource Pointer to an \ref events_resource struct - * - * \return The ready status of users connected to an event channel. - * \retval true All the users connected to the event channel are ready to handle incoming events - * \retval false One or more users connected to the event channel are not ready to handle incoming events - */ -bool events_is_users_ready(struct events_resource *resource); - -/** - * \brief Check if an event is detected on the event channel. - * - * Check if an event has been detected on the channel. - * - * \note This function will clear the event detected interrupt flag. - * - * \param[in] resource Pointer to an \ref events_resource struct - * - * \return Status of the event detection interrupt flag. - * \retval true Event has been detected - * \retval false Event has not been detected - */ -bool events_is_detected(struct events_resource *resource); - -/** - * \brief Check if there has been an overrun situation on this channel. - * - * \note This function will clear the event overrun detected interrupt flag. - * - * \param[in] resource Pointer to an \ref events_resource struct - * - * \return Status of the event overrun interrupt flag. - * \retval true Event overrun has been detected - * \retval false Event overrun has not been detected - */ -bool events_is_overrun(struct events_resource *resource); - -/** - * \brief Release allocated channel back the the resource pool. - * - * Release an allocated channel back to the resource pool to make it available for other purposes. - * - * \param[in] resource Pointer to an \ref events_resource struct - * - * \return Status of the channel release procedure. - * \retval STATUS_OK No error was detected when the channel was released - * \retval STATUS_BUSY One or more event users have not processed the last event - * \retval STATUS_ERR_NOT_INITIALIZED Channel not allocated, and can therefore not be released - */ -enum status_code events_release(struct events_resource *resource); - -/** - * \brief Get the number of free channels. - * - * Get the number of allocatable channels in the events system resource pool. - * - * \return The number of free channels in the event system. - * - */ -uint8_t events_get_free_channels(void); - - -///@cond INTERNAL -/** - * \internal - * Function to find bit position in the CHSTATUS and INTFLAG register, - * and return bit mask of this position. - * - * @{ - */ -uint32_t _events_find_bit_position(uint8_t channel, uint8_t start_offset); -/** @} */ -///@endcond - - -/** @} */ - -/** - * \page asfdoc_sam0_events_extra Extra Information for EVENTS Driver - * - * \section asfdoc_sam0_events_extra_acronyms Acronyms - * Below is a table listing the acronyms used in this module, along with their - * intended meanings. - * - * <table> - * <tr> - * <th>Acronym</th> - * <th>Description</th> - * </tr> - * <tr> - * <td>CPU</td> - * <td>Central Processing Unit</td> - * </tr> - * <tr> - * <td>MUX</td> - * <td>Multiplexer</td> - * </tr> - * </table> - * - * - * \section asfdoc_sam0_events_extra_dependencies Dependencies - * This driver has the following dependencies: - * - * - \ref asfdoc_sam0_system_clock_group "System Clock Driver" - * - * - * \section asfdoc_sam0_events_extra_errata Errata - * There are no errata related to this driver. - * - * - * \section asfdoc_sam0_events_extra_history Module History - * An overview of the module history is presented in the table below, with - * details on the enhancements and fixes made to the module since its first - * release. The current version of this corresponds to the newest version in - * the table. - * - * <table> - * <tr> - * <th>Changelog</th> - * </tr> - * <tr> - * <td>Fix a bug in internal function _events_find_bit_position()</td> - * </tr> - * <tr> - * <td>Rewrite of events driver</td> - * </tr> - * <tr> - * <td>Initial Release</td> - * </tr> - * </table> - */ - - /** - * \page asfdoc_sam0_events_exqsg Examples for EVENTS Driver - * - * This is a list of the available Quick Start guides (QSGs) and example - * applications for \ref asfdoc_sam0_events_group. QSGs are simple examples with - * step-by-step instructions to configure and use this driver in a selection of - * use cases. Note that a QSG can be compiled as a standalone application or be - * added to the user application. - * - * - \subpage asfdoc_sam0_events_basic_use_case - * \if EVENTS_INTERRUPT_HOOK_MODE - * - \subpage asfdoc_sam0_events_interrupt_hook_use_case - * \endif - * - * \page asfdoc_sam0_events_document_revision_history Document Revision History - * - * <table> - * <tr> - * <th>Doc. Rev.</td> - * <th>Date</td> - * <th>Comments</td> - * </tr> - * <tr> - * <td>42108G</td> - * <td>12/2015</td> - * <td>Added support for SAM D09 and SAM L22</td> - * </tr> - * <tr> - * <td>42108F</td> - * <td>08/2015</td> - * <td>Added support for SAM L21, SAM DA1, SAMR30 and SAM C20/C21</td> - * </tr> - * <tr> - * <td>42108E</td> - * <td>12/2014</td> - * <td>Added support for interrupt hook mode. - * Added support for SAM R21 and SAM D10/D11.</td> - * </tr> - * <tr> - * <td>42108D</td> - * <td>01/2014</td> - * <td>Update to support SAM D21 and corrected documentation typos</td> - * </tr> - * <tr> - * <td>42108C</td> - * <td>11/2013</td> - * <td>Fixed incorrect documentation for the event signal paths. Added - * configuration steps overview to the documentation.</td> - * </tr> - * <tr> - * <td>42108B</td> - * <td>06/2013</td> - * <td>Corrected documentation typos</td> - * </tr> - * <tr> - * <td>42108A</td> - * <td>06/2013</td> - * <td>Initial release</td> - * </tr> - * </table> - */ - -#ifdef __cplusplus -} -#endif - -#endif /* EVENTS_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/events/events_common.h b/atmel-samd/asf/sam0/drivers/events/events_common.h deleted file mode 100644 index b40db7cec..000000000 --- a/atmel-samd/asf/sam0/drivers/events/events_common.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * \file - * - * \brief SAM Event System Controller Driver - * - * Copyright (C) 2014-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef _EVENTS_COMMON_H_INCLUDED_ -#define _EVENTS_COMMON_H_INCLUDED_ - -/** - * \internal Internal module structure to manage necessary globals - * - * - */ -struct _events_module { - /* Allocated channels bitmask where 1 means allocated */ - volatile uint32_t allocated_channels; - /* Free channels */ - uint8_t free_channels; - -#if EVENTS_INTERRUPT_HOOKS_MODE == true - /* Buffer to store a copy of the current interrupt flags */ - volatile uint32_t interrupt_flag_buffer; - /* Buffer to store acknowledged interrupt sources */ - volatile uint32_t interrupt_flag_ack_buffer; - - /* Interrup hook linked list start pointer */ - struct events_hook *hook_list; -#endif -}; - -#endif diff --git a/atmel-samd/asf/sam0/drivers/events/events_hooks.c b/atmel-samd/asf/sam0/drivers/events/events_hooks.c deleted file mode 100644 index ee912b060..000000000 --- a/atmel-samd/asf/sam0/drivers/events/events_hooks.c +++ /dev/null @@ -1,235 +0,0 @@ -/* - * \file - * - * \brief SAM Event System Controller Driver - * - * Copyright (C) 2014-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#include "events.h" -#include "events_hooks.h" -#include "system_interrupt.h" - -#if (SAML21) || (SAML22) || (SAMC20) || (SAMC21) || (SAMR30) -# define _EVENTS_INTFLAGS_DETECT 0x0fff0000 -# define _EVENTS_INTFLAGS_OVERRUN 0x00000fff -#else -# define _EVENTS_INTFLAGS_DETECT 0x0f00ff00 -# define _EVENTS_INTFLAGS_OVERRUN 0x000f00ff -#endif -#define _EVENTS_INTFLAGS_MASK (_EVENTS_INTFLAGS_DETECT | _EVENTS_INTFLAGS_OVERRUN) - -extern struct _events_module _events_inst; - -enum status_code events_create_hook(struct events_hook *hook, events_interrupt_hook func) -{ - /* Initialize the hook struct members */ - hook->next = NULL; - hook->resource = NULL; - hook->hook_func = func; - - return STATUS_OK; -} - -enum status_code events_add_hook(struct events_resource *resource, struct events_hook *hook) -{ - struct events_hook *tmp_hook = NULL; - - /* Associate the hook with the resource */ - hook->resource = resource; - - /* Check if this is the first hook in the list */ - if (_events_inst.hook_list == NULL) { - _events_inst.hook_list = hook; - } else { - tmp_hook = _events_inst.hook_list; - - /* Find the first free place in the list */ - while (tmp_hook->next != NULL) { - tmp_hook = tmp_hook->next; - } - - /* Put the hook into the next free place in the list */ - tmp_hook->next = hook; - } - - /* Check if interrupts from the EVSYS module is enabled in the interrupt controller */ - if (!system_interrupt_is_enabled(SYSTEM_INTERRUPT_MODULE_EVSYS)) { - system_interrupt_enable(SYSTEM_INTERRUPT_MODULE_EVSYS); - } - - return STATUS_OK; -} - -enum status_code events_del_hook(struct events_resource *resource, struct events_hook *hook) -{ - struct events_hook *tmp_hook = _events_inst.hook_list; - struct events_hook *last_hook = NULL; - - if (tmp_hook != NULL) { - /* Check if the first hook in the list is the one we are looking for */ - if (tmp_hook != hook) { - /* Don't double check the first hook */ - tmp_hook = tmp_hook->next; - - /* Check if the current hook is the one we are looking for */ - while (tmp_hook != hook) { - - /* If the current hook pointer is NULL the hook is not found in the list */ - if(tmp_hook == NULL) { - return STATUS_ERR_NOT_FOUND; - } - - last_hook = tmp_hook; - tmp_hook = tmp_hook->next; - - } - /* Remove the current hook from the list */ - last_hook->next = tmp_hook->next; - } else { - _events_inst.hook_list = tmp_hook->next; - } - } else { - /* No hooks where found in the list */ - return STATUS_ERR_NO_MEMORY; - } - - return STATUS_OK; -} - -enum status_code events_enable_interrupt_source(struct events_resource *resource, enum events_interrupt_source source) -{ - Assert((source == EVENTS_INTERRUPT_DETECT) || (source == EVENTS_INTERRUPT_OVERRUN)); - - if (source == EVENTS_INTERRUPT_DETECT) { - EVSYS->INTENSET.reg = _events_find_bit_position(resource->channel, - _EVENTS_START_OFFSET_DETECTION_BIT); - } else if (source == EVENTS_INTERRUPT_OVERRUN) { - EVSYS->INTENSET.reg = _events_find_bit_position(resource->channel, - _EVENTS_START_OFFSET_OVERRUN_BIT); - } else { - return STATUS_ERR_INVALID_ARG; - } - - return STATUS_OK; -} - -enum status_code events_disable_interrupt_source(struct events_resource *resource, enum events_interrupt_source source) -{ - Assert((source == EVENTS_INTERRUPT_DETECT) || (source == EVENTS_INTERRUPT_OVERRUN)); - - if (source == EVENTS_INTERRUPT_DETECT) { - EVSYS->INTENCLR.reg = _events_find_bit_position(resource->channel, - _EVENTS_START_OFFSET_DETECTION_BIT); - } else if (source == EVENTS_INTERRUPT_OVERRUN) { - EVSYS->INTENCLR.reg = _events_find_bit_position(resource->channel, - _EVENTS_START_OFFSET_OVERRUN_BIT); - } else { - return STATUS_ERR_INVALID_ARG; - } - - return STATUS_OK; -} - - -bool events_is_interrupt_set(struct events_resource *resource, enum events_interrupt_source source) -{ - Assert((source == EVENTS_INTERRUPT_DETECT) || (source == EVENTS_INTERRUPT_OVERRUN)); - - uint32_t bitpos; - - if (source == EVENTS_INTERRUPT_DETECT) { - bitpos = _events_find_bit_position(resource->channel, - _EVENTS_START_OFFSET_DETECTION_BIT); - } else if (source == EVENTS_INTERRUPT_OVERRUN) { - bitpos = _events_find_bit_position(resource->channel, - _EVENTS_START_OFFSET_OVERRUN_BIT); - } else { - return false; - } - - return (bool)(_events_inst.interrupt_flag_buffer & bitpos); -} - -enum status_code events_ack_interrupt(struct events_resource *resource, enum events_interrupt_source source) -{ - Assert((source == EVENTS_INTERRUPT_DETECT) || (source == EVENTS_INTERRUPT_OVERRUN)); - - uint32_t bitpos; - - if (source == EVENTS_INTERRUPT_DETECT) { - bitpos = _events_find_bit_position(resource->channel, - _EVENTS_START_OFFSET_DETECTION_BIT); - } else if (source == EVENTS_INTERRUPT_OVERRUN) { - bitpos = _events_find_bit_position(resource->channel, - _EVENTS_START_OFFSET_OVERRUN_BIT); - } else { - return STATUS_ERR_INVALID_ARG; - } - - _events_inst.interrupt_flag_ack_buffer |= bitpos; - - return STATUS_OK; -} - -void EVSYS_Handler(void) -{ - struct events_hook *current_hook = _events_inst.hook_list; - uint32_t flag; - - /* Synch the interrupt flag buffer with the hardware register */ - flag = EVSYS->INTFLAG.reg; - _events_inst.interrupt_flag_buffer |= flag; - /* Clear all hardware interrupt flags */ - EVSYS->INTFLAG.reg = _EVENTS_INTFLAGS_MASK; - - /* Traverse the linked list */ - while (current_hook != NULL) { - current_hook->hook_func(current_hook->resource); - current_hook = current_hook->next; - } - - /* Clear acknowledged interrupt sources from the interrupt flag buffer */ - flag = _events_inst.interrupt_flag_ack_buffer; - _events_inst.interrupt_flag_buffer &= ~flag; -} - - - diff --git a/atmel-samd/asf/sam0/drivers/events/events_hooks.h b/atmel-samd/asf/sam0/drivers/events/events_hooks.h deleted file mode 100644 index f16e5e336..000000000 --- a/atmel-samd/asf/sam0/drivers/events/events_hooks.h +++ /dev/null @@ -1,182 +0,0 @@ -/** - * \file - * - * \brief SAM Event System Driver - * - * Copyright (C) 2014-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#include "events.h" - -#ifndef _EVENTS_HOOKS_H_INCLUDED_ -#define _EVENTS_HOOKS_H_INCLUDED_ - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \addtogroup asfdoc_sam0_events_group - * @{ - * - */ - -/** - * \brief Interrupt source enumerator. - * - * Interrupt source selector definitions. - * - */ -enum events_interrupt_source { - /** Overrun in event channel detected interrupt */ - EVENTS_INTERRUPT_OVERRUN, - /** Event signal propagation in event channel detected interrupt */ - EVENTS_INTERRUPT_DETECT, -}; - -/** - * \brief Initializes an interrupt hook for insertion in the event interrupt hook queue. - * - * Initializes a hook structure so it is ready for insertion in the interrupt hook queue. - * - * \param[out] hook Pointer to an \ref events_hook struct instance - * \param[in] hook_func Pointer to a function containing the interrupt hook code - * - * \return Status of the hook creation procedure. - * \retval STATUS_OK Creation and initialization of interrupt hook went successful - * - */ -enum status_code events_create_hook(struct events_hook *hook, events_interrupt_hook hook_func); - -/** - * \brief Insert hook into the event drivers interrupt hook queue. - * - * Inserts a hook into the event drivers interrupt hook queue. - * - * \param[in] resource Pointer to an \ref events_resource struct instance - * \param[in] hook Pointer to an \ref events_hook struct instance - * - * \return Status of the insertion procedure. - * \retval STATUS_OK Insertion of hook went successful - * - */ -enum status_code events_add_hook(struct events_resource *resource, struct events_hook *hook); - -/** - * \brief Remove hook from the event drivers interrupt hook queue. - * - * Removes a hook from the event drivers interrupt hook queue. - * - * \param[in] resource Pointer to an \ref events_resource struct instance - * \param[in] hook Pointer to an \ref events_hook struct instance - * - * \return Status of the removal procedure. - * \retval STATUS_OK Removal of hook went successful - * \retval STATUS_ERR_NO_MEMORY There are no hooks instances in the event driver interrupt hook list - * \retval STATUS_ERR_NOT_FOUND Interrupt hook not found in the event drivers interrupt hook list - * - */ -enum status_code events_del_hook(struct events_resource *resource, struct events_hook *hook); - -/** - * \brief Enable interrupt source. - * - * Enable an interrupt source so can trigger execution of an interrupt hook. - * - * \param[in] resource Pointer to an \ref events_resource struct instance - * \param[in] source One of the members in the \ref events_interrupt_source enumerator - * - * \return Status of the interrupt source enable procedure. - * \retval STATUS_OK Enabling of the interrupt source was successful - * \retval STATUS_ERR_INVALID_ARG Interrupt source does not exist - * - */ -enum status_code events_enable_interrupt_source(struct events_resource *resource, enum events_interrupt_source source); - -/** - * \brief Disable interrupt source. - * - * Disable an interrupt source so can trigger execution of an interrupt hook. - * - * \param[in] resource Pointer to an \ref events_resource struct instance - * \param[in] source One of the members in the \ref events_interrupt_source enumerator - * - * \return Status of the interrupt source enable procedure. - * \retval STATUS_OK Enabling of the interrupt source went successful - * \retval STATUS_ERR_INVALID_ARG Interrupt source does not exist - * - */ -enum status_code events_disable_interrupt_source(struct events_resource *resource, enum events_interrupt_source source); - -/** - * \brief Check if interrupt source is set. - * - * Check if an interrupt source is set and should be processed. - * - * \param[in] resource Pointer to an \ref events_resource struct instance - * \param[in] source One of the members in the \ref events_interrupt_source enumerator - * - * \return Status of the interrupt source. - * \retval true Interrupt source is set - * \retval false Interrupt source is not set - * - */ -bool events_is_interrupt_set(struct events_resource *resource, enum events_interrupt_source source); - -/** - * \brief Acknowledge an interrupt source. - * - * Acknowledge an interrupt source so the interrupt state is cleared in hardware. - * - * \param[in] resource Pointer to an \ref events_resource struct instance - * \param[in] source One of the members in the \ref events_interrupt_source enumerator - * - * \return Status of the interrupt source. - * \retval STATUS_OK Interrupt source was acknowledged successfully - * - */ -enum status_code events_ack_interrupt(struct events_resource *resource, enum events_interrupt_source source); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/atmel-samd/asf/sam0/drivers/events/events_sam_d_r/events.c b/atmel-samd/asf/sam0/drivers/events/events_sam_d_r/events.c deleted file mode 100644 index b2180b999..000000000 --- a/atmel-samd/asf/sam0/drivers/events/events_sam_d_r/events.c +++ /dev/null @@ -1,328 +0,0 @@ -/* - * \file - * - * \brief SAM Event System Controller Driver - * - * Copyright (C) 2013-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#include <events.h> -#include <system.h> -#include <system_interrupt.h> -#include <status_codes.h> - -#define EVENTS_INVALID_CHANNEL 0xff - -struct _events_module _events_inst = { - .allocated_channels = 0, - .free_channels = EVSYS_CHANNELS, - -#if EVENTS_INTERRUPT_HOOKS_MODE == true - .interrupt_flag_buffer = 0, - .interrupt_flag_ack_buffer = 0, - - .hook_list = NULL, -#endif -}; - -/** - * \internal - * - */ -uint32_t _events_find_bit_position(uint8_t channel, uint8_t start_offset) -{ - uint32_t pos; - - if (channel < _EVENTS_START_OFFSET_BUSY_BITS) { - pos = 0x01UL << (start_offset + channel); - } else { - pos = 0x01UL << (start_offset + channel + _EVENTS_START_OFFSET_BUSY_BITS); - } - - return pos; -} - -static uint8_t _events_find_first_free_channel_and_allocate(void) -{ - uint8_t count; - uint32_t tmp; - bool allocated = false; - - system_interrupt_enter_critical_section(); - - tmp = _events_inst.allocated_channels; - - for(count = 0; count < EVSYS_CHANNELS; ++count) { - - if(!(tmp & 0x00000001)) { - /* If free channel found, set as allocated and return number */ - - _events_inst.allocated_channels |= 1 << count; - _events_inst.free_channels--; - allocated = true; - - break; - - } - - tmp = tmp >> 1; - } - - system_interrupt_leave_critical_section(); - - if(!allocated) { - return EVENTS_INVALID_CHANNEL; - } else { - return count; - } -} - -static void _events_release_channel(uint8_t channel) -{ - system_interrupt_enter_critical_section(); - - _events_inst.allocated_channels &= ~(1 << channel); - _events_inst.free_channels++; - - system_interrupt_leave_critical_section(); -} - - -/* This function is called by the system_init function, but should not be a public API call */ -#if defined(__GNUC__) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wmissing-prototypes" -#endif -void _system_events_init(void) -{ - /* Enable EVSYS register interface */ - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBC, PM_APBCMASK_EVSYS); - - /* Make sure the EVSYS module is properly reset */ - EVSYS->CTRL.reg = EVSYS_CTRL_SWRST; - - while (EVSYS->CTRL.reg & EVSYS_CTRL_SWRST) { - } -} -#if defined(__GNUC__) -# pragma GCC diagnostic pop -#endif - -void events_get_config_defaults(struct events_config *config) -{ - /* Check that config is something other than NULL */ - Assert(config); - - config->edge_detect = EVENTS_EDGE_DETECT_RISING; - config->path = EVENTS_PATH_SYNCHRONOUS; - config->generator = EVSYS_ID_GEN_NONE; - config->clock_source = GCLK_GENERATOR_0; -} - -enum status_code events_allocate( - struct events_resource *resource, - struct events_config *config) -{ - uint8_t new_channel; - - Assert(resource); - - new_channel = _events_find_first_free_channel_and_allocate(); - - if(new_channel == EVENTS_INVALID_CHANNEL) { - return STATUS_ERR_NOT_FOUND; - } - - resource->channel = new_channel; - - if (config->path != EVENTS_PATH_ASYNCHRONOUS) { - /* Set up a GLCK channel to use with the specific channel */ - struct system_gclk_chan_config gclk_chan_conf; - - system_gclk_chan_get_config_defaults(&gclk_chan_conf); - gclk_chan_conf.source_generator = - (enum gclk_generator)config->clock_source; - system_gclk_chan_set_config(EVSYS_GCLK_ID_0 + new_channel, &gclk_chan_conf); - system_gclk_chan_enable(EVSYS_GCLK_ID_0 + new_channel); - } - - /* Save channel setting and configure it after user multiplexer */ - resource->channel_reg = EVSYS_CHANNEL_CHANNEL(new_channel) | - EVSYS_CHANNEL_EVGEN(config->generator) | - EVSYS_CHANNEL_PATH(config->path) | - EVSYS_CHANNEL_EDGSEL(config->edge_detect); - - - return STATUS_OK; -} - - -enum status_code events_release(struct events_resource *resource) -{ - enum status_code err = STATUS_OK; - - Assert(resource); - - /* Check if channel is busy */ - if(events_is_busy(resource)) { - return STATUS_BUSY; - } - - if (!(_events_inst.allocated_channels & (1<<resource->channel))) { - err = STATUS_ERR_NOT_INITIALIZED; - } else { - _events_release_channel(resource->channel); - } - - return err; -} - -enum status_code events_trigger(struct events_resource *resource) -{ - - Assert(resource); - - system_interrupt_enter_critical_section(); - - /* Because of indirect access the channel must be set first */ - ((uint8_t*)&EVSYS->CHANNEL)[0] = EVSYS_CHANNEL_CHANNEL(resource->channel); - - /* Assert if event path is asynchronous */ - if (EVSYS->CHANNEL.reg & EVSYS_CHANNEL_PATH(EVENTS_PATH_ASYNCHRONOUS)) { - return STATUS_ERR_UNSUPPORTED_DEV; - } - - /* Assert if event edge detection is not set to RISING */ - if (!(EVSYS->CHANNEL.reg & EVSYS_CHANNEL_EDGSEL(EVENTS_EDGE_DETECT_RISING))) { - return STATUS_ERR_UNSUPPORTED_DEV; - } - - - /* The GCLKREQ bit has to be set while triggering the software event */ - EVSYS->CTRL.reg = EVSYS_CTRL_GCLKREQ; - - ((uint16_t*)&EVSYS->CHANNEL)[0] = EVSYS_CHANNEL_CHANNEL(resource->channel) | - EVSYS_CHANNEL_SWEVT; - - EVSYS->CTRL.reg &= ~EVSYS_CTRL_GCLKREQ; - - system_interrupt_leave_critical_section(); - - return STATUS_OK; -} - -bool events_is_busy(struct events_resource *resource) -{ - Assert(resource); - - return EVSYS->CHSTATUS.reg & (_events_find_bit_position(resource->channel, - _EVENTS_START_OFFSET_BUSY_BITS)); -} - -bool events_is_users_ready(struct events_resource *resource) -{ - Assert(resource); - - return EVSYS->CHSTATUS.reg & (_events_find_bit_position(resource->channel, - _EVENTS_START_OFFSET_USER_READY_BIT)); -} - -bool events_is_detected(struct events_resource *resource) -{ - Assert(resource); - - uint32_t flag = _events_find_bit_position(resource->channel, - _EVENTS_START_OFFSET_DETECTION_BIT); - - /* Clear flag when read */ - if (EVSYS->INTFLAG.reg & flag) { - EVSYS->INTFLAG.reg = flag; - return true; - } - - return false; -} - -bool events_is_overrun(struct events_resource *resource) -{ - Assert(resource); - - uint32_t flag = _events_find_bit_position(resource->channel, - _EVENTS_START_OFFSET_OVERRUN_BIT); - - /* Clear flag when read */ - if (EVSYS->INTFLAG.reg & flag) { - EVSYS->INTFLAG.reg = flag; - return true; - } - - return false; -} - -enum status_code events_attach_user(struct events_resource *resource, uint8_t user_id) -{ - Assert(resource); - - /* First configure user multiplexer: channel number is n + 1 */ - EVSYS->USER.reg = EVSYS_USER_CHANNEL(resource->channel + 1) | - EVSYS_USER_USER(user_id); - - /* Then configure the channel */ - EVSYS->CHANNEL.reg = resource->channel_reg; - - return STATUS_OK; -} - -enum status_code events_detach_user(struct events_resource *resource, uint8_t user_id) -{ - - Assert(resource); - - /* Write 0 to the channel bit field to select no input */ - EVSYS->USER.reg = EVSYS_USER_USER(user_id); - - return STATUS_OK; -} - -uint8_t events_get_free_channels() -{ - return _events_inst.free_channels; -} diff --git a/atmel-samd/asf/sam0/drivers/extint/extint.h b/atmel-samd/asf/sam0/drivers/extint/extint.h deleted file mode 100644 index a40fd512c..000000000 --- a/atmel-samd/asf/sam0/drivers/extint/extint.h +++ /dev/null @@ -1,707 +0,0 @@ -/** - * \file - * - * \brief SAM External Interrupt Driver - * - * Copyright (C) 2012-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef EXTINT_H_INCLUDED -#define EXTINT_H_INCLUDED - -/** - * \defgroup asfdoc_sam0_extint_group SAM External Interrupt (EXTINT) Driver - * - * This driver for Atmel® | SMART ARM®-based microcontrollers provides - * an interface for the configuration and management of external interrupts - * generated by the physical device pins, including edge detection. - * The following driver API modes are covered by this - * manual: - * - * - Polled APIs - * \if EXTINT_CALLBACK_MODE - * - Callback APIs - * \endif - * - * The following peripheral is used by this module: - * - EIC (External Interrupt Controller) - * - * The following devices can use this module: - * - Atmel | SMART SAM D20/D21 - * - Atmel | SMART SAM R21 - * - Atmel | SMART SAM D09/D10/D11 - * - Atmel | SMART SAM L21/L22 - * - Atmel | SMART SAM DA1 - * - Atmel | SMART SAM C20/C21 - * - * The outline of this documentation is as follows: - * - \ref asfdoc_sam0_extint_prerequisites - * - \ref asfdoc_sam0_extint_module_overview - * - \ref asfdoc_sam0_extint_special_considerations - * - \ref asfdoc_sam0_extint_extra_info - * - \ref asfdoc_sam0_extint_examples - * - \ref asfdoc_sam0_extint_api_overview - * - * - * \section asfdoc_sam0_extint_prerequisites Prerequisites - * - * There are no prerequisites for this module. - * - * - * \section asfdoc_sam0_extint_module_overview Module Overview - * - * The External Interrupt (EXTINT) module provides a method of asynchronously - * detecting rising edge, falling edge, or specific level detection on individual - * I/O pins of a device. This detection can then be used to trigger a software - * interrupt or event, or polled for later use if required. External interrupts - * can also optionally be used to automatically wake up the device from sleep - * mode, allowing the device to conserve power while still being able to react - * to an external stimulus in a timely manner. - * - * \subsection asfdoc_sam0_extint_logical_channels Logical Channels - * The External Interrupt module contains a number of logical channels, each of - * which is capable of being individually configured for a given pin routing, - * detection mode, and filtering/wake up characteristics. - * - * Each individual logical external interrupt channel may be routed to a single - * physical device I/O pin in order to detect a particular edge or level of the - * incoming signal. - * - * \subsection asfdoc_sam0_extint_module_overview_nmi_chanel NMI Channels - * - * One or more Non Maskable Interrupt (NMI) channels are provided within each - * physical External Interrupt Controller module, allowing a single physical pin - * of the device to fire a single NMI interrupt in response to a particular - * edge or level stimulus. An NMI cannot, as the name suggests, be disabled in - * firmware and will take precedence over any in-progress interrupt sources. - * - * NMIs can be used to implement critical device features such as forced - * software reset or other functionality where the action should be executed in - * preference to all other running code with a minimum amount of latency. - * - * \subsection asfdoc_sam0_extint_module_overview_filtering Input Filtering and Detection - * - * To reduce the possibility of noise or other transient signals causing - * unwanted device wake-ups, interrupts, and/or events via an external interrupt - * channel. A hardware signal filter can be enabled on individual channels. This - * filter provides a Majority-of-Three voter filter on the incoming signal, so - * that the input state is considered to be the majority vote of three - * subsequent samples of the pin input buffer. The possible sampled input and - * resulting filtered output when the filter is enabled is shown in - * \ref asfdoc_sam0_extint_filter_table "the table below". - * - * \anchor asfdoc_sam0_extint_filter_table - * <table> - * <caption>Sampled Input and Resulting Filtered Output</caption> - * <tr> - * <th>Input Sample 1</th> - * <th>Input Sample 2</th> - * <th>Input Sample 3</th> - * <th>Filtered Output</th> - * </tr> - * <tr> - * <td>0</td> <td>0</td> <td>0</td> <td>0</td> - * </tr> - * <tr> - * <td>0</td> <td>0</td> <td>1</td> <td>0</td> - * </tr> - * <tr> - * <td>0</td> <td>1</td> <td>0</td> <td>0</td> - * </tr> - * <tr> - * <td>0</td> <td>1</td> <td>1</td> <td>1</td> - * </tr> - * <tr> - * <td>1</td> <td>0</td> <td>0</td> <td>0</td> - * </tr> - * <tr> - * <td>1</td> <td>0</td> <td>1</td> <td>1</td> - * </tr> - * <tr> - * <td>1</td> <td>1</td> <td>0</td> <td>1</td> - * </tr> - * <tr> - * <td>1</td> <td>1</td> <td>1</td> <td>1</td> - * </tr> - * </table> - * - * \subsection asfdoc_sam0_extint_module_overview_events Events and Interrupts - * - * Channel detection states may be polled inside the application for synchronous - * detection, or events and interrupts may be used for asynchronous behavior. - * Each channel can be configured to give an asynchronous hardware event (which - * may in turn trigger actions in other hardware modules) or an asynchronous - * software interrupt. - * - * \note The connection of events between modules requires the use of the - * \ref asfdoc_sam0_events_group "SAM Event System Driver (EVENTS)" - * to route output event of one module to the input event of another. - * For more information on event routing, refer to the event driver - * documentation. - * - * \subsection asfdoc_sam0_extint_module_overview_physical Physical Connection - * - * \ref asfdoc_sam0_extint_int_connections "The diagram below" shows how this - * module is interconnected within the device. - * - * \anchor asfdoc_sam0_extint_int_connections - * \dot - * digraph overview { - * node [label="Port Pad" shape=square] pad; - * - * subgraph driver { - * node [label="Peripheral MUX" shape=trapezium] pinmux; - * node [label="EIC Module" shape=ellipse] eic; - * node [label="Other Peripheral Modules" shape=ellipse style=filled fillcolor=lightgray] peripherals; - * } - * - * pinmux -> eic; - * pad -> pinmux; - * pinmux -> peripherals; - * } - * \enddot - * - * \section asfdoc_sam0_extint_special_considerations Special Considerations - * - * Not all devices support disabling of the NMI channel(s) detection mode - see - * your device datasheet. - * - * - * \section asfdoc_sam0_extint_extra_info Extra Information - * - * For extra information, see \ref asfdoc_sam0_extint_extra. This includes: - * - \ref asfdoc_sam0_extint_extra_acronyms - * - \ref asfdoc_sam0_extint_extra_dependencies - * - \ref asfdoc_sam0_extint_extra_errata - * - \ref asfdoc_sam0_extint_extra_history - * - * - * \section asfdoc_sam0_extint_examples Examples - * - * For a list of examples related to this driver, see - * \ref asfdoc_sam0_extint_exqsg. - * - * - * \section asfdoc_sam0_extint_api_overview API Overview - * @{ - */ - -#include <compiler.h> -#include <pinmux.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief External interrupt edge detection configuration enum. - * - * Enum for the possible signal edge detection modes of the External - * Interrupt Controller module. - */ -enum extint_detect { - /** No edge detection. Not allowed as a NMI detection mode on some - * devices. */ - EXTINT_DETECT_NONE = 0, - /** Detect rising signal edges */ - EXTINT_DETECT_RISING = 1, - /** Detect falling signal edges */ - EXTINT_DETECT_FALLING = 2, - /** Detect both signal edges */ - EXTINT_DETECT_BOTH = 3, - /** Detect high signal levels */ - EXTINT_DETECT_HIGH = 4, - /** Detect low signal levels */ - EXTINT_DETECT_LOW = 5, -}; - -/** - * \brief External interrupt internal pull configuration enum. - * - * Enum for the possible pin internal pull configurations. - * - * \note Disabling the internal pull resistor is not recommended if the driver - * is used in interrupt (callback) mode, due the possibility of floating - * inputs generating continuous interrupts. - */ -enum extint_pull { - /** Internal pull-up resistor is enabled on the pin */ - EXTINT_PULL_UP = SYSTEM_PINMUX_PIN_PULL_UP, - /** Internal pull-down resistor is enabled on the pin */ - EXTINT_PULL_DOWN = SYSTEM_PINMUX_PIN_PULL_DOWN, - /** Internal pull resistor is disconnected from the pin */ - EXTINT_PULL_NONE = SYSTEM_PINMUX_PIN_PULL_NONE, -}; - -/** The EIC is clocked by GCLK_EIC. */ -#define EXTINT_CLK_GCLK 0 -/** The EIC is clocked by CLK_ULP32K. */ -#define EXTINT_CLK_ULP32K 1 - -/** - * \brief External Interrupt Controller channel configuration structure. - * - * Configuration structure for the edge detection mode of an external - * interrupt channel. - */ -struct extint_chan_conf { - /** GPIO pin the NMI should be connected to */ - uint32_t gpio_pin; - /** MUX position the GPIO pin should be configured to */ - uint32_t gpio_pin_mux; - /** Internal pull to enable on the input pin */ - enum extint_pull gpio_pin_pull; -#if (SAML21) || (SAML22) || (SAMC20) || (SAMC21) || (SAMR30) - /** Enable asynchronous edge detection. */ - bool enable_async_edge_detection; -#else - /** Wake up the device if the channel interrupt fires during sleep mode */ - bool wake_if_sleeping; -#endif - /** Filter the raw input signal to prevent noise from triggering an - * interrupt accidentally, using a three sample majority filter */ - bool filter_input_signal; - /** Edge detection mode to use */ - enum extint_detect detection_criteria; -}; - -/** - * \brief External Interrupt event enable/disable structure. - * - * Event flags for the \ref extint_enable_events() and - * \ref extint_disable_events(). - */ -struct extint_events { - /** If \c true, an event will be generated when an external interrupt - * channel detection state changes */ - bool generate_event_on_detect[32 * EIC_INST_NUM]; -}; - -/** - * \brief External Interrupt Controller NMI configuration structure. - * - * Configuration structure for the edge detection mode of an external - * interrupt NMI channel. - */ -struct extint_nmi_conf { - /** GPIO pin the NMI should be connected to */ - uint32_t gpio_pin; - /** MUX position the GPIO pin should be configured to */ - uint32_t gpio_pin_mux; - /** Internal pull to enable on the input pin */ - enum extint_pull gpio_pin_pull; - /** Filter the raw input signal to prevent noise from triggering an - * interrupt accidentally, using a three sample majority filter */ - bool filter_input_signal; - /** Edge detection mode to use. Not all devices support all possible - * detection modes for NMIs. - */ - enum extint_detect detection_criteria; -#if (SAML21) || (SAML22) || (SAMC20) || (SAMC21) || (SAMR30) - /** Enable asynchronous edge detection. */ - bool enable_async_edge_detection; -#endif -}; - -#if EXTINT_CALLBACK_MODE == true -/** Type definition for an EXTINT module callback function */ -typedef void (*extint_callback_t)(void); - -#ifndef EIC_NUMBER_OF_INTERRUPTS -# define EIC_NUMBER_OF_INTERRUPTS 16 -#endif -#endif - -#if !defined(__DOXYGEN__) -/** \internal - * Internal EXTINT module device instance structure definition. - */ -struct _extint_module -{ -# if EXTINT_CALLBACK_MODE == true - /** Asynchronous channel callback table, for user-registered handlers */ - extint_callback_t callbacks[EIC_NUMBER_OF_INTERRUPTS]; -# else - /** Dummy value to ensure the struct has at least one member */ - uint8_t _dummy; -# endif -}; - -/** - * \brief Retrieves the base EIC module address from a given channel number. - * - * Retrieves the base address of a EIC hardware module associated with the - * given external interrupt channel. - * - * \param[in] channel External interrupt channel index to convert - * - * \return Base address of the associated EIC module. - */ -static inline Eic * _extint_get_eic_from_channel( - const uint8_t channel) -{ - uint8_t eic_index = (channel / 32); - - if (eic_index < EIC_INST_NUM) { - /* Array of available EICs */ - Eic *const eics[EIC_INST_NUM] = EIC_INSTS; - - return eics[eic_index]; - } else { - Assert(false); - return NULL; - } -} - -/** - * \brief Retrieves the base EIC module address from a given NMI channel number. - * - * Retrieves the base address of a EIC hardware module associated with the - * given non-maskable external interrupt channel. - * - * \param[in] nmi_channel Non-Maskable interrupt channel index to convert - * - * \return Base address of the associated EIC module. - */ -static inline Eic * _extint_get_eic_from_nmi( - const uint8_t nmi_channel) -{ - uint8_t eic_index = nmi_channel; - - if (eic_index < EIC_INST_NUM) { - /* Array of available EICs */ - Eic *const eics[EIC_INST_NUM] = EIC_INSTS; - - return eics[eic_index]; - } else { - Assert(false); - return NULL; - } -} -#endif - -/** \name Event Management - * @{ - */ - -void extint_enable_events( - struct extint_events *const events); - -void extint_disable_events( - struct extint_events *const events); - -/** @} */ - -/** \name Configuration and Initialization (Channel) - * @{ - */ - -void extint_chan_get_config_defaults( - struct extint_chan_conf *const config); - -void extint_chan_set_config( - const uint8_t channel, - const struct extint_chan_conf *const config); - -/** @} */ - -/** \name Configuration and Initialization (NMI) - * @{ - */ - -/** - * \brief Initializes an External Interrupt NMI channel configuration structure to defaults. - * - * Initializes a given External Interrupt NMI channel configuration structure - * to a set of known default values. This function should be called on all new - * instances of these configuration structures before being modified by the - * user application. - * - * The default configuration is as follows: - * \li Input filtering disabled - * \li Detect falling edges of a signal - * \li Asynchronous edge detection is disabled - * - * \param[out] config Configuration structure to initialize to default values - */ -static inline void extint_nmi_get_config_defaults( - struct extint_nmi_conf *const config) -{ - /* Sanity check arguments */ - Assert(config); - - /* Default configuration values */ - config->gpio_pin = 0; - config->gpio_pin_mux = 0; - config->gpio_pin_pull = EXTINT_PULL_UP; - config->filter_input_signal = false; - config->detection_criteria = EXTINT_DETECT_FALLING; -#if (SAML21) || (SAML22) || (SAMC20) || (SAMC21) || (SAMR30) - config->enable_async_edge_detection = false; -#endif - -} - -enum status_code extint_nmi_set_config( - const uint8_t nmi_channel, - const struct extint_nmi_conf *const config); - -/** @} */ - -/** \name Detection testing and clearing (channel) - * @{ - */ - -/** - * \brief Retrieves the edge detection state of a configured channel. - * - * Reads the current state of a configured channel, and determines - * if the detection criteria of the channel has been met. - * - * \param[in] channel External Interrupt channel index to check - * - * \return Status of the requested channel's edge detection state. - * \retval true If the channel's edge/level detection criteria was met - * \retval false If the channel has not detected its configured criteria - */ -static inline bool extint_chan_is_detected( - const uint8_t channel) -{ - Eic *const eic_module = _extint_get_eic_from_channel(channel); - uint32_t eic_mask = (1UL << (channel % 32)); - - return (eic_module->INTFLAG.reg & eic_mask); -} - -/** - * \brief Clears the edge detection state of a configured channel. - * - * Clears the current state of a configured channel, readying it for - * the next level or edge detection. - * - * \param[in] channel External Interrupt channel index to check - */ -static inline void extint_chan_clear_detected( - const uint8_t channel) -{ - Eic *const eic_module = _extint_get_eic_from_channel(channel); - uint32_t eic_mask = (1UL << (channel % 32)); - - eic_module->INTFLAG.reg = eic_mask; -} - -/** @} */ - -/** \name Detection Testing and Clearing (NMI) - * @{ - */ - -/** - * \brief Retrieves the edge detection state of a configured NMI channel. - * - * Reads the current state of a configured NMI channel, and determines - * if the detection criteria of the NMI channel has been met. - * - * \param[in] nmi_channel External Interrupt NMI channel index to check - * - * \return Status of the requested NMI channel's edge detection state. - * \retval true If the NMI channel's edge/level detection criteria was met - * \retval false If the NMI channel has not detected its configured criteria - */ -static inline bool extint_nmi_is_detected( - const uint8_t nmi_channel) -{ - Eic *const eic_module = _extint_get_eic_from_nmi(nmi_channel); - - return (eic_module->NMIFLAG.reg & EIC_NMIFLAG_NMI); -} - -/** - * \brief Clears the edge detection state of a configured NMI channel. - * - * Clears the current state of a configured NMI channel, readying it for - * the next level or edge detection. - * - * \param[in] nmi_channel External Interrupt NMI channel index to check - */ -static inline void extint_nmi_clear_detected( - const uint8_t nmi_channel) -{ - Eic *const eic_module = _extint_get_eic_from_nmi(nmi_channel); - - eic_module->NMIFLAG.reg = EIC_NMIFLAG_NMI; -} - -/** @} */ - -#ifdef __cplusplus -} -#endif - -/** @} */ - -#if EXTINT_CALLBACK_MODE == true -# include "extint_callback.h" -#endif - -/** - * \page asfdoc_sam0_extint_extra Extra Information for EXTINT Driver - * - * \section asfdoc_sam0_extint_extra_acronyms Acronyms - * The table below presents the acronyms used in this module: - * - * <table> - * <tr> - * <th>Acronym</th> - * <th>Description</th> - * </tr> - * <tr> - * <td>EIC</td> - * <td>External Interrupt Controller</td> - * </tr> - * <tr> - * <td>MUX</td> - * <td>Multiplexer</td> - * </tr> - * <tr> - * <td>NMI</td> - * <td>Non-Maskable Interrupt</td> - * </tr> - * </table> - * - * - * \section asfdoc_sam0_extint_extra_dependencies Dependencies - * This driver has the following dependencies: - * - * - \ref asfdoc_sam0_system_pinmux_group "System Pin Multiplexer Driver" - * - * - * \section asfdoc_sam0_extint_extra_errata Errata - * There are no errata related to this driver. - * - * - * \section asfdoc_sam0_extint_extra_history Module History - * An overview of the module history is presented in the table below, with - * details on the enhancements and fixes made to the module since its first - * release. The current version of this corresponds to the newest version in - * the table. - * - * <table> - * <tr> - * <th>Changelog</th> - * </tr> - * <tr> - * <td> - * \li Driver updated to follow driver type convention - * \li Removed \c %extint_reset(), \c %extint_disable() and - * \c extint_enable() functions. Added internal function - * \c %_system_extint_init(). - * \li Added configuration EXTINT_CLOCK_SOURCE in conf_extint.h - * \li Removed configuration EXTINT_CALLBACKS_MAX in conf_extint.h, and - * added channel parameter in the register functions - * \c %extint_register_callback() and \c %extint_unregister_callback() - * </td> - * </tr> - * <tr> - * <td>Updated interrupt handler to clear interrupt flag before calling - * callback function</td> - * </tr> - * <tr> - * <td>Updated initialization function to also enable the digital interface - * clock to the module if it is disabled</td> - * </tr> - * <tr> - * <td>Initial Release</td> - * </tr> - * </table> - */ - -/** - * \page asfdoc_sam0_extint_exqsg Examples for EXTINT Driver - * - * This is a list of the available Quick Start guides (QSGs) and example - * applications for \ref asfdoc_sam0_extint_group. - * QSGs are simple examples with step-by-step instructions to configure and - * use this driver in a selection of use cases. Note that a QSG can be compiled - * as a standalone application or be added to the user application. - * - * - \subpage asfdoc_sam0_extint_basic_use_case - * \if EXTINT_CALLBACK_MODE - * - \subpage asfdoc_sam0_extint_callback_use_case - * \endif - * - * \page asfdoc_sam0_extint_document_revision_history Document Revision History - * - * <table> - * <tr> - * <th>Doc. Rev.</th> - * <th>Date</th> - * <th>Comments</th> - * </tr> - * <tr> - * <td>42112E</td> - * <td>12/2015</td> - * <td>Added support for SAM L21/L22, SAM C21, SAM D09, and SAM DA1</td> - * </tr> - * <tr> - * <td>42112D</td> - * <td>12/2014</td> - * <td>Added support for SAM R21 and SAM D10/D11</td> - * </tr> - * <tr> - * <td>42112C</td> - * <td>01/2014</td> - * <td>Added support for SAM D21</td> - * </tr> - * <tr> - * <td>42112B</td> - * <td>06/2013</td> - * <td>Added additional documentation on the event system. Corrected - * documentation typos.</td> - * </tr> - * <tr> - * <td>42112A</td> - * <td>06/2013</td> - * <td>Initial release</td> - * </tr> - * </table> - */ - -#endif diff --git a/atmel-samd/asf/sam0/drivers/extint/extint_callback.c b/atmel-samd/asf/sam0/drivers/extint/extint_callback.c deleted file mode 100644 index 52424d786..000000000 --- a/atmel-samd/asf/sam0/drivers/extint/extint_callback.c +++ /dev/null @@ -1,232 +0,0 @@ -/** - * \file - * - * \brief SAM External Interrupt Driver - * - * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#include "extint.h" -#include "extint_callback.h" - -/** - * \internal - * Internal driver device instance struct, declared in the main module driver. - */ -extern struct _extint_module _extint_dev; - -/** - * \internal - * This is the number of the channel whose callback is currently running. - */ -uint8_t _current_channel; - -/** - * \brief Registers an asynchronous callback function with the driver. - * - * Registers an asynchronous callback with the EXTINT driver, fired when a - * channel detects the configured channel detection criteria - * (e.g. edge or level). Callbacks are fired once for each detected channel. - * - * \note NMI channel callbacks cannot be registered via this function; the - * device's NMI interrupt should be hooked directly in the user - * application and the NMI flags manually cleared via - * \ref extint_nmi_clear_detected(). - * - * \param[in] callback Pointer to the callback function to register - * \param[in] channel Logical channel to register callback for - * \param[in] type Type of callback function to register - * - * \return Status of the registration operation. - * \retval STATUS_OK The callback was registered successfully - * \retval STATUS_ERR_INVALID_ARG If an invalid callback type was supplied - * \retval STATUS_ERR_ALREADY_INITIALIZED Callback function has been - * registered, need unregister first - */ -enum status_code extint_register_callback( - const extint_callback_t callback, - const uint8_t channel, - const enum extint_callback_type type) -{ - /* Sanity check arguments */ - Assert(callback); - - if (type != EXTINT_CALLBACK_TYPE_DETECT) { - Assert(false); - return STATUS_ERR_INVALID_ARG; - } - - if (_extint_dev.callbacks[channel] == NULL) { - _extint_dev.callbacks[channel] = callback; - return STATUS_OK; - } else if (_extint_dev.callbacks[channel] == callback) { - return STATUS_OK; - } - - return STATUS_ERR_ALREADY_INITIALIZED; -} - -/** - * \brief Unregisters an asynchronous callback function with the driver. - * - * Unregisters an asynchronous callback with the EXTINT driver, removing it - * from the internal callback registration table. - * - * \param[in] callback Pointer to the callback function to unregister - * \param[in] channel Logical channel to unregister callback for - * \param[in] type Type of callback function to unregister - * - * \return Status of the de-registration operation. - * \retval STATUS_OK The callback was unregistered successfully - * \retval STATUS_ERR_INVALID_ARG If an invalid callback type was supplied - * \retval STATUS_ERR_BAD_ADDRESS No matching entry was found in the - * registration table - */ -enum status_code extint_unregister_callback( - const extint_callback_t callback, - const uint8_t channel, - const enum extint_callback_type type) -{ - /* Sanity check arguments */ - Assert(callback); - - if (type != EXTINT_CALLBACK_TYPE_DETECT) { - Assert(false); - return STATUS_ERR_INVALID_ARG; - } - - if (_extint_dev.callbacks[channel] == callback) { - _extint_dev.callbacks[channel] = NULL; - return STATUS_OK; - } - - return STATUS_ERR_BAD_ADDRESS; -} - -/** - * \brief Enables asynchronous callback generation for a given channel and type. - * - * Enables asynchronous callbacks for a given logical external interrupt channel - * and type. This must be called before an external interrupt channel will - * generate callback events. - * - * \param[in] channel Logical channel to enable callback generation for - * \param[in] type Type of callback function callbacks to enable - * - * \return Status of the callback enable operation. - * \retval STATUS_OK The callback was enabled successfully - * \retval STATUS_ERR_INVALID_ARG If an invalid callback type was supplied - */ -enum status_code extint_chan_enable_callback( - const uint8_t channel, - const enum extint_callback_type type) -{ - if (type == EXTINT_CALLBACK_TYPE_DETECT) { - Eic *const eic = _extint_get_eic_from_channel(channel); - - eic->INTENSET.reg = (1UL << channel); - } - else { - Assert(false); - return STATUS_ERR_INVALID_ARG; - } - - return STATUS_OK; -} - -/** - * \brief Disables asynchronous callback generation for a given channel and type. - * - * Disables asynchronous callbacks for a given logical external interrupt - * channel and type. - * - * \param[in] channel Logical channel to disable callback generation for - * \param[in] type Type of callback function callbacks to disable - * - * \return Status of the callback disable operation. - * \retval STATUS_OK The callback was disabled successfully - * \retval STATUS_ERR_INVALID_ARG If an invalid callback type was supplied - */ -enum status_code extint_chan_disable_callback( - const uint8_t channel, - const enum extint_callback_type type) -{ - if (type == EXTINT_CALLBACK_TYPE_DETECT) { - Eic *const eic = _extint_get_eic_from_channel(channel); - - eic->INTENCLR.reg = (1UL << channel); - } - else { - Assert(false); - return STATUS_ERR_INVALID_ARG; - } - - return STATUS_OK; -} - -/** - * \brief Find what channel caused the callback. - * - * Can be used in an EXTINT callback function to find what channel caused - * the callback in case the same callback is used by multiple channels. - * - * \return Channel number. - */ -uint8_t extint_get_current_channel(void) -{ - return _current_channel; -} - -/** Handler for the EXTINT hardware module interrupt. */ -void EIC_Handler(void) -{ - /* Find any triggered channels, run associated callback handlers */ - for (_current_channel = 0; _current_channel < EIC_NUMBER_OF_INTERRUPTS ; _current_channel++) { - if (extint_chan_is_detected(_current_channel)) { - /* Clear flag */ - extint_chan_clear_detected(_current_channel); - /* Find any associated callback entries in the callback table */ - if (_extint_dev.callbacks[_current_channel] != NULL) { - /* Run the registered callback */ - _extint_dev.callbacks[_current_channel](); - } - } - } -} diff --git a/atmel-samd/asf/sam0/drivers/extint/extint_callback.h b/atmel-samd/asf/sam0/drivers/extint/extint_callback.h deleted file mode 100644 index 35cf23018..000000000 --- a/atmel-samd/asf/sam0/drivers/extint/extint_callback.h +++ /dev/null @@ -1,108 +0,0 @@ -/** - * \file - * - * \brief SAM External Interrupt Driver - * - * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef EXTINT_CALLBACK_H_INCLUDED -#define EXTINT_CALLBACK_H_INCLUDED - -#include <compiler.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \addtogroup asfdoc_sam0_extint_group - * - * @{ - */ - -/** \name Callback Configuration and Initialization - * @{ - */ - -/** Enum for the possible callback types for the EXTINT module. */ -enum extint_callback_type -{ - /** Callback type for when an external interrupt detects the configured - * channel criteria (i.e. edge or level detection) - */ - EXTINT_CALLBACK_TYPE_DETECT, -}; - -enum status_code extint_register_callback( - const extint_callback_t callback, - const uint8_t channel, - const enum extint_callback_type type); - -enum status_code extint_unregister_callback( - const extint_callback_t callback, - const uint8_t channel, - const enum extint_callback_type type); - -uint8_t extint_get_current_channel(void); - -/** @} */ - -/** \name Callback Enabling and Disabling (Channel) - * @{ - */ - -enum status_code extint_chan_enable_callback( - const uint8_t channel, - const enum extint_callback_type type); - -enum status_code extint_chan_disable_callback( - const uint8_t channel, - const enum extint_callback_type type); - -/** @} */ - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/atmel-samd/asf/sam0/drivers/extint/extint_sam_d_r/extint.c b/atmel-samd/asf/sam0/drivers/extint/extint_sam_d_r/extint.c deleted file mode 100644 index a9697d0e6..000000000 --- a/atmel-samd/asf/sam0/drivers/extint/extint_sam_d_r/extint.c +++ /dev/null @@ -1,425 +0,0 @@ -/** - * \file - * - * \brief SAM External Interrupt Driver - * - * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#include <system.h> -#include <system_interrupt.h> -#include <extint.h> -#include <conf_extint.h> - -#if !defined(EXTINT_CLOCK_SOURCE) || defined(__DOXYGEN__) -# warning EXTINT_CLOCK_SOURCE is not defined, assuming GCLK_GENERATOR_0. - -/** Configuration option, setting the EIC clock source which can be used for - * EIC edge detection or filtering. This option may be overridden in the module - * configuration header file \c conf_extint.h. - */ -# define EXTINT_CLOCK_SOURCE GCLK_GENERATOR_0 -#endif - -/** - * \internal - * Internal driver device instance struct. - */ -struct _extint_module _extint_dev; - -/** - * \brief Determin if the general clock is required - * - * \param[in] filter_input_signal Filter the raw input signal to prevent noise - * \param[in] detection_criteria Edge detection mode to use (\ref extint_detect) - */ -#define _extint_is_gclk_required(filter_input_signal, detection_criteria) \ - ((filter_input_signal) ? true : (\ - (EXTINT_DETECT_RISING == (detection_criteria)) ? true : (\ - (EXTINT_DETECT_FALLING == (detection_criteria)) ? true : (\ - (EXTINT_DETECT_BOTH == (detection_criteria)) ? true : false)))) - -static void _extint_enable(void); -static void _extint_disable(void); - -/** - * \brief Determines if the hardware module(s) are currently synchronizing to the bus. - * - * Checks to see if the underlying hardware peripheral module(s) are currently - * synchronizing across multiple clock domains to the hardware bus, This - * function can be used to delay further operations on a module until such time - * that it is ready, to prevent blocking delays for synchronization in the - * user application. - * - * \return Synchronization status of the underlying hardware module(s). - * - * \retval true If the module synchronization is ongoing - * \retval false If the module has completed synchronization - */ -static inline bool extint_is_syncing(void) -{ - Eic *const eics[EIC_INST_NUM] = EIC_INSTS; - - for (uint32_t i = 0; i < EIC_INST_NUM; i++) { - if (eics[i]->STATUS.reg & EIC_STATUS_SYNCBUSY) { - return true; - } - } - return false; -} -/** - * \internal - * \brief Initializes and enables the External Interrupt driver. - * - * Enable the clocks used by External Interrupt driver. - * - * Resets the External Interrupt driver, resetting all hardware - * module registers to their power-on defaults, then enable it for further use. - * - * Reset the callback list if callback mode is used. - * - * This function must be called before attempting to use any NMI or standard - * external interrupt channel functions. - * - * \note When SYSTEM module is used, this function will be invoked by - * \ref system_init() automatically if the module is included. - */ -void _system_extint_init(void); -void _system_extint_init(void) -{ - Eic *const eics[EIC_INST_NUM] = EIC_INSTS; - - /* Turn on the digital interface clock */ - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBA, PM_APBAMASK_EIC); - - /* Configure the generic clock for the module and enable it */ - struct system_gclk_chan_config gclk_chan_conf; - system_gclk_chan_get_config_defaults(&gclk_chan_conf); - gclk_chan_conf.source_generator = EXTINT_CLOCK_SOURCE; - system_gclk_chan_set_config(EIC_GCLK_ID, &gclk_chan_conf); - - /* Enable the clock anyway, since when needed it will be requested - * by External Interrupt driver */ - system_gclk_chan_enable(EIC_GCLK_ID); - - /* Reset all EIC hardware modules. */ - for (uint32_t i = 0; i < EIC_INST_NUM; i++) { - eics[i]->CTRL.reg |= EIC_CTRL_SWRST; - } - - while (extint_is_syncing()) { - /* Wait for all hardware modules to complete synchronization */ - } - - /* Reset the software module */ -#if EXTINT_CALLBACK_MODE == true - /* Clear callback registration table */ - for (uint8_t j = 0; j < EIC_NUMBER_OF_INTERRUPTS; j++) { - _extint_dev.callbacks[j] = NULL; - } - system_interrupt_enable(SYSTEM_INTERRUPT_MODULE_EIC); -#endif - - /* Enables the driver for further use */ - _extint_enable(); -} - -/** - * \internal - * \brief Enables the External Interrupt driver. - * - * Enables EIC modules. - * Registered callback list will not be affected if callback mode is used. - */ -void _extint_enable(void) -{ - Eic *const eics[EIC_INST_NUM] = EIC_INSTS; - - /* Enable all EIC hardware modules. */ - for (uint32_t i = 0; i < EIC_INST_NUM; i++) { - eics[i]->CTRL.reg |= EIC_CTRL_ENABLE; - } - - while (extint_is_syncing()) { - /* Wait for all hardware modules to complete synchronization */ - } -} - -/** - * \internal - * \brief Disables the External Interrupt driver. - * - * Disables EIC modules that were previously started via a call to - * \ref _extint_enable(). - * Registered callback list will not be affected if callback mode is used. - */ -void _extint_disable(void) -{ - Eic *const eics[EIC_INST_NUM] = EIC_INSTS; - - /* Disable all EIC hardware modules. */ - for (uint32_t i = 0; i < EIC_INST_NUM; i++) { - eics[i]->CTRL.reg &= ~EIC_CTRL_ENABLE; - } - - while (extint_is_syncing()) { - /* Wait for all hardware modules to complete synchronization */ - } -} - -/** - * \brief Initializes an External Interrupt channel configuration structure to defaults. - * - * Initializes a given External Interrupt channel configuration structure to a - * set of known default values. This function should be called on all new - * instances of these configuration structures before being modified by the - * user application. - * - * The default configuration is as follows: - * \li Wake the device if an edge detection occurs whilst in sleep - * \li Input filtering disabled - * \li Internal pull-up enabled - * \li Detect falling edges of a signal - * - * \param[out] config Configuration structure to initialize to default values - */ -void extint_chan_get_config_defaults( - struct extint_chan_conf *const config) -{ - /* Sanity check arguments */ - Assert(config); - - /* Default configuration values */ - config->gpio_pin = 0; - config->gpio_pin_mux = 0; - config->gpio_pin_pull = EXTINT_PULL_UP; - config->wake_if_sleeping = true; - config->filter_input_signal = false; - config->detection_criteria = EXTINT_DETECT_FALLING; -} - -/** - * \brief Writes an External Interrupt channel configuration to the hardware module. - * - * Writes out a given configuration of an External Interrupt channel - * configuration to the hardware module. If the channel is already configured, - * the new configuration will replace the existing one. - * - * \param[in] channel External Interrupt channel to configure - * \param[in] config Configuration settings for the channel - - */ -void extint_chan_set_config( - const uint8_t channel, - const struct extint_chan_conf *const config) -{ - /* Sanity check arguments */ - Assert(config); - /* Sanity check clock requirements */ - Assert(!(!system_gclk_gen_is_enabled(EXTINT_CLOCK_SOURCE) && - _extint_is_gclk_required(config->filter_input_signal, - config->detection_criteria))); - - struct system_pinmux_config pinmux_config; - system_pinmux_get_config_defaults(&pinmux_config); - - pinmux_config.mux_position = config->gpio_pin_mux; - pinmux_config.direction = SYSTEM_PINMUX_PIN_DIR_INPUT; - pinmux_config.input_pull = (enum system_pinmux_pin_pull)config->gpio_pin_pull; - system_pinmux_pin_set_config(config->gpio_pin, &pinmux_config); - - /* Get a pointer to the module hardware instance */ - Eic *const EIC_module = _extint_get_eic_from_channel(channel); - - uint32_t config_pos = (4 * (channel % 8)); - uint32_t new_config; - - /* Determine the channel's new edge detection configuration */ - new_config = (config->detection_criteria << EIC_CONFIG_SENSE0_Pos); - - /* Enable the hardware signal filter if requested in the config */ - if (config->filter_input_signal) { - new_config |= EIC_CONFIG_FILTEN0; - } - - /* Clear the existing and set the new channel configuration */ - EIC_module->CONFIG[channel / 8].reg - = (EIC_module->CONFIG[channel / 8].reg & - ~((EIC_CONFIG_SENSE0_Msk | EIC_CONFIG_FILTEN0) << config_pos)) | - (new_config << config_pos); - - /* Set the channel's new wake up mode setting */ - if (config->wake_if_sleeping) { - EIC_module->WAKEUP.reg |= (1UL << channel); - } else { - EIC_module->WAKEUP.reg &= ~(1UL << channel); - } -} - -/** - * \brief Writes an External Interrupt NMI channel configuration to the hardware module. - * - * Writes out a given configuration of an External Interrupt NMI channel - * configuration to the hardware module. If the channel is already configured, - * the new configuration will replace the existing one. - * - * \param[in] nmi_channel External Interrupt NMI channel to configure - * \param[in] config Configuration settings for the channel - * - * \returns Status code indicating the success or failure of the request. - * \retval STATUS_OK Configuration succeeded - * \retval STATUS_ERR_PIN_MUX_INVALID An invalid pinmux value was supplied - * \retval STATUS_ERR_BAD_FORMAT An invalid detection mode was requested - */ -enum status_code extint_nmi_set_config( - const uint8_t nmi_channel, - const struct extint_nmi_conf *const config) -{ - /* Sanity check arguments */ - Assert(config); - /* Sanity check clock requirements */ - Assert(!(!system_gclk_gen_is_enabled(EXTINT_CLOCK_SOURCE) && - _extint_is_gclk_required(config->filter_input_signal, - config->detection_criteria))); - - struct system_pinmux_config pinmux_config; - system_pinmux_get_config_defaults(&pinmux_config); - - pinmux_config.mux_position = config->gpio_pin_mux; - pinmux_config.direction = SYSTEM_PINMUX_PIN_DIR_INPUT; - pinmux_config.input_pull = SYSTEM_PINMUX_PIN_PULL_UP; - pinmux_config.input_pull = (enum system_pinmux_pin_pull)config->gpio_pin_pull; - system_pinmux_pin_set_config(config->gpio_pin, &pinmux_config); - - /* Get a pointer to the module hardware instance */ - Eic *const EIC_module = _extint_get_eic_from_channel(nmi_channel); - - uint32_t new_config; - - /* Determine the NMI's new edge detection configuration */ - new_config = (config->detection_criteria << EIC_NMICTRL_NMISENSE_Pos); - - /* Enable the hardware signal filter if requested in the config */ - if (config->filter_input_signal) { - new_config |= EIC_NMICTRL_NMIFILTEN; - } - - /* Disable EIC and general clock to configure NMI */ - _extint_disable(); - system_gclk_chan_disable(EIC_GCLK_ID); - - EIC_module->NMICTRL.reg = new_config; - - /* Enable the general clock and EIC after configure NMI */ - system_gclk_chan_enable(EIC_GCLK_ID); - _extint_enable(); - - return STATUS_OK; -} - -/** - * \brief Enables an External Interrupt event output. - * - * Enables one or more output events from the External Interrupt module. See - * \ref extint_events "here" for a list of events this module supports. - * - * \note Events cannot be altered while the module is enabled. - * - * \param[in] events Struct containing flags of events to enable - */ -void extint_enable_events( - struct extint_events *const events) -{ - /* Sanity check arguments */ - Assert(events); - - /* Array of available EICs. */ - Eic *const eics[EIC_INST_NUM] = EIC_INSTS; - - /* Update the event control register for each physical EIC instance */ - for (uint32_t i = 0; i < EIC_INST_NUM; i++) { - uint32_t event_mask = 0; - - /* Create an enable mask for the current EIC module */ - for (uint32_t j = 0; j < 32; j++) { - if (events->generate_event_on_detect[(32 * i) + j]) { - event_mask |= (1UL << j); - } - } - - /* Enable the masked events */ - eics[i]->EVCTRL.reg |= event_mask; - } -} - -/** - * \brief Disables an External Interrupt event output. - * - * Disables one or more output events from the External Interrupt module. See - * \ref extint_events "here" for a list of events this module supports. - * - * \note Events cannot be altered while the module is enabled. - * - * \param[in] events Struct containing flags of events to disable - */ -void extint_disable_events( - struct extint_events *const events) -{ - /* Sanity check arguments */ - Assert(events); - - /* Array of available EICs. */ - Eic *const eics[EIC_INST_NUM] = EIC_INSTS; - - /* Update the event control register for each physical EIC instance */ - for (uint32_t i = 0; i < EIC_INST_NUM; i++) { - uint32_t event_mask = 0; - - /* Create a disable mask for the current EIC module */ - for (uint32_t j = 0; j < 32; j++) { - if (events->generate_event_on_detect[(32 * i) + j]) { - event_mask |= (1UL << j); - } - } - - /* Disable the masked events */ - eics[i]->EVCTRL.reg &= ~event_mask; - } -} diff --git a/atmel-samd/asf/sam0/drivers/extint/extint_sam_l_c/extint.c b/atmel-samd/asf/sam0/drivers/extint/extint_sam_l_c/extint.c deleted file mode 100644 index 1f5236222..000000000 --- a/atmel-samd/asf/sam0/drivers/extint/extint_sam_l_c/extint.c +++ /dev/null @@ -1,491 +0,0 @@ -/** - * \file - * - * \brief SAM External Interrupt Driver - * - * Copyright (C) 2014-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#include <system.h> -#include <system_interrupt.h> -#include <extint.h> -#include <conf_extint.h> - -#if !defined(EXTINT_CLOCK_SELECTION) || defined(__DOXYGEN__) -# warning EXTINT_CLOCK_SELECTION is not defined, assuming EXTINT_CLK_GCLK. - -/** Configuration option, setting the EIC clock source which can be used for - * EIC edge detection or filtering. This option may be overridden in the module - * configuration header file \c conf_extint.h. - */ -# define EXTINT_CLOCK_SELECTION EXTINT_CLK_GCLK -#endif - -#if (EXTINT_CLOCK_SELECTION == EXTINT_CLK_GCLK) -#if !defined(EXTINT_CLOCK_SOURCE) || defined(__DOXYGEN__) -# warning EXTINT_CLOCK_SOURCE is not defined, assuming GCLK_GENERATOR_0. - -/** Configuration option, setting the EIC clock source which can be used for - * EIC edge detection or filtering. This option may be overridden in the module - * configuration header file \c conf_extint.h. - */ -# define EXTINT_CLOCK_SOURCE GCLK_GENERATOR_0 -#endif -#endif - -/** - * \internal - * Internal driver device instance struct. - */ -struct _extint_module _extint_dev; - -/** - * \brief Determin if the general clock is required. - * - * \param[in] filter_input_signal Filter the raw input signal to prevent noise - * \param[in] detection_criteria Edge detection mode to use (\ref extint_detect) - */ -#define _extint_is_gclk_required(filter_input_signal, detection_criteria) \ - ((filter_input_signal) ? true : (\ - (EXTINT_DETECT_RISING == (detection_criteria)) ? true : (\ - (EXTINT_DETECT_FALLING == (detection_criteria)) ? true : (\ - (EXTINT_DETECT_BOTH == (detection_criteria)) ? true : false)))) - -static void _extint_enable(void); -static void _extint_disable(void); - -/** - * \brief Determines if the hardware module(s) are currently synchronizing to the bus. - * - * Checks to see if the underlying hardware peripheral module(s) are currently - * synchronizing across multiple clock domains to the hardware bus, This - * function can be used to delay further operations on a module until such time - * that it is ready, to prevent blocking delays for synchronization in the - * user application. - * - * \return Synchronization status of the underlying hardware module(s). - * - * \retval true If the module synchronization is ongoing - * \retval false If the module has completed synchronization - */ -static inline bool extint_is_syncing(void) -{ - Eic *const eics[EIC_INST_NUM] = EIC_INSTS; - - for (uint32_t i = 0; i < EIC_INST_NUM; i++) { - if((eics[i]->SYNCBUSY.reg & EIC_SYNCBUSY_ENABLE) - || (eics[i]->SYNCBUSY.reg & EIC_SYNCBUSY_SWRST)){ - return true; - } - } - return false; -} - -/** - * \internal - * \brief Initializes and enables the External Interrupt driver. - * - * Enable the clocks used by External Interrupt driver. - * - * Resets the External Interrupt driver, resetting all hardware - * module registers to their power-on defaults, then enable it for further use. - * - * Reset the callback list if callback mode is used. - * - * This function must be called before attempting to use any NMI or standard - * external interrupt channel functions. - * - * \note When SYSTEM module is used, this function will be invoked by - * \ref system_init() automatically if the module is included. - */ -void _system_extint_init(void); -void _system_extint_init(void) -{ - Eic *const eics[EIC_INST_NUM] = EIC_INSTS; - - /* Turn on the digital interface clock */ - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBA, MCLK_APBAMASK_EIC); - -#if (EXTINT_CLOCK_SELECTION == EXTINT_CLK_GCLK) - /* Configure the generic clock for the module and enable it */ - struct system_gclk_chan_config gclk_chan_conf; - system_gclk_chan_get_config_defaults(&gclk_chan_conf); - gclk_chan_conf.source_generator = EXTINT_CLOCK_SOURCE; - system_gclk_chan_set_config(EIC_GCLK_ID, &gclk_chan_conf); - - /* Enable the clock anyway, since when needed it will be requested - * by External Interrupt driver */ - system_gclk_chan_enable(EIC_GCLK_ID); -#endif - - /* Reset all EIC hardware modules. */ - for (uint32_t i = 0; i < EIC_INST_NUM; i++) { - eics[i]->CTRLA.reg |= EIC_CTRLA_SWRST; - } - - while (extint_is_syncing()) { - /* Wait for all hardware modules to complete synchronization */ - } - -#if (EXTINT_CLOCK_SELECTION == EXTINT_CLK_GCLK) - for (uint32_t i = 0; i < EIC_INST_NUM; i++) { - eics[i]->CTRLA.bit.CKSEL = EXTINT_CLK_GCLK; - } -#else - for (uint32_t i = 0; i < EIC_INST_NUM; i++) { - eics[i]->CTRLA.bit.CKSEL = EXTINT_CLK_ULP32K; - } -#endif - - /* Reset the software module */ -#if EXTINT_CALLBACK_MODE == true - /* Clear callback registration table */ - for (uint8_t j = 0; j < EIC_NUMBER_OF_INTERRUPTS; j++) { - _extint_dev.callbacks[j] = NULL; - } - system_interrupt_enable(SYSTEM_INTERRUPT_MODULE_EIC); -#endif - - /* Enables the driver for further use */ - _extint_enable(); -} - -/** - * \internal - * \brief Enables the External Interrupt driver. - * - * Enables EIC modules. - * Registered callback list will not be affected if callback mode is used. - */ -void _extint_enable(void) -{ - Eic *const eics[EIC_INST_NUM] = EIC_INSTS; - - /* Enable all EIC hardware modules. */ - for (uint32_t i = 0; i < EIC_INST_NUM; i++) { - eics[i]->CTRLA.reg |= EIC_CTRLA_ENABLE; - } - - while (extint_is_syncing()) { - /* Wait for all hardware modules to complete synchronization */ - } -} - -/** - * \internal - * \brief Disables the External Interrupt driver. - * - * Disables EIC modules that were previously started via a call to - * \ref _extint_enable(). - * Registered callback list will not be affected if callback mode is used. - */ -void _extint_disable(void) -{ - Eic *const eics[EIC_INST_NUM] = EIC_INSTS; - - /* Disable all EIC hardware modules. */ - for (uint32_t i = 0; i < EIC_INST_NUM; i++) { - eics[i]->CTRLA.reg &= ~EIC_CTRLA_ENABLE; - } - - while (extint_is_syncing()) { - /* Wait for all hardware modules to complete synchronization */ - } -} - -/** - * \brief Initializes an External Interrupt channel configuration structure to defaults. - * - * Initializes a given External Interrupt channel configuration structure to a - * set of known default values. This function should be called on all new - * instances of these configuration structures before being modified by the - * user application. - * - * The default configuration is as follows: - * \li Input filtering disabled - * \li Internal pull-up enabled - * \li Detect falling edges of a signal - * \li Asynchronous edge detection is disabled - * - * \param[out] config Configuration structure to initialize to default values - */ -void extint_chan_get_config_defaults( - struct extint_chan_conf *const config) -{ - /* Sanity check arguments */ - Assert(config); - - /* Default configuration values */ - config->gpio_pin = 0; - config->gpio_pin_mux = 0; - config->gpio_pin_pull = EXTINT_PULL_UP; - config->filter_input_signal = false; - config->detection_criteria = EXTINT_DETECT_FALLING; - config->enable_async_edge_detection = false; -} - -/** - * \brief Writes an External Interrupt channel configuration to the hardware module. - * - * Writes out a given configuration of an External Interrupt channel - * configuration to the hardware module. If the channel is already configured, - * the new configuration will replace the existing one. - * - * \param[in] channel External Interrupt channel to configure - * \param[in] config Configuration settings for the channel - - */ -void extint_chan_set_config( - const uint8_t channel, - const struct extint_chan_conf *const config) -{ - /* Sanity check arguments */ - Assert(config); - _extint_disable(); -#if(EXTINT_CLOCK_SELECTION == EXTINT_CLK_GCLK) - /* Sanity check clock requirements */ - Assert(!(!system_gclk_gen_is_enabled(EXTINT_CLOCK_SOURCE) && - _extint_is_gclk_required(config->filter_input_signal, - config->detection_criteria))); -#endif - struct system_pinmux_config pinmux_config; - system_pinmux_get_config_defaults(&pinmux_config); - - pinmux_config.mux_position = config->gpio_pin_mux; - pinmux_config.direction = SYSTEM_PINMUX_PIN_DIR_INPUT; - pinmux_config.input_pull = (enum system_pinmux_pin_pull)config->gpio_pin_pull; - system_pinmux_pin_set_config(config->gpio_pin, &pinmux_config); - - /* Get a pointer to the module hardware instance */ - Eic *const EIC_module = _extint_get_eic_from_channel(channel); - - uint32_t config_pos = (4 * (channel % 8)); - uint32_t new_config; - - /* Determine the channel's new edge detection configuration */ - new_config = (config->detection_criteria << EIC_CONFIG_SENSE0_Pos); - - /* Enable the hardware signal filter if requested in the config */ - if (config->filter_input_signal) { - new_config |= EIC_CONFIG_FILTEN0; - } - - /* Clear the existing and set the new channel configuration */ - EIC_module->CONFIG[channel / 8].reg - = (EIC_module->CONFIG[channel / 8].reg & - ~((EIC_CONFIG_SENSE0_Msk | EIC_CONFIG_FILTEN0) << config_pos)) | - (new_config << config_pos); -#if (SAML22) || (SAML21XXXB) || (SAMC20) || (SAMR30) - /* Config asynchronous edge detection */ - if (config->enable_async_edge_detection) { - EIC_module->ASYNCH.reg |= (1UL << channel); - } else { - EIC_module->ASYNCH.reg &= (EIC_ASYNCH_MASK & (~(1UL << channel))); - } -#endif -#if (SAMC21) - /* Config asynchronous edge detection */ - if (config->enable_async_edge_detection) { - EIC_module->EIC_ASYNCH.reg |= (1UL << channel); - } else { - EIC_module->EIC_ASYNCH.reg &= (EIC_EIC_ASYNCH_MASK & (~(1UL << channel))); - } -#endif - _extint_enable(); -} - -/** - * \brief Writes an External Interrupt NMI channel configuration to the hardware module. - * - * Writes out a given configuration of an External Interrupt NMI channel - * configuration to the hardware module. If the channel is already configured, - * the new configuration will replace the existing one. - * - * \param[in] nmi_channel External Interrupt NMI channel to configure - * \param[in] config Configuration settings for the channel - * - * \returns Status code indicating the success or failure of the request. - * \retval STATUS_OK Configuration succeeded - * \retval STATUS_ERR_PIN_MUX_INVALID An invalid pin mux value was supplied - * \retval STATUS_ERR_BAD_FORMAT An invalid detection mode was requested - */ -enum status_code extint_nmi_set_config( - const uint8_t nmi_channel, - const struct extint_nmi_conf *const config) -{ - /* Sanity check arguments */ - Assert(config); - - /* Sanity check clock requirements */ - Assert(!(!system_gclk_gen_is_enabled(EXTINT_CLOCK_SOURCE) && - _extint_is_gclk_required(config->filter_input_signal, - config->detection_criteria))); - - struct system_pinmux_config pinmux_config; - system_pinmux_get_config_defaults(&pinmux_config); - - pinmux_config.mux_position = config->gpio_pin_mux; - pinmux_config.direction = SYSTEM_PINMUX_PIN_DIR_INPUT; - pinmux_config.input_pull = SYSTEM_PINMUX_PIN_PULL_UP; - pinmux_config.input_pull = (enum system_pinmux_pin_pull)config->gpio_pin_pull; - system_pinmux_pin_set_config(config->gpio_pin, &pinmux_config); - - /* Get a pointer to the module hardware instance */ - Eic *const EIC_module = _extint_get_eic_from_channel(nmi_channel); - - uint32_t new_config; - - /* Determine the NMI's new edge detection configuration */ - new_config = (config->detection_criteria << EIC_NMICTRL_NMISENSE_Pos); - - /* Enable the hardware signal filter if requested in the config */ - if (config->filter_input_signal) { - new_config |= EIC_NMICTRL_NMIFILTEN; - } - -#if (SAML21XXXB) || (SAML22) || (SAMC21) || (SAMR30) - /* Enable asynchronous edge detection if requested in the config */ - if (config->enable_async_edge_detection) { - new_config |= EIC_NMICTRL_NMIASYNCH; - } -#endif - - /* Disable EIC and general clock to configure NMI */ - _extint_disable(); -#if(EXTINT_CLOCK_SELECTION == EXTINT_CLK_GCLK) - system_gclk_chan_disable(EIC_GCLK_ID); -#else - Eic *const eics[EIC_INST_NUM] = EIC_INSTS; - for (uint32_t i = 0; i < EIC_INST_NUM; i++){ - eics[i]->CTRLA.bit.CKSEL = EXTINT_CLK_GCLK; - system_gclk_chan_disable(EIC_GCLK_ID); - } -#endif - - EIC_module->NMICTRL.reg = new_config; - - /* Enable the EIC clock and EIC after configure NMI */ -#if(EXTINT_CLOCK_SELECTION == EXTINT_CLK_GCLK) - system_gclk_chan_enable(EIC_GCLK_ID); -#else - for (uint32_t i = 0; i < EIC_INST_NUM; i++){ - eics[i]->CTRLA.bit.CKSEL = EXTINT_CLK_ULP32K; - } -#endif - _extint_enable(); - - return STATUS_OK; -} - -/** - * \brief Enables an External Interrupt event output. - * - * Enables one or more output events from the External Interrupt module. See - * \ref extint_events "here" for a list of events this module supports. - * - * \note Events cannot be altered while the module is enabled. - * - * \param[in] events Struct containing flags of events to enable - */ -void extint_enable_events( - struct extint_events *const events) -{ - /* Sanity check arguments */ - Assert(events); - - /* Array of available EICs. */ - Eic *const eics[EIC_INST_NUM] = EIC_INSTS; - - _extint_disable(); - - /* Update the event control register for each physical EIC instance */ - for (uint32_t i = 0; i < EIC_INST_NUM; i++) { - uint32_t event_mask = 0; - - /* Create an enable mask for the current EIC module */ - for (uint32_t j = 0; j < 32; j++) { - if (events->generate_event_on_detect[(32 * i) + j]) { - event_mask |= (1UL << j); - } - } - - /* Enable the masked events */ - eics[i]->EVCTRL.reg |= event_mask; - } - _extint_enable(); -} - -/** - * \brief Disables an External Interrupt event output. - * - * Disables one or more output events from the External Interrupt module. See - * \ref extint_events "here" for a list of events this module supports. - * - * \note Events cannot be altered while the module is enabled. - * - * \param[in] events Struct containing flags of events to disable - */ -void extint_disable_events( - struct extint_events *const events) -{ - /* Sanity check arguments */ - Assert(events); - - /* Array of available EICs. */ - Eic *const eics[EIC_INST_NUM] = EIC_INSTS; - - _extint_disable(); - - /* Update the event control register for each physical EIC instance */ - for (uint32_t i = 0; i < EIC_INST_NUM; i++) { - uint32_t event_mask = 0; - - /* Create a disable mask for the current EIC module */ - for (uint32_t j = 0; j < 32; j++) { - if (events->generate_event_on_detect[(32 * i) + j]) { - event_mask |= (1UL << j); - } - } - - /* Disable the masked events */ - eics[i]->EVCTRL.reg &= ~event_mask; - } - _extint_enable(); -} diff --git a/atmel-samd/asf/sam0/drivers/extint/module_config/conf_extint.h b/atmel-samd/asf/sam0/drivers/extint/module_config/conf_extint.h deleted file mode 100644 index fd8611ec1..000000000 --- a/atmel-samd/asf/sam0/drivers/extint/module_config/conf_extint.h +++ /dev/null @@ -1,65 +0,0 @@ -/** - * \file - * - * \brief SAM External Interrupt Driver Configuration Header - * - * Copyright (C) 2013-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef CONF_EXTINT_H_INCLUDED -#define CONF_EXTINT_H_INCLUDED - -/** - * Define which clock type is used to clock EIC peripheral: - * - EXTINT_CLK_GCLK - * - EXTINT_CLK_ULP32K - * - * EXTINT_CLK_ULP32K is available for SAM L21/C21. - */ -#define EXTINT_CLOCK_SELECTION EXTINT_CLK_GCLK - -/** - * Define which GCLK source is used when selecting EXTINT_CLK_GCLK type. - */ -#if (EXTINT_CLOCK_SELECTION == EXTINT_CLK_GCLK) -# define EXTINT_CLOCK_SOURCE GCLK_GENERATOR_0 -#endif - -#endif diff --git a/atmel-samd/asf/sam0/drivers/i2s/i2s.c b/atmel-samd/asf/sam0/drivers/i2s/i2s.c deleted file mode 100644 index bbf04620b..000000000 --- a/atmel-samd/asf/sam0/drivers/i2s/i2s.c +++ /dev/null @@ -1,750 +0,0 @@ -/** - * \file - * - * \brief SAM I2S - Inter-IC Sound Controller - * - * Copyright (C) 2014-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#include "i2s.h" - -/** - * \brief Initializes a hardware I<SUP>2</SUP>S module instance - * - * Enables the clock and initialize the I<SUP>2</SUP>S module. - * - * \param[in,out] module_inst Pointer to the software module instance struct - * \param[in] hw Pointer to the TCC hardware module - * - * \return Status of the initialization procedure. - * - * \retval STATUS_OK The module was initialized successfully - * \retval STATUS_BUSY Hardware module was busy when the - * initialization procedure was attempted - * \retval STATUS_ERR_DENIED Hardware module was already enabled - */ -enum status_code i2s_init( - struct i2s_module *const module_inst, - I2s *hw) -{ - Assert(module_inst); - Assert(hw); - - /* Enable the user interface clock in the PM */ - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBC, PM_APBCMASK_I2S); - - /* Status check */ - uint32_t ctrla; - ctrla = module_inst->hw->CTRLA.reg; - if (ctrla & I2S_CTRLA_ENABLE) { - if (ctrla & (I2S_CTRLA_SEREN1 | - I2S_CTRLA_SEREN0 | I2S_CTRLA_CKEN1 | I2S_CTRLA_CKEN0)) { - return STATUS_BUSY; - } else { - return STATUS_ERR_DENIED; - } - } - - /* Initialize module */ - module_inst->hw = hw; - - /* Initialize serializers */ -#if I2S_CALLBACK_MODE == true - int i, j; - for (i = 0; i < 2; i ++) { - for (j = 0; j < I2S_SERIALIZER_CALLBACK_N; j ++) { - module_inst->serializer[i].callback[j] = NULL; - } - module_inst->serializer[i].registered_callback_mask = 0; - module_inst->serializer[i].enabled_callback_mask = 0; - - module_inst->serializer[i].job_buffer = NULL; - module_inst->serializer[i].job_status = STATUS_OK; - module_inst->serializer[i].requested_words = 0; - module_inst->serializer[i].transferred_words = 0; - - module_inst->serializer[i].mode = I2S_SERIALIZER_RECEIVE; - module_inst->serializer[i].data_size = I2S_DATA_SIZE_32BIT; - } - - _i2s_instances[0] = module_inst; - - system_interrupt_enable(SYSTEM_INTERRUPT_MODULE_I2S); -#endif - - return STATUS_OK; -} - - -/** - * \brief Configure specified I<SUP>2</SUP>S clock unit - * - * Enables the clock and initialize the clock unit, based on the given - * configurations. - * - * \param[in,out] module_inst Pointer to the software module instance struct - * \param[in] clock_unit I<SUP>2</SUP>S clock unit to initialize and configure - * \param[in] config Pointer to the I<SUP>2</SUP>S clock unit configuration - * options struct - * - * \return Status of the configuration procedure. - * - * \retval STATUS_OK The module was initialized successfully - * \retval STATUS_BUSY Hardware module was busy when the - * configuration procedure was attempted - * \retval STATUS_ERR_DENIED Hardware module was already enabled - * \retval STATUS_ERR_INVALID_ARG Invalid divider value or - * MCK direction setting conflict - */ -enum status_code i2s_clock_unit_set_config( - struct i2s_module *const module_inst, - const enum i2s_clock_unit clock_unit, - const struct i2s_clock_unit_config *config) -{ - Assert(module_inst); - Assert(module_inst->hw); - Assert(clock_unit < I2S_CLOCK_UNIT_N); - Assert(config); - - /* Status check */ - uint32_t ctrla, syncbusy; - syncbusy = module_inst->hw->SYNCBUSY.reg; - ctrla = module_inst->hw->CTRLA.reg; - - /* Busy ? */ - if (syncbusy & (I2S_SYNCBUSY_CKEN0 << clock_unit)) { - return STATUS_BUSY; - } - /* Already enabled ? */ - if (ctrla & (I2S_CTRLA_CKEN0 << clock_unit)) { - return STATUS_ERR_DENIED; - } - /* Parameter check */ - if (config->clock.mck_src && config->clock.mck_out_enable) { - return STATUS_ERR_INVALID_ARG; - } - - /* Initialize Clock Unit */ - uint32_t clkctrl = - (config->clock.mck_out_invert ? I2S_CLKCTRL_MCKOUTINV : 0) | - (config->clock.sck_out_invert ? I2S_CLKCTRL_SCKOUTINV : 0) | - (config->frame.frame_sync.invert_out ? I2S_CLKCTRL_FSOUTINV : 0) | - (config->clock.mck_out_enable ? I2S_CLKCTRL_MCKEN : 0) | - (config->clock.mck_src ? I2S_CLKCTRL_MCKSEL : 0) | - (config->clock.sck_src ? I2S_CLKCTRL_SCKSEL : 0) | - (config->frame.frame_sync.invert_use ? I2S_CLKCTRL_FSINV : 0) | - (config->frame.frame_sync.source ? I2S_CLKCTRL_FSSEL : 0) | - (config->frame.data_delay ? I2S_CLKCTRL_BITDELAY : 0); - - uint8_t div_val = config->clock.mck_out_div; - if ((div_val > 0x21) || (div_val == 0)) { - return STATUS_ERR_INVALID_ARG; - } else { - div_val --; - } - clkctrl |= I2S_CLKCTRL_MCKOUTDIV(div_val); - - div_val = config->clock.sck_div; - if ((div_val > 0x21) || (div_val == 0)) { - return STATUS_ERR_INVALID_ARG; - } else { - div_val --; - } - clkctrl |= I2S_CLKCTRL_MCKDIV(div_val); - - uint8_t number_slots = config->frame.number_slots; - if (number_slots > 8) { - return STATUS_ERR_INVALID_ARG; - } else if (number_slots > 0) { - number_slots --; - } - clkctrl |= - I2S_CLKCTRL_NBSLOTS(number_slots) | - I2S_CLKCTRL_FSWIDTH(config->frame.frame_sync.width) | - I2S_CLKCTRL_SLOTSIZE(config->frame.slot_size); - - /* Write clock unit configurations */ - module_inst->hw->CLKCTRL[clock_unit].reg = clkctrl; - - /* Select general clock source */ - const uint8_t i2s_gclk_ids[2] = {I2S_GCLK_ID_0, I2S_GCLK_ID_1}; - struct system_gclk_chan_config gclk_chan_config; - system_gclk_chan_get_config_defaults(&gclk_chan_config); - gclk_chan_config.source_generator = config->clock.gclk_src; - system_gclk_chan_set_config(i2s_gclk_ids[clock_unit], &gclk_chan_config); - system_gclk_chan_enable(i2s_gclk_ids[clock_unit]); - - /* Initialize pins */ - struct system_pinmux_config pin_config; - system_pinmux_get_config_defaults(&pin_config); - if (config->mck_pin.enable) { - pin_config.mux_position = config->mck_pin.mux; - system_pinmux_pin_set_config(config->mck_pin.gpio, &pin_config); - } - if (config->sck_pin.enable) { - pin_config.mux_position = config->sck_pin.mux; - system_pinmux_pin_set_config(config->sck_pin.gpio, &pin_config); - } - if (config->fs_pin.enable) { - pin_config.mux_position = config->fs_pin.mux; - system_pinmux_pin_set_config(config->fs_pin.gpio, &pin_config); - } - - return STATUS_OK; -} - - -/** - * \brief Configure specified I<SUP>2</SUP>S serializer - * - * Enables the clock and initialize the serializer, based on the given - * configurations. - * - * \param[in,out] module_inst Pointer to the software module instance struct - * \param[in] serializer I<SUP>2</SUP>S serializer to initialize and configure - * \param[in] config Pointer to the I<SUP>2</SUP>S serializer configuration - * options struct - * - * \return Status of the configuration procedure. - * - * \retval STATUS_OK The module was initialized successfully - * \retval STATUS_BUSY Hardware module was busy when the - * configuration procedure was attempted - * \retval STATUS_ERR_DENIED Hardware module was already enabled - */ -enum status_code i2s_serializer_set_config( - struct i2s_module *const module_inst, - const enum i2s_serializer serializer, - const struct i2s_serializer_config *config) -{ - Assert(module_inst); - Assert(module_inst->hw); - Assert(serializer < I2S_SERIALIZER_N); - Assert(config); - - /* Status check */ - uint32_t ctrla, syncbusy; - syncbusy = module_inst->hw->SYNCBUSY.reg; - ctrla = module_inst->hw->CTRLA.reg; - - /* Busy ? */ - if (syncbusy & ((I2S_SYNCBUSY_SEREN0 | I2S_SYNCBUSY_DATA0) << serializer)) { - return STATUS_BUSY; - } - /* Already enabled ? */ - if (ctrla & (I2S_CTRLA_CKEN0 << serializer)) { - return STATUS_ERR_DENIED; - } - - /* Initialize Serializer */ - uint32_t serctrl = - (config->loop_back ? I2S_SERCTRL_RXLOOP : 0) | - (config->dma_usage ? I2S_SERCTRL_DMA : 0) | - (config->mono_mode ? I2S_SERCTRL_MONO : 0) | - (config->disable_data_slot[7] ? I2S_SERCTRL_SLOTDIS7 : 0) | - (config->disable_data_slot[6] ? I2S_SERCTRL_SLOTDIS6 : 0) | - (config->disable_data_slot[5] ? I2S_SERCTRL_SLOTDIS5 : 0) | - (config->disable_data_slot[4] ? I2S_SERCTRL_SLOTDIS4 : 0) | - (config->disable_data_slot[3] ? I2S_SERCTRL_SLOTDIS3 : 0) | - (config->disable_data_slot[2] ? I2S_SERCTRL_SLOTDIS2 : 0) | - (config->disable_data_slot[1] ? I2S_SERCTRL_SLOTDIS1 : 0) | - (config->disable_data_slot[0] ? I2S_SERCTRL_SLOTDIS0 : 0) | - (config->transfer_lsb_first ? I2S_SERCTRL_BITREV : 0) | - (config->data_adjust_left_in_word ? I2S_SERCTRL_WORDADJ : 0) | - (config->data_adjust_left_in_slot ? I2S_SERCTRL_SLOTADJ : 0) | - (config->data_padding ? I2S_SERCTRL_TXSAME : 0); - - if (config->clock_unit < I2S_CLOCK_UNIT_N) { - serctrl |= (config->clock_unit ? I2S_SERCTRL_CLKSEL : 0); - } else { - return STATUS_ERR_INVALID_ARG; - } - - serctrl |= - I2S_SERCTRL_SERMODE(config->mode) | - I2S_SERCTRL_TXDEFAULT(config->line_default_state) | - I2S_SERCTRL_DATASIZE(config->data_size) | - I2S_SERCTRL_EXTEND(config->bit_padding); - - /* Write Serializer configuration */ - module_inst->hw->SERCTRL[serializer].reg = serctrl; - - /* Initialize pins */ - struct system_pinmux_config pin_config; - system_pinmux_get_config_defaults(&pin_config); - if (config->data_pin.enable) { - pin_config.mux_position = config->data_pin.mux; - system_pinmux_pin_set_config(config->data_pin.gpio, &pin_config); - } - - /* Save configure */ - module_inst->serializer[serializer].mode = config->mode; - module_inst->serializer[serializer].data_size = config->data_size; - - return STATUS_OK; -} - - - -/** - * \brief Retrieves the current module status. - * - * Retrieves the status of the module, giving overall state information. - * - * \param[in] module_inst Pointer to the I<SUP>2</SUP>S software instance struct - * - * \return Bitmask of \c I2S_STATUS_* flags. - * - * \retval I2S_STATUS_SYNC_BUSY Module is busy synchronization - * \retval I2S_STATUS_TRANSMIT_UNDERRUN(x) Serializer x (0~1) is underrun - * \retval I2S_STATUS_TRANSMIT_READY(x) Serializer x (0~1) is ready to - * transmit new data word - * \retval I2S_STATUS_RECEIVE_OVERRUN(x) Serializer x (0~1) is overrun - * \retval I2S_STATUS_RECEIVE_READY(x) Serializer x (0~1) has data ready to - * read - */ -uint32_t i2s_get_status( - const struct i2s_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - uint32_t intflag = module_inst->hw->INTFLAG.reg; - uint32_t status; - if (module_inst->hw->SYNCBUSY.reg) { - status = I2S_STATUS_SYNC_BUSY; - } else { - status = 0; - } - if (intflag & I2S_INTFLAG_TXUR0) { - status |= I2S_STATUS_TRANSMIT_UNDERRUN(0); - } - if (intflag & I2S_INTFLAG_TXUR1) { - status |= I2S_STATUS_TRANSMIT_UNDERRUN(1); - } - if ((intflag & I2S_INTFLAG_TXRDY0) && - !module_inst->hw->SYNCBUSY.bit.DATA0) { - status |= I2S_STATUS_TRANSMIT_READY(0); - } - if ((intflag & I2S_INTFLAG_TXRDY1) && - !module_inst->hw->SYNCBUSY.bit.DATA1) { - status |= I2S_STATUS_TRANSMIT_READY(1); - } - if (intflag & I2S_INTFLAG_RXOR0) { - status |= I2S_STATUS_RECEIVE_OVERRUN(0); - } - if (intflag & I2S_INTFLAG_RXOR1) { - status |= I2S_STATUS_RECEIVE_OVERRUN(1); - } - if (intflag & I2S_INTFLAG_RXRDY0) { - status |= I2S_STATUS_RECEIVE_READY(0); - } - if (intflag & I2S_INTFLAG_RXRDY1) { - status |= I2S_STATUS_RECEIVE_READY(1); - } - return status; -} - -/** - * \brief Clears a module status flags. - * - * Clears the given status flags of the module. - * - * \param[in] module_inst Pointer to the I<SUP>2</SUP>S software instance struct - * \param[in] status Bitmask of \c I2S_STATUS_* flags to clear - */ -void i2s_clear_status( - const struct i2s_module *const module_inst, - uint32_t status) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - uint32_t intflag = 0; - - if (status & I2S_STATUS_TRANSMIT_UNDERRUN(0)) { - intflag = I2S_INTFLAG_TXUR0; - } - if (status & I2S_STATUS_TRANSMIT_UNDERRUN(1)) { - intflag = I2S_INTFLAG_TXUR1; - } - if (status & I2S_STATUS_TRANSMIT_READY(0)) { - intflag = I2S_INTFLAG_TXRDY0; - } - if (status & I2S_STATUS_TRANSMIT_READY(1)) { - intflag = I2S_INTFLAG_TXRDY1; - } - if (status & I2S_STATUS_RECEIVE_OVERRUN(0)) { - intflag = I2S_INTFLAG_RXOR0; - } - if (status & I2S_STATUS_RECEIVE_OVERRUN(1)) { - intflag = I2S_INTFLAG_RXOR1; - } - if (status & I2S_STATUS_RECEIVE_READY(0)) { - intflag = I2S_INTFLAG_RXRDY0; - } - if (status & I2S_STATUS_RECEIVE_READY(1)) { - intflag = I2S_INTFLAG_RXRDY1; - } - module_inst->hw->INTFLAG.reg = intflag; -} - -/** - * \brief Enable interrupts on status set - * - * Enable the given status interrupt request from the I<SUP>2</SUP>S module. - * - * \param[in] module_inst Pointer to the I<SUP>2</SUP>S software instance struct - * \param[in] status Status interrupts to enable - * - * \return Status of enable procedure. - * - * \retval STATUS_OK Interrupt is enabled successfully - * \retval STATUS_ERR_INVALID_ARG Status with no interrupt is passed - */ -enum status_code i2s_enable_status_interrupt( - struct i2s_module *const module_inst, - uint32_t status) -{ - /* Sanity check arguments */ - Assert(module_inst); - - /* No sync busy interrupt */ - if (status & I2S_STATUS_SYNC_BUSY) { - return STATUS_ERR_INVALID_ARG; - } - Assert(module_inst->hw); - - uint32_t intflag = 0; - if (status & I2S_STATUS_TRANSMIT_UNDERRUN(0)) { - intflag = I2S_INTFLAG_TXUR0; - } - if (status & I2S_STATUS_TRANSMIT_UNDERRUN(1)) { - intflag = I2S_INTFLAG_TXUR1; - } - if (status & I2S_STATUS_TRANSMIT_READY(0)) { - intflag = I2S_INTFLAG_TXRDY0; - } - if (status & I2S_STATUS_TRANSMIT_READY(1)) { - intflag = I2S_INTFLAG_TXRDY1; - } - if (status & I2S_STATUS_RECEIVE_OVERRUN(0)) { - intflag = I2S_INTFLAG_RXOR0; - } - if (status & I2S_STATUS_RECEIVE_OVERRUN(1)) { - intflag = I2S_INTFLAG_RXOR1; - } - if (status & I2S_STATUS_RECEIVE_READY(0)) { - intflag = I2S_INTFLAG_RXRDY0; - } - if (status & I2S_STATUS_RECEIVE_READY(1)) { - intflag = I2S_INTFLAG_RXRDY1; - } - module_inst->hw->INTENSET.reg = intflag; - return STATUS_OK; -} - -/** - * \brief Disable interrupts on status set - * - * Disable the given status interrupt request from the I<SUP>2</SUP>S module. - * - * \param[in] module_inst Pointer to the I<SUP>2</SUP>S software instance struct - * \param[in] status Status interrupts to disable - */ -void i2s_disable_status_interrupt( - struct i2s_module *const module_inst, - uint32_t status) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - uint32_t intflag = 0; - if (status & I2S_STATUS_TRANSMIT_UNDERRUN(0)) { - intflag = I2S_INTFLAG_TXUR0; - } - if (status & I2S_STATUS_TRANSMIT_UNDERRUN(1)) { - intflag = I2S_INTFLAG_TXUR1; - } - if (status & I2S_STATUS_TRANSMIT_READY(0)) { - intflag = I2S_INTFLAG_TXRDY0; - } - if (status & I2S_STATUS_TRANSMIT_READY(1)) { - intflag = I2S_INTFLAG_TXRDY1; - } - if (status & I2S_STATUS_RECEIVE_OVERRUN(0)) { - intflag = I2S_INTFLAG_RXOR0; - } - if (status & I2S_STATUS_RECEIVE_OVERRUN(1)) { - intflag = I2S_INTFLAG_RXOR1; - } - if (status & I2S_STATUS_RECEIVE_READY(0)) { - intflag = I2S_INTFLAG_RXRDY0; - } - if (status & I2S_STATUS_RECEIVE_READY(1)) { - intflag = I2S_INTFLAG_RXRDY1; - } - module_inst->hw->INTENCLR.reg = intflag; -} - - -/** - * \brief Write buffer to the specified Serializer of I<SUP>2</SUP>S module - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] serializer The serializer to write to - * \param[in] buffer The data buffer to write - * \param[in] size Number of data words to write - * - * \return Status of the initialization procedure. - * - * \retval STATUS_OK The data was sent successfully - * \retval STATUS_ERR_DENIED The module or serializer is disabled - * \retval STATUS_ERR_INVALID_ARG An invalid buffer pointer was supplied - */ -enum status_code i2s_serializer_write_buffer_wait( - const struct i2s_module *const module_inst, - enum i2s_serializer serializer, - void *buffer, uint32_t size) -{ - Assert(module_inst); - Assert(module_inst->hw); - Assert(serializer < I2S_SERIALIZER_N); - Assert(buffer); - - if (size == 0) { - return STATUS_OK; - } - - uint8_t data_size = 1; /* number of bytes */ - struct i2s_serializer_module *data_module = (struct i2s_serializer_module *) - &module_inst->serializer[serializer]; - - /* Check buffer */ - switch(data_module->data_size) { - case I2S_DATA_SIZE_32BIT: - case I2S_DATA_SIZE_24BIT: - case I2S_DATA_SIZE_20BIT: - case I2S_DATA_SIZE_18BIT: - if ((uint32_t)buffer & 0x3) { - return STATUS_ERR_INVALID_ARG; - } - data_size = 4; - break; - case I2S_DATA_SIZE_16BIT: - case I2S_DATA_SIZE_16BIT_COMPACT: - if ((uint32_t)buffer & 0x1) { - return STATUS_ERR_INVALID_ARG; - } - data_size = 2; - break; - default: - break; - } - - /* Check status */ - if (!(module_inst->hw->CTRLA.reg & - (I2S_CTRLA_ENABLE | (I2S_CTRLA_SEREN0 << serializer)))) { - return STATUS_ERR_DENIED; - } - - /* Write */ - uint32_t i; - uint32_t sync_bit = I2S_SYNCBUSY_DATA0 << serializer; - uint32_t ready_bit = I2S_INTFLAG_TXRDY0 << serializer; - if (4 == data_size) { - uint32_t *p32 = (uint32_t*)buffer; - for (i = 0; i < size; i ++) { - while(!(module_inst->hw->INTFLAG.reg & ready_bit)) { - /* Wait Tx ready */ - } - while(module_inst->hw->SYNCBUSY.reg & sync_bit) { - /* Wait Sync */ - } - module_inst->hw->DATA[serializer].reg = p32[i]; - module_inst->hw->INTFLAG.reg = ready_bit; - } - } else if (2 == data_size) { - uint16_t *p16 = (uint16_t*)buffer; - for (i = 0; i < size; i ++) { - while(!(module_inst->hw->INTFLAG.reg & ready_bit)) { - /* Wait Tx ready */ - } - while(module_inst->hw->SYNCBUSY.reg & sync_bit) { - /* Wait Sync */ - } - module_inst->hw->DATA[serializer].reg = p16[i]; - module_inst->hw->INTFLAG.reg = ready_bit; - } - } else { - uint8_t *p8 = (uint8_t*)buffer; - for (i = 0; i < size; i ++) { - while(!(module_inst->hw->INTFLAG.reg & ready_bit)) { - /* Wait Tx ready */ - } - while(module_inst->hw->SYNCBUSY.reg & sync_bit) { - /* Wait Sync */ - } - module_inst->hw->DATA[serializer].reg = p8[i]; - module_inst->hw->INTFLAG.reg = ready_bit; - } - } - - return STATUS_OK; -} - -/** - * \brief Read from the specified Serializer of I<SUP>2</SUP>S module to a buffer - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] serializer The serializer to write to - * \param[in] buffer The buffer to fill read data (NULL to discard) - * \param[in] size Number of data words to read - * - * \return Status of the initialization procedure. - * - * \retval STATUS_OK The data was sent successfully - * \retval STATUS_ERR_DENIED The module or serializer is disabled - * \retval STATUS_ERR_INVALID_ARG An invalid buffer pointer was supplied - */ -enum status_code i2s_serializer_read_buffer_wait( - const struct i2s_module *const module_inst, - enum i2s_serializer serializer, - void *buffer, uint32_t size) -{ - Assert(module_inst); - Assert(module_inst->hw); - - if (size == 0) { - return STATUS_OK; - } - - uint8_t data_size = 1; /* number of bytes */ - struct i2s_serializer_module *data_module = (struct i2s_serializer_module *) - &module_inst->serializer[serializer]; - - /* Check buffer */ - switch(data_module->data_size) { - case I2S_DATA_SIZE_32BIT: - case I2S_DATA_SIZE_24BIT: - case I2S_DATA_SIZE_20BIT: - case I2S_DATA_SIZE_18BIT: - if ((uint32_t)buffer & 0x3) { - return STATUS_ERR_INVALID_ARG; - } - data_size = 4; - break; - case I2S_DATA_SIZE_16BIT: - case I2S_DATA_SIZE_16BIT_COMPACT: - if ((uint32_t)buffer & 0x1) { - return STATUS_ERR_INVALID_ARG; - } - data_size = 2; - break; - default: - break; - } - - /* Check status */ - if (!(module_inst->hw->CTRLA.reg & - (I2S_CTRLA_ENABLE | (I2S_CTRLA_SEREN0 << serializer)))) { - return STATUS_ERR_DENIED; - } - - /* Read */ - uint32_t i; - uint32_t sync_bit = I2S_SYNCBUSY_DATA0 << serializer; - uint32_t ready_bit = I2S_INTFLAG_RXRDY0 << serializer; - if (buffer == NULL) { - for (i = 0; i < size; i ++) { - while(!(module_inst->hw->INTFLAG.reg & ready_bit)) { - /* Wait Rx ready */ - } - while(module_inst->hw->SYNCBUSY.reg & sync_bit) { - /* Wait Sync */ - } - module_inst->hw->DATA[serializer].reg; - module_inst->hw->INTFLAG.reg = ready_bit; - } - } - else if (4 == data_size) { - uint32_t *p32 = (uint32_t*)buffer; - for (i = 0; i < size; i ++) { - while(!(module_inst->hw->INTFLAG.reg & ready_bit)) { - /* Wait Rx ready */ - } - while(module_inst->hw->SYNCBUSY.reg & sync_bit) { - /* Wait Sync */ - } - p32[i] = module_inst->hw->DATA[serializer].reg; - module_inst->hw->INTFLAG.reg = ready_bit; - } - } else if (2 == data_size) { - uint16_t *p16 = (uint16_t*)buffer; - for (i = 0; i < size; i ++) { - while(!(module_inst->hw->INTFLAG.reg & ready_bit)) { - /* Wait Rx ready */ - } - while(module_inst->hw->SYNCBUSY.reg & sync_bit) { - /* Wait Sync */ - } - p16[i] = module_inst->hw->DATA[serializer].reg; - module_inst->hw->INTFLAG.reg = ready_bit; - } - } else { - uint8_t *p8 = (uint8_t*)buffer; - for (i = 0; i < size; i ++) { - while(!(module_inst->hw->INTFLAG.reg & ready_bit)) { - /* Wait Tx ready */ - } - while(module_inst->hw->SYNCBUSY.reg & sync_bit) { - /* Wait Sync */ - } - p8[i] = module_inst->hw->DATA[serializer].reg; - module_inst->hw->INTFLAG.reg = ready_bit; - } - } - - return STATUS_OK; -} diff --git a/atmel-samd/asf/sam0/drivers/i2s/i2s.h b/atmel-samd/asf/sam0/drivers/i2s/i2s.h deleted file mode 100644 index 0e965d8d3..000000000 --- a/atmel-samd/asf/sam0/drivers/i2s/i2s.h +++ /dev/null @@ -1,1386 +0,0 @@ -/** - * \file - * - * \brief SAM I2S - Inter-IC Sound Controller - * - * Copyright (c) 2014-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef I2S_H_INCLUDED -#define I2S_H_INCLUDED - -/** - * \defgroup asfdoc_sam0_i2s_group SAM Inter-IC Sound Controller (I2S) Driver - * - * This driver for Atmel® | SMART ARM®-based microcontrollers provides - * an interface for the configuration and management of the device's Inter-IC - * Sound Controller functionality. - * - * The following driver API modes are covered by this manual: - * - Polled APIs - * \if I2S_CALLBACK_MODE - * - Callback APIs - * \endif - * - * The following peripheral is used by this module: - * - I<SUP>2</SUP>S (Inter-IC Sound Controller) - * - * The following devices can use this module: - * - Atmel | SMART SAM D21 - * - Atmel | SMART SAM DA1 - * - * The outline of this documentation is as follows: - * - \ref asfdoc_sam0_i2s_prerequisites - * - \ref asfdoc_sam0_i2s_module_overview - * - \ref asfdoc_sam0_i2s_special_considerations - * - \ref asfdoc_sam0_i2s_extra_info - * - \ref asfdoc_sam0_i2s_examples - * - \ref asfdoc_sam0_i2s_api_overview - * - * \section asfdoc_sam0_i2s_prerequisites Prerequisites - * - * There are no prerequisites for this module. - * - * \section asfdoc_sam0_i2s_module_overview Module Overview - * - * The I<SUP>2</SUP>S provides bidirectional, synchronous, digital audio link with - * external audio devices through these signal pins: - * - Serial Data (SDm) - * - Frame Sync (FSn) - * - Serial Clock (SCKn) - * - Master Clock (MCKn) - * - * The I<SUP>2</SUP>S consists of two Clock Units and two Serializers, which can be - * separately configured and enabled, to provide varies functionalities as follow: - * - Communicate to Audio CODECs as Master or Slave, or provides clock and - * frame sync signals as Controller - * - Communicate to DAC or ADC through dedicated I<SUP>2</SUP>S serial interface - * - Communicate to multi-slot or multiple stereo DACs or ADCs, via - * Time Division Multiplexed (TDM) format - * - Reading mono or stereo MEMS microphones, using the Pulse Density - * Modulation (PDM) interface - * - * The I<SUP>2</SUP>S supports compact stereo data word, where left channel data bits are - * in lower half and right channel data bits are in upper half. It reduces the - * number of data words for stereo audio data and the DMA bandwidth. - * - * In master mode, the frame is configured by number of slots and slot size, and - * allows range covering 16fs to 1024fs MCK, to provide oversampling clock to an - * external audio CODEC or digital signal processor (DSP). - * - * A block diagram of the I<SUP>2</SUP>S can be seen in - * \ref asfdoc_sam0_i2s_module_block_diagram "the figure below". - * - * \anchor asfdoc_sam0_i2s_module_block_diagram - * \image html i2s_blocks.svg "I2S Block Diagram" - * - * This driver for I<SUP>2</SUP>S module provides an interface to: - * - Initialize and control I<SUP>2</SUP>S module - * - Configure and control the I<SUP>2</SUP>S Clock Unit and Serializer - * - Transmit/receive data through I<SUP>2</SUP>S Serializer - * - * \subsection asfdoc_sam0_i2s_module_overview_clocks Clocks - * - * To use I<SUP>2</SUP>S module, the I<SUP>2</SUP>S bus interface clock (clk_i2s) - * must be enabled via Power Manager. - * - * For each I<SUP>2</SUP>S Clock Unit, a generic clock (gclk_i2s_n) is connnected. - * When I<SUP>2</SUP>S works in master mode the generic clock is used. It should - * be prepared before clock unit is used. In master mode the input generic clock - * will be used as MCK for SCKn and FSn generation, in addition, the MCK could be - * devided and output to I<SUP>2</SUP>S MCKn pin, as oversampling clock to - * external audio device. - * - * The I<SUP>2</SUP>S Serializer uses clock and control signal from Clock Unit to handle - * transfer. Select different clock unit with different configurations allows - * the I<SUP>2</SUP>S to work as master or slave, to work on non-related clocks. - * - * When using the driver with ASF, enabling the register interface is normally - * done by the \c init function. - * The Generic Clock Controller (GCLK) source for the asynchronous domain is - * normally configured and set through the _configuration - * struct_ / _init_ function. - * If GCLK source != 0 is used, this source has to be configured and enabled - * through invoking the system_gclk driver function when needed, or modifying - * conf_clock.h to enable it at the beginning. - * - * \subsection asfdoc_sam0_i2s_module_overview_frame Audio Frame Generation - * - * Audio sample data for all channels are sent in frames, one frame can consist - * 1 - 8 slots where each slot can be configured to a size 8-bit, 16-bit, 24-bit, - * or 32-bit. The audio frame synch clock is generated by the I<SUP>2</SUP>S - * Clock unit in the master/controller mode. The frame rate (or frame sync - * frequency) is calculated as follows: - * - * FS = SCK / number_of_slots / number_of_bits_in_slot - * - * The serial clock (SCK) source is either an external source (slave mode) or - * generated by the I<SUP>2</SUP>S clock unit (controller or master mode) using - * the MCK as source. - * - * SCK = MCK / sck_div - * \note SCK generation division value is MCKDIV in register. - * - * MCK is either an external source or generated using the GCLK input from a - * generic clock generator. - * - * \subsection asfdoc_sam0_i2s_module_overview_mode Master, Controller, and Slave Modes - * - * The I<SUP>2</SUP>S module has three modes: master, controller, and slave. - * - * \subsubsection asfdoc_sam0_i2s_module_overview_mode_mst Master - * In master mode the module will control the data flow on the I<SUP>2</SUP>S bus and can - * be responsible for clock generation. The Serializers are enabled and will - * transmit/receive data. On a bus with only master and slave the SCK, and FS - * clock signal will be outputted on the SCK and FS pin on the master module. - * MCK can optionally be outputted on the MCK pin, if there is a controller - * module on the bus the SCK, FS, and optionally the MCK clock is sourced from - * the same pins. Serial data will be trancieved on the SD pin in both - * scenarios. - * - * \subsubsection asfdoc_sam0_i2s_module_overview_mode_ctl Controller - * In controller mode the module will generate the clock signals, but the - * Serializers are disabled and no data will be transmitted/received by the - * module in this mode. The clock signals is outputted on the SCK, FS and - * optionally the MCK pin. - * - * \subsubsection asfdoc_sam0_i2s_module_overview_mode_slv Slave - * In slave mode the module will use the SCK and FS clock source from the master - * or the controller which is received on the SCK and FS pin. The MCK can - * optionally be sourced externally on the MCK pin. The Serializers are enabled - * and will tranceive data on the SD pin. All data flow is controlled by the - * master. - * - * \subsubsection asfdoc_sam0_i2s_module_overview_mode_chg Switch Modes - * The mode switching between master, controller, and slave modes are actually - * done by modifying the source mode of I<SUP>2</SUP>S pins. - * The source mode of I<SUP>2</SUP>S pins are selected by writing corresponding - * bits in CLKCTRLn. - * Since source mode switching changes the direction of pin, the mode must be - * changed when the I<SUP>2</SUP>S Clock Unit is stopped. - * - * \subsection asfdoc_sam0_i2s_module_overview_data Data Stream Reception/Transmission - * - * The I<SUP>2</SUP>S module support several data stream formats: - * - I<SUP>2</SUP>S format - * - Time Division Multiplexed (TDM) format - * - Pulse Density Modulation (PDM) format (reception only) - * - * Basically the I<SUP>2</SUP>S module can send several words within each frame, - * it's more like TDM format. With adjust to the number of data words in a frame, - * the FS width, the FS to data bits delay, etc., the module is able to handle - * I<SUP>2</SUP>S compliant data stream. - * - * Also the Serializer can receive PDM format data stream, which allows the - * I<SUP>2</SUP>S module receive 1 PDM data on each SCK edge. - * - * \subsubsection asfdoc_sam0_i2s_module_overview_data_i2s I2S Stream Reception/Transmission - * - * For 2-channel I<SUP>2</SUP>S compliant data stream format the I<SUP>2</SUP>S - * module uses the FS line as word select (WS) signal and will send left channel - * data word on low WS level and right channel data word on high WS level as - * specified in the I<SUP>2</SUP>S standard. The supported word sizes are 8-, - * 16-, 18-, 20-, 24-, and 32- bit. - * - * Thus for I<SUP>2</SUP>S stream, the following settings should be applied to the module: - * - Data starting delay after FS transition : one SCK period - * - FS width : half of frame - * - Data bits adjust in word : left-adjusted - * - Bit transmitting order : MSB first - * - * Following is an example for I<SUP>2</SUP>S application connections and waveforms. See - * the figure below. - * - * \anchor asfdoc_sam0_i2s_module_i2s_example_diagram - * \image html i2s_example.svg "I2S Example Diagram" - * - * \subsubsection asfdoc_sam0_i2s_module_overview_data_tdm TDM Stream Reception/Transmission - * In TDM format, the module sends several data words in each frame. For this - * data stream format most of the configurations could be adjusted: - * - Main Frame related settings are as follow: - * - Frame Sync (FS) options: - * - The active edge of the FS (or if FS is inverted before use) - * - The width of the FS - * - The delay between FS to first data bit - * - Data alignment in slot - * - The number of slots and slot size can be adjusted, it has been mentioned - * in \ref asfdoc_sam0_i2s_module_overview_frame - * - The data word size is controlled by Serializer, it can be chosen among - * 8, 16, 18, 20, 24, and 32 bits. - * - * The general TDM waveform generation is as follows: - * - * \anchor asfdoc_sam0_i2s_module_tdm_wave_diagram - * \image html tdm_wave.svg "TDM Waveform Generation" - * - * Some other settings could also be found to set up clock, data formatting and - * pin multiplexer (MUX). - * Refer to \ref i2s_clock_unit_config "Clock Unit Configurations" - * and \ref i2s_serializer_config "Serializer Configurations" for more - * details. - * - * Following is examples for different application use cases. - * - * See \ref asfdoc_sam0_i2s_module_tdm_timeslot_example_diagram "here" for - * the Time Slot Application connection and waveform example. - * - * \anchor asfdoc_sam0_i2s_module_tdm_timeslot_example_diagram - * \image html tdm_timeslot_example.svg "Codec Example Diagram" - * - * See \ref asfdoc_sam0_i2s_module_tdm_codec_example_diagram "here" for the - * Codec Application connection and waveform example. - * - * \anchor asfdoc_sam0_i2s_module_tdm_codec_example_diagram - * \image html tdm_codec_example.svg "Time Slot Example Diagram" - * - * \subsubsection asfdoc_sam0_i2s_module_overview_data_pdm PDM Reception - * The I<SUP>2</SUP>S Serializer integrates PDM reception feature, to use this feature, - * simply select PDM2 mode in Serializer configuration. In PDM2 mode, it assumes - * two microphones are input for stereo stream. The left microphone bits will - * be stored in lower half and right microphone bits in upper half of the data - * word, like in compact stereo format. - * - * See \ref asfdoc_sam0_i2s_module_pdm_example_diagram "following figure" for an - * example of PDM Microphones Application with both left and right channel - * microphone connected. - * - * \anchor asfdoc_sam0_i2s_module_pdm_example_diagram - * \image html pdm_example.svg "Time PDM2 Example Diagram" - * - * \subsubsection asfdoc_sam0_i2s_module_overview_data_fmt MONO and Compact Data - * The I<SUP>2</SUP>S Serializer can accept some pre-defined data format and generates - * the data stream in specified way. - * - * When transmitting data, the Serializer can work in MONO mode: assum input - * is single channel mono data on left channel and copy it to right channel - * automatically. - * - * Also the I<SUP>2</SUP>S Serializer can support compact stereo data word. The data word - * size of the Serializer can be set to \ref I2S_DATA_SIZE_16BIT_COMPACT - * "16-bit compact" or \ref I2S_DATA_SIZE_8BIT_COMPACT "8-bit compact", with - * these option I<SUP>2</SUP>S Serializer will compact left channel data and right channel - * data together, the left channel data will take lower bytes and right channel - * data take higher bytes. - * - * \subsection asfdoc_sam0_i2s_module_overview_loop Loop-back Mode - * The I<SUP>2</SUP>S can be configured to loop back the Transmitter to Receiver. In this - * mode Serializer's input will be connected to another Serializer's output - * internally. - * - * \subsection asfdoc_sam0_i2s_module_overview_sleep Sleep Modes - * The I<SUP>2</SUP>S will continue to operate in any sleep mode, where the selected source - * clocks are running. - * - * \section asfdoc_sam0_i2s_special_considerations Special Considerations - * - * There is no special considerations for I<SUP>2</SUP>S module. - * - * \section asfdoc_sam0_i2s_extra_info Extra Information - * - * For extra information see \ref asfdoc_sam0_i2s_extra. This includes: - * - \ref asfdoc_sam0_i2s_extra_acronyms - * - \ref asfdoc_sam0_i2s_extra_dependencies - * - \ref asfdoc_sam0_i2s_extra_errata - * - \ref asfdoc_sam0_i2s_extra_history - * - * \section asfdoc_sam0_i2s_examples Examples - * - * For a list of examples related to this driver, see - * \ref asfdoc_sam0_i2s_exqsg. - * - * - * \section asfdoc_sam0_i2s_api_overview API Overview - * @{ - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include <compiler.h> -#include <system.h> - -#if I2S_CALLBACK_MODE == true -# include <system_interrupt.h> - -#if !defined(__DOXYGEN__) -extern struct i2s_module *_i2s_instances[I2S_INST_NUM]; -#endif - -/** Forward definition of the device instance */ -struct i2s_module; - -/** Type of the callback functions. */ -typedef void (*i2s_serializer_callback_t) - (struct i2s_module *const module); - -/** - * \brief I<SUP>2</SUP>S Serializer Callback enum - */ -enum i2s_serializer_callback { - /** Callback for buffer read/write finished */ - I2S_SERIALIZER_CALLBACK_BUFFER_DONE, - /** Callback for Serializer overrun/underrun */ - I2S_SERIALIZER_CALLBACK_OVER_UNDER_RUN, -# if !defined(__DOXYGEN__) - I2S_SERIALIZER_CALLBACK_N -# endif -}; - -#endif /* #if I2S_CALLBACK_MODE == true */ - -/** - * \name Module Status Flags - * - * I<SUP>2</SUP>S status flags, returned by \ref i2s_get_status() and cleared by - * \ref i2s_clear_status(). - * - * @{ - */ - -/** Module Serializer x (0~1) Transmit Underrun. */ -#define I2S_STATUS_TRANSMIT_UNDERRUN(x) (1u << ((x)+0)) -/** Module Serializer x (0~1) is ready to accept new data to be transmitted. */ -#define I2S_STATUS_TRANSMIT_READY(x) (1u << ((x)+2)) -/** Module Serializer x (0~1) Receive Overrun. */ -#define I2S_STATUS_RECEIVE_OVERRUN(x) (1u << ((x)+4)) -/** Module Serializer x (0~1) has received a new data. */ -#define I2S_STATUS_RECEIVE_READY(x) (1u << ((x)+6)) -/** Module is busy on synchronization. */ -#define I2S_STATUS_SYNC_BUSY (1u << 8) - -/** @} */ - -/** - * Master Clock (MCK) source selection. - */ -enum i2s_master_clock_source { - /** Master Clock (MCK) is from general clock */ - I2S_MASTER_CLOCK_SOURCE_GCLK, - /** Master Clock (MCK) is from MCK input pin */ - I2S_MASTER_CLOCK_SOURCE_MCKPIN -}; - -/** - * Serial Clock (SCK) source selection. - */ -enum i2s_serial_clock_source { - /** Serial Clock (SCK) is divided from Master Clock */ - I2S_SERIAL_CLOCK_SOURCE_MCKDIV, - /** Serial Clock (SCK) is input from SCK input pin */ - I2S_SERIAL_CLOCK_SOURCE_SCKPIN -}; - -/** - * Data delay from Frame Sync (FS). - */ -enum i2s_data_delay { - /** Left Justified (no delay) */ - I2S_DATA_DELAY_0, - /** I<SUP>2</SUP>S data delay (1-bit delay) */ - I2S_DATA_DELAY_1, - /** Left Justified (no delay) */ - I2S_DATA_DELAY_LEFT_JUSTIFIED = I2S_DATA_DELAY_0, - /** I<SUP>2</SUP>S data delay (1-bit delay) */ - I2S_DATA_DELAY_I2S = I2S_DATA_DELAY_1 -}; - -/** - * Frame Sync (FS) source. - */ -enum i2s_frame_sync_source { - /** Frame Sync (FS) is divided from I<SUP>2</SUP>S Serial Clock */ - I2S_FRAME_SYNC_SOURCE_SCKDIV, - /** Frame Sync (FS) is input from FS input pin */ - I2S_FRAME_SYNC_SOURCE_FSPIN -}; - -/** - * Frame Sync (FS) output pulse width. - */ -enum i2s_frame_sync_width { - /** Frame Sync (FS) Pulse is one slot width */ - I2S_FRAME_SYNC_WIDTH_SLOT, - /** Frame Sync (FS) Pulse is half a frame width */ - I2S_FRAME_SYNC_WIDTH_HALF_FRAME, - /** Frame Sync (FS) Pulse is one bit width */ - I2S_FRAME_SYNC_WIDTH_BIT, - /** 1-bit wide Frame Sync (FS) per Data sample, only used when Data transfer - * is requested */ - I2S_FRAME_SYNC_WIDTH_BURST -}; - -/** - * Time Slot Size in number of I<SUP>2</SUP>S serial clocks (bits). - */ -enum i2s_slot_size { - /** 8-bit slot */ - I2S_SLOT_SIZE_8_BIT, - /** 16-bit slot */ - I2S_SLOT_SIZE_16_BIT, - /** 24-bit slot */ - I2S_SLOT_SIZE_24_BIT, - /** 32-bit slot */ - I2S_SLOT_SIZE_32_BIT -}; - -/** - * DMA channels usage for I<SUP>2</SUP>S. - */ -enum i2s_dma_usage { - /** Single DMA channel for all I<SUP>2</SUP>S channels */ - I2S_DMA_USE_SINGLE_CHANNEL_FOR_ALL, - /** One DMA channel per data channel */ - I2S_DMA_USE_ONE_CHANNEL_PER_DATA_CHANNEL -}; - -/** - * I<SUP>2</SUP>S data format, to extend mono data to two channels. - */ -enum i2s_data_format { - /** Normal mode, keep data to its right channel */ - I2S_DATA_FORMAT_STEREO, - /** Assume input is mono data for left channel, the data is duplicated to - * right channel */ - I2S_DATA_FORMAT_MONO -}; - -/** - * I<SUP>2</SUP>S data bit order. - */ -enum i2s_bit_order { - /** Transfer Data Most Significant Bit first - * (Default for I<SUP>2</SUP>S protocol) - */ - I2S_BIT_ORDER_MSB_FIRST, - /** Transfer Data Least Significant Bit first */ - I2S_BIT_ORDER_LSB_FIRST -}; - -/** - * I<SUP>2</SUP>S data bit padding. - */ -enum i2s_bit_padding { - /** Padding with 0 */ - I2S_BIT_PADDING_0, - /** Padding with 1 */ - I2S_BIT_PADDING_1, - /** Padding with MSBit */ - I2S_BIT_PADDING_MSB, - /** Padding with LSBit */ - I2S_BIT_PADDING_LSB, -}; - -/** - * I<SUP>2</SUP>S data word adjust. - */ -enum i2s_data_adjust { - /** Data is right adjusted in word */ - I2S_DATA_ADJUST_RIGHT, - /** Data is left adjusted in word */ - I2S_DATA_ADJUST_LEFT -}; - -/** - * I<SUP>2</SUP>S data word size. - */ -enum i2s_data_size { - /** 32-bit */ - I2S_DATA_SIZE_32BIT, - /** 24-bit */ - I2S_DATA_SIZE_24BIT, - /** 20-bit */ - I2S_DATA_SIZE_20BIT, - /** 18-bit */ - I2S_DATA_SIZE_18BIT, - /** 16-bit */ - I2S_DATA_SIZE_16BIT, - /** 16-bit compact stereo */ - I2S_DATA_SIZE_16BIT_COMPACT, - /** 8-bit */ - I2S_DATA_SIZE_8BIT, - /** 8-bit compact stereo */ - I2S_DATA_SIZE_8BIT_COMPACT -}; - -/** - * I<SUP>2</SUP>S data slot adjust. - */ -enum i2s_slot_adjust { - /** Data is right adjusted in slot */ - I2S_SLOT_ADJUST_RIGHT, - /** Data is left adjusted in slot */ - I2S_SLOT_ADJUST_LEFT -}; - -/** - * I<SUP>2</SUP>S data padding. - */ -enum i2s_data_padding { - /** Padding 0 in case of under-run */ - I2S_DATA_PADDING_0, - /** Padding last data in case of under-run */ - I2S_DATA_PADDING_SAME_AS_LAST, - /** Padding last data in case of under-run - * (abbr. \c I2S_DATA_PADDING_SAME_AS_LAST) */ - I2S_DATA_PADDING_LAST = I2S_DATA_PADDING_SAME_AS_LAST, - /** Padding last data in case of under-run - * (abbr. \c I2S_DATA_PADDING_SAME_AS_LAST) */ - I2S_DATA_PADDING_SAME = I2S_DATA_PADDING_SAME_AS_LAST -}; - -/** - * I<SUP>2</SUP>S line default value when slot disabled. - */ -enum i2s_line_default_state { - /** Output default value is 0 */ - I2S_LINE_DEFAULT_0, - /** Output default value is 1 */ - I2S_LINE_DEFAULT_1, - /** Output default value is high impedance */ - I2S_LINE_DEFAULT_HIGH_IMPEDANCE = 3, - /** Output default value is high impedance - * (abbr. \c I2S_LINE_DEFAULT_HIGH_IMPEDANCE) */ - I2S_LINE_DEFAULT_HIZ = I2S_LINE_DEFAULT_HIGH_IMPEDANCE -}; - -/** - * I<SUP>2</SUP>S Serializer mode. - */ -enum i2s_serializer_mode { - /** Serializer is used to receive data */ - I2S_SERIALIZER_RECEIVE, - /** Serializer is used to transmit data */ - I2S_SERIALIZER_TRANSMIT, - /** Serializer is used to receive PDM data on each clock edge */ - I2S_SERIALIZER_PDM2 -}; - -/** - * I<SUP>2</SUP>S clock unit selection. - */ -enum i2s_clock_unit { - /** Clock Unit channel 0 */ - I2S_CLOCK_UNIT_0, - /** Clock Unit channel 1 */ - I2S_CLOCK_UNIT_1, - /** Number of Clock Unit channels */ - I2S_CLOCK_UNIT_N -}; - -/** - * I<SUP>2</SUP>S Serializer selection. - */ -enum i2s_serializer { - /** Serializer channel 0 */ - I2S_SERIALIZER_0, - /** Serializer channel 1 */ - I2S_SERIALIZER_1, - /** Number of Serializer channels */ - I2S_SERIALIZER_N -}; - - -/** - * Configure for I<SUP>2</SUP>S pin. - */ -struct i2s_pin_config { - /** GPIO index to access the pin */ - uint8_t gpio; - /** Pin function MUX */ - uint8_t mux; - /** Enable this pin for I<SUP>2</SUP>S module */ - bool enable; -}; - -/** - * Configure for I<SUP>2</SUP>S clock (SCK). - */ -struct i2s_clock_config { - /** Divide generic clock to master clock output (1~32, 0,1 means no div) */ - uint8_t mck_out_div; - /** Divide generic clock to serial clock (1~32, 0,1 means no div) */ - uint8_t sck_div; - /** Clock source selection */ - enum gclk_generator gclk_src; - /** Master clock source selection: generated or input from pin */ - enum i2s_master_clock_source mck_src; - /** Serial clock source selection: generated or input from pin */ - enum i2s_serial_clock_source sck_src; - /** Invert master clock output */ - bool mck_out_invert; - /** Invert serial clock output */ - bool sck_out_invert; - /** Generate MCK clock output */ - bool mck_out_enable; -}; - -/** - * Configure for I<SUP>2</SUP>S frame sync (FS). - */ -struct i2s_frame_sync_config { - /** Frame Sync (FS) generated or input from pin */ - enum i2s_frame_sync_source source; - /** Frame Sync (FS) width */ - enum i2s_frame_sync_width width; - /** Invert Frame Sync (FS) signal before use */ - bool invert_use; - /** Invert Frame Sync (FS) signal before output */ - bool invert_out; -}; - -/** - * Configure for I<SUP>2</SUP>S frame. - */ -struct i2s_frame_config { - /** Number of slots in a frame (1~8, 0,1 means minimum 1) */ - uint8_t number_slots; - /** Size of each slot in frame */ - enum i2s_slot_size slot_size; - /** Data delay from Frame Sync (FS) to first data bit */ - enum i2s_data_delay data_delay; - /** Frame sync (FS) */ - struct i2s_frame_sync_config frame_sync; -}; - -/** - * Configure for I<SUP>2</SUP>S clock unit. - */ -struct i2s_clock_unit_config { - /** Configure clock generation */ - struct i2s_clock_config clock; - /** Configure frame generation */ - struct i2s_frame_config frame; - - /** Configure master clock pin */ - struct i2s_pin_config mck_pin; - /** Configure serial clock pin */ - struct i2s_pin_config sck_pin; - /** Configure frame sync pin */ - struct i2s_pin_config fs_pin; -}; - -/** - * Configure for I<SUP>2</SUP>S Serializer. - */ -struct i2s_serializer_config { - /** Configure Serializer data pin */ - struct i2s_pin_config data_pin; - - /** Set to \c true to loop-back output to input pin for test */ - bool loop_back; - - /** Set to \c true to assumes mono input and duplicate it (left channel) to - * right channel */ - bool mono_mode; - - /** Disable data slot */ - bool disable_data_slot[8]; - - /** Set to \c true to transfer LSB first, \c false to transfer MSB first */ - bool transfer_lsb_first; - /** Data Word Formatting Adjust, - * set to \c true to adjust bits in word to left */ - bool data_adjust_left_in_word; - /** Data Slot Formatting Adjust, - * set to \c true to adjust words in slot to left */ - bool data_adjust_left_in_slot; - - /** Data Word Size */ - enum i2s_data_size data_size; - /** Data Formatting Bit Extension */ - enum i2s_bit_padding bit_padding; - /** Data padding when under-run */ - enum i2s_data_padding data_padding; - - /** DMA usage */ - enum i2s_dma_usage dma_usage; - - /** Clock unit selection */ - enum i2s_clock_unit clock_unit; - - /** Line default state where slot is disabled */ - enum i2s_line_default_state line_default_state; - - /** Serializer Mode */ - enum i2s_serializer_mode mode; -}; - -/** - * \brief I<SUP>2</SUP>S Serializer instance struct. - */ -struct i2s_serializer_module { - -#if I2S_CALLBACK_MODE == true - /** Callbacks list for Serializer */ - i2s_serializer_callback_t callback[I2S_SERIALIZER_CALLBACK_N]; - - /** Job buffer */ - void *job_buffer; - /** Requested data words to read/write */ - uint32_t requested_words; - /** Transferred data words for read/write */ - uint32_t transferred_words; - - /** Callback mask for registered callbacks */ - uint8_t registered_callback_mask; - /** Callback mask for enabled callbacks */ - uint8_t enabled_callback_mask; - - /** Status of the ongoing or last transfer job */ - enum status_code job_status; -#endif - - /** Serializer mode */ - enum i2s_serializer_mode mode; - /** Serializer data word size */ - enum i2s_data_size data_size; -}; - -/** - * \brief I<SUP>2</SUP>S Software Module instance struct. - */ -struct i2s_module { - /** Module HW register access base */ - I2s *hw; - - /** Module Serializer used */ - struct i2s_serializer_module serializer[2]; -}; - -/** - * \brief Determines if the hardware module(s) are currently synchronizing to the bus. - * - * Checks to see if the underlying hardware peripheral module(s) are currently - * synchronizing across multiple clock domains to the hardware bus, This - * function can be used to delay further operations on a module until such time - * that it is ready, to prevent blocking delays for synchronization in the - * user application. - * - * \param[in] module_inst Pointer to the software module instance struct - * - * \return Synchronization status of the underlying hardware module(s). - * - * \retval false If the module has completed synchronization - * \retval true If the module synchronization is ongoing - */ -static inline bool i2s_is_syncing( - const struct i2s_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - return (module_inst->hw->SYNCBUSY.reg > 0); -} - -/** - * \name Driver Initialization - * @{ - */ - -enum status_code i2s_init( - struct i2s_module *const module_inst, - I2s *hw); - -/** @} */ - -/** - * \name Enable/Disable/Reset - * @{ - */ - -/** - * \brief Enable the I<SUP>2</SUP>S module. - * - * Enables a I<SUP>2</SUP>S module that has been previously initialized. - * - * \param[in] module_inst Pointer to the software module instance struct - */ -static inline void i2s_enable(const struct i2s_module *const module_inst) -{ - Assert(module_inst); - Assert(module_inst->hw); - - while (module_inst->hw->SYNCBUSY.reg & I2S_SYNCBUSY_ENABLE) { - /* Sync wait */ - } - module_inst->hw->CTRLA.reg |= I2S_SYNCBUSY_ENABLE; -} - -/** - * \brief Disables the I<SUP>2</SUP>S module. - * - * Disables a I<SUP>2</SUP>S module. - * - * \param[in] module_inst Pointer to the software module instance struct - */ -static inline void i2s_disable(const struct i2s_module *const module_inst) -{ - Assert(module_inst); - Assert(module_inst->hw); - - while (module_inst->hw->SYNCBUSY.reg & I2S_SYNCBUSY_ENABLE) { - /* Sync wait */ - } - - module_inst->hw->INTENCLR.reg = I2S_INTENCLR_MASK; - module_inst->hw->INTFLAG.reg = I2S_INTFLAG_MASK; - module_inst->hw->CTRLA.reg &= ~I2S_SYNCBUSY_ENABLE; -} - -/** - * \brief Resets the I<SUP>2</SUP>S module. - * - * Resets the I<SUP>2</SUP>S module, restoring all hardware module registers to their - * default values and disabling the module. The I<SUP>2</SUP>S module will not be - * accessible while the reset is being performed. - * - * \param[in] module_inst Pointer to the software module instance struct - */ -static inline void i2s_reset(const struct i2s_module *const module_inst) -{ - Assert(module_inst); - Assert(module_inst->hw); - - /* Disable the module if it is running */ - if (module_inst->hw->CTRLA.reg & I2S_CTRLA_ENABLE) { - i2s_disable(module_inst); - while (i2s_is_syncing(module_inst)) { - /* Sync wait */ - } - } - /* Reset the HW module */ - module_inst->hw->CTRLA.reg = I2S_CTRLA_SWRST; -} - -/** @} */ - -/** - * \name Clock Unit Initialization and Configuration - * @{ - */ - -/** - * \brief Initializes config with predefined default values for I<SUP>2</SUP>S clock unit. - * - * This function will initialize a given I<SUP>2</SUP>S Clock Unit configuration structure - * to a set of known default values. This function should be called on any new - * instance of the configuration structures before being modified by the user - * application. - * - * The default configuration is as follows: - * - The clock unit does not generate output clocks (MCK, SCK, and FS) - * - The pins (MCK, SCK, and FS) and MUX configurations are not set - * - * \param[out] config Pointer to a I<SUP>2</SUP>S module clock unit configuration struct - * to set - */ -static inline void i2s_clock_unit_get_config_defaults( - struct i2s_clock_unit_config *const config) -{ - Assert(config); - - config->clock.mck_out_enable = false; - config->clock.gclk_src = GCLK_GENERATOR_0; - - config->clock.mck_src = I2S_MASTER_CLOCK_SOURCE_GCLK; - config->clock.mck_out_div = 1; - config->clock.mck_out_invert = false; - - config->clock.sck_src = I2S_SERIAL_CLOCK_SOURCE_MCKDIV; - config->clock.sck_div = 1; - config->clock.sck_out_invert = false; - - config->frame.number_slots = 1; - config->frame.slot_size = I2S_SLOT_SIZE_32_BIT; - config->frame.data_delay = I2S_DATA_DELAY_I2S; - - config->frame.frame_sync.source = I2S_FRAME_SYNC_SOURCE_SCKDIV; - config->frame.frame_sync.width = I2S_FRAME_SYNC_WIDTH_HALF_FRAME; - config->frame.frame_sync.invert_use = false; - config->frame.frame_sync.invert_out = false; - - config->mck_pin.enable = false; - config->mck_pin.mux = 0; - config->mck_pin.gpio = 0; - - config->sck_pin.enable = false; - config->sck_pin.mux = 0; - config->sck_pin.gpio = 0; - - config->fs_pin.enable = false; - config->fs_pin.mux = 0; - config->fs_pin.gpio = 0; -} - -enum status_code i2s_clock_unit_set_config( - struct i2s_module *const module_inst, - const enum i2s_clock_unit clock_unit, - const struct i2s_clock_unit_config *config); - -/** @} */ - - -/** - * \name Clock Unit Enable/Disable - * @{ - */ - -/** - * \brief Enable the Specified Clock Unit of I<SUP>2</SUP>S module. - * - * Enables a Clock Unit in I<SUP>2</SUP>S module that has been previously initialized. - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] clock_unit I<SUP>2</SUP>S Clock Unit to enable - */ -static inline void i2s_clock_unit_enable( - const struct i2s_module *const module_inst, - const enum i2s_clock_unit clock_unit) -{ - uint32_t cken_bit; - - Assert(module_inst); - Assert(module_inst->hw); - - cken_bit = I2S_CTRLA_CKEN0 << clock_unit; - - while (module_inst->hw->SYNCBUSY.reg & cken_bit) { - /* Sync wait */ - } - module_inst->hw->CTRLA.reg |= cken_bit; -} - -/** - * \brief Disable the Specified Clock Unit of I<SUP>2</SUP>S module. - * - * Disables a Clock Unit in I<SUP>2</SUP>S module that has been previously initialized. - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] clock_unit I<SUP>2</SUP>S Clock Unit to disable - */ -static inline void i2s_clock_unit_disable( - const struct i2s_module *const module_inst, - const enum i2s_clock_unit clock_unit) -{ - uint32_t cken_bit; - - Assert(module_inst); - Assert(module_inst->hw); - - cken_bit = I2S_CTRLA_CKEN0 << clock_unit; - - while (module_inst->hw->SYNCBUSY.reg & cken_bit) { - /* Sync wait */ - } - module_inst->hw->CTRLA.reg &= ~cken_bit; -} - -/** @} */ - - -/** - * \name Serializer Initialization and Configuration - * @{ - */ - -/** - * \brief Initializes config with predefined default values for I<SUP>2</SUP>S Serializer. - * - * This function will initialize a given I<SUP>2</SUP>S Clock Unit configuration structure - * to a set of known default values. This function should be called on any new - * instance of the configuration structures before being modified by the user - * application. - * - * The default configuration is as follows: - * - Output data does not internally loopback to input line - * - Does not extend mono data (left channel) to right channel - * - None of the data slot is disabled - * - MSB of I<SUP>2</SUP>S data is transferred first - * - In data word data is adjusted right - * - In slot data word is adjusted left - * - The data size is 16-bit width - * - I<SUP>2</SUP>S will padd 0 to not defined bits - * - I<SUP>2</SUP>S will padd 0 to not defined words - * - I<SUP>2</SUP>S will use single DMA channel for all data channels - * - I<SUP>2</SUP>S will use clock unit 0 to serve as clock - * - The default data line state is 0, when there is no data - * - I<SUP>2</SUP>S will transmit data to output line - * - The data pin and MUX configuration are not set - * - * \param[out] config Pointer to a I<SUP>2</SUP>S module Serializer configuration struct - * to set - */ -static inline void i2s_serializer_get_config_defaults( - struct i2s_serializer_config *const config) -{ - config->loop_back = false; - - config->mono_mode = false; - - config->disable_data_slot[0] = false; - config->disable_data_slot[1] = false; - config->disable_data_slot[2] = false; - config->disable_data_slot[3] = false; - config->disable_data_slot[4] = false; - config->disable_data_slot[5] = false; - config->disable_data_slot[6] = false; - config->disable_data_slot[7] = false; - - config->transfer_lsb_first = false; - config->data_adjust_left_in_word = false; - config->data_adjust_left_in_slot = true; - - config->data_size = I2S_DATA_SIZE_16BIT; - - config->bit_padding = I2S_BIT_PADDING_0; - config->data_padding = I2S_DATA_PADDING_0; - - config->dma_usage = I2S_DMA_USE_SINGLE_CHANNEL_FOR_ALL; - - config->clock_unit = I2S_CLOCK_UNIT_0; - - config->line_default_state = I2S_LINE_DEFAULT_0; - - config->mode = I2S_SERIALIZER_TRANSMIT; - - config->data_pin.enable = false; - config->data_pin.gpio = 0; - config->data_pin.mux = 0; -} - -enum status_code i2s_serializer_set_config( - struct i2s_module *const module_inst, - const enum i2s_serializer serializer, - const struct i2s_serializer_config *config); -/** @} */ - -/** - * \name Serializer Enable/Disable - * @{ - */ - -/** - * \brief Enable the Specified Serializer of I<SUP>2</SUP>S module. - * - * Enables a Serializer in I<SUP>2</SUP>S module that has been previously initialized. - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] serializer I<SUP>2</SUP>S Serializer to enable - */ -static inline void i2s_serializer_enable( - const struct i2s_module *const module_inst, - const enum i2s_serializer serializer) -{ - uint32_t seren_bit; - - Assert(module_inst); - Assert(module_inst->hw); - - seren_bit = I2S_CTRLA_SEREN0 << serializer; - - while (module_inst->hw->SYNCBUSY.reg & seren_bit) { - /* Sync wait */ - } - module_inst->hw->CTRLA.reg |= seren_bit; -} - -/** - * \brief Disable the Specified Serializer of I<SUP>2</SUP>S module. - * - * Disables a Serializer in I<SUP>2</SUP>S module that has been previously initialized. - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] serializer I<SUP>2</SUP>S Serializer to disable - */ -static inline void i2s_serializer_disable( - const struct i2s_module *const module_inst, - const enum i2s_serializer serializer) -{ - uint32_t seren_bit; - - Assert(module_inst); - Assert(module_inst->hw); - - seren_bit = I2S_CTRLA_SEREN0 << serializer; - - while (module_inst->hw->SYNCBUSY.reg & seren_bit) { - /* Sync wait */ - } - module_inst->hw->CTRLA.reg &= ~seren_bit; -} -/** @} */ - -/** - * \name Status Management - * @{ - */ - -uint32_t i2s_get_status( - const struct i2s_module *const module_inst); - -void i2s_clear_status( - const struct i2s_module *const module_inst, - uint32_t status); - - -enum status_code i2s_enable_status_interrupt( - struct i2s_module *const module_inst, - uint32_t status); - -void i2s_disable_status_interrupt( - struct i2s_module *const module_inst, - uint32_t status); - -/** @}*/ - -/** - * \name Data Read/Write - * @{ - */ - -/** - * \brief Write a data word to the specified Serializer of I<SUP>2</SUP>S module - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] serializer The Serializer to write to - * \param[in] data The data to write - * - */ -static inline void i2s_serializer_write_wait( - const struct i2s_module *const module_inst, - enum i2s_serializer serializer, - uint32_t data) -{ - uint32_t sync_bit, ready_bit; - - Assert(module_inst); - Assert(module_inst->hw); - - ready_bit = I2S_INTFLAG_TXRDY0 << serializer; - while (!(module_inst->hw->INTFLAG.reg & ready_bit)) { - /* Wait until ready to transmit */ - } - sync_bit = I2S_SYNCBUSY_DATA0 << serializer; - while (module_inst->hw->SYNCBUSY.reg & sync_bit) { - /* Wait sync */ - } - /* Write data */ - module_inst->hw->DATA[serializer].reg = data; - module_inst->hw->INTFLAG.reg = ready_bit; -} - -/** - * \brief Read a data word from the specified Serializer of I<SUP>2</SUP>S module - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] serializer The Serializer to read - */ -static inline uint32_t i2s_serializer_read_wait( - const struct i2s_module *const module_inst, - enum i2s_serializer serializer) -{ - uint32_t sync_bit, ready_bit; - uint32_t data; - - Assert(module_inst); - Assert(module_inst->hw); - - ready_bit = I2S_INTFLAG_RXRDY0 << serializer; - while (!(module_inst->hw->INTFLAG.reg & ready_bit)) { - /* Wait until ready to transmit */ - } - sync_bit = I2S_SYNCBUSY_DATA0 << serializer; - while (module_inst->hw->SYNCBUSY.reg & sync_bit) { - /* Wait sync */ - } - /* Read data */ - data = module_inst->hw->DATA[serializer].reg; - module_inst->hw->INTFLAG.reg = ready_bit; - return data; -} - -enum status_code i2s_serializer_write_buffer_wait( - const struct i2s_module *const module_inst, - enum i2s_serializer serializer, - void *buffer, uint32_t size); - -enum status_code i2s_serializer_read_buffer_wait( - const struct i2s_module *const module_inst, - enum i2s_serializer serializer, - void *buffer, uint32_t size); - -/** @} */ - -#ifdef __cplusplus -} -#endif - -/** @} */ - - -/** - * \page asfdoc_sam0_i2s_extra Extra Information for I2S Driver - * - * \section asfdoc_sam0_i2s_extra_acronyms Acronyms - * Below is a table listing the acronyms used in this module, along with their - * intended meanings. - * - * <table> - * <tr> - * <th>Acronym</th> - * <th>Description</th> - * </tr> - * <tr> - * <td>I<SUP>2</SUP>S, IIS</td> - * <td>Inter-IC Sound Controller</td> - * </tr> - * <tr> - * <td>MCK</td> - * <td>Master Clock</td> - * </tr> - * <tr> - * <td>SCK</td> - * <td>Serial Clock</td> - * </tr> - * <tr> - * <td>FS</td> - * <td>Frame Sync</td> - * </tr> - * <tr> - * <td>SD</td> - * <td>Serial Data</td> - * </tr> - * <tr> - * <td>ADC</td> - * <td>Analog-to-Digital Converter</td> - * </tr> - * <tr> - * <td>DAC</td> - * <td>Digital-to-Analog Converter</td> - * </tr> - * <tr> - * <td>TDM</td> - * <td>Time Division Multiplexed</td> - * </tr> - * <tr> - * <td>PDM</td> - * <td>Pulse Density Modulation</td> - * </tr> - * <tr> - * <td>LSB</td> - * <td>Least Significant Bit</td> - * </tr> - * <tr> - * <td>MSB</td> - * <td>Most Significant Bit</td> - * </tr> - * <tr> - * <td>DSP</td> - * <td>Digital Signal Processor</td> - * </tr> - * </table> - * - * - * \section asfdoc_sam0_i2s_extra_dependencies Dependencies - * This driver has the following dependencies: - * - * - \ref asfdoc_sam0_system_pinmux_group "System Pin Multiplexer Driver" - * - * - * \section asfdoc_sam0_i2s_extra_errata Errata - * There are no errata related to this driver. - * - * - * \section asfdoc_sam0_i2s_extra_history Module History - * An overview of the module history is presented in the table below, with - * details on the enhancements and fixes made to the module since its first - * release. The current version of this corresponds to the newest version in - * the table. - * - * <table> - * <tr> - * <th>Changelog</th> - * </tr> - * <tr> - * <td>Initial Release</td> - * </tr> - * </table> - */ - -/** - * \page asfdoc_sam0_i2s_exqsg Examples for I2S Driver - * - * This is a list of the available Quick Start guides (QSGs) and example - * applications for \ref asfdoc_sam0_i2s_group. QSGs are simple examples with - * step-by-step instructions to configure and use this driver in a selection of - * use cases. Note that QSGs can be compiled as a standalone application or be - * added to the user application. - * - * - \subpage asfdoc_sam0_i2s_basic_use_case - * \if I2S_CALLBACK_MODE - * - \subpage asfdoc_sam0_i2s_callback_use_case - * \endif - * - \subpage asfdoc_sam0_i2s_dma_use_case - * - * \page asfdoc_sam0_i2s_document_revision_history Document Revision History - * - * <table> - * <tr> - * <th>Doc. Rev.</th> - * <th>Date</th> - * <th>Comments</th> - * </tr> - * <tr> - * <td>42255B</td> - * <td>12/2015</td> - * <td>Added support for SAM DA1</td> - * </tr> - * <tr> - * <td>42255A</td> - * <td>01/2014</td> - * <td>Initial release</td> - * </tr> - * </table> - */ - -#endif /* #ifndef I2S_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/i2s/i2s_callback.c b/atmel-samd/asf/sam0/drivers/i2s/i2s_callback.c deleted file mode 100644 index fae543c11..000000000 --- a/atmel-samd/asf/sam0/drivers/i2s/i2s_callback.c +++ /dev/null @@ -1,392 +0,0 @@ -/** - * \file - * - * \brief SAM I<SUP>2</SUP>S - Inter-IC Sound Controller - * - * Copyright (C) 2014-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#include "i2s_callback.h" - -struct i2s_module *_i2s_instances[I2S_INST_NUM]; - -static void _i2s_interrupt_handler(const uint8_t instance) -{ - struct i2s_module *module = _i2s_instances[instance]; - struct i2s_serializer_module *data_module; - - /* Get interrupt flags */ - uint32_t intflag = module->hw->INTFLAG.reg; - uint32_t inten = intflag & module->hw->INTENSET.reg; - uint32_t run_flags = (I2S_INTFLAG_TXUR0 | I2S_INTFLAG_RXOR0); - uint32_t ready_flags = (I2S_INTFLAG_TXRDY0 | I2S_INTFLAG_RXRDY0); - uint32_t call_mask; - uint8_t serializer; - - for (serializer = 0; serializer < 2; serializer ++) { - data_module = &module->serializer[serializer]; - call_mask = data_module->registered_callback_mask & - data_module->enabled_callback_mask; - - if (intflag & (run_flags | ready_flags)) { - /* Serializer Tx ready */ - if ((I2S_INTFLAG_TXRDY0 << serializer) & inten) { - - if (data_module->transferred_words < - data_module->requested_words) { - - /* Write data word */ - while (module->hw->SYNCBUSY.reg & - (I2S_SYNCBUSY_DATA0 << serializer)) { - /* Wait sync */ - } - switch(data_module->data_size) { - case I2S_DATA_SIZE_32BIT: - case I2S_DATA_SIZE_24BIT: - case I2S_DATA_SIZE_20BIT: - case I2S_DATA_SIZE_18BIT: - module->hw->DATA[serializer].reg = - ((uint32_t*)data_module->job_buffer) \ - [data_module->transferred_words]; - break; - case I2S_DATA_SIZE_16BIT: - case I2S_DATA_SIZE_16BIT_COMPACT: - module->hw->DATA[serializer].reg = - ((uint16_t*)data_module->job_buffer) \ - [data_module->transferred_words]; - break; - default: - module->hw->DATA[serializer].reg = - ((uint8_t*)data_module->job_buffer) \ - [data_module->transferred_words]; - } - /* Clear interrupt status */ - module->hw->INTFLAG.reg = I2S_INTFLAG_TXRDY0 << serializer; - - /* Count data */ - data_module->transferred_words ++; - } - - /* Check if the buffer is done */ - if (data_module->transferred_words >= - data_module->requested_words) { - /* It's done */ - data_module->job_status = STATUS_OK; - /* Disable interrupt */ - module->hw->INTENCLR.reg = - I2S_INTFLAG_TXRDY0 << serializer; - /* Invoke callback */ - if ((1 << I2S_SERIALIZER_CALLBACK_BUFFER_DONE) & - call_mask) { - (data_module->callback \ - [I2S_SERIALIZER_CALLBACK_BUFFER_DONE])(module); - } - } - return; - } - /* Serializer Rx ready */ - if ((I2S_INTFLAG_RXRDY0 << serializer) & inten) { - /* Read data word */ - switch(data_module->data_size) { - case I2S_DATA_SIZE_32BIT: - case I2S_DATA_SIZE_24BIT: - case I2S_DATA_SIZE_20BIT: - case I2S_DATA_SIZE_18BIT: - ((uint32_t*)data_module->job_buffer) \ - [data_module->transferred_words] = - module->hw->DATA[serializer].reg; - break; - case I2S_DATA_SIZE_16BIT: - case I2S_DATA_SIZE_16BIT_COMPACT: - ((uint16_t*)data_module->job_buffer) \ - [data_module->transferred_words] = - (uint16_t)module->hw->DATA[serializer].reg; - break; - default: - ((uint8_t*)data_module->job_buffer) \ - [data_module->transferred_words] = - (uint8_t)module->hw->DATA[serializer].reg; - - } - /* Clear interrupt status */ - module->hw->INTFLAG.reg = I2S_INTFLAG_RXRDY0 << serializer; - - /* Count data */ - data_module->transferred_words ++; - - /* Check if the buffer is done */ - if (data_module->transferred_words >= - data_module->requested_words) { - if (data_module->job_status == STATUS_BUSY) { - data_module->job_status = STATUS_OK; - /* Disable interrupt */ - module->hw->INTENCLR.reg = - I2S_INTFLAG_RXRDY0 << serializer; - /* Invoke callback */ - if ((1 << I2S_SERIALIZER_CALLBACK_BUFFER_DONE) & - call_mask) { - (data_module->callback \ - [I2S_SERIALIZER_CALLBACK_BUFFER_DONE])(module); - } - } - } - return; - } - /* Serializer Tx undrerun or Rx overrun */ - if (run_flags & inten) { - module->hw->INTFLAG.reg = I2S_INTFLAG_TXUR0 << serializer; - if ((1 << I2S_SERIALIZER_CALLBACK_OVER_UNDER_RUN) & - call_mask) { - (data_module->callback \ - [I2S_SERIALIZER_CALLBACK_OVER_UNDER_RUN])(module); - } - return; - } - } - run_flags <<= 1; - ready_flags <<= 1; - } - -} - -/** Interrupt handler for the I<SUP>2</SUP>S module */ -void I2S_Handler(void) -{ - _i2s_interrupt_handler(0); -} - -/** - * \brief Write buffer to the specified Serializer of I<SUP>2</SUP>S module - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] serializer The serializer to write to - * \param[in] buffer The data buffer to write - * \param[in] size Number of data words to write - * - * \return Status of the initialization procedure. - * - * \retval STATUS_OK The data was sent successfully - * \retval STATUS_ERR_DENIED The serializer is not in transmit mode - * \retval STATUS_ERR_INVALID_ARG An invalid buffer pointer was supplied - */ -enum status_code i2s_serializer_write_buffer_job( - struct i2s_module *const module_inst, - const enum i2s_serializer serializer, - const void *buffer, - const uint32_t size) -{ - struct i2s_serializer_module *data_module; - - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - Assert(serializer < I2S_SERIALIZER_N); - - data_module = &module_inst->serializer[serializer]; - - /* Serializer must in transmit mode */ - if (data_module->mode != I2S_SERIALIZER_TRANSMIT) { - return STATUS_ERR_DENIED; - } - - /* Buffer should be aligned */ - switch(data_module->data_size) { - case I2S_DATA_SIZE_32BIT: - case I2S_DATA_SIZE_24BIT: - case I2S_DATA_SIZE_20BIT: - case I2S_DATA_SIZE_18BIT: - if ((uint32_t)buffer & 0x3) { - return STATUS_ERR_INVALID_ARG; - } - break; - case I2S_DATA_SIZE_16BIT: - case I2S_DATA_SIZE_16BIT_COMPACT: - if ((uint32_t)buffer & 0x1) { - return STATUS_ERR_INVALID_ARG; - } - break; - default: - break; - } - - data_module = &module_inst->serializer[serializer]; - if (data_module->job_status == STATUS_BUSY) { - return STATUS_BUSY; - } - - data_module->job_status = STATUS_BUSY; - data_module->requested_words = size; - data_module->transferred_words = 0; - data_module->job_buffer = (void*)buffer; - - module_inst->hw->INTENSET.reg = (I2S_INTENSET_TXRDY0 << serializer); - - return STATUS_OK; -} - -/** - * \brief Read from the specified Serializer of I<SUP>2</SUP>S module to a buffer - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] serializer The serializer to write to - * \param[out] buffer The buffer to fill read data - * \param[in] size Number of data words to read - * - * \return Status of the initialization procedure. - * - * \retval STATUS_OK The data was sent successfully - * \retval STATUS_ERR_DENIED The serializer is not in receive mode - * \retval STATUS_ERR_INVALID_ARG An invalid buffer pointer was supplied - */ -enum status_code i2s_serializer_read_buffer_job( - struct i2s_module *const module_inst, - const enum i2s_serializer serializer, - void *buffer, - const uint32_t size) -{ - struct i2s_serializer_module *data_module; - - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - Assert(serializer < I2S_SERIALIZER_N); - - data_module = &module_inst->serializer[serializer]; - - /* Serializer must in receive mode */ - if (data_module->mode == I2S_SERIALIZER_TRANSMIT) { - return STATUS_ERR_DENIED; - } - - /* Data buffer must be aligned */ - switch(data_module->data_size) { - case I2S_DATA_SIZE_32BIT: - case I2S_DATA_SIZE_24BIT: - case I2S_DATA_SIZE_20BIT: - case I2S_DATA_SIZE_18BIT: - if ((uint32_t)buffer & 0x3) { - return STATUS_ERR_INVALID_ARG; - } - break; - case I2S_DATA_SIZE_16BIT: - case I2S_DATA_SIZE_16BIT_COMPACT: - if ((uint32_t)buffer & 0x1) { - return STATUS_ERR_INVALID_ARG; - } - break; - default: - break; - } - - data_module = &module_inst->serializer[serializer]; - if (data_module->job_status == STATUS_BUSY) { - return STATUS_BUSY; - } - - data_module->job_status = STATUS_BUSY; - data_module->requested_words = size; - data_module->transferred_words = 0; - data_module->job_buffer = (void*)buffer; - - module_inst->hw->INTENCLR.reg = (I2S_INTENSET_RXRDY0 << serializer); - module_inst->hw->INTENSET.reg = (I2S_INTENSET_RXRDY0 << serializer); - - return STATUS_OK; -} - -/** - * \brief Aborts an ongoing job running on serializer - * - * Aborts an ongoing job. - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] serializer The serializer which runs the job - * \param[in] job_type Type of job to abort - */ -void i2s_serializer_abort_job( - struct i2s_module *const module_inst, - const enum i2s_serializer serializer, - const enum i2s_job_type job_type) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - Assert(serializer < I2S_SERIALIZER_N); - - if (job_type == I2S_JOB_WRITE_BUFFER) { - /* Disable interrupt */ - module_inst->hw->INTENCLR.reg = (I2S_INTENCLR_TXRDY0 << serializer); - /* Mark job as aborted */ - module_inst->serializer[serializer].job_status = STATUS_ABORTED; - } else if (job_type == I2S_JOB_READ_BUFFER) { - /* Disable interrupt */ - module_inst->hw->INTENCLR.reg = (I2S_INTENCLR_RXRDY0 << serializer); - /* Mark job as aborted */ - module_inst->serializer[serializer].job_status = STATUS_ABORTED; - } -} - -/** - * \brief Gets the status of a job running on serializer - * - * Gets the status of an ongoing or the last job. - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] serializer The serializer which runs the job - * \param[in] job_type Type of job to abort - * - * \return Status of the job. - */ -enum status_code i2s_serializer_get_job_status( - const struct i2s_module *const module_inst, - const enum i2s_serializer serializer, - const enum i2s_job_type job_type) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(serializer < I2S_SERIALIZER_N); - - if (job_type == I2S_JOB_WRITE_BUFFER || job_type == I2S_JOB_READ_BUFFER) { - return module_inst->serializer[serializer].job_status; - } else { - return STATUS_ERR_INVALID_ARG; - } -} diff --git a/atmel-samd/asf/sam0/drivers/i2s/i2s_callback.h b/atmel-samd/asf/sam0/drivers/i2s/i2s_callback.h deleted file mode 100644 index 6fa98f3e1..000000000 --- a/atmel-samd/asf/sam0/drivers/i2s/i2s_callback.h +++ /dev/null @@ -1,234 +0,0 @@ -/** - * \file - * - * \brief SAM I2S - Inter-IC Sound Controller - * - * Copyright (C) 2014-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef I2S_CALLBACK_H_INCLUDED -#define I2S_CALLBACK_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \addtogroup asfdoc_sam0_i2s_group - * - * @{ - */ - -#include <i2s.h> - -/** - * Enum for the possible types of I<SUP>2</SUP>S asynchronous jobs that may be issued to - * the driver. - */ -enum i2s_job_type { - /** Asynchronous I<SUP>2</SUP>S write from a user provided buffer */ - I2S_JOB_WRITE_BUFFER, - /** Asynchronous I<SUP>2</SUP>S read into a user provided buffer */ - I2S_JOB_READ_BUFFER -}; - -/** - * \name Callback Management - * @{ - */ - -/** - * \brief Registers a callback for serializer - * - * Registers a callback function which is implemented by the user. - * - * \note The callback must be enabled by for the interrupt handler to call it - * when the condition for the callback is met. - * - * \param[in] module Pointer to ADC software instance struct - * \param[in] serializer The serializer that generates callback - * \param[in] callback_func Pointer to callback function - * \param[in] callback_type Callback type given by an enum - * - */ -static inline void i2s_serializer_register_callback( - struct i2s_module *const module_inst, - const enum i2s_serializer serializer, - const i2s_serializer_callback_t callback_func, - const enum i2s_serializer_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(serializer < I2S_SERIALIZER_N); - - module_inst->serializer[serializer].callback[callback_type] = callback_func; - module_inst->serializer[serializer].registered_callback_mask |= - (1u << callback_type); -} - -/** - * \brief Unregisters a callback for serializer - * - * Unregisters a callback function which is implemented by the user. - * - * \param[in] module Pointer to ADC software instance struct - * \param[in] serializer The serializer that generates callback - * \param[in] callback_type Callback type given by an enum - * - */ -static inline void i2s_serializer_unregister_callback( - struct i2s_module *const module_inst, - const enum i2s_serializer serializer, - const enum i2s_serializer_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(serializer < I2S_SERIALIZER_N); - - module_inst->serializer[serializer].callback[callback_type] = NULL; - module_inst->serializer[serializer].registered_callback_mask &= - ~(1u << callback_type); -} - -/** - * \brief Enables callback for serializer - * - * Enables the callback function registered by \ref - * i2s_serializer_register_callback. The callback function will be called from - * the interrupt handler when the conditions for the callback type are met. - * - * \param[in] module Pointer to ADC software instance struct - * \param[in] serializer The serializer that generates callback - * \param[in] callback_type Callback type given by an enum - * - */ -static inline void i2s_serializer_enable_callback( - struct i2s_module *const module_inst, - const enum i2s_serializer serializer, - const enum i2s_serializer_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - Assert(serializer < I2S_SERIALIZER_N); - - module_inst->serializer[serializer].enabled_callback_mask |= - (1u << callback_type); - if (I2S_SERIALIZER_CALLBACK_OVER_UNDER_RUN != callback_type) { - return; - } - module_inst->hw->INTENSET.reg = - (module_inst->serializer[serializer].mode == I2S_SERIALIZER_TRANSMIT) ? - (I2S_INTFLAG_TXUR0 << serializer) : - (I2S_INTFLAG_RXOR0 << serializer); -} - -/** - * \brief Disables callback for Serializer - * - * Disables the callback function registered by the \ref - * i2s_serializer_register_callback. - * - * \param[in] module Pointer to ADC software instance struct - * \param[in] serializer The serializer that generates callback - * \param[in] callback_type Callback type given by an enum - * - */ -static inline void i2s_serializer_disable_callback( - struct i2s_module *const module_inst, - const enum i2s_serializer serializer, - const enum i2s_serializer_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - Assert(serializer < I2S_SERIALIZER_N); - - module_inst->serializer[serializer].enabled_callback_mask &= - ~(1u << callback_type); - if (I2S_SERIALIZER_CALLBACK_OVER_UNDER_RUN != callback_type) { - return; - } - module_inst->hw->INTENCLR.reg = - (module_inst->serializer[serializer].mode == I2S_SERIALIZER_TRANSMIT) ? - (I2S_INTFLAG_TXUR0 << serializer) : - (I2S_INTFLAG_RXOR0 << serializer); -} - -/** @} */ - -/** - * \name Job Management - * - * @{ - */ - -enum status_code i2s_serializer_write_buffer_job( - struct i2s_module *const module_inst, - const enum i2s_serializer serializer, - const void *buffer, - const uint32_t size); - -enum status_code i2s_serializer_read_buffer_job( - struct i2s_module *const module_inst, - const enum i2s_serializer serializer, - void *buffer, - const uint32_t size); - -void i2s_serializer_abort_job( - struct i2s_module *const module_inst, - const enum i2s_serializer serializer, - const enum i2s_job_type job_type); - -enum status_code i2s_serializer_get_job_status( - const struct i2s_module *const module_inst, - const enum i2s_serializer serializer, - const enum i2s_job_type job_type); - -/** @} */ - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* #ifndef I2S_CALLBACK_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/nvm/nvm.c b/atmel-samd/asf/sam0/drivers/nvm/nvm.c deleted file mode 100644 index 53a0d7beb..000000000 --- a/atmel-samd/asf/sam0/drivers/nvm/nvm.c +++ /dev/null @@ -1,1146 +0,0 @@ -/** - * \file - * - * \brief SAM Non Volatile Memory driver - * - * Copyright (C) 2012-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#include "nvm.h" -#include <system.h> -#include <system_interrupt.h> -#include <string.h> - -/** - * \internal Internal device instance struct - * - * This struct contains information about the NVM module which is - * often used by the different functions. The information is loaded - * into the struct in the nvm_init() function. - */ -struct _nvm_module { - /** Number of bytes contained per page. */ - uint16_t page_size; - /** Total number of pages in the NVM memory. */ - uint16_t number_of_pages; - /** If \c false, a page write command will be issued automatically when the - * page buffer is full. */ - bool manual_page_write; -}; - -/** - * \internal Instance of the internal device struct - */ -static struct _nvm_module _nvm_dev; - -/** - * \internal Pointer to the NVM MEMORY region start address - */ -#define NVM_MEMORY ((volatile uint16_t *)FLASH_ADDR) - -/** - * \internal Pointer to the NVM USER MEMORY region start address - */ -#define NVM_USER_MEMORY ((volatile uint16_t *)NVMCTRL_USER) - - -/** - * \brief Sets the up the NVM hardware module based on the configuration. - * - * Writes a given configuration of an NVM controller configuration to the - * hardware module, and initializes the internal device struct. - * - * \param[in] config Configuration settings for the NVM controller - * - * \note The security bit must be cleared in order successfully use this - * function. This can only be done by a chip erase. - * - * \return Status of the configuration procedure. - * - * \retval STATUS_OK If the initialization was a success - * \retval STATUS_BUSY If the module was busy when the operation was attempted - * \retval STATUS_ERR_IO If the security bit has been set, preventing the - * EEPROM and/or auxiliary space configuration from being - * altered - */ -enum status_code nvm_set_config( - const struct nvm_config *const config) -{ - /* Sanity check argument */ - Assert(config); - - /* Get a pointer to the module hardware instance */ - Nvmctrl *const nvm_module = NVMCTRL; - -#if (SAML21) || (SAML22) || (SAMC20) || (SAMC21) || (SAMR30) - /* Turn on the digital interface clock */ - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBB, MCLK_APBBMASK_NVMCTRL); -#else - /* Turn on the digital interface clock */ - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBB, PM_APBBMASK_NVMCTRL); -#endif - - /* Clear error flags */ - nvm_module->STATUS.reg = NVMCTRL_STATUS_MASK; - - /* Check if the module is busy */ - if (!nvm_is_ready()) { - return STATUS_BUSY; - } - -#if (!SAMC20) && (!SAMC21) - /* Writing configuration to the CTRLB register */ - nvm_module->CTRLB.reg = - NVMCTRL_CTRLB_SLEEPPRM(config->sleep_power_mode) | - ((config->manual_page_write & 0x01) << NVMCTRL_CTRLB_MANW_Pos) | - NVMCTRL_CTRLB_RWS(config->wait_states) | - ((config->disable_cache & 0x01) << NVMCTRL_CTRLB_CACHEDIS_Pos) | - NVMCTRL_CTRLB_READMODE(config->cache_readmode); -#else - uint8_t cache_disable_value = 0; - if (config->disable_rww_cache == false) { - cache_disable_value = 0x02; - } else { - cache_disable_value = (config->disable_cache & 0x01); - } - /* Writing configuration to the CTRLB register */ - nvm_module->CTRLB.reg = - NVMCTRL_CTRLB_SLEEPPRM(config->sleep_power_mode) | - ((config->manual_page_write & 0x01) << NVMCTRL_CTRLB_MANW_Pos) | - NVMCTRL_CTRLB_RWS(config->wait_states) | - (cache_disable_value << NVMCTRL_CTRLB_CACHEDIS_Pos) | - NVMCTRL_CTRLB_READMODE(config->cache_readmode); -#endif - - /* Initialize the internal device struct */ - _nvm_dev.page_size = (8 << nvm_module->PARAM.bit.PSZ); - _nvm_dev.number_of_pages = nvm_module->PARAM.bit.NVMP; - _nvm_dev.manual_page_write = config->manual_page_write; - - /* If the security bit is set, the auxiliary space cannot be written */ - if (nvm_module->STATUS.reg & NVMCTRL_STATUS_SB) { - return STATUS_ERR_IO; - } - - return STATUS_OK; -} - -/** - * \brief Executes a command on the NVM controller. - * - * Executes an asynchronous command on the NVM controller, to perform a requested - * action such as an NVM page read or write operation. - * - * \note The function will return before the execution of the given command is - * completed. - * - * \param[in] command Command to issue to the NVM controller - * \param[in] address Address to pass to the NVM controller in NVM memory - * space - * \param[in] parameter Parameter to pass to the NVM controller, not used - * for this driver - * - * \return Status of the attempt to execute a command. - * - * \retval STATUS_OK If the command was accepted and execution - * is now in progress - * \retval STATUS_BUSY If the NVM controller was already busy - * executing a command when the new command - * was issued - * \retval STATUS_ERR_IO If the command was invalid due to memory or - * security locking - * \retval STATUS_ERR_INVALID_ARG If the given command was invalid or - * unsupported - * \retval STATUS_ERR_BAD_ADDRESS If the given address was invalid - */ -enum status_code nvm_execute_command( - const enum nvm_command command, - const uint32_t address, - const uint32_t parameter) -{ - uint32_t ctrlb_bak; - - /* Check that the address given is valid */ - if (address > ((uint32_t)_nvm_dev.page_size * _nvm_dev.number_of_pages) - && !(address >= NVMCTRL_AUX0_ADDRESS && address <= NVMCTRL_AUX1_ADDRESS )){ -#ifdef FEATURE_NVM_RWWEE - if (address >= ((uint32_t)NVMCTRL_RWW_EEPROM_SIZE + NVMCTRL_RWW_EEPROM_ADDR) - || address < NVMCTRL_RWW_EEPROM_ADDR){ - return STATUS_ERR_BAD_ADDRESS; - } -#else - return STATUS_ERR_BAD_ADDRESS; -#endif - } - - /* Get a pointer to the module hardware instance */ - Nvmctrl *const nvm_module = NVMCTRL; - - /* Turn off cache before issuing flash commands */ - ctrlb_bak = nvm_module->CTRLB.reg; -#if (SAMC20) || (SAMC21) - nvm_module->CTRLB.reg = ((ctrlb_bak &(~(NVMCTRL_CTRLB_CACHEDIS(0x2)))) - | NVMCTRL_CTRLB_CACHEDIS(0x1)); -#else - nvm_module->CTRLB.reg = ctrlb_bak | NVMCTRL_CTRLB_CACHEDIS; -#endif - - /* Clear error flags */ - nvm_module->STATUS.reg = NVMCTRL_STATUS_MASK; - - /* Check if the module is busy */ - if (!nvm_is_ready()) { - /* Restore the setting */ - nvm_module->CTRLB.reg = ctrlb_bak; - return STATUS_BUSY; - } - - switch (command) { - - /* Commands requiring address (protected) */ - case NVM_COMMAND_ERASE_AUX_ROW: - case NVM_COMMAND_WRITE_AUX_ROW: - - /* Auxiliary space cannot be accessed if the security bit is set */ - if (nvm_module->STATUS.reg & NVMCTRL_STATUS_SB) { - /* Restore the setting */ - nvm_module->CTRLB.reg = ctrlb_bak; - return STATUS_ERR_IO; - } - - /* Set address, command will be issued elsewhere */ - nvm_module->ADDR.reg = (uintptr_t)&NVM_MEMORY[address / 4]; - break; - - /* Commands requiring address (unprotected) */ - case NVM_COMMAND_ERASE_ROW: - case NVM_COMMAND_WRITE_PAGE: - case NVM_COMMAND_LOCK_REGION: - case NVM_COMMAND_UNLOCK_REGION: -#ifdef FEATURE_NVM_RWWEE - case NVM_COMMAND_RWWEE_ERASE_ROW: - case NVM_COMMAND_RWWEE_WRITE_PAGE: -#endif - - /* Set address, command will be issued elsewhere */ - nvm_module->ADDR.reg = (uintptr_t)&NVM_MEMORY[address / 4]; - break; - - /* Commands not requiring address */ - case NVM_COMMAND_PAGE_BUFFER_CLEAR: - case NVM_COMMAND_SET_SECURITY_BIT: - case NVM_COMMAND_ENTER_LOW_POWER_MODE: - case NVM_COMMAND_EXIT_LOW_POWER_MODE: - break; - - default: - /* Restore the setting */ - nvm_module->CTRLB.reg = ctrlb_bak; - return STATUS_ERR_INVALID_ARG; - } - - /* Set command */ - nvm_module->CTRLA.reg = command | NVMCTRL_CTRLA_CMDEX_KEY; - - /* Wait for the NVM controller to become ready */ - while (!nvm_is_ready()) { - } - - /* Restore the setting */ - nvm_module->CTRLB.reg = ctrlb_bak; - - return STATUS_OK; -} - -/** - * \brief Updates an arbitrary section of a page with new data. - * - * Writes from a buffer to a given page in the NVM memory, retaining any - * unmodified data already stored in the page. - * - * \note If manual write mode is enable, the write command must be executed after - * this function, otherwise the data will not write to NVM from page buffer. - * - * \warning This routine is unsafe if data integrity is critical; a system reset - * during the update process will result in up to one row of data being - * lost. If corruption must be avoided in all circumstances (including - * power loss or system reset) this function should not be used. - * - * \param[in] destination_address Destination page address to write to - * \param[in] buffer Pointer to buffer where the data to write is - * stored - * \param[in] offset Number of bytes to offset the data write in - * the page - * \param[in] length Number of bytes in the page to update - * - * \return Status of the attempt to update a page. - * - * \retval STATUS_OK Requested NVM memory page was successfully - * read - * \retval STATUS_BUSY NVM controller was busy when the operation - * was attempted - * \retval STATUS_ERR_BAD_ADDRESS The requested address was outside the - * acceptable range of the NVM memory region - * \retval STATUS_ERR_INVALID_ARG The supplied length and offset was invalid - */ -enum status_code nvm_update_buffer( - const uint32_t destination_address, - uint8_t *const buffer, - uint16_t offset, - uint16_t length) -{ - enum status_code error_code = STATUS_OK; - uint8_t row_buffer[NVMCTRL_ROW_PAGES][NVMCTRL_PAGE_SIZE]; - - /* Ensure the read does not overflow the page size */ - if ((offset + length) > _nvm_dev.page_size) { - return STATUS_ERR_INVALID_ARG; - } - - /* Calculate the starting row address of the page to update */ - uint32_t row_start_address = - destination_address & ~((_nvm_dev.page_size * NVMCTRL_ROW_PAGES) - 1); - - /* Read in the current row contents */ - for (uint32_t i = 0; i < NVMCTRL_ROW_PAGES; i++) { - do - { - error_code = nvm_read_buffer( - row_start_address + (i * _nvm_dev.page_size), - row_buffer[i], _nvm_dev.page_size); - } while (error_code == STATUS_BUSY); - - if (error_code != STATUS_OK) { - return error_code; - } - } - - /* Calculate the starting page in the row that is to be updated */ - uint8_t page_in_row = - (destination_address % (_nvm_dev.page_size * NVMCTRL_ROW_PAGES)) / - _nvm_dev.page_size; - - /* Update the specified bytes in the page buffer */ - for (uint32_t i = 0; i < length; i++) { - row_buffer[page_in_row][offset + i] = buffer[i]; - } - - system_interrupt_enter_critical_section(); - - /* Erase the row */ - do - { - error_code = nvm_erase_row(row_start_address); - } while (error_code == STATUS_BUSY); - - if (error_code != STATUS_OK) { - system_interrupt_leave_critical_section(); - return error_code; - } - - /* Write the updated row contents to the erased row */ - for (uint32_t i = 0; i < NVMCTRL_ROW_PAGES; i++) { - do - { - error_code = nvm_write_buffer( - row_start_address + (i * _nvm_dev.page_size), - row_buffer[i], _nvm_dev.page_size); - } while (error_code == STATUS_BUSY); - - if (error_code != STATUS_OK) { - system_interrupt_leave_critical_section(); - return error_code; - } - } - - system_interrupt_leave_critical_section(); - - return error_code; -} - -/** - * \brief Writes a number of bytes to a page in the NVM memory region. - * - * Writes from a buffer to a given page address in the NVM memory. - * - * \param[in] destination_address Destination page address to write to - * \param[in] buffer Pointer to buffer where the data to write is - * stored - * \param[in] length Number of bytes in the page to write - * - * \note If writing to a page that has previously been written to, the page's - * row should be erased (via \ref nvm_erase_row()) before attempting to - * write new data to the page. - * - * \note For SAM D21 RWW devices, see \c SAMD21_64K, command \c NVM_COMMAND_RWWEE_WRITE_PAGE - * must be executed before any other commands after writing a page, - * refer to errata 13588. - * - * \note If manual write mode is enabled, the write command must be executed after - * this function, otherwise the data will not write to NVM from page buffer. - * - * \return Status of the attempt to write a page. - * - * \retval STATUS_OK Requested NVM memory page was successfully - * read - * \retval STATUS_BUSY NVM controller was busy when the operation - * was attempted - * \retval STATUS_ERR_BAD_ADDRESS The requested address was outside the - * acceptable range of the NVM memory region or - * not aligned to the start of a page - * \retval STATUS_ERR_INVALID_ARG The supplied write length was invalid - */ -enum status_code nvm_write_buffer( - const uint32_t destination_address, - const uint8_t *buffer, - uint16_t length) -{ -#ifdef FEATURE_NVM_RWWEE - bool is_rww_eeprom = false; -#endif - - /* Check if the destination address is valid */ - if (destination_address > - ((uint32_t)_nvm_dev.page_size * _nvm_dev.number_of_pages)) { -#ifdef FEATURE_NVM_RWWEE - if (destination_address >= ((uint32_t)NVMCTRL_RWW_EEPROM_SIZE + NVMCTRL_RWW_EEPROM_ADDR) - || destination_address < NVMCTRL_RWW_EEPROM_ADDR){ - return STATUS_ERR_BAD_ADDRESS; - } - is_rww_eeprom = true; -#else - return STATUS_ERR_BAD_ADDRESS; -#endif - } - - /* Check if the write address not aligned to the start of a page */ - if (destination_address & (_nvm_dev.page_size - 1)) { - return STATUS_ERR_BAD_ADDRESS; - } - - /* Check if the write length is longer than an NVM page */ - if (length > _nvm_dev.page_size) { - return STATUS_ERR_INVALID_ARG; - } - - /* Get a pointer to the module hardware instance */ - Nvmctrl *const nvm_module = NVMCTRL; - - /* Check if the module is busy */ - if (!nvm_is_ready()) { - return STATUS_BUSY; - } - - /* Erase the page buffer before buffering new data */ - nvm_module->CTRLA.reg = NVM_COMMAND_PAGE_BUFFER_CLEAR | NVMCTRL_CTRLA_CMDEX_KEY; - - /* Check if the module is busy */ - while (!nvm_is_ready()) { - /* Force-wait for the buffer clear to complete */ - } - - /* Clear error flags */ - nvm_module->STATUS.reg = NVMCTRL_STATUS_MASK; - - uint32_t nvm_address = destination_address / 2; - - /* NVM _must_ be accessed as a series of 16-bit words, perform manual copy - * to ensure alignment */ - for (uint16_t i = 0; i < length; i += 2) { - uint16_t data; - - /* Copy first byte of the 16-bit chunk to the temporary buffer */ - data = buffer[i]; - - /* If we are not at the end of a write request with an odd byte count, - * store the next byte of data as well */ - if (i < (length - 1)) { - data |= (buffer[i + 1] << 8); - } - - /* Store next 16-bit chunk to the NVM memory space */ - NVM_MEMORY[nvm_address++] = data; - } - - /* If automatic page write mode is enable, then perform a manual NVM - * write when the length of data to be programmed is less than page size - */ - if ((_nvm_dev.manual_page_write == false) && (length < NVMCTRL_PAGE_SIZE)) { -#ifdef FEATURE_NVM_RWWEE - return ((is_rww_eeprom) ? - (nvm_execute_command(NVM_COMMAND_RWWEE_WRITE_PAGE,destination_address, 0)): - (nvm_execute_command(NVM_COMMAND_WRITE_PAGE,destination_address, 0))); -#else - return nvm_execute_command(NVM_COMMAND_WRITE_PAGE, - destination_address, 0); -#endif - } - - return STATUS_OK; -} - -/** - * \brief Reads a number of bytes from a page in the NVM memory region. - * - * Reads a given number of bytes from a given page address in the NVM memory - * space into a buffer. - * - * \param[in] source_address Source page address to read from - * \param[out] buffer Pointer to a buffer where the content of the read - * page will be stored - * \param[in] length Number of bytes in the page to read - * - * \return Status of the page read attempt. - * - * \retval STATUS_OK Requested NVM memory page was successfully - * read - * \retval STATUS_BUSY NVM controller was busy when the operation - * was attempted - * \retval STATUS_ERR_BAD_ADDRESS The requested address was outside the - * acceptable range of the NVM memory region or - * not aligned to the start of a page - * \retval STATUS_ERR_INVALID_ARG The supplied read length was invalid - */ -enum status_code nvm_read_buffer( - const uint32_t source_address, - uint8_t *const buffer, - uint16_t length) -{ - /* Check if the source address is valid */ - if (source_address > - ((uint32_t)_nvm_dev.page_size * _nvm_dev.number_of_pages)) { -#ifdef FEATURE_NVM_RWWEE - if (source_address >= ((uint32_t)NVMCTRL_RWW_EEPROM_SIZE + NVMCTRL_RWW_EEPROM_ADDR) - || source_address < NVMCTRL_RWW_EEPROM_ADDR){ - return STATUS_ERR_BAD_ADDRESS; - } -#else - return STATUS_ERR_BAD_ADDRESS; -#endif - } - - /* Check if the read address is not aligned to the start of a page */ - if (source_address & (_nvm_dev.page_size - 1)) { - return STATUS_ERR_BAD_ADDRESS; - } - - /* Check if the write length is longer than an NVM page */ - if (length > _nvm_dev.page_size) { - return STATUS_ERR_INVALID_ARG; - } - - /* Get a pointer to the module hardware instance */ - Nvmctrl *const nvm_module = NVMCTRL; - - /* Check if the module is busy */ - if (!nvm_is_ready()) { - return STATUS_BUSY; - } - - /* Clear error flags */ - nvm_module->STATUS.reg = NVMCTRL_STATUS_MASK; - - uint32_t page_address = source_address / 2; - - /* NVM _must_ be accessed as a series of 16-bit words, perform manual copy - * to ensure alignment */ - for (uint16_t i = 0; i < length; i += 2) { - /* Fetch next 16-bit chunk from the NVM memory space */ - uint16_t data = NVM_MEMORY[page_address++]; - - /* Copy first byte of the 16-bit chunk to the destination buffer */ - buffer[i] = (data & 0xFF); - - /* If we are not at the end of a read request with an odd byte count, - * store the next byte of data as well */ - if (i < (length - 1)) { - buffer[i + 1] = (data >> 8); - } - } - - return STATUS_OK; -} - -/** - * \brief Erases a row in the NVM memory space. - * - * Erases a given row in the NVM memory region. - * - * \param[in] row_address Address of the row to erase - * - * \return Status of the NVM row erase attempt. - * - * \retval STATUS_OK Requested NVM memory row was successfully - * erased - * \retval STATUS_BUSY NVM controller was busy when the operation - * was attempted - * \retval STATUS_ERR_BAD_ADDRESS The requested row address was outside the - * acceptable range of the NVM memory region or - * not aligned to the start of a row - * \retval STATUS_ABORTED NVM erased error - */ -enum status_code nvm_erase_row( - const uint32_t row_address) -{ -#ifdef FEATURE_NVM_RWWEE - bool is_rww_eeprom = false; -#endif - - /* Check if the row address is valid */ - if (row_address > - ((uint32_t)_nvm_dev.page_size * _nvm_dev.number_of_pages)) { -#ifdef FEATURE_NVM_RWWEE - if (row_address >= ((uint32_t)NVMCTRL_RWW_EEPROM_SIZE + NVMCTRL_RWW_EEPROM_ADDR) - || row_address < NVMCTRL_RWW_EEPROM_ADDR){ - return STATUS_ERR_BAD_ADDRESS;e4 - } - is_rww_eeprom = true; -#else - return STATUS_ERR_BAD_ADDRESS; -#endif - } - - /* Check if the address to erase is not aligned to the start of a row */ - if (row_address & ((_nvm_dev.page_size * NVMCTRL_ROW_PAGES) - 1)) { - return STATUS_ERR_BAD_ADDRESS; - } - - /* Get a pointer to the module hardware instance */ - Nvmctrl *const nvm_module = NVMCTRL; - - /* Check if the module is busy */ - if (!nvm_is_ready()) { - return STATUS_BUSY; - } - - /* Clear error flags */ - nvm_module->STATUS.reg = NVMCTRL_STATUS_MASK; - - /* Set address and command */ - nvm_module->ADDR.reg = (uintptr_t)&NVM_MEMORY[row_address / 4]; - -#ifdef SAMD21_64K - if (is_rww_eeprom) { - NVM_MEMORY[row_address / 2] = 0x0; - } -#endif - -#ifdef FEATURE_NVM_RWWEE - nvm_module->CTRLA.reg = ((is_rww_eeprom) ? - (NVM_COMMAND_RWWEE_ERASE_ROW | NVMCTRL_CTRLA_CMDEX_KEY): - (NVM_COMMAND_ERASE_ROW | NVMCTRL_CTRLA_CMDEX_KEY)); -#else - nvm_module->CTRLA.reg = NVM_COMMAND_ERASE_ROW | NVMCTRL_CTRLA_CMDEX_KEY; -#endif - - while (!nvm_is_ready()) { - } - - /* There existed error in NVM erase operation */ - if ((enum nvm_error)(nvm_module->STATUS.reg & NVM_ERRORS_MASK) != NVM_ERROR_NONE) { - return STATUS_ABORTED; - } - - return STATUS_OK; -} - -/** - * \brief Reads the parameters of the NVM controller. - * - * Retrieves the page size, number of pages, and other configuration settings - * of the NVM region. - * - * \param[out] parameters Parameter structure, which holds page size and - * number of pages in the NVM memory - */ -void nvm_get_parameters( - struct nvm_parameters *const parameters) -{ - /* Sanity check parameters */ - Assert(parameters); - - /* Get a pointer to the module hardware instance */ - Nvmctrl *const nvm_module = NVMCTRL; - - /* Clear error flags */ - nvm_module->STATUS.reg = NVMCTRL_STATUS_MASK; - - /* Read out from the PARAM register */ - uint32_t param_reg = nvm_module->PARAM.reg; - - /* Mask out page size exponent and convert to a number of bytes */ - parameters->page_size = - 8 << ((param_reg & NVMCTRL_PARAM_PSZ_Msk) >> NVMCTRL_PARAM_PSZ_Pos); - - /* Mask out number of pages count */ - parameters->nvm_number_of_pages = - (param_reg & NVMCTRL_PARAM_NVMP_Msk) >> NVMCTRL_PARAM_NVMP_Pos; - -#ifdef FEATURE_NVM_RWWEE - /* Mask out rwwee number of pages count */ - parameters->rww_eeprom_number_of_pages = - (param_reg & NVMCTRL_PARAM_RWWEEP_Msk) >> NVMCTRL_PARAM_RWWEEP_Pos; -#endif - - /* Read the current EEPROM fuse value from the USER row */ - uint16_t eeprom_fuse_value = - (NVM_USER_MEMORY[NVMCTRL_FUSES_EEPROM_SIZE_Pos / 16] & - NVMCTRL_FUSES_EEPROM_SIZE_Msk) >> NVMCTRL_FUSES_EEPROM_SIZE_Pos; - - /* Translate the EEPROM fuse byte value to a number of NVM pages */ - if (eeprom_fuse_value == 7) { - parameters->eeprom_number_of_pages = 0; - } - else { - parameters->eeprom_number_of_pages = - NVMCTRL_ROW_PAGES << (6 - eeprom_fuse_value); - } - - /* Read the current BOOTSZ fuse value from the USER row */ - uint16_t boot_fuse_value = - (NVM_USER_MEMORY[NVMCTRL_FUSES_BOOTPROT_Pos / 16] & - NVMCTRL_FUSES_BOOTPROT_Msk) >> NVMCTRL_FUSES_BOOTPROT_Pos; - - /* Translate the BOOTSZ fuse byte value to a number of NVM pages */ - if (boot_fuse_value == 7) { - parameters->bootloader_number_of_pages = 0; - } - else { - parameters->bootloader_number_of_pages = - NVMCTRL_ROW_PAGES << (7 - boot_fuse_value); - } -} - -/** - * \brief Checks whether the page region is locked. - * - * Extracts the region to which the given page belongs and checks whether - * that region is locked. - * - * \param[in] page_number Page number to be checked - * - * \return Page lock status. - * - * \retval true Page is locked - * \retval false Page is not locked - * - */ -bool nvm_is_page_locked(uint16_t page_number) -{ - uint16_t pages_in_region; - uint16_t region_number; - -#ifdef FEATURE_NVM_RWWEE - Assert(page_number < _nvm_dev.number_of_pages); -#endif - - /* Get a pointer to the module hardware instance */ - Nvmctrl *const nvm_module = NVMCTRL; - - /* Get number of pages in a region */ - pages_in_region = _nvm_dev.number_of_pages / 16; - - /* Get region for given page */ - region_number = page_number / pages_in_region; - - return !(nvm_module->LOCK.reg & (1 << region_number)); -} - -///@cond INTERNAL - -/** - * \internal - * - * \brief Translate fusebit words into struct content. - * - */ -static void _nvm_translate_raw_fusebits_to_struct ( - uint32_t *raw_user_row, - struct nvm_fusebits *fusebits) -{ - - fusebits->bootloader_size = (enum nvm_bootloader_size) - ((raw_user_row[0] & NVMCTRL_FUSES_BOOTPROT_Msk) - >> NVMCTRL_FUSES_BOOTPROT_Pos); - - fusebits->eeprom_size = (enum nvm_eeprom_emulator_size) - ((raw_user_row[0] & NVMCTRL_FUSES_EEPROM_SIZE_Msk) - >> NVMCTRL_FUSES_EEPROM_SIZE_Pos); - -#if (SAML21) || (SAML22) || (SAMR30) - fusebits->bod33_level = (uint8_t) - ((raw_user_row[0] & FUSES_BOD33USERLEVEL_Msk) - >> FUSES_BOD33USERLEVEL_Pos); - - fusebits->bod33_enable = (bool) - (!((raw_user_row[0] & FUSES_BOD33_DIS_Msk) - >> FUSES_BOD33_DIS_Pos)); - - fusebits->bod33_action = (enum nvm_bod33_action) - ((raw_user_row[0] & FUSES_BOD33_ACTION_Msk) - >> FUSES_BOD33_ACTION_Pos); - - fusebits->bod33_hysteresis = (bool) - ((raw_user_row[1] & FUSES_BOD33_HYST_Msk) - >> FUSES_BOD33_HYST_Pos); - -#elif (SAMD20) || (SAMD21) || (SAMR21)|| (SAMDA1) || (SAMD09) || (SAMD10) - fusebits->bod33_level = (uint8_t) - ((raw_user_row[0] & FUSES_BOD33USERLEVEL_Msk) - >> FUSES_BOD33USERLEVEL_Pos); - - fusebits->bod33_enable = (bool) - ((raw_user_row[0] & FUSES_BOD33_EN_Msk) - >> FUSES_BOD33_EN_Pos); - - fusebits->bod33_action = (enum nvm_bod33_action) - ((raw_user_row[0] & FUSES_BOD33_ACTION_Msk) - >> FUSES_BOD33_ACTION_Pos); - fusebits->bod33_hysteresis = (bool) - ((raw_user_row[1] & FUSES_BOD33_HYST_Msk) - >> FUSES_BOD33_HYST_Pos); -#elif (SAMC20) || (SAMC21) - fusebits->bodvdd_level = (uint8_t) - ((raw_user_row[0] & FUSES_BODVDDUSERLEVEL_Msk) - >> FUSES_BODVDDUSERLEVEL_Pos); - - fusebits->bodvdd_enable = (bool) - (!((raw_user_row[0] & FUSES_BODVDD_DIS_Msk) - >> FUSES_BODVDD_DIS_Pos)); - - fusebits->bodvdd_action = (enum nvm_bod33_action) - ((raw_user_row[0] & FUSES_BODVDD_ACTION_Msk) - >> FUSES_BODVDD_ACTION_Pos); - - fusebits->bodvdd_hysteresis = (raw_user_row[1] & FUSES_BODVDD_HYST_Msk) - >> FUSES_BODVDD_HYST_Pos; -#else - fusebits->bod33_level = (uint8_t) - ((raw_user_row[0] & SYSCTRL_FUSES_BOD33USERLEVEL_Msk) - >> SYSCTRL_FUSES_BOD33USERLEVEL_Pos); - - fusebits->bod33_enable = (bool) - ((raw_user_row[0] & SYSCTRL_FUSES_BOD33_EN_Msk) - >> SYSCTRL_FUSES_BOD33_EN_Pos); - - fusebits->bod33_action = (enum nvm_bod33_action) - ((raw_user_row[0] & SYSCTRL_FUSES_BOD33_ACTION_Msk) - >> SYSCTRL_FUSES_BOD33_ACTION_Pos); - - fusebits->bod33_hysteresis = (bool) - ((raw_user_row[1] & SYSCTRL_FUSES_BOD33_HYST_Msk) - >> SYSCTRL_FUSES_BOD33_HYST_Pos); - -#endif - -#ifdef FEATURE_BOD12 - -#ifndef FUSES_BOD12USERLEVEL_Pos -#define FUSES_BOD12USERLEVEL_Pos 17 -#define FUSES_BOD12USERLEVEL_Msk (0x3Ful << FUSES_BOD12USERLEVEL_Pos) -#endif -#ifndef FUSES_BOD12_DIS_Pos -#define FUSES_BOD12_DIS_Pos 23 -#define FUSES_BOD12_DIS_Msk (0x1ul << FUSES_BOD12_DIS_Pos) -#endif -#ifndef FUSES_BOD12_ACTION_Pos -#define FUSES_BOD12_ACTION_Pos 24 -#define FUSES_BOD12_ACTION_Msk (0x3ul << FUSES_BOD12_ACTION_Pos) -#endif - - fusebits->bod12_level = (uint8_t) - ((raw_user_row[0] & FUSES_BOD12USERLEVEL_Msk) - >> FUSES_BOD12USERLEVEL_Pos); - - fusebits->bod12_enable = (bool) - (!((raw_user_row[0] & FUSES_BOD12_DIS_Msk) - >> FUSES_BOD12_DIS_Pos)); - - fusebits->bod12_action = (enum nvm_bod12_action) - ((raw_user_row[0] & FUSES_BOD12_ACTION_Msk) - >> FUSES_BOD33_ACTION_Pos); - - fusebits->bod12_hysteresis = (bool) - ((raw_user_row[1] & FUSES_BOD12_HYST_Msk) - >> FUSES_BOD12_HYST_Pos); -#endif - - fusebits->wdt_enable = (bool) - ((raw_user_row[0] & WDT_FUSES_ENABLE_Msk) >> WDT_FUSES_ENABLE_Pos); - - fusebits->wdt_always_on = (bool) - ((raw_user_row[0] & WDT_FUSES_ALWAYSON_Msk) >> WDT_FUSES_ALWAYSON_Pos); - - fusebits->wdt_timeout_period = (uint8_t) - ((raw_user_row[0] & WDT_FUSES_PER_Msk) >> WDT_FUSES_PER_Pos); - -#if (SAML21) || (SAML22) || (SAMC20) || (SAMC21) || (SAMR30) - fusebits->wdt_window_timeout = (enum nvm_wdt_window_timeout) - ((raw_user_row[1] & WDT_FUSES_WINDOW_Msk) >> WDT_FUSES_WINDOW_Pos); -#else - /* WDT Windows timout lay between two 32-bit words in the user row. Because only one bit lays in word[0], - bits in word[1] must be left sifted by one to make the correct number */ - fusebits->wdt_window_timeout = (enum nvm_wdt_window_timeout) - (((raw_user_row[0] & WDT_FUSES_WINDOW_0_Msk) >> WDT_FUSES_WINDOW_0_Pos) | - ((raw_user_row[1] & WDT_FUSES_WINDOW_1_Msk) << 1)); -#endif - fusebits->wdt_early_warning_offset = (enum nvm_wdt_early_warning_offset) - ((raw_user_row[1] & WDT_FUSES_EWOFFSET_Msk) >> WDT_FUSES_EWOFFSET_Pos); - - fusebits->wdt_window_mode_enable_at_poweron = (bool) - ((raw_user_row[1] & WDT_FUSES_WEN_Msk) >> WDT_FUSES_WEN_Pos); - - fusebits->lockbits = (uint16_t) - ((raw_user_row[1] & NVMCTRL_FUSES_REGION_LOCKS_Msk) - >> NVMCTRL_FUSES_REGION_LOCKS_Pos); - -} - -///@endcond - -/** - * \brief Get fuses from user row. - * - * Read out the fuse settings from the user row. - * - * \param[in] fusebits Pointer to a 64-bit wide memory buffer of type struct nvm_fusebits - * - * \return Status of read fuses attempt. - * - * \retval STATUS_OK This function will always return STATUS_OK - */ -enum status_code nvm_get_fuses ( - struct nvm_fusebits *fusebits) -{ - enum status_code error_code = STATUS_OK; - uint32_t raw_fusebits[2]; - - /* Make sure the module is ready */ - while (!nvm_is_ready()) { - } - - /* Read the fuse settings in the user row, 64 bit */ - raw_fusebits[0] = ((uint32_t)(NVM_MEMORY[NVMCTRL_USER / 2] & 0xffff) << 16) + - (uint32_t)(NVM_MEMORY[(NVMCTRL_USER / 2) + 1] & 0xffff); - raw_fusebits[1] = ((uint32_t)(NVM_MEMORY[(NVMCTRL_USER / 2) + 2] & 0xffff) << 16) + - (uint32_t)(NVM_MEMORY[(NVMCTRL_USER / 2) + 3] & 0xffff); - - _nvm_translate_raw_fusebits_to_struct(raw_fusebits, fusebits); - - return error_code; -} - -/** - * \brief Set fuses from user row. - * - * Set fuse settings from the user row. - * - * \note When writing to the user row, the values do not get loaded by the - * other modules on the device until a device reset occurs. - * - * \param[in] fusebits Pointer to a 64-bit wide memory buffer of type struct nvm_fusebits - * - * \return Status of read fuses attempt. - * - * \retval STATUS_OK This function will always return STATUS_OK - * - * \retval STATUS_BUSY If the NVM controller was already busy - * executing a command when the new command - * was issued - * \retval STATUS_ERR_IO If the command was invalid due to memory or - * security locking - * \retval STATUS_ERR_INVALID_ARG If the given command was invalid or - * unsupported - * \retval STATUS_ERR_BAD_ADDRESS If the given address was invalid - */ - -enum status_code nvm_set_fuses(struct nvm_fusebits *fb) -{ - uint32_t fusebits[2]; - enum status_code error_code = STATUS_OK; - - if (fb == NULL) { - return STATUS_ERR_INVALID_ARG; - } - /* Read the fuse settings in the user row, 64 bit */ - fusebits[0] = *((uint32_t *)NVMCTRL_AUX0_ADDRESS); - fusebits[1] = *(((uint32_t *)NVMCTRL_AUX0_ADDRESS) + 1); - - /* Set user fuses bit */ - fusebits[0] &= (~NVMCTRL_FUSES_BOOTPROT_Msk); - fusebits[0] |= NVMCTRL_FUSES_BOOTPROT(fb->bootloader_size); - - fusebits[0] &= (~NVMCTRL_FUSES_EEPROM_SIZE_Msk); - fusebits[0] |= NVMCTRL_FUSES_EEPROM_SIZE(fb->eeprom_size); - -#if (SAML21) || (SAML22) || (SAMR30) - fusebits[0] &= (~FUSES_BOD33USERLEVEL_Msk); - fusebits[0] |= FUSES_BOD33USERLEVEL(fb->bod33_level); - - fusebits[0] &= (~FUSES_BOD33_DIS_Msk); - fusebits[0] |= (!fb->bod33_enable) << FUSES_BOD33_DIS_Pos; - - fusebits[0] &= (~FUSES_BOD33_ACTION_Msk); - fusebits[0] |= fb->bod33_action << FUSES_BOD33_ACTION_Pos; - - fusebits[1] &= (~FUSES_BOD33_HYST_Msk); - fusebits[1] |= fb->bod33_hysteresis << FUSES_BOD33_HYST_Pos; - -#elif (SAMD20) || (SAMD21) || (SAMR21) || (SAMDA1) || (SAMD09) || (SAMD10) - fusebits[0] &= (~FUSES_BOD33USERLEVEL_Msk); - fusebits[0] |= FUSES_BOD33USERLEVEL(fb->bod33_level); - - fusebits[0] &= (~FUSES_BOD33_EN_Msk); - fusebits[0] |= (fb->bod33_enable) << FUSES_BOD33_EN_Pos; - - fusebits[0] &= (~FUSES_BOD33_ACTION_Msk); - fusebits[0] |= fb->bod33_action << FUSES_BOD33_ACTION_Pos; - - fusebits[1] &= (~FUSES_BOD33_HYST_Msk); - fusebits[1] |= fb->bod33_hysteresis << FUSES_BOD33_HYST_Pos; - -#elif (SAMC20) || (SAMC21) - fusebits[0] &= (~FUSES_BODVDDUSERLEVEL_Msk); - fusebits[0] |= FUSES_BODVDDUSERLEVEL(fb->bodvdd_level); - - fusebits[0] &= (~FUSES_BODVDD_DIS_Msk); - fusebits[0] |= (!fb->bodvdd_enable) << FUSES_BODVDD_DIS_Pos; - - fusebits[0] &= (~FUSES_BODVDD_ACTION_Msk); - fusebits[0] |= fb->bodvdd_action << FUSES_BODVDD_ACTION_Pos; - - fusebits[1] &= (~FUSES_BODVDD_HYST_Msk); - fusebits[1] |= fb->bodvdd_hysteresis << FUSES_BODVDD_HYST_Pos; - -#else - fusebits[0] &= (~SYSCTRL_FUSES_BOD33USERLEVEL_Msk); - fusebits[0] |= SYSCTRL_FUSES_BOD33USERLEVEL(fb->bod33_level); - - fusebits[0] &= (~SYSCTRL_FUSES_BOD33_EN_Msk); - fusebits[0] |= (fb->bod33_enable) << SYSCTRL_FUSES_BOD33_EN_Pos; - - fusebits[0] &= (~SYSCTRL_FUSES_BOD33_ACTION_Msk); - fusebits[0] |= fb->bod33_action << SYSCTRL_FUSES_BOD33_ACTION_Pos; - - fusebits[1] &= (~SYSCTRL_FUSES_BOD33_HYST_Msk); - fusebits[1] |= fb->bod33_hysteresis << SYSCTRL_FUSES_BOD33_HYST_Pos; - -#endif - - fusebits[0] &= (~WDT_FUSES_ENABLE_Msk); - fusebits[0] |= fb->wdt_enable << WDT_FUSES_ENABLE_Pos; - - fusebits[0] &= (~WDT_FUSES_ALWAYSON_Msk); - fusebits[0] |= (fb->wdt_always_on) << WDT_FUSES_ALWAYSON_Pos; - - fusebits[0] &= (~WDT_FUSES_PER_Msk); - fusebits[0] |= fb->wdt_timeout_period << WDT_FUSES_PER_Pos; - -#if (SAML21) || (SAML22) || (SAMC20) || (SAMC21) || (SAMR30) - fusebits[1] &= (~WDT_FUSES_WINDOW_Msk); - fusebits[1] |= fb->wdt_window_timeout << WDT_FUSES_WINDOW_Pos; -#else - /* WDT Windows timout lay between two 32-bit words in the user row. the last one bit lays in word[0], - and the other bits in word[1] */ - fusebits[0] &= (~WDT_FUSES_WINDOW_0_Msk); - fusebits[0] |= (fb->wdt_window_timeout & 0x1) << WDT_FUSES_WINDOW_0_Pos; - - fusebits[1] &= (~WDT_FUSES_WINDOW_1_Msk); - fusebits[1] |= (fb->wdt_window_timeout >> 1) << WDT_FUSES_WINDOW_1_Pos; - -#endif - fusebits[1] &= (~WDT_FUSES_EWOFFSET_Msk); - fusebits[1] |= fb->wdt_early_warning_offset << WDT_FUSES_EWOFFSET_Pos; - - fusebits[1] &= (~WDT_FUSES_WEN_Msk); - fusebits[1] |= fb->wdt_window_mode_enable_at_poweron << WDT_FUSES_WEN_Pos; - - fusebits[1] &= (~NVMCTRL_FUSES_REGION_LOCKS_Msk); - fusebits[1] |= fb->lockbits << NVMCTRL_FUSES_REGION_LOCKS_Pos; - -#ifdef FEATURE_BOD12 - -#ifndef FUSES_BOD12USERLEVEL_Pos -#define FUSES_BOD12USERLEVEL_Pos 17 -#define FUSES_BOD12USERLEVEL_Msk (0x3Ful << FUSES_BOD12USERLEVEL_Pos) -#endif -#ifndef FUSES_BOD12_DIS_Pos -#define FUSES_BOD12_DIS_Pos 23 -#define FUSES_BOD12_DIS_Msk (0x1ul << FUSES_BOD12_DIS_Pos) -#endif -#ifndef FUSES_BOD12_ACTION_Pos -#define FUSES_BOD12_ACTION_Pos 24 -#define FUSES_BOD12_ACTION_Msk (0x3ul << FUSES_BOD12_ACTION_Pos) -#endif - - fusebits[0] &= (~FUSES_BOD12USERLEVEL_Msk); - fusebits[0] |= ((FUSES_BOD12USERLEVEL_Msk & ((fb->bod12_level) << - FUSES_BOD12USERLEVEL_Pos))); - - fusebits[0] &= (~FUSES_BOD12_DIS_Msk); - fusebits[0] |= (!fb->bod12_enable) << FUSES_BOD12_DIS_Pos; - - fusebits[0] &= (~FUSES_BOD12_ACTION_Msk); - fusebits[0] |= fb->bod12_action << FUSES_BOD12_ACTION_Pos; - - fusebits[1] &= (~FUSES_BOD12_HYST_Msk); - fusebits[1] |= fb->bod12_hysteresis << FUSES_BOD12_HYST_Pos; -#endif - - error_code = nvm_execute_command(NVM_COMMAND_ERASE_AUX_ROW,NVMCTRL_AUX0_ADDRESS,0); - if (error_code != STATUS_OK) { - return error_code; - } - - error_code = nvm_execute_command(NVM_COMMAND_PAGE_BUFFER_CLEAR,NVMCTRL_AUX0_ADDRESS,0); - if (error_code != STATUS_OK) { - return error_code; - } - - *((uint32_t *)NVMCTRL_AUX0_ADDRESS) = fusebits[0]; - *(((uint32_t *)NVMCTRL_AUX0_ADDRESS) + 1) = fusebits[1]; - - error_code = nvm_execute_command(NVM_COMMAND_WRITE_AUX_ROW,NVMCTRL_AUX0_ADDRESS,0); - if (error_code != STATUS_OK) { - return error_code; - } - - return error_code; -} diff --git a/atmel-samd/asf/sam0/drivers/nvm/nvm.h b/atmel-samd/asf/sam0/drivers/nvm/nvm.h deleted file mode 100644 index 99245dd4a..000000000 --- a/atmel-samd/asf/sam0/drivers/nvm/nvm.h +++ /dev/null @@ -1,944 +0,0 @@ -/** - * \file - * - * \brief SAM Non-Volatile Memory driver - * - * Copyright (C) 2012-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef NVM_H_INCLUDED -#define NVM_H_INCLUDED - -/** - * \defgroup asfdoc_sam0_nvm_group SAM Non-Volatile Memory (NVM) Driver - * - * This driver for Atmel® | SMART ARM®-based microcontrollers provides - * an interface for the configuration and management of non-volatile memories - * within the device, for partitioning, erasing, reading, and writing of data. - * - * The following peripheral is used by this module: - * - NVM (Non-Volatile Memory) - * - * The following devices can use this module: - * - Atmel | SMART SAM D20/D21 - * - Atmel | SMART SAM R21 - * - Atmel | SMART SAM D09/D10/D11 - * - Atmel | SMART SAM L21/L22 - * - Atmel | SMART SAM DA1 - * - Atmel | SMART SAM C20/C21 - * - Atmel | SMART SAM R30 - * - * The outline of this documentation is as follows: - * - \ref asfdoc_sam0_nvm_prerequisites - * - \ref asfdoc_sam0_nvm_module_overview - * - \ref asfdoc_sam0_nvm_special_considerations - * - \ref asfdoc_sam0_nvm_extra_info - * - \ref asfdoc_sam0_nvm_examples - * - \ref asfdoc_sam0_nvm_api_overview - * - * - * \section asfdoc_sam0_nvm_prerequisites Prerequisites - * - * There are no prerequisites for this module. - * - * - * \section asfdoc_sam0_nvm_module_overview Module Overview - * - * The Non-Volatile Memory (NVM) module provides an interface to the device's - * Non-Volatile Memory controller, so that memory pages can be written, read, - * erased, and reconfigured in a standardized manner. - * - * \subsection asfdoc_sam0_nvm_features Driver Feature Macro Definition - * <table> - * <tr> - * <th>Driver feature macro</th> - * <th>Supported devices</th> - * </tr> - * <tr> - * <td>FEATURE_NVM_RWWEE</td> - * <td>SAM L21/L22, SAM D21-64K, SAM DA1, SAM C20/C21, SAM R30</td> - * </tr> - * <tr> - * <td>FEATURE_BOD12</td> - * <td>SAM L21, SAMR30</td> - * </tr> - * </table> - * \note The specific features are only available in the driver when the - * selected device supports those features. - * - * \subsection asfdoc_sam0_nvm_module_overview_regions Memory Regions - * The NVM memory space of the SAM devices is divided into two sections: - * a Main Array section, and an Auxiliary space section. The Main Array space - * can be configured to have an (emulated) EEPROM and/or boot loader section. - * The memory layout with the EEPROM and bootloader partitions is shown in - * \ref asfdoc_sam0_nvm_module_mem_layout "the figure below". - * - * \anchor asfdoc_sam0_nvm_module_mem_layout - * \dot - * digraph memory_layout { - * size="5,5" - * node [shape=plaintext, fontname=arial] - * memory [label=< - * <table border="0" cellborder="1" cellspacing="0" > - * <tr> - * <td align="right" border="0"> End of NVM Memory </td> - * <td rowspan="3" align="center"> Reserved EEPROM Section </td> - * </tr> - * <tr> - * <td align="right" border="0"> </td> - * </tr> - * <tr> - * <td align="right" border="0"> Start of EEPROM Memory </td> - * </tr> - * <tr> - * <td align="right" border="0"> End of Application Memory </td> - * <td rowspan="3" align="center"> Application Section </td> - * </tr> - * <tr> - * <td height="300" align="right" border="0"> </td> - * </tr> - * <tr> - * <td align="right" border="0"> Start of Application Memory </td> - * </tr> - * <tr> - * <td align="right" border="0"> End of Bootloader Memory </td> - * <td rowspan="3" align="center"> BOOT Section </td> - * </tr> - * <tr> - * <td align="right" border="0"> </td> - * </tr> - * <tr> - * <td align="right" border="0"> Start of NVM Memory</td> - * </tr> - * </table> - * >] - * } - * \enddot - * - * The Main Array is divided into rows and pages, where each row contains four - * pages. The size of each page may vary from 8-1024 bytes dependent of the - * device. Device specific parameters such as the page size and total number of - * pages in the NVM memory space are available via the \ref nvm_get_parameters() - * function. - * - * An NVM page number and address can be computed via the following equations: - * - * \f[ PageNum = (RowNum \times 4) + PagePosInRow \f] - * \f[ PageAddr = PageNum \times PageSize \f] - * - * \ref asfdoc_sam0_nvm_module_row_layout "The figure below" shows an example - * of the memory page and address values associated with logical row 7 of the - * NVM memory space. - * - * \anchor asfdoc_sam0_nvm_module_row_layout - * \dot - * digraph row_layout { - * size="4,4" - * node [shape=plaintext, fontname=arial] - * row [label=< - * <table border="0" cellborder="1" cellspacing="0"> - * <tr> - * <td align="right" border ="0"> Row 0x07 </td> - * <td > Page 0x1F </td> - * <td > Page 0x1E </td> - * <td > Page 0x1D </td> - * <td > Page 0x1C </td> - * </tr> - * <tr> - * <td align="right" border ="0"> Address </td> - * <td border="0"> 0x7C0 </td> - * <td border="0"> 0x780 </td> - * <td border="0"> 0x740 </td> - * <td border="0"> 0x700 </td> - * </tr> - * </table> - * >] - * } - * \enddot - * - * \subsection asfdoc_sam0_nvm_module_overview_locking_regions Region Lock Bits - * As mentioned in \ref asfdoc_sam0_nvm_module_overview_regions, the main - * block of the NVM memory is divided into a number of individually addressable - * pages. These pages are grouped into 16 equal sized regions, where each region - * can be locked separately issuing an \ref NVM_COMMAND_LOCK_REGION command or - * by writing the LOCK bits in the User Row. Rows reserved for the EEPROM - * section are not affected by the lock bits or commands. - * - * \note By using the \ref NVM_COMMAND_LOCK_REGION or - * \ref NVM_COMMAND_UNLOCK_REGION commands the settings will remain in - * effect until the next device reset. By changing the default lock - * setting for the regions, the auxiliary space must to be written, - * however the adjusted configuration will not take effect until the next - * device reset. - * - * \note If the \ref asfdoc_sam0_nvm_special_consideration_security_bit is - * set, the auxiliary space cannot be written to. Clearing of the security - * bit can only be performed by a full chip erase. - * - * \subsection asfdoc_sam0_nvm_module_overview_sub_rw Read/Write - * Reading from the NVM memory can be performed using direct addressing into the - * NVM memory space, or by calling the \ref nvm_read_buffer() function. - * - * Writing to the NVM memory must be performed by the \ref nvm_write_buffer() - * function - additionally, a manual page program command must be issued if - * the NVM controller is configured in manual page writing mode. - * - * Before a page can be updated, the associated NVM memory row must be erased - * first via the \ref nvm_erase_row() function. Writing to a non-erased page - * will result in corrupt data being stored in the NVM memory space. - * - * \section asfdoc_sam0_nvm_special_considerations Special Considerations - * - * \subsection asfdoc_sam0_nvm_special_consideration_pageerase Page Erasure - * The granularity of an erase is per row, while the granularity of a write is - * per page. Thus, if the user application is modifying only one page of a row, - * the remaining pages in the row must be buffered and the row erased, as an - * erase is mandatory before writing to a page. - * - * \subsection asfdoc_sam0_nvm_special_consideration_clocks Clocks - * The user must ensure that the driver is configured with a proper number of - * wait states when the CPU is running at high frequencies. - * - * \subsection asfdoc_sam0_nvm_special_consideration_security_bit Security Bit - * The User Row in the Auxiliary Space cannot be read or written when - * the Security Bit is set. The Security Bit can be set by using passing - * \ref NVM_COMMAND_SET_SECURITY_BIT to the \ref nvm_execute_command() function, - * or it will be set if one tries to access a locked region. See - * \ref asfdoc_sam0_nvm_module_overview_locking_regions. - * - * The Security Bit can only be cleared by performing a chip erase. - * - * - * \section asfdoc_sam0_nvm_extra_info Extra Information - * - * For extra information, see \ref asfdoc_sam0_nvm_extra. This includes: - * - \ref asfdoc_sam0_nvm_extra_acronyms - * - \ref asfdoc_sam0_nvm_extra_dependencies - * - \ref asfdoc_sam0_nvm_extra_errata - * - \ref asfdoc_sam0_nvm_extra_history - * - * - * \section asfdoc_sam0_nvm_examples Examples - * - * For a list of examples related to this driver, see - * \ref asfdoc_sam0_nvm_exqsg. - * - * - * \section asfdoc_sam0_nvm_api_overview API Overview - * @{ - */ - -#include <compiler.h> -#include <status_codes.h> -#include <stdbool.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* Define SAMD21-64K devices */ -#if defined(SAMD21E15L) || defined(SAMD21E16L) || defined(__SAMD21E15L__) || defined(__SAMD21E16L__) \ - || defined(SAMD21E15B) || defined(SAMD21E16B) || defined(__SAMD21E15B__) || defined(__SAMD21E16B__) \ - || defined(SAMD21E15BU) || defined(SAMD21E16BU) || defined(__SAMD21E15BU__) || defined(__SAMD21E16BU__) \ - || defined(SAMD21G15L) || defined(SAMD21G16L) || defined(__SAMD21G15L__) || defined(__SAMD21G16L__) \ - || defined(SAMD21G15B) || defined(SAMD21G16B) || defined(__SAMD21G15B__) || defined(__SAMD21G16B__) \ - || defined(SAMD21J15B) || defined(SAMD21J16B) || defined(__SAMD21J15B__) || defined(__SAMD21J16B__) - -# define SAMD21_64K - -#endif - -/** - * \name Driver Feature Definition - * - * Define NVM features set according to the different device families. - * @{ -*/ -#if (SAML21) || (SAML22) || (SAMDA1) || (SAMC20) || (SAMC21) || (SAMR30) || defined(SAMD21_64K) || defined(__DOXYGEN__) -/** Read while write EEPROM emulation feature. */ -# define FEATURE_NVM_RWWEE -#endif -#if (SAML21) || (SAMR30) || defined(__DOXYGEN__) -/** Brown-out detector internal to the voltage regulator for VDDCORE. */ -#define FEATURE_BOD12 -#endif -/*@}*/ - -#if !defined(__DOXYGEN__) -/** - * \brief Mask for the error flags in the status register. - */ -# define NVM_ERRORS_MASK (NVMCTRL_STATUS_PROGE | \ - NVMCTRL_STATUS_LOCKE | \ - NVMCTRL_STATUS_NVME) -#endif - -/** - * \brief NVM error flags. - * - * Possible NVM controller error codes, which can be returned by the NVM - * controller after a command is issued. - */ -enum nvm_error { - /** No errors */ - NVM_ERROR_NONE = 0, - /** Lock error, a locked region was attempted accessed */ - NVM_ERROR_LOCK = NVMCTRL_STATUS_NVME | NVMCTRL_STATUS_LOCKE, - /** Program error, invalid command was executed */ - NVM_ERROR_PROG = NVMCTRL_STATUS_NVME | NVMCTRL_STATUS_PROGE, -}; - -/** - * \brief NVM controller commands. - */ -enum nvm_command { - /** Erases the addressed memory row */ - NVM_COMMAND_ERASE_ROW = NVMCTRL_CTRLA_CMD_ER, - - /** Write the contents of the page buffer to the addressed memory page */ - NVM_COMMAND_WRITE_PAGE = NVMCTRL_CTRLA_CMD_WP, - - /** Erases the addressed auxiliary memory row. - * - * \note This command can only be given when the security bit is not set. - */ - NVM_COMMAND_ERASE_AUX_ROW = NVMCTRL_CTRLA_CMD_EAR, - - /** Write the contents of the page buffer to the addressed auxiliary memory - * row. - * - * \note This command can only be given when the security bit is not set. - */ - NVM_COMMAND_WRITE_AUX_ROW = NVMCTRL_CTRLA_CMD_WAP, - - /** Locks the addressed memory region, preventing further modifications - * until the region is unlocked or the device is erased - */ - NVM_COMMAND_LOCK_REGION = NVMCTRL_CTRLA_CMD_LR, - - /** Unlocks the addressed memory region, allowing the region contents to be - * modified - */ - NVM_COMMAND_UNLOCK_REGION = NVMCTRL_CTRLA_CMD_UR, - - /** Clears the page buffer of the NVM controller, resetting the contents to - * all zero values - */ - NVM_COMMAND_PAGE_BUFFER_CLEAR = NVMCTRL_CTRLA_CMD_PBC, - - /** Sets the device security bit, disallowing the changing of lock bits and - * auxiliary row data until a chip erase has been performed - */ - NVM_COMMAND_SET_SECURITY_BIT = NVMCTRL_CTRLA_CMD_SSB, - - /** Enter power reduction mode in the NVM controller to reduce the power - * consumption of the system - */ - NVM_COMMAND_ENTER_LOW_POWER_MODE = NVMCTRL_CTRLA_CMD_SPRM, - - /** Exit power reduction mode in the NVM controller to allow other NVM - * commands to be issued - */ - NVM_COMMAND_EXIT_LOW_POWER_MODE = NVMCTRL_CTRLA_CMD_CPRM, -#ifdef FEATURE_NVM_RWWEE - /** Read while write (RWW) EEPROM area erase row */ - NVM_COMMAND_RWWEE_ERASE_ROW = NVMCTRL_CTRLA_CMD_RWWEEER, - /** RWW EEPROM write page */ - NVM_COMMAND_RWWEE_WRITE_PAGE = NVMCTRL_CTRLA_CMD_RWWEEWP, -#endif -}; - -/** - * \brief NVM controller power reduction mode configurations. - * - * Power reduction modes of the NVM controller, to conserve power while the - * device is in sleep. - */ -enum nvm_sleep_power_mode { - /** NVM controller exits low-power mode on first access after sleep */ - NVM_SLEEP_POWER_MODE_WAKEONACCESS = NVMCTRL_CTRLB_SLEEPPRM_WAKEONACCESS_Val, - /** NVM controller exits low-power mode when the device exits sleep mode */ - NVM_SLEEP_POWER_MODE_WAKEUPINSTANT = NVMCTRL_CTRLB_SLEEPPRM_WAKEUPINSTANT_Val, - /** Power reduction mode in the NVM controller disabled */ - NVM_SLEEP_POWER_MODE_ALWAYS_AWAKE = NVMCTRL_CTRLB_SLEEPPRM_DISABLED_Val, -}; - -/** - * \brief NVM controller cache readmode configuration. - * - * Control how the NVM cache prefetch data from flash. - * - */ -enum nvm_cache_readmode { - /** The NVM Controller (cache system) does not insert wait states on - * a cache miss. Gives the best system performance. - */ - NVM_CACHE_READMODE_NO_MISS_PENALTY, - /** Reduces power consumption of the cache system, but inserts a - * wait state each time there is a cache miss - */ - NVM_CACHE_READMODE_LOW_POWER, - /** The cache system ensures that a cache hit or miss takes the same - * amount of time, determined by the number of programmed flash - * wait states - */ - NVM_CACHE_READMODE_DETERMINISTIC, -}; - -/** - * \brief NVM controller configuration structure. - * - * Configuration structure for the NVM controller within the device. - */ -struct nvm_config { - /** Power reduction mode during device sleep */ - enum nvm_sleep_power_mode sleep_power_mode; - /** Manual write mode; if enabled, pages loaded into the NVM buffer will - * not be written until a separate write command is issued. If disabled, - * writing to the last byte in the NVM page buffer will trigger an automatic - * write. - * - * \note If a partial page is to be written, a manual write command must be - * executed in either mode. - */ - bool manual_page_write; - /** Number of wait states to insert when reading from flash, to prevent - * invalid data from being read at high clock frequencies - */ - uint8_t wait_states; - - /** - * Setting this to true will disable the pre-fetch cache in front of the - * NVM controller - */ - bool disable_cache; -#if (SAMC20) || (SAMC21) - /** - * Setting this to true will disable the pre-fetch RWW cache in front of the - * NVM controller. - * If RWW cache is enabled, NVM cache will also be enabled. - */ - bool disable_rww_cache; -#endif - /** - * Select the mode for how the cache will pre-fetch data from the flash - */ - enum nvm_cache_readmode cache_readmode; -}; - -/** - * \brief NVM memory parameter structure. - * - * Structure containing the memory layout parameters of the NVM module. - */ -struct nvm_parameters { - /** Number of bytes per page */ - uint8_t page_size; - /** Number of pages in the main array */ - uint16_t nvm_number_of_pages; - /** Size of the emulated EEPROM memory section configured in the NVM - * auxiliary memory space */ - uint32_t eeprom_number_of_pages; - /** Size of the Bootloader memory section configured in the NVM auxiliary - * memory space */ - uint32_t bootloader_number_of_pages; -#ifdef FEATURE_NVM_RWWEE - /** Number of pages in read while write EEPROM (RWWEE) emulation area */ - uint16_t rww_eeprom_number_of_pages; -#endif -}; - -/** - * \brief Bootloader size. - * - * Available bootloader protection sizes in kilobytes. - * - */ -enum nvm_bootloader_size { - /** Boot Loader Size is 32768 bytes */ - NVM_BOOTLOADER_SIZE_128, - /** Boot Loader Size is 16384 bytes */ - NVM_BOOTLOADER_SIZE_64, - /** Boot Loader Size is 8192 bytes */ - NVM_BOOTLOADER_SIZE_32, - /** Boot Loader Size is 4096 bytes */ - NVM_BOOTLOADER_SIZE_16, - /** Boot Loader Size is 2048 bytes */ - NVM_BOOTLOADER_SIZE_8, - /** Boot Loader Size is 1024 bytes */ - NVM_BOOTLOADER_SIZE_4, - /** Boot Loader Size is 512 bytes */ - NVM_BOOTLOADER_SIZE_2, - /** Boot Loader Size is 0 bytes */ - NVM_BOOTLOADER_SIZE_0, -}; - -/** - * \brief EEPROM emulator size. - * - * Available space in flash dedicated for EEPROM emulator in bytes. - * - */ -enum nvm_eeprom_emulator_size { - /** EEPROM Size for EEPROM emulation is 16384 bytes */ - NVM_EEPROM_EMULATOR_SIZE_16384, - /** EEPROM Size for EEPROM emulation is 8192 bytes */ - NVM_EEPROM_EMULATOR_SIZE_8192, - /** EEPROM Size for EEPROM emulation is 4096 bytes */ - NVM_EEPROM_EMULATOR_SIZE_4096, - /** EEPROM Size for EEPROM emulation is 2048 bytes */ - NVM_EEPROM_EMULATOR_SIZE_2048, - /** EEPROM Size for EEPROM emulation is 1024 bytes */ - NVM_EEPROM_EMULATOR_SIZE_1024, - /** EEPROM Size for EEPROM emulation is 512 bytes */ - NVM_EEPROM_EMULATOR_SIZE_512, - /** EEPROM Size for EEPROM emulation is 256 bytes */ - NVM_EEPROM_EMULATOR_SIZE_256, - /** EEPROM Size for EEPROM emulation is 0 bytes */ - NVM_EEPROM_EMULATOR_SIZE_0, -}; - -/** - * \brief BOD33 Action. - * - * What action should be triggered when BOD33 is detected. - * - */ -enum nvm_bod33_action { - /** No action */ - NVM_BOD33_ACTION_NONE, - /** The BOD33 generates a reset */ - NVM_BOD33_ACTION_RESET, - /** The BOD33 generates an interrupt */ - NVM_BOD33_ACTION_INTERRUPT, -}; - -#ifdef FEATURE_BOD12 -/** - * \brief BOD12 Action. - * - * What action should be triggered when BOD12 is detected. - * - */ -enum nvm_bod12_action { - /** No action */ - NVM_BOD12_ACTION_NONE, - /** The BOD12 generates a reset */ - NVM_BOD12_ACTION_RESET, - /** The BOD12 generates an interrupt */ - NVM_BOD12_ACTION_INTERRUPT, -}; -#endif - -/** - * \brief WDT Window time-out period. - * - * Window mode time-out period in clock cycles. - * - */ -enum nvm_wdt_window_timeout { - /** 8 clock cycles */ - NVM_WDT_WINDOW_TIMEOUT_PERIOD_8, - /** 16 clock cycles */ - NVM_WDT_WINDOW_TIMEOUT_PERIOD_16, - /** 32 clock cycles */ - NVM_WDT_WINDOW_TIMEOUT_PERIOD_32, - /** 64 clock cycles */ - NVM_WDT_WINDOW_TIMEOUT_PERIOD_64, - /** 128 clock cycles */ - NVM_WDT_WINDOW_TIMEOUT_PERIOD_128, - /** 256 clock cycles */ - NVM_WDT_WINDOW_TIMEOUT_PERIOD_256, - /** 512 clock cycles */ - NVM_WDT_WINDOW_TIMEOUT_PERIOD_512, - /** 1024 clock cycles */ - NVM_WDT_WINDOW_TIMEOUT_PERIOD_1024, - /** 2048 clock cycles */ - NVM_WDT_WINDOW_TIMEOUT_PERIOD_2048, - /** 4096 clock cycles */ - NVM_WDT_WINDOW_TIMEOUT_PERIOD_4096, - /** 8192 clock cycles */ - NVM_WDT_WINDOW_TIMEOUT_PERIOD_8192, - /** 16384 clock cycles */ - NVM_WDT_WINDOW_TIMEOUT_PERIOD_16384, -}; - -/** - * \brief WDT Early warning offset. - * - * This setting determine how many GCLK_WDT cycles before a watchdog time-out period - * an early warning interrupt should be triggered. - * - */ -enum nvm_wdt_early_warning_offset { - /** 8 clock cycles */ - NVM_WDT_EARLY_WARNING_OFFSET_8, - /** 16 clock cycles */ - NVM_WDT_EARLY_WARNING_OFFSET_16, - /** 32 clock cycles */ - NVM_WDT_EARLY_WARNING_OFFSET_32, - /** 64 clock cycles */ - NVM_WDT_EARLY_WARNING_OFFSET_64, - /** 128 clock cycles */ - NVM_WDT_EARLY_WARNING_OFFSET_128, - /** 256 clock cycles */ - NVM_WDT_EARLY_WARNING_OFFSET_256, - /** 512 clock cycles */ - NVM_WDT_EARLY_WARNING_OFFSET_512, - /** 1024 clock cycles */ - NVM_WDT_EARLY_WARNING_OFFSET_1024, - /** 2048 clock cycles */ - NVM_WDT_EARLY_WARNING_OFFSET_2048, - /** 4096 clock cycles */ - NVM_WDT_EARLY_WARNING_OFFSET_4096, - /** 8192 clock cycles */ - NVM_WDT_EARLY_WARNING_OFFSET_8192, - /** 16384 clock cycles */ - NVM_WDT_EARLY_WARNING_OFFSET_16384, -}; - -/** - * \brief NVM user row fuse setting structure. - * - * This structure contain the layout of the first 64 bits of the user row - * which contain the fuse settings. - */ -struct nvm_fusebits { - /** Bootloader size */ - enum nvm_bootloader_size bootloader_size; - /** EEPROM emulation area size */ - enum nvm_eeprom_emulator_size eeprom_size; -#if (SAMC20) || (SAMC21) - /** BODVDD Threshold level at power on */ - uint8_t bodvdd_level; - /** BODVDD Enable at power on */ - bool bodvdd_enable; - /** BODVDD Action at power on */ - enum nvm_bod33_action bodvdd_action; - /* BODVDD Hysteresis at power on */ - bool bodvdd_hysteresis; -#else - /** BOD33 Threshold level at power on */ - uint8_t bod33_level; - /** BOD33 Enable at power on */ - bool bod33_enable; - /** BOD33 Action at power on */ - enum nvm_bod33_action bod33_action; - /* BOD33 Hysteresis at power on */ - bool bod33_hysteresis; -#endif - /** WDT Enable at power on */ - bool wdt_enable; - /** WDT Always-on at power on */ - bool wdt_always_on; - /** WDT Period at power on */ - uint8_t wdt_timeout_period; - /** WDT Window mode time-out at power on */ - enum nvm_wdt_window_timeout wdt_window_timeout; - /** WDT Early warning interrupt time offset at power on */ - enum nvm_wdt_early_warning_offset wdt_early_warning_offset; - /** WDT Window mode enabled at power on */ - bool wdt_window_mode_enable_at_poweron; - /** NVM Lock bits */ - uint16_t lockbits; -#ifdef FEATURE_BOD12 - /** BOD12 Threshold level at power on */ - uint8_t bod12_level; - /** BOD12 Enable at power on */ - bool bod12_enable; - /** BOD12 Action at power on */ - enum nvm_bod12_action bod12_action; - /* BOD12 Hysteresis at power on */ - bool bod12_hysteresis; -#endif -}; - -/** - * \name Configuration and Initialization - * @{ - */ - -/** - * \brief Initializes an NVM controller configuration structure to defaults. - * - * Initializes a given NVM controller configuration structure to a set of - * known default values. This function should be called on all new - * instances of these configuration structures before being modified by the - * user application. - * - * The default configuration is as follows: - * \li Power reduction mode enabled after sleep mode until first NVM access - * \li Automatic page write mode disabled - * \li Number of FLASH wait states left unchanged - * - * \param[out] config Configuration structure to initialize to default values - * - */ -static inline void nvm_get_config_defaults( - struct nvm_config *const config) -{ - /* Sanity check the parameters */ - Assert(config); - - /* Write the default configuration for the NVM configuration */ - config->sleep_power_mode = NVM_SLEEP_POWER_MODE_WAKEONACCESS; - config->manual_page_write = true; - config->wait_states = NVMCTRL->CTRLB.bit.RWS; - config->disable_cache = false; -#if (SAMC20) || (SAMC21) - config->disable_rww_cache = false; -#endif - config->cache_readmode = NVM_CACHE_READMODE_NO_MISS_PENALTY; -} - -enum status_code nvm_set_config( - const struct nvm_config *const config); - -/** - * \brief Checks if the NVM controller is ready to accept a new command. - * - * Checks the NVM controller to determine if it is currently busy execution an - * operation, or ready for a new command. - * - * \return Busy state of the NVM controller. - * - * \retval true If the hardware module is ready for a new command - * \retval false If the hardware module is busy executing a command - * - */ -static inline bool nvm_is_ready(void) -{ - /* Get a pointer to the module hardware instance */ - Nvmctrl *const nvm_module = NVMCTRL; - - return nvm_module->INTFLAG.reg & NVMCTRL_INTFLAG_READY; -} - -/** @} */ - -/** - * \name NVM Access Management - * @{ - */ - -void nvm_get_parameters( - struct nvm_parameters *const parameters); - -enum status_code nvm_write_buffer( - const uint32_t destination_address, - const uint8_t *buffer, - uint16_t length); - -enum status_code nvm_read_buffer( - const uint32_t source_address, - uint8_t *const buffer, - uint16_t length); - -enum status_code nvm_update_buffer( - const uint32_t destination_address, - uint8_t *const buffer, - uint16_t offset, - uint16_t length); - -enum status_code nvm_erase_row( - const uint32_t row_address); - -enum status_code nvm_execute_command( - const enum nvm_command command, - const uint32_t address, - const uint32_t parameter); - -enum status_code nvm_get_fuses(struct nvm_fusebits *fusebits); -enum status_code nvm_set_fuses(struct nvm_fusebits *fb); - -bool nvm_is_page_locked(uint16_t page_number); - -/** - * \brief Retrieves the error code of the last issued NVM operation. - * - * Retrieves the error code from the last executed NVM operation. Once - * retrieved, any error state flags in the controller are cleared. - * - * \note The \ref nvm_is_ready() function is an exception. Thus, errors - * retrieved after running this function should be valid for the function - * executed before \ref nvm_is_ready(). - * - * \return Error caused by the last NVM operation. - * - * \retval NVM_ERROR_NONE No error occurred in the last NVM operation - * - * \retval NVM_ERROR_LOCK The last NVM operation attempted to access a locked - * region - * \retval NVM_ERROR_PROG An invalid NVM command was issued - */ -static inline enum nvm_error nvm_get_error(void) -{ - enum nvm_error ret_val; - - /* Get a pointer to the module hardware instance */ - Nvmctrl *const nvm_module = NVMCTRL; - - /* Mask out non-error bits */ - ret_val = (enum nvm_error)(nvm_module->STATUS.reg & NVM_ERRORS_MASK); - - /* Clear error flags */ - nvm_module->STATUS.reg = NVM_ERRORS_MASK; - - /* Return error code from the NVM controller */ - return ret_val; -} - -/** @} */ - -#ifdef __cplusplus -} -#endif - -/** @} */ - -/** - * \page asfdoc_sam0_nvm_extra Extra Information for NVM Driver - * - * \section asfdoc_sam0_nvm_extra_acronyms Acronyms - * The table below presents the acronyms used in this module: - * - * <table> - * <tr> - * <th>Acronym</th> - * <th>Description</th> - * </tr> - * <tr> - * <td>NVM</td> - * <td>Non-Volatile Memory</td> - * </tr> - * <tr> - * <td>EEPROM</td> - * <td>Electrically Erasable Programmable Read-Only Memory</td> - * </tr> - * </table> - * - * - * \section asfdoc_sam0_nvm_extra_dependencies Dependencies - * This driver has the following dependencies: - * - * - None - * - * - * \section asfdoc_sam0_nvm_extra_errata Errata - * There are no errata related to this driver. - * - * - * \section asfdoc_sam0_nvm_extra_history Module History - * An overview of the module history is presented in the table below, with - * details on the enhancements and fixes made to the module since its first - * release. The current version of this corresponds to the newest version in - * the table. - * - * <table> - * <tr> - * <th>Changelog</th> - * </tr> - * <tr> - * <td>Removed BOD12 reference, removed nvm_set_fuses() API</td> - * </tr> - * <tr> - * <td>Added functions to read/write fuse settings</td> - * </tr> - * <tr> - * <td>Added support for NVM cache configuration</td> - * </tr> - * <tr> - * <td>Updated initialization function to also enable the digital interface - * clock to the module if it is disabled</td> - * </tr> - * <tr> - * <td>Initial Release</td> - * </tr> - * </table> - */ - -/** - * \page asfdoc_sam0_nvm_exqsg Examples for NVM Driver - * - * This is a list of the available Quick Start guides (QSGs) and example - * applications for \ref asfdoc_sam0_nvm_group. QSGs are simple examples with - * step-by-step instructions to configure and use this driver in a selection of - * use cases. Note that a QSG can be compiled as a standalone application or be - * added to the user application. - * - * - \subpage asfdoc_sam0_nvm_basic_use_case - * - * \page asfdoc_sam0_nvm_document_revision_history Document Revision History - * - * <table> - * <tr> - * <th>Doc. Rev.</th> - * <th>Date</th> - * <th>Comments</th> - * </tr> - * <tr> - * <td>42114E</td> - * <td>12/2015</td> - * <td>Added support for SAM L21/L22, SAM C21, SAM D09, SAMR30 and SAM DA1</td> - * </tr> - * <tr> - * <td>42114D</td> - * <td>12/2014</td> - * <td>Added support for SAM R21 and SAM D10/D11</td> - * </tr> - * <tr> - * <td>42114C</td> - * <td>01/2014</td> - * <td>Added support for SAM D21</td> - * </tr> - * <tr> - * <td>42114B</td> - * <td>06/2013</td> - * <td>Corrected documentation typos</td> - * </tr> - * <tr> - * <td>42114A</td> - * <td>06/2013</td> - * <td>Initial document release</td> - * </tr> - * </table> - */ - -#endif /* NVM_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/port/port.c b/atmel-samd/asf/sam0/drivers/port/port.c deleted file mode 100644 index 64787c6e5..000000000 --- a/atmel-samd/asf/sam0/drivers/port/port.c +++ /dev/null @@ -1,109 +0,0 @@ -/** - * \file - * - * \brief SAM GPIO Port Driver - * - * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#include <port.h> - -/** - * \brief Writes a Port pin configuration to the hardware module. - * - * Writes out a given configuration of a Port pin configuration to the hardware - * module. - * - * \note If the pin direction is set as an output, the pull-up/pull-down input - * configuration setting is ignored. - * - * \param[in] gpio_pin Index of the GPIO pin to configure - * \param[in] config Configuration settings for the pin - */ -void port_pin_set_config( - const uint8_t gpio_pin, - const struct port_config *const config) -{ - /* Sanity check arguments */ - Assert(config); - - struct system_pinmux_config pinmux_config; - system_pinmux_get_config_defaults(&pinmux_config); - - pinmux_config.mux_position = SYSTEM_PINMUX_GPIO; - pinmux_config.direction = (enum system_pinmux_pin_dir)config->direction; - pinmux_config.input_pull = (enum system_pinmux_pin_pull)config->input_pull; - pinmux_config.powersave = config->powersave; - - system_pinmux_pin_set_config(gpio_pin, &pinmux_config); -} - -/** - * \brief Writes a Port group configuration group to the hardware module. - * - * Writes out a given configuration of a Port group configuration to the - * hardware module. - * - * \note If the pin direction is set as an output, the pull-up/pull-down input - * configuration setting is ignored. - * - * \param[out] port Base of the PORT module to write to - * \param[in] mask Mask of the port pin(s) to configure - * \param[in] config Configuration settings for the pin group - */ -void port_group_set_config( - PortGroup *const port, - const uint32_t mask, - const struct port_config *const config) -{ - /* Sanity check arguments */ - Assert(port); - Assert(config); - - struct system_pinmux_config pinmux_config; - system_pinmux_get_config_defaults(&pinmux_config); - - pinmux_config.mux_position = SYSTEM_PINMUX_GPIO; - pinmux_config.direction = (enum system_pinmux_pin_dir)config->direction; - pinmux_config.input_pull = (enum system_pinmux_pin_pull)config->input_pull; - pinmux_config.powersave = config->powersave; - - system_pinmux_group_set_config(port, mask, &pinmux_config); -} diff --git a/atmel-samd/asf/sam0/drivers/port/port.h b/atmel-samd/asf/sam0/drivers/port/port.h deleted file mode 100644 index d52714f6c..000000000 --- a/atmel-samd/asf/sam0/drivers/port/port.h +++ /dev/null @@ -1,792 +0,0 @@ -/** - * \file - * - * \brief SAM GPIO Port Driver - * - * Copyright (C) 2012-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef PORT_H_INCLUDED -#define PORT_H_INCLUDED - -/** - * \defgroup asfdoc_sam0_port_group SAM Port (PORT) Driver - * - * This driver for Atmel® | SMART ARM®-based microcontrollers provides - * an interface for the configuration and management of the device's General - * Purpose Input/Output (GPIO) pin functionality, for manual pin state reading - * and writing. - * - * The following peripheral is used by this module: - * - PORT (GPIO Management) - * - * The following devices can use this module: - * - Atmel | SMART SAM D20/D21 - * - Atmel | SMART SAM R21 - * - Atmel | SMART SAM D09/D10/D11 - * - Atmel | SMART SAM L21/L22 - * - Atmel | SMART SAM DA1 - * - Atmel | SMART SAM C20/C21 - * - Atmel | SMART SAM R30 - * - * The outline of this documentation is as follows: - * - \ref asfdoc_sam0_port_prerequisites - * - \ref asfdoc_sam0_port_module_overview - * - \ref asfdoc_sam0_port_special_considerations - * - \ref asfdoc_sam0_port_extra_info - * - \ref asfdoc_sam0_port_examples - * - \ref asfdoc_sam0_port_api_overview - * - * - * \section asfdoc_sam0_port_prerequisites Prerequisites - * - * There are no prerequisites for this module. - * - * - * \section asfdoc_sam0_port_module_overview Module Overview - * - * The device GPIO (PORT) module provides an interface between the user - * application logic and external hardware peripherals, when general pin state - * manipulation is required. This driver provides an easy-to-use interface to - * the physical pin input samplers and output drivers, so that pins can be read - * from or written to for general purpose external hardware control. - * - * \subsection asfdoc_sam0_port_features Driver Feature Macro Definition - * <table> - * <tr> - * <th>Driver Feature Macro</th> - * <th>Supported devices</th> - * </tr> - * <tr> - * <td>FEATURE_PORT_INPUT_EVENT</td> - * <td>SAM L21/L22/C20/C21/R30</td> - * </tr> - * </table> - * \note The specific features are only available in the driver when the - * selected device supports those features. - * - * \subsection asfdoc_sam0_port_module_overview_pin_numbering Physical and Logical GPIO Pins - * SAM devices use two naming conventions for the I/O pins in the device; one - * physical and one logical. Each physical pin on a device package is assigned - * both a physical port and pin identifier (e.g. "PORTA.0") as well as a - * monotonically incrementing logical GPIO number (e.g. "GPIO0"). While the - * former is used to map physical pins to their physical internal device module - * counterparts, for simplicity the design of this driver uses the logical GPIO - * numbers instead. - * - * \subsection asfdoc_sam0_port_module_overview_physical Physical Connection - * - * \ref asfdoc_sam0_port_module_int_connections "The diagram below" shows how - * this module is interconnected within the device. - * - * \anchor asfdoc_sam0_port_module_int_connections - * \dot - * digraph overview { - * node [label="Port Pad" shape=square] pad; - * - * subgraph driver { - * node [label="Peripheral MUX" shape=trapezium] pinmux; - * node [label="GPIO Module" shape=ellipse] gpio; - * node [label="Other Peripheral Modules" shape=ellipse style=filled fillcolor=lightgray] peripherals; - * } - * - * pinmux -> gpio; - * pad -> pinmux; - * pinmux -> peripherals; - * } - * \enddot - * - * - * \section asfdoc_sam0_port_special_considerations Special Considerations - * - * The SAM port pin input sampler can be disabled when the pin is configured - * in pure output mode to save power; reading the pin state of a pin configured - * in output-only mode will read the logical output state that was last set. - * - * \section asfdoc_sam0_port_extra_info Extra Information - * - * For extra information, see \ref asfdoc_sam0_port_extra. This includes: - * - \ref asfdoc_sam0_port_extra_acronyms - * - \ref asfdoc_sam0_port_extra_dependencies - * - \ref asfdoc_sam0_port_extra_errata - * - \ref asfdoc_sam0_port_extra_history - * - * - * \section asfdoc_sam0_port_examples Examples - * - * For a list of examples related to this driver, see - * \ref asfdoc_sam0_port_exqsg. - * - * - * \section asfdoc_sam0_port_api_overview API Overview - * @{ - */ - -#include <compiler.h> -#include <pinmux.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \name Driver Feature Definition - * Define port features set according to different device family. - * @{ -*/ -#if (SAML21) || (SAML22) || (SAMC20) || (SAMC21) || (SAMR30) || defined(__DOXYGEN__) -/** Event input control feature support for PORT group. */ -# define FEATURE_PORT_INPUT_EVENT -#endif -/*@}*/ - -/** \name PORT Alias Macros - * @{ - */ - -/** Convenience definition for GPIO module group A on the device (if - * available). */ -#if (PORT_GROUPS > 0) || defined(__DOXYGEN__) -# define PORTA PORT->Group[0] -#endif - -#if (PORT_GROUPS > 1) || defined(__DOXYGEN__) -/** Convenience definition for GPIO module group B on the device (if - * available). */ -# define PORTB PORT->Group[1] -#endif - -#if (PORT_GROUPS > 2) || defined(__DOXYGEN__) -/** Convenience definition for GPIO module group C on the device (if - * available). */ -# define PORTC PORT->Group[2] -#endif - -#if (PORT_GROUPS > 3) || defined(__DOXYGEN__) -/** Convenience definition for GPIO module group D on the device (if - * available). */ -# define PORTD PORT->Group[3] -#endif - -/** @} */ - -/** - * \brief Port pin direction configuration enum. - * - * Enum for the possible pin direction settings of the port pin configuration - * structure, to indicate the direction the pin should use. - */ -enum port_pin_dir { - /** The pin's input buffer should be enabled, so that the pin state can - * be read */ - PORT_PIN_DIR_INPUT = SYSTEM_PINMUX_PIN_DIR_INPUT, - /** The pin's output buffer should be enabled, so that the pin state can - * be set */ - PORT_PIN_DIR_OUTPUT = SYSTEM_PINMUX_PIN_DIR_OUTPUT, - /** The pin's output and input buffers should be enabled, so that the pin - * state can be set and read back */ - PORT_PIN_DIR_OUTPUT_WTH_READBACK = SYSTEM_PINMUX_PIN_DIR_OUTPUT_WITH_READBACK, -}; - -/** - * \brief Port pin input pull configuration enum. - * - * Enum for the possible pin pull settings of the port pin configuration - * structure, to indicate the type of logic level pull the pin should use. - */ -enum port_pin_pull { - /** No logical pull should be applied to the pin */ - PORT_PIN_PULL_NONE = SYSTEM_PINMUX_PIN_PULL_NONE, - /** Pin should be pulled up when idle */ - PORT_PIN_PULL_UP = SYSTEM_PINMUX_PIN_PULL_UP, - /** Pin should be pulled down when idle */ - PORT_PIN_PULL_DOWN = SYSTEM_PINMUX_PIN_PULL_DOWN, -}; - -#ifdef FEATURE_PORT_INPUT_EVENT -/** - * \brief Port input event action. - * - * List of port input events action on pin. - */ -enum port_input_event_action { - /** Event out to pin */ - PORT_INPUT_EVENT_ACTION_OUT = 0, - /** Set output register of pin on event */ - PORT_INPUT_EVENT_ACTION_SET, - /** Clear output register pin on event */ - PORT_INPUT_EVENT_ACTION_CLR, - /** Toggle output register pin on event */ - PORT_INPUT_EVENT_ACTION_TGL, -}; - -/** - * \brief Port input event. - * - * List of port input events. - */ -enum port_input_event{ - /** Port input event 0 */ - PORT_INPUT_EVENT_0 = 0, - /** Port input event 1 */ - PORT_INPUT_EVENT_1 = 1, - /** Port input event 2 */ - PORT_INPUT_EVENT_2 = 2, - /** Port input event 3 */ - PORT_INPUT_EVENT_3 = 3, -}; - -/** - * \brief Port input event configuration structure. - * - * Configuration structure for a port input event. - */ -struct port_input_event_config{ - /** Port input event action */ - enum port_input_event_action action; - /** GPIO pin */ - uint8_t gpio_pin; -}; -#endif - -/** - * \brief Port pin configuration structure. - * - * Configuration structure for a port pin instance. This structure should be - * initialized by the \ref port_get_config_defaults() function before being - * modified by the user application. - */ -struct port_config { - /** Port buffer input/output direction */ - enum port_pin_dir direction; - - /** Port pull-up/pull-down for input pins */ - enum port_pin_pull input_pull; - - /** Enable lowest possible powerstate on the pin - * - * \note All other configurations will be ignored, the pin will be disabled. - */ - bool powersave; -}; - -/** \name State Reading/Writing (Physical Group Orientated) - * @{ - */ - -/** - * \brief Retrieves the PORT module group instance from a given GPIO pin number. - * - * Retrieves the PORT module group instance associated with a given logical - * GPIO pin number. - * - * \param[in] gpio_pin Index of the GPIO pin to convert - * - * \return Base address of the associated PORT module. - */ -static inline PortGroup* port_get_group_from_gpio_pin( - const uint8_t gpio_pin) -{ - return system_pinmux_get_group_from_gpio_pin(gpio_pin); -} - -/** - * \brief Retrieves the state of a group of port pins that are configured as inputs. - * - * Reads the current logic level of a port module's pins and returns the - * current levels as a bitmask. - * - * \param[in] port Base of the PORT module to read from - * \param[in] mask Mask of the port pin(s) to read - * - * \return Status of the port pin(s) input buffers. - */ -static inline uint32_t port_group_get_input_level( - const PortGroup *const port, - const uint32_t mask) -{ - /* Sanity check arguments */ - Assert(port); - - return (port->IN.reg & mask); -} - -/** - * \brief Retrieves the state of a group of port pins that are configured as outputs. - * - * Reads the current logical output level of a port module's pins and returns - * the current levels as a bitmask. - * - * \param[in] port Base of the PORT module to read from - * \param[in] mask Mask of the port pin(s) to read - * - * \return Status of the port pin(s) output buffers. - */ -static inline uint32_t port_group_get_output_level( - const PortGroup *const port, - const uint32_t mask) -{ - /* Sanity check arguments */ - Assert(port); - - return (port->OUT.reg & mask); -} - -/** - * \brief Sets the state of a group of port pins that are configured as outputs. - * - * Sets the current output level of a port module's pins to a given logic - * level. - * - * \param[out] port Base of the PORT module to write to - * \param[in] mask Mask of the port pin(s) to change - * \param[in] level_mask Mask of the port level(s) to set - */ -static inline void port_group_set_output_level( - PortGroup *const port, - const uint32_t mask, - const uint32_t level_mask) -{ - /* Sanity check arguments */ - Assert(port); - - port->OUTSET.reg = (mask & level_mask); - port->OUTCLR.reg = (mask & ~level_mask); -} - -/** - * \brief Toggles the state of a group of port pins that are configured as an outputs. - * - * Toggles the current output levels of a port module's pins. - * - * \param[out] port Base of the PORT module to write to - * \param[in] mask Mask of the port pin(s) to toggle - */ -static inline void port_group_toggle_output_level( - PortGroup *const port, - const uint32_t mask) -{ - /* Sanity check arguments */ - Assert(port); - - port->OUTTGL.reg = mask; -} - -/** @} */ - -/** \name Configuration and Initialization - * @{ - */ - -/** - * \brief Initializes a Port pin/group configuration structure to defaults. - * - * Initializes a given Port pin/group configuration structure to a set of - * known default values. This function should be called on all new - * instances of these configuration structures before being modified by the - * user application. - * - * The default configuration is as follows: - * \li Input mode with internal pull-up enabled - * - * \param[out] config Configuration structure to initialize to default values - */ -static inline void port_get_config_defaults( - struct port_config *const config) -{ - /* Sanity check arguments */ - Assert(config); - - /* Default configuration values */ - config->direction = PORT_PIN_DIR_INPUT; - config->input_pull = PORT_PIN_PULL_UP; - config->powersave = false; -} - -void port_pin_set_config( - const uint8_t gpio_pin, - const struct port_config *const config); - -void port_group_set_config( - PortGroup *const port, - const uint32_t mask, - const struct port_config *const config); - -/** @} */ - -/** \name State Reading/Writing (Logical Pin Orientated) - * @{ - */ - -/** - * \brief Retrieves the state of a port pin that is configured as an input. - * - * Reads the current logic level of a port pin and returns the current - * level as a Boolean value. - * - * \param[in] gpio_pin Index of the GPIO pin to read - * - * \return Status of the port pin's input buffer. - */ -static inline bool port_pin_get_input_level( - const uint8_t gpio_pin) -{ - PortGroup *const port_base = port_get_group_from_gpio_pin(gpio_pin); - uint32_t pin_mask = (1UL << (gpio_pin % 32)); - - return (port_base->IN.reg & pin_mask); -} - -/** - * \brief Retrieves the state of a port pin that is configured as an output. - * - * Reads the current logical output level of a port pin and returns the current - * level as a Boolean value. - * - * \param[in] gpio_pin Index of the GPIO pin to read - * - * \return Status of the port pin's output buffer. - */ -static inline bool port_pin_get_output_level( - const uint8_t gpio_pin) -{ - PortGroup *const port_base = port_get_group_from_gpio_pin(gpio_pin); - uint32_t pin_mask = (1UL << (gpio_pin % 32)); - - return (port_base->OUT.reg & pin_mask); -} - -/** - * \brief Sets the state of a port pin that is configured as an output. - * - * Sets the current output level of a port pin to a given logic level. - * - * \param[in] gpio_pin Index of the GPIO pin to write to - * \param[in] level Logical level to set the given pin to - */ -static inline void port_pin_set_output_level( - const uint8_t gpio_pin, - const bool level) -{ - PortGroup *const port_base = port_get_group_from_gpio_pin(gpio_pin); - uint32_t pin_mask = (1UL << (gpio_pin % 32)); - - /* Set the pin to high or low atomically based on the requested level */ - if (level) { - port_base->OUTSET.reg = pin_mask; - } else { - port_base->OUTCLR.reg = pin_mask; - } -} - -/** - * \brief Toggles the state of a port pin that is configured as an output. - * - * Toggles the current output level of a port pin. - * - * \param[in] gpio_pin Index of the GPIO pin to toggle - */ -static inline void port_pin_toggle_output_level( - const uint8_t gpio_pin) -{ - PortGroup *const port_base = port_get_group_from_gpio_pin(gpio_pin); - uint32_t pin_mask = (1UL << (gpio_pin % 32)); - - /* Toggle pin output level */ - port_base->OUTTGL.reg = pin_mask; -} - -/** @} */ - -#ifdef FEATURE_PORT_INPUT_EVENT - -/** \name Port Input Event - * @{ - */ - -/** - * \brief Enable the port event input. - * - * Enable the port event input with the given pin and event. - * - * \param[in] gpio_pin Index of the GPIO pin - * \param[in] n Port input event - * - * \retval STATUS_ERR_INVALID_ARG Invalid parameter - * \retval STATUS_OK Successfully - */ -static inline enum status_code port_enable_input_event( - const uint8_t gpio_pin, - const enum port_input_event n) -{ - PortGroup *const port_base = port_get_group_from_gpio_pin(gpio_pin); - switch (n) { - case PORT_INPUT_EVENT_0: - port_base->EVCTRL.reg |= PORT_EVCTRL_PORTEI0; - break; - case PORT_INPUT_EVENT_1: - port_base->EVCTRL.reg |= PORT_EVCTRL_PORTEI1; - break; - case PORT_INPUT_EVENT_2: - port_base->EVCTRL.reg |= PORT_EVCTRL_PORTEI2; - break; - case PORT_INPUT_EVENT_3: - port_base->EVCTRL.reg |= PORT_EVCTRL_PORTEI3; - break; - default: - Assert(false); - return STATUS_ERR_INVALID_ARG; - } - return STATUS_OK; -} - -/** - * \brief Disable the port event input. - * - * Disable the port event input with the given pin and event. - * - * \param[in] gpio_pin Index of the GPIO pin - * \param[in] gpio_pin Port input event - * - * \retval STATUS_ERR_INVALID_ARG Invalid parameter - * \retval STATUS_OK Successfully - */ -static inline enum status_code port_disable_input_event( - const uint8_t gpio_pin, - const enum port_input_event n) -{ - PortGroup *const port_base = port_get_group_from_gpio_pin(gpio_pin); - switch (n) { - case PORT_INPUT_EVENT_0: - port_base->EVCTRL.reg &= ~PORT_EVCTRL_PORTEI0; - break; - case PORT_INPUT_EVENT_1: - port_base->EVCTRL.reg &= ~PORT_EVCTRL_PORTEI1; - break; - case PORT_INPUT_EVENT_2: - port_base->EVCTRL.reg &= ~PORT_EVCTRL_PORTEI2; - break; - case PORT_INPUT_EVENT_3: - port_base->EVCTRL.reg &= ~PORT_EVCTRL_PORTEI3; - break; - default: - Assert(false); - return STATUS_ERR_INVALID_ARG; - } - return STATUS_OK; -} - -/** - * \brief Retrieve the default configuration for port input event. - * - * Fills a configuration structure with the default configuration for port input event: - * - Event output to pin - * - Event action to be executed on PIN 0 - * - * \param[out] config Configuration structure to fill with default values - */ -static inline void port_input_event_get_config_defaults( - struct port_input_event_config *const config) -{ - Assert(config); - config->action = PORT_INPUT_EVENT_ACTION_OUT; - config->gpio_pin = 0; -} - -/** - * \brief Configure port input event. - * - * Configures port input event with the given configuration settings. - * - * \param[in] config Port input even configuration structure containing the new config - * - * \retval STATUS_ERR_INVALID_ARG Invalid parameter - * \retval STATUS_OK Successfully - */ - -static inline enum status_code port_input_event_set_config( - const enum port_input_event n, - struct port_input_event_config *const config) -{ - Assert(config); - PortGroup *const port_base = port_get_group_from_gpio_pin(config->gpio_pin); - uint8_t pin_index = config->gpio_pin % 32; - struct port_config pin_conf; - - port_get_config_defaults(&pin_conf); - /* Configure the GPIO pin as outputs*/ - pin_conf.direction = PORT_PIN_DIR_OUTPUT; - port_pin_set_config(config->gpio_pin, &pin_conf); - - switch (n) { - case PORT_INPUT_EVENT_0: - port_base->EVCTRL.reg |= PORT_EVCTRL_EVACT0(config->action) - | PORT_EVCTRL_PID0(pin_index); - break; - case PORT_INPUT_EVENT_1: - port_base->EVCTRL.reg |= PORT_EVCTRL_EVACT1(config->action) - | PORT_EVCTRL_PID1(pin_index); - break; - case PORT_INPUT_EVENT_2: - port_base->EVCTRL.reg |= PORT_EVCTRL_EVACT2(config->action) - | PORT_EVCTRL_PID2(pin_index); - break; - case PORT_INPUT_EVENT_3: - port_base->EVCTRL.reg |= PORT_EVCTRL_EVACT3(config->action) - | PORT_EVCTRL_PID3(pin_index); - break; - default: - Assert(false); - return STATUS_ERR_INVALID_ARG; - } - return STATUS_OK; -} - -/** @} */ - -#endif - -#ifdef __cplusplus -} -#endif - -/** @} */ - -/** - * \page asfdoc_sam0_port_extra Extra Information for PORT Driver - * - * \section asfdoc_sam0_port_extra_acronyms Acronyms - * Below is a table listing the acronyms used in this module, along with their - * intended meanings. - * - * <table> - * <tr> - * <th>Acronym</th> - * <th>Description</th> - * </tr> - * <tr> - * <td>GPIO</td> - * <td>General Purpose Input/Output</td> - * </tr> - * <tr> - * <td>MUX</td> - * <td>Multiplexer</td> - * </tr> - * </table> - * - * - * \section asfdoc_sam0_port_extra_dependencies Dependencies - * This driver has the following dependencies: - * - * - \ref asfdoc_sam0_system_pinmux_group "System Pin Multiplexer Driver" - * - * - * \section asfdoc_sam0_port_extra_errata Errata - * There are no errata related to this driver. - * - * - * \section asfdoc_sam0_port_extra_history Module History - * An overview of the module history is presented in the table below, with - * details on the enhancements and fixes made to the module since its first - * release. The current version of this corresponds to the newest version in - * the table. - * - * <table> - * <tr> - * <th>Changelog</th> - * </tr> - * <tr> - * <td>Added input event feature</td> - * </tr> - * <tr> - * <td>Initial release</td> - * </tr> - * </table> - */ - -/** - * \page asfdoc_sam0_port_exqsg Examples for PORT Driver - * - * This is a list of the available Quick Start guides (QSGs) and example - * applications for \ref asfdoc_sam0_port_group. QSGs are simple examples with - * step-by-step instructions to configure and use this driver in a selection of - * use cases. Note that a QSG can be compiled as a standalone application or be - * added to the user application. - * - * - \subpage asfdoc_sam0_port_basic_use_case - * - * \page asfdoc_sam0_port_document_revision_history Document Revision History - * - * <table> - * <tr> - * <th>Doc. Rev.</td> - * <th>Date</td> - * <th>Comments</td> - * </tr> - * <tr> - * <td>42113E</td> - * <td>12/2015</td> - * <td>Added input event feature. - * Added support for SAM L21/L22, SAM C21, SAM D09, SAMR30 and SAM DA1.</td> - * </tr> - * <tr> - * <td>42113D</td> - * <td>12/2014</td> - * <td>Added support for SAM R21 and SAM D10/D11</td> - * </tr> - * <tr> - * <td>42113C</td> - * <td>01/2014</td> - * <td>Added support for SAM D21</td> - * </tr> - * <tr> - * <td>42113B</td> - * <td>06/2013</td> - * <td>Corrected documentation typos</td> - * </tr> - * <tr> - * <td>42113A</td> - * <td>06/2013</td> - * <td>Initial document release</td> - * </tr> - * </table> - */ - -#endif diff --git a/atmel-samd/asf/sam0/drivers/sercom/i2c/docimg/bus_state_diagram.svg b/atmel-samd/asf/sam0/drivers/sercom/i2c/docimg/bus_state_diagram.svg deleted file mode 100644 index 4bd4175a0..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/i2c/docimg/bus_state_diagram.svg +++ /dev/null @@ -1,533 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> - -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - id="svg2985" - version="1.1" - inkscape:version="0.48.2 r9819" - width="380.12842" - height="320.95972" - xml:space="preserve" - sodipodi:docname="Sercom_I2C_Bus_State_State_Diagram.svg"><metadata - id="metadata2991"><rdf:RDF><cc:Work - rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs - id="defs2989"><clipPath - clipPathUnits="userSpaceOnUse" - id="clipPath3001"><path - d="m 0,762.9 612,0 0,0.53998 -612,0 L 0,762.9 z" - id="path3003" - inkscape:connector-curvature="0" /></clipPath><clipPath - clipPathUnits="userSpaceOnUse" - id="clipPath3011"><path - d="m 611.76,757.86 0.23999,0 0,5.34 -0.23999,0 0,-5.34 z" - id="path3013" - inkscape:connector-curvature="0" /></clipPath><clipPath - clipPathUnits="userSpaceOnUse" - id="clipPath3021"><path - d="m 0,757.86 612,0 0,0.54004 -612,0 0,-0.54004 z" - id="path3023" - inkscape:connector-curvature="0" /></clipPath><clipPath - clipPathUnits="userSpaceOnUse" - id="clipPath3031"><path - d="m 0,758.1 0.29999,0 0,5.34 -0.29999,0 0,-5.34 z" - id="path3033" - inkscape:connector-curvature="0" /></clipPath><clipPath - clipPathUnits="userSpaceOnUse" - id="clipPath3043"><path - d="m 0,791.7 612,0 0,0.29999 -612,0 L 0,791.7 z" - id="path3045" - inkscape:connector-curvature="0" /></clipPath><clipPath - clipPathUnits="userSpaceOnUse" - id="clipPath3053"><path - d="m 611.76,762.9 0.23999,0 0,29.1 -0.23999,0 0,-29.1 z" - id="path3055" - inkscape:connector-curvature="0" /></clipPath><clipPath - clipPathUnits="userSpaceOnUse" - id="clipPath3063"><path - d="m 0,762.9 612,0 0,0.53998 -612,0 L 0,762.9 z" - id="path3065" - inkscape:connector-curvature="0" /></clipPath><clipPath - clipPathUnits="userSpaceOnUse" - id="clipPath3073"><path - d="m 0,763.14 0.29999,0 0,28.86 L 0,792 0,763.14 z" - id="path3075" - inkscape:connector-curvature="0" /></clipPath><clipPath - clipPathUnits="userSpaceOnUse" - id="clipPath3105"><path - d="m 35.28,48.42 50.22,0 0,-12.48 -50.22,0 0,12.48 z" - clip-rule="evenodd" - id="path3107" - inkscape:connector-curvature="0" /></clipPath><clipPath - clipPathUnits="userSpaceOnUse" - id="clipPath3111"><path - d="m 0,792.03 612,0 0,-792 -612,0 0,792 z" - id="path3113" - inkscape:connector-curvature="0" /></clipPath><clipPath - clipPathUnits="userSpaceOnUse" - id="clipPath3321"><path - d="m 161.64,724.98 324.72,0 0,-271.02 -324.72,0 0,271.02 z" - clip-rule="evenodd" - id="path3323" - inkscape:connector-curvature="0" /></clipPath><clipPath - clipPathUnits="userSpaceOnUse" - id="clipPath3327"><path - d="m 109.8,726.84 428.46,0 0,-274.74 -428.46,0 0,274.74 z" - clip-rule="evenodd" - id="path3329" - inkscape:connector-curvature="0" /></clipPath><clipPath - clipPathUnits="userSpaceOnUse" - id="clipPath3333"><path - d="m 72,735.84 504,0 0,-503.76 -504,0 0,503.76 z" - clip-rule="evenodd" - id="path3335" - inkscape:connector-curvature="0" /></clipPath><clipPath - clipPathUnits="userSpaceOnUse" - id="clipPath3339"><path - d="m 0,792.03 612,0 0,-792 -612,0 0,792 z" - id="path3341" - inkscape:connector-curvature="0" /></clipPath></defs><sodipodi:namedview - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1" - objecttolerance="10" - gridtolerance="10" - guidetolerance="10" - inkscape:pageopacity="0" - inkscape:pageshadow="2" - inkscape:window-width="1230" - inkscape:window-height="873" - id="namedview2987" - showgrid="true" - inkscape:zoom="1.6066596" - inkscape:cx="241.9873" - inkscape:cy="159.0032" - inkscape:window-x="0" - inkscape:window-y="0" - inkscape:window-maximized="0" - inkscape:current-layer="g2993" - fit-margin-top="0" - fit-margin-left="0" - fit-margin-right="0" - fit-margin-bottom="0"><inkscape:grid - type="xygrid" - id="grid3962" - empspacing="5" - visible="true" - enabled="true" - snapvisiblegridlinesonly="true" /></sodipodi:namedview><g - id="g2993" - inkscape:groupmode="layer" - inkscape:label="SAMD20" - transform="matrix(1.25,0,0,-1.25,-183.91829,749.20451)"><g - transform="translate(179.56813,517.13011)" - id="g3343" - style="stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none"><path - inkscape:connector-curvature="0" - id="path3345" - style="fill:none;stroke:#000000;stroke-width:0.4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" - d="M 0,0 C 11.82,35.04 44.58,58.56 81.48,58.5" /></g><g - transform="translate(183.04813,517.07011)" - id="g3347" - style="stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none"><path - inkscape:connector-curvature="0" - id="path3349" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none" - d="M 0,0 -5.94,-8.88 -6.48,1.8 0,0" /></g><text - id="text3351" - transform="scale(0.99830575,-1.0016971)" - x="197.48271" - y="-537.51788" - style="font-size:9.60000012000000070px;-inkscape-font-specification:Arial;font-family:Arial;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%;stroke-width:0.40000001;stroke-miterlimit:4;stroke-dasharray:none" - sodipodi:linespacing="125%"><tspan - id="tspan3353" - sodipodi:role="line" - y="-537.51788" - x="197.48271 202.8923 204.69655 209.50446 211.90959 216.71907 219.12421 226.3349 230.54115 235.35063 240.16011" - style="font-size:9.60000012000000070px;font-variant:normal;font-weight:normal;font-stretch:normal;writing-mode:lr;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:Arial;-inkscape-font-specification:Arial;font-style:normal;text-anchor:start;text-align:start;line-height:125%;stroke-width:0.40000001;stroke-miterlimit:4;stroke-dasharray:none">P + Timeout</tspan></text> - -<g - transform="translate(202.96813,594.41011)" - id="g3355" - style="stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none"><path - inkscape:connector-curvature="0" - id="path3357" - style="fill:none;stroke:#000000;stroke-width:0.4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" - d="M 0,0 C 19.08,4.56 39.12,2.64 56.94,-5.46" /></g><g - transform="translate(260.62813,592.31011)" - id="g3359" - style="stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none"><path - inkscape:connector-curvature="0" - id="path3361" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none" - d="M 0,0 4.56,-6 -3,-6 0,0" /></g><text - id="text3363" - transform="scale(0.99830575,-1.0016971)" - x="223.32651" - y="-583.81927" - style="font-size:9.60000012000000070px;-inkscape-font-specification:Arial;font-family:Arial;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%;stroke-width:0.40000001;stroke-miterlimit:4;stroke-dasharray:none" - sodipodi:linespacing="125%"><tspan - id="tspan3365" - sodipodi:role="line" - y="-583.81927" - x="223.32651 229.33542 234.74501 240.1546 245.56419" - style="font-size:9.60000012000000070px;font-variant:normal;font-weight:normal;font-stretch:normal;writing-mode:lr;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:Arial;-inkscape-font-specification:Arial;font-style:normal;text-anchor:start;text-align:start;line-height:125%;stroke-width:0.40000001;stroke-miterlimit:4;stroke-dasharray:none">RESET</tspan></text> - -<g - transform="translate(251.80813,384.53011)" - id="g3367" - style="stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none"><path - inkscape:connector-curvature="0" - id="path3369" - style="fill:none;stroke:#000000;stroke-width:0.4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" - d="M 0,0 C -36.66,3.84 -66.72,30.78 -74.7,66.9" /></g><g - transform="translate(251.14813,387.89011)" - id="g3371" - style="stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none"><path - inkscape:connector-curvature="0" - id="path3373" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none" - d="M 0,0 9.9,-3.84 -0.36,-6.72 0,0" /></g><text - id="text3375" - transform="scale(0.99830575,-1.0016971)" - x="197.48271" - y="-420.29681" - style="font-size:9.60000012000000070px;-inkscape-font-specification:Arial;font-family:Arial;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%;stroke-width:0.40000001;stroke-miterlimit:4;stroke-dasharray:none" - sodipodi:linespacing="125%"><tspan - id="tspan3377" - sodipodi:role="line" - y="-420.29681" - x="197.48271 205.29744 208.30112 210.70624 213.1106 217.31683 219.72197 225.73088 231.73981 237.74872" - style="font-size:9.60000012000000070px;font-variant:normal;font-weight:normal;font-stretch:normal;writing-mode:lr;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:Arial;-inkscape-font-specification:Arial;font-style:normal;text-anchor:start;text-align:start;line-height:125%;stroke-width:0.40000001;stroke-miterlimit:4;stroke-dasharray:none">Write ADDR</tspan><tspan - id="tspan3379" - sodipodi:role="line" - y="-410.71301" - x="214.91249 217.31683 222.72643" - style="font-size:9.60000012000000070px;font-variant:normal;font-weight:normal;font-stretch:normal;writing-mode:lr;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:Arial;-inkscape-font-specification:Arial;font-style:normal;text-anchor:start;text-align:start;line-height:125%;stroke-width:0.40000001;stroke-miterlimit:4;stroke-dasharray:none">(S)</tspan></text> - -<g - transform="translate(147.22813,479.81011)" - id="g3381" - style="stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none"><path - inkscape:connector-curvature="0" - id="path3383" - style="fill:#008000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none" - d="M 0,0 C 0,15.72 12.72,28.44 28.32,28.44 43.98,28.44 56.7,15.72 56.7,0 56.7,-15.72 43.98,-28.44 28.32,-28.44 12.72,-28.44 0,-15.72 0,0" /></g><g - transform="translate(147.22813,479.81011)" - id="g3385" - style="fill:#8cc63f;stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none"><path - inkscape:connector-curvature="0" - id="path3387" - style="fill:#8cc63f;stroke:#000000;stroke-width:0.4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" - d="M 0,0 C 0,15.72 12.72,28.44 28.32,28.44 43.98,28.44 56.7,15.72 56.7,0 56.7,-15.72 43.98,-28.44 28.32,-28.44 12.72,-28.44 0,-15.72 0,0" /></g><text - id="text3389" - transform="scale(0.99831175,-1.0016911)" - x="165.02673" - y="-481.03674" - style="font-size:9.60000001999999950px;-inkscape-font-specification:Arial;font-family:Arial;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%;fill:#000000;stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none" - sodipodi:linespacing="125%"><tspan - id="tspan3391" - sodipodi:role="line" - y="-481.03674" - x="165.02673 167.43201 174.64301 180.65474" - style="font-size:9.60000001999999950px;font-variant:normal;font-weight:normal;font-stretch:normal;writing-mode:lr;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:Arial;-inkscape-font-specification:Arial;font-style:normal;text-anchor:start;text-align:start;line-height:125%;stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none">IDLE</tspan></text> - -<text - id="text3393" - transform="scale(0.99830575,-1.0016971)" - x="163.8257" - y="-470.79111" - style="font-size:9.60000012000000070px;-inkscape-font-specification:Arial;font-family:Arial;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%;fill:#000000;stroke-width:0.40000001;stroke-miterlimit:4;stroke-dasharray:none" - sodipodi:linespacing="125%"><tspan - id="tspan3395" - sodipodi:role="line" - y="-470.79111" - x="163.8257 166.83093 171.03717 175.84665 180.0529 184.86003" - style="font-size:9.60000012000000070px;font-variant:normal;font-weight:normal;font-stretch:normal;writing-mode:lr;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:Arial;-inkscape-font-specification:Arial;font-style:normal;text-anchor:start;text-align:start;line-height:125%;stroke-width:0.40000001;stroke-miterlimit:4;stroke-dasharray:none">(0b01)</tspan></text> - -<g - transform="translate(202.96813,487.13011)" - id="g3397" - style="stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none"><path - inkscape:connector-curvature="0" - id="path3399" - style="fill:none;stroke:#000000;stroke-width:0.4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" - d="M 0,0 C 54.66,12.54 111.42,12.96 166.26,1.26" /></g><g - transform="translate(369.16813,491.93011)" - id="g3401" - style="stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none"><path - inkscape:connector-curvature="0" - id="path3403" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none" - d="M 0,0 5.82,-4.8 -1.5,-6.6 0,0" /></g><text - id="text3405" - transform="scale(0.99830575,-1.0016971)" - x="287.03442" - y="-485.22662" - style="font-size:9.60000012000000070px;-inkscape-font-specification:Arial;font-family:Arial;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%;stroke-width:0.40000001;stroke-miterlimit:4;stroke-dasharray:none" - sodipodi:linespacing="125%"><tspan - id="tspan3407" - y="-485.22662" - x="287.03442" - style="font-size:9.60000012000000070px;font-variant:normal;font-weight:normal;font-stretch:normal;writing-mode:lr;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:Arial;-inkscape-font-specification:Arial;font-style:normal;text-anchor:start;text-align:start;line-height:125%;stroke-width:0.40000001;stroke-miterlimit:4;stroke-dasharray:none">S</tspan></text> - -<g - transform="translate(374.02813,479.81011)" - id="g3409" - style="fill:#f99d31;stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none"><path - inkscape:connector-curvature="0" - id="path3411" - style="fill:#f99d31;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none" - d="M 0,0 C 0,15.72 12.66,28.44 28.38,28.44 43.98,28.44 56.7,15.72 56.7,0 56.7,-15.72 43.98,-28.44 28.38,-28.44 12.66,-28.44 0,-15.72 0,0" /></g><g - transform="translate(374.02813,479.81011)" - id="g3413" - style="stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none"><path - inkscape:connector-curvature="0" - id="path3415" - style="fill:none;stroke:#000000;stroke-width:0.4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" - d="M 0,0 C 0,15.72 12.66,28.44 28.38,28.44 43.98,28.44 56.7,15.72 56.7,0 56.7,-15.72 43.98,-28.44 28.38,-28.44 12.66,-28.44 0,-15.72 0,0" /></g><text - id="text3417" - transform="scale(0.99831175,-1.0016911)" - x="389.80621" - y="-481.03674" - style="font-size:9.60000001999999950px;-inkscape-font-specification:Arial;font-family:Arial;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%;stroke-width:0.40000000000000002;stroke-miterlimit:4;stroke-dasharray:none;fill:#000000" - sodipodi:linespacing="125%"><tspan - id="tspan3419" - sodipodi:role="line" - y="-481.03674" - x="389.80621 397.01337 404.22052 410.89874" - style="font-size:9.60000001999999950px;font-variant:normal;font-weight:normal;font-stretch:normal;writing-mode:lr;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:Arial;-inkscape-font-specification:Arial;font-style:normal;text-anchor:start;text-align:start;line-height:125%;stroke-width:0.40000000000000002;stroke-miterlimit:4;stroke-dasharray:none">BUSY</tspan></text> - -<text - id="text3421" - transform="scale(0.99830575,-1.0016971)" - x="391.01059" - y="-470.79111" - style="font-size:9.60000012000000070px;-inkscape-font-specification:Arial;font-family:Arial;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%;stroke-width:0.40000001000000002;stroke-miterlimit:4;stroke-dasharray:none;fill:#000000" - sodipodi:linespacing="125%"><tspan - id="tspan3423" - sodipodi:role="line" - y="-470.79111" - x="391.01059 394.01584 398.22208 403.09174 407.29797 412.1051" - style="font-size:9.60000012000000070px;font-variant:normal;font-weight:normal;font-stretch:normal;writing-mode:lr;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:Arial;-inkscape-font-specification:Arial;font-style:normal;text-anchor:start;text-align:start;line-height:125%;stroke-width:0.40000001000000002;stroke-miterlimit:4;stroke-dasharray:none">(0b11)</tspan></text> - -<g - transform="translate(212.02813,470.51011)" - id="g3425" - style="stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none"><path - inkscape:connector-curvature="0" - id="path3427" - style="fill:none;stroke:#000000;stroke-width:0.4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" - d="M 0,0 C 53.82,-10.98 109.38,-10.32 162.96,1.92" /></g><g - transform="translate(213.52813,473.63011)" - id="g3429" - style="stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none"><path - inkscape:connector-curvature="0" - id="path3431" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none" - d="M 0,0 -10.56,-1.2 -1.38,-6.6 0,0" /></g><text - id="text3433" - transform="scale(0.99830575,-1.0016971)" - x="266.59982" - y="-467.7962" - style="font-size:9.60000012000000070px;-inkscape-font-specification:Arial;font-family:Arial;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%;stroke-width:0.40000001;stroke-miterlimit:4;stroke-dasharray:none" - sodipodi:linespacing="125%"><tspan - id="tspan3435" - sodipodi:role="line" - y="-467.7962" - x="266.59982 272.0094 274.41455 279.22244 281.0267 285.83618 288.2413 295.452 299.65823 304.46774 309.27719" - style="font-size:9.60000012000000070px;font-variant:normal;font-weight:normal;font-stretch:normal;writing-mode:lr;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:Arial;-inkscape-font-specification:Arial;font-style:normal;text-anchor:start;text-align:start;line-height:125%;stroke-width:0.40000001;stroke-miterlimit:4;stroke-dasharray:none">P + Timeout</tspan></text> - -<g - transform="translate(260.62813,570.83011)" - id="g3437" - style="stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none"><path - inkscape:connector-curvature="0" - id="path3439" - style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none" - d="M 0,0 C 0,15.72 12.72,28.44 28.32,28.44 44.04,28.44 56.7,15.72 56.7,0 56.7,-15.72 44.04,-28.44 28.32,-28.44 12.72,-28.44 0,-15.72 0,0" /></g><g - transform="translate(260.62813,570.83011)" - id="g3441" - style="stroke-width:0.40000000000000002;stroke-miterlimit:4;stroke-dasharray:none;fill:#dcdcdc"><path - inkscape:connector-curvature="0" - id="path3443" - style="fill:#dcdcdc;stroke:#000000;stroke-width:0.40000000000000002;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" - d="M 0,0 C 0,15.72 12.72,28.44 28.32,28.44 44.04,28.44 56.7,15.72 56.7,0 56.7,-15.72 44.04,-28.44 28.32,-28.44 12.72,-28.44 0,-15.72 0,0" /></g><text - id="text3445" - transform="scale(0.99831175,-1.0016911)" - x="263.59314" - y="-571.78314" - style="font-size:9.60000001999999950px;-inkscape-font-specification:Arial;font-family:Arial;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%;stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none" - sodipodi:linespacing="125%"><tspan - id="tspan3447" - sodipodi:role="line" - y="-571.78314" - x="263.59314 270.80414 278.01514 285.22617 292.43716 299.65103 308.66815" - style="font-size:9.60000001999999950px;font-variant:normal;font-weight:normal;font-stretch:normal;writing-mode:lr;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:Arial;-inkscape-font-specification:Arial;font-style:normal;text-anchor:start;text-align:start;line-height:125%;stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none">UNKNOWN</tspan></text> - -<text - id="text3449" - transform="scale(0.99830575,-1.0016971)" - x="277.41815" - y="-561.53711" - style="font-size:9.60000012000000070px;-inkscape-font-specification:Arial;font-family:Arial;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%;stroke-width:0.40000001;stroke-miterlimit:4;stroke-dasharray:none" - sodipodi:linespacing="125%"><tspan - id="tspan3451" - sodipodi:role="line" - y="-561.53711" - x="277.41815 280.4234 284.62964 289.43912 293.64536 298.45248" - style="font-size:9.60000012000000070px;font-variant:normal;font-weight:normal;font-stretch:normal;writing-mode:lr;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:Arial;-inkscape-font-specification:Arial;font-style:normal;text-anchor:start;text-align:start;line-height:125%;stroke-width:0.40000001;stroke-miterlimit:4;stroke-dasharray:none">(0b00)</tspan></text> - -<g - transform="translate(260.62813,388.79011)" - id="g3453" - style="stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none"><path - inkscape:connector-curvature="0" - id="path3455" - style="fill:#ffff00;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none" - d="M 0,0 C 0,15.72 12.72,28.44 28.32,28.44 44.04,28.44 56.7,15.72 56.7,0 56.7,-15.72 44.04,-28.44 28.32,-28.44 12.72,-28.44 0,-15.72 0,0" /></g><g - transform="translate(260.62813,388.79011)" - id="g3457" - style="fill:#cdeae8;stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none"><path - inkscape:connector-curvature="0" - id="path3459" - style="fill:#cdeae8;stroke:#000000;stroke-width:0.4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" - d="M 0,0 C 0,15.72 12.72,28.44 28.32,28.44 44.04,28.44 56.7,15.72 56.7,0 56.7,-15.72 44.04,-28.44 28.32,-28.44 12.72,-28.44 0,-15.72 0,0" /></g><text - id="text3461" - transform="scale(0.99831175,-1.0016911)" - x="270.80533" - y="-390.23019" - style="font-size:9.60000001999999950px;-inkscape-font-specification:Arial;font-family:Arial;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%;stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none" - sodipodi:linespacing="125%"><tspan - id="tspan3463" - sodipodi:role="line" - y="-390.23019" - x="270.80533 278.0192 287.03632 294.24734 300.85822" - style="font-size:9.60000001999999950px;font-variant:normal;font-weight:normal;font-stretch:normal;writing-mode:lr;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:Arial;-inkscape-font-specification:Arial;font-style:normal;text-anchor:start;text-align:start;line-height:125%;stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none">OWNER</tspan></text> - -<text - id="text3465" - transform="scale(0.99830575,-1.0016971)" - x="277.41815" - y="-380.04514" - style="font-size:9.60000012000000070px;-inkscape-font-specification:Arial;font-family:Arial;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%;stroke-width:0.40000001;stroke-miterlimit:4;stroke-dasharray:none" - sodipodi:linespacing="125%"><tspan - id="tspan3467" - sodipodi:role="line" - y="-380.04514" - x="277.41815 280.4234 284.62964 289.43912 293.64536 298.45248" - style="font-size:9.60000012000000070px;font-variant:normal;font-weight:normal;font-stretch:normal;writing-mode:lr;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:Arial;-inkscape-font-specification:Arial;font-style:normal;text-anchor:start;text-align:start;line-height:125%;stroke-width:0.40000001;stroke-miterlimit:4;stroke-dasharray:none">(0b10)</tspan></text> - -<g - transform="translate(399.46813,442.37011)" - id="g3469" - style="stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none"><path - inkscape:connector-curvature="0" - id="path3471" - style="fill:none;stroke:#000000;stroke-width:0.4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" - d="M 0,0 C -11.22,-36.12 -45,-60.3 -82.68,-59.22" /></g><g - transform="translate(395.98813,442.37011)" - id="g3473" - style="stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none"><path - inkscape:connector-curvature="0" - id="path3475" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none" - d="M 0,0 5.7,9 6.54,-1.62 0,0" /></g><text - id="text3477" - transform="scale(0.99830575,-1.0016971)" - x="338.72202" - y="-419.69794" - style="font-size:9.60000012000000070px;-inkscape-font-specification:Arial;font-family:Arial;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%;stroke-width:0.40000001;stroke-miterlimit:4;stroke-dasharray:none" - sodipodi:linespacing="125%"><tspan - id="tspan3479" - sodipodi:role="line" - y="-419.69794" - x="338.72202 344.73093 347.73462 352.5441 354.94922 357.35358 360.35724 364.56348 366.96783 369.37296 374.18243" - style="font-size:9.60000012000000070px;font-variant:normal;font-weight:normal;font-stretch:normal;writing-mode:lr;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:Arial;-inkscape-font-specification:Arial;font-style:normal;text-anchor:start;text-align:start;line-height:125%;stroke-width:0.40000001;stroke-miterlimit:4;stroke-dasharray:none">Arbitration</tspan><tspan - id="tspan3481" - sodipodi:role="line" - y="-410.11414" - x="350.74219 355.55167 360.36115 364.56738" - style="font-size:9.60000012000000070px;font-variant:normal;font-weight:normal;font-stretch:normal;writing-mode:lr;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:Arial;-inkscape-font-specification:Arial;font-style:normal;text-anchor:start;text-align:start;line-height:125%;stroke-width:0.40000001;stroke-miterlimit:4;stroke-dasharray:none">Lost</tspan></text> - -<g - transform="translate(209.44813,463.55011)" - id="g3483" - style="stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none"><path - inkscape:connector-curvature="0" - id="path3485" - style="fill:none;stroke:#000000;stroke-width:0.4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" - d="M 0,0 C 23.58,-13.68 44.7,-31.32 62.4,-52.08" /></g><g - transform="translate(208.54813,460.19011)" - id="g3487" - style="stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none"><path - inkscape:connector-curvature="0" - id="path3489" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none" - d="M 0,0 -7.14,7.8 3.3,5.88 0,0" /></g><g - transform="translate(294.64813,360.89011)" - id="g3491" - style="stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none"><path - inkscape:connector-curvature="0" - id="path3493" - style="fill:none;stroke:#000000;stroke-width:0.4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" - d="m 0,0 c 4.5,-3.12 5.64,-9.36 2.52,-13.92 -3.12,-4.5 -9.3,-5.64 -13.86,-2.52 -3.78,2.64 -5.28,7.5 -3.66,11.82" /></g><g - transform="translate(276.52813,357.71011)" - id="g3495" - style="stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none"><path - inkscape:connector-curvature="0" - id="path3497" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none" - d="M 0,0 6.78,3.18 5.28,-4.14 0,0" /></g><text - id="text3499" - transform="scale(0.99830575,-1.0016971)" - x="247.36723" - y="-435.93027" - style="font-size:9.60000012000000070px;-inkscape-font-specification:Arial;font-family:Arial;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%;stroke-width:0.40000001;stroke-miterlimit:4;stroke-dasharray:none" - sodipodi:linespacing="125%"><tspan - id="tspan3501" - sodipodi:role="line" - y="-435.93027" - x="247.36723 253.37614 258.18564 265.39633 272.60703 276.81329 281.62277 286.43222 288.83737" - style="font-size:9.60000012000000070px;font-variant:normal;font-weight:normal;font-stretch:normal;writing-mode:lr;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:Arial;-inkscape-font-specification:Arial;font-style:normal;text-anchor:start;text-align:start;line-height:125%;stroke-width:0.40000001;stroke-miterlimit:4;stroke-dasharray:none">Command P</tspan><tspan - id="tspan3503" - sodipodi:role="line" - y="-351.17404" - x="304.46368 312.27841 315.28207 317.68723 320.09155 324.29779 326.70294 332.71185 338.72076 344.72968 350.73862 351.94196 354.34631 359.75589 362.75958" - style="font-size:9.60000012000000070px;font-variant:normal;font-weight:normal;font-stretch:normal;writing-mode:lr;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:Arial;-inkscape-font-specification:Arial;font-style:normal;text-anchor:start;text-align:start;line-height:125%;stroke-width:0.40000001;stroke-miterlimit:4;stroke-dasharray:none">Write ADDR (Sr)</tspan></text> - -<g - transform="translate(430.12813,485.51011)" - id="g3505" - style="stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none"><path - inkscape:connector-curvature="0" - id="path3507" - style="fill:none;stroke:#000000;stroke-width:0.4;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" - d="M 0,0 C 3.18,5.4 10.08,7.2 15.42,4.08 20.76,0.9 22.62,-6 19.5,-11.4 17.04,-15.6 12.3,-17.7 7.56,-16.8" /></g><g - transform="translate(436.42813,465.47011)" - id="g3509" - style="stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none"><path - inkscape:connector-curvature="0" - id="path3511" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.4;stroke-miterlimit:4;stroke-dasharray:none" - d="M 0,0 -6.3,8.64 3.9,5.52 0,0" /></g><text - id="text3513" - transform="scale(0.99830575,-1.0016971)" - x="438.55115" - y="-494.27127" - style="font-size:9.60000012000000070px;-inkscape-font-specification:Arial;font-family:Arial;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;text-anchor:start;text-align:start;writing-mode:lr;line-height:125%;stroke-width:0.40000001;stroke-miterlimit:4;stroke-dasharray:none" - sodipodi:linespacing="125%"><tspan - id="tspan3515" - sodipodi:role="line" - y="-494.27127" - x="438.55115 443.95996" - style="font-size:9.60000012000000070px;font-variant:normal;font-weight:normal;font-stretch:normal;writing-mode:lr;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;font-family:Arial;-inkscape-font-specification:Arial;font-style:normal;text-anchor:start;text-align:start;line-height:125%;stroke-width:0.40000001;stroke-miterlimit:4;stroke-dasharray:none">Sr</tspan></text> - -</g></svg> diff --git a/atmel-samd/asf/sam0/drivers/sercom/i2c/docimg/bus_topology.svg b/atmel-samd/asf/sam0/drivers/sercom/i2c/docimg/bus_topology.svg deleted file mode 100644 index 80df58f30..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/i2c/docimg/bus_topology.svg +++ /dev/null @@ -1,351 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> -<!-- Generated by Microsoft Visio 11.0, SVG Export, v1.0 bus_topology.svg Page-1 --> -<svg xmlns="http://www.w3.org/2000/svg" xmlns:v="http://schemas.microsoft.com/visio/2003/SVGExtensions/" width="7.30346in" - height="2.76924in" viewBox="0 0 525.849 199.385" xml:space="preserve" color-interpolation-filters="sRGB" class="st13"> - <v:documentProperties v:langID="1033" v:metric="true" v:viewMarkup="false"/> - - <style type="text/css"> - <![CDATA[ - .st1 {fill:#ffffff;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.24} - .st2 {fill:#000000;font-family:Arial;font-size:1.00001em;font-weight:bold} - .st3 {font-size:1em} - .st4 {fill:#ffffff;stroke:#000000;stroke-dasharray:1.68,1.2;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.24} - .st5 {stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.24} - .st6 {fill:none;stroke:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.72} - .st7 {fill:#000000;font-family:Arial;font-size:0.833336em} - .st8 {baseline-shift:-32.4947%;font-size:0.649894em} - .st9 {fill:none;stroke:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.24} - .st10 {stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-width:1.2} - .st11 {baseline-shift:-32.4941%;font-size:0.649882em} - .st12 {fill:#000000;stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.24} - .st13 {fill:none;fill-rule:evenodd;font-size:12;overflow:visible;stroke-linecap:square;stroke-miterlimit:3} - ]]> - </style> - - <g v:mID="0" v:index="1" v:groupContext="foregroundPage"> - <title>Page-1</title> - <v:pageProperties v:drawingScale="0.0393701" v:pageScale="0.0393701" v:drawingUnits="24" v:shadowOffsetX="8.50394" - v:shadowOffsetY="-8.50394"/> - <g id="group1-1" transform="translate(0.24,-0.72)" v:mID="1" v:groupContext="group"> - <title>Sheet.1</title> - <g id="shape2-2" v:mID="2" v:groupContext="shape" transform="translate(155.906,-113.386)"> - <title>Box.448</title> - <desc>I2C DEVICE #1</desc> - <v:textBlock v:margins="rect(4,4,4,4)"/> - <v:textRect cx="42.5197" cy="171.039" width="85.04" height="56.6929"/> - <rect x="0" y="142.692" width="85.0394" height="56.6929" class="st1"/> - <text x="9.18" y="167.44" class="st2" v:langID="1044"><v:paragraph v:horizAlign="1"/><v:tabList/>I2C DEVICE <tspan - x="35.85" dy="1.2em" class="st3">#</tspan>1</text> </g> - <g id="shape3-6" v:mID="3" v:groupContext="shape" transform="translate(180.709,-70.8661)"> - <title>Box.450</title> - <path d="M0 199.39 L7.09 199.39 L7.09 171.04 L0 171.04 L0 199.39 Z" class="st4"/> - </g> - <g id="shape4-8" v:mID="4" v:groupContext="shape" transform="translate(209.055,-70.8661)"> - <title>Box.451</title> - <path d="M0 199.39 L7.09 199.39 L7.09 171.04 L0 171.04 L0 199.39 Z" class="st4"/> - </g> - <g id="shape5-10" v:mID="5" v:groupContext="shape" transform="translate(184.252,-99.2126)"> - <title>Bottom to top 1</title> - <v:userDefs> - <v:ud v:nameU="TextPos" v:val="VT0(1):26"/> - </v:userDefs> - <path d="M0 185.21 L0 192.3 L0 199.39" class="st5"/> - </g> - <g id="shape6-13" v:mID="6" v:groupContext="shape" transform="translate(212.598,-99.2126)"> - <title>Bottom to top 1.453</title> - <v:userDefs> - <v:ud v:nameU="TextPos" v:val="VT0(1):26"/> - </v:userDefs> - <path d="M0 185.21 L0 192.3 L0 199.39" class="st5"/> - </g> - <g id="shape7-16" v:mID="7" v:groupContext="shape" transform="translate(212.598,-56.6929)"> - <title>Bottom to top 1.454</title> - <v:userDefs> - <v:ud v:nameU="TextPos" v:val="VT0(1):26"/> - </v:userDefs> - <path d="M0 185.21 L0 192.3 L0 199.39" class="st5"/> - </g> - <g id="shape8-19" v:mID="8" v:groupContext="shape" transform="translate(184.252,-28.3465)"> - <title>Bottom to top 1.455</title> - <v:userDefs> - <v:ud v:nameU="TextPos" v:val="VT0(1):26"/> - </v:userDefs> - <path d="M0 156.87 L0 178.13 L0 199.39" class="st5"/> - </g> - <g id="shape9-22" v:mID="9" v:groupContext="shape" transform="translate(109.843,-127.559)"> - <title>Box.449</title> - <rect x="0" y="171.039" width="7.08661" height="28.3465" class="st1"/> - </g> - <g id="shape10-24" v:mID="10" v:groupContext="shape" transform="translate(113.386,-155.906)"> - <title>Bottom to top 1.456</title> - <v:userDefs> - <v:ud v:nameU="TextPos" v:val="VT0(1):26"/> - </v:userDefs> - <path d="M0 171.04 L0 185.21 L0 199.39" class="st5"/> - </g> - <g id="shape11-27" v:mID="11" v:groupContext="shape" transform="translate(113.386,-56.6929)"> - <title>Bottom to top 1.457</title> - <v:userDefs> - <v:ud v:nameU="TextPos" v:val="VT0(1):26"/> - </v:userDefs> - <path d="M0 128.52 L0 163.95 L0 199.39" class="st5"/> - </g> - <g id="shape12-30" v:mID="12" v:groupContext="shape" transform="translate(67.3228,-127.559)"> - <title>Box.447</title> - <rect x="0" y="171.039" width="7.08661" height="28.3465" class="st1"/> - </g> - <g id="shape13-32" v:mID="13" v:groupContext="shape" transform="translate(70.8661,-155.906)"> - <title>Bottom to top 1.458</title> - <v:userDefs> - <v:ud v:nameU="TextPos" v:val="VT0(1):26"/> - </v:userDefs> - <path d="M0 171.04 L0 185.21 L0 199.39" class="st5"/> - </g> - <g id="shape14-35" v:mID="14" v:groupContext="shape" transform="translate(70.8661,-28.3465)"> - <title>Bottom to top 1.459</title> - <v:userDefs> - <v:ud v:nameU="TextPos" v:val="VT0(1):26"/> - </v:userDefs> - <path d="M0 100.17 L0 149.78 L0 199.39" class="st5"/> - </g> - <g id="shape15-38" v:mID="15" v:groupContext="shape" transform="translate(77.9528,-141.732)"> - <title>Sheet.15</title> - <desc>RP</desc> - <v:textBlock v:margins="rect(4,4,4,4)" v:tabSpace="42.5197"/> - <v:textRect cx="10.6299" cy="192.299" width="21.26" height="14.1732"/> - <rect x="0" y="185.212" width="21.2598" height="14.1732" class="st6"/> - <text x="4" y="195.3" class="st7" v:langID="1033"><v:paragraph/><v:tabList/>R<tspan dy="-0.287em" class="st8" - v:langID="1044" v:baseFontSize="10">P</tspan></text> </g> - <g id="shape16-42" v:mID="16" v:groupContext="shape" transform="translate(120.472,-141.732)"> - <title>Sheet.16</title> - <desc>RP</desc> - <v:textBlock v:margins="rect(4,4,4,4)" v:tabSpace="42.5197"/> - <v:textRect cx="10.6299" cy="192.299" width="21.26" height="14.1732"/> - <rect x="0" y="185.212" width="21.2598" height="14.1732" class="st6"/> - <text x="4" y="195.3" class="st7" v:langID="1033"><v:paragraph/><v:tabList/>R<tspan dy="-0.287em" class="st8" - v:langID="1044" v:baseFontSize="10">P</tspan></text> </g> - <g id="shape17-46" v:mID="17" v:groupContext="shape" transform="translate(187.795,-77.9528)"> - <title>Sheet.17</title> - <desc>RS</desc> - <v:textBlock v:margins="rect(4,4,4,4)" v:tabSpace="42.5197"/> - <v:textRect cx="10.6299" cy="192.299" width="21.26" height="14.1732"/> - <rect x="0" y="185.212" width="21.2598" height="14.1732" class="st6"/> - <text x="4" y="195.3" class="st7" v:langID="1033"><v:paragraph/><v:tabList/>R<tspan dy="-0.287em" class="st8" - v:langID="1044" v:baseFontSize="10">S</tspan></text> </g> - <g id="shape18-50" v:mID="18" v:groupContext="shape" transform="translate(219.685,-77.9528)"> - <title>Sheet.18</title> - <desc>RS</desc> - <v:textBlock v:margins="rect(4,4,4,4)" v:tabSpace="42.5197"/> - <v:textRect cx="10.6299" cy="192.299" width="21.26" height="14.1732"/> - <rect x="0" y="185.212" width="21.2598" height="14.1732" class="st6"/> - <text x="4" y="195.3" class="st7" v:langID="1033"><v:paragraph/><v:tabList/>R<tspan dy="-0.287em" class="st8" - v:langID="1044" v:baseFontSize="10">S</tspan></text> </g> - <g id="shape19-54" v:mID="19" v:groupContext="shape" transform="translate(-3.59712E-014,-42.5197)"> - <title>Box.211</title> - <desc>SDA</desc> - <v:textBlock v:margins="rect(4,4,4,4)"/> - <v:textRect cx="21.2598" cy="185.212" width="42.52" height="28.3465"/> - <rect x="0" y="171.039" width="42.5197" height="28.3465" class="st9"/> - <text x="13.18" y="188.81" class="st2" v:langID="1044"><v:paragraph v:horizAlign="2"/><v:tabList/>SDA</text> </g> - <g id="shape20-57" v:mID="20" v:groupContext="shape" transform="translate(-3.59712E-014,-14.1732)"> - <title>Box.465</title> - <desc>SCL</desc> - <v:textBlock v:margins="rect(4,4,4,4)"/> - <v:textRect cx="21.2598" cy="185.212" width="42.52" height="28.3465"/> - <rect x="0" y="171.039" width="42.5197" height="28.3465" class="st9"/> - <text x="14.52" y="188.81" class="st2" v:langID="1044"><v:paragraph v:horizAlign="2"/><v:tabList/>SCL</text> </g> - <g id="shape21-60" v:mID="21" v:groupContext="shape" transform="translate(42.5197,-56.6929)"> - <title>Side to side 1</title> - <v:userDefs> - <v:ud v:nameU="TextPos" v:val="VT0(1):26"/> - </v:userDefs> - <path d="M0 199.39 L240.94 199.39 L481.89 199.39" class="st10"/> - </g> - <g id="shape22-63" v:mID="22" v:groupContext="shape" transform="translate(42.5197,-28.3465)"> - <title>Side to side 1.467</title> - <v:userDefs> - <v:ud v:nameU="TextPos" v:val="VT0(1):26"/> - </v:userDefs> - <path d="M0 199.39 L240.94 199.39 L481.89 199.39" class="st10"/> - </g> - <g id="shape23-66" v:mID="23" v:groupContext="shape" transform="translate(198.425,-170.079)"> - <title>Bottom to top 1.468</title> - <v:userDefs> - <v:ud v:nameU="TextPos" v:val="VT0(1):26"/> - </v:userDefs> - <path d="M0 185.21 L0 192.3 L0 199.39" class="st5"/> - </g> - <g id="shape24-69" v:mID="24" v:groupContext="shape" transform="translate(42.5197,-184.252)"> - <title>Side to side 1.469</title> - <v:userDefs> - <v:ud v:nameU="TextPos" v:val="VT0(1):26"/> - </v:userDefs> - <path d="M0 199.39 L240.94 199.39 L481.89 199.39" class="st10"/> - </g> - <g id="shape25-72" v:mID="25" v:groupContext="shape" transform="translate(-3.59712E-014,-170.079)"> - <title>Box.470</title> - <desc>VCC</desc> - <v:textBlock v:margins="rect(4,4,4,4)" v:tabSpace="42.5197"/> - <v:textRect cx="21.2598" cy="185.212" width="42.52" height="28.3465"/> - <rect x="0" y="171.039" width="42.5197" height="28.3465" class="st9"/> - <text x="19.25" y="188.81" class="st2" v:langID="1044"><v:paragraph v:horizAlign="2"/><v:tabList/>V<tspan - dy="-0.287em" class="st11" v:baseFontSize="12">CC</tspan></text> </g> - <g id="shape26-76" v:mID="26" v:groupContext="shape" transform="translate(269.291,-113.386)"> - <title>Box.471</title> - <desc>I2C DEVICE #2</desc> - <v:textBlock v:margins="rect(4,4,4,4)"/> - <v:textRect cx="42.5197" cy="171.039" width="85.04" height="56.6929"/> - <rect x="0" y="142.692" width="85.0394" height="56.6929" class="st1"/> - <text x="9.18" y="167.44" class="st2" v:langID="1044"><v:paragraph v:horizAlign="1"/><v:tabList/>I2C DEVICE <tspan - x="35.85" dy="1.2em" class="st3">#</tspan>2</text> </g> - <g id="shape27-80" v:mID="27" v:groupContext="shape" transform="translate(294.094,-70.8661)"> - <title>Box.472</title> - <path d="M0 199.39 L7.09 199.39 L7.09 171.04 L0 171.04 L0 199.39 Z" class="st4"/> - </g> - <g id="shape28-82" v:mID="28" v:groupContext="shape" transform="translate(322.441,-70.8661)"> - <title>Box.473</title> - <path d="M0 199.39 L7.09 199.39 L7.09 171.04 L0 171.04 L0 199.39 Z" class="st4"/> - </g> - <g id="shape29-84" v:mID="29" v:groupContext="shape" transform="translate(297.638,-99.2126)"> - <title>Bottom to top 1.474</title> - <v:userDefs> - <v:ud v:nameU="TextPos" v:val="VT0(1):26"/> - </v:userDefs> - <path d="M0 185.21 L0 192.3 L0 199.39" class="st5"/> - </g> - <g id="shape30-87" v:mID="30" v:groupContext="shape" transform="translate(325.984,-99.2126)"> - <title>Bottom to top 1.475</title> - <v:userDefs> - <v:ud v:nameU="TextPos" v:val="VT0(1):26"/> - </v:userDefs> - <path d="M0 185.21 L0 192.3 L0 199.39" class="st5"/> - </g> - <g id="shape31-90" v:mID="31" v:groupContext="shape" transform="translate(325.984,-56.6929)"> - <title>Bottom to top 1.476</title> - <v:userDefs> - <v:ud v:nameU="TextPos" v:val="VT0(1):26"/> - </v:userDefs> - <path d="M0 185.21 L0 192.3 L0 199.39" class="st5"/> - </g> - <g id="shape32-93" v:mID="32" v:groupContext="shape" transform="translate(297.638,-28.3465)"> - <title>Bottom to top 1.477</title> - <v:userDefs> - <v:ud v:nameU="TextPos" v:val="VT0(1):26"/> - </v:userDefs> - <path d="M0 156.87 L0 178.13 L0 199.39" class="st5"/> - </g> - <g id="shape33-96" v:mID="33" v:groupContext="shape" transform="translate(301.181,-77.9528)"> - <title>Sheet.33</title> - <desc>RS</desc> - <v:textBlock v:margins="rect(4,4,4,4)" v:tabSpace="42.5197"/> - <v:textRect cx="10.6299" cy="192.299" width="21.26" height="14.1732"/> - <rect x="0" y="185.212" width="21.2598" height="14.1732" class="st6"/> - <text x="4" y="195.3" class="st7" v:langID="1033"><v:paragraph/><v:tabList/>R<tspan dy="-0.287em" class="st8" - v:langID="1044" v:baseFontSize="10">S</tspan></text> </g> - <g id="shape34-100" v:mID="34" v:groupContext="shape" transform="translate(333.071,-77.9528)"> - <title>Sheet.34</title> - <desc>RS</desc> - <v:textBlock v:margins="rect(4,4,4,4)" v:tabSpace="42.5197"/> - <v:textRect cx="10.6299" cy="192.299" width="21.26" height="14.1732"/> - <rect x="0" y="185.212" width="21.2598" height="14.1732" class="st6"/> - <text x="4" y="195.3" class="st7" v:langID="1033"><v:paragraph/><v:tabList/>R<tspan dy="-0.287em" class="st8" - v:langID="1044" v:baseFontSize="10">S</tspan></text> </g> - <g id="shape35-104" v:mID="35" v:groupContext="shape" transform="translate(311.811,-170.079)"> - <title>Bottom to top 1.480</title> - <v:userDefs> - <v:ud v:nameU="TextPos" v:val="VT0(1):26"/> - </v:userDefs> - <path d="M0 185.21 L0 192.3 L0 199.39" class="st5"/> - </g> - <g id="shape36-107" v:mID="36" v:groupContext="shape" transform="translate(425.197,-113.386)"> - <title>Box.481</title> - <desc>I2C DEVICE #N</desc> - <v:textBlock v:margins="rect(4,4,4,4)"/> - <v:textRect cx="42.5197" cy="171.039" width="85.04" height="56.6929"/> - <rect x="0" y="142.692" width="85.0394" height="56.6929" class="st1"/> - <text x="9.18" y="167.44" class="st2" v:langID="1044"><v:paragraph v:horizAlign="1"/><v:tabList/>I2C DEVICE <tspan - x="34.85" dy="1.2em" class="st3">#</tspan>N</text> </g> - <g id="shape37-111" v:mID="37" v:groupContext="shape" transform="translate(450,-70.8661)"> - <title>Box.482</title> - <path d="M0 199.39 L7.09 199.39 L7.09 171.04 L0 171.04 L0 199.39 Z" class="st4"/> - </g> - <g id="shape38-113" v:mID="38" v:groupContext="shape" transform="translate(478.346,-70.8661)"> - <title>Box.483</title> - <path d="M0 199.39 L7.09 199.39 L7.09 171.04 L0 171.04 L0 199.39 Z" class="st4"/> - </g> - <g id="shape39-115" v:mID="39" v:groupContext="shape" transform="translate(453.543,-99.2126)"> - <title>Bottom to top 1.484</title> - <v:userDefs> - <v:ud v:nameU="TextPos" v:val="VT0(1):26"/> - </v:userDefs> - <path d="M0 185.21 L0 192.3 L0 199.39" class="st5"/> - </g> - <g id="shape40-118" v:mID="40" v:groupContext="shape" transform="translate(481.89,-99.2126)"> - <title>Bottom to top 1.485</title> - <v:userDefs> - <v:ud v:nameU="TextPos" v:val="VT0(1):26"/> - </v:userDefs> - <path d="M0 185.21 L0 192.3 L0 199.39" class="st5"/> - </g> - <g id="shape41-121" v:mID="41" v:groupContext="shape" transform="translate(481.89,-56.6929)"> - <title>Bottom to top 1.486</title> - <v:userDefs> - <v:ud v:nameU="TextPos" v:val="VT0(1):26"/> - </v:userDefs> - <path d="M0 185.21 L0 192.3 L0 199.39" class="st5"/> - </g> - <g id="shape42-124" v:mID="42" v:groupContext="shape" transform="translate(453.543,-28.3465)"> - <title>Bottom to top 1.487</title> - <v:userDefs> - <v:ud v:nameU="TextPos" v:val="VT0(1):26"/> - </v:userDefs> - <path d="M0 156.87 L0 178.13 L0 199.39" class="st5"/> - </g> - <g id="shape43-127" v:mID="43" v:groupContext="shape" transform="translate(457.087,-77.9528)"> - <title>Sheet.43</title> - <desc>RS</desc> - <v:textBlock v:margins="rect(4,4,4,4)" v:tabSpace="42.5197"/> - <v:textRect cx="10.6299" cy="192.299" width="21.26" height="14.1732"/> - <rect x="0" y="185.212" width="21.2598" height="14.1732" class="st6"/> - <text x="4" y="195.3" class="st7" v:langID="1033"><v:paragraph/><v:tabList/>R<tspan dy="-0.287em" class="st8" - v:langID="1044" v:baseFontSize="10">S</tspan></text> </g> - <g id="shape44-131" v:mID="44" v:groupContext="shape" transform="translate(488.976,-77.9528)"> - <title>Sheet.44</title> - <desc>RS</desc> - <v:textBlock v:margins="rect(4,4,4,4)" v:tabSpace="42.5197"/> - <v:textRect cx="10.6299" cy="192.299" width="21.26" height="14.1732"/> - <rect x="0" y="185.212" width="21.2598" height="14.1732" class="st6"/> - <text x="4" y="195.3" class="st7" v:langID="1033"><v:paragraph/><v:tabList/>R<tspan dy="-0.287em" class="st8" - v:langID="1044" v:baseFontSize="10">S</tspan></text> </g> - <g id="shape45-135" v:mID="45" v:groupContext="shape" transform="translate(467.717,-170.079)"> - <title>Bottom to top 1.490</title> - <v:userDefs> - <v:ud v:nameU="TextPos" v:val="VT0(1):26"/> - </v:userDefs> - <path d="M0 185.21 L0 192.3 L0 199.39" class="st5"/> - </g> - <g id="shape46-138" v:mID="46" v:groupContext="shape" transform="translate(372.047,-138.189)"> - <title>Sheet.46</title> - <ellipse cx="3.54331" cy="195.842" rx="3.54331" ry="3.54331" class="st12"/> - </g> - <g id="shape47-140" v:mID="47" v:groupContext="shape" transform="translate(386.22,-138.189)"> - <title>Sheet.47</title> - <ellipse cx="3.54331" cy="195.842" rx="3.54331" ry="3.54331" class="st12"/> - </g> - <g id="shape48-142" v:mID="48" v:groupContext="shape" transform="translate(400.394,-138.189)"> - <title>Sheet.48</title> - <ellipse cx="3.54331" cy="195.842" rx="3.54331" ry="3.54331" class="st12"/> - </g> - <g id="shape49-144" v:mID="49" v:groupContext="shape" transform="translate(411.024,0)"> - <title>Sheet.49</title> - <desc>Note: RS is optional</desc> - <v:textBlock v:margins="rect(4,4,4,4)" v:tabSpace="42.5197"/> - <v:textRect cx="56.6929" cy="185.212" width="113.39" height="28.3465"/> - <rect x="0" y="171.039" width="113.386" height="28.3465" class="st6"/> - <text x="23.34" y="188.21" class="st7" v:langID="1033"><v:paragraph v:horizAlign="2"/><v:tabList/>Note: R<tspan - dy="-0.287em" class="st8" v:langID="1044" v:baseFontSize="10">S</tspan><tspan dy="0.186em" class="st3" - v:langID="1044"> </tspan><tspan class="st3" v:langID="1044">is optional</tspan></text> </g> - </g> - </g> -</svg> diff --git a/atmel-samd/asf/sam0/drivers/sercom/i2c/docimg/i2c_read.svg b/atmel-samd/asf/sam0/drivers/sercom/i2c/docimg/i2c_read.svg deleted file mode 100644 index 5be8085d9..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/i2c/docimg/i2c_read.svg +++ /dev/null @@ -1,1037 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> - -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="1062.9928" - height="39.954796" - id="svg2" - version="1.1" - inkscape:version="0.48.4 r9939" - sodipodi:docname="i2c_read.svg"> - <defs - id="defs4" /> - <sodipodi:namedview - id="base" - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1.0" - inkscape:pageopacity="0.0" - inkscape:pageshadow="2" - inkscape:zoom="1.4" - inkscape:cx="431.58384" - inkscape:cy="191.3885" - inkscape:document-units="px" - inkscape:current-layer="layer1" - showgrid="false" - inkscape:window-width="1920" - inkscape:window-height="1138" - inkscape:window-x="1042" - inkscape:window-y="123" - inkscape:window-maximized="1" - fit-margin-top="0" - fit-margin-left="0" - fit-margin-right="0" - fit-margin-bottom="0" - units="cm" /> - <metadata - id="metadata7"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title /> - </cc:Work> - </rdf:RDF> - </metadata> - <g - inkscape:label="Layer 1" - inkscape:groupmode="layer" - id="layer1" - transform="translate(-13.760627,-247.09327)"> - <g - id="g3025-8-1" - transform="matrix(0.2273934,0,0,0.2273934,337.19144,210.19696)"> - <g - id="g3084-7"> - <g - id="g3137"> - <rect - y="250.80614" - x="29.7995" - height="84.852814" - width="160.10918" - id="rect2985-2-1" - style="fill:#ffffff;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <text - sodipodi:linespacing="125%" - id="text2987-45-1" - y="305.35434" - x="68.236969" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="305.35434" - x="68.236969" - id="tspan2989-5-5" - sodipodi:role="line">ACK</tspan></text> - </g> - </g> - </g> - <g - id="g3367" - transform="matrix(0.2273934,0,0,0.2273934,10.929948,221.47683)" /> - <g - id="g3651" - transform="matrix(0.2273934,0,0,0.2273934,10.929948,221.47683)"> - <g - transform="translate(-15.152288,-49.497478)" - id="g3025"> - <rect - style="fill:#cccccc;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985" - width="160.10918" - height="84.852814" - x="29.7995" - y="250.80614" /> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" - x="45.961941" - y="307.37466" - id="text2987" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989" - x="45.961941" - y="307.37466">START</tspan></text> - </g> - <g - transform="translate(0.08928571,0.54971913)" - id="g3371"> - <rect - y="114.81322" - x="14.562887" - height="84.852814" - width="160.10918" - id="rect2985-3" - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <g - id="g3363"> - <text - sodipodi:linespacing="125%" - id="text2987-41" - y="170.37161" - x="51.433456" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="170.37161" - x="51.433456" - id="tspan2989-1" - sodipodi:role="line">Bit 0</tspan></text> - </g> - </g> - </g> - <g - id="g3025-0" - transform="matrix(0.2273934,0,0,0.2273934,44.171155,210.21446)"> - <rect - y="250.80614" - x="29.799496" - height="84.852814" - width="1126" - id="rect2985-9" - style="fill:#cccccc;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <text - sodipodi:linespacing="125%" - id="text2987-4" - y="307.37466" - x="45.961941" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="307.37466" - x="45.961941" - id="tspan2989-8" - sodipodi:role="line">ADDRESS</tspan></text> - </g> - <g - id="g3572" - transform="matrix(0.2273934,0,0,0.2273934,10.929948,221.47683)"> - <g - transform="translate(161.20365,0.3799057)" - id="g3371-3"> - <rect - y="114.81322" - x="14.562887" - height="84.852814" - width="160.10918" - id="rect2985-3-8" - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <g - id="g3363-7"> - <text - sodipodi:linespacing="125%" - id="text2987-41-4" - y="170.37161" - x="51.433456" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="170.37161" - x="51.433456" - id="tspan2989-1-2" - sodipodi:role="line">Bit 1</tspan></text> - </g> - </g> - <g - transform="translate(322.34682,0.36425801)" - id="g3371-3-9"> - <rect - y="114.81322" - x="14.562887" - height="84.852814" - width="160.10918" - id="rect2985-3-8-8" - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <g - id="g3363-7-6"> - <text - sodipodi:linespacing="125%" - id="text2987-41-4-5" - y="170.37161" - x="51.433456" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="170.37161" - x="51.433456" - id="tspan2989-1-2-0" - sodipodi:role="line">Bit 2</tspan></text> - </g> - </g> - <g - transform="translate(483.53819,0.33959304)" - id="g3371-3-2"> - <rect - y="114.81322" - x="14.562887" - height="84.852814" - width="160.10918" - id="rect2985-3-8-86" - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <g - id="g3363-7-0"> - <text - sodipodi:linespacing="125%" - id="text2987-41-4-2" - y="170.37161" - x="51.433456" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="170.37161" - x="51.433456" - id="tspan2989-1-2-4" - sodipodi:role="line">Bit 3</tspan></text> - </g> - </g> - <g - transform="translate(644.68136,0.32394304)" - id="g3371-3-9-8"> - <rect - y="114.81322" - x="14.562887" - height="84.852814" - width="160.10918" - id="rect2985-3-8-8-6" - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <g - id="g3363-7-6-5"> - <text - sodipodi:linespacing="125%" - id="text2987-41-4-5-0" - y="170.37161" - x="51.433456" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="170.37161" - x="51.433456" - id="tspan2989-1-2-0-9" - sodipodi:role="line">Bit 4</tspan></text> - </g> - </g> - <g - transform="translate(805.87366,0.28165828)" - id="g3371-3-0"> - <rect - y="114.81322" - x="14.562887" - height="84.852814" - width="160.10918" - id="rect2985-3-8-0" - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <g - id="g3363-7-61"> - <text - sodipodi:linespacing="125%" - id="text2987-41-4-3" - y="170.37161" - x="51.433456" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="170.37161" - x="51.433456" - id="tspan2989-1-2-8" - sodipodi:role="line">Bit 5</tspan></text> - </g> - </g> - <g - transform="translate(967.01682,0.26600828)" - id="g3371-3-9-9"> - <rect - y="114.81322" - x="14.562887" - height="84.852814" - width="160.10918" - id="rect2985-3-8-8-3" - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <g - id="g3363-7-6-4"> - <text - sodipodi:linespacing="125%" - id="text2987-41-4-5-4" - y="170.37161" - x="51.433456" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="170.37161" - x="51.433456" - id="tspan2989-1-2-0-6" - sodipodi:role="line">Bit 6</tspan></text> - </g> - </g> - <g - transform="translate(1128.2082,0.24133828)" - id="g3371-3-2-0"> - <rect - y="114.81322" - x="14.562887" - height="84.852814" - width="160.10918" - id="rect2985-3-8-86-6" - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <g - id="g3363-7-0-6"> - <text - sodipodi:linespacing="125%" - id="text2987-41-4-2-1" - y="170.37161" - x="51.433456" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="170.37161" - x="51.433456" - id="tspan2989-1-2-4-8" - sodipodi:role="line">Bit 7</tspan></text> - </g> - </g> - </g> - <g - id="g3025-8" - transform="matrix(0.2273934,0,0,0.2273934,300.48366,210.19696)"> - <g - id="g3084"> - <rect - style="fill:#cccccc;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-2" - width="160.10918" - height="84.852814" - x="29.7995" - y="250.80614" /> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" - x="57.578697" - y="306.3645" - id="text2987-45" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-5" - x="57.578697" - y="306.3645">READ</tspan></text> - </g> - </g> - <g - id="g3371-3-9-8-4" - transform="matrix(0.2273934,0,0,0.2273934,303.94836,221.52814)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-8-6-9" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-6-5-6"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-5-0-3" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-0-9-7" - x="51.433456" - y="170.37161">Bit 8</tspan></text> - </g> - </g> - <g - id="g3371-3-9-8-4-8" - transform="matrix(0.2273934,0,0,0.2273934,340.65614,221.52499)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-8-6-9-8" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-6-5-6-2"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-5-0-3-9" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-0-9-7-1" - x="51.433456" - y="170.37161">Bit 9</tspan></text> - </g> - </g> - <g - id="g4012" - transform="matrix(0.2273934,0,0,0.2273934,10.929948,221.47683)"> - <g - transform="translate(1601.3444,-51.122901)" - id="g3137-6"> - <g - transform="translate(-5.2678572,1.5178572)" - id="g3184"> - <rect - y="250.80614" - x="29.799498" - height="84.852814" - width="1287" - id="rect2985-2-1-1" - style="fill:#ffffff;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <text - sodipodi:linespacing="125%" - id="text2987-45-1-4" - y="305.35434" - x="68.236969" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="305.35434" - x="68.236969" - id="tspan2989-5-5-2" - sodipodi:role="line">DATA</tspan></text> - </g> - </g> - <g - id="g3970"> - <g - id="g3371-3-5" - transform="translate(1611.2553,0.1918423)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-9" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-8"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-4" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-07" - x="51.433456" - y="170.37161">Bit 10</tspan></text> - </g> - </g> - <g - id="g3371-3-9-6" - transform="translate(1772.3984,0.17619461)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-8-36" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-6-1"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-5-5" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-0-4" - x="51.433456" - y="170.37161">Bit 11</tspan></text> - </g> - </g> - <g - id="g3371-3-2-2" - transform="translate(1933.5898,0.15152964)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-86-0" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-0-9"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-2-7" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-4-3" - x="51.433456" - y="170.37161">Bit 12</tspan></text> - </g> - </g> - <g - id="g3371-3-9-8-7" - transform="translate(2094.733,0.13587964)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-8-6-2" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-6-5-60"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-5-0-1" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-0-9-6" - x="51.433456" - y="170.37161">Bit 13</tspan></text> - </g> - </g> - <g - id="g3371-3-0-5" - transform="translate(2255.9253,0.09359488)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-0-7" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-61-5"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-3-4" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-8-1" - x="51.433456" - y="170.37161">Bit 14</tspan></text> - </g> - </g> - <g - id="g3371-3-9-9-2" - transform="translate(2417.0684,0.07794488)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-8-3-0" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-6-4-0"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-5-4-1" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-0-6-4" - x="51.433456" - y="170.37161">Bit 15</tspan></text> - </g> - </g> - <g - id="g3371-3-2-0-6" - transform="translate(2578.1601,0.05327488)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-86-6-0" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-0-6-7"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-2-1-1" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-4-8-7" - x="51.433456" - y="170.37161">Bit 16</tspan></text> - </g> - </g> - <g - id="g3371-3-2-0-6-7" - transform="translate(2739.1003,0.03811784)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-86-6-0-7" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-0-6-7-7"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-2-1-1-3" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-4-8-7-3" - x="51.433456" - y="170.37161">Bit 17</tspan></text> - </g> - </g> - </g> - </g> - <g - transform="matrix(0.2273934,0,0,0.2273934,10.929948,221.4397)" - id="g3234"> - <rect - style="fill:#cccccc;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-2-1-16" - width="160.10918" - height="84.852814" - x="2914.0579" - y="201.36435" /> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" - x="2952.4954" - y="255.91255" - id="text2987-45-1-8" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-5-5-5" - x="2952.4954" - y="255.91255">ACK</tspan></text> - </g> - <g - id="g3363-7-6-5-6-9" - transform="matrix(0.2273934,0,0,0.2273934,670.25138,221.5058)"> - <g - id="g4454"> - <rect - transform="translate(-2899.4747,-0.12740393)" - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-8-6-9-9" - width="160.10918" - height="84.852814" - x="2914.0376" - y="114.94062" /> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-5-0-3-8" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-0-9-7-18" - x="51.433456" - y="170.37161">Bit 18</tspan></text> - </g> - </g> - <g - transform="matrix(0.2273934,0,0,0.2273934,340.5387,221.48936)" - id="g4012-2"> - <g - id="g4349"> - <g - id="g3137-6-6" - transform="translate(1601.3444,-51.122901)"> - <g - id="g3184-6" - transform="translate(-5.2678572,1.5178572)"> - <rect - style="fill:#ffffff;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-2-1-1-0" - width="1287" - height="84.852814" - x="29.799498" - y="250.80614" /> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" - x="68.236969" - y="305.35434" - id="text2987-45-1-4-3" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-5-5-2-8" - x="68.236969" - y="305.35434">DATA</tspan></text> - </g> - </g> - <g - id="g4307"> - <g - transform="translate(1611.2553,0.1918423)" - id="g3371-3-5-1"> - <rect - y="114.81322" - x="14.562887" - height="84.852814" - width="160.10918" - id="rect2985-3-8-9-2" - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <g - id="g3363-7-8-5"> - <text - sodipodi:linespacing="125%" - id="text2987-41-4-4-0" - y="170.37161" - x="51.433456" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="170.37161" - x="51.433456" - id="tspan2989-1-2-07-9" - sodipodi:role="line">Bit 19</tspan></text> - </g> - </g> - <g - transform="translate(1772.3984,0.17619461)" - id="g3371-3-9-6-4"> - <rect - y="114.81322" - x="14.562887" - height="84.852814" - width="160.10918" - id="rect2985-3-8-8-36-7" - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <g - id="g3363-7-6-1-8"> - <text - sodipodi:linespacing="125%" - id="text2987-41-4-5-5-3" - y="170.37161" - x="51.433456" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="170.37161" - x="51.433456" - id="tspan2989-1-2-0-4-5" - sodipodi:role="line">Bit 20</tspan></text> - </g> - </g> - <g - transform="translate(1933.5898,0.15152964)" - id="g3371-3-2-2-1"> - <rect - y="114.81322" - x="14.562887" - height="84.852814" - width="160.10918" - id="rect2985-3-8-86-0-2" - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <g - id="g3363-7-0-9-0"> - <text - sodipodi:linespacing="125%" - id="text2987-41-4-2-7-1" - y="170.37161" - x="51.433456" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="170.37161" - x="51.433456" - id="tspan2989-1-2-4-3-6" - sodipodi:role="line">Bit 21</tspan></text> - </g> - </g> - <g - transform="translate(2094.733,0.13587964)" - id="g3371-3-9-8-7-4"> - <rect - y="114.81322" - x="14.562887" - height="84.852814" - width="160.10918" - id="rect2985-3-8-8-6-2-0" - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <g - id="g3363-7-6-5-60-6"> - <text - sodipodi:linespacing="125%" - id="text2987-41-4-5-0-1-1" - y="170.37161" - x="51.433456" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="170.37161" - x="51.433456" - id="tspan2989-1-2-0-9-6-8" - sodipodi:role="line">Bit 22</tspan></text> - </g> - </g> - <g - transform="translate(2255.9253,0.09359488)" - id="g3371-3-0-5-9"> - <rect - y="114.81322" - x="14.562887" - height="84.852814" - width="160.10918" - id="rect2985-3-8-0-7-8" - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <g - id="g3363-7-61-5-4"> - <text - sodipodi:linespacing="125%" - id="text2987-41-4-3-4-1" - y="170.37161" - x="51.433456" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="170.37161" - x="51.433456" - id="tspan2989-1-2-8-1-4" - sodipodi:role="line">Bit 23</tspan></text> - </g> - </g> - <g - transform="translate(2417.0684,0.07794488)" - id="g3371-3-9-9-2-3"> - <rect - y="114.81322" - x="14.562887" - height="84.852814" - width="160.10918" - id="rect2985-3-8-8-3-0-9" - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <g - id="g3363-7-6-4-0-8"> - <text - sodipodi:linespacing="125%" - id="text2987-41-4-5-4-1-8" - y="170.37161" - x="51.433456" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="170.37161" - x="51.433456" - id="tspan2989-1-2-0-6-4-0" - sodipodi:role="line">Bit 24</tspan></text> - </g> - </g> - <g - transform="translate(2578.1601,0.05327488)" - id="g3371-3-2-0-6-8"> - <rect - y="114.81322" - x="14.562887" - height="84.852814" - width="160.10918" - id="rect2985-3-8-86-6-0-77" - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <g - id="g3363-7-0-6-7-8"> - <text - sodipodi:linespacing="125%" - id="text2987-41-4-2-1-1-38" - y="170.37161" - x="51.433456" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="170.37161" - x="51.433456" - id="tspan2989-1-2-4-8-7-37" - sodipodi:role="line">Bit 25</tspan></text> - </g> - </g> - <g - transform="translate(2739.1003,0.03811784)" - id="g3371-3-2-0-6-7-1"> - <rect - y="114.81322" - x="14.562887" - height="84.852814" - width="160.10918" - id="rect2985-3-8-86-6-0-7-0" - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <g - id="g3363-7-0-6-7-7-7"> - <text - sodipodi:linespacing="125%" - id="text2987-41-4-2-1-1-3-3" - y="170.37161" - x="51.433456" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="170.37161" - x="51.433456" - id="tspan2989-1-2-4-8-7-3-4" - sodipodi:role="line">Bit 26</tspan></text> - </g> - </g> - </g> - </g> - </g> - <g - id="g4561" - transform="matrix(0.2273934,0,0,0.2273934,10.929948,221.47683)"> - <g - transform="translate(1449.4207,-0.08294312)" - id="g3296"> - <rect - style="fill:#cccccc;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-2-1-16-7" - width="160.10918" - height="84.852814" - x="2914.0579" - y="201.36435" /> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" - x="2941.0669" - y="258.05542" - id="text2987-45-1-8-9" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-5-5-5-5" - x="2941.0669" - y="258.05542">NACK</tspan></text> - </g> - <g - transform="translate(4348.9157,0.18342068)" - id="g4499"> - <rect - y="114.94062" - x="2914.0376" - height="84.852814" - width="160.10918" - id="rect2985-3-8-8-6-9-9-9" - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - transform="translate(-2899.4747,-0.12740393)" /> - <text - sodipodi:linespacing="125%" - id="text2987-41-4-5-0-3-8-9" - y="170.37161" - x="51.433456" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="170.37161" - x="51.433456" - id="tspan2989-1-2-0-9-7-18-6" - sodipodi:role="line">Bit 27</tspan></text> - </g> - </g> - <g - id="g4571" - transform="matrix(0.2273934,0,0,0.2273934,10.929948,221.47683)"> - <g - transform="translate(1610.7689,-0.16325573)" - id="g3296-4"> - <g - id="g3328"> - <rect - y="201.36435" - x="2914.0579" - height="84.852814" - width="160.10918" - id="rect2985-2-1-16-7-3" - style="fill:#cccccc;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <text - sodipodi:linespacing="125%" - id="text2987-45-1-8-9-1" - y="257.04526" - x="2945.1074" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="257.04526" - x="2945.1074" - id="tspan2989-5-5-5-5-2" - sodipodi:role="line">STOP</tspan></text> - </g> - </g> - <g - transform="translate(4510.1629,0.12740431)" - id="g4454-8"> - <rect - transform="translate(-2899.4747,-0.12740393)" - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.39766502px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-8-6-9-9-3" - width="160.10918" - height="84.852814" - x="2914.0376" - y="114.94062" /> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-5-0-3-8-4" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-0-9-7-18-8" - x="51.433456" - y="170.37161">Bit 28</tspan></text> - </g> - </g> - </g> -</svg> diff --git a/atmel-samd/asf/sam0/drivers/sercom/i2c/docimg/i2c_write.svg b/atmel-samd/asf/sam0/drivers/sercom/i2c/docimg/i2c_write.svg deleted file mode 100644 index 6f2628100..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/i2c/docimg/i2c_write.svg +++ /dev/null @@ -1,1031 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> - -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="1062.9977" - height="39.199993" - id="svg2" - version="1.1" - inkscape:version="0.48.4 r9939" - sodipodi:docname="i2c_write.svg"> - <defs - id="defs4" /> - <sodipodi:namedview - id="base" - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1.0" - inkscape:pageopacity="0.0" - inkscape:pageshadow="2" - inkscape:zoom="0.9899495" - inkscape:cx="-488.42509" - inkscape:cy="-132.2365" - inkscape:document-units="px" - inkscape:current-layer="layer1" - showgrid="false" - inkscape:window-width="1920" - inkscape:window-height="1138" - inkscape:window-x="1042" - inkscape:window-y="123" - inkscape:window-maximized="1" - fit-margin-top="0" - fit-margin-left="0" - fit-margin-right="0" - fit-margin-bottom="0" - units="cm" /> - <metadata - id="metadata7"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title /> - </cc:Work> - </rdf:RDF> - </metadata> - <g - inkscape:label="Layer 1" - inkscape:groupmode="layer" - id="layer1" - transform="translate(-994.63325,-178.88436)"> - <g - id="g3367" - transform="matrix(0.22739325,0,0,0.22304957,991.80606,153.76187)" /> - <g - id="g3651" - transform="matrix(0.22739325,0,0,0.22304957,991.80606,153.76187)"> - <g - transform="translate(-15.152288,-49.497478)" - id="g3025"> - <rect - style="fill:#cccccc;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985" - width="160.10918" - height="84.852814" - x="29.7995" - y="250.80614" /> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" - x="45.961941" - y="307.37466" - id="text2987" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989" - x="45.961941" - y="307.37466">START</tspan></text> - </g> - <g - transform="translate(0.08928571,0.54971913)" - id="g3371"> - <rect - y="114.81322" - x="14.562887" - height="84.852814" - width="160.10918" - id="rect2985-3" - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <g - id="g3363"> - <text - sodipodi:linespacing="125%" - id="text2987-41" - y="170.37161" - x="51.433456" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="170.37161" - x="51.433456" - id="tspan2989-1" - sodipodi:role="line">Bit 0</tspan></text> - </g> - </g> - </g> - <g - id="g3600" - transform="matrix(0.22739325,0,0,0.22304957,991.80606,153.76187)"> - <g - transform="translate(146.18369,-49.528111)" - id="g3025-0"> - <rect - style="fill:#cccccc;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-9" - width="1126" - height="84.852814" - x="29.799496" - y="250.80614" /> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" - x="45.961941" - y="307.37466" - id="text2987-4" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-8" - x="45.961941" - y="307.37466">ADDRESS</tspan></text> - </g> - <g - id="g3572"> - <g - id="g3371-3" - transform="translate(161.20365,0.3799057)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2" - x="51.433456" - y="170.37161">Bit 1</tspan></text> - </g> - </g> - <g - id="g3371-3-9" - transform="translate(322.34682,0.36425801)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-8" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-6"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-5" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-0" - x="51.433456" - y="170.37161">Bit 2</tspan></text> - </g> - </g> - <g - id="g3371-3-2" - transform="translate(483.53819,0.33959304)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-86" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-0"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-2" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-4" - x="51.433456" - y="170.37161">Bit 3</tspan></text> - </g> - </g> - <g - id="g3371-3-9-8" - transform="translate(644.68136,0.32394304)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-8-6" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-6-5"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-5-0" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-0-9" - x="51.433456" - y="170.37161">Bit 4</tspan></text> - </g> - </g> - <g - id="g3371-3-0" - transform="translate(805.87366,0.28165828)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-0" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-61"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-3" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-8" - x="51.433456" - y="170.37161">Bit 5</tspan></text> - </g> - </g> - <g - id="g3371-3-9-9" - transform="translate(967.01682,0.26600828)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-8-3" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-6-4"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-5-4" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-0-6" - x="51.433456" - y="170.37161">Bit 6</tspan></text> - </g> - </g> - <g - id="g3371-3-2-0" - transform="translate(1128.2082,0.24133828)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-86-6" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-0-6"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-2-1" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-4-8" - x="51.433456" - y="170.37161">Bit 7</tspan></text> - </g> - </g> - </g> - </g> - <g - id="g3588" - transform="matrix(0.22739325,0,0,0.22304957,991.80606,153.76187)"> - <g - transform="translate(1273.3602,-49.605043)" - id="g3025-8"> - <g - id="g3084"> - <rect - y="250.80614" - x="29.7995" - height="84.852814" - width="160.10918" - id="rect2985-2" - style="fill:#cccccc;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <text - sodipodi:linespacing="125%" - id="text2987-45" - y="306.3645" - x="45.456867" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="306.3645" - x="45.456867" - id="tspan2989-5" - sodipodi:role="line">WRITE</tspan></text> - </g> - </g> - <g - transform="translate(1288.5968,0.22568828)" - id="g3371-3-9-8-4"> - <rect - y="114.81322" - x="14.562887" - height="84.852814" - width="160.10918" - id="rect2985-3-8-8-6-9" - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <g - id="g3363-7-6-5-6"> - <text - sodipodi:linespacing="125%" - id="text2987-41-4-5-0-3" - y="170.37161" - x="51.433456" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="170.37161" - x="51.433456" - id="tspan2989-1-2-0-9-7" - sodipodi:role="line">Bit 8</tspan></text> - </g> - </g> - </g> - <g - id="g3575" - transform="matrix(0.22739325,0,0,0.22304957,991.80606,153.76187)"> - <g - transform="translate(1434.7887,-49.605043)" - id="g3025-8-1"> - <g - id="g3084-7"> - <g - id="g3137"> - <rect - style="fill:#ffffff;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-2-1" - width="160.10918" - height="84.852814" - x="29.7995" - y="250.80614" /> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" - x="68.236969" - y="305.35434" - id="text2987-45-1" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-5-5" - x="68.236969" - y="305.35434">ACK</tspan></text> - </g> - </g> - </g> - <g - transform="translate(1450.0253,0.21184383)" - id="g3371-3-9-8-4-8"> - <rect - y="114.81322" - x="14.562887" - height="84.852814" - width="160.10918" - id="rect2985-3-8-8-6-9-8" - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <g - id="g3363-7-6-5-6-2"> - <text - sodipodi:linespacing="125%" - id="text2987-41-4-5-0-3-9" - y="170.37161" - x="51.433456" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="170.37161" - x="51.433456" - id="tspan2989-1-2-0-9-7-1" - sodipodi:role="line">Bit 9</tspan></text> - </g> - </g> - </g> - <g - id="g4012" - transform="matrix(0.22739325,0,0,0.22304957,991.80606,153.76187)"> - <rect - y="201.2011" - x="1625.876" - height="84.852814" - width="1287" - id="rect2985-2-1-1" - style="fill:#cccccc;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <text - sodipodi:linespacing="125%" - id="text2987-45-1-4" - y="255.7493" - x="1664.3135" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="255.7493" - x="1664.3135" - id="tspan2989-5-5-2" - sodipodi:role="line">DATA</tspan></text> - <g - id="g3970"> - <g - id="g3371-3-5" - transform="translate(1611.2553,0.1918423)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-9" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-8"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-4" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-07" - x="51.433456" - y="170.37161">Bit 10</tspan></text> - </g> - </g> - <g - id="g3371-3-9-6" - transform="translate(1772.3984,0.17619461)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-8-36" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-6-1"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-5-5" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-0-4" - x="51.433456" - y="170.37161">Bit 11</tspan></text> - </g> - </g> - <g - id="g3371-3-2-2" - transform="translate(1933.5898,0.15152964)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-86-0" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-0-9"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-2-7" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-4-3" - x="51.433456" - y="170.37161">Bit 12</tspan></text> - </g> - </g> - <g - id="g3371-3-9-8-7" - transform="translate(2094.733,0.13587964)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-8-6-2" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-6-5-60"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-5-0-1" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-0-9-6" - x="51.433456" - y="170.37161">Bit 13</tspan></text> - </g> - </g> - <g - id="g3371-3-0-5" - transform="translate(2255.9253,0.09359488)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-0-7" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-61-5"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-3-4" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-8-1" - x="51.433456" - y="170.37161">Bit 14</tspan></text> - </g> - </g> - <g - id="g3371-3-9-9-2" - transform="translate(2417.0684,0.07794488)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-8-3-0" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-6-4-0"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-5-4-1" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-0-6-4" - x="51.433456" - y="170.37161">Bit 15</tspan></text> - </g> - </g> - <g - id="g3371-3-2-0-6" - transform="translate(2578.1601,0.05327488)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-86-6-0" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-0-6-7"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-2-1-1" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-4-8-7" - x="51.433456" - y="170.37161">Bit 16</tspan></text> - </g> - </g> - <g - id="g3371-3-2-0-6-7" - transform="translate(2739.1003,0.03811784)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-86-6-0-7" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-0-6-7-7"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-2-1-1-3" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-4-8-7-3" - x="51.433456" - y="170.37161">Bit 17</tspan></text> - </g> - </g> - </g> - </g> - <g - id="g3564" - transform="matrix(0.22739325,0,0,0.22304957,991.80606,153.76187)"> - <g - id="g3559"> - <rect - y="201.2011" - x="2914.0579" - height="84.852814" - width="160.10918" - id="rect2985-2-1-16" - style="fill:#ffffff;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <text - sodipodi:linespacing="125%" - id="text2987-45-1-8" - y="255.7493" - x="2952.4954" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="255.7493" - x="2952.4954" - id="tspan2989-5-5-5" - sodipodi:role="line">ACK</tspan></text> - </g> - <g - transform="translate(2899.4747,0.12740393)" - id="g3363-7-6-5-6-9"> - <g - id="g4454"> - <rect - y="114.94062" - x="2914.0376" - height="84.852814" - width="160.10918" - id="rect2985-3-8-8-6-9-9" - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - transform="translate(-2899.4747,-0.12740393)" /> - <text - sodipodi:linespacing="125%" - id="text2987-41-4-5-0-3-8" - y="170.37161" - x="51.433456" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="170.37161" - x="51.433456" - id="tspan2989-1-2-0-9-7-18" - sodipodi:role="line">Bit 18</tspan></text> - </g> - </g> - </g> - <rect - y="179.42236" - x="1727.759" - height="18.926369" - width="36.407738" - id="rect2985-3-8-8-36-7" - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <g - id="g3498" - transform="matrix(0.22739325,0,0,0.22304957,991.80606,153.76187)"> - <g - id="g3361"> - <rect - style="fill:#cccccc;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-2-1-1-0" - width="1287" - height="84.852814" - x="3075.3848" - y="201.2562" /> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" - x="3113.8223" - y="255.8044" - id="text2987-45-1-4-3" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-5-5-2-8" - x="3113.8223" - y="255.8044">DATA</tspan></text> - </g> - <g - id="g3458"> - <g - id="g3371-3-5-1" - transform="translate(3060.7641,0.24694231)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-9-2" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-8-5"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-4-0" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-07-9" - x="51.433456" - y="170.37161">Bit 19</tspan></text> - </g> - </g> - <g - id="g3363-7-6-1-8" - transform="translate(3221.9072,0.23129462)"> - <text - sodipodi:linespacing="125%" - id="text2987-41-4-5-5-3" - y="170.37161" - x="51.433456" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="170.37161" - x="51.433456" - id="tspan2989-1-2-0-4-5" - sodipodi:role="line">Bit 20</tspan></text> - </g> - <g - id="g3371-3-2-2-1" - transform="translate(3383.0986,0.20662965)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-86-0-2" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-0-9-0"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-2-7-1" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-4-3-6" - x="51.433456" - y="170.37161">Bit 21</tspan></text> - </g> - </g> - <g - id="g3371-3-9-8-7-4" - transform="translate(3544.2418,0.19097965)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-8-6-2-0" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-6-5-60-6"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-5-0-1-1" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-0-9-6-8" - x="51.433456" - y="170.37161">Bit 22</tspan></text> - </g> - </g> - <g - id="g3371-3-0-5-9" - transform="translate(3705.4341,0.14869489)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-0-7-8" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-61-5-4"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-3-4-1" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-8-1-4" - x="51.433456" - y="170.37161">Bit 23</tspan></text> - </g> - </g> - <g - id="g3371-3-9-9-2-3" - transform="translate(3866.5772,0.13304489)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-8-3-0-9" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-6-4-0-8"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-5-4-1-8" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-0-6-4-0" - x="51.433456" - y="170.37161">Bit 24</tspan></text> - </g> - </g> - <g - id="g3371-3-2-0-6-8" - transform="translate(4027.6689,0.10837489)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-86-6-0-77" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-0-6-7-8"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-2-1-1-38" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-4-8-7-37" - x="51.433456" - y="170.37161">Bit 25</tspan></text> - </g> - </g> - <g - id="g3371-3-2-0-6-7-1" - transform="translate(4188.6091,0.09321785)"> - <rect - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-86-6-0-7-0" - width="160.10918" - height="84.852814" - x="14.562887" - y="114.81322" /> - <g - id="g3363-7-0-6-7-7-7"> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-2-1-1-3-3" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-4-8-7-3-4" - x="51.433456" - y="170.37161">Bit 26</tspan></text> - </g> - </g> - </g> - </g> - <g - id="g3351" - transform="matrix(0.22739325,0,0,0.22304957,991.80606,153.76187)"> - <g - id="g3346"> - <rect - style="fill:#ffffff;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-2-1-16-7" - width="160.10918" - height="84.852814" - x="4363.4785" - y="201.2814" /> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" - x="4402.6099" - y="257.97247" - id="text2987-45-1-8-9" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-5-5-5-5" - x="4402.6099" - y="257.97247">ACK</tspan></text> - </g> - <g - transform="translate(4348.9157,0.18342068)" - id="g4499"> - <rect - y="114.94062" - x="2914.0376" - height="84.852814" - width="160.10918" - id="rect2985-3-8-8-6-9-9-9" - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - transform="translate(-2899.4747,-0.12740393)" /> - <text - sodipodi:linespacing="125%" - id="text2987-41-4-5-0-3-8-9" - y="170.37161" - x="51.433456" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="170.37161" - x="51.433456" - id="tspan2989-1-2-0-9-7-18-6" - sodipodi:role="line">Bit 27</tspan></text> - </g> - </g> - <g - id="g4571" - transform="matrix(0.22739325,0,0,0.22304957,991.80606,153.76187)"> - <g - transform="translate(1610.7689,-0.16325573)" - id="g3296-4"> - <g - id="g3328"> - <rect - y="201.36435" - x="2914.0579" - height="84.852814" - width="160.10918" - id="rect2985-2-1-16-7-3" - style="fill:#cccccc;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" /> - <text - sodipodi:linespacing="125%" - id="text2987-45-1-8-9-1" - y="257.04526" - x="2945.1074" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans" - xml:space="preserve"><tspan - y="257.04526" - x="2945.1074" - id="tspan2989-5-5-5-5-2" - sodipodi:role="line">STOP</tspan></text> - </g> - </g> - <g - transform="translate(4510.1629,0.12740431)" - id="g4454-8"> - <rect - transform="translate(-2899.4747,-0.12740393)" - style="fill:#333333;fill-rule:evenodd;stroke:#000000;stroke-width:4.4402833px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - id="rect2985-3-8-8-6-9-9-3" - width="160.10918" - height="84.852814" - x="2914.0376" - y="114.94062" /> - <text - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;font-family:Sans" - x="51.433456" - y="170.37161" - id="text2987-41-4-5-0-3-8-4" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan2989-1-2-0-9-7-18-8" - x="51.433456" - y="170.37161">Bit 28</tspan></text> - </g> - </g> - </g> -</svg> diff --git a/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_common.h b/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_common.h deleted file mode 100644 index de4f0d23f..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_common.h +++ /dev/null @@ -1,613 +0,0 @@ -/** - * \file - * - * \brief SAM SERCOM I2C Common Driver - * - * Copyright (c) 2012-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef I2C_COMMON_H_INCLUDED -#define I2C_COMMON_H_INCLUDED - -#include <compiler.h> -#include <sercom.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \if (I2C_MASTER_MODE && I2C_SLAVE_MODE) - * \defgroup asfdoc_sam0_sercom_i2c_group SAM I2C (SERCOM I2C) Driver - * \elseif I2C_MASTER_MODE - * \defgroup asfdoc_sam0_sercom_i2c_group SAM I2C Master Mode (SERCOM I2C) Driver - * \elseif I2C_SLAVE_MODE - * \defgroup asfdoc_sam0_sercom_i2c_group SAM I2C Slave Mode (SERCOM I2C) Driver - * \endif - * - * This driver for Atmel® | SMART ARM®-based microcontrollers provides - * an interface for the configuration and management of the device's SERCOM - * I<SUP>2</SUP>C module, for the transfer of data via an I<SUP>2</SUP>C bus. - * The following driver API modes are covered by this manual: - * - * \if I2C_MASTER_MODE - * - Master Mode Polled APIs - * \endif - * \if I2C_MASTER_CALLBACK_MODE - * - Master Mode Callback APIs - * \endif - * \if I2C_SLAVE_MODE - * - Slave Mode Polled APIs - * \endif - * \if I2C_SLAVE_CALLBACK_MODE - * - Slave Mode Callback APIs - * \endif - * - * The following peripheral is used by this module: - * - SERCOM (Serial Communication Interface) - * - * The following devices can use this module: - * - Atmel | SMART SAM D20/D21 - * - Atmel | SMART SAM R21 - * - Atmel | SMART SAM D09/D10/D11 - * - Atmel | SMART SAM L21/L22 - * - Atmel | SMART SAM DA1 - * - Atmel | SMART SAM C20/C21 - * - * The outline of this documentation is as follows: - * - \ref asfdoc_sam0_sercom_i2c_prerequisites - * - \ref asfdoc_sam0_sercom_i2c_overview - * - \ref asfdoc_sam0_sercom_i2c_special_considerations - * - \ref asfdoc_sam0_sercom_i2c_extra - * - \ref asfdoc_sam0_sercom_i2c_examples - * - \ref asfdoc_sam0_sercom_i2c_api_overview - * - * \section asfdoc_sam0_sercom_i2c_prerequisites Prerequisites - * There are no prerequisites. - * - * \section asfdoc_sam0_sercom_i2c_overview Module Overview - * The outline of this section is as follows: - * - \ref asfdoc_sam0_sercom_i2c_module_features - * - \ref asfdoc_sam0_sercom_i2c_functional_desc - * - \ref asfdoc_sam0_sercom_i2c_bus_topology - * - \ref asfdoc_sam0_sercom_i2c_transactions - * - \ref asfdoc_sam0_sercom_i2c_multi_master - * - \ref asfdoc_sam0_sercom_i2c_bus_states - * - \ref asfdoc_sam0_sercom_i2c_timeout - * - \ref asfdoc_sam0_sercom_i2c_sleep_modes - * - * \subsection asfdoc_sam0_sercom_i2c_module_features Driver Feature Macro Definition - * <table> - * <tr> - * <th>Driver Feature Macro</th> - * <th>Supported devices</th> - * </tr> - * <tr> - * <td>FEATURE_I2C_FAST_MODE_PLUS_AND_HIGH_SPEED</td> - * <td>SAM D21/R21/D10/D11/L21/L22/DA1/C20/C21</td> - * </tr> - * <tr> - * <td>FEATURE_I2C_10_BIT_ADDRESS</td> - * <td>SAM D21/R21/D10/D11/L21/L22/DA1/C20/C21</td> - * </tr> - * <tr> - * <td>FEATURE_I2C_SCL_STRETCH_MODE</td> - * <td>SAM D21/R21/D10/D11/L21/L22/DA1/C20/C21</td> - * </tr> - * <tr> - * <td>FEATURE_I2C_SCL_EXTEND_TIMEOUT</td> - * <td>SAM D21/R21/D10/D11/L21/L22/DA1/C20/C21</td> - * </tr> - * </table> - * \note The specific features are only available in the driver when the selected - * device supports those features. - * \note When using the I2C high-speed mode for off-board communication, - * there are various high frequency interference, which can lead to distortion of the signals - * and communication failure. When using Xplained Pro boards in order to test I2C high-speed - * communication, the following recommendation should be followed: - * - Use the SDA-line on PA08 and SCL-line on PA09 for both boards. This will provide stronger - * pull-ups on both SDA and SCL. - * - The SCL should not be higher than 1.5MHz. - * - * \subsection asfdoc_sam0_sercom_i2c_functional_desc Functional Description - * The I<SUP>2</SUP>C provides a simple two-wire bidirectional bus consisting of a - * wired-AND type serial clock line (SCL) and a wired-AND type serial data line - * (SDA). - * - * The I<SUP>2</SUP>C bus provides a simple, but efficient method of interconnecting - * multiple master and slave devices. An arbitration mechanism is provided for - * resolving bus ownership between masters, as only one master device may own - * the bus at any given time. The arbitration mechanism relies on the wired-AND - * connections to avoid bus drivers short-circuiting. - * - * A unique address is assigned to all slave devices connected to the bus. A - * device can contain both master and slave logic, and can emulate multiple - * slave devices by responding to more than one address. - * - * \subsection asfdoc_sam0_sercom_i2c_bus_topology Bus Topology - * The I<SUP>2</SUP>C bus topology is illustrated in - * \ref asfdoc_sam0_sercom_i2c_bus_topology_figure "the figure below". The pull-up - * resistors (Rs) will provide a high level on the bus lines when none of the - * I<SUP>2</SUP>C devices are driving the bus. These are optional, and can be - * replaced with a constant current source. - * - * \anchor asfdoc_sam0_sercom_i2c_bus_topology_figure - * \image html bus_topology.svg "I2C Bus Topology" Width=100% - * - * \subsection asfdoc_sam0_sercom_i2c_transactions Transactions - * The I<SUP>2</SUP>C standard defines three fundamental transaction formats: - * - Master Write - * - The master transmits data packets to the slave after addressing it - * - Master Read - * - The slave transmits data packets to the master after being addressed - * - Combined Read/Write - * - A combined transaction consists of several write and read transactions - * - * A data transfer starts with the master issuing a \b Start condition on the - * bus, followed by the address of the slave together with a bit to indicate - * whether the master wants to read from or write to the slave. - * The addressed slave must respond to this by sending an \b ACK back to the - * master. - * - * After this, data packets are sent from the master or slave, according to the - * read/write bit. Each packet must be acknowledged (ACK) or not - * acknowledged (NACK) by the receiver. - * - * If a slave responds with a NACK, the master must assume that the slave - * cannot receive any more data and cancel the write operation. - * - * The master completes a transaction by issuing a \b Stop condition. - * - * A master can issue multiple \b Start conditions during a transaction; this - * is then called a \b Repeated \b Start condition. - * - * \subsubsection asfdoc_sam0_sercom_i2c_address_packets Address Packets - * The slave address consists of seven bits. The 8<SUP>th</SUP> bit in the transfer - * determines the data direction (read or write). An address packet always - * succeeds a \b Start or \b Repeated \b Start condition. The 8<SUP>th</SUP> bit is handled - * in the driver, and the user will only have to provide the 7-bit address. - * - * \subsubsection asfdoc_sam0_sercom_i2c_data_packets Data Packets - * Data packets are nine bits long, consisting of one 8-bit data byte, and an - * acknowledgement bit. Data packets follow either an address packet or another - * data packet on the bus. - * - * \subsubsection asfdoc_sam0_sercom_i2c_trans_examples Transaction Examples - * The gray bits in the following examples are sent from master to slave, and - * the white bits are sent from slave to master. - * Example of a read transaction is shown in - * \ref asfdoc_sam0_sercom_i2c_trans_examples_i2c_read "the figure below". Here, the - * master first issues a \b Start condition and gets ownership of the bus. An - * address packet with the direction flag set to read is then sent and - * acknowledged by the slave. Then the slave sends one data packet which is - * acknowledged by the master. The slave sends another packet, which is not - * acknowledged by the master and indicates that the master will terminate the - * transaction. In the end, the transaction is terminated by the master issuing - * a \b Stop condition. - * - * \anchor asfdoc_sam0_sercom_i2c_trans_examples_i2c_read - * \image html i2c_read.svg "I2C Packet Read" Width=100% - * - * Example of a write transaction is shown in - * \ref asfdoc_sam0_sercom_i2c_trans_examples_i2c_write "the figure below". Here, the - * master first issues a \b Start condition and gets ownership of the bus. An - * address packet with the dir flag set to write is then sent and acknowledged - * by the slave. Then the master sends two data packets, each acknowledged by - * the slave. In the end, the transaction is terminated by the master issuing - * a \b Stop condition. - * - * \anchor asfdoc_sam0_sercom_i2c_trans_examples_i2c_write - * \image html i2c_write.svg "I2C Packet Write" Width=100% - * - * \subsubsection asfdoc_sam0_sercom_i2c_packet_timeout Packet Timeout - * When a master sends an I<SUP>2</SUP>C packet, there is no way of - * being sure that a slave will acknowledge the packet. To avoid stalling the - * device forever while waiting for an acknowledge, a user selectable timeout - * is provided in the \ref i2c_master_config struct which - * lets the driver exit a read or write operation after the specified time. - * The function will then return the STATUS_ERR_TIMEOUT flag. - * - * This is also the case for the slave when using the functions postfixed - * \c _wait. - * - * The time before the timeout occurs, will be the same as - * for \ref asfdoc_sam0_sercom_i2c_unknown_bus_timeout "unknown bus state" timeout. - * - * \subsubsection asfdoc_sam0_sercom_i2c_repeated_start Repeated Start - * To issue a \b Repeated \b Start, the functions postfixed \c _no_stop must be - * used. - * These functions will not send a \b Stop condition when the transfer is done, - * thus the next transfer will start with a \b Repeated \b Start. To end the - * transaction, the functions without the \c _no_stop postfix must be used - * for the last read/write. - * - * \subsection asfdoc_sam0_sercom_i2c_multi_master Multi Master - * In a multi master environment, arbitration of the bus is important, as only - * one master can own the bus at any point. - * - * \subsubsection asfdoc_sam0_sercom_i2c_arbitration Arbitration - * - * \par Clock stretching - * The serial clock line is always driven by a master device. However, all - * devices connected to the bus are allowed stretch the low period of the clock - * to slow down the overall clock frequency or to insert wait states while - * processing data. - * Both master and slave can randomly stretch the clock, which will force the - * other device into a wait-state until the clock line goes high again. - * - * \par Arbitration on the data line - * If two masters start transmitting at the same time, they will both transmit - * until one master detects that the other master is pulling the data line low. - * When this is detected, the master not pulling the line low, will stop the - * transmission and wait until the bus is idle. - * As it is the master trying to contact the slave with the lowest address that - * will get the bus ownership, this will create an arbitration scheme always - * prioritizing the slaves with the lowest address in case of a bus collision. - * - * \subsubsection asfdoc_sam0_sercom_i2c_clock_sync Clock Synchronization - * In situations where more than one master is trying to control the bus clock - * line at the same time, a clock synchronization algorithm based on the same - * principles used for clock stretching is necessary. - * - * - * \subsection asfdoc_sam0_sercom_i2c_bus_states Bus States - * As the I<SUP>2</SUP>C bus is limited to one transaction at the time, - * a master that wants to perform a bus transaction must wait until the bus is - * free. - * Because of this, it is necessary for all masters in a multi-master system to - * know the current status of the bus to be able to avoid conflicts and to - * ensure data integrity. - * \li \b IDLE No activity on the bus (between a \b Stop and a new \b Start - * condition) - * \li \b OWNER If the master initiates a transaction successfully - * \li \b BUSY If another master is driving the bus - * \li \b UNKNOWN If the master has recently been enabled or connected to - * the bus. Is forced to \b IDLE after given - * \ref asfdoc_sam0_sercom_i2c_unknown_bus_timeout "timeout" when - * the master module is enabled - * - * The bus state diagram can be seen in - * \ref asfdoc_sam0_sercom_i2c_bus_states_figure "the figure below". - * \li S: Start condition - * \li P: Stop condition - * \li Sr: Repeated start condition - * \anchor asfdoc_sam0_sercom_i2c_bus_states_figure - * \image html bus_state_diagram.svg "I2C Bus State Diagram" Width=100% - * - * \subsection asfdoc_sam0_sercom_i2c_timeout Bus Timing - * Inactive bus timeout for the master and SDA hold time is configurable in the - * drivers. - * - * \subsubsection asfdoc_sam0_sercom_i2c_unknown_bus_timeout Unknown Bus State Timeout - * When a master is enabled or connected to the bus, the bus state will be - * unknown until either a given timeout or a stop command has occurred. The - * timeout is configurable in the \ref i2c_master_config struct. - * The timeout time will depend on toolchain and optimization level used, as - * the timeout is a loop incrementing a value until it reaches the specified - * timeout value. - * - * \subsubsection sda_hold SDA Hold Timeout - * When using the I<SUP>2</SUP>C in slave mode, it will be important to - * set a SDA hold time which assures that the master will be able to pick up - * the bit sent from the slave. The SDA hold time makes sure that this is the - * case by holding the data line low for a given period after the negative edge - * on the clock. - * - * The SDA hold time is also available for the master driver, but is not a - * necessity. - * - * \subsection asfdoc_sam0_sercom_i2c_sleep_modes Operation in Sleep Modes - * The I<SUP>2</SUP>C module can operate in all sleep modes by setting - * the run_in_standby Boolean in the \ref i2c_master_config or - * \ref i2c_slave_config struct. - * The operation in slave and master mode is shown in - * \ref asfdoc_sam0_sercom_i2c_sleep_modes_table "the table below". - * - * \anchor asfdoc_sam0_sercom_i2c_sleep_modes_table - * <table> - * <caption>I2C Standby Operations</caption> - * <tr> - * <th>Run in standby</th> - * <th>Slave</th> - * <th>Master</th> - * </tr> - * <tr> - * <td>false</td> - * <td>Disabled, all reception is dropped</td> - * <td>Generic Clock (GCLK) disabled when master is idle</td> - * </tr> - * <tr> - * <td>true</td> - * <td>Wake on address match when enabled</td> - * <td>GCLK enabled while in sleep modes</td> - * </tr> - * </table> - * - * - * \section asfdoc_sam0_sercom_i2c_special_considerations Special Considerations - * - * \if (I2C_MASTER_CALLBACK_MODE || I2C_SLAVE_CALLBACK_MODE) - * \subsection asfdoc_sam0_sercom_i2c_common_interrupt Interrupt-driven Operation - * While an interrupt-driven operation is in progress, subsequent calls to a - * write or read operation will return the STATUS_BUSY flag, indicating that - * only one operation is allowed at any given time. - * - * To check if another transmission can be initiated, the user can either call - * another transfer operation, or use the - * \ref i2c_master_get_job_status/\ref i2c_slave_get_job_status functions - * depending on mode. - * - * If the user would like to get callback from operations while using the - * interrupt-driven driver, the callback must be registered and then enabled - * using the "register_callback" and "enable_callback" functions. - * \else - * There are no special considerations for this driver for the APIs listed in - * this document. - * \endif - * - * \section asfdoc_sam0_sercom_i2c_extra Extra Information - * For extra information, see \ref asfdoc_sam0_sercom_i2c_extra_info_page. - * This includes: - * - \ref asfdoc_sam0_sercom_i2c_acronyms - * - \ref asfdoc_sam0_sercom_i2c_extra_dependencies - * - \ref asfdoc_sam0_sercom_i2c_extra_errata - * - \ref asfdoc_sam0_sercom_i2c_extra_history - * - * \section asfdoc_sam0_sercom_i2c_examples Examples - * - * For a list of examples related to this driver, see - * \ref asfdoc_sam0_sercom_i2c_exqsg. - * - * \section asfdoc_sam0_sercom_i2c_api_overview API Overview - * @{ - */ - -/** - * \name Driver Feature Definition - * Define SERCOM I<SUP>2</SUP>C driver features set according to different device family. - * - * @{ - */ -#if (SAMD21) || (SAMR21) || (SAMD10) || (SAMD11) || (SAML21) || (SAMDA1) || \ - (SAML22) || (SAMC20) || (SAMC21) || (SAMD09) || (SAMR30) || defined(__DOXYGEN__) -/** Fast mode plus and high speed support. */ -# define FEATURE_I2C_FAST_MODE_PLUS_AND_HIGH_SPEED -/** 10-bit address support */ -# define FEATURE_I2C_10_BIT_ADDRESS -/** SCL stretch mode support */ -# define FEATURE_I2C_SCL_STRETCH_MODE -/** SCL extend timeout support */ -# define FEATURE_I2C_SCL_EXTEND_TIMEOUT -# define FEATURE_I2C_DMA_SUPPORT -#endif -/*@}*/ - -/** \brief Transfer direction - * - * For master: transfer direction or setting direction bit in address. - * For slave: direction of request from master. - */ -enum i2c_transfer_direction { - /** Master write operation is in progress */ - I2C_TRANSFER_WRITE = 0, - /** Master read operation is in progress */ - I2C_TRANSFER_READ = 1, -}; - -/** @} */ - -#ifdef __cplusplus -} -#endif - -/** - * \page asfdoc_sam0_sercom_i2c_extra_info_page Extra Information for SERCOM I2C Driver - * - * \section asfdoc_sam0_sercom_i2c_acronyms Acronyms - * \ref asfdoc_sam0_sercom_i2c_acronyms_table "Below" is a table listing the acronyms - * used in this module, along with their intended meanings. - * - * \anchor asfdoc_sam0_sercom_i2c_acronyms_table - * <table> - * <caption>Acronyms</caption> - * <tr> - * <th>Acronym</th> - * <th>Description</th> - * </tr> - * <tr> - * <td>SDA</td> - * <td>Serial Data Line</td> - * </tr> - * <tr> - * <td>SCL</td> - * <td>Serial Clock Line</td> - * </tr> - * <tr> - * <td>SERCOM</td> - * <td>Serial Communication Interface</td> - * </tr> - * <tr> - * <td>DMA</td> - * <td>Direct Memory Access</td> - * </tr> - * </table> - * - * \section asfdoc_sam0_sercom_i2c_extra_dependencies Dependencies - * The I<SUP>2</SUP>C driver has the following dependencies: - * \li \ref asfdoc_sam0_system_pinmux_group "System Pin Multiplexer Driver" - * - * - * \section asfdoc_sam0_sercom_i2c_extra_errata Errata - * There are no errata related to this driver. - * - * \section asfdoc_sam0_sercom_i2c_extra_history Module History - * \ref asfdoc_sam0_sercom_i2c_extra_history_table "Below" is an overview of the - * module history, detailing enhancements and fixes made to the module since - * its first release. The current version of this corresponds to the newest - * version listed in - * \ref asfdoc_sam0_sercom_i2c_extra_history_table "the table below". - * - * \anchor asfdoc_sam0_sercom_i2c_extra_history_table - * <table> - * <caption>Module History</caption> - * <tr> - * <th>Changelog</th> - * </tr> - * <tr> - * <td> - * \li Added 10-bit addressing and high speed support in SAM D21 - * \li Separate structure i2c_packet into i2c_master_packet and i2c_slave packet - * </td> - * </tr> - * <tr> - * <td> - * \li Added support for SCL stretch and extended timeout hardware features in SAM D21 - * \li Added fast mode plus support in SAM D21 - * </td> - * </tr> - * <tr> - * <td>Fixed incorrect logical mask for determining if a bus error has - * occurred in I<SUP>2</SUP>C Slave mode - * </td> - * </tr> - * <tr> - * <td>Initial Release</td> - * </tr> - * </table> - */ - -/** - * \page asfdoc_sam0_sercom_i2c_exqsg Examples for SERCOM I2C Driver - * - * This is a list of the available Quick Start guides (QSGs) and example - * applications for \ref asfdoc_sam0_sercom_i2c_group. QSGs are simple examples with - * step-by-step instructions to configure and use this driver in a selection of - * use cases. Note that a QSG can be compiled as a standalone application or be - * added to the user application. - * - * \if I2C_MASTER_MODE - * - \subpage asfdoc_sam0_sercom_i2c_master_basic_use_case "Quick Start Guide for the I2C Master module - Basic Use Case" - * \endif - * \if I2C_MASTER_CALLBACK_MODE - * - \subpage asfdoc_sam0_sercom_i2c_master_callback_use_case "Quick Start Guide for the I2C Master module - Callback Use Case" - * - \subpage asfdoc_sam0_sercom_i2c_master_dma_use_case "Quick Start Guide for the I2C Master module - DMA Use Case" - * \endif - * \if I2C_SLAVE_MODE - * - \subpage asfdoc_sam0_sercom_i2c_slave_basic_use_case "Quick Start Guide for the I2C Slave module - Basic Use Case" - * \endif - * \if I2C_SLAVE_CALLBACK_MODE - * - \subpage asfdoc_sam0_sercom_i2c_slave_callback_use_case "Quick Start Guide for the I2C Slave module - Callback Use Case" - * - \subpage asfdoc_sam0_sercom_i2c_slave_dma_use_case "Quick Start Guide for the I2C Slave module - DMA Use Case" - * \endif - * - * \page asfdoc_sam0_sercom_i2c_document_revision_history Document Revision History - * - * \if (I2C_MASTER_MODE || I2C_MASTER_CALLBACK_MODE) - * <table> - * <tr> - * <th>Doc. Rev.</th> - * <th>Date</th> - * <th>Comments</th> - * </tr> - * <tr> - * <td>42117E</td> - * <td>12/2015</td> - * <td>Added support for SAM L21/L22, SAM DA1, SAM D09, and SAM C21</td> - * </tr> - * <tr> - * <td>42117D</td> - * <td>12/2014</td> - * <td>Added support for 10-bit addressing and high speed in SAM D21. - * Added support for SAM R21 and SAM D10/D11.</td> - * </tr> - * <tr> - * <td>42117C</td> - * <td>01/2014</td> - * <td>Added support for SAM D21</td> - * </tr> - * <tr> - * <td>42117B</td> - * <td>06/2013</td> - * <td>Corrected documentation typos. Updated I<SUP>2</SUP>C Bus State Diagram.</td> - * </tr> - * <tr> - * <td>42117A</td> - * <td>06/2013</td> - * <td>Initial release</td> - * </tr> - * </table> - * \else - * <table> - * <tr> - * <th>Doc. Rev.</th> - * <th>Date</th> - * <th>Comments</th> - * </tr> - * <tr> - * <td>42116E</td> - * <td>12/2015</td> - * <td>Added support for SAM L21/L22, SAM DA1, SAM D09, and SAM C21</td> - * </tr> - * <tr> - * <td>42116D</td> - * <td>12/2014</td> - * <td>Added support for 10-bit addressing and high speed in SAM D21. - * Added support for SAM R21 and SAM D10/D11.</td> - * </tr> - * <tr> - * <td>42116C</td> - * <td>01/2014</td> - * <td>Added support for SAM D21</td> - * </tr> - * <tr> - * <td>42116B</td> - * <td>06/2013</td> - * <td>Corrected documentation typos. Updated I<SUP>2</SUP>C Bus State Diagram.</td> - * </tr> - * <tr> - * <td>42116A</td> - * <td>06/2013</td> - * <td>Initial release</td> - * </tr> - * </table> - *\endif - */ - -#endif /* I2C_COMMON_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_master.h b/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_master.h deleted file mode 100644 index 79c2effe8..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_master.h +++ /dev/null @@ -1,629 +0,0 @@ -/** - * \file - * - * \brief SAM SERCOM I2C Master Driver - * - * Copyright (C) 2012-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef I2C_MASTER_H_INCLUDED -#define I2C_MASTER_H_INCLUDED - -#include "i2c_common.h" -#include <sercom.h> -#include <pinmux.h> - -#if I2C_MASTER_CALLBACK_MODE == true -# include <sercom_interrupt.h> -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef PINMUX_DEFAULT -# define PINMUX_DEFAULT 0 -#endif - -/** - * \addtogroup asfdoc_sam0_sercom_i2c_group - * - * @{ - */ - -/** - * \brief I<SUP>2</SUP>C master packet for read/write - * - * Structure to be used when transferring I<SUP>2</SUP>C master packets. - */ -struct i2c_master_packet { - /** Address to slave device */ - uint16_t address; - /** Length of data array */ - uint16_t data_length; - /** Data array containing all data to be transferred */ - uint8_t *data; - /** Use 10-bit addressing. Set to false if the feature is not supported by the device */ - bool ten_bit_address; - /** Use high speed transfer. Set to false if the feature is not supported by the device */ - bool high_speed; - /** High speed mode master code (0000 1XXX), valid when high_speed is true */ - uint8_t hs_master_code; -}; - -/** \brief Interrupt flags - * - * Flags used when reading or setting interrupt flags. - */ -enum i2c_master_interrupt_flag { - /** Interrupt flag used for write */ - I2C_MASTER_INTERRUPT_WRITE = 0, - /** Interrupt flag used for read */ - I2C_MASTER_INTERRUPT_READ = 1, -}; - -/** - * \brief Values for hold time after start bit. - * - * Values for the possible I<SUP>2</SUP>C master mode SDA internal hold times after start - * bit has been sent. - */ -enum i2c_master_start_hold_time { - /** Internal SDA hold time disabled */ - I2C_MASTER_START_HOLD_TIME_DISABLED = SERCOM_I2CM_CTRLA_SDAHOLD(0), - /** Internal SDA hold time 50ns - 100ns */ - I2C_MASTER_START_HOLD_TIME_50NS_100NS = SERCOM_I2CM_CTRLA_SDAHOLD(1), - /** Internal SDA hold time 300ns - 600ns */ - I2C_MASTER_START_HOLD_TIME_300NS_600NS = SERCOM_I2CM_CTRLA_SDAHOLD(2), - /** Internal SDA hold time 400ns - 800ns */ - I2C_MASTER_START_HOLD_TIME_400NS_800NS = SERCOM_I2CM_CTRLA_SDAHOLD(3), -}; - -/** - * \brief Values for inactive bus time-out. - * - * If the inactive bus time-out is enabled and the bus is inactive for - * longer than the time-out setting, the bus state logic will be set to idle. - */ -enum i2c_master_inactive_timeout { - /** Inactive bus time-out disabled */ - I2C_MASTER_INACTIVE_TIMEOUT_DISABLED = SERCOM_I2CM_CTRLA_INACTOUT(0), - /** Inactive bus time-out 5-6 SCL cycle time-out */ - I2C_MASTER_INACTIVE_TIMEOUT_55US = SERCOM_I2CM_CTRLA_INACTOUT(1), - /** Inactive bus time-out 10-11 SCL cycle time-out */ - I2C_MASTER_INACTIVE_TIMEOUT_105US = SERCOM_I2CM_CTRLA_INACTOUT(2), - /** Inactive bus time-out 20-21 SCL cycle time-out */ - I2C_MASTER_INACTIVE_TIMEOUT_205US = SERCOM_I2CM_CTRLA_INACTOUT(3), -}; - -/** - * \brief I<SUP>2</SUP>C frequencies - * - * Values for I<SUP>2</SUP>C speeds supported by the module. The driver - * will also support setting any other value, in which case set - * the value in the \ref i2c_master_config at desired value divided by 1000. - * - * Example: If 10KHz operation is required, give baud_rate in the configuration - * structure the value 10. - */ -enum i2c_master_baud_rate { - /** Baud rate at 100KHz (Standard-mode) */ - I2C_MASTER_BAUD_RATE_100KHZ = 100, - /** Baud rate at 400KHz (Fast-mode) */ - I2C_MASTER_BAUD_RATE_400KHZ = 400, -#ifdef FEATURE_I2C_FAST_MODE_PLUS_AND_HIGH_SPEED - /** Baud rate at 1MHz (Fast-mode Plus) */ - I2C_MASTER_BAUD_RATE_1000KHZ = 1000, - /** Baud rate at 3.4MHz (High-speed mode) */ - I2C_MASTER_BAUD_RATE_3400KHZ = 3400, -#endif -}; - -#ifdef FEATURE_I2C_FAST_MODE_PLUS_AND_HIGH_SPEED -/** - * \brief Enum for the transfer speed - * - * Enum for the transfer speed. - */ -enum i2c_master_transfer_speed { - /** Standard-mode (Sm) up to 100KHz and Fast-mode (Fm) up to 400KHz */ - I2C_MASTER_SPEED_STANDARD_AND_FAST = SERCOM_I2CM_CTRLA_SPEED(0), - /** Fast-mode Plus (Fm+) up to 1MHz */ - I2C_MASTER_SPEED_FAST_MODE_PLUS = SERCOM_I2CM_CTRLA_SPEED(1), - /** High-speed mode (Hs-mode) up to 3.4MHz */ - I2C_MASTER_SPEED_HIGH_SPEED = SERCOM_I2CM_CTRLA_SPEED(2), -}; -#endif - -#if I2C_MASTER_CALLBACK_MODE == true -/** - * \brief Callback types - * - * The available callback types for the I<SUP>2</SUP>C master module. - */ -enum i2c_master_callback { - /** Callback for packet write complete */ - I2C_MASTER_CALLBACK_WRITE_COMPLETE = 0, - /** Callback for packet read complete */ - I2C_MASTER_CALLBACK_READ_COMPLETE = 1, - /** Callback for error */ - I2C_MASTER_CALLBACK_ERROR = 2, -# if !defined(__DOXYGEN__) - /** Total number of callbacks */ - _I2C_MASTER_CALLBACK_N = 3, -# endif -}; - -# if !defined(__DOXYGEN__) -/* Prototype for software module */ -struct i2c_master_module; - -typedef void (*i2c_master_callback_t)( - struct i2c_master_module *const module); -# endif -#endif - -/** - * \brief SERCOM I<SUP>2</SUP>C Master driver software device instance structure. - * - * SERCOM I<SUP>2</SUP>C Master driver software instance structure, used to - * retain software state information of an associated hardware module instance. - * - * \note The fields of this structure should not be altered by the user - * application; they are reserved for module-internal use only. - */ -struct i2c_master_module { -#if !defined(__DOXYGEN__) - /** Hardware instance initialized for the struct */ - Sercom *hw; - /** Module lock */ - volatile bool locked; - /** Unknown bus state timeout */ - uint16_t unknown_bus_state_timeout; - /** Buffer write timeout value */ - uint16_t buffer_timeout; - /** If true, stop condition will be sent after a read/write */ - bool send_stop; - /** If true, nack signal will be sent after a read/write */ - bool send_nack; -# if I2C_MASTER_CALLBACK_MODE == true - /** Pointers to callback functions */ - volatile i2c_master_callback_t callbacks[_I2C_MASTER_CALLBACK_N]; - /** Mask for registered callbacks */ - volatile uint8_t registered_callback; - /** Mask for enabled callbacks */ - volatile uint8_t enabled_callback; - /** The total number of bytes to transfer */ - volatile uint16_t buffer_length; - /** - * Counter used for bytes left to send in write and to count number of - * obtained bytes in read - */ - volatile uint16_t buffer_remaining; - /** Data buffer for packet write and read */ - volatile uint8_t *buffer; - /** Save direction of async request. 1 = read, 0 = write */ - volatile enum i2c_transfer_direction transfer_direction; - /** Status for status read back in error callback */ - volatile enum status_code status; -# endif -#endif -}; - -/** - * \brief Configuration structure for the I<SUP>2</SUP>C Master device - * - * This is the configuration structure for the I<SUP>2</SUP>C Master device. It - * is used as an argument for \ref i2c_master_init to provide the desired - * configurations for the module. The structure should be initialized using the - * \ref i2c_master_get_config_defaults. - */ -struct i2c_master_config { - /** Baud rate (in KHz) for I<SUP>2</SUP>C operations in - * standard-mode, Fast-mode, and Fast-mode Plus Transfers, - * \ref i2c_master_baud_rate */ - uint32_t baud_rate; -#ifdef FEATURE_I2C_FAST_MODE_PLUS_AND_HIGH_SPEED - /** Baud rate (in KHz) for I<SUP>2</SUP>C operations in - * High-speed mode, \ref i2c_master_baud_rate */ - uint32_t baud_rate_high_speed; - /** Transfer speed mode */ - enum i2c_master_transfer_speed transfer_speed; -#endif - /** GCLK generator to use as clock source */ - enum gclk_generator generator_source; - /** Bus hold time after start signal on data line */ - enum i2c_master_start_hold_time start_hold_time; - /** Unknown bus state \ref asfdoc_sam0_sercom_i2c_unknown_bus_timeout "timeout" */ - uint16_t unknown_bus_state_timeout; - /** Timeout for packet write to wait for slave */ - uint16_t buffer_timeout; - /** Set to keep module active in sleep modes */ - bool run_in_standby; - /** PAD0 (SDA) pinmux */ - uint32_t pinmux_pad0; - /** PAD1 (SCL) pinmux */ - uint32_t pinmux_pad1; - /** Set to enable SCL low time-out */ - bool scl_low_timeout; - /** Inactive bus time out */ - enum i2c_master_inactive_timeout inactive_timeout; -#ifdef FEATURE_I2C_SCL_STRETCH_MODE - /** Set to enable SCL stretch only after ACK bit (required for high speed) */ - bool scl_stretch_only_after_ack_bit; -#endif -#ifdef FEATURE_I2C_SCL_EXTEND_TIMEOUT - /** Set to enable slave SCL low extend time-out */ - bool slave_scl_low_extend_timeout; - /** Set to enable maser SCL low extend time-out */ - bool master_scl_low_extend_timeout; -#endif - /** Get more accurate BAUD, considering rise time(required for standard-mode and Fast-mode) */ - uint16_t sda_scl_rise_time_ns; -}; - -/** - * \name Lock/Unlock - * @{ - */ - -/** - * \brief Attempt to get lock on driver instance - * - * This function checks the instance's lock, which indicates whether or not it - * is currently in use, and sets the lock if it was not already set. - * - * The purpose of this is to enable exclusive access to driver instances, so - * that, e.g., transactions by different services will not interfere with each - * other. - * - * \param[in,out] module Pointer to the driver instance to lock - * - * \retval STATUS_OK If the module was locked - * \retval STATUS_BUSY If the module was already locked - */ -static inline enum status_code i2c_master_lock( - struct i2c_master_module *const module) -{ - enum status_code status; - - system_interrupt_enter_critical_section(); - - if (module->locked) { - status = STATUS_BUSY; - } else { - module->locked = true; - status = STATUS_OK; - } - - system_interrupt_leave_critical_section(); - - return status; -} - -/** - * \brief Unlock driver instance - * - * This function clears the instance lock, indicating that it is available for - * use. - * - * \param[in,out] module Pointer to the driver instance to lock - * - * \retval STATUS_OK If the module was locked - * \retval STATUS_BUSY If the module was already locked - */ -static inline void i2c_master_unlock(struct i2c_master_module *const module) -{ - module->locked = false; -} - -/** @} */ - -/** - * \name Configuration and Initialization - * @{ - */ - -/** - * \brief Returns the synchronization status of the module - * - * Returns the synchronization status of the module. - * - * \param[in] module Pointer to software module structure - * - * \return Status of the synchronization. - * \retval true Module is busy synchronizing - * \retval false Module is not synchronizing - */ -static inline bool i2c_master_is_syncing ( - const struct i2c_master_module *const module) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_hw = &(module->hw->I2CM); - -#if defined(FEATURE_SERCOM_SYNCBUSY_SCHEME_VERSION_1) - return (i2c_hw->STATUS.reg & SERCOM_I2CM_STATUS_SYNCBUSY); -#elif defined(FEATURE_SERCOM_SYNCBUSY_SCHEME_VERSION_2) - return (i2c_hw->SYNCBUSY.reg & SERCOM_I2CM_SYNCBUSY_MASK); -#else -# error Unknown SERCOM SYNCBUSY scheme! -#endif -} - -#if !defined(__DOXYGEN__) -/** - * \internal - * Wait for hardware module to sync - * - * \param[in] module Pointer to software module structure - */ -static void _i2c_master_wait_for_sync( - const struct i2c_master_module *const module) -{ - /* Sanity check */ - Assert(module); - - while (i2c_master_is_syncing(module)) { - /* Wait for I2C module to sync. */ - } -} -#endif - -/** - * \brief Gets the I<SUP>2</SUP>C master default configurations - * - * Use to initialize the configuration structure to known default values. - * - * The default configuration is as follows: - * - Baudrate 100KHz - * - GCLK generator 0 - * - Do not run in standby - * - Start bit hold time 300ns - 600ns - * - Buffer timeout = 65535 - * - Unknown bus status timeout = 65535 - * - Do not run in standby - * - PINMUX_DEFAULT for SERCOM pads - * - * Those default configuration only available if the device supports it: - * - High speed baudrate 3.4MHz - * - Standard-mode and Fast-mode transfer speed - * - SCL stretch disabled - * - Slave SCL low extend time-out disabled - * - Master SCL low extend time-out disabled - * - * \param[out] config Pointer to configuration structure to be initiated - */ -static inline void i2c_master_get_config_defaults( - struct i2c_master_config *const config) -{ - /*Sanity check argument */ - Assert(config); - config->baud_rate = I2C_MASTER_BAUD_RATE_100KHZ; -#ifdef FEATURE_I2C_FAST_MODE_PLUS_AND_HIGH_SPEED - config->baud_rate_high_speed = I2C_MASTER_BAUD_RATE_3400KHZ; - config->transfer_speed = I2C_MASTER_SPEED_STANDARD_AND_FAST; -#endif - config->generator_source = GCLK_GENERATOR_0; - config->run_in_standby = false; - config->start_hold_time = I2C_MASTER_START_HOLD_TIME_300NS_600NS; - config->buffer_timeout = 65535; - config->unknown_bus_state_timeout = 65535; - config->pinmux_pad0 = PINMUX_DEFAULT; - config->pinmux_pad1 = PINMUX_DEFAULT; - config->scl_low_timeout = false; - config->inactive_timeout = I2C_MASTER_INACTIVE_TIMEOUT_DISABLED; -#ifdef FEATURE_I2C_SCL_STRETCH_MODE - config->scl_stretch_only_after_ack_bit = false; -#endif -#ifdef FEATURE_I2C_SCL_EXTEND_TIMEOUT - config->slave_scl_low_extend_timeout = false; - config->master_scl_low_extend_timeout = false; -#endif - /* The typical value is 215ns */ - config->sda_scl_rise_time_ns = 215; -} - -enum status_code i2c_master_init( - struct i2c_master_module *const module, - Sercom *const hw, - const struct i2c_master_config *const config); - -/** - * \brief Enables the I<SUP>2</SUP>C module - * - * Enables the requested I<SUP>2</SUP>C module and set the bus state to IDLE - * after the specified \ref asfdoc_sam0_sercom_i2c_timeout "timeout" period if no - * stop bit is detected. - * - * \param[in] module Pointer to the software module struct - */ -static inline void i2c_master_enable( - const struct i2c_master_module *const module) -{ - /* Sanity check of arguments */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Timeout counter used to force bus state */ - uint32_t timeout_counter = 0; - - /* Wait for module to sync */ - _i2c_master_wait_for_sync(module); - - /* Enable module */ - i2c_module->CTRLA.reg |= SERCOM_I2CM_CTRLA_ENABLE; - -#if I2C_MASTER_CALLBACK_MODE == true - /* Enable module interrupts */ - system_interrupt_enable(_sercom_get_interrupt_vector(module->hw)); -#endif - /* Start timeout if bus state is unknown */ - while (!(i2c_module->STATUS.reg & SERCOM_I2CM_STATUS_BUSSTATE(1))) { - timeout_counter++; - if(timeout_counter >= (module->unknown_bus_state_timeout)) { - /* Timeout, force bus state to idle */ - i2c_module->STATUS.reg = SERCOM_I2CM_STATUS_BUSSTATE(1); - /* Workaround #1 */ - return; - } - } -} - -/** - * \brief Disable the I<SUP>2</SUP>C module - * - * Disables the requested I<SUP>2</SUP>C module. - * - * \param[in] module Pointer to the software module struct - */ -static inline void i2c_master_disable( - const struct i2c_master_module *const module) -{ - /* Sanity check of arguments */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - -#if I2C_MASTER_CALLBACK_MODE == true - /* Disable module interrupts */ - system_interrupt_disable(_sercom_get_interrupt_vector(module->hw)); -#endif - - /* Wait for module to sync */ - _i2c_master_wait_for_sync(module); - - /* Disbale interrupt */ - i2c_module->INTENCLR.reg = SERCOM_I2CM_INTENCLR_MASK; - /* Clear interrupt flag */ - i2c_module->INTFLAG.reg = SERCOM_I2CM_INTFLAG_MASK; - - /* Disable module */ - i2c_module->CTRLA.reg &= ~SERCOM_I2CM_CTRLA_ENABLE; - -} - -void i2c_master_reset(struct i2c_master_module *const module); - -/** @} */ - -/** -* \name Read and Write -* @{ -*/ - -enum status_code i2c_master_read_packet_wait( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet); - -enum status_code i2c_master_read_packet_wait_no_stop( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet); - -enum status_code i2c_master_write_packet_wait( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet); - -enum status_code i2c_master_write_packet_wait_no_stop( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet); - -void i2c_master_send_stop(struct i2c_master_module *const module); - -void i2c_master_send_nack(struct i2c_master_module *const module); - -enum status_code i2c_master_read_byte( - struct i2c_master_module *const module, - uint8_t *byte); - -enum status_code i2c_master_write_byte( - struct i2c_master_module *const module, - uint8_t byte); - -enum status_code i2c_master_read_packet_wait_no_nack( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet); - -/** @} */ - -#ifdef FEATURE_I2C_DMA_SUPPORT -/** -* \name SERCOM I2C Master with DMA Interfaces -* @{ -*/ - -/** - * \brief Set I<SUP>2</SUP>C for DMA transfer with slave address and transfer size. - * - * This function will set the slave address, transfer size and enable the auto transfer - * mode for DMA. - * - * \param[in,out] module Pointer to the driver instance to lock - * \param[in] addr I<SUP>2</SUP>C slave address - * \param[in] length I<SUP>2</SUP>C transfer length with DMA - * \param[in] direction I<SUP>2</SUP>C transfer direction - * - */ -static inline void i2c_master_dma_set_transfer(struct i2c_master_module *const module, - uint16_t addr, uint8_t length, enum i2c_transfer_direction direction) -{ - module->hw->I2CM.ADDR.reg = - SERCOM_I2CM_ADDR_ADDR(addr<<1) | - SERCOM_I2CM_ADDR_LENEN | - SERCOM_I2CM_ADDR_LEN(length) | - direction; -} - -/** @} */ -#endif - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* I2C_MASTER_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_master_interrupt.h b/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_master_interrupt.h deleted file mode 100644 index 249525d3c..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_master_interrupt.h +++ /dev/null @@ -1,214 +0,0 @@ -/** - * \file - * - * \brief SAM SERCOM I2C Master Interrupt Driver - * - * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef I2C_MASTER_INTERRUPT_H_INCLUDED -#define I2C_MASTER_INTERRUPT_H_INCLUDED - -#include "i2c_master.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \addtogroup asfdoc_sam0_sercom_i2c_group - * @{ - * - */ - -/** - * \name Callbacks - * @{ - */ -#if !defined(__DOXYGEN__) -void _i2c_master_interrupt_handler( - uint8_t instance); -#endif - -void i2c_master_register_callback( - struct i2c_master_module *const module, - i2c_master_callback_t callback, - enum i2c_master_callback callback_type); - -void i2c_master_unregister_callback( - struct i2c_master_module *const module, - enum i2c_master_callback callback_type); - -/** - * \brief Enables callback - * - * Enables the callback specified by the callback_type. - * - * \param[in,out] module Pointer to the software module struct - * \param[in] callback_type Callback type to enable - */ -static inline void i2c_master_enable_callback( - struct i2c_master_module *const module, - enum i2c_master_callback callback_type) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - - /* Mark callback as enabled */ - module->enabled_callback |= (1 << callback_type); -} - -/** - * \brief Disables callback - * - * Disables the callback specified by the callback_type. - * - * \param[in,out] module Pointer to the software module struct - * \param[in] callback_type Callback type to disable - */ -static inline void i2c_master_disable_callback( - struct i2c_master_module *const module, - enum i2c_master_callback callback_type) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - - /* Mark callback as disabled */ - module->enabled_callback &= ~(1 << callback_type); -} - -/** @} */ - -/** - * \name Read and Write, Interrupt-driven - * @{ - */ - -enum status_code i2c_master_read_bytes( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet); - -enum status_code i2c_master_read_packet_job( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet); - -enum status_code i2c_master_read_packet_job_no_stop( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet); - -enum status_code i2c_master_read_packet_job_no_nack( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet); - -enum status_code i2c_master_write_bytes( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet); - -enum status_code i2c_master_write_packet_job( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet); - -enum status_code i2c_master_write_packet_job_no_stop( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet); - -/** - * \brief Cancel any currently ongoing operation - * - * Terminates the running transfer operation. - * - * \param[in,out] module Pointer to software module structure - */ -static inline void i2c_master_cancel_job( - struct i2c_master_module *const module) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - - /* Set buffer to 0 */ - module->buffer_remaining = 0; - /* Update status */ - module->status = STATUS_ABORTED; -} - -/** - * \brief Get status from ongoing job - * - * Will return the status of a transfer operation. - * - * \param[in] module Pointer to software module structure - * - * \return Last status code from transfer operation. - * \retval STATUS_OK No error has occurred - * \retval STATUS_BUSY If transfer is in progress - * \retval STATUS_BUSY If master module is busy - * \retval STATUS_ERR_DENIED If error on bus - * \retval STATUS_ERR_PACKET_COLLISION If arbitration is lost - * \retval STATUS_ERR_BAD_ADDRESS If slave is busy, or no slave - * acknowledged the address - * \retval STATUS_ERR_TIMEOUT If timeout occurred - * \retval STATUS_ERR_OVERFLOW If slave did not acknowledge last sent - * data, indicating that slave does not - * want more data and was not able to read - */ -static inline enum status_code i2c_master_get_job_status( - struct i2c_master_module *const module) -{ - /* Check sanity */ - Assert(module); - Assert(module->hw); - - /* Return current status code */ - return module->status; -} - -/** @} */ - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* I2C_MASTER_INTERRUPT_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_sam0/i2c_master.c b/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_sam0/i2c_master.c deleted file mode 100644 index 4e37b4f09..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_sam0/i2c_master.c +++ /dev/null @@ -1,1050 +0,0 @@ -/** - * \file - * - * \brief SAM I2C Master Driver - * - * Copyright (C) 2012-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#include "i2c_master.h" - -#if I2C_MASTER_CALLBACK_MODE == true -# include "i2c_master_interrupt.h" -#endif - -/* Forward declaration */ -enum status_code _i2c_master_wait_for_bus( - struct i2c_master_module *const module); - -enum status_code _i2c_master_address_response( - struct i2c_master_module *const module); - -enum status_code _i2c_master_send_hs_master_code( - struct i2c_master_module *const module, - uint8_t hs_master_code); - -#if !defined(__DOXYGEN__) - -/** - * \internal Sets configurations to module - * - * \param[out] module Pointer to software module structure - * \param[in] config Configuration structure with configurations to set - * - * \return Status of setting configuration. - * \retval STATUS_OK If module was configured correctly - * \retval STATUS_ERR_ALREADY_INITIALIZED If setting other GCLK generator than - * previously set - * \retval STATUS_ERR_BAUDRATE_UNAVAILABLE If given baudrate is not compatible - * with set GCLK frequency - */ -static enum status_code _i2c_master_set_config( - struct i2c_master_module *const module, - const struct i2c_master_config *const config) -{ - /* Sanity check arguments. */ - Assert(module); - Assert(module->hw); - Assert(config); - - /* Temporary variables. */ - uint32_t tmp_ctrla; - int32_t tmp_baud = 0; - int32_t tmp_baud_hs = 0; - int32_t tmp_baudlow_hs = 0; - enum status_code tmp_status_code = STATUS_OK; - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - Sercom *const sercom_hw = module->hw; - - uint8_t sercom_index = _sercom_get_sercom_inst_index(sercom_hw); - - /* Pin configuration */ - struct system_pinmux_config pin_conf; - system_pinmux_get_config_defaults(&pin_conf); - - uint32_t pad0 = config->pinmux_pad0; - uint32_t pad1 = config->pinmux_pad1; - - /* SERCOM PAD0 - SDA */ - if (pad0 == PINMUX_DEFAULT) { - pad0 = _sercom_get_default_pad(sercom_hw, 0); - } - pin_conf.mux_position = pad0 & 0xFFFF; - pin_conf.direction = SYSTEM_PINMUX_PIN_DIR_OUTPUT_WITH_READBACK; - system_pinmux_pin_set_config(pad0 >> 16, &pin_conf); - - /* SERCOM PAD1 - SCL */ - if (pad1 == PINMUX_DEFAULT) { - pad1 = _sercom_get_default_pad(sercom_hw, 1); - } - pin_conf.mux_position = pad1 & 0xFFFF; - pin_conf.direction = SYSTEM_PINMUX_PIN_DIR_OUTPUT_WITH_READBACK; - system_pinmux_pin_set_config(pad1 >> 16, &pin_conf); - - /* Save timeout on unknown bus state in software module. */ - module->unknown_bus_state_timeout = config->unknown_bus_state_timeout; - - /* Save timeout on buffer write. */ - module->buffer_timeout = config->buffer_timeout; - - /* Set whether module should run in standby. */ - if (config->run_in_standby || system_is_debugger_present()) { - tmp_ctrla = SERCOM_I2CM_CTRLA_RUNSTDBY; - } else { - tmp_ctrla = 0; - } - - /* Check and set start data hold timeout. */ - if (config->start_hold_time != I2C_MASTER_START_HOLD_TIME_DISABLED) { - tmp_ctrla |= config->start_hold_time; - } - - /* Check and set transfer speed */ - tmp_ctrla |= config->transfer_speed; - - /* Check and set SCL low timeout. */ - if (config->scl_low_timeout) { - tmp_ctrla |= SERCOM_I2CM_CTRLA_LOWTOUTEN; - } - - /* Check and set inactive bus timeout. */ - if (config->inactive_timeout != I2C_MASTER_INACTIVE_TIMEOUT_DISABLED) { - tmp_ctrla |= config->inactive_timeout; - } - - /* Check and set SCL clock stretch mode. */ - if (config->scl_stretch_only_after_ack_bit || (config->transfer_speed == I2C_MASTER_SPEED_HIGH_SPEED)) { - tmp_ctrla |= SERCOM_I2CM_CTRLA_SCLSM; - } - - /* Check and set slave SCL low extend timeout. */ - if (config->slave_scl_low_extend_timeout) { - tmp_ctrla |= SERCOM_I2CM_CTRLA_SEXTTOEN; - } - - /* Check and set master SCL low extend timeout. */ - if (config->master_scl_low_extend_timeout) { - tmp_ctrla |= SERCOM_I2CM_CTRLA_MEXTTOEN; - } - - /* Write config to register CTRLA. */ - i2c_module->CTRLA.reg |= tmp_ctrla; - - /* Set configurations in CTRLB. */ - i2c_module->CTRLB.reg = SERCOM_I2CM_CTRLB_SMEN; - - /* Find and set baudrate, considering sda/scl rise time */ - uint32_t fgclk = system_gclk_chan_get_hz(SERCOM0_GCLK_ID_CORE + sercom_index); - uint32_t fscl = 1000 * config->baud_rate; - uint32_t fscl_hs = 1000 * config->baud_rate_high_speed; - uint32_t trise = config->sda_scl_rise_time_ns; - - tmp_baud = (int32_t)(div_ceil( - fgclk - fscl * (10 + fgclk * trise * 0.000000001), 2 * fscl)); - - /* For High speed mode, set the SCL ratio of high:low to 1:2. */ - if (config->transfer_speed == I2C_MASTER_SPEED_HIGH_SPEED) { - tmp_baudlow_hs = (int32_t)((fgclk * 2.0) / (3.0 * fscl_hs) - 1); - if (tmp_baudlow_hs) { - tmp_baud_hs = (int32_t)(fgclk / fscl_hs) - 2 - tmp_baudlow_hs; - } else { - tmp_baud_hs = (int32_t)(div_ceil(fgclk, 2 * fscl_hs)) - 1; - } - } - - /* Check that baudrate is supported at current speed. */ - if (tmp_baud > 255 || tmp_baud < 0 || tmp_baud_hs > 255 || tmp_baud_hs < 0) { - /* Baud rate not supported. */ - tmp_status_code = STATUS_ERR_BAUDRATE_UNAVAILABLE; - } - if (tmp_status_code != STATUS_ERR_BAUDRATE_UNAVAILABLE) { - /* Baud rate acceptable. */ - i2c_module->BAUD.reg = SERCOM_I2CM_BAUD_BAUD(tmp_baud) | - SERCOM_I2CM_BAUD_HSBAUD(tmp_baud_hs) | SERCOM_I2CM_BAUD_HSBAUDLOW(tmp_baudlow_hs); - } - - return tmp_status_code; -} -#endif /* __DOXYGEN__ */ - -/** - * \brief Initializes the requested I<SUP>2</SUP>C hardware module - * - * Initializes the SERCOM I<SUP>2</SUP>C master device requested and sets the provided - * software module struct. Run this function before any further use of - * the driver. - * - * \param[out] module Pointer to software module struct - * \param[in] hw Pointer to the hardware instance - * \param[in] config Pointer to the configuration struct - * - * \return Status of initialization. - * \retval STATUS_OK Module initiated correctly - * \retval STATUS_ERR_DENIED If module is enabled - * \retval STATUS_BUSY If module is busy resetting - * \retval STATUS_ERR_ALREADY_INITIALIZED If setting other GCLK generator than - * previously set - * \retval STATUS_ERR_BAUDRATE_UNAVAILABLE If given baudrate is not compatible - * with set GCLK frequency - * - */ -enum status_code i2c_master_init( - struct i2c_master_module *const module, - Sercom *const hw, - const struct i2c_master_config *const config) -{ - /* Sanity check arguments. */ - Assert(module); - Assert(hw); - Assert(config); - - /* Initialize software module */ - module->hw = hw; - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - uint32_t sercom_index = _sercom_get_sercom_inst_index(module->hw); - uint32_t pm_index, gclk_index; - -#if (SAML22) || (SAMC20) - pm_index = sercom_index + MCLK_APBCMASK_SERCOM0_Pos; - gclk_index = sercom_index + SERCOM0_GCLK_ID_CORE; -#elif (SAML21) || (SAMR30) - if (sercom_index == 5) { - pm_index = MCLK_APBDMASK_SERCOM5_Pos; - gclk_index = SERCOM5_GCLK_ID_CORE; - } else { - pm_index = sercom_index + MCLK_APBCMASK_SERCOM0_Pos; - gclk_index = sercom_index + SERCOM0_GCLK_ID_CORE; - } -#elif (SAMC21) - pm_index = sercom_index + MCLK_APBCMASK_SERCOM0_Pos; - if (sercom_index == 5) { - gclk_index = SERCOM5_GCLK_ID_CORE; - } else { - gclk_index = sercom_index + SERCOM0_GCLK_ID_CORE; - } -#else - pm_index = sercom_index + PM_APBCMASK_SERCOM0_Pos; - gclk_index = sercom_index + SERCOM0_GCLK_ID_CORE; -#endif - - /* Turn on module in PM */ -#if (SAML21) || (SAMR30) - if (sercom_index == 5) { - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBD, 1 << pm_index); - } else { - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBC, 1 << pm_index); - } -#else - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBC, 1 << pm_index); -#endif - - /* Set up the GCLK for the module */ - struct system_gclk_chan_config gclk_chan_conf; - system_gclk_chan_get_config_defaults(&gclk_chan_conf); - gclk_chan_conf.source_generator = config->generator_source; - system_gclk_chan_set_config(gclk_index, &gclk_chan_conf); - system_gclk_chan_enable(gclk_index); - sercom_set_gclk_generator(config->generator_source, false); - - /* Check if module is enabled. */ - if (i2c_module->CTRLA.reg & SERCOM_I2CM_CTRLA_ENABLE) { - return STATUS_ERR_DENIED; - } - - /* Check if reset is in progress. */ - if (i2c_module->CTRLA.reg & SERCOM_I2CM_CTRLA_SWRST) { - return STATUS_BUSY; - } - -#if I2C_MASTER_CALLBACK_MODE == true - /* Get sercom instance index and register callback. */ - uint8_t instance_index = _sercom_get_sercom_inst_index(module->hw); - _sercom_set_handler(instance_index, _i2c_master_interrupt_handler); - _sercom_instances[instance_index] = module; - - /* Initialize values in module. */ - module->registered_callback = 0; - module->enabled_callback = 0; - module->buffer_length = 0; - module->buffer_remaining = 0; - - module->status = STATUS_OK; - module->buffer = NULL; -#endif - - /* Set sercom module to operate in I2C master mode. */ - i2c_module->CTRLA.reg = SERCOM_I2CM_CTRLA_MODE(0x5); - - /* Set config and return status. */ - return _i2c_master_set_config(module, config); -} - -/** - * \brief Resets the hardware module - * - * Reset the module to hardware defaults. - * - * \param[in,out] module Pointer to software module structure - */ -void i2c_master_reset(struct i2c_master_module *const module) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Wait for sync */ - _i2c_master_wait_for_sync(module); - - /* Disable module */ - i2c_master_disable(module); - -#if I2C_MASTER_CALLBACK_MODE == true - /* Clear all pending interrupts */ - system_interrupt_enter_critical_section(); - system_interrupt_clear_pending(_sercom_get_interrupt_vector(module->hw)); - system_interrupt_leave_critical_section(); -#endif - - /* Wait for sync */ - _i2c_master_wait_for_sync(module); - - /* Reset module */ - i2c_module->CTRLA.reg = SERCOM_I2CM_CTRLA_SWRST; -} - -#if !defined(__DOXYGEN__) -/** - * \internal - * Address response. Called when address is answered or timed out. - * - * \param[in,out] module Pointer to software module structure - * - * \return Status of address response. - * \retval STATUS_OK No error has occurred - * \retval STATUS_ERR_DENIED If error on bus - * \retval STATUS_ERR_PACKET_COLLISION If arbitration is lost - * \retval STATUS_ERR_BAD_ADDRESS If slave is busy, or no slave - * acknowledged the address - */ -enum status_code _i2c_master_address_response( - struct i2c_master_module *const module) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Check for error and ignore bus-error; workaround for BUSSTATE stuck in - * BUSY */ - if (i2c_module->INTFLAG.reg & SERCOM_I2CM_INTFLAG_SB) { - - /* Clear write interrupt flag */ - i2c_module->INTFLAG.reg = SERCOM_I2CM_INTFLAG_SB; - - /* Check arbitration. */ - if (i2c_module->STATUS.reg & SERCOM_I2CM_STATUS_ARBLOST) { - /* Return packet collision. */ - return STATUS_ERR_PACKET_COLLISION; - } - /* Check that slave responded with ack. */ - } else if (i2c_module->STATUS.reg & SERCOM_I2CM_STATUS_RXNACK) { - /* Slave busy. Issue ack and stop command. */ - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_CMD(3); - - /* Return bad address value. */ - return STATUS_ERR_BAD_ADDRESS; - } - - return STATUS_OK; -} - -/** - * \internal - * Waits for answer on bus. - * - * \param[in,out] module Pointer to software module structure - * - * \return Status of bus. - * \retval STATUS_OK If given response from slave device - * \retval STATUS_ERR_TIMEOUT If no response was given within specified timeout - * period - */ -enum status_code _i2c_master_wait_for_bus( - struct i2c_master_module *const module) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Wait for reply. */ - uint16_t timeout_counter = 0; - while (!(i2c_module->INTFLAG.reg & SERCOM_I2CM_INTFLAG_MB) && - !(i2c_module->INTFLAG.reg & SERCOM_I2CM_INTFLAG_SB)) { - - /* Check timeout condition. */ - if (++timeout_counter >= module->buffer_timeout) { - return STATUS_ERR_TIMEOUT; - } - } - return STATUS_OK; -} -#endif /* __DOXYGEN__ */ - -/** - * \internal - * Send master code for high speed transfer. - * - * \param[in,out] module Pointer to software module structure - * \param[in] hs_master_code 8-bit master code (0000 1XXX) - * - * \return Status of bus. - * \retval STATUS_OK No error happen - */ -enum status_code _i2c_master_send_hs_master_code( - struct i2c_master_module *const module, - uint8_t hs_master_code) -{ - SercomI2cm *const i2c_module = &(module->hw->I2CM); - /* Return value. */ - enum status_code tmp_status; - - /* Set NACK for high speed code */ - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_ACKACT; - /* Send high speed code */ - i2c_module->ADDR.reg = hs_master_code; - /* Wait for response on bus. */ - tmp_status = _i2c_master_wait_for_bus(module); - /* Clear write interrupt flag */ - i2c_module->INTFLAG.reg = SERCOM_I2CM_INTENCLR_MB; - - return tmp_status; -} - - -/** - * \internal - * Starts blocking read operation. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of reading packet. - * \retval STATUS_OK The packet was read successfully - * \retval STATUS_ERR_TIMEOUT If no response was given within - * specified timeout period - * \retval STATUS_ERR_DENIED If error on bus - * \retval STATUS_ERR_PACKET_COLLISION If arbitration is lost - * \retval STATUS_ERR_BAD_ADDRESS If slave is busy, or no slave - * acknowledged the address - * - */ -static enum status_code _i2c_master_read_packet( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - Assert(packet); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Return value. */ - enum status_code tmp_status; - uint16_t tmp_data_length = packet->data_length; - - /* Written buffer counter. */ - uint16_t counter = 0; - - bool sclsm_flag = i2c_module->CTRLA.bit.SCLSM; - - /* Switch to high speed mode */ - if (packet->high_speed) { - _i2c_master_send_hs_master_code(module, packet->hs_master_code); - } - - /* Set action to ACK. */ - i2c_module->CTRLB.reg &= ~SERCOM_I2CM_CTRLB_ACKACT; - - /* Set address and direction bit. Will send start command on bus. */ - if (packet->ten_bit_address) { - /* - * Write ADDR.ADDR[10:1] with the 10-bit address. ADDR.TENBITEN must - * be set and read/write bit (ADDR.ADDR[0]) equal to 0. - */ - i2c_module->ADDR.reg = (packet->address << 1) | - (packet->high_speed << SERCOM_I2CM_ADDR_HS_Pos) | - SERCOM_I2CM_ADDR_TENBITEN; - - /* Wait for response on bus. */ - tmp_status = _i2c_master_wait_for_bus(module); - - /* Set action to ack. */ - i2c_module->CTRLB.reg &= ~SERCOM_I2CM_CTRLB_ACKACT; - - /* Check for address response error unless previous error is - * detected. */ - if (tmp_status == STATUS_OK) { - tmp_status = _i2c_master_address_response(module); - } - - if (tmp_status == STATUS_OK) { - /* - * Write ADDR[7:0] register to "11110 address[9:8] 1" - * ADDR.TENBITEN must be cleared - */ - i2c_module->ADDR.reg = (((packet->address >> 8) | 0x78) << 1) | - (packet->high_speed << SERCOM_I2CM_ADDR_HS_Pos) | - I2C_TRANSFER_READ; - } else { - return tmp_status; - } - } else { - i2c_module->ADDR.reg = (packet->address << 1) | I2C_TRANSFER_READ | - (packet->high_speed << SERCOM_I2CM_ADDR_HS_Pos); - } - - /* Wait for response on bus. */ - tmp_status = _i2c_master_wait_for_bus(module); - - /* Set action to ack or nack. */ - if ((sclsm_flag) && (packet->data_length == 1)) { - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_ACKACT; - } else { - i2c_module->CTRLB.reg &= ~SERCOM_I2CM_CTRLB_ACKACT; - } - - /* Check for address response error unless previous error is - * detected. */ - if (tmp_status == STATUS_OK) { - tmp_status = _i2c_master_address_response(module); - } - - /* Check that no error has occurred. */ - if (tmp_status == STATUS_OK) { - /* Read data buffer. */ - while (tmp_data_length--) { - /* Check that bus ownership is not lost. */ - if (!(i2c_module->STATUS.reg & SERCOM_I2CM_STATUS_BUSSTATE(2))) { - return STATUS_ERR_PACKET_COLLISION; - } - - if (module->send_nack && (((!sclsm_flag) && (tmp_data_length == 0)) || - ((sclsm_flag) && (tmp_data_length == 1)))) { - /* Set action to NACK */ - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_ACKACT; - } else { - /* Save data to buffer. */ - _i2c_master_wait_for_sync(module); - packet->data[counter++] = i2c_module->DATA.reg; - /* Wait for response. */ - tmp_status = _i2c_master_wait_for_bus(module); - } - - /* Check for error. */ - if (tmp_status != STATUS_OK) { - break; - } - } - - if (module->send_stop) { - /* Send stop command unless arbitration is lost. */ - _i2c_master_wait_for_sync(module); - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_CMD(3); - } - - /* Save last data to buffer. */ - _i2c_master_wait_for_sync(module); - packet->data[counter] = i2c_module->DATA.reg; - } - - return tmp_status; -} - -/** - * \brief Reads data packet from slave - * - * Reads a data packet from the specified slave address on the I<SUP>2</SUP>C - * bus and sends a stop condition when finished. - * - * \note This will stall the device from any other operation. For - * interrupt-driven operation, see \ref i2c_master_read_packet_job. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of reading packet. - * \retval STATUS_OK The packet was read successfully - * \retval STATUS_ERR_TIMEOUT If no response was given within - * specified timeout period - * \retval STATUS_ERR_DENIED If error on bus - * \retval STATUS_ERR_PACKET_COLLISION If arbitration is lost - * \retval STATUS_ERR_BAD_ADDRESS If slave is busy, or no slave - * acknowledged the address - */ -enum status_code i2c_master_read_packet_wait( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - Assert(packet); - -#if I2C_MASTER_CALLBACK_MODE == true - /* Check if the I2C module is busy with a job. */ - if (module->buffer_remaining > 0) { - return STATUS_BUSY; - } -#endif - - module->send_stop = true; - module->send_nack = true; - - return _i2c_master_read_packet(module, packet); -} - -/** - * \brief Reads data packet from slave without sending a stop condition when done - * - * Reads a data packet from the specified slave address on the I<SUP>2</SUP>C - * bus without sending a stop condition when done, thus retaining ownership of - * the bus when done. To end the transaction, a - * \ref i2c_master_read_packet_wait "read" or - * \ref i2c_master_write_packet_wait "write" with stop condition must be - * performed. - * - * \note This will stall the device from any other operation. For - * interrupt-driven operation, see \ref i2c_master_read_packet_job. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of reading packet. - * \retval STATUS_OK The packet was read successfully - * \retval STATUS_ERR_TIMEOUT If no response was given within - * specified timeout period - * \retval STATUS_ERR_DENIED If error on bus - * \retval STATUS_ERR_PACKET_COLLISION If arbitration is lost - * \retval STATUS_ERR_BAD_ADDRESS If slave is busy, or no slave - * acknowledged the address - */ -enum status_code i2c_master_read_packet_wait_no_stop( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - Assert(packet); - -#if I2C_MASTER_CALLBACK_MODE == true - /* Check if the I2C module is busy with a job. */ - if (module->buffer_remaining > 0) { - return STATUS_BUSY; - } -#endif - - module->send_stop = false; - module->send_nack = true; - - return _i2c_master_read_packet(module, packet); -} - -/** - * \internal - * Starts blocking read operation. - * \brief Reads data packet from slave without sending a nack signal and a stop - * condition when done - * - * Reads a data packet from the specified slave address on the I<SUP>2</SUP>C - * bus without sending a nack signal and a stop condition when done, - * thus retaining ownership of the bus when done. To end the transaction, a - * \ref i2c_master_read_packet_wait "read" or - * \ref i2c_master_write_packet_wait "write" with stop condition must be - * performed. - * - * \note This will stall the device from any other operation. For - * interrupt-driven operation, see \ref i2c_master_read_packet_job. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of reading packet. - * \retval STATUS_OK The packet was read successfully - * \retval STATUS_ERR_TIMEOUT If no response was given within - * specified timeout period - * \retval STATUS_ERR_DENIED If error on bus - * \retval STATUS_ERR_PACKET_COLLISION If arbitration is lost - * \retval STATUS_ERR_BAD_ADDRESS If slave is busy, or no slave - * acknowledged the address - */ -enum status_code i2c_master_read_packet_wait_no_nack( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - Assert(packet); - -#if I2C_MASTER_CALLBACK_MODE == true - /* Check if the I2C module is busy with a job. */ - if (module->buffer_remaining > 0) { - return STATUS_BUSY; - } -#endif - - module->send_stop = false; - module->send_nack = false; - - return _i2c_master_read_packet(module, packet); -} - -/** - * \internal - * Starts blocking write operation. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of write packet. - * \retval STATUS_OK The packet was write successfully - * \retval STATUS_ERR_TIMEOUT If no response was given within - * specified timeout period - * \retval STATUS_ERR_DENIED If error on bus - * \retval STATUS_ERR_PACKET_COLLISION If arbitration is lost - * \retval STATUS_ERR_BAD_ADDRESS If slave is busy, or no slave - * acknowledged the address - */ -static enum status_code _i2c_master_write_packet( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Return value. */ - enum status_code tmp_status; - uint16_t tmp_data_length = packet->data_length; - - _i2c_master_wait_for_sync(module); - - /* Switch to high speed mode */ - if (packet->high_speed) { - _i2c_master_send_hs_master_code(module, packet->hs_master_code); - } - - /* Set action to ACK. */ - i2c_module->CTRLB.reg &= ~SERCOM_I2CM_CTRLB_ACKACT; - - /* Set address and direction bit. Will send start command on bus. */ - if (packet->ten_bit_address) { - i2c_module->ADDR.reg = (packet->address << 1) | I2C_TRANSFER_WRITE | - (packet->high_speed << SERCOM_I2CM_ADDR_HS_Pos) | - SERCOM_I2CM_ADDR_TENBITEN; - } else { - i2c_module->ADDR.reg = (packet->address << 1) | I2C_TRANSFER_WRITE | - (packet->high_speed << SERCOM_I2CM_ADDR_HS_Pos); - } - /* Wait for response on bus. */ - tmp_status = _i2c_master_wait_for_bus(module); - - /* Check for address response error unless previous error is - * detected. */ - if (tmp_status == STATUS_OK) { - tmp_status = _i2c_master_address_response(module); - } - - /* Check that no error has occurred. */ - if (tmp_status == STATUS_OK) { - /* Buffer counter. */ - uint16_t buffer_counter = 0; - - /* Write data buffer. */ - while (tmp_data_length--) { - /* Check that bus ownership is not lost. */ - if (!(i2c_module->STATUS.reg & SERCOM_I2CM_STATUS_BUSSTATE(2))) { - return STATUS_ERR_PACKET_COLLISION; - } - - /* Write byte to slave. */ - _i2c_master_wait_for_sync(module); - i2c_module->DATA.reg = packet->data[buffer_counter++]; - - /* Wait for response. */ - tmp_status = _i2c_master_wait_for_bus(module); - - /* Check for error. */ - if (tmp_status != STATUS_OK) { - break; - } - - /* Check for NACK from slave. */ - if (i2c_module->STATUS.reg & SERCOM_I2CM_STATUS_RXNACK) { - /* Return bad data value. */ - tmp_status = STATUS_ERR_OVERFLOW; - break; - } - } - - if (module->send_stop) { - /* Stop command */ - _i2c_master_wait_for_sync(module); - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_CMD(3); - } - } - - return tmp_status; -} - -/** - * \brief Writes data packet to slave - * - * Writes a data packet to the specified slave address on the I<SUP>2</SUP>C bus - * and sends a stop condition when finished. - * - * \note This will stall the device from any other operation. For - * interrupt-driven operation, see \ref i2c_master_read_packet_job. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of write packet. - * \retval STATUS_OK If packet was write successfully - * \retval STATUS_BUSY If master module is busy with a job - * \retval STATUS_ERR_DENIED If error on bus - * \retval STATUS_ERR_PACKET_COLLISION If arbitration is lost - * \retval STATUS_ERR_BAD_ADDRESS If slave is busy, or no slave - * acknowledged the address - * \retval STATUS_ERR_TIMEOUT If timeout occurred - * \retval STATUS_ERR_OVERFLOW If slave did not acknowledge last sent - * data, indicating that slave does not - * want more data and was not able to read - * last data sent - */ -enum status_code i2c_master_write_packet_wait( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - Assert(packet); - -#if I2C_MASTER_CALLBACK_MODE == true - /* Check if the I2C module is busy with a job */ - if (module->buffer_remaining > 0) { - return STATUS_BUSY; - } -#endif - - module->send_stop = true; - module->send_nack = true; - - return _i2c_master_write_packet(module, packet); -} - -/** - * \brief Writes data packet to slave without sending a stop condition when done - * - * Writes a data packet to the specified slave address on the I<SUP>2</SUP>C bus - * without sending a stop condition, thus retaining ownership of the bus when - * done. To end the transaction, a \ref i2c_master_read_packet_wait "read" or - * \ref i2c_master_write_packet_wait "write" with stop condition or sending a - * stop with the \ref i2c_master_send_stop function must be performed. - * - * \note This will stall the device from any other operation. For - * interrupt-driven operation, see \ref i2c_master_read_packet_job. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of write packet. - * \retval STATUS_OK If packet was write successfully - * \retval STATUS_BUSY If master module is busy - * \retval STATUS_ERR_DENIED If error on bus - * \retval STATUS_ERR_PACKET_COLLISION If arbitration is lost - * \retval STATUS_ERR_BAD_ADDRESS If slave is busy, or no slave - * acknowledged the address - * \retval STATUS_ERR_TIMEOUT If timeout occurred - * \retval STATUS_ERR_OVERFLOW If slave did not acknowledge last sent - * data, indicating that slave do not want - * more data - */ -enum status_code i2c_master_write_packet_wait_no_stop( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - Assert(packet); - -#if I2C_MASTER_CALLBACK_MODE == true - /* Check if the I2C module is busy with a job */ - if (module->buffer_remaining > 0) { - return STATUS_BUSY; - } -#endif - - module->send_stop = false; - module->send_nack = true; - - return _i2c_master_write_packet(module, packet); -} - -/** - * \brief Sends stop condition on bus - * - * Sends a stop condition on bus. - * - * \note This function can only be used after the - * \ref i2c_master_write_packet_wait_no_stop function. If a stop condition - * is to be sent after a read, the \ref i2c_master_read_packet_wait - * function must be used. - * - * \param[in,out] module Pointer to the software instance struct - */ -void i2c_master_send_stop(struct i2c_master_module *const module) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Send stop command */ - _i2c_master_wait_for_sync(module); - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_CMD(3); -} - -/** - * \brief Sends nack signal on bus - * - * Sends a nack signal on bus. - * - * \note This function can only be used after the - * \ref i2c_master_write_packet_wait_no_nack function, - * or \ref i2c_master_read_byte function. - * \param[in,out] module Pointer to the software instance struct - */ -void i2c_master_send_nack(struct i2c_master_module *const module) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Send nack signal */ - _i2c_master_wait_for_sync(module); - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_ACKACT; -} - -/** - * \brief Reads one byte data from slave - * - * \param[in,out] module Pointer to software module struct - * \param[out] byte Read one byte data to slave - * - * \return Status of reading byte. - * \retval STATUS_OK One byte was read successfully - * \retval STATUS_ERR_TIMEOUT If no response was given within - * specified timeout period - * \retval STATUS_ERR_DENIED If error on bus - * \retval STATUS_ERR_PACKET_COLLISION If arbitration is lost - * \retval STATUS_ERR_BAD_ADDRESS If slave is busy, or no slave - * acknowledged the address - */ -enum status_code i2c_master_read_byte( - struct i2c_master_module *const module, - uint8_t *byte) -{ - enum status_code tmp_status; - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - i2c_module->CTRLB.reg &= ~SERCOM_I2CM_CTRLB_ACKACT; - /* Write byte to slave. */ - _i2c_master_wait_for_sync(module); - *byte = i2c_module->DATA.reg; - /* Wait for response. */ - tmp_status = _i2c_master_wait_for_bus(module); - - return tmp_status; -} - -/** - * \brief Write one byte data to slave - * - * \param[in,out] module Pointer to software module struct - * \param[in] byte Send one byte data to slave - * - * \return Status of writing byte. - * \retval STATUS_OK One byte was write successfully - * \retval STATUS_ERR_TIMEOUT If no response was given within - * specified timeout period - * \retval STATUS_ERR_DENIED If error on bus - * \retval STATUS_ERR_PACKET_COLLISION If arbitration is lost - * \retval STATUS_ERR_BAD_ADDRESS If slave is busy, or no slave - * acknowledged the address - */ -enum status_code i2c_master_write_byte( - struct i2c_master_module *const module, - uint8_t byte) -{ - enum status_code tmp_status; - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Write byte to slave. */ - _i2c_master_wait_for_sync(module); - i2c_module->DATA.reg = byte; - /* Wait for response. */ - tmp_status = _i2c_master_wait_for_bus(module); - return tmp_status; -} diff --git a/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_sam0/i2c_master_interrupt.c b/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_sam0/i2c_master_interrupt.c deleted file mode 100644 index 7551b2912..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_sam0/i2c_master_interrupt.c +++ /dev/null @@ -1,762 +0,0 @@ -/** - * \file - * - * \brief SAM I2C Master Interrupt Driver - * - * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#include "i2c_master_interrupt.h" - -extern enum status_code _i2c_master_wait_for_bus( - struct i2c_master_module *const module); - -extern enum status_code _i2c_master_address_response( - struct i2c_master_module *const module); - -extern enum status_code _i2c_master_send_hs_master_code( - struct i2c_master_module *const module, - uint8_t hs_master_code);; - -/** - * \internal - * Read next data. Used by interrupt handler to get next data byte from slave. - * - * \param[in,out] module Pointer to software module structure - */ -static void _i2c_master_read( - struct i2c_master_module *const module) -{ - /* Sanity check arguments. */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - bool sclsm_flag = i2c_module->CTRLA.bit.SCLSM; - - /* Find index to save next value in buffer */ - uint16_t buffer_index = module->buffer_length; - buffer_index -= module->buffer_remaining; - - module->buffer_remaining--; - - if (sclsm_flag) { - if (module->send_nack && module->buffer_remaining == 1) { - /* Set action to NACK. */ - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_ACKACT; - } - } else { - if (module->send_nack && module->buffer_remaining == 0) { - /* Set action to NACK. */ - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_ACKACT; - } - } - - if (module->buffer_remaining == 0) { - if (module->send_stop) { - /* Send stop condition */ - _i2c_master_wait_for_sync(module); - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_CMD(3); - } - } - - /* Read byte from slave and put in buffer */ - _i2c_master_wait_for_sync(module); - module->buffer[buffer_index] = i2c_module->DATA.reg; -} - -/** - * \internal - * - * Write next data. Used by interrupt handler to send next data byte to slave. - * - * \param[in,out] module Pointer to software module structure - */ -static void _i2c_master_write(struct i2c_master_module *const module) -{ - /* Sanity check arguments. */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Check for ack from slave */ - if (i2c_module->STATUS.reg & SERCOM_I2CM_STATUS_RXNACK) - { - /* Set status */ - module->status = STATUS_ERR_OVERFLOW; - /* Do not write more data */ - return; - } - - /* Find index to get next byte in buffer */ - uint16_t buffer_index = module->buffer_length; - buffer_index -= module->buffer_remaining; - - module->buffer_remaining--; - - /* Write byte from buffer to slave */ - _i2c_master_wait_for_sync(module); - i2c_module->DATA.reg = module->buffer[buffer_index]; -} - -/** - * \internal - * Acts on slave address response. Checks for errors concerning master->slave - * handshake. - * - * \param[in,out] module Pointer to software module structure - */ -static void _i2c_master_async_address_response( - struct i2c_master_module *const module) -{ - /* Sanity check arguments. */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Check for error. Ignore bus-error; workaround for bus state stuck in - * BUSY. - */ - if (i2c_module->INTFLAG.reg & SERCOM_I2CM_INTFLAG_MB) - { - /* Clear write interrupt flag */ - i2c_module->INTFLAG.reg = SERCOM_I2CM_INTENCLR_MB; - - /* Check arbitration */ - if (i2c_module->STATUS.reg & SERCOM_I2CM_STATUS_ARBLOST) { - /* Return busy */ - module->status = STATUS_ERR_PACKET_COLLISION; - } - /* No slave responds */ - else if (i2c_module->STATUS.reg & SERCOM_I2CM_STATUS_RXNACK) { - module->status = STATUS_ERR_BAD_ADDRESS; - module->buffer_remaining = 0; - - if (module->send_stop) { - /* Send stop condition */ - _i2c_master_wait_for_sync(module); - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_CMD(3); - } - } - } - - module->buffer_length = module->buffer_remaining; - - /* Check for status OK. */ - if (module->status == STATUS_BUSY) { - /* Call function based on transfer direction. */ - if (module->transfer_direction == I2C_TRANSFER_WRITE) { - _i2c_master_write(module); - } else { - _i2c_master_read(module); - } - } -} - -/** - * \brief Registers callback for the specified callback type - * - * Associates the given callback function with the - * specified callback type. - * - * To enable the callback, the \ref i2c_master_enable_callback function - * must be used. - * - * \param[in,out] module Pointer to the software module struct - * \param[in] callback Pointer to the function desired for the - * specified callback - * \param[in] callback_type Callback type to register - */ -void i2c_master_register_callback( - struct i2c_master_module *const module, - const i2c_master_callback_t callback, - enum i2c_master_callback callback_type) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - Assert(callback); - - /* Register callback */ - module->callbacks[callback_type] = callback; - - /* Set corresponding bit to set callback as registered */ - module->registered_callback |= (1 << callback_type); -} - -/** - * \brief Unregisters callback for the specified callback type - * - * When called, the currently registered callback for the given callback type - * will be removed. - * - * \param[in,out] module Pointer to the software module struct - * \param[in] callback_type Specifies the callback type to unregister - */ -void i2c_master_unregister_callback( - struct i2c_master_module *const module, - enum i2c_master_callback callback_type) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - - /* Register callback */ - module->callbacks[callback_type] = NULL; - - /* Clear corresponding bit to set callback as unregistered */ - module->registered_callback &= ~(1 << callback_type); -} - -/** - * \internal - * Starts a read bytes operation. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of starting reading I<SUP>2</SUP>C packet. - * \retval STATUS_OK If reading was started successfully - * \retval STATUS_BUSY If module is currently busy with another transfer - */ -enum status_code i2c_master_read_bytes( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Save packet to software module */ - module->buffer = packet->data; - module->buffer_remaining = packet->data_length; - module->transfer_direction = I2C_TRANSFER_READ; - module->status = STATUS_BUSY; - module->send_stop = false; - module->send_nack = false; - - /* Enable interrupts */ - i2c_module->INTENSET.reg = - SERCOM_I2CM_INTENSET_MB | SERCOM_I2CM_INTENSET_SB; - - return STATUS_OK; -} - -/** - * \internal - * Starts a read packet operation. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of starting reading I<SUP>2</SUP>C packet. - * \retval STATUS_OK If reading was started successfully - * \retval STATUS_BUSY If module is currently busy with another transfer - */ -static enum status_code _i2c_master_read_packet( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - enum status_code tmp_status; - - /* Save packet to software module */ - module->buffer = packet->data; - module->buffer_remaining = packet->data_length; - module->transfer_direction = I2C_TRANSFER_READ; - module->status = STATUS_BUSY; - - bool sclsm_flag = i2c_module->CTRLA.bit.SCLSM; - - /* Switch to high speed mode */ - if (packet->high_speed) { - _i2c_master_send_hs_master_code(module, packet->hs_master_code); - } - - /* Set action to ACK or NACK. */ - if ((sclsm_flag) && (packet->data_length == 1)) { - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_ACKACT; - } else { - i2c_module->CTRLB.reg &= ~SERCOM_I2CM_CTRLB_ACKACT; - } - - if (packet->ten_bit_address) { - /* - * Write ADDR.ADDR[10:1] with the 10-bit address. ADDR.TENBITEN must - * be set and read/write bit (ADDR.ADDR[0]) equal to 0. - */ - i2c_module->ADDR.reg = (packet->address << 1) | - (packet->high_speed << SERCOM_I2CM_ADDR_HS_Pos) | - SERCOM_I2CM_ADDR_TENBITEN; - - /* Wait for response on bus. */ - tmp_status = _i2c_master_wait_for_bus(module); - - /* Set action to ack. */ - i2c_module->CTRLB.reg &= ~SERCOM_I2CM_CTRLB_ACKACT; - - /* Check for address response error unless previous error is - * detected. */ - if (tmp_status == STATUS_OK) { - tmp_status = _i2c_master_address_response(module); - } - - if (tmp_status == STATUS_OK) { - /* Enable interrupts */ - i2c_module->INTENSET.reg = - SERCOM_I2CM_INTENSET_MB | SERCOM_I2CM_INTENSET_SB; - - /* - * Write ADDR[7:0] register to "11110 address[9:8] 1" - * ADDR.TENBITEN must be cleared - */ - i2c_module->ADDR.reg = (((packet->address >> 8) | 0x78) << 1) | - (packet->high_speed << SERCOM_I2CM_ADDR_HS_Pos) | - I2C_TRANSFER_READ; - } else { - return tmp_status; - } - } else { - /* Enable interrupts */ - i2c_module->INTENSET.reg = - SERCOM_I2CM_INTENSET_MB | SERCOM_I2CM_INTENSET_SB; - - /* Set address and direction bit. Will send start command on bus */ - i2c_module->ADDR.reg = (packet->address << 1) | I2C_TRANSFER_READ | - (packet->high_speed << SERCOM_I2CM_ADDR_HS_Pos); - } - - return STATUS_OK; -} - -/** - * \brief Initiates a read packet operation - * - * Reads a data packet from the specified slave address on the I<SUP>2</SUP>C - * bus. This is the non-blocking equivalent of \ref i2c_master_read_packet_wait. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of starting reading I<SUP>2</SUP>C packet. - * \retval STATUS_OK If reading was started successfully - * \retval STATUS_BUSY If module is currently busy with another transfer - */ -enum status_code i2c_master_read_packet_job( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - Assert(packet); - - /* Check if the I2C module is busy with a job */ - if (module->buffer_remaining > 0) { - return STATUS_BUSY; - } - - /* Make sure we send STOP */ - module->send_stop = true; - module->send_nack = true; - /* Start reading */ - return _i2c_master_read_packet(module, packet); -} - -/** - * \brief Initiates a read packet operation without sending a STOP condition when done - * - * Reads a data packet from the specified slave address on the I<SUP>2</SUP>C bus without - * sending a stop condition, thus retaining ownership of the bus when done. - * To end the transaction, a \ref i2c_master_read_packet_wait "read" or - * \ref i2c_master_write_packet_wait "write" with stop condition must be - * performed. - * - * This is the non-blocking equivalent of \ref i2c_master_read_packet_wait_no_stop. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of starting reading I<SUP>2</SUP>C packet. - * \retval STATUS_OK If reading was started successfully - * \retval STATUS_BUSY If module is currently busy with another operation - */ -enum status_code i2c_master_read_packet_job_no_stop( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - Assert(packet); - - /* Check if the I2C module is busy with a job */ - if (module->buffer_remaining > 0) { - return STATUS_BUSY; - } - - /* Make sure we don't send STOP */ - module->send_stop = false; - module->send_nack = true; - /* Start reading */ - return _i2c_master_read_packet(module, packet); -} - -/** - * \brief Initiates a read packet operation without sending a NACK signal and a - * STOP condition when done - * - * Reads a data packet from the specified slave address on the I<SUP>2</SUP>C bus without - * sending a nack and a stop condition, thus retaining ownership of the bus when done. - * To end the transaction, a \ref i2c_master_read_packet_wait "read" or - * \ref i2c_master_write_packet_wait "write" with stop condition must be - * performed. - * - * This is the non-blocking equivalent of \ref i2c_master_read_packet_wait_no_stop. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of starting reading I<SUP>2</SUP>C packet. - * \retval STATUS_OK If reading was started successfully - * \retval STATUS_BUSY If module is currently busy with another operation - */ -enum status_code i2c_master_read_packet_job_no_nack( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - Assert(packet); - - /* Check if the I2C module is busy with a job */ - if (module->buffer_remaining > 0) { - return STATUS_BUSY; - } - - /* Make sure we don't send STOP */ - module->send_stop = false; - module->send_nack = false; - /* Start reading */ - return _i2c_master_read_packet(module, packet); -} - -/** - * \internal - * Starts a write bytes operation. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of starting write I<SUP>2</SUP>C bytes. - * \retval STATUS_OK If writing was started successfully - * \retval STATUS_BUSY If module is currently busy with another transfer - */ -enum status_code i2c_master_write_bytes( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Save packet to software module */ - module->buffer = packet->data; - module->buffer_remaining = packet->data_length; - module->transfer_direction = I2C_TRANSFER_WRITE; - module->status = STATUS_BUSY; - module->send_stop = false; - module->send_nack = false; - - /* Enable interrupts */ - i2c_module->INTENSET.reg = - SERCOM_I2CM_INTENSET_MB | SERCOM_I2CM_INTENSET_SB; - - return STATUS_OK; -} - -/** - * \internal Initiates a write packet operation - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of starting writing I<SUP>2</SUP>C packet job. - * \retval STATUS_OK If writing was started successfully - * \retval STATUS_BUSY If module is currently busy with another transfer - */ -static enum status_code _i2c_master_write_packet( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Switch to high speed mode */ - if (packet->high_speed) { - _i2c_master_send_hs_master_code(module, packet->hs_master_code); - } - - /* Set action to ACK. */ - i2c_module->CTRLB.reg &= ~SERCOM_I2CM_CTRLB_ACKACT; - - /* Save packet to software module */ - module->buffer = packet->data; - module->buffer_remaining = packet->data_length; - module->transfer_direction = I2C_TRANSFER_WRITE; - module->status = STATUS_BUSY; - - /* Enable interrupts */ - i2c_module->INTENSET.reg = - SERCOM_I2CM_INTENSET_MB | SERCOM_I2CM_INTENSET_SB; - - /* Set address and direction bit, will send start command on bus */ - if (packet->ten_bit_address) { - i2c_module->ADDR.reg = (packet->address << 1) | I2C_TRANSFER_WRITE | - (packet->high_speed << SERCOM_I2CM_ADDR_HS_Pos) | - SERCOM_I2CM_ADDR_TENBITEN; - } else { - i2c_module->ADDR.reg = (packet->address << 1) | I2C_TRANSFER_WRITE | - (packet->high_speed << SERCOM_I2CM_ADDR_HS_Pos); - } - - return STATUS_OK; -} - -/** - * \brief Initiates a write packet operation - * - * Writes a data packet to the specified slave address on the I<SUP>2</SUP>C - * bus. This is the non-blocking equivalent of \ref i2c_master_write_packet_wait. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of starting writing I<SUP>2</SUP>C packet job. - * \retval STATUS_OK If writing was started successfully - * \retval STATUS_BUSY If module is currently busy with another transfer - */ -enum status_code i2c_master_write_packet_job( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - Assert(packet); - - /* Check if the I2C module is busy with another job. */ - if (module->buffer_remaining > 0) { - return STATUS_BUSY; - } - - /* Make sure we send STOP at end*/ - module->send_stop = true; - module->send_nack = true; - /* Start write operation */ - return _i2c_master_write_packet(module, packet); -} - -/** - * \brief Initiates a write packet operation without sending a STOP condition when done - * - * Writes a data packet to the specified slave address on the I<SUP>2</SUP>C bus - * without sending a stop condition, thus retaining ownership of the bus when - * done. To end the transaction, a \ref i2c_master_read_packet_wait "read" or - * \ref i2c_master_write_packet_wait "write" with stop condition or sending - * a stop with the \ref i2c_master_send_stop function must be performed. - * - * This is the non-blocking equivalent of \ref i2c_master_write_packet_wait_no_stop. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of starting writing I<SUP>2</SUP>C packet job. - * \retval STATUS_OK If writing was started successfully - * \retval STATUS_BUSY If module is currently busy with another - */ -enum status_code i2c_master_write_packet_job_no_stop( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - Assert(packet); - - /* Check if the I2C module is busy with another job. */ - if (module->buffer_remaining > 0) { - return STATUS_BUSY; - } - - /* Do not send stop condition when done */ - module->send_stop = false; - module->send_nack = true; - /* Start write operation */ - return _i2c_master_write_packet(module, packet); -} - -/** - * \internal - * Interrupt handler for I<SUP>2</SUP>C master. - * - * \param[in] instance SERCOM instance that triggered the interrupt - */ -void _i2c_master_interrupt_handler( - uint8_t instance) -{ - /* Get software module for callback handling */ - struct i2c_master_module *module = - (struct i2c_master_module*)_sercom_instances[instance]; - - Assert(module); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - bool sclsm_flag = i2c_module->CTRLA.bit.SCLSM; - - /* Combine callback registered and enabled masks */ - uint8_t callback_mask = module->enabled_callback; - callback_mask &= module->registered_callback; - - /* Check if the module should respond to address ack */ - if ((module->buffer_length <= 0) && (module->buffer_remaining > 0)) { - /* Call function for address response */ - _i2c_master_async_address_response(module); - - /* Check if buffer write is done */ - } else if ((module->buffer_length > 0) && (module->buffer_remaining <= 0) && - (module->status == STATUS_BUSY) && - (module->transfer_direction == I2C_TRANSFER_WRITE)) { - /* Stop packet operation */ - i2c_module->INTENCLR.reg = - SERCOM_I2CM_INTENCLR_MB | SERCOM_I2CM_INTENCLR_SB; - - module->buffer_length = 0; - module->status = STATUS_OK; - - if (module->send_stop) { - /* Send stop condition */ - _i2c_master_wait_for_sync(module); - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_CMD(3); - } else { - /* Clear write interrupt flag */ - i2c_module->INTFLAG.reg = SERCOM_I2CM_INTFLAG_MB; - } - - if (callback_mask & (1 << I2C_MASTER_CALLBACK_WRITE_COMPLETE)) { - module->callbacks[I2C_MASTER_CALLBACK_WRITE_COMPLETE](module); - } - - /* Continue buffer write/read */ - } else if ((module->buffer_length > 0) && (module->buffer_remaining > 0)){ - /* Check that bus ownership is not lost */ - if ((!(i2c_module->STATUS.reg & SERCOM_I2CM_STATUS_BUSSTATE(2))) && - (!(sclsm_flag && (module->buffer_remaining == 1)))) { - module->status = STATUS_ERR_PACKET_COLLISION; - } else if (module->transfer_direction == I2C_TRANSFER_WRITE) { - _i2c_master_write(module); - } else { - _i2c_master_read(module); - } - } - - /* Check if read buffer transfer is complete */ - if ((module->buffer_length > 0) && (module->buffer_remaining <= 0) && - (module->status == STATUS_BUSY) && - (module->transfer_direction == I2C_TRANSFER_READ)) { - - /* Clear read interrupt flag */ - if (i2c_module->INTFLAG.reg & SERCOM_I2CM_INTFLAG_SB) { - i2c_module->INTFLAG.reg = SERCOM_I2CM_INTFLAG_SB; - } - /* Stop packet operation */ - i2c_module->INTENCLR.reg = - SERCOM_I2CM_INTENCLR_MB | SERCOM_I2CM_INTENCLR_SB; - module->buffer_length = 0; - module->status = STATUS_OK; - - /* Call appropriate callback if enabled and registered */ - if ((callback_mask & (1 << I2C_MASTER_CALLBACK_READ_COMPLETE)) - && (module->transfer_direction == I2C_TRANSFER_READ)) { - module->callbacks[I2C_MASTER_CALLBACK_READ_COMPLETE](module); - } else if ((callback_mask & (1 << I2C_MASTER_CALLBACK_WRITE_COMPLETE)) - && (module->transfer_direction == I2C_TRANSFER_WRITE)) { - module->callbacks[I2C_MASTER_CALLBACK_WRITE_COMPLETE](module); - } - } - - /* Check for error */ - if ((module->status != STATUS_BUSY) && (module->status != STATUS_OK)) { - /* Stop packet operation */ - i2c_module->INTENCLR.reg = SERCOM_I2CM_INTENCLR_MB | - SERCOM_I2CM_INTENCLR_SB; - - module->buffer_length = 0; - module->buffer_remaining = 0; - - /* Send nack and stop command unless arbitration is lost */ - if ((module->status != STATUS_ERR_PACKET_COLLISION) && - module->send_stop) { - _i2c_master_wait_for_sync(module); - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_ACKACT | - SERCOM_I2CM_CTRLB_CMD(3); - } - - /* Call error callback if enabled and registered */ - if (callback_mask & (1 << I2C_MASTER_CALLBACK_ERROR)) { - module->callbacks[I2C_MASTER_CALLBACK_ERROR](module); - } - } -} diff --git a/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_sam0/i2c_slave.c b/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_sam0/i2c_slave.c deleted file mode 100644 index 113087794..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_sam0/i2c_slave.c +++ /dev/null @@ -1,745 +0,0 @@ -/** - * \file - * - * \brief SAM I2C Slave Driver - * - * Copyright (C) 2013-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#include "i2c_slave.h" -#if I2C_SLAVE_CALLBACK_MODE == true -# include "i2c_slave_interrupt.h" -#endif - -/** - * \internal Sets configuration to module - * - * \param[out] module Pointer to software module structure - * \param[in] config Configuration structure with configurations to set - * - * \return Status of setting configuration. - * \retval STATUS_OK Module was configured correctly - * \retval STATUS_ERR_ALREADY_INITIALIZED If setting other GCLK generator than - * previously set - */ -static enum status_code _i2c_slave_set_config( - struct i2c_slave_module *const module, - const struct i2c_slave_config *const config) -{ - uint32_t tmp_ctrla; - - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - Assert(config); - - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - Sercom *const sercom_hw = module->hw; - - module->buffer_timeout = config->buffer_timeout; - module->ten_bit_address = config->ten_bit_address; - - struct system_pinmux_config pin_conf; - system_pinmux_get_config_defaults(&pin_conf); - - uint32_t pad0 = config->pinmux_pad0; - uint32_t pad1 = config->pinmux_pad1; - - /* SERCOM PAD0 - SDA */ - if (pad0 == PINMUX_DEFAULT) { - pad0 = _sercom_get_default_pad(sercom_hw, 0); - } - pin_conf.mux_position = pad0 & 0xFFFF; - pin_conf.direction = SYSTEM_PINMUX_PIN_DIR_OUTPUT_WITH_READBACK; - system_pinmux_pin_set_config(pad0 >> 16, &pin_conf); - - /* SERCOM PAD1 - SCL */ - if (pad1 == PINMUX_DEFAULT) { - pad1 = _sercom_get_default_pad(sercom_hw, 1); - } - pin_conf.mux_position = pad1 & 0xFFFF; - pin_conf.direction = SYSTEM_PINMUX_PIN_DIR_OUTPUT_WITH_READBACK; - system_pinmux_pin_set_config(pad1 >> 16, &pin_conf); - - /* Prepare config to write to register CTRLA */ - if (config->run_in_standby || system_is_debugger_present()) { - tmp_ctrla = SERCOM_I2CS_CTRLA_RUNSTDBY; - } else { - tmp_ctrla = 0; - } - - /* Check and set SCL clock stretch mode. */ - if (config->scl_stretch_only_after_ack_bit || (config->transfer_speed == I2C_SLAVE_SPEED_HIGH_SPEED)) { - tmp_ctrla |= SERCOM_I2CM_CTRLA_SCLSM; - } - - tmp_ctrla |= ((uint32_t)config->sda_hold_time | - config->transfer_speed | - (config->scl_low_timeout << SERCOM_I2CS_CTRLA_LOWTOUTEN_Pos) | - (config->slave_scl_low_extend_timeout << SERCOM_I2CS_CTRLA_SEXTTOEN_Pos)); - - i2c_hw->CTRLA.reg |= tmp_ctrla; - - /* Set CTRLB configuration */ - i2c_hw->CTRLB.reg = SERCOM_I2CS_CTRLB_SMEN | config->address_mode; - - i2c_hw->ADDR.reg = config->address << SERCOM_I2CS_ADDR_ADDR_Pos | - config->address_mask << SERCOM_I2CS_ADDR_ADDRMASK_Pos | - config->ten_bit_address << SERCOM_I2CS_ADDR_TENBITEN_Pos | - config->enable_general_call_address << SERCOM_I2CS_ADDR_GENCEN_Pos; - - return STATUS_OK; -} - -/** - * \brief Initializes the requested I<SUP>2</SUP>C hardware module - * - * Initializes the SERCOM I<SUP>2</SUP>C slave device requested and sets the provided - * software module struct. Run this function before any further use of - * the driver. - * - * \param[out] module Pointer to software module struct - * \param[in] hw Pointer to the hardware instance - * \param[in] config Pointer to the configuration struct - * - * \return Status of initialization. - * \retval STATUS_OK Module initiated correctly - * \retval STATUS_ERR_DENIED If module is enabled - * \retval STATUS_BUSY If module is busy resetting - * \retval STATUS_ERR_ALREADY_INITIALIZED If setting other GCLK generator than - * previously set - */ -enum status_code i2c_slave_init( - struct i2c_slave_module *const module, - Sercom *const hw, - const struct i2c_slave_config *const config) -{ - /* Sanity check arguments */ - Assert(module); - Assert(hw); - Assert(config); - - /* Initialize software module */ - module->hw = hw; - - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - - /* Check if module is enabled */ - if (i2c_hw->CTRLA.reg & SERCOM_I2CS_CTRLA_ENABLE) { - return STATUS_ERR_DENIED; - } - - /* Check if reset is in progress */ - if (i2c_hw->CTRLA.reg & SERCOM_I2CS_CTRLA_SWRST) { - return STATUS_BUSY; - } - - uint32_t sercom_index = _sercom_get_sercom_inst_index(module->hw); - uint32_t pm_index, gclk_index; -#if (SAML21) || (SAML22) || (SAMC20) || (SAMC21) || (SAMR30) -#if (SAML21) || (SAMR30) - if (sercom_index == 5) { - pm_index = MCLK_APBDMASK_SERCOM5_Pos; - gclk_index = SERCOM5_GCLK_ID_CORE; - } else { - pm_index = sercom_index + MCLK_APBCMASK_SERCOM0_Pos; - gclk_index = sercom_index + SERCOM0_GCLK_ID_CORE; - } -#else - pm_index = sercom_index + MCLK_APBCMASK_SERCOM0_Pos; - gclk_index = sercom_index + SERCOM0_GCLK_ID_CORE; -#endif -#else - pm_index = sercom_index + PM_APBCMASK_SERCOM0_Pos; - gclk_index = sercom_index + SERCOM0_GCLK_ID_CORE; -#endif - - /* Turn on module in PM */ -#if (SAML21) || (SAMR30) - if (sercom_index == 5) { - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBD, 1 << pm_index); - } else { - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBC, 1 << pm_index); - } -#else - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBC, 1 << pm_index); -#endif - - /* Set up the GCLK for the module */ - struct system_gclk_chan_config gclk_chan_conf; - system_gclk_chan_get_config_defaults(&gclk_chan_conf); - gclk_chan_conf.source_generator = config->generator_source; - system_gclk_chan_set_config(gclk_index, &gclk_chan_conf); - system_gclk_chan_enable(gclk_index); - sercom_set_gclk_generator(config->generator_source, false); - -#if I2C_SLAVE_CALLBACK_MODE == true - /* Get sercom instance index */ - uint8_t instance_index = _sercom_get_sercom_inst_index(module->hw); - - /* Save software module in interrupt handler */ - _sercom_set_handler(instance_index, _i2c_slave_interrupt_handler); - - /* Save software module */ - _sercom_instances[instance_index] = module; - - /* Initialize values in module */ - module->registered_callback = 0; - module->enabled_callback = 0; - module->buffer_length = 0; - module->nack_on_address = config->enable_nack_on_address; -#endif - - /* Set SERCOM module to operate in I2C slave mode */ - i2c_hw->CTRLA.reg = SERCOM_I2CS_CTRLA_MODE(0x4); - - /* Set config and return status */ - return _i2c_slave_set_config(module, config); -} - -/** - * \brief Resets the hardware module - * - * This will reset the module to hardware defaults. - * - * \param[in,out] module Pointer to software module structure - */ -void i2c_slave_reset( - struct i2c_slave_module *const module) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - -#if I2C_SLAVE_CALLBACK_MODE == true - /* Reset module instance */ - module->registered_callback = 0; - module->enabled_callback = 0; - module->buffer_length = 0; - module->buffer_remaining = 0; - module->buffer = NULL; -#endif - - /* Disable module */ - i2c_slave_disable(module); - -#if I2C_SLAVE_CALLBACK_MODE == true - /* Clear all pending interrupts */ - system_interrupt_enter_critical_section(); - system_interrupt_clear_pending(_sercom_get_interrupt_vector(module->hw)); - system_interrupt_leave_critical_section(); -#endif - - /* Wait for sync */ - _i2c_slave_wait_for_sync(module); - - /* Reset module */ - i2c_hw->CTRLA.reg = SERCOM_I2CS_CTRLA_SWRST; -} - -/** - * \internal Waits for answer on bus - * - * \param[in] module Pointer to software module structure - * - * \return Status of bus. - * \retval STATUS_OK If given response from slave device - * \retval STATUS_ERR_TIMEOUT If no response was given within specified timeout - * period - */ -static enum status_code _i2c_slave_wait_for_bus( - struct i2c_slave_module *const module) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Wait for reply */ - uint16_t timeout_counter = 0; - while ((!(i2c_module->INTFLAG.reg & SERCOM_I2CS_INTFLAG_DRDY)) && - (!(i2c_module->INTFLAG.reg & SERCOM_I2CS_INTFLAG_PREC)) && - (!(i2c_module->INTFLAG.reg & SERCOM_I2CS_INTFLAG_AMATCH))) { - - /* Check timeout condition */ - if (++timeout_counter >= module->buffer_timeout) { - return STATUS_ERR_TIMEOUT; - } - } - return STATUS_OK; -} - -/** - * \brief Writes a packet to the master - * - * Writes a packet to the master. This will wait for the master to issue - * a request. - * - * \param[in] module Pointer to software module structure - * \param[in] packet Packet to write to master - * - * \return Status of packet write. - * \retval STATUS_OK Packet was written successfully - * \retval STATUS_ERR_DENIED Start condition not received, another - * interrupt flag is set - * \retval STATUS_ERR_IO There was an error in the previous transfer - * \retval STATUS_ERR_BAD_FORMAT Master wants to write data - * \retval STATUS_ERR_INVALID_ARG Invalid argument(s) was provided - * \retval STATUS_ERR_BUSY The I<SUP>2</SUP>C module is busy with a job - * \retval STATUS_ERR_ERR_OVERFLOW Master NACKed before entire packet was - * transferred - * \retval STATUS_ERR_TIMEOUT No response was given within the timeout - * period - */ -enum status_code i2c_slave_write_packet_wait( - struct i2c_slave_module *const module, - struct i2c_slave_packet *const packet) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - Assert(packet); - - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - - uint16_t length = packet->data_length; - - if (length == 0) { - return STATUS_ERR_INVALID_ARG; - } - -#if I2C_SLAVE_CALLBACK_MODE == true - /* Check if the module is busy with a job or AMATCH is enabled */ - if (module->buffer_remaining > 0 || - (i2c_hw->INTENSET.reg & SERCOM_I2CS_INTFLAG_AMATCH)) { - return STATUS_BUSY; - } -#endif - - enum status_code status; - /* Wait for master to send address packet */ - status = _i2c_slave_wait_for_bus(module); - - if (status != STATUS_OK) { - /* Timeout, return */ - return status; - } - if (!(i2c_hw->INTFLAG.reg & SERCOM_I2CS_INTFLAG_AMATCH)) { - /* Not address interrupt, something is wrong */ - return STATUS_ERR_DENIED; - } - - if (module->ten_bit_address) { - /* ACK the first address */ - i2c_hw->CTRLB.reg &= ~SERCOM_I2CS_CTRLB_ACKACT; - i2c_hw->CTRLB.reg |= SERCOM_I2CS_CTRLB_CMD(0x3); - - /* Wait for address interrupt */ - status = _i2c_slave_wait_for_bus(module); - - if (status != STATUS_OK) { - /* Timeout, return */ - return STATUS_ERR_TIMEOUT; - } - - if (!(i2c_hw->INTFLAG.reg & SERCOM_I2CS_INTFLAG_AMATCH)) { - /* Not address interrupt, something is wrong */ - return STATUS_ERR_DENIED; - } - } - - /* Check if there was an error in last transfer */ - if (i2c_hw->STATUS.reg & (SERCOM_I2CS_STATUS_BUSERR | - SERCOM_I2CS_STATUS_COLL | SERCOM_I2CS_STATUS_LOWTOUT)) { - return STATUS_ERR_IO; - } - - /* Check direction */ - if (!(i2c_hw->STATUS.reg & SERCOM_I2CS_STATUS_DIR)) { - /* Write request from master, send NACK and return */ - i2c_hw->CTRLB.reg |= SERCOM_I2CS_CTRLB_ACKACT; - i2c_hw->CTRLB.reg |= SERCOM_I2CS_CTRLB_CMD(0x3); - return STATUS_ERR_BAD_FORMAT; - } - - /* Read request from master, ACK address */ - i2c_hw->CTRLB.reg &= ~SERCOM_I2CS_CTRLB_ACKACT; - i2c_hw->CTRLB.reg |= SERCOM_I2CS_CTRLB_CMD(0x3); - - uint16_t i = 0; - - /* Wait for data interrupt */ - status = _i2c_slave_wait_for_bus(module); - if (status != STATUS_OK) { - /* Timeout, return */ - return status; - } - - while (length--) { - /* Write data */ - _i2c_slave_wait_for_sync(module); - i2c_hw->DATA.reg = packet->data[i++]; - - /* Wait for response from master */ - status = _i2c_slave_wait_for_bus(module); - - if (status != STATUS_OK) { - /* Timeout, return */ - return status; - } - - if (i2c_hw->STATUS.reg & SERCOM_I2CS_STATUS_RXNACK && - length !=0) { - /* NACK from master, abort */ - /* Release line */ - i2c_hw->CTRLB.reg |= SERCOM_I2CS_CTRLB_CMD(0x02); - - return STATUS_ERR_OVERFLOW; - } - /* ACK from master, continue writing */ - } - - /* Release line */ - i2c_hw->CTRLB.reg |= SERCOM_I2CS_CTRLB_CMD(0x02); - - return STATUS_OK; -} - -/** - * \brief Reads a packet from the master - * - * Reads a packet from the master. This will wait for the master to issue a - * request. - * - * \param[in] module Pointer to software module structure - * \param[out] packet Packet to read from master - * - * \return Status of packet read. - * \retval STATUS_OK Packet was read successfully - * \retval STATUS_ABORTED Master sent stop condition or repeated - * start before specified length of bytes - * was received - * \retval STATUS_ERR_IO There was an error in the previous transfer - * \retval STATUS_ERR_DENIED Start condition not received, another - * interrupt flag is set - * \retval STATUS_ERR_INVALID_ARG Invalid argument(s) was provided - * \retval STATUS_ERR_BUSY The I<SUP>2</SUP>C module is busy with a job - * \retval STATUS_ERR_BAD_FORMAT Master wants to read data - * \retval STATUS_ERR_ERR_OVERFLOW Last byte received overflows buffer - */ -enum status_code i2c_slave_read_packet_wait( - struct i2c_slave_module *const module, - struct i2c_slave_packet *const packet) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - Assert(packet); - - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - - uint16_t length = packet->data_length; - - if (length == 0) { - return STATUS_ERR_INVALID_ARG; - } - -#if I2C_SLAVE_CALLBACK_MODE == true - /* Check if the module is busy with a job or AMATCH is enabled */ - if (module->buffer_remaining > 0 || - (i2c_hw->INTENSET.reg & SERCOM_I2CS_INTFLAG_AMATCH)) { - return STATUS_BUSY; - } -#endif - - enum status_code status; - - /* Wait for master to send address packet */ - status = _i2c_slave_wait_for_bus(module); - if (status != STATUS_OK) { - /* Timeout, return */ - return status; - } - - if (!(i2c_hw->INTFLAG.reg & SERCOM_I2CS_INTFLAG_AMATCH)) { - /* Not address interrupt, something is wrong */ - return STATUS_ERR_DENIED; - } - - /* Check if there was an error in the last transfer */ - if (i2c_hw->STATUS.reg & (SERCOM_I2CS_STATUS_BUSERR | - SERCOM_I2CS_STATUS_COLL | SERCOM_I2CS_STATUS_LOWTOUT)) { - return STATUS_ERR_IO; - } - /* Check direction */ - if ((i2c_hw->STATUS.reg & SERCOM_I2CS_STATUS_DIR)) { - /* Read request from master, send NACK and return */ - i2c_hw->CTRLB.reg |= SERCOM_I2CS_CTRLB_ACKACT; - i2c_hw->CTRLB.reg |= SERCOM_I2CS_CTRLB_CMD(0x3); - return STATUS_ERR_BAD_FORMAT; - } - - /* Write request from master, ACK address */ - i2c_hw->CTRLB.reg &= ~SERCOM_I2CS_CTRLB_ACKACT; - i2c_hw->CTRLB.reg |= SERCOM_I2CS_CTRLB_CMD(0x3); - - uint16_t i = 0; - while (length--) { - - /* Wait for next byte or stop condition */ - status = _i2c_slave_wait_for_bus(module); - if (status != STATUS_OK) { - /* Timeout, return */ - return status; - } - - if ((i2c_hw->INTFLAG.reg & SERCOM_I2CS_INTFLAG_PREC) || - i2c_hw->INTFLAG.reg & SERCOM_I2CS_INTFLAG_AMATCH) { - /* Master sent stop condition, or repeated start, read done */ - /* Clear stop flag */ - i2c_hw->INTFLAG.reg = SERCOM_I2CS_INTFLAG_PREC; - return STATUS_ABORTED; - } - - /* Read data */ - _i2c_slave_wait_for_sync(module); - packet->data[i++] = i2c_hw->DATA.reg; - - } - - /* Packet read done, wait for packet to NACK, Stop or repeated start */ - status = _i2c_slave_wait_for_bus(module); - - if (i2c_hw->INTFLAG.reg & SERCOM_I2CS_INTFLAG_DRDY) { - /* Buffer is full, send NACK */ - i2c_hw->CTRLB.reg |= SERCOM_I2CS_CTRLB_ACKACT; - i2c_hw->CTRLB.reg |= SERCOM_I2CS_CTRLB_CMD(0x2); - } - if (i2c_hw->INTFLAG.reg & SERCOM_I2CS_INTFLAG_PREC) { - /* Clear stop flag */ - i2c_hw->INTFLAG.reg = SERCOM_I2CS_INTFLAG_PREC; - } - return STATUS_OK; -} - -/** - * \brief Waits for a start condition on the bus - * - * \note This function is only available for 7-bit slave addressing. - * - * Waits for the master to issue a start condition on the bus. - * - * \note This function does not check for errors in the last transfer, - * this will be discovered when reading or writing. - * - * \param[in] module Pointer to software module structure - * - * \return Direction of the current transfer, when in slave mode. - * \retval I2C_SLAVE_DIRECTION_NONE No request from master within timeout - * period - * \retval I2C_SLAVE_DIRECTION_READ Write request from master - * \retval I2C_SLAVE_DIRECTION_WRITE Read request from master - */ -enum i2c_slave_direction i2c_slave_get_direction_wait( - struct i2c_slave_module *const module) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - - enum status_code status; - - /* Wait for address interrupt */ - status = _i2c_slave_wait_for_bus(module); - - if (status != STATUS_OK) { - /* Timeout, return */ - return I2C_SLAVE_DIRECTION_NONE; - } - - if (!(i2c_hw->INTFLAG.reg & SERCOM_I2CS_INTFLAG_AMATCH)) { - /* Not address interrupt, something is wrong */ - return I2C_SLAVE_DIRECTION_NONE; - } - - /* Check direction */ - if ((i2c_hw->STATUS.reg & SERCOM_I2CS_STATUS_DIR)) { - /* Read request from master */ - return I2C_SLAVE_DIRECTION_WRITE; - } else { - /* Write request from master */ - return I2C_SLAVE_DIRECTION_READ; - } -} - -/** - * \brief Retrieves the current module status - * - * Checks the status of the module and returns it as a bitmask of status - * flags. - * - * \param[in] module Pointer to the I<SUP>2</SUP>C slave software device struct - * - * \return Bitmask of status flags. - * - * \retval I2C_SLAVE_STATUS_ADDRESS_MATCH A valid address has been received - * \retval I2C_SLAVE_STATUS_DATA_READY A I<SUP>2</SUP>C slave byte transmission is - * successfully completed - * \retval I2C_SLAVE_STATUS_STOP_RECEIVED A stop condition is detected for a - * transaction being processed - * \retval I2C_SLAVE_STATUS_CLOCK_HOLD The slave is holding the SCL line - * low - * \retval I2C_SLAVE_STATUS_SCL_LOW_TIMEOUT An SCL low time-out has occurred - * \retval I2C_SLAVE_STATUS_REPEATED_START Indicates a repeated start, only - * valid if \ref - * I2C_SLAVE_STATUS_ADDRESS_MATCH is - * set - * \retval I2C_SLAVE_STATUS_RECEIVED_NACK The last data packet sent was not - * acknowledged - * \retval I2C_SLAVE_STATUS_COLLISION The I<SUP>2</SUP>C slave was not able to - * transmit a high data or NACK bit - * \retval I2C_SLAVE_STATUS_BUS_ERROR An illegal bus condition has - * occurred on the bus - */ -uint32_t i2c_slave_get_status( - struct i2c_slave_module *const module) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - - uint8_t intflags = i2c_hw->INTFLAG.reg; - uint8_t status = i2c_hw->STATUS.reg; - uint32_t status_flags = 0; - - /* Check Address Match flag */ - if (intflags & SERCOM_I2CS_INTFLAG_AMATCH) { - status_flags |= I2C_SLAVE_STATUS_ADDRESS_MATCH; - } - /* Check Data Ready flag */ - if (intflags & SERCOM_I2CS_INTFLAG_DRDY) { - status_flags |= I2C_SLAVE_STATUS_DATA_READY; - } - /* Check Stop flag */ - if (intflags & SERCOM_I2CS_INTFLAG_PREC) { - status_flags |= I2C_SLAVE_STATUS_STOP_RECEIVED; - } - /* Check Clock Hold */ - if (status & SERCOM_I2CS_STATUS_CLKHOLD) { - status_flags |= I2C_SLAVE_STATUS_CLOCK_HOLD; - } - /* Check SCL Low Timeout */ - if (status & SERCOM_I2CS_STATUS_LOWTOUT) { - status_flags |= I2C_SLAVE_STATUS_SCL_LOW_TIMEOUT; - } - /* Check Repeated Start */ - if (status & SERCOM_I2CS_STATUS_SR) { - status_flags |= I2C_SLAVE_STATUS_REPEATED_START; - } - /* Check Received Not Acknowledge */ - if (status & SERCOM_I2CS_STATUS_RXNACK) { - status_flags |= I2C_SLAVE_STATUS_RECEIVED_NACK; - } - /* Check Transmit Collision */ - if (status & SERCOM_I2CS_STATUS_COLL) { - status_flags |= I2C_SLAVE_STATUS_COLLISION; - } - /* Check Bus Error */ - if (status & SERCOM_I2CS_STATUS_BUSERR) { - status_flags |= I2C_SLAVE_STATUS_BUS_ERROR; - } - - return status_flags; -} - -/** - * \brief Clears a module status flag - * - * Clears the given status flag of the module. - * - * \note Not all status flags can be cleared. - * - * \param[in] module Pointer to the I<SUP>2</SUP>C software device struct - * \param[in] status_flags Bit mask of status flags to clear - * - */ -void i2c_slave_clear_status( - struct i2c_slave_module *const module, - uint32_t status_flags) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - - /* Clear Address Match flag */ - if (status_flags & I2C_SLAVE_STATUS_ADDRESS_MATCH) { - i2c_hw->INTFLAG.reg = SERCOM_I2CS_INTFLAG_AMATCH; - } - /* Clear Data Ready flag */ - if (status_flags & I2C_SLAVE_STATUS_DATA_READY) { - i2c_hw->INTFLAG.reg = SERCOM_I2CS_INTFLAG_DRDY; - } - /* Clear Stop flag */ - if (status_flags & I2C_SLAVE_STATUS_STOP_RECEIVED) { - i2c_hw->INTFLAG.reg = SERCOM_I2CS_INTFLAG_PREC; - } - /* Clear SCL Low Timeout */ - if (status_flags & I2C_SLAVE_STATUS_SCL_LOW_TIMEOUT) { - i2c_hw->STATUS.reg = SERCOM_I2CS_STATUS_LOWTOUT; - } - /* Clear Transmit Collision */ - if (status_flags & I2C_SLAVE_STATUS_COLLISION) { - i2c_hw->STATUS.reg = SERCOM_I2CS_STATUS_COLL; - } - /* Clear Bus Error */ - if (status_flags & I2C_SLAVE_STATUS_BUS_ERROR) { - i2c_hw->STATUS.reg = SERCOM_I2CS_STATUS_BUSERR; - } -} diff --git a/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_sam0/i2c_slave_interrupt.c b/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_sam0/i2c_slave_interrupt.c deleted file mode 100644 index 0a6f234f8..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_sam0/i2c_slave_interrupt.c +++ /dev/null @@ -1,434 +0,0 @@ -/** - * \file - * - * \brief SAM I2C Slave Interrupt Driver - * - * Copyright (c) 2013-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#include "i2c_slave_interrupt.h" - -/** - * \brief Enables sending of NACK on address match - * - * Enables sending of NACK on address match, thus discarding - * any incoming transaction. - * - * \param[in,out] module Pointer to software module structure - */ -void i2c_slave_enable_nack_on_address( - struct i2c_slave_module *const module) -{ - /* Sanity check arguments. */ - Assert(module); - - module->nack_on_address = true; -} - -/** - * \brief Disables sending NACK on address match - * - * Disables sending of NACK on address match, thus - * acknowledging incoming transactions. - * - * \param[in,out] module Pointer to software module structure - */ -void i2c_slave_disable_nack_on_address( - struct i2c_slave_module *const module) -{ - /* Sanity check arguments. */ - Assert(module); - - module->nack_on_address = false; -} - -/** - * \internal - * Reads next data. Used by interrupt handler to get next data byte from master. - * - * \param[in,out] module Pointer to software module structure - */ -static void _i2c_slave_read( - struct i2c_slave_module *const module) -{ - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - - /* Read byte from master and put in buffer. */ - *(module->buffer++) = i2c_hw->DATA.reg; - - /*Decrement remaining buffer length */ - module->buffer_remaining--; -} - -/** - * \internal - * Writes next data. Used by interrupt handler to send next data byte to master. - * - * \param[in,out] module Pointer to software module structure - */ -static void _i2c_slave_write( - struct i2c_slave_module *const module) -{ - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - - /* Write byte from buffer to master */ - i2c_hw->DATA.reg = *(module->buffer++); - - /*Decrement remaining buffer length */ - module->buffer_remaining--; -} - -/** - * \brief Registers callback for the specified callback type - * - * Associates the given callback function with the - * specified callback type. To enable the callback, the - * \ref i2c_slave_enable_callback function must be used. - * - * \param[in,out] module Pointer to the software module struct - * \param[in] callback Pointer to the function desired for the - * specified callback - * \param[in] callback_type Callback type to register - */ -void i2c_slave_register_callback( - struct i2c_slave_module *const module, - i2c_slave_callback_t callback, - enum i2c_slave_callback callback_type) -{ - /* Sanity check. */ - Assert(module); - Assert(module->hw); - Assert(callback); - - /* Register callback. */ - module->callbacks[callback_type] = callback; - - /* Set corresponding bit to set callback as initiated. */ - module->registered_callback |= (1 << callback_type); -} - -/** - * \brief Unregisters callback for the specified callback type - * - * Removes the currently registered callback for the given callback - * type. - * - * \param[in,out] module Pointer to the software module struct - * \param[in] callback_type Callback type to unregister - */ -void i2c_slave_unregister_callback( - struct i2c_slave_module *const module, - enum i2c_slave_callback callback_type) -{ - /* Sanity check. */ - Assert(module); - Assert(module->hw); - - /* Register callback. */ - module->callbacks[callback_type] = NULL; - - /* Set corresponding bit to set callback as initiated. */ - module->registered_callback &= ~(1 << callback_type); -} - -/** - * \brief Initiates a reads packet operation - * - * Reads a data packet from the master. A write request must be initiated by - * the master before the packet can be read. - * - * The \ref I2C_SLAVE_CALLBACK_WRITE_REQUEST callback can be used to call this - * function. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of starting asynchronously reading I<SUP>2</SUP>C packet. - * \retval STATUS_OK If reading was started successfully - * \retval STATUS_BUSY If module is currently busy with another transfer - */ -enum status_code i2c_slave_read_packet_job( - struct i2c_slave_module *const module, - struct i2c_slave_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - Assert(packet); - - /* Check if the I2C module is busy doing async operation. */ - if (module->buffer_remaining > 0) { - return STATUS_BUSY; - } - - /* Save packet to software module. */ - module->buffer = packet->data; - module->buffer_remaining = packet->data_length; - module->buffer_length = packet->data_length; - module->status = STATUS_BUSY; - - /* Enable interrupts */ - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - i2c_hw->INTENSET.reg = SERCOM_I2CS_INTFLAG_AMATCH | - SERCOM_I2CS_INTFLAG_DRDY | SERCOM_I2CS_INTFLAG_PREC; - - /* Read will begin when master initiates the transfer */ - return STATUS_OK; -} - -/** - * \brief Initiates a write packet operation - * - * Writes a data packet to the master. A read request must be initiated by - * the master before the packet can be written. - * - * The \ref I2C_SLAVE_CALLBACK_READ_REQUEST callback can be used to call this - * function. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of starting writing I<SUP>2</SUP>C packet. - * \retval STATUS_OK If writing was started successfully - * \retval STATUS_BUSY If module is currently busy with another transfer - */ -enum status_code i2c_slave_write_packet_job( - struct i2c_slave_module *const module, - struct i2c_slave_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - Assert(packet); - - /* Check if the I2C module is busy doing async operation. */ - if (module->buffer_remaining > 0) { - return STATUS_BUSY; - } - - /* Save packet to software module. */ - module->buffer = packet->data; - module->buffer_remaining = packet->data_length; - module->buffer_length = packet->data_length; - module->status = STATUS_BUSY; - - /* Enable interrupts */ - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - i2c_hw->INTENSET.reg = SERCOM_I2CS_INTFLAG_AMATCH | - SERCOM_I2CS_INTFLAG_DRDY | SERCOM_I2CS_INTFLAG_PREC; - - return STATUS_OK; -} - -/** - * \internal Interrupt handler for I<SUP>2</SUP>C slave - * - * \param[in] instance Sercom instance that triggered the interrupt - */ -void _i2c_slave_interrupt_handler( - uint8_t instance) -{ - /* Get software module for callback handling. */ - struct i2c_slave_module *module = - (struct i2c_slave_module*)_sercom_instances[instance]; - - Assert(module); - - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - - /* Combine callback registered and enabled masks. */ - uint8_t callback_mask = module->enabled_callback; - callback_mask &= module->registered_callback; - - - if (i2c_hw->INTFLAG.reg & SERCOM_I2CS_INTFLAG_AMATCH) { - /* Address match */ - /* Check if last transfer is done - repeated start */ - if (module->buffer_length != module->buffer_remaining && - module->transfer_direction == I2C_TRANSFER_WRITE) { - - module->status = STATUS_OK; - module->buffer_length = 0; - module->buffer_remaining = 0; - - if ((callback_mask & (1 << I2C_SLAVE_CALLBACK_READ_COMPLETE))) { - module->callbacks[I2C_SLAVE_CALLBACK_READ_COMPLETE](module); - } - } else if (module->buffer_length != module->buffer_remaining && - module->transfer_direction == I2C_TRANSFER_READ) { - module->status = STATUS_OK; - module->buffer_length = 0; - module->buffer_remaining = 0; - - if ((callback_mask & (1 << I2C_SLAVE_CALLBACK_WRITE_COMPLETE))) { - module->callbacks[I2C_SLAVE_CALLBACK_WRITE_COMPLETE](module); - } - } - - if (i2c_hw->STATUS.reg & (SERCOM_I2CS_STATUS_BUSERR | - SERCOM_I2CS_STATUS_COLL | SERCOM_I2CS_STATUS_LOWTOUT)) { - /* An error occurred in last packet transfer */ - module->status = STATUS_ERR_IO; - - if ((callback_mask & (1 << I2C_SLAVE_CALLBACK_ERROR_LAST_TRANSFER))) { - module->callbacks[I2C_SLAVE_CALLBACK_ERROR_LAST_TRANSFER](module); - } - } - if (module->nack_on_address) { - /* NACK address, workaround 13574 */ - _i2c_slave_set_ctrlb_ackact(module, false); - } else if (i2c_hw->STATUS.reg & SERCOM_I2CS_STATUS_DIR) { - /* Set transfer direction in module instance */ - module->transfer_direction = I2C_TRANSFER_READ; - - /* Read request from master */ - if (callback_mask & (1 << I2C_SLAVE_CALLBACK_READ_REQUEST)) { - module->callbacks[I2C_SLAVE_CALLBACK_READ_REQUEST](module); - } - - if (module->buffer_length == 0) { - /* Data buffer not set up, NACK address, workaround 13574*/ - _i2c_slave_set_ctrlb_ackact(module, false); - } else { - /* ACK address, workaround 13574 */ - _i2c_slave_set_ctrlb_ackact(module, true); - } - } else { - /* Set transfer direction in dev inst */ - module->transfer_direction = I2C_TRANSFER_WRITE; - - /* Write request from master */ - if (callback_mask & (1 << I2C_SLAVE_CALLBACK_WRITE_REQUEST)) { - module->callbacks[I2C_SLAVE_CALLBACK_WRITE_REQUEST](module); - } - - if (module->buffer_length == 0) { - /* Data buffer not set up, NACK address, workaround 13574 */ - _i2c_slave_set_ctrlb_ackact(module, false); - } else { - /* ACK address, workaround 13574 */ - _i2c_slave_set_ctrlb_ackact(module, true); - } - } - - /* ACK or NACK address, Workaround 13574 */ - _i2c_slave_set_ctrlb_cmd3(module); - - /* ACK next incoming packet, workaround 13574 */ - _i2c_slave_set_ctrlb_ackact(module, true); - - } else if (i2c_hw->INTFLAG.reg & SERCOM_I2CS_INTFLAG_PREC) { - /* Stop condition on bus - current transfer done */ - - /* Clear Stop interrupt */ - i2c_hw->INTFLAG.reg = SERCOM_I2CS_INTFLAG_PREC; - - /* Disable interrupts */ - i2c_hw->INTENCLR.reg = SERCOM_I2CS_INTFLAG_PREC | SERCOM_I2CS_INTFLAG_DRDY; - - if (!((module->enabled_callback & (1 << I2C_SLAVE_CALLBACK_READ_REQUEST)) - || (module->enabled_callback == (1 << I2C_SLAVE_CALLBACK_WRITE_REQUEST)))) { - /* Disable address match if read/write request is not enabled */ - i2c_hw->INTENCLR.reg = SERCOM_I2CS_INTFLAG_AMATCH; - } - - if (!(module->status == STATUS_ERR_OVERFLOW || module->status == STATUS_ERR_IO)) { - module->status = STATUS_OK; - module->buffer_length = 0; - module->buffer_remaining = 0; - - /* Call appropriate callback if enabled and registered */ - if ((callback_mask & (1 << I2C_SLAVE_CALLBACK_READ_COMPLETE)) - && (module->transfer_direction == I2C_TRANSFER_WRITE)) { - /* Read from master complete */ - module->callbacks[I2C_SLAVE_CALLBACK_READ_COMPLETE](module); - } else if ((callback_mask & (1 << I2C_SLAVE_CALLBACK_WRITE_COMPLETE)) - && (module->transfer_direction == I2C_TRANSFER_READ)) { - /* Write to master complete */ - module->callbacks[I2C_SLAVE_CALLBACK_WRITE_COMPLETE](module); - } - } - } else if (i2c_hw->INTFLAG.reg & SERCOM_I2CS_INTFLAG_DRDY) { - /* Check if buffer is full, or NACK from master */ - if (module->buffer_remaining <= 0 || - (module->transfer_direction == I2C_TRANSFER_READ && - (module->buffer_length > module->buffer_remaining) && - (i2c_hw->STATUS.reg & SERCOM_I2CS_STATUS_RXNACK))) { - - module->buffer_remaining = 0; - module->buffer_length = 0; - - if (module->transfer_direction == I2C_TRANSFER_WRITE) { - /* Buffer is full, send NACK, workaround 13574 */ - _i2c_slave_set_ctrlb_ackact(module, false); - i2c_hw->CTRLB.reg |= SERCOM_I2CS_CTRLB_CMD(0x2); - - /* Set status, new character in DATA register will overflow - * buffer */ - module->status = STATUS_ERR_OVERFLOW; - - if (callback_mask & (1 << I2C_SLAVE_CALLBACK_ERROR)) { - /* Read complete */ - module->callbacks[I2C_SLAVE_CALLBACK_ERROR](module); - } - } else { - /* Release SCL and wait for new start condition */ - _i2c_slave_set_ctrlb_ackact(module, false); - i2c_hw->CTRLB.reg |= SERCOM_I2CS_CTRLB_CMD(0x2); - - /* Transfer successful */ - module->status = STATUS_OK; - - /* Disable interrupts */ - i2c_hw->INTENCLR.reg = SERCOM_I2CS_INTFLAG_DRDY; - } - - /* Continue buffer write/read */ - } else if (module->buffer_length > 0 && module->buffer_remaining > 0) { - /* Call function based on transfer direction */ - if (module->transfer_direction == I2C_TRANSFER_WRITE) { - _i2c_slave_read(module); - } else { - _i2c_slave_write(module); - } - } - } -} diff --git a/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_samd20/i2c_master.c b/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_samd20/i2c_master.c deleted file mode 100644 index ce4f58c23..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_samd20/i2c_master.c +++ /dev/null @@ -1,881 +0,0 @@ -/** - * \file - * - * \brief SAM D20 I2C Master Driver - * - * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#include "i2c_master.h" - -#if I2C_MASTER_CALLBACK_MODE == true -# include "i2c_master_interrupt.h" -#endif - -#if !defined(__DOXYGEN__) - -/** - * \internal Sets configurations to module - * - * \param[out] module Pointer to software module structure - * \param[in] config Configuration structure with configurations to set - * - * \return Status of setting configuration. - * \retval STATUS_OK If module was configured correctly - * \retval STATUS_ERR_ALREADY_INITIALIZED If setting other GCLK generator than - * previously set - * \retval STATUS_ERR_BAUDRATE_UNAVAILABLE If given baud rate is not compatible - * with set GCLK frequency - */ -static enum status_code _i2c_master_set_config( - struct i2c_master_module *const module, - const struct i2c_master_config *const config) -{ - /* Sanity check arguments. */ - Assert(module); - Assert(module->hw); - Assert(config); - - /* Temporary variables. */ - uint32_t tmp_ctrla; - int32_t tmp_baud; - enum status_code tmp_status_code = STATUS_OK; - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - Sercom *const sercom_hw = module->hw; - - uint8_t sercom_index = _sercom_get_sercom_inst_index(sercom_hw); - - /* Pin configuration */ - struct system_pinmux_config pin_conf; - system_pinmux_get_config_defaults(&pin_conf); - - uint32_t pad0 = config->pinmux_pad0; - uint32_t pad1 = config->pinmux_pad1; - - /* SERCOM PAD0 - SDA */ - if (pad0 == PINMUX_DEFAULT) { - pad0 = _sercom_get_default_pad(sercom_hw, 0); - } - pin_conf.mux_position = pad0 & 0xFFFF; - pin_conf.direction = SYSTEM_PINMUX_PIN_DIR_OUTPUT_WITH_READBACK; - system_pinmux_pin_set_config(pad0 >> 16, &pin_conf); - - /* SERCOM PAD1 - SCL */ - if (pad1 == PINMUX_DEFAULT) { - pad1 = _sercom_get_default_pad(sercom_hw, 1); - } - pin_conf.mux_position = pad1 & 0xFFFF; - pin_conf.direction = SYSTEM_PINMUX_PIN_DIR_OUTPUT_WITH_READBACK; - system_pinmux_pin_set_config(pad1 >> 16, &pin_conf); - - /* Save timeout on unknown bus state in software module. */ - module->unknown_bus_state_timeout = config->unknown_bus_state_timeout; - - /* Save timeout on buffer write. */ - module->buffer_timeout = config->buffer_timeout; - - /* Set whether module should run in standby. */ - if (config->run_in_standby || system_is_debugger_present()) { - tmp_ctrla = SERCOM_I2CM_CTRLA_RUNSTDBY; - } else { - tmp_ctrla = 0; - } - - /* Check and set start data hold timeout. */ - if (config->start_hold_time != I2C_MASTER_START_HOLD_TIME_DISABLED) { - tmp_ctrla |= config->start_hold_time; - } - - /* Check and set SCL low timeout. */ - if (config->scl_low_timeout) { - tmp_ctrla |= SERCOM_I2CM_CTRLA_LOWTOUT; - } - - /* Check and set inactive bus timeout. */ - if (config->inactive_timeout != I2C_MASTER_INACTIVE_TIMEOUT_DISABLED) { - tmp_ctrla |= config->inactive_timeout; - } - - /* Write config to register CTRLA. */ - i2c_module->CTRLA.reg |= tmp_ctrla; - - /* Set configurations in CTRLB. */ - i2c_module->CTRLB.reg = SERCOM_I2CM_CTRLB_SMEN; - - /* Find and set baudrate. */ - tmp_baud = (int32_t)(div_ceil( - system_gclk_chan_get_hz(SERCOM0_GCLK_ID_CORE + sercom_index), - (2000*(config->baud_rate))) - 5); - - /* Check that baud rate is supported at current speed. */ - if (tmp_baud > 255 || tmp_baud < 0) { - /* Baud rate not supported. */ - tmp_status_code = STATUS_ERR_BAUDRATE_UNAVAILABLE; - } else { - /* Baud rate acceptable. */ - i2c_module->BAUD.reg = (uint8_t)tmp_baud; - } - - return tmp_status_code; -} -#endif /* __DOXYGEN__ */ - -/** - * \brief Initializes the requested I<SUP>2</SUP>C hardware module - * - * Initializes the SERCOM I<SUP>2</SUP>C master device requested and sets the provided - * software module struct. Run this function before any further use of - * the driver. - * - * \param[out] module Pointer to software module struct - * \param[in] hw Pointer to the hardware instance - * \param[in] config Pointer to the configuration struct - * - * \return Status of initialization. - * \retval STATUS_OK Module initiated correctly - * \retval STATUS_ERR_DENIED If module is enabled - * \retval STATUS_BUSY If module is busy resetting - * \retval STATUS_ERR_ALREADY_INITIALIZED If setting other GCLK generator than - * previously set - * \retval STATUS_ERR_BAUDRATE_UNAVAILABLE If given baudrate is not compatible - * with set GCLK frequency - * - */ -enum status_code i2c_master_init( - struct i2c_master_module *const module, - Sercom *const hw, - const struct i2c_master_config *const config) -{ - /* Sanity check arguments. */ - Assert(module); - Assert(hw); - Assert(config); - - /* Initialize software module */ - module->hw = hw; - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - uint32_t sercom_index = _sercom_get_sercom_inst_index(module->hw); - uint32_t pm_index = sercom_index + PM_APBCMASK_SERCOM0_Pos; - uint32_t gclk_index = sercom_index + SERCOM0_GCLK_ID_CORE; - - /* Turn on module in PM */ - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBC, 1 << pm_index); - - /* Set up the GCLK for the module */ - struct system_gclk_chan_config gclk_chan_conf; - system_gclk_chan_get_config_defaults(&gclk_chan_conf); - gclk_chan_conf.source_generator = config->generator_source; - system_gclk_chan_set_config(gclk_index, &gclk_chan_conf); - system_gclk_chan_enable(gclk_index); - sercom_set_gclk_generator(config->generator_source, false); - - /* Check if module is enabled. */ - if (i2c_module->CTRLA.reg & SERCOM_I2CM_CTRLA_ENABLE) { - return STATUS_ERR_DENIED; - } - - /* Check if reset is in progress. */ - if (i2c_module->CTRLA.reg & SERCOM_I2CM_CTRLA_SWRST) { - return STATUS_BUSY; - } - -#if I2C_MASTER_CALLBACK_MODE == true - /* Get sercom instance index and register callback. */ - uint8_t instance_index = _sercom_get_sercom_inst_index(module->hw); - _sercom_set_handler(instance_index, _i2c_master_interrupt_handler); - _sercom_instances[instance_index] = module; - - /* Initialize values in module. */ - module->registered_callback = 0; - module->enabled_callback = 0; - module->buffer_length = 0; - module->buffer_remaining = 0; - - module->status = STATUS_OK; - module->buffer = NULL; -#endif - - /* Set sercom module to operate in I2C master mode. */ - i2c_module->CTRLA.reg = SERCOM_I2CM_CTRLA_MODE_I2C_MASTER; - - /* Set config and return status. */ - return _i2c_master_set_config(module, config); -} - -/** - * \brief Resets the hardware module - * - * Reset the module to hardware defaults. - * - * \param[in,out] module Pointer to software module structure - */ -void i2c_master_reset(struct i2c_master_module *const module) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Wait for sync */ - _i2c_master_wait_for_sync(module); - - /* Disable module */ - i2c_master_disable(module); - -#if I2C_MASTER_CALLBACK_MODE == true - /* Clear all pending interrupts */ - system_interrupt_enter_critical_section(); - system_interrupt_clear_pending(_sercom_get_interrupt_vector(module->hw)); - system_interrupt_leave_critical_section(); -#endif - - /* Wait for sync */ - _i2c_master_wait_for_sync(module); - - /* Reset module */ - i2c_module->CTRLA.reg = SERCOM_I2CM_CTRLA_SWRST; -} - -#if !defined(__DOXYGEN__) -/** - * \internal - * Address response. Called when address is answered or timed out. - * - * \param[in,out] module Pointer to software module structure - * - * \return Status of address response. - * \retval STATUS_OK No error has occurred - * \retval STATUS_ERR_DENIED If error on bus - * \retval STATUS_ERR_PACKET_COLLISION If arbitration is lost - * \retval STATUS_ERR_BAD_ADDRESS If slave is busy, or no slave - * acknowledged the address - */ -static enum status_code _i2c_master_address_response( - struct i2c_master_module *const module) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Check for error and ignore bus-error; workaround for BUSSTATE stuck in - * BUSY */ - if (i2c_module->INTFLAG.reg & SERCOM_I2CM_INTFLAG_SB) { - - /* Clear write interrupt flag */ - i2c_module->INTFLAG.reg = SERCOM_I2CM_INTFLAG_SB; - - /* Check arbitration. */ - if (i2c_module->STATUS.reg & SERCOM_I2CM_STATUS_ARBLOST) { - /* Return packet collision. */ - return STATUS_ERR_PACKET_COLLISION; - } - /* Check that slave responded with ack. */ - } else if (i2c_module->STATUS.reg & SERCOM_I2CM_STATUS_RXNACK) { - /* Slave busy. Issue ack and stop command. */ - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_CMD(3); - - /* Return bad address value. */ - return STATUS_ERR_BAD_ADDRESS; - } - - return STATUS_OK; -} - -/** - * \internal - * Waits for answer on bus. - * - * \param[in,out] module Pointer to software module structure - * - * \return Status of bus. - * \retval STATUS_OK If given response from slave device - * \retval STATUS_ERR_TIMEOUT If no response was given within specified timeout - * period - */ -static enum status_code _i2c_master_wait_for_bus( - struct i2c_master_module *const module) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Wait for reply. */ - uint16_t timeout_counter = 0; - while (!(i2c_module->INTFLAG.reg & SERCOM_I2CM_INTFLAG_MB) && - !(i2c_module->INTFLAG.reg & SERCOM_I2CM_INTFLAG_SB)) { - - /* Check timeout condition. */ - if (++timeout_counter >= module->buffer_timeout) { - return STATUS_ERR_TIMEOUT; - } - } - return STATUS_OK; -} -#endif /* __DOXYGEN__ */ - -/** - * \internal - * Starts blocking read operation. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of reading packet. - * \retval STATUS_OK The packet was read successfully - * \retval STATUS_ERR_TIMEOUT If no response was given within - * specified timeout period - * \retval STATUS_ERR_DENIED If error on bus - * \retval STATUS_ERR_PACKET_COLLISION If arbitration is lost - * \retval STATUS_ERR_BAD_ADDRESS If slave is busy, or no slave - * acknowledged the address - * - */ -static enum status_code _i2c_master_read_packet( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - Assert(packet); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Return value. */ - enum status_code tmp_status; - uint16_t tmp_data_length = packet->data_length; - - /* Written buffer counter. */ - uint16_t counter = 0; - - /* Set address and direction bit. Will send start command on bus. */ - i2c_module->ADDR.reg = (packet->address << 1) | I2C_TRANSFER_READ; - - /* Wait for response on bus. */ - tmp_status = _i2c_master_wait_for_bus(module); - - /* Set action to ack. */ - i2c_module->CTRLB.reg &= ~SERCOM_I2CM_CTRLB_ACKACT; - - /* Check for address response error unless previous error is - * detected. */ - if (tmp_status == STATUS_OK) { - tmp_status = _i2c_master_address_response(module); - } - - /* Check that no error has occurred. */ - if (tmp_status == STATUS_OK) { - /* Read data buffer. */ - while (tmp_data_length--) { - /* Check that bus ownership is not lost. */ - if (!(i2c_module->STATUS.reg & SERCOM_I2CM_STATUS_BUSSTATE(2))) { - return STATUS_ERR_PACKET_COLLISION; - } - - if (module->send_nack && tmp_data_length == 0) { - /* Set action to NACK */ - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_ACKACT; - } else { - /* Save data to buffer. */ - _i2c_master_wait_for_sync(module); - packet->data[counter++] = i2c_module->DATA.reg; - /* Wait for response. */ - tmp_status = _i2c_master_wait_for_bus(module); - } - - /* Check for error. */ - if (tmp_status != STATUS_OK) { - break; - } - } - - if (module->send_stop) { - /* Send stop command unless arbitration is lost. */ - _i2c_master_wait_for_sync(module); - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_CMD(3); - } else { - _i2c_master_wait_for_sync(module); - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_CMD(1); - } - - /* Save last data to buffer. */ - _i2c_master_wait_for_sync(module); - packet->data[counter] = i2c_module->DATA.reg; - } - - return tmp_status; -} - -/** - * \brief Reads data packet from slave - * - * Reads a data packet from the specified slave address on the I<SUP>2</SUP>C - * bus and sends a stop condition when finished. - * - * \note This will stall the device from any other operation. For - * interrupt-driven operation, see \ref i2c_master_read_packet_job. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of reading packet. - * \retval STATUS_OK The packet was read successfully - * \retval STATUS_ERR_TIMEOUT If no response was given within - * specified timeout period - * \retval STATUS_ERR_DENIED If error on bus - * \retval STATUS_ERR_PACKET_COLLISION If arbitration is lost - * \retval STATUS_ERR_BAD_ADDRESS If slave is busy, or no slave - * acknowledged the address - */ -enum status_code i2c_master_read_packet_wait( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - Assert(packet); - -#if I2C_MASTER_CALLBACK_MODE == true - /* Check if the I2C module is busy with a job. */ - if (module->buffer_remaining > 0) { - return STATUS_BUSY; - } -#endif - - module->send_stop = true; - module->send_nack = true; - - return _i2c_master_read_packet(module, packet); -} - -/** - * \brief Reads data packet from slave without sending a stop condition when done - * - * Reads a data packet from the specified slave address on the I<SUP>2</SUP>C - * bus without sending a stop condition when done, thus retaining ownership of - * the bus when done. To end the transaction, a - * \ref i2c_master_read_packet_wait "read" or - * \ref i2c_master_write_packet_wait "write" with stop condition must be - * performed. - * - * \note This will stall the device from any other operation. For - * interrupt-driven operation, see \ref i2c_master_read_packet_job. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of reading packet. - * \retval STATUS_OK The packet was read successfully - * \retval STATUS_ERR_TIMEOUT If no response was given within - * specified timeout period - * \retval STATUS_ERR_DENIED If error on bus - * \retval STATUS_ERR_PACKET_COLLISION If arbitration is lost - * \retval STATUS_ERR_BAD_ADDRESS If slave is busy, or no slave - * acknowledged the address - */ -enum status_code i2c_master_read_packet_wait_no_stop( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - Assert(packet); - -#if I2C_MASTER_CALLBACK_MODE == true - /* Check if the I2C module is busy with a job. */ - if (module->buffer_remaining > 0) { - return STATUS_BUSY; - } -#endif - - module->send_stop = false; - module->send_nack = true; - - return _i2c_master_read_packet(module, packet); -} - -/** - * \internal - * Starts blocking read operation. - * \brief Reads data packet from slave without sending a nack signal and a stop - * condition when done - * - * Reads a data packet from the specified slave address on the I<SUP>2</SUP>C - * bus without sending a nack signal and a stop condition when done, - * thus retaining ownership of the bus when done. To end the transaction, a - * \ref i2c_master_read_packet_wait "read" or - * \ref i2c_master_write_packet_wait "write" with stop condition must be - * performed. - * - * \note This will stall the device from any other operation. For - * interrupt-driven operation, see \ref i2c_master_read_packet_job. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of reading packet. - * \retval STATUS_OK The packet was read successfully - * \retval STATUS_ERR_TIMEOUT If no response was given within - * specified timeout period - * \retval STATUS_ERR_DENIED If error on bus - * \retval STATUS_ERR_PACKET_COLLISION If arbitration is lost - * \retval STATUS_ERR_BAD_ADDRESS If slave is busy, or no slave - * acknowledged the address - */ -enum status_code i2c_master_read_packet_wait_no_nack( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - Assert(packet); - -#if I2C_MASTER_CALLBACK_MODE == true - /* Check if the I2C module is busy with a job. */ - if (module->buffer_remaining > 0) { - return STATUS_BUSY; - } -#endif - - module->send_stop = false; - module->send_nack = false; - - return _i2c_master_read_packet(module, packet); -} - -/** - * \internal - * Starts blocking write operation. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of write packet. - * \retval STATUS_OK The packet was write successfully - * \retval STATUS_ERR_TIMEOUT If no response was given within - * specified timeout period - * \retval STATUS_ERR_DENIED If error on bus - * \retval STATUS_ERR_PACKET_COLLISION If arbitration is lost - * \retval STATUS_ERR_BAD_ADDRESS If slave is busy, or no slave - * acknowledged the address - */ -static enum status_code _i2c_master_write_packet( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Return value. */ - enum status_code tmp_status; - uint16_t tmp_data_length = packet->data_length; - - _i2c_master_wait_for_sync(module); - - /* Set address and direction bit. Will send start command on bus. */ - i2c_module->ADDR.reg = (packet->address << 1) | I2C_TRANSFER_WRITE; - - /* Wait for response on bus. */ - tmp_status = _i2c_master_wait_for_bus(module); - - /* Check for address response error unless previous error is - * detected. */ - if (tmp_status == STATUS_OK) { - tmp_status = _i2c_master_address_response(module); - } - - /* Check that no error has occurred. */ - if (tmp_status == STATUS_OK) { - /* Buffer counter. */ - uint16_t buffer_counter = 0; - - /* Write data buffer. */ - while (tmp_data_length--) { - /* Check that bus ownership is not lost. */ - if (!(i2c_module->STATUS.reg & SERCOM_I2CM_STATUS_BUSSTATE(2))) { - return STATUS_ERR_PACKET_COLLISION; - } - - /* Write byte to slave. */ - _i2c_master_wait_for_sync(module); - i2c_module->DATA.reg = packet->data[buffer_counter++]; - - /* Wait for response. */ - tmp_status = _i2c_master_wait_for_bus(module); - - /* Check for error. */ - if (tmp_status != STATUS_OK) { - break; - } - - /* Check for NACK from slave. */ - if (i2c_module->STATUS.reg & SERCOM_I2CM_STATUS_RXNACK) { - /* Return bad data value. */ - tmp_status = STATUS_ERR_OVERFLOW; - break; - } - } - - if (module->send_stop) { - /* Stop command */ - _i2c_master_wait_for_sync(module); - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_CMD(3); - } - } - - return tmp_status; -} - -/** - * \brief Writes data packet to slave - * - * Writes a data packet to the specified slave address on the I<SUP>2</SUP>C bus - * and sends a stop condition when finished. - * - * \note This will stall the device from any other operation. For - * interrupt-driven operation, see \ref i2c_master_read_packet_job. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of write packet. - * \retval STATUS_OK If packet was write successfully - * \retval STATUS_BUSY If master module is busy with a job - * \retval STATUS_ERR_DENIED If error on bus - * \retval STATUS_ERR_PACKET_COLLISION If arbitration is lost - * \retval STATUS_ERR_BAD_ADDRESS If slave is busy, or no slave - * acknowledged the address - * \retval STATUS_ERR_TIMEOUT If timeout occurred - * \retval STATUS_ERR_OVERFLOW If slave did not acknowledge last sent - * data, indicating that slave does not - * want more data and was not able to read - * last data sent - */ -enum status_code i2c_master_write_packet_wait( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - Assert(packet); - -#if I2C_MASTER_CALLBACK_MODE == true - /* Check if the I2C module is busy with a job */ - if (module->buffer_remaining > 0) { - return STATUS_BUSY; - } -#endif - - module->send_stop = true; - module->send_nack = true; - - return _i2c_master_write_packet(module, packet); -} - -/** - * \brief Writes data packet to slave without sending a stop condition when done - * - * Writes a data packet to the specified slave address on the I<SUP>2</SUP>C bus - * without sending a stop condition, thus retaining ownership of the bus when - * done. To end the transaction, a \ref i2c_master_read_packet_wait "read" or - * \ref i2c_master_write_packet_wait "write" with stop condition or sending a - * stop with the \ref i2c_master_send_stop function must be performed. - * - * \note This will stall the device from any other operation. For - * interrupt-driven operation, see \ref i2c_master_read_packet_job. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of write packet. - * \retval STATUS_OK If packet was write successfully - * \retval STATUS_BUSY If master module is busy - * \retval STATUS_ERR_DENIED If error on bus - * \retval STATUS_ERR_PACKET_COLLISION If arbitration is lost - * \retval STATUS_ERR_BAD_ADDRESS If slave is busy, or no slave - * acknowledged the address - * \retval STATUS_ERR_TIMEOUT If timeout occurred - * \retval STATUS_ERR_OVERFLOW If slave did not acknowledge last sent - * data, indicating that slave do not want - * more data - */ -enum status_code i2c_master_write_packet_wait_no_stop( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - Assert(packet); - -#if I2C_MASTER_CALLBACK_MODE == true - /* Check if the I2C module is busy with a job */ - if (module->buffer_remaining > 0) { - return STATUS_BUSY; - } -#endif - - module->send_stop = false; - module->send_nack = true; - - return _i2c_master_write_packet(module, packet); -} - -/** - * \brief Sends stop condition on bus - * - * Sends a stop condition on bus. - * - * \note This function can only be used after the - * \ref i2c_master_write_packet_wait_no_stop function. If a stop condition - * is to be sent after a read, the \ref i2c_master_read_packet_wait - * function must be used. - * - * \param[in,out] module Pointer to the software instance struct - */ -void i2c_master_send_stop(struct i2c_master_module *const module) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Send stop command */ - _i2c_master_wait_for_sync(module); - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_CMD(3); -} - -/** - * \brief Sends nack signal on bus - * - * Sends a nack signal on bus. - * - * \note This function can only be used after the - * \ref i2c_master_write_packet_wait_no_nack function, - * or \ref i2c_master_read_byte function. - * \param[in,out] module Pointer to the software instance struct - */ -void i2c_master_send_nack(struct i2c_master_module *const module) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Send nack signal */ - _i2c_master_wait_for_sync(module); - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_ACKACT; -} - -/** - * \brief Reads one byte data from slave - * - * \param[in,out] module Pointer to software module struct - * \param[out] byte Read one byte data to slave - * - * \return Status of reading byte. - * \retval STATUS_OK One byte was read successfully - * \retval STATUS_ERR_TIMEOUT If no response was given within - * specified timeout period - * \retval STATUS_ERR_DENIED If error on bus - * \retval STATUS_ERR_PACKET_COLLISION If arbitration is lost - * \retval STATUS_ERR_BAD_ADDRESS If slave is busy, or no slave - * acknowledged the address - */ -enum status_code i2c_master_read_byte( - struct i2c_master_module *const module, - uint8_t *byte) -{ - enum status_code tmp_status; - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - i2c_module->CTRLB.reg &= ~SERCOM_I2CM_CTRLB_ACKACT; - /* Write byte to slave. */ - _i2c_master_wait_for_sync(module); - *byte = i2c_module->DATA.reg; - /* Wait for response. */ - tmp_status = _i2c_master_wait_for_bus(module); - - return tmp_status; -} - -/** - * \brief Write one byte data to slave - * - * \param[in,out] module Pointer to software module struct - * \param[in] byte Send one byte data to slave - * - * \return Status of writing byte. - * \retval STATUS_OK One byte was write successfully - * \retval STATUS_ERR_TIMEOUT If no response was given within - * specified timeout period - * \retval STATUS_ERR_DENIED If error on bus - * \retval STATUS_ERR_PACKET_COLLISION If arbitration is lost - * \retval STATUS_ERR_BAD_ADDRESS If slave is busy, or no slave - * acknowledged the address - */ -enum status_code i2c_master_write_byte( - struct i2c_master_module *const module, - uint8_t byte) -{ - enum status_code tmp_status; - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Write byte to slave. */ - _i2c_master_wait_for_sync(module); - i2c_module->DATA.reg = byte; - /* Wait for response. */ - tmp_status = _i2c_master_wait_for_bus(module); - return tmp_status; -}
\ No newline at end of file diff --git a/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_samd20/i2c_master_interrupt.c b/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_samd20/i2c_master_interrupt.c deleted file mode 100644 index 07c892a03..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_samd20/i2c_master_interrupt.c +++ /dev/null @@ -1,670 +0,0 @@ -/** - * \file - * - * \brief SAM D20 I2C Master Interrupt Driver - * - * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#include "i2c_master_interrupt.h" - -/** - * \internal - * Read next data. Used by interrupt handler to get next data byte from slave. - * - * \param[in,out] module Pointer to software module structure - */ -static void _i2c_master_read( - struct i2c_master_module *const module) -{ - /* Sanity check arguments. */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Find index to save next value in buffer */ - uint16_t buffer_index = module->buffer_length - module->buffer_remaining; - - module->buffer_remaining--; - - if (!module->buffer_remaining) { - /* Send nack */ - if (module->send_nack) - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_ACKACT; - if (module->send_stop) { - /* Send stop condition */ - _i2c_master_wait_for_sync(module); - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_CMD(3); - } else { - _i2c_master_wait_for_sync(module); - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_CMD(1); - } - } else { - i2c_module->CTRLB.reg &= ~SERCOM_I2CM_CTRLB_ACKACT; - } - - /* Read byte from slave and put in buffer */ - _i2c_master_wait_for_sync(module); - module->buffer[buffer_index] = i2c_module->DATA.reg; -} - -/** - * \internal - * - * Write next data. Used by interrupt handler to send next data byte to slave. - * - * \param[in,out] module Pointer to software module structure - */ -static void _i2c_master_write(struct i2c_master_module *const module) -{ - /* Sanity check arguments. */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Check for ack from slave */ - if (i2c_module->STATUS.reg & SERCOM_I2CM_STATUS_RXNACK) - { - /* Set status */ - module->status = STATUS_ERR_OVERFLOW; - /* Do not write more data */ - return; - } - - /* Find index to get next byte in buffer */ - uint16_t buffer_index = module->buffer_length - module->buffer_remaining; - - module->buffer_remaining--; - - /* Write byte from buffer to slave */ - _i2c_master_wait_for_sync(module); - i2c_module->DATA.reg = module->buffer[buffer_index]; -} - -/** - * \internal - * Acts on slave address response. Checks for errors concerning master->slave - * handshake. - * - * \param[in,out] module Pointer to software module structure - */ -static void _i2c_master_async_address_response( - struct i2c_master_module *const module) -{ - /* Sanity check arguments. */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Check for error. Ignore bus-error; workaround for bus state stuck in - * BUSY. - */ - if (i2c_module->INTFLAG.reg & SERCOM_I2CM_INTFLAG_MB) - { - /* Clear write interrupt flag */ - i2c_module->INTFLAG.reg = SERCOM_I2CM_INTENCLR_MB; - - /* Check arbitration */ - if (i2c_module->STATUS.reg & SERCOM_I2CM_STATUS_ARBLOST) { - /* Return busy */ - module->status = STATUS_ERR_PACKET_COLLISION; - } - } - - if (i2c_module->STATUS.reg & SERCOM_I2CM_STATUS_RXNACK) { - /* Return bad address value */ - module->status = STATUS_ERR_BAD_ADDRESS; - module->buffer_remaining = 0; - - if (module->send_stop) { - /* Send stop condition */ - _i2c_master_wait_for_sync(module); - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_CMD(3); - } - } - - module->buffer_length = module->buffer_remaining; - - /* Check for status OK. */ - if (module->status == STATUS_BUSY) { - /* Call function based on transfer direction. */ - if (module->transfer_direction == I2C_TRANSFER_WRITE) { - _i2c_master_write(module); - } else { - _i2c_master_read(module); - } - } -} - -/** - * \brief Registers callback for the specified callback type - * - * Associates the given callback function with the - * specified callback type. - * - * To enable the callback, the \ref i2c_master_enable_callback function - * must be used. - * - * \param[in,out] module Pointer to the software module struct - * \param[in] callback Pointer to the function desired for the - * specified callback - * \param[in] callback_type Callback type to register - */ -void i2c_master_register_callback( - struct i2c_master_module *const module, - const i2c_master_callback_t callback, - enum i2c_master_callback callback_type) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - Assert(callback); - - /* Register callback */ - module->callbacks[callback_type] = callback; - - /* Set corresponding bit to set callback as registered */ - module->registered_callback |= (1 << callback_type); -} - -/** - * \brief Unregisters callback for the specified callback type - * - * When called, the currently registered callback for the given callback type - * will be removed. - * - * \param[in,out] module Pointer to the software module struct - * \param[in] callback_type Specifies the callback type to unregister - */ -void i2c_master_unregister_callback( - struct i2c_master_module *const module, - enum i2c_master_callback callback_type) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - - /* Register callback */ - module->callbacks[callback_type] = NULL; - - /* Clear corresponding bit to set callback as unregistered */ - module->registered_callback &= ~(1 << callback_type); -} - -/** - * \internal - * Starts a read bytes operation. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of starting reading I<SUP>2</SUP>C packet. - * \retval STATUS_OK If reading was started successfully - * \retval STATUS_BUSY If module is currently busy with another transfer - */ -enum status_code i2c_master_read_bytes( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Save packet to software module */ - module->buffer = packet->data; - module->buffer_remaining = packet->data_length; - module->transfer_direction = I2C_TRANSFER_READ; - module->status = STATUS_BUSY; - module->send_stop = false; - module->send_nack = false; - - /* Enable interrupts */ - i2c_module->INTENSET.reg = - SERCOM_I2CM_INTENSET_MB | SERCOM_I2CM_INTENSET_SB; - - return STATUS_OK; -} - -/** - * \internal - * Starts a read packet operation. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of starting reading I<SUP>2</SUP>C packet. - * \retval STATUS_OK If reading was started successfully - * \retval STATUS_BUSY If module is currently busy with another transfer - */ -static enum status_code _i2c_master_read_packet( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Save packet to software module */ - module->buffer = packet->data; - module->buffer_remaining = packet->data_length; - module->transfer_direction = I2C_TRANSFER_READ; - module->status = STATUS_BUSY; - - /* Enable interrupts */ - i2c_module->INTENSET.reg = - SERCOM_I2CM_INTENSET_MB | SERCOM_I2CM_INTENSET_SB; - - /* Set address and direction bit. Will send start command on bus */ - i2c_module->ADDR.reg = (packet->address << 1) | I2C_TRANSFER_READ; - - return STATUS_OK; -} - -/** - * \brief Initiates a read packet operation - * - * Reads a data packet from the specified slave address on the I<SUP>2</SUP>C - * bus. This is the non-blocking equivalent of \ref i2c_master_read_packet_wait. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of starting reading I<SUP>2</SUP>C packet. - * \retval STATUS_OK If reading was started successfully - * \retval STATUS_BUSY If module is currently busy with another transfer - */ -enum status_code i2c_master_read_packet_job( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - Assert(packet); - - /* Check if the I2C module is busy with a job */ - if (module->buffer_remaining > 0) { - return STATUS_BUSY; - } - - /* Make sure we send STOP */ - module->send_stop = true; - module->send_nack = true; - /* Start reading */ - return _i2c_master_read_packet(module, packet); -} - -/** - * \brief Initiates a read packet operation without sending a STOP condition when done - * - * Reads a data packet from the specified slave address on the I<SUP>2</SUP>C bus without - * sending a stop condition, thus retaining ownership of the bus when done. - * To end the transaction, a \ref i2c_master_read_packet_wait "read" or - * \ref i2c_master_write_packet_wait "write" with stop condition must be - * performed. - * - * This is the non-blocking equivalent of \ref i2c_master_read_packet_wait_no_stop. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of starting reading I<SUP>2</SUP>C packet. - * \retval STATUS_OK If reading was started successfully - * \retval STATUS_BUSY If module is currently busy with another operation - */ -enum status_code i2c_master_read_packet_job_no_stop( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - Assert(packet); - - /* Check if the I2C module is busy with a job */ - if (module->buffer_remaining > 0) { - return STATUS_BUSY; - } - - /* Make sure we don't send STOP */ - module->send_stop = false; - module->send_nack = true; - /* Start reading */ - return _i2c_master_read_packet(module, packet); -} - -/** - * \brief Initiates a read packet operation without sending a NACK signal and a - * STOP condition when done - * - * Reads a data packet from the specified slave address on the I<SUP>2</SUP>C bus without - * sending a nack and a stop condition, thus retaining ownership of the bus when done. - * To end the transaction, a \ref i2c_master_read_packet_wait "read" or - * \ref i2c_master_write_packet_wait "write" with stop condition must be - * performed. - * - * This is the non-blocking equivalent of \ref i2c_master_read_packet_wait_no_stop. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of starting reading I<SUP>2</SUP>C packet. - * \retval STATUS_OK If reading was started successfully - * \retval STATUS_BUSY If module is currently busy with another operation - */ -enum status_code i2c_master_read_packet_job_no_nack( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - Assert(packet); - - /* Check if the I2C module is busy with a job */ - if (module->buffer_remaining > 0) { - return STATUS_BUSY; - } - - /* Make sure we don't send STOP */ - module->send_stop = false; - module->send_nack = false; - /* Start reading */ - return _i2c_master_read_packet(module, packet); -} - -/** - * \internal - * Starts a write bytes operation. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of starting write I<SUP>2</SUP>C bytes. - * \retval STATUS_OK If writing was started successfully - * \retval STATUS_BUSY If module is currently busy with another transfer - */ -enum status_code i2c_master_write_bytes( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Save packet to software module */ - module->buffer = packet->data; - module->buffer_remaining = packet->data_length; - module->transfer_direction = I2C_TRANSFER_WRITE; - module->status = STATUS_BUSY; - module->send_stop = false; - module->send_nack = false; - - /* Enable interrupts */ - i2c_module->INTENSET.reg = - SERCOM_I2CM_INTENSET_MB | SERCOM_I2CM_INTENSET_SB; - - return STATUS_OK; -} - -/** - * \internal Initiates a write packet operation - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of starting writing I<SUP>2</SUP>C packet job. - * \retval STATUS_OK If writing was started successfully - * \retval STATUS_BUSY If module is currently busy with another transfer - */ -static enum status_code _i2c_master_write_packet( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Save packet to software module */ - module->buffer = packet->data; - module->buffer_remaining = packet->data_length; - module->transfer_direction = I2C_TRANSFER_WRITE; - module->status = STATUS_BUSY; - - /* Enable interrupts */ - i2c_module->INTENSET.reg = - SERCOM_I2CM_INTENSET_MB | SERCOM_I2CM_INTENSET_SB; - - /* Set address and direction bit, will send start command on bus */ - i2c_module->ADDR.reg = (packet->address << 1) | I2C_TRANSFER_WRITE; - - return STATUS_OK; -} - -/** - * \brief Initiates a write packet operation - * - * Writes a data packet to the specified slave address on the I<SUP>2</SUP>C - * bus. This is the non-blocking equivalent of \ref i2c_master_write_packet_wait. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of starting writing I<SUP>2</SUP>C packet job. - * \retval STATUS_OK If writing was started successfully - * \retval STATUS_BUSY If module is currently busy with another transfer - */ -enum status_code i2c_master_write_packet_job( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - Assert(packet); - - /* Check if the I2C module is busy with another job. */ - if (module->buffer_remaining > 0) { - return STATUS_BUSY; - } - - /* Make sure we send STOP at end*/ - module->send_stop = true; - module->send_nack = true; - /* Start write operation */ - return _i2c_master_write_packet(module, packet); -} - -/** - * \brief Initiates a write packet operation without sending a STOP condition when done - * - * Writes a data packet to the specified slave address on the I<SUP>2</SUP>C bus - * without sending a stop condition, thus retaining ownership of the bus when - * done. To end the transaction, a \ref i2c_master_read_packet_wait "read" or - * \ref i2c_master_write_packet_wait "write" with stop condition or sending - * a stop with the \ref i2c_master_send_stop function must be performed. - * - * This is the non-blocking equivalent of \ref i2c_master_write_packet_wait_no_stop. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of starting writing I<SUP>2</SUP>C packet job. - * \retval STATUS_OK If writing was started successfully - * \retval STATUS_BUSY If module is currently busy with another - */ -enum status_code i2c_master_write_packet_job_no_stop( - struct i2c_master_module *const module, - struct i2c_master_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - Assert(packet); - - /* Check if the I2C module is busy with another job. */ - if (module->buffer_remaining > 0) { - return STATUS_BUSY; - } - - /* Do not send stop condition when done */ - module->send_stop = false; - module->send_nack = true; - /* Start write operation */ - return _i2c_master_write_packet(module, packet); -} - -/** - * \internal - * Interrupt handler for I<SUP>2</SUP>C master. - * - * \param[in] instance SERCOM instance that triggered the interrupt - */ -void _i2c_master_interrupt_handler( - uint8_t instance) -{ - /* Get software module for callback handling */ - struct i2c_master_module *module = - (struct i2c_master_module*)_sercom_instances[instance]; - - Assert(module); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Combine callback registered and enabled masks */ - uint8_t callback_mask = module->enabled_callback & - module->registered_callback; - - /* Check if the module should respond to address ack */ - if ((module->buffer_length <= 0) && (module->buffer_remaining > 0)) { - /* Call function for address response */ - _i2c_master_async_address_response(module); - - /* Check if buffer write is done */ - } else if ((module->buffer_length > 0) && (module->buffer_remaining <= 0) && - (module->status == STATUS_BUSY) && - (module->transfer_direction == I2C_TRANSFER_WRITE)) { - /* Stop packet operation */ - i2c_module->INTENCLR.reg = - SERCOM_I2CM_INTENCLR_MB | SERCOM_I2CM_INTENCLR_SB; - - module->buffer_length = 0; - module->status = STATUS_OK; - - if (module->send_stop) { - /* Send stop condition */ - _i2c_master_wait_for_sync(module); - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_CMD(3); - } else { - /* Clear write interrupt flag */ - i2c_module->INTFLAG.reg = SERCOM_I2CM_INTFLAG_MB; - } - if (callback_mask & (1 << I2C_MASTER_CALLBACK_WRITE_COMPLETE)) { - module->callbacks[I2C_MASTER_CALLBACK_WRITE_COMPLETE](module); - } - - /* Continue buffer write/read */ - } else if ((module->buffer_length > 0) && (module->buffer_remaining > 0)){ - /* Check that bus ownership is not lost */ - if (!(i2c_module->STATUS.reg & SERCOM_I2CM_STATUS_BUSSTATE(2))) { - module->status = STATUS_ERR_PACKET_COLLISION; - } else if (module->transfer_direction == I2C_TRANSFER_WRITE) { - _i2c_master_write(module); - } else { - _i2c_master_read(module); - } - } - - /* Check if read buffer transfer is complete */ - if ((module->buffer_length > 0) && (module->buffer_remaining <= 0) && - (module->status == STATUS_BUSY) && - (module->transfer_direction == I2C_TRANSFER_READ)) { - - /* Stop packet operation */ - i2c_module->INTENCLR.reg = - SERCOM_I2CM_INTENCLR_MB | SERCOM_I2CM_INTENCLR_SB; - module->buffer_length = 0; - module->status = STATUS_OK; - - /* Call appropriate callback if enabled and registered */ - if ((callback_mask & (1 << I2C_MASTER_CALLBACK_READ_COMPLETE)) - && (module->transfer_direction == I2C_TRANSFER_READ)) { - module->callbacks[I2C_MASTER_CALLBACK_READ_COMPLETE](module); - } else if ((callback_mask & (1 << I2C_MASTER_CALLBACK_WRITE_COMPLETE)) - && (module->transfer_direction == I2C_TRANSFER_WRITE)) { - module->callbacks[I2C_MASTER_CALLBACK_WRITE_COMPLETE](module); - } - } - - /* Check for error */ - if ((module->status != STATUS_BUSY) && (module->status != STATUS_OK)) { - /* Stop packet operation */ - i2c_module->INTENCLR.reg = SERCOM_I2CM_INTENCLR_MB | - SERCOM_I2CM_INTENCLR_SB; - - module->buffer_length = 0; - module->buffer_remaining = 0; - - /* Send nack and stop command unless arbitration is lost */ - if ((module->status != STATUS_ERR_PACKET_COLLISION) && - module->send_stop) { - _i2c_master_wait_for_sync(module); - i2c_module->CTRLB.reg |= SERCOM_I2CM_CTRLB_ACKACT | - SERCOM_I2CM_CTRLB_CMD(3); - } - - /* Call error callback if enabled and registered */ - if (callback_mask & (1 << I2C_MASTER_CALLBACK_ERROR)) { - module->callbacks[I2C_MASTER_CALLBACK_ERROR](module); - } - } -} diff --git a/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_samd20/i2c_slave.c b/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_samd20/i2c_slave.c deleted file mode 100644 index c403479a3..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_samd20/i2c_slave.c +++ /dev/null @@ -1,693 +0,0 @@ -/** - * \file - * - * \brief SAM D20 I2C Slave Driver - * - * Copyright (c) 2013-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#include "i2c_slave.h" -#if I2C_SLAVE_CALLBACK_MODE == true -# include "i2c_slave_interrupt.h" -#endif - -/** - * \internal Sets configuration to module - * - * \param[out] module Pointer to software module structure - * \param[in] config Configuration structure with configurations to set - * - * \return Status of setting configuration. - * \retval STATUS_OK Module was configured correctly - * \retval STATUS_ERR_ALREADY_INITIALIZED If setting other GCLK generator than - * previously set - */ -static enum status_code _i2c_slave_set_config( - struct i2c_slave_module *const module, - const struct i2c_slave_config *const config) -{ - uint32_t tmp_ctrla; - - /* Sanity check arguments. */ - Assert(module); - Assert(module->hw); - Assert(config); - - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - Sercom *const sercom_hw = module->hw; - - module->buffer_timeout = config->buffer_timeout; - - struct system_pinmux_config pin_conf; - system_pinmux_get_config_defaults(&pin_conf); - - uint32_t pad0 = config->pinmux_pad0; - uint32_t pad1 = config->pinmux_pad1; - - /* SERCOM PAD0 - SDA */ - if (pad0 == PINMUX_DEFAULT) { - pad0 = _sercom_get_default_pad(sercom_hw, 0); - } - pin_conf.mux_position = pad0 & 0xFFFF; - pin_conf.direction = SYSTEM_PINMUX_PIN_DIR_OUTPUT_WITH_READBACK; - system_pinmux_pin_set_config(pad0 >> 16, &pin_conf); - - /* SERCOM PAD1 - SCL */ - if (pad1 == PINMUX_DEFAULT) { - pad1 = _sercom_get_default_pad(sercom_hw, 1); - } - pin_conf.mux_position = pad1 & 0xFFFF; - pin_conf.direction = SYSTEM_PINMUX_PIN_DIR_OUTPUT_WITH_READBACK; - system_pinmux_pin_set_config(pad1 >> 16, &pin_conf); - - /* Prepare config to write to register CTRLA */ - if (config->run_in_standby || system_is_debugger_present()) { - tmp_ctrla = SERCOM_I2CS_CTRLA_RUNSTDBY; - } else { - tmp_ctrla = 0; - } - - tmp_ctrla |= config->sda_hold_time | - (config->scl_low_timeout << SERCOM_I2CS_CTRLA_LOWTOUT_Pos); - - i2c_hw->CTRLA.reg |= tmp_ctrla; - - /* Set CTRLB configuration */ - i2c_hw->CTRLB.reg = SERCOM_I2CS_CTRLB_SMEN | config->address_mode; - - i2c_hw->ADDR.reg = config->address << SERCOM_I2CS_ADDR_ADDR_Pos | - config->address_mask << SERCOM_I2CS_ADDR_ADDRMASK_Pos | - config->enable_general_call_address << SERCOM_I2CS_ADDR_GENCEN_Pos; - - return STATUS_OK; -} - -/** - * \brief Initializes the requested I<SUP>2</SUP>C hardware module - * - * Initializes the SERCOM I<SUP>2</SUP>C slave device requested and sets the provided - * software module struct. Run this function before any further use of - * the driver. - * - * \param[out] module Pointer to software module struct - * \param[in] hw Pointer to the hardware instance - * \param[in] config Pointer to the configuration struct - * - * \return Status of initialization. - * \retval STATUS_OK Module initiated correctly - * \retval STATUS_ERR_DENIED If module is enabled - * \retval STATUS_BUSY If module is busy resetting - * \retval STATUS_ERR_ALREADY_INITIALIZED If setting other GCLK generator than - * previously set - */ -enum status_code i2c_slave_init( - struct i2c_slave_module *const module, - Sercom *const hw, - const struct i2c_slave_config *const config) -{ - /* Sanity check arguments. */ - Assert(module); - Assert(hw); - Assert(config); - - /* Initialize software module */ - module->hw = hw; - - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - - /* Check if module is enabled. */ - if (i2c_hw->CTRLA.reg & SERCOM_I2CS_CTRLA_ENABLE) { - return STATUS_ERR_DENIED; - } - - /* Check if reset is in progress. */ - if (i2c_hw->CTRLA.reg & SERCOM_I2CS_CTRLA_SWRST) { - return STATUS_BUSY; - } - - uint32_t sercom_index = _sercom_get_sercom_inst_index(module->hw); - uint32_t pm_index = sercom_index + PM_APBCMASK_SERCOM0_Pos; - uint32_t gclk_index = sercom_index + SERCOM0_GCLK_ID_CORE; - - /* Turn on module in PM */ - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBC, 1 << pm_index); - - /* Set up the GCLK for the module */ - struct system_gclk_chan_config gclk_chan_conf; - system_gclk_chan_get_config_defaults(&gclk_chan_conf); - gclk_chan_conf.source_generator = config->generator_source; - system_gclk_chan_set_config(gclk_index, &gclk_chan_conf); - system_gclk_chan_enable(gclk_index); - sercom_set_gclk_generator(config->generator_source, false); - -#if I2C_SLAVE_CALLBACK_MODE == true - /* Get sercom instance index. */ - uint8_t instance_index = _sercom_get_sercom_inst_index(module->hw); - - /* Save software module in interrupt handler. */ - _sercom_set_handler(instance_index, _i2c_slave_interrupt_handler); - - /* Save software module. */ - _sercom_instances[instance_index] = module; - - /* Initialize values in module. */ - module->registered_callback = 0; - module->enabled_callback = 0; - module->buffer_length = 0; - module->nack_on_address = config->enable_nack_on_address; -#endif - - /* Set SERCOM module to operate in I2C slave mode. */ - i2c_hw->CTRLA.reg = SERCOM_I2CS_CTRLA_MODE_I2C_SLAVE; - - /* Set config and return status. */ - return _i2c_slave_set_config(module, config); -} - -/** - * \brief Resets the hardware module - * - * This will reset the module to hardware defaults. - * - * \param[in,out] module Pointer to software module structure - */ -void i2c_slave_reset( - struct i2c_slave_module *const module) -{ - /* Sanity check arguments. */ - Assert(module); - Assert(module->hw); - - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - -#if I2C_SLAVE_CALLBACK_MODE == true - /* Reset module instance. */ - module->registered_callback = 0; - module->enabled_callback = 0; - module->buffer_length = 0; - module->buffer_remaining = 0; - module->buffer = NULL; -#endif - - /* Disable module */ - i2c_slave_disable(module); - -#if I2C_SLAVE_CALLBACK_MODE == true - /* Clear all pending interrupts. */ - system_interrupt_enter_critical_section(); - system_interrupt_clear_pending(_sercom_get_interrupt_vector(module->hw)); - system_interrupt_leave_critical_section(); -#endif - - /* Wait for sync. */ - _i2c_slave_wait_for_sync(module); - - /* Reset module. */ - i2c_hw->CTRLA.reg = SERCOM_I2CS_CTRLA_SWRST; -} - -/** - * \internal Waits for answer on bus - * - * \param[in] module Pointer to software module structure - * - * \return Status of bus. - * \retval STATUS_OK If given response from slave device - * \retval STATUS_ERR_TIMEOUT If no response was given within specified timeout - * period - */ -static enum status_code _i2c_slave_wait_for_bus( - struct i2c_slave_module *const module) -{ - /* Sanity check arguments. */ - Assert(module); - Assert(module->hw); - - SercomI2cm *const i2c_module = &(module->hw->I2CM); - - /* Wait for reply. */ - uint16_t timeout_counter = 0; - while ((!(i2c_module->INTFLAG.reg & SERCOM_I2CS_INTFLAG_DRDY)) && - (!(i2c_module->INTFLAG.reg & SERCOM_I2CS_INTFLAG_PREC)) && - (!(i2c_module->INTFLAG.reg & SERCOM_I2CS_INTFLAG_AMATCH))) { - - /* Check timeout condition. */ - if (++timeout_counter >= module->buffer_timeout) { - return STATUS_ERR_TIMEOUT; - } - } - return STATUS_OK; -} - -/** - * \brief Writes a packet to the master - * - * Writes a packet to the master. This will wait for the master to issue - * a request. - * - * \param[in] module Pointer to software module structure - * \param[in] packet Packet to write to master - * - * \return Status of packet write. - * \retval STATUS_OK Packet was written successfully - * \retval STATUS_ERR_DENIED Start condition not received, another - * interrupt flag is set - * \retval STATUS_ERR_IO There was an error in the previous transfer - * \retval STATUS_ERR_BAD_FORMAT Master wants to write data - * \retval STATUS_ERR_INVALID_ARG Invalid argument(s) was provided - * \retval STATUS_ERR_BUSY The I<SUP>2</SUP>C module is busy with a job - * \retval STATUS_ERR_ERR_OVERFLOW Master NACKed before entire packet was - * transferred - * \retval STATUS_ERR_TIMEOUT No response was given within the timeout - * period - */ -enum status_code i2c_slave_write_packet_wait( - struct i2c_slave_module *const module, - struct i2c_slave_packet *const packet) -{ - /* Sanity check arguments. */ - Assert(module); - Assert(module->hw); - Assert(packet); - - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - - uint16_t length = packet->data_length; - - if (length == 0) { - return STATUS_ERR_INVALID_ARG; - } - -#if I2C_SLAVE_CALLBACK_MODE == true - /* Check if the module is busy with a job or AMATCH is enabled */ - if (module->buffer_remaining > 0 || - (i2c_hw->INTENSET.reg & SERCOM_I2CS_INTFLAG_AMATCH)) { - return STATUS_BUSY; - } -#endif - - enum status_code status; - /* Wait for master to send address packet */ - status = _i2c_slave_wait_for_bus(module); - - if (status != STATUS_OK) { - /* Timeout, return */ - return status; - } - if (!(i2c_hw->INTFLAG.reg & SERCOM_I2CS_INTFLAG_AMATCH)) { - /* Not address interrupt, something is wrong */ - return STATUS_ERR_DENIED; - } - - /* Check if there was an error in last transfer */ - if (i2c_hw->STATUS.reg & (SERCOM_I2CS_STATUS_BUSERR | - SERCOM_I2CS_STATUS_COLL | SERCOM_I2CS_STATUS_LOWTOUT)) { - return STATUS_ERR_IO; - } - - /* Check direction */ - if (!(i2c_hw->STATUS.reg & SERCOM_I2CS_STATUS_DIR)) { - /* Write request from master, send NACK and return, workaround 13574*/ - _i2c_slave_set_ctrlb_ackact(module, false); - _i2c_slave_set_ctrlb_cmd3(module); - return STATUS_ERR_BAD_FORMAT; - } - - /* Read request from master, ACK address, workaround 13574 */ - _i2c_slave_set_ctrlb_ackact(module, true); - _i2c_slave_set_ctrlb_cmd3(module); - - uint16_t i = 0; - - /* Wait for data interrupt */ - status = _i2c_slave_wait_for_bus(module); - if (status != STATUS_OK) { - /* Timeout, return */ - return status; - } - - while (length--) { - /* Write data */ - _i2c_slave_wait_for_sync(module); - i2c_hw->DATA.reg = packet->data[i++]; - - /* Wait for response from master */ - status = _i2c_slave_wait_for_bus(module); - - if (status != STATUS_OK) { - /* Timeout, return */ - return status; - } - - if (i2c_hw->STATUS.reg & SERCOM_I2CS_STATUS_RXNACK && - length !=0) { - /* NACK from master, abort */ - /* Release line */ - i2c_hw->CTRLB.reg |= SERCOM_I2CS_CTRLB_CMD(0x02); - - return STATUS_ERR_OVERFLOW; - /* Workaround: PIF will probably not be set, ignore */ - } - /* ACK from master, continue writing */ - } - - /* Release line */ - i2c_hw->CTRLB.reg |= SERCOM_I2CS_CTRLB_CMD(0x02); - - return STATUS_OK; -} - -/** - * \brief Reads a packet from the master - * - * Reads a packet from the master. This will wait for the master to issue a - * request. - * - * \param[in] module Pointer to software module structure - * \param[out] packet Packet to read from master - * - * \return Status of packet read. - * \retval STATUS_OK Packet was read successfully - * \retval STATUS_ABORTED Master sent stop condition or repeated - * start before specified length of bytes - * was received - * \retval STATUS_ERR_IO There was an error in the previous transfer - * \retval STATUS_ERR_DENIED Start condition not received, another - * interrupt flag is set - * \retval STATUS_ERR_INVALID_ARG Invalid argument(s) was provided - * \retval STATUS_ERR_BUSY The I<SUP>2</SUP>C module is busy with a job - * \retval STATUS_ERR_BAD_FORMAT Master wants to read data - * \retval STATUS_ERR_ERR_OVERFLOW Last byte received overflows buffer - */ -enum status_code i2c_slave_read_packet_wait( - struct i2c_slave_module *const module, - struct i2c_slave_packet *const packet) -{ - /* Sanity check arguments. */ - Assert(module); - Assert(module->hw); - Assert(packet); - - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - - uint16_t length = packet->data_length; - - if (length == 0) { - return STATUS_ERR_INVALID_ARG; - } - -#if I2C_SLAVE_CALLBACK_MODE == true - /* Check if the module is busy with a job or AMATCH is enabled */ - if (module->buffer_remaining > 0 || - (i2c_hw->INTENSET.reg & SERCOM_I2CS_INTFLAG_AMATCH)) { - return STATUS_BUSY; - } -#endif - - enum status_code status; - - /* Wait for master to send address packet */ - status = _i2c_slave_wait_for_bus(module); - if (status != STATUS_OK) { - /* Timeout, return */ - return status; - } - - if (!(i2c_hw->INTFLAG.reg & SERCOM_I2CS_INTFLAG_AMATCH)) { - /* Not address interrupt, something is wrong */ - return STATUS_ERR_DENIED; - } - - /* Check if there was an error in the last transfer */ - if (i2c_hw->STATUS.reg & (SERCOM_I2CS_STATUS_BUSERR | - SERCOM_I2CS_STATUS_COLL | SERCOM_I2CS_STATUS_LOWTOUT)) { - return STATUS_ERR_IO; - } - /* Check direction */ - if ((i2c_hw->STATUS.reg & SERCOM_I2CS_STATUS_DIR)) { - /* Read request from master, send NACK and return, workaround 13574 */ - _i2c_slave_set_ctrlb_ackact(module, false); - _i2c_slave_set_ctrlb_cmd3(module); - return STATUS_ERR_BAD_FORMAT; - } - - /* Write request from master, ACK address, workaround 13574 */ - _i2c_slave_set_ctrlb_ackact(module, true); - _i2c_slave_set_ctrlb_cmd3(module); - - uint16_t i = 0; - while (length--) { - - /* Wait for next byte or stop condition */ - status = _i2c_slave_wait_for_bus(module); - if (status != STATUS_OK) { - /* Timeout, return */ - return status; - } - - if ((i2c_hw->INTFLAG.reg & SERCOM_I2CS_INTFLAG_PREC) || - i2c_hw->INTFLAG.reg & SERCOM_I2CS_INTFLAG_AMATCH) { - /* Master sent stop condition, or repeated start, read done */ - /* Clear stop flag */ - i2c_hw->INTFLAG.reg = SERCOM_I2CS_INTFLAG_PREC; - return STATUS_ABORTED; - } - - /* Read data */ - _i2c_slave_wait_for_sync(module); - packet->data[i++] = i2c_hw->DATA.reg; - - } - - /* Packet read done, wait for packet to NACK, Stop or repeated start */ - status = _i2c_slave_wait_for_bus(module); - - if (i2c_hw->INTFLAG.reg & SERCOM_I2CS_INTFLAG_DRDY) { - /* Buffer is full, send NACK */ - _i2c_slave_set_ctrlb_ackact(module, false); - i2c_hw->CTRLB.reg |= SERCOM_I2CS_CTRLB_CMD(0x2); - } - if (i2c_hw->INTFLAG.reg & SERCOM_I2CS_INTFLAG_PREC) { - /* Clear stop flag */ - i2c_hw->INTFLAG.reg = SERCOM_I2CS_INTFLAG_PREC; - } - return STATUS_OK; -} - -/** - * \brief Waits for a start condition on the bus - * - * \note This function is only available for 7-bit slave addressing. - * - * Waits for the master to issue a start condition on the bus. - * \note This function does not check for errors in the last transfer, - * this will be discovered when reading or writing. - * - * \param[in] module Pointer to software module structure - * - * \return Direction of the current transfer, when in slave mode. - * \retval I2C_SLAVE_DIRECTION_NONE No request from master within timeout - * period - * \retval I2C_SLAVE_DIRECTION_READ Write request from master - * \retval I2C_SLAVE_DIRECTION_WRITE Read request from master - */ -enum i2c_slave_direction i2c_slave_get_direction_wait( - struct i2c_slave_module *const module) -{ - /* Sanity check arguments. */ - Assert(module); - Assert(module->hw); - - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - - enum status_code status; - - /* Wait for address interrupt */ - status = _i2c_slave_wait_for_bus(module); - - if (status != STATUS_OK) { - /* Timeout, return */ - return I2C_SLAVE_DIRECTION_NONE; - } - - if (!(i2c_hw->INTFLAG.reg & SERCOM_I2CS_INTFLAG_AMATCH)) { - /* Not address interrupt, something is wrong */ - return I2C_SLAVE_DIRECTION_NONE; - } - - /* Check direction */ - if ((i2c_hw->STATUS.reg & SERCOM_I2CS_STATUS_DIR)) { - /* Read request from master */ - return I2C_SLAVE_DIRECTION_WRITE; - } else { - /* Write request from master */ - return I2C_SLAVE_DIRECTION_READ; - } -} - -/** - * \brief Retrieves the current module status - * - * Checks the status of the module and returns it as a bitmask of status - * flags. - * - * \param[in] module Pointer to the I<SUP>2</SUP>C slave software device struct - * - * \return Bitmask of status flags. - * - * \retval I2C_SLAVE_STATUS_ADDRESS_MATCH A valid address has been received - * \retval I2C_SLAVE_STATUS_DATA_READY A I<SUP>2</SUP>C slave byte transmission is - * successfully completed - * \retval I2C_SLAVE_STATUS_STOP_RECEIVED A stop condition is detected for a - * transaction being processed - * \retval I2C_SLAVE_STATUS_CLOCK_HOLD The slave is holding the SCL line - * low - * \retval I2C_SLAVE_STATUS_SCL_LOW_TIMEOUT An SCL low time-out has occurred - * \retval I2C_SLAVE_STATUS_REPEATED_START Indicates a repeated start, only - * valid if \ref - * I2C_SLAVE_STATUS_ADDRESS_MATCH is - * set - * \retval I2C_SLAVE_STATUS_RECEIVED_NACK The last data packet sent was not - * acknowledged - * \retval I2C_SLAVE_STATUS_COLLISION The I<SUP>2</SUP>C slave was not able to - * transmit a high data or NACK bit - * \retval I2C_SLAVE_STATUS_BUS_ERROR An illegal bus condition has - * occurred on the bus - */ -uint32_t i2c_slave_get_status( - struct i2c_slave_module *const module) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - - uint8_t intflags = i2c_hw->INTFLAG.reg; - uint8_t status = i2c_hw->STATUS.reg; - uint32_t status_flags = 0; - - /* Check Address Match flag */ - if (intflags & SERCOM_I2CS_INTFLAG_AMATCH) { - status_flags |= I2C_SLAVE_STATUS_ADDRESS_MATCH; - } - /* Check Data Ready flag */ - if (intflags & SERCOM_I2CS_INTFLAG_DRDY) { - status_flags |= I2C_SLAVE_STATUS_DATA_READY; - } - /* Check Stop flag */ - if (intflags & SERCOM_I2CS_INTFLAG_PREC) { - status_flags |= I2C_SLAVE_STATUS_STOP_RECEIVED; - } - /* Check Clock Hold */ - if (status & SERCOM_I2CS_STATUS_CLKHOLD) { - status_flags |= I2C_SLAVE_STATUS_CLOCK_HOLD; - } - /* Check SCL Low Timeout */ - if (status & SERCOM_I2CS_STATUS_LOWTOUT) { - status_flags |= I2C_SLAVE_STATUS_SCL_LOW_TIMEOUT; - } - /* Check Repeated Start */ - if (status & SERCOM_I2CS_STATUS_SR) { - status_flags |= I2C_SLAVE_STATUS_REPEATED_START; - } - /* Check Received Not Acknowledge */ - if (status & SERCOM_I2CS_STATUS_RXNACK) { - status_flags |= I2C_SLAVE_STATUS_RECEIVED_NACK; - } - /* Check Transmit Collision */ - if (status & SERCOM_I2CS_STATUS_COLL) { - status_flags |= I2C_SLAVE_STATUS_COLLISION; - } - /* Check Bus Error */ - if (status & SERCOM_I2CS_STATUS_BUSERR) { - status_flags |= I2C_SLAVE_STATUS_BUS_ERROR; - } - - return status_flags; -} - -/** - * \brief Clears a module status flag - * - * Clears the given status flag of the module. - * - * \note Not all status flags can be cleared. - * - * \param[in] module Pointer to the I<SUP>2</SUP>C software device struct - * \param[in] status_flags Bit mask of status flags to clear - * - */ -void i2c_slave_clear_status( - struct i2c_slave_module *const module, - uint32_t status_flags) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - - /* Clear Address Match flag */ - if (status_flags & I2C_SLAVE_STATUS_ADDRESS_MATCH) { - i2c_hw->INTFLAG.reg = SERCOM_I2CS_INTFLAG_AMATCH; - } - /* Clear Data Ready flag */ - if (status_flags & I2C_SLAVE_STATUS_DATA_READY) { - i2c_hw->INTFLAG.reg = SERCOM_I2CS_INTFLAG_DRDY; - } - /* Clear Stop flag */ - if (status_flags & I2C_SLAVE_STATUS_STOP_RECEIVED) { - i2c_hw->INTFLAG.reg = SERCOM_I2CS_INTFLAG_PREC; - } - /* Clear SCL Low Timeout */ - if (status_flags & I2C_SLAVE_STATUS_SCL_LOW_TIMEOUT) { - i2c_hw->STATUS.reg = SERCOM_I2CS_STATUS_LOWTOUT; - } - /* Clear Transmit Collision */ - if (status_flags & I2C_SLAVE_STATUS_COLLISION) { - i2c_hw->STATUS.reg = SERCOM_I2CS_STATUS_COLL; - } - /* Clear Bus Error */ - if (status_flags & I2C_SLAVE_STATUS_BUS_ERROR) { - i2c_hw->STATUS.reg = SERCOM_I2CS_STATUS_BUSERR; - } -} diff --git a/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_samd20/i2c_slave_interrupt.c b/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_samd20/i2c_slave_interrupt.c deleted file mode 100644 index 29d222bd2..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_samd20/i2c_slave_interrupt.c +++ /dev/null @@ -1,434 +0,0 @@ -/** - * \file - * - * \brief SAM D20 I2C Slave Interrupt Driver - * - * Copyright (c) 2013-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#include "i2c_slave_interrupt.h" - -/** - * \brief Enables sending of NACK on address match - * - * Enables sending of NACK on address match, thus discarding - * any incoming transaction. - * - * \param[in,out] module Pointer to software module structure - */ -void i2c_slave_enable_nack_on_address( - struct i2c_slave_module *const module) -{ - /* Sanity check arguments. */ - Assert(module); - - module->nack_on_address = true; -} - -/** - * \brief Disables sending NACK on address match - * - * Disables sending of NACK on address match, thus - * acknowledging incoming transactions. - * - * \param[in,out] module Pointer to software module structure - */ -void i2c_slave_disable_nack_on_address( - struct i2c_slave_module *const module) -{ - /* Sanity check arguments. */ - Assert(module); - - module->nack_on_address = false; -} - -/** - * \internal - * Reads next data. Used by interrupt handler to get next data byte from master. - * - * \param[in,out] module Pointer to software module structure - */ -static void _i2c_slave_read( - struct i2c_slave_module *const module) -{ - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - - /* Read byte from master and put in buffer. */ - *(module->buffer++) = i2c_hw->DATA.reg; - - /*Decrement remaining buffer length */ - module->buffer_remaining--; -} - -/** - * \internal - * Writes next data. Used by interrupt handler to send next data byte to master. - * - * \param[in,out] module Pointer to software module structure - */ -static void _i2c_slave_write( - struct i2c_slave_module *const module) -{ - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - - /* Write byte from buffer to master */ - i2c_hw->DATA.reg = *(module->buffer++); - - /*Decrement remaining buffer length */ - module->buffer_remaining--; -} - -/** - * \brief Registers callback for the specified callback type - * - * Associates the given callback function with the - * specified callback type. To enable the callback, the - * \ref i2c_slave_enable_callback function must be used. - * - * \param[in,out] module Pointer to the software module struct - * \param[in] callback Pointer to the function desired for the - * specified callback - * \param[in] callback_type Callback type to register - */ -void i2c_slave_register_callback( - struct i2c_slave_module *const module, - i2c_slave_callback_t callback, - enum i2c_slave_callback callback_type) -{ - /* Sanity check. */ - Assert(module); - Assert(module->hw); - Assert(callback); - - /* Register callback. */ - module->callbacks[callback_type] = callback; - - /* Set corresponding bit to set callback as initiated. */ - module->registered_callback |= (1 << callback_type); -} - -/** - * \brief Unregisters callback for the specified callback type - * - * Removes the currently registered callback for the given callback - * type. - * - * \param[in,out] module Pointer to the software module struct - * \param[in] callback_type Callback type to unregister - */ -void i2c_slave_unregister_callback( - struct i2c_slave_module *const module, - enum i2c_slave_callback callback_type) -{ - /* Sanity check. */ - Assert(module); - Assert(module->hw); - - /* Register callback. */ - module->callbacks[callback_type] = NULL; - - /* Set corresponding bit to set callback as initiated. */ - module->registered_callback &= ~(1 << callback_type); -} - -/** - * \brief Initiates a reads packet operation - * - * Reads a data packet from the master. A write request must be initiated by - * the master before the packet can be read. - * - * The \ref I2C_SLAVE_CALLBACK_WRITE_REQUEST callback can be used to call this - * function. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of starting asynchronously reading I<SUP>2</SUP>C packet. - * \retval STATUS_OK If reading was started successfully - * \retval STATUS_BUSY If module is currently busy with another transfer - */ -enum status_code i2c_slave_read_packet_job( - struct i2c_slave_module *const module, - struct i2c_slave_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - Assert(packet); - - /* Check if the I2C module is busy doing async operation. */ - if (module->buffer_remaining > 0) { - return STATUS_BUSY; - } - - /* Save packet to software module. */ - module->buffer = packet->data; - module->buffer_remaining = packet->data_length; - module->buffer_length = packet->data_length; - module->status = STATUS_BUSY; - - /* Enable interrupts */ - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - i2c_hw->INTENSET.reg = SERCOM_I2CS_INTFLAG_AMATCH | - SERCOM_I2CS_INTFLAG_DRDY | SERCOM_I2CS_INTFLAG_PREC; - - /* Read will begin when master initiates the transfer */ - return STATUS_OK; -} - -/** - * \brief Initiates a write packet operation - * - * Writes a data packet to the master. A read request must be initiated by - * the master before the packet can be written. - * - * The \ref I2C_SLAVE_CALLBACK_READ_REQUEST callback can be used to call this - * function. - * - * \param[in,out] module Pointer to software module struct - * \param[in,out] packet Pointer to I<SUP>2</SUP>C packet to transfer - * - * \return Status of starting writing I<SUP>2</SUP>C packet. - * \retval STATUS_OK If writing was started successfully - * \retval STATUS_BUSY If module is currently busy with another transfer - */ -enum status_code i2c_slave_write_packet_job( - struct i2c_slave_module *const module, - struct i2c_slave_packet *const packet) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - Assert(packet); - - /* Check if the I2C module is busy doing async operation. */ - if (module->buffer_remaining > 0) { - return STATUS_BUSY; - } - - /* Save packet to software module. */ - module->buffer = packet->data; - module->buffer_remaining = packet->data_length; - module->buffer_length = packet->data_length; - module->status = STATUS_BUSY; - - /* Enable interrupts */ - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - i2c_hw->INTENSET.reg = SERCOM_I2CS_INTFLAG_AMATCH | - SERCOM_I2CS_INTFLAG_DRDY | SERCOM_I2CS_INTFLAG_PREC; - - return STATUS_OK; -} - -/** - * \internal Interrupt handler for I<SUP>2</SUP>C slave - * - * \param[in] instance Sercom instance that triggered the interrupt - */ -void _i2c_slave_interrupt_handler( - uint8_t instance) -{ - /* Get software module for callback handling. */ - struct i2c_slave_module *module = - (struct i2c_slave_module*)_sercom_instances[instance]; - - Assert(module); - - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - - /* Combine callback registered and enabled masks. */ - uint8_t callback_mask = - module->enabled_callback & module->registered_callback; - - - if (i2c_hw->INTFLAG.reg & SERCOM_I2CS_INTFLAG_AMATCH) { - /* Address match */ - /* Check if last transfer is done - repeated start */ - if (module->buffer_length != module->buffer_remaining && - module->transfer_direction == I2C_TRANSFER_WRITE) { - - module->status = STATUS_OK; - module->buffer_length = 0; - module->buffer_remaining = 0; - - if ((callback_mask & (1 << I2C_SLAVE_CALLBACK_READ_COMPLETE))) { - module->callbacks[I2C_SLAVE_CALLBACK_READ_COMPLETE](module); - } - } else if (module->buffer_length != module->buffer_remaining && - module->transfer_direction == I2C_TRANSFER_READ) { - module->status = STATUS_OK; - module->buffer_length = 0; - module->buffer_remaining = 0; - - if ((callback_mask & (1 << I2C_SLAVE_CALLBACK_WRITE_COMPLETE))) { - module->callbacks[I2C_SLAVE_CALLBACK_WRITE_COMPLETE](module); - } - } - - if (i2c_hw->STATUS.reg & (SERCOM_I2CS_STATUS_BUSERR | - SERCOM_I2CS_STATUS_COLL | SERCOM_I2CS_STATUS_LOWTOUT)) { - /* An error occurred in last packet transfer */ - module->status = STATUS_ERR_IO; - - if ((callback_mask & (1 << I2C_SLAVE_CALLBACK_ERROR_LAST_TRANSFER))) { - module->callbacks[I2C_SLAVE_CALLBACK_ERROR_LAST_TRANSFER](module); - } - } - if (module->nack_on_address) { - /* NACK address, workaround 13574 */ - _i2c_slave_set_ctrlb_ackact(module, false); - } else if (i2c_hw->STATUS.reg & SERCOM_I2CS_STATUS_DIR) { - /* Set transfer direction in module instance */ - module->transfer_direction = I2C_TRANSFER_READ; - - /* Read request from master */ - if (callback_mask & (1 << I2C_SLAVE_CALLBACK_READ_REQUEST)) { - module->callbacks[I2C_SLAVE_CALLBACK_READ_REQUEST](module); - } - - if (module->buffer_length == 0) { - /* Data buffer not set up, NACK address, workaround 13574*/ - _i2c_slave_set_ctrlb_ackact(module, false); - } else { - /* ACK address, workaround 13574 */ - _i2c_slave_set_ctrlb_ackact(module, true); - } - } else { - /* Set transfer direction in dev inst */ - module->transfer_direction = I2C_TRANSFER_WRITE; - - /* Write request from master */ - if (callback_mask & (1 << I2C_SLAVE_CALLBACK_WRITE_REQUEST)) { - module->callbacks[I2C_SLAVE_CALLBACK_WRITE_REQUEST](module); - } - - if (module->buffer_length == 0) { - /* Data buffer not set up, NACK address, workaround 13574 */ - _i2c_slave_set_ctrlb_ackact(module, false); - } else { - /* ACK address, workaround 13574 */ - _i2c_slave_set_ctrlb_ackact(module, true); - } - } - - /* ACK or NACK address, Workaround 13574 */ - _i2c_slave_set_ctrlb_cmd3(module); - - /* ACK next incoming packet, workaround 13574 */ - _i2c_slave_set_ctrlb_ackact(module, true); - - } else if (i2c_hw->INTFLAG.reg & SERCOM_I2CS_INTFLAG_PREC) { - /* Stop condition on bus - current transfer done */ - - /* Clear Stop interrupt */ - i2c_hw->INTFLAG.reg = SERCOM_I2CS_INTFLAG_PREC; - - /* Disable interrupts */ - i2c_hw->INTENCLR.reg = SERCOM_I2CS_INTFLAG_PREC | SERCOM_I2CS_INTFLAG_DRDY; - - if (!((module->enabled_callback & (1 << I2C_SLAVE_CALLBACK_READ_REQUEST)) - || (module->enabled_callback == (1 << I2C_SLAVE_CALLBACK_WRITE_REQUEST)))) { - /* Disable address match if read/write request is not enabled */ - i2c_hw->INTENCLR.reg = SERCOM_I2CS_INTFLAG_AMATCH; - } - - if (!(module->status == STATUS_ERR_OVERFLOW || module->status == STATUS_ERR_IO)) { - module->status = STATUS_OK; - module->buffer_length = 0; - module->buffer_remaining = 0; - - /* Call appropriate callback if enabled and registered */ - if ((callback_mask & (1 << I2C_SLAVE_CALLBACK_READ_COMPLETE)) - && (module->transfer_direction == I2C_TRANSFER_WRITE)) { - /* Read from master complete */ - module->callbacks[I2C_SLAVE_CALLBACK_READ_COMPLETE](module); - } else if ((callback_mask & (1 << I2C_SLAVE_CALLBACK_WRITE_COMPLETE)) - && (module->transfer_direction == I2C_TRANSFER_READ)) { - /* Write to master complete */ - module->callbacks[I2C_SLAVE_CALLBACK_WRITE_COMPLETE](module); - } - } - } else if (i2c_hw->INTFLAG.reg & SERCOM_I2CS_INTFLAG_DRDY) { - /* Check if buffer is full, or NACK from master */ - if (module->buffer_remaining <= 0 || - (module->transfer_direction == I2C_TRANSFER_READ && - (module->buffer_length > module->buffer_remaining) && - (i2c_hw->STATUS.reg & SERCOM_I2CS_STATUS_RXNACK))) { - - module->buffer_remaining = 0; - module->buffer_length = 0; - - if (module->transfer_direction == I2C_TRANSFER_WRITE) { - /* Buffer is full, send NACK, workaround 13574 */ - _i2c_slave_set_ctrlb_ackact(module, false); - i2c_hw->CTRLB.reg |= SERCOM_I2CS_CTRLB_CMD(0x2); - - /* Set status, new character in DATA register will overflow - * buffer */ - module->status = STATUS_ERR_OVERFLOW; - - if (callback_mask & (1 << I2C_SLAVE_CALLBACK_ERROR)) { - /* Read complete */ - module->callbacks[I2C_SLAVE_CALLBACK_ERROR](module); - } - } else { - /* Release SCL and wait for new start condition */ - _i2c_slave_set_ctrlb_ackact(module, false); - i2c_hw->CTRLB.reg |= SERCOM_I2CS_CTRLB_CMD(0x2); - - /* Transfer successful */ - module->status = STATUS_OK; - - /* Disable interrupts */ - i2c_hw->INTENCLR.reg = SERCOM_I2CS_INTFLAG_DRDY; - } - - /* Continue buffer write/read */ - } else if (module->buffer_length > 0 && module->buffer_remaining > 0) { - /* Call function based on transfer direction */ - if (module->transfer_direction == I2C_TRANSFER_WRITE) { - _i2c_slave_read(module); - } else { - _i2c_slave_write(module); - } - } - } -} diff --git a/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_slave.h b/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_slave.h deleted file mode 100644 index 20eb78ec0..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_slave.h +++ /dev/null @@ -1,753 +0,0 @@ -/** - * \file - * - * \brief SAM SERCOM I2C Slave Driver - * - * Copyright (c) 2013-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef I2C_SLAVE_H_INCLUDED -#define I2C_SLAVE_H_INCLUDED - -#include "i2c_common.h" -#include <sercom.h> -#include <pinmux.h> - -#if I2C_SLAVE_CALLBACK_MODE == true -# include <sercom_interrupt.h> -#endif - -#ifndef PINMUX_DEFAULT -# define PINMUX_DEFAULT 0 -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \addtogroup asfdoc_sam0_sercom_i2c_group - * - * @{ - * - */ - -/** - * \name I2C Slave Status Flags - * - * I<SUP>2</SUP>C slave status flags, returned by \ref i2c_slave_get_status() and cleared - * by \ref i2c_slave_clear_status(). - * @{ - */ - -/** Address Match. - * \note Should only be cleared internally by driver. - */ -#define I2C_SLAVE_STATUS_ADDRESS_MATCH (1UL << 0) -/** Data Ready. */ -#define I2C_SLAVE_STATUS_DATA_READY (1UL << 1) -/** Stop Received. */ -#define I2C_SLAVE_STATUS_STOP_RECEIVED (1UL << 2) -/** Clock Hold. - * \note Cannot be cleared, only valid when I2C_SLAVE_STATUS_ADDRESS_MATCH is - * set. - */ -#define I2C_SLAVE_STATUS_CLOCK_HOLD (1UL << 3) -/** SCL Low Timeout. */ -#define I2C_SLAVE_STATUS_SCL_LOW_TIMEOUT (1UL << 4) -/** Repeated Start. - * \note Cannot be cleared, only valid when I2C_SLAVE_STATUS_ADDRESS_MATCH is - * set. - */ -#define I2C_SLAVE_STATUS_REPEATED_START (1UL << 5) -/** Received not acknowledge. - * \note Cannot be cleared. - */ -#define I2C_SLAVE_STATUS_RECEIVED_NACK (1UL << 6) -/** Transmit Collision. */ -#define I2C_SLAVE_STATUS_COLLISION (1UL << 7) -/** Bus error. */ -#define I2C_SLAVE_STATUS_BUS_ERROR (1UL << 8) - -/** @} */ - -/** - * \brief I<SUP>2</SUP>C slave packet for read/write - * - * Structure to be used when transferring I<SUP>2</SUP>C slave packets. - */ -struct i2c_slave_packet { - /** Length of data array */ - uint16_t data_length; - /** Data array containing all data to be transferred */ - uint8_t *data; -}; - -#if I2C_SLAVE_CALLBACK_MODE == true - /** - * \brief Callback types - * - * The available callback types for the I<SUP>2</SUP>C slave. - */ -enum i2c_slave_callback { - /** Callback for packet write complete */ - I2C_SLAVE_CALLBACK_WRITE_COMPLETE, - /** Callback for packet read complete */ - I2C_SLAVE_CALLBACK_READ_COMPLETE, - /** - * Callback for read request from master - can be used to - * issue a write - */ - I2C_SLAVE_CALLBACK_READ_REQUEST, - /** - * Callback for write request from master - can be used to issue a read - */ - I2C_SLAVE_CALLBACK_WRITE_REQUEST, - /** Callback for error */ - I2C_SLAVE_CALLBACK_ERROR, - /** - * Callback for error in last transfer. Discovered on a new address - * interrupt. - */ - I2C_SLAVE_CALLBACK_ERROR_LAST_TRANSFER, -# if !defined(__DOXYGEN__) - /** Total number of callbacks */ - _I2C_SLAVE_CALLBACK_N, -# endif -}; - -# if !defined(__DOXYGEN__) -/** Software module prototype */ -struct i2c_slave_module; - -/** Callback type */ -typedef void (*i2c_slave_callback_t)( - struct i2c_slave_module *const module); -# endif -#endif - -/** - * \brief Enum for the possible SDA hold times with respect to the negative - * edge of SCL - * - * Enum for the possible SDA hold times with respect to the negative edge - * of SCL. - */ -enum i2c_slave_sda_hold_time { - /** SDA hold time disabled */ - I2C_SLAVE_SDA_HOLD_TIME_DISABLED = - ((SERCOM_I2CS_CTRLA_SDAHOLD_Msk & ((0) << SERCOM_I2CS_CTRLA_SDAHOLD_Pos))), - /** SDA hold time 50ns - 100ns */ - I2C_SLAVE_SDA_HOLD_TIME_50NS_100NS = - ((SERCOM_I2CS_CTRLA_SDAHOLD_Msk & ((1) << SERCOM_I2CS_CTRLA_SDAHOLD_Pos))), - /** SDA hold time 300ns - 600ns */ - I2C_SLAVE_SDA_HOLD_TIME_300NS_600NS = - ((SERCOM_I2CS_CTRLA_SDAHOLD_Msk & ((2) << SERCOM_I2CS_CTRLA_SDAHOLD_Pos))), - /** SDA hold time 400ns - 800ns */ - I2C_SLAVE_SDA_HOLD_TIME_400NS_800NS = - ((SERCOM_I2CS_CTRLA_SDAHOLD_Msk & ((3) << SERCOM_I2CS_CTRLA_SDAHOLD_Pos))), -}; - -/** - * \brief Enum for the possible address modes - * - * Enum for the possible address modes. - */ -enum i2c_slave_address_mode { - /** Address match on address_mask used as a mask to address */ - I2C_SLAVE_ADDRESS_MODE_MASK = SERCOM_I2CS_CTRLB_AMODE(0), - /** Address math on both address and address_mask */ - I2C_SLAVE_ADDRESS_MODE_TWO_ADDRESSES = SERCOM_I2CS_CTRLB_AMODE(1), - /** - * Address match on range of addresses between and including address and - * address_mask - */ - I2C_SLAVE_ADDRESS_MODE_RANGE = SERCOM_I2CS_CTRLB_AMODE(2), -}; - -/** - * \brief Enum for the direction of a request - * - * Enum for the direction of a request. - */ -enum i2c_slave_direction { - /** Read */ - I2C_SLAVE_DIRECTION_READ, - /** Write */ - I2C_SLAVE_DIRECTION_WRITE, - /** No direction */ - I2C_SLAVE_DIRECTION_NONE, -}; - -#ifdef FEATURE_I2C_FAST_MODE_PLUS_AND_HIGH_SPEED -/** - * \brief Enum for the transfer speed - * - * Enum for the transfer speed. - */ -enum i2c_slave_transfer_speed { - /** Standard-mode (Sm) up to 100KHz and Fast-mode (Fm) up to 400KHz */ - I2C_SLAVE_SPEED_STANDARD_AND_FAST = SERCOM_I2CS_CTRLA_SPEED(0), - /** Fast-mode Plus (Fm+) up to 1MHz */ - I2C_SLAVE_SPEED_FAST_MODE_PLUS = SERCOM_I2CS_CTRLA_SPEED(1), - /** High-speed mode (Hs-mode) up to 3.4MHz */ - I2C_SLAVE_SPEED_HIGH_SPEED = SERCOM_I2CS_CTRLA_SPEED(2), -}; -#endif - -/** - * \brief SERCOM I<SUP>2</SUP>C slave driver software device instance structure. - * - * SERCOM I<SUP>2</SUP>C slave driver software instance structure, used to - * retain software state information of an associated hardware module instance. - * - * \note The fields of this structure should not be altered by the user - * application; they are reserved for module-internal use only. - */ -struct i2c_slave_module { -#if !defined(__DOXYGEN__) - /** Hardware instance initialized for the struct */ - Sercom *hw; - /** Module lock */ - volatile bool locked; - /** Timeout value for polled functions */ - uint16_t buffer_timeout; -# ifdef FEATURE_I2C_10_BIT_ADDRESS - /** Using 10-bit addressing for the slave */ - bool ten_bit_address; -# endif -# if I2C_SLAVE_CALLBACK_MODE == true - /** Nack on address match */ - bool nack_on_address; - /** Pointers to callback functions */ - volatile i2c_slave_callback_t callbacks[_I2C_SLAVE_CALLBACK_N]; - /** Mask for registered callbacks */ - volatile uint8_t registered_callback; - /** Mask for enabled callbacks */ - volatile uint8_t enabled_callback; - /** The total number of bytes to transfer */ - volatile uint16_t buffer_length; - /** - * Counter used for bytes left to send in write and to count number of - * obtained bytes in read - */ - uint16_t buffer_remaining; - /** Data buffer for packet write and read */ - volatile uint8_t *buffer; - /** Save direction of request from master. 1 = read, 0 = write. */ - volatile enum i2c_transfer_direction transfer_direction; - /** Status for status read back in error callback */ - volatile enum status_code status; -# endif -#endif -}; - -/** - * \brief Configuration structure for the I<SUP>2</SUP>C slave device - * - * This is the configuration structure for the I<SUP>2</SUP>C slave device. It is used - * as an argument for \ref i2c_slave_init to provide the desired - * configurations for the module. The structure should be initialized using the - * \ref i2c_slave_get_config_defaults. - */ -struct i2c_slave_config { - /** Set to enable the SCL low timeout */ - bool enable_scl_low_timeout; - /** SDA hold time with respect to the negative edge of SCL */ - enum i2c_slave_sda_hold_time sda_hold_time; - /** Timeout to wait for master in polled functions */ - uint16_t buffer_timeout; - /** Addressing mode */ - enum i2c_slave_address_mode address_mode; - /** Address or upper limit of address range */ - uint16_t address; - /** Address mask, second address, or lower limit of address range */ - uint16_t address_mask; -#ifdef FEATURE_I2C_10_BIT_ADDRESS - /** Enable 10-bit addressing */ - bool ten_bit_address; -#endif - /** - * Enable general call address recognition (general call address - * is defined as 0000000 with direction bit 0). - */ - bool enable_general_call_address; - -#ifdef FEATURE_I2C_FAST_MODE_PLUS_AND_HIGH_SPEED - /** Transfer speed mode */ - enum i2c_slave_transfer_speed transfer_speed; -#endif - -#if I2C_SLAVE_CALLBACK_MODE == true - /** - * Enable NACK on address match (this can be changed after initialization - * via the \ref i2c_slave_enable_nack_on_address and - * \ref i2c_slave_disable_nack_on_address functions). - */ - bool enable_nack_on_address; -#endif - /** GCLK generator to use as clock source */ - enum gclk_generator generator_source; - /** Set to keep module active in sleep modes */ - bool run_in_standby; - /** PAD0 (SDA) pinmux */ - uint32_t pinmux_pad0; - /** PAD1 (SCL) pinmux */ - uint32_t pinmux_pad1; - /** Set to enable SCL low time-out */ - bool scl_low_timeout; -#ifdef FEATURE_I2C_SCL_STRETCH_MODE - /** Set to enable SCL stretch only after ACK bit (required for high speed) */ - bool scl_stretch_only_after_ack_bit; -#endif -#ifdef FEATURE_I2C_SCL_EXTEND_TIMEOUT - /** Set to enable slave SCL low extend time-out */ - bool slave_scl_low_extend_timeout; -#endif -}; - - -/** - * \name Lock/Unlock - * @{ - */ - -/** - * \brief Attempt to get lock on driver instance - * - * This function checks the instance's lock, which indicates whether or not it - * is currently in use, and sets the lock if it was not already set. - * - * The purpose of this is to enable exclusive access to driver instances, so - * that, e.g., transactions by different services will not interfere with each - * other. - * - * \param[in,out] module Pointer to the driver instance to lock - * - * \retval STATUS_OK If the module was locked - * \retval STATUS_BUSY If the module was already locked - */ -static inline enum status_code i2c_slave_lock( - struct i2c_slave_module *const module) -{ - enum status_code status; - - system_interrupt_enter_critical_section(); - - if (module->locked) { - status = STATUS_BUSY; - } else { - module->locked = true; - status = STATUS_OK; - } - - system_interrupt_leave_critical_section(); - - return status; -} - -/** - * \brief Unlock driver instance - * - * This function clears the instance lock, indicating that it is available for - * use. - * - * \param[in,out] module Pointer to the driver instance to lock - * - * \retval STATUS_OK If the module was locked - * \retval STATUS_BUSY If the module was already locked - */ -static inline void i2c_slave_unlock(struct i2c_slave_module *const module) -{ - module->locked = false; -} - -/** @} */ - -/** - * \name Configuration and Initialization - * @{ - */ - -/** - * \brief Returns the synchronization status of the module - * - * Returns the synchronization status of the module. - * - * \param[out] module Pointer to software module structure - * - * \return Status of the synchronization. - * \retval true Module is busy synchronizing - * \retval false Module is not synchronizing - */ -static inline bool i2c_slave_is_syncing( - const struct i2c_slave_module *const module) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - - /* Return sync status */ -#if defined(FEATURE_SERCOM_SYNCBUSY_SCHEME_VERSION_1) - return (i2c_hw->STATUS.reg & SERCOM_I2CS_STATUS_SYNCBUSY); -#elif defined(FEATURE_SERCOM_SYNCBUSY_SCHEME_VERSION_2) - return (i2c_hw->SYNCBUSY.reg & SERCOM_I2CS_SYNCBUSY_MASK); -#else -# error Unknown SERCOM SYNCBUSY scheme! -#endif -} - -#if !defined(__DOXYGEN__) -/** - * \internal Wait for hardware module to sync - * - * \param[in] module Pointer to software module structure - */ -static void _i2c_slave_wait_for_sync( - const struct i2c_slave_module *const module) -{ - /* Sanity check */ - Assert(module); - - while (i2c_slave_is_syncing(module)) { - /* Wait for I<SUP>2</SUP>C module to sync */ - } -} -#endif - -///@cond INTERNAL -/** - * \internal Workaround for errata 13574 - * Instead set ACK/NACK of CTRLB - * - * This errata exist in part revisions of SAM D20/D21/D09 - * D10/D11/L21/L22/DA1/C20/C21/R30, but workaround can be works in all - * revision of those device. As this function operation - * should be use less cpu time as possible, so caller - * function can ignore to check revision number, and use - * this workaround in all revision of those device. - * - * \param[in,out] module Pointer to software module structure - * \param[in] send_ack true send ACK, false send NACK - */ -static inline void _i2c_slave_set_ctrlb_ackact( - struct i2c_slave_module *const module, - bool send_ack) -{ - Assert(module); - Assert(module->hw); - - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - -#if (SAMD20 || SAMD21 || SAMD09 || SAMD10 || SAMD11 || SAML21 || SAMDA1 || \ - SAML22 || SAMC20 || SAMC21 || SAMR30) - /* Workaround, Following two write are atomic */ - system_interrupt_enter_critical_section(); - i2c_hw->STATUS.reg = 0; - - if (send_ack == true) { - i2c_hw->CTRLB.reg = 0; - } - else { - i2c_hw->CTRLB.reg = SERCOM_I2CS_CTRLB_ACKACT; - } - system_interrupt_leave_critical_section(); -#else - /* Normal operation */ - if (send_ack == true) { - i2c_hw->CTRLB.reg &= ~SERCOM_I2CS_CTRLB_ACKACT; - } - else { - i2c_hw->CTRLB.reg |= SERCOM_I2CS_CTRLB_ACKACT; - } -#endif - return; -} - -/** - * \internal Workaround for SAM0 errata 13574, - * instead Set CMD3 of CTRLB - * - * This errata exist in part revisions of SAM D20/D21/D09 - * D10/D11/L21/DA1/C20/C21/R30, but workaround can be works in all - * revision of those device. As this function operation - * should be use less cpu time as possible, so caller - * function can ignore to check revision number, and use - * this workaround in all revision of those device. - * - * \param[in,out] module Pointer to software module structure - */ -static inline void _i2c_slave_set_ctrlb_cmd3( - struct i2c_slave_module *const module) -{ - Assert(module); - Assert(module->hw); - - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - -#if (SAMD20 || SAMD21 || SAMD09 || SAMD10 || SAMD11 || SAML21 || SAML22 || \ - SAMDA1 || SAMC20 || SAMC21 || SAMR30) - /* Workaround */ - /* - * Below code instead i2c_hw->CTRLB.reg = SERCOM_I2CS_CTRLB_CMD(0x3); - * CMD=0x3 clears all interrupts, so to keep the result similar - * PREC is cleared if it was set - */ - if (i2c_hw->INTFLAG.bit.PREC) { - i2c_hw->INTFLAG.reg = SERCOM_I2CS_INTFLAG_PREC; - } - i2c_hw->INTFLAG.reg = SERCOM_I2CS_INTFLAG_AMATCH; -#else - /* Normal operation */ - i2c_hw->CTRLB.reg = SERCOM_I2CS_CTRLB_CMD(0x3); -#endif - return; -} -///@endcond - -/** - * \brief Gets the I<SUP>2</SUP>C slave default configurations - * - * This will initialize the configuration structure to known default values. - * - * The default configuration is as follows: - * - Disable SCL low timeout - * - 300ns - 600ns SDA hold time - * - Buffer timeout = 65535 - * - Address with mask - * - Address = 0 - * - Address mask = 0 (one single address) - * - General call address disabled - * - Address nack disabled if the interrupt driver is used - * - GCLK generator 0 - * - Do not run in standby - * - PINMUX_DEFAULT for SERCOM pads - * - * Those default configuration only available if the device supports it: - * - Not using 10-bit addressing - * - Standard-mode and Fast-mode transfer speed - * - SCL stretch disabled - * - Slave SCL low extend time-out disabled - * - * \param[out] config Pointer to configuration structure to be initialized - */ -static inline void i2c_slave_get_config_defaults( - struct i2c_slave_config *const config) -{ - /*Sanity check argument */ - Assert(config); - config->enable_scl_low_timeout = false; - config->sda_hold_time = I2C_SLAVE_SDA_HOLD_TIME_300NS_600NS; - config->buffer_timeout = 65535; - config->address_mode = I2C_SLAVE_ADDRESS_MODE_MASK; - config->address = 0; - config->address_mask = 0; -#ifdef FEATURE_I2C_10_BIT_ADDRESS - config->ten_bit_address = false; -#endif - config->enable_general_call_address = false; -#ifdef FEATURE_I2C_FAST_MODE_PLUS_AND_HIGH_SPEED - config->transfer_speed = I2C_SLAVE_SPEED_STANDARD_AND_FAST; -#endif -#if I2C_SLAVE_CALLBACK_MODE == true - config->enable_nack_on_address = false; -#endif - config->generator_source = GCLK_GENERATOR_0; - config->run_in_standby = false; - config->pinmux_pad0 = PINMUX_DEFAULT; - config->pinmux_pad1 = PINMUX_DEFAULT; - config->scl_low_timeout = false; -#ifdef FEATURE_I2C_SCL_STRETCH_MODE - config->scl_stretch_only_after_ack_bit = false; -#endif -#ifdef FEATURE_I2C_SCL_EXTEND_TIMEOUT - config->slave_scl_low_extend_timeout = false; -#endif -} - -enum status_code i2c_slave_init(struct i2c_slave_module *const module, - Sercom *const hw, - const struct i2c_slave_config *const config); - -/** - * \brief Enables the I<SUP>2</SUP>C module - * - * This will enable the requested I<SUP>2</SUP>C module. - * - * \param[in] module Pointer to the software module struct - */ -static inline void i2c_slave_enable( - const struct i2c_slave_module *const module) -{ - /* Sanity check of arguments */ - Assert(module); - Assert(module->hw); - - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - -#if I2C_SLAVE_CALLBACK_MODE == true - /* Enable global interrupt for module */ - system_interrupt_enable(_sercom_get_interrupt_vector(module->hw)); -#endif - - /* Wait for module to sync */ - _i2c_slave_wait_for_sync(module); - - /* Enable module */ - i2c_hw->CTRLA.reg |= SERCOM_I2CS_CTRLA_ENABLE; -} - - -/** - * \brief Disables the I<SUP>2</SUP>C module - * - * This will disable the I<SUP>2</SUP>C module specified in the provided software module - * structure. - * - * \param[in] module Pointer to the software module struct - */ -static inline void i2c_slave_disable( - const struct i2c_slave_module *const module) -{ - /* Sanity check of arguments */ - Assert(module); - Assert(module->hw); - - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - -#if I2C_SLAVE_CALLBACK_MODE == true - /* Disable interrupts */ - i2c_hw->INTENCLR.reg = SERCOM_I2CS_INTENSET_PREC | - SERCOM_I2CS_INTENSET_AMATCH | SERCOM_I2CS_INTENSET_DRDY; - - /* Clear interrupt flags */ - i2c_hw->INTFLAG.reg = SERCOM_I2CS_INTFLAG_PREC | SERCOM_I2CS_INTFLAG_AMATCH | - SERCOM_I2CS_INTFLAG_DRDY; - - /* Disable global interrupt for module */ - system_interrupt_disable(_sercom_get_interrupt_vector(module->hw)); -#endif - - /* Wait for module to sync */ - _i2c_slave_wait_for_sync(module); - - /* Disable module */ - i2c_hw->CTRLA.reg &= ~SERCOM_I2CS_CTRLA_ENABLE; -} - -void i2c_slave_reset( - struct i2c_slave_module *const module); - -/** @} */ - -/** - * \name Read and Write - * @{ - */ - -enum status_code i2c_slave_write_packet_wait( - struct i2c_slave_module *const module, - struct i2c_slave_packet *const packet); -enum status_code i2c_slave_read_packet_wait( - struct i2c_slave_module *const module, - struct i2c_slave_packet *const packet); -enum i2c_slave_direction i2c_slave_get_direction_wait( - struct i2c_slave_module *const module); - -/** @} */ - -/** - * \name Status Management - * @{ - */ -uint32_t i2c_slave_get_status( - struct i2c_slave_module *const module); -void i2c_slave_clear_status( - struct i2c_slave_module *const module, - uint32_t status_flags); -/** @} */ - -#ifdef FEATURE_I2C_DMA_SUPPORT -/** - * \name SERCOM I2C slave with DMA Interfaces - * @{ - */ - -/** - * \brief Read SERCOM I<SUP>2</SUP>C interrupt status. - * - * Read I<SUP>2</SUP>C interrupt status for DMA transfer. - * - * \param[in,out] module Pointer to the driver instance to lock - * - */ -static inline uint8_t i2c_slave_dma_read_interrupt_status(struct i2c_slave_module *const module) -{ - return (uint8_t)module->hw->I2CS.INTFLAG.reg; -} - -/** - * \brief Write SERCOM I<SUP>2</SUP>C interrupt status. - * - * Write I<SUP>2</SUP>C interrupt status for DMA transfer. - * - * \param[in,out] module Pointer to the driver instance to lock - * \param[in] flag Interrupt flag status - * - */ -static inline void i2c_slave_dma_write_interrupt_status(struct i2c_slave_module *const module, - uint8_t flag) -{ - module->hw->I2CS.INTFLAG.reg = flag; -} - -/** @} */ -#endif - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* I2C_SLAVE_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_slave_interrupt.h b/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_slave_interrupt.h deleted file mode 100644 index cf1c4362c..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/i2c/i2c_slave_interrupt.h +++ /dev/null @@ -1,215 +0,0 @@ -/** - * \file - * - * \brief SAM SERCOM I2C Slave Interrupt Driver - * - * Copyright (C) 2013-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef I2C_SLAVE_INTERRUPT_H_INCLUDED -#define I2C_SLAVE_INTERRUPT_H_INCLUDED - -#include "i2c_slave.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \addtogroup asfdoc_sam0_sercom_i2c_group - * @{ - * - */ - -/** - * \name Address Match Functionality - * @{ - */ - -void i2c_slave_enable_nack_on_address( - struct i2c_slave_module *const module); -void i2c_slave_disable_nack_on_address( - struct i2c_slave_module *const module); - -/** @} */ - -/** - * \name Callbacks - * @{ - */ -#if !defined(__DOXYGEN__) -void _i2c_slave_interrupt_handler(uint8_t instance); -#endif - -void i2c_slave_register_callback( - struct i2c_slave_module *const module, - i2c_slave_callback_t callback, - enum i2c_slave_callback callback_type); - -void i2c_slave_unregister_callback( - struct i2c_slave_module *const module, - enum i2c_slave_callback callback_type); - -/** - * \brief Enables callback - * - * Enables the callback specified by the callback_type. - * - * \param[in,out] module Pointer to the software module struct - * \param[in] callback_type Callback type to enable - */ -static inline void i2c_slave_enable_callback( - struct i2c_slave_module *const module, - enum i2c_slave_callback callback_type) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - - /* Mark callback as enabled */ - module->enabled_callback |= (1 << callback_type); - - /* Enable address callback */ - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - if (callback_type == I2C_SLAVE_CALLBACK_READ_REQUEST || - callback_type == I2C_SLAVE_CALLBACK_WRITE_REQUEST) { - i2c_hw->INTENSET.reg = SERCOM_I2CS_INTFLAG_AMATCH; - } -} - -/** - * \brief Disables callback - * - * Disables the callback specified by the callback_type. - * - * \param[in,out] module Pointer to the software module struct - * \param[in] callback_type Callback type to disable - */ -static inline void i2c_slave_disable_callback( - struct i2c_slave_module *const module, - enum i2c_slave_callback callback_type) -{ - /* Sanity check */ - Assert(module); - Assert(module->hw); - - /* Mark callback as disabled */ - module->enabled_callback &= ~(1 << callback_type); - SercomI2cs *const i2c_hw = &(module->hw->I2CS); - if (callback_type == I2C_SLAVE_CALLBACK_READ_REQUEST || - callback_type == I2C_SLAVE_CALLBACK_WRITE_REQUEST || - module->status != STATUS_BUSY) { - i2c_hw->INTENCLR.reg = SERCOM_I2CS_INTFLAG_AMATCH; - } -} - -/** @} */ - -/** - * \name Read and Write, Interrupt-Driven - * @{ - */ - - -enum status_code i2c_slave_read_packet_job( - struct i2c_slave_module *const module, - struct i2c_slave_packet *const packet); - -enum status_code i2c_slave_write_packet_job( - struct i2c_slave_module *const module, - struct i2c_slave_packet *const packet); - -/** - * \brief Cancels any currently ongoing operation - * - * Terminates the running transfer operation. - * - * \param[in,out] module Pointer to software module structure - */ -static inline void i2c_slave_cancel_job( - struct i2c_slave_module *const module) -{ - /* Sanity check. */ - Assert(module); - Assert(module->hw); - - /* Set buffer to 0. */ - module->buffer_remaining = 0; - module->buffer_length = 0; -} - -/** - * \brief Gets status of ongoing job - * - * Will return the status of the ongoing job, or the error that occurred - * in the last transfer operation. - * The status will be cleared when starting a new job. - * - * \param[in,out] module Pointer to software module structure - * - * \return Status of job. - * \retval STATUS_OK No error has occurred - * \retval STATUS_BUSY Transfer is in progress - * \retval STATUS_ERR_IO A collision, timeout or bus error happened in - * the last transfer - * \retval STATUS_ERR_TIMEOUT A timeout occurred - * \retval STATUS_ERR_OVERFLOW Data from master overflows receive buffer - */ -static inline enum status_code i2c_slave_get_job_status( - struct i2c_slave_module *const module) -{ - /* Check sanity. */ - Assert(module); - Assert(module->hw); - - /* Return current status code. */ - return module->status; -} - -/** @} */ - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* I2C_SLAVE_INTERRUPT_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/sercom/sercom.c b/atmel-samd/asf/sam0/drivers/sercom/sercom.c deleted file mode 100644 index 637f3947f..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/sercom.c +++ /dev/null @@ -1,296 +0,0 @@ -/** - * \file - * - * \brief SAM Serial Peripheral Interface Driver - * - * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#include "sercom.h" - -#define SHIFT 32 -#define BAUD_INT_MAX 8192 -#define BAUD_FP_MAX 8 - -#if !defined(__DOXYGEN__) -/** - * \internal Configuration structure to save current gclk status. - */ -struct _sercom_conf { - /* Status of gclk generator initialization */ - bool generator_is_set; - /* Sercom gclk generator used */ - enum gclk_generator generator_source; -}; - -static struct _sercom_conf _sercom_config; - - -/** - * \internal Calculate 64 bit division, ref can be found in - * http://en.wikipedia.org/wiki/Division_algorithm#Long_division - */ -static uint64_t long_division(uint64_t n, uint64_t d) -{ - int32_t i; - uint64_t q = 0, r = 0, bit_shift; - for (i = 63; i >= 0; i--) { - bit_shift = (uint64_t)1 << i; - - r = r << 1; - - if (n & bit_shift) { - r |= 0x01; - } - - if (r >= d) { - r = r - d; - q |= bit_shift; - } - } - - return q; -} - -/** - * \internal Calculate synchronous baudrate value (SPI/UART) - */ -enum status_code _sercom_get_sync_baud_val( - const uint32_t baudrate, - const uint32_t external_clock, - uint16_t *const baudvalue) -{ - /* Baud value variable */ - uint16_t baud_calculated = 0; - uint32_t clock_value = external_clock; - - - /* Check if baudrate is outside of valid range */ - if (baudrate > (external_clock / 2)) { - /* Return with error code */ - return STATUS_ERR_BAUDRATE_UNAVAILABLE; - } - - /* Calculate BAUD value from clock frequency and baudrate */ - clock_value = external_clock / 2; - while (clock_value >= baudrate) { - clock_value = clock_value - baudrate; - baud_calculated++; - } - baud_calculated = baud_calculated - 1; - - /* Check if BAUD value is more than 255, which is maximum - * for synchronous mode */ - if (baud_calculated > 0xFF) { - /* Return with an error code */ - return STATUS_ERR_BAUDRATE_UNAVAILABLE; - } else { - *baudvalue = baud_calculated; - return STATUS_OK; - } -} - -/** - * \internal Calculate asynchronous baudrate value (UART) -*/ -enum status_code _sercom_get_async_baud_val( - const uint32_t baudrate, - const uint32_t peripheral_clock, - uint16_t *const baudval, - enum sercom_asynchronous_operation_mode mode, - enum sercom_asynchronous_sample_num sample_num) -{ - /* Temporary variables */ - uint64_t ratio = 0; - uint64_t scale = 0; - uint64_t baud_calculated = 0; - uint8_t baud_fp; - uint32_t baud_int = 0; - uint64_t temp1, temp2; - - /* Check if the baudrate is outside of valid range */ - if ((baudrate * sample_num) > peripheral_clock) { - /* Return with error code */ - return STATUS_ERR_BAUDRATE_UNAVAILABLE; - } - - if(mode == SERCOM_ASYNC_OPERATION_MODE_ARITHMETIC) { - /* Calculate the BAUD value */ - temp1 = ((sample_num * (uint64_t)baudrate) << SHIFT); - ratio = long_division(temp1, peripheral_clock); - scale = ((uint64_t)1 << SHIFT) - ratio; - baud_calculated = (65536 * scale) >> SHIFT; - } else if(mode == SERCOM_ASYNC_OPERATION_MODE_FRACTIONAL) { - for(baud_fp = 0; baud_fp < BAUD_FP_MAX; baud_fp++) { - temp1 = BAUD_FP_MAX * (uint64_t)peripheral_clock; - temp2 = ((uint64_t)baudrate * sample_num); - baud_int = long_division(temp1, temp2); - baud_int -= baud_fp; - baud_int = baud_int / BAUD_FP_MAX; - if(baud_int < BAUD_INT_MAX) { - break; - } - } - if(baud_fp == BAUD_FP_MAX) { - return STATUS_ERR_BAUDRATE_UNAVAILABLE; - } - baud_calculated = baud_int | (baud_fp << 13); - } - - *baudval = baud_calculated; - return STATUS_OK; -} -#endif - -/** - * \brief Set GCLK channel to generator. - * - * This will set the appropriate GCLK channel to the requested GCLK generator. - * This will set the generator for all SERCOM instances, and the user will thus - * only be able to set the same generator that has previously been set, if any. - * - * After the generator has been set the first time, the generator can be changed - * using the \c force_change flag. - * - * \param[in] generator_source The generator to use for SERCOM. - * \param[in] force_change Force change the generator. - * - * \return Status code indicating the GCLK generator change operation. - * \retval STATUS_OK If the generator update request was - * successful. - * \retval STATUS_ERR_ALREADY_INITIALIZED If a generator was already configured - * and the new configuration was not - * forced. - */ -enum status_code sercom_set_gclk_generator( - const enum gclk_generator generator_source, - const bool force_change) -{ - /* Check if valid option */ - if (!_sercom_config.generator_is_set || force_change) { - /* Create and fill a GCLK configuration structure for the new config */ - struct system_gclk_chan_config gclk_chan_conf; - system_gclk_chan_get_config_defaults(&gclk_chan_conf); - gclk_chan_conf.source_generator = generator_source; - system_gclk_chan_set_config(SERCOM_GCLK_ID, &gclk_chan_conf); - system_gclk_chan_enable(SERCOM_GCLK_ID); - - /* Save config */ - _sercom_config.generator_source = generator_source; - _sercom_config.generator_is_set = true; - - return STATUS_OK; - } else if (generator_source == _sercom_config.generator_source) { - /* Return status OK if same config */ - return STATUS_OK; - } - - /* Return invalid config to already initialized GCLK */ - return STATUS_ERR_ALREADY_INITIALIZED; -} - -/** \internal - * Creates a switch statement case entry to convert a SERCOM instance and pad - * index to the default SERCOM pad MUX setting. - */ -#define _SERCOM_PAD_DEFAULTS_CASE(n, pad) \ - case (uintptr_t)SERCOM##n: \ - switch (pad) { \ - case 0: \ - return SERCOM##n##_PAD0_DEFAULT; \ - case 1: \ - return SERCOM##n##_PAD1_DEFAULT; \ - case 2: \ - return SERCOM##n##_PAD2_DEFAULT; \ - case 3: \ - return SERCOM##n##_PAD3_DEFAULT; \ - } \ - break; - -/** - * \internal Gets the default PAD pinout for a given SERCOM. - * - * Returns the pinmux settings for the given SERCOM and pad. This is used - * for default configuration of pins. - * - * \param[in] sercom_module Pointer to the SERCOM module - * \param[in] pad PAD to get default pinout for - * - * \returns The default pinmux for the given SERCOM instance and PAD - * - */ -uint32_t _sercom_get_default_pad( - Sercom *const sercom_module, - const uint8_t pad) -{ - switch ((uintptr_t)sercom_module) { - /* Auto-generate a lookup table for the default SERCOM pad defaults */ - MREPEAT(SERCOM_INST_NUM, _SERCOM_PAD_DEFAULTS_CASE, pad) - } - - Assert(false); - return 0; -} - -/** - * \internal - * Find index of given instance. - * - * \param[in] sercom_instance Instance pointer. - * - * \return Index of given instance. - */ -uint8_t _sercom_get_sercom_inst_index( - Sercom *const sercom_instance) -{ - /* Save all available SERCOM instances for compare */ - Sercom *sercom_instances[SERCOM_INST_NUM] = SERCOM_INSTS; - - /* Find index for sercom instance */ - for (uint32_t i = 0; i < SERCOM_INST_NUM; i++) { - if ((uintptr_t)sercom_instance == (uintptr_t)sercom_instances[i]) { - return i; - } - } - - /* Invalid data given */ - Assert(false); - return 0; -} diff --git a/atmel-samd/asf/sam0/drivers/sercom/sercom.h b/atmel-samd/asf/sam0/drivers/sercom/sercom.h deleted file mode 100644 index 60ce6f8ad..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/sercom.h +++ /dev/null @@ -1,118 +0,0 @@ -/** - * \file - * - * \brief SAM Serial Peripheral Interface Driver - * - * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef SERCOM_H_INCLUDED -#define SERCOM_H_INCLUDED - -#include <compiler.h> -#include <system.h> -#include <clock.h> -#include <system_interrupt.h> -#include "sercom_pinout.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* SERCOM modules should share same slow GCLK channel ID */ -#define SERCOM_GCLK_ID SERCOM0_GCLK_ID_SLOW - -#if (0x1ff >= REV_SERCOM) -# define FEATURE_SERCOM_SYNCBUSY_SCHEME_VERSION_1 -#elif (0x400 >= REV_SERCOM) -# define FEATURE_SERCOM_SYNCBUSY_SCHEME_VERSION_2 -#else -# error "Unknown SYNCBUSY scheme for this SERCOM revision" -#endif - -/** - * \brief sercom asynchronous operation mode - * - * Select sercom asynchronous operation mode - */ -enum sercom_asynchronous_operation_mode { - SERCOM_ASYNC_OPERATION_MODE_ARITHMETIC = 0, - SERCOM_ASYNC_OPERATION_MODE_FRACTIONAL, -}; - -/** - * \brief sercom asynchronous samples per bit - * - * Select number of samples per bit - */ -enum sercom_asynchronous_sample_num { - SERCOM_ASYNC_SAMPLE_NUM_3 = 3, - SERCOM_ASYNC_SAMPLE_NUM_8 = 8, - SERCOM_ASYNC_SAMPLE_NUM_16 = 16, -}; - -enum status_code sercom_set_gclk_generator( - const enum gclk_generator generator_source, - const bool force_change); - -enum status_code _sercom_get_sync_baud_val( - const uint32_t baudrate, - const uint32_t external_clock, - uint16_t *const baudval); - -enum status_code _sercom_get_async_baud_val( - const uint32_t baudrate, - const uint32_t peripheral_clock, - uint16_t *const baudval, - enum sercom_asynchronous_operation_mode mode, - enum sercom_asynchronous_sample_num sample_num); - -uint32_t _sercom_get_default_pad( - Sercom *const sercom_module, - const uint8_t pad); - -uint8_t _sercom_get_sercom_inst_index( - Sercom *const sercom_instance); -#ifdef __cplusplus -} -#endif - -#endif //__SERCOM_H_INCLUDED diff --git a/atmel-samd/asf/sam0/drivers/sercom/sercom_interrupt.c b/atmel-samd/asf/sam0/drivers/sercom/sercom_interrupt.c deleted file mode 100644 index b26d05b6e..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/sercom_interrupt.c +++ /dev/null @@ -1,141 +0,0 @@ -/** - * \file - * - * \brief SAM Serial Peripheral Interface Driver - * - * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#include "sercom_interrupt.h" - -void *_sercom_instances[SERCOM_INST_NUM]; - -/** Save status of initialized handlers */ -static bool _handler_table_initialized = false; - -/** Void pointers for saving device instance structures */ -static void (*_sercom_interrupt_handlers[SERCOM_INST_NUM])(const uint8_t instance); - -/** - * \internal - * Default interrupt handler. - * - * \param[in] instance SERCOM instance used. - */ -static void _sercom_default_handler( - const uint8_t instance) -{ - Assert(false); -} - -/** - * \internal - * Saves the given callback handler. - * - * \param[in] instance Instance index. - * \param[in] interrupt_handler Pointer to instance callback handler. - */ -void _sercom_set_handler( - const uint8_t instance, - const sercom_handler_t interrupt_handler) -{ - /* Initialize handlers with default handler and device instances with 0 */ - if (_handler_table_initialized == false) { - for (uint32_t i = 0; i < SERCOM_INST_NUM; i++) { - _sercom_interrupt_handlers[i] = &_sercom_default_handler; - _sercom_instances[i] = NULL; - } - - _handler_table_initialized = true; - } - - /* Save interrupt handler */ - _sercom_interrupt_handlers[instance] = interrupt_handler; -} - - -/** \internal - * Converts a given SERCOM index to its interrupt vector index. - */ -#define _SERCOM_INTERRUPT_VECT_NUM(n, unused) \ - SYSTEM_INTERRUPT_MODULE_SERCOM##n, - -/** \internal - * Generates a SERCOM interrupt handler function for a given SERCOM index. - */ -#define _SERCOM_INTERRUPT_HANDLER(n, unused) \ - void SERCOM##n##_Handler(void) \ - { \ - _sercom_interrupt_handlers[n](n); \ - } - -/** - * \internal - * Returns the system interrupt vector. - * - * \param[in] sercom_instance Instance pointer - * - * \return Enum of system interrupt vector - * \retval SYSTEM_INTERRUPT_MODULE_SERCOM0 - * \retval SYSTEM_INTERRUPT_MODULE_SERCOM1 - * \retval SYSTEM_INTERRUPT_MODULE_SERCOM2 - * \retval SYSTEM_INTERRUPT_MODULE_SERCOM3 - * \retval SYSTEM_INTERRUPT_MODULE_SERCOM4 - * \retval SYSTEM_INTERRUPT_MODULE_SERCOM5 - * \retval SYSTEM_INTERRUPT_MODULE_SERCOM6 - * \retval SYSTEM_INTERRUPT_MODULE_SERCOM7 - */ -enum system_interrupt_vector _sercom_get_interrupt_vector( - Sercom *const sercom_instance) -{ - const uint8_t sercom_int_vectors[SERCOM_INST_NUM] = - { - MREPEAT(SERCOM_INST_NUM, _SERCOM_INTERRUPT_VECT_NUM, ~) - }; - - /* Retrieve the index of the SERCOM being requested */ - uint8_t instance_index = _sercom_get_sercom_inst_index(sercom_instance); - - /* Get the vector number from the lookup table for the requested SERCOM */ - return (enum system_interrupt_vector)sercom_int_vectors[instance_index]; -} - -/** Auto-generate a set of interrupt handlers for each SERCOM in the device */ -MREPEAT(SERCOM_INST_NUM, _SERCOM_INTERRUPT_HANDLER, ~) diff --git a/atmel-samd/asf/sam0/drivers/sercom/sercom_interrupt.h b/atmel-samd/asf/sam0/drivers/sercom/sercom_interrupt.h deleted file mode 100644 index 18945f518..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/sercom_interrupt.h +++ /dev/null @@ -1,72 +0,0 @@ -/** - * \file - * - * \brief SAM Serial Peripheral Interface Driver - * - * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef SERCOM_INTERRUPT_H_INCLUDED -#define SERCOM_INTERRUPT_H_INCLUDED - -#include "sercom.h" -#include <system_interrupt.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/* Look-up table for device instances */ -extern void *_sercom_instances[SERCOM_INST_NUM]; - -typedef void (*sercom_handler_t)(uint8_t instance); - -enum system_interrupt_vector _sercom_get_interrupt_vector( - Sercom *const sercom_instance); - -void _sercom_set_handler( - const uint8_t instance, - const sercom_handler_t interrupt_handler); - -#ifdef __cplusplus -} -#endif - -#endif /* SERCOM_INTERRUPT_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/sercom/sercom_pinout.h b/atmel-samd/asf/sam0/drivers/sercom/sercom_pinout.h deleted file mode 100644 index 94ebc9cc0..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/sercom_pinout.h +++ /dev/null @@ -1,526 +0,0 @@ -/** - * \file - * - * \brief SAM SERCOM Module Pinout Definitions - * - * Copyright (C) 2012-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef SERCOM_PINOUT_H_INCLUDED -#define SERCOM_PINOUT_H_INCLUDED - -#include <compiler.h> - -#if SAMR21E - /* SERCOM0 */ - #define SERCOM0_PAD0_DEFAULT PINMUX_PA08C_SERCOM0_PAD0 - #define SERCOM0_PAD1_DEFAULT PINMUX_PA09C_SERCOM0_PAD1 - #define SERCOM0_PAD2_DEFAULT PINMUX_PA06D_SERCOM0_PAD2 - #define SERCOM0_PAD3_DEFAULT PINMUX_PA07D_SERCOM0_PAD3 - - /* SERCOM1 */ - #define SERCOM1_PAD0_DEFAULT PINMUX_PA16C_SERCOM1_PAD0 - #define SERCOM1_PAD1_DEFAULT PINMUX_PA17C_SERCOM1_PAD1 - #define SERCOM1_PAD2_DEFAULT PINMUX_PA18C_SERCOM1_PAD2 - #define SERCOM1_PAD3_DEFAULT PINMUX_PA19C_SERCOM1_PAD3 - - /* SERCOM2 */ - #define SERCOM2_PAD0_DEFAULT PINMUX_PA08D_SERCOM2_PAD0 - #define SERCOM2_PAD1_DEFAULT PINMUX_PA09D_SERCOM2_PAD1 - #define SERCOM2_PAD2_DEFAULT PINMUX_PA14C_SERCOM2_PAD2 - #define SERCOM2_PAD3_DEFAULT PINMUX_PA15C_SERCOM2_PAD3 - - /* SERCOM3 */ -# if SAM_PART_IS_DEFINED(SAMR21E19A) - #define SERCOM3_PAD0_DEFAULT PINMUX_PA16D_SERCOM3_PAD0 - #define SERCOM3_PAD1_DEFAULT PINMUX_PA17D_SERCOM3_PAD1 -# else - #define SERCOM3_PAD0_DEFAULT PINMUX_PA27F_SERCOM3_PAD0 - #define SERCOM3_PAD1_DEFAULT PINMUX_PA28F_SERCOM3_PAD1 -#endif - #define SERCOM3_PAD2_DEFAULT PINMUX_PA24C_SERCOM3_PAD2 - #define SERCOM3_PAD3_DEFAULT PINMUX_PA25C_SERCOM3_PAD3 - - /* SERCOM4 */ -# if SAM_PART_IS_DEFINED(SAMR21E19A) - #define SERCOM4_PAD0_DEFAULT PINMUX_PB08D_SERCOM4_PAD0 - #define SERCOM4_PAD1_DEFAULT PINMUX_PB09D_SERCOM4_PAD1 - #define SERCOM4_PAD2_DEFAULT PINMUX_PA14D_SERCOM4_PAD2 - #define SERCOM4_PAD3_DEFAULT PINMUX_PA15D_SERCOM4_PAD3 -# else - #define SERCOM4_PAD0_DEFAULT PINMUX_PC19F_SERCOM4_PAD0 - #define SERCOM4_PAD1_DEFAULT PINMUX_PB31F_SERCOM4_PAD1 - #define SERCOM4_PAD2_DEFAULT PINMUX_PB30F_SERCOM4_PAD2 - #define SERCOM4_PAD3_DEFAULT PINMUX_PC18F_SERCOM4_PAD3 -# endif - - /* SERCOM5 */ - #define SERCOM5_PAD0_DEFAULT PINMUX_PB30D_SERCOM5_PAD0 - #define SERCOM5_PAD1_DEFAULT PINMUX_PB31D_SERCOM5_PAD1 - #define SERCOM5_PAD2_DEFAULT PINMUX_PA24D_SERCOM5_PAD2 - #define SERCOM5_PAD3_DEFAULT PINMUX_PA25D_SERCOM5_PAD3 - -#elif SAMR21G - /* SERCOM0 */ - #define SERCOM0_PAD0_DEFAULT PINMUX_PA04D_SERCOM0_PAD0 - #define SERCOM0_PAD1_DEFAULT PINMUX_PA05D_SERCOM0_PAD1 - #define SERCOM0_PAD2_DEFAULT PINMUX_PA06D_SERCOM0_PAD2 - #define SERCOM0_PAD3_DEFAULT PINMUX_PA07D_SERCOM0_PAD3 - - /* SERCOM1 */ - #define SERCOM1_PAD0_DEFAULT PINMUX_PA00D_SERCOM1_PAD0 - #define SERCOM1_PAD1_DEFAULT PINMUX_PA01D_SERCOM1_PAD1 - #define SERCOM1_PAD2_DEFAULT PINMUX_PA30D_SERCOM1_PAD2 - #define SERCOM1_PAD3_DEFAULT PINMUX_PA31D_SERCOM1_PAD3 - - /* SERCOM2 */ - #define SERCOM2_PAD0_DEFAULT PINMUX_PA12C_SERCOM2_PAD0 - #define SERCOM2_PAD1_DEFAULT PINMUX_PA13C_SERCOM2_PAD1 - #define SERCOM2_PAD2_DEFAULT PINMUX_PA14C_SERCOM2_PAD2 - #define SERCOM2_PAD3_DEFAULT PINMUX_PA15C_SERCOM2_PAD3 - - /* SERCOM3 */ - #define SERCOM3_PAD0_DEFAULT PINMUX_PA16D_SERCOM3_PAD0 - #define SERCOM3_PAD1_DEFAULT PINMUX_PA17D_SERCOM3_PAD1 - #define SERCOM3_PAD2_DEFAULT PINMUX_PA18D_SERCOM3_PAD2 - #define SERCOM3_PAD3_DEFAULT PINMUX_PA19D_SERCOM3_PAD3 - - /* SERCOM4 */ - #define SERCOM4_PAD0_DEFAULT PINMUX_PC19F_SERCOM4_PAD0 - #define SERCOM4_PAD1_DEFAULT PINMUX_PB31F_SERCOM4_PAD1 - #define SERCOM4_PAD2_DEFAULT PINMUX_PB30F_SERCOM4_PAD2 - #define SERCOM4_PAD3_DEFAULT PINMUX_PC18F_SERCOM4_PAD3 - - /* SERCOM5 */ - #define SERCOM5_PAD0_DEFAULT PINMUX_PA22D_SERCOM5_PAD0 - #define SERCOM5_PAD1_DEFAULT PINMUX_PA23D_SERCOM5_PAD1 - #define SERCOM5_PAD2_DEFAULT PINMUX_PA24D_SERCOM5_PAD2 - #define SERCOM5_PAD3_DEFAULT PINMUX_PA25D_SERCOM5_PAD3 - -#elif (SAMD09) - /* SERCOM0 */ - #define SERCOM0_PAD0_DEFAULT PINMUX_PA04D_SERCOM0_PAD0 - #define SERCOM0_PAD1_DEFAULT PINMUX_PA05D_SERCOM0_PAD1 - #define SERCOM0_PAD2_DEFAULT PINMUX_PA08D_SERCOM0_PAD2 - #define SERCOM0_PAD3_DEFAULT PINMUX_PA09D_SERCOM0_PAD3 - - /* SERCOM1 */ - #define SERCOM1_PAD0_DEFAULT PINMUX_PA30C_SERCOM1_PAD0 - #define SERCOM1_PAD1_DEFAULT PINMUX_PA31C_SERCOM1_PAD1 - #define SERCOM1_PAD2_DEFAULT PINMUX_PA24C_SERCOM1_PAD2 - #define SERCOM1_PAD3_DEFAULT PINMUX_PA25C_SERCOM1_PAD3 - -#elif (SAMD10DS) || (SAMD10DM) || (SAMD10DU) || (SAMD11DS) || (SAMD11DM) || (SAMD11DU) - /* SERCOM0 */ - #define SERCOM0_PAD0_DEFAULT PINMUX_PA04D_SERCOM0_PAD0 - #define SERCOM0_PAD1_DEFAULT PINMUX_PA05D_SERCOM0_PAD1 - #define SERCOM0_PAD2_DEFAULT PINMUX_PA06D_SERCOM0_PAD2 - #define SERCOM0_PAD3_DEFAULT PINMUX_PA07D_SERCOM0_PAD3 - - /* SERCOM1 */ - #define SERCOM1_PAD0_DEFAULT PINMUX_PA22C_SERCOM1_PAD0 - #define SERCOM1_PAD1_DEFAULT PINMUX_PA23C_SERCOM1_PAD1 - #define SERCOM1_PAD2_DEFAULT PINMUX_PA30D_SERCOM1_PAD2 - #define SERCOM1_PAD3_DEFAULT PINMUX_PA31D_SERCOM1_PAD3 - - /* SERCOM2 */ - #define SERCOM2_PAD0_DEFAULT PINMUX_PA22D_SERCOM2_PAD0 - #define SERCOM2_PAD1_DEFAULT PINMUX_PA23D_SERCOM2_PAD1 - #define SERCOM2_PAD2_DEFAULT PINMUX_PA16D_SERCOM2_PAD2 - #define SERCOM2_PAD3_DEFAULT PINMUX_PA25D_SERCOM2_PAD3 - -#elif (SAMD10C) || (SAMD11C) - /* SERCOM0 */ - #define SERCOM0_PAD0_DEFAULT PINMUX_PA04D_SERCOM0_PAD0 - #define SERCOM0_PAD1_DEFAULT PINMUX_PA05D_SERCOM0_PAD1 - #define SERCOM0_PAD2_DEFAULT PINMUX_PA08D_SERCOM0_PAD2 - #define SERCOM0_PAD3_DEFAULT PINMUX_PA09D_SERCOM0_PAD3 - - /* SERCOM1 */ - #define SERCOM1_PAD0_DEFAULT PINMUX_PA30C_SERCOM1_PAD0 - #define SERCOM1_PAD1_DEFAULT PINMUX_PA31C_SERCOM1_PAD1 - #define SERCOM1_PAD2_DEFAULT PINMUX_PA24C_SERCOM1_PAD2 - #define SERCOM1_PAD3_DEFAULT PINMUX_PA25C_SERCOM1_PAD3 - -#elif SAM_PART_IS_DEFINED(SAMD21E15L) || SAM_PART_IS_DEFINED(SAMD21E16L) - - /* SERCOM0 */ - #define SERCOM0_PAD0_DEFAULT PINMUX_PA04D_SERCOM0_PAD0 - #define SERCOM0_PAD1_DEFAULT PINMUX_PA05D_SERCOM0_PAD1 - #define SERCOM0_PAD2_DEFAULT PINMUX_PA06D_SERCOM0_PAD2 - #define SERCOM0_PAD3_DEFAULT PINMUX_PA07D_SERCOM0_PAD3 - - /* SERCOM1 */ - #define SERCOM1_PAD0_DEFAULT PINMUX_PA16C_SERCOM1_PAD0 - #define SERCOM1_PAD1_DEFAULT PINMUX_PA17C_SERCOM1_PAD1 - #define SERCOM1_PAD2_DEFAULT PINMUX_PA18C_SERCOM1_PAD2 - #define SERCOM1_PAD3_DEFAULT PINMUX_PA19C_SERCOM1_PAD3 - - /* SERCOM2 */ - #define SERCOM2_PAD0_DEFAULT PINMUX_PA08D_SERCOM2_PAD0 - #define SERCOM2_PAD1_DEFAULT PINMUX_PA09D_SERCOM2_PAD1 - #define SERCOM2_PAD2_DEFAULT PINMUX_PA10D_SERCOM2_PAD2 - #define SERCOM2_PAD3_DEFAULT PINMUX_PA11D_SERCOM2_PAD3 - - /* SERCOM3 */ - #define SERCOM3_PAD0_DEFAULT PINMUX_PA22C_SERCOM3_PAD0 - #define SERCOM3_PAD1_DEFAULT PINMUX_PA23C_SERCOM3_PAD1 - #define SERCOM3_PAD2_DEFAULT PINMUX_PA24C_SERCOM3_PAD2 - #define SERCOM3_PAD3_DEFAULT PINMUX_PA25C_SERCOM3_PAD3 - -#elif (SAML22N) - /* SERCOM0 */ - #define SERCOM0_PAD0_DEFAULT PINMUX_PA08C_SERCOM0_PAD0 - #define SERCOM0_PAD1_DEFAULT PINMUX_PA09C_SERCOM0_PAD1 - #define SERCOM0_PAD2_DEFAULT PINMUX_PA10C_SERCOM0_PAD2 - #define SERCOM0_PAD3_DEFAULT PINMUX_PA11C_SERCOM0_PAD3 - - /* SERCOM1 */ - #define SERCOM1_PAD0_DEFAULT PINMUX_PA16C_SERCOM1_PAD0 - #define SERCOM1_PAD1_DEFAULT PINMUX_PA17C_SERCOM1_PAD1 - #define SERCOM1_PAD2_DEFAULT PINMUX_PA18C_SERCOM1_PAD2 - #define SERCOM1_PAD3_DEFAULT PINMUX_PA19C_SERCOM1_PAD3 - - /* SERCOM2 */ - #define SERCOM2_PAD0_DEFAULT PINMUX_PA22D_SERCOM2_PAD0 - #define SERCOM2_PAD1_DEFAULT PINMUX_PA23D_SERCOM2_PAD1 - #define SERCOM2_PAD2_DEFAULT PINMUX_PA20D_SERCOM2_PAD2 - #define SERCOM2_PAD3_DEFAULT PINMUX_PA21D_SERCOM2_PAD3 - - /* SERCOM3 */ - #define SERCOM3_PAD0_DEFAULT PINMUX_PB02C_SERCOM3_PAD0 - #define SERCOM3_PAD1_DEFAULT PINMUX_PB21C_SERCOM3_PAD1 - #define SERCOM3_PAD2_DEFAULT PINMUX_PB00C_SERCOM3_PAD2 - #define SERCOM3_PAD3_DEFAULT PINMUX_PB01C_SERCOM3_PAD3 - - /* SERCOM4 */ - #define SERCOM4_PAD0_DEFAULT PINMUX_PA12C_SERCOM4_PAD0 - #define SERCOM4_PAD1_DEFAULT PINMUX_PA13C_SERCOM4_PAD1 - #define SERCOM4_PAD2_DEFAULT PINMUX_PA14C_SERCOM4_PAD2 - #define SERCOM4_PAD3_DEFAULT PINMUX_PA15C_SERCOM4_PAD3 - - /* SERCOM5 */ - #define SERCOM5_PAD0_DEFAULT PINMUX_PB30D_SERCOM5_PAD0 - #define SERCOM5_PAD1_DEFAULT PINMUX_PB31D_SERCOM5_PAD1 - #define SERCOM5_PAD2_DEFAULT PINMUX_PB22D_SERCOM5_PAD2 - #define SERCOM5_PAD3_DEFAULT PINMUX_PB23D_SERCOM5_PAD3 -#elif (SAML22J) - /* SERCOM0 */ - #define SERCOM0_PAD0_DEFAULT PINMUX_PA08C_SERCOM0_PAD0 - #define SERCOM0_PAD1_DEFAULT PINMUX_PA09C_SERCOM0_PAD1 - #define SERCOM0_PAD2_DEFAULT PINMUX_PA10C_SERCOM0_PAD2 - #define SERCOM0_PAD3_DEFAULT PINMUX_PA11C_SERCOM0_PAD3 - - /* SERCOM1 */ - #define SERCOM1_PAD0_DEFAULT PINMUX_PA16C_SERCOM1_PAD0 - #define SERCOM1_PAD1_DEFAULT PINMUX_PA17C_SERCOM1_PAD1 - #define SERCOM1_PAD2_DEFAULT PINMUX_PA18C_SERCOM1_PAD2 - #define SERCOM1_PAD3_DEFAULT PINMUX_PA19C_SERCOM1_PAD3 - - /* SERCOM2 */ - #define SERCOM2_PAD0_DEFAULT PINMUX_PA22D_SERCOM2_PAD0 - #define SERCOM2_PAD1_DEFAULT PINMUX_PA23D_SERCOM2_PAD1 - #define SERCOM2_PAD2_DEFAULT PINMUX_PA20D_SERCOM2_PAD2 - #define SERCOM2_PAD3_DEFAULT PINMUX_PA21D_SERCOM2_PAD3 - - /* SERCOM3 */ - #define SERCOM3_PAD0_DEFAULT PINMUX_PB02C_SERCOM3_PAD0 - #define SERCOM3_PAD1_DEFAULT PINMUX_PB13C_SERCOM3_PAD1 - #define SERCOM3_PAD2_DEFAULT PINMUX_PB00C_SERCOM3_PAD2 - #define SERCOM3_PAD3_DEFAULT PINMUX_PB01C_SERCOM3_PAD3 -#elif (SAML22G) - /* SERCOM0 */ - #define SERCOM0_PAD0_DEFAULT PINMUX_PA08C_SERCOM0_PAD0 - #define SERCOM0_PAD1_DEFAULT PINMUX_PA09C_SERCOM0_PAD1 - #define SERCOM0_PAD2_DEFAULT PINMUX_PA10C_SERCOM0_PAD2 - #define SERCOM0_PAD3_DEFAULT PINMUX_PA11C_SERCOM0_PAD3 - - /* SERCOM1 */ - #define SERCOM1_PAD0_DEFAULT PINMUX_PA16C_SERCOM1_PAD0 - #define SERCOM1_PAD1_DEFAULT PINMUX_PA17C_SERCOM1_PAD1 - #define SERCOM1_PAD2_DEFAULT PINMUX_PA18C_SERCOM1_PAD2 - #define SERCOM1_PAD3_DEFAULT PINMUX_PA19C_SERCOM1_PAD3 - - /* SERCOM2 */ - #define SERCOM2_PAD0_DEFAULT PINMUX_PA22D_SERCOM2_PAD0 - #define SERCOM2_PAD1_DEFAULT PINMUX_PA23D_SERCOM2_PAD1 - #define SERCOM2_PAD2_DEFAULT PINMUX_PA20D_SERCOM2_PAD2 - #define SERCOM2_PAD3_DEFAULT PINMUX_PA21D_SERCOM2_PAD3 -#elif (SAMC20E) || (SAMC21E) - /* SERCOM0 */ - #define SERCOM0_PAD0_DEFAULT PINMUX_PA04D_SERCOM0_PAD0 - #define SERCOM0_PAD1_DEFAULT PINMUX_PA05D_SERCOM0_PAD1 - #define SERCOM0_PAD2_DEFAULT PINMUX_PA06D_SERCOM0_PAD2 - #define SERCOM0_PAD3_DEFAULT PINMUX_PA07D_SERCOM0_PAD3 - - /* SERCOM1 */ - #define SERCOM1_PAD0_DEFAULT PINMUX_PA16C_SERCOM1_PAD0 - #define SERCOM1_PAD1_DEFAULT PINMUX_PA17C_SERCOM1_PAD1 - #define SERCOM1_PAD2_DEFAULT PINMUX_PA18C_SERCOM1_PAD2 - #define SERCOM1_PAD3_DEFAULT PINMUX_PA19C_SERCOM1_PAD3 - - /* SERCOM2 */ - #define SERCOM2_PAD0_DEFAULT PINMUX_PA08D_SERCOM2_PAD0 - #define SERCOM2_PAD1_DEFAULT PINMUX_PA09D_SERCOM2_PAD1 - #define SERCOM2_PAD2_DEFAULT PINMUX_PA10D_SERCOM2_PAD2 - #define SERCOM2_PAD3_DEFAULT PINMUX_PA11D_SERCOM2_PAD3 - - /* SERCOM3 */ - #define SERCOM3_PAD0_DEFAULT PINMUX_PA22C_SERCOM3_PAD0 - #define SERCOM3_PAD1_DEFAULT PINMUX_PA23C_SERCOM3_PAD1 - #define SERCOM3_PAD2_DEFAULT PINMUX_PA24C_SERCOM3_PAD2 - #define SERCOM3_PAD3_DEFAULT PINMUX_PA25C_SERCOM3_PAD3 - -#elif (SAMC20G) || (SAMC21G) - /* SERCOM0 */ - #define SERCOM0_PAD0_DEFAULT PINMUX_PA04D_SERCOM0_PAD0 - #define SERCOM0_PAD1_DEFAULT PINMUX_PA05D_SERCOM0_PAD1 - #define SERCOM0_PAD2_DEFAULT PINMUX_PA06D_SERCOM0_PAD2 - #define SERCOM0_PAD3_DEFAULT PINMUX_PA07D_SERCOM0_PAD3 - - /* SERCOM1 */ - #define SERCOM1_PAD0_DEFAULT PINMUX_PA16C_SERCOM1_PAD0 - #define SERCOM1_PAD1_DEFAULT PINMUX_PA17C_SERCOM1_PAD1 - #define SERCOM1_PAD2_DEFAULT PINMUX_PA18C_SERCOM1_PAD2 - #define SERCOM1_PAD3_DEFAULT PINMUX_PA19C_SERCOM1_PAD3 - - /* SERCOM2 */ - #define SERCOM2_PAD0_DEFAULT PINMUX_PA12C_SERCOM2_PAD0 - #define SERCOM2_PAD1_DEFAULT PINMUX_PA13C_SERCOM2_PAD1 - #define SERCOM2_PAD2_DEFAULT PINMUX_PA14C_SERCOM2_PAD2 - #define SERCOM2_PAD3_DEFAULT PINMUX_PA15C_SERCOM2_PAD3 - - /* SERCOM3 */ - #define SERCOM3_PAD0_DEFAULT PINMUX_PA22C_SERCOM3_PAD0 - #define SERCOM3_PAD1_DEFAULT PINMUX_PA23C_SERCOM3_PAD1 - #define SERCOM3_PAD2_DEFAULT PINMUX_PA24C_SERCOM3_PAD2 - #define SERCOM3_PAD3_DEFAULT PINMUX_PA25C_SERCOM3_PAD3 - - #ifdef ID_SERCOM4 - /* SERCOM4 */ - #define SERCOM4_PAD0_DEFAULT PINMUX_PB08D_SERCOM4_PAD0 - #define SERCOM4_PAD1_DEFAULT PINMUX_PB09D_SERCOM4_PAD1 - #define SERCOM4_PAD2_DEFAULT PINMUX_PB10D_SERCOM4_PAD2 - #define SERCOM4_PAD3_DEFAULT PINMUX_PB11D_SERCOM4_PAD3 - #endif - - #ifdef ID_SERCOM5 - /* SERCOM5 */ - #define SERCOM5_PAD0_DEFAULT PINMUX_PB02D_SERCOM5_PAD0 - #define SERCOM5_PAD1_DEFAULT PINMUX_PB03D_SERCOM5_PAD1 - #define SERCOM5_PAD2_DEFAULT PINMUX_PB22D_SERCOM5_PAD2 - #define SERCOM5_PAD3_DEFAULT PINMUX_PB23D_SERCOM5_PAD3 - #endif - -#elif (SAMC20J) || (SAMC21J) - /* SERCOM0 */ - #define SERCOM0_PAD0_DEFAULT PINMUX_PA04D_SERCOM0_PAD0 - #define SERCOM0_PAD1_DEFAULT PINMUX_PA05D_SERCOM0_PAD1 - #define SERCOM0_PAD2_DEFAULT PINMUX_PA06D_SERCOM0_PAD2 - #define SERCOM0_PAD3_DEFAULT PINMUX_PA07D_SERCOM0_PAD3 - - /* SERCOM1 */ - #define SERCOM1_PAD0_DEFAULT PINMUX_PA16C_SERCOM1_PAD0 - #define SERCOM1_PAD1_DEFAULT PINMUX_PA17C_SERCOM1_PAD1 - #define SERCOM1_PAD2_DEFAULT PINMUX_PA18C_SERCOM1_PAD2 - #define SERCOM1_PAD3_DEFAULT PINMUX_PA19C_SERCOM1_PAD3 - - /* SERCOM2 */ - #define SERCOM2_PAD0_DEFAULT PINMUX_PA12C_SERCOM2_PAD0 - #define SERCOM2_PAD1_DEFAULT PINMUX_PA13C_SERCOM2_PAD1 - #define SERCOM2_PAD2_DEFAULT PINMUX_PA14C_SERCOM2_PAD2 - #define SERCOM2_PAD3_DEFAULT PINMUX_PA15C_SERCOM2_PAD3 - - /* SERCOM3 */ - #define SERCOM3_PAD0_DEFAULT PINMUX_PA22C_SERCOM3_PAD0 - #define SERCOM3_PAD1_DEFAULT PINMUX_PA23C_SERCOM3_PAD1 - #define SERCOM3_PAD2_DEFAULT PINMUX_PA24C_SERCOM3_PAD2 - #define SERCOM3_PAD3_DEFAULT PINMUX_PA25C_SERCOM3_PAD3 - - #ifdef ID_SERCOM4 - /* SERCOM4 */ - #define SERCOM4_PAD0_DEFAULT PINMUX_PB08D_SERCOM4_PAD0 - #define SERCOM4_PAD1_DEFAULT PINMUX_PB09D_SERCOM4_PAD1 - #define SERCOM4_PAD2_DEFAULT PINMUX_PB10D_SERCOM4_PAD2 - #define SERCOM4_PAD3_DEFAULT PINMUX_PB11D_SERCOM4_PAD3 - #endif - - #ifdef ID_SERCOM5 - /* SERCOM5 */ - #define SERCOM5_PAD0_DEFAULT PINMUX_PB02D_SERCOM5_PAD0 - #define SERCOM5_PAD1_DEFAULT PINMUX_PB03D_SERCOM5_PAD1 - #define SERCOM5_PAD2_DEFAULT PINMUX_PB00D_SERCOM5_PAD2 - #define SERCOM5_PAD3_DEFAULT PINMUX_PB01D_SERCOM5_PAD3 - #endif - -#elif (SAMDA1) - /* SERCOM0 */ - #define SERCOM0_PAD0_DEFAULT PINMUX_PA04D_SERCOM0_PAD0 - #define SERCOM0_PAD1_DEFAULT PINMUX_PA05D_SERCOM0_PAD1 - #define SERCOM0_PAD2_DEFAULT PINMUX_PA06D_SERCOM0_PAD2 - #define SERCOM0_PAD3_DEFAULT PINMUX_PA07D_SERCOM0_PAD3 - - /* SERCOM1 */ - #define SERCOM1_PAD0_DEFAULT PINMUX_PA00D_SERCOM1_PAD0 - #define SERCOM1_PAD1_DEFAULT PINMUX_PA01D_SERCOM1_PAD1 - #define SERCOM1_PAD2_DEFAULT PINMUX_PA30D_SERCOM1_PAD2 - #define SERCOM1_PAD3_DEFAULT PINMUX_PA31D_SERCOM1_PAD3 - - /* SERCOM2 */ - #define SERCOM2_PAD0_DEFAULT PINMUX_PA08D_SERCOM2_PAD0 - #define SERCOM2_PAD1_DEFAULT PINMUX_PA09D_SERCOM2_PAD1 - #define SERCOM2_PAD2_DEFAULT PINMUX_PA10D_SERCOM2_PAD2 - #define SERCOM2_PAD3_DEFAULT PINMUX_PA11D_SERCOM2_PAD3 - - /* SERCOM3 */ - #define SERCOM3_PAD0_DEFAULT PINMUX_PA16D_SERCOM3_PAD0 - #define SERCOM3_PAD1_DEFAULT PINMUX_PA17D_SERCOM3_PAD1 - #define SERCOM3_PAD2_DEFAULT PINMUX_PA18D_SERCOM3_PAD2 - #define SERCOM3_PAD3_DEFAULT PINMUX_PA19D_SERCOM3_PAD3 - - #if (SAMDA1E) - /* SERCOM4 */ - #define SERCOM4_PAD0_DEFAULT 0 /* No available pin */ - #define SERCOM4_PAD1_DEFAULT 0 /* No available pin */ - #define SERCOM4_PAD2_DEFAULT PINMUX_PA14D_SERCOM4_PAD2 - #define SERCOM4_PAD3_DEFAULT PINMUX_PA15D_SERCOM4_PAD3 - #else - /* SERCOM4 */ - #define SERCOM4_PAD0_DEFAULT PINMUX_PA12D_SERCOM4_PAD0 - #define SERCOM4_PAD1_DEFAULT PINMUX_PA13D_SERCOM4_PAD1 - #define SERCOM4_PAD2_DEFAULT PINMUX_PA14D_SERCOM4_PAD2 - #define SERCOM4_PAD3_DEFAULT PINMUX_PA15D_SERCOM4_PAD3 - #endif - - /* SERCOM5 */ - #define SERCOM5_PAD0_DEFAULT PINMUX_PA22D_SERCOM5_PAD0 - #define SERCOM5_PAD1_DEFAULT PINMUX_PA23D_SERCOM5_PAD1 - #define SERCOM5_PAD2_DEFAULT PINMUX_PA24D_SERCOM5_PAD2 - #define SERCOM5_PAD3_DEFAULT PINMUX_PA25D_SERCOM5_PAD3 - -#elif (SAML21E) || (SAMR30E) - - /* SERCOM0 */ - #define SERCOM0_PAD0_DEFAULT PINMUX_PA04D_SERCOM0_PAD0 - #define SERCOM0_PAD1_DEFAULT PINMUX_PA05D_SERCOM0_PAD1 - #define SERCOM0_PAD2_DEFAULT PINMUX_PA06D_SERCOM0_PAD2 - #define SERCOM0_PAD3_DEFAULT PINMUX_PA07D_SERCOM0_PAD3 - - /* SERCOM1 */ - #define SERCOM1_PAD0_DEFAULT PINMUX_PA00D_SERCOM1_PAD0 - #define SERCOM1_PAD1_DEFAULT PINMUX_PA01D_SERCOM1_PAD1 - #define SERCOM1_PAD2_DEFAULT PINMUX_PA30D_SERCOM1_PAD2 - #define SERCOM1_PAD3_DEFAULT PINMUX_PA31D_SERCOM1_PAD3 - - /* SERCOM2 */ - #define SERCOM2_PAD0_DEFAULT PINMUX_PA08D_SERCOM2_PAD0 - #define SERCOM2_PAD1_DEFAULT PINMUX_PA09D_SERCOM2_PAD1 - #define SERCOM2_PAD2_DEFAULT PINMUX_PA10D_SERCOM2_PAD2 - #define SERCOM2_PAD3_DEFAULT PINMUX_PA11D_SERCOM2_PAD3 - - /* SERCOM3 */ - #define SERCOM3_PAD0_DEFAULT PINMUX_PA16D_SERCOM3_PAD0 - #define SERCOM3_PAD1_DEFAULT PINMUX_PA17D_SERCOM3_PAD1 - #define SERCOM3_PAD2_DEFAULT PINMUX_PA18D_SERCOM3_PAD2 - #define SERCOM3_PAD3_DEFAULT PINMUX_PA19D_SERCOM3_PAD3 - - #if !SAM_PART_IS_DEFINED(SAML21E18A) && !SAM_PART_IS_DEFINED(SAMR30E18A) - /* SERCOM4 */ - #define SERCOM4_PAD0_DEFAULT 0 /* No available pin */ - #define SERCOM4_PAD1_DEFAULT 0 /* No available pin */ - #define SERCOM4_PAD2_DEFAULT PINMUX_PA14D_SERCOM4_PAD2 - #define SERCOM4_PAD3_DEFAULT PINMUX_PA15D_SERCOM4_PAD3 - - /* SERCOM5 */ - #define SERCOM5_PAD0_DEFAULT PINMUX_PA22D_SERCOM5_PAD0 - #define SERCOM5_PAD1_DEFAULT PINMUX_PA23D_SERCOM5_PAD1 - #define SERCOM5_PAD2_DEFAULT PINMUX_PA24D_SERCOM5_PAD2 - #define SERCOM5_PAD3_DEFAULT PINMUX_PA25D_SERCOM5_PAD3 - #endif - -#else - /* SERCOM0 */ - #define SERCOM0_PAD0_DEFAULT PINMUX_PA04D_SERCOM0_PAD0 - #define SERCOM0_PAD1_DEFAULT PINMUX_PA05D_SERCOM0_PAD1 - #define SERCOM0_PAD2_DEFAULT PINMUX_PA06D_SERCOM0_PAD2 - #define SERCOM0_PAD3_DEFAULT PINMUX_PA07D_SERCOM0_PAD3 - - /* SERCOM1 */ -#if SAM_PART_IS_DEFINED(SAMD21G15L) || SAM_PART_IS_DEFINED(SAMD21G16L) - #define SERCOM1_PAD0_DEFAULT PINMUX_PA16C_SERCOM1_PAD0 - #define SERCOM1_PAD1_DEFAULT PINMUX_PA17C_SERCOM1_PAD1 - #define SERCOM1_PAD2_DEFAULT PINMUX_PA18C_SERCOM1_PAD2 - #define SERCOM1_PAD3_DEFAULT PINMUX_PA19C_SERCOM1_PAD3 -#else - #define SERCOM1_PAD0_DEFAULT PINMUX_PA00D_SERCOM1_PAD0 - #define SERCOM1_PAD1_DEFAULT PINMUX_PA01D_SERCOM1_PAD1 - #define SERCOM1_PAD2_DEFAULT PINMUX_PA30D_SERCOM1_PAD2 - #define SERCOM1_PAD3_DEFAULT PINMUX_PA31D_SERCOM1_PAD3 -#endif - - /* SERCOM2 */ - #define SERCOM2_PAD0_DEFAULT PINMUX_PA08D_SERCOM2_PAD0 - #define SERCOM2_PAD1_DEFAULT PINMUX_PA09D_SERCOM2_PAD1 - #define SERCOM2_PAD2_DEFAULT PINMUX_PA10D_SERCOM2_PAD2 - #define SERCOM2_PAD3_DEFAULT PINMUX_PA11D_SERCOM2_PAD3 - - /* SERCOM3 */ - #define SERCOM3_PAD0_DEFAULT PINMUX_PA16D_SERCOM3_PAD0 - #define SERCOM3_PAD1_DEFAULT PINMUX_PA17D_SERCOM3_PAD1 - #define SERCOM3_PAD2_DEFAULT PINMUX_PA18D_SERCOM3_PAD2 - #define SERCOM3_PAD3_DEFAULT PINMUX_PA19D_SERCOM3_PAD3 - - #if !(SAMD20E || SAMD21E) - /* SERCOM4 */ - #define SERCOM4_PAD0_DEFAULT PINMUX_PA12D_SERCOM4_PAD0 - #define SERCOM4_PAD1_DEFAULT PINMUX_PA13D_SERCOM4_PAD1 - #define SERCOM4_PAD2_DEFAULT PINMUX_PA14D_SERCOM4_PAD2 - #define SERCOM4_PAD3_DEFAULT PINMUX_PA15D_SERCOM4_PAD3 - - /* SERCOM5 */ - #define SERCOM5_PAD0_DEFAULT PINMUX_PA22D_SERCOM5_PAD0 - #define SERCOM5_PAD1_DEFAULT PINMUX_PA23D_SERCOM5_PAD1 - #define SERCOM5_PAD2_DEFAULT PINMUX_PA24D_SERCOM5_PAD2 - #define SERCOM5_PAD3_DEFAULT PINMUX_PA25D_SERCOM5_PAD3 - #endif - -#endif - -#endif /* SERCOM_PINOUT_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/sercom/spi/module_config/conf_spi.h b/atmel-samd/asf/sam0/drivers/sercom/spi/module_config/conf_spi.h deleted file mode 100644 index 18b4f76ef..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/spi/module_config/conf_spi.h +++ /dev/null @@ -1,55 +0,0 @@ -/** - * \file - * - * \brief SAM SPI configuration - * - * Copyright (C) 2013-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - - -#ifndef CONF_SPI_H_INCLUDED -# define CONF_SPI_H_INCLUDED - -# define CONF_SPI_MASTER_ENABLE true -# define CONF_SPI_SLAVE_ENABLE true - -#endif /* CONF_SPI_H_INCLUDED */ - diff --git a/atmel-samd/asf/sam0/drivers/sercom/spi/spi.c b/atmel-samd/asf/sam0/drivers/sercom/spi/spi.c deleted file mode 100644 index c0b4acb4a..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/spi/spi.c +++ /dev/null @@ -1,1265 +0,0 @@ -/** - * \file - * - * \brief SAM Serial Peripheral Interface Driver - * - * Copyright (C) 2012-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#include "spi.h" - -/** - * \brief Resets the SPI module - * - * This function will reset the SPI module to its power on default values and - * disable it. - * - * \param[in,out] module Pointer to the software instance struct - */ -void spi_reset( - struct spi_module *const module) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - SercomSpi *const spi_module = &(module->hw->SPI); - - /* Disable the module */ - spi_disable(module); - - while (spi_is_syncing(module)) { - /* Wait until the synchronization is complete */ - } - - /* Software reset the module */ - spi_module->CTRLA.reg |= SERCOM_SPI_CTRLA_SWRST; -} - -/** - * \brief Set the baudrate of the SPI module - * - * This function will set the baudrate of the SPI module. - * - * \param[in] module Pointer to the software instance struct - * \param[in] baudrate The baudrate wanted - * - * \return The status of the configuration. - * \retval STATUS_ERR_INVALID_ARG If invalid argument(s) were provided - * \retval STATUS_OK If the configuration was written - */ -enum status_code spi_set_baudrate( - struct spi_module *const module, - uint32_t baudrate) -{ - /* Sanity check arguments */ - Assert(module); - Assert(baudrate); - Assert(module->hw); - - /* Value to write to BAUD register */ - uint16_t baud = 0; - - SercomSpi *const spi_module = &(module->hw->SPI); - - /* Disable the module */ - spi_disable(module); - - while (spi_is_syncing(module)) { - /* Wait until the synchronization is complete */ - } - - /* Find frequency of the internal SERCOMi_GCLK_ID_CORE */ - uint32_t sercom_index = _sercom_get_sercom_inst_index(module->hw); - uint32_t gclk_index = sercom_index + SERCOM0_GCLK_ID_CORE; - uint32_t internal_clock = system_gclk_chan_get_hz(gclk_index); - - /* Get baud value, based on baudrate and the internal clock frequency */ - enum status_code error_code = _sercom_get_sync_baud_val( - baudrate, internal_clock, &baud); - - if (error_code != STATUS_OK) { - /* Baud rate calculation error, return status code */ - return STATUS_ERR_INVALID_ARG; - } - - spi_module->BAUD.reg = (uint8_t)baud; - - while (spi_is_syncing(module)) { - /* Wait until the synchronization is complete */ - } - - /* Enable the module */ - spi_enable(module); - - while (spi_is_syncing(module)) { - /* Wait until the synchronization is complete */ - } - - return STATUS_OK; -} - -# if CONF_SPI_SLAVE_ENABLE == true -/** - * \internal Clears the Transmit Complete interrupt flag. - * - * \param[in] module Pointer to the software instance struct - */ -static void _spi_clear_tx_complete_flag( - struct spi_module *const module) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - SercomSpi *const spi_module = &(module->hw->SPI); - - /* Clear interrupt flag */ - spi_module->INTFLAG.reg = SPI_INTERRUPT_FLAG_TX_COMPLETE; -} -# endif - -/** - * \internal Writes an SPI SERCOM configuration to the hardware module. - * - * This function will write out a given configuration to the hardware module. - * Can only be done when the module is disabled. - * - * \param[in] module Pointer to the software instance struct - * \param[in] config Pointer to the configuration struct - * - * \return The status of the configuration. - * \retval STATUS_ERR_INVALID_ARG If invalid argument(s) were provided - * \retval STATUS_OK If the configuration was written - */ -static enum status_code _spi_set_config( - struct spi_module *const module, - const struct spi_config *const config) -{ - /* Sanity check arguments */ - Assert(module); - Assert(config); - Assert(module->hw); - - SercomSpi *const spi_module = &(module->hw->SPI); - Sercom *const hw = module->hw; - - struct system_pinmux_config pin_conf; - system_pinmux_get_config_defaults(&pin_conf); - pin_conf.direction = SYSTEM_PINMUX_PIN_DIR_INPUT; - if(config->mode == SPI_MODE_SLAVE) { - pin_conf.input_pull = SYSTEM_PINMUX_PIN_PULL_NONE; - } - - uint32_t pad_pinmuxes[] = { - config->pinmux_pad0, config->pinmux_pad1, - config->pinmux_pad2, config->pinmux_pad3 - }; - - /* Configure the SERCOM pins according to the user configuration */ - for (uint8_t pad = 0; pad < 4; pad++) { - uint32_t current_pinmux = pad_pinmuxes[pad]; - - if (current_pinmux == PINMUX_DEFAULT) { - current_pinmux = _sercom_get_default_pad(hw, pad); - } - - if (current_pinmux != PINMUX_UNUSED) { - pin_conf.mux_position = current_pinmux & 0xFFFF; - system_pinmux_pin_set_config(current_pinmux >> 16, &pin_conf); - } - } - - module->mode = config->mode; - module->character_size = config->character_size; - module->receiver_enabled = config->receiver_enable; -# ifdef FEATURE_SPI_HARDWARE_SLAVE_SELECT - module->master_slave_select_enable = config->master_slave_select_enable; -# endif - -# if CONF_SPI_MASTER_ENABLE == true - /* Value to write to BAUD register */ - uint16_t baud = 0; -# endif - /* Value to write to CTRLA register */ - uint32_t ctrla = 0; - /* Value to write to CTRLB register */ - uint32_t ctrlb = 0; - -# if CONF_SPI_MASTER_ENABLE == true - /* Find baud value and write it */ - if (config->mode == SPI_MODE_MASTER) { - /* Find frequency of the internal SERCOMi_GCLK_ID_CORE */ - uint32_t sercom_index = _sercom_get_sercom_inst_index(module->hw); - uint32_t gclk_index = sercom_index + SERCOM0_GCLK_ID_CORE; - uint32_t internal_clock = system_gclk_chan_get_hz(gclk_index); - - /* Get baud value, based on baudrate and the internal clock frequency */ - enum status_code error_code = _sercom_get_sync_baud_val( - config->mode_specific.master.baudrate, - internal_clock, &baud); - - if (error_code != STATUS_OK) { - /* Baud rate calculation error, return status code */ - return STATUS_ERR_INVALID_ARG; - } - - spi_module->BAUD.reg = (uint8_t)baud; - } -# endif -# if CONF_SPI_SLAVE_ENABLE == true - if (config->mode == SPI_MODE_SLAVE) { - /* Set frame format */ - ctrla = config->mode_specific.slave.frame_format; - - /* Set address mode */ - ctrlb = config->mode_specific.slave.address_mode; - - /* Set address and address mask*/ - spi_module->ADDR.reg |= - (config->mode_specific.slave.address << SERCOM_SPI_ADDR_ADDR_Pos) | - (config->mode_specific.slave.address_mask << SERCOM_SPI_ADDR_ADDRMASK_Pos); - - if (config->mode_specific.slave.preload_enable) { - /* Enable pre-loading of shift register */ - ctrlb |= SERCOM_SPI_CTRLB_PLOADEN; - } - } -# endif - /* Set data order */ - ctrla |= config->data_order; - - /* Set clock polarity and clock phase */ - ctrla |= config->transfer_mode; - - /* Set MUX setting */ - ctrla |= config->mux_setting; - - /* Set SPI character size */ - ctrlb |= config->character_size; - - /* Set whether module should run in standby. */ - if (config->run_in_standby || system_is_debugger_present()) { - ctrla |= SERCOM_SPI_CTRLA_RUNSTDBY; - } - - if (config->receiver_enable) { - /* Enable receiver */ - ctrlb |= SERCOM_SPI_CTRLB_RXEN; - } -# ifdef FEATURE_SPI_SLAVE_SELECT_LOW_DETECT - if (config->select_slave_low_detect_enable) { - /* Enable Slave Select Low Detect */ - ctrlb |= SERCOM_SPI_CTRLB_SSDE; - } -# endif -# ifdef FEATURE_SPI_HARDWARE_SLAVE_SELECT - if (config->master_slave_select_enable) { - /* Enable Master Slave Select */ - ctrlb |= SERCOM_SPI_CTRLB_MSSEN; - } -# endif - /* Write CTRLA register */ - spi_module->CTRLA.reg |= ctrla; - - /* Write CTRLB register */ - spi_module->CTRLB.reg |= ctrlb; - - return STATUS_OK; -} - -#if SPI_CALLBACK_MODE == false -/** - * \internal Checks an SPI config against current set config - * - * This function will check that the config does not alter the - * configuration of the module. If the new config changes any - * setting, the initialization will be discarded. - * - * \param[in] module Pointer to the software instance struct - * \param[in] config Pointer to the configuration struct - * - * \return The status of the configuration. - * \retval STATUS_ERR_INVALID_ARG If invalid argument(s) were provided - * \retval STATUS_ERR_DENIED If configuration was different from previous - * \retval STATUS_OK If the configuration was written - */ -static enum status_code _spi_check_config( - struct spi_module *const module, - const struct spi_config *const config) -{ - /* Sanity check arguments */ - Assert(module); - Assert(config); - Assert(module->hw); - - SercomSpi *const spi_module = &(module->hw->SPI); - Sercom *const hw = module->hw; - - uint32_t pad_pinmuxes[] = { - config->pinmux_pad0, config->pinmux_pad1, - config->pinmux_pad2, config->pinmux_pad3 - }; - - /* Compare the current SERCOM pins against the user configuration */ - for (uint8_t pad = 0; pad < 4; pad++) { - uint32_t current_pinmux = pad_pinmuxes[pad]; - - if (current_pinmux == PINMUX_DEFAULT) { - current_pinmux = _sercom_get_default_pad(hw, pad); - } - - if (current_pinmux == PINMUX_UNUSED) { - continue; - } - - if ((current_pinmux & 0xFFFF) != - system_pinmux_pin_get_mux_position(current_pinmux >> 16)) { - module->hw = NULL; - return STATUS_ERR_DENIED; - } - } - -# if CONF_SPI_MASTER_ENABLE == true - /* Value to read BAUD register */ - uint16_t baud; - uint32_t external_clock = system_gclk_chan_get_hz(SERCOM_GCLK_ID); -# endif - /* Value to read CTRLA, CTRLB and ADDR register */ - uint32_t ctrla = 0; - uint32_t ctrlb = 0; -# if CONF_SPI_SLAVE_ENABLE == true - uint32_t addr = 0; -# endif - -# if CONF_SPI_MASTER_ENABLE == true - /* Find baud value and compare it */ - if (config->mode == SPI_MODE_MASTER) { - enum status_code error_code = _sercom_get_sync_baud_val( - config->mode_specific.master.baudrate, - external_clock, &baud); - - if (error_code != STATUS_OK) { - /* Baud rate calculation error, return status code */ - return STATUS_ERR_INVALID_ARG; - } - - if (spi_module->BAUD.reg != (uint8_t)baud) { - return STATUS_ERR_DENIED; - } - - ctrla |= SERCOM_SPI_CTRLA_MODE(0x3); - } -# endif - -# if CONF_SPI_SLAVE_ENABLE == true - if (config->mode == SPI_MODE_SLAVE) { - - /* Set frame format */ - ctrla |= config->mode_specific.slave.frame_format; - - /* Set address mode */ - ctrlb |= config->mode_specific.slave.address_mode; - - /* Set address and address mask*/ - addr |= (config->mode_specific.slave.address << SERCOM_SPI_ADDR_ADDR_Pos) | - (config->mode_specific.slave.address_mask << SERCOM_SPI_ADDR_ADDRMASK_Pos); - if (spi_module->CTRLA.reg != addr) { - return STATUS_ERR_DENIED; - } - - if (config->mode_specific.slave.preload_enable) { - /* Enable pre-loading of shift register */ - ctrlb |= SERCOM_SPI_CTRLB_PLOADEN; - } - ctrla |= SERCOM_SPI_CTRLA_MODE(0x2); - } -# endif - /* Set data order */ - ctrla |= config->data_order; - - /* Set clock polarity and clock phase */ - ctrla |= config->transfer_mode; - - /* Set MUX setting */ - ctrla |= config->mux_setting; - - /* Set SPI character size */ - ctrlb |= config->character_size; - - if (config->run_in_standby) { - /* Enable in sleep mode */ - ctrla |= SERCOM_SPI_CTRLA_RUNSTDBY; - } - - if (config->receiver_enable) { - /* Enable receiver */ - ctrlb |= SERCOM_SPI_CTRLB_RXEN; - } - -# ifdef FEATURE_SPI_SLAVE_SELECT_LOW_DETECT - if (config->select_slave_low_detect_enable) { - /* Enable Slave Select Low Detect */ - ctrlb |= SERCOM_SPI_CTRLB_SSDE; - } -# endif -# ifdef FEATURE_SPI_HARDWARE_SLAVE_SELECT - if (config->master_slave_select_enable) { - /* Enable Master Slave Select */ - ctrlb |= SERCOM_SPI_CTRLB_MSSEN; - } -# endif - - ctrla |= SERCOM_SPI_CTRLA_ENABLE; - - /* Check that same config is set */ - if (spi_module->CTRLA.reg == ctrla && - spi_module->CTRLB.reg == ctrlb) { - module->mode = config->mode; - module->character_size = config->character_size; - return STATUS_OK; - } - - /* Not same config, wipe module pointer and return */ - module->hw = NULL; - - return STATUS_ERR_DENIED; -} -#endif - -/** - * \brief Initializes the SERCOM SPI module - * - * This function will initialize the SERCOM SPI module, based on the values - * of the config struct. - * - * \param[out] module Pointer to the software instance struct - * \param[in] hw Pointer to hardware instance - * \param[in] config Pointer to the config struct - * - * \return Status of the initialization. - * \retval STATUS_OK Module initiated correctly - * \retval STATUS_ERR_DENIED If module is enabled - * \retval STATUS_BUSY If module is busy resetting - * \retval STATUS_ERR_INVALID_ARG If invalid argument(s) were provided - */ -enum status_code spi_init( - struct spi_module *const module, - Sercom *const hw, - const struct spi_config *const config) -{ - - /* Sanity check arguments */ - Assert(module); - Assert(hw); - Assert(config); - - /* Initialize device instance */ - module->hw = hw; - - SercomSpi *const spi_module = &(module->hw->SPI); - - /* Check if module is enabled. */ - if (spi_module->CTRLA.reg & SERCOM_SPI_CTRLA_ENABLE) { -# if SPI_CALLBACK_MODE == false - /* Check if config is valid */ - return _spi_check_config(module, config); -# else - return STATUS_ERR_DENIED; -# endif - } - - /* Check if reset is in progress. */ - if (spi_module->CTRLA.reg & SERCOM_SPI_CTRLA_SWRST){ - return STATUS_BUSY; - } - - uint32_t sercom_index = _sercom_get_sercom_inst_index(module->hw); - uint32_t pm_index, gclk_index; -#if (SAML21) || (SAMR30) - if (sercom_index == 5) { -# ifdef ID_SERCOM5 - pm_index = MCLK_APBDMASK_SERCOM5_Pos; - gclk_index = SERCOM5_GCLK_ID_CORE; -# else - return STATUS_ERR_INVALID_ARG; -# endif - } else { - pm_index = sercom_index + MCLK_APBCMASK_SERCOM0_Pos; - gclk_index = sercom_index + SERCOM0_GCLK_ID_CORE; - } -#elif (SAMC21) - if (sercom_index == 5) { -# ifdef ID_SERCOM5 - pm_index = sercom_index + MCLK_APBCMASK_SERCOM0_Pos; - gclk_index = SERCOM5_GCLK_ID_CORE; -# else - return STATUS_ERR_INVALID_ARG; -# endif - } else { - pm_index = sercom_index + MCLK_APBCMASK_SERCOM0_Pos; - gclk_index = sercom_index + SERCOM0_GCLK_ID_CORE; - } -#elif (SAMC20) || (SAML22) - pm_index = sercom_index + MCLK_APBCMASK_SERCOM0_Pos; - gclk_index = sercom_index + SERCOM0_GCLK_ID_CORE; -#else - pm_index = sercom_index + PM_APBCMASK_SERCOM0_Pos; - gclk_index = sercom_index + SERCOM0_GCLK_ID_CORE; -#endif - - /* Turn on module in PM */ -#if (SAML21) || (SAMR30) - if (sercom_index == 5) { -# ifdef ID_SERCOM5 - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBD, 1 << pm_index); -# else - return STATUS_ERR_INVALID_ARG; -# endif - } else { - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBC, 1 << pm_index); - } -#else - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBC, 1 << pm_index); -#endif - - /* Set up the GCLK for the module */ - struct system_gclk_chan_config gclk_chan_conf; - system_gclk_chan_get_config_defaults(&gclk_chan_conf); - gclk_chan_conf.source_generator = config->generator_source; - system_gclk_chan_set_config(gclk_index, &gclk_chan_conf); - system_gclk_chan_enable(gclk_index); - sercom_set_gclk_generator(config->generator_source, false); - -# if CONF_SPI_MASTER_ENABLE == true - if (config->mode == SPI_MODE_MASTER) { - /* Set the SERCOM in SPI master mode */ - spi_module->CTRLA.reg |= SERCOM_SPI_CTRLA_MODE(0x3); - } -# endif - -# if CONF_SPI_SLAVE_ENABLE == true - if (config->mode == SPI_MODE_SLAVE) { - /* Set the SERCOM in SPI slave mode */ - spi_module->CTRLA.reg |= SERCOM_SPI_CTRLA_MODE(0x2); - } -# endif - -#if SPI_CALLBACK_MODE == true - /* Temporary variables */ - uint8_t i; - uint8_t instance_index; - - /* Initialize parameters */ - for (i = 0; i < SPI_CALLBACK_N; i++) { - module->callback[i] = NULL; - } - module->tx_buffer_ptr = NULL; - module->rx_buffer_ptr = NULL; - module->remaining_tx_buffer_length = 0x0000; - module->remaining_rx_buffer_length = 0x0000; - module->registered_callback = 0x00; - module->enabled_callback = 0x00; - module->status = STATUS_OK; - module->dir = SPI_DIRECTION_IDLE; - module->locked = false; - /* - * Set interrupt handler and register SPI software module struct in - * look-up table - */ - instance_index = _sercom_get_sercom_inst_index(module->hw); - _sercom_set_handler(instance_index, _spi_interrupt_handler); - _sercom_instances[instance_index] = module; -#endif - - /* Write configuration to module and return status code */ - return _spi_set_config(module, config); -} - -/** - * \brief Reads buffer of \c length SPI characters - * - * This function will read a buffer of data from an SPI peripheral by sending - * dummy SPI character if in master mode, or by waiting for data in slave mode. - * - * \note If address matching is enabled for the slave, the first character - * received and placed in the buffer will be the address. - * - * \param[in] module Pointer to the software instance struct - * \param[out] rx_data Data buffer for received data - * \param[in] length Length of data to receive - * \param[in] dummy 8- or 9-bit dummy byte to shift out in master mode - * - * \return Status of the read operation. - * \retval STATUS_OK If the read was completed - * \retval STATUS_ABORTED If transaction was ended by master before - * the entire buffer was transferred - * \retval STATUS_ERR_INVALID_ARG If invalid argument(s) were provided - * \retval STATUS_ERR_TIMEOUT If the operation was not completed within the - * timeout in slave mode - * \retval STATUS_ERR_DENIED If the receiver is not enabled - * \retval STATUS_ERR_OVERFLOW If the data is overflown - */ -enum status_code spi_read_buffer_wait( - struct spi_module *const module, - uint8_t *rx_data, - uint16_t length, - uint16_t dummy) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - -# if SPI_CALLBACK_MODE == true - if (module->status == STATUS_BUSY) { - /* Check if the SPI module is busy with a job */ - return STATUS_BUSY; - } -# endif - - /* Sanity check arguments */ - if (length == 0) { - return STATUS_ERR_INVALID_ARG; - } - - if (!(module->receiver_enabled)) { - return STATUS_ERR_DENIED; - } -# if CONF_SPI_SLAVE_ENABLE == true - if ((module->mode == SPI_MODE_SLAVE) && (spi_is_write_complete(module))) { - /* Clear TX complete flag */ - _spi_clear_tx_complete_flag(module); - } -# endif - uint16_t rx_pos = 0; - - while (length--) { -# if CONF_SPI_MASTER_ENABLE == true - if (module->mode == SPI_MODE_MASTER) { - /* Wait until the module is ready to write a character */ - while (!spi_is_ready_to_write(module)) { - } - - /* Send dummy SPI character to read in master mode */ - spi_write(module, dummy); - } -# endif - -# if CONF_SPI_SLAVE_ENABLE == true - /* Start timeout period for slave */ - if (module->mode == SPI_MODE_SLAVE) { - for (uint32_t i = 0; i <= SPI_TIMEOUT; i++) { - if (spi_is_ready_to_read(module)) { - break; - } - } - /* Check if master has ended the transaction */ - if (spi_is_write_complete(module)) { - _spi_clear_tx_complete_flag(module); - return STATUS_ABORTED; - } - - if (!spi_is_ready_to_read(module)) { - /* Not ready to read data within timeout period */ - return STATUS_ERR_TIMEOUT; - } - } -# endif - - /* Wait until the module is ready to read a character */ - while (!spi_is_ready_to_read(module)) { - } - - uint16_t received_data = 0; - enum status_code retval = spi_read(module, &received_data); - - if (retval != STATUS_OK) { - /* Overflow, abort */ - return retval; - } - - /* Read value will be at least 8-bits long */ - rx_data[rx_pos++] = received_data; - - /* If 9-bit data, write next received byte to the buffer */ - if (module->character_size == SPI_CHARACTER_SIZE_9BIT) { - rx_data[rx_pos++] = (received_data >> 8); - } - } - - return STATUS_OK; -} - -/** - * \brief Sends and reads a single SPI character - * - * This function will transfer a single SPI character via SPI and return the - * SPI character that is shifted into the shift register. - * - * In master mode the SPI character will be sent immediately and the received - * SPI character will be read as soon as the shifting of the data is - * complete. - * - * In slave mode this function will place the data to be sent into the transmit - * buffer. It will then block until an SPI master has shifted a complete - * SPI character, and the received data is available. - * - * \note The data to be sent might not be sent before the next transfer, as - * loading of the shift register is dependent on SCK. - * \note If address matching is enabled for the slave, the first character - * received and placed in the buffer will be the address. - * - * \param[in] module Pointer to the software instance struct - * \param[in] tx_data SPI character to transmit - * \param[out] rx_data Pointer to store the received SPI character - * - * \return Status of the operation. - * \retval STATUS_OK If the operation was completed - * \retval STATUS_ERR_TIMEOUT If the operation was not completed within the - * timeout in slave mode - * \retval STATUS_ERR_DENIED If the receiver is not enabled - * \retval STATUS_ERR_OVERFLOW If the incoming data is overflown - */ -enum status_code spi_transceive_wait( - struct spi_module *const module, - uint16_t tx_data, - uint16_t *rx_data) -{ - /* Sanity check arguments */ - Assert(module); - - if (!(module->receiver_enabled)) { - return STATUS_ERR_DENIED; - } - -# if SPI_CALLBACK_MODE == true - if (module->status == STATUS_BUSY) { - /* Check if the SPI module is busy with a job */ - return STATUS_BUSY; - } -# endif - -# if CONF_SPI_SLAVE_ENABLE == true - uint16_t j; -# endif - enum status_code retval = STATUS_OK; - -# if CONF_SPI_SLAVE_ENABLE == true - /* Start timeout period for slave */ - if (module->mode == SPI_MODE_SLAVE) { - for (j = 0; j <= SPI_TIMEOUT; j++) { - if (spi_is_ready_to_write(module)) { - break; - } else if (j == SPI_TIMEOUT) { - /* Not ready to write data within timeout period */ - return STATUS_ERR_TIMEOUT; - } - } - } -# endif - /* Wait until the module is ready to write the character */ - while (!spi_is_ready_to_write(module)) { - } - - /* Write data */ - spi_write(module, tx_data); - -# if CONF_SPI_SLAVE_ENABLE == true - /* Start timeout period for slave */ - if (module->mode == SPI_MODE_SLAVE) { - for (j = 0; j <= SPI_TIMEOUT; j++) { - if (spi_is_ready_to_read(module)) { - break; - } else if (j == SPI_TIMEOUT) { - /* Not ready to read data within timeout period */ - return STATUS_ERR_TIMEOUT; - } - } - } -# endif - - /* Wait until the module is ready to read the character */ - while (!spi_is_ready_to_read(module)) { - } - - /* Read data */ - retval = spi_read(module, rx_data); - - return retval; -} - - /** - * \brief Selects slave device - * - * This function will drive the slave select pin of the selected device low or - * high depending on the select Boolean. - * If slave address recognition is enabled, the address will be sent to the - * slave when selecting it. - * - * \param[in] module Pointer to the software module struct - * \param[in] slave Pointer to the attached slave - * \param[in] select Boolean stating if the slave should be selected or - * deselected - * - * \return Status of the operation. - * \retval STATUS_OK If the slave device was selected - * \retval STATUS_ERR_UNSUPPORTED_DEV If the SPI module is operating in slave - * mode - * \retval STATUS_BUSY If the SPI module is not ready to write - * the slave address - */ -enum status_code spi_select_slave( - struct spi_module *const module, - struct spi_slave_inst *const slave, - const bool select) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - Assert(slave); - - /* Check that the SPI module is operating in master mode */ - if (module->mode != SPI_MODE_MASTER) { - return STATUS_ERR_UNSUPPORTED_DEV; - } -# ifdef FEATURE_SPI_HARDWARE_SLAVE_SELECT - if(!(module->master_slave_select_enable)) -# endif - { - if (select) { - /* Check if address recognition is enabled */ - if (slave->address_enabled) { - /* Check if the module is ready to write the address */ - if (!spi_is_ready_to_write(module)) { - /* Not ready, do not select slave and return */ - port_pin_set_output_level(slave->ss_pin, true); - return STATUS_BUSY; - } - - /* Drive Slave Select low */ - port_pin_set_output_level(slave->ss_pin, false); - - /* Write address to slave */ - spi_write(module, slave->address); - - if (!(module->receiver_enabled)) { - /* Flush contents of shift register shifted back from slave */ - while (!spi_is_ready_to_read(module)) { - } - uint16_t flush = 0; - spi_read(module, &flush); - } - } else { - /* Drive Slave Select low */ - port_pin_set_output_level(slave->ss_pin, false); - } - } else { - /* Drive Slave Select high */ - port_pin_set_output_level(slave->ss_pin, true); - } - } - return STATUS_OK; -} - -/** - * \brief Sends a buffer of \c length SPI characters - * - * This function will send a buffer of SPI characters via the SPI - * and discard any data that is received. To both send and receive a buffer of - * data, use the \ref spi_transceive_buffer_wait function. - * - * Note that this function does not handle the _SS (slave select) pin(s) in - * master mode; this must be handled by the user application. - * - * \param[in] module Pointer to the software instance struct - * \param[in] tx_data Pointer to the buffer to transmit - * \param[in] length Number of SPI characters to transfer - * - * \return Status of the write operation. - * \retval STATUS_OK If the write was completed - * \retval STATUS_ABORTED If transaction was ended by master before - * entire buffer was transferred - * \retval STATUS_ERR_INVALID_ARG If invalid argument(s) were provided - * \retval STATUS_ERR_TIMEOUT If the operation was not completed within the - * timeout in slave mode - */ -enum status_code spi_write_buffer_wait( - struct spi_module *const module, - const uint8_t *tx_data, - uint16_t length) -{ - /* Sanity check arguments */ - Assert(module); - -# if SPI_CALLBACK_MODE == true - if (module->status == STATUS_BUSY) { - /* Check if the SPI module is busy with a job */ - return STATUS_BUSY; - } -# endif - - if (length == 0) { - return STATUS_ERR_INVALID_ARG; - } - -# if CONF_SPI_SLAVE_ENABLE == true - if ((module->mode == SPI_MODE_SLAVE) && (spi_is_write_complete(module))) { - /* Clear TX complete flag */ - _spi_clear_tx_complete_flag(module); - } -# endif - - uint16_t tx_pos = 0; - uint16_t flush_length = length; - - /* Write block */ - while (length--) { -# if CONF_SPI_SLAVE_ENABLE == true - /* Start timeout period for slave */ - if (module->mode == SPI_MODE_SLAVE) { - for (uint32_t i = 0; i <= SPI_TIMEOUT; i++) { - if (spi_is_ready_to_write(module)) { - break; - } - } - /* Check if master has ended the transaction */ - if (spi_is_write_complete(module)) { - _spi_clear_tx_complete_flag(module); - return STATUS_ABORTED; - } - - if (!spi_is_ready_to_write(module)) { - /* Not ready to write data within timeout period */ - return STATUS_ERR_TIMEOUT; - } - } -# endif - - /* Wait until the module is ready to write a character */ - while (!spi_is_ready_to_write(module)) { - } - - /* Write value will be at least 8-bits long */ - uint16_t data_to_send = tx_data[tx_pos++]; - - /* If 9-bit data, get next byte to send from the buffer */ - if (module->character_size == SPI_CHARACTER_SIZE_9BIT) { - data_to_send |= (tx_data[tx_pos++] << 8); - } - - /* Write the data to send */ - spi_write(module, data_to_send); - - if (module->receiver_enabled) { -# if CONF_SPI_SLAVE_ENABLE == true - /* Start timeout period for slave */ - if (module->mode == SPI_MODE_SLAVE) { - for (uint32_t i = 0; i <= SPI_TIMEOUT; i++) { - if (length && spi_is_ready_to_write(module)) { - data_to_send = tx_data[tx_pos++]; - /* If 9-bit data, get next byte to send from the buffer */ - if (module->character_size == SPI_CHARACTER_SIZE_9BIT) { - data_to_send |= (tx_data[tx_pos++] << 8); - } - - /* Write the data to send */ - spi_write(module, data_to_send); - length--; - } - if (spi_is_ready_to_read(module)) { - break; - } - } - - /* Check if master has ended the transaction */ - if (spi_is_write_complete(module)) { - _spi_clear_tx_complete_flag(module); - return STATUS_ABORTED; - } - - if (!spi_is_ready_to_read(module)) { - /* Not ready to read data within timeout period */ - return STATUS_ERR_TIMEOUT; - } - } -# endif - - while (!spi_is_ready_to_read(module)) { - } - - /* Flush read buffer */ - uint16_t flush; - spi_read(module, &flush); - flush_length--; - } - } - -# if CONF_SPI_MASTER_ENABLE == true - if (module->mode == SPI_MODE_MASTER) { - /* Wait for last byte to be transferred */ - while (!spi_is_write_complete(module)) { - } - } -# endif - -# if CONF_SPI_SLAVE_ENABLE == true - if (module->mode == SPI_MODE_SLAVE) { - if (module->receiver_enabled) { - while (flush_length) { - /* Start timeout period for slave */ - for (uint32_t i = 0; i <= SPI_TIMEOUT; i++) { - if (spi_is_ready_to_read(module)) { - break; - } - } - if (!spi_is_ready_to_read(module)) { - /* Not ready to read data within timeout period */ - return STATUS_ERR_TIMEOUT; - } - /* Flush read buffer */ - uint16_t flush; - spi_read(module, &flush); - flush_length--; - } - } - } -# endif - return STATUS_OK; -} - -/** - * \brief Sends and receives a buffer of \c length SPI characters - * - * This function will send and receive a buffer of data via the SPI. - * - * In master mode the SPI characters will be sent immediately and the - * received SPI character will be read as soon as the shifting of the SPI - * character is complete. - * - * In slave mode this function will place the data to be sent into the transmit - * buffer. It will then block until an SPI master has shifted the complete - * buffer and the received data is available. - * - * \param[in] module Pointer to the software instance struct - * \param[in] tx_data Pointer to the buffer to transmit - * \param[out] rx_data Pointer to the buffer where received data will be stored - * \param[in] length Number of SPI characters to transfer - * - * \return Status of the operation. - * \retval STATUS_OK If the operation was completed - * \retval STATUS_ERR_INVALID_ARG If invalid argument(s) were provided - * \retval STATUS_ERR_TIMEOUT If the operation was not completed within the - * timeout in slave mode - * \retval STATUS_ERR_DENIED If the receiver is not enabled - * \retval STATUS_ERR_OVERFLOW If the data is overflown - */ -enum status_code spi_transceive_buffer_wait( - struct spi_module *const module, - uint8_t *tx_data, - uint8_t *rx_data, - uint16_t length) -{ - /* Sanity check arguments */ - Assert(module); - -# if SPI_CALLBACK_MODE == true - if (module->status == STATUS_BUSY) { - /* Check if the SPI module is busy with a job */ - return STATUS_BUSY; - } -# endif - - /* Sanity check arguments */ - if (length == 0) { - return STATUS_ERR_INVALID_ARG; - } - - if (!(module->receiver_enabled)) { - return STATUS_ERR_DENIED; - } - -# if CONF_SPI_SLAVE_ENABLE == true - if ((module->mode == SPI_MODE_SLAVE) && (spi_is_write_complete(module))) { - /* Clear TX complete flag */ - _spi_clear_tx_complete_flag(module); - } -# endif - - uint16_t tx_pos = 0; - uint16_t rx_pos = 0; - uint16_t rx_length = length; - - /* Send and receive buffer */ - while (length--) { -# if CONF_SPI_SLAVE_ENABLE == true - /* Start timeout period for slave */ - if (module->mode == SPI_MODE_SLAVE) { - for (uint32_t i = 0; i <= SPI_TIMEOUT; i++) { - if (spi_is_ready_to_write(module)) { - break; - } - } - /* Check if master has ended the transaction */ - if (spi_is_write_complete(module)) { - _spi_clear_tx_complete_flag(module); - return STATUS_ABORTED; - } - - if (!spi_is_ready_to_write(module)) { - /* Not ready to write data within timeout period */ - return STATUS_ERR_TIMEOUT; - } - } -# endif - - /* Wait until the module is ready to write a character */ - while (!spi_is_ready_to_write(module)) { - } - - /* Write value will be at least 8-bits long */ - uint16_t data_to_send = tx_data[tx_pos++]; - - /* If 9-bit data, get next byte to send from the buffer */ - if (module->character_size == SPI_CHARACTER_SIZE_9BIT) { - data_to_send |= (tx_data[tx_pos++] << 8); - } - - /* Write the data to send */ - spi_write(module, data_to_send); - -# if CONF_SPI_SLAVE_ENABLE == true - /* Start timeout period for slave */ - if (module->mode == SPI_MODE_SLAVE) { - for (uint32_t i = 0; i <= SPI_TIMEOUT; i++) { - if (spi_is_ready_to_write(module)) { - data_to_send = tx_data[tx_pos++]; - /* If 9-bit data, get next byte to send from the buffer */ - if (module->character_size == SPI_CHARACTER_SIZE_9BIT) { - data_to_send |= (tx_data[tx_pos++] << 8); - } - - /* Write the data to send */ - spi_write(module, data_to_send); - length--; - } - if (spi_is_ready_to_read(module)) { - break; - } - } - /* Check if master has ended the transaction */ - if (spi_is_write_complete(module)) { - _spi_clear_tx_complete_flag(module); - return STATUS_ABORTED; - } - - if (!spi_is_ready_to_read(module)) { - /* Not ready to read data within timeout period */ - return STATUS_ERR_TIMEOUT; - } - } -# endif - - /* Wait until the module is ready to read a character */ - while (!spi_is_ready_to_read(module)) { - } - - enum status_code retval; - uint16_t received_data = 0; - rx_length--; - - retval = spi_read(module, &received_data); - - if (retval != STATUS_OK) { - /* Overflow, abort */ - return retval; - } - - /* Read value will be at least 8-bits long */ - rx_data[rx_pos++] = received_data; - - /* If 9-bit data, write next received byte to the buffer */ - if (module->character_size == SPI_CHARACTER_SIZE_9BIT) { - rx_data[rx_pos++] = (received_data >> 8); - } - } - -# if CONF_SPI_MASTER_ENABLE == true - if (module->mode == SPI_MODE_MASTER) { - /* Wait for last byte to be transferred */ - while (!spi_is_write_complete(module)) { - } - } -# endif - -# if CONF_SPI_SLAVE_ENABLE == true - if (module->mode == SPI_MODE_SLAVE) { - while (rx_length) { - /* Start timeout period for slave */ - for (uint32_t i = 0; i <= SPI_TIMEOUT; i++) { - if (spi_is_ready_to_read(module)) { - break; - } - } - if (!spi_is_ready_to_read(module)) { - /* Not ready to read data within timeout period */ - return STATUS_ERR_TIMEOUT; - } - enum status_code retval; - uint16_t received_data = 0; - rx_length--; - - retval = spi_read(module, &received_data); - - if (retval != STATUS_OK) { - /* Overflow, abort */ - return retval; - } - /* Read value will be at least 8-bits long */ - rx_data[rx_pos++] = received_data; - - /* If 9-bit data, write next received byte to the buffer */ - if (module->character_size == SPI_CHARACTER_SIZE_9BIT) { - rx_data[rx_pos++] = (received_data >> 8); - } - } - } -# endif - return STATUS_OK; -} diff --git a/atmel-samd/asf/sam0/drivers/sercom/spi/spi.h b/atmel-samd/asf/sam0/drivers/sercom/spi/spi.h deleted file mode 100644 index 01d21a21e..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/spi/spi.h +++ /dev/null @@ -1,1807 +0,0 @@ -/** - * \file - * - * \brief SAM Serial Peripheral Interface Driver - * - * Copyright (C) 2012-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef SPI_H_INCLUDED -#define SPI_H_INCLUDED - -/** - * \defgroup asfdoc_sam0_sercom_spi_group SAM Serial Peripheral Interface (SERCOM SPI) Driver - * - * This driver for Atmel® | SMART ARM®-based microcontrollers provides - * an interface for the configuration and management of the SERCOM module in - * its SPI mode to transfer SPI data frames. The following driver API modes - * are covered by this manual: - * - * - Polled APIs - * \if SPI_CALLBACK_MODE - * - Callback APIs - * \endif - * - * The following peripheral is used by this module: - * - SERCOM (Serial Communication Interface) - * - * The following devices can use this module: - * - Atmel | SMART SAM D20/D21 - * - Atmel | SMART SAM R21 - * - Atmel | SMART SAM D09/D10/D11 - * - Atmel | SMART SAM L21/L22 - * - Atmel | SMART SAM DA1 - * - Atmel | SMART SAM C20/C21 - * - Atmel | SMART SAM R30 - * - * The outline of this documentation is as follows: - * - \ref asfdoc_sam0_sercom_spi_prerequisites - * - \ref asfdoc_sam0_sercom_spi_module_overview - * - \ref asfdoc_sam0_sercom_spi_special_considerations - * - \ref asfdoc_sam0_sercom_spi_extra_info - * - \ref asfdoc_sam0_sercom_spi_examples - * - \ref asfdoc_sam0_sercom_spi_api_overview - * - * \section asfdoc_sam0_sercom_spi_prerequisites Prerequisites - * There are no prerequisites. - * - * - * \section asfdoc_sam0_sercom_spi_module_overview Module Overview - * The Serial Peripheral Interface (SPI) is a high-speed synchronous data - * transfer interface using three or four pins. It allows fast communication - * between a master device and one or more peripheral devices. - * - * A device connected to the bus must act as a master or a slave. The master - * initiates and controls all data transactions. - * The SPI master initiates a communication cycle by pulling low the Slave - * Select (SS) pin of the desired slave. The Slave Select pin is active low. - * Master and slave prepare data to be sent in their respective shift - * registers, and the master generates the required clock pulses on the SCK - * line to interchange data. Data is always shifted from master to slave on - * the Master Out - Slave In (MOSI) line, and from slave to master on the - * Master In - Slave Out (MISO) line. After each data transfer, the master can - * synchronize to the slave by pulling the SS line high. - * - * \subsection asfdoc_sam0_sercom_spi_module_features Driver Feature Macro Definition - * <table> - * <tr> - * <th>Driver feature macro</th> - * <th>Supported devices</th> - * </tr> - * <tr> - * <td>FEATURE_SPI_SLAVE_SELECT_LOW_DETECT</td> - * <td>SAM D21/R21/D10/D11/L21/L22/DA1/C20/C21/R30</td> - * </tr> - * <tr> - * <td>FEATURE_SPI_HARDWARE_SLAVE_SELECT</td> - * <td>SAM D21/R21/D10/D11/L21/L22/DA1/C20/C21/R30</td> - * </tr> - * <tr> - * <td>FEATURE_SPI_ERROR_INTERRUPT</td> - * <td>SAM D21/R21/D10/D11/L21/L22/DA1/C20/C21/R30</td> - * </tr> - * <tr> - * <td>FEATURE_SPI_SYNC_SCHEME_VERSION_2</td> - * <td>SAM D21/R21/D10/D11/L21/L22/DA1/C20/C21/R30</td> - * </tr> - * </table> - * \note The specific features are only available in the driver when the - * selected device supports those features. - * - * \subsection asfdoc_sam0_sercom_spi_bus SPI Bus Connection - * In \ref asfdoc_sam0_spi_connection_example "the figure below", the - * connection between one master and one slave is shown. - * - * \anchor asfdoc_sam0_spi_connection_example - * \dot - * digraph spi_slaves_par { - * subgraph cluster_spi_master { - * shift_reg [label="Shift register", shape=box]; - * mosi_m [label="MOSI", shape=none]; - * miso_m [label="MISO", shape=none]; - * sck_m [label="SCK", shape=none]; - * ss_m [label="GPIO pin", shape=none]; - * {rank=same; mosi_m miso_m sck_m ss_m} - * label="SPI Master"; - * } - * subgraph cluster_spi_slave { - * mosi_s [label="MOSI", shape=none]; - * miso_s [label="MISO", shape=none]; - * sck_s [label="SCK", shape=none]; - * ss_s [label="SS", shape=none]; - * shift_reg_s [label="Shift register", shape=box]; - * {rank=same; mosi_s miso_s sck_s ss_s} - * label="SPI Slave"; - * rankdir=LR; - * } - * shift_reg:e -> mosi_m:w [label=""]; - * mosi_m:e -> mosi_s:w [label=""]; - * mosi_s:e -> shift_reg_s:w [label=""]; - * miso_s:w -> miso_m:e [label=""]; - * sck_m -> sck_s; - * ss_m -> ss_s; - * shift_reg_s:se -> miso_s:e [label=""]; - * miso_m:w -> shift_reg:sw [label=""]; - * rankdir=LR; - * } - * \enddot - * - * The different lines are as follows: - * - \b MISO Master Input Slave Output. The line where the data is shifted - * out from the slave and into the master. - * - \b MOSI Master Output Slave Input. The line where the data is shifted - * out from the master and into the slave. - * - \b SCK Serial Clock. Generated by the master device. - * - \b SS Slave Select. To initiate a transaction, the master must pull this - * line low. - * - * If the bus consists of several SPI slaves, they can be connected in parallel - * and the SPI master can use general I/O pins to control separate SS lines to - * each slave on the bus. - * - * It is also possible to connect all slaves in series. In this configuration, - * a common SS is provided to \c N slaves, enabling them simultaneously. The - * MISO from the \c N-1 slaves is connected to the MOSI on the next slave. The - * \c N<SUP>th</SUP> slave connects its MISO back to the master. For a - * complete transaction, the master must shift \c N+1 characters. - * - * \subsection asfdoc_sam0_sercom_spi_chsize SPI Character Size - * The SPI character size is configurable to eight or nine bits. - * - * \subsection asfdoc_sam0_sercom_spi_master_mode Master Mode - * When configured as a master, the SS pin will be configured as an output. - * - * \subsubsection asfdoc_sam0_sercom_spi_master_mode_data_transfer Data Transfer - * Writing a character will start the SPI clock generator, and - * the character is transferred to the shift register when the shift - * register is empty. - * Once this is done, a new character can be written. - * As each character is shifted out from the master, a character is shifted in - * from the slave. If the receiver is enabled, the data is moved to the receive - * buffer at the completion of the frame and can be read. - * - * \subsection asfdoc_sam0_sercom_spi_slave_mode Slave Mode - * When configured as a slave, the SPI interface will remain inactive with MISO - * tri-stated as long as the SS pin is driven high. - * - * \subsubsection asfdoc_sam0_sercom_spi_slave_mode_data_transfer_slave Data Transfer - * The data register can be updated at any time. - * As the SPI slave shift register is clocked by SCK, a minimum of three SCK - * cycles are needed from the time new data is written, until the character is - * ready to be shifted out. If the shift register has not been loaded with - * data, the current contents will be transmitted. - * - * If constant transmission of data is needed in SPI slave mode, the system - * clock should be faster than SCK. - * If the receiver is enabled, the received character can be read from the - * receive buffer. When SS line is driven high, the slave will not receive any - * additional data. - * - * \subsubsection asfdoc_sam0_sercom_spi_slave_mode_addr_recognition Address Recognition - * When the SPI slave is configured with address recognition, the first - * character in a transaction is checked for an address match. If there is a - * match, the MISO output is enabled and the transaction is processed. - * If the address does not match, the complete transaction is ignored. - * - * If the device is asleep, it can be woken up by an address match in order - * to process the transaction. - * - * \note In master mode, an address packet is written by the - * \ref spi_select_slave function if the address_enabled configuration is - * set in the \ref spi_slave_inst_config struct. - * - * \subsection asfdoc_sam0_sercom_spi_data_modes Data Modes - * There are four combinations of SCK phase and polarity with respect to - * serial data. \ref asfdoc_sam0_spi_mode_table "The table below" shows the - * clock polarity (CPOL) and clock phase (CPHA) in the different modes. - * <i>Leading edge</i> is the first clock edge in a clock cycle and - * <i>trailing edge</i> is the last clock edge in a clock cycle. - * - * \anchor asfdoc_sam0_spi_mode_table - * <table> - * <caption>SPI Data Modes</caption> - * <tr> - * <th>Mode</th> - * <th>CPOL</th> - * <th>CPHA</th> - * <th>Leading Edge</th> - * <th>Trailing Edge</th> - * </tr> - * <tr> - * <td> 0 </td> - * <td> 0 </td> - * <td> 0 </td> - * <td> Rising, Sample </td> - * <td> Falling, Setup </td> - * </tr> - * <tr> - * <td> 1 </td> - * <td> 0 </td> - * <td> 1 </td> - * <td> Rising, Setup </td> - * <td> Falling, Sample </td> - * </tr> - * <tr> - * <td> 2 </td> - * <td> 1 </td> - * <td> 0 </td> - * <td> Falling, Sample </td> - * <td> Rising, Setup </td> - * </tr> - * <tr> - * <td> 3 </td> - * <td> 1 </td> - * <td> 1 </td> - * <td> Falling, Setup </td> - * <td> Rising, Sample </td> - * </tr> - * </table> - * - * - * \subsection asfdoc_sam0_sercom_spi_pads SERCOM Pads - * The SERCOM pads are automatically configured as seen in - * \ref asfdoc_sam0_spi_sercom_pad_table "the table below". If the receiver - * is disabled, the data input (MISO for master, MOSI for slave) can be used - * for other purposes. - * - * In master mode, the SS pin(s) must be configured using the \ref spi_slave_inst - * struct. - * - * \anchor asfdoc_sam0_spi_sercom_pad_table - * <table> - * <caption>SERCOM SPI Pad Usages</caption> - * <tr> - * <th> Pin </th> - * <th> Master SPI </th> - * <th> Slave SPI </th> - * </tr> - * <tr> - * <td> MOSI </td> - * <td> Output </td> - * <td> Input </td> - * </tr> - * <tr> - * <td> MISO </td> - * <td> Input </td> - * <td> Output </td> - * </tr> - * <tr> - * <td> SCK </td> - * <td> Output </td> - * <td> Input </td> - * </tr> - * <tr> - * <td> SS </td> - * <td> User defined output enable </td> - * <td> Input </td> - * </tr> - * </table> - * - * \subsection asfdoc_sam0_sercom_spi_sleep_modes Operation in Sleep Modes - * The SPI module can operate in all sleep modes by setting the run_in_standby - * option in the \ref spi_config struct. The operation in slave and master mode - * is shown in the table below. - * <table> - * <tr> - * <th> run_in_standby </th> - * <th> Slave </th> - * <th> Master </th> - * </tr> - * <tr> - * <td> false </td> - * <td> Disabled, all reception is dropped </td> - * <td> GCLK is disabled when master is idle, wake on transmit complete </td> - * </tr> - * <tr> - * <td> true </td> - * <td> Wake on reception </td> - * <td> GCLK is enabled while in sleep modes, wake on all interrupts </td> - * </tr> - * </table> - * - * \subsection asfdoc_sam0_sercom_spi_clock_generation Clock Generation - * In SPI master mode, the clock (SCK) is generated internally using the - * SERCOM baudrate generator. In SPI slave mode, the clock is provided by - * an external master on the SCK pin. This clock is used to directly clock - * the SPI shift register. - * - * \section asfdoc_sam0_sercom_spi_special_considerations Special Considerations - * \subsection pin_mux pinmux Settings - * The pin MUX settings must be configured properly, as not all settings - * can be used in different modes of operation. - * - * \section asfdoc_sam0_sercom_spi_extra_info Extra Information - * For extra information, see \ref asfdoc_sam0_sercom_spi_extra. This includes: - * - \ref asfdoc_sam0_sercom_spi_extra_acronyms - * - \ref asfdoc_sam0_sercom_spi_extra_dependencies - * - \ref asfdoc_sam0_sercom_spi_extra_workarounds - * - \ref asfdoc_sam0_sercom_spi_extra_history - * - * \section asfdoc_sam0_sercom_spi_examples Examples - * - * For a list of examples related to this driver, see - * \ref asfdoc_sam0_sercom_spi_exqsg. - * - * \section asfdoc_sam0_sercom_spi_api_overview API Overview - * @{ - */ - -#include <compiler.h> -#include <port.h> -#include <sercom.h> -#include <pinmux.h> -#include <string.h> -#include <conf_spi.h> - -# if SPI_CALLBACK_MODE == true -# include <sercom_interrupt.h> -# endif - -#ifdef __cplusplus -extern "C" { -#endif - -#if (CONF_SPI_MASTER_ENABLE == false) && (CONF_SPI_SLAVE_ENABLE == false) -#error "Not possible compile SPI driver, invalid driver configuration. Make sure that either/both CONF_SPI_MASTER_ENABLE/CONF_SPI_SLAVE_ENABLE is set to true." -#endif - -/** - * \name Driver Feature Definition - * Define SERCOM SPI features set according to different device family. - * @{ - */ -# if (SAMD21) || (SAMR21) || (SAMD11) || (SAMD10) || (SAML21) || (SAMDA1) || \ - (SAML22) || (SAMC20) || (SAMC21) || (SAMD09) || (SAMR30) || defined(__DOXYGEN__) -/** SPI slave select low detection. */ -# define FEATURE_SPI_SLAVE_SELECT_LOW_DETECT -/** Slave select can be controlled by hardware. */ -# define FEATURE_SPI_HARDWARE_SLAVE_SELECT -/** SPI with error detect feature. */ -# define FEATURE_SPI_ERROR_INTERRUPT -/** SPI sync scheme version 2. */ -# define FEATURE_SPI_SYNC_SCHEME_VERSION_2 -# endif -/*@}*/ - -# ifndef PINMUX_DEFAULT -/** Default pinmux. */ -# define PINMUX_DEFAULT 0 -# endif - -# ifndef PINMUX_UNUSED -/** Unused pinmux. */ -# define PINMUX_UNUSED 0xFFFFFFFF -# endif - -# ifndef SPI_TIMEOUT -/** SPI timeout value. */ -# define SPI_TIMEOUT 10000 -# endif - -# if SPI_CALLBACK_MODE == true -/** - * \brief SPI Callback enum - * - * Callbacks for SPI callback driver. - * - * \note For slave mode, these callbacks will be called when a transaction - * is ended by the master pulling Slave Select high. - * - */ -enum spi_callback { - /** Callback for buffer transmitted */ - SPI_CALLBACK_BUFFER_TRANSMITTED, - /** Callback for buffer received */ - SPI_CALLBACK_BUFFER_RECEIVED, - /** Callback for buffers transceived */ - SPI_CALLBACK_BUFFER_TRANSCEIVED, - /** Callback for error */ - SPI_CALLBACK_ERROR, - /** - * Callback for transmission ended by master before the entire buffer was - * read or written from slave - */ - SPI_CALLBACK_SLAVE_TRANSMISSION_COMPLETE, -# ifdef FEATURE_SPI_SLAVE_SELECT_LOW_DETECT - /** Callback for slave select low */ - SPI_CALLBACK_SLAVE_SELECT_LOW, -# endif -# ifdef FEATURE_SPI_ERROR_INTERRUPT - /** Callback for combined error happen */ - SPI_CALLBACK_COMBINED_ERROR, -# endif -# if !defined(__DOXYGEN__) - /** Number of available callbacks */ - SPI_CALLBACK_N, -# endif -}; -# endif - -#if SPI_CALLBACK_MODE == true -# if !defined(__DOXYGEN__) -/** - * \internal SPI transfer directions - */ -enum _spi_direction { - /** Transfer direction is read */ - SPI_DIRECTION_READ, - /** Transfer direction is write */ - SPI_DIRECTION_WRITE, - /** Transfer direction is read and write */ - SPI_DIRECTION_BOTH, - /** No transfer */ - SPI_DIRECTION_IDLE, -}; -# endif -#endif - -/** - * \brief SPI Interrupt Flags - * - * Interrupt flags for the SPI module. - * - */ -enum spi_interrupt_flag { - /** - * This flag is set when the contents of the data register has been moved - * to the shift register and the data register is ready for new data - */ - SPI_INTERRUPT_FLAG_DATA_REGISTER_EMPTY = SERCOM_SPI_INTFLAG_DRE, - /** - * This flag is set when the contents of the shift register has been - * shifted out - */ - SPI_INTERRUPT_FLAG_TX_COMPLETE = SERCOM_SPI_INTFLAG_TXC, - /** This flag is set when data has been shifted into the data register */ - SPI_INTERRUPT_FLAG_RX_COMPLETE = SERCOM_SPI_INTFLAG_RXC, -# ifdef FEATURE_SPI_SLAVE_SELECT_LOW_DETECT - /** This flag is set when slave select low */ - SPI_INTERRUPT_FLAG_SLAVE_SELECT_LOW = SERCOM_SPI_INTFLAG_SSL, -# endif -# ifdef FEATURE_SPI_ERROR_INTERRUPT - /** This flag is set when combined error happen */ - SPI_INTERRUPT_FLAG_COMBINED_ERROR = SERCOM_SPI_INTFLAG_ERROR, -# endif -}; - -/** - * \brief SPI transfer modes enum - * - * SPI transfer mode. - */ -enum spi_transfer_mode { - /** Mode 0. Leading edge: rising, sample. Trailing edge: falling, setup */ - SPI_TRANSFER_MODE_0 = 0, - /** Mode 1. Leading edge: rising, setup. Trailing edge: falling, sample */ - SPI_TRANSFER_MODE_1 = SERCOM_SPI_CTRLA_CPHA, - /** Mode 2. Leading edge: falling, sample. Trailing edge: rising, setup */ - SPI_TRANSFER_MODE_2 = SERCOM_SPI_CTRLA_CPOL, - /** Mode 3. Leading edge: falling, setup. Trailing edge: rising, sample */ - SPI_TRANSFER_MODE_3 = SERCOM_SPI_CTRLA_CPHA | SERCOM_SPI_CTRLA_CPOL, -}; - -/** - * \brief SPI frame format enum - * - * Frame format for slave mode. - */ -enum spi_frame_format { - /** SPI frame */ - SPI_FRAME_FORMAT_SPI_FRAME = SERCOM_SPI_CTRLA_FORM(0), - /** SPI frame with address */ - SPI_FRAME_FORMAT_SPI_FRAME_ADDR = SERCOM_SPI_CTRLA_FORM(2), -}; - -/** - * \brief SPI signal MUX settings - * - * Set the functionality of the SERCOM pins. As not all combinations can be used - * in different modes of operation, proper combinations must be chosen according - * to the rest of the configuration. - * - * \note In master operation: DI is MISO, DO is MOSI. - * In slave operation: DI is MOSI, DO is MISO. - * - * See \ref asfdoc_sam0_sercom_spi_mux_settings for a description of the - * various MUX setting options. - */ -enum spi_signal_mux_setting { - /** SPI MUX combination A. DOPO: 0x0, DIPO: 0x0 */ - SPI_SIGNAL_MUX_SETTING_A = - (0x0 << SERCOM_SPI_CTRLA_DOPO_Pos) | - (0x0 << SERCOM_SPI_CTRLA_DIPO_Pos), - /** SPI MUX combination B. DOPO: 0x0, DIPO: 0x1 */ - SPI_SIGNAL_MUX_SETTING_B = - (0x0 << SERCOM_SPI_CTRLA_DOPO_Pos) | - (0x1 << SERCOM_SPI_CTRLA_DIPO_Pos), - /** SPI MUX combination C. DOPO: 0x0, DIPO: 0x2 */ - SPI_SIGNAL_MUX_SETTING_C = - (0x0 << SERCOM_SPI_CTRLA_DOPO_Pos) | - (0x2 << SERCOM_SPI_CTRLA_DIPO_Pos), - /** SPI MUX combination D. DOPO: 0x0, DIPO: 0x3 */ - SPI_SIGNAL_MUX_SETTING_D = - (0x0 << SERCOM_SPI_CTRLA_DOPO_Pos) | - (0x3 << SERCOM_SPI_CTRLA_DIPO_Pos), - /** SPI MUX combination E. DOPO: 0x1, DIPO: 0x0 */ - SPI_SIGNAL_MUX_SETTING_E = - (0x1 << SERCOM_SPI_CTRLA_DOPO_Pos) | - (0x0 << SERCOM_SPI_CTRLA_DIPO_Pos), - /** SPI MUX combination F. DOPO: 0x1, DIPO: 0x1 */ - SPI_SIGNAL_MUX_SETTING_F = - (0x1 << SERCOM_SPI_CTRLA_DOPO_Pos) | - (0x1 << SERCOM_SPI_CTRLA_DIPO_Pos), - /** SPI MUX combination G. DOPO: 0x1, DIPO: 0x2 */ - SPI_SIGNAL_MUX_SETTING_G = - (0x1 << SERCOM_SPI_CTRLA_DOPO_Pos) | - (0x2 << SERCOM_SPI_CTRLA_DIPO_Pos), - /** SPI MUX combination H. DOPO: 0x1, DIPO: 0x3 */ - SPI_SIGNAL_MUX_SETTING_H = - (0x1 << SERCOM_SPI_CTRLA_DOPO_Pos) | - (0x3 << SERCOM_SPI_CTRLA_DIPO_Pos), - /** SPI MUX combination I. DOPO: 0x2, DIPO: 0x0 */ - SPI_SIGNAL_MUX_SETTING_I = - (0x2 << SERCOM_SPI_CTRLA_DOPO_Pos) | - (0x0 << SERCOM_SPI_CTRLA_DIPO_Pos), - /** SPI MUX combination J. DOPO: 0x2, DIPO: 0x1 */ - SPI_SIGNAL_MUX_SETTING_J = - (0x2 << SERCOM_SPI_CTRLA_DOPO_Pos) | - (0x1 << SERCOM_SPI_CTRLA_DIPO_Pos), - /** SPI MUX combination K. DOPO: 0x2, DIPO: 0x2 */ - SPI_SIGNAL_MUX_SETTING_K = - (0x2 << SERCOM_SPI_CTRLA_DOPO_Pos) | - (0x2 << SERCOM_SPI_CTRLA_DIPO_Pos), - /** SPI MUX combination L. DOPO: 0x2, DIPO: 0x3 */ - SPI_SIGNAL_MUX_SETTING_L = - (0x2 << SERCOM_SPI_CTRLA_DOPO_Pos) | - (0x3 << SERCOM_SPI_CTRLA_DIPO_Pos), - /** SPI MUX combination M. DOPO: 0x3, DIPO: 0x0 */ - SPI_SIGNAL_MUX_SETTING_M = - (0x3 << SERCOM_SPI_CTRLA_DOPO_Pos) | - (0x0 << SERCOM_SPI_CTRLA_DIPO_Pos), - /** SPI MUX combination N. DOPO: 0x3, DIPO: 0x1 */ - SPI_SIGNAL_MUX_SETTING_N = - (0x3 << SERCOM_SPI_CTRLA_DOPO_Pos) | - (0x1 << SERCOM_SPI_CTRLA_DIPO_Pos), - /** SPI MUX combination O. DOPO: 0x3, DIPO: 0x2 */ - SPI_SIGNAL_MUX_SETTING_O = - (0x3 << SERCOM_SPI_CTRLA_DOPO_Pos) | - (0x2 << SERCOM_SPI_CTRLA_DIPO_Pos), - /** SPI MUX combination P. DOPO: 0x3, DIPO: 0x3 */ - SPI_SIGNAL_MUX_SETTING_P = - (0x3 << SERCOM_SPI_CTRLA_DOPO_Pos) | - (0x3 << SERCOM_SPI_CTRLA_DIPO_Pos), -}; - -/** - * \brief SPI address modes enum - * - * For slave mode when using the SPI frame with address format. - * - */ -enum spi_addr_mode { - /** - * \c address_mask in the \ref spi_config struct is used as a mask to the register - */ - SPI_ADDR_MODE_MASK = SERCOM_SPI_CTRLB_AMODE(0), - /** - * The slave responds to the two unique addresses in \c address and - * \c address_mask in the \ref spi_config struct - */ - SPI_ADDR_MODE_UNIQUE = SERCOM_SPI_CTRLB_AMODE(1), - /** - * The slave responds to the range of addresses between and including \c address - * and \c address_mask in the \ref spi_config struct - */ - SPI_ADDR_MODE_RANGE = SERCOM_SPI_CTRLB_AMODE(2), -}; - -/** - * \brief SPI modes enum - * - * SPI mode selection. - */ -enum spi_mode { - /** Master mode */ - SPI_MODE_MASTER = 1, - /** Slave mode */ - SPI_MODE_SLAVE = 0, -}; - -/** - * \brief SPI data order enum - * - * SPI data order. - * - */ -enum spi_data_order { - /** The LSB of the data is transmitted first */ - SPI_DATA_ORDER_LSB = SERCOM_SPI_CTRLA_DORD, - /** The MSB of the data is transmitted first */ - SPI_DATA_ORDER_MSB = 0, -}; - -/** - * \brief SPI character size enum - * - * SPI character size. - * - */ -enum spi_character_size { - /** 8-bit character */ - SPI_CHARACTER_SIZE_8BIT = SERCOM_SPI_CTRLB_CHSIZE(0), - /** 9-bit character */ - SPI_CHARACTER_SIZE_9BIT = SERCOM_SPI_CTRLB_CHSIZE(1), -}; - -# if SPI_CALLBACK_MODE == true -/** Prototype for the device instance */ -struct spi_module; - -/** Type of the callback functions */ -typedef void (*spi_callback_t)(struct spi_module *const module); - -# if !defined(__DOXYGEN__) -/** Prototype for the interrupt handler */ -extern void _spi_interrupt_handler(uint8_t instance); -# endif -# endif - -/** - * \brief SERCOM SPI driver software device instance structure. - * - * SERCOM SPI driver software instance structure, used to retain software state - * information of an associated hardware module instance. - * - * \note The fields of this structure should not be altered by the user - * application; they are reserved for module-internal use only. - */ -struct spi_module { -# if !defined(__DOXYGEN__) - /** SERCOM hardware module */ - Sercom *hw; - /** Module lock */ - volatile bool locked; - /** SPI mode */ - enum spi_mode mode; - /** SPI character size */ - enum spi_character_size character_size; - /** Receiver enabled */ - bool receiver_enabled; -# ifdef FEATURE_SPI_HARDWARE_SLAVE_SELECT - /** Enable Hardware Slave Select */ - bool master_slave_select_enable; -# endif -# if SPI_CALLBACK_MODE == true - /** Direction of transaction */ - volatile enum _spi_direction dir; - /** Array to store callback function pointers in */ - spi_callback_t callback[SPI_CALLBACK_N]; - /** Buffer pointer to where the next received character will be put */ - volatile uint8_t *rx_buffer_ptr; - /** Buffer pointer to where the next character will be transmitted from - **/ - volatile uint8_t *tx_buffer_ptr; - /** Remaining characters to receive */ - volatile uint16_t remaining_rx_buffer_length; - /** Remaining dummy characters to send when reading */ - volatile uint16_t remaining_dummy_buffer_length; - /** Remaining characters to transmit */ - volatile uint16_t remaining_tx_buffer_length; - /** Bit mask for callbacks registered */ - uint8_t registered_callback; - /** Bit mask for callbacks enabled */ - uint8_t enabled_callback; - /** Holds the status of the ongoing or last operation */ - volatile enum status_code status; -# endif -# endif -}; - -/** - * \brief SPI peripheral slave instance structure - * - * SPI peripheral slave software instance structure, used to configure the - * correct SPI transfer mode settings for an attached slave. See - * \ref spi_select_slave. - */ -struct spi_slave_inst { - /** Pin to use as slave select */ - uint8_t ss_pin; - /** Address recognition enabled in slave device */ - bool address_enabled; - /** Address of slave device */ - uint8_t address; -}; - -/** - * \brief SPI peripheral slave configuration structure - * - * SPI Peripheral slave configuration structure. - */ -struct spi_slave_inst_config { - /** Pin to use as slave select */ - uint8_t ss_pin; - /** Enable address */ - bool address_enabled; - /** Address of slave */ - uint8_t address; -}; - -/** - * \brief SPI Master configuration structure - * - * SPI Master configuration structure. - */ -struct spi_master_config { - /** Baud rate */ - uint32_t baudrate; -}; - -/** - * \brief SPI slave configuration structure - * - * SPI slave configuration structure. - */ -struct spi_slave_config { - /** Frame format */ - enum spi_frame_format frame_format; - /** Address mode */ - enum spi_addr_mode address_mode; - /** Address */ - uint8_t address; - /** Address mask */ - uint8_t address_mask; - /** Preload data to the shift register while SS is high */ - bool preload_enable; -}; - -/** - * \brief SPI configuration structure - * - * Configuration structure for an SPI instance. This structure should be - * initialized by the \ref spi_get_config_defaults function before being - * modified by the user application. - */ -struct spi_config { - /** SPI mode */ - enum spi_mode mode; - /** Data order */ - enum spi_data_order data_order; - /** Transfer mode */ - enum spi_transfer_mode transfer_mode; - /** MUX setting */ - enum spi_signal_mux_setting mux_setting; - /** SPI character size */ - enum spi_character_size character_size; - /** Enabled in sleep modes */ - bool run_in_standby; - /** Enable receiver */ - bool receiver_enable; -# ifdef FEATURE_SPI_SLAVE_SELECT_LOW_DETECT - /** Enable Slave Select Low Detect */ - bool select_slave_low_detect_enable; -# endif -# ifdef FEATURE_SPI_HARDWARE_SLAVE_SELECT - /** Enable Master Slave Select */ - bool master_slave_select_enable; -# endif - /** Union for slave or master specific configuration */ - union { - /** Slave specific configuration */ - struct spi_slave_config slave; - /** Master specific configuration */ - struct spi_master_config master; - } mode_specific; - /** GCLK generator to use as clock source */ - enum gclk_generator generator_source; - /** PAD0 pinmux */ - uint32_t pinmux_pad0; - /** PAD1 pinmux */ - uint32_t pinmux_pad1; - /** PAD2 pinmux */ - uint32_t pinmux_pad2; - /** PAD3 pinmux */ - uint32_t pinmux_pad3; -}; - -/** - * \brief Determines if the SPI module is currently synchronizing to the bus. - * - * This function will check if the underlying hardware peripheral module is - * currently synchronizing across multiple clock domains to the hardware bus. - * This function can be used to delay further operations on the module until it - * is ready. - * - * \param[in] module SPI hardware module - * - * \return Synchronization status of the underlying hardware module. - * \retval true Module synchronization is ongoing - * \retval false Module synchronization is not ongoing - * - */ -static inline bool spi_is_syncing( - struct spi_module *const module) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - SercomSpi *const spi_module = &(module->hw->SPI); - -# ifdef FEATURE_SPI_SYNC_SCHEME_VERSION_2 - /* Return synchronization status */ - return (spi_module->SYNCBUSY.reg); -# else - /* Return synchronization status */ - return (spi_module->STATUS.reg & SERCOM_SPI_STATUS_SYNCBUSY); -# endif -} - -/** - * \name Driver Initialization and Configuration - * @{ - */ - -/** - * \brief Initializes an SPI configuration structure to default values - * - * This function will initialize a given SPI configuration structure to a set - * of known default values. This function should be called on any new - * instance of the configuration structures before being modified by the - * user application. - * - * The default configuration is as follows: - * \li Master mode enabled - * \li MSB of the data is transmitted first - * \li Transfer mode 0 - * \li MUX Setting D - * \li Character size eight bits - * \li Not enabled in sleep mode - * \li Receiver enabled - * \li Baudrate 100000 - * \li Default pinmux settings for all pads - * \li GCLK generator 0 - * - * \param[out] config Configuration structure to initialize to default values - */ -static inline void spi_get_config_defaults( - struct spi_config *const config) -{ - /* Sanity check arguments */ - Assert(config); - - /* Default configuration values */ - config->mode = SPI_MODE_MASTER; - config->data_order = SPI_DATA_ORDER_MSB; - config->transfer_mode = SPI_TRANSFER_MODE_0; - config->mux_setting = SPI_SIGNAL_MUX_SETTING_D; - config->character_size = SPI_CHARACTER_SIZE_8BIT; - config->run_in_standby = false; - config->receiver_enable = true; -# ifdef FEATURE_SPI_SLAVE_SELECT_LOW_DETECT - config->select_slave_low_detect_enable= true; -# endif -# ifdef FEATURE_SPI_HARDWARE_SLAVE_SELECT - config->master_slave_select_enable= false; -# endif - config->generator_source = GCLK_GENERATOR_0; - - /* Clear mode specific config */ - memset(&(config->mode_specific), 0, sizeof(config->mode_specific)); - - /* Master config defaults */ - config->mode_specific.master.baudrate = 100000; - - /* pinmux config defaults */ - config->pinmux_pad0 = PINMUX_DEFAULT; - config->pinmux_pad1 = PINMUX_DEFAULT; - config->pinmux_pad2 = PINMUX_DEFAULT; - config->pinmux_pad3 = PINMUX_DEFAULT; - -}; - -/** - * \brief Initializes an SPI peripheral slave device configuration structure to default values - * - * This function will initialize a given SPI slave device configuration - * structure to a set of known default values. This function should be called - * on any new instance of the configuration structures before being modified by - * the user application. - * - * The default configuration is as follows: - * \li Slave Select on GPIO pin 10 - * \li Addressing not enabled - * - * \param[out] config Configuration structure to initialize to default values - */ -static inline void spi_slave_inst_get_config_defaults( - struct spi_slave_inst_config *const config) -{ - Assert(config); - - config->ss_pin = 10; - config->address_enabled = false; - config->address = 0; -} - -/** - * \brief Attaches an SPI peripheral slave - * - * This function will initialize the software SPI peripheral slave, based on - * the values of the config struct. The slave can then be selected and - * optionally addressed by the \ref spi_select_slave function. - * - * \param[out] slave Pointer to the software slave instance struct - * \param[in] config Pointer to the config struct - * - */ -static inline void spi_attach_slave( - struct spi_slave_inst *const slave, - const struct spi_slave_inst_config *const config) -{ - Assert(slave); - Assert(config); - - slave->ss_pin = config->ss_pin; - slave->address_enabled = config->address_enabled; - slave->address = config->address; - - /* Get default config for pin */ - struct port_config pin_conf; - port_get_config_defaults(&pin_conf); - - /* Edit config to set the pin as output */ - pin_conf.direction = PORT_PIN_DIR_OUTPUT; - - /* Set config on Slave Select pin */ - port_pin_set_config(slave->ss_pin, &pin_conf); - port_pin_set_output_level(slave->ss_pin, true); -} - -enum status_code spi_init( - struct spi_module *const module, - Sercom *const hw, - const struct spi_config *const config); - -/** @} */ - -/** - * \name Enable/Disable - * @{ - */ - -/** - * \brief Enables the SERCOM SPI module - * - * This function will enable the SERCOM SPI module. - * - * \param[in,out] module Pointer to the software instance struct - */ -static inline void spi_enable( - struct spi_module *const module) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - SercomSpi *const spi_module = &(module->hw->SPI); - -# if SPI_CALLBACK_MODE == true - system_interrupt_enable(_sercom_get_interrupt_vector(module->hw)); -# endif - - while (spi_is_syncing(module)) { - /* Wait until the synchronization is complete */ - } - - /* Enable SPI */ - spi_module->CTRLA.reg |= SERCOM_SPI_CTRLA_ENABLE; -} - -/** - * \brief Disables the SERCOM SPI module - * - * This function will disable the SERCOM SPI module. - * - * \param[in,out] module Pointer to the software instance struct - */ -static inline void spi_disable( - struct spi_module *const module) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - SercomSpi *const spi_module = &(module->hw->SPI); - -# if SPI_CALLBACK_MODE == true - system_interrupt_disable(_sercom_get_interrupt_vector(module->hw)); -# endif - - while (spi_is_syncing(module)) { - /* Wait until the synchronization is complete */ - } - - /* Disbale interrupt */ - spi_module->INTENCLR.reg = SERCOM_SPI_INTENCLR_MASK; - /* Clear interrupt flag */ - spi_module->INTFLAG.reg = SERCOM_SPI_INTFLAG_MASK; - - /* Disable SPI */ - spi_module->CTRLA.reg &= ~SERCOM_SPI_CTRLA_ENABLE; -} - -void spi_reset( - struct spi_module *const module); - -/** @} */ - -enum status_code spi_set_baudrate( - struct spi_module *const module, - uint32_t baudrate); - -/** - * \name Lock/Unlock - * @{ - */ - -/** - * \brief Attempt to get lock on driver instance - * - * This function checks the instance's lock, which indicates whether or not it - * is currently in use, and sets the lock if it was not already set. - * - * The purpose of this is to enable exclusive access to driver instances, so - * that, e.g., transactions by different services will not interfere with each - * other. - * - * \param[in,out] module Pointer to the driver instance to lock - * - * \retval STATUS_OK If the module was locked - * \retval STATUS_BUSY If the module was already locked - */ -static inline enum status_code spi_lock(struct spi_module *const module) -{ - enum status_code status; - - system_interrupt_enter_critical_section(); - - if (module->locked) { - status = STATUS_BUSY; - } else { - module->locked = true; - status = STATUS_OK; - } - - system_interrupt_leave_critical_section(); - - return status; -} - -/** - * \brief Unlock driver instance - * - * This function clears the instance lock, indicating that it is available for - * use. - * - * \param[in,out] module Pointer to the driver instance to lock - * - * \retval STATUS_OK If the module was locked - * \retval STATUS_BUSY If the module was already locked - */ -static inline void spi_unlock(struct spi_module *const module) -{ - module->locked = false; -} - -/** @} */ - -/** - * \name Ready to Write/Read - * @{ - */ - - /** - * \brief Checks if the SPI in master mode has shifted out last data, or if the master has ended the transfer in slave mode. - * - * This function will check if the SPI master module has shifted out last data, - * or if the slave select pin has been drawn high by the master for the SPI - * slave module. - * - * \param[in] module Pointer to the software instance struct - * - * \return Indication of whether any writes are ongoing. - * \retval true If the SPI master module has shifted out data, or slave select - * has been drawn high for SPI slave - * \retval false If the SPI master module has not shifted out data - */ -static inline bool spi_is_write_complete( - struct spi_module *const module) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - SercomSpi *const spi_module = &(module->hw->SPI); - - /* Check interrupt flag */ - return (spi_module->INTFLAG.reg & SERCOM_SPI_INTFLAG_TXC); -} - - /** - * \brief Checks if the SPI module is ready to write data - * - * This function will check if the SPI module is ready to write data. - * - * \param[in] module Pointer to the software instance struct - * - * \return Indication of whether the module is ready to read data or not. - * \retval true If the SPI module is ready to write data - * \retval false If the SPI module is not ready to write data - */ -static inline bool spi_is_ready_to_write( - struct spi_module *const module) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - SercomSpi *const spi_module = &(module->hw->SPI); - - /* Check interrupt flag */ - return (spi_module->INTFLAG.reg & SERCOM_SPI_INTFLAG_DRE); -} - -/** - * \brief Checks if the SPI module is ready to read data - * - * This function will check if the SPI module is ready to read data. - * - * \param[in] module Pointer to the software instance struct - * - * \return Indication of whether the module is ready to read data or not. - * \retval true If the SPI module is ready to read data - * \retval false If the SPI module is not ready to read data - */ -static inline bool spi_is_ready_to_read( - struct spi_module *const module) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - SercomSpi *const spi_module = &(module->hw->SPI); - - /* Check interrupt flag */ - return (spi_module->INTFLAG.reg & SERCOM_SPI_INTFLAG_RXC); -} -/** @} */ - -/** - * \name Read/Write - * @{ - */ - - /** - * \brief Transfers a single SPI character - * - * This function will send a single SPI character via SPI and ignore any data - * shifted in by the connected device. To both send and receive data, use the - * \ref spi_transceive_wait function or use the \ref spi_read function after - * writing a character. The \ref spi_is_ready_to_write function - * should be called before calling this function. - * - * Note that this function does not handle the SS (Slave Select) - * pin(s) in master mode; this must be handled from the user application. - * - * \note In slave mode, the data will not be transferred before a master - * initiates a transaction. - * - * \param[in] module Pointer to the software instance struct - * \param[in] tx_data Data to transmit - * - * \return Status of the procedure. - * \retval STATUS_OK If the data was written - * \retval STATUS_BUSY If the last write was not completed - */ -static inline enum status_code spi_write( - struct spi_module *module, - uint16_t tx_data) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - SercomSpi *const spi_module = &(module->hw->SPI); - - /* Check if the data register has been copied to the shift register */ - if (!spi_is_ready_to_write(module)) { - /* Data register has not been copied to the shift register, return */ - return STATUS_BUSY; - } - - /* Write the character to the DATA register */ - spi_module->DATA.reg = tx_data & SERCOM_SPI_DATA_MASK; - - return STATUS_OK; -} - -enum status_code spi_write_buffer_wait( - struct spi_module *const module, - const uint8_t *tx_data, - uint16_t length); - -/** - * \brief Reads last received SPI character - * - * This function will return the last SPI character shifted into the receive - * register by the \ref spi_write function. - * - * \note The \ref spi_is_ready_to_read function should be called before calling - * this function. - * - * \note Receiver must be enabled in the configuration. - * - * \param[in] module Pointer to the software instance struct - * \param[out] rx_data Pointer to store the received data - * - * \returns Status of the read operation. - * \retval STATUS_OK If data was read - * \retval STATUS_ERR_IO If no data is available - * \retval STATUS_ERR_OVERFLOW If the data is overflown - */ -static inline enum status_code spi_read( - struct spi_module *const module, - uint16_t *rx_data) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - SercomSpi *const spi_module = &(module->hw->SPI); - - /* Check if data is ready to be read */ - if (!spi_is_ready_to_read(module)) { - /* No data has been received, return */ - return STATUS_ERR_IO; - } - - /* Return value */ - enum status_code retval = STATUS_OK; - - /* Check if data is overflown */ - if (spi_module->STATUS.reg & SERCOM_SPI_STATUS_BUFOVF) { - retval = STATUS_ERR_OVERFLOW; - /* Clear overflow flag */ - spi_module->STATUS.reg = SERCOM_SPI_STATUS_BUFOVF; - } - - /* Read the character from the DATA register */ - if (module->character_size == SPI_CHARACTER_SIZE_9BIT) { - *rx_data = (spi_module->DATA.reg & SERCOM_SPI_DATA_MASK); - } else { - *rx_data = (uint8_t)spi_module->DATA.reg; - } - - return retval; -} - -enum status_code spi_read_buffer_wait( - struct spi_module *const module, - uint8_t *rx_data, - uint16_t length, - uint16_t dummy); - -enum status_code spi_transceive_wait( - struct spi_module *const module, - uint16_t tx_data, - uint16_t *rx_data); - -enum status_code spi_transceive_buffer_wait( - struct spi_module *const module, - uint8_t *tx_data, - uint8_t *rx_data, - uint16_t length); - -enum status_code spi_select_slave( - struct spi_module *const module, - struct spi_slave_inst *const slave, - bool select); - -/** @} */ - -#ifdef __cplusplus -} -#endif - -/** @} */ - - -/** - * \page asfdoc_sam0_sercom_spi_extra Extra Information for SERCOM SPI Driver - * - * \section asfdoc_sam0_sercom_spi_extra_acronyms Acronyms - * Below is a table listing the acronyms used in this module, along with their - * intended meanings. - * - * <table> - * <tr> - * <th>Acronym</th> - * <th>Description</th> - * </tr> - * <tr> - * <td>SERCOM</td> - * <td>Serial Communication Interface</td> - * </tr> - * <tr> - * <td>SPI</td> - * <td>Serial Peripheral Interface</td> - * </tr> - * <tr> - * <td>SCK</td> - * <td>Serial Clock</td> - * </tr> - * <tr> - * <td>MOSI</td> - * <td>Master Output Slave Input</td> - * </tr> - * <tr> - * <td>MISO</td> - * <td>Master Input Slave Output</td> - * </tr> - * <tr> - * <td>SS</td> - * <td>Slave Select</td> - * </tr> - * <tr> - * <td>DIO</td> - * <td>Data Input Output</td> - * </tr> - * <tr> - * <td>DO</td> - * <td>Data Output</td> - * </tr> - * <tr> - * <td>DI</td> - * <td>Data Input</td> - * </tr> - * <tr> - * <td>DMA</td> - * <td>Direct Memory Access</td> - * </tr> - * </table> - * - * \section asfdoc_sam0_sercom_spi_extra_dependencies Dependencies - * The SPI driver has the following dependencies: - * \li \ref asfdoc_sam0_system_pinmux_group "System Pin Multiplexer Driver" - * - * - * \section asfdoc_sam0_sercom_spi_extra_workarounds Workarounds Implemented by Driver - * No workarounds in driver. - * - * \section asfdoc_sam0_sercom_spi_extra_history Module History - * An overview of the module history is presented in the table below, with - * details on the enhancements and fixes made to the module since its first - * release. The current version of this corresponds to the newest version in the table. - * - * <table> - * <tr> - * <th>Changelog</th> - * </tr> - * <tr> - * <td>Added new features as below: - * \li Slave select low detect - * \li Hardware slave select - * \li DMA support </td> - * </tr> - * <tr> - * <td>Edited slave part of write and transceive buffer functions to ensure - * that second character is sent at the right time</td> - * </tr> - * <tr> - * <td>Renamed the anonymous union in \c struct spi_config to - * \c mode_specific</td> - * </tr> - * <tr> - * <td>Initial Release</td> - * </tr> - * </table> - */ - -/** - * \page asfdoc_sam0_sercom_spi_exqsg Examples for SERCOM SPI Driver - * - * This is a list of the available Quick Start guides (QSGs) and example - * applications for \ref asfdoc_sam0_sercom_spi_group. QSGs are simple examples with - * step-by-step instructions to configure and use this driver in a selection of - * use cases. Note that a QSG can be compiled as a standalone application or be - * added to the user application. - * - * - \subpage asfdoc_sam0_sercom_spi_master_basic_use - * - \subpage asfdoc_sam0_sercom_spi_slave_basic_use - * \if SPI_CALLBACK_MODE - * - \subpage asfdoc_sam0_sercom_spi_master_callback_use - * - \subpage asfdoc_sam0_sercom_spi_slave_callback_use - * \endif - * - \subpage asfdoc_sam0_sercom_spi_dma_use_case - */ - - /** - * \page asfdoc_sam0_sercom_spi_mux_settings MUX Settings - * - * The following lists the possible internal SERCOM module pad function - * assignments for the four SERCOM pads in both SPI Master and SPI Slave - * modes. They are combinations of DOPO and DIPO in CTRLA. - * Note that this is in addition to the physical GPIO pin MUX of the device, - * and can be used in conjunction to optimize the serial data pin-out. - * - * \section asfdoc_sam0_sercom_spi_mux_settings_master Master Mode Settings - * The following table describes the SERCOM pin functionalities for the various - * MUX settings, whilst in SPI Master mode. - * - * \note If MISO is unlisted, the SPI receiver must not be enabled for the - * given MUX setting. - * - * <table> - * <tr> - * <th>Combination</th> - * <th>DOPO / DIPO</th> - * <th>SERCOM PAD[0]</th> - * <th>SERCOM PAD[1]</th> - * <th>SERCOM PAD[2]</th> - * <th>SERCOM PAD[3]</th> - * </tr> - * <tr> - * <td>A</td> - * <td>0x0 / 0x0</td> - * <td>MOSI</td> - * <td>SCK</td> - * <td>-</td> - * <td>-</td> - * </tr> - * <tr> - * <td>B</td> - * <td>0x0 / 0x1</td> - * <td>MOSI</td> - * <td>SCK</td> - * <td>-</td> - * <td>-</td> - * </tr> - * <tr> - * <td>C</td> - * <td>0x0 / 0x2</td> - * <td>MOSI</td> - * <td>SCK</td> - * <td>MISO</td> - * <td>-</td> - * </tr> - * <tr> - * <td>D</td> - * <td>0x0 / 0x3</td> - * <td>MOSI</td> - * <td>SCK</td> - * <td>-</td> - * <td>MISO</td> - * </tr> - * <tr> - * <td>E</td> - * <td>0x1 / 0x0</td> - * <td>MISO</td> - * <td>-</td> - * <td>MOSI</td> - * <td>SCK</td> - * </tr> - * <tr> - * <td>F</td> - * <td>0x1 / 0x1</td> - * <td>-</td> - * <td>MISO</td> - * <td>MOSI</td> - * <td>SCK</td> - * </tr> - * <tr> - * <td>G</td> - * <td>0x1 / 0x2</td> - * <td>-</td> - * <td>-</td> - * <td>MOSI</td> - * <td>SCK</td> - * </tr> - * <tr> - * <td>H</td> - * <td>0x1 / 0x3</td> - * <td>-</td> - * <td>-</td> - * <td>MOSI</td> - * <td>SCK</td> - * </tr> - * <tr> - * <td>I</td> - * <td>0x2 / 0x0</td> - * <td>MISO</td> - * <td>SCK</td> - * <td>-</td> - * <td>MOSI</td> - * </tr> - * <tr> - * <td>J</td> - * <td>0x2 / 0x1</td> - * <td>-</td> - * <td>SCK</td> - * <td>-</td> - * <td>MOSI</td> - * </tr> - * <tr> - * <td>K</td> - * <td>0x2 / 0x2</td> - * <td>-</td> - * <td>SCK</td> - * <td>MISO</td> - * <td>MOSI</td> - * </tr> - * <tr> - * <td>L</td> - * <td>0x2 / 0x3</td> - * <td>-</td> - * <td>SCK</td> - * <td>-</td> - * <td>MOSI</td> - * </tr> - * <tr> - * <td>M</td> - * <td>0x3 / 0x0</td> - * <td>MOSI</td> - * <td>-</td> - * <td>-</td> - * <td>SCK</td> - * </tr> - * <tr> - * <td>N</td> - * <td>0x3 / 0x1</td> - * <td>MOSI</td> - * <td>MISO</td> - * <td>-</td> - * <td>SCK</td> - * </tr> - * <tr> - * <td>O</td> - * <td>0x3 / 0x2</td> - * <td>MOSI</td> - * <td>-</td> - * <td>MISO</td> - * <td>SCK</td> - * </tr> - * <tr> - * <td>P</td> - * <td>0x3 / 0x3</td> - * <td>MOSI</td> - * <td>-</td> - * <td>-</td> - * <td>SCK</td> - * </tr> - * </table> - * - * - * \section asfdoc_sam0_sercom_spi_mux_settings_slave Slave Mode Settings - * The following table describes the SERCOM pin functionalities for the various - * MUX settings, whilst in SPI Slave mode. - * - * \note If MISO is unlisted, the SPI receiver must not be enabled for the - * given MUX setting. - * - * <table> - * <tr> - * <th>Combination</th> - * <th>DOPO / DIPO</th> - * <th>SERCOM PAD[0]</th> - * <th>SERCOM PAD[1]</th> - * <th>SERCOM PAD[2]</th> - * <th>SERCOM PAD[3]</th> - * </tr> - * <tr> - * <td>A</td> - * <td>0x0 / 0x0</td> - * <td>MISO</td> - * <td>SCK</td> - * <td>/SS</td> - * <td>-</td> - * </tr> - * <tr> - * <td>B</td> - * <td>0x0 / 0x1</td> - * <td>MISO</td> - * <td>SCK</td> - * <td>/SS</td> - * <td>-</td> - * </tr> - * <tr> - * <td>C</td> - * <td>0x0 / 0x2</td> - * <td>MISO</td> - * <td>SCK</td> - * <td>/SS</td> - * <td>-</td> - * </tr> - * <tr> - * <td>D</td> - * <td>0x0 / 0x3</td> - * <td>MISO</td> - * <td>SCK</td> - * <td>/SS</td> - * <td>MOSI</td> - * </tr> - * <tr> - * <td>E</td> - * <td>0x1 / 0x0</td> - * <td>MOSI</td> - * <td>/SS</td> - * <td>MISO</td> - * <td>SCK</td> - * </tr> - * <tr> - * <td>F</td> - * <td>0x1 / 0x1</td> - * <td>-</td> - * <td>/SS</td> - * <td>MISO</td> - * <td>SCK</td> - * </tr> - * <tr> - * <td>G</td> - * <td>0x1 / 0x2</td> - * <td>-</td> - * <td>/SS</td> - * <td>MISO</td> - * <td>SCK</td> - * </tr> - * <tr> - * <td>H</td> - * <td>0x1 / 0x3</td> - * <td>-</td> - * <td>/SS</td> - * <td>MISO</td> - * <td>SCK</td> - * </tr> - * <tr> - * <td>I</td> - * <td>0x2 / 0x0</td> - * <td>MOSI</td> - * <td>SCK</td> - * <td>/SS</td> - * <td>MISO</td> - * </tr> - * <tr> - * <td>J</td> - * <td>0x2 / 0x1</td> - * <td>-</td> - * <td>SCK</td> - * <td>/SS</td> - * <td>MISO</td> - * </tr> - * <tr> - * <td>K</td> - * <td>0x2 / 0x2</td> - * <td>-</td> - * <td>SCK</td> - * <td>/SS</td> - * <td>MISO</td> - * </tr> - * <tr> - * <td>L</td> - * <td>0x2 / 0x3</td> - * <td>-</td> - * <td>SCK</td> - * <td>/SS</td> - * <td>MISO</td> - * </tr> - * <tr> - * <td>M</td> - * <td>0x3 / 0x0</td> - * <td>MISO</td> - * <td>/SS</td> - * <td>-</td> - * <td>SCK</td> - * </tr> - * <tr> - * <td>N</td> - * <td>0x3 / 0x1</td> - * <td>MISO</td> - * <td>/SS</td> - * <td>-</td> - * <td>SCK</td> - * </tr> - * <tr> - * <td>O</td> - * <td>0x3 / 0x2</td> - * <td>MISO</td> - * <td>/SS</td> - * <td>MOSI</td> - * <td>SCK</td> - * </tr> - * <tr> - * <td>P</td> - * <td>0x3 / 0x3</td> - * <td>MISO</td> - * <td>/SS</td> - * <td>-</td> - * <td>SCK</td> - * </tr> - * </table> - * - * - * - * \page asfdoc_sam0_sercom_spi_document_revision_history Document Revision History - * - * <table> - * <tr> - * <th>Doc. Rev.</th> - * <th>Date</th> - * <th>Comments</th> - * </tr> - * <tr> - * <td>42115E</td> - * <td>12/2015</td> - * <td>Add SAM L21/L22, SAM DA1, SAM D09, SAMR30 and SAM C21 support</td> - * </tr> - * <tr> - * <td>42115D</td> - * <td>12/2014</td> - * <td>Add SAM R21/D10/D11 support</td> - * </tr> - * <tr> - * <td>42115C</td> - * <td>01/2014</td> - * <td>Add SAM D21 support</td> - * </tr> - * <tr> - * <td>42115B</td> - * <td>11/2013</td> - * <td>Replaced the pad multiplexing documentation with a condensed table</td> - * </tr> - * <tr> - * <td>42115A</td> - * <td>06/2013</td> - * <td>Initial release</td> - * </tr> - * </table> - */ - -#endif /* SPI_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/sercom/spi/spi_interrupt.c b/atmel-samd/asf/sam0/drivers/sercom/spi/spi_interrupt.c deleted file mode 100644 index 5909843b2..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/spi/spi_interrupt.c +++ /dev/null @@ -1,741 +0,0 @@ -/** - * \file - * - * \brief SAM Serial Peripheral Interface Driver - * - * Copyright (c) 2013-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#include "spi_interrupt.h" - -/** - * \internal - * - * Dummy byte to send when reading in master mode. - */ -uint16_t dummy_write; - -/** - * \internal - * Starts transceive of buffers with a given length - * - * \param[in] module Pointer to SPI software instance struct - * \param[in] rx_data Pointer to data to be received - * \param[in] tx_data Pointer to data to be transmitted - * \param[in] length Length of data buffer - * - */ -static void _spi_transceive_buffer( - struct spi_module *const module, - uint8_t *tx_data, - uint8_t *rx_data, - uint16_t length) -{ - Assert(module); - Assert(tx_data); - - /* Write parameters to the device instance */ - module->remaining_tx_buffer_length = length; - module->remaining_rx_buffer_length = length; - module->rx_buffer_ptr = rx_data; - module->tx_buffer_ptr = tx_data; - module->status = STATUS_BUSY; - - module->dir = SPI_DIRECTION_BOTH; - - /* Get a pointer to the hardware module instance */ - SercomSpi *const hw = &(module->hw->SPI); - - /* Enable the Data Register Empty and RX Complete Interrupt */ - hw->INTENSET.reg = (SPI_INTERRUPT_FLAG_DATA_REGISTER_EMPTY | - SPI_INTERRUPT_FLAG_RX_COMPLETE); - -# if CONF_SPI_SLAVE_ENABLE == true - if (module->mode == SPI_MODE_SLAVE) { - /* Clear TXC flag if set */ - hw->INTFLAG.reg = SPI_INTERRUPT_FLAG_TX_COMPLETE; - /* Enable transmit complete interrupt for slave */ - hw->INTENSET.reg = SPI_INTERRUPT_FLAG_TX_COMPLETE; - } -# endif -} - -/** - * \internal - * Starts write of a buffer with a given length - * - * \param[in] module Pointer to SPI software instance struct - * \param[in] tx_data Pointer to data to be transmitted - * \param[in] length Length of data buffer - * - */ -static void _spi_write_buffer( - struct spi_module *const module, - uint8_t *tx_data, - uint16_t length) -{ - Assert(module); - Assert(tx_data); - - /* Write parameters to the device instance */ - module->remaining_tx_buffer_length = length; - module->remaining_dummy_buffer_length = length; - module->tx_buffer_ptr = tx_data; - module->status = STATUS_BUSY; - - module->dir = SPI_DIRECTION_WRITE; - - /* Get a pointer to the hardware module instance */ - SercomSpi *const hw = &(module->hw->SPI); - -# if CONF_SPI_SLAVE_ENABLE == true - if (module->mode == SPI_MODE_SLAVE) { - /* Clear TXC flag if set */ - hw->INTFLAG.reg = SPI_INTERRUPT_FLAG_TX_COMPLETE; - /* Enable transmit complete interrupt for slave */ - hw->INTENSET.reg = SPI_INTERRUPT_FLAG_TX_COMPLETE; - } -# endif - - if (module->receiver_enabled) { - /* Enable the Data Register Empty and RX Complete interrupt */ - hw->INTENSET.reg = (SPI_INTERRUPT_FLAG_DATA_REGISTER_EMPTY | - SPI_INTERRUPT_FLAG_RX_COMPLETE); - } else { - /* Enable the Data Register Empty interrupt */ - hw->INTENSET.reg = SPI_INTERRUPT_FLAG_DATA_REGISTER_EMPTY; - } -} - -/** - * \internal - * Setup SPI to read a buffer with a given length - * - * \param[in] module Pointer to SPI software instance struct - * \param[in] rx_data Pointer to data to be received - * \param[in] length Length of data buffer - * - */ -static void _spi_read_buffer( - struct spi_module *const module, - uint8_t *rx_data, - uint16_t length) -{ - Assert(module); - Assert(rx_data); - - uint8_t tmp_intenset = 0; - - /* Set length for the buffer and the pointer, and let - * the interrupt handler do the rest */ - module->remaining_rx_buffer_length = length; - module->remaining_dummy_buffer_length = length; - module->rx_buffer_ptr = rx_data; - module->status = STATUS_BUSY; - - module->dir = SPI_DIRECTION_READ; - - /* Get a pointer to the hardware module instance */ - SercomSpi *const hw = &(module->hw->SPI); - - /* Enable the RX Complete Interrupt */ - tmp_intenset = SPI_INTERRUPT_FLAG_RX_COMPLETE; - -# if CONF_SPI_MASTER_ENABLE == true - if (module->mode == SPI_MODE_MASTER && module->dir == SPI_DIRECTION_READ) { - /* Enable Data Register Empty interrupt for master */ - tmp_intenset |= SPI_INTERRUPT_FLAG_DATA_REGISTER_EMPTY; - } -# endif -# if CONF_SPI_SLAVE_ENABLE == true - if (module->mode == SPI_MODE_SLAVE) { - /* Clear TXC flag if set */ - hw->INTFLAG.reg = SPI_INTERRUPT_FLAG_TX_COMPLETE; - /* Enable transmit complete interrupt for slave */ - tmp_intenset |= SPI_INTERRUPT_FLAG_TX_COMPLETE; - - /* Workaround for SSL flag enable */ -#ifdef FEATURE_SPI_SLAVE_SELECT_LOW_DETECT - /* Clear SSL flag if set */ - hw->INTFLAG.reg = SPI_INTERRUPT_FLAG_SLAVE_SELECT_LOW; - /* Enable Slave Select Low Interrupt for slave */ - tmp_intenset |= SPI_INTERRUPT_FLAG_SLAVE_SELECT_LOW; -#endif - } -# endif - - /* Enable all interrupts simultaneously */ - hw->INTENSET.reg = tmp_intenset; -} - -/** - * \brief Registers a SPI callback function - * - * Registers a callback function which is implemented by the user. - * - * \note The callback must be enabled by \ref spi_enable_callback, in order - * for the interrupt handler to call it when the conditions for the - * callback type are met. - * - * \param[in] module Pointer to USART software instance struct - * \param[in] callback_func Pointer to callback function - * \param[in] callback_type Callback type given by an enum - * - */ -void spi_register_callback( - struct spi_module *const module, - spi_callback_t callback_func, - enum spi_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module); - Assert(callback_func); - - /* Register callback function */ - module->callback[callback_type] = callback_func; - - /* Set the bit corresponding to the callback_type */ - module->registered_callback |= (1 << callback_type); -} - -/** - * \brief Unregisters a SPI callback function - * - * Unregisters a callback function which is implemented by the user. - * - * \param[in] module Pointer to SPI software instance struct - * \param[in] callback_type Callback type given by an enum - * - */ -void spi_unregister_callback( - struct spi_module *const module, - enum spi_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module); - - /* Unregister callback function */ - module->callback[callback_type] = NULL; - - /* Clear the bit corresponding to the callback_type */ - module->registered_callback &= ~(1 << callback_type); -} - -/** - * \brief Asynchronous buffer write - * - * Sets up the driver to write to the SPI from a given buffer. If registered - * and enabled, a callback function will be called when the write is finished. - * - * \param[in] module Pointer to SPI software instance struct - * \param[out] tx_data Pointer to data buffer to receive - * \param[in] length Data buffer length - * - * \returns Status of the write request operation. - * \retval STATUS_OK If the operation completed successfully - * \retval STATUS_ERR_BUSY If the SPI was already busy with a write - * operation - * \retval STATUS_ERR_INVALID_ARG If requested write length was zero - */ -enum status_code spi_write_buffer_job( - struct spi_module *const module, - uint8_t *tx_data, - uint16_t length) -{ - Assert(module); - Assert(tx_data); - - if (length == 0) { - return STATUS_ERR_INVALID_ARG; - } - - /* Check if the SPI is busy transmitting or slave waiting for TXC*/ - if (module->status == STATUS_BUSY) { - return STATUS_BUSY; - } - - /* Issue internal write */ - _spi_write_buffer(module, tx_data, length); - - return STATUS_OK; -} - -/** - * \brief Asynchronous buffer read - * - * Sets up the driver to read from the SPI to a given buffer. If registered - * and enabled, a callback function will be called when the read is finished. - * - * \note If address matching is enabled for the slave, the first character - * received and placed in the RX buffer will be the address. - * - * \param[in] module Pointer to SPI software instance struct - * \param[out] rx_data Pointer to data buffer to receive - * \param[in] length Data buffer length - * \param[in] dummy Dummy character to send when reading in master mode - * - * \returns Status of the operation. - * \retval STATUS_OK If the operation completed successfully - * \retval STATUS_ERR_BUSY If the SPI was already busy with a read - * operation - * \retval STATUS_ERR_DENIED If the receiver is not enabled - * \retval STATUS_ERR_INVALID_ARG If requested read length was zero - */ -enum status_code spi_read_buffer_job( - struct spi_module *const module, - uint8_t *rx_data, - uint16_t length, - uint16_t dummy) -{ - /* Sanity check arguments */ - Assert(module); - Assert(rx_data); - - if (length == 0) { - return STATUS_ERR_INVALID_ARG; - } - - if (!(module->receiver_enabled)) { - return STATUS_ERR_DENIED; - } - - /* Check if the SPI is busy transmitting or slave waiting for TXC*/ - if (module->status == STATUS_BUSY) { - return STATUS_BUSY; - } - - dummy_write = dummy; - /* Issue internal read */ - _spi_read_buffer(module, rx_data, length); - return STATUS_OK; -} - -/** - * \brief Asynchronous buffer write and read - * - * Sets up the driver to write and read to and from given buffers. If registered - * and enabled, a callback function will be called when the transfer is finished. - * - * \note If address matching is enabled for the slave, the first character - * received and placed in the RX buffer will be the address. - * - * \param[in] module Pointer to SPI software instance struct - * \param[in] tx_data Pointer to data buffer to send - * \param[out] rx_data Pointer to data buffer to receive - * \param[in] length Data buffer length - * - * \returns Status of the operation. - * \retval STATUS_OK If the operation completed successfully - * \retval STATUS_ERR_BUSY If the SPI was already busy with a read - * operation - * \retval STATUS_ERR_DENIED If the receiver is not enabled - * \retval STATUS_ERR_INVALID_ARG If requested read length was zero - */ -enum status_code spi_transceive_buffer_job( - struct spi_module *const module, - uint8_t *tx_data, - uint8_t *rx_data, - uint16_t length) -{ - /* Sanity check arguments */ - Assert(module); - Assert(rx_data); - - if (length == 0) { - return STATUS_ERR_INVALID_ARG; - } - - if (!(module->receiver_enabled)) { - return STATUS_ERR_DENIED; - } - - /* Check if the SPI is busy transmitting or slave waiting for TXC*/ - if (module->status == STATUS_BUSY) { - return STATUS_BUSY; - } - - /* Issue internal transceive */ - _spi_transceive_buffer(module, tx_data, rx_data, length); - - return STATUS_OK; -} -/** - * \brief Aborts an ongoing job - * - * This function will abort the specified job type. - * - * \param[in] module Pointer to SPI software instance struct - */ -void spi_abort_job( - struct spi_module *const module) -{ - /* Pointer to the hardware module instance */ - SercomSpi *const spi_hw - = &(module->hw->SPI); - - /* Abort ongoing job */ - - /* Disable interrupts */ - spi_hw->INTENCLR.reg = SPI_INTERRUPT_FLAG_RX_COMPLETE | - SPI_INTERRUPT_FLAG_DATA_REGISTER_EMPTY | - SPI_INTERRUPT_FLAG_TX_COMPLETE; - - module->status = STATUS_ABORTED; - module->remaining_rx_buffer_length = 0; - module->remaining_dummy_buffer_length = 0; - module->remaining_tx_buffer_length = 0; - - module->dir = SPI_DIRECTION_IDLE; -} - -# if CONF_SPI_SLAVE_ENABLE == true || CONF_SPI_MASTER_ENABLE == true -/** - * \internal - * Writes a character from the TX buffer to the Data register. - * - * \param[in,out] module Pointer to SPI software instance struct - */ -static void _spi_write( - struct spi_module *const module) -{ - /* Pointer to the hardware module instance */ - SercomSpi *const spi_hw = &(module->hw->SPI); - - /* Write value will be at least 8-bits long */ - uint16_t data_to_send = *(module->tx_buffer_ptr); - /* Increment 8-bit pointer */ - (module->tx_buffer_ptr)++; - - if (module->character_size == SPI_CHARACTER_SIZE_9BIT) { - data_to_send |= ((*(module->tx_buffer_ptr)) << 8); - /* Increment 8-bit pointer */ - (module->tx_buffer_ptr)++; - } - - /* Write the data to send*/ - spi_hw->DATA.reg = data_to_send & SERCOM_SPI_DATA_MASK; - - /* Decrement remaining buffer length */ - (module->remaining_tx_buffer_length)--; -} -# endif - -# if CONF_SPI_MASTER_ENABLE == true -/** - * \internal - * Writes a dummy character to the Data register. - * - * \param[in,out] module Pointer to SPI software instance struct - */ -static void _spi_write_dummy( - struct spi_module *const module) -{ - /* Pointer to the hardware module instance */ - SercomSpi *const spi_hw = &(module->hw->SPI); - - /* Write dummy byte */ - spi_hw->DATA.reg = dummy_write; - - /* Decrement remaining dummy buffer length */ - module->remaining_dummy_buffer_length--; -} -# endif - -/** - * \internal - * Writes a dummy character from the to the Data register. - * - * \param[in,out] module Pointer to SPI software instance struct - */ -static void _spi_read_dummy( - struct spi_module *const module) -{ - /* Pointer to the hardware module instance */ - SercomSpi *const spi_hw = &(module->hw->SPI); - uint16_t flush = 0; - - /* Read dummy byte */ - flush = spi_hw->DATA.reg; - UNUSED(flush); - - /* Decrement remaining dummy buffer length */ - module->remaining_dummy_buffer_length--; -} - -/** - * \internal - * Reads a character from the Data register to the RX buffer. - * - * \param[in,out] module Pointer to SPI software instance struct - */ -static void _spi_read( - struct spi_module *const module) -{ - /* Pointer to the hardware module instance */ - SercomSpi *const spi_hw = &(module->hw->SPI); - - uint16_t received_data = (spi_hw->DATA.reg & SERCOM_SPI_DATA_MASK); - - /* Read value will be at least 8-bits long */ - *(module->rx_buffer_ptr) = received_data; - /* Increment 8-bit pointer */ - module->rx_buffer_ptr += 1; - - if(module->character_size == SPI_CHARACTER_SIZE_9BIT) { - /* 9-bit data, write next received byte to the buffer */ - *(module->rx_buffer_ptr) = (received_data >> 8); - /* Increment 8-bit pointer */ - module->rx_buffer_ptr += 1; - } - - /* Decrement length of the remaining buffer */ - module->remaining_rx_buffer_length--; -} - -/** - * \internal - * - * Handles interrupts as they occur, and it will run callback functions - * which are registered and enabled. - * - * \note This function will be called by the Sercom_Handler, and should - * not be called directly from any application code. - * - * \param[in] instance ID of the SERCOM instance calling the interrupt - * handler. - */ -void _spi_interrupt_handler( - uint8_t instance) -{ - /* Get device instance from the look-up table */ - struct spi_module *module - = (struct spi_module *)_sercom_instances[instance]; - - /* Pointer to the hardware module instance */ - SercomSpi *const spi_hw = &(module->hw->SPI); - - /* Combine callback registered and enabled masks. */ - uint8_t callback_mask = - module->enabled_callback & module->registered_callback; - - /* Read and mask interrupt flag register */ - uint16_t interrupt_status = spi_hw->INTFLAG.reg; - interrupt_status &= spi_hw->INTENSET.reg; - - /* Data register empty interrupt */ - if (interrupt_status & SPI_INTERRUPT_FLAG_DATA_REGISTER_EMPTY) { -# if CONF_SPI_MASTER_ENABLE == true - if ((module->mode == SPI_MODE_MASTER) && - (module->dir == SPI_DIRECTION_READ)) { - /* Send dummy byte when reading in master mode */ - _spi_write_dummy(module); - if (module->remaining_dummy_buffer_length == 0) { - /* Disable the Data Register Empty Interrupt */ - spi_hw->INTENCLR.reg - = SPI_INTERRUPT_FLAG_DATA_REGISTER_EMPTY; - } - } -# endif - - if (0 -# if CONF_SPI_MASTER_ENABLE == true - || ((module->mode == SPI_MODE_MASTER) && - (module->dir != SPI_DIRECTION_READ)) -# endif -# if CONF_SPI_SLAVE_ENABLE == true - || ((module->mode == SPI_MODE_SLAVE) && - (module->dir != SPI_DIRECTION_READ)) -# endif - ) { - /* Write next byte from buffer */ - _spi_write(module); - if (module->remaining_tx_buffer_length == 0) { - /* Disable the Data Register Empty Interrupt */ - spi_hw->INTENCLR.reg - = SPI_INTERRUPT_FLAG_DATA_REGISTER_EMPTY; - - if (module->dir == SPI_DIRECTION_WRITE && - !(module->receiver_enabled)) { - /* Enable the Data Register transmit complete Interrupt */ - spi_hw->INTENSET.reg = SPI_INTERRUPT_FLAG_TX_COMPLETE; - } - } - } - } - - /* Receive complete interrupt*/ - if (interrupt_status & SPI_INTERRUPT_FLAG_RX_COMPLETE) { - /* Check for overflow */ - if (spi_hw->STATUS.reg & SERCOM_SPI_STATUS_BUFOVF) { - if (module->dir != SPI_DIRECTION_WRITE) { - /* Store the error code */ - module->status = STATUS_ERR_OVERFLOW; - - /* End transaction */ - module->dir = SPI_DIRECTION_IDLE; - - spi_hw->INTENCLR.reg = SPI_INTERRUPT_FLAG_RX_COMPLETE | - SPI_INTERRUPT_FLAG_DATA_REGISTER_EMPTY; - /* Run callback if registered and enabled */ - if (callback_mask & (1 << SPI_CALLBACK_ERROR)) { - (module->callback[SPI_CALLBACK_ERROR])(module); - } - } - /* Flush */ - uint16_t flush = spi_hw->DATA.reg; - UNUSED(flush); - /* Clear overflow flag */ - spi_hw->STATUS.reg = SERCOM_SPI_STATUS_BUFOVF; - } else { - if (module->dir == SPI_DIRECTION_WRITE) { - /* Flush receive buffer when writing */ - _spi_read_dummy(module); - if (module->remaining_dummy_buffer_length == 0) { - spi_hw->INTENCLR.reg = SPI_INTERRUPT_FLAG_RX_COMPLETE; - module->status = STATUS_OK; - module->dir = SPI_DIRECTION_IDLE; - /* Run callback if registered and enabled */ - if (callback_mask & - (1 << SPI_CALLBACK_BUFFER_TRANSMITTED)){ - (module->callback[SPI_CALLBACK_BUFFER_TRANSMITTED])(module); - } - } - } else { - /* Read data register */ - _spi_read(module); - - /* Check if the last character have been received */ - if (module->remaining_rx_buffer_length == 0) { - module->status = STATUS_OK; - /* Disable RX Complete Interrupt and set status */ - spi_hw->INTENCLR.reg = SPI_INTERRUPT_FLAG_RX_COMPLETE; - if(module->dir == SPI_DIRECTION_BOTH) { - if (callback_mask & (1 << SPI_CALLBACK_BUFFER_TRANSCEIVED)) { - (module->callback[SPI_CALLBACK_BUFFER_TRANSCEIVED])(module); - } - } else if (module->dir == SPI_DIRECTION_READ) { - if (callback_mask & (1 << SPI_CALLBACK_BUFFER_RECEIVED)) { - (module->callback[SPI_CALLBACK_BUFFER_RECEIVED])(module); - } - } - } - } - } - } - - /* Transmit complete */ - if (interrupt_status & SPI_INTERRUPT_FLAG_TX_COMPLETE) { -# if CONF_SPI_SLAVE_ENABLE == true - if (module->mode == SPI_MODE_SLAVE) { - /* Transaction ended by master */ - - /* Disable interrupts */ - spi_hw->INTENCLR.reg = - SPI_INTERRUPT_FLAG_TX_COMPLETE | - SPI_INTERRUPT_FLAG_RX_COMPLETE | - SPI_INTERRUPT_FLAG_DATA_REGISTER_EMPTY; - /* Clear interrupt flag */ - spi_hw->INTFLAG.reg = SPI_INTERRUPT_FLAG_TX_COMPLETE; - - - /* Reset all status information */ - module->dir = SPI_DIRECTION_IDLE; - module->remaining_tx_buffer_length = 0; - module->remaining_rx_buffer_length = 0; - module->status = STATUS_OK; - - if (callback_mask & - (1 << SPI_CALLBACK_SLAVE_TRANSMISSION_COMPLETE)) { - (module->callback[SPI_CALLBACK_SLAVE_TRANSMISSION_COMPLETE]) - (module); - } - - } -# endif -# if CONF_SPI_MASTER_ENABLE == true - if ((module->mode == SPI_MODE_MASTER) && - (module->dir == SPI_DIRECTION_WRITE) && !(module->receiver_enabled)) { - /* Clear interrupt flag */ - spi_hw->INTENCLR.reg - = SPI_INTERRUPT_FLAG_TX_COMPLETE; - /* Buffer sent with receiver disabled */ - module->dir = SPI_DIRECTION_IDLE; - module->status = STATUS_OK; - /* Run callback if registered and enabled */ - if (callback_mask & (1 << SPI_CALLBACK_BUFFER_TRANSMITTED)){ - (module->callback[SPI_CALLBACK_BUFFER_TRANSMITTED]) - (module); - } - } -#endif - } - -# ifdef FEATURE_SPI_SLAVE_SELECT_LOW_DETECT -# if CONF_SPI_SLAVE_ENABLE == true - /* When a high to low transition is detected on the _SS pin in slave mode */ - if (interrupt_status & SPI_INTERRUPT_FLAG_SLAVE_SELECT_LOW) { - if (module->mode == SPI_MODE_SLAVE) { - /* Disable interrupts */ - spi_hw->INTENCLR.reg = SPI_INTERRUPT_FLAG_SLAVE_SELECT_LOW; - /* Clear interrupt flag */ - spi_hw->INTFLAG.reg = SPI_INTERRUPT_FLAG_SLAVE_SELECT_LOW; - - if (callback_mask & (1 << SPI_CALLBACK_SLAVE_SELECT_LOW)) { - (module->callback[SPI_CALLBACK_SLAVE_SELECT_LOW])(module); - } - } - } -# endif -# endif - -# ifdef FEATURE_SPI_ERROR_INTERRUPT - /* When combined error happen */ - if (interrupt_status & SPI_INTERRUPT_FLAG_COMBINED_ERROR) { - /* Disable interrupts */ - spi_hw->INTENCLR.reg = SPI_INTERRUPT_FLAG_COMBINED_ERROR; - /* Clear interrupt flag */ - spi_hw->INTFLAG.reg = SPI_INTERRUPT_FLAG_COMBINED_ERROR; - - if (callback_mask & (1 << SPI_CALLBACK_COMBINED_ERROR)) { - (module->callback[SPI_CALLBACK_COMBINED_ERROR])(module); - } - } -# endif -} diff --git a/atmel-samd/asf/sam0/drivers/sercom/spi/spi_interrupt.h b/atmel-samd/asf/sam0/drivers/sercom/spi/spi_interrupt.h deleted file mode 100644 index bb7168250..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/spi/spi_interrupt.h +++ /dev/null @@ -1,190 +0,0 @@ -/** - * \file - * - * \brief SAM Serial Peripheral Interface Driver (Callback Mode) - * - * Copyright (C) 2013-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef SPI_INTERRUPT_H_INCLUDED -#define SPI_INTERRUPT_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \addtogroup asfdoc_sam0_sercom_spi_group - * - * @{ - */ - -#include "spi.h" - -/** - * \name Callback Management - * @{ - */ - -void spi_register_callback( - struct spi_module *const module, - spi_callback_t callback_func, - enum spi_callback callback_type); - -void spi_unregister_callback( - struct spi_module *module, - enum spi_callback callback_type); - -/** - * \brief Enables an SPI callback of a given type - * - * Enables the callback function registered by the \ref spi_register_callback. - * The callback function will be called from the interrupt handler when the - * conditions for the callback type are met. - * - * \param[in] module Pointer to SPI software instance struct - * \param[in] callback_type Callback type given by an enum - */ -static inline void spi_enable_callback( - struct spi_module *const module, - enum spi_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module); - - /* Enable callback */ - module->enabled_callback |= (1 << callback_type); -} - -/** - * \brief Disables callback - * - * Disables the callback function registered by the \ref spi_register_callback, - * and the callback will not be called from the interrupt routine. - * - * \param[in] module Pointer to SPI software instance struct - * \param[in] callback_type Callback type given by an enum - */ -static inline void spi_disable_callback( - struct spi_module *const module, - enum spi_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module); - - /* Disable callback */ - module->enabled_callback &= ~(1 << callback_type); -} - -/** @} */ - - -/** - * \name Writing and Reading - * @{ - */ -enum status_code spi_write_buffer_job( - struct spi_module *const module, - uint8_t *tx_data, - uint16_t length); - -enum status_code spi_read_buffer_job( - struct spi_module *const module, - uint8_t *rx_data, - uint16_t length, - uint16_t dummy); - -enum status_code spi_transceive_buffer_job( - struct spi_module *const module, - uint8_t *tx_data, - uint8_t *rx_data, - uint16_t length); - -void spi_abort_job( - struct spi_module *const module); - -/** - * \brief Retrieves the current status of a job. - * - * Retrieves the current status of a job that was previously issued. - * - * \param[in] module Pointer to SPI software instance struct - * - * \return Current job status. - */ -static inline enum status_code spi_get_job_status( - const struct spi_module *const module) -{ - return module->status; -} - -/** - * \brief Retrieves the status of job once it ends. - * - * Waits for current job status to become non-busy, then returns its value. - * - * \param[in] module Pointer to SPI software instance struct - * - * \return Current non-busy job status. - */ -static inline enum status_code spi_get_job_status_wait( - const struct spi_module *const module) -{ - enum status_code status; - - do { - status = spi_get_job_status(module); - } while (status == STATUS_BUSY); - - return status; -} - -/** @} */ - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /* SPI_INTERRUPT_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/sercom/spi_master_vec/module-config/conf_spi.h b/atmel-samd/asf/sam0/drivers/sercom/spi_master_vec/module-config/conf_spi.h deleted file mode 100644 index 3bb66ff5b..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/spi_master_vec/module-config/conf_spi.h +++ /dev/null @@ -1,55 +0,0 @@ -/** - * \file - * - * \brief common SPI configuration - * - * Copyright (C) 2013-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - - -#ifndef CONF_SPI_H_INCLUDED -# define CONF_SPI_H_INCLUDED - -# define CONF_SPI_MASTER_ENABLE true -# define CONF_SPI_SLAVE_ENABLE false - -#endif /* CONF_SPI_H_INCLUDED */ - diff --git a/atmel-samd/asf/sam0/drivers/sercom/spi_master_vec/module-config/conf_spi_master_vec.h b/atmel-samd/asf/sam0/drivers/sercom/spi_master_vec/module-config/conf_spi_master_vec.h deleted file mode 100644 index 394b1fa61..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/spi_master_vec/module-config/conf_spi_master_vec.h +++ /dev/null @@ -1,68 +0,0 @@ -/** - * \file - * - * \brief SERCOM SPI master with vectored I/O driver configuration - * - * Copyright (C) 2013-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef CONF_SPI_MASTER_VEC_H -#define CONF_SPI_MASTER_VEC_H - -#if defined(__FREERTOS__) || defined(__DOXYGEN__) -# include <FreeRTOS.h> -# include <semphr.h> - -# define CONF_SPI_MASTER_VEC_OS_SUPPORT -# define CONF_SPI_MASTER_VEC_SEMAPHORE_TYPE xSemaphoreHandle -# define CONF_SPI_MASTER_VEC_CREATE_SEMAPHORE(semaphore) \ - vSemaphoreCreateBinary(semaphore) -# define CONF_SPI_MASTER_VEC_DELETE_SEMAPHORE(semaphore) \ - vSemaphoreDelete(semaphore) -# define CONF_SPI_MASTER_VEC_TAKE_SEMAPHORE(semaphore) \ - xSemaphoreTake((semaphore), portMAX_DELAY) -# define CONF_SPI_MASTER_VEC_GIVE_SEMAPHORE(semaphore) \ - xSemaphoreGive((semaphore)) -# define CONF_SPI_MASTER_VEC_GIVE_SEMAPHORE_FROM_ISR(semaphore) \ - xSemaphoreGiveFromISR((semaphore), NULL) -#endif - -#endif // CONF_SPI_MASTER_VEC_H
\ No newline at end of file diff --git a/atmel-samd/asf/sam0/drivers/sercom/spi_master_vec/spi_master_vec.c b/atmel-samd/asf/sam0/drivers/sercom/spi_master_vec/spi_master_vec.c deleted file mode 100644 index 89de7dd0d..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/spi_master_vec/spi_master_vec.c +++ /dev/null @@ -1,588 +0,0 @@ -/** - * \file - * - * \brief SERCOM SPI master with vectored I/O driver implementation - * - * Copyright (C) 2013-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#include "spi_master_vec.h" -#include <sercom_interrupt.h> -#include <system.h> -#include <system_interrupt.h> - -/** - * \ingroup asfdoc_sam0_sercom_spi_master_vec_group - * - * @{ - */ - -/** - * \name Internal functions - * @{ - */ - -/** \cond INTERNAL */ - -static void _spi_master_vec_int_handler(uint8_t sercom_index); - -/** - * \brief Wait for SERCOM SPI to synchronize - * - * \param[in] sercom_spi SERCOM SPI to check for synchronization. - * - * \note The implementation of this function depends on the SERCOM revision. - */ -static inline void _spi_master_vec_wait_for_sync(SercomSpi *const sercom_spi) -{ -#if defined(FEATURE_SERCOM_SYNCBUSY_SCHEME_VERSION_1) - while (sercom_spi->STATUS.reg & SERCOM_SPI_STATUS_SYNCBUSY) { - /* Intentionally left empty */ - } -#elif defined(FEATURE_SERCOM_SYNCBUSY_SCHEME_VERSION_2) - while (sercom_spi->SYNCBUSY.reg) { - /* Intentionally left empty */ - } -#else -# error Unknown SERCOM SYNCBUSY scheme! -#endif -} - -/** - * \brief Pin MUX configuration helper - * - * \param[in] pinmux Pin MUX setting to apply. Special values: - * \arg \c PINMUX_UNUSED to do nothing. - * \arg \c PINMUX_DEFAULT to use default pin MUX for the SERCOM pad. - * \param[in] sercom,padnum SERCOM pad specification, for \ref PINMUX_DEFAULT. - */ -static inline void _spi_master_vec_pinmux_helper(uint32_t pinmux, - Sercom *const sercom, uint8_t padnum) -{ - struct system_pinmux_config pin_conf; - - if (pinmux == PINMUX_DEFAULT) { - pinmux = _sercom_get_default_pad(sercom, padnum); - } - - if (pinmux == PINMUX_UNUSED) { - return; - } - - system_pinmux_get_config_defaults(&pin_conf); - pin_conf.mux_position = pinmux & 0xFFFF; - system_pinmux_pin_set_config(pinmux >> 16, &pin_conf); -}; - -/** \endcond */ - -/** @} */ - -/** - * \brief Initialize hardware and driver instance - * - * This function configures the clock system for the specified SERCOM module, - * sets up the related pins and their MUX, initializes the SERCOM in SPI master - * mode, and prepares the driver instance for operation. - * - * \pre \ref system_init() must have been called prior to this function. - * - * The SERCOM SPI module is left disabled after initialization, and must be - * enabled with \ref spi_master_vec_enable() before a transfer can be done. - * - * \param[out] module Driver instance to initialize. - * \param[in,out] sercom SERCOM module to initialize and associate driver - * instance with. - * \param[in] config Driver configuration to use. - * - * \return Status of initialization. - * \retval STATUS_OK if initialization succeeded. - * \retval STATUS_ERR_INVALID_ARG if driver has been misconfigured. - */ -enum status_code spi_master_vec_init(struct spi_master_vec_module *const module, - Sercom *const sercom, const struct spi_master_vec_config *const config) -{ - Assert(module); - Assert(sercom); - Assert(config); - - enum status_code status; - SercomSpi *const spi_hw = &(sercom->SPI); - struct system_gclk_chan_config gclk_chan_conf; - uint16_t tmp_baud; - uint32_t sercom_index = _sercom_get_sercom_inst_index((Sercom *)spi_hw); -#if (SAML21) || (SAML22) || (SAMC20) || (SAMC21) || (SAMR30) - uint32_t pm_index = sercom_index + MCLK_APBCMASK_SERCOM0_Pos; -#else - uint32_t pm_index = sercom_index + PM_APBCMASK_SERCOM0_Pos; -#endif - uint32_t gclk_index = sercom_index + SERCOM0_GCLK_ID_CORE; - uint32_t gclk_hz; - - module->sercom = sercom; - - /* Enable clock for the module interface */ - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBC, 1 << pm_index); - - /* Set up the GCLK for the module */ - system_gclk_chan_get_config_defaults(&gclk_chan_conf); - gclk_chan_conf.source_generator = config->gclk_generator; - system_gclk_chan_set_config(gclk_index, &gclk_chan_conf); - system_gclk_chan_enable(gclk_index); - sercom_set_gclk_generator(config->gclk_generator, false); - - _spi_master_vec_wait_for_sync(spi_hw); - - /* Set up the SERCOM SPI module as master */ - spi_hw->CTRLA.reg = SERCOM_SPI_CTRLA_MODE(0x3); - spi_hw->CTRLA.reg |= (uint32_t)config->mux_setting - | config->transfer_mode - | config->data_order - | ((config->run_in_standby || system_is_debugger_present()) ? - SERCOM_SPI_CTRLA_RUNSTDBY : 0); - - /* Get baud value from configured baudrate and internal clock rate */ - gclk_hz = system_gclk_chan_get_hz(gclk_index); - status = _sercom_get_sync_baud_val(config->baudrate, gclk_hz, &tmp_baud); - - if (status != STATUS_OK) { - /* Baud rate calculation error! */ - return STATUS_ERR_INVALID_ARG; - } - - spi_hw->BAUD.reg = (uint8_t)tmp_baud; - - /* Configure the pin multiplexers */ - _spi_master_vec_pinmux_helper(config->pinmux_pad0, sercom, 0); - _spi_master_vec_pinmux_helper(config->pinmux_pad3, sercom, 3); - - /* SERCOM PAD1 and PAD2 are used for slave SS. - * This is a SPI master driver, so control of slave SS must be left to - * the PORT module, i.e., peripheral MUX should not be set for that pin. - * DOPO controls which PAD is used for slave SS: - * If DOPO is odd, SERCOM_PAD1 is SS: SERCOM_PAD2 can be MUXed. - * If DOPO is even, SERCOM_PAD2 is SS: SERCOM_PAD1 can be MUXed. - */ - if (config->mux_setting & (1 << SERCOM_SPI_CTRLA_DOPO_Pos)) { - _spi_master_vec_pinmux_helper(config->pinmux_pad2, sercom, 2); - } else { - _spi_master_vec_pinmux_helper(config->pinmux_pad1, sercom, 1); - } - - /* Initialize our instance and register interrupt handler + data */ - module->rx_bufdesc_ptr = NULL; - module->tx_bufdesc_ptr = NULL; - module->direction = SPI_MASTER_VEC_DIRECTION_IDLE; - module->status = STATUS_OK; -#ifdef CONF_SPI_MASTER_VEC_OS_SUPPORT - CONF_SPI_MASTER_VEC_CREATE_SEMAPHORE(module->busy_semaphore); -#endif - - _sercom_set_handler(sercom_index, _spi_master_vec_int_handler); - _sercom_instances[sercom_index] = module; - - return STATUS_OK; -} - -/** - * \brief Enable the SERCOM SPI module - * - * This function must be called after \ref spi_master_vec_init() before a - * transfer can be started. - * - * \param[in,out] module Driver instance to operate on. - */ -void spi_master_vec_enable(const struct spi_master_vec_module *const module) -{ - Assert(module); - Assert(module->sercom); - - SercomSpi *const spi_hw = &(module->sercom->SPI); - - spi_hw->INTENCLR.reg = SERCOM_SPI_INTFLAG_DRE | SERCOM_SPI_INTFLAG_RXC - | SERCOM_SPI_INTFLAG_TXC; - - _spi_master_vec_wait_for_sync(spi_hw); - - spi_hw->CTRLA.reg |= SERCOM_SPI_CTRLA_ENABLE; - - system_interrupt_enable(_sercom_get_interrupt_vector(module->sercom)); -} - -/** - * \brief Disable the SERCOM SPI module - * - * \param[in,out] module Driver instance to operate on. - */ -void spi_master_vec_disable(struct spi_master_vec_module *const module) -{ - Assert(module); - Assert(module->sercom); - - SercomSpi *const spi_hw = &(module->sercom->SPI); - - system_interrupt_disable(_sercom_get_interrupt_vector(module->sercom)); - - _spi_master_vec_wait_for_sync(spi_hw); - - spi_hw->INTENCLR.reg = SERCOM_SPI_INTENCLR_MASK; - spi_hw->INTFLAG.reg = SERCOM_SPI_INTFLAG_MASK; - spi_hw->CTRLB.reg = 0; - spi_hw->CTRLA.reg &= ~SERCOM_SPI_CTRLA_ENABLE; - module->rx_bufdesc_ptr = NULL; - module->tx_bufdesc_ptr = NULL; - module->direction = SPI_MASTER_VEC_DIRECTION_IDLE; - module->status = STATUS_OK; -} - -/** - * \brief Reset the SERCOM SPI module - * - * This function will disable and reset the SPI module to its power on default - * values. - * - * \param[in,out] module Pointer to a driver instance. - */ -void spi_master_vec_reset(struct spi_master_vec_module *const module) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->sercom); - - SercomSpi *const spi_hw = &(module->sercom->SPI); - - /* Disable the module */ - spi_master_vec_disable(module); - - _spi_master_vec_wait_for_sync(spi_hw); - - /* Software reset the module */ - spi_hw->CTRLA.reg |= SERCOM_SPI_CTRLA_SWRST; - -#ifdef CONF_SPI_MASTER_VEC_OS_SUPPORT - CONF_SPI_MASTER_VEC_DELETE_SEMAPHORE(module->busy_semaphore); -#endif -} - -/** - * \brief Start vectored I/O transfer - * - * This function initiates a uni- or bidirectional SPI transfer from/to any - * number of data buffers. The transfer is interrupt-driven and will run in the - * background, after this function has returned. - * - * The buffers to transmit from or receive into must be described in arrays of - * buffer descriptors. These arrays \e must end with descriptors that specify - * zero buffer length. The first descriptor in an array can \e not specify zero - * length. The number of bytes to transmit and to receive do not have to be - * equal. - * - * If the address for a receive buffer is set to \c NULL, the received bytes - * corresponding to that buffer descriptor will be discarded. This is useful if - * slave is already set up to transfer a number of bytes, but the master has no - * available buffer to receive them into. As an example, to receive the two - * first bytes and discard the 128 following, the buffer descriptors could be: -\code - struct spi_master_vec_bufdesc rx_buffers[3] = { - // Read two status bytes - {.data = status_buffer, .length = 2}, - // Discard 128 data bytes - {.data = NULL, .length = 128}, - // End of reception - {.length = 0}, - }; -\endcode - * - * To initiate a unidirectional transfer, pass \c NULL as the address of either - * buffer descriptor array, like this: -\code - // Transmit some buffers - spi_master_vec_transceive_buffer_job(&module, tx_buffers, NULL); - - // Receive some buffers - spi_master_vec_transceive_buffer_job(&module, NULL, rx_buffers); -\endcode - * - * \pre \ref spi_master_vec_init() and \ref spi_master_vec_enable() must have - * been called before this function. - * - * \param[in,out] module Driver instance to operate on. - * \param[in] tx_bufdescs address of buffer descriptor array for bytes to - * transmit. - * \arg \c NULL if the transfer is a simplex read. - * \param[in,out] rx_bufdescs address of buffer descriptor array for storing - * received bytes. - * \arg \c NULL if the transfer is a simplex write. - * - * \return Status of transfer start. - * \retval STATUS_OK if transfer was started. - * \retval STATUS_BUSY if a transfer is already on-going. - */ -enum status_code spi_master_vec_transceive_buffer_job( - struct spi_master_vec_module *const module, - struct spi_master_vec_bufdesc tx_bufdescs[], - struct spi_master_vec_bufdesc rx_bufdescs[]) -{ - Assert(module); - Assert(module->sercom); - Assert(tx_bufdescs || rx_bufdescs); - - SercomSpi *const spi_hw = &(module->sercom->SPI); - uint32_t tmp_ctrlb; - uint8_t tmp_intenset; - - system_interrupt_enter_critical_section(); - if (module->status == STATUS_BUSY) { - system_interrupt_leave_critical_section(); - return STATUS_BUSY; - } else { - module->status = STATUS_BUSY; - system_interrupt_leave_critical_section(); - } - -#ifdef CONF_SPI_MASTER_VEC_OS_SUPPORT - CONF_SPI_MASTER_VEC_TAKE_SEMAPHORE(module->busy_semaphore); -#endif - - module->tx_bufdesc_ptr = tx_bufdescs; - module->rx_bufdesc_ptr = rx_bufdescs; - - if (tx_bufdescs && rx_bufdescs) { - Assert(tx_bufdescs[0].length); - Assert(rx_bufdescs[0].length); - - module->direction = SPI_MASTER_VEC_DIRECTION_BOTH; - module->tx_length = tx_bufdescs[0].length; - module->tx_head_ptr = tx_bufdescs[0].data; - module->rx_length = rx_bufdescs[0].length; - module->rx_head_ptr = rx_bufdescs[0].data; - module->tx_lead_on_rx = 0; - tmp_ctrlb = SERCOM_SPI_CTRLB_RXEN; - tmp_intenset = SERCOM_SPI_INTFLAG_DRE | SERCOM_SPI_INTFLAG_RXC; - } else { - if (tx_bufdescs) { - Assert(tx_bufdescs[0].length); - - module->direction = SPI_MASTER_VEC_DIRECTION_WRITE; - module->tx_length = tx_bufdescs[0].length; - module->tx_head_ptr = tx_bufdescs[0].data; - tmp_ctrlb = 0; - tmp_intenset = SERCOM_SPI_INTFLAG_DRE; - } else { - Assert(rx_bufdescs[0].length); - - module->direction = SPI_MASTER_VEC_DIRECTION_READ; - module->rx_length = rx_bufdescs[0].length; - module->rx_head_ptr = rx_bufdescs[0].data; - module->tx_lead_on_rx = 0; - tmp_ctrlb = SERCOM_SPI_CTRLB_RXEN; - tmp_intenset = SERCOM_SPI_INTFLAG_DRE | SERCOM_SPI_INTFLAG_RXC; - } - } - - /* Ensure the SERCOM is sync'ed before writing these registers */ - _spi_master_vec_wait_for_sync(spi_hw); - - spi_hw->CTRLB.reg = tmp_ctrlb; - spi_hw->INTENSET.reg = tmp_intenset; - - return STATUS_OK; -} - -/** - * \brief Interrupt handler - * - * \param[in] sercom_index SERCOM instance number passed from the master SERCOM - * driver. - */ -static void _spi_master_vec_int_handler(uint8_t sercom_index) -{ - struct spi_master_vec_module *const module = - _sercom_instances[sercom_index]; - enum _spi_master_vec_direction dir = module->direction; - SercomSpi *const spi_hw = &(module->sercom->SPI); - uint8_t int_status; - - int_status = spi_hw->INTFLAG.reg ; - int_status &= spi_hw->INTENSET.reg; - - if (int_status & SERCOM_SPI_INTFLAG_DRE) { - uint_fast8_t tx_lead_on_rx = module->tx_lead_on_rx; - - /* If TX is ahead of RX by 2+ bytes, allow RX to catch up. - * Note: will only happen _once_ per READ or BOTH. - */ - if ((tx_lead_on_rx >= 2) && (dir != SPI_MASTER_VEC_DIRECTION_WRITE)) { - Assert((dir == SPI_MASTER_VEC_DIRECTION_READ) - || (dir == SPI_MASTER_VEC_DIRECTION_BOTH)); - Assert(int_status & SERCOM_SPI_INTFLAG_RXC); - /* Otherwise, we can send more bytes */ - } else { - module->tx_lead_on_rx = ++tx_lead_on_rx; - - /* If doing a READ, just send 0 to trigger the transfer */ - if (dir == SPI_MASTER_VEC_DIRECTION_READ) { - uint32_t tx_lead_limit; - - spi_hw->DATA.reg = 0; - -check_for_read_end: - /* With current TX'ed bytes, will we get the last RX byte? - * If so, we can disable the DRE interrupt to stop transmitting. - * - * Since a buffer can have minimum 1 byte length, this check is - * simplified by first checking if the RX end is so close that - * the max. 2 byte lead of TX may actually fill the buffers. - */ - tx_lead_limit = (module->rx_bufdesc_ptr + 1)->length; - - if (!tx_lead_limit || !(module->rx_bufdesc_ptr + 2)->length) { - tx_lead_limit += module->rx_length; - - if (tx_lead_on_rx >= tx_lead_limit) { - spi_hw->INTENCLR.reg = SERCOM_SPI_INTFLAG_DRE; - } - } - /* For WRITE and BOTH, output current byte */ - } else { - spi_master_vec_buflen_t tx_length; - uint8_t *tx_head_ptr; - - tx_head_ptr = module->tx_head_ptr; - spi_hw->DATA.reg = *(tx_head_ptr++); - - /* Check if this was the last byte to send */ - tx_length = module->tx_length - 1; - - if (tx_length) { - module->tx_head_ptr = tx_head_ptr; - module->tx_length = tx_length; - } else { - /* Any more buffers left to send, perhaps? */ - tx_length = (++module->tx_bufdesc_ptr)->length; - - if (tx_length) { - module->tx_head_ptr = module->tx_bufdesc_ptr->data; - module->tx_length = tx_length; - } else { - if (dir == SPI_MASTER_VEC_DIRECTION_WRITE) { - /* Disable DRE and enable TXC to end WRITE */ - spi_hw->INTENCLR.reg = SERCOM_SPI_INTFLAG_DRE; - spi_hw->INTENSET.reg = SERCOM_SPI_INTFLAG_TXC; - } else { - /* For BOTH, check if we still have bytes to read */ - dir = SPI_MASTER_VEC_DIRECTION_READ; - module->direction = dir; - goto check_for_read_end; - } - } - } - } - } - } - - /* For READ and BOTH, store the received byte */ - if (int_status & SERCOM_SPI_INTFLAG_RXC) { - spi_master_vec_buflen_t rx_length; - uint8_t *rx_head_ptr; - - rx_head_ptr = module->rx_head_ptr; - if (rx_head_ptr != NULL) { - *(rx_head_ptr++) = spi_hw->DATA.reg; - } else { - uint8_t dummy; - dummy = spi_hw->DATA.reg; - UNUSED(dummy); - } - module->tx_lead_on_rx--; - - /* Check if this was the last byte to receive */ - rx_length = module->rx_length - 1; - - if (rx_length) { - module->rx_head_ptr = rx_head_ptr; - module->rx_length = rx_length; - } else { - /* Any more buffers left to receive into? */ - rx_length = (++module->rx_bufdesc_ptr)->length; - - if (rx_length) { - module->rx_head_ptr = module->rx_bufdesc_ptr->data; - module->rx_length = rx_length; - } else { - /* Disable the SPI receiver (instant effect) and RX interrupt */ - spi_hw->CTRLB.reg = 0; - spi_hw->INTENCLR.reg = SERCOM_SPI_INTFLAG_RXC; - - if (dir == SPI_MASTER_VEC_DIRECTION_READ) { - /* If doing READ, end the transaction here */ - dir = SPI_MASTER_VEC_DIRECTION_IDLE; - module->direction = dir; - module->status = STATUS_OK; -#ifdef CONF_SPI_MASTER_VEC_OS_SUPPORT - CONF_SPI_MASTER_VEC_GIVE_SEMAPHORE_FROM_ISR(module->busy_semaphore); -#endif - } else { - /* If doing BOTH, change direction to WRITE */ - dir = SPI_MASTER_VEC_DIRECTION_WRITE; - module->direction = dir; - } - } - } - } - - /* For WRITE */ - if (int_status & SERCOM_SPI_INTFLAG_TXC) { - /* End transaction here, since last byte has been sent */ - spi_hw->INTENCLR.reg = SERCOM_SPI_INTFLAG_TXC; - - dir = SPI_MASTER_VEC_DIRECTION_IDLE; - module->direction = dir; - module->status = STATUS_OK; -#ifdef CONF_SPI_MASTER_VEC_OS_SUPPORT - CONF_SPI_MASTER_VEC_GIVE_SEMAPHORE_FROM_ISR(module->busy_semaphore); -#endif - } -} - -/** - * @} - */
\ No newline at end of file diff --git a/atmel-samd/asf/sam0/drivers/sercom/spi_master_vec/spi_master_vec.h b/atmel-samd/asf/sam0/drivers/sercom/spi_master_vec/spi_master_vec.h deleted file mode 100644 index a10ae22f1..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/spi_master_vec/spi_master_vec.h +++ /dev/null @@ -1,692 +0,0 @@ -/** - * \file - * - * \brief SERCOM SPI master with vectored I/O driver include - * - * Copyright (C) 2013-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef SPI_MASTER_VEC_H -#define SPI_MASTER_VEC_H - -#include <compiler.h> -#include <gclk.h> -#include <port.h> -#include <spi.h> -#include <status_codes.h> -#include <conf_spi_master_vec.h> - -/** - * \defgroup asfdoc_sam0_sercom_spi_master_vec_group SAM Serial Peripheral Interface Master Driver w/ Vectored I/O (SERCOM SPI) - * - * This driver for Atmel® | SMART SAM devices provides an interface for the configuration - * and operation of the SERCOM module in SPI master mode and uses vectored I/O - * for data transfers. - * - * The following peripherals are used by this driver: - * - SERCOM (Serial Communication Interface) - * - * The following devices can use this driver: - * - Atmel | SMART SAM D20/D21 - * - Atmel | SMART SAM R21 - * - Atmel | SMART SAM D09/D10/D11 - * - Atmel | SMART SAM L21/L22 - * - Atmel | SMART SAM DA1 - * - Atmel | SMART SAM C20/C21 - * - * The reader is assumed to be familiar with the regular SERCOM SPI driver, and - * how it is configured and operated. Configuration of this driver is done a - * similar way and actually re-uses several enumerations (configuration values) - * from the regular SERCOM SPI driver. - * - * The outline of this documentation is as follows: - * - \ref asfdoc_sam0_sercom_spi_master_vec_prerequisites - * - \ref asfdoc_sam0_sercom_spi_master_vec_module_overview - * - \ref asfdoc_sam0_sercom_spi_master_vec_special_considerations - * - \ref asfdoc_sam0_sercom_spi_master_vec_extra_info - * - \ref asfdoc_sam0_sercom_spi_master_vec_examples - * - \ref asfdoc_sam0_sercom_spi_master_vec_api_overview - * - * - * \section asfdoc_sam0_sercom_spi_master_vec_prerequisites Prerequisites - * - * This driver uses the \ref asfdoc_sam0_system_clock_group "SYSTEM clock driver" - * to select the SERCOM's clock source and to configure the SERCOM for the - * desired baud rate. Ensure that the selected clock source is configured and - * that the clock system is initialized. This is typically done indirectly with - * \ref system_init(), or directly with \ref system_clock_init(). - * - * According to the datasheet, the minimum and maximum limits for the baud rate - * is given by: \f$ \frac{1}{2^{17}} \times f_{clk} \le f_{baud} - * \le \frac{1}{2} \times f_{clk} \f$. - * - * - * \section asfdoc_sam0_sercom_spi_master_vec_module_overview Module Overview - * - * This SERCOM SPI master driver supports uni- and bidirectional transfers of - * 8-bit data with vectored I/O, also know as scatter/gather. - * It does not implement control of SS or slave addressing since the intended - * usage is in stacks which usually have their own protocols and handshaking - * schemes. - * - * - * \subsection asfdoc_sam0_sercom_spi_master_vectored_io Vectored I/O - * - * Vectored I/O enables the transfer of data from/to any number of buffers with - * arbitrary memory locations without having to do several transfers, i.e., one - * buffer at a time. This feature is useful in stacks because it allows each - * layer of the stack to have a dedicated data buffer, thus avoiding the need - * for a centralized data buffer that the different layers must use in - * cooperation. - * - * The vectored I/O relies on arrays of buffer descriptors which must be passed - * to the driver to start a transfer. These buffer descriptors specify where in - * memory each buffer is, and how large they are. - * \ref asfdoc_sam0_vectored_io_example "The figure below" illustrates this - * for an example with three buffers of varying sizes that are transmitted. - * - * \anchor asfdoc_sam0_vectored_io_example - * \dot -digraph bufptr_to_spiord { - rankdir=LR; - subgraph cluster_bufptr { - style=invis; - bufptr_label [shape=none, label="Buffer descriptors"]; - bufptrs [shape=record, label="<bf1> [0]|<bf2> [1]|<bf3> [2]|<bf4> [3]"]; - } - subgraph cluster_buf { - style=invis; - buf_label [shape=none, label="Memory layout"]; - bufs [shape=record, label="...|<b1>"yy"|...|<b3>"z"|<b2>"xxx"|..."]; - } - subgraph cluster_spiord { - style=invis; - spiord_label [shape=none, label="SPI transmission"]; - spiord [shape=record, label="<s1>"yy"|<s2>"xxx"|<s3>"z""]; - } - bufptrs:bf1 -> bufs:b1 -> spiord:s1; - bufptrs:bf2 -> bufs:b2 -> spiord:s2; - bufptrs:bf3 -> bufs:b3 -> spiord:s3; - bufptrs:bf4 -> "none"; -} - * \enddot - * - * Note that the last descriptor \e must indicate no next buffer in order for - * the driver to detect that the end of the buffer list has been reached. This - * means that for \c N buffers, \c N+1 buffer descriptors are needed. - * - * Bidirectional transfers are supported without any restrictions on the buffer - * descriptors, so the number of bytes and buffers to receive and transmit do - * \e not have to be the same. - * - * \sa spi_master_vec_transceive_buffer_job() for details on starting transfers. - * - * - * \subsection asfdoc_sam0_sercom_spi_master_os_support OS support - * - * Since this driver is interrupt-driven, it is possible for the MCU to run - * other code while a transfer is on-going. - * - * In a single-threaded application, this can be achieved by starting a transfer - * and then avoid any waiting for completion until absolutely required, e.g., - * when a new transfer is needed. - * - * But in a multi-threaded application, for example based on FreeRTOS, one can - * utilize \e semaphores to let the OS know when a function is waiting and thus - * blocking the thread, and that other threads can be run instead. Put another - * way, the waiting can be made efficient. - * - * This driver has an internal semaphore which is used to signal to the OS - * whenever a function is waiting for a transfer to complete. And since the - * semaphore datatypes and functions are OS-specific, the support has been made - * configurable by the use of macros. Note that support for FreeRTOS is already - * implemented, but must be enabled. - * - * \sa CONF_SPI_MASTER_VEC_OS_SUPPORT for more on the configurable OS support. - * - * - * \section asfdoc_sam0_sercom_spi_master_vec_special_considerations Special Considerations - * - * \subsection asfdoc_sam0_sercom_spi_master_vec_special_isr Interrupt safety - * - * This driver should not be used within interrupt contexts. The reason for this - * is that the driver itself is interrupt driven. Further, the configurable OS - * support is implemented with the assumption that transfers are only started - * in threads, not in interrupt service routines, because it gives the simplest - * API. - * - * - * \subsection asfdoc_sam0_sercom_spi_master_vec_special_mux Signal MUX - * - * The SERCOM module has two layers of signal multiplexing in SPI mode: - * -# SERCOM pad MUX: This routes the SPI signals to internal lines. - * -# PORT pin MUX: This routes the internal line to a device pin. - * - * Both of these layers are configured in the \ref spi_master_vec_config - * "configuration structure", using the members named \c mux_setting and - * \c pinmux_padN. These must be set in combination. - * - * The driver supplies values for the - * \ref spi_master_vec_config::mux_setting "SERCOM pad MUX" from the standard - * ASF SERCOM SPI driver. For the PORT pin MUX configuration, refer to the - * peripheral include file for the device (\c pio_samd20XNN.h ) and use the - * macros that are prefixed with \c PINMUX_, such as - * \c PINMUX_PA04D_SERCOM0_PAD0. It is also possible to use the default pin MUX - * setting for a SERCOM pad by using the \ref PINMUX_DEFAULT macro. The defaults - * are defined in the file \ref sercom_pinout.h. - * - * Note that for \ref spi_master_vec_init() to function properly with the macro - * \ref PINMUX_DEFAULT, the order of the values in \c pinmux_padN \e must be - * correct, i.e., \c pinmux_pad0 must contain the pin MUX setting for - * multiplexing SERCOM pad 0, and so on. - * - * - * \section asfdoc_sam0_sercom_spi_master_vec_extra_info Extra Information - * - * For extra information, see - * \subpage asfdoc_sam0_sercom_spi_master_vec_extra. This includes: - * - \ref asfdoc_sam0_sercom_spi_master_vec_extra_acronyms - * - \ref asfdoc_sam0_sercom_spi_master_vec_extra_dependencies - * - \ref asfdoc_sam0_sercom_spi_master_vec_extra_errata - * - \ref asfdoc_sam0_sercom_spi_master_vec_extra_history - * - * - * \section asfdoc_sam0_sercom_spi_master_vec_examples Examples - * - * For a list of examples related to this driver, see - * \ref asfdoc_sam0_sercom_spi_master_vec_exqsg. - * - * - * \section asfdoc_sam0_sercom_spi_master_vec_api_overview API Overview - * - * @{ - */ - -/** - * Driver configuration structure - * - * \sa asfdoc_sam0_sercom_spi_master_vec_special_considerations for more - * information regarding SERCOM pad and pin MUX. - */ -struct spi_master_vec_config { - /** Baud rate in Hertz. */ - uint32_t baudrate; - /** GCLK generator to use for the SERCOM. */ - enum gclk_generator gclk_generator; - /** Enabled in sleep modes. */ - bool run_in_standby; - /** SERCOM pad MUX setting. */ - enum spi_signal_mux_setting mux_setting; - /** Transfer mode. */ - enum spi_transfer_mode transfer_mode; - /** Data order. */ - enum spi_data_order data_order; - /** Pin MUX setting for SERCOM pad 0. */ - uint32_t pinmux_pad0; - /** Pin MUX setting for SERCOM pad 1. */ - uint32_t pinmux_pad1; - /** Pin MUX setting for SERCOM pad 2. */ - uint32_t pinmux_pad2; - /** Pin MUX setting for SERCOM pad 4. */ - uint32_t pinmux_pad3; -}; - -/** Buffer length container. */ -typedef uint16_t spi_master_vec_buflen_t; - -/** Buffer descriptor structure. */ -struct spi_master_vec_bufdesc { - /** Pointer to buffer start. */ - void *data; - /** Length of buffer. */ - spi_master_vec_buflen_t length; -}; - -/** Transfer direction */ -enum _spi_master_vec_direction { - SPI_MASTER_VEC_DIRECTION_READ, - SPI_MASTER_VEC_DIRECTION_WRITE, - SPI_MASTER_VEC_DIRECTION_BOTH, - SPI_MASTER_VEC_DIRECTION_IDLE, -}; - -/** Driver instance. */ -struct spi_master_vec_module { -#if !defined(__DOXYGEN__) - Sercom *volatile sercom; - volatile bool locked; - volatile enum _spi_master_vec_direction direction; - volatile enum status_code status; - volatile spi_master_vec_buflen_t rx_length; - volatile spi_master_vec_buflen_t tx_length; - uint8_t *volatile rx_head_ptr; - uint8_t *volatile tx_head_ptr; - volatile uint_fast8_t tx_lead_on_rx; - struct spi_master_vec_bufdesc *volatile rx_bufdesc_ptr; - struct spi_master_vec_bufdesc *volatile tx_bufdesc_ptr; -# ifdef CONF_SPI_MASTER_VEC_OS_SUPPORT - CONF_SPI_MASTER_VEC_SEMAPHORE_TYPE busy_semaphore; -# endif -#endif -}; - -/** - * \name Configuration and Initialization - * @{ - */ - -/** - * \brief Initialize configuration with default values. - * - * \param[out] config Configuration struct to initialize. - */ -static inline void spi_master_vec_get_config_defaults( - struct spi_master_vec_config *const config) -{ - config->baudrate = 100000; - config->gclk_generator = GCLK_GENERATOR_0; - config->run_in_standby = false; - config->mux_setting = SPI_SIGNAL_MUX_SETTING_D; - config->transfer_mode = SPI_TRANSFER_MODE_0; - config->data_order = SPI_DATA_ORDER_MSB; - config->pinmux_pad0 = PINMUX_DEFAULT; - config->pinmux_pad1 = PINMUX_DEFAULT; - config->pinmux_pad2 = PINMUX_DEFAULT; - config->pinmux_pad3 = PINMUX_DEFAULT; -} - -#ifdef __cplusplus -extern "C" { -#endif - -enum status_code spi_master_vec_init(struct spi_master_vec_module *const module, - Sercom *const sercom, const struct spi_master_vec_config *const config); - -/** @} */ - -/** - * \name Enable/Disable and Reset - * @{ - */ - -void spi_master_vec_enable(const struct spi_master_vec_module *const module); -void spi_master_vec_disable(struct spi_master_vec_module *const module); -void spi_master_vec_reset(struct spi_master_vec_module *const module); - -/** @} */ - -/** - * \name Lock/Unlock - * @{ - */ - -/** - * \brief Attempt to get lock on driver instance - * - * This function checks the instance's lock, which indicates whether or not it - * is currently in use, and sets the lock if it was not already set. - * - * The purpose of this is to enable exclusive access to driver instances, so - * that, e.g., transactions by different services will not interfere with each - * other. - * - * \param[in,out] module Pointer to the driver instance to lock. - * - * \retval STATUS_OK if the module was locked. - * \retval STATUS_BUSY if the module was already locked. - */ -static inline enum status_code spi_master_vec_lock( - struct spi_master_vec_module *const module) -{ - enum status_code status; - - system_interrupt_enter_critical_section(); - - if (module->locked) { - status = STATUS_BUSY; - } else { - module->locked = true; - status = STATUS_OK; - } - - system_interrupt_leave_critical_section(); - - return status; -} - -/** - * \brief Unlock driver instance - * - * This function clears the instance lock, indicating that it is available for - * use. - * - * \param[in,out] module Pointer to the driver instance to lock. - */ -static inline void spi_master_vec_unlock( - struct spi_master_vec_module *const module) -{ - module->locked = false; -} - -/** @} */ - -/** - * \name Read/Write and Status - * @{ - */ - -enum status_code spi_master_vec_transceive_buffer_job( - struct spi_master_vec_module *const module, - struct spi_master_vec_bufdesc tx_bufdescs[], - struct spi_master_vec_bufdesc rx_bufdescs[]); - -/** - * \brief Get current status of transfer. - * - * \param[in] module Driver instance to operate on. - * - * \return Current status of driver instance. - * \retval STATUS_OK if idle and previous transfer succeeded. - * \retval STATUS_BUSY if a transfer is ongoing. - * \retval <other> if previous transfer failed. - */ -static inline enum status_code spi_master_vec_get_job_status( - const struct spi_master_vec_module *const module) -{ - return module->status; -} - -/** - * \brief Get status of transfer upon job end. - * - * \param[in] module Driver instance to operate on. - * - * \return Current status of driver instance. - * \retval STATUS_OK if idle and previous transfer succeeded. - * \retval <other> if previous transfer failed. - */ -static inline enum status_code spi_master_vec_get_job_status_wait( - const struct spi_master_vec_module *const module) -{ - enum status_code status; - -#ifdef CONF_SPI_MASTER_VEC_OS_SUPPORT - CONF_SPI_MASTER_VEC_TAKE_SEMAPHORE(module->busy_semaphore); - status = spi_master_vec_get_job_status(module); - CONF_SPI_MASTER_VEC_GIVE_SEMAPHORE(module->busy_semaphore); -#else - do { - status = spi_master_vec_get_job_status(module); - } while (status == STATUS_BUSY); -#endif - - return status; -} - - -/** - * \brief Start vectored I/O transfer, wait for it to end. - * - * \param[in,out] module Driver instance to operate on. - * \param[in] tx_bufdescs address of buffer descriptor array for bytes to - * transmit. - * \arg \c NULL if the transfer is a simplex read. - * \param[in,out] rx_bufdescs address of buffer descriptor array for storing - * received bytes. - * \arg \c NULL if the transfer is a simplex write. - * - * \return Status of transfer start. - * \retval STATUS_OK if transfer succeeded. - * \retval STATUS_BUSY if a transfer was already on-going. - * \retval <other> if transfer failed. - */ -static inline enum status_code spi_master_vec_transceive_buffer_wait( - struct spi_master_vec_module *const module, - struct spi_master_vec_bufdesc tx_bufdescs[], - struct spi_master_vec_bufdesc rx_bufdescs[]) -{ - enum status_code status; - - status = spi_master_vec_transceive_buffer_job(module, tx_bufdescs, - rx_bufdescs); - - if (status == STATUS_BUSY) { - return status; - } - - return spi_master_vec_get_job_status_wait(module); -} - -/** @} */ - -#ifdef __cplusplus -} -#endif - -/** - * \name OS Support Configuration - * @{ - */ - -/** - * \def CONF_SPI_MASTER_VEC_OS_SUPPORT - * \brief Enable support for OS - * - * Defining this symbol will enable support for an OS, e.g., FreeRTOS, by using - * the macros in this group: - * - \ref CONF_SPI_MASTER_VEC_SEMAPHORE_TYPE - * - \ref CONF_SPI_MASTER_VEC_CREATE_SEMAPHORE - * - \ref CONF_SPI_MASTER_VEC_DELETE_SEMAPHORE - * - \ref CONF_SPI_MASTER_VEC_TAKE_SEMAPHORE - * - \ref CONF_SPI_MASTER_VEC_GIVE_SEMAPHORE - * - \ref CONF_SPI_MASTER_VEC_GIVE_SEMAPHORE_FROM_ISR - * - * The user must ensure that these macros map to the implementation for the OS - * that is used. Further, required includes must be added alongside these macros - * in \ref conf_spi_master_vec.h. - * - * The purpose of this configuration is to enable usage of the OS' semaphore - * system to wait for transfers to end rather than continuously polling the - * transfer status, which is an inefficient approach. - */ - -/** - * \def CONF_SPI_MASTER_VEC_SEMAPHORE_TYPE - * \brief Semaphore datatype - */ - -/** - * \def CONF_SPI_MASTER_VEC_CREATE_SEMAPHORE - * \brief Create/initialize semaphore - * - * \param semaphore Semaphore member in driver instance. - */ - -/** - * \def CONF_SPI_MASTER_VEC_DELETE_SEMAPHORE - * \brief Delete semaphore - * - * \param semaphore Semaphore member in driver instance. - */ - -/** - * \def CONF_SPI_MASTER_VEC_TAKE_SEMAPHORE - * \brief Wait for and take semaphore - * - * \param semaphore Semaphore member in driver instance. - */ - -/** - * \def CONF_SPI_MASTER_VEC_GIVE_SEMAPHORE - * \brief Give semaphore back - * - * \param semaphore Semaphore member in driver instance. - */ - -/** - * \def CONF_SPI_MASTER_VEC_GIVE_SEMAPHORE_FROM_ISR - * \brief Give semaphore back from an ISR - * - * \param semaphore Semaphore member in driver instance. - */ - -/** @} */ - -/** - * @} - */ - -/** - * \page asfdoc_sam0_sercom_spi_master_vec_extra Extra Information for SERCOM SPI Master Driver w/ Vectored I/O - * - * - * \section asfdoc_sam0_sercom_spi_master_vec_extra_acronyms Acronyms - * - * The table below presents the acronyms used in this module. - * - * <table> - * <tr> - * <th>Acronym</td> - * <th>Description</td> - * </tr> - * <tr> - * <td>GCLK</td> - * <td>Generic Clock</td> - * </tr> - * <tr> - * <td>MISO</td> - * <td>Master Input, Slave Output</td> - * </tr> - * <tr> - * <td>MOSI</td> - * <td>Master Output, Slave Input</td> - * </tr> - * <tr> - * <td>SCK</td> - * <td>Serial Clock</td> - * </tr> - * <tr> - * <td>SPI</td> - * <td>Serial Peripheral Interface</td> - * </tr> - * <tr> - * <td>SS</td> - * <td>Slave Select</td> - * </tr> - * </table> - * - * - * \section asfdoc_sam0_sercom_spi_master_vec_extra_dependencies Dependencies - * - * This driver has the following dependencies: - * - \ref asfdoc_sam0_system_group "System driver" - * - \ref group_sam0_utils "Compiler driver" - * - \ref asfdoc_sam0_port_group "Port driver" - * - \ref Common SERCOM driver base - * - * - * \section asfdoc_sam0_sercom_spi_master_vec_extra_errata Errata - * - * There are no errata related to this driver. - * - * - * \section asfdoc_sam0_sercom_spi_master_vec_extra_history Module History - * - * An overview of the module history is presented in the table below, with - * details on the enhancements and fixes made to the module since its first - * release. The current version of this corresponds to the newest version in the - * table. - * - * <table> - * <tr> - * <th>Changelog</th> - * </tr> - * <tr> - * <td>Initial Release</td> - * </tr> - * </table> - */ - -/** - * \page asfdoc_sam0_sercom_spi_master_vec_exqsg Examples for SERCOM SPI Master Driver w/ Vectored I/O - * - * This is a list of the available Quick Start guides (QSGs) and example - * applications for \ref asfdoc_sam0_sercom_spi_master_vec_group. QSGs are - * simple examples with step-by-step instructions to configure and use this - * driver in a selection of use cases. Note that QSGs can be compiled as a - * standalone application or be added to the user application. - * - * - \subpage asfdoc_sam0_sercom_spi_master_vec_basic - */ - - /** - * \page asfdoc_sam0_sercom_spi_master_vec_document_revision_history Document Revision History - * - * <table> - * <tr> - * <th>Doc. Rev.</td> - * <th>Date</td> - * <th>Comments</td> - * </tr> - * <tr> - * <td>D</td> - * <td>12/2014</td> - * <td>Add SAM L21/C21 support.</td> - * </tr> - * <tr> - * <td>C</td> - * <td>04/2014</td> - * <td>Add SAM D10/D11 support.</td> - * </tr> - * <tr> - * <td>B</td> - * <td>03/2014</td> - * <td>Add SAMR21 support.</td> - * </tr> - * <tr> - * <td>A</td> - * <td>01/2014</td> - * <td>Initial release</td> - * </tr> - * </table> - */ - -#endif /* SPI_MASTER_VEC_H */ diff --git a/atmel-samd/asf/sam0/drivers/sercom/usart/docimg/usart_frame.svg b/atmel-samd/asf/sam0/drivers/sercom/usart/docimg/usart_frame.svg deleted file mode 100644 index 2a7550184..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/usart/docimg/usart_frame.svg +++ /dev/null @@ -1,272 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> -<!-- Generated by Microsoft Visio 11.0, SVG Export, v1.0 usart_frame.svg Page-1 --> -<svg xmlns="http://www.w3.org/2000/svg" xmlns:v="http://schemas.microsoft.com/visio/2003/SVGExtensions/" width="6.50273in" - height="0.879475in" viewBox="0 0 468.197 63.3222" xml:space="preserve" color-interpolation-filters="sRGB" class="st7"> - <v:documentProperties v:langID="1044" v:metric="true" v:viewMarkup="false"/> - - <style type="text/css"> - <![CDATA[ - .st1 {stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.24} - .st2 {fill:none;stroke:none;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.72} - .st3 {fill:#000000;font-family:Arial;font-size:0.666664em} - .st4 {marker-end:url(#mrkr13-134);marker-start:url(#mrkr13-132);stroke:#000000;stroke-linecap:round;stroke-linejoin:round;stroke-width:0.24} - .st5 {fill:#000000;fill-opacity:1;stroke:#000000;stroke-opacity:1;stroke-width:0.08695652173913} - .st6 {fill:#ffffff;stroke:none;stroke-linecap:butt;stroke-width:7.2} - .st7 {fill:none;fill-rule:evenodd;font-size:12;overflow:visible;stroke-linecap:square;stroke-miterlimit:3} - ]]> - </style> - - <defs id="Markers"> - <g id="lend13"> - <path d="M 3 1 L -0 0 L 3 -1 L 3 1 " style="stroke:none"/> - </g> - <marker id="mrkr13-132" class="st5" v:arrowType="13" v:arrowSize="2" v:setback="33" refX="33" orient="auto" - markerUnits="strokeWidth"> - </marker> - <marker id="mrkr13-134" class="st5" v:arrowType="13" v:arrowSize="2" v:setback="34.5" refX="-34.5" orient="auto" - markerUnits="strokeWidth"> - </marker> - </defs> - <g v:mID="0" v:index="1" v:groupContext="foregroundPage"> - <v:userDefs> - <v:ud v:nameU="ShapeNumCriteria" v:prompt="" v:val="VT4(0,0,0,1,1,'',0,0,0,1,0,1,)"/> - </v:userDefs> - <title>Page-1</title> - <v:pageProperties v:drawingScale="0.0393701" v:pageScale="0.0393701" v:drawingUnits="24" v:shadowOffsetX="8.50394" - v:shadowOffsetY="-8.50394"/> - <g id="group3-1" transform="translate(99.4526,-0.72)" v:mID="3" v:groupContext="group"> - <title>Sheet.3</title> - <g id="shape1-2" v:mID="1" v:groupContext="shape" transform="translate(56.6371,6.6572) rotate(63.4349)"> - <title>Sheet.1</title> - <path d="M0 63.32 L31.69 63.32" class="st1"/> - </g> - <g id="shape2-5" v:mID="2" v:groupContext="shape" transform="translate(-56.6371,35.0037) rotate(-63.4349)"> - <title>Sheet.2</title> - <path d="M0 63.32 L31.69 63.32" class="st1"/> - </g> - </g> - <g id="group4-8" transform="translate(127.799,-0.72)" v:mID="4" v:groupContext="group"> - <title>Sheet.4</title> - <g id="shape5-9" v:mID="5" v:groupContext="shape" transform="translate(56.6371,6.6572) rotate(63.4349)"> - <title>Sheet.5</title> - <path d="M0 63.32 L31.69 63.32" class="st1"/> - </g> - <g id="shape6-12" v:mID="6" v:groupContext="shape" transform="translate(-56.6371,35.0037) rotate(-63.4349)"> - <title>Sheet.6</title> - <path d="M0 63.32 L31.69 63.32" class="st1"/> - </g> - </g> - <g id="group7-15" transform="translate(156.146,-0.72)" v:mID="7" v:groupContext="group"> - <title>Sheet.7</title> - <g id="shape8-16" v:mID="8" v:groupContext="shape" transform="translate(56.6371,6.6572) rotate(63.4349)"> - <title>Sheet.8</title> - <path d="M0 63.32 L31.69 63.32" class="st1"/> - </g> - <g id="shape9-19" v:mID="9" v:groupContext="shape" transform="translate(-56.6371,35.0037) rotate(-63.4349)"> - <title>Sheet.9</title> - <path d="M0 63.32 L31.69 63.32" class="st1"/> - </g> - </g> - <g id="group10-22" transform="translate(184.492,-0.72)" v:mID="10" v:groupContext="group"> - <title>Sheet.10</title> - <g id="shape11-23" v:mID="11" v:groupContext="shape" transform="translate(56.6371,6.6572) rotate(63.4349)"> - <title>Sheet.11</title> - <path d="M0 63.32 L31.69 63.32" class="st1"/> - </g> - <g id="shape12-26" v:mID="12" v:groupContext="shape" transform="translate(-56.6371,35.0037) rotate(-63.4349)"> - <title>Sheet.12</title> - <path d="M0 63.32 L31.69 63.32" class="st1"/> - </g> - </g> - <g id="group13-29" transform="translate(212.838,-0.72)" v:mID="13" v:groupContext="group"> - <title>Sheet.13</title> - <g id="shape14-30" v:mID="14" v:groupContext="shape" transform="translate(56.6371,6.6572) rotate(63.4349)"> - <title>Sheet.14</title> - <path d="M0 63.32 L31.69 63.32" class="st1"/> - </g> - <g id="shape15-33" v:mID="15" v:groupContext="shape" transform="translate(-56.6371,35.0037) rotate(-63.4349)"> - <title>Sheet.15</title> - <path d="M0 63.32 L31.69 63.32" class="st1"/> - </g> - </g> - <g id="group16-36" transform="translate(241.185,-0.72)" v:mID="16" v:groupContext="group"> - <title>Sheet.16</title> - <g id="shape17-37" v:mID="17" v:groupContext="shape" transform="translate(56.6371,6.6572) rotate(63.4349)"> - <title>Sheet.17</title> - <path d="M0 63.32 L31.69 63.32" class="st1"/> - </g> - <g id="shape18-40" v:mID="18" v:groupContext="shape" transform="translate(-56.6371,35.0037) rotate(-63.4349)"> - <title>Sheet.18</title> - <path d="M0 63.32 L31.69 63.32" class="st1"/> - </g> - </g> - <g id="group19-43" transform="translate(269.531,-0.72)" v:mID="19" v:groupContext="group"> - <title>Sheet.19</title> - <g id="shape20-44" v:mID="20" v:groupContext="shape" transform="translate(56.6371,6.6572) rotate(63.4349)"> - <title>Sheet.20</title> - <path d="M0 63.32 L31.69 63.32" class="st1"/> - </g> - <g id="shape21-47" v:mID="21" v:groupContext="shape" transform="translate(-56.6371,35.0037) rotate(-63.4349)"> - <title>Sheet.21</title> - <path d="M0 63.32 L31.69 63.32" class="st1"/> - </g> - </g> - <g id="shape22-50" v:mID="22" v:groupContext="shape" transform="translate(107.957,-0.72)"> - <title>Sheet.22</title> - <desc>1</desc> - <v:textBlock v:margins="rect(4,4,4,4)"/> - <v:textRect cx="14.1732" cy="49.149" width="28.35" height="28.3465"/> - <rect x="0" y="34.9757" width="28.3465" height="28.3465" class="st2"/> - <text x="11.95" y="51.55" class="st3" v:langID="1044"><v:paragraph v:horizAlign="1"/><v:tabList/>1</text> </g> - <g id="shape23-53" v:mID="23" v:groupContext="shape" transform="translate(134.886,-0.72)"> - <title>Sheet.23</title> - <desc>2</desc> - <v:textBlock v:margins="rect(4,4,4,4)"/> - <v:textRect cx="14.1732" cy="49.149" width="28.35" height="28.3465"/> - <rect x="0" y="34.9757" width="28.3465" height="28.3465" class="st2"/> - <text x="11.95" y="51.55" class="st3" v:langID="1044"><v:paragraph v:horizAlign="1"/><v:tabList/>2</text> </g> - <g id="shape24-56" v:mID="24" v:groupContext="shape" transform="translate(163.232,-0.72)"> - <title>Sheet.24</title> - <desc>3</desc> - <v:textBlock v:margins="rect(4,4,4,4)"/> - <v:textRect cx="14.1732" cy="49.149" width="28.35" height="28.3465"/> - <rect x="0" y="34.9757" width="28.3465" height="28.3465" class="st2"/> - <text x="11.95" y="51.55" class="st3" v:langID="1044"><v:paragraph v:horizAlign="1"/><v:tabList/>3</text> </g> - <g id="shape25-59" v:mID="25" v:groupContext="shape" transform="translate(191.579,-0.72)"> - <title>Sheet.25</title> - <desc>4</desc> - <v:textBlock v:margins="rect(4,4,4,4)"/> - <v:textRect cx="14.1732" cy="49.149" width="28.35" height="28.3465"/> - <rect x="0" y="34.9757" width="28.3465" height="28.3465" class="st2"/> - <text x="11.95" y="51.55" class="st3" v:langID="1044"><v:paragraph v:horizAlign="1"/><v:tabList/>4</text> </g> - <g id="shape26-62" v:mID="26" v:groupContext="shape" transform="translate(219.925,-0.72)"> - <title>Sheet.26</title> - <desc>[5]</desc> - <v:textBlock v:margins="rect(4,4,4,4)"/> - <v:textRect cx="14.1732" cy="49.149" width="28.35" height="28.3465"/> - <rect x="0" y="34.9757" width="28.3465" height="28.3465" class="st2"/> - <text x="9.73" y="51.55" class="st3" v:langID="1044"><v:paragraph v:horizAlign="1"/><v:tabList/>[5]</text> </g> - <g id="shape27-65" v:mID="27" v:groupContext="shape" transform="translate(248.271,-0.72)"> - <title>Sheet.27</title> - <desc>[6]</desc> - <v:textBlock v:margins="rect(4,4,4,4)"/> - <v:textRect cx="14.1732" cy="49.149" width="28.35" height="28.3465"/> - <rect x="0" y="34.9757" width="28.3465" height="28.3465" class="st2"/> - <text x="9.73" y="51.55" class="st3" v:langID="1044"><v:paragraph v:horizAlign="1"/><v:tabList/>[6]</text> </g> - <g id="shape28-68" v:mID="28" v:groupContext="shape" transform="translate(275.909,-0.72)"> - <title>Sheet.28</title> - <desc>[7]</desc> - <v:textBlock v:margins="rect(4,4,4,4)"/> - <v:textRect cx="14.1732" cy="49.149" width="28.35" height="28.3465"/> - <rect x="0" y="34.9757" width="28.3465" height="28.3465" class="st2"/> - <text x="9.73" y="51.55" class="st3" v:langID="1044"><v:paragraph v:horizAlign="1"/><v:tabList/>[7]</text> </g> - <g id="shape29-71" v:mID="29" v:groupContext="shape" transform="translate(302.838,-0.72)"> - <title>Sheet.29</title> - <desc>[8]</desc> - <v:textBlock v:margins="rect(4,4,4,4)"/> - <v:textRect cx="14.1732" cy="49.149" width="28.35" height="28.3465"/> - <rect x="0" y="34.9757" width="28.3465" height="28.3465" class="st2"/> - <text x="9.73" y="51.55" class="st3" v:langID="1044"><v:paragraph v:horizAlign="1"/><v:tabList/>[8]</text> </g> - <g id="shape30-74" v:mID="30" v:groupContext="shape" transform="translate(141.916,62.5743) rotate(116.565)"> - <title>Sheet.30</title> - <path d="M0 63.32 L31.69 63.32" class="st1"/> - </g> - <g id="group31-77" transform="translate(297.878,-0.72)" v:mID="31" v:groupContext="group"> - <title>Sheet.31</title> - <g id="shape32-78" v:mID="32" v:groupContext="shape" transform="translate(56.6371,6.6572) rotate(63.4349)"> - <title>Sheet.32</title> - <path d="M0 63.32 L31.69 63.32" class="st1"/> - </g> - <g id="shape33-81" v:mID="33" v:groupContext="shape" transform="translate(-56.6371,35.0037) rotate(-63.4349)"> - <title>Sheet.33</title> - <path d="M0 63.32 L31.69 63.32" class="st1"/> - </g> - </g> - <g id="shape34-84" v:mID="34" v:groupContext="shape" transform="translate(269.587,34.2837) rotate(-63.4349)"> - <title>Sheet.34</title> - <path d="M0 63.32 L31.69 63.32" class="st1"/> - </g> - <g id="shape35-87" v:mID="35" v:groupContext="shape" transform="translate(0.24,-0.72)"> - <title>Sheet.35</title> - <path d="M325.98 63.32 L70.87 63.32 L56.69 63.32 L42.52 34.98 L0 34.98" class="st1"/> - </g> - <g id="shape37-90" v:mID="37" v:groupContext="shape" transform="translate(467.957,97.578) rotate(180)"> - <title>Sheet.37</title> - <path d="M0 63.32 L56.69 63.32" class="st1"/> - </g> - <g id="shape38-93" v:mID="38" v:groupContext="shape" transform="translate(79.6101,-0.72)"> - <title>Sheet.38</title> - <desc>0</desc> - <v:textBlock v:margins="rect(4,4,4,4)"/> - <v:textRect cx="14.1732" cy="49.149" width="28.35" height="28.3465"/> - <rect x="0" y="34.9757" width="28.3465" height="28.3465" class="st2"/> - <text x="11.95" y="51.55" class="st3" v:langID="1044"><v:paragraph v:horizAlign="1"/><v:tabList/>0</text> </g> - <g id="shape39-96" v:mID="39" v:groupContext="shape" transform="translate(49.8463,-0.72)"> - <title>Sheet.39</title> - <desc>St</desc> - <v:textBlock v:margins="rect(4,4,4,4)"/> - <v:textRect cx="14.1732" cy="49.149" width="28.35" height="28.3465"/> - <rect x="0" y="34.9757" width="28.3465" height="28.3465" class="st2"/> - <text x="10.39" y="51.55" class="st3" v:langID="1044"><v:paragraph v:horizAlign="1"/><v:tabList/>St</text> </g> - <g id="shape40-99" v:mID="40" v:groupContext="shape" transform="translate(8.74394,-0.72)"> - <title>Sheet.40</title> - <desc>(IDLE)</desc> - <v:textBlock v:margins="rect(4,4,4,4)"/> - <v:textRect cx="18.4252" cy="49.149" width="36.86" height="28.3465"/> - <rect x="0" y="34.9757" width="36.8504" height="28.3465" class="st2"/> - <text x="6.87" y="51.55" class="st3" v:langID="1044"><v:paragraph v:horizAlign="1"/><v:tabList/>(IDLE)</text> </g> - <g id="shape41-102" v:mID="41" v:groupContext="shape" transform="translate(361.657,-0.72)"> - <title>Sheet.41</title> - <desc>Sp1</desc> - <v:textBlock v:margins="rect(4,4,4,4)"/> - <v:textRect cx="14.1732" cy="49.149" width="28.35" height="28.3465"/> - <rect x="0" y="34.9757" width="28.3465" height="28.3465" class="st2"/> - <text x="7.06" y="51.55" class="st3" v:langID="1044"><v:paragraph v:horizAlign="1"/><v:tabList/>Sp1</text> </g> - <g id="shape42-105" v:mID="42" v:groupContext="shape" transform="translate(388.586,-0.72)"> - <title>Sheet.42</title> - <desc>[Sp2]</desc> - <v:textBlock v:margins="rect(4,4,4,4)"/> - <v:textRect cx="14.1732" cy="49.149" width="28.35" height="28.3465"/> - <rect x="0" y="34.9757" width="28.3465" height="28.3465" class="st2"/> - <text x="4.83" y="51.55" class="st3" v:langID="1044"><v:paragraph v:horizAlign="1"/><v:tabList/>[Sp2]</text> </g> - <g id="shape43-108" v:mID="43" v:groupContext="shape" transform="translate(422.602,-0.72)"> - <title>Sheet.43</title> - <desc>(St/IDLE)</desc> - <v:textBlock v:margins="rect(4,4,4,4)"/> - <v:textRect cx="21.2598" cy="49.149" width="42.52" height="28.3465"/> - <rect x="0" y="34.9757" width="42.5197" height="28.3465" class="st2"/> - <text x="4.81" y="51.55" class="st3" v:langID="1044"><v:paragraph v:horizAlign="1"/><v:tabList/>(St/IDLE)</text> </g> - <g id="shape44-111" v:mID="44" v:groupContext="shape" transform="translate(-20.5625,22.9172) rotate(-90)"> - <title>Sheet.44</title> - <path d="M0 63.32 L22.68 63.32" class="st1"/> - </g> - <g id="shape45-114" v:mID="45" v:groupContext="shape" transform="translate(347.941,22.9172) rotate(-90)"> - <title>Sheet.45</title> - <path d="M0 63.32 L22.68 63.32" class="st1"/> - </g> - <g id="shape240-117" v:mID="240" v:groupContext="shape" transform="translate(326.224,-0.72)"> - <title>Sheet.240</title> - <path d="M42.52 34.98 L28.35 63.32 L14.17 63.32 L0 34.98" class="st1"/> - </g> - <g id="shape36-120" v:mID="36" v:groupContext="shape" transform="translate(85.2794,-0.72)"> - <title>Sheet.36</title> - <path d="M0 34.98 L325.98 34.98 L340.16 63.32 L379.84 63.32" class="st1"/> - </g> - <g id="shape241-123" v:mID="241" v:groupContext="shape" transform="translate(333.311,-0.72)"> - <title>Sheet.241</title> - <desc>[P]</desc> - <v:textBlock v:margins="rect(4,4,4,4)"/> - <v:textRect cx="14.1732" cy="49.149" width="28.35" height="28.3465"/> - <rect x="0" y="34.9757" width="28.3465" height="28.3465" class="st2"/> - <text x="9.28" y="51.55" class="st3" v:langID="1044"><v:paragraph v:horizAlign="1"/><v:tabList/>[P]</text> </g> - <g id="shape242-126" v:mID="242" v:groupContext="shape" transform="translate(42.7597,-51.7436)"> - <title>Sheet.242</title> - <desc>Frame</desc> - <v:textBlock v:margins="rect(4,4,4,4)" v:tabSpace="42.5197"/> - <v:textRect cx="184.252" cy="63.3222" width="368.51" height="0"/> - <path d="M7.92 63.32 L8.28 63.32 L360.22 63.32" class="st4"/> - <rect v:rectContext="textBkgnd" x="172.695" y="58.5223" width="23.1133" height="9.59985" class="st6"/> - <text x="172.7" y="65.72" class="st3" v:langID="1044"><v:paragraph v:horizAlign="1"/><v:tabList/>Frame</text> </g> - </g> -</svg> diff --git a/atmel-samd/asf/sam0/drivers/sercom/usart/usart.c b/atmel-samd/asf/sam0/drivers/sercom/usart/usart.c deleted file mode 100644 index ab1c3bacf..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/usart/usart.c +++ /dev/null @@ -1,817 +0,0 @@ -/** - * \file - * - * \brief SAM SERCOM USART Driver - * - * Copyright (C) 2012-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#include "usart.h" -#include <pinmux.h> -#if USART_CALLBACK_MODE == true -# include "usart_interrupt.h" -#endif - -/** - * \internal - * Set Configuration of the USART module - */ -static enum status_code _usart_set_config( - struct usart_module *const module, - const struct usart_config *const config) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - /* Get a pointer to the hardware module instance */ - SercomUsart *const usart_hw = &(module->hw->USART); - - /* Index for generic clock */ - uint32_t sercom_index = _sercom_get_sercom_inst_index(module->hw); - uint32_t gclk_index = sercom_index + SERCOM0_GCLK_ID_CORE; - - /* Cache new register values to minimize the number of register writes */ - uint32_t ctrla = 0; - uint32_t ctrlb = 0; -#ifdef FEATURE_USART_ISO7816 - uint32_t ctrlc = 0; -#endif - uint16_t baud = 0; - uint32_t transfer_mode; - - enum sercom_asynchronous_operation_mode mode = SERCOM_ASYNC_OPERATION_MODE_ARITHMETIC; - enum sercom_asynchronous_sample_num sample_num = SERCOM_ASYNC_SAMPLE_NUM_16; - -#ifdef FEATURE_USART_OVER_SAMPLE - switch (config->sample_rate) { - case USART_SAMPLE_RATE_16X_ARITHMETIC: - mode = SERCOM_ASYNC_OPERATION_MODE_ARITHMETIC; - sample_num = SERCOM_ASYNC_SAMPLE_NUM_16; - break; - case USART_SAMPLE_RATE_8X_ARITHMETIC: - mode = SERCOM_ASYNC_OPERATION_MODE_ARITHMETIC; - sample_num = SERCOM_ASYNC_SAMPLE_NUM_8; - break; - case USART_SAMPLE_RATE_3X_ARITHMETIC: - mode = SERCOM_ASYNC_OPERATION_MODE_ARITHMETIC; - sample_num = SERCOM_ASYNC_SAMPLE_NUM_3; - break; - case USART_SAMPLE_RATE_16X_FRACTIONAL: - mode = SERCOM_ASYNC_OPERATION_MODE_FRACTIONAL; - sample_num = SERCOM_ASYNC_SAMPLE_NUM_16; - break; - case USART_SAMPLE_RATE_8X_FRACTIONAL: - mode = SERCOM_ASYNC_OPERATION_MODE_FRACTIONAL; - sample_num = SERCOM_ASYNC_SAMPLE_NUM_8; - break; - } -#endif - - /* Set data order, internal muxing, and clock polarity */ - ctrla = (uint32_t)config->data_order | - (uint32_t)config->mux_setting | - #ifdef FEATURE_USART_OVER_SAMPLE - config->sample_adjustment | - config->sample_rate | - #endif - #ifdef FEATURE_USART_IMMEDIATE_BUFFER_OVERFLOW_NOTIFICATION - (config->immediate_buffer_overflow_notification << SERCOM_USART_CTRLA_IBON_Pos) | - #endif - (config->clock_polarity_inverted << SERCOM_USART_CTRLA_CPOL_Pos); - - enum status_code status_code = STATUS_OK; - - transfer_mode = (uint32_t)config->transfer_mode; -#ifdef FEATURE_USART_ISO7816 - if(config->iso7816_config.enabled) { - transfer_mode = config->iso7816_config.protocol_t; - } -#endif - /* Get baud value from mode and clock */ -#ifdef FEATURE_USART_ISO7816 - if(config->iso7816_config.enabled) { - baud = config->baudrate; - } else { -#endif - switch (transfer_mode) - { - case USART_TRANSFER_SYNCHRONOUSLY: - if (!config->use_external_clock) { - status_code = _sercom_get_sync_baud_val(config->baudrate, - system_gclk_chan_get_hz(gclk_index), &baud); - } - - break; - - case USART_TRANSFER_ASYNCHRONOUSLY: - if (config->use_external_clock) { - status_code = - _sercom_get_async_baud_val(config->baudrate, - config->ext_clock_freq, &baud, mode, sample_num); - } else { - status_code = - _sercom_get_async_baud_val(config->baudrate, - system_gclk_chan_get_hz(gclk_index), &baud, mode, sample_num); - } - - break; - } - - /* Check if calculating the baudrate failed */ - if (status_code != STATUS_OK) { - /* Abort */ - return status_code; - } -#ifdef FEATURE_USART_ISO7816 - } -#endif - -#ifdef FEATURE_USART_IRDA - if(config->encoding_format_enable) { - usart_hw->RXPL.reg = config->receive_pulse_length; - } -#endif - - /* Wait until synchronization is complete */ - _usart_wait_for_sync(module); - - /*Set baud val */ - usart_hw->BAUD.reg = baud; - - /* Set sample mode */ - ctrla |= transfer_mode; - - if (config->use_external_clock == false) { - ctrla |= SERCOM_USART_CTRLA_MODE(0x1); - } - else { - ctrla |= SERCOM_USART_CTRLA_MODE(0x0); - } - - /* Set stopbits and enable transceivers */ - ctrlb = - #ifdef FEATURE_USART_IRDA - (config->encoding_format_enable << SERCOM_USART_CTRLB_ENC_Pos) | - #endif - #ifdef FEATURE_USART_START_FRAME_DECTION - (config->start_frame_detection_enable << SERCOM_USART_CTRLB_SFDE_Pos) | - #endif - #ifdef FEATURE_USART_COLLISION_DECTION - (config->collision_detection_enable << SERCOM_USART_CTRLB_COLDEN_Pos) | - #endif - (config->receiver_enable << SERCOM_USART_CTRLB_RXEN_Pos) | - (config->transmitter_enable << SERCOM_USART_CTRLB_TXEN_Pos); - -#ifdef FEATURE_USART_ISO7816 - if(config->iso7816_config.enabled) { - ctrla |= SERCOM_USART_CTRLA_FORM(0x07); - if (config->iso7816_config.enable_inverse) { - ctrla |= SERCOM_USART_CTRLA_TXINV | SERCOM_USART_CTRLA_RXINV; - } - ctrlb |= USART_CHARACTER_SIZE_8BIT; - - switch(config->iso7816_config.protocol_t) { - case ISO7816_PROTOCOL_T_0: - ctrlb |= (uint32_t)config->stopbits; - ctrlc |= SERCOM_USART_CTRLC_GTIME(config->iso7816_config.guard_time) | \ - (config->iso7816_config.inhibit_nack) | \ - (config->iso7816_config.successive_recv_nack) | \ - SERCOM_USART_CTRLC_MAXITER(config->iso7816_config.max_iterations); - break; - case ISO7816_PROTOCOL_T_1: - ctrlb |= USART_STOPBITS_1; - break; - } - } else { -#endif - ctrlb |= (uint32_t)config->character_size; - /* Check parity mode bits */ - if (config->parity != USART_PARITY_NONE) { - ctrla |= SERCOM_USART_CTRLA_FORM(1); - ctrlb |= config->parity; - } else { -#ifdef FEATURE_USART_LIN_SLAVE - if(config->lin_slave_enable) { - ctrla |= SERCOM_USART_CTRLA_FORM(0x4); - } else { - ctrla |= SERCOM_USART_CTRLA_FORM(0); - } -#else - ctrla |= SERCOM_USART_CTRLA_FORM(0); -#endif - } -#ifdef FEATURE_USART_ISO7816 - } -#endif - -#ifdef FEATURE_USART_LIN_MASTER - usart_hw->CTRLC.reg = ((usart_hw->CTRLC.reg) & SERCOM_USART_CTRLC_GTIME_Msk) - | config->lin_header_delay - | config->lin_break_length; - - if (config->lin_node != LIN_INVALID_MODE) { - ctrla &= ~(SERCOM_USART_CTRLA_FORM(0xf)); - ctrla |= config->lin_node; - } -#endif - - /* Set whether module should run in standby. */ - if (config->run_in_standby || system_is_debugger_present()) { - ctrla |= SERCOM_USART_CTRLA_RUNSTDBY; - } - - /* Wait until synchronization is complete */ - _usart_wait_for_sync(module); - - /* Write configuration to CTRLB */ - usart_hw->CTRLB.reg = ctrlb; - - /* Wait until synchronization is complete */ - _usart_wait_for_sync(module); - - /* Write configuration to CTRLA */ - usart_hw->CTRLA.reg = ctrla; - -#ifdef FEATURE_USART_RS485 - if ((usart_hw->CTRLA.reg & SERCOM_USART_CTRLA_FORM_Msk) != \ - SERCOM_USART_CTRLA_FORM(0x07)) { - usart_hw->CTRLC.reg &= ~(SERCOM_USART_CTRLC_GTIME(0x7)); - usart_hw->CTRLC.reg |= SERCOM_USART_CTRLC_GTIME(config->rs485_guard_time); - } -#endif - -#ifdef FEATURE_USART_ISO7816 - if(config->iso7816_config.enabled) { - _usart_wait_for_sync(module); - usart_hw->CTRLC.reg = ctrlc; - } -#endif - - return STATUS_OK; -} - -/** - * \brief Initializes the device - * - * Initializes the USART device based on the setting specified in the - * configuration struct. - * - * \param[out] module Pointer to USART device - * \param[in] hw Pointer to USART hardware instance - * \param[in] config Pointer to configuration struct - * - * \return Status of the initialization. - * - * \retval STATUS_OK The initialization was successful - * \retval STATUS_BUSY The USART module is busy - * resetting - * \retval STATUS_ERR_DENIED The USART has not been disabled in - * advance of initialization - * \retval STATUS_ERR_INVALID_ARG The configuration struct contains - * invalid configuration - * \retval STATUS_ERR_ALREADY_INITIALIZED The SERCOM instance has already been - * initialized with different clock - * configuration - * \retval STATUS_ERR_BAUD_UNAVAILABLE The BAUD rate given by the - * configuration - * struct cannot be reached with - * the current clock configuration - */ -enum status_code usart_init( - struct usart_module *const module, - Sercom *const hw, - const struct usart_config *const config) -{ - /* Sanity check arguments */ - Assert(module); - Assert(hw); - Assert(config); - - enum status_code status_code = STATUS_OK; - - /* Assign module pointer to software instance struct */ - module->hw = hw; - - /* Get a pointer to the hardware module instance */ - SercomUsart *const usart_hw = &(module->hw->USART); - - uint32_t sercom_index = _sercom_get_sercom_inst_index(module->hw); - uint32_t pm_index, gclk_index; -#if (SAML22) || (SAMC20) - pm_index = sercom_index + MCLK_APBCMASK_SERCOM0_Pos; - gclk_index = sercom_index + SERCOM0_GCLK_ID_CORE; -#elif (SAML21) || (SAMR30) - if (sercom_index == 5) { - pm_index = MCLK_APBDMASK_SERCOM5_Pos; - gclk_index = SERCOM5_GCLK_ID_CORE; - } else { - pm_index = sercom_index + MCLK_APBCMASK_SERCOM0_Pos; - gclk_index = sercom_index + SERCOM0_GCLK_ID_CORE; - } -#elif (SAMC21) - pm_index = sercom_index + MCLK_APBCMASK_SERCOM0_Pos; - - if (sercom_index == 5){ - gclk_index = SERCOM5_GCLK_ID_CORE; - } else { - gclk_index = sercom_index + SERCOM0_GCLK_ID_CORE; - } -#else - pm_index = sercom_index + PM_APBCMASK_SERCOM0_Pos; - gclk_index = sercom_index + SERCOM0_GCLK_ID_CORE; -#endif - - if (usart_hw->CTRLA.reg & SERCOM_USART_CTRLA_SWRST) { - /* The module is busy resetting itself */ - return STATUS_BUSY; - } - - if (usart_hw->CTRLA.reg & SERCOM_USART_CTRLA_ENABLE) { - /* Check the module is enabled */ - return STATUS_ERR_DENIED; - } - - /* Turn on module in PM */ -#if (SAML21) || (SAMR30) - if (sercom_index == 5) { - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBD, 1 << pm_index); - } else { - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBC, 1 << pm_index); - } -#else - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBC, 1 << pm_index); -#endif - - /* Set up the GCLK for the module */ - struct system_gclk_chan_config gclk_chan_conf; - system_gclk_chan_get_config_defaults(&gclk_chan_conf); - gclk_chan_conf.source_generator = config->generator_source; - system_gclk_chan_set_config(gclk_index, &gclk_chan_conf); - system_gclk_chan_enable(gclk_index); - sercom_set_gclk_generator(config->generator_source, false); - - /* Set character size */ - module->character_size = config->character_size; - - /* Set transmitter and receiver status */ - module->receiver_enabled = config->receiver_enable; - module->transmitter_enabled = config->transmitter_enable; - -#ifdef FEATURE_USART_LIN_SLAVE - module->lin_slave_enabled = config->lin_slave_enable; -#endif -#ifdef FEATURE_USART_START_FRAME_DECTION - module->start_frame_detection_enabled = config->start_frame_detection_enable; -#endif -#ifdef FEATURE_USART_ISO7816 - module->iso7816_mode_enabled = config->iso7816_config.enabled; -#endif - /* Set configuration according to the config struct */ - status_code = _usart_set_config(module, config); - if(status_code != STATUS_OK) { - return status_code; - } - - struct system_pinmux_config pin_conf; - system_pinmux_get_config_defaults(&pin_conf); - pin_conf.direction = SYSTEM_PINMUX_PIN_DIR_INPUT; - pin_conf.input_pull = SYSTEM_PINMUX_PIN_PULL_NONE; - - uint32_t pad_pinmuxes[] = { - config->pinmux_pad0, config->pinmux_pad1, - config->pinmux_pad2, config->pinmux_pad3 - }; - - /* Configure the SERCOM pins according to the user configuration */ - for (uint8_t pad = 0; pad < 4; pad++) { - uint32_t current_pinmux = pad_pinmuxes[pad]; - - if (current_pinmux == PINMUX_DEFAULT) { - current_pinmux = _sercom_get_default_pad(hw, pad); - } - - if (current_pinmux != PINMUX_UNUSED) { - pin_conf.mux_position = current_pinmux & 0xFFFF; - system_pinmux_pin_set_config(current_pinmux >> 16, &pin_conf); - } - } - -#if USART_CALLBACK_MODE == true - /* Initialize parameters */ - for (uint32_t i = 0; i < USART_CALLBACK_N; i++) { - module->callback[i] = NULL; - } - - module->tx_buffer_ptr = NULL; - module->rx_buffer_ptr = NULL; - module->remaining_tx_buffer_length = 0x0000; - module->remaining_rx_buffer_length = 0x0000; - module->callback_reg_mask = 0x00; - module->callback_enable_mask = 0x00; - module->rx_status = STATUS_OK; - module->tx_status = STATUS_OK; - - /* Set interrupt handler and register USART software module struct in - * look-up table */ - uint8_t instance_index = _sercom_get_sercom_inst_index(module->hw); - _sercom_set_handler(instance_index, _usart_interrupt_handler); - _sercom_instances[instance_index] = module; -#endif - - return status_code; -} - -/** - * \brief Transmit a character via the USART - * - * This blocking function will transmit a single character via the - * USART. - * - * \param[in] module Pointer to the software instance struct - * \param[in] tx_data Data to transfer - * - * \return Status of the operation. - * \retval STATUS_OK If the operation was completed - * \retval STATUS_BUSY If the operation was not completed, due to the USART - * module being busy - * \retval STATUS_ERR_DENIED If the transmitter is not enabled - */ -enum status_code usart_write_wait( - struct usart_module *const module, - const uint16_t tx_data) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - /* Get a pointer to the hardware module instance */ - SercomUsart *const usart_hw = &(module->hw->USART); - - /* Check that the transmitter is enabled */ - if (!(module->transmitter_enabled)) { - return STATUS_ERR_DENIED; - } - -#if USART_CALLBACK_MODE == true - /* Check if the USART is busy doing asynchronous operation. */ - if (module->remaining_tx_buffer_length > 0) { - return STATUS_BUSY; - } - -#else - /* Check if USART is ready for new data */ - if (!(usart_hw->INTFLAG.reg & SERCOM_USART_INTFLAG_DRE)) { - /* Return error code */ - return STATUS_BUSY; - } -#endif - - /* Wait until synchronization is complete */ - _usart_wait_for_sync(module); - - /* Write data to USART module */ - usart_hw->DATA.reg = tx_data; - - while (!(usart_hw->INTFLAG.reg & SERCOM_USART_INTFLAG_TXC)) { - /* Wait until data is sent */ - } - - return STATUS_OK; -} - -/** - * \brief Receive a character via the USART - * - * This blocking function will receive a character via the USART. - * - * \param[in] module Pointer to the software instance struct - * \param[out] rx_data Pointer to received data - * - * \return Status of the operation. - * \retval STATUS_OK If the operation was completed - * \retval STATUS_BUSY If the operation was not completed, - * due to the USART module being busy - * \retval STATUS_ERR_BAD_FORMAT If the operation was not completed, - * due to configuration mismatch between USART - * and the sender - * \retval STATUS_ERR_BAD_OVERFLOW If the operation was not completed, - * due to the baudrate being too low or the - * system frequency being too high - * \retval STATUS_ERR_BAD_DATA If the operation was not completed, due to - * data being corrupted - * \retval STATUS_ERR_DENIED If the receiver is not enabled - */ -enum status_code usart_read_wait( - struct usart_module *const module, - uint16_t *const rx_data) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - /* Error variable */ - uint8_t error_code; - - /* Get a pointer to the hardware module instance */ - SercomUsart *const usart_hw = &(module->hw->USART); - - /* Check that the receiver is enabled */ - if (!(module->receiver_enabled)) { - return STATUS_ERR_DENIED; - } - -#if USART_CALLBACK_MODE == true - /* Check if the USART is busy doing asynchronous operation. */ - if (module->remaining_rx_buffer_length > 0) { - return STATUS_BUSY; - } -#endif - - /* Check if USART has new data */ - if (!(usart_hw->INTFLAG.reg & SERCOM_USART_INTFLAG_RXC)) { - /* Return error code */ - return STATUS_BUSY; - } - - /* Wait until synchronization is complete */ - _usart_wait_for_sync(module); - - /* Read out the status code and mask away all but the 3 LSBs*/ - error_code = (uint8_t)(usart_hw->STATUS.reg & SERCOM_USART_STATUS_MASK); - - /* Check if an error has occurred during the receiving */ - if (error_code) { - /* Check which error occurred */ - if (error_code & SERCOM_USART_STATUS_FERR) { - /* Clear flag by writing a 1 to it and - * return with an error code */ - usart_hw->STATUS.reg = SERCOM_USART_STATUS_FERR; - - return STATUS_ERR_BAD_FORMAT; - } else if (error_code & SERCOM_USART_STATUS_BUFOVF) { - /* Clear flag by writing a 1 to it and - * return with an error code */ - usart_hw->STATUS.reg = SERCOM_USART_STATUS_BUFOVF; - - return STATUS_ERR_OVERFLOW; - } else if (error_code & SERCOM_USART_STATUS_PERR) { - /* Clear flag by writing a 1 to it and - * return with an error code */ - usart_hw->STATUS.reg = SERCOM_USART_STATUS_PERR; - - return STATUS_ERR_BAD_DATA; - } -#ifdef FEATURE_USART_LIN_SLAVE - else if (error_code & SERCOM_USART_STATUS_ISF) { - /* Clear flag by writing 1 to it and - * return with an error code */ - usart_hw->STATUS.reg = SERCOM_USART_STATUS_ISF; - - return STATUS_ERR_PROTOCOL; - } -#endif -#ifdef FEATURE_USART_COLLISION_DECTION - else if (error_code & SERCOM_USART_STATUS_COLL) { - /* Clear flag by writing 1 to it - * return with an error code */ - usart_hw->STATUS.reg = SERCOM_USART_STATUS_COLL; - - return STATUS_ERR_PACKET_COLLISION; - } -#endif - } - - /* Read data from USART module */ - *rx_data = usart_hw->DATA.reg; - - return STATUS_OK; -} - -/** - * \brief Transmit a buffer of characters via the USART - * - * This blocking function will transmit a block of \c length characters - * via the USART. - * - * \note Using this function in combination with the interrupt (\c _job) functions is - * not recommended as it has no functionality to check if there is an - * ongoing interrupt driven operation running or not. - * - * \param[in] module Pointer to USART software instance struct - * \param[in] tx_data Pointer to data to transmit - * \param[in] length Number of characters to transmit - * - * \note If using 9-bit data, the array that *tx_data point to should be defined - * as uint16_t array and should be casted to uint8_t* pointer. Because it - * is an address pointer, the highest byte is not discarded. For example: - * \code - #define TX_LEN 3 - uint16_t tx_buf[TX_LEN] = {0x0111, 0x0022, 0x0133}; - usart_write_buffer_wait(&module, (uint8_t*)tx_buf, TX_LEN); - \endcode - * - * \return Status of the operation. - * \retval STATUS_OK If operation was completed - * \retval STATUS_ERR_INVALID_ARG If operation was not completed, due to invalid - * arguments - * \retval STATUS_ERR_TIMEOUT If operation was not completed, due to USART - * module timing out - * \retval STATUS_ERR_DENIED If the transmitter is not enabled - */ -enum status_code usart_write_buffer_wait( - struct usart_module *const module, - const uint8_t *tx_data, - uint16_t length) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - /* Check if the buffer length is valid */ - if (length == 0) { - return STATUS_ERR_INVALID_ARG; - } - - /* Check that the transmitter is enabled */ - if (!(module->transmitter_enabled)) { - return STATUS_ERR_DENIED; - } - - /* Get a pointer to the hardware module instance */ - SercomUsart *const usart_hw = &(module->hw->USART); - - /* Wait until synchronization is complete */ - _usart_wait_for_sync(module); - - uint16_t tx_pos = 0; - - /* Blocks while buffer is being transferred */ - while (length--) { - /* Wait for the USART to be ready for new data and abort - * operation if it doesn't get ready within the timeout*/ - for (uint32_t i = 0; i <= USART_TIMEOUT; i++) { - if (usart_hw->INTFLAG.reg & SERCOM_USART_INTFLAG_DRE) { - break; - } else if (i == USART_TIMEOUT) { - return STATUS_ERR_TIMEOUT; - } - } - - /* Data to send is at least 8 bits long */ - uint16_t data_to_send = tx_data[tx_pos++]; - - /* Check if the character size exceeds 8 bit */ - if (module->character_size == USART_CHARACTER_SIZE_9BIT) { - data_to_send |= (tx_data[tx_pos++] << 8); - } - - /* Send the data through the USART module */ - usart_write_wait(module, data_to_send); - } - - /* Wait until Transmit is complete or timeout */ - for (uint32_t i = 0; i <= USART_TIMEOUT; i++) { - if (usart_hw->INTFLAG.reg & SERCOM_USART_INTFLAG_TXC) { - break; - } else if (i == USART_TIMEOUT) { - return STATUS_ERR_TIMEOUT; - } - } - - return STATUS_OK; -} - -/** - * \brief Receive a buffer of \c length characters via the USART - * - * This blocking function will receive a block of \c length characters - * via the USART. - * - * \note Using this function in combination with the interrupt (\c *_job) - * functions is not recommended as it has no functionality to check if - * there is an ongoing interrupt driven operation running or not. - * - * \param[in] module Pointer to USART software instance struct - * \param[out] rx_data Pointer to receive buffer - * \param[in] length Number of characters to receive - * - * \note If using 9-bit data, the array that *rx_data point to should be defined - * as uint16_t array and should be casted to uint8_t* pointer. Because it - * is an address pointer, the highest byte is not discarded. For example: - * \code - #define RX_LEN 3 - uint16_t rx_buf[RX_LEN] = {0x0,}; - usart_read_buffer_wait(&module, (uint8_t*)rx_buf, RX_LEN); - \endcode - * - * \return Status of the operation. - * \retval STATUS_OK If operation was completed - * \retval STATUS_ERR_INVALID_ARG If operation was not completed, due to an - * invalid argument being supplied - * \retval STATUS_ERR_TIMEOUT If operation was not completed, due - * to USART module timing out - * \retval STATUS_ERR_BAD_FORMAT If the operation was not completed, - * due to a configuration mismatch - * between USART and the sender - * \retval STATUS_ERR_BAD_OVERFLOW If the operation was not completed, - * due to the baudrate being too low or the - * system frequency being too high - * \retval STATUS_ERR_BAD_DATA If the operation was not completed, due - * to data being corrupted - * \retval STATUS_ERR_DENIED If the receiver is not enabled - */ -enum status_code usart_read_buffer_wait( - struct usart_module *const module, - uint8_t *rx_data, - uint16_t length) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - /* Check if the buffer length is valid */ - if (length == 0) { - return STATUS_ERR_INVALID_ARG; - } - - /* Check that the receiver is enabled */ - if (!(module->receiver_enabled)) { - return STATUS_ERR_DENIED; - } - - /* Get a pointer to the hardware module instance */ - SercomUsart *const usart_hw = &(module->hw->USART); - - uint16_t rx_pos = 0; - - /* Blocks while buffer is being received */ - while (length--) { - /* Wait for the USART to have new data and abort operation if it - * doesn't get ready within the timeout*/ - for (uint32_t i = 0; i <= USART_TIMEOUT; i++) { - if (usart_hw->INTFLAG.reg & SERCOM_USART_INTFLAG_RXC) { - break; - } else if (i == USART_TIMEOUT) { - return STATUS_ERR_TIMEOUT; - } - } - - enum status_code retval; - uint16_t received_data = 0; - - retval = usart_read_wait(module, &received_data); - - if (retval != STATUS_OK) { - /* Overflow, abort */ - return retval; - } - - /* Read value will be at least 8-bits long */ - rx_data[rx_pos++] = received_data; - - /* If 9-bit data, write next received byte to the buffer */ - if (module->character_size == USART_CHARACTER_SIZE_9BIT) { - rx_data[rx_pos++] = (received_data >> 8); - } - } - - return STATUS_OK; -} diff --git a/atmel-samd/asf/sam0/drivers/sercom/usart/usart.h b/atmel-samd/asf/sam0/drivers/sercom/usart/usart.h deleted file mode 100644 index ac79c1116..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/usart/usart.h +++ /dev/null @@ -1,1593 +0,0 @@ -/** - * - * \file - * - * \brief SAM SERCOM USART Driver - * - * Copyright (C) 2012-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef USART_H_INCLUDED -#define USART_H_INCLUDED - -/** - * \defgroup asfdoc_sam0_sercom_usart_group SAM Serial USART (SERCOM USART) Driver - * - * This driver for Atmel® | SMART ARM®-based microcontrollers provides - * an interface for the configuration and management of the SERCOM module in - * its USART mode to transfer or receive USART data frames. The following driver - * API modes are covered by this manual: - * - * - Polled APIs - * \if USART_CALLBACK_MODE - * - Callback APIs - * \endif - * - * The following peripheral is used by this module: - * - SERCOM (Serial Communication Interface) - * - * The following devices can use this module: - * - Atmel | SMART SAM D20/D21 - * - Atmel | SMART SAM R21 - * - Atmel | SMART SAM D09/D10/D11 - * - Atmel | SMART SAM D10/D11 - * - Atmel | SMART SAM L21/L22 - * - Atmel | SMART SAM DA1 - * - Atmel | SMART SAM C20/C21 - * - * The outline of this documentation is as follows: - * - \ref asfdoc_sam0_sercom_usart_prerequisites - * - \ref asfdoc_sam0_sercom_usart_overview - * - \ref asfdoc_sam0_sercom_usart_special_considerations - * - \ref asfdoc_sam0_sercom_usart_extra_info - * - \ref asfdoc_sam0_sercom_usart_examples - * - \ref asfdoc_sam0_sercom_usart_api_overview - * - * \section asfdoc_sam0_sercom_usart_prerequisites Prerequisites - * - * To use the USART you need to have a GCLK generator enabled and running - * that can be used as the SERCOM clock source. This can either be configured - * in conf_clocks.h or by using the system clock driver. - * - * \section asfdoc_sam0_sercom_usart_overview Module Overview - * - * This driver will use one (or more) SERCOM interface(s) in the system - * and configure it to run as a USART interface in either synchronous - * or asynchronous mode. - * - * \subsection asfdoc_sam0_sercom_usart_features Driver Feature Macro Definition - * <table> - * <tr> - * <th>Driver Feature Macro</th> - * <th>Supported devices</th> - * </tr> - * <tr> - * <td>FEATURE_USART_SYNC_SCHEME_V2</td> - * <td>SAM D21/R21/D09/D10/D11/L21/L22/DA1/C20/C21</td> - * </tr> - * <tr> - * <td>FEATURE_USART_OVER_SAMPLE</td> - * <td>SAM D21/R21/D09/D10/D11/L21/L22/DA1/C20/C21</td> - * </tr> - * <tr> - * <td>FEATURE_USART_HARDWARE_FLOW_CONTROL</td> - * <td>SAM D21/R21/D09/D10/D11/L21/L22/DA1/C20/C21</td> - * </tr> - * <tr> - * <td>FEATURE_USART_IRDA</td> - * <td>SAM D21/R21/D09/D10/D11/L21/L22/DA1/C20/C21</td> - * </tr> - * <tr> - * <td>FEATURE_USART_LIN_SLAVE</td> - * <td>SAM D21/R21/D09/D10/D11/L21/L22/DA1/C20/C21</td> - * </tr> - * <tr> - * <td>FEATURE_USART_COLLISION_DECTION</td> - * <td>SAM D21/R21/D09/D10/D11/L21/L22/DA1/C20/C21</td> - * </tr> - * <tr> - * <td>FEATURE_USART_START_FRAME_DECTION</td> - * <td>SAM D21/R21/D09/D10/D11/L21/L22/DA1/C20/C21</td> - * </tr> - * <tr> - * <td>FEATURE_USART_IMMEDIATE_BUFFER_OVERFLOW_NOTIFICATION</td> - * <td>SAM D21/R21/D09/D10/D11/L21/L22/DA1/C20/C21</td> - * </tr> - * <tr> - * <td>FEATURE_USART_RS485</td> - * <td>SAM C20/C21</td> - * </tr> - * <tr> - * <td>FEATURE_USART_LIN_MASTER</td> - * <td>SAM L22/C20/C21</td> - * </tr> - * </table> - * \note The specific features are only available in the driver when the - * selected device supports those features. - * - * \subsection asfdoc_sam0_sercom_usart_overview_frame_format Frame Format - * - * Communication is based on frames, where the frame format can be customized - * to accommodate a wide range of standards. A frame consists of a start bit, - * a number of data bits, an optional parity bit for error detection as well - * as a configurable length stop bit(s) - see - * \ref asfdoc_sam0_sercom_usart_frame_diagram "the figure below". - * \ref asfdoc_sam0_sercom_usart_frame_params "The table below" shows the - * available parameters you can change in a frame. - * - * \anchor asfdoc_sam0_sercom_usart_frame_params - * <table> - * <caption>USART Frame Parameters</caption> - * <tr> - * <th>Parameter</th> - * <th>Options</th> - * </tr> - * <tr> - * <td>Start bit</td> - * <td>1</td> - * </tr> - * <tr> - * <td>Data bits</td> - * <td>5, 6, 7, 8, 9</td> - * </tr> - * <tr> - * <td>Parity bit</td> - * <td>None, Even, Odd</td> - * </tr> - * <tr> - * <td>Stop bits</td> - * <td>1, 2</td> - * </tr> - * </table> - * - * \anchor asfdoc_sam0_sercom_usart_frame_diagram - * \image html usart_frame.svg "USART Frame Overview" width=100% - * - * \subsection asfdoc_sam0_sercom_usart_overview_sync Synchronous Mode - * - * In synchronous mode a dedicated clock line is provided; either by the USART - * itself if in master mode, or by an external master if in slave mode. - * Maximum transmission speed is the same as the GCLK clocking the USART - * peripheral when in slave mode, and the GCLK divided by two if in - * master mode. In synchronous mode the interface needs three lines to - * communicate: - * - TX (Transmit pin) - * - RX (Receive pin) - * - XCK (Clock pin) - * - * \subsubsection asfdoc_sam0_sercom_usart_overview_sync_sampling Data Sampling - * In synchronous mode the data is sampled on either the rising or falling edge - * of the clock signal. This is configured by setting the clock polarity in the - * configuration struct. - * - * \subsection asfdoc_sam0_sercom_usart_overview_async Asynchronous Mode - * - * In asynchronous mode no dedicated clock line is used, and the communication - * is based on matching the clock speed on the transmitter and receiver. The - * clock is generated from the internal SERCOM baudrate generator, and the - * frames are synchronized by using the frame start bits. Maximum transmission - * speed is limited to the SERCOM GCLK divided by 16. - * In asynchronous mode the interface only needs two lines to communicate: - * - TX (Transmit pin) - * - RX (Receive pin) - * - * \subsubsection asfdoc_sam0_sercom_usart_overview_async_clock_matching Transmitter/receiver Clock Matching - * - * For successful transmit and receive using the asynchronous mode the receiver - * and transmitter clocks needs to be closely matched. When receiving a frame - * that does not match the selected baudrate closely enough the receiver will - * be unable to synchronize the frame(s), and garbage transmissions will - * result. - * - * \subsection asfdoc_sam0_sercom_usart_parity Parity - * Parity can be enabled to detect if a transmission was in error. This is done - * by counting the number of "1" bits in the frame. When using even parity the - * parity bit will be set if the total number of "1"s in the frame are an even - * number. If using odd parity the parity bit will be set if the total number - * of "1"s are odd. - * - * When receiving a character the receiver will count the number of "1"s in the - * frame and give an error if the received frame and parity bit disagree. - * - * \subsection asfdoc_sam0_sercom_usart_overview_pin_configuration GPIO Configuration - * - * The SERCOM module has four internal pads; the RX pin can be placed freely on - * any one of the four pads, and the TX and XCK pins have two predefined - * positions that can be selected as a pair. The pads can then be routed to an - * external GPIO pin using the normal pin multiplexing scheme on the SAM. - * - * \section asfdoc_sam0_sercom_usart_special_considerations Special Considerations - * - * \if USART_CALLBACK_MODE - * Never execute large portions of code in the callbacks. These - * are run from the interrupt routine, and thus having long callbacks will - * keep the processor in the interrupt handler for an equally long time. - * A common way to handle this is to use global flags signaling the - * main application that an interrupt event has happened, and only do the - * minimal needed processing in the callback. - * \else - * No special considerations. - * \endif - * - * \section asfdoc_sam0_sercom_usart_extra_info Extra Information - * - * For extra information, see \ref asfdoc_sam0_sercom_usart_extra. This includes: - * - \ref asfdoc_sam0_sercom_usart_extra_acronyms - * - \ref asfdoc_sam0_sercom_usart_extra_dependencies - * - \ref asfdoc_sam0_sercom_usart_extra_errata - * - \ref asfdoc_sam0_sercom_usart_extra_history - * - * \section asfdoc_sam0_sercom_usart_examples Examples - * - * For a list of examples related to this driver, see - * \ref asfdoc_sam0_sercom_usart_exqsg. - * - * \section asfdoc_sam0_sercom_usart_api_overview API Overview - * @{ - */ - -#include <compiler.h> -#include <sercom.h> -#include <pinmux.h> - -#if USART_CALLBACK_MODE == true -# include <sercom_interrupt.h> -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \name Driver Feature Definition - * Define SERCOM USART features set according to different device family. - * @{ - */ -#if (SAMD21) || (SAMR21) || (SAMD09) || (SAMD10) || (SAMD11) || (SAML21) || \ - (SAML22) ||(SAMDA1) || (SAMC20) || (SAMC21) || (SAMR30) || defined(__DOXYGEN__) -/** USART sync scheme version 2. */ -# define FEATURE_USART_SYNC_SCHEME_V2 -/** USART oversampling. */ -# define FEATURE_USART_OVER_SAMPLE -/** USART hardware control flow. */ -# define FEATURE_USART_HARDWARE_FLOW_CONTROL -/** IrDA mode. */ -# define FEATURE_USART_IRDA -/** LIN slave mode. */ -# define FEATURE_USART_LIN_SLAVE -/** USART collision detection. */ -# define FEATURE_USART_COLLISION_DECTION -/** USART start frame detection. */ -# define FEATURE_USART_START_FRAME_DECTION -/** USART start buffer overflow notification. */ -# define FEATURE_USART_IMMEDIATE_BUFFER_OVERFLOW_NOTIFICATION -#endif - -#if (SAML22) || defined(__DOXYGEN__) -/** ISO7816 for smart card interfacing. */ -#define FEATURE_USART_ISO7816 -#endif -#if (SAMC20) || (SAMC21) || defined(__DOXYGEN__) -/** LIN master mode. */ -#define FEATURE_USART_LIN_MASTER -#endif -#if (SAML22) || (SAMC20) || (SAMC21) || defined(__DOXYGEN__) -/** RS485 mode. */ -# define FEATURE_USART_RS485 -#endif -/*@}*/ - -#ifdef FEATURE_USART_LIN_MASTER -/** - * \brief LIN node type - * - * LIN node type. - */ -enum lin_node_type { - /** LIN master mode */ - LIN_MASTER_NODE = SERCOM_USART_CTRLA_FORM(0x02), - /** LIN slave mode */ - LIN_SLAVE_NODE = SERCOM_USART_CTRLA_FORM(0x04), - /** Neither LIN master nor LIN slave mode */ - LIN_INVALID_MODE = SERCOM_USART_CTRLA_FORM(0x00), -}; - -/** - * \brief LIN master command enum - * - * LIN master command enum. - */ -enum lin_master_cmd { - /** LIN master software control transmission command */ - LIN_MASTER_SOFTWARE_CONTROL_TRANSMIT_CMD = SERCOM_USART_CTRLB_LINCMD(0x01), - /** LIN master automatically transmission command */ - LIN_MASTER_AUTO_TRANSMIT_CMD = SERCOM_USART_CTRLB_LINCMD(0x02), -}; - -/** - * \brief LIN master header delay - * - * LIN master header delay between break and sync transmission, - * and between the sync and identifier (ID) fields. - * This field is only valid when using automatically transmission command - */ -enum lin_master_header_delay { - /** Delay between break and sync transmission is 1 bit time. - Delay between sync and ID transmission is 1 bit time. */ - LIN_MASTER_HEADER_DELAY_0 = SERCOM_USART_CTRLC_HDRDLY(0x0), - /** Delay between break and sync transmission is 4 bit time. - Delay between sync and ID transmission is 4 bit time. */ - LIN_MASTER_HEADER_DELAY_1 = SERCOM_USART_CTRLC_HDRDLY(0x01), - /** Delay between break and sync transmission is 8 bit time. - Delay between sync and ID transmission is 4 bit time. */ - LIN_MASTER_HEADER_DELAY_2 = SERCOM_USART_CTRLC_HDRDLY(0x02), - /** Delay between break and sync transmission is 14 bit time. - Delay between sync and ID transmission is 4 bit time. */ - LIN_MASTER_HEADER_DELAY_3 = SERCOM_USART_CTRLC_HDRDLY(0x03), -}; - -/** - * \brief LIN master break length - * - * Length of the break field transmitted when in LIN master mode - */ -enum lin_master_break_length { - /** Break field transmission is 13 bit times */ - LIN_MASTER_BREAK_LENGTH_13_BIT = SERCOM_USART_CTRLC_BRKLEN(0x0), - /** Break field transmission is 17 bit times */ - LIN_MASTER_BREAK_LENGTH_17_BIT = SERCOM_USART_CTRLC_BRKLEN(0x1), - /** Break field transmission is 21 bit times */ - LIN_MASTER_BREAK_LENGTH_21_BIT = SERCOM_USART_CTRLC_BRKLEN(0x2), - /** Break field transmission is 26 bit times */ - LIN_MASTER_BREAK_LENGTH_26_BIT = SERCOM_USART_CTRLC_BRKLEN(0x3), -}; -#endif -#ifdef FEATURE_USART_ISO7816 -/** - * \brief ISO7816 protocol type - * - * ISO7816 protocol type. - */ -enum iso7816_protocol_type { - /** ISO7816 protocol type 0 */ - ISO7816_PROTOCOL_T_0 = SERCOM_USART_CTRLA_CMODE, - /** ISO7816 protocol type 1 */ - ISO7816_PROTOCOL_T_1 = (0x0ul << SERCOM_USART_CTRLA_CMODE_Pos), -}; - -/** - * \brief ISO7816 guard time - * - * The value of ISO7816 guard time. - */ -enum iso7816_guard_time { - /** The guard time is 2-bit times */ - ISO7816_GUARD_TIME_2_BIT = 2, - /** The guard time is 3-bit times */ - ISO7816_GUARD_TIME_3_BIT, - /** The guard time is 4-bit times */ - ISO7816_GUARD_TIME_4_BIT, - /** The guard time is 5-bit times */ - ISO7816_GUARD_TIME_5_BIT, - /** The guard time is 6-bit times */ - ISO7816_GUARD_TIME_6_BIT, - /** The guard time is 7-bit times */ - ISO7816_GUARD_TIME_7_BIT, -}; - -/** - * \brief ISO7816 receive NACK inhibit - * - * The value of ISO7816 receive NACK inhibit. - */ -enum iso7816_inhibit_nack { - /** The NACK is generated */ - ISO7816_INHIBIT_NACK_DISABLE = (0x0ul << SERCOM_USART_CTRLC_INACK_Pos), - /** The NACK is not generated */ - ISO7816_INHIBIT_NACK_ENABLE = SERCOM_USART_CTRLC_INACK, -}; - -/** - * \brief ISO7816 disable successive receive NACK - * - * The value of ISO7816 disable successive receive NACK. - */ -enum iso7816_successive_recv_nack { - /** The successive receive NACK is enable. */ - ISO7816_SUCCESSIVE_RECV_NACK_DISABLE = (0x0ul << SERCOM_USART_CTRLC_INACK_Pos), - /** The successive receive NACK is disable. */ - ISO7816_SUCCESSIVE_RECV_NACK_ENABLE = SERCOM_USART_CTRLC_DSNACK, -}; - -/** - * \brief ISO7816 configuration struct - * - * ISO7816 configuration structure. - */ -struct iso7816_config_t { - /* ISO7816 mode enable */ - bool enabled; - /** ISO7816 protocol type */ - enum iso7816_protocol_type protocol_t; - /** Enable inverse transmission and reception */ - bool enable_inverse; - /** Guard time, which lasts two bit times */ - enum iso7816_guard_time guard_time; - /** - * Inhibit Non Acknowledge: - * - 0: the NACK is generated; - * - 1: the NACK is not generated. - */ - enum iso7816_inhibit_nack inhibit_nack; - /** - * Disable successive NACKs. - * - 0: NACK is sent on the ISO line as soon as a parity error occurs - * in the received character. Successive parity errors are counted up to - * the value in the max_iterations field. These parity errors generate - * a NACK on the ISO line. As soon as this value is reached, no additional - * NACK is sent on the ISO line. The ITERATION flag is asserted. - */ - enum iso7816_successive_recv_nack successive_recv_nack; - /* Max number of repetitions */ - uint32_t max_iterations; -}; -#endif - -#ifndef PINMUX_DEFAULT -/** Default pinmux */ -# define PINMUX_DEFAULT 0 -#endif - -#ifndef PINMUX_UNUSED -/** Unused pinmux */ -# define PINMUX_UNUSED 0xFFFFFFFF -#endif - -#ifndef USART_TIMEOUT -/** USART timeout value */ -# define USART_TIMEOUT 0xFFFF -#endif - -#if USART_CALLBACK_MODE == true -/** - * \brief USART callback enum - * - * Callbacks for the Asynchronous USART driver. - */ -enum usart_callback { - /** Callback for buffer transmitted */ - USART_CALLBACK_BUFFER_TRANSMITTED, - /** Callback for buffer received */ - USART_CALLBACK_BUFFER_RECEIVED, - /** Callback for error */ - USART_CALLBACK_ERROR, -#ifdef FEATURE_USART_LIN_SLAVE - /** Callback for break character is received */ - USART_CALLBACK_BREAK_RECEIVED, -#endif -#ifdef FEATURE_USART_HARDWARE_FLOW_CONTROL - /** Callback for a change is detected on the CTS pin */ - USART_CALLBACK_CTS_INPUT_CHANGE, -#endif -#ifdef FEATURE_USART_START_FRAME_DECTION - /** Callback for a start condition is detected on the RxD line */ - USART_CALLBACK_START_RECEIVED, -#endif -# if !defined(__DOXYGEN__) - /** Number of available callbacks */ - USART_CALLBACK_N, -# endif -}; -#endif - -/** - * \brief USART Data Order enum - * - * The data order decides which MSB or LSB is shifted out first when data is - * transferred. - */ -enum usart_dataorder { - /** The MSB will be shifted out first during transmission, - * and shifted in first during reception */ - USART_DATAORDER_MSB = 0, - /** The LSB will be shifted out first during transmission, - * and shifted in first during reception */ - USART_DATAORDER_LSB = SERCOM_USART_CTRLA_DORD, -}; - -/** - * \brief USART Transfer mode enum - * - * Select USART transfer mode. - */ -enum usart_transfer_mode { - /** Transfer of data is done synchronously */ - USART_TRANSFER_SYNCHRONOUSLY = (SERCOM_USART_CTRLA_CMODE), - /** Transfer of data is done asynchronously */ - USART_TRANSFER_ASYNCHRONOUSLY = (0x0ul << SERCOM_USART_CTRLA_CMODE_Pos), -}; - -/** - * \brief USART Parity enum - * - * Select parity USART parity mode. - */ -enum usart_parity { - /** For odd parity checking, the parity bit will be set if number of - * ones being transferred is even */ - USART_PARITY_ODD = SERCOM_USART_CTRLB_PMODE, - - /** For even parity checking, the parity bit will be set if number of - * ones being received is odd */ - USART_PARITY_EVEN = 0, - - /** No parity checking will be executed, and there will be no parity bit - * in the received frame */ - USART_PARITY_NONE = 0xFF, -}; - -/** - * \brief USART signal MUX settings - * - * Set the functionality of the SERCOM pins. - * - * See \ref asfdoc_sam0_sercom_usart_mux_settings for a description of the - * various MUX setting options. - */ -enum usart_signal_mux_settings { -#ifdef FEATURE_USART_HARDWARE_FLOW_CONTROL - /** MUX setting RX_0_TX_0_XCK_1 */ - USART_RX_0_TX_0_XCK_1 = (SERCOM_USART_CTRLA_RXPO(0) | SERCOM_USART_CTRLA_TXPO(0)), - /** MUX setting RX_0_TX_2_XCK_3 */ - USART_RX_0_TX_2_XCK_3 = (SERCOM_USART_CTRLA_RXPO(0) | SERCOM_USART_CTRLA_TXPO(1)), - /** MUX setting USART_RX_0_TX_0_RTS_2_CTS_3 */ - USART_RX_0_TX_0_RTS_2_CTS_3 = (SERCOM_USART_CTRLA_RXPO(0) | SERCOM_USART_CTRLA_TXPO(2)), - /** MUX setting RX_1_TX_0_XCK_1 */ - USART_RX_1_TX_0_XCK_1 = (SERCOM_USART_CTRLA_RXPO(1) | SERCOM_USART_CTRLA_TXPO(0)), - /** MUX setting RX_1_TX_2_XCK_3 */ - USART_RX_1_TX_2_XCK_3 = (SERCOM_USART_CTRLA_RXPO(1) | SERCOM_USART_CTRLA_TXPO(1)), - /** MUX setting USART_RX_1_TX_0_RTS_2_CTS_3 */ - USART_RX_1_TX_0_RTS_2_CTS_3 = (SERCOM_USART_CTRLA_RXPO(1) | SERCOM_USART_CTRLA_TXPO(2)), - /** MUX setting RX_2_TX_0_XCK_1 */ - USART_RX_2_TX_0_XCK_1 = (SERCOM_USART_CTRLA_RXPO(2) | SERCOM_USART_CTRLA_TXPO(0)), - /** MUX setting RX_2_TX_2_XCK_3 */ - USART_RX_2_TX_2_XCK_3 = (SERCOM_USART_CTRLA_RXPO(2) | SERCOM_USART_CTRLA_TXPO(1)), - /** MUX setting USART_RX_2_TX_0_RTS_2_CTS_3 */ - USART_RX_2_TX_0_RTS_2_CTS_3 = (SERCOM_USART_CTRLA_RXPO(2) | SERCOM_USART_CTRLA_TXPO(2)), - /** MUX setting RX_3_TX_0_XCK_1 */ - USART_RX_3_TX_0_XCK_1 = (SERCOM_USART_CTRLA_RXPO(3) | SERCOM_USART_CTRLA_TXPO(0)), - /** MUX setting RX_3_TX_2_XCK_3 */ - USART_RX_3_TX_2_XCK_3 = (SERCOM_USART_CTRLA_RXPO(3) | SERCOM_USART_CTRLA_TXPO(1)), - /** MUX setting USART_RX_3_TX_0_RTS_2_CTS_3 */ - USART_RX_3_TX_0_RTS_2_CTS_3 = (SERCOM_USART_CTRLA_RXPO(3) | SERCOM_USART_CTRLA_TXPO(2)), -#ifdef FEATURE_USART_RS485 - /** MUX setting USART_RX_0_TX_0_XCK_1_TE_2 */ - USART_RX_0_TX_0_XCK_1_TE_2 = (SERCOM_USART_CTRLA_RXPO(0) | SERCOM_USART_CTRLA_TXPO(3)), - /** MUX setting USART_RX_1_TX_0_XCK_1_TE_2 */ - USART_RX_1_TX_0_XCK_1_TE_2 = (SERCOM_USART_CTRLA_RXPO(1) | SERCOM_USART_CTRLA_TXPO(3)), - /** MUX setting USART_RX_2_TX_0_XCK_1_TE_2 */ - USART_RX_2_TX_0_XCK_1_TE_2 = (SERCOM_USART_CTRLA_RXPO(2) | SERCOM_USART_CTRLA_TXPO(3)), - /** MUX setting USART_RX_3_TX_0_XCK_1_TE_2 */ - USART_RX_3_TX_0_XCK_1_TE_2 = (SERCOM_USART_CTRLA_RXPO(3) | SERCOM_USART_CTRLA_TXPO(3)), -#endif -#else - /** MUX setting RX_0_TX_0_XCK_1 */ - USART_RX_0_TX_0_XCK_1 = (SERCOM_USART_CTRLA_RXPO(0)), - /** MUX setting RX_0_TX_2_XCK_3 */ - USART_RX_0_TX_2_XCK_3 = (SERCOM_USART_CTRLA_RXPO(0) | SERCOM_USART_CTRLA_TXPO), - /** MUX setting RX_1_TX_0_XCK_1 */ - USART_RX_1_TX_0_XCK_1 = (SERCOM_USART_CTRLA_RXPO(1)), - /** MUX setting RX_1_TX_2_XCK_3 */ - USART_RX_1_TX_2_XCK_3 = (SERCOM_USART_CTRLA_RXPO(1) | SERCOM_USART_CTRLA_TXPO), - /** MUX setting RX_2_TX_0_XCK_1 */ - USART_RX_2_TX_0_XCK_1 = (SERCOM_USART_CTRLA_RXPO(2)), - /** MUX setting RX_2_TX_2_XCK_3 */ - USART_RX_2_TX_2_XCK_3 = (SERCOM_USART_CTRLA_RXPO(2) | SERCOM_USART_CTRLA_TXPO), - /** MUX setting RX_3_TX_0_XCK_1 */ - USART_RX_3_TX_0_XCK_1 = (SERCOM_USART_CTRLA_RXPO(3)), - /** MUX setting RX_3_TX_2_XCK_3 */ - USART_RX_3_TX_2_XCK_3 = (SERCOM_USART_CTRLA_RXPO(3) | SERCOM_USART_CTRLA_TXPO), -#endif -}; - -/** - * \brief USART Stop Bits enum - * - * Number of stop bits for a frame. - */ -enum usart_stopbits { - /** Each transferred frame contains one stop bit */ - USART_STOPBITS_1 = 0, - /** Each transferred frame contains two stop bits */ - USART_STOPBITS_2 = SERCOM_USART_CTRLB_SBMODE, -}; - -/** - * \brief USART Character Size - * - * Number of bits for the character sent in a frame. - */ -enum usart_character_size { - /** The char being sent in a frame is five bits long */ - USART_CHARACTER_SIZE_5BIT = SERCOM_USART_CTRLB_CHSIZE(5), - /** The char being sent in a frame is six bits long */ - USART_CHARACTER_SIZE_6BIT = SERCOM_USART_CTRLB_CHSIZE(6), - /** The char being sent in a frame is seven bits long */ - USART_CHARACTER_SIZE_7BIT = SERCOM_USART_CTRLB_CHSIZE(7), - /** The char being sent in a frame is eight bits long */ - USART_CHARACTER_SIZE_8BIT = SERCOM_USART_CTRLB_CHSIZE(0), - /** The char being sent in a frame is nine bits long */ - USART_CHARACTER_SIZE_9BIT = SERCOM_USART_CTRLB_CHSIZE(1), -}; - -#ifdef FEATURE_USART_OVER_SAMPLE -/** - * \brief USART Sample Rate - * - * The value of sample rate and baudrate generation mode. - */ -enum usart_sample_rate { - /** 16x over-sampling using arithmetic baudrate generation */ - USART_SAMPLE_RATE_16X_ARITHMETIC = SERCOM_USART_CTRLA_SAMPR(0), - /** 16x over-sampling using fractional baudrate generation */ - USART_SAMPLE_RATE_16X_FRACTIONAL = SERCOM_USART_CTRLA_SAMPR(1), - /** 8x over-sampling using arithmetic baudrate generation */ - USART_SAMPLE_RATE_8X_ARITHMETIC = SERCOM_USART_CTRLA_SAMPR(2), - /** 8x over-sampling using fractional baudrate generation */ - USART_SAMPLE_RATE_8X_FRACTIONAL = SERCOM_USART_CTRLA_SAMPR(3), - /** 3x over-sampling using arithmetic baudrate generation */ - USART_SAMPLE_RATE_3X_ARITHMETIC = SERCOM_USART_CTRLA_SAMPR(4), -}; - -/** - * \brief USART Sample Adjustment - * - * The value of sample number used for majority voting. - */ -enum usart_sample_adjustment { - /** The first, middle and last sample number used for majority voting is 7-8-9 */ - USART_SAMPLE_ADJUSTMENT_7_8_9 = SERCOM_USART_CTRLA_SAMPA(0), - /** The first, middle and last sample number used for majority voting is 9-10-11 */ - USART_SAMPLE_ADJUSTMENT_9_10_11 = SERCOM_USART_CTRLA_SAMPA(1), - /** The first, middle and last sample number used for majority voting is 11-12-13 */ - USART_SAMPLE_ADJUSTMENT_11_12_13 = SERCOM_USART_CTRLA_SAMPA(2), - /** The first, middle and last sample number used for majority voting is 13-14-15 */ - USART_SAMPLE_ADJUSTMENT_13_14_15 = SERCOM_USART_CTRLA_SAMPA(3), -}; -#endif - -#ifdef FEATURE_USART_RS485 -/** - * \brief RS485 Guard Time - * - * The value of RS485 guard time. - */ -enum rs485_guard_time { - /** The guard time is 0-bit time */ - RS485_GUARD_TIME_0_BIT = 0, - /** The guard time is 1-bit time */ - RS485_GUARD_TIME_1_BIT, - /** The guard time is 2-bit times */ - RS485_GUARD_TIME_2_BIT, - /** The guard time is 3-bit times */ - RS485_GUARD_TIME_3_BIT, - /** The guard time is 4-bit times */ - RS485_GUARD_TIME_4_BIT, - /** The guard time is 5-bit times */ - RS485_GUARD_TIME_5_BIT, - /** The guard time is 6-bit times */ - RS485_GUARD_TIME_6_BIT, - /** The guard time is 7-bit times */ - RS485_GUARD_TIME_7_BIT, -}; -#endif - -/** - * \brief USART Transceiver - * - * Select Receiver or Transmitter. - */ -enum usart_transceiver_type { - /** The parameter is for the Receiver */ - USART_TRANSCEIVER_RX, - /** The parameter is for the Transmitter */ - USART_TRANSCEIVER_TX, -}; - -/** - * \brief USART configuration struct - * - * Configuration options for USART. - */ -struct usart_config { - /** USART bit order (MSB or LSB first) */ - enum usart_dataorder data_order; - /** USART in asynchronous or synchronous mode */ - enum usart_transfer_mode transfer_mode; - /** USART parity */ - enum usart_parity parity; - /** Number of stop bits */ - enum usart_stopbits stopbits; - /** USART character size */ - enum usart_character_size character_size; - /** USART pin out */ - enum usart_signal_mux_settings mux_setting; -#ifdef FEATURE_USART_OVER_SAMPLE - /** USART sample rate */ - enum usart_sample_rate sample_rate; - /** USART sample adjustment */ - enum usart_sample_adjustment sample_adjustment; -#endif -#ifdef FEATURE_USART_IMMEDIATE_BUFFER_OVERFLOW_NOTIFICATION - /** Controls when the buffer overflow status bit is asserted when a buffer overflow occurs */ - bool immediate_buffer_overflow_notification; -#endif -#ifdef FEATURE_USART_IRDA - /** Enable IrDA encoding format */ - bool encoding_format_enable; - /** The minimum pulse length required for a pulse to be accepted by the IrDA receiver */ - uint8_t receive_pulse_length; -#endif -#ifdef FEATURE_USART_LIN_SLAVE - /** Enable LIN Slave Support */ - bool lin_slave_enable; -#endif - -#ifdef FEATURE_USART_LIN_MASTER - /** LIN node type */ - enum lin_node_type lin_node; - /** LIN master header delay */ - enum lin_master_header_delay lin_header_delay; - /** LIN Master Break Length */ - enum lin_master_break_length lin_break_length; -#endif - -#ifdef FEATURE_USART_START_FRAME_DECTION - /** Enable start of frame dection */ - bool start_frame_detection_enable; -#endif -#ifdef FEATURE_USART_ISO7816 - /** Enable ISO7816 for smart card interfacing */ - struct iso7816_config_t iso7816_config; -#endif -#ifdef FEATURE_USART_RS485 - /** RS485 guard time */ - enum rs485_guard_time rs485_guard_time; -#endif -#ifdef FEATURE_USART_COLLISION_DECTION - /** Enable collision dection */ - bool collision_detection_enable; -#endif - /** USART baudrate */ - uint32_t baudrate; - /** Enable receiver */ - bool receiver_enable; - /** Enable transmitter */ - bool transmitter_enable; - - /** USART Clock Polarity. - * If true, data changes on falling XCK edge and - * is sampled at rising edge. - * If false, data changes on rising XCK edge and - * is sampled at falling edge. - * */ - bool clock_polarity_inverted; - - /** States whether to use the external clock applied to the XCK pin. - * In synchronous mode the shift register will act directly on the XCK clock. - * In asynchronous mode the XCK will be the input to the USART hardware module. - */ - bool use_external_clock; - /** External clock frequency in synchronous mode. - * This must be set if \c use_external_clock is true. */ - uint32_t ext_clock_freq; - /** If true the USART will be kept running in Standby sleep mode */ - bool run_in_standby; - /** GCLK generator source */ - enum gclk_generator generator_source; - /** PAD0 pinmux. - * - * If current USARTx has several alternative multiplexing I/O pins for PAD0, then - * only one peripheral multiplexing I/O can be enabled for current USARTx PAD0 - * function. Make sure that no other alternative multiplexing I/O is associated - * with the same USARTx PAD0. - */ - uint32_t pinmux_pad0; - /** PAD1 pinmux. - * - * If current USARTx has several alternative multiplexing I/O pins for PAD1, then - * only one peripheral multiplexing I/O can be enabled for current USARTx PAD1 - * function. Make sure that no other alternative multiplexing I/O is associated - * with the same USARTx PAD1. - */ - uint32_t pinmux_pad1; - /** PAD2 pinmux. - * - * If current USARTx has several alternative multiplexing I/O pins for PAD2, then - * only one peripheral multiplexing I/O can be enabled for current USARTx PAD2 - * function. Make sure that no other alternative multiplexing I/O is associated - * with the same USARTx PAD2. - */ - uint32_t pinmux_pad2; - /** PAD3 pinmux. - * - * If current USARTx has several alternative multiplexing I/O pins for PAD3, then - * only one peripheral multiplexing I/O can be enabled for current USARTx PAD3 - * function. Make sure that no other alternative multiplexing I/O is associated - * with the same USARTx PAD3. - */ - uint32_t pinmux_pad3; -}; - -#if USART_CALLBACK_MODE == true -/** - * \brief USART module instance - * - * Forward Declaration for the device instance. - */ -struct usart_module; - -/** - * \brief USART callback type - * - * Type of the callback functions. - */ -typedef void (*usart_callback_t)(struct usart_module *const module); -#endif - -/** - * \brief SERCOM USART driver software device instance structure. - * - * SERCOM USART driver software instance structure, used to retain software - * state information of an associated hardware module instance. - * - * \note The fields of this structure should not be altered by the user - * application; they are reserved for module-internal use only. - */ -struct usart_module { -#if !defined(__DOXYGEN__) - /** Pointer to the hardware instance */ - Sercom *hw; - /** Module lock */ - volatile bool locked; - /** Character size of the data being transferred */ - enum usart_character_size character_size; - /** Receiver enabled */ - bool receiver_enabled; - /** Transmitter enabled */ - bool transmitter_enabled; -#ifdef FEATURE_USART_LIN_SLAVE - /** LIN Slave Support enabled */ - bool lin_slave_enabled; -#endif -#ifdef FEATURE_USART_START_FRAME_DECTION - /** Start of frame dection enabled */ - bool start_frame_detection_enabled; -#endif -#ifdef FEATURE_USART_ISO7816 - /** ISO7816 mode enable */ - bool iso7816_mode_enabled; -#endif -# if USART_CALLBACK_MODE == true - /** Array to store callback function pointers in */ - usart_callback_t callback[USART_CALLBACK_N]; - /** Buffer pointer to where the next received character will be put */ - volatile uint8_t *rx_buffer_ptr; - - /** Buffer pointer to where the next character will be transmitted from - **/ - volatile uint8_t *tx_buffer_ptr; - /** Remaining characters to receive */ - volatile uint16_t remaining_rx_buffer_length; - /** Remaining characters to transmit */ - volatile uint16_t remaining_tx_buffer_length; - /** Bit mask for callbacks registered */ - uint8_t callback_reg_mask; - /** Bit mask for callbacks enabled */ - uint8_t callback_enable_mask; - /** Holds the status of the ongoing or last read operation */ - volatile enum status_code rx_status; - /** Holds the status of the ongoing or last write operation */ - volatile enum status_code tx_status; -# endif -#endif -}; - - /** - * \name Lock/Unlock - * @{ - */ - -/** - * \brief Attempt to get lock on driver instance - * - * This function checks the instance's lock, which indicates whether or not it - * is currently in use, and sets the lock if it was not already set. - * - * The purpose of this is to enable exclusive access to driver instances, so - * that, e.g., transactions by different services will not interfere with each - * other. - * - * \param[in,out] module Pointer to the driver instance to lock - * - * \retval STATUS_OK If the module was locked - * \retval STATUS_BUSY If the module was already locked - */ -static inline enum status_code usart_lock( - struct usart_module *const module) -{ - enum status_code status; - - system_interrupt_enter_critical_section(); - - if (module->locked) { - status = STATUS_BUSY; - } else { - module->locked = true; - status = STATUS_OK; - } - - system_interrupt_leave_critical_section(); - - return status; -} - -/** - * \brief Unlock driver instance - * - * This function clears the instance lock, indicating that it is available for - * use. - * - * \param[in,out] module Pointer to the driver instance to lock - * - */ -static inline void usart_unlock(struct usart_module *const module) -{ - module->locked = false; -} - -/** @} */ - -/** - * \brief Check if peripheral is busy syncing registers across clock domains - * - * Return peripheral synchronization status. If doing a non-blocking - * implementation this function can be used to check the sync state and hold of - * any new actions until sync is complete. If this function is not run; the - * functions will block until the sync has completed. - * - * \param[in] module Pointer to peripheral module - * - * \return Peripheral sync status. - * - * \retval true Peripheral is busy syncing - * \retval false Peripheral is not busy syncing and can be read/written without - * stalling the bus - */ -static inline bool usart_is_syncing( - const struct usart_module *const module) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - SercomUsart *const usart_hw = &(module->hw->USART); - -#ifdef FEATURE_USART_SYNC_SCHEME_V2 - return (usart_hw->SYNCBUSY.reg); -#else - return (usart_hw->STATUS.reg & SERCOM_USART_STATUS_SYNCBUSY); -#endif -} - -#if !defined (__DOXYGEN__) -/** - * \internal - * Waits until synchronization is complete - */ -static inline void _usart_wait_for_sync( - const struct usart_module *const module) -{ - /* Sanity check */ - Assert(module); - - while (usart_is_syncing(module)) { - /* Wait until the synchronization is complete */ - } -} -#endif - -/** - * \brief Initializes the device to predefined defaults - * - * Initialize the USART device to predefined defaults: - * - 8-bit asynchronous USART - * - No parity - * - One stop bit - * - 9600 baud - * - Transmitter enabled - * - Receiver enabled - * - GCLK generator 0 as clock source - * - Default pin configuration - * - * The configuration struct will be updated with the default - * configuration. - * - * \param[in,out] config Pointer to configuration struct - */ -static inline void usart_get_config_defaults( - struct usart_config *const config) -{ - /* Sanity check arguments */ - Assert(config); - - /* Set default config in the config struct */ - config->data_order = USART_DATAORDER_LSB; - config->transfer_mode = USART_TRANSFER_ASYNCHRONOUSLY; - config->parity = USART_PARITY_NONE; - config->stopbits = USART_STOPBITS_1; - config->character_size = USART_CHARACTER_SIZE_8BIT; - config->baudrate = 9600; - config->receiver_enable = true; - config->transmitter_enable = true; - config->clock_polarity_inverted = false; - config->use_external_clock = false; - config->ext_clock_freq = 0; - config->mux_setting = USART_RX_1_TX_2_XCK_3; - config->run_in_standby = false; - config->generator_source = GCLK_GENERATOR_0; - config->pinmux_pad0 = PINMUX_DEFAULT; - config->pinmux_pad1 = PINMUX_DEFAULT; - config->pinmux_pad2 = PINMUX_DEFAULT; - config->pinmux_pad3 = PINMUX_DEFAULT; -#ifdef FEATURE_USART_OVER_SAMPLE - config->sample_adjustment = USART_SAMPLE_ADJUSTMENT_7_8_9; - config->sample_rate = USART_SAMPLE_RATE_16X_ARITHMETIC; -#endif -#ifdef FEATURE_USART_LIN_SLAVE - config->lin_slave_enable = false; -#endif - -#ifdef FEATURE_USART_LIN_MASTER - config->lin_node = LIN_INVALID_MODE; - config->lin_header_delay = LIN_MASTER_HEADER_DELAY_0; - config->lin_break_length = LIN_MASTER_BREAK_LENGTH_13_BIT; -#endif - -#ifdef FEATURE_USART_IMMEDIATE_BUFFER_OVERFLOW_NOTIFICATION - config->immediate_buffer_overflow_notification = false; -#endif -#ifdef FEATURE_USART_START_FRAME_DECTION - config->start_frame_detection_enable = false; -#endif -#ifdef FEATURE_USART_IRDA - config->encoding_format_enable = false; - config->receive_pulse_length = 19; -#endif -#ifdef FEATURE_USART_ISO7816 - config->iso7816_config.enabled = false; - config->iso7816_config.guard_time = ISO7816_GUARD_TIME_2_BIT; - config->iso7816_config.protocol_t = ISO7816_PROTOCOL_T_0; - config->iso7816_config.enable_inverse = false; - config->iso7816_config.inhibit_nack = ISO7816_INHIBIT_NACK_DISABLE; - config->iso7816_config.successive_recv_nack = ISO7816_SUCCESSIVE_RECV_NACK_DISABLE; - config->iso7816_config.max_iterations = 7; -#endif -#ifdef FEATURE_USART_COLLISION_DECTION - config->collision_detection_enable = false; -#endif -#ifdef FEATURE_USART_RS485 - config->rs485_guard_time = RS485_GUARD_TIME_0_BIT; -#endif -} - -enum status_code usart_init( - struct usart_module *const module, - Sercom *const hw, - const struct usart_config *const config); - -/** - * \brief Enable the module - * - * Enables the USART module. - * - * \param[in] module Pointer to USART software instance struct - */ -static inline void usart_enable( - const struct usart_module *const module) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - /* Get a pointer to the hardware module instance */ - SercomUsart *const usart_hw = &(module->hw->USART); - -#if USART_CALLBACK_MODE == true - /* Enable Global interrupt for module */ - system_interrupt_enable(_sercom_get_interrupt_vector(module->hw)); -#endif - - /* Wait until synchronization is complete */ - _usart_wait_for_sync(module); - - /* Enable USART module */ - usart_hw->CTRLA.reg |= SERCOM_USART_CTRLA_ENABLE; -} - -/** - * \brief Disable module - * - * Disables the USART module. - * - * \param[in] module Pointer to USART software instance struct - */ -static inline void usart_disable( - const struct usart_module *const module) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - /* Get a pointer to the hardware module instance */ - SercomUsart *const usart_hw = &(module->hw->USART); - -#if USART_CALLBACK_MODE == true - /* Disable Global interrupt for module */ - system_interrupt_disable(_sercom_get_interrupt_vector(module->hw)); -#endif - - /* Wait until synchronization is complete */ - _usart_wait_for_sync(module); - - /* Disable USART module */ - usart_hw->CTRLA.reg &= ~SERCOM_USART_CTRLA_ENABLE; -} - -/** - * \brief Resets the USART module - * - * Disables and resets the USART module. - * - * \param[in] module Pointer to the USART software instance struct - */ -static inline void usart_reset( - const struct usart_module *const module) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - /* Get a pointer to the hardware module instance */ - SercomUsart *const usart_hw = &(module->hw->USART); - - usart_disable(module); - - /* Wait until synchronization is complete */ - _usart_wait_for_sync(module); - - /* Reset module */ - usart_hw->CTRLA.reg = SERCOM_USART_CTRLA_SWRST; -} - -/** - * \name Writing and Reading - * @{ - */ -enum status_code usart_write_wait( - struct usart_module *const module, - const uint16_t tx_data); - -enum status_code usart_read_wait( - struct usart_module *const module, - uint16_t *const rx_data); - -enum status_code usart_write_buffer_wait( - struct usart_module *const module, - const uint8_t *tx_data, - uint16_t length); - -enum status_code usart_read_buffer_wait( - struct usart_module *const module, - uint8_t *rx_data, - uint16_t length); -/** @} */ - -/** - * \name Enabling/Disabling Receiver and Transmitter - * @{ - */ - -/** - * \brief Enable Transceiver - * - * Enable the given transceiver. Either RX or TX. - * - * \param[in] module Pointer to USART software instance struct - * \param[in] transceiver_type Transceiver type - */ -static inline void usart_enable_transceiver( - struct usart_module *const module, - enum usart_transceiver_type transceiver_type) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - /* Get a pointer to the hardware module instance */ - SercomUsart *const usart_hw = &(module->hw->USART); - - /* Wait until synchronization is complete */ - _usart_wait_for_sync(module); - - switch (transceiver_type) { - case USART_TRANSCEIVER_RX: - /* Enable RX */ - usart_hw->CTRLB.reg |= SERCOM_USART_CTRLB_RXEN; - module->receiver_enabled = true; - break; - - case USART_TRANSCEIVER_TX: - /* Enable TX */ - usart_hw->CTRLB.reg |= SERCOM_USART_CTRLB_TXEN; - module->transmitter_enabled = true; - break; - } - _usart_wait_for_sync(module); -} - -/** - * \brief Disable Transceiver - * - * Disable the given transceiver (RX or TX). - * - * \param[in] module Pointer to USART software instance struct - * \param[in] transceiver_type Transceiver type - */ -static inline void usart_disable_transceiver( - struct usart_module *const module, - enum usart_transceiver_type transceiver_type) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - /* Get a pointer to the hardware module instance */ - SercomUsart *const usart_hw = &(module->hw->USART); - - /* Wait until synchronization is complete */ - _usart_wait_for_sync(module); - - switch (transceiver_type) { - case USART_TRANSCEIVER_RX: - /* Disable RX */ - usart_hw->CTRLB.reg &= ~SERCOM_USART_CTRLB_RXEN; - module->receiver_enabled = false; - break; - - case USART_TRANSCEIVER_TX: - /* Disable TX */ - usart_hw->CTRLB.reg &= ~SERCOM_USART_CTRLB_TXEN; - module->transmitter_enabled = false; - break; - } -} - -/** @} */ - -#ifdef FEATURE_USART_LIN_MASTER -/** - * \name LIN Master Command and Status - * @{ - */ - -/** - * \brief Sending LIN command. - * - * Sending LIN command. - * - * \param[in] module Pointer to USART software instance struct - * \param[in] cmd Cammand type - */ -static inline void lin_master_send_cmd( - struct usart_module *const module, - enum lin_master_cmd cmd) -{ - SercomUsart *const usart_hw = &(module->hw->USART); - _usart_wait_for_sync(module); - usart_hw->CTRLB.reg |= cmd; -} - -/** - * \brief Get LIN transmission status - * - * Get LIN transmission status. - * - * \param[in] module Pointer to USART software instance struct - * - * \return Status of LIN master transmission. - * \retval true Data transmission completed - * \retval false Transmission is ongoing - */ -static inline bool lin_master_transmission_status(struct usart_module *const module) -{ - SercomUsart *const usart_hw = &(module->hw->USART); - return ((usart_hw->STATUS.reg & SERCOM_USART_STATUS_TXE)? true:false); -} - -/** @} */ -#endif - -#ifdef __cplusplus -} -#endif - -/** @} */ - -/** -* \page asfdoc_sam0_sercom_usart_extra Extra Information for SERCOM USART Driver -* -* \section asfdoc_sam0_sercom_usart_extra_acronyms Acronyms -* -* Below is a table listing the acronyms used in this module, along with their -* intended meanings. -* -* <table> -* <tr> -* <th>Acronym</th> -* <th>Description</th> -* </tr> -* <tr> -* <td>SERCOM</td> -* <td>Serial Communication Interface</td> -* </tr> -* <tr> -* <td>USART</td> -* <td>Universal Synchronous and Asynchronous Serial Receiver and Transmitter</td> -* </tr> -* <tr> -* <td>LSB</td> -* <td>Least Significant Bit</td> -* </tr> -* <tr> -* <td>MSB</td> -* <td>Most Significant Bit</td> -* </tr> -* <tr> -* <td>DMA</td> -* <td>Direct Memory Access</td> -* </tr> -* </table> -* -* -* \section asfdoc_sam0_sercom_usart_extra_dependencies Dependencies -* This driver has the following dependencies: -* -* - \ref asfdoc_sam0_system_pinmux_group "System Pin Multiplexer Driver" -* - \ref asfdoc_sam0_system_clock_group "System clock configuration" -* -* -* \section asfdoc_sam0_sercom_usart_extra_errata Errata -* There are no errata related to this driver. -* -* -* \section asfdoc_sam0_sercom_usart_extra_history Module History -* An overview of the module history is presented in the table below, with -* details on the enhancements and fixes made to the module since its first -* release. The current version of this corresponds to the newest version in -* the table. -* - * <table> - * <tr> - * <th>Changelog</th> - * </tr> - * <tr> - * <td>Added new feature as below: - * \li ISO7816 - * </tr> - * <tr> - * <td>Added new features as below: - * \li LIN master - * \li RS485 - * </tr> - * <tr> - * <td>Added new features as below: - * \li Oversample - * \li Buffer overflow notification - * \li Irda - * \li Lin slave - * \li Start frame detection - * \li Hardware flow control - * \li Collision detection - * \li DMA support </td> - * </tr> - * <tr> - * <td>\li Added new \c transmitter_enable and \c receiver_enable Boolean - * values to \c struct usart_config - * \li Altered \c usart_write_* and usart_read_* functions to abort with - * an error code if the relevant transceiver is not enabled - * \li Fixed \c usart_write_buffer_wait() and \c usart_read_buffer_wait() - * not aborting correctly when a timeout condition occurs</td> - * </tr> - * <tr> - * <td>Initial Release</td> - * </tr> - * </table> -*/ - -/** - * \page asfdoc_sam0_sercom_usart_exqsg Examples for SERCOM USART Driver - * - * This is a list of the available Quick Start guides (QSGs) and example - * applications for \ref asfdoc_sam0_sercom_usart_group. QSGs are simple examples with - * step-by-step instructions to configure and use this driver in a selection of - * use cases. Note that a QSG can be compiled as a standalone application or be - * added to the user application. - * - * - \subpage asfdoc_sam0_sercom_usart_basic_use_case - * \if USART_CALLBACK_MODE - * - \subpage asfdoc_sam0_sercom_usart_callback_use_case - * \endif - * - \subpage asfdoc_sam0_sercom_usart_dma_use_case - * - \subpage asfdoc_sam0_sercom_usart_lin_use_case - */ - -/** - * \page asfdoc_sam0_sercom_usart_mux_settings SERCOM USART MUX Settings - * - * The following lists the possible internal SERCOM module pad function - * assignments, for the four SERCOM pads when in USART mode. Note that this is - * in addition to the physical GPIO pin MUX of the device, and can be used in - * conjunction to optimize the serial data pin-out. - * - * When TX and RX are connected to the same pin, the USART will operate in - * half-duplex mode if both one transmitter and several receivers are enabled. - * - * \note When RX and XCK are connected to the same pin, the receiver must not - * be enabled if the USART is configured to use an external clock. - * - * - * <table> - * <tr> - * <th>MUX/Pad</th> - * <th>PAD 0</th> - * <th>PAD 1</th> - * <th>PAD 2</th> - * <th>PAD 3</th> - * </tr> - * <tr> - * <td>RX_0_TX_0_XCK_1</td> - * <td>TX / RX</td> - * <td>XCK</td> - * <td>-</td> - * <td>-</td> - * </tr> - * <tr> - * <td>RX_0_TX_2_XCK_3</td> - * <td>RX</td> - * <td>-</td> - * <td>TX</td> - * <td>XCK</td> - * </tr> - * <tr> - * <td>RX_1_TX_0_XCK_1</td> - * <td>TX</td> - * <td>RX / XCK</td> - * <td>-</td> - * <td>-</td> - * </tr> - * <tr> - * <td>RX_1_TX_2_XCK_3</td> - * <td>-</td> - * <td>RX</td> - * <td>TX</td> - * <td>XCK</td> - * </tr> - * <tr> - * <td>RX_2_TX_0_XCK_1</td> - * <td>TX</td> - * <td>XCK</td> - * <td>RX</td> - * <td>-</td> - * </tr> - * <tr> - * <td>RX_2_TX_2_XCK_3</td> - * <td>-</td> - * <td>-</td> - * <td>TX / RX</td> - * <td>XCK</td> - * </tr> - * <tr> - * <td>RX_3_TX_0_XCK_1</td> - * <td>TX</td> - * <td>XCK</td> - * <td>-</td> - * <td>RX</td> - * </tr> - * <tr> - * <td>RX_3_TX_2_XCK_3</td> - * <td>-</td> - * <td>-</td> - * <td>TX</td> - * <td>RX / XCK</td> - * </tr> - * </table> - * - * \page asfdoc_sam0_sercom_usart_document_revision_history Document Revision History - * - * <table> - * <tr> - * <th>Doc. Rev.</td> - * <th>Date</td> - * <th>Comments</td> - * </tr> - * <tr> - * <td>42118F</td> - * <td>12/2015</td> - * <td>Added support for SAM L21/L22, SAM DA1, SAM D09, SAMR30 and SAM C20/C21</td> - * </tr> - * <tr> - * <td>42118E</td> - * <td>12/2014</td> - * <td>Added support for SAM R21 and SAM D10/D11</td> - * </tr> - * <tr> - * <td>42118D</td> - * <td>01/2014</td> - * <td>Added support for SAM D21</td> - * </tr> - * <tr> - * <td>42118C</td> - * <td>10/2013</td> - * <td>Replaced the pad multiplexing documentation with a condensed table</td> - * </tr> - * <tr> - * <td>42118B</td> - * <td>06/2013</td> - * <td>Corrected documentation typos</td> - * </tr> - * <tr> - * <td>42118A</td> - * <td>06/2013</td> - * <td>Initial release</td> - * </tr> - * </table> - */ -#endif /* USART_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/sercom/usart/usart_interrupt.c b/atmel-samd/asf/sam0/drivers/sercom/usart/usart_interrupt.c deleted file mode 100644 index cc042894c..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/usart/usart_interrupt.c +++ /dev/null @@ -1,666 +0,0 @@ -/** - * \file - * - * \brief SAM SERCOM USART Asynchronous Driver - * - * Copyright (C) 2012-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#include "usart_interrupt.h" - -/** - * \internal - * Asynchronous write of a buffer with a given length - * - * \param[in] module Pointer to USART software instance struct - * \param[in] tx_data Pointer to data to be transmitted - * \param[in] length Length of data buffer - * - */ -enum status_code _usart_write_buffer( - struct usart_module *const module, - uint8_t *tx_data, - uint16_t length) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - Assert(tx_data); - - /* Get a pointer to the hardware module instance */ - SercomUsart *const usart_hw = &(module->hw->USART); - - system_interrupt_enter_critical_section(); - - /* Check if the USART transmitter is busy */ - if (module->remaining_tx_buffer_length > 0) { - system_interrupt_leave_critical_section(); - return STATUS_BUSY; - } - - /* Write parameters to the device instance */ - module->remaining_tx_buffer_length = length; - - system_interrupt_leave_critical_section(); - - module->tx_buffer_ptr = tx_data; - module->tx_status = STATUS_BUSY; - - /* Enable the Data Register Empty Interrupt */ - usart_hw->INTENSET.reg = SERCOM_USART_INTFLAG_DRE; - - return STATUS_OK; -} - -/** - * \internal - * Asynchronous read of a buffer with a given length - * - * \param[in] module Pointer to USART software instance struct - * \param[in] rx_data Pointer to data to be received - * \param[in] length Length of data buffer - * - */ -enum status_code _usart_read_buffer( - struct usart_module *const module, - uint8_t *rx_data, - uint16_t length) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - Assert(rx_data); - - /* Get a pointer to the hardware module instance */ - SercomUsart *const usart_hw = &(module->hw->USART); - - system_interrupt_enter_critical_section(); - - /* Check if the USART receiver is busy */ - if (module->remaining_rx_buffer_length > 0) { - system_interrupt_leave_critical_section(); - return STATUS_BUSY; - } - - /* Set length for the buffer and the pointer, and let - * the interrupt handler do the rest */ - module->remaining_rx_buffer_length = length; - - system_interrupt_leave_critical_section(); - - module->rx_buffer_ptr = rx_data; - module->rx_status = STATUS_BUSY; - - /* Enable the RX Complete Interrupt */ - usart_hw->INTENSET.reg = SERCOM_USART_INTFLAG_RXC; - -#ifdef FEATURE_USART_LIN_SLAVE - /* Enable the break character is received Interrupt */ - if(module->lin_slave_enabled) { - usart_hw->INTENSET.reg = SERCOM_USART_INTFLAG_RXBRK; - } -#endif - -#ifdef FEATURE_USART_START_FRAME_DECTION - /* Enable a start condition is detected Interrupt */ - if(module->start_frame_detection_enabled) { - usart_hw->INTENSET.reg = SERCOM_USART_INTFLAG_RXS; - } -#endif - - return STATUS_OK; -} - -/** - * \brief Registers a callback - * - * Registers a callback function, which is implemented by the user. - * - * \note The callback must be enabled by \ref usart_enable_callback - * in order for the interrupt handler to call it when the conditions for - * the callback type are met. - * - * \param[in] module Pointer to USART software instance struct - * \param[in] callback_func Pointer to callback function - * \param[in] callback_type Callback type given by an enum - * - */ -void usart_register_callback( - struct usart_module *const module, - usart_callback_t callback_func, - enum usart_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module); - Assert(callback_func); - - /* Register callback function */ - module->callback[callback_type] = callback_func; - - /* Set the bit corresponding to the callback_type */ - module->callback_reg_mask |= (1 << callback_type); -} - -/** - * \brief Unregisters a callback - * - * Unregisters a callback function, which is implemented by the user. - * - * \param[in,out] module Pointer to USART software instance struct - * \param[in] callback_type Callback type given by an enum - * - */ -void usart_unregister_callback( - struct usart_module *const module, - enum usart_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module); - - /* Unregister callback function */ - module->callback[callback_type] = NULL; - - /* Clear the bit corresponding to the callback_type */ - module->callback_reg_mask &= ~(1 << callback_type); -} - -/** - * \brief Asynchronous write a single char - * - * Sets up the driver to write the data given. If registered and enabled, - * a callback function will be called when the transmit is completed. - * - * \param[in] module Pointer to USART software instance struct - * \param[in] tx_data Data to transfer - * - * \returns Status of the operation. - * \retval STATUS_OK If operation was completed - * \retval STATUS_BUSY If operation was not completed, due to the - * USART module being busy - * \retval STATUS_ERR_DENIED If the transmitter is not enabled - */ -enum status_code usart_write_job( - struct usart_module *const module, - const uint16_t *tx_data) -{ - /* Sanity check arguments */ - Assert(module); - Assert(tx_data); - - - /* Check that the transmitter is enabled */ - if (!(module->transmitter_enabled)) { - return STATUS_ERR_DENIED; - } - - /* Call internal write buffer function with length 1 */ - return _usart_write_buffer(module, (uint8_t *)tx_data, 1); -} - -/** - * \brief Asynchronous read a single char - * - * Sets up the driver to read data from the USART module to the data - * pointer given. If registered and enabled, a callback will be called - * when the receiving is completed. - * - * \param[in] module Pointer to USART software instance struct - * \param[out] rx_data Pointer to where received data should be put - * - * \returns Status of the operation. - * \retval STATUS_OK If operation was completed - * \retval STATUS_BUSY If operation was not completed - */ -enum status_code usart_read_job( - struct usart_module *const module, - uint16_t *const rx_data) -{ - /* Sanity check arguments */ - Assert(module); - Assert(rx_data); - - /* Call internal read buffer function with length 1 */ - return _usart_read_buffer(module, (uint8_t *)rx_data, 1); -} - -/** - * \brief Asynchronous buffer write - * - * Sets up the driver to write a given buffer over the USART. If registered and - * enabled, a callback function will be called. - * - * \param[in] module Pointer to USART software instance struct - * \param[in] tx_data Pointer do data buffer to transmit - * \param[in] length Length of the data to transmit - * - * \note If using 9-bit data, the array that *tx_data point to should be defined - * as uint16_t array and should be casted to uint8_t* pointer. Because it - * is an address pointer, the highest byte is not discarded. For example: - * \code - #define TX_LEN 3 - uint16_t tx_buf[TX_LEN] = {0x0111, 0x0022, 0x0133}; - usart_write_buffer_job(&module, (uint8_t*)tx_buf, TX_LEN); - \endcode - * - * \returns Status of the operation. - * \retval STATUS_OK If operation was completed successfully. - * \retval STATUS_BUSY If operation was not completed, due to the - * USART module being busy - * \retval STATUS_ERR_INVALID_ARG If operation was not completed, due to invalid - * arguments - * \retval STATUS_ERR_DENIED If the transmitter is not enabled - */ -enum status_code usart_write_buffer_job( - struct usart_module *const module, - uint8_t *tx_data, - uint16_t length) -{ - /* Sanity check arguments */ - Assert(module); - Assert(tx_data); - - if (length == 0) { - return STATUS_ERR_INVALID_ARG; - } - - /* Check that the transmitter is enabled */ - if (!(module->transmitter_enabled)) { - return STATUS_ERR_DENIED; - } - - /* Issue internal asynchronous write */ - return _usart_write_buffer(module, tx_data, length); -} - -/** - * \brief Asynchronous buffer read - * - * Sets up the driver to read from the USART to a given buffer. If registered - * and enabled, a callback function will be called. - * - * \param[in] module Pointer to USART software instance struct - * \param[out] rx_data Pointer to data buffer to receive - * \param[in] length Data buffer length - * - * \note If using 9-bit data, the array that *rx_data point to should be defined - * as uint16_t array and should be casted to uint8_t* pointer. Because it - * is an address pointer, the highest byte is not discarded. For example: - * \code - #define RX_LEN 3 - uint16_t rx_buf[RX_LEN] = {0x0,}; - usart_read_buffer_job(&module, (uint8_t*)rx_buf, RX_LEN); - \endcode - * - * \returns Status of the operation. - * \retval STATUS_OK If operation was completed - * \retval STATUS_BUSY If operation was not completed, due to the - * USART module being busy - * \retval STATUS_ERR_INVALID_ARG If operation was not completed, due to invalid - * arguments - * \retval STATUS_ERR_DENIED If the transmitter is not enabled - */ -enum status_code usart_read_buffer_job( - struct usart_module *const module, - uint8_t *rx_data, - uint16_t length) -{ - /* Sanity check arguments */ - Assert(module); - Assert(rx_data); - - if (length == 0) { - return STATUS_ERR_INVALID_ARG; - } - - /* Check that the receiver is enabled */ - if (!(module->receiver_enabled)) { - return STATUS_ERR_DENIED; - } - - /* Issue internal asynchronous read */ - return _usart_read_buffer(module, rx_data, length); -} - -/** - * \brief Cancels ongoing read/write operation - * - * Cancels the ongoing read/write operation modifying parameters in the - * USART software struct. - * - * \param[in] module Pointer to USART software instance struct - * \param[in] transceiver_type Transfer type to cancel - */ -void usart_abort_job( - struct usart_module *const module, - enum usart_transceiver_type transceiver_type) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - /* Get a pointer to the hardware module instance */ - SercomUsart *const usart_hw = &(module->hw->USART); - - switch(transceiver_type) { - case USART_TRANSCEIVER_RX: - /* Clear the interrupt flag in order to prevent the receive - * complete callback to fire */ - usart_hw->INTFLAG.reg = SERCOM_USART_INTFLAG_RXC; - - /* Clear the software reception buffer */ - module->remaining_rx_buffer_length = 0; - - break; - - case USART_TRANSCEIVER_TX: - /* Clear the interrupt flag in order to prevent the receive - * complete callback to fire */ - usart_hw->INTFLAG.reg = SERCOM_USART_INTFLAG_TXC; - - /* Clear the software reception buffer */ - module->remaining_tx_buffer_length = 0; - - break; - } -} - -/** - * \brief Get status from the ongoing or last asynchronous transfer operation - * - * Returns the error from a given ongoing or last asynchronous transfer operation. - * Either from a read or write transfer. - * - * \param[in] module Pointer to USART software instance struct - * \param[in] transceiver_type Transfer type to check - * - * \return Status of the given job. - * \retval STATUS_OK No error occurred during the last transfer - * \retval STATUS_BUSY A transfer is ongoing - * \retval STATUS_ERR_BAD_DATA The last operation was aborted due to a - * parity error. The transfer could be affected - * by external noise - * \retval STATUS_ERR_BAD_FORMAT The last operation was aborted due to a - * frame error - * \retval STATUS_ERR_OVERFLOW The last operation was aborted due to a - * buffer overflow - * \retval STATUS_ERR_INVALID_ARG An invalid transceiver enum given - */ -enum status_code usart_get_job_status( - struct usart_module *const module, - enum usart_transceiver_type transceiver_type) -{ - /* Sanity check arguments */ - Assert(module); - - /* Variable for status code */ - enum status_code status_code; - - switch(transceiver_type) { - case USART_TRANSCEIVER_RX: - status_code = module->rx_status; - break; - - case USART_TRANSCEIVER_TX: - status_code = module->tx_status; - break; - - default: - status_code = STATUS_ERR_INVALID_ARG; - break; - } - - return status_code; -} - -/** - * \internal - * Handles interrupts as they occur, and it will run callback functions - * which are registered and enabled. - * - * \param[in] instance ID of the SERCOM instance calling the interrupt - * handler. - */ -void _usart_interrupt_handler( - uint8_t instance) -{ - /* Temporary variables */ - uint16_t interrupt_status; - uint16_t callback_status; - uint8_t error_code; - - - /* Get device instance from the look-up table */ - struct usart_module *module - = (struct usart_module *)_sercom_instances[instance]; - - /* Pointer to the hardware module instance */ - SercomUsart *const usart_hw - = &(module->hw->USART); - - /* Wait for the synchronization to complete */ - _usart_wait_for_sync(module); - - /* Read and mask interrupt flag register */ - interrupt_status = usart_hw->INTFLAG.reg; - interrupt_status &= usart_hw->INTENSET.reg; - callback_status = module->callback_reg_mask & - module->callback_enable_mask; - - /* Check if a DATA READY interrupt has occurred, - * and if there is more to transfer */ - if (interrupt_status & SERCOM_USART_INTFLAG_DRE) { - if (module->remaining_tx_buffer_length) { - /* Write value will be at least 8-bits long */ - uint16_t data_to_send = *(module->tx_buffer_ptr); - /* Increment 8-bit pointer */ - (module->tx_buffer_ptr)++; - - if (module->character_size == USART_CHARACTER_SIZE_9BIT) { - data_to_send |= (*(module->tx_buffer_ptr) << 8); - /* Increment 8-bit pointer */ - (module->tx_buffer_ptr)++; - } - /* Write the data to send */ - usart_hw->DATA.reg = (data_to_send & SERCOM_USART_DATA_MASK); - - if (--(module->remaining_tx_buffer_length) == 0) { - /* Disable the Data Register Empty Interrupt */ - usart_hw->INTENCLR.reg = SERCOM_USART_INTFLAG_DRE; - /* Enable Transmission Complete interrupt */ - usart_hw->INTENSET.reg = SERCOM_USART_INTFLAG_TXC; - - } - } else { - usart_hw->INTENCLR.reg = SERCOM_USART_INTFLAG_DRE; - } - } - - /* Check if the Transmission Complete interrupt has occurred and - * that the transmit buffer is empty */ - if (interrupt_status & SERCOM_USART_INTFLAG_TXC) { - - /* Disable TX Complete Interrupt, and set STATUS_OK */ - usart_hw->INTENCLR.reg = SERCOM_USART_INTFLAG_TXC; - module->tx_status = STATUS_OK; - - /* Run callback if registered and enabled */ - if (callback_status & (1 << USART_CALLBACK_BUFFER_TRANSMITTED)) { - (*(module->callback[USART_CALLBACK_BUFFER_TRANSMITTED]))(module); - } - } - - /* Check if the Receive Complete interrupt has occurred, and that - * there's more data to receive */ - if (interrupt_status & SERCOM_USART_INTFLAG_RXC) { - - if (module->remaining_rx_buffer_length) { - /* Read out the status code and mask away all but the 4 LSBs*/ - error_code = (uint8_t)(usart_hw->STATUS.reg & SERCOM_USART_STATUS_MASK); -#if !SAMD20 - /* CTS status should not be considered as an error */ - if(error_code & SERCOM_USART_STATUS_CTS) { - error_code &= ~SERCOM_USART_STATUS_CTS; - } -#endif -#ifdef FEATURE_USART_LIN_MASTER - /* TXE status should not be considered as an error */ - if(error_code & SERCOM_USART_STATUS_TXE) { - error_code &= ~SERCOM_USART_STATUS_TXE; - } -#endif - /* Check if an error has occurred during the receiving */ - if (error_code) { - /* Check which error occurred */ - if (error_code & SERCOM_USART_STATUS_FERR) { - /* Store the error code and clear flag by writing 1 to it */ - module->rx_status = STATUS_ERR_BAD_FORMAT; - usart_hw->STATUS.reg = SERCOM_USART_STATUS_FERR; - } else if (error_code & SERCOM_USART_STATUS_BUFOVF) { - /* Store the error code and clear flag by writing 1 to it */ - module->rx_status = STATUS_ERR_OVERFLOW; - usart_hw->STATUS.reg = SERCOM_USART_STATUS_BUFOVF; - } else if (error_code & SERCOM_USART_STATUS_PERR) { - /* Store the error code and clear flag by writing 1 to it */ - module->rx_status = STATUS_ERR_BAD_DATA; - usart_hw->STATUS.reg = SERCOM_USART_STATUS_PERR; - } -#ifdef FEATURE_USART_LIN_SLAVE - else if (error_code & SERCOM_USART_STATUS_ISF) { - /* Store the error code and clear flag by writing 1 to it */ - module->rx_status = STATUS_ERR_PROTOCOL; - usart_hw->STATUS.reg = SERCOM_USART_STATUS_ISF; - } -#endif -#ifdef FEATURE_USART_COLLISION_DECTION - else if (error_code & SERCOM_USART_STATUS_COLL) { - /* Store the error code and clear flag by writing 1 to it */ - module->rx_status = STATUS_ERR_PACKET_COLLISION; - usart_hw->STATUS.reg = SERCOM_USART_STATUS_COLL; - } -#endif - - /* Run callback if registered and enabled */ - if (callback_status - & (1 << USART_CALLBACK_ERROR)) { - (*(module->callback[USART_CALLBACK_ERROR]))(module); - } - - } else { - - /* Read current packet from DATA register, - * increment buffer pointer and decrement buffer length */ - uint16_t received_data = (usart_hw->DATA.reg & SERCOM_USART_DATA_MASK); - - /* Read value will be at least 8-bits long */ - *(module->rx_buffer_ptr) = received_data; - /* Increment 8-bit pointer */ - module->rx_buffer_ptr += 1; - - if (module->character_size == USART_CHARACTER_SIZE_9BIT) { - /* 9-bit data, write next received byte to the buffer */ - *(module->rx_buffer_ptr) = (received_data >> 8); - /* Increment 8-bit pointer */ - module->rx_buffer_ptr += 1; - } - - /* Check if the last character have been received */ - if(--(module->remaining_rx_buffer_length) == 0) { - /* Disable RX Complete Interrupt, - * and set STATUS_OK */ - usart_hw->INTENCLR.reg = SERCOM_USART_INTFLAG_RXC; - module->rx_status = STATUS_OK; - - /* Run callback if registered and enabled */ - if (callback_status - & (1 << USART_CALLBACK_BUFFER_RECEIVED)) { - (*(module->callback[USART_CALLBACK_BUFFER_RECEIVED]))(module); - } - } - } - } else { - /* This should not happen. Disable Receive Complete interrupt. */ - usart_hw->INTENCLR.reg = SERCOM_USART_INTFLAG_RXC; - } - } - -#ifdef FEATURE_USART_HARDWARE_FLOW_CONTROL - if (interrupt_status & SERCOM_USART_INTFLAG_CTSIC) { - /* Disable interrupts */ - usart_hw->INTENCLR.reg = SERCOM_USART_INTENCLR_CTSIC; - /* Clear interrupt flag */ - usart_hw->INTFLAG.reg = SERCOM_USART_INTFLAG_CTSIC; - - /* Run callback if registered and enabled */ - if (callback_status & (1 << USART_CALLBACK_CTS_INPUT_CHANGE)) { - (*(module->callback[USART_CALLBACK_CTS_INPUT_CHANGE]))(module); - } - } -#endif - -#ifdef FEATURE_USART_LIN_SLAVE - if (interrupt_status & SERCOM_USART_INTFLAG_RXBRK) { - /* Disable interrupts */ - usart_hw->INTENCLR.reg = SERCOM_USART_INTENCLR_RXBRK; - /* Clear interrupt flag */ - usart_hw->INTFLAG.reg = SERCOM_USART_INTFLAG_RXBRK; - - /* Run callback if registered and enabled */ - if (callback_status & (1 << USART_CALLBACK_BREAK_RECEIVED)) { - (*(module->callback[USART_CALLBACK_BREAK_RECEIVED]))(module); - } - } -#endif - -#ifdef FEATURE_USART_START_FRAME_DECTION - if (interrupt_status & SERCOM_USART_INTFLAG_RXS) { - /* Disable interrupts */ - usart_hw->INTENCLR.reg = SERCOM_USART_INTENCLR_RXS; - /* Clear interrupt flag */ - usart_hw->INTFLAG.reg = SERCOM_USART_INTFLAG_RXS; - - /* Run callback if registered and enabled */ - if (callback_status & (1 << USART_CALLBACK_START_RECEIVED)) { - (*(module->callback[USART_CALLBACK_START_RECEIVED]))(module); - } - } -#endif -} - diff --git a/atmel-samd/asf/sam0/drivers/sercom/usart/usart_interrupt.h b/atmel-samd/asf/sam0/drivers/sercom/usart/usart_interrupt.h deleted file mode 100644 index 26595d0a0..000000000 --- a/atmel-samd/asf/sam0/drivers/sercom/usart/usart_interrupt.h +++ /dev/null @@ -1,177 +0,0 @@ -/** - * \file - * - * \brief SAM SERCOM USART Asynchronous Driver - * - * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef USART_INTERRUPT_H_INCLUDED -#define USART_INTERRUPT_H_INCLUDED - -#include "usart.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(__DOXYGEN__) -enum status_code _usart_write_buffer( - struct usart_module *const module, - uint8_t *tx_data, - uint16_t length); - -enum status_code _usart_read_buffer( - struct usart_module *const module, - uint8_t *rx_data, - uint16_t length); - -void _usart_interrupt_handler( - uint8_t instance); -#endif - -/** - * \addtogroup asfdoc_sam0_sercom_usart_group - * - * @{ - */ - -/** - * \name Callback Management - * @{ - */ -void usart_register_callback( - struct usart_module *const module, - usart_callback_t callback_func, - enum usart_callback callback_type); - -void usart_unregister_callback( - struct usart_module *module, - enum usart_callback callback_type); - -/** - * \brief Enables callback - * - * Enables the callback function registered by the \ref usart_register_callback. - * The callback function will be called from the interrupt handler when the - * conditions for the callback type are met. - * - * \param[in] module Pointer to USART software instance struct - * \param[in] callback_type Callback type given by an enum - */ -static inline void usart_enable_callback( - struct usart_module *const module, - enum usart_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module); - - /* Enable callback */ - module->callback_enable_mask |= (1 << callback_type); - -} - -/** - * \brief Disable callback - * - * Disables the callback function registered by the \ref usart_register_callback, - * and the callback will not be called from the interrupt routine. - * - * \param[in] module Pointer to USART software instance struct - * \param[in] callback_type Callback type given by an enum - */ -static inline void usart_disable_callback( - struct usart_module *const module, - enum usart_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module); - - /* Disable callback */ - module->callback_enable_mask &= ~(1 << callback_type); -} - -/** - * @} - */ - -/** - * \name Writing and Reading - * @{ - */ -enum status_code usart_write_job( - struct usart_module *const module, - const uint16_t *tx_data); - -enum status_code usart_read_job( - struct usart_module *const module, - uint16_t *const rx_data); - -enum status_code usart_write_buffer_job( - struct usart_module *const module, - uint8_t *tx_data, - uint16_t length); - -enum status_code usart_read_buffer_job( - struct usart_module *const module, - uint8_t *rx_data, - uint16_t length); - -void usart_abort_job( - struct usart_module *const module, - enum usart_transceiver_type transceiver_type); - -enum status_code usart_get_job_status( - struct usart_module *const module, - enum usart_transceiver_type transceiver_type); -/** - * @} - */ - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /* USART_INTERRUPT_H_INCLUDED */ - diff --git a/atmel-samd/asf/sam0/drivers/system/clock/clock.h b/atmel-samd/asf/sam0/drivers/system/clock/clock.h deleted file mode 100644 index 0d350428d..000000000 --- a/atmel-samd/asf/sam0/drivers/system/clock/clock.h +++ /dev/null @@ -1,53 +0,0 @@ -/** - * \file - * - * \brief SAM Clock Driver - * - * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef SYSTEM_CLOCK_H_INCLUDED -#define SYSTEM_CLOCK_H_INCLUDED - -#include <compiler.h> -#include <gclk.h> -#include <clock_feature.h> - -#endif /* SYSTEM_CLOCK_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/system/clock/clock_samd21_r21_da/clock.c b/atmel-samd/asf/sam0/drivers/system/clock/clock_samd21_r21_da/clock.c deleted file mode 100644 index 777ac5b9b..000000000 --- a/atmel-samd/asf/sam0/drivers/system/clock/clock_samd21_r21_da/clock.c +++ /dev/null @@ -1,1041 +0,0 @@ -/** - * \file - * - * \brief SAM D21/R21/DA0/DA1 Clock Driver - * - * Copyright (C) 2013-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#include <clock.h> -#include <conf_clocks.h> -#include <system.h> - -#ifndef SYSCTRL_FUSES_OSC32K_ADDR -#if (SAMR21) || (SAMD) -# define SYSCTRL_FUSES_OSC32K_ADDR FUSES_OSC32K_CAL_ADDR -# define SYSCTRL_FUSES_OSC32K_Pos FUSES_OSC32K_CAL_Pos -#elif (SAML21) -# define SYSCTRL_FUSES_OSC32K_ADDR NVMCTRL_OTP4 -# define SYSCTRL_FUSES_OSC32K_Pos 6 - -#else -# define SYSCTRL_FUSES_OSC32K_ADDR SYSCTRL_FUSES_OSC32K_CAL_ADDR -# define SYSCTRL_FUSES_OSC32K_Pos SYSCTRL_FUSES_OSC32K_CAL_Pos -#endif -#endif - -/** - * \internal - * \brief DFLL-specific data container. - */ -struct _system_clock_dfll_config { - uint32_t control; - uint32_t val; - uint32_t mul; -}; - -/** - * \internal - * \brief DPLL-specific data container. - */ -struct _system_clock_dpll_config { - uint32_t frequency; -}; - - -/** - * \internal - * \brief XOSC-specific data container. - */ -struct _system_clock_xosc_config { - uint32_t frequency; -}; - -/** - * \internal - * \brief System clock module data container. - */ -struct _system_clock_module { - volatile struct _system_clock_dfll_config dfll; - -#ifdef FEATURE_SYSTEM_CLOCK_DPLL - volatile struct _system_clock_dpll_config dpll; -#endif - - volatile struct _system_clock_xosc_config xosc; - volatile struct _system_clock_xosc_config xosc32k; -}; - -/** - * \internal - * \brief Internal module instance to cache configuration values. - */ -static struct _system_clock_module _system_clock_inst = { - .dfll = { - .control = 0, - .val = 0, - .mul = 0, - }, - -#ifdef FEATURE_SYSTEM_CLOCK_DPLL - .dpll = { - .frequency = 0, - }, -#endif - .xosc = { - .frequency = 0, - }, - .xosc32k = { - .frequency = 0, - }, - }; - -/** - * \internal - * \brief Wait for sync to the DFLL control registers. - */ -static inline void _system_dfll_wait_for_sync(void) -{ - while (!(SYSCTRL->PCLKSR.reg & SYSCTRL_PCLKSR_DFLLRDY)) { - /* Wait for DFLL sync */ - } -} - -/** - * \internal - * \brief Wait for sync to the OSC32K control registers. - */ -static inline void _system_osc32k_wait_for_sync(void) -{ - while (!(SYSCTRL->PCLKSR.reg & SYSCTRL_PCLKSR_OSC32KRDY)) { - /* Wait for OSC32K sync */ - } -} - -static inline void _system_clock_source_dfll_set_config_errata_9905(void) -{ - - /* Disable ONDEMAND mode while writing configurations */ - SYSCTRL->DFLLCTRL.reg = SYSCTRL_DFLLCTRL_ENABLE; - _system_dfll_wait_for_sync(); - - SYSCTRL->DFLLMUL.reg = _system_clock_inst.dfll.mul; - SYSCTRL->DFLLVAL.reg = _system_clock_inst.dfll.val; - - /* Write full configuration to DFLL control register */ - SYSCTRL->DFLLCTRL.reg = 0; - _system_dfll_wait_for_sync(); - SYSCTRL->DFLLCTRL.reg = _system_clock_inst.dfll.control; -} - -/** - * \brief Retrieve the frequency of a clock source. - * - * Determines the current operating frequency of a given clock source. - * - * \param[in] clock_source Clock source to get the frequency - * - * \returns Frequency of the given clock source, in Hz. - */ -uint32_t system_clock_source_get_hz( - const enum system_clock_source clock_source) -{ - switch (clock_source) { - case SYSTEM_CLOCK_SOURCE_XOSC: - return _system_clock_inst.xosc.frequency; - - case SYSTEM_CLOCK_SOURCE_OSC8M: - return 8000000UL >> SYSCTRL->OSC8M.bit.PRESC; - - case SYSTEM_CLOCK_SOURCE_OSC32K: - return 32768UL; - - case SYSTEM_CLOCK_SOURCE_ULP32K: - return 32768UL; - - case SYSTEM_CLOCK_SOURCE_XOSC32K: - return _system_clock_inst.xosc32k.frequency; - - case SYSTEM_CLOCK_SOURCE_DFLL: - - /* Check if the DFLL has been configured */ - if (!(_system_clock_inst.dfll.control & SYSCTRL_DFLLCTRL_ENABLE)) - return 0; - - /* Make sure that the DFLL module is ready */ - _system_dfll_wait_for_sync(); - - /* Check if operating in closed loop mode */ - if ((_system_clock_inst.dfll.control & SYSCTRL_DFLLCTRL_MODE) && - !( _system_clock_inst.dfll.control & SYSCTRL_DFLLCTRL_USBCRM )) { - return system_gclk_chan_get_hz(SYSCTRL_GCLK_ID_DFLL48) * - (_system_clock_inst.dfll.mul & 0xffff); - } - - return 48000000UL; - -#ifdef FEATURE_SYSTEM_CLOCK_DPLL - case SYSTEM_CLOCK_SOURCE_DPLL: - if (!(SYSCTRL->DPLLSTATUS.reg & SYSCTRL_DPLLSTATUS_ENABLE)) { - return 0; - } - - return _system_clock_inst.dpll.frequency; -#endif - - default: - return 0; - } -} - -/** - * \brief Configure the internal OSC8M oscillator clock source. - * - * Configures the 8MHz (nominal) internal RC oscillator with the given - * configuration settings. - * - * \param[in] config OSC8M configuration structure containing the new config - */ -void system_clock_source_osc8m_set_config( - struct system_clock_source_osc8m_config *const config) -{ - SYSCTRL_OSC8M_Type temp = SYSCTRL->OSC8M; - - /* Use temporary struct to reduce register access */ - temp.bit.PRESC = config->prescaler; - temp.bit.ONDEMAND = config->on_demand; - temp.bit.RUNSTDBY = config->run_in_standby; - - SYSCTRL->OSC8M = temp; -} - -/** - * \brief Configure the internal OSC32K oscillator clock source. - * - * Configures the 32KHz (nominal) internal RC oscillator with the given - * configuration settings. - * - * \param[in] config OSC32K configuration structure containing the new config - */ -void system_clock_source_osc32k_set_config( - struct system_clock_source_osc32k_config *const config) -{ - SYSCTRL_OSC32K_Type temp = SYSCTRL->OSC32K; - - /* Update settings via a temporary struct to reduce register access */ - temp.bit.EN1K = config->enable_1khz_output; - temp.bit.EN32K = config->enable_32khz_output; - temp.bit.STARTUP = config->startup_time; - temp.bit.ONDEMAND = config->on_demand; - temp.bit.RUNSTDBY = config->run_in_standby; - temp.bit.WRTLOCK = config->write_once; - - SYSCTRL->OSC32K = temp; -} - -/** - * \brief Configure the external oscillator clock source. - * - * Configures the external oscillator clock source with the given configuration - * settings. - * - * \param[in] config External oscillator configuration structure containing - * the new config - */ -void system_clock_source_xosc_set_config( - struct system_clock_source_xosc_config *const config) -{ - SYSCTRL_XOSC_Type temp = SYSCTRL->XOSC; - - temp.bit.STARTUP = config->startup_time; - - if (config->external_clock == SYSTEM_CLOCK_EXTERNAL_CRYSTAL) { - temp.bit.XTALEN = 1; - } else { - temp.bit.XTALEN = 0; - } - - temp.bit.AMPGC = config->auto_gain_control; - - /* Set gain if automatic gain control is not selected */ - if (!config->auto_gain_control) { - if (config->frequency <= 2000000) { - temp.bit.GAIN = 0; - } else if (config->frequency <= 4000000) { - temp.bit.GAIN = 1; - } else if (config->frequency <= 8000000) { - temp.bit.GAIN = 2; - } else if (config->frequency <= 16000000) { - temp.bit.GAIN = 3; - } else if (config->frequency <= 32000000) { - temp.bit.GAIN = 4; - } - - } - - temp.bit.ONDEMAND = config->on_demand; - temp.bit.RUNSTDBY = config->run_in_standby; - - /* Store XOSC frequency for internal use */ - _system_clock_inst.xosc.frequency = config->frequency; - - SYSCTRL->XOSC = temp; -} - -/** - * \brief Configure the XOSC32K external 32KHz oscillator clock source. - * - * Configures the external 32KHz oscillator clock source with the given - * configuration settings. - * - * \param[in] config XOSC32K configuration structure containing the new config - */ -void system_clock_source_xosc32k_set_config( - struct system_clock_source_xosc32k_config *const config) -{ - SYSCTRL_XOSC32K_Type temp = SYSCTRL->XOSC32K; - - temp.bit.STARTUP = config->startup_time; - - if (config->external_clock == SYSTEM_CLOCK_EXTERNAL_CRYSTAL) { - temp.bit.XTALEN = 1; - } else { - temp.bit.XTALEN = 0; - } - - temp.bit.AAMPEN = config->auto_gain_control; - temp.bit.EN1K = config->enable_1khz_output; - temp.bit.EN32K = config->enable_32khz_output; - - temp.bit.ONDEMAND = config->on_demand; - temp.bit.RUNSTDBY = config->run_in_standby; - temp.bit.WRTLOCK = config->write_once; - - /* Cache the new frequency in case the user needs to check the current - * operating frequency later */ - _system_clock_inst.xosc32k.frequency = config->frequency; - - SYSCTRL->XOSC32K = temp; -} - -/** - * \brief Configure the DFLL clock source. - * - * Configures the Digital Frequency Locked Loop clock source with the given - * configuration settings. - * - * \note The DFLL will be running when this function returns, as the DFLL module - * needs to be enabled in order to perform the module configuration. - * - * \param[in] config DFLL configuration structure containing the new config - */ -void system_clock_source_dfll_set_config( - struct system_clock_source_dfll_config *const config) -{ - _system_clock_inst.dfll.val = - SYSCTRL_DFLLVAL_COARSE(config->coarse_value) | - SYSCTRL_DFLLVAL_FINE(config->fine_value); - - _system_clock_inst.dfll.control = - (uint32_t)config->wakeup_lock | - (uint32_t)config->stable_tracking | - (uint32_t)config->quick_lock | - (uint32_t)config->chill_cycle | - ((uint32_t)config->on_demand << SYSCTRL_DFLLCTRL_ONDEMAND_Pos); - - if (config->loop_mode == SYSTEM_CLOCK_DFLL_LOOP_MODE_CLOSED) { - - _system_clock_inst.dfll.mul = - SYSCTRL_DFLLMUL_CSTEP(config->coarse_max_step) | - SYSCTRL_DFLLMUL_FSTEP(config->fine_max_step) | - SYSCTRL_DFLLMUL_MUL(config->multiply_factor); - - /* Enable the closed loop mode */ - _system_clock_inst.dfll.control |= config->loop_mode; - } - if (config->loop_mode == SYSTEM_CLOCK_DFLL_LOOP_MODE_USB_RECOVERY) { - - _system_clock_inst.dfll.mul = - SYSCTRL_DFLLMUL_CSTEP(config->coarse_max_step) | - SYSCTRL_DFLLMUL_FSTEP(config->fine_max_step) | - SYSCTRL_DFLLMUL_MUL(config->multiply_factor); - - /* Enable the USB recovery mode */ - _system_clock_inst.dfll.control |= config->loop_mode | - SYSCTRL_DFLLCTRL_MODE | SYSCTRL_DFLLCTRL_BPLCKC; - } -} - -#ifdef FEATURE_SYSTEM_CLOCK_DPLL -/** - * \brief Configure the DPLL clock source. - * - * Configures the Digital Phase-Locked Loop clock source with the given - * configuration settings. - * - * \note The DPLL will be running when this function returns, as the DPLL module - * needs to be enabled in order to perform the module configuration. - * - * \param[in] config DPLL configuration structure containing the new config - */ -void system_clock_source_dpll_set_config( - struct system_clock_source_dpll_config *const config) -{ - - uint32_t tmpldr; - uint8_t tmpldrfrac; - uint32_t refclk; - - refclk = config->reference_frequency; - - /* Only reference clock REF1 can be divided */ - if (config->reference_clock == SYSTEM_CLOCK_SOURCE_DPLL_REFERENCE_CLOCK_XOSC) { - refclk = refclk / (2 * (config->reference_divider + 1)); - } - - /* Calculate LDRFRAC and LDR */ - tmpldr = (config->output_frequency << 4) / refclk; - tmpldrfrac = tmpldr & 0x0f; - tmpldr = (tmpldr >> 4) - 1; - - SYSCTRL->DPLLCTRLA.reg = - ((uint32_t)config->on_demand << SYSCTRL_DPLLCTRLA_ONDEMAND_Pos) | - ((uint32_t)config->run_in_standby << SYSCTRL_DPLLCTRLA_RUNSTDBY_Pos); - - SYSCTRL->DPLLRATIO.reg = - SYSCTRL_DPLLRATIO_LDRFRAC(tmpldrfrac) | - SYSCTRL_DPLLRATIO_LDR(tmpldr); - - SYSCTRL->DPLLCTRLB.reg = - SYSCTRL_DPLLCTRLB_DIV(config->reference_divider) | - ((uint32_t)config->lock_bypass << SYSCTRL_DPLLCTRLB_LBYPASS_Pos) | - SYSCTRL_DPLLCTRLB_LTIME(config->lock_time) | - SYSCTRL_DPLLCTRLB_REFCLK(config->reference_clock) | - ((uint32_t)config->wake_up_fast << SYSCTRL_DPLLCTRLB_WUF_Pos) | - ((uint32_t)config->low_power_enable << SYSCTRL_DPLLCTRLB_LPEN_Pos) | - SYSCTRL_DPLLCTRLB_FILTER(config->filter); - - /* - * Fck = Fckrx * (LDR + 1 + LDRFRAC / 16) - */ - _system_clock_inst.dpll.frequency = - (refclk * (((tmpldr + 1) << 4) + tmpldrfrac)) >> 4; -} -#endif - -/** - * \brief Writes the calibration values for a given oscillator clock source. - * - * Writes an oscillator calibration value to the given oscillator control - * registers. The acceptable ranges are: - * - * For OSC32K: - * - 7 bits (max value 128) - * For OSC8MHZ: - * - 8 bits (Max value 255) - * For OSCULP: - * - 5 bits (Max value 32) - * - * \note The frequency range parameter applies only when configuring the 8MHz - * oscillator and will be ignored for the other oscillators. - * - * \param[in] clock_source Clock source to calibrate - * \param[in] calibration_value Calibration value to write - * \param[in] freq_range Frequency range (8MHz oscillator only) - * - * \retval STATUS_OK The calibration value was written - * successfully. - * \retval STATUS_ERR_INVALID_ARG The setting is not valid for selected clock - * source. - */ -enum status_code system_clock_source_write_calibration( - const enum system_clock_source clock_source, - const uint16_t calibration_value, - const uint8_t freq_range) -{ - switch (clock_source) { - case SYSTEM_CLOCK_SOURCE_OSC8M: - - if (calibration_value > 0xfff || freq_range > 4) { - return STATUS_ERR_INVALID_ARG; - } - - SYSCTRL->OSC8M.bit.CALIB = calibration_value; - SYSCTRL->OSC8M.bit.FRANGE = freq_range; - break; - - case SYSTEM_CLOCK_SOURCE_OSC32K: - - if (calibration_value > 128) { - return STATUS_ERR_INVALID_ARG; - } - - _system_osc32k_wait_for_sync(); - SYSCTRL->OSC32K.bit.CALIB = calibration_value; - break; - - case SYSTEM_CLOCK_SOURCE_ULP32K: - - if (calibration_value > 32) { - return STATUS_ERR_INVALID_ARG; - } - - SYSCTRL->OSCULP32K.bit.CALIB = calibration_value; - break; - - default: - Assert(false); - return STATUS_ERR_INVALID_ARG; - break; - } - - return STATUS_OK; -} - -/** - * \brief Enables a clock source. - * - * Enables a clock source which has been previously configured. - * - * \param[in] clock_source Clock source to enable - * - * \retval STATUS_OK Clock source was enabled successfully and - * is ready - * \retval STATUS_ERR_INVALID_ARG The clock source is not available on this - * device - */ -enum status_code system_clock_source_enable( - const enum system_clock_source clock_source) -{ - switch (clock_source) { - case SYSTEM_CLOCK_SOURCE_OSC8M: - SYSCTRL->OSC8M.reg |= SYSCTRL_OSC8M_ENABLE; - return STATUS_OK; - - case SYSTEM_CLOCK_SOURCE_OSC32K: - SYSCTRL->OSC32K.reg |= SYSCTRL_OSC32K_ENABLE; - break; - - case SYSTEM_CLOCK_SOURCE_XOSC: - SYSCTRL->XOSC.reg |= SYSCTRL_XOSC_ENABLE; - break; - - case SYSTEM_CLOCK_SOURCE_XOSC32K: - SYSCTRL->XOSC32K.reg |= SYSCTRL_XOSC32K_ENABLE; - break; - - case SYSTEM_CLOCK_SOURCE_DFLL: - _system_clock_inst.dfll.control |= SYSCTRL_DFLLCTRL_ENABLE; - _system_clock_source_dfll_set_config_errata_9905(); - break; - -#ifdef FEATURE_SYSTEM_CLOCK_DPLL - case SYSTEM_CLOCK_SOURCE_DPLL: - SYSCTRL->DPLLCTRLA.reg |= SYSCTRL_DPLLCTRLA_ENABLE; - break; -#endif - - case SYSTEM_CLOCK_SOURCE_ULP32K: - /* Always enabled */ - return STATUS_OK; - - default: - Assert(false); - return STATUS_ERR_INVALID_ARG; - } - - return STATUS_OK; -} - -/** - * \brief Disables a clock source. - * - * Disables a clock source that was previously enabled. - * - * \param[in] clock_source Clock source to disable - * - * \retval STATUS_OK Clock source was disabled successfully - * \retval STATUS_ERR_INVALID_ARG An invalid or unavailable clock source was - * given - */ -enum status_code system_clock_source_disable( - const enum system_clock_source clock_source) -{ - switch (clock_source) { - case SYSTEM_CLOCK_SOURCE_OSC8M: - SYSCTRL->OSC8M.reg &= ~SYSCTRL_OSC8M_ENABLE; - break; - - case SYSTEM_CLOCK_SOURCE_OSC32K: - SYSCTRL->OSC32K.reg &= ~SYSCTRL_OSC32K_ENABLE; - break; - - case SYSTEM_CLOCK_SOURCE_XOSC: - SYSCTRL->XOSC.reg &= ~SYSCTRL_XOSC_ENABLE; - break; - - case SYSTEM_CLOCK_SOURCE_XOSC32K: - SYSCTRL->XOSC32K.reg &= ~SYSCTRL_XOSC32K_ENABLE; - break; - - case SYSTEM_CLOCK_SOURCE_DFLL: - _system_clock_inst.dfll.control &= ~SYSCTRL_DFLLCTRL_ENABLE; - SYSCTRL->DFLLCTRL.reg = _system_clock_inst.dfll.control; - break; - -#ifdef FEATURE_SYSTEM_CLOCK_DPLL - case SYSTEM_CLOCK_SOURCE_DPLL: - SYSCTRL->DPLLCTRLA.reg &= ~SYSCTRL_DPLLCTRLA_ENABLE; - break; -#endif - - case SYSTEM_CLOCK_SOURCE_ULP32K: - /* Not possible to disable */ - - default: - Assert(false); - return STATUS_ERR_INVALID_ARG; - - } - - return STATUS_OK; -} - -/** - * \brief Checks if a clock source is ready. - * - * Checks if a given clock source is ready to be used. - * - * \param[in] clock_source Clock source to check if ready - * - * \returns Ready state of the given clock source. - * - * \retval true Clock source is enabled and ready - * \retval false Clock source is disabled or not yet ready - */ -bool system_clock_source_is_ready( - const enum system_clock_source clock_source) -{ - uint32_t mask = 0; - - switch (clock_source) { - case SYSTEM_CLOCK_SOURCE_OSC8M: - mask = SYSCTRL_PCLKSR_OSC8MRDY; - break; - - case SYSTEM_CLOCK_SOURCE_OSC32K: - mask = SYSCTRL_PCLKSR_OSC32KRDY; - break; - - case SYSTEM_CLOCK_SOURCE_XOSC: - mask = SYSCTRL_PCLKSR_XOSCRDY; - break; - - case SYSTEM_CLOCK_SOURCE_XOSC32K: - mask = SYSCTRL_PCLKSR_XOSC32KRDY; - break; - - case SYSTEM_CLOCK_SOURCE_DFLL: - if (CONF_CLOCK_DFLL_LOOP_MODE == SYSTEM_CLOCK_DFLL_LOOP_MODE_CLOSED) { - mask = (SYSCTRL_PCLKSR_DFLLRDY | - SYSCTRL_PCLKSR_DFLLLCKF | SYSCTRL_PCLKSR_DFLLLCKC); - } else { - mask = SYSCTRL_PCLKSR_DFLLRDY; - } - break; - -#ifdef FEATURE_SYSTEM_CLOCK_DPLL - case SYSTEM_CLOCK_SOURCE_DPLL: - return ((SYSCTRL->DPLLSTATUS.reg & - (SYSCTRL_DPLLSTATUS_CLKRDY | SYSCTRL_DPLLSTATUS_LOCK)) == - (SYSCTRL_DPLLSTATUS_CLKRDY | SYSCTRL_DPLLSTATUS_LOCK)); -#endif - - case SYSTEM_CLOCK_SOURCE_ULP32K: - /* Not possible to disable */ - return true; - - default: - return false; - } - - return ((SYSCTRL->PCLKSR.reg & mask) == mask); -} - -/* Include some checks for conf_clocks.h validation */ -#include "clock_config_check.h" - -#if !defined(__DOXYGEN__) -/** \internal - * - * Configures a Generic Clock Generator with the configuration from \c conf_clocks.h. - */ -# define _CONF_CLOCK_GCLK_CONFIG(n, unused) \ - if (CONF_CLOCK_GCLK_##n##_ENABLE == true) { \ - struct system_gclk_gen_config gclk_conf; \ - system_gclk_gen_get_config_defaults(&gclk_conf); \ - gclk_conf.source_clock = CONF_CLOCK_GCLK_##n##_CLOCK_SOURCE; \ - gclk_conf.division_factor = CONF_CLOCK_GCLK_##n##_PRESCALER; \ - gclk_conf.run_in_standby = CONF_CLOCK_GCLK_##n##_RUN_IN_STANDBY; \ - gclk_conf.output_enable = CONF_CLOCK_GCLK_##n##_OUTPUT_ENABLE; \ - system_gclk_gen_set_config(GCLK_GENERATOR_##n, &gclk_conf); \ - system_gclk_gen_enable(GCLK_GENERATOR_##n); \ - } - -/** \internal - * - * Configures a Generic Clock Generator with the configuration from \c conf_clocks.h, - * provided that it is not the main Generic Clock Generator channel. - */ -# define _CONF_CLOCK_GCLK_CONFIG_NONMAIN(n, unused) \ - if (n > 0) { _CONF_CLOCK_GCLK_CONFIG(n, unused); } -#endif - -/** \internal - * - * Switch all peripheral clock to a not enabled general clock - * to save power. - */ -static void _switch_peripheral_gclk(void) -{ - uint32_t gclk_id; - struct system_gclk_chan_config gclk_conf; - -#if CONF_CLOCK_GCLK_1_ENABLE == false - gclk_conf.source_generator = GCLK_GENERATOR_1; -#elif CONF_CLOCK_GCLK_2_ENABLE == false - gclk_conf.source_generator = GCLK_GENERATOR_2; -#elif CONF_CLOCK_GCLK_3_ENABLE == false - gclk_conf.source_generator = GCLK_GENERATOR_3; -#elif CONF_CLOCK_GCLK_4_ENABLE == false - gclk_conf.source_generator = GCLK_GENERATOR_4; -#elif CONF_CLOCK_GCLK_5_ENABLE == false - gclk_conf.source_generator = GCLK_GENERATOR_5; -#elif CONF_CLOCK_GCLK_6_ENABLE == false - gclk_conf.source_generator = GCLK_GENERATOR_6; -#elif CONF_CLOCK_GCLK_7_ENABLE == false - gclk_conf.source_generator = GCLK_GENERATOR_7; -#else - gclk_conf.source_generator = GCLK_GENERATOR_7; -#endif - - for (gclk_id = 0; gclk_id < GCLK_NUM; gclk_id++) { - system_gclk_chan_set_config(gclk_id, &gclk_conf); - } -} - -/** - * \brief Initialize clock system based on the configuration in conf_clocks.h. - * - * This function will apply the settings in conf_clocks.h when run from the user - * application. All clock sources and GCLK generators are running when this function - * returns. - * - * \note OSC8M is always enabled and if user selects other clocks for GCLK generators, - * the OSC8M default enable can be disabled after system_clock_init. Make sure the - * clock switch successfully before disabling OSC8M. - */ -// Added dfll_fine_calibration as a parameter so that the user program can save -// and restore it. -void system_clock_init(uint16_t dfll_fine_calibration) -{ - /* Various bits in the INTFLAG register can be set to one at startup. - This will ensure that these bits are cleared */ - SYSCTRL->INTFLAG.reg = SYSCTRL_INTFLAG_BOD33RDY | SYSCTRL_INTFLAG_BOD33DET | - SYSCTRL_INTFLAG_DFLLRDY; - - system_flash_set_waitstates(CONF_CLOCK_FLASH_WAIT_STATES); - - /* Switch all peripheral clock to a not enabled general clock to save power. */ - _switch_peripheral_gclk(); - - /* XOSC */ -#if CONF_CLOCK_XOSC_ENABLE == true - struct system_clock_source_xosc_config xosc_conf; - system_clock_source_xosc_get_config_defaults(&xosc_conf); - - xosc_conf.external_clock = CONF_CLOCK_XOSC_EXTERNAL_CRYSTAL; - xosc_conf.startup_time = CONF_CLOCK_XOSC_STARTUP_TIME; - xosc_conf.auto_gain_control = CONF_CLOCK_XOSC_AUTO_GAIN_CONTROL; - xosc_conf.frequency = CONF_CLOCK_XOSC_EXTERNAL_FREQUENCY; - xosc_conf.on_demand = CONF_CLOCK_XOSC_ON_DEMAND; - xosc_conf.run_in_standby = CONF_CLOCK_XOSC_RUN_IN_STANDBY; - - system_clock_source_xosc_set_config(&xosc_conf); - system_clock_source_enable(SYSTEM_CLOCK_SOURCE_XOSC); -#endif - - - /* XOSC32K */ -#if CONF_CLOCK_XOSC32K_ENABLE == true - struct system_clock_source_xosc32k_config xosc32k_conf; - system_clock_source_xosc32k_get_config_defaults(&xosc32k_conf); - - xosc32k_conf.frequency = 32768UL; - xosc32k_conf.external_clock = CONF_CLOCK_XOSC32K_EXTERNAL_CRYSTAL; - xosc32k_conf.startup_time = CONF_CLOCK_XOSC32K_STARTUP_TIME; - xosc32k_conf.auto_gain_control = CONF_CLOCK_XOSC32K_AUTO_AMPLITUDE_CONTROL; - xosc32k_conf.enable_1khz_output = CONF_CLOCK_XOSC32K_ENABLE_1KHZ_OUPUT; - xosc32k_conf.enable_32khz_output = CONF_CLOCK_XOSC32K_ENABLE_32KHZ_OUTPUT; - xosc32k_conf.on_demand = false; - xosc32k_conf.run_in_standby = CONF_CLOCK_XOSC32K_RUN_IN_STANDBY; - - system_clock_source_xosc32k_set_config(&xosc32k_conf); - system_clock_source_enable(SYSTEM_CLOCK_SOURCE_XOSC32K); - while(!system_clock_source_is_ready(SYSTEM_CLOCK_SOURCE_XOSC32K)); - if (CONF_CLOCK_XOSC32K_ON_DEMAND) { - SYSCTRL->XOSC32K.bit.ONDEMAND = 1; - } -#endif - - - /* OSCK32K */ -#if CONF_CLOCK_OSC32K_ENABLE == true - SYSCTRL->OSC32K.bit.CALIB = - ((*(uint32_t *)SYSCTRL_FUSES_OSC32K_ADDR >> - SYSCTRL_FUSES_OSC32K_Pos) & 0x7Ful); - - struct system_clock_source_osc32k_config osc32k_conf; - system_clock_source_osc32k_get_config_defaults(&osc32k_conf); - - osc32k_conf.startup_time = CONF_CLOCK_OSC32K_STARTUP_TIME; - osc32k_conf.enable_1khz_output = CONF_CLOCK_OSC32K_ENABLE_1KHZ_OUTPUT; - osc32k_conf.enable_32khz_output = CONF_CLOCK_OSC32K_ENABLE_32KHZ_OUTPUT; - osc32k_conf.on_demand = CONF_CLOCK_OSC32K_ON_DEMAND; - osc32k_conf.run_in_standby = CONF_CLOCK_OSC32K_RUN_IN_STANDBY; - - system_clock_source_osc32k_set_config(&osc32k_conf); - system_clock_source_enable(SYSTEM_CLOCK_SOURCE_OSC32K); -#endif - - - /* DFLL Config (Open and Closed Loop) */ -#if CONF_CLOCK_DFLL_ENABLE == true - struct system_clock_source_dfll_config dfll_conf; - system_clock_source_dfll_get_config_defaults(&dfll_conf); - - dfll_conf.loop_mode = CONF_CLOCK_DFLL_LOOP_MODE; - dfll_conf.on_demand = false; - - /* Using DFLL48M COARSE CAL value from NVM Software Calibration Area Mapping - in DFLL.COARSE helps to output a frequency close to 48 MHz.*/ -#define NVM_DFLL_COARSE_POS 58 /* DFLL48M Coarse calibration value bit position.*/ -#define NVM_DFLL_COARSE_SIZE 6 /* DFLL48M Coarse calibration value bit size.*/ - - uint32_t coarse =( *((uint32_t *)(NVMCTRL_OTP4) - + (NVM_DFLL_COARSE_POS / 32)) - >> (NVM_DFLL_COARSE_POS % 32)) - & ((1 << NVM_DFLL_COARSE_SIZE) - 1); - /* In some revision chip, the coarse calibration value is not correct. */ - if (coarse == 0x3f) { - coarse = 0x1f; - } - dfll_conf.coarse_value = coarse; - - if (CONF_CLOCK_DFLL_LOOP_MODE == SYSTEM_CLOCK_DFLL_LOOP_MODE_OPEN) { - dfll_conf.fine_value = CONF_CLOCK_DFLL_FINE_VALUE; - } - -# if CONF_CLOCK_DFLL_QUICK_LOCK == true - dfll_conf.quick_lock = SYSTEM_CLOCK_DFLL_QUICK_LOCK_ENABLE; -# else - dfll_conf.quick_lock = SYSTEM_CLOCK_DFLL_QUICK_LOCK_DISABLE; -# endif - -# if CONF_CLOCK_DFLL_TRACK_AFTER_FINE_LOCK == true - dfll_conf.stable_tracking = SYSTEM_CLOCK_DFLL_STABLE_TRACKING_TRACK_AFTER_LOCK; -# else - dfll_conf.stable_tracking = SYSTEM_CLOCK_DFLL_STABLE_TRACKING_FIX_AFTER_LOCK; -# endif - -# if CONF_CLOCK_DFLL_KEEP_LOCK_ON_WAKEUP == true - dfll_conf.wakeup_lock = SYSTEM_CLOCK_DFLL_WAKEUP_LOCK_KEEP; -# else - dfll_conf.wakeup_lock = SYSTEM_CLOCK_DFLL_WAKEUP_LOCK_LOSE; -# endif - -# if CONF_CLOCK_DFLL_ENABLE_CHILL_CYCLE == true - dfll_conf.chill_cycle = SYSTEM_CLOCK_DFLL_CHILL_CYCLE_ENABLE; -# else - dfll_conf.chill_cycle = SYSTEM_CLOCK_DFLL_CHILL_CYCLE_DISABLE; -# endif - - if (CONF_CLOCK_DFLL_LOOP_MODE == SYSTEM_CLOCK_DFLL_LOOP_MODE_CLOSED) { - dfll_conf.multiply_factor = CONF_CLOCK_DFLL_MULTIPLY_FACTOR; - } - - dfll_conf.coarse_max_step = CONF_CLOCK_DFLL_MAX_COARSE_STEP_SIZE; - dfll_conf.fine_max_step = CONF_CLOCK_DFLL_MAX_FINE_STEP_SIZE; - - if (CONF_CLOCK_DFLL_LOOP_MODE == SYSTEM_CLOCK_DFLL_LOOP_MODE_USB_RECOVERY) { - dfll_conf.fine_max_step = 10; - dfll_conf.fine_value = dfll_fine_calibration; - dfll_conf.quick_lock = SYSTEM_CLOCK_DFLL_QUICK_LOCK_ENABLE; - dfll_conf.stable_tracking = SYSTEM_CLOCK_DFLL_STABLE_TRACKING_TRACK_AFTER_LOCK; - dfll_conf.wakeup_lock = SYSTEM_CLOCK_DFLL_WAKEUP_LOCK_KEEP; - dfll_conf.chill_cycle = SYSTEM_CLOCK_DFLL_CHILL_CYCLE_DISABLE; - - dfll_conf.multiply_factor = 48000; - } - - system_clock_source_dfll_set_config(&dfll_conf); -#endif - - - /* OSC8M */ - struct system_clock_source_osc8m_config osc8m_conf; - system_clock_source_osc8m_get_config_defaults(&osc8m_conf); - - osc8m_conf.prescaler = CONF_CLOCK_OSC8M_PRESCALER; - osc8m_conf.on_demand = CONF_CLOCK_OSC8M_ON_DEMAND; - osc8m_conf.run_in_standby = CONF_CLOCK_OSC8M_RUN_IN_STANDBY; - - system_clock_source_osc8m_set_config(&osc8m_conf); - system_clock_source_enable(SYSTEM_CLOCK_SOURCE_OSC8M); - - - /* GCLK */ -#if CONF_CLOCK_CONFIGURE_GCLK == true - system_gclk_init(); - - /* Configure all GCLK generators except for the main generator, which - * is configured later after all other clock systems are set up */ - MREPEAT(GCLK_GEN_NUM, _CONF_CLOCK_GCLK_CONFIG_NONMAIN, ~); - -# if CONF_CLOCK_DFLL_ENABLE == true - /* Enable DFLL reference clock if in closed loop mode */ - if (CONF_CLOCK_DFLL_LOOP_MODE == SYSTEM_CLOCK_DFLL_LOOP_MODE_CLOSED) { - struct system_gclk_chan_config dfll_gclk_chan_conf; - - system_gclk_chan_get_config_defaults(&dfll_gclk_chan_conf); - dfll_gclk_chan_conf.source_generator = CONF_CLOCK_DFLL_SOURCE_GCLK_GENERATOR; - system_gclk_chan_set_config(SYSCTRL_GCLK_ID_DFLL48, &dfll_gclk_chan_conf); - system_gclk_chan_enable(SYSCTRL_GCLK_ID_DFLL48); - } -# endif - -# if CONF_CLOCK_DPLL_ENABLE == true - /* Enable DPLL internal lock timer and reference clock */ - struct system_gclk_chan_config dpll_gclk_chan_conf; - system_gclk_chan_get_config_defaults(&dpll_gclk_chan_conf); - if (CONF_CLOCK_DPLL_LOCK_TIME != SYSTEM_CLOCK_SOURCE_DPLL_LOCK_TIME_DEFAULT) { - dpll_gclk_chan_conf.source_generator = CONF_CLOCK_DPLL_LOCK_GCLK_GENERATOR; - system_gclk_chan_set_config(SYSCTRL_GCLK_ID_FDPLL32K, &dpll_gclk_chan_conf); - system_gclk_chan_enable(SYSCTRL_GCLK_ID_FDPLL32K); - } - - if (CONF_CLOCK_DPLL_REFERENCE_CLOCK == SYSTEM_CLOCK_SOURCE_DPLL_REFERENCE_CLOCK_GCLK) { - dpll_gclk_chan_conf.source_generator = CONF_CLOCK_DPLL_REFERENCE_GCLK_GENERATOR; - system_gclk_chan_set_config(SYSCTRL_GCLK_ID_FDPLL, &dpll_gclk_chan_conf); - system_gclk_chan_enable(SYSCTRL_GCLK_ID_FDPLL); - } -# endif -#endif - - - /* DFLL Enable (Open and Closed Loop) */ -#if CONF_CLOCK_DFLL_ENABLE == true - system_clock_source_enable(SYSTEM_CLOCK_SOURCE_DFLL); - while(!system_clock_source_is_ready(SYSTEM_CLOCK_SOURCE_DFLL)); - if (CONF_CLOCK_DFLL_ON_DEMAND) { - SYSCTRL->DFLLCTRL.bit.ONDEMAND = 1; - } -#endif - - /* DPLL */ -#ifdef FEATURE_SYSTEM_CLOCK_DPLL -# if (CONF_CLOCK_DPLL_ENABLE == true) - - /* Enable DPLL reference clock */ - if (CONF_CLOCK_DPLL_REFERENCE_CLOCK == SYSTEM_CLOCK_SOURCE_DPLL_REFERENCE_CLOCK_XOSC32K) { - /* XOSC32K should have been enabled for DPLL_REF0 */ - Assert(CONF_CLOCK_XOSC32K_ENABLE); - } else if (CONF_CLOCK_DPLL_REFERENCE_CLOCK == SYSTEM_CLOCK_SOURCE_DPLL_REFERENCE_CLOCK_XOSC) { - /* XOSC should have been enabled for DPLL_REF1 */ - Assert(CONF_CLOCK_XOSC_ENABLE); - } - else if (CONF_CLOCK_DPLL_REFERENCE_CLOCK == SYSTEM_CLOCK_SOURCE_DPLL_REFERENCE_CLOCK_GCLK) { - /* GCLK should have been enabled */ - Assert(CONF_CLOCK_CONFIGURE_GCLK); - } - else { - Assert(false); - } - - struct system_clock_source_dpll_config dpll_config; - system_clock_source_dpll_get_config_defaults(&dpll_config); - - dpll_config.on_demand = false; - dpll_config.run_in_standby = CONF_CLOCK_DPLL_RUN_IN_STANDBY; - dpll_config.lock_bypass = CONF_CLOCK_DPLL_LOCK_BYPASS; - dpll_config.wake_up_fast = CONF_CLOCK_DPLL_WAKE_UP_FAST; - dpll_config.low_power_enable = CONF_CLOCK_DPLL_LOW_POWER_ENABLE; - - dpll_config.filter = CONF_CLOCK_DPLL_FILTER; - dpll_config.lock_time = CONF_CLOCK_DPLL_LOCK_TIME; - - dpll_config.reference_clock = CONF_CLOCK_DPLL_REFERENCE_CLOCK; - dpll_config.reference_frequency = CONF_CLOCK_DPLL_REFERENCE_FREQUENCY; - dpll_config.reference_divider = CONF_CLOCK_DPLL_REFERENCE_DIVIDER; - dpll_config.output_frequency = CONF_CLOCK_DPLL_OUTPUT_FREQUENCY; - - system_clock_source_dpll_set_config(&dpll_config); - system_clock_source_enable(SYSTEM_CLOCK_SOURCE_DPLL); - while(!system_clock_source_is_ready(SYSTEM_CLOCK_SOURCE_DPLL)); - if (CONF_CLOCK_DPLL_ON_DEMAND) { - SYSCTRL->DPLLCTRLA.bit.ONDEMAND = 1; - } - -# endif -#endif - - /* CPU and BUS clocks */ - system_cpu_clock_set_divider(CONF_CLOCK_CPU_DIVIDER); - - system_apb_clock_set_divider(SYSTEM_CLOCK_APB_APBA, CONF_CLOCK_APBA_DIVIDER); - system_apb_clock_set_divider(SYSTEM_CLOCK_APB_APBB, CONF_CLOCK_APBB_DIVIDER); - system_apb_clock_set_divider(SYSTEM_CLOCK_APB_APBC, CONF_CLOCK_APBC_DIVIDER); - - /* GCLK 0 */ -#if CONF_CLOCK_CONFIGURE_GCLK == true - /* Configure the main GCLK last as it might depend on other generators */ - _CONF_CLOCK_GCLK_CONFIG(0, ~); -#endif -} diff --git a/atmel-samd/asf/sam0/drivers/system/clock/clock_samd21_r21_da/clock_config_check.h b/atmel-samd/asf/sam0/drivers/system/clock/clock_samd21_r21_da/clock_config_check.h deleted file mode 100644 index fd4757e28..000000000 --- a/atmel-samd/asf/sam0/drivers/system/clock/clock_samd21_r21_da/clock_config_check.h +++ /dev/null @@ -1,454 +0,0 @@ -/** - * \file - * - * \brief SAM D21/R21/DA0/DA1 Clock Driver - * - * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef CLOCK_CONFIG_CHECK_H -# define CLOCK_CONFIG_CHECK_H - -#if !defined(CONF_CLOCK_FLASH_WAIT_STATES) -# error CONF_CLOCK_FLASH_WAIT_STATES not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_CPU_DIVIDER) -# error CONF_CLOCK_CPU_DIVIDER not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_APBA_DIVIDER) -# error CONF_CLOCK_APBA_DIVIDER not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_APBB_DIVIDER) -# error CONF_CLOCK_APBB_DIVIDER not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_APBC_DIVIDER) -# error CONF_CLOCK_APBC_DIVIDER not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_OSC8M_PRESCALER) -# error CONF_CLOCK_OSC8M_PRESCALER not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_OSC8M_ON_DEMAND) -# error CONF_CLOCK_OSC8M_ON_DEMAND not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_OSC8M_RUN_IN_STANDBY) -# error CONF_CLOCK_OSC8M_RUN_IN_STANDBY not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_XOSC_ENABLE) -# error CONF_CLOCK_XOSC_ENABLE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_XOSC_EXTERNAL_CRYSTAL) -# error CONF_CLOCK_XOSC_EXTERNAL_CRYSTAL not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_XOSC_EXTERNAL_FREQUENCY) -# error CONF_CLOCK_XOSC_EXTERNAL_FREQUENCY not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_XOSC_STARTUP_TIME) -# error CONF_CLOCK_XOSC_STARTUP_TIME not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_XOSC_AUTO_GAIN_CONTROL) -# error CONF_CLOCK_XOSC_AUTO_GAIN_CONTROL not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_XOSC_ON_DEMAND) -# error CONF_CLOCK_XOSC_ON_DEMAND not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_XOSC_RUN_IN_STANDBY) -# error CONF_CLOCK_XOSC_RUN_IN_STANDBY not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_XOSC32K_ENABLE) -# error CONF_CLOCK_XOSC32K_ENABLE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_XOSC32K_EXTERNAL_CRYSTAL) -# error CONF_CLOCK_XOSC32K_EXTERNAL_CRYSTAL not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_XOSC32K_STARTUP_TIME) -# error CONF_CLOCK_XOSC32K_STARTUP_TIME not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_XOSC32K_AUTO_AMPLITUDE_CONTROL) -# error CONF_CLOCK_XOSC32K_AUTO_AMPLITUDE_CONTROL not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_XOSC32K_ENABLE_1KHZ_OUPUT) -# error CONF_CLOCK_XOSC32K_ENABLE_1KHZ_OUPUT not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_XOSC32K_ENABLE_32KHZ_OUTPUT) -# error CONF_CLOCK_XOSC32K_ENABLE_32KHZ_OUTPUT not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_XOSC32K_ON_DEMAND) -# error CONF_CLOCK_XOSC32K_ON_DEMAND not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_XOSC32K_RUN_IN_STANDBY) -# error CONF_CLOCK_XOSC32K_RUN_IN_STANDBY not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_OSC32K_ENABLE) -# error CONF_CLOCK_OSC32K_ENABLE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_OSC32K_STARTUP_TIME) -# error CONF_CLOCK_OSC32K_STARTUP_TIME not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_OSC32K_ENABLE_1KHZ_OUTPUT) -# error CONF_CLOCK_OSC32K_ENABLE_1KHZ_OUTPUT not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_OSC32K_ENABLE_32KHZ_OUTPUT) -# error CONF_CLOCK_OSC32K_ENABLE_32KHZ_OUTPUT not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_OSC32K_ON_DEMAND) -# error CONF_CLOCK_OSC32K_ON_DEMAND not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_OSC32K_RUN_IN_STANDBY) -# error CONF_CLOCK_OSC32K_RUN_IN_STANDBY not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_DFLL_ENABLE) -# error CONF_CLOCK_DFLL_ENABLE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_DFLL_LOOP_MODE) -# error CONF_CLOCK_DFLL_LOOP_MODE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_DFLL_ON_DEMAND) -# error CONF_CLOCK_DFLL_ON_DEMAND not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_DFLL_FINE_VALUE) -# error CONF_CLOCK_DFLL_FINE_VALUE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_DFLL_SOURCE_GCLK_GENERATOR) -# error CONF_CLOCK_DFLL_SOURCE_GCLK_GENERATOR not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_DFLL_MULTIPLY_FACTOR) -# error CONF_CLOCK_DFLL_MULTIPLY_FACTOR not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_DFLL_QUICK_LOCK) -# error CONF_CLOCK_DFLL_QUICK_LOCK not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_DFLL_TRACK_AFTER_FINE_LOCK) -# error CONF_CLOCK_DFLL_TRACK_AFTER_FINE_LOCK not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_DFLL_KEEP_LOCK_ON_WAKEUP) -# error CONF_CLOCK_DFLL_KEEP_LOCK_ON_WAKEUP not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_DFLL_ENABLE_CHILL_CYCLE) -# error CONF_CLOCK_DFLL_ENABLE_CHILL_CYCLE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_DFLL_MAX_COARSE_STEP_SIZE) -# error CONF_CLOCK_DFLL_MAX_COARSE_STEP_SIZE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_DFLL_MAX_FINE_STEP_SIZE) -# error CONF_CLOCK_DFLL_MAX_FINE_STEP_SIZE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_DPLL_ENABLE) -# error CONF_CLOCK_DPLL_ENABLE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_DPLL_ON_DEMAND) -# error CONF_CLOCK_DPLL_ON_DEMAND not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_DPLL_RUN_IN_STANDBY) -# error CONF_CLOCK_DPLL_RUN_IN_STANDBY not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_DPLL_LOCK_BYPASS) -# error CONF_CLOCK_DPLL_LOCK_BYPASS not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_DPLL_WAKE_UP_FAST) -# error CONF_CLOCK_DPLL_WAKE_UP_FAST not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_DPLL_LOW_POWER_ENABLE) -# error CONF_CLOCK_DPLL_LOW_POWER_ENABLE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_DPLL_LOCK_TIME) -# error CONF_CLOCK_DPLL_LOCK_TIME not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_DPLL_REFERENCE_CLOCK) -# error CONF_CLOCK_DPLL_REFERENCE_CLOCK not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_DPLL_FILTER) -# error CONF_CLOCK_DPLL_FILTER not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_DPLL_REFERENCE_FREQUENCY) -# error CONF_CLOCK_DPLL_REFERENCE_FREQUENCY not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_DPLL_REFERENCE_DIVIDER) -# error CONF_CLOCK_DPLL_REFERENCE_DIVIDER not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_DPLL_OUTPUT_FREQUENCY) -# error CONF_CLOCK_DPLL_OUTPUT_FREQUENCY not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_DPLL_REFERENCE_GCLK_GENERATOR) -# error CONF_CLOCK_DPLL_REFERENCE_GCLK_GENERATOR not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_DPLL_LOCK_GCLK_GENERATOR) -# error CONF_CLOCK_DPLL_LOCK_GCLK_GENERATOR not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_CONFIGURE_GCLK) -# error CONF_CLOCK_CONFIGURE_GCLK not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_0_ENABLE) -# error CONF_CLOCK_GCLK_0_ENABLE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_0_RUN_IN_STANDBY) -# error CONF_CLOCK_GCLK_0_RUN_IN_STANDBY not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_0_CLOCK_SOURCE) -# error CONF_CLOCK_GCLK_0_CLOCK_SOURCE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_0_PRESCALER) -# error CONF_CLOCK_GCLK_0_PRESCALER not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_0_OUTPUT_ENABLE) -# error CONF_CLOCK_GCLK_0_OUTPUT_ENABLE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_1_ENABLE) -# error CONF_CLOCK_GCLK_1_ENABLE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_1_RUN_IN_STANDBY) -# error CONF_CLOCK_GCLK_1_RUN_IN_STANDBY not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_1_CLOCK_SOURCE) -# error CONF_CLOCK_GCLK_1_CLOCK_SOURCE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_1_PRESCALER) -# error CONF_CLOCK_GCLK_1_PRESCALER not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_1_OUTPUT_ENABLE) -# error CONF_CLOCK_GCLK_1_OUTPUT_ENABLE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_2_ENABLE) -# error CONF_CLOCK_GCLK_2_ENABLE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_2_RUN_IN_STANDBY) -# error CONF_CLOCK_GCLK_2_RUN_IN_STANDBY not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_2_CLOCK_SOURCE) -# error CONF_CLOCK_GCLK_2_CLOCK_SOURCE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_2_PRESCALER) -# error CONF_CLOCK_GCLK_2_PRESCALER not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_2_OUTPUT_ENABLE) -# error CONF_CLOCK_GCLK_2_OUTPUT_ENABLE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_3_ENABLE) -# error CONF_CLOCK_GCLK_3_ENABLE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_3_RUN_IN_STANDBY) -# error CONF_CLOCK_GCLK_3_RUN_IN_STANDBY not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_3_CLOCK_SOURCE) -# error CONF_CLOCK_GCLK_3_CLOCK_SOURCE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_3_PRESCALER) -# error CONF_CLOCK_GCLK_3_PRESCALER not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_3_OUTPUT_ENABLE) -# error CONF_CLOCK_GCLK_3_OUTPUT_ENABLE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_4_ENABLE) -# error CONF_CLOCK_GCLK_4_ENABLE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_4_RUN_IN_STANDBY) -# error CONF_CLOCK_GCLK_4_RUN_IN_STANDBY not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_4_CLOCK_SOURCE) -# error CONF_CLOCK_GCLK_4_CLOCK_SOURCE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_4_PRESCALER) -# error CONF_CLOCK_GCLK_4_PRESCALER not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_4_OUTPUT_ENABLE) -# error CONF_CLOCK_GCLK_4_OUTPUT_ENABLE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_5_ENABLE) -# error CONF_CLOCK_GCLK_5_ENABLE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_5_RUN_IN_STANDBY) -# error CONF_CLOCK_GCLK_5_RUN_IN_STANDBY not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_5_CLOCK_SOURCE) -# error CONF_CLOCK_GCLK_5_CLOCK_SOURCE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_5_PRESCALER) -# error CONF_CLOCK_GCLK_5_PRESCALER not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_5_OUTPUT_ENABLE) -# error CONF_CLOCK_GCLK_5_OUTPUT_ENABLE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_6_ENABLE) -# error CONF_CLOCK_GCLK_6_ENABLE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_6_RUN_IN_STANDBY) -# error CONF_CLOCK_GCLK_6_RUN_IN_STANDBY not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_6_CLOCK_SOURCE) -# error CONF_CLOCK_GCLK_6_CLOCK_SOURCE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_6_PRESCALER) -# error CONF_CLOCK_GCLK_6_PRESCALER not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_6_OUTPUT_ENABLE) -# error CONF_CLOCK_GCLK_6_OUTPUT_ENABLE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_7_ENABLE) -# error CONF_CLOCK_GCLK_7_ENABLE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_7_RUN_IN_STANDBY) -# error CONF_CLOCK_GCLK_7_RUN_IN_STANDBY not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_7_CLOCK_SOURCE) -# error CONF_CLOCK_GCLK_7_CLOCK_SOURCE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_7_PRESCALER) -# error CONF_CLOCK_GCLK_7_PRESCALER not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_7_OUTPUT_ENABLE) -# error CONF_CLOCK_GCLK_7_OUTPUT_ENABLE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_8_ENABLE) -# error CONF_CLOCK_GCLK_8_ENABLE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_8_RUN_IN_STANDBY) -# error CONF_CLOCK_GCLK_8_RUN_IN_STANDBY not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_8_CLOCK_SOURCE) -# error CONF_CLOCK_GCLK_8_CLOCK_SOURCE not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_8_PRESCALER) -# error CONF_CLOCK_GCLK_8_PRESCALER not defined in conf_clocks.h -#endif - -#if !defined(CONF_CLOCK_GCLK_8_OUTPUT_ENABLE) -# error CONF_CLOCK_GCLK_8_OUTPUT_ENABLE not defined in conf_clocks.h -#endif - -#endif /* CLOCK_CONFIG_CHECK_H */ diff --git a/atmel-samd/asf/sam0/drivers/system/clock/clock_samd21_r21_da/clock_feature.h b/atmel-samd/asf/sam0/drivers/system/clock/clock_samd21_r21_da/clock_feature.h deleted file mode 100644 index ee8890a31..000000000 --- a/atmel-samd/asf/sam0/drivers/system/clock/clock_samd21_r21_da/clock_feature.h +++ /dev/null @@ -1,1492 +0,0 @@ -/** - * \file - * - * \brief SAM Clock Driver - * - * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef SYSTEM_CLOCK_FEATURE_H_INCLUDED -#define SYSTEM_CLOCK_FEATURE_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \defgroup asfdoc_sam0_system_clock_group SAM System Clock Management (SYSTEM CLOCK) Driver - * - * This driver for Atmel® | SMART ARM®-based microcontrollers provides an interface for the configuration - * and management of the device's clocking related functions. This includes - * the various clock sources, bus clocks, and generic clocks within the device, - * with functions to manage the enabling, disabling, source selection, and - * prescaling of clocks to various internal peripherals. - * - * The following peripherals are used by this module: - * - * - GCLK (Generic Clock Management) - * - PM (Power Management) - * - SYSCTRL (Clock Source Control) - * - * The following devices can use this module: - * - Atmel | SMART SAM D20/D21 - * - Atmel | SMART SAM R21 - * - Atmel | SMART SAM D09/D10/D11 - * - Atmel | SMART SAM DA1 - * - * The outline of this documentation is as follows: - * - \ref asfdoc_sam0_system_clock_prerequisites - * - \ref asfdoc_sam0_system_clock_module_overview - * - \ref asfdoc_sam0_system_clock_special_considerations - * - \ref asfdoc_sam0_system_clock_extra_info - * - \ref asfdoc_sam0_system_clock_examples - * - \ref asfdoc_sam0_system_clock_api_overview - * - * - * \section asfdoc_sam0_system_clock_prerequisites Prerequisites - * - * There are no prerequisites for this module. - * - * - * \section asfdoc_sam0_system_clock_module_overview Module Overview - * The SAM devices contain a sophisticated clocking system, which is designed - * to give the maximum flexibility to the user application. This system allows - * a system designer to tune the performance and power consumption of the device - * in a dynamic manner, to achieve the best trade-off between the two for a - * particular application. - * - * This driver provides a set of functions for the configuration and management - * of the various clock related functionality within the device. - * - * \subsection asfdoc_sam0_system_clock_module_features Driver Feature Macro Definition - * <table> - * <tr> - * <th>Driver Feature Macro</th> - * <th>Supported devices</th> - * </tr> - * <tr> - * <td>FEATURE_SYSTEM_CLOCK_DPLL</td> - * <td>SAM D21, SAM R21, SAM D10, SAM D11, SAM DA1</td> - * </tr> - * </table> - * \note The specific features are only available in the driver when the - * selected device supports those features. - * - * \subsection asfdoc_sam0_system_clock_module_overview_clock_sources Clock Sources - * The SAM devices have a number of master clock source modules, each of - * which being capable of producing a stabilized output frequency, which can then - * be fed into the various peripherals and modules within the device. - * - * Possible clock source modules include internal R/C oscillators, internal - * DFLL modules, as well as external crystal oscillators and/or clock inputs. - * - * \subsection asfdoc_sam0_system_clock_module_overview_cpu_clock CPU / Bus Clocks - * The CPU and AHB/APBx buses are clocked by the same physical clock source - * (referred in this module as the Main Clock), however the APBx buses may - * have additional prescaler division ratios set to give each peripheral bus a - * different clock speed. - * - * The general main clock tree for the CPU and associated buses is shown in - * \ref asfdoc_sam0_system_clock_module_clock_tree "the figure below". - * - * \anchor asfdoc_sam0_system_clock_module_clock_tree - * \dot - * digraph overview { - * rankdir=LR; - * clk_src [label="Clock Sources", shape=none, height=0]; - * node [label="CPU Bus" shape=ellipse] cpu_bus; - * node [label="AHB Bus" shape=ellipse] ahb_bus; - * node [label="APBA Bus" shape=ellipse] apb_a_bus; - * node [label="APBB Bus" shape=ellipse] apb_b_bus; - * node [label="APBC Bus" shape=ellipse] apb_c_bus; - * node [label="Main Bus\nPrescaler" shape=square] main_prescaler; - * node [label="APBA Bus\nPrescaler" shape=square] apb_a_prescaler; - * node [label="APBB Bus\nPrescaler" shape=square] apb_b_prescaler; - * node [label="APBC Bus\nPrescaler" shape=square] apb_c_prescaler; - * node [label="", shape=polygon, sides=4, distortion=0.6, orientation=90, style=filled, fillcolor=black, height=0.9, width=0.2] main_clock_mux; - * - * clk_src -> main_clock_mux; - * main_clock_mux -> main_prescaler; - * main_prescaler -> cpu_bus; - * main_prescaler -> ahb_bus; - * main_prescaler -> apb_a_prescaler; - * main_prescaler -> apb_b_prescaler; - * main_prescaler -> apb_c_prescaler; - * apb_a_prescaler -> apb_a_bus; - * apb_b_prescaler -> apb_b_bus; - * apb_c_prescaler -> apb_c_bus; - * } - * \enddot - * - * \subsection asfdoc_sam0_system_clock_module_overview_clock_masking Clock Masking - * To save power, the input clock to one or more peripherals on the AHB and APBx - * buses can be masked away - when masked, no clock is passed into the module. - * Disabling of clocks of unused modules will prevent all access to the masked - * module, but will reduce the overall device power consumption. - * - * \subsection asfdoc_sam0_system_clock_module_overview_gclk Generic Clocks - * Within the SAM devices there are a number of Generic Clocks; these are used to - * provide clocks to the various peripheral clock domains in the device in a - * standardized manner. One or more master source clocks can be selected as the - * input clock to a Generic Clock Generator, which can prescale down the input - * frequency to a slower rate for use in a peripheral. - * - * Additionally, a number of individually selectable Generic Clock Channels are - * provided, which multiplex and gate the various generator outputs for one or - * more peripherals within the device. This setup allows for a single common - * generator to feed one or more channels, which can then be enabled or disabled - * individually as required. - * - * \anchor asfdoc_sam0_system_clock_module_chain_overview - * \dot - * digraph overview { - * rankdir=LR; - * node [label="Clock\nSource a" shape=square] system_clock_source; - * node [label="Generator 1" shape=square] clock_gen; - * node [label="Channel x" shape=square] clock_chan0; - * node [label="Channel y" shape=square] clock_chan1; - * node [label="Peripheral x" shape=ellipse style=filled fillcolor=lightgray] peripheral0; - * node [label="Peripheral y" shape=ellipse style=filled fillcolor=lightgray] peripheral1; - * - * system_clock_source -> clock_gen; - * clock_gen -> clock_chan0; - * clock_chan0 -> peripheral0; - * clock_gen -> clock_chan1; - * clock_chan1 -> peripheral1; - * } - * \enddot - * - * \subsubsection asfdoc_sam0_system_clock_module_chain_example Clock Chain Example - * An example setup of a complete clock chain within the device is shown in - * \ref asfdoc_sam0_system_clock_module_chain_example_fig "the figure below". - * - * \anchor asfdoc_sam0_system_clock_module_chain_example_fig - * \dot - * digraph overview { - * rankdir=LR; - * node [label="External\nOscillator" shape=square] system_clock_source0; - * node [label="Generator 0" shape=square] clock_gen0; - * node [label="Channel x" shape=square] clock_chan0; - * node [label="Core CPU" shape=ellipse style=filled fillcolor=lightgray] peripheral0; - * - * system_clock_source0 -> clock_gen0; - * clock_gen0 -> clock_chan0; - * clock_chan0 -> peripheral0; - * node [label="8MHz R/C\nOscillator (OSC8M)" shape=square fillcolor=white] system_clock_source1; - * node [label="Generator 1" shape=square] clock_gen1; - * node [label="Channel y" shape=square] clock_chan1; - * node [label="Channel z" shape=square] clock_chan2; - * node [label="SERCOM\nModule" shape=ellipse style=filled fillcolor=lightgray] peripheral1; - * node [label="Timer\nModule" shape=ellipse style=filled fillcolor=lightgray] peripheral2; - * - * system_clock_source1 -> clock_gen1; - * clock_gen1 -> clock_chan1; - * clock_gen1 -> clock_chan2; - * clock_chan1 -> peripheral1; - * clock_chan2 -> peripheral2; - * } - * \enddot - * - * \subsubsection asfdoc_sam0_system_clock_module_overview_gclk_generators Generic Clock Generators - * Each Generic Clock generator within the device can source its input clock - * from one of the provided Source Clocks, and prescale the output for one or - * more Generic Clock Channels in a one-to-many relationship. The generators - * thus allow for several clocks to be generated of different frequencies, - * power usages, and accuracies, which can be turned on and off individually to - * disable the clocks to multiple peripherals as a group. - * - * \subsubsection asfdoc_sam0_system_clock_module_overview_gclk_channels Generic Clock Channels - * To connect a Generic Clock Generator to a peripheral within the - * device, a Generic Clock Channel is used. Each peripheral or - * peripheral group has an associated Generic Clock Channel, which serves as the - * clock input for the peripheral(s). To supply a clock to the peripheral - * module(s), the associated channel must be connected to a running Generic - * Clock Generator and the channel enabled. - * - * \section asfdoc_sam0_system_clock_special_considerations Special Considerations - * - * There are no special considerations for this module. - * - * - * \section asfdoc_sam0_system_clock_extra_info Extra Information - * - * For extra information, see \ref asfdoc_sam0_system_clock_extra. This includes: - * - \ref asfdoc_sam0_system_clock_extra_acronyms - * - \ref asfdoc_sam0_system_clock_extra_dependencies - * - \ref asfdoc_sam0_system_clock_extra_errata - * - \ref asfdoc_sam0_system_clock_extra_history - * - * - * \section asfdoc_sam0_system_clock_examples Examples - * - * For a list of examples related to this driver, see - * \ref asfdoc_sam0_system_clock_exqsg. - * - * - * \section asfdoc_sam0_system_clock_api_overview API Overview - * @{ - */ - -#include <compiler.h> -#include <gclk.h> - -/** - * \name Driver Feature Definition - * Define system clock features set according to different device family. - * @{ - */ -#if (SAMD21) || (SAMR21) || (SAMD11) || (SAMD10) || (SAMDA1) || defined(__DOXYGEN__) -/** Digital Phase Locked Loop (DPLL) feature support. */ -# define FEATURE_SYSTEM_CLOCK_DPLL -#endif -/*@}*/ - -/** - * \brief Available start-up times for the XOSC32K. - * - * Available external 32KHz oscillator start-up times, as a number of external - * clock cycles. - */ -enum system_xosc32k_startup { - /** Wait zero clock cycles until the clock source is considered stable */ - SYSTEM_XOSC32K_STARTUP_0, - /** Wait 32 clock cycles until the clock source is considered stable */ - SYSTEM_XOSC32K_STARTUP_32, - /** Wait 2048 clock cycles until the clock source is considered stable */ - SYSTEM_XOSC32K_STARTUP_2048, - /** Wait 4096 clock cycles until the clock source is considered stable */ - SYSTEM_XOSC32K_STARTUP_4096, - /** Wait 16384 clock cycles until the clock source is considered stable */ - SYSTEM_XOSC32K_STARTUP_16384, - /** Wait 32768 clock cycles until the clock source is considered stable */ - SYSTEM_XOSC32K_STARTUP_32768, - /** Wait 65536 clock cycles until the clock source is considered stable */ - SYSTEM_XOSC32K_STARTUP_65536, - /** Wait 131072 clock cycles until the clock source is considered stable */ - SYSTEM_XOSC32K_STARTUP_131072, -}; - -/** - * \brief Available start-up times for the XOSC. - * - * Available external oscillator start-up times, as a number of external clock - * cycles. - */ -enum system_xosc_startup { - /** Wait one clock cycles until the clock source is considered stable */ - SYSTEM_XOSC_STARTUP_1, - /** Wait two clock cycles until the clock source is considered stable */ - SYSTEM_XOSC_STARTUP_2, - /** Wait four clock cycles until the clock source is considered stable */ - SYSTEM_XOSC_STARTUP_4, - /** Wait eight clock cycles until the clock source is considered stable */ - SYSTEM_XOSC_STARTUP_8, - /** Wait 16 clock cycles until the clock source is considered stable */ - SYSTEM_XOSC_STARTUP_16, - /** Wait 32 clock cycles until the clock source is considered stable */ - SYSTEM_XOSC_STARTUP_32, - /** Wait 64 clock cycles until the clock source is considered stable */ - SYSTEM_XOSC_STARTUP_64, - /** Wait 128 clock cycles until the clock source is considered stable */ - SYSTEM_XOSC_STARTUP_128, - /** Wait 256 clock cycles until the clock source is considered stable */ - SYSTEM_XOSC_STARTUP_256, - /** Wait 512 clock cycles until the clock source is considered stable */ - SYSTEM_XOSC_STARTUP_512, - /** Wait 1024 clock cycles until the clock source is considered stable */ - SYSTEM_XOSC_STARTUP_1024, - /** Wait 2048 clock cycles until the clock source is considered stable */ - SYSTEM_XOSC_STARTUP_2048, - /** Wait 4096 clock cycles until the clock source is considered stable */ - SYSTEM_XOSC_STARTUP_4096, - /** Wait 8192 clock cycles until the clock source is considered stable */ - SYSTEM_XOSC_STARTUP_8192, - /** Wait 16384 clock cycles until the clock source is considered stable */ - SYSTEM_XOSC_STARTUP_16384, - /** Wait 32768 clock cycles until the clock source is considered stable */ - SYSTEM_XOSC_STARTUP_32768, -}; - -/** - * \brief Available start-up times for the OSC32K. - * - * Available internal 32KHz oscillator start-up times, as a number of internal - * OSC32K clock cycles. - */ -enum system_osc32k_startup { - /** Wait three clock cycles until the clock source is considered stable */ - SYSTEM_OSC32K_STARTUP_3, - /** Wait four clock cycles until the clock source is considered stable */ - SYSTEM_OSC32K_STARTUP_4, - /** Wait six clock cycles until the clock source is considered stable */ - SYSTEM_OSC32K_STARTUP_6, - /** Wait ten clock cycles until the clock source is considered stable */ - SYSTEM_OSC32K_STARTUP_10, - /** Wait 18 clock cycles until the clock source is considered stable */ - SYSTEM_OSC32K_STARTUP_18, - /** Wait 34 clock cycles until the clock source is considered stable */ - SYSTEM_OSC32K_STARTUP_34, - /** Wait 66 clock cycles until the clock source is considered stable */ - SYSTEM_OSC32K_STARTUP_66, - /** Wait 130 clock cycles until the clock source is considered stable */ - SYSTEM_OSC32K_STARTUP_130, -}; - -/** - * \brief Division prescalers for the internal 8MHz system clock. - * - * Available prescalers for the internal 8MHz (nominal) system clock. - */ -enum system_osc8m_div { - /** Do not divide the 8MHz RC oscillator output */ - SYSTEM_OSC8M_DIV_1, - /** Divide the 8MHz RC oscillator output by two */ - SYSTEM_OSC8M_DIV_2, - /** Divide the 8MHz RC oscillator output by four */ - SYSTEM_OSC8M_DIV_4, - /** Divide the 8MHz RC oscillator output by eight */ - SYSTEM_OSC8M_DIV_8, -}; - -/** - * \brief Frequency range for the internal 8MHz RC oscillator. - * - * Internal 8MHz RC oscillator frequency range setting. - */ -enum system_osc8m_frequency_range { - /** Frequency range 4MHz to 6MHz */ - SYSTEM_OSC8M_FREQUENCY_RANGE_4_TO_6, - /** Frequency range 6MHz to 8MHz */ - SYSTEM_OSC8M_FREQUENCY_RANGE_6_TO_8, - /** Frequency range 8MHz to 11MHz */ - SYSTEM_OSC8M_FREQUENCY_RANGE_8_TO_11, - /** Frequency range 11MHz to 15MHz */ - SYSTEM_OSC8M_FREQUENCY_RANGE_11_TO_15, -}; - -/** - * \brief Main CPU and APB/AHB bus clock source prescaler values. - * - * Available division ratios for the CPU and APB/AHB bus clocks. - */ -enum system_main_clock_div { - /** Divide Main clock by one */ - SYSTEM_MAIN_CLOCK_DIV_1, - /** Divide Main clock by two */ - SYSTEM_MAIN_CLOCK_DIV_2, - /** Divide Main clock by four */ - SYSTEM_MAIN_CLOCK_DIV_4, - /** Divide Main clock by eight */ - SYSTEM_MAIN_CLOCK_DIV_8, - /** Divide Main clock by 16 */ - SYSTEM_MAIN_CLOCK_DIV_16, - /** Divide Main clock by 32 */ - SYSTEM_MAIN_CLOCK_DIV_32, - /** Divide Main clock by 64 */ - SYSTEM_MAIN_CLOCK_DIV_64, - /** Divide Main clock by 128 */ - SYSTEM_MAIN_CLOCK_DIV_128, -}; - -/** - * \brief External clock source types. - * - * Available external clock source types. - */ -enum system_clock_external { - /** The external clock source is a crystal oscillator */ - SYSTEM_CLOCK_EXTERNAL_CRYSTAL, - /** The connected clock source is an external logic level clock signal */ - SYSTEM_CLOCK_EXTERNAL_CLOCK, -}; - -/** - * \brief Operating modes of the DFLL clock source. - * - * Available operating modes of the DFLL clock source module. - */ -enum system_clock_dfll_loop_mode { - /** The DFLL is operating in open loop mode with no feedback */ - SYSTEM_CLOCK_DFLL_LOOP_MODE_OPEN, - /** The DFLL is operating in closed loop mode with frequency feedback from - * a low frequency reference clock - */ - SYSTEM_CLOCK_DFLL_LOOP_MODE_CLOSED = SYSCTRL_DFLLCTRL_MODE, - -#ifdef SYSCTRL_DFLLCTRL_USBCRM - /** The DFLL is operating in USB recovery mode with frequency feedback - * from USB SOF. - */ - SYSTEM_CLOCK_DFLL_LOOP_MODE_USB_RECOVERY = SYSCTRL_DFLLCTRL_USBCRM, -#endif -}; - -/** - * \brief Locking behavior for the DFLL during device wake-up. - * - * DFLL lock behavior modes on device wake-up from sleep. - */ -enum system_clock_dfll_wakeup_lock { - /** Keep DFLL lock when the device wakes from sleep */ - SYSTEM_CLOCK_DFLL_WAKEUP_LOCK_KEEP, - /** Lose DFLL lock when the devices wakes from sleep */ - SYSTEM_CLOCK_DFLL_WAKEUP_LOCK_LOSE = SYSCTRL_DFLLCTRL_LLAW, -}; - -/** - * \brief Fine tracking behavior for the DFLL once a lock has been acquired. - * - * DFLL fine tracking behavior modes after a lock has been acquired. - */ -enum system_clock_dfll_stable_tracking { - /** Keep tracking after the DFLL has gotten a fine lock */ - SYSTEM_CLOCK_DFLL_STABLE_TRACKING_TRACK_AFTER_LOCK, - /** Stop tracking after the DFLL has gotten a fine lock */ - SYSTEM_CLOCK_DFLL_STABLE_TRACKING_FIX_AFTER_LOCK = SYSCTRL_DFLLCTRL_STABLE, -}; - -/** - * \brief Chill-cycle behavior of the DFLL module. - * - * DFLL chill-cycle behavior modes of the DFLL module. A chill cycle is a period - * of time when the DFLL output frequency is not measured by the unit, to allow - * the output to stabilize after a change in the input clock source. - */ -enum system_clock_dfll_chill_cycle { - /** Enable a chill cycle, where the DFLL output frequency is not measured */ - SYSTEM_CLOCK_DFLL_CHILL_CYCLE_ENABLE, - /** Disable a chill cycle, where the DFLL output frequency is not measured */ - SYSTEM_CLOCK_DFLL_CHILL_CYCLE_DISABLE = SYSCTRL_DFLLCTRL_CCDIS, -}; - -/** - * \brief QuickLock settings for the DFLL module. - * - * DFLL QuickLock settings for the DFLL module, to allow for a faster lock of - * the DFLL output frequency at the expense of accuracy. - */ -enum system_clock_dfll_quick_lock { - /** Enable the QuickLock feature for looser lock requirements on the DFLL */ - SYSTEM_CLOCK_DFLL_QUICK_LOCK_ENABLE, - /** Disable the QuickLock feature for strict lock requirements on the DFLL */ - SYSTEM_CLOCK_DFLL_QUICK_LOCK_DISABLE = SYSCTRL_DFLLCTRL_QLDIS, -}; - -/** - * \brief Available clock sources in the system. - * - * Clock sources available to the GCLK generators. - */ -enum system_clock_source { - /** Internal 8MHz RC oscillator */ - SYSTEM_CLOCK_SOURCE_OSC8M = GCLK_SOURCE_OSC8M, - /** Internal 32KHz RC oscillator */ - SYSTEM_CLOCK_SOURCE_OSC32K = GCLK_SOURCE_OSC32K, - /** External oscillator */ - SYSTEM_CLOCK_SOURCE_XOSC = GCLK_SOURCE_XOSC , - /** External 32KHz oscillator */ - SYSTEM_CLOCK_SOURCE_XOSC32K = GCLK_SOURCE_XOSC32K, - /** Digital Frequency Locked Loop (DFLL) */ - SYSTEM_CLOCK_SOURCE_DFLL = GCLK_SOURCE_DFLL48M, - /** Internal Ultra Low Power 32KHz oscillator */ - SYSTEM_CLOCK_SOURCE_ULP32K = GCLK_SOURCE_OSCULP32K, - /** Generator input pad */ - SYSTEM_CLOCK_SOURCE_GCLKIN = GCLK_SOURCE_GCLKIN, - /** Generic clock generator one output */ - SYSTEM_CLOCK_SOURCE_GCLKGEN1 = GCLK_SOURCE_GCLKGEN1, -#ifdef FEATURE_SYSTEM_CLOCK_DPLL - /** Digital Phase Locked Loop (DPLL). - * Check \c FEATURE_SYSTEM_CLOCK_DPLL for which device support it. - */ - SYSTEM_CLOCK_SOURCE_DPLL = GCLK_SOURCE_FDPLL, -#endif -}; - -/** - * \brief List of APB peripheral buses. - * - * Available bus clock domains on the APB bus. - */ -enum system_clock_apb_bus { - /** Peripheral bus A on the APB bus */ - SYSTEM_CLOCK_APB_APBA, - /** Peripheral bus B on the APB bus */ - SYSTEM_CLOCK_APB_APBB, - /** Peripheral bus C on the APB bus */ - SYSTEM_CLOCK_APB_APBC, -}; - -/** - * \brief Configuration structure for XOSC. - * - * External oscillator clock configuration structure. - */ -struct system_clock_source_xosc_config { - /** External clock type */ - enum system_clock_external external_clock; - /** Crystal oscillator start-up time */ - enum system_xosc_startup startup_time; - /** Enable automatic amplitude gain control */ - bool auto_gain_control; - /** External clock/crystal frequency */ - uint32_t frequency; - /** Keep the XOSC enabled in standby sleep mode */ - bool run_in_standby; - /** Run On Demand. If this is set the XOSC won't run - * until requested by a peripheral. */ - bool on_demand; -}; - -/** - * \brief Configuration structure for XOSC32K. - * - * External 32KHz oscillator clock configuration structure. - */ -struct system_clock_source_xosc32k_config { - /** External clock type */ - enum system_clock_external external_clock; - /** Crystal oscillator start-up time */ - enum system_xosc32k_startup startup_time; - /** Enable automatic amplitude control */ - bool auto_gain_control; - /** Enable 1KHz output */ - bool enable_1khz_output; - /** Enable 32KHz output */ - bool enable_32khz_output; - /** External clock/crystal frequency */ - uint32_t frequency; - /** Keep the XOSC32K enabled in standby sleep mode */ - bool run_in_standby; - /** Run On Demand. If this is set the XOSC32K won't run - * until requested by a peripheral. */ - bool on_demand; - /** Lock configuration after it has been written, - * a device reset will release the lock */ - bool write_once; -}; - -/** - * \brief Configuration structure for OSC8M. - * - * Internal 8MHz (nominal) oscillator configuration structure. - */ -struct system_clock_source_osc8m_config { - /** Internal 8MHz RC oscillator prescaler */ - enum system_osc8m_div prescaler; - /** Keep the OSC8M enabled in standby sleep mode */ - bool run_in_standby; - /** Run On Demand. If this is set the OSC8M won't run - * until requested by a peripheral. */ - bool on_demand; -}; - -/** - * \brief Configuration structure for OSC32K. - * - * Internal 32KHz (nominal) oscillator configuration structure. - */ -struct system_clock_source_osc32k_config { - /** Startup time */ - enum system_osc32k_startup startup_time; - /** Enable 1KHz output */ - bool enable_1khz_output; - /** Enable 32KHz output */ - bool enable_32khz_output; - /** Keep the OSC32K enabled in standby sleep mode */ - bool run_in_standby; - /** Run On Demand. If this is set the OSC32K won't run - * until requested by a peripheral */ - bool on_demand; - /** Lock configuration after it has been written, - * a device reset will release the lock */ - bool write_once; -}; - -/** - * \brief Configuration structure for DFLL. - * - * DFLL oscillator configuration structure. - */ -struct system_clock_source_dfll_config { - /** Loop mode */ - enum system_clock_dfll_loop_mode loop_mode; - /** Run On Demand. If this is set the DFLL won't run - * until requested by a peripheral. */ - bool on_demand; - /** Enable Quick Lock */ - enum system_clock_dfll_quick_lock quick_lock; - /** Enable Chill Cycle */ - enum system_clock_dfll_chill_cycle chill_cycle; - /** DFLL lock state on wakeup */ - enum system_clock_dfll_wakeup_lock wakeup_lock; - /** DFLL tracking after fine lock */ - enum system_clock_dfll_stable_tracking stable_tracking; - /** Coarse calibration value (Open loop mode) */ - uint8_t coarse_value; - /** Fine calibration value (Open loop mode) */ - uint16_t fine_value; - /** Coarse adjustment maximum step size (Closed loop mode) */ - uint8_t coarse_max_step; - /** Fine adjustment maximum step size (Closed loop mode) */ - uint16_t fine_max_step; - /** DFLL multiply factor (Closed loop mode */ - uint16_t multiply_factor; -}; - -/** - * \name External Oscillator Management - * @{ - */ - -/** - * \brief Retrieve the default configuration for XOSC. - * - * Fills a configuration structure with the default configuration for an - * external oscillator module: - * - External Crystal - * - Start-up time of 16384 external clock cycles - * - Automatic crystal gain control mode enabled - * - Frequency of 12MHz - * - Don't run in STANDBY sleep mode - * - Run only when requested by peripheral (on demand) - * - * \param[out] config Configuration structure to fill with default values - */ -static inline void system_clock_source_xosc_get_config_defaults( - struct system_clock_source_xosc_config *const config) -{ - Assert(config); - - config->external_clock = SYSTEM_CLOCK_EXTERNAL_CRYSTAL; - config->startup_time = SYSTEM_XOSC_STARTUP_16384; - config->auto_gain_control = true; - config->frequency = 12000000UL; - config->run_in_standby = false; - config->on_demand = true; -} - -void system_clock_source_xosc_set_config( - struct system_clock_source_xosc_config *const config); - -/** - * @} - */ - - -/** - * \name External 32KHz Oscillator Management - * @{ - */ - -/** - * \brief Retrieve the default configuration for XOSC32K. - * - * Fills a configuration structure with the default configuration for an - * external 32KHz oscillator module: - * - External Crystal - * - Start-up time of 16384 external clock cycles - * - Automatic crystal gain control mode disabled - * - Frequency of 32.768KHz - * - 1KHz clock output disabled - * - 32KHz clock output enabled - * - Don't run in STANDBY sleep mode - * - Run only when requested by peripheral (on demand) - * - Don't lock registers after configuration has been written - * - * \param[out] config Configuration structure to fill with default values - */ -static inline void system_clock_source_xosc32k_get_config_defaults( - struct system_clock_source_xosc32k_config *const config) -{ - Assert(config); - - config->external_clock = SYSTEM_CLOCK_EXTERNAL_CRYSTAL; - config->startup_time = SYSTEM_XOSC32K_STARTUP_16384; - config->auto_gain_control = false; - config->frequency = 32768UL; - config->enable_1khz_output = false; - config->enable_32khz_output = true; - config->run_in_standby = false; - config->on_demand = true; - config->write_once = false; -} - -void system_clock_source_xosc32k_set_config( - struct system_clock_source_xosc32k_config *const config); -/** - * @} - */ - - -/** - * \name Internal 32KHz Oscillator Management - * @{ - */ - -/** - * \brief Retrieve the default configuration for OSC32K. - * - * Fills a configuration structure with the default configuration for an - * internal 32KHz oscillator module: - * - 1KHz clock output enabled - * - 32KHz clock output enabled - * - Don't run in STANDBY sleep mode - * - Run only when requested by peripheral (on demand) - * - Set startup time to 130 cycles - * - Don't lock registers after configuration has been written - * - * \param[out] config Configuration structure to fill with default values - */ -static inline void system_clock_source_osc32k_get_config_defaults( - struct system_clock_source_osc32k_config *const config) -{ - Assert(config); - - config->enable_1khz_output = true; - config->enable_32khz_output = true; - config->run_in_standby = false; - config->on_demand = true; - config->startup_time = SYSTEM_OSC32K_STARTUP_130; - config->write_once = false; -} - -void system_clock_source_osc32k_set_config( - struct system_clock_source_osc32k_config *const config); - -/** - * @} - */ - - -/** - * \name Internal 8MHz Oscillator Management - * @{ - */ - -/** - * \brief Retrieve the default configuration for OSC8M. - * - * Fills a configuration structure with the default configuration for an - * internal 8MHz (nominal) oscillator module: - * - Clock output frequency divided by a factor of eight - * - Don't run in STANDBY sleep mode - * - Run only when requested by peripheral (on demand) - * - * \param[out] config Configuration structure to fill with default values - */ -static inline void system_clock_source_osc8m_get_config_defaults( - struct system_clock_source_osc8m_config *const config) -{ - Assert(config); - - config->prescaler = SYSTEM_OSC8M_DIV_8; - config->run_in_standby = false; - config->on_demand = true; -} - -void system_clock_source_osc8m_set_config( - struct system_clock_source_osc8m_config *const config); - -/** - * @} - */ - - -/** - * \name Internal DFLL Management - * @{ - */ - -/** - * \brief Retrieve the default configuration for DFLL. - * - * Fills a configuration structure with the default configuration for a - * DFLL oscillator module: - * - Open loop mode - * - QuickLock mode enabled - * - Chill cycle enabled - * - Output frequency lock maintained during device wake-up - * - Continuous tracking of the output frequency - * - Default tracking values at the mid-points for both coarse and fine - * tracking parameters - * - Don't run in STANDBY sleep mode - * - Run only when requested by peripheral (on demand) - * - * \param[out] config Configuration structure to fill with default values - */ -static inline void system_clock_source_dfll_get_config_defaults( - struct system_clock_source_dfll_config *const config) -{ - Assert(config); - - config->loop_mode = SYSTEM_CLOCK_DFLL_LOOP_MODE_OPEN; - config->quick_lock = SYSTEM_CLOCK_DFLL_QUICK_LOCK_ENABLE; - config->chill_cycle = SYSTEM_CLOCK_DFLL_CHILL_CYCLE_ENABLE; - config->wakeup_lock = SYSTEM_CLOCK_DFLL_WAKEUP_LOCK_KEEP; - config->stable_tracking = SYSTEM_CLOCK_DFLL_STABLE_TRACKING_TRACK_AFTER_LOCK; - config->on_demand = true; - - /* Open loop mode calibration value */ - config->coarse_value = 0x1f / 4; /* Midpoint */ - config->fine_value = 0xff / 4; /* Midpoint */ - - /* Closed loop mode */ - config->coarse_max_step = 1; - config->fine_max_step = 1; - config->multiply_factor = 6; /* Multiply 8MHz by 6 to get 48MHz */ -} - -void system_clock_source_dfll_set_config( - struct system_clock_source_dfll_config *const config); - -/** - * @} - */ - -/** - * \name Clock Source Management - * @{ - */ -enum status_code system_clock_source_write_calibration( - const enum system_clock_source system_clock_source, - const uint16_t calibration_value, - const uint8_t freq_range); - -enum status_code system_clock_source_enable( - const enum system_clock_source system_clock_source); - -enum status_code system_clock_source_disable( - const enum system_clock_source clk_source); - -bool system_clock_source_is_ready( - const enum system_clock_source clk_source); - -uint32_t system_clock_source_get_hz( - const enum system_clock_source clk_source); - -/** - * @} - */ - -/** - * \name Main Clock Management - * @{ - */ - -/** - * \brief Set main CPU clock divider. - * - * Sets the clock divider used on the main clock to provide the CPU clock. - * - * \param[in] divider CPU clock divider to set - */ -static inline void system_cpu_clock_set_divider( - const enum system_main_clock_div divider) -{ - Assert(((uint32_t)divider & PM_CPUSEL_CPUDIV_Msk) == divider); - PM->CPUSEL.reg = (uint32_t)divider; -} - -/** - * \brief Retrieves the current frequency of the CPU core. - * - * Retrieves the operating frequency of the CPU core, obtained from the main - * generic clock and the set CPU bus divider. - * - * \return Current CPU frequency in Hz. - */ -static inline uint32_t system_cpu_clock_get_hz(void) -{ - return (system_gclk_gen_get_hz(GCLK_GENERATOR_0) >> PM->CPUSEL.reg); -} - -/** - * \brief Set APBx clock divider. - * - * Set the clock divider used on the main clock to provide the clock for the - * given APBx bus. - * - * \param[in] divider APBx bus divider to set - * \param[in] bus APBx bus to set divider - * - * \returns Status of the clock division change operation. - * - * \retval STATUS_ERR_INVALID_ARG Invalid bus ID was given - * \retval STATUS_OK The APBx clock was set successfully - */ -static inline enum status_code system_apb_clock_set_divider( - const enum system_clock_apb_bus bus, - const enum system_main_clock_div divider) -{ - switch (bus) { - case SYSTEM_CLOCK_APB_APBA: - PM->APBASEL.reg = (uint32_t)divider; - break; - case SYSTEM_CLOCK_APB_APBB: - PM->APBBSEL.reg = (uint32_t)divider; - break; - case SYSTEM_CLOCK_APB_APBC: - PM->APBCSEL.reg = (uint32_t)divider; - break; - default: - Assert(false); - return STATUS_ERR_INVALID_ARG; - } - - return STATUS_OK; -} - -/** - * \brief Retrieves the current frequency of a ABPx. - * - * Retrieves the operating frequency of an APBx bus, obtained from the main - * generic clock and the set APBx bus divider. - * - * \return Current APBx bus frequency in Hz. - */ -static inline uint32_t system_apb_clock_get_hz( - const enum system_clock_apb_bus bus) -{ - uint16_t bus_divider = 0; - - switch (bus) { - case SYSTEM_CLOCK_APB_APBA: - bus_divider = PM->APBASEL.reg; - break; - case SYSTEM_CLOCK_APB_APBB: - bus_divider = PM->APBBSEL.reg; - break; - case SYSTEM_CLOCK_APB_APBC: - bus_divider = PM->APBCSEL.reg; - break; - default: - Assert(false); - return 0; - } - - return (system_gclk_gen_get_hz(GCLK_GENERATOR_0) >> bus_divider); -} - - -/** - * @} - */ - -/** - * \name Bus Clock Masking - * @{ - */ - -/** - * \brief Set bits in the clock mask for the AHB bus. - * - * This function will set bits in the clock mask for the AHB bus. - * Any bits set to 1 will enable that clock, 0 bits in the mask - * will be ignored. - * - * \param[in] ahb_mask AHB clock mask to enable - */ -static inline void system_ahb_clock_set_mask( - const uint32_t ahb_mask) -{ - PM->AHBMASK.reg |= ahb_mask; -} - -/** - * \brief Clear bits in the clock mask for the AHB bus. - * - * This function will clear bits in the clock mask for the AHB bus. - * Any bits set to 1 will disable that clock, 0 bits in the mask - * will be ignored. - * - * \param[in] ahb_mask AHB clock mask to disable - */ -static inline void system_ahb_clock_clear_mask( - const uint32_t ahb_mask) -{ - PM->AHBMASK.reg &= ~ahb_mask; -} - -/** - * \brief Set bits in the clock mask for an APBx bus. - * - * This function will set bits in the clock mask for an APBx bus. - * Any bits set to 1 will enable the corresponding module clock, zero bits in - * the mask will be ignored. - * - * \param[in] mask APBx clock mask, a \c SYSTEM_CLOCK_APB_APBx constant from - * the device header files - * \param[in] bus Bus to set clock mask bits for, a mask of \c PM_APBxMASK_* - * constants from the device header files - * - * \returns Status indicating the result of the clock mask change operation. - * - * \retval STATUS_ERR_INVALID_ARG Invalid bus given - * \retval STATUS_OK The clock mask was set successfully - */ -static inline enum status_code system_apb_clock_set_mask( - const enum system_clock_apb_bus bus, - const uint32_t mask) -{ - switch (bus) { - case SYSTEM_CLOCK_APB_APBA: - PM->APBAMASK.reg |= mask; - break; - - case SYSTEM_CLOCK_APB_APBB: - PM->APBBMASK.reg |= mask; - break; - - case SYSTEM_CLOCK_APB_APBC: - PM->APBCMASK.reg |= mask; - break; - - default: - Assert(false); - return STATUS_ERR_INVALID_ARG; - - } - - return STATUS_OK; -} - -/** - * \brief Clear bits in the clock mask for an APBx bus. - * - * This function will clear bits in the clock mask for an APBx bus. - * Any bits set to 1 will disable the corresponding module clock, zero bits in - * the mask will be ignored. - * - * \param[in] mask APBx clock mask, a \c SYSTEM_CLOCK_APB_APBx constant from - * the device header files - * \param[in] bus Bus to clear clock mask bits - * - * \returns Status indicating the result of the clock mask change operation. - * - * \retval STATUS_ERR_INVALID_ARG Invalid bus ID was given - * \retval STATUS_OK The clock mask was changed successfully - */ -static inline enum status_code system_apb_clock_clear_mask( - const enum system_clock_apb_bus bus, - const uint32_t mask) -{ - switch (bus) { - case SYSTEM_CLOCK_APB_APBA: - PM->APBAMASK.reg &= ~mask; - break; - - case SYSTEM_CLOCK_APB_APBB: - PM->APBBMASK.reg &= ~mask; - break; - - case SYSTEM_CLOCK_APB_APBC: - PM->APBCMASK.reg &= ~mask; - break; - - default: - Assert(false); - return STATUS_ERR_INVALID_ARG; - } - - return STATUS_OK; -} - -/** - * @} - */ - -#ifdef FEATURE_SYSTEM_CLOCK_DPLL -/** - * \brief Reference clock source of the DPLL module. - */ -enum system_clock_source_dpll_reference_clock { - /** Select XOSC32K as clock reference. */ - SYSTEM_CLOCK_SOURCE_DPLL_REFERENCE_CLOCK_XOSC32K, - /** Select XOSC as clock reference. */ - SYSTEM_CLOCK_SOURCE_DPLL_REFERENCE_CLOCK_XOSC, - /** Select GCLK as clock reference. */ - SYSTEM_CLOCK_SOURCE_DPLL_REFERENCE_CLOCK_GCLK, -}; - -/** - * \brief Lock time-out value of the DPLL module. - */ -enum system_clock_source_dpll_lock_time { - /** Set no time-out as default. */ - SYSTEM_CLOCK_SOURCE_DPLL_LOCK_TIME_DEFAULT, - /** Set time-out if no lock within 8ms. */ - SYSTEM_CLOCK_SOURCE_DPLL_LOCK_TIME_8MS = 0x04, - /** Set time-out if no lock within 9ms. */ - SYSTEM_CLOCK_SOURCE_DPLL_LOCK_TIME_9MS, - /** Set time-out if no lock within 10ms. */ - SYSTEM_CLOCK_SOURCE_DPLL_LOCK_TIME_10MS, - /** Set time-out if no lock within 11ms. */ - SYSTEM_CLOCK_SOURCE_DPLL_LOCK_TIME_11MS, -}; - -/** - * \brief Filter type of the DPLL module. - */ -enum system_clock_source_dpll_filter { - /** Default filter mode. */ - SYSTEM_CLOCK_SOURCE_DPLL_FILTER_DEFAULT, - /** Low bandwidth filter. */ - SYSTEM_CLOCK_SOURCE_DPLL_FILTER_LOW_BANDWIDTH_FILTER, - /** High bandwidth filter. */ - SYSTEM_CLOCK_SOURCE_DPLL_FILTER_HIGH_BANDWIDTH_FILTER, - /** High damping filter. */ - SYSTEM_CLOCK_SOURCE_DPLL_FILTER_HIGH_DAMPING_FILTER, -}; - -/** - * \brief Configuration structure for DPLL. - * - * DPLL oscillator configuration structure. - */ -struct system_clock_source_dpll_config { - /** Run On Demand. If this is set the DPLL won't run - * until requested by a peripheral. */ - bool on_demand; - /** Keep the DPLL enabled in standby sleep mode. */ - bool run_in_standby; - /** Bypass lock signal. */ - bool lock_bypass; - /** Wake up fast. If this is set DPLL output clock is enabled after - * the startup time. */ - bool wake_up_fast; - /** Enable low power mode. */ - bool low_power_enable; - - /** Output frequency of the clock. */ - uint32_t output_frequency; - /** Reference frequency of the clock. */ - uint32_t reference_frequency; - /** Devider of reference clock. */ - uint16_t reference_divider; - - /** Filter type of the DPLL module. */ - enum system_clock_source_dpll_filter filter; - /** Lock time-out value of the DPLL module. */ - enum system_clock_source_dpll_lock_time lock_time; - /** Reference clock source of the DPLL module. */ - enum system_clock_source_dpll_reference_clock reference_clock; -}; - -/** - * \name Internal DPLL Management - * @{ - */ - -/** - * \brief Retrieve the default configuration for DPLL. - * - * Fills a configuration structure with the default configuration for a - * DPLL oscillator module: - * - Run only when requested by peripheral (on demand) - * - Don't run in STANDBY sleep mode - * - Lock bypass disabled - * - Fast wake up disabled - * - Low power mode disabled - * - Output frequency is 48MHz - * - Reference clock frequency is 32768Hz - * - Not divide reference clock - * - Select REF0 as reference clock - * - Set lock time to default mode - * - Use default filter - * - * \param[out] config Configuration structure to fill with default values - */ -static inline void system_clock_source_dpll_get_config_defaults( - struct system_clock_source_dpll_config *const config) -{ - config->on_demand = true; - config->run_in_standby = false; - config->lock_bypass = false; - config->wake_up_fast = false; - config->low_power_enable = false; - - config->output_frequency = 48000000; - config->reference_frequency = 32768; - config->reference_divider = 1; - config->reference_clock = SYSTEM_CLOCK_SOURCE_DPLL_REFERENCE_CLOCK_XOSC32K; - - config->lock_time = SYSTEM_CLOCK_SOURCE_DPLL_LOCK_TIME_DEFAULT; - config->filter = SYSTEM_CLOCK_SOURCE_DPLL_FILTER_DEFAULT; -}; - -void system_clock_source_dpll_set_config( - struct system_clock_source_dpll_config *const config); - -/* @} */ -#endif - -/** - * \name System Clock Initialization - * @{ - */ - -void system_clock_init(uint16_t dfll_fine_calibration); - -/** - * @} - */ - -/** - * \name System Flash Wait States - * @{ - */ - -/** - * \brief Set flash controller wait states. - * - * Will set the number of wait states that are used by the onboard - * flash memory. The number of wait states depend on both device - * supply voltage and CPU speed. The required number of wait states - * can be found in the electrical characteristics of the device. - * - * \param[in] wait_states Number of wait states to use for internal flash - */ -static inline void system_flash_set_waitstates(uint8_t wait_states) -{ - Assert(NVMCTRL_CTRLB_RWS((uint32_t)wait_states) == - ((uint32_t)wait_states << NVMCTRL_CTRLB_RWS_Pos)); - - NVMCTRL->CTRLB.bit.RWS = wait_states; -} -/** - * @} - */ - -/** - * @} - */ - -/** - * \page asfdoc_sam0_system_clock_extra Extra Information for SYSTEM CLOCK Driver - * - * \section asfdoc_sam0_system_clock_extra_acronyms Acronyms - * Below is a table listing the acronyms used in this module, along with their - * intended meanings. - * - * <table> - * <tr> - * <th>Acronym</th> - * <th>Description</th> - * </tr> - * <tr> - * <td>DFLL</td> - * <td>Digital Frequency Locked Loop</td> - * </tr> - * <tr> - * <td>MUX</td> - * <td>Multiplexer</td> - * </tr> - * <tr> - * <td>OSC32K</td> - * <td>Internal 32KHz Oscillator</td> - * </tr> - * <tr> - * <td>OSC8M</td> - * <td>Internal 8MHz Oscillator</td> - * </tr> - * <tr> - * <td>PLL</td> - * <td>Phase Locked Loop</td> - * </tr> - * <tr> - * <td>OSC</td> - * <td>Oscillator</td> - * </tr> - * <tr> - * <td>XOSC</td> - * <td>External Oscillator</td> - * </tr> - * <tr> - * <td>XOSC32K</td> - * <td>External 32KHz Oscillator</td> - * </tr> - * <tr> - * <td>AHB</td> - * <td>Advanced High-performance Bus</td> - * </tr> - * <tr> - * <td>APB</td> - * <td>Advanced Peripheral Bus</td> - * </tr> - * <tr> - * <td>DPLL</td> - * <td>Digital Phase Locked Loop</td> - * </tr> - * </table> - * - * - * \section asfdoc_sam0_system_clock_extra_dependencies Dependencies - * This driver has the following dependencies: - * - * - None - * - * - * \section asfdoc_sam0_system_clock_extra_errata Errata - * - * - This driver implements experimental workaround for errata 9905 - * - * "The DFLL clock must be requested before being configured otherwise a - * write access to a DFLL register can freeze the device." - * This driver will enable and configure the DFLL before the ONDEMAND bit is set. - * - * - * \section asfdoc_sam0_system_clock_extra_history Module History - * An overview of the module history is presented in the table below, with - * details on the enhancements and fixes made to the module since its first - * release. The current version of this corresponds to the newest version in - * the table. - * - * <table> - * <tr> - * <th>Changelog</th> - * </tr> - * <tr> - * <td> - * \li Corrected OSC32K startup time definitions - * \li Support locking of OSC32K and XOSC32K config register (default: false) - * \li Added DPLL support, functions added: - * \c system_clock_source_dpll_get_config_defaults() and - * \c system_clock_source_dpll_set_config() - * \li Moved gclk channel locking feature out of the config struct - * functions added: - * \c system_gclk_chan_lock(), - * \c system_gclk_chan_is_locked() - * \c system_gclk_chan_is_enabled() and - * \c system_gclk_gen_is_enabled() - * </td> - * </tr> - * <tr> - * <td>Fixed \c system_gclk_chan_disable() deadlocking if a channel is enabled - * and configured to a failed/not running clock generator</td> - * </tr> - * <tr> - * <td> - * \li Changed default value for CONF_CLOCK_DFLL_ON_DEMAND from \c true to \c false - * \li Fixed system_flash_set_waitstates() failing with an assertion - * if an odd number of wait states provided - * </td> - * </tr> - * <tr> - * <td> - * \li Updated DFLL configuration function to implement workaround for - * errata 9905 in the DFLL module - * \li Updated \c system_clock_init() to reset interrupt flags before - * they are used - * \li Fixed \c system_clock_source_get_hz() to return correcy DFLL - * frequency number - * </td> - * </tr> - * <tr> - * <td>\li Fixed \c system_clock_source_is_ready not returning the correct - * state for \c SYSTEM_CLOCK_SOURCE_OSC8M - * \li Renamed the various \c system_clock_source_*_get_default_config() - * functions to \c system_clock_source_*_get_config_defaults() to - * match the remainder of ASF - * \li Added OSC8M calibration constant loading from the device signature - * row when the oscillator is initialized - * \li Updated default configuration of the XOSC32 to disable Automatic - * Gain Control due to silicon errata - * </td> - * </tr> - * <tr> - * <td>Initial Release</td> - * </tr> - * </table> - */ - -/** - * \page asfdoc_sam0_system_clock_exqsg Examples for System Clock Driver - * - * This is a list of the available Quick Start guides (QSGs) and example - * applications for \ref asfdoc_sam0_system_clock_group. QSGs are simple - * examples with step-by-step instructions to configure and use this driver in - * a selection of use cases. Note that a QSG can be compiled as a standalone - * application or be added to the user application. - * - * - \subpage asfdoc_sam0_system_clock_basic_use_case - * - \subpage asfdoc_sam0_system_gclk_basic_use_case - * - * \page asfdoc_sam0_system_clock_document_revision_history Document Revision History - * - * <table> - * <tr> - * <th>Doc. Rev.</th> - * <th>Date</th> - * <th>Comments</th> - * </tr> - * <tr> - * <td>42119E</td> - * <td>12/2015</td> - * <td>Added support for SAM DA1 and SAM D09</td> - * </tr> - * <tr> - * <td>42119D</td> - * <td>12/2014</td> - * <td>Added support for SAM R21 and SAM D10/D11</td> - * </tr> - * <tr> - * <td>42119C</td> - * <td>01/2014</td> - * <td>Added support for SAM D21</td> - * </tr> - * <tr> - * <td>42119B</td> - * <td>06/2013</td> - * <td>Corrected documentation typos. Fixed missing steps in the Basic - * Use Case Quick Start Guide</td> - * </tr> - * <tr> - * <td>42119A</td> - * <td>06/2013</td> - * <td>Initial release</td> - * </tr> - * </table> - */ - -#ifdef __cplusplus -} -#endif - -#endif /* SYSTEM_CLOCK_FEATURE_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/system/clock/clock_samd21_r21_da/gclk.c b/atmel-samd/asf/sam0/drivers/system/clock/clock_samd21_r21_da/gclk.c deleted file mode 100644 index 79b5a5813..000000000 --- a/atmel-samd/asf/sam0/drivers/system/clock/clock_samd21_r21_da/gclk.c +++ /dev/null @@ -1,522 +0,0 @@ -/** - * \file - * - * \brief SAM D21/R21/DA0/DA1 Generic Clock Driver - * - * Copyright (C) 2013-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#include <gclk.h> -#include <clock.h> -#include <system_interrupt.h> - -/** - * \brief Determines if the hardware module(s) are currently synchronizing to the bus. - * - * Checks to see if the underlying hardware peripheral module(s) are currently - * synchronizing across multiple clock domains to the hardware bus, This - * function can be used to delay further operations on a module until such time - * that it is ready, to prevent blocking delays for synchronization in the - * user application. - * - * \return Synchronization status of the underlying hardware module(s). - * - * \retval false if the module has completed synchronization - * \retval true if the module synchronization is ongoing - */ -static inline bool system_gclk_is_syncing(void) -{ - if (GCLK->STATUS.reg & GCLK_STATUS_SYNCBUSY){ - return true; - } - - return false; -} - -/** - * \brief Initializes the GCLK driver. - * - * Initializes the Generic Clock module, disabling and resetting all active - * Generic Clock Generators and Channels to their power-on default values. - */ -void system_gclk_init(void) -{ - /* Turn on the digital interface clock */ - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBA, PM_APBAMASK_GCLK); - - /* Software reset the module to ensure it is re-initialized correctly */ - GCLK->CTRL.reg = GCLK_CTRL_SWRST; - while (GCLK->CTRL.reg & GCLK_CTRL_SWRST) { - /* Wait for reset to complete */ - } -} - -/** - * \brief Writes a Generic Clock Generator configuration to the hardware module. - * - * Writes out a given configuration of a Generic Clock Generator configuration - * to the hardware module. - * - * \note Changing the clock source on the fly (on a running - * generator) can take additional time if the clock source is configured - * to only run on-demand (ONDEMAND bit is set) and it is not currently - * running (no peripheral is requesting the clock source). In this case - * the GCLK will request the new clock while still keeping a request to - * the old clock source until the new clock source is ready. - * - * \note This function will not start a generator that is not already running; - * to start the generator, call \ref system_gclk_gen_enable() - * after configuring a generator. - * - * \param[in] generator Generic Clock Generator index to configure - * \param[in] config Configuration settings for the generator - */ -void system_gclk_gen_set_config( - const uint8_t generator, - struct system_gclk_gen_config *const config) -{ - /* Sanity check arguments */ - Assert(config); - - /* Cache new register configurations to minimize sync requirements. */ - uint32_t new_genctrl_config = (generator << GCLK_GENCTRL_ID_Pos); - uint32_t new_gendiv_config = (generator << GCLK_GENDIV_ID_Pos); - - /* Select the requested source clock for the generator */ - new_genctrl_config |= config->source_clock << GCLK_GENCTRL_SRC_Pos; - - /* Configure the clock to be either high or low when disabled */ - if (config->high_when_disabled) { - new_genctrl_config |= GCLK_GENCTRL_OOV; - } - - /* Configure if the clock output to I/O pin should be enabled. */ - if (config->output_enable) { - new_genctrl_config |= GCLK_GENCTRL_OE; - } - - /* Set division factor */ - if (config->division_factor > 1) { - /* Check if division is a power of two */ - if (((config->division_factor & (config->division_factor - 1)) == 0)) { - /* Determine the index of the highest bit set to get the - * division factor that must be loaded into the division - * register */ - - uint32_t div2_count = 0; - - uint32_t mask; - for (mask = (1UL << 1); mask < config->division_factor; - mask <<= 1) { - div2_count++; - } - - /* Set binary divider power of 2 division factor */ - new_gendiv_config |= div2_count << GCLK_GENDIV_DIV_Pos; - new_genctrl_config |= GCLK_GENCTRL_DIVSEL; - } else { - /* Set integer division factor */ - - new_gendiv_config |= - (config->division_factor) << GCLK_GENDIV_DIV_Pos; - - /* Enable non-binary division with increased duty cycle accuracy */ - new_genctrl_config |= GCLK_GENCTRL_IDC; - } - - } - - /* Enable or disable the clock in standby mode */ - if (config->run_in_standby) { - new_genctrl_config |= GCLK_GENCTRL_RUNSTDBY; - } - - while (system_gclk_is_syncing()) { - /* Wait for synchronization */ - }; - - system_interrupt_enter_critical_section(); - - /* Select the correct generator */ - *((uint8_t*)&GCLK->GENDIV.reg) = generator; - - /* Write the new generator configuration */ - while (system_gclk_is_syncing()) { - /* Wait for synchronization */ - }; - GCLK->GENDIV.reg = new_gendiv_config; - - while (system_gclk_is_syncing()) { - /* Wait for synchronization */ - }; - GCLK->GENCTRL.reg = new_genctrl_config | (GCLK->GENCTRL.reg & GCLK_GENCTRL_GENEN); - - system_interrupt_leave_critical_section(); -} - -/** - * \brief Enables a Generic Clock Generator that was previously configured. - * - * Starts the clock generation of a Generic Clock Generator that was previously - * configured via a call to \ref system_gclk_gen_set_config(). - * - * \param[in] generator Generic Clock Generator index to enable - */ -void system_gclk_gen_enable( - const uint8_t generator) -{ - while (system_gclk_is_syncing()) { - /* Wait for synchronization */ - }; - - system_interrupt_enter_critical_section(); - - /* Select the requested generator */ - *((uint8_t*)&GCLK->GENCTRL.reg) = generator; - while (system_gclk_is_syncing()) { - /* Wait for synchronization */ - }; - - /* Enable generator */ - GCLK->GENCTRL.reg |= GCLK_GENCTRL_GENEN; - - system_interrupt_leave_critical_section(); -} - -/** - * \brief Disables a Generic Clock Generator that was previously enabled. - * - * Stops the clock generation of a Generic Clock Generator that was previously - * started via a call to \ref system_gclk_gen_enable(). - * - * \param[in] generator Generic Clock Generator index to disable - */ -void system_gclk_gen_disable( - const uint8_t generator) -{ - while (system_gclk_is_syncing()) { - /* Wait for synchronization */ - }; - - system_interrupt_enter_critical_section(); - - /* Select the requested generator */ - *((uint8_t*)&GCLK->GENCTRL.reg) = generator; - while (system_gclk_is_syncing()) { - /* Wait for synchronization */ - }; - - /* Disable generator */ - GCLK->GENCTRL.reg &= ~GCLK_GENCTRL_GENEN; - while (GCLK->GENCTRL.reg & GCLK_GENCTRL_GENEN) { - /* Wait for clock to become disabled */ - } - - system_interrupt_leave_critical_section(); -} - -/** - * \brief Determins if the specified Generic Clock Generator is enabled. - * - * \param[in] generator Generic Clock Generator index to check - * - * \return The enabled status. - * \retval true The Generic Clock Generator is enabled - * \retval false The Generic Clock Generator is disabled - */ -bool system_gclk_gen_is_enabled( - const uint8_t generator) -{ - bool enabled; - - system_interrupt_enter_critical_section(); - - /* Select the requested generator */ - *((uint8_t*)&GCLK->GENCTRL.reg) = generator; - /* Obtain the enabled status */ - enabled = (GCLK->GENCTRL.reg & GCLK_GENCTRL_GENEN); - - system_interrupt_leave_critical_section(); - - return enabled; -} - -/** - * \brief Retrieves the clock frequency of a Generic Clock generator. - * - * Determines the clock frequency (in Hz) of a specified Generic Clock - * generator, used as a source to a Generic Clock Channel module. - * - * \param[in] generator Generic Clock Generator index - * - * \return The frequency of the generic clock generator, in Hz. - */ -uint32_t system_gclk_gen_get_hz( - const uint8_t generator) -{ - while (system_gclk_is_syncing()) { - /* Wait for synchronization */ - }; - - system_interrupt_enter_critical_section(); - - /* Select the appropriate generator */ - *((uint8_t*)&GCLK->GENCTRL.reg) = generator; - while (system_gclk_is_syncing()) { - /* Wait for synchronization */ - }; - - /* Get the frequency of the source connected to the GCLK generator */ - uint32_t gen_input_hz = system_clock_source_get_hz( - (enum system_clock_source)GCLK->GENCTRL.bit.SRC); - - *((uint8_t*)&GCLK->GENCTRL.reg) = generator; - - uint8_t divsel = GCLK->GENCTRL.bit.DIVSEL; - - /* Select the appropriate generator division register */ - *((uint8_t*)&GCLK->GENDIV.reg) = generator; - while (system_gclk_is_syncing()) { - /* Wait for synchronization */ - }; - - uint32_t divider = GCLK->GENDIV.bit.DIV; - - system_interrupt_leave_critical_section(); - - /* Check if the generator is using fractional or binary division */ - if (!divsel && divider > 1) { - gen_input_hz /= divider; - } else if (divsel) { - gen_input_hz >>= (divider+1); - } - - return gen_input_hz; -} - -/** - * \brief Writes a Generic Clock configuration to the hardware module. - * - * Writes out a given configuration of a Generic Clock configuration to the - * hardware module. If the clock is currently running, it will be stopped. - * - * \note Once called the clock will not be running; to start the clock, - * call \ref system_gclk_chan_enable() after configuring a clock channel. - * - * \param[in] channel Generic Clock channel to configure - * \param[in] config Configuration settings for the clock - * - */ -void system_gclk_chan_set_config( - const uint8_t channel, - struct system_gclk_chan_config *const config) -{ - /* Sanity check arguments */ - Assert(config); - - /* Cache the new config to reduce sync requirements */ - uint32_t new_clkctrl_config = (channel << GCLK_CLKCTRL_ID_Pos); - - /* Select the desired generic clock generator */ - new_clkctrl_config |= config->source_generator << GCLK_CLKCTRL_GEN_Pos; - - /* Disable generic clock channel */ - system_gclk_chan_disable(channel); - - /* Write the new configuration */ - GCLK->CLKCTRL.reg = new_clkctrl_config; -} - -/** - * \brief Enables a Generic Clock that was previously configured. - * - * Starts the clock generation of a Generic Clock that was previously - * configured via a call to \ref system_gclk_chan_set_config(). - * - * \param[in] channel Generic Clock channel to enable - */ -void system_gclk_chan_enable( - const uint8_t channel) -{ - system_interrupt_enter_critical_section(); - - /* Select the requested generator channel */ - *((uint8_t*)&GCLK->CLKCTRL.reg) = channel; - - /* Enable the generic clock */ - GCLK->CLKCTRL.reg |= GCLK_CLKCTRL_CLKEN; - - system_interrupt_leave_critical_section(); -} - -/** - * \brief Disables a Generic Clock that was previously enabled. - * - * Stops the clock generation of a Generic Clock that was previously started - * via a call to \ref system_gclk_chan_enable(). - * - * \param[in] channel Generic Clock channel to disable - */ -void system_gclk_chan_disable( - const uint8_t channel) -{ - system_interrupt_enter_critical_section(); - - /* Select the requested generator channel */ - *((uint8_t*)&GCLK->CLKCTRL.reg) = channel; - - /* Sanity check WRTLOCK */ - Assert(!GCLK->CLKCTRL.bit.WRTLOCK); - - /* Switch to known-working source so that the channel can be disabled */ - uint32_t prev_gen_id = GCLK->CLKCTRL.bit.GEN; - GCLK->CLKCTRL.bit.GEN = 0; - - /* Disable the generic clock */ - GCLK->CLKCTRL.reg &= ~GCLK_CLKCTRL_CLKEN; - while (GCLK->CLKCTRL.reg & GCLK_CLKCTRL_CLKEN) { - /* Wait for clock to become disabled */ - } - - /* Restore previous configured clock generator */ - GCLK->CLKCTRL.bit.GEN = prev_gen_id; - - system_interrupt_leave_critical_section(); -} - -/** - * \brief Determins if the specified Generic Clock channel is enabled. - * - * \param[in] channel Generic Clock Channel index - * - * \return The enabled status. - * \retval true The Generic Clock channel is enabled - * \retval false The Generic Clock channel is disabled - */ -bool system_gclk_chan_is_enabled( - const uint8_t channel) -{ - bool enabled; - - system_interrupt_enter_critical_section(); - - /* Select the requested generic clock channel */ - *((uint8_t*)&GCLK->CLKCTRL.reg) = channel; - enabled = GCLK->CLKCTRL.bit.CLKEN; - - system_interrupt_leave_critical_section(); - - return enabled; -} - -/** - * \brief Locks a Generic Clock channel from further configuration writes. - * - * Locks a generic clock channel from further configuration writes. It is only - * possible to unlock the channel configuration through a power on reset. - * - * \param[in] channel Generic Clock channel to enable - */ -void system_gclk_chan_lock( - const uint8_t channel) -{ - system_interrupt_enter_critical_section(); - - /* Select the requested generator channel */ - *((uint8_t*)&GCLK->CLKCTRL.reg) = channel; - - /* Lock the generic clock */ - GCLK->CLKCTRL.reg |= GCLK_CLKCTRL_WRTLOCK | GCLK_CLKCTRL_CLKEN; - - system_interrupt_leave_critical_section(); -} - -/** - * \brief Determins if the specified Generic Clock channel is locked. - * - * \param[in] channel Generic Clock Channel index - * - * \return The lock status. - * \retval true The Generic Clock channel is locked - * \retval false The Generic Clock channel is not locked - */ -bool system_gclk_chan_is_locked( - const uint8_t channel) -{ - bool locked; - - system_interrupt_enter_critical_section(); - - /* Select the requested generic clock channel */ - *((uint8_t*)&GCLK->CLKCTRL.reg) = channel; - locked = GCLK->CLKCTRL.bit.WRTLOCK; - - system_interrupt_leave_critical_section(); - - return locked; -} - -/** - * \brief Retrieves the clock frequency of a Generic Clock channel. - * - * Determines the clock frequency (in Hz) of a specified Generic Clock - * channel, used as a source to a device peripheral module. - * - * \param[in] channel Generic Clock Channel index - * - * \return The frequency of the generic clock channel, in Hz. - */ -uint32_t system_gclk_chan_get_hz( - const uint8_t channel) -{ - uint8_t gen_id; - - system_interrupt_enter_critical_section(); - - /* Select the requested generic clock channel */ - *((uint8_t*)&GCLK->CLKCTRL.reg) = channel; - gen_id = GCLK->CLKCTRL.bit.GEN; - - system_interrupt_leave_critical_section(); - - /* Return the clock speed of the associated GCLK generator */ - return system_gclk_gen_get_hz(gen_id); -} diff --git a/atmel-samd/asf/sam0/drivers/system/clock/clock_samd21_r21_da/module_config/conf_clocks.h b/atmel-samd/asf/sam0/drivers/system/clock/clock_samd21_r21_da/module_config/conf_clocks.h deleted file mode 100644 index 17357f7cc..000000000 --- a/atmel-samd/asf/sam0/drivers/system/clock/clock_samd21_r21_da/module_config/conf_clocks.h +++ /dev/null @@ -1,197 +0,0 @@ -/** - * \file - * - * \brief SAM D21/R21/DA0/DA1 Clock configuration - * - * Copyright (C) 2013-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#include <clock.h> - -#ifndef CONF_CLOCKS_H_INCLUDED -# define CONF_CLOCKS_H_INCLUDED - -/* System clock bus configuration */ -# define CONF_CLOCK_FLASH_WAIT_STATES 0 -# define CONF_CLOCK_CPU_DIVIDER SYSTEM_MAIN_CLOCK_DIV_1 -# define CONF_CLOCK_APBA_DIVIDER SYSTEM_MAIN_CLOCK_DIV_1 -# define CONF_CLOCK_APBB_DIVIDER SYSTEM_MAIN_CLOCK_DIV_1 -# define CONF_CLOCK_APBC_DIVIDER SYSTEM_MAIN_CLOCK_DIV_1 - -/* SYSTEM_CLOCK_SOURCE_OSC8M configuration - Internal 8MHz oscillator */ -# define CONF_CLOCK_OSC8M_PRESCALER SYSTEM_OSC8M_DIV_1 -# define CONF_CLOCK_OSC8M_ON_DEMAND true -# define CONF_CLOCK_OSC8M_RUN_IN_STANDBY false - -/* SYSTEM_CLOCK_SOURCE_XOSC configuration - External clock/oscillator */ -# define CONF_CLOCK_XOSC_ENABLE false -# define CONF_CLOCK_XOSC_EXTERNAL_CRYSTAL SYSTEM_CLOCK_EXTERNAL_CRYSTAL -# define CONF_CLOCK_XOSC_EXTERNAL_FREQUENCY 12000000UL -# define CONF_CLOCK_XOSC_STARTUP_TIME SYSTEM_XOSC_STARTUP_32768 -# define CONF_CLOCK_XOSC_AUTO_GAIN_CONTROL true -# define CONF_CLOCK_XOSC_ON_DEMAND true -# define CONF_CLOCK_XOSC_RUN_IN_STANDBY false - -/* SYSTEM_CLOCK_SOURCE_XOSC32K configuration - External 32KHz crystal/clock oscillator */ -# define CONF_CLOCK_XOSC32K_ENABLE false -# define CONF_CLOCK_XOSC32K_EXTERNAL_CRYSTAL SYSTEM_CLOCK_EXTERNAL_CRYSTAL -# define CONF_CLOCK_XOSC32K_STARTUP_TIME SYSTEM_XOSC32K_STARTUP_65536 -# define CONF_CLOCK_XOSC32K_AUTO_AMPLITUDE_CONTROL false -# define CONF_CLOCK_XOSC32K_ENABLE_1KHZ_OUPUT false -# define CONF_CLOCK_XOSC32K_ENABLE_32KHZ_OUTPUT true -# define CONF_CLOCK_XOSC32K_ON_DEMAND true -# define CONF_CLOCK_XOSC32K_RUN_IN_STANDBY false - -/* SYSTEM_CLOCK_SOURCE_OSC32K configuration - Internal 32KHz oscillator */ -# define CONF_CLOCK_OSC32K_ENABLE false -# define CONF_CLOCK_OSC32K_STARTUP_TIME SYSTEM_OSC32K_STARTUP_130 -# define CONF_CLOCK_OSC32K_ENABLE_1KHZ_OUTPUT true -# define CONF_CLOCK_OSC32K_ENABLE_32KHZ_OUTPUT true -# define CONF_CLOCK_OSC32K_ON_DEMAND true -# define CONF_CLOCK_OSC32K_RUN_IN_STANDBY false - -/* SYSTEM_CLOCK_SOURCE_DFLL configuration - Digital Frequency Locked Loop */ -# define CONF_CLOCK_DFLL_ENABLE false -# define CONF_CLOCK_DFLL_LOOP_MODE SYSTEM_CLOCK_DFLL_LOOP_MODE_OPEN -# define CONF_CLOCK_DFLL_ON_DEMAND false - -/* DFLL open loop mode configuration */ -# define CONF_CLOCK_DFLL_FINE_VALUE (512) - -/* DFLL closed loop mode configuration */ -# define CONF_CLOCK_DFLL_SOURCE_GCLK_GENERATOR GCLK_GENERATOR_1 -# define CONF_CLOCK_DFLL_MULTIPLY_FACTOR 1465 //(48000000 / 32768) -# define CONF_CLOCK_DFLL_QUICK_LOCK true -# define CONF_CLOCK_DFLL_TRACK_AFTER_FINE_LOCK true -# define CONF_CLOCK_DFLL_KEEP_LOCK_ON_WAKEUP true -# define CONF_CLOCK_DFLL_ENABLE_CHILL_CYCLE true -# define CONF_CLOCK_DFLL_MAX_COARSE_STEP_SIZE (0x1f / 4) -# define CONF_CLOCK_DFLL_MAX_FINE_STEP_SIZE (0xff / 4) - -/* SYSTEM_CLOCK_SOURCE_DPLL configuration - Digital Phase-Locked Loop */ -# define CONF_CLOCK_DPLL_ENABLE false -# define CONF_CLOCK_DPLL_ON_DEMAND true -# define CONF_CLOCK_DPLL_RUN_IN_STANDBY false -# define CONF_CLOCK_DPLL_LOCK_BYPASS false -# define CONF_CLOCK_DPLL_WAKE_UP_FAST false -# define CONF_CLOCK_DPLL_LOW_POWER_ENABLE false - -# define CONF_CLOCK_DPLL_LOCK_TIME SYSTEM_CLOCK_SOURCE_DPLL_LOCK_TIME_DEFAULT -# define CONF_CLOCK_DPLL_REFERENCE_CLOCK SYSTEM_CLOCK_SOURCE_DPLL_REFERENCE_CLOCK_XOSC32K -# define CONF_CLOCK_DPLL_FILTER SYSTEM_CLOCK_SOURCE_DPLL_FILTER_DEFAULT - -# define CONF_CLOCK_DPLL_REFERENCE_FREQUENCY 32768 -# define CONF_CLOCK_DPLL_REFERENCE_DIVIDER 1 -# define CONF_CLOCK_DPLL_OUTPUT_FREQUENCY 48000000 - -/* DPLL GCLK reference configuration */ -# define CONF_CLOCK_DPLL_REFERENCE_GCLK_GENERATOR GCLK_GENERATOR_1 -/* DPLL GCLK lock timer configuration */ -# define CONF_CLOCK_DPLL_LOCK_GCLK_GENERATOR GCLK_GENERATOR_1 - -/* Set this to true to configure the GCLK when running clocks_init. If set to - * false, none of the GCLK generators will be configured in clocks_init(). */ -# define CONF_CLOCK_CONFIGURE_GCLK true - -/* Configure GCLK generator 0 (Main Clock) */ -# define CONF_CLOCK_GCLK_0_ENABLE true -# define CONF_CLOCK_GCLK_0_RUN_IN_STANDBY false -# define CONF_CLOCK_GCLK_0_CLOCK_SOURCE SYSTEM_CLOCK_SOURCE_OSC8M -# define CONF_CLOCK_GCLK_0_PRESCALER 1 -# define CONF_CLOCK_GCLK_0_OUTPUT_ENABLE false - -/* Configure GCLK generator 1 */ -# define CONF_CLOCK_GCLK_1_ENABLE false -# define CONF_CLOCK_GCLK_1_RUN_IN_STANDBY false -# define CONF_CLOCK_GCLK_1_CLOCK_SOURCE SYSTEM_CLOCK_SOURCE_XOSC32K -# define CONF_CLOCK_GCLK_1_PRESCALER 1 -# define CONF_CLOCK_GCLK_1_OUTPUT_ENABLE false - -/* Configure GCLK generator 2 (RTC) */ -# define CONF_CLOCK_GCLK_2_ENABLE false -# define CONF_CLOCK_GCLK_2_RUN_IN_STANDBY false -# define CONF_CLOCK_GCLK_2_CLOCK_SOURCE SYSTEM_CLOCK_SOURCE_OSC32K -# define CONF_CLOCK_GCLK_2_PRESCALER 32 -# define CONF_CLOCK_GCLK_2_OUTPUT_ENABLE false - -/* Configure GCLK generator 3 */ -# define CONF_CLOCK_GCLK_3_ENABLE false -# define CONF_CLOCK_GCLK_3_RUN_IN_STANDBY false -# define CONF_CLOCK_GCLK_3_CLOCK_SOURCE SYSTEM_CLOCK_SOURCE_OSC8M -# define CONF_CLOCK_GCLK_3_PRESCALER 1 -# define CONF_CLOCK_GCLK_3_OUTPUT_ENABLE false - -/* Configure GCLK generator 4 */ -# define CONF_CLOCK_GCLK_4_ENABLE false -# define CONF_CLOCK_GCLK_4_RUN_IN_STANDBY false -# define CONF_CLOCK_GCLK_4_CLOCK_SOURCE SYSTEM_CLOCK_SOURCE_OSC8M -# define CONF_CLOCK_GCLK_4_PRESCALER 1 -# define CONF_CLOCK_GCLK_4_OUTPUT_ENABLE false - -/* Configure GCLK generator 5 */ -# define CONF_CLOCK_GCLK_5_ENABLE false -# define CONF_CLOCK_GCLK_5_RUN_IN_STANDBY false -# define CONF_CLOCK_GCLK_5_CLOCK_SOURCE SYSTEM_CLOCK_SOURCE_OSC8M -# define CONF_CLOCK_GCLK_5_PRESCALER 1 -# define CONF_CLOCK_GCLK_5_OUTPUT_ENABLE false - -/* Configure GCLK generator 6 */ -# define CONF_CLOCK_GCLK_6_ENABLE false -# define CONF_CLOCK_GCLK_6_RUN_IN_STANDBY false -# define CONF_CLOCK_GCLK_6_CLOCK_SOURCE SYSTEM_CLOCK_SOURCE_OSC8M -# define CONF_CLOCK_GCLK_6_PRESCALER 1 -# define CONF_CLOCK_GCLK_6_OUTPUT_ENABLE false - -/* Configure GCLK generator 7 */ -# define CONF_CLOCK_GCLK_7_ENABLE false -# define CONF_CLOCK_GCLK_7_RUN_IN_STANDBY false -# define CONF_CLOCK_GCLK_7_CLOCK_SOURCE SYSTEM_CLOCK_SOURCE_OSC8M -# define CONF_CLOCK_GCLK_7_PRESCALER 1 -# define CONF_CLOCK_GCLK_7_OUTPUT_ENABLE false - -/* Configure GCLK generator 8 */ -# define CONF_CLOCK_GCLK_8_ENABLE false -# define CONF_CLOCK_GCLK_8_RUN_IN_STANDBY false -# define CONF_CLOCK_GCLK_8_CLOCK_SOURCE SYSTEM_CLOCK_SOURCE_OSC8M -# define CONF_CLOCK_GCLK_8_PRESCALER 1 -# define CONF_CLOCK_GCLK_8_OUTPUT_ENABLE false - -#endif /* CONF_CLOCKS_H_INCLUDED */ - diff --git a/atmel-samd/asf/sam0/drivers/system/clock/gclk.h b/atmel-samd/asf/sam0/drivers/system/clock/gclk.h deleted file mode 100644 index ff26eac9e..000000000 --- a/atmel-samd/asf/sam0/drivers/system/clock/gclk.h +++ /dev/null @@ -1,307 +0,0 @@ -/** - * \file - * - * \brief SAM Generic Clock Driver - * - * Copyright (C) 2012-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef SYSTEM_CLOCK_GCLK_H_INCLUDED -#define SYSTEM_CLOCK_GCLK_H_INCLUDED - -/** - * \addtogroup asfdoc_sam0_system_clock_group - * - * @{ - */ - -#include <compiler.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \brief List of available GCLK generators. - * - * List of Available GCLK generators. This enum is used in the peripheral - * device drivers to select the GCLK generator to be used for its operation. - * - * The number of GCLK generators available is device dependent. - */ -enum gclk_generator { - /** GCLK generator channel 0 */ - GCLK_GENERATOR_0, -#if defined(__DOXYGEN__) || (GCLK_GEN_NUM_MSB > 0) - /** GCLK generator channel 1 */ - GCLK_GENERATOR_1, -#endif -#if defined(__DOXYGEN__) || (GCLK_GEN_NUM_MSB > 1) - /** GCLK generator channel 2 */ - GCLK_GENERATOR_2, -#endif -#if defined(__DOXYGEN__) || (GCLK_GEN_NUM_MSB > 2) - /** GCLK generator channel 3 */ - GCLK_GENERATOR_3, -#endif -#if defined(__DOXYGEN__) || (GCLK_GEN_NUM_MSB > 3) - /** GCLK generator channel 4 */ - GCLK_GENERATOR_4, -#endif -#if defined(__DOXYGEN__) || (GCLK_GEN_NUM_MSB > 4) - /** GCLK generator channel 5 */ - GCLK_GENERATOR_5, -#endif -#if defined(__DOXYGEN__) || (GCLK_GEN_NUM_MSB > 5) - /** GCLK generator channel 6 */ - GCLK_GENERATOR_6, -#endif -#if defined(__DOXYGEN__) || (GCLK_GEN_NUM_MSB > 6) - /** GCLK generator channel 7 */ - GCLK_GENERATOR_7, -#endif -#if defined(__DOXYGEN__) || (GCLK_GEN_NUM_MSB > 7) - /** GCLK generator channel 8 */ - GCLK_GENERATOR_8, -#endif -#if defined(__DOXYGEN__) || (GCLK_GEN_NUM_MSB > 8) - /** GCLK generator channel 9 */ - GCLK_GENERATOR_9, -#endif -#if defined(__DOXYGEN__) || (GCLK_GEN_NUM_MSB > 9) - /** GCLK generator channel 10 */ - GCLK_GENERATOR_10, -#endif -#if defined(__DOXYGEN__) || (GCLK_GEN_NUM_MSB > 10) - /** GCLK generator channel 11 */ - GCLK_GENERATOR_11, -#endif -#if defined(__DOXYGEN__) || (GCLK_GEN_NUM_MSB > 11) - /** GCLK generator channel 12 */ - GCLK_GENERATOR_12, -#endif -#if defined(__DOXYGEN__) || (GCLK_GEN_NUM_MSB > 12) - /** GCLK generator channel 13 */ - GCLK_GENERATOR_13, -#endif -#if defined(__DOXYGEN__) || (GCLK_GEN_NUM_MSB > 13) - /** GCLK generator channel 14 */ - GCLK_GENERATOR_14, -#endif -#if defined(__DOXYGEN__) || (GCLK_GEN_NUM_MSB > 14) - /** GCLK generator channel 15 */ - GCLK_GENERATOR_15, -#endif -#if defined(__DOXYGEN__) || (GCLK_GEN_NUM_MSB > 15) - /** GCLK generator channel 16 */ - GCLK_GENERATOR_16, -#endif -}; - -/** - * \brief Generic Clock Generator configuration structure. - * - * Configuration structure for a Generic Clock Generator channel. This - * structure should be initialized by the - * \ref system_gclk_gen_get_config_defaults() function before being modified by - * the user application. - */ -struct system_gclk_gen_config { - /** Source clock input channel index, see the \ref system_clock_source */ - uint8_t source_clock; - /** If \c true, the generator output level is high when disabled */ - bool high_when_disabled; - /** Integer division factor of the clock output compared to the input */ - uint32_t division_factor; - /** If \c true, the clock is kept enabled during device standby mode */ - bool run_in_standby; - /** If \c true, enables GCLK generator clock output to a GPIO pin */ - bool output_enable; -}; - -/** - * \brief Generic Clock configuration structure. - * - * Configuration structure for a Generic Clock channel. This structure - * should be initialized by the \ref system_gclk_chan_get_config_defaults() - * function before being modified by the user application. - */ -struct system_gclk_chan_config { - /** Generic Clock Generator source channel */ - enum gclk_generator source_generator; -}; - -/** \name Generic Clock Management - * @{ - */ -void system_gclk_init(void); - -/** @} */ - - -/** - * \name Generic Clock Management (Generators) - * @{ - */ - -/** - * \brief Initializes a Generic Clock Generator configuration structure to defaults. - * - * Initializes a given Generic Clock Generator configuration structure to - * a set of known default values. This function should be called on all - * new instances of these configuration structures before being modified - * by the user application. - * - * The default configuration is: - * \li The clock is generated undivided from the source frequency - * \li The clock generator output is low when the generator is disabled - * \li The input clock is sourced from input clock channel 0 - * \li The clock will be disabled during sleep - * \li The clock output will not be routed to a physical GPIO pin - * - * \param[out] config Configuration structure to initialize to default values - */ -static inline void system_gclk_gen_get_config_defaults( - struct system_gclk_gen_config *const config) -{ - /* Sanity check arguments */ - Assert(config); - - /* Default configuration values */ - config->division_factor = 1; - config->high_when_disabled = false; -#if SAML21 || SAML22 || SAMR30 - config->source_clock = GCLK_SOURCE_OSC16M; -#elif (SAMC20) || (SAMC21) - config->source_clock = GCLK_SOURCE_OSC48M; -#else - config->source_clock = GCLK_SOURCE_OSC8M; -#endif - config->run_in_standby = false; - config->output_enable = false; -} - -void system_gclk_gen_set_config( - const uint8_t generator, - struct system_gclk_gen_config *const config); - -void system_gclk_gen_enable( - const uint8_t generator); - -void system_gclk_gen_disable( - const uint8_t generator); - -bool system_gclk_gen_is_enabled( - const uint8_t generator); - -/** @} */ - - -/** - * \name Generic Clock Management (Channels) - * @{ - */ - -/** - * \brief Initializes a Generic Clock configuration structure to defaults. - * - * Initializes a given Generic Clock configuration structure to a set of - * known default values. This function should be called on all new - * instances of these configuration structures before being modified by the - * user application. - * - * The default configuration is as follows: - * \li The clock is sourced from the Generic Clock Generator channel 0 - * \li The clock configuration will not be write-locked when set - * - * \param[out] config Configuration structure to initialize to default values - */ -static inline void system_gclk_chan_get_config_defaults( - struct system_gclk_chan_config *const config) -{ - /* Sanity check arguments */ - Assert(config); - - /* Default configuration values */ - config->source_generator = GCLK_GENERATOR_0; -} - -void system_gclk_chan_set_config( - const uint8_t channel, - struct system_gclk_chan_config *const config); - -void system_gclk_chan_enable( - const uint8_t channel); - -void system_gclk_chan_disable( - const uint8_t channel); - -bool system_gclk_chan_is_enabled( - const uint8_t channel); - -void system_gclk_chan_lock( - const uint8_t channel); - -bool system_gclk_chan_is_locked( - const uint8_t channel); - -/** @} */ - - -/** - * \name Generic Clock Frequency Retrieval - * @{ - */ - -uint32_t system_gclk_gen_get_hz( - const uint8_t generator); - -uint32_t system_gclk_chan_get_hz( - const uint8_t channel); - -/** @} */ - -#ifdef __cplusplus -} -#endif - -/** @} */ - -#endif diff --git a/atmel-samd/asf/sam0/drivers/system/docimg/performance_level_transition.svg b/atmel-samd/asf/sam0/drivers/system/docimg/performance_level_transition.svg deleted file mode 100644 index e0c86a627..000000000 --- a/atmel-samd/asf/sam0/drivers/system/docimg/performance_level_transition.svg +++ /dev/null @@ -1,1006 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> - -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - id="svg2985" - version="1.1" - inkscape:version="0.48.4 r9939" - width="662" - height="650" - sodipodi:docname="performance_level_transition.png"> - <metadata - id="metadata2991"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> - </cc:Work> - </rdf:RDF> - </metadata> - <defs - id="defs2989" /> - <sodipodi:namedview - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1" - objecttolerance="10" - gridtolerance="10" - guidetolerance="10" - inkscape:pageopacity="0" - inkscape:pageshadow="2" - inkscape:window-width="971" - inkscape:window-height="1060" - id="namedview2987" - showgrid="false" - inkscape:zoom="0.36307692" - inkscape:cx="331" - inkscape:cy="325" - inkscape:window-x="0" - inkscape:window-y="100" - inkscape:window-maximized="0" - inkscape:current-layer="svg2985" /> - <image - width="662" - height="650" - xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAApYAAAKKCAYAAACH5hvqAAAABHNCSVQICAgIfAhkiAAAIABJREFU -eJzs3Xd8lfX5//HXffZJTvbem4QQAmFDmLJE0Kpg66LWUa2jtfXXinW1jq+2to5Wra1WLC1OBBcq -iqAoQ/YIBMgAkpBA9h5n3r8/gBggCevAScL1fDziA845932u+0ju874/1/25b0VVVZVewuVyYbPZ -aGxspLW1lUOHDlFVVUVlZSUVFRXU1tbidDqpr69n3bp1KIqC0WhEURQAjEYjWq222/dwOBzYbLb2 -v7e0tKCqKgMHDiQ2Nhaz2YxWqyUuLg4/Pz8iIiIICQnBYrFgNpvx8vJCo9Gc189BCCGEEKInUnpy -sFRVlaamJsrLy9m7dy+5ubkcOnSIiooKAgICqKmpQVEUgoODsVgsBAQEkJmZiZeXF/7+/hgMBnx9 -fdvDpI+PDwaDodv3tFqtNDU1tf+9srISVVVpbGykvr6e4uJiioqKqKura3+dj48PFRUVBAYGEhkZ -yeDBg4mJiSE2NpaAgIDz9wEJIYQQQvQg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//vr/zykrgO -H0wrW5Y8SlaUT+frNoZx5zs7udDzwq1WK++99x4TJ06UYCmEEEKIHuGcGr6jRo3io48+YunSpdx1 -111uuUh6SP9x/OK3kQxNCe5kio6CKXYcDz1/Px/t88Zms6H1D2bSVbeiSznc9UpNAQwbHHHkLj0a -EymT5vJK2kR2blnNyrW7aQP8okZy6cyRpESFYm6f5e1D9vV388DI7q4TaWZYeshJtepDM7jzl3cS -OzT66CQg93G5XCxdupSDBw/y6KOPunntQgghhBBnR1HPoY/tcrn48ssvefzxx1mwYAEpKSnurK1b -KhwX5rrdDEXpJKS2L3hkXd2E4u4/ogs/iWfXrl3ceeed/O53v+Pyyy+/sG8uhBBCCNGFc2qFazQa -pk+fzl133cXNN9/M6tWrcTgc7qqtWydmuc5mg7f/dLsi5ZQjrd2u+wKHytzcXB577DFmzZrF9OnT -L+ybCyGEEEJ045yCJRwJXddeey2zZ8/m6aefZt26de6oS5zA5XJRUFDA448/TmpqKrfeeisGg+HU -CwohhBBCXCDnHCwBdDodt912G5MnT+bBBx9k1apV7litOMrlcrFhwwbuvfdeEhMTue+++wgKCvJ0 -WUIIIYQQxzmncyxPZLfbWbVqFY8//jiXXnop1157rVxj8Ry4XC5qampYtGgRb731FjfddBM//elP -ZaRSCCGEED2SW4PlMevWreO1116jvr6eO+64g7Fjx+Ll5eXut+nTrFYrq1ev5s0338RqtXL77bcz -ZswY9PoTbysphBBCCNEznJdg6XK5qKysZOnSpSxYsICBAwdy++23k5mZ6ZZLEvV1JSUlvPLKK6xb -t45p06Yxd+5coqKi5LMTQgghRI92XoLlMaqqcujQIV555RU+/PBDJk+ezOzZs0lPT5dzBDtwuVw0 -NTWxd+9ePv74Y1atWsXkyZO56aabiI2NRaNxy6mw50xVVdra2qioqKCoqIi0tDS5OHuPYaN89y72 -1bW1P6IxeBEem0h0kAXV1sD+ohoCY6IJ8jp51NvZ1khZaQllFfWoipmo5CTCAy3oNdBcWUJBQSkt -HV6vaHzoNyidQJMGVDu1h8s4W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qardeytTRU/h1 -Vibe8Fqc3ecihl3cmrrhLgzA6gogLMKD45DhcosnmnNvvYhdr3zPuB+W0eTWdgTXbcItz97MLz/8 -xo//XkAmENqyC7c83I6WzWrjsBqAicUZQGRUBfYzfE0Tn8/H5s2bmTBhAm+//TaZmZn/8TD3jBkz -mDFjxkmsUuRoCpYiIvs0adLE3yWcNPbQOAY/9SiDjur1Mw70THraduPxNhz7bhyLi4YXX81rAziw -v80TSuNOXWjcsQu377uN58hMXqt9L55qx1GvB9dpyF2vNsQ09p/OQlBiCgNuT+Gi2647qrZ9RRDe -shevv3d0e2cawzAICAggISGBVq1asXbtWlasWKH5k/8lh8NB165dz8g/GqsbBUs5qYYMGUKXLl38 -XYbI33Luueee2R88Bhgnuof7RJuPtf0E7R73LTWOfboT/T84k/8X7WcYBrGxsfTv359evXqxefNm -FixYwLx585g4cSKrV68+YRvXXXcdHTt2PAXVVn9Op5Orr77a32XUCAqWclJ16dJFwVJE5H8QEBBA -WloaqampXHjhhdx1112sXLmS7777jvHjx1NcXExBQcFRcy47duzIkCFD/FS11FQKliIiIqcBwzDw -eDx4PB6SkpI455xzePLJJ5k7dy5jxow5MFxeUFDg71KlBlOwFBEROQ1ZLBbi4uK44IIL6NWrF1u2 -bGH+/PksWLCAn3766cye1iHVloKliIjIac7tdpOWlkaDBg246KKLuPPOOwkODvZ3WVIDKViKiIic -ISwWCx6Ph+TkZH+XIjXUGb4SmIiIiIicKgqWIiIiIlIlFCxFREREpEooWIqIiIhIlVCwFBEREZEq -oWApIiIiIlVCwVJEREREqoSCpYiIiIhUCQVLEREREakSCpYiIiIiUiUULEVERKqAz2cCYBiGnysR -8R8FSxGRk8xqteJwOCgtLfd3KXIS5ebkg2khJCTE36WI+I2CpYjISeZwOAgODmZ3Rg6mafq7HDlJ -MjNySUpKwul0+rsUEb9RsBQROckCAgKIjY0lY2e2v0uRk8Q0TZYvXUf7dh00FC41moKliMhJZhgG -Xbt2Yff2QirKKvxdjpwEhYXFrF6+gebN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GQMkz9NBYRKRH8fj8fz/uY8U89SZvLLuGKPh2olFw+1GXJGXg8hWz4ZiszX/+IVi068vjj -T5AQnxDqskRCTsFSRKSEWbRoES+/8iKHj+zjT1d3oHnr+rgjtR5iSeD3+9m7+wCz3vmMjJ2HGdAv -jZtuGkxcXFyoSxMpERQsRURKmEAgwL79+/j4o495fdrLxCa4uOqaLjRrXR+H3Q7qIg860zTZtSOD -z+Z9zZcLVtCndz/SBl5P06ZNcTqdoS5PpMRQsBQRKcGysrL45NNPmPmvmfx8cB9N29ShStUKVE6p -SHz5WGw2GxFuBZvi5Pf5KSgoosBTyN49mez6MYOfdh0kY3c2rVu2ZtSoUdSqVUvLCYmcgYKliEgY -yMrKYv369SxfsZxdO3dxJDeHyGgbh3OyyM7JAn2TFxvDsFKjek28hQEKPQGSk5Np1qwp7dt3oEqV -Klit1lCXKFJiKViKiIQRv99Pfn4+eXl55OfncfToUbKzs7VEUTGy2+1UrJiEw2EnIsJNdHS0urtF -LpCCpYiIiIgUCw0QEREREZFioWApIiIiIsVCwVJEREREioWCpYiIiIgUCwVLERERESkW/w/6+1BI -j+TWxQAAAABJRU5ErkJggg== -" - id="image2993" - x="0" - y="0" /> -</svg> diff --git a/atmel-samd/asf/sam0/drivers/system/interrupt/system_interrupt.c b/atmel-samd/asf/sam0/drivers/system/interrupt/system_interrupt.c deleted file mode 100644 index 24ee27ffa..000000000 --- a/atmel-samd/asf/sam0/drivers/system/interrupt/system_interrupt.c +++ /dev/null @@ -1,217 +0,0 @@ -/** - * \file - * - * \brief SAM System Interrupt Driver - * - * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#include "system_interrupt.h" - -/** - * \brief Check if a interrupt line is pending. - * - * Checks if the requested interrupt vector is pending. - * - * \param[in] vector Interrupt vector number to check - * - * \returns A boolean identifying if the requested interrupt vector is pending. - * - * \retval true Specified interrupt vector is pending - * \retval false Specified interrupt vector is not pending - * - */ -bool system_interrupt_is_pending( - const enum system_interrupt_vector vector) -{ - bool result; - - if (vector >= _SYSTEM_INTERRUPT_EXTERNAL_VECTOR_START) { - result = ((NVIC->ISPR[0] & (1 << vector)) != 0); - } else if (vector == SYSTEM_INTERRUPT_SYSTICK) { - result = ((SCB->ICSR & SCB_ICSR_PENDSTSET_Msk) != 0); - } else { - Assert(false); - result = false; - } - - return result; -} - -/** - * \brief Set a interrupt vector as pending. - * - * Set the requested interrupt vector as pending (i.e. issues a software - * interrupt request for the specified vector). The software handler will be - * handled (if enabled) in a priority order based on vector number and - * configured priority settings. - * - * \param[in] vector Interrupt vector number which is set as pending - * - * \returns Status code identifying if the vector was successfully set as - * pending. - * - * \retval STATUS_OK If no error was detected - * \retval STATUS_INVALID_ARG If an unsupported interrupt vector number was given - */ -enum status_code system_interrupt_set_pending( - const enum system_interrupt_vector vector) -{ - enum status_code status = STATUS_OK; - - if (vector >= _SYSTEM_INTERRUPT_EXTERNAL_VECTOR_START) { - NVIC->ISPR[0] = (1 << vector); - } else if (vector == SYSTEM_INTERRUPT_NON_MASKABLE) { - /* Note: Because NMI has highest priority it will be executed - * immediately after it has been set pending */ - SCB->ICSR = SCB_ICSR_NMIPENDSET_Msk; - } else if (vector == SYSTEM_INTERRUPT_SYSTICK) { - SCB->ICSR = SCB_ICSR_PENDSTSET_Msk; - } else { - /* The user want to set something unsupported as pending */ - Assert(false); - status = STATUS_ERR_INVALID_ARG; - } - - return status; -} - -/** - * \brief Clear pending interrupt vector. - * - * Clear a pending interrupt vector, so the software handler is not executed. - * - * \param[in] vector Interrupt vector number to clear - * - * \returns A status code identifying if the interrupt pending state was - * successfully cleared. - * - * \retval STATUS_OK If no error was detected - * \retval STATUS_INVALID_ARG If an unsupported interrupt vector number was given - */ -enum status_code system_interrupt_clear_pending( - const enum system_interrupt_vector vector) -{ - enum status_code status = STATUS_OK; - - if (vector >= _SYSTEM_INTERRUPT_EXTERNAL_VECTOR_START) { - NVIC->ICPR[0] = (1 << vector); - } else if (vector == SYSTEM_INTERRUPT_NON_MASKABLE) { - /* Note: Clearing of NMI pending interrupts does not make sense and is - * not supported by the device, as it has the highest priority and will - * always be executed at the moment it is set */ - return STATUS_ERR_INVALID_ARG; - } else if (vector == SYSTEM_INTERRUPT_SYSTICK) { - SCB->ICSR = SCB_ICSR_PENDSTCLR_Msk; - } else { - Assert(false); - status = STATUS_ERR_INVALID_ARG; - } - - return status; -} - -/** - * \brief Set interrupt vector priority level. - * - * Set the priority level of an external interrupt or exception. - * - * \param[in] vector Interrupt vector to change - * \param[in] priority_level New vector priority level to set - * - * \returns Status code indicating if the priority level of the interrupt was - * successfully set. - * - * \retval STATUS_OK If no error was detected - * \retval STATUS_INVALID_ARG If an unsupported interrupt vector number was given - */ -enum status_code system_interrupt_set_priority( - const enum system_interrupt_vector vector, - const enum system_interrupt_priority_level priority_level) -{ - enum status_code status = STATUS_OK; - - if (vector >= _SYSTEM_INTERRUPT_EXTERNAL_VECTOR_START) { - uint8_t register_num = vector / 4; - uint8_t priority_pos = ((vector % 4) * 8) + (8 - __NVIC_PRIO_BITS); - - NVIC->IP[register_num] = - (NVIC->IP[register_num] & ~(_SYSTEM_INTERRUPT_PRIORITY_MASK << priority_pos)) | - (priority_level << priority_pos); - - } else if (vector == SYSTEM_INTERRUPT_SYSTICK) { - SCB->SHP[1] = (priority_level << _SYSTEM_INTERRUPT_SYSTICK_PRI_POS); - } else { - Assert(false); - status = STATUS_ERR_INVALID_ARG; - } - - return status; -} - -/** - * \brief Get interrupt vector priority level. - * - * Retrieves the priority level of the requested external interrupt or exception. - * - * \param[in] vector Interrupt vector of which the priority level will be read - * - * \return Currently configured interrupt priority level of the given interrupt - * vector. - */ -enum system_interrupt_priority_level system_interrupt_get_priority( - const enum system_interrupt_vector vector) -{ - uint8_t register_num = vector / 4; - uint8_t priority_pos = ((vector % 4) * 8) + (8 - __NVIC_PRIO_BITS); - - enum system_interrupt_priority_level priority = SYSTEM_INTERRUPT_PRIORITY_LEVEL_0; - - if (vector >= 0) { - priority = (enum system_interrupt_priority_level) - ((NVIC->IP[register_num] >> priority_pos) & _SYSTEM_INTERRUPT_PRIORITY_MASK); - } else if (vector == SYSTEM_INTERRUPT_SYSTICK) { - priority = (enum system_interrupt_priority_level) - ((SCB->SHP[1] >> _SYSTEM_INTERRUPT_SYSTICK_PRI_POS) & _SYSTEM_INTERRUPT_PRIORITY_MASK); - } - - return priority; -} - diff --git a/atmel-samd/asf/sam0/drivers/system/interrupt/system_interrupt.h b/atmel-samd/asf/sam0/drivers/system/interrupt/system_interrupt.h deleted file mode 100644 index 0b7834369..000000000 --- a/atmel-samd/asf/sam0/drivers/system/interrupt/system_interrupt.h +++ /dev/null @@ -1,429 +0,0 @@ -/** - * \file - * - * \brief SAM System Interrupt Driver - * - * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef SYSTEM_INTERRUPT_H_INCLUDED -#define SYSTEM_INTERRUPT_H_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \defgroup asfdoc_sam0_system_interrupt_group SAM System Interrupt (SYSTEM INTERRUPT) Driver - * - * This driver for Atmel® | SMART ARM®-based microcontrollers provides - * an interface for the configuration and management of internal software and - * hardware interrupts/exceptions. - * - * The following peripheral is used by this module: - * - NVIC (Nested Vector Interrupt Controller) - * - * The following devices can use this module: - * - Atmel | SMART SAM D20/D21 - * - Atmel | SMART SAM R21 - * - Atmel | SMART SAM D09/D10/D11 - * - Atmel | SMART SAM L21/L22 - * - Atmel | SMART SAM DA1 - * - Atmel | SMART SAM C20/C21 - * - * The outline of this documentation is as follows: - * - \ref asfdoc_sam0_system_interrupt_prerequisites - * - \ref asfdoc_sam0_system_interrupt_module_overview - * - \ref asfdoc_sam0_system_interrupt_special_considerations - * - \ref asfdoc_sam0_system_interrupt_extra_info - * - \ref asfdoc_sam0_system_interrupt_examples - * - \ref asfdoc_sam0_system_interrupt_api_overview - * - * - * \section asfdoc_sam0_system_interrupt_prerequisites Prerequisites - * - * There are no prerequisites for this module. - * - * - * \section asfdoc_sam0_system_interrupt_module_overview Module Overview - * - * The ARM® Cortex® M0+ core contains an interrupt and exception vector table, which - * can be used to configure the device's interrupt handlers; individual - * interrupts and exceptions can be enabled and disabled, as well as configured - * with a variable priority. - * - * This driver provides a set of wrappers around the core interrupt functions, - * to expose a simple API for the management of global and individual interrupts - * within the device. - * - * \subsection asfdoc_sam0_system_interrupt_module_overview_criticalsec Critical Sections - * In some applications it is important to ensure that no interrupts may be - * executed by the system whilst a critical portion of code is being run; for - * example, a buffer may be copied from one context to another - during which - * interrupts must be disabled to avoid corruption of the source buffer contents - * until the copy has completed. This driver provides a basic API to enter and - * exit nested critical sections, so that global interrupts can be kept disabled - * for as long as necessary to complete a critical application code section. - * - * \subsection asfdoc_sam0_system_interrupt_module_overview_softints Software Interrupts - * For some applications, it may be desirable to raise a module or core - * interrupt via software. For this reason, a set of APIs to set an interrupt or - * exception as pending are provided to the user application. - * - * \section asfdoc_sam0_system_interrupt_special_considerations Special Considerations - * - * Interrupts from peripherals in the SAM devices are on a per-module basis; - * an interrupt raised from any source within a module will cause a single, - * module-common handler to execute. It is the user application or driver's - * responsibility to de-multiplex the module-common interrupt to determine the - * exact interrupt cause. - * - * \section asfdoc_sam0_system_interrupt_extra_info Extra Information - * - * For extra information, see \ref asfdoc_sam0_system_interrupt_extra. This includes: - * - \ref asfdoc_sam0_system_interrupt_extra_acronyms - * - \ref asfdoc_sam0_system_interrupt_extra_dependencies - * - \ref asfdoc_sam0_system_interrupt_extra_errata - * - \ref asfdoc_sam0_system_interrupt_extra_history - * - * - * \section asfdoc_sam0_system_interrupt_examples Examples - * - * For a list of examples related to this driver, see - * \ref asfdoc_sam0_system_interrupt_exqsg. - * - * \section asfdoc_sam0_system_interrupt_api_overview API Overview - * @{ - */ - -#include <compiler.h> -#include <core_cm0plus.h> -#include "system_interrupt_features.h" - -/** - * \brief Table of possible system interrupt/exception vector priorities. - * - * Table of all possible interrupt and exception vector priorities within the - * device. - */ -enum system_interrupt_priority_level { - /** Priority level 0, the highest possible interrupt priority */ - SYSTEM_INTERRUPT_PRIORITY_LEVEL_0 = 0, - /** Priority level 1 */ - SYSTEM_INTERRUPT_PRIORITY_LEVEL_1 = 1, - /** Priority level 2 */ - SYSTEM_INTERRUPT_PRIORITY_LEVEL_2 = 2, - /** Priority level 3, the lowest possible interrupt priority */ - SYSTEM_INTERRUPT_PRIORITY_LEVEL_3 = 3, -}; - -/** - * \name Critical Section Management - * @{ - */ - -/** - * \brief Enters a critical section. - * - * Disables global interrupts. To support nested critical sections, an internal - * count of the critical section nesting will be kept, so that global interrupts - * are only re-enabled upon leaving the outermost nested critical section. - * - */ -static inline void system_interrupt_enter_critical_section(void) -{ - cpu_irq_enter_critical(); -} - -/** - * \brief Leaves a critical section. - * - * Enables global interrupts. To support nested critical sections, an internal - * count of the critical section nesting will be kept, so that global interrupts - * are only re-enabled upon leaving the outermost nested critical section. - * - */ -static inline void system_interrupt_leave_critical_section(void) -{ - cpu_irq_leave_critical(); -} - -/** @} */ - -/** - * \name Interrupt Enabling/Disabling - * @{ - */ - -/** - * \brief Check if global interrupts are enabled. - * - * Checks if global interrupts are currently enabled. - * - * \returns A boolean that identifies if the global interrupts are enabled or not. - * - * \retval true Global interrupts are currently enabled - * \retval false Global interrupts are currently disabled - * - */ -static inline bool system_interrupt_is_global_enabled(void) -{ - return cpu_irq_is_enabled(); -} - -/** - * \brief Enables global interrupts. - * - * Enables global interrupts in the device to fire any enabled interrupt handlers. - */ -static inline void system_interrupt_enable_global(void) -{ - cpu_irq_enable(); -} - -/** - * \brief Disables global interrupts. - * - * Disabled global interrupts in the device, preventing any enabled interrupt - * handlers from executing. - */ -static inline void system_interrupt_disable_global(void) -{ - cpu_irq_disable(); -} - -/** - * \brief Checks if an interrupt vector is enabled or not. - * - * Checks if a specific interrupt vector is currently enabled. - * - * \param[in] vector Interrupt vector number to check - * - * \returns A variable identifying if the requested interrupt vector is enabled. - * - * \retval true Specified interrupt vector is currently enabled - * \retval false Specified interrupt vector is currently disabled - * - */ -static inline bool system_interrupt_is_enabled( - const enum system_interrupt_vector vector) -{ - return (bool)((NVIC->ISER[0] >> (uint32_t)vector) & 0x00000001); -} - -/** - * \brief Enable interrupt vector. - * - * Enables execution of the software handler for the requested interrupt vector. - * - * \param[in] vector Interrupt vector to enable - */ -static inline void system_interrupt_enable( - const enum system_interrupt_vector vector) -{ - NVIC->ISER[0] = (uint32_t)(1 << ((uint32_t)vector & 0x0000001f)); -} - -/** - * \brief Disable interrupt vector. - * - * Disables execution of the software handler for the requested interrupt vector. - * - * \param[in] vector Interrupt vector to disable - */ -static inline void system_interrupt_disable( - const enum system_interrupt_vector vector) -{ - NVIC->ICER[0] = (uint32_t)(1 << ((uint32_t)vector & 0x0000001f)); -} - -/** @} */ - -/** - * \name Interrupt State Management - * @{ - */ - -/** - * \brief Get active interrupt (if any). - * - * Return the vector number for the current executing software handler, if any. - * - * \return Interrupt number that is currently executing. - */ -static inline enum system_interrupt_vector system_interrupt_get_active(void) -{ - uint32_t IPSR = __get_IPSR(); - /* The IPSR returns the Exception number, which with an offset 16 to IRQ number. */ - return (enum system_interrupt_vector)((IPSR & _SYSTEM_INTERRUPT_IPSR_MASK) - 16); -} - -bool system_interrupt_is_pending( - const enum system_interrupt_vector vector); - -enum status_code system_interrupt_set_pending( - const enum system_interrupt_vector vector); - -enum status_code system_interrupt_clear_pending( - const enum system_interrupt_vector vector); - -/** @} */ - -/** - * \name Interrupt Priority Management - * @{ - */ - -enum status_code system_interrupt_set_priority( - const enum system_interrupt_vector vector, - const enum system_interrupt_priority_level priority_level); - -enum system_interrupt_priority_level system_interrupt_get_priority( - const enum system_interrupt_vector vector); - -/** @} */ - -/** @} */ - -/** - * \page asfdoc_sam0_system_interrupt_extra Extra Information for SYSTEM INTERRUPT Driver - * - * \section asfdoc_sam0_system_interrupt_extra_acronyms Acronyms - * The table below presents the acronyms used in this module: - * - * <table> - * <tr> - * <th>Acronym</th> - * <th>Description</th> - * </tr> - * <tr> - * <td>ISR</td> - * <td>Interrupt Service Routine</td> - * </tr> - * <tr> - * <td>NMI</td> - * <td>Non-maskable Interrupt</td> - * </tr> - * <tr> - * <td>SERCOM</td> - * <td>Serial Communication Interface</td> - * </tr> - * </table> - * - * - * \section asfdoc_sam0_system_interrupt_extra_dependencies Dependencies - * This driver has the following dependencies: - * - * - None - * - * - * \section asfdoc_sam0_system_interrupt_extra_errata Errata - * There are no errata related to this driver. - * - * - * \section asfdoc_sam0_system_interrupt_extra_history Module History - * An overview of the module history is presented in the table below, with - * details on the enhancements and fixes made to the module since its first - * release. The current version of this corresponds to the newest version in - * the table. - * - * <table> - * <tr> - * <th>Changelog</th> - * </tr> - * <tr> - * <td>Initial Release</td> - * </tr> - * </table> - */ - -/** - * \page asfdoc_sam0_system_interrupt_exqsg Examples for SYSTEM INTERRUPT Driver - * - * This is a list of the available Quick Start guides (QSGs) and example - * applications for \ref asfdoc_sam0_system_interrupt_group. QSGs are simple examples with - * step-by-step instructions to configure and use this driver in a selection of - * use cases. Note that a QSG can be compiled as a standalone application or be - * added to the user application. - * - * - \subpage asfdoc_sam0_system_interrupt_critsec_use_case - * - \subpage asfdoc_sam0_system_interrupt_enablemodint_use_case - * - * \page asfdoc_sam0_system_interrupt_document_revision_history Document Revision History - * - * <table> - * <tr> - * <th>Doc. Rev.</th> - * <th>Date</th> - * <th>Comments</th> - * </tr> - * <tr> - * <td>42122E</td> - * <td>12/2015</td> - * <td>Added support for SAM L21/L22, SAM DA1, SAM D09, and SAM C20/C21</td> - * </tr> - * <tr> - * <td>42122D</td> - * <td>12/2014</td> - * <td>Added support for SAM R21 and SAM D10/D11</td> - * </tr> - * <tr> - * <td>42122C</td> - * <td>01/2014</td> - * <td>Added support for SAM D21</td> - * </tr> - * <tr> - * <td>42122B</td> - * <td>06/2013</td> - * <td>Corrected documentation typos</td> - * </tr> - * <tr> - * <td>42122A</td> - * <td>06/2013</td> - * <td>Initial release</td> - * </tr> - * </table> - */ - -#ifdef __cplusplus -} -#endif - -#endif // #ifndef SYSTEM_INTERRUPT_H_INCLUDED diff --git a/atmel-samd/asf/sam0/drivers/system/interrupt/system_interrupt_samd21/system_interrupt_features.h b/atmel-samd/asf/sam0/drivers/system/interrupt/system_interrupt_samd21/system_interrupt_features.h deleted file mode 100644 index 25dfa838d..000000000 --- a/atmel-samd/asf/sam0/drivers/system/interrupt/system_interrupt_samd21/system_interrupt_features.h +++ /dev/null @@ -1,195 +0,0 @@ -/** - * \file - * - * \brief SAM D21 System Interrupt Driver - * - * Copyright (C) 2013-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef SYSTEM_INTERRUPT_FEATURES_H_INCLUDED -#define SYSTEM_INTERRUPT_FEATURES_H_INCLUDED - -#if !defined(__DOXYGEN__) - -/* Generates a interrupt vector table enum list entry for a given module type - and index (e.g. "SYSTEM_INTERRUPT_MODULE_TC0 = TC0_IRQn,"). */ -# define _MODULE_IRQn(n, module) \ - SYSTEM_INTERRUPT_MODULE_##module##n = module##n##_IRQn, - -/* Generates interrupt vector table enum list entries for all instances of a - given module type on the selected device. */ -# define _SYSTEM_INTERRUPT_MODULES(name) \ - MREPEAT(name##_INST_NUM, _MODULE_IRQn, name) - -# define _SYSTEM_INTERRUPT_IPSR_MASK 0x0000003f -# define _SYSTEM_INTERRUPT_PRIORITY_MASK 0x00000003 - -# define _SYSTEM_INTERRUPT_EXTERNAL_VECTOR_START 0 - -# define _SYSTEM_INTERRUPT_SYSTICK_PRI_POS 30 -#endif - -/** - * \addtogroup asfdoc_sam0_system_interrupt_group - * @{ - */ - -/** - * \brief Table of possible system interrupt/exception vector numbers. - * - * Table of all possible interrupt and exception vector indexes within the - * SAM D21 device. Check peripherals configuration in SAM D21 datasheet for - * available vector index for specific device. - * - */ -#if defined(__DOXYGEN__) -/** \note The actual enumeration name is "system_interrupt_vector". */ -enum system_interrupt_vector_samd21 { -#else -enum system_interrupt_vector { -#endif - /** Interrupt vector index for a NMI interrupt */ - SYSTEM_INTERRUPT_NON_MASKABLE = NonMaskableInt_IRQn, - /** Interrupt vector index for a Hard Fault memory access exception */ - SYSTEM_INTERRUPT_HARD_FAULT = HardFault_IRQn, - /** Interrupt vector index for a Supervisor Call exception */ - SYSTEM_INTERRUPT_SV_CALL = SVCall_IRQn, - /** Interrupt vector index for a Pending Supervisor interrupt */ - SYSTEM_INTERRUPT_PENDING_SV = PendSV_IRQn, - /** Interrupt vector index for a System Tick interrupt */ - SYSTEM_INTERRUPT_SYSTICK = SysTick_IRQn, - - /** Interrupt vector index for a Power Manager peripheral interrupt */ - SYSTEM_INTERRUPT_MODULE_PM = PM_IRQn, - /** Interrupt vector index for a System Control peripheral interrupt */ - SYSTEM_INTERRUPT_MODULE_SYSCTRL = SYSCTRL_IRQn, - /** Interrupt vector index for a Watch Dog peripheral interrupt */ - SYSTEM_INTERRUPT_MODULE_WDT = WDT_IRQn, - /** Interrupt vector index for a Real Time Clock peripheral interrupt */ - SYSTEM_INTERRUPT_MODULE_RTC = RTC_IRQn, - /** Interrupt vector index for an External Interrupt peripheral interrupt */ - SYSTEM_INTERRUPT_MODULE_EIC = EIC_IRQn, - /** Interrupt vector index for a Non Volatile Memory Controller interrupt */ - SYSTEM_INTERRUPT_MODULE_NVMCTRL = NVMCTRL_IRQn, - /** Interrupt vector index for a Direct Memory Access interrupt */ - SYSTEM_INTERRUPT_MODULE_DMA = DMAC_IRQn, -#if defined(__DOXYGEN__) || defined(ID_USB) - /** Interrupt vector index for a Universal Serial Bus interrupt */ - SYSTEM_INTERRUPT_MODULE_USB = USB_IRQn, -#endif - /** Interrupt vector index for an Event System interrupt */ - SYSTEM_INTERRUPT_MODULE_EVSYS = EVSYS_IRQn, -#if defined(__DOXYGEN__) - /** Interrupt vector index for a SERCOM peripheral interrupt. - * - * Each specific device may contain several SERCOM peripherals; each module - * instance will have its own entry in the table, with the instance number - * substituted for "n" in the entry name (e.g. - * \c SYSTEM_INTERRUPT_MODULE_SERCOM0). - */ - SYSTEM_INTERRUPT_MODULE_SERCOMn = SERCOMn_IRQn, - - /** Interrupt vector index for a Timer/Counter Control peripheral interrupt. - * - * Each specific device may contain several TCC peripherals; each module - * instance will have its own entry in the table, with the instance number - * substituted for "n" in the entry name (e.g. - * \c SYSTEM_INTERRUPT_MODULE_TCC0). - */ - SYSTEM_INTERRUPT_MODULE_TCCn = TCCn_IRQn, - - /** Interrupt vector index for a Timer/Counter peripheral interrupt. - * - * Each specific device may contain several TC peripherals; each module - * instance will have its own entry in the table, with the instance number - * substituted for "n" in the entry name (e.g. - * \c SYSTEM_INTERRUPT_MODULE_TC3). - */ - SYSTEM_INTERRUPT_MODULE_TCn = TCn_IRQn, -#else - _SYSTEM_INTERRUPT_MODULES(SERCOM) - - _SYSTEM_INTERRUPT_MODULES(TCC) - - SYSTEM_INTERRUPT_MODULE_TC3 = TC3_IRQn, - SYSTEM_INTERRUPT_MODULE_TC4 = TC4_IRQn, - SYSTEM_INTERRUPT_MODULE_TC5 = TC5_IRQn, -# if defined(ID_TC6) - SYSTEM_INTERRUPT_MODULE_TC6 = TC6_IRQn, -# endif -# if defined(ID_TC7) - SYSTEM_INTERRUPT_MODULE_TC7 = TC7_IRQn, -# endif -#endif - -#if defined(__DOXYGEN__) || defined(ID_ADC) - /** Interrupt vector index for an Analog-to-Digital peripheral interrupt */ - SYSTEM_INTERRUPT_MODULE_ADC = ADC_IRQn, -#endif - -#if defined(__DOXYGEN__) || defined(ID_AC) - /** Interrupt vector index for an Analog Comparator peripheral interrupt */ - SYSTEM_INTERRUPT_MODULE_AC = AC_IRQn, -#endif - -#if defined(__DOXYGEN__) || defined(ID_DAC) - /** Interrupt vector index for a Digital-to-Analog peripheral interrupt */ - SYSTEM_INTERRUPT_MODULE_DAC = DAC_IRQn, -#endif -#if defined(__DOXYGEN__) || defined(ID_PTC) - /** Interrupt vector index for a Peripheral Touch Controller peripheral - * interrupt */ - SYSTEM_INTERRUPT_MODULE_PTC = PTC_IRQn, -#endif -#if defined(__DOXYGEN__) || defined(ID_I2S) - /** Interrupt vector index for a Inter-IC Sound Interface peripheral - * interrupt */ - SYSTEM_INTERRUPT_MODULE_I2S = I2S_IRQn, -#endif -#if defined(__DOXYGEN__) || defined(ID_AC1) - /** Interrupt vector index for an Analog Comparator 1 peripheral interrupt */ - SYSTEM_INTERRUPT_MODULE_AC1 = AC1_IRQn, -#endif -}; - -/** @} */ - -#endif diff --git a/atmel-samd/asf/sam0/drivers/system/pinmux/pinmux.c b/atmel-samd/asf/sam0/drivers/system/pinmux/pinmux.c deleted file mode 100644 index a2c9c7cdc..000000000 --- a/atmel-samd/asf/sam0/drivers/system/pinmux/pinmux.c +++ /dev/null @@ -1,311 +0,0 @@ -/** - * \file - * - * \brief SAM Pin Multiplexer Driver - * - * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#include <pinmux.h> - -/** - * \internal - * Writes out a given configuration of a Port pin configuration to the - * hardware module. - * - * \note If the pin direction is set as an output, the pull-up/pull-down input - * configuration setting is ignored. - * - * \param[in] port Base of the PORT module to configure - * \param[in] pin_mask Mask of the port pin to configure - * \param[in] config Configuration settings for the pin - */ -static void _system_pinmux_config( - PortGroup *const port, - const uint32_t pin_mask, - const struct system_pinmux_config *const config) -{ - Assert(port); - Assert(config); - - /* Track the configuration bits into a temporary variable before writing */ - uint32_t pin_cfg = 0; - - /* Enabled powersave mode, don't create configuration */ - if (!config->powersave) { - /* Enable the pin peripheral MUX flag if non-GPIO selected (pinmux will - * be written later) and store the new MUX mask */ - if (config->mux_position != SYSTEM_PINMUX_GPIO) { - pin_cfg |= PORT_WRCONFIG_PMUXEN; - pin_cfg |= (config->mux_position << PORT_WRCONFIG_PMUX_Pos); - } - - /* Check if the user has requested that the input buffer be enabled */ - if ((config->direction == SYSTEM_PINMUX_PIN_DIR_INPUT) || - (config->direction == SYSTEM_PINMUX_PIN_DIR_OUTPUT_WITH_READBACK)) { - /* Enable input buffer flag */ - pin_cfg |= PORT_WRCONFIG_INEN; - - /* Enable pull-up/pull-down control flag if requested */ - if (config->input_pull != SYSTEM_PINMUX_PIN_PULL_NONE) { - pin_cfg |= PORT_WRCONFIG_PULLEN; - } - - /* Clear the port DIR bits to disable the output buffer */ - port->DIRCLR.reg = pin_mask; - } - - /* Check if the user has requested that the output buffer be enabled */ - if ((config->direction == SYSTEM_PINMUX_PIN_DIR_OUTPUT) || - (config->direction == SYSTEM_PINMUX_PIN_DIR_OUTPUT_WITH_READBACK)) { - /* Cannot use a pull-up if the output driver is enabled, - * if requested the input buffer can only sample the current - * output state */ - pin_cfg &= ~PORT_WRCONFIG_PULLEN; - } - } else { - port->DIRCLR.reg = pin_mask; - } - - /* The Write Configuration register (WRCONFIG) requires the - * pins to to grouped into two 16-bit half-words - split them out here */ - uint32_t lower_pin_mask = (pin_mask & 0xFFFF); - uint32_t upper_pin_mask = (pin_mask >> 16); - - /* Configure the lower 16-bits of the port to the desired configuration, - * including the pin peripheral multiplexer just in case it is enabled */ - port->WRCONFIG.reg - = (lower_pin_mask << PORT_WRCONFIG_PINMASK_Pos) | - pin_cfg | PORT_WRCONFIG_WRPMUX | PORT_WRCONFIG_WRPINCFG; - - /* Configure the upper 16-bits of the port to the desired configuration, - * including the pin peripheral multiplexer just in case it is enabled */ - port->WRCONFIG.reg - = (upper_pin_mask << PORT_WRCONFIG_PINMASK_Pos) | - pin_cfg | PORT_WRCONFIG_WRPMUX | PORT_WRCONFIG_WRPINCFG | - PORT_WRCONFIG_HWSEL; - - if(!config->powersave) { - /* Set the pull-up state once the port pins are configured if one was - * requested and it does not violate the valid set of port - * configurations */ - if (pin_cfg & PORT_WRCONFIG_PULLEN) { - /* Set the OUT register bits to enable the pull-up if requested, - * clear to enable pull-down */ - if (config->input_pull == SYSTEM_PINMUX_PIN_PULL_UP) { - port->OUTSET.reg = pin_mask; - } else { - port->OUTCLR.reg = pin_mask; - } - } - - /* Check if the user has requested that the output buffer be enabled */ - if ((config->direction == SYSTEM_PINMUX_PIN_DIR_OUTPUT) || - (config->direction == SYSTEM_PINMUX_PIN_DIR_OUTPUT_WITH_READBACK)) { - /* Set the port DIR bits to enable the output buffer */ - port->DIRSET.reg = pin_mask; - } - } -} - -/** - * \brief Writes a Port pin configuration to the hardware module. - * - * Writes out a given configuration of a Port pin configuration to the hardware - * module. - * - * \note If the pin direction is set as an output, the pull-up/pull-down input - * configuration setting is ignored. - * - * \param[in] gpio_pin Index of the GPIO pin to configure - * \param[in] config Configuration settings for the pin - */ -void system_pinmux_pin_set_config( - const uint8_t gpio_pin, - const struct system_pinmux_config *const config) -{ - PortGroup *const port = system_pinmux_get_group_from_gpio_pin(gpio_pin); - uint32_t pin_mask = (1UL << (gpio_pin % 32)); - - _system_pinmux_config(port, pin_mask, config); -} - -/** - * \brief Writes a Port pin group configuration to the hardware module. - * - * Writes out a given configuration of a Port pin group configuration to the - * hardware module. - * - * \note If the pin direction is set as an output, the pull-up/pull-down input - * configuration setting is ignored. - * - * \param[in] port Base of the PORT module to configure - * \param[in] mask Mask of the port pin(s) to configure - * \param[in] config Configuration settings for the pin - */ -void system_pinmux_group_set_config( - PortGroup *const port, - const uint32_t mask, - const struct system_pinmux_config *const config) -{ - Assert(port); - - for (int i = 0; i < 32; i++) { - if (mask & (1UL << i)) { - _system_pinmux_config(port, (1UL << i), config); - } - } -} - -/** - * \brief Configures the input sampling mode for a group of pins. - * - * Configures the input sampling mode for a group of pins, to - * control when the physical I/O pin value is sampled and - * stored inside the microcontroller. - * - * \param[in] port Base of the PORT module to configure - * \param[in] mask Mask of the port pin(s) to configure - * \param[in] mode New pin sampling mode to configure - */ -void system_pinmux_group_set_input_sample_mode( - PortGroup *const port, - const uint32_t mask, - const enum system_pinmux_pin_sample mode) -{ - Assert(port); - - if (mode == SYSTEM_PINMUX_PIN_SAMPLE_ONDEMAND) { - port->CTRL.reg |= mask; - } else { - port->CTRL.reg &= ~mask; - } -} - -#ifdef FEATURE_SYSTEM_PINMUX_SLEWRATE_LIMITER -/** - * \brief Configures the output slew rate mode for a group of pins. - * - * Configures the output slew rate mode for a group of pins, to - * control the speed at which the physical output pin can react to - * logical changes of the I/O pin value. - * - * \param[in] port Base of the PORT module to configure - * \param[in] mask Mask of the port pin(s) to configure - * \param[in] mode New pin slew rate mode to configure - */ -void system_pinmux_group_set_output_slew_rate( - PortGroup *const port, - const uint32_t mask, - const enum system_pinmux_pin_slew_rate mode) -{ - Assert(port); - - for (int i = 0; i < 32; i++) { - if (mask & (1UL << i)) { - if (mode == SYSTEM_PINMUX_PIN_SLEW_RATE_LIMITED) { - port->PINCFG[i].reg |= PORT_PINCFG_SLEWLIM; - } else { - port->PINCFG[i].reg &= ~PORT_PINCFG_SLEWLIM; - } - } - } -} -#endif - -#ifdef FEATURE_SYSTEM_PINMUX_DRIVE_STRENGTH -/** - * \brief Configures the output driver strength mode for a group of pins. - * - * Configures the output drive strength for a group of pins, to - * control the amount of current the pad is able to sink/source. - * - * \param[in] port Base of the PORT module to configure - * \param[in] mask Mask of the port pin(s) to configure - * \param[in] mode New output driver strength mode to configure - */ -void system_pinmux_group_set_output_strength( - PortGroup *const port, - const uint32_t mask, - const enum system_pinmux_pin_strength mode) -{ - Assert(port); - - for (int i = 0; i < 32; i++) { - if (mask & (1UL << i)) { - if (mode == SYSTEM_PINMUX_PIN_STRENGTH_HIGH) { - port->PINCFG[i].reg |= PORT_PINCFG_DRVSTR; - } else { - port->PINCFG[i].reg &= ~PORT_PINCFG_DRVSTR; - } - } - } -} -#endif - -#ifdef FEATURE_SYSTEM_PINMUX_OPEN_DRAIN -/** - * \brief Configures the output driver mode for a group of pins. - * - * Configures the output driver mode for a group of pins, to - * control the pad behavior. - * - * \param[in] port Base of the PORT module to configure - * \param[in] mask Mask of the port pin(s) to configure - * \param[in] mode New pad output driver mode to configure - */ -void system_pinmux_group_set_output_drive( - PortGroup *const port, - const uint32_t mask, - const enum system_pinmux_pin_drive mode) -{ - Assert(port); - - for (int i = 0; i < 32; i++) { - if (mask & (1UL << i)) { - if (mode == SYSTEM_PINMUX_PIN_DRIVE_OPEN_DRAIN) { - port->PINCFG[i].reg |= PORT_PINCFG_ODRAIN; - } else { - port->PINCFG[i].reg &= ~PORT_PINCFG_ODRAIN; - } - } - } -} -#endif diff --git a/atmel-samd/asf/sam0/drivers/system/pinmux/pinmux.h b/atmel-samd/asf/sam0/drivers/system/pinmux/pinmux.h deleted file mode 100644 index 015389c3f..000000000 --- a/atmel-samd/asf/sam0/drivers/system/pinmux/pinmux.h +++ /dev/null @@ -1,675 +0,0 @@ -/** - * \file - * - * \brief SAM Pin Multiplexer Driver - * - * Copyright (C) 2012-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef PINMUX_H_INCLUDED -#define PINMUX_H_INCLUDED - -/** - * \defgroup asfdoc_sam0_system_pinmux_group SAM System Pin Multiplexer (SYSTEM PINMUX) Driver - * - * This driver for Atmel® | SMART ARM®-based microcontrollers provides - * an interface for the configuration and management of the device's physical - * I/O Pins, to alter the direction and input/drive characteristics as well as - * to configure the pin peripheral multiplexer selection. - * - * The following peripheral is used by this module: - * - PORT (Port I/O Management) - * - * The following devices can use this module: - * - Atmel | SMART SAM D20/D21 - * - Atmel | SMART SAM R21 - * - Atmel | SMART SAM D09/D10/D11 - * - Atmel | SMART SAM L21/L22 - * - Atmel | SMART SAM DA1 - * - Atmel | SMART SAM C20/C21 - * - * The outline of this documentation is as follows: - * - \ref asfdoc_sam0_system_pinmux_prerequisites - * - \ref asfdoc_sam0_system_pinmux_module_overview - * - \ref asfdoc_sam0_system_pinmux_special_considerations - * - \ref asfdoc_sam0_system_pinmux_extra_info - * - \ref asfdoc_sam0_system_pinmux_examples - * - \ref asfdoc_sam0_system_pinmux_api_overview - * - * - * \section asfdoc_sam0_system_pinmux_prerequisites Prerequisites - * - * There are no prerequisites for this module. - * - * - * \section asfdoc_sam0_system_pinmux_module_overview Module Overview - * - * The SAM devices contain a number of General Purpose I/O pins, used to - * interface the user application logic and internal hardware peripherals to - * an external system. The Pin Multiplexer (PINMUX) driver provides a method - * of configuring the individual pin peripheral multiplexers to select - * alternate pin functions. - * - * \subsection asfdoc_sam0_system_pinmux_features Driver Feature Macro Definition - * <table> - * <tr> - * <th>Driver Feature Macro</th> - * <th>Supported devices</th> - * </tr> - * <tr> - * <td>FEATURE_SYSTEM_PINMUX_DRIVE_STRENGTH</td> - * <td>SAM L21, SAM C20/C21</td> - * </tr> - * </table> - * \note The specific features are only available in the driver when the - * selected device supports those features. - * - * \subsection asfdoc_sam0_system_pinmux_physical_logical_pins Physical and Logical GPIO Pins - * SAM devices use two naming conventions for the I/O pins in the device; one - * physical and one logical. Each physical pin on a device package is assigned - * both a physical port and pin identifier (e.g. "PORTA.0") as well as a - * monotonically incrementing logical GPIO number (e.g. "GPIO0"). While the - * former is used to map physical pins to their physical internal device module - * counterparts, for simplicity the design of this driver uses the logical GPIO - * numbers instead. - * - * \subsection asfdoc_sam0_system_pinmux_peripheral_muxing Peripheral Multiplexing - * SAM devices contain a peripheral MUX, which is individually controllable - * for each I/O pin of the device. The peripheral MUX allows you to select the - * function of a physical package pin - whether it will be controlled as a user - * controllable GPIO pin, or whether it will be connected internally to one of - * several peripheral modules (such as an I<SUP>2</SUP>C module). When a pin is - * configured in GPIO mode, other peripherals connected to the same pin will be - * disabled. - * - * \subsection asfdoc_sam0_system_pinmux_pad_characteristics Special Pad Characteristics - * There are several special modes that can be selected on one or more I/O pins - * of the device, which alter the input and output characteristics of the pad. - * - * \subsubsection asfdoc_sam0_system_pinmux_drive_strength Drive Strength - * The Drive Strength configures the strength of the output driver on the - * pad. Normally, there is a fixed current limit that each I/O pin can safely - * drive, however some I/O pads offer a higher drive mode which increases this - * limit for that I/O pin at the expense of an increased power consumption. - * - * \subsubsection asfdoc_sam0_system_pinmux_slew_rate Slew Rate - * The Slew Rate configures the slew rate of the output driver, limiting the - * rate at which the pad output voltage can change with time. - * - * \subsubsection asfdoc_sam0_system_pinmux_input_sample_mode Input Sample Mode - * The Input Sample Mode configures the input sampler buffer of the pad. By - * default, the input buffer is only sampled "on-demand", i.e. when the user - * application attempts to read from the input buffer. This mode is the most - * power efficient, but increases the latency of the input sample by two clock - * cycles of the port clock. To reduce latency, the input sampler can instead - * be configured to always sample the input buffer on each port clock cycle, at - * the expense of an increased power consumption. - * - * \subsection asfdoc_sam0_system_pinmux_module_overview_physical Physical Connection - * - * \ref asfdoc_sam0_system_pinmux_intconnections "The diagram below" shows - * how this module is interconnected within the device: - * - * \anchor asfdoc_sam0_system_pinmux_intconnections - * \dot - * digraph overview { - * node [label="Port Pad" shape=square] pad; - * - * subgraph driver { - * node [label="Peripheral MUX" shape=trapezium] pinmux; - * node [label="GPIO Module" shape=ellipse shape=ellipse style=filled fillcolor=lightgray] gpio; - * node [label="Other Peripheral Modules" shape=ellipse style=filled fillcolor=lightgray] peripherals; - * } - * - * pinmux -> gpio; - * pad -> pinmux; - * pinmux -> peripherals; - * } - * \enddot - * - * \section asfdoc_sam0_system_pinmux_special_considerations Special Considerations - * - * The SAM port pin input sampling mode is set in groups of four physical - * pins; setting the sampling mode of any pin in a sub-group of eight I/O pins - * will configure the sampling mode of the entire sub-group. - * - * High Drive Strength output driver mode is not available on all device pins - - * refer to your device specific datasheet. - * - * - * \section asfdoc_sam0_system_pinmux_extra_info Extra Information - * - * For extra information, see \ref asfdoc_sam0_system_pinmux_extra. This includes: - * - \ref asfdoc_sam0_system_pinmux_extra_acronyms - * - \ref asfdoc_sam0_system_pinmux_extra_dependencies - * - \ref asfdoc_sam0_system_pinmux_extra_errata - * - \ref asfdoc_sam0_system_pinmux_extra_history - * - * - * \section asfdoc_sam0_system_pinmux_examples Examples - * - * For a list of examples related to this driver, see - * \ref asfdoc_sam0_system_pinmux_exqsg. - * - * - * \section asfdoc_sam0_system_pinmux_api_overview API Overview - * @{ - */ - -#include <compiler.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/*@{*/ -#if (SAML21) || (SAMC20) || (SAMC21) || (SAMD21) || (SAMD10) || (SAMD11) || (SAMR30) || defined(__DOXYGEN__) -/** Output Driver Strength Selection feature support */ -# define FEATURE_SYSTEM_PINMUX_DRIVE_STRENGTH -#endif -/*@}*/ - -/** Peripheral multiplexer index to select GPIO mode for a pin */ -#define SYSTEM_PINMUX_GPIO (1 << 7) - -/** - * \brief Port pin direction configuration enum. - * - * Enum for the possible pin direction settings of the port pin configuration - * structure, to indicate the direction the pin should use. - */ -enum system_pinmux_pin_dir { - /** The pin's input buffer should be enabled, so that the pin state can - * be read */ - SYSTEM_PINMUX_PIN_DIR_INPUT, - /** The pin's output buffer should be enabled, so that the pin state can - * be set (but not read back) */ - SYSTEM_PINMUX_PIN_DIR_OUTPUT, - /** The pin's output and input buffers should both be enabled, so that the - * pin state can be set and read back */ - SYSTEM_PINMUX_PIN_DIR_OUTPUT_WITH_READBACK, -}; - -/** - * \brief Port pin input pull configuration enum. - * - * Enum for the possible pin pull settings of the port pin configuration - * structure, to indicate the type of logic level pull the pin should use. - */ -enum system_pinmux_pin_pull { - /** No logical pull should be applied to the pin */ - SYSTEM_PINMUX_PIN_PULL_NONE, - /** Pin should be pulled up when idle */ - SYSTEM_PINMUX_PIN_PULL_UP, - /** Pin should be pulled down when idle */ - SYSTEM_PINMUX_PIN_PULL_DOWN, -}; - -/** - * \brief Port pin digital input sampling mode enum. - * - * Enum for the possible input sampling modes for the port pin configuration - * structure, to indicate the type of sampling a port pin should use. - */ -enum system_pinmux_pin_sample { - /** Pin input buffer should continuously sample the pin state */ - SYSTEM_PINMUX_PIN_SAMPLE_CONTINUOUS, - /** Pin input buffer should be enabled when the IN register is read */ - SYSTEM_PINMUX_PIN_SAMPLE_ONDEMAND, -}; - -/** - * \brief Port pin configuration structure. - * - * Configuration structure for a port pin instance. This structure should - * be initialized by the \ref system_pinmux_get_config_defaults() function - * before being modified by the user application. - */ -struct system_pinmux_config { - /** MUX index of the peripheral that should control the pin, if peripheral - * control is desired. For GPIO use, this should be set to - * \ref SYSTEM_PINMUX_GPIO. */ - uint8_t mux_position; - - /** Port buffer input/output direction */ - enum system_pinmux_pin_dir direction; - - /** Logic level pull of the input buffer */ - enum system_pinmux_pin_pull input_pull; - - /** Enable lowest possible powerstate on the pin - * - * \note All other configurations will be ignored, the pin will be disabled. - */ - bool powersave; -}; - -/** \name Configuration and Initialization - * @{ - */ - -/** - * \brief Initializes a Port pin configuration structure to defaults. - * - * Initializes a given Port pin configuration structure to a set of - * known default values. This function should be called on all new - * instances of these configuration structures before being modified by the - * user application. - * - * The default configuration is as follows: - * \li Non peripheral (i.e. GPIO) controlled - * \li Input mode with internal pull-up enabled - * - * \param[out] config Configuration structure to initialize to default values - */ -static inline void system_pinmux_get_config_defaults( - struct system_pinmux_config *const config) -{ - /* Sanity check arguments */ - Assert(config); - - /* Default configuration values */ - config->mux_position = SYSTEM_PINMUX_GPIO; - config->direction = SYSTEM_PINMUX_PIN_DIR_INPUT; - config->input_pull = SYSTEM_PINMUX_PIN_PULL_UP; - config->powersave = false; -} - -void system_pinmux_pin_set_config( - const uint8_t gpio_pin, - const struct system_pinmux_config *const config); - -void system_pinmux_group_set_config( - PortGroup *const port, - const uint32_t mask, - const struct system_pinmux_config *const config); - -/** @} */ - -/** \name Special Mode Configuration (Physical Group Orientated) - * @{ - */ - -/** - * \brief Retrieves the PORT module group instance from a given GPIO pin number. - * - * Retrieves the PORT module group instance associated with a given logical - * GPIO pin number. - * - * \param[in] gpio_pin Index of the GPIO pin to convert - * - * \return Base address of the associated PORT module. - */ -static inline PortGroup* system_pinmux_get_group_from_gpio_pin( - const uint8_t gpio_pin) -{ - uint8_t port_index = (gpio_pin / 128); - uint8_t group_index = (gpio_pin / 32); - - /* Array of available ports */ - Port *const ports[PORT_INST_NUM] = PORT_INSTS; - - if (port_index < PORT_INST_NUM) { - return &(ports[port_index]->Group[group_index]); - } else { - Assert(false); - return NULL; - } -} - -void system_pinmux_group_set_input_sample_mode( - PortGroup *const port, - const uint32_t mask, - const enum system_pinmux_pin_sample mode); - -/** @} */ - -/** \name Special Mode Configuration (Logical Pin Orientated) - * @{ - */ - -/** - * \brief Retrieves the currently selected MUX position of a logical pin. - * - * Retrieves the selected MUX peripheral on a given logical GPIO pin. - * - * \param[in] gpio_pin Index of the GPIO pin to configure - * - * \return Currently selected peripheral index on the specified pin. - */ -static inline uint8_t system_pinmux_pin_get_mux_position( - const uint8_t gpio_pin) -{ - PortGroup *const port = system_pinmux_get_group_from_gpio_pin(gpio_pin); - uint32_t pin_index = (gpio_pin % 32); - - if (!(port->PINCFG[pin_index].reg & PORT_PINCFG_PMUXEN)) { - return SYSTEM_PINMUX_GPIO; - } - - uint32_t pmux_reg = port->PMUX[pin_index / 2].reg; - - if (pin_index & 1) { - return (pmux_reg & PORT_PMUX_PMUXO_Msk) >> PORT_PMUX_PMUXO_Pos; - } - else { - return (pmux_reg & PORT_PMUX_PMUXE_Msk) >> PORT_PMUX_PMUXE_Pos; - } -} - -/** - * \brief Configures the input sampling mode for a GPIO pin. - * - * Configures the input sampling mode for a GPIO input, to - * control when the physical I/O pin value is sampled and - * stored inside the microcontroller. - * - * \param[in] gpio_pin Index of the GPIO pin to configure - * \param[in] mode New pin sampling mode to configure - */ -static inline void system_pinmux_pin_set_input_sample_mode( - const uint8_t gpio_pin, - const enum system_pinmux_pin_sample mode) -{ - PortGroup* const port = system_pinmux_get_group_from_gpio_pin(gpio_pin); - uint32_t pin_index = (gpio_pin % 32); - - if (mode == SYSTEM_PINMUX_PIN_SAMPLE_ONDEMAND) { - port->CTRL.reg |= (1 << pin_index); - } else { - port->CTRL.reg &= ~(1 << pin_index); - } -} - -/** @} */ - -#ifdef FEATURE_SYSTEM_PINMUX_DRIVE_STRENGTH -/** - * \brief Port pin drive output strength enum. - * - * Enum for the possible output drive strengths for the port pin - * configuration structure, to indicate the driver strength the pin should - * use. - */ -enum system_pinmux_pin_strength { - /** Normal output driver strength */ - SYSTEM_PINMUX_PIN_STRENGTH_NORMAL, - /** High current output driver strength */ - SYSTEM_PINMUX_PIN_STRENGTH_HIGH, -}; - -/** - * \brief Configures the output driver strength mode for a GPIO pin. - * - * Configures the output drive strength for a GPIO output, to - * control the amount of current the pad is able to sink/source. - * - * \param[in] gpio_pin Index of the GPIO pin to configure - * \param[in] mode New output driver strength mode to configure - */ -static inline void system_pinmux_pin_set_output_strength( - const uint8_t gpio_pin, - const enum system_pinmux_pin_strength mode) -{ - PortGroup* const port = system_pinmux_get_group_from_gpio_pin(gpio_pin); - uint32_t pin_index = (gpio_pin % 32); - - if (mode == SYSTEM_PINMUX_PIN_STRENGTH_HIGH) { - port->PINCFG[pin_index].reg |= PORT_PINCFG_DRVSTR; - } - else { - port->PINCFG[pin_index].reg &= ~PORT_PINCFG_DRVSTR; - } -} - -void system_pinmux_group_set_output_strength( - PortGroup *const port, - const uint32_t mask, - const enum system_pinmux_pin_strength mode); -#endif - -#ifdef FEATURE_SYSTEM_PINMUX_SLEWRATE_LIMITER -/** - * \brief Port pin output slew rate enum. - * - * Enum for the possible output drive slew rates for the port pin - * configuration structure, to indicate the driver slew rate the pin should - * use. - */ -enum system_pinmux_pin_slew_rate { - /** Normal pin output slew rate */ - SYSTEM_PINMUX_PIN_SLEW_RATE_NORMAL, - /** Enable slew rate limiter on the pin */ - SYSTEM_PINMUX_PIN_SLEW_RATE_LIMITED, -}; - -/** - * \brief Configures the output slew rate mode for a GPIO pin. - * - * Configures the output slew rate mode for a GPIO output, to - * control the speed at which the physical output pin can react to - * logical changes of the I/O pin value. - * - * \param[in] gpio_pin Index of the GPIO pin to configure - * \param[in] mode New pin slew rate mode to configure - */ -static inline void system_pinmux_pin_set_output_slew_rate( - const uint8_t gpio_pin, - const enum system_pinmux_pin_slew_rate mode) -{ - PortGroup* const port = system_pinmux_get_group_from_gpio_pin(gpio_pin); - uint32_t pin_index = (gpio_pin % 32); - - if (mode == SYSTEM_PINMUX_PIN_SLEW_RATE_LIMITED) { - port->PINCFG[pin_index].reg |= PORT_PINCFG_SLEWLIM; - } - else { - port->PINCFG[pin_index].reg &= ~PORT_PINCFG_SLEWLIM; - } -} - -void system_pinmux_group_set_output_slew_rate( - PortGroup *const port, - const uint32_t mask, - const enum system_pinmux_pin_slew_rate mode); -#endif - -#ifdef FEATURE_SYSTEM_PINMUX_OPEN_DRAIN -/** - * \brief Port pin output drive mode enum. - * - * Enum for the possible output drive modes for the port pin configuration - * structure, to indicate the output mode the pin should use. - */ -enum system_pinmux_pin_drive { - /** Use totem pole output drive mode */ - SYSTEM_PINMUX_PIN_DRIVE_TOTEM, - /** Use open drain output drive mode */ - SYSTEM_PINMUX_PIN_DRIVE_OPEN_DRAIN, -}; - -/** - * \brief Configures the output driver mode for a GPIO pin. - * - * Configures the output driver mode for a GPIO output, to - * control the pad behavior. - * - * \param[in] gpio_pin Index of the GPIO pin to configure - * \param[in] mode New pad output driver mode to configure - */ -static inline void system_pinmux_pin_set_output_drive( - const uint8_t gpio_pin, - const enum system_pinmux_pin_drive mode) -{ - PortGroup* const port = system_pinmux_get_group_from_gpio_pin(gpio_pin); - uint32_t pin_index = (gpio_pin % 32); - - if (mode == SYSTEM_PINMUX_PIN_DRIVE_OPEN_DRAIN) { - port->PINCFG[pin_index].reg |= PORT_PINCFG_ODRAIN; - } - else { - port->PINCFG[pin_index].reg &= ~PORT_PINCFG_ODRAIN; - } -} - -void system_pinmux_group_set_output_drive( - PortGroup *const port, - const uint32_t mask, - const enum system_pinmux_pin_drive mode); -#endif - -#ifdef __cplusplus -} -#endif - -/** @} */ - -/** - * \page asfdoc_sam0_system_pinmux_extra Extra Information for SYSTEM PINMUX Driver - * - * \section asfdoc_sam0_system_pinmux_extra_acronyms Acronyms - * The table below presents the acronyms used in this module: - * - * <table> - * <tr> - * <th>Acronym</th> - * <th>Description</th> - * </tr> - * <tr> - * <td>GPIO</td> - * <td>General Purpose Input/Output</td> - * </tr> - * <tr> - * <td>MUX</td> - * <td>Multiplexer</td> - * </tr> - * </table> - * - * - * \section asfdoc_sam0_system_pinmux_extra_dependencies Dependencies - * This driver has the following dependencies: - * - * - None - * - * - * \section asfdoc_sam0_system_pinmux_extra_errata Errata - * There are no errata related to this driver. - * - * - * \section asfdoc_sam0_system_pinmux_extra_history Module History - * An overview of the module history is presented in the table below, with - * details on the enhancements and fixes made to the module since its first - * release. The current version of this corresponds to the newest version in - * the table. - * - * <table> - * <tr> - * <th>Changelog</th> - * </tr> - * <tr> - * <td>Removed code of open drain, slew limit and drive strength - * features</td> - * </tr> - * <tr> - * <td>Fixed broken sampling mode function implementations, which wrote - * corrupt configuration values to the device registers</td> - * </tr> - * <tr> - * <td>Added missing NULL pointer asserts to the PORT driver functions</td> - * </tr> - * <tr> - * <td>Initial Release</td> - * </tr> - * </table> - */ - -/** - * \page asfdoc_sam0_system_pinmux_exqsg Examples for SYSTEM PINMUX Driver - * - * This is a list of the available Quick Start guides (QSGs) and example - * applications for \ref asfdoc_sam0_system_pinmux_group. QSGs are simple - * examples with step-by-step instructions to configure and use this driver in a - * selection of use cases. Note that a QSG can be compiled as a standalone - * application or be added to the user application. - * - * - \subpage asfdoc_sam0_system_pinmux_basic_use_case - * - * \page asfdoc_sam0_system_pinmux_document_revision_history Document Revision History - * - * <table> - * <tr> - * <th>Doc. Rev.</td> - * <th>Date</td> - * <th>Comments</td> - * </tr> - * <tr> - * <td>42121F</td> - * <td>12/2015</td> - * <td>Added support for SAM L21/L22, SAM DA1, SAM D09, and SAM C20/C21</td> - * </tr> - * <tr> - * <td>42121E</td> - * <td>12/2014</td> - * <td>Added support for SAM R21 and SAM D10/D11</td> - * </tr> - * <tr> - * <td>42121D</td> - * <td>01/2014</td> - * <td>Added support for SAM D21</td> - * </tr> - * <tr> - * <td>42121C</td> - * <td>09/2013</td> - * <td>Fixed incorrect documentation for the device pin sampling mode</td> - * </tr> - * <tr> - * <td>42121B</td> - * <td>06/2013</td> - * <td>Corrected documentation typos</td> - * </tr> - * <tr> - * <td>42121A</td> - * <td>06/2013</td> - * <td>Initial release</td> - * </tr> - * </table> - */ - -#endif diff --git a/atmel-samd/asf/sam0/drivers/system/power/power_sam_d_r/power.h b/atmel-samd/asf/sam0/drivers/system/power/power_sam_d_r/power.h deleted file mode 100644 index fe884dea2..000000000 --- a/atmel-samd/asf/sam0/drivers/system/power/power_sam_d_r/power.h +++ /dev/null @@ -1,224 +0,0 @@ -/** - * \file - * - * \brief SAM Power related functionality - * - * Copyright (C) 2014-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef POWER_H_INCLUDED -#define POWER_H_INCLUDED - -#include <compiler.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \addtogroup asfdoc_sam0_system_group - * @{ - */ - -/** - * \brief Voltage references within the device. - * - * List of available voltage references (VREF) that may be used within the - * device. - */ -enum system_voltage_reference { - /** Temperature sensor voltage reference */ - SYSTEM_VOLTAGE_REFERENCE_TEMPSENSE, - /** Bandgap voltage reference */ - SYSTEM_VOLTAGE_REFERENCE_BANDGAP, -}; - -/** - * \brief Device sleep modes. - * - * List of available sleep modes in the device. A table of clocks available in - * different sleep modes can be found in \ref asfdoc_sam0_system_module_overview_sleep_mode. - */ -enum system_sleepmode { - /** IDLE 0 sleep mode */ - SYSTEM_SLEEPMODE_IDLE_0, - /** IDLE 1 sleep mode */ - SYSTEM_SLEEPMODE_IDLE_1, - /** IDLE 2 sleep mode */ - SYSTEM_SLEEPMODE_IDLE_2, - /** Standby sleep mode */ - SYSTEM_SLEEPMODE_STANDBY, -}; - - - -/** - * \name Voltage References - * @{ - */ - -/** - * \brief Enable the selected voltage reference - * - * Enables the selected voltage reference source, making the voltage reference - * available on a pin as well as an input source to the analog peripherals. - * - * \param[in] vref Voltage reference to enable - */ -static inline void system_voltage_reference_enable( - const enum system_voltage_reference vref) -{ - switch (vref) { - case SYSTEM_VOLTAGE_REFERENCE_TEMPSENSE: - SYSCTRL->VREF.reg |= SYSCTRL_VREF_TSEN; - break; - - case SYSTEM_VOLTAGE_REFERENCE_BANDGAP: - SYSCTRL->VREF.reg |= SYSCTRL_VREF_BGOUTEN; - break; - - default: - Assert(false); - return; - } -} - -/** - * \brief Disable the selected voltage reference - * - * Disables the selected voltage reference source. - * - * \param[in] vref Voltage reference to disable - */ -static inline void system_voltage_reference_disable( - const enum system_voltage_reference vref) -{ - switch (vref) { - case SYSTEM_VOLTAGE_REFERENCE_TEMPSENSE: - SYSCTRL->VREF.reg &= ~SYSCTRL_VREF_TSEN; - break; - - case SYSTEM_VOLTAGE_REFERENCE_BANDGAP: - SYSCTRL->VREF.reg &= ~SYSCTRL_VREF_BGOUTEN; - break; - - default: - Assert(false); - return; - } -} - -/** - * @} - */ - - -/** - * \name Device Sleep Control - * @{ - */ - -/** - * \brief Set the sleep mode of the device - * - * Sets the sleep mode of the device; the configured sleep mode will be entered - * upon the next call of the \ref system_sleep() function. - * - * For an overview of which systems are disabled in sleep for the different - * sleep modes, see \ref asfdoc_sam0_system_module_overview_sleep_mode. - * - * \param[in] sleep_mode Sleep mode to configure for the next sleep operation - * - * \retval STATUS_OK Operation completed successfully - * \retval STATUS_ERR_INVALID_ARG The requested sleep mode was invalid or not - * available - */ -static inline enum status_code system_set_sleepmode( - const enum system_sleepmode sleep_mode) -{ -#if (SAMD20) - /* Errata 13140: Make sure that the Flash does not power all the way down - * when in sleep mode. This errata has been fixed as of revision D of SAMD21 */ - NVMCTRL->CTRLB.bit.SLEEPPRM = NVMCTRL_CTRLB_SLEEPPRM_DISABLED_Val; -#endif - - switch (sleep_mode) { - case SYSTEM_SLEEPMODE_IDLE_0: - case SYSTEM_SLEEPMODE_IDLE_1: - case SYSTEM_SLEEPMODE_IDLE_2: - SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk; - PM->SLEEP.reg = sleep_mode; - break; - - case SYSTEM_SLEEPMODE_STANDBY: - SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; - break; - - default: - return STATUS_ERR_INVALID_ARG; - } - - return STATUS_OK; -} - -/** - * \brief Put the system to sleep waiting for interrupt - * - * Executes a device DSB (Data Synchronization Barrier) instruction to ensure - * all ongoing memory accesses have completed, then a WFI (Wait For Interrupt) - * instruction to place the device into the sleep mode specified by - * \ref system_set_sleepmode until woken by an interrupt. - */ -static inline void system_sleep(void) -{ - __DSB(); - __WFI(); -} - -/** - * @} - */ - -/** @} */ -#ifdef __cplusplus -} -#endif - -#endif /* POWER_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/system/reset/reset_sam_d_r/reset.h b/atmel-samd/asf/sam0/drivers/system/reset/reset_sam_d_r/reset.h deleted file mode 100644 index befed28e8..000000000 --- a/atmel-samd/asf/sam0/drivers/system/reset/reset_sam_d_r/reset.h +++ /dev/null @@ -1,119 +0,0 @@ -/** - * \file - * - * \brief SAM Reset related functionality - * - * Copyright (C) 2014-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef RESET_H_INCLUDED -#define RESET_H_INCLUDED - -#include <compiler.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \addtogroup asfdoc_sam0_system_group - * @{ - */ - -/** - * \brief Reset causes of the system. - * - * List of possible reset causes of the system. - */ -enum system_reset_cause { - /** The system was last reset by a software reset */ - SYSTEM_RESET_CAUSE_SOFTWARE = PM_RCAUSE_SYST, - /** The system was last reset by the watchdog timer */ - SYSTEM_RESET_CAUSE_WDT = PM_RCAUSE_WDT, - /** The system was last reset because the external reset line was pulled low */ - SYSTEM_RESET_CAUSE_EXTERNAL_RESET = PM_RCAUSE_EXT, - /** The system was last reset by the BOD33 */ - SYSTEM_RESET_CAUSE_BOD33 = PM_RCAUSE_BOD33, - /** The system was last reset by the BOD12 */ - SYSTEM_RESET_CAUSE_BOD12 = PM_RCAUSE_BOD12, - /** The system was last reset by the POR (Power on reset) */ - SYSTEM_RESET_CAUSE_POR = PM_RCAUSE_POR, -}; - - -/** - * \name Reset Control - * @{ - */ - -/** - * \brief Reset the MCU. - * - * Resets the MCU and all associated peripherals and registers, except RTC, all 32KHz sources, - * WDT (if ALWAYSON is set) and GCLK (if WRTLOCK is set). - * - */ -static inline void system_reset(void) -{ - NVIC_SystemReset(); -} - -/** - * \brief Return the reset cause. - * - * Retrieves the cause of the last system reset. - * - * \return An enum value indicating the cause of the last system reset. - */ -static inline enum system_reset_cause system_get_reset_cause(void) -{ - return (enum system_reset_cause)PM->RCAUSE.reg; -} - -/** - * @} - */ - -/** @} */ -#ifdef __cplusplus -} -#endif - -#endif /* RESET_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/system/system.c b/atmel-samd/asf/sam0/drivers/system/system.c deleted file mode 100644 index 62f2d6463..000000000 --- a/atmel-samd/asf/sam0/drivers/system/system.c +++ /dev/null @@ -1,110 +0,0 @@ -/** - * \file - * - * \brief SAM System related functionality - * - * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#include <system.h> - -/** - * \internal - * Dummy initialization function, used as a weak alias target for the various - * init functions called by \ref system_init(). - */ -void _system_dummy_init(void); -void _system_dummy_init(void) -{ - return; -} - -#if !defined(__DOXYGEN__) -# if defined(__GNUC__) -void system_clock_init(uint16_t dfll_fine_calibration) WEAK __attribute__((alias("_system_dummy_init"))); -void system_board_init(void) WEAK __attribute__((alias("_system_dummy_init"))); -void _system_events_init(void) WEAK __attribute__((alias("_system_dummy_init"))); -void _system_extint_init(void) WEAK __attribute__((alias("_system_dummy_init"))); -void _system_divas_init(void) WEAK __attribute__((alias("_system_dummy_init"))); -# elif defined(__ICCARM__) -void system_clock_init(uint16_t dfll_fine_calibration); -void system_board_init(void); -void _system_events_init(void); -void _system_extint_init(void); -void _system_divas_init(void); -# pragma weak system_clock_init=_system_dummy_init -# pragma weak system_board_init=_system_dummy_init -# pragma weak _system_events_init=_system_dummy_init -# pragma weak _system_extint_init=_system_dummy_init -# pragma weak _system_divas_init=_system_dummy_init -# endif -#endif - -/** - * \brief Initialize system - * - * This function will call the various initialization functions within the - * system namespace. If a given optional system module is not available, the - * associated call will effectively be a NOP (No Operation). - * - * Currently the following initialization functions are supported: - * - System clock initialization (via the SYSTEM CLOCK sub-module) - * - Board hardware initialization (via the Board module) - * - Event system driver initialization (via the EVSYS module) - * - External Interrupt driver initialization (via the EXTINT module) - */ -void system_init(uint16_t dfll_fine_calibration) -{ - /* Configure GCLK and clock sources according to conf_clocks.h */ - system_clock_init(dfll_fine_calibration); - - /* Initialize board hardware */ - system_board_init(); - - /* Initialize EVSYS hardware */ - _system_events_init(); - - /* Initialize External hardware */ - _system_extint_init(); - - /* Initialize DIVAS hardware */ - _system_divas_init(); -} diff --git a/atmel-samd/asf/sam0/drivers/system/system.h b/atmel-samd/asf/sam0/drivers/system/system.h deleted file mode 100644 index a0be5b705..000000000 --- a/atmel-samd/asf/sam0/drivers/system/system.h +++ /dev/null @@ -1,727 +0,0 @@ -/** - * \file - * - * \brief SAM System related functionality - * - * Copyright (C) 2012-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef SYSTEM_H_INCLUDED -#define SYSTEM_H_INCLUDED - -#include <compiler.h> -#include <clock.h> -#include <gclk.h> -#include <pinmux.h> -#include <power.h> -#include <reset.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \defgroup asfdoc_sam0_system_group SAM System (SYSTEM) Driver - * - * This driver for Atmel® | SMART ARM®-based microcontrollers provides an interface for the configuration - * and management of the device's system relation functionality, necessary for - * the basic device operation. This is not limited to a single peripheral, but - * extends across multiple hardware peripherals. - * - * The following peripherals are used by this module: - * \if DEVICE_SAML21_SYSTEM_SUPPORT - * - PM (Power Manager) - * - RSTC (Reset Controller) - * - SUPC (Supply Controller) - * \endif - * \if DEVICE_SAMC21_SYSTEM_SUPPORT - * - PM (Power Manager) - * - RSTC (Reset Controller) - * - SUPC (Supply Controller) - * \endif - * \if DEVICE_SAMD21_SYSTEM_SUPPORT - * - SYSCTRL (System Control) - * - PM (Power Manager) - * \endif - * - * The following devices can use this module: - * \if DEVICE_SAML21_SYSTEM_SUPPORT - * - Atmel | SMART SAM L21 - * \endif - * \if DEVICE_SAMC21_SYSTEM_SUPPORT - * - Atmel | SMART SAM C20/C21 - * \endif - * \if DEVICE_SAMD21_SYSTEM_SUPPORT - * - Atmel | SMART SAM D20/D21 - * - Atmel | SMART SAM R21 - * - Atmel | SMART SAM D09/D10/D11 - * - Atmel | SMART SAM DA1 - * \endif - * - * The outline of this documentation is as follows: - * - \ref asfdoc_sam0_system_prerequisites - * - \ref asfdoc_sam0_system_module_overview - * - \ref asfdoc_sam0_system_special_considerations - * - \ref asfdoc_sam0_system_extra_info - * - \ref asfdoc_sam0_system_examples - * - \ref asfdoc_sam0_system_api_overview - * - * - * \section asfdoc_sam0_system_prerequisites Prerequisites - * - * There are no prerequisites for this module. - * - * - * \section asfdoc_sam0_system_module_overview Module Overview - * - * The System driver provides a collection of interfaces between the user - * application logic, and the core device functionality (such as clocks, reset - * cause determination, etc.) that is required for all applications. It contains - * a number of sub-modules that control one specific aspect of the device: - * - * - System Core (this module) - * - \ref asfdoc_sam0_system_clock_group "System Clock Control" (sub-module) - * - \ref asfdoc_sam0_system_interrupt_group "System Interrupt Control" (sub-module) - * - \ref asfdoc_sam0_system_pinmux_group "System Pin Multiplexer Control" (sub-module) - * - * - * \if DEVICE_SAML21_SYSTEM_SUPPORT - * \subsection asfdoc_sam0_system_module_overview_vreg_l21 Voltage Regulator - * The SAM device controls the voltage regulators for the core (VDDCORE) and - * backup (VDDBU) domains. It sets the voltage regulators according to the sleep - * modes, the performance level, or the user configuration. - * - * In active mode, the voltage regulator can be chosen on the fly between a LDO - * or a Buck converter. In standby mode, the low power voltage regulator is used - * to supply VDDCORE. - * - * \subsection asfdoc_sam0_system_module_overview_bbps Battery Backup Power Switch - * The SAM device supports connection of a battery backup to the VBAT power pin. - * It includes functionality that enables automatic power switching between main - * power and battery backup power. This will ensure power to the backup domain, - * when the main battery or power source is unavailable. - * \endif - * - * \if DEVICE_SAMC21_SYSTEM_SUPPORT - * \subsection asfdoc_sam0_system_module_overview_vreg_c21 Voltage Regulator - * The SAM device controls the voltage regulators for the core (VDDCORE). It sets - * the voltage regulators according to the sleep modes. - * - * There are a selectable reference voltage and voltage dependent on the temperature - * which can be used by analog modules like the ADC. - * \endif - * - * \subsection asfdoc_sam0_system_module_overview_vref Voltage References - * The various analog modules within the SAM devices (such as AC, ADC, and - * DAC) require a voltage reference to be configured to act as a reference point - * for comparisons and conversions. - * - * The SAM devices contain multiple references, including an internal - * temperature sensor and a fixed band-gap voltage source. When enabled, the - * associated voltage reference can be selected within the desired peripheral - * where applicable. - * - * \subsection asfdoc_sam0_system_module_overview_reset_cause System Reset Cause - * In some applications there may be a need to execute a different program - * flow based on how the device was reset. For example, if the cause of reset - * was the Watchdog timer (WDT), this might indicate an error in the application, - * and a form of error handling or error logging might be needed. - * - * For this reason, an API is provided to retrieve the cause of the last system - * reset, so that appropriate action can be taken. - * - * \if DEVICE_SAML21_SYSTEM_SUPPORT - * There are three groups of reset sources: - * - Power supply reset: Resets caused by an electrical issue. It covers POR and BOD reset. - * - User reset: Resets caused by the application. It covers external reset, - * system reset, and watchdog reset. - * - Backup reset: Resets caused by a backup mode exit condition. - * - * \subsection asfdoc_sam0_system_module_overview_performance_level Performance Level - * Performance level allows the user to adjust the regulator output voltage to reduce - * power consumption. The user can on the fly select the most suitable performance - * level, depending on the application demands. - * - * The SAM device can operate at two different performance levels (PL0 and PL2). - * When operating at PL0, the voltage applied on the full logic area is reduced - * by voltage scaling. This voltage scaling technique allows to reduce the active - * power consumption while decreasing the maximum frequency of the device. When - * operating at PL2, the voltage regulator supplies the highest voltage, allowing - * the device to run at higher clock speeds. - * - * Performance level transition is possible only when the device is in active - * mode. After a reset, the device starts at the lowest performance level - * (lowest power consumption and lowest max. frequency). The application can then - * switch to another performance level at any time without any stop in the code - * execution. As shown in \ref asfdoc_sam0_system_performance_level_transition_figure. - * - * \note When scaling down the performance level, the bus frequency should first be - * scaled down in order to not exceed the maximum frequency allowed for the - * low performance level. - * When scaling up the performance level (e.g. from PL0 to PL2), check the performance - * level status before increasing the bus frequency. It can be increased only - * when the performance level transition is completed. - * - * \anchor asfdoc_sam0_system_performance_level_transition_figure - * \image html performance_level_transition.svg "Performance Level Transition" - * - * \subsection asfdoc_sam0_system_module_overview_power_domain Power Domain Gating - * Power domain gating allows power saving by reducing the voltage in logic - * areas in the device to a low-power supply. The feature is available in - * Standby sleep mode and will reduce the voltage in domains where all peripherals - * are idle. Internal logic will maintain its content, meaning the corresponding - * peripherals will not need to be reconfigured when normal operating voltage - * is returned. Most power domains can be in the following three states: - * - * - Active state: The power domain is powered on. - * - Retention state: The main voltage supply for the power domain is switched off, - * while maintaining a secondary low-power supply for the sequential cells. The - * logic context is restored when waking up. - * - Off state: The power domain is entirely powered off. The logic context is lost. - * - * The SAM L21 device contains three power domains which can be controlled using - * power domain gating, namely PD0, PD1, and PD2. These power domains can be - * configured to the following cases: - * - Default with no sleepwalking peripherals: A power domain is automatically set - * to retention state in standby sleep mode if no activity require it. The application - * can force all power domains to remain in active state during standby sleep mode - * in order to accelerate wakeup time. - * - Default with sleepwalking peripherals: If one or more peripherals are enabled - * to perform sleepwalking tasks in standby sleep mode, the corresponding power - * domain (PDn) remains in active state as well as all inferior power domains (<PDn). - * - Sleepwalking with dynamic power domain gating: During standby sleep mode, a - * power domain (PDn) in active can wake up a superior power domain (>PDn) in order - * to perform a sleepwalking task. The superior power domain is then automatically - * set to active state. At the end of the sleepwalking task, the device can either - * be woken up or the superior power domain can return to retention state. - * - * Power domains can be linked to each other, it allows a power domain (PDn) to be kept - * in active state if the inferior power domain (PDn-1) is in active state too. - * - * \ref asfdoc_sam0_system_power_domain_overview_table illustrates the - * four cases to consider in standby mode. - * - * \anchor asfdoc_sam0_system_power_domain_overview_table - * <table> - * <caption>Sleep Mode versus Power Domain State Overview</caption> - * <tr> - * <th>Sleep mode</th> - * <th>PD0</th> - * <th>PD1</th> - * <th>PD2</th> - * <th>PDTOP</th> - * <th>PDBACKUP</th> - * </tr> - * <tr> - * <td>Idle</td> - * <td>active</td> - * <td>active</td> - * <td>active</td> - * <td>active</td> - * <td>active</td> - * </tr> - * <tr> - * <td>Standby - Case 1</td> - * <td>active</td> - * <td>active</td> - * <td>active</td> - * <td>active</td> - * <td>active</td> - * </tr> - * <tr> - * <td>Standby - Case 2</td> - * <td>active</td> - * <td>active</td> - * <td>retention</td> - * <td>active</td> - * <td>active</td> - * </tr> - * <tr> - * <td>Standby - Case 3</td> - * <td>active</td> - * <td>retention</td> - * <td>retention</td> - * <td>active</td> - * <td>active</td> - * </tr> - * <tr> - * <td>Standby - Case 4</td> - * <td>retention</td> - * <td>retention</td> - * <td>retention</td> - * <td>active</td> - * <td>active</td> - * </tr> - * <tr> - * <td>Backup</td> - * <td>off</td> - * <td>off</td> - * <td>off</td> - * <td>off</td> - * <td>active</td> - * </tr> - * <tr> - * <td>Off</td> - * <td>off</td> - * <td>off</td> - * <td>off</td> - * <td>off</td> - * <td>off</td> - * </tr> - * </table> - * - * \subsection asfdoc_sam0_system_module_overview_ram_state RAMs Low Power Mode - * By default, in standby sleep mode, RAM is in low power mode (back biased) - * if its power domain is in retention state. - * \ref asfdoc_sam0_system_power_ram_state_table lists RAMs low power mode. - * - * \anchor asfdoc_sam0_system_power_ram_state_table - * <table> - * <caption>RAM Back-biasing Mode</caption> - * <tr> - * <th>RAM mode</th> - * <th>Description</th> - * </tr> - * <tr> - * <td>Retention Back-biasing mode</td> - * <td>RAM is back-biased if its power domain is in retention mode</td> - * </tr> - * <tr> - * <td>Standby Back-biasing mode</td> - * <td>RAM is back-biased if the device is in standby mode</td> - * </tr> - * <tr> - * <td>Standby OFF mode</td> - * <td>RAM is OFF if the device is in standby mode</td> - * </tr> - * <tr> - * <td>Always OFF mode</td> - * <td>RAM is OFF if the device is in RET mode</td> - * </tr> - * </table> - * - * \endif - * - * \subsection asfdoc_sam0_system_module_overview_sleep_mode Sleep Modes - * The SAM devices have several sleep modes. The sleep mode controls - * which clock systems on the device will remain enabled or disabled when the - * device enters a low power sleep mode. - * \ref asfdoc_sam0_system_module_sleep_mode_table "The table below" lists the - * clock settings of the different sleep modes. - * - * \anchor asfdoc_sam0_system_module_sleep_mode_table - * <table> - * <caption>SAM Device Sleep Modes</caption> - * \if DEVICE_SAML21_SYSTEM_SUPPORT - * <tr> - * <th>Sleep mode</th> - * <th>System clock</th> - * <th>CPU clock</th> - * <th>AHB/AHB clock</th> - * <th>GCLK clocks</th> - * <th>Oscillators (ONDEMAND = 0)</th> - * <th>Oscillators (ONDEMAND = 1)</th> - * <th>Regulator mode</th> - * <th>RAM mode</th> - * </tr> - * <tr> - * <td>Idle</td> - * <td>Run</td> - * <td>Stop</td> - * <td>Run if requested</td> - * <td>Run</td> - * <td>Run</td> - * <td>Run if requested</td> - * <td>Normal</td> - * <td>Normal</td> - * </tr> - * <tr> - * <td>Standby</td> - * <td>Stop</td> - * <td>Stop</td> - * <td>Run if requested</td> - * <td>Run if requested</td> - * <td>Run if requested or RUNSTDBY = 1</td> - * <td>Run if requested</td> - * <td>Low pwer</td> - * <td>Low pwer</td> - * </tr> - * <tr> - * <td>Backup</td> - * <td>Stop</td> - * <td>Stop</td> - * <td>Stop</td> - * <td>Stop</td> - * <td>Stop</td> - * <td>Stop</td> - * <td>Backup</td> - * <td>Off</td> - * </tr> - * <tr> - * <td>Off</td> - * <td>Off</td> - * <td>Off</td> - * <td>Off</td> - * <td>Off</td> - * <td>Off</td> - * <td>Off</td> - * <td>Off</td> - * <td>Off</td> - * </tr> - * \else - * <tr> - * <th>Sleep mode</th> - * <th>CPU clock</th> - * <th>AHB clock</th> - * <th>APB clocks</th> - * <th>Clock sources</th> - * <th>System clock</th> - * <th>32KHz</th> - * <th>Reg mode</th> - * <th>RAM mode</th> - * </tr> - * <tr> - * <td>Idle 0</td> - * <td>Stop</td> - * <td>Run</td> - * <td>Run</td> - * <td>Run</td> - * <td>Run</td> - * <td>Run</td> - * <td>Normal</td> - * <td>Normal</td> - * </tr> - * <tr> - * <td>Idle 1</td> - * <td>Stop</td> - * <td>Stop</td> - * <td>Run</td> - * <td>Run</td> - * <td>Run</td> - * <td>Run</td> - * <td>Normal</td> - * <td>Normal</td> - * </tr> - * <tr> - * <td>Idle 2</td> - * <td>Stop</td> - * <td>Stop</td> - * <td>Stop</td> - * <td>Run</td> - * <td>Run</td> - * <td>Run</td> - * <td>Normal</td> - * <td>Normal</td> - * </tr> - * <tr> - * <td>Standby</td> - * <td>Stop</td> - * <td>Stop</td> - * <td>Stop</td> - * <td>Stop</td> - * <td>Stop</td> - * <td>Stop</td> - * <td>Low Power</td> - * <td>Source/Drain biasing</td> - * </tr> - * \endif - * </table> - * - * Before entering device sleep, one of the available sleep modes must be set. - * The device will automatically wake up in response to an interrupt being - * generated or upon any other sleep mode exit condition. - * - * Some peripheral clocks will remain enabled during sleep, depending on their - * configuration. If desired, the modules can remain clocked during sleep to allow - * them continue to operate while other parts of the system are powered down - * to save power. - * - * - * \section asfdoc_sam0_system_special_considerations Special Considerations - * - * Most of the functions in this driver have device specific restrictions and - * caveats; refer to your device datasheet. - * - * - * \section asfdoc_sam0_system_extra_info Extra Information - * - * For extra information, see \ref asfdoc_sam0_system_extra. This includes: - * - \ref asfdoc_sam0_system_extra_acronyms - * - \ref asfdoc_sam0_system_extra_dependencies - * - \ref asfdoc_sam0_system_extra_errata - * - \ref asfdoc_sam0_system_extra_history - * - * - * \section asfdoc_sam0_system_examples Examples - * - * For SYSTEM module related examples, refer to the sub-modules listed in - * the \ref asfdoc_sam0_system_module_overview "Module Overview". - * - * \if DEVICE_SAML21_SYSTEM_SUPPORT - * For a list of examples related to this driver, see - * \ref asfdoc_sam0_drivers_power_exqsg. - * \endif - * - * - * \section asfdoc_sam0_system_api_overview API Overview - * @{ - */ - -/** - * \name System Debugger - * @{ - */ - -/** - * \brief Check if debugger is present. - * - * Check if debugger is connected to the onboard debug system (DAP). - * - * \return A bool identifying if a debugger is present. - * - * \retval true Debugger is connected to the system - * \retval false Debugger is not connected to the system - * - */ -static inline bool system_is_debugger_present(void) -{ - return DSU->STATUSB.reg & DSU_STATUSB_DBGPRES; -} - -/** - * @} - */ - -/** - * \name System Identification - * @{ - */ - -/** - * \brief Retrieve the device identification signature. - * - * Retrieves the signature of the current device. - * - * \return Device ID signature as a 32-bit integer. - */ -static inline uint32_t system_get_device_id(void) -{ - return DSU->DID.reg; -} - -/** - * @} - */ - -/** - * \name System Initialization - * @{ - */ - -void system_init(uint16_t dfll_fine_calibration); - -/** - * @} - */ - - -/** - * @} - */ - -/** - * - * \if DEVICE_SAML21_SYSTEM_SUPPORT - * \page asfdoc_sam0_drivers_power_exqsg Examples for SYSTEM Driver - * - * This is a list of the available Quick Start Guides (QSGs) and example - * applications for \ref asfdoc_sam0_system_group. QSGs are simple examples with step-by-step instructions to - * configure and use this driver in a selection of - * use cases. Note that a QSG can be compiled as a standalone application or be - * added to the user application. - * - * - \subpage asfdoc_sam0_power_basic_use_case - * \endif - * - * \page asfdoc_sam0_system_extra Extra Information for SYSTEM Driver - * - * \section asfdoc_sam0_system_extra_acronyms Acronyms - * Below is a table listing the acronyms used in this module, along with their - * intended meanings. - * - * <table> - * <tr> - * <th>Acronym</th> - * <th>Definition</th> - * </tr> - * <tr> - * <td>PM</td> - * <td>Power Manager</td> - * </tr> - * \if DEVICE_SAML21_SYSTEM_SUPPORT - * <tr> - * <td>SUPC</td> - * <td>Supply Controller</td> - * </tr> - * <tr> - * <td>RSTC</td> - * <td>Reset Controller</td> - * </tr> - * \endif - * \if DEVICE_SAMC21_SYSTEM_SUPPORT - * <tr> - * <td>SUPC</td> - * <td>Supply Controller</td> - * </tr> - * <tr> - * <td>RSTC</td> - * <td>Reset Controller</td> - * </tr> - * \endif - * \if DEVICE_SAMD21_SYSTEM_SUPPORT - * <tr> - * <td>SYSCTRL</td> - * <td>System control interface</td> - * </tr> - * \endif - * </table> - * - * - * \section asfdoc_sam0_system_extra_dependencies Dependencies - * This driver has the following dependencies: - * - * - None - * - * - * \section asfdoc_sam0_system_extra_errata Errata - * There are no errata related to this driver. - * - * - * \section asfdoc_sam0_system_extra_history Module History - * An overview of the module history is presented in the table below, with - * details on the enhancements and fixes made to the module since its first - * release. The current version of this corresponds to the newest version in - * the table. - * - * <table> - * <tr> - * <th>Changelog</th> - * </tr> - * \if DEVICE_SAML21_SYSTEM_SUPPORT - * <tr> - * <td>Initial Release</td> - * </tr> - * \endif - * \if DEVICE_SAMC21_SYSTEM_SUPPORT - * <tr> - * <td>Initial Release</td> - * </tr> - * \endif - * \if DEVICE_SAMD21_SYSTEM_SUPPORT - * <tr> - * <td>Added new \c system_reset() to reset the complete MCU with some exceptions</td> - * </tr> - * <tr> - * <td>Added new \c system_get_device_id() function to retrieved the device - * ID</td> - * </tr> - * <tr> - * <td>Initial Release</td> - * </tr> - * \endif - * </table> - * - * \page asfdoc_sam0_system_document_revision_history Document Revision History - * - * <table> - * <tr> - * <th>Doc. Rev.</th> - * <th>Date</th> - * <th>Comments</th> - * </tr> - * \if DEVICE_SAML21_SYSTEM_SUPPORT - * <tr> - * <td>42449A</td> - * <td>07/2015</td> - * <td>Initial document release</td> - * </tr> - * \endif - * \if DEVICE_SAMC21_SYSTEM_SUPPORT - * <tr> - * <td>42484A</td> - * <td>12/2015</td> - * <td>Initial document release.</td> - * </tr> - * \endif - * \if DEVICE_SAMD21_SYSTEM_SUPPORT - * <tr> - * <td>42120E</td> - * <td>12/2015</td> - * <td>Added support for SAM DA1 and SAM D09</td> - * </tr> - * <tr> - * <td>42120D</td> - * <td>12/2014</td> - * <td>Added support for SAM R21 and SAM D10/D11</td> - * </tr> - * <tr> - * <td>42120C</td> - * <td>01/2014</td> - * <td>Added support for SAM D21</td> - * </tr> - * <tr> - * <td>42120B</td> - * <td>06/2013</td> - * <td>Corrected documentation typos</td> - * </tr> - * <tr> - * <td>42120A</td> - * <td>06/2013</td> - * <td>Initial document release</td> - * </tr> - * \endif - * </table> - */ - -#ifdef __cplusplus -} -#endif - -#endif /* SYSTEM_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/tc/docimg/overview.svg b/atmel-samd/asf/sam0/drivers/tc/docimg/overview.svg deleted file mode 100644 index 895ba938c..000000000 --- a/atmel-samd/asf/sam0/drivers/tc/docimg/overview.svg +++ /dev/null @@ -1,434 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<svg version="1.2" baseProfile="tiny" width="180mm" height="210mm" viewBox="0 0 18000 21000" preserveAspectRatio="xMidYMid" fill-rule="evenodd" stroke-width="28.222" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve"> - <defs> - <font id="EmbeddedFont_1" horiz-adv-x="2048"> - <font-face font-family="Arial" units-per-em="2048" font-weight="normal" font-style="normal" ascent="1852" descent="450"/> - <missing-glyph horiz-adv-x="2048" d="M 0,0 L 2047,0 2047,2047 0,2047 0,0 Z"/> - <glyph unicode="x" horiz-adv-x="954" d="M 15,0 L 403,552 44,1062 269,1062 432,813 C 463,766 487,726 506,694 535,738 562,777 587,811 L 766,1062 981,1062 614,562 1009,0 788,0 570,330 512,419 233,0 15,0 Z"/> - <glyph unicode="v" horiz-adv-x="954" d="M 430,0 L 26,1062 216,1062 444,426 C 469,357 491,286 512,212 528,268 550,335 579,414 L 815,1062 1000,1062 598,0 430,0 Z"/> - <glyph unicode="u" horiz-adv-x="848" d="M 831,0 L 831,156 C 748,36 636,-24 494,-24 431,-24 373,-12 319,12 264,36 224,66 198,103 171,139 153,183 142,236 135,271 131,327 131,404 L 131,1062 311,1062 311,473 C 311,379 315,316 322,283 333,236 357,199 394,172 431,145 476,131 530,131 584,131 635,145 682,173 729,200 763,238 783,286 802,333 812,402 812,493 L 812,1062 992,1062 992,0 831,0 Z"/> - <glyph unicode="t" horiz-adv-x="504" d="M 528,161 L 554,2 C 503,-9 458,-14 418,-14 353,-14 302,-4 266,17 230,38 205,65 190,99 175,132 168,203 168,311 L 168,922 36,922 36,1062 168,1062 168,1325 347,1433 347,1062 528,1062 528,922 347,922 347,301 C 347,250 350,217 357,202 363,187 373,176 388,167 402,158 422,154 449,154 469,154 495,156 528,161 Z"/> - <glyph unicode="s" horiz-adv-x="874" d="M 63,317 L 241,345 C 251,274 279,219 325,181 370,143 434,124 516,124 599,124 660,141 700,175 740,208 760,248 760,293 760,334 742,366 707,389 682,405 621,425 523,450 391,483 300,512 249,537 198,561 159,595 133,638 106,681 93,728 93,780 93,827 104,871 126,912 147,952 177,985 214,1012 242,1033 280,1050 329,1065 377,1079 429,1086 484,1086 567,1086 641,1074 704,1050 767,1026 813,994 843,953 873,912 894,857 905,788 L 729,764 C 721,819 698,861 660,892 621,923 567,938 497,938 414,938 355,924 320,897 285,870 267,838 267,801 267,778 274,757 289,738 304,719 327,703 358,690 376,683 429,668 517,644 644,610 733,582 784,561 834,539 873,507 902,466 931,425 945,373 945,312 945,252 928,196 893,143 858,90 807,49 741,20 675,-9 600,-24 517,-24 379,-24 274,5 202,62 129,119 83,204 63,317 Z"/> - <glyph unicode="r" horiz-adv-x="557" d="M 133,0 L 133,1062 295,1062 295,901 C 336,976 375,1026 410,1050 445,1074 483,1086 525,1086 586,1086 647,1067 710,1028 L 648,861 C 604,887 560,900 516,900 477,900 441,888 410,865 379,841 356,808 343,766 323,702 313,632 313,556 L 313,0 133,0 Z"/> - <glyph unicode="p" horiz-adv-x="901" d="M 135,-407 L 135,1062 299,1062 299,924 C 338,978 381,1019 430,1046 479,1073 538,1086 607,1086 698,1086 778,1063 847,1016 916,969 969,904 1004,819 1039,734 1057,640 1057,539 1057,430 1038,333 999,246 960,159 903,92 829,46 754,-1 676,-24 594,-24 534,-24 480,-11 433,14 385,39 346,71 315,110 L 315,-407 135,-407 Z M 298,525 C 298,388 326,287 381,222 436,157 503,124 582,124 662,124 731,158 788,226 845,293 873,398 873,540 873,675 845,777 790,844 734,911 667,945 590,945 513,945 446,909 387,838 328,766 298,662 298,525 Z"/> - <glyph unicode="o" horiz-adv-x="980" d="M 68,531 C 68,728 123,873 232,968 323,1047 435,1086 566,1086 712,1086 831,1038 924,943 1017,847 1063,715 1063,546 1063,409 1043,302 1002,224 961,145 901,84 823,41 744,-2 659,-24 566,-24 417,-24 297,24 206,119 114,214 68,352 68,531 Z M 253,531 C 253,395 283,293 342,226 401,158 476,124 566,124 655,124 730,158 789,226 848,294 878,398 878,537 878,668 848,768 789,836 729,903 655,937 566,937 476,937 401,903 342,836 283,769 253,667 253,531 Z"/> - <glyph unicode="n" horiz-adv-x="848" d="M 135,0 L 135,1062 297,1062 297,911 C 375,1028 488,1086 635,1086 699,1086 758,1075 812,1052 865,1029 905,998 932,961 959,924 977,879 988,828 995,795 998,736 998,653 L 998,0 818,0 818,646 C 818,719 811,774 797,811 783,847 758,876 723,898 687,919 645,930 597,930 520,930 454,906 399,857 343,808 315,716 315,580 L 315,0 135,0 Z"/> - <glyph unicode="m" horiz-adv-x="1457" d="M 135,0 L 135,1062 296,1062 296,913 C 329,965 374,1007 429,1039 484,1070 547,1086 618,1086 697,1086 761,1070 812,1037 862,1004 897,959 918,900 1002,1024 1111,1086 1246,1086 1351,1086 1432,1057 1489,999 1546,940 1574,850 1574,729 L 1574,0 1395,0 1395,669 C 1395,741 1389,793 1378,825 1366,856 1345,882 1314,901 1283,920 1247,930 1206,930 1131,930 1069,905 1020,856 971,806 946,726 946,617 L 946,0 766,0 766,690 C 766,770 751,830 722,870 693,910 645,930 578,930 527,930 481,917 438,890 395,863 363,824 344,773 325,722 315,648 315,551 L 315,0 135,0 Z"/> - <glyph unicode="l" horiz-adv-x="186" d="M 131,0 L 131,1466 311,1466 311,0 131,0 Z"/> - <glyph unicode="i" horiz-adv-x="160" d="M 136,1259 L 136,1466 316,1466 316,1259 136,1259 Z M 136,0 L 136,1062 316,1062 316,0 136,0 Z"/> - <glyph unicode="h" horiz-adv-x="848" d="M 135,0 L 135,1466 315,1466 315,940 C 399,1037 505,1086 633,1086 712,1086 780,1071 838,1040 896,1009 938,966 963,911 988,856 1000,777 1000,673 L 1000,0 820,0 820,673 C 820,763 801,829 762,870 723,911 667,931 596,931 543,931 493,917 446,890 399,862 365,824 345,777 325,730 315,664 315,581 L 315,0 135,0 Z"/> - <glyph unicode="g" horiz-adv-x="927" d="M 102,-88 L 277,-114 C 284,-168 305,-207 338,-232 383,-265 444,-282 521,-282 604,-282 669,-265 714,-232 759,-199 790,-152 806,-92 815,-55 820,22 819,139 740,46 642,0 525,0 379,0 266,53 186,158 106,263 66,390 66,537 66,638 84,732 121,818 158,903 211,969 281,1016 350,1063 432,1086 526,1086 651,1086 755,1035 836,934 L 836,1062 1002,1062 1002,144 C 1002,-21 985,-138 952,-207 918,-276 865,-331 792,-371 719,-411 629,-431 522,-431 395,-431 293,-402 215,-345 137,-288 99,-203 102,-88 Z M 251,550 C 251,411 279,309 334,245 389,181 459,149 542,149 625,149 694,181 750,245 806,308 834,408 834,544 834,674 805,772 748,838 690,904 620,937 539,937 459,937 391,905 335,840 279,775 251,678 251,550 Z"/> - <glyph unicode="f" horiz-adv-x="610" d="M 178,0 L 178,922 19,922 19,1062 178,1062 178,1175 C 178,1246 184,1299 197,1334 214,1381 245,1419 289,1448 332,1477 393,1491 472,1491 523,1491 579,1485 640,1473 L 613,1316 C 576,1323 540,1326 507,1326 452,1326 414,1314 391,1291 368,1268 357,1224 357,1160 L 357,1062 564,1062 564,922 357,922 357,0 178,0 Z"/> - <glyph unicode="e" horiz-adv-x="980" d="M 862,342 L 1048,319 C 1019,210 964,126 885,66 806,6 704,-24 581,-24 426,-24 303,24 212,120 121,215 75,349 75,522 75,701 121,839 213,938 305,1037 424,1086 571,1086 713,1086 829,1038 919,941 1009,844 1054,708 1054,533 1054,522 1054,506 1053,485 L 261,485 C 268,368 301,279 360,217 419,155 493,124 582,124 648,124 704,141 751,176 798,211 835,266 862,342 Z M 271,633 L 864,633 C 856,722 833,789 796,834 739,903 664,938 573,938 490,938 421,910 365,855 308,800 277,726 271,633 Z"/> - <glyph unicode="c" horiz-adv-x="927" d="M 828,389 L 1005,366 C 986,244 936,149 857,80 777,11 679,-24 563,-24 418,-24 301,24 213,119 124,214 80,350 80,527 80,642 99,742 137,828 175,914 233,979 311,1022 388,1065 473,1086 564,1086 679,1086 774,1057 847,999 920,940 967,857 988,750 L 813,723 C 796,794 767,848 725,884 682,920 631,938 571,938 480,938 407,906 350,841 293,776 265,673 265,532 265,389 292,286 347,221 402,156 473,124 561,124 632,124 691,146 738,189 785,232 815,299 828,389 Z"/> - <glyph unicode="a" horiz-adv-x="980" d="M 828,131 C 761,74 697,34 636,11 574,-12 508,-24 437,-24 320,-24 231,5 168,62 105,119 74,191 74,280 74,332 86,380 110,423 133,466 164,500 203,526 241,552 284,572 332,585 367,594 421,603 492,612 637,629 744,650 813,674 814,699 814,714 814,721 814,794 797,846 763,876 717,917 649,937 558,937 473,937 411,922 371,893 330,863 300,810 281,735 L 105,759 C 121,834 147,895 184,942 221,988 274,1024 343,1049 412,1074 493,1086 584,1086 675,1086 748,1075 805,1054 862,1033 903,1006 930,974 957,941 975,900 986,851 992,820 995,765 995,685 L 995,445 C 995,278 999,172 1007,128 1014,83 1029,41 1052,0 L 864,0 C 845,37 833,81 828,131 Z M 813,533 C 748,506 650,484 519,465 445,454 393,442 362,429 331,416 308,396 291,371 274,345 266,316 266,285 266,237 284,197 321,165 357,133 410,117 480,117 549,117 611,132 665,163 719,193 759,234 784,287 803,328 813,388 813,467 L 813,533 Z"/> - <glyph unicode="_" horiz-adv-x="1192" d="M -31,-407 L -31,-277 1162,-277 1162,-407 -31,-407 Z"/> - <glyph unicode="W" horiz-adv-x="1986" d="M 414,0 L 25,1466 224,1466 447,505 C 471,404 492,304 509,205 546,362 568,452 575,476 L 854,1466 1088,1466 1298,724 C 1351,540 1389,367 1412,205 1431,298 1455,404 1485,524 L 1715,1466 1910,1466 1508,0 1321,0 1012,1117 C 986,1210 971,1268 966,1289 951,1222 936,1164 923,1117 L 612,0 414,0 Z"/> - <glyph unicode="T" horiz-adv-x="1166" d="M 531,0 L 531,1293 48,1293 48,1466 1210,1466 1210,1293 725,1293 725,0 531,0 Z"/> - <glyph unicode="P" horiz-adv-x="1113" d="M 158,0 L 158,1466 711,1466 C 808,1466 883,1461 934,1452 1006,1440 1066,1417 1115,1384 1164,1350 1203,1303 1233,1242 1262,1181 1277,1115 1277,1042 1277,917 1237,812 1158,726 1079,639 935,596 728,596 L 352,596 352,0 158,0 Z M 352,769 L 731,769 C 856,769 945,792 998,839 1051,886 1077,951 1077,1036 1077,1097 1062,1150 1031,1194 1000,1237 959,1266 908,1280 875,1289 815,1293 727,1293 L 352,1293 352,769 Z"/> - <glyph unicode="O" horiz-adv-x="1404" d="M 99,714 C 99,957 164,1148 295,1286 426,1423 594,1492 801,1492 936,1492 1058,1460 1167,1395 1276,1330 1359,1240 1416,1125 1473,1009 1501,878 1501,731 1501,582 1471,449 1411,332 1351,215 1266,126 1156,66 1046,5 927,-25 800,-25 662,-25 539,8 430,75 321,142 239,233 183,348 127,463 99,585 99,714 Z M 299,711 C 299,534 347,395 442,294 537,192 656,141 799,141 945,141 1065,192 1160,295 1254,398 1301,543 1301,732 1301,851 1281,956 1241,1045 1200,1134 1141,1203 1064,1252 986,1301 899,1325 802,1325 665,1325 547,1278 448,1184 349,1089 299,932 299,711 Z"/> - <glyph unicode="L" horiz-adv-x="927" d="M 150,0 L 150,1466 344,1466 344,173 1066,173 1066,0 150,0 Z"/> - <glyph unicode="K" horiz-adv-x="1192" d="M 150,0 L 150,1466 344,1466 344,739 1072,1466 1335,1466 720,872 1362,0 1106,0 584,742 344,508 344,0 150,0 Z"/> - <glyph unicode="I" horiz-adv-x="186" d="M 191,0 L 191,1466 385,1466 385,0 191,0 Z"/> - <glyph unicode="G" horiz-adv-x="1350" d="M 844,575 L 844,747 1465,748 1465,204 C 1370,128 1271,71 1170,33 1069,-6 965,-25 858,-25 714,-25 583,6 466,68 348,129 259,218 199,335 139,452 109,582 109,726 109,869 139,1002 199,1126 258,1249 344,1341 456,1401 568,1461 697,1491 843,1491 949,1491 1045,1474 1131,1440 1216,1405 1283,1357 1332,1296 1381,1235 1418,1155 1443,1056 L 1268,1008 C 1246,1083 1219,1141 1186,1184 1153,1227 1107,1261 1046,1287 985,1312 918,1325 844,1325 755,1325 679,1312 614,1285 549,1258 497,1222 458,1178 418,1134 387,1086 365,1033 328,942 309,844 309,738 309,607 332,498 377,410 422,322 487,257 573,214 659,171 750,150 847,150 931,150 1013,166 1093,199 1173,231 1234,265 1275,302 L 1275,575 844,575 Z"/> - <glyph unicode="E" horiz-adv-x="1059" d="M 162,0 L 162,1466 1222,1466 1222,1293 356,1293 356,844 1167,844 1167,672 356,672 356,173 1256,173 1256,0 162,0 Z"/> - <glyph unicode="C" horiz-adv-x="1298" d="M 1204,514 L 1398,465 C 1357,306 1284,184 1179,101 1073,17 944,-25 791,-25 633,-25 505,7 406,72 307,136 231,229 180,351 128,473 102,604 102,744 102,897 131,1030 190,1144 248,1257 331,1344 439,1403 546,1462 665,1491 794,1491 941,1491 1064,1454 1164,1379 1264,1304 1334,1199 1373,1064 L 1182,1019 C 1148,1126 1099,1203 1034,1252 969,1301 888,1325 790,1325 677,1325 583,1298 508,1244 432,1190 379,1118 348,1027 317,936 302,842 302,745 302,620 320,512 357,419 393,326 449,256 526,210 603,164 686,141 775,141 884,141 976,172 1051,235 1126,298 1177,391 1204,514 Z"/> - <glyph unicode="B" horiz-adv-x="1086" d="M 150,0 L 150,1466 700,1466 C 812,1466 902,1451 970,1422 1037,1392 1090,1346 1129,1285 1167,1223 1186,1158 1186,1091 1186,1028 1169,969 1135,914 1101,859 1050,814 981,780 1070,754 1138,710 1186,647 1233,584 1257,510 1257,425 1257,356 1243,293 1214,234 1185,175 1149,129 1106,97 1063,65 1010,41 946,25 881,8 802,0 709,0 L 150,0 Z M 344,850 L 661,850 C 747,850 809,856 846,867 895,882 933,906 958,940 983,974 995,1017 995,1068 995,1117 983,1160 960,1197 937,1234 903,1259 860,1273 817,1286 742,1293 637,1293 L 344,1293 344,850 Z M 344,173 L 709,173 C 772,173 816,175 841,180 886,188 923,201 953,220 983,239 1008,266 1027,302 1046,337 1056,378 1056,425 1056,480 1042,527 1014,568 986,608 947,636 898,653 848,669 776,677 683,677 L 344,677 344,173 Z"/> - <glyph unicode="=" horiz-adv-x="953" d="M 1082,862 L 114,862 114,1030 1082,1030 1082,862 Z M 1082,417 L 114,417 114,585 1082,585 1082,417 Z"/> - <glyph unicode="1" horiz-adv-x="530" d="M 763,0 L 583,0 583,1147 C 540,1106 483,1064 413,1023 342,982 279,951 223,930 L 223,1104 C 324,1151 412,1209 487,1276 562,1343 616,1409 647,1472 L 763,1472 763,0 Z"/> - <glyph unicode="0" horiz-adv-x="954" d="M 85,723 C 85,896 103,1036 139,1142 174,1247 227,1329 298,1386 368,1443 456,1472 563,1472 642,1472 711,1456 770,1425 829,1393 878,1347 917,1288 956,1228 986,1155 1008,1070 1030,984 1041,868 1041,723 1041,551 1023,412 988,307 953,201 900,119 830,62 759,4 670,-25 563,-25 422,-25 311,26 230,127 133,249 85,448 85,723 Z M 270,723 C 270,482 298,322 355,243 411,163 480,123 563,123 646,123 715,163 772,243 828,323 856,483 856,723 856,964 828,1125 772,1204 715,1283 645,1323 561,1323 478,1323 412,1288 363,1218 301,1129 270,964 270,723 Z"/> - <glyph unicode="/" horiz-adv-x="557" d="M 0,-25 L 425,1491 569,1491 145,-25 0,-25 Z"/> - <glyph unicode="." horiz-adv-x="212" d="M 186,0 L 186,205 391,205 391,0 186,0 Z"/> - <glyph unicode=" " horiz-adv-x="556"/> - </font> - </defs> - <g visibility="visible" id="MasterSlide_1_Default"> - <desc>Master slide - </desc> - <rect fill="none" stroke="none" x="0" y="0" width="18000" height="21000"/> - </g> - <g visibility="visible" id="Slide_1_page1"> - <g> - <path fill="rgb(255,255,255)" stroke="rgb(0,0,0)" id="Drawing_1_0" stroke-width="50" stroke-linejoin="round" d="M 7506,8480 L 900,8480 900,2000 14111,2000 14111,8480 7506,8480 Z"/> - </g> - <g id="Drawing_2"> - <path fill="rgb(255,255,255)" stroke="rgb(0,0,0)" stroke-width="50" stroke-linejoin="round" d="M 4966,7508 L 2134,7508 2134,5483 7797,5483 7797,7508 4966,7508 Z"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="423" font-style="normal" font-weight="400"> - <text x="4210" y="6640">C</text> - <text x="4515" y="6640">o</text> - <text x="4752" y="6640">u</text> - <text x="4989" y="6640">n</text> - <text x="5226" y="6640">t</text> - <text x="5345" y="6640">e</text> - <text x="5582" y="6640">r</text> - </g> - </g> - <g id="Drawing_3"> - <path fill="rgb(255,255,255)" stroke="rgb(0,0,0)" stroke-width="50" stroke-linejoin="round" d="M 4966,4430 L 2134,4430 2134,3701 7797,3701 7797,4430 4966,4430 Z"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="423" font-style="normal" font-weight="400"> - <text x="4070" y="4210">P</text> - <text x="4354" y="4210">r</text> - <text x="4493" y="4210">e</text> - <text x="4730" y="4210">s</text> - <text x="4942" y="4210">c</text> - <text x="5154" y="4210">a</text> - <text x="5391" y="4210">l</text> - <text x="5484" y="4210">e</text> - <text x="5721" y="4210">r</text> - </g> - </g> - <g id="Drawing_4"> - <rect fill="none" stroke="none" x="1924" y="2040" width="6083" height="1261"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="423" font-style="normal" font-weight="400"> - <text x="2174" y="2546">B</text> - <text x="2458" y="2546">a</text> - <text x="2695" y="2546">s</text> - <text x="2906" y="2546">e</text> - <text x="3143" y="2546"> </text> - <text x="3262" y="2546">C</text> - <text x="3567" y="2546">o</text> - <text x="3804" y="2546">u</text> - <text x="4041" y="2546">n</text> - <text x="4278" y="2546">t</text> - <text x="4397" y="2546">e</text> - <text x="4634" y="2546">r</text> - </g> - </g> - <g id="Drawing_5"> - <path fill="rgb(255,255,255)" stroke="rgb(0,0,0)" stroke-width="50" stroke-linejoin="round" d="M 10963,5605 L 9180,5605 9180,3580 12746,3580 12746,5605 10963,5605 Z"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="423" font-style="normal" font-weight="400"> - <text x="9714" y="4737">C</text> - <text x="10019" y="4737">o</text> - <text x="10256" y="4737">n</text> - <text x="10493" y="4737">t</text> - <text x="10611" y="4737">r</text> - <text x="10751" y="4737">o</text> - <text x="10988" y="4737">l</text> - <text x="11081" y="4737"> </text> - <text x="11200" y="4737">L</text> - <text x="11437" y="4737">o</text> - <text x="11674" y="4737">g</text> - <text x="11907" y="4737">i</text> - <text x="12000" y="4737">c</text> - </g> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 8247,6495 L 10963,6495 10963,6055"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_6_0" d="M 7797,6495 L 8360,6683 8360,6308 7797,6495 Z"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_6_1" d="M 10963,5605 L 10776,6168 11151,6168 10963,5605 Z"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 4965,4430 L 4965,5033"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_7_0" d="M 4965,5483 L 5153,4921 4778,4921 4965,5483 Z"/> - </g> - <g> - <path fill="rgb(255,255,255)" stroke="rgb(0,0,0)" id="Drawing_8_0" stroke-width="50" stroke-linejoin="round" d="M 8024,17465 L 1500,17465 1500,9605 14548,9605 14548,17465 8024,17465 Z"/> - </g> - <g id="Drawing_9"> - <rect fill="none" stroke="none" x="6100" y="9500" width="4455" height="726"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="423" font-style="normal" font-weight="400"> - <text x="6350" y="10006">C</text> - <text x="6655" y="10006">o</text> - <text x="6892" y="10006">m</text> - <text x="7247" y="10006">p</text> - <text x="7485" y="10006">a</text> - <text x="7722" y="10006">r</text> - <text x="7861" y="10006">e</text> - <text x="8098" y="10006"> </text> - <text x="8217" y="10006">C</text> - <text x="8522" y="10006">a</text> - <text x="8759" y="10006">p</text> - <text x="8996" y="10006">t</text> - <text x="9114" y="10006">u</text> - <text x="9351" y="10006">r</text> - <text x="9491" y="10006">e</text> - <text x="9728" y="10006"> </text> - <text x="9847" y="10006">n</text> - </g> - </g> - <g> - <path fill="rgb(255,255,255)" stroke="rgb(0,0,0)" id="Drawing_10_0" stroke-width="50" stroke-linejoin="round" d="M 7825,18060 L 1300,18060 1300,10200 14349,10200 14349,18060 7825,18060 Z"/> - </g> - <g id="Drawing_11"> - <rect fill="none" stroke="none" x="5805" y="10125" width="4453" height="727"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="423" font-style="normal" font-weight="400"> - <text x="6055" y="10631">C</text> - <text x="6360" y="10631">o</text> - <text x="6597" y="10631">m</text> - <text x="6952" y="10631">p</text> - <text x="7190" y="10631">a</text> - <text x="7427" y="10631">r</text> - <text x="7566" y="10631">e</text> - <text x="7803" y="10631"> </text> - <text x="7922" y="10631">C</text> - <text x="8227" y="10631">a</text> - <text x="8464" y="10631">p</text> - <text x="8701" y="10631">t</text> - <text x="8819" y="10631">u</text> - <text x="9056" y="10631">r</text> - <text x="9196" y="10631">e</text> - <text x="9433" y="10631"> </text> - <text x="9552" y="10631">.</text> - <text x="9670" y="10631">.</text> - <text x="9789" y="10631">.</text> - </g> - </g> - <g> - <path fill="rgb(255,255,255)" stroke="rgb(0,0,0)" id="Drawing_12_0" stroke-width="50" stroke-linejoin="round" d="M 7624,18700 L 1100,18700 1100,10841 14148,10841 14148,18700 7624,18700 Z"/> - </g> - <g id="Drawing_13"> - <rect fill="none" stroke="none" x="5319" y="10826" width="4453" height="726"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="423" font-style="normal" font-weight="400"> - <text x="5569" y="11332">C</text> - <text x="5874" y="11332">o</text> - <text x="6111" y="11332">m</text> - <text x="6466" y="11332">p</text> - <text x="6704" y="11332">a</text> - <text x="6941" y="11332">r</text> - <text x="7080" y="11332">e</text> - <text x="7317" y="11332"> </text> - <text x="7436" y="11332">C</text> - <text x="7741" y="11332">a</text> - <text x="7978" y="11332">p</text> - <text x="8215" y="11332">t</text> - <text x="8333" y="11332">u</text> - <text x="8570" y="11332">r</text> - <text x="8710" y="11332">e</text> - <text x="8947" y="11332"> </text> - <text x="9066" y="11332">1</text> - </g> - </g> - <g> - <path fill="rgb(255,255,255)" stroke="rgb(0,0,0)" id="Drawing_14_0" stroke-width="50" stroke-linejoin="round" d="M 7433,19323 L 910,19323 910,11462 13956,11462 13956,19323 7433,19323 Z"/> - </g> - <g id="Drawing_15"> - <path fill="rgb(255,255,255)" stroke="rgb(0,0,0)" stroke-width="50" stroke-linejoin="round" d="M 10963,14376 L 8840,14376 8840,12350 13086,12350 13086,14376 10963,14376 Z"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="423" font-style="normal" font-weight="400"> - <text x="9714" y="13507">C</text> - <text x="10019" y="13507">o</text> - <text x="10256" y="13507">n</text> - <text x="10493" y="13507">t</text> - <text x="10611" y="13507">r</text> - <text x="10751" y="13507">o</text> - <text x="10988" y="13507">l</text> - <text x="11081" y="13507"> </text> - <text x="11200" y="13507">L</text> - <text x="11437" y="13507">o</text> - <text x="11674" y="13507">g</text> - <text x="11907" y="13507">i</text> - <text x="12000" y="13507">c</text> - </g> - </g> - <g id="Drawing_16"> - <rect fill="none" stroke="none" x="4946" y="11400" width="4455" height="726"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="423" font-style="normal" font-weight="400"> - <text x="5196" y="11906">C</text> - <text x="5501" y="11906">o</text> - <text x="5738" y="11906">m</text> - <text x="6093" y="11906">p</text> - <text x="6331" y="11906">a</text> - <text x="6568" y="11906">r</text> - <text x="6707" y="11906">e</text> - <text x="6944" y="11906"> </text> - <text x="7063" y="11906">C</text> - <text x="7368" y="11906">a</text> - <text x="7605" y="11906">p</text> - <text x="7842" y="11906">t</text> - <text x="7960" y="11906">u</text> - <text x="8197" y="11906">r</text> - <text x="8337" y="11906">e</text> - <text x="8574" y="11906"> </text> - <text x="8693" y="11906">0</text> - </g> - </g> - <g id="Drawing_17"> - <path fill="rgb(255,255,255)" stroke="rgb(0,0,0)" stroke-width="50" stroke-linejoin="round" d="M 10963,17375 L 8840,17375 8840,15349 13086,15349 13086,17375 10963,17375 Z"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="423" font-style="normal" font-weight="400"> - <text x="9935" y="16269">W</text> - <text x="10337" y="16269">a</text> - <text x="10574" y="16269">v</text> - <text x="10782" y="16269">e</text> - <text x="11019" y="16269">f</text> - <text x="11142" y="16269">o</text> - <text x="11379" y="16269">r</text> - <text x="11518" y="16269">m</text> - <text x="11874" y="16269"> </text> - <text fill="rgb(0,0,0)" stroke="none" x="9911" y="16743">G</text> - <text x="10241" y="16743">e</text> - <text x="10478" y="16743">n</text> - <text x="10715" y="16743">e</text> - <text x="10952" y="16743">r</text> - <text x="11092" y="16743">a</text> - <text x="11329" y="16743">t</text> - <text x="11448" y="16743">i</text> - <text x="11541" y="16743">o</text> - <text x="11778" y="16743">n</text> - </g> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 10963,14376 L 10963,14899"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_18_0" d="M 10963,15349 L 11151,14787 10776,14787 10963,15349 Z"/> - </g> - <g id="Drawing_19"> - <path fill="rgb(255,255,255)" stroke="rgb(0,0,0)" stroke-width="50" stroke-linejoin="round" d="M 4966,15735 L 2894,15735 2894,15006 7037,15006 7037,15735 4966,15735 Z"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="423" font-style="normal" font-weight="400"> - <text x="4542" y="15515">C</text> - <text x="4847" y="15515">C</text> - <text x="5152" y="15515">0</text> - </g> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 7037,15370 L 7939,15370 7939,16362 8390,16362"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_20_0" d="M 8840,16362 L 8278,16175 8278,16550 8840,16362 Z"/> - </g> - <g id="Drawing_21"> - <path fill="rgb(255,255,255)" stroke="rgb(0,0,0)" stroke-width="50" stroke-linejoin="round" d="M 4966,18895 L 2894,18895 2894,18166 7037,18166 7037,18895 4966,18895 Z"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="635" font-style="normal" font-weight="400"> - <text x="4779" y="18747">=</text> - </g> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 4965,15735 L 4965,17716"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_22_0" d="M 4965,18166 L 5153,17604 4778,17604 4965,18166 Z"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 7037,18530 L 10963,18530 10963,17825"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_23_0" d="M 10963,17375 L 10776,17938 11151,17938 10963,17375 Z"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 10950,18320 L 10958,19888"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_24_0" d="M 10960,20338 L 11145,19775 10770,19776 10960,20338 Z"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 4965,7508 L 4965,14556"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_25_0" d="M 4965,15006 L 5153,14444 4778,14444 4965,15006 Z"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 9180,4592 L 8489,4592 8489,4065 8247,4065"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_26_0" d="M 7797,4065 L 8360,4253 8360,3878 7797,4065 Z"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 17000,2700 L 14812,2700"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_27_0" d="M 14200,2700 L 14965,2955 14965,2445 14200,2700 Z"/> - </g> - <g id="Drawing_28"> - <rect fill="none" stroke="none" x="14800" y="1800" width="2501" height="851"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="423" font-style="normal" font-weight="400"> - <text x="15050" y="2306">G</text> - <text x="15380" y="2306">C</text> - <text x="15685" y="2306">L</text> - <text x="15922" y="2306">K</text> - <text x="16206" y="2306">_</text> - <text x="16443" y="2306">T</text> - <text x="16705" y="2306">C</text> - </g> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 14200,2700 L 4965,2700 4965,3251"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_29_0" d="M 4965,3701 L 5153,3139 4778,3139 4965,3701 Z"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 10963,2700 L 10963,3150"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_30_0" d="M 10963,3600 L 11151,3038 10776,3038 10963,3600 Z"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 15600,2700 L 15600,13535 15160,13535"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_31_0" d="M 14548,13535 L 15313,13790 15313,13280 14548,13535 Z"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 12100,17400 L 12100,19950"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_32_0" d="M 12100,20400 L 12288,19838 11913,19838 12100,20400 Z"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_33_0" stroke-linejoin="round" d=""/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 4965,15006 L 4965,13800 1992,13800 1992,18530 2444,18530"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_34_0" d="M 2894,18530 L 2332,18343 2332,18718 2894,18530 Z"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 11800,3600 L 11800,1150"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_35_0" d="M 11800,700 L 11613,1263 11988,1263 11800,700 Z"/> - </g> - <g id="Drawing_36"> - <rect fill="none" stroke="none" x="7200" y="19700" width="3401" height="1200"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="423" font-style="normal" font-weight="400"> - <text x="7450" y="20206">I</text> - <text x="7569" y="20206">n</text> - <text x="7806" y="20206">t</text> - <text x="7924" y="20206">e</text> - <text x="8161" y="20206">r</text> - <text x="8301" y="20206">r</text> - <text x="8441" y="20206">u</text> - <text x="8678" y="20206">p</text> - <text x="8915" y="20206">t</text> - <text x="9033" y="20206">/</text> - <text fill="rgb(0,0,0)" stroke="none" x="7450" y="20680">E</text> - <text x="7734" y="20680">v</text> - <text x="7941" y="20680">e</text> - <text x="8178" y="20680">n</text> - <text x="8415" y="20680">t</text> - <text x="8534" y="20680"> </text> - <text x="8652" y="20680">C</text> - <text x="8957" y="20680">h</text> - <text x="9194" y="20680">a</text> - <text x="9431" y="20680">n</text> - <text x="9668" y="20680">n</text> - <text x="9905" y="20680">e</text> - <text x="10142" y="20680">l</text> - </g> - </g> - <g id="Drawing_37"> - <rect fill="none" stroke="none" x="12100" y="300" width="3501" height="1200"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="423" font-style="normal" font-weight="400"> - <text x="12350" y="806">I</text> - <text x="12469" y="806">n</text> - <text x="12706" y="806">t</text> - <text x="12824" y="806">e</text> - <text x="13061" y="806">r</text> - <text x="13201" y="806">r</text> - <text x="13341" y="806">u</text> - <text x="13578" y="806">p</text> - <text x="13815" y="806">t</text> - <text x="13933" y="806">/</text> - <text fill="rgb(0,0,0)" stroke="none" x="12350" y="1280">E</text> - <text x="12634" y="1280">v</text> - <text x="12841" y="1280">e</text> - <text x="13078" y="1280">n</text> - <text x="13315" y="1280">t</text> - <text x="13434" y="1280"> </text> - <text x="13552" y="1280">C</text> - <text x="13857" y="1280">h</text> - <text x="14094" y="1280">a</text> - <text x="14331" y="1280">n</text> - <text x="14568" y="1280">n</text> - <text x="14805" y="1280">e</text> - <text x="15042" y="1280">l</text> - </g> - </g> - <g id="Drawing_38"> - <rect fill="none" stroke="none" x="12300" y="19550" width="2401" height="1151"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="423" font-style="normal" font-weight="400"> - <text x="12550" y="20056">W</text> - <text x="12969" y="20056">O</text> - <text x="13299" y="20056">x</text> - <text x="13507" y="20056"> </text> - <text x="13625" y="20056">O</text> - <text x="13955" y="20056">u</text> - <text x="14193" y="20056">t</text> - </g> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 11700,6500 L 11700,6068"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_39_0" d="M 11700,5600 L 11505,6185 11895,6185 11700,5600 Z"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_40_0" stroke-width="50" stroke-linejoin="round" d="M 11700,7000 L 11700,6500"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 11700,7000 L 11700,9000 10963,9000 10963,11900"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_41_0" d="M 10963,12350 L 11151,11788 10776,11788 10963,12350 Z"/> - </g> - </g> -</svg>
\ No newline at end of file diff --git a/atmel-samd/asf/sam0/drivers/tc/docimg/pwm_match_ex.svg b/atmel-samd/asf/sam0/drivers/tc/docimg/pwm_match_ex.svg deleted file mode 100644 index 3eed8c70f..000000000 --- a/atmel-samd/asf/sam0/drivers/tc/docimg/pwm_match_ex.svg +++ /dev/null @@ -1,431 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<svg version="1.2" baseProfile="tiny" width="160mm" height="90mm" viewBox="0 0 16000 9000" preserveAspectRatio="xMidYMid" fill-rule="evenodd" stroke-width="28.222" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve"> - <defs> - <font id="EmbeddedFont_1" horiz-adv-x="2048"> - <font-face font-family="Arial" units-per-em="2048" font-weight="normal" font-style="normal" ascent="1852" descent="450"/> - <missing-glyph horiz-adv-x="2048" d="M 0,0 L 2047,0 2047,2047 0,2047 0,0 Z"/> - <glyph unicode="x" horiz-adv-x="954" d="M 15,0 L 403,552 44,1062 269,1062 432,813 C 463,766 487,726 506,694 535,738 562,777 587,811 L 766,1062 981,1062 614,562 1009,0 788,0 570,330 512,419 233,0 15,0 Z"/> - <glyph unicode="w" horiz-adv-x="1430" d="M 331,0 L 6,1062 192,1062 361,449 424,221 C 427,232 445,305 479,440 L 648,1062 833,1062 992,446 1045,243 1106,448 1288,1062 1463,1062 1131,0 944,0 775,636 734,817 519,0 331,0 Z"/> - <glyph unicode="v" horiz-adv-x="954" d="M 430,0 L 26,1062 216,1062 444,426 C 469,357 491,286 512,212 528,268 550,335 579,414 L 815,1062 1000,1062 598,0 430,0 Z"/> - <glyph unicode="u" horiz-adv-x="848" d="M 831,0 L 831,156 C 748,36 636,-24 494,-24 431,-24 373,-12 319,12 264,36 224,66 198,103 171,139 153,183 142,236 135,271 131,327 131,404 L 131,1062 311,1062 311,473 C 311,379 315,316 322,283 333,236 357,199 394,172 431,145 476,131 530,131 584,131 635,145 682,173 729,200 763,238 783,286 802,333 812,402 812,493 L 812,1062 992,1062 992,0 831,0 Z"/> - <glyph unicode="t" horiz-adv-x="504" d="M 528,161 L 554,2 C 503,-9 458,-14 418,-14 353,-14 302,-4 266,17 230,38 205,65 190,99 175,132 168,203 168,311 L 168,922 36,922 36,1062 168,1062 168,1325 347,1433 347,1062 528,1062 528,922 347,922 347,301 C 347,250 350,217 357,202 363,187 373,176 388,167 402,158 422,154 449,154 469,154 495,156 528,161 Z"/> - <glyph unicode="s" horiz-adv-x="874" d="M 63,317 L 241,345 C 251,274 279,219 325,181 370,143 434,124 516,124 599,124 660,141 700,175 740,208 760,248 760,293 760,334 742,366 707,389 682,405 621,425 523,450 391,483 300,512 249,537 198,561 159,595 133,638 106,681 93,728 93,780 93,827 104,871 126,912 147,952 177,985 214,1012 242,1033 280,1050 329,1065 377,1079 429,1086 484,1086 567,1086 641,1074 704,1050 767,1026 813,994 843,953 873,912 894,857 905,788 L 729,764 C 721,819 698,861 660,892 621,923 567,938 497,938 414,938 355,924 320,897 285,870 267,838 267,801 267,778 274,757 289,738 304,719 327,703 358,690 376,683 429,668 517,644 644,610 733,582 784,561 834,539 873,507 902,466 931,425 945,373 945,312 945,252 928,196 893,143 858,90 807,49 741,20 675,-9 600,-24 517,-24 379,-24 274,5 202,62 129,119 83,204 63,317 Z"/> - <glyph unicode="r" horiz-adv-x="557" d="M 133,0 L 133,1062 295,1062 295,901 C 336,976 375,1026 410,1050 445,1074 483,1086 525,1086 586,1086 647,1067 710,1028 L 648,861 C 604,887 560,900 516,900 477,900 441,888 410,865 379,841 356,808 343,766 323,702 313,632 313,556 L 313,0 133,0 Z"/> - <glyph unicode="p" horiz-adv-x="901" d="M 135,-407 L 135,1062 299,1062 299,924 C 338,978 381,1019 430,1046 479,1073 538,1086 607,1086 698,1086 778,1063 847,1016 916,969 969,904 1004,819 1039,734 1057,640 1057,539 1057,430 1038,333 999,246 960,159 903,92 829,46 754,-1 676,-24 594,-24 534,-24 480,-11 433,14 385,39 346,71 315,110 L 315,-407 135,-407 Z M 298,525 C 298,388 326,287 381,222 436,157 503,124 582,124 662,124 731,158 788,226 845,293 873,398 873,540 873,675 845,777 790,844 734,911 667,945 590,945 513,945 446,909 387,838 328,766 298,662 298,525 Z"/> - <glyph unicode="o" horiz-adv-x="980" d="M 68,531 C 68,728 123,873 232,968 323,1047 435,1086 566,1086 712,1086 831,1038 924,943 1017,847 1063,715 1063,546 1063,409 1043,302 1002,224 961,145 901,84 823,41 744,-2 659,-24 566,-24 417,-24 297,24 206,119 114,214 68,352 68,531 Z M 253,531 C 253,395 283,293 342,226 401,158 476,124 566,124 655,124 730,158 789,226 848,294 878,398 878,537 878,668 848,768 789,836 729,903 655,937 566,937 476,937 401,903 342,836 283,769 253,667 253,531 Z"/> - <glyph unicode="n" horiz-adv-x="848" d="M 135,0 L 135,1062 297,1062 297,911 C 375,1028 488,1086 635,1086 699,1086 758,1075 812,1052 865,1029 905,998 932,961 959,924 977,879 988,828 995,795 998,736 998,653 L 998,0 818,0 818,646 C 818,719 811,774 797,811 783,847 758,876 723,898 687,919 645,930 597,930 520,930 454,906 399,857 343,808 315,716 315,580 L 315,0 135,0 Z"/> - <glyph unicode="m" horiz-adv-x="1457" d="M 135,0 L 135,1062 296,1062 296,913 C 329,965 374,1007 429,1039 484,1070 547,1086 618,1086 697,1086 761,1070 812,1037 862,1004 897,959 918,900 1002,1024 1111,1086 1246,1086 1351,1086 1432,1057 1489,999 1546,940 1574,850 1574,729 L 1574,0 1395,0 1395,669 C 1395,741 1389,793 1378,825 1366,856 1345,882 1314,901 1283,920 1247,930 1206,930 1131,930 1069,905 1020,856 971,806 946,726 946,617 L 946,0 766,0 766,690 C 766,770 751,830 722,870 693,910 645,930 578,930 527,930 481,917 438,890 395,863 363,824 344,773 325,722 315,648 315,551 L 315,0 135,0 Z"/> - <glyph unicode="l" horiz-adv-x="186" d="M 131,0 L 131,1466 311,1466 311,0 131,0 Z"/> - <glyph unicode="i" horiz-adv-x="160" d="M 136,1259 L 136,1466 316,1466 316,1259 136,1259 Z M 136,0 L 136,1062 316,1062 316,0 136,0 Z"/> - <glyph unicode="h" horiz-adv-x="848" d="M 135,0 L 135,1466 315,1466 315,940 C 399,1037 505,1086 633,1086 712,1086 780,1071 838,1040 896,1009 938,966 963,911 988,856 1000,777 1000,673 L 1000,0 820,0 820,673 C 820,763 801,829 762,870 723,911 667,931 596,931 543,931 493,917 446,890 399,862 365,824 345,777 325,730 315,664 315,581 L 315,0 135,0 Z"/> - <glyph unicode="g" horiz-adv-x="927" d="M 102,-88 L 277,-114 C 284,-168 305,-207 338,-232 383,-265 444,-282 521,-282 604,-282 669,-265 714,-232 759,-199 790,-152 806,-92 815,-55 820,22 819,139 740,46 642,0 525,0 379,0 266,53 186,158 106,263 66,390 66,537 66,638 84,732 121,818 158,903 211,969 281,1016 350,1063 432,1086 526,1086 651,1086 755,1035 836,934 L 836,1062 1002,1062 1002,144 C 1002,-21 985,-138 952,-207 918,-276 865,-331 792,-371 719,-411 629,-431 522,-431 395,-431 293,-402 215,-345 137,-288 99,-203 102,-88 Z M 251,550 C 251,411 279,309 334,245 389,181 459,149 542,149 625,149 694,181 750,245 806,308 834,408 834,544 834,674 805,772 748,838 690,904 620,937 539,937 459,937 391,905 335,840 279,775 251,678 251,550 Z"/> - <glyph unicode="e" horiz-adv-x="980" d="M 862,342 L 1048,319 C 1019,210 964,126 885,66 806,6 704,-24 581,-24 426,-24 303,24 212,120 121,215 75,349 75,522 75,701 121,839 213,938 305,1037 424,1086 571,1086 713,1086 829,1038 919,941 1009,844 1054,708 1054,533 1054,522 1054,506 1053,485 L 261,485 C 268,368 301,279 360,217 419,155 493,124 582,124 648,124 704,141 751,176 798,211 835,266 862,342 Z M 271,633 L 864,633 C 856,722 833,789 796,834 739,903 664,938 573,938 490,938 421,910 365,855 308,800 277,726 271,633 Z"/> - <glyph unicode="d" horiz-adv-x="927" d="M 824,0 L 824,134 C 757,29 658,-24 527,-24 442,-24 365,-1 294,46 223,93 168,158 129,242 90,325 70,421 70,530 70,636 88,732 123,819 158,905 211,971 282,1017 353,1063 432,1086 519,1086 583,1086 640,1073 690,1046 740,1019 781,983 812,940 L 812,1466 991,1466 991,0 824,0 Z M 255,530 C 255,394 284,292 341,225 398,158 466,124 544,124 623,124 690,156 745,221 800,285 827,383 827,515 827,660 799,767 743,835 687,903 618,937 536,937 456,937 389,904 336,839 282,774 255,671 255,530 Z"/> - <glyph unicode="c" horiz-adv-x="927" d="M 828,389 L 1005,366 C 986,244 936,149 857,80 777,11 679,-24 563,-24 418,-24 301,24 213,119 124,214 80,350 80,527 80,642 99,742 137,828 175,914 233,979 311,1022 388,1065 473,1086 564,1086 679,1086 774,1057 847,999 920,940 967,857 988,750 L 813,723 C 796,794 767,848 725,884 682,920 631,938 571,938 480,938 407,906 350,841 293,776 265,673 265,532 265,389 292,286 347,221 402,156 473,124 561,124 632,124 691,146 738,189 785,232 815,299 828,389 Z"/> - <glyph unicode="b" horiz-adv-x="901" d="M 301,0 L 134,0 134,1466 314,1466 314,943 C 390,1038 487,1086 605,1086 670,1086 732,1073 791,1047 849,1020 897,983 935,936 972,888 1002,830 1023,763 1044,696 1055,624 1055,547 1055,365 1010,224 920,125 830,26 722,-24 596,-24 471,-24 372,28 301,133 L 301,0 Z M 299,539 C 299,412 316,320 351,263 408,170 484,124 581,124 660,124 728,158 785,227 842,295 871,397 871,532 871,671 844,773 789,839 734,905 667,938 589,938 510,938 442,904 385,836 328,767 299,668 299,539 Z"/> - <glyph unicode="a" horiz-adv-x="980" d="M 828,131 C 761,74 697,34 636,11 574,-12 508,-24 437,-24 320,-24 231,5 168,62 105,119 74,191 74,280 74,332 86,380 110,423 133,466 164,500 203,526 241,552 284,572 332,585 367,594 421,603 492,612 637,629 744,650 813,674 814,699 814,714 814,721 814,794 797,846 763,876 717,917 649,937 558,937 473,937 411,922 371,893 330,863 300,810 281,735 L 105,759 C 121,834 147,895 184,942 221,988 274,1024 343,1049 412,1074 493,1086 584,1086 675,1086 748,1075 805,1054 862,1033 903,1006 930,974 957,941 975,900 986,851 992,820 995,765 995,685 L 995,445 C 995,278 999,172 1007,128 1014,83 1029,41 1052,0 L 864,0 C 845,37 833,81 828,131 Z M 813,533 C 748,506 650,484 519,465 445,454 393,442 362,429 331,416 308,396 291,371 274,345 266,316 266,285 266,237 284,197 321,165 357,133 410,117 480,117 549,117 611,132 665,163 719,193 759,234 784,287 803,328 813,388 813,467 L 813,533 Z"/> - <glyph unicode="_" horiz-adv-x="1192" d="M -31,-407 L -31,-277 1162,-277 1162,-407 -31,-407 Z"/> - <glyph unicode="W" horiz-adv-x="1986" d="M 414,0 L 25,1466 224,1466 447,505 C 471,404 492,304 509,205 546,362 568,452 575,476 L 854,1466 1088,1466 1298,724 C 1351,540 1389,367 1412,205 1431,298 1455,404 1485,524 L 1715,1466 1910,1466 1508,0 1321,0 1012,1117 C 986,1210 971,1268 966,1289 951,1222 936,1164 923,1117 L 612,0 414,0 Z"/> - <glyph unicode="T" horiz-adv-x="1166" d="M 531,0 L 531,1293 48,1293 48,1466 1210,1466 1210,1293 725,1293 725,0 531,0 Z"/> - <glyph unicode="R" horiz-adv-x="1271" d="M 161,0 L 161,1466 811,1466 C 942,1466 1041,1453 1109,1427 1177,1400 1231,1354 1272,1287 1313,1220 1333,1147 1333,1066 1333,962 1299,874 1232,803 1165,732 1061,686 920,667 971,642 1010,618 1037,594 1094,542 1147,477 1198,399 L 1453,0 1209,0 1015,305 C 958,393 912,460 875,507 838,554 806,586 777,605 748,624 718,637 688,644 666,649 630,651 580,651 L 355,651 355,0 161,0 Z M 355,819 L 772,819 C 861,819 930,828 980,847 1030,865 1068,894 1094,935 1120,975 1133,1019 1133,1066 1133,1135 1108,1192 1058,1237 1007,1282 928,1304 819,1304 L 355,1304 355,819 Z"/> - <glyph unicode="P" horiz-adv-x="1113" d="M 158,0 L 158,1466 711,1466 C 808,1466 883,1461 934,1452 1006,1440 1066,1417 1115,1384 1164,1350 1203,1303 1233,1242 1262,1181 1277,1115 1277,1042 1277,917 1237,812 1158,726 1079,639 935,596 728,596 L 352,596 352,0 158,0 Z M 352,769 L 731,769 C 856,769 945,792 998,839 1051,886 1077,951 1077,1036 1077,1097 1062,1150 1031,1194 1000,1237 959,1266 908,1280 875,1289 815,1293 727,1293 L 352,1293 352,769 Z"/> - <glyph unicode="O" horiz-adv-x="1404" d="M 99,714 C 99,957 164,1148 295,1286 426,1423 594,1492 801,1492 936,1492 1058,1460 1167,1395 1276,1330 1359,1240 1416,1125 1473,1009 1501,878 1501,731 1501,582 1471,449 1411,332 1351,215 1266,126 1156,66 1046,5 927,-25 800,-25 662,-25 539,8 430,75 321,142 239,233 183,348 127,463 99,585 99,714 Z M 299,711 C 299,534 347,395 442,294 537,192 656,141 799,141 945,141 1065,192 1160,295 1254,398 1301,543 1301,732 1301,851 1281,956 1241,1045 1200,1134 1141,1203 1064,1252 986,1301 899,1325 802,1325 665,1325 547,1278 448,1184 349,1089 299,932 299,711 Z"/> - <glyph unicode="M" horiz-adv-x="1377" d="M 152,0 L 152,1466 444,1466 791,428 C 823,331 846,259 861,211 878,264 904,343 939,446 L 1290,1466 1551,1466 1551,0 1364,0 1364,1227 938,0 763,0 339,1248 339,0 152,0 Z"/> - <glyph unicode="C" horiz-adv-x="1298" d="M 1204,514 L 1398,465 C 1357,306 1284,184 1179,101 1073,17 944,-25 791,-25 633,-25 505,7 406,72 307,136 231,229 180,351 128,473 102,604 102,744 102,897 131,1030 190,1144 248,1257 331,1344 439,1403 546,1462 665,1491 794,1491 941,1491 1064,1454 1164,1379 1264,1304 1334,1199 1373,1064 L 1182,1019 C 1148,1126 1099,1203 1034,1252 969,1301 888,1325 790,1325 677,1325 583,1298 508,1244 432,1190 379,1118 348,1027 317,936 302,842 302,745 302,620 320,512 357,419 393,326 449,256 526,210 603,164 686,141 775,141 884,141 976,172 1051,235 1126,298 1177,391 1204,514 Z"/> - <glyph unicode=")" horiz-adv-x="477" d="M 253,-431 L 124,-431 C 323,-111 423,209 423,530 423,655 409,780 380,903 357,1003 326,1099 285,1191 259,1251 205,1351 124,1491 L 253,1491 C 378,1324 471,1156 531,987 582,842 608,690 608,531 608,351 574,177 505,9 436,-159 352,-306 253,-431 Z"/> - <glyph unicode="(" horiz-adv-x="478" d="M 479,-431 C 380,-306 296,-159 227,9 158,177 124,351 124,531 124,690 150,842 201,987 261,1156 354,1324 479,1491 L 608,1491 C 527,1352 474,1253 448,1194 407,1102 375,1006 352,906 323,781 309,656 309,530 309,209 409,-111 608,-431 L 479,-431 Z"/> - <glyph unicode=" " horiz-adv-x="556"/> - </font> - </defs> - <g visibility="visible" id="MasterSlide_1_Default"> - <desc>Master slide - </desc> - <rect fill="none" stroke="none" x="0" y="0" width="16000" height="9000"/> - </g> - <g visibility="visible" id="Slide_1_page1"> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 2600,5382 L 2600,1732"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_1_0" d="M 2600,1282 L 2413,1845 2788,1845 2600,1282 Z"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 2600,5382 L 13850,5382"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_2_0" d="M 14300,5382 L 13738,5195 13738,5570 14300,5382 Z"/> - </g> - <g id="Drawing_3"> - <rect fill="none" stroke="none" x="13200" y="5682" width="1301" height="641"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="353" font-style="normal" font-weight="400"> - <text x="13450" y="6120">T</text> - <text x="13657" y="6120">i</text> - <text x="13734" y="6120">m</text> - <text x="14034" y="6120">e</text> - </g> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_4_0" stroke-width="50" stroke-linejoin="round" d="M 3100,5382 L 3100,2882"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_5_0" stroke-width="50" stroke-linejoin="round" d="M 3100,5382 L 2600,4882"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_6_0" stroke-width="50" stroke-linejoin="round" d="M 5600,5382 L 5600,2382"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_7_0" stroke-width="50" stroke-linejoin="round" d="M 8601,5381 L 5601,2383"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_8_0" stroke-width="50" stroke-linejoin="round" d="M 13600,5381 L 12600,4382"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_9_0" stroke-width="30" stroke-linejoin="round" stroke-dasharray="508,508,508,508" d="M 2600,2382 L 14000,2382"/> - </g> - <g id="Drawing_10"> - <rect fill="none" stroke="none" x="13600" y="3182" width="2101" height="1419"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="353" font-style="normal" font-weight="400"> - <text x="13850" y="3620">C</text> - <text x="14104" y="3620">o</text> - <text x="14299" y="3620">m</text> - <text x="14599" y="3620">p</text> - <text x="14794" y="3620">a</text> - <text x="14989" y="3620">r</text> - <text x="15107" y="3620">e</text> - <text x="15302" y="3620"> </text> - <text fill="rgb(0,0,0)" stroke="none" x="13850" y="4009">m</text> - <text x="14151" y="4009">a</text> - <text x="14345" y="4009">t</text> - <text x="14443" y="4009">c</text> - <text x="14620" y="4009">h</text> - <text x="14815" y="4009"> </text> - <text fill="rgb(0,0,0)" stroke="none" x="13850" y="4398">v</text> - <text x="14024" y="4398">a</text> - <text x="14218" y="4398">l</text> - <text x="14295" y="4398">u</text> - <text x="14489" y="4398">e</text> - </g> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_11_0" stroke-width="50" stroke-linejoin="round" d="M 8600,5382 L 8600,3382"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_12_0" stroke-width="50" stroke-linejoin="round" d="M 9601,4383 L 8601,3383"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_13_0" stroke-width="50" stroke-linejoin="round" d="M 9601,4382 L 9601,2382"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_14_0" stroke-width="50" stroke-linejoin="round" d="M 12602,5383 L 9601,2382"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_15_0" stroke-width="50" stroke-linejoin="round" d="M 12600,5382 L 12600,4382"/> - </g> - <g id="Drawing_16"> - <rect fill="none" stroke="none" x="6000" y="6542" width="4401" height="641"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="353" font-style="normal" font-weight="400"> - <text x="6250" y="6980">R</text> - <text x="6504" y="6980">e</text> - <text x="6699" y="6980">l</text> - <text x="6775" y="6980">o</text> - <text x="6970" y="6980">a</text> - <text x="7164" y="6980">d</text> - <text x="7359" y="6980"> </text> - <text x="7457" y="6980">t</text> - <text x="7554" y="6980">o</text> - <text x="7749" y="6980"> </text> - <text x="7842" y="6980">T</text> - <text x="8058" y="6980">O</text> - <text x="8333" y="6980">P</text> - <text x="8561" y="6980"> </text> - <text x="8659" y="6980">v</text> - <text x="8832" y="6980">a</text> - <text x="9027" y="6980">l</text> - <text x="9103" y="6980">u</text> - <text x="9298" y="6980">e</text> - </g> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 8400,6482 L 8519,5888"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_17_0" d="M 8600,5482 L 8329,5956 8668,6023 8600,5482 Z"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 9600,6682 L 11917,5738"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_18_0" d="M 12300,5582 L 11756,5618 11886,5937 12300,5582 Z"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 9700,2282 L 10542,1791"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_19_0" d="M 10900,1582 L 10366,1694 10540,1992 10900,1582 Z"/> - </g> - <g id="Drawing_20"> - <rect fill="none" stroke="none" x="10651" y="553" width="4150" height="1030"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="353" font-style="normal" font-weight="400"> - <text x="10901" y="991">C</text> - <text x="11155" y="991">o</text> - <text x="11350" y="991">u</text> - <text x="11544" y="991">n</text> - <text x="11739" y="991">t</text> - <text x="11837" y="991"> </text> - <text x="11934" y="991">i</text> - <text x="12010" y="991">s</text> - <text x="12188" y="991"> </text> - <text x="12285" y="991">w</text> - <text x="12535" y="991">r</text> - <text x="12654" y="991">i</text> - <text x="12730" y="991">t</text> - <text x="12827" y="991">t</text> - <text x="12925" y="991">e</text> - <text x="13119" y="991">n</text> - <text x="13314" y="991"> </text> - <text x="13411" y="991">u</text> - <text x="13606" y="991">s</text> - <text x="13784" y="991">i</text> - <text x="13860" y="991">n</text> - <text x="14055" y="991">g</text> - <text x="14250" y="991"> </text> - <text fill="rgb(0,0,0)" stroke="none" x="10901" y="1380">t</text> - <text x="10998" y="1380">c</text> - <text x="11176" y="1380">_</text> - <text x="11371" y="1380">s</text> - <text x="11549" y="1380">e</text> - <text x="11743" y="1380">t</text> - <text x="11841" y="1380">_</text> - <text x="12036" y="1380">c</text> - <text x="12213" y="1380">o</text> - <text x="12408" y="1380">u</text> - <text x="12603" y="1380">n</text> - <text x="12798" y="1380">t</text> - <text x="12895" y="1380">_</text> - <text x="13090" y="1380">v</text> - <text x="13263" y="1380">a</text> - <text x="13458" y="1380">l</text> - <text x="13534" y="1380">u</text> - <text x="13729" y="1380">e</text> - <text x="13924" y="1380">(</text> - <text x="14042" y="1380">)</text> - </g> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 5800,2182 L 6152,1713"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_21_0" d="M 6400,1382 L 5952,1693 6228,1900 6400,1382 Z"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 8300,2982 L 7519,1733"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_22_0" d="M 7300,1382 L 7428,1912 7721,1729 7300,1382 Z"/> - </g> - <g id="Drawing_23"> - <rect fill="none" stroke="none" x="4500" y="482" width="5601" height="1030"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="353" font-style="normal" font-weight="400"> - <text x="4750" y="920">T</text> - <text x="4966" y="920">O</text> - <text x="5241" y="920">P</text> - <text x="5470" y="920"> </text> - <text x="5567" y="920">v</text> - <text x="5741" y="920">a</text> - <text x="5935" y="920">l</text> - <text x="6012" y="920">u</text> - <text x="6206" y="920">e</text> - <text x="6401" y="920"> </text> - <text x="6498" y="920">h</text> - <text x="6693" y="920">a</text> - <text x="6888" y="920">s</text> - <text x="7066" y="920"> </text> - <text x="7163" y="920">b</text> - <text x="7358" y="920">e</text> - <text x="7552" y="920">e</text> - <text x="7747" y="920">n</text> - <text x="7942" y="920"> </text> - <text x="8039" y="920">c</text> - <text x="8217" y="920">h</text> - <text x="8412" y="920">a</text> - <text x="8607" y="920">n</text> - <text x="8801" y="920">g</text> - <text x="8996" y="920">e</text> - <text x="9191" y="920">d</text> - <text x="9386" y="920"> </text> - <text fill="rgb(0,0,0)" stroke="none" x="4750" y="1309">u</text> - <text x="4945" y="1309">s</text> - <text x="5123" y="1309">i</text> - <text x="5199" y="1309">n</text> - <text x="5393" y="1309">g</text> - <text x="5588" y="1309"> </text> - <text x="5686" y="1309">t</text> - <text x="5783" y="1309">c</text> - <text x="5961" y="1309">_</text> - <text x="6155" y="1309">s</text> - <text x="6333" y="1309">e</text> - <text x="6528" y="1309">t</text> - <text x="6625" y="1309">_</text> - <text x="6820" y="1309">t</text> - <text x="6917" y="1309">o</text> - <text x="7112" y="1309">p</text> - <text x="7307" y="1309">_</text> - <text x="7502" y="1309">v</text> - <text x="7675" y="1309">a</text> - <text x="7870" y="1309">l</text> - <text x="7946" y="1309">u</text> - <text x="8141" y="1309">e</text> - <text x="8336" y="1309">(</text> - <text x="8454" y="1309">)</text> - </g> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_24_0" stroke-width="100" stroke-linejoin="round" stroke-dasharray="197,197" d="M 2600,4882 L 14200,4882"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_25_0" stroke-width="50" stroke-linejoin="round" d="M 3100,8407 L 5100,8407"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_26_0" stroke-width="50" stroke-linejoin="round" d="M 5100,7407 L 5100,8407"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_27_0" stroke-width="50" stroke-linejoin="round" d="M 5100,7407 L 5600,7407"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_28_0" stroke-width="50" stroke-linejoin="round" d="M 5600,7407 L 5600,8407"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_29_0" stroke-width="50" stroke-linejoin="round" d="M 5600,8407 L 7600,8407"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_30_0" stroke-width="50" stroke-linejoin="round" d="M 7600,7407 L 7600,8407"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_31_0" stroke-width="50" stroke-linejoin="round" d="M 7600,7407 L 8100,7407"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_32_0" stroke-width="50" stroke-linejoin="round" d="M 8100,7407 L 8100,8407"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_33_0" stroke-width="50" stroke-linejoin="round" d="M 12100,7407 L 12100,8407"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_34_0" stroke-width="50" stroke-linejoin="round" d="M 12100,7407 L 12600,7407"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_35_0" stroke-width="50" stroke-linejoin="round" d="M 12600,7407 L 12600,8407"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_36_0" stroke-width="50" stroke-linejoin="round" d="M 13100,7407 L 13100,8407"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_37_0" stroke-width="50" stroke-linejoin="round" d="M 13100,7407 L 13600,7407"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_38_0" stroke-width="50" stroke-linejoin="round" d="M 13600,7407 L 13600,8407"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_39_0" stroke-width="50" stroke-linejoin="round" d="M 8100,8407 L 12100,8407"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_40_0" stroke-width="50" stroke-linejoin="round" d="M 4953,4649 L 5203,5082"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_41_0" stroke-width="50" stroke-linejoin="round" d="M 5300,4742 L 4867,4992"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_42_0" stroke-width="50" stroke-linejoin="round" d="M 7986,4682 L 8236,5115"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_43_0" stroke-width="50" stroke-linejoin="round" d="M 8333,4775 L 7900,5025"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_44_0" stroke-width="50" stroke-linejoin="round" d="M 11986,4649 L 12236,5082"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_45_0" stroke-width="50" stroke-linejoin="round" d="M 12333,4742 L 11900,4992"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_46_0" stroke-width="50" stroke-linejoin="round" d="M 12986,4682 L 13236,5115"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_47_0" stroke-width="50" stroke-linejoin="round" d="M 13333,4775 L 12900,5025"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_48_0" stroke-width="50" stroke-linejoin="round" d="M 12853,6453 L 13103,6886"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_49_0" stroke-width="50" stroke-linejoin="round" d="M 13200,6546 L 12767,6796"/> - </g> - <g id="Drawing_50"> - <rect fill="none" stroke="none" x="13200" y="6413" width="1701" height="641"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="353" font-style="normal" font-weight="400"> - <text x="13450" y="6851">M</text> - <text x="13742" y="6851">a</text> - <text x="13937" y="6851">t</text> - <text x="14034" y="6851">c</text> - <text x="14212" y="6851">h</text> - </g> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_51_0" stroke-width="50" stroke-linejoin="round" d="M 12600,8407 L 13100,8407"/> - </g> - <g id="Drawing_52"> - <rect fill="none" stroke="none" x="600" y="7182" width="2601" height="1419"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="353" font-style="normal" font-weight="400"> - <text x="850" y="7620">P</text> - <text x="1083" y="7620">W</text> - <text x="1434" y="7620">M</text> - <text x="1726" y="7620"> </text> - <text fill="rgb(0,0,0)" stroke="none" x="850" y="8009">i</text> - <text x="926" y="8009">n</text> - <text x="1121" y="8009">v</text> - <text x="1295" y="8009">e</text> - <text x="1489" y="8009">r</text> - <text x="1608" y="8009">t</text> - <text x="1705" y="8009">e</text> - <text x="1900" y="8009">d</text> - <text x="2095" y="8009"> </text> - <text fill="rgb(0,0,0)" stroke="none" x="850" y="8398">o</text> - <text x="1045" y="8398">u</text> - <text x="1239" y="8398">t</text> - <text x="1337" y="8398">p</text> - <text x="1532" y="8398">u</text> - <text x="1726" y="8398">t</text> - </g> - </g> - <g id="Drawing_53"> - <rect fill="none" stroke="none" x="13300" y="1742" width="2101" height="641"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="353" font-style="normal" font-weight="400"> - <text x="13550" y="2180">M</text> - <text x="13842" y="2180">a</text> - <text x="14037" y="2180">x</text> - </g> - </g> - <g id="Drawing_54"> - <rect fill="none" stroke="none" x="0" y="1171" width="2001" height="1030"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="353" font-style="normal" font-weight="400"> - <text x="376" y="1609">C</text> - <text x="630" y="1609">o</text> - <text x="825" y="1609">u</text> - <text x="1019" y="1609">n</text> - <text x="1214" y="1609">t</text> - <text x="1312" y="1609">e</text> - <text x="1506" y="1609">r</text> - <text x="1625" y="1609"> </text> - <text fill="rgb(0,0,0)" stroke="none" x="583" y="1998">v</text> - <text x="757" y="1998">a</text> - <text x="951" y="1998">l</text> - <text x="1028" y="1998">u</text> - <text x="1222" y="1998">e</text> - </g> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_55_0" stroke-width="50" stroke-linejoin="round" d="M 5600,5379 L 3100,2880"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_56_0" stroke-width="50" stroke-linejoin="round" d="M 2600,7407 L 2600,8407"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_57_0" stroke-width="50" stroke-linejoin="round" d="M 2600,7407 L 3100,7407"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_58_0" stroke-width="50" stroke-linejoin="round" d="M 3100,7407 L 3100,8407"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 6700,6482 L 6175,5891"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_59_0" d="M 5900,5582 L 6115,6083 6373,5854 5900,5582 Z"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 6000,6682 L 3590,5821"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_60_0" d="M 3200,5682 L 3629,6019 3745,5694 3200,5682 Z"/> - </g> - </g> -</svg>
\ No newline at end of file diff --git a/atmel-samd/asf/sam0/drivers/tc/docimg/pwm_normal_ex.svg b/atmel-samd/asf/sam0/drivers/tc/docimg/pwm_normal_ex.svg deleted file mode 100644 index 072e1fc89..000000000 --- a/atmel-samd/asf/sam0/drivers/tc/docimg/pwm_normal_ex.svg +++ /dev/null @@ -1,386 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<svg version="1.2" baseProfile="tiny" width="160mm" height="90mm" viewBox="0 0 16000 9000" preserveAspectRatio="xMidYMid" fill-rule="evenodd" stroke-width="28.222" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve"> - <defs> - <font id="EmbeddedFont_1" horiz-adv-x="2048"> - <font-face font-family="Arial" units-per-em="2048" font-weight="normal" font-style="normal" ascent="1852" descent="450"/> - <missing-glyph horiz-adv-x="2048" d="M 0,0 L 2047,0 2047,2047 0,2047 0,0 Z"/> - <glyph unicode="z" horiz-adv-x="928" d="M 40,0 L 40,146 716,922 C 639,918 572,916 513,916 L 80,916 80,1062 948,1062 948,943 373,269 262,146 C 343,152 418,155 489,155 L 980,155 980,0 40,0 Z"/> - <glyph unicode="x" horiz-adv-x="954" d="M 15,0 L 403,552 44,1062 269,1062 432,813 C 463,766 487,726 506,694 535,738 562,777 587,811 L 766,1062 981,1062 614,562 1009,0 788,0 570,330 512,419 233,0 15,0 Z"/> - <glyph unicode="w" horiz-adv-x="1430" d="M 331,0 L 6,1062 192,1062 361,449 424,221 C 427,232 445,305 479,440 L 648,1062 833,1062 992,446 1045,243 1106,448 1288,1062 1463,1062 1131,0 944,0 775,636 734,817 519,0 331,0 Z"/> - <glyph unicode="v" horiz-adv-x="954" d="M 430,0 L 26,1062 216,1062 444,426 C 469,357 491,286 512,212 528,268 550,335 579,414 L 815,1062 1000,1062 598,0 430,0 Z"/> - <glyph unicode="u" horiz-adv-x="848" d="M 831,0 L 831,156 C 748,36 636,-24 494,-24 431,-24 373,-12 319,12 264,36 224,66 198,103 171,139 153,183 142,236 135,271 131,327 131,404 L 131,1062 311,1062 311,473 C 311,379 315,316 322,283 333,236 357,199 394,172 431,145 476,131 530,131 584,131 635,145 682,173 729,200 763,238 783,286 802,333 812,402 812,493 L 812,1062 992,1062 992,0 831,0 Z"/> - <glyph unicode="t" horiz-adv-x="504" d="M 528,161 L 554,2 C 503,-9 458,-14 418,-14 353,-14 302,-4 266,17 230,38 205,65 190,99 175,132 168,203 168,311 L 168,922 36,922 36,1062 168,1062 168,1325 347,1433 347,1062 528,1062 528,922 347,922 347,301 C 347,250 350,217 357,202 363,187 373,176 388,167 402,158 422,154 449,154 469,154 495,156 528,161 Z"/> - <glyph unicode="s" horiz-adv-x="874" d="M 63,317 L 241,345 C 251,274 279,219 325,181 370,143 434,124 516,124 599,124 660,141 700,175 740,208 760,248 760,293 760,334 742,366 707,389 682,405 621,425 523,450 391,483 300,512 249,537 198,561 159,595 133,638 106,681 93,728 93,780 93,827 104,871 126,912 147,952 177,985 214,1012 242,1033 280,1050 329,1065 377,1079 429,1086 484,1086 567,1086 641,1074 704,1050 767,1026 813,994 843,953 873,912 894,857 905,788 L 729,764 C 721,819 698,861 660,892 621,923 567,938 497,938 414,938 355,924 320,897 285,870 267,838 267,801 267,778 274,757 289,738 304,719 327,703 358,690 376,683 429,668 517,644 644,610 733,582 784,561 834,539 873,507 902,466 931,425 945,373 945,312 945,252 928,196 893,143 858,90 807,49 741,20 675,-9 600,-24 517,-24 379,-24 274,5 202,62 129,119 83,204 63,317 Z"/> - <glyph unicode="r" horiz-adv-x="557" d="M 133,0 L 133,1062 295,1062 295,901 C 336,976 375,1026 410,1050 445,1074 483,1086 525,1086 586,1086 647,1067 710,1028 L 648,861 C 604,887 560,900 516,900 477,900 441,888 410,865 379,841 356,808 343,766 323,702 313,632 313,556 L 313,0 133,0 Z"/> - <glyph unicode="p" horiz-adv-x="901" d="M 135,-407 L 135,1062 299,1062 299,924 C 338,978 381,1019 430,1046 479,1073 538,1086 607,1086 698,1086 778,1063 847,1016 916,969 969,904 1004,819 1039,734 1057,640 1057,539 1057,430 1038,333 999,246 960,159 903,92 829,46 754,-1 676,-24 594,-24 534,-24 480,-11 433,14 385,39 346,71 315,110 L 315,-407 135,-407 Z M 298,525 C 298,388 326,287 381,222 436,157 503,124 582,124 662,124 731,158 788,226 845,293 873,398 873,540 873,675 845,777 790,844 734,911 667,945 590,945 513,945 446,909 387,838 328,766 298,662 298,525 Z"/> - <glyph unicode="o" horiz-adv-x="980" d="M 68,531 C 68,728 123,873 232,968 323,1047 435,1086 566,1086 712,1086 831,1038 924,943 1017,847 1063,715 1063,546 1063,409 1043,302 1002,224 961,145 901,84 823,41 744,-2 659,-24 566,-24 417,-24 297,24 206,119 114,214 68,352 68,531 Z M 253,531 C 253,395 283,293 342,226 401,158 476,124 566,124 655,124 730,158 789,226 848,294 878,398 878,537 878,668 848,768 789,836 729,903 655,937 566,937 476,937 401,903 342,836 283,769 253,667 253,531 Z"/> - <glyph unicode="n" horiz-adv-x="848" d="M 135,0 L 135,1062 297,1062 297,911 C 375,1028 488,1086 635,1086 699,1086 758,1075 812,1052 865,1029 905,998 932,961 959,924 977,879 988,828 995,795 998,736 998,653 L 998,0 818,0 818,646 C 818,719 811,774 797,811 783,847 758,876 723,898 687,919 645,930 597,930 520,930 454,906 399,857 343,808 315,716 315,580 L 315,0 135,0 Z"/> - <glyph unicode="m" horiz-adv-x="1457" d="M 135,0 L 135,1062 296,1062 296,913 C 329,965 374,1007 429,1039 484,1070 547,1086 618,1086 697,1086 761,1070 812,1037 862,1004 897,959 918,900 1002,1024 1111,1086 1246,1086 1351,1086 1432,1057 1489,999 1546,940 1574,850 1574,729 L 1574,0 1395,0 1395,669 C 1395,741 1389,793 1378,825 1366,856 1345,882 1314,901 1283,920 1247,930 1206,930 1131,930 1069,905 1020,856 971,806 946,726 946,617 L 946,0 766,0 766,690 C 766,770 751,830 722,870 693,910 645,930 578,930 527,930 481,917 438,890 395,863 363,824 344,773 325,722 315,648 315,551 L 315,0 135,0 Z"/> - <glyph unicode="l" horiz-adv-x="186" d="M 131,0 L 131,1466 311,1466 311,0 131,0 Z"/> - <glyph unicode="i" horiz-adv-x="160" d="M 136,1259 L 136,1466 316,1466 316,1259 136,1259 Z M 136,0 L 136,1062 316,1062 316,0 136,0 Z"/> - <glyph unicode="h" horiz-adv-x="848" d="M 135,0 L 135,1466 315,1466 315,940 C 399,1037 505,1086 633,1086 712,1086 780,1071 838,1040 896,1009 938,966 963,911 988,856 1000,777 1000,673 L 1000,0 820,0 820,673 C 820,763 801,829 762,870 723,911 667,931 596,931 543,931 493,917 446,890 399,862 365,824 345,777 325,730 315,664 315,581 L 315,0 135,0 Z"/> - <glyph unicode="g" horiz-adv-x="927" d="M 102,-88 L 277,-114 C 284,-168 305,-207 338,-232 383,-265 444,-282 521,-282 604,-282 669,-265 714,-232 759,-199 790,-152 806,-92 815,-55 820,22 819,139 740,46 642,0 525,0 379,0 266,53 186,158 106,263 66,390 66,537 66,638 84,732 121,818 158,903 211,969 281,1016 350,1063 432,1086 526,1086 651,1086 755,1035 836,934 L 836,1062 1002,1062 1002,144 C 1002,-21 985,-138 952,-207 918,-276 865,-331 792,-371 719,-411 629,-431 522,-431 395,-431 293,-402 215,-345 137,-288 99,-203 102,-88 Z M 251,550 C 251,411 279,309 334,245 389,181 459,149 542,149 625,149 694,181 750,245 806,308 834,408 834,544 834,674 805,772 748,838 690,904 620,937 539,937 459,937 391,905 335,840 279,775 251,678 251,550 Z"/> - <glyph unicode="e" horiz-adv-x="980" d="M 862,342 L 1048,319 C 1019,210 964,126 885,66 806,6 704,-24 581,-24 426,-24 303,24 212,120 121,215 75,349 75,522 75,701 121,839 213,938 305,1037 424,1086 571,1086 713,1086 829,1038 919,941 1009,844 1054,708 1054,533 1054,522 1054,506 1053,485 L 261,485 C 268,368 301,279 360,217 419,155 493,124 582,124 648,124 704,141 751,176 798,211 835,266 862,342 Z M 271,633 L 864,633 C 856,722 833,789 796,834 739,903 664,938 573,938 490,938 421,910 365,855 308,800 277,726 271,633 Z"/> - <glyph unicode="d" horiz-adv-x="927" d="M 824,0 L 824,134 C 757,29 658,-24 527,-24 442,-24 365,-1 294,46 223,93 168,158 129,242 90,325 70,421 70,530 70,636 88,732 123,819 158,905 211,971 282,1017 353,1063 432,1086 519,1086 583,1086 640,1073 690,1046 740,1019 781,983 812,940 L 812,1466 991,1466 991,0 824,0 Z M 255,530 C 255,394 284,292 341,225 398,158 466,124 544,124 623,124 690,156 745,221 800,285 827,383 827,515 827,660 799,767 743,835 687,903 618,937 536,937 456,937 389,904 336,839 282,774 255,671 255,530 Z"/> - <glyph unicode="c" horiz-adv-x="927" d="M 828,389 L 1005,366 C 986,244 936,149 857,80 777,11 679,-24 563,-24 418,-24 301,24 213,119 124,214 80,350 80,527 80,642 99,742 137,828 175,914 233,979 311,1022 388,1065 473,1086 564,1086 679,1086 774,1057 847,999 920,940 967,857 988,750 L 813,723 C 796,794 767,848 725,884 682,920 631,938 571,938 480,938 407,906 350,841 293,776 265,673 265,532 265,389 292,286 347,221 402,156 473,124 561,124 632,124 691,146 738,189 785,232 815,299 828,389 Z"/> - <glyph unicode="b" horiz-adv-x="901" d="M 301,0 L 134,0 134,1466 314,1466 314,943 C 390,1038 487,1086 605,1086 670,1086 732,1073 791,1047 849,1020 897,983 935,936 972,888 1002,830 1023,763 1044,696 1055,624 1055,547 1055,365 1010,224 920,125 830,26 722,-24 596,-24 471,-24 372,28 301,133 L 301,0 Z M 299,539 C 299,412 316,320 351,263 408,170 484,124 581,124 660,124 728,158 785,227 842,295 871,397 871,532 871,671 844,773 789,839 734,905 667,938 589,938 510,938 442,904 385,836 328,767 299,668 299,539 Z"/> - <glyph unicode="a" horiz-adv-x="980" d="M 828,131 C 761,74 697,34 636,11 574,-12 508,-24 437,-24 320,-24 231,5 168,62 105,119 74,191 74,280 74,332 86,380 110,423 133,466 164,500 203,526 241,552 284,572 332,585 367,594 421,603 492,612 637,629 744,650 813,674 814,699 814,714 814,721 814,794 797,846 763,876 717,917 649,937 558,937 473,937 411,922 371,893 330,863 300,810 281,735 L 105,759 C 121,834 147,895 184,942 221,988 274,1024 343,1049 412,1074 493,1086 584,1086 675,1086 748,1075 805,1054 862,1033 903,1006 930,974 957,941 975,900 986,851 992,820 995,765 995,685 L 995,445 C 995,278 999,172 1007,128 1014,83 1029,41 1052,0 L 864,0 C 845,37 833,81 828,131 Z M 813,533 C 748,506 650,484 519,465 445,454 393,442 362,429 331,416 308,396 291,371 274,345 266,316 266,285 266,237 284,197 321,165 357,133 410,117 480,117 549,117 611,132 665,163 719,193 759,234 784,287 803,328 813,388 813,467 L 813,533 Z"/> - <glyph unicode="_" horiz-adv-x="1192" d="M -31,-407 L -31,-277 1162,-277 1162,-407 -31,-407 Z"/> - <glyph unicode="W" horiz-adv-x="1986" d="M 414,0 L 25,1466 224,1466 447,505 C 471,404 492,304 509,205 546,362 568,452 575,476 L 854,1466 1088,1466 1298,724 C 1351,540 1389,367 1412,205 1431,298 1455,404 1485,524 L 1715,1466 1910,1466 1508,0 1321,0 1012,1117 C 986,1210 971,1268 966,1289 951,1222 936,1164 923,1117 L 612,0 414,0 Z"/> - <glyph unicode="T" horiz-adv-x="1166" d="M 531,0 L 531,1293 48,1293 48,1466 1210,1466 1210,1293 725,1293 725,0 531,0 Z"/> - <glyph unicode="R" horiz-adv-x="1271" d="M 161,0 L 161,1466 811,1466 C 942,1466 1041,1453 1109,1427 1177,1400 1231,1354 1272,1287 1313,1220 1333,1147 1333,1066 1333,962 1299,874 1232,803 1165,732 1061,686 920,667 971,642 1010,618 1037,594 1094,542 1147,477 1198,399 L 1453,0 1209,0 1015,305 C 958,393 912,460 875,507 838,554 806,586 777,605 748,624 718,637 688,644 666,649 630,651 580,651 L 355,651 355,0 161,0 Z M 355,819 L 772,819 C 861,819 930,828 980,847 1030,865 1068,894 1094,935 1120,975 1133,1019 1133,1066 1133,1135 1108,1192 1058,1237 1007,1282 928,1304 819,1304 L 355,1304 355,819 Z"/> - <glyph unicode="P" horiz-adv-x="1113" d="M 158,0 L 158,1466 711,1466 C 808,1466 883,1461 934,1452 1006,1440 1066,1417 1115,1384 1164,1350 1203,1303 1233,1242 1262,1181 1277,1115 1277,1042 1277,917 1237,812 1158,726 1079,639 935,596 728,596 L 352,596 352,0 158,0 Z M 352,769 L 731,769 C 856,769 945,792 998,839 1051,886 1077,951 1077,1036 1077,1097 1062,1150 1031,1194 1000,1237 959,1266 908,1280 875,1289 815,1293 727,1293 L 352,1293 352,769 Z"/> - <glyph unicode="O" horiz-adv-x="1404" d="M 99,714 C 99,957 164,1148 295,1286 426,1423 594,1492 801,1492 936,1492 1058,1460 1167,1395 1276,1330 1359,1240 1416,1125 1473,1009 1501,878 1501,731 1501,582 1471,449 1411,332 1351,215 1266,126 1156,66 1046,5 927,-25 800,-25 662,-25 539,8 430,75 321,142 239,233 183,348 127,463 99,585 99,714 Z M 299,711 C 299,534 347,395 442,294 537,192 656,141 799,141 945,141 1065,192 1160,295 1254,398 1301,543 1301,732 1301,851 1281,956 1241,1045 1200,1134 1141,1203 1064,1252 986,1301 899,1325 802,1325 665,1325 547,1278 448,1184 349,1089 299,932 299,711 Z"/> - <glyph unicode="M" horiz-adv-x="1377" d="M 152,0 L 152,1466 444,1466 791,428 C 823,331 846,259 861,211 878,264 904,343 939,446 L 1290,1466 1551,1466 1551,0 1364,0 1364,1227 938,0 763,0 339,1248 339,0 152,0 Z"/> - <glyph unicode="C" horiz-adv-x="1298" d="M 1204,514 L 1398,465 C 1357,306 1284,184 1179,101 1073,17 944,-25 791,-25 633,-25 505,7 406,72 307,136 231,229 180,351 128,473 102,604 102,744 102,897 131,1030 190,1144 248,1257 331,1344 439,1403 546,1462 665,1491 794,1491 941,1491 1064,1454 1164,1379 1264,1304 1334,1199 1373,1064 L 1182,1019 C 1148,1126 1099,1203 1034,1252 969,1301 888,1325 790,1325 677,1325 583,1298 508,1244 432,1190 379,1118 348,1027 317,936 302,842 302,745 302,620 320,512 357,419 393,326 449,256 526,210 603,164 686,141 775,141 884,141 976,172 1051,235 1126,298 1177,391 1204,514 Z"/> - <glyph unicode="=" horiz-adv-x="953" d="M 1082,862 L 114,862 114,1030 1082,1030 1082,862 Z M 1082,417 L 114,417 114,585 1082,585 1082,417 Z"/> - <glyph unicode=")" horiz-adv-x="477" d="M 253,-431 L 124,-431 C 323,-111 423,209 423,530 423,655 409,780 380,903 357,1003 326,1099 285,1191 259,1251 205,1351 124,1491 L 253,1491 C 378,1324 471,1156 531,987 582,842 608,690 608,531 608,351 574,177 505,9 436,-159 352,-306 253,-431 Z"/> - <glyph unicode="(" horiz-adv-x="478" d="M 479,-431 C 380,-306 296,-159 227,9 158,177 124,351 124,531 124,690 150,842 201,987 261,1156 354,1324 479,1491 L 608,1491 C 527,1352 474,1253 448,1194 407,1102 375,1006 352,906 323,781 309,656 309,530 309,209 409,-111 608,-431 L 479,-431 Z"/> - <glyph unicode=" " horiz-adv-x="556"/> - </font> - </defs> - <g visibility="visible" id="MasterSlide_1_Default"> - <desc>Master slide - </desc> - <rect fill="none" stroke="none" x="0" y="0" width="16000" height="9000"/> - </g> - <g visibility="visible" id="Slide_1_page1"> - <g id="Drawing_1"> - <rect fill="none" stroke="none" x="200" y="1171" width="1801" height="1030"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="353" font-style="normal" font-weight="400"> - <text x="476" y="1609">C</text> - <text x="730" y="1609">o</text> - <text x="925" y="1609">u</text> - <text x="1119" y="1609">n</text> - <text x="1314" y="1609">t</text> - <text x="1412" y="1609">e</text> - <text x="1606" y="1609">r</text> - <text x="1725" y="1609"> </text> - <text fill="rgb(0,0,0)" stroke="none" x="683" y="1998">v</text> - <text x="857" y="1998">a</text> - <text x="1051" y="1998">l</text> - <text x="1128" y="1998">u</text> - <text x="1322" y="1998">e</text> - </g> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_2_0" stroke-width="50" stroke-linejoin="round" d="M 12486,1900 L 12736,2333"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_3_0" stroke-width="50" stroke-linejoin="round" d="M 12833,1993 L 12400,2243"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 2100,4600 L 2100,950"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_4_0" d="M 2100,500 L 1913,1063 2288,1063 2100,500 Z"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 2100,4600 L 13350,4600"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_5_0" d="M 13800,4600 L 13238,4413 13238,4788 13800,4600 Z"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_6_0" stroke-width="50" stroke-linejoin="round" d="M 2600,4600 L 5100,2100"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_7_0" stroke-width="50" stroke-linejoin="round" d="M 5100,4600 L 5100,2100"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_8_0" stroke-width="50" stroke-linejoin="round" d="M 5100,4600 L 7600,2100"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_9_0" stroke-width="50" stroke-linejoin="round" d="M 7600,4600 L 7600,2100"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_10_0" stroke-width="50" stroke-linejoin="round" d="M 7600,4600 L 10100,2100"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_11_0" stroke-width="50" stroke-linejoin="round" d="M 10100,4600 L 10100,2100"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_12_0" stroke-width="50" stroke-linejoin="round" d="M 10100,4600 L 12600,2100"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_13_0" stroke-width="50" stroke-linejoin="round" d="M 12590,4556 L 12590,2056"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_14_0" stroke-width="30" stroke-linejoin="round" stroke-dasharray="508,508,508,508" d="M 2100,2100 L 13500,2100"/> - </g> - <g id="Drawing_15"> - <rect fill="none" stroke="none" x="12600" y="4967" width="1301" height="641"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="353" font-style="normal" font-weight="400"> - <text x="12850" y="5405">T</text> - <text x="13057" y="5405">i</text> - <text x="13134" y="5405">m</text> - <text x="13434" y="5405">e</text> - </g> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_16_0" stroke-width="100" stroke-linejoin="round" stroke-dasharray="197,197" d="M 2100,3630 L 4100,3630"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_17_0" stroke-width="100" stroke-linejoin="round" stroke-dasharray="197,197" d="M 4100,4600 L 7600,4600"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_18_0" stroke-width="100" stroke-linejoin="round" stroke-dasharray="197,197" d="M 7600,3200 L 8100,3200"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_19_0" stroke-width="100" stroke-linejoin="round" stroke-dasharray="197,197" d="M 8100,4300 L 10100,4300"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_20_0" stroke-width="100" stroke-linejoin="round" stroke-dasharray="197,197" d="M 10100,2100 L 12600,2100"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_21_0" stroke-width="50" stroke-linejoin="round" d="M 3386,3367 L 3636,3800"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_22_0" stroke-width="50" stroke-linejoin="round" d="M 3733,3460 L 3300,3710"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_23_0" stroke-width="50" stroke-linejoin="round" d="M 5053,4400 L 5303,4833"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_24_0" stroke-width="50" stroke-linejoin="round" d="M 5400,4493 L 4967,4743"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_25_0" stroke-width="50" stroke-linejoin="round" d="M 12600,4600 L 13100,4100"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_26_0" stroke-width="50" stroke-linejoin="round" d="M 2600,7100 L 3600,7100"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_27_0" stroke-width="50" stroke-linejoin="round" d="M 2600,8100 L 2600,7100"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_28_0" stroke-width="50" stroke-linejoin="round" d="M 3600,7100 L 3600,8100"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_29_0" stroke-width="50" stroke-linejoin="round" d="M 3600,8100 L 7100,8100"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_30_0" stroke-width="50" stroke-linejoin="round" d="M 7100,7100 L 12900,7100"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_31_0" stroke-width="50" stroke-linejoin="round" d="M 7100,7100 L 7100,8100"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_32_0" stroke-width="50" stroke-linejoin="round" d="M 12900,7100 L 12900,8100"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_33_0" stroke-width="100" stroke-linejoin="round" stroke-dasharray="197,197" d="M 12600,4300 L 14600,4300"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_34_0" stroke-width="50" stroke-linejoin="round" d="M 11686,5800 L 11936,6233"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_35_0" stroke-width="50" stroke-linejoin="round" d="M 12033,5893 L 11600,6143"/> - </g> - <g id="Drawing_36"> - <rect fill="none" stroke="none" x="12300" y="5760" width="1701" height="641"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="353" font-style="normal" font-weight="400"> - <text x="12550" y="6198">M</text> - <text x="12842" y="6198">a</text> - <text x="13037" y="6198">t</text> - <text x="13134" y="6198">c</text> - <text x="13312" y="6198">h</text> - </g> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_37_0" stroke-width="50" stroke-linejoin="round" d="M 12853,4067 L 13103,4500"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_38_0" stroke-width="50" stroke-linejoin="round" d="M 13200,4160 L 12767,4410"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_39_0" stroke-width="50" stroke-linejoin="round" d="M 12900,8100 L 13500,8100"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_40_0" stroke-width="50" stroke-linejoin="round" d="M 2100,8100 L 2600,8100"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_41_0" stroke-width="50" stroke-linejoin="round" d="M 2600,4600 L 2600,2100"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" id="Drawing_42_0" stroke-width="50" stroke-linejoin="round" d="M 2100,2600 L 2600,2100"/> - </g> - <g id="Drawing_43"> - <rect fill="none" stroke="none" x="500" y="7171" width="1901" height="1030"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="353" font-style="normal" font-weight="400"> - <text x="750" y="7609">P</text> - <text x="983" y="7609">W</text> - <text x="1334" y="7609">M</text> - <text x="1626" y="7609"> </text> - <text fill="rgb(0,0,0)" stroke="none" x="750" y="7998">o</text> - <text x="945" y="7998">u</text> - <text x="1139" y="7998">t</text> - <text x="1237" y="7998">p</text> - <text x="1432" y="7998">u</text> - <text x="1626" y="7998">t</text> - </g> - </g> - <g id="Drawing_44"> - <rect fill="none" stroke="none" x="6000" y="200" width="4401" height="641"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="353" font-style="normal" font-weight="400"> - <text x="6250" y="638">R</text> - <text x="6504" y="638">e</text> - <text x="6699" y="638">l</text> - <text x="6775" y="638">o</text> - <text x="6970" y="638">a</text> - <text x="7164" y="638">d</text> - <text x="7359" y="638"> </text> - <text x="7457" y="638">c</text> - <text x="7634" y="638">o</text> - <text x="7829" y="638">u</text> - <text x="8024" y="638">n</text> - <text x="8219" y="638">t</text> - <text x="8316" y="638">e</text> - <text x="8511" y="638">r</text> - <text x="8629" y="638"> </text> - <text x="8727" y="638">t</text> - <text x="8824" y="638">o</text> - <text x="9019" y="638"> </text> - <text x="9116" y="638">z</text> - <text x="9285" y="638">e</text> - <text x="9480" y="638">r</text> - <text x="9599" y="638">o</text> - </g> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 9200,800 L 11910,1762"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_45_0" d="M 12300,1900 L 11870,1564 11755,1890 12300,1900 Z"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 8500,800 L 9586,1731"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_46_0" d="M 9900,2000 L 9619,1532 9395,1794 9900,2000 Z"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 7800,700 L 7668,1492"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_47_0" d="M 7600,1900 L 7855,1418 7515,1361 7600,1900 Z"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 7200,700 L 5452,1782"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_48_0" d="M 5100,2000 L 5631,1874 5449,1581 5100,2000 Z"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 6600,700 L 3294,1772"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_49_0" d="M 2900,1900 L 3445,1904 3339,1576 2900,1900 Z"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 7700,5400 L 7870,5144"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_50_0" d="M 8100,4800 L 7669,5135 7956,5326 8100,4800 Z"/> - </g> - <g id="Drawing_51"> - <rect fill="none" stroke="none" x="4100" y="5571" width="5901" height="1030"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="353" font-style="normal" font-weight="400"> - <text x="4350" y="6009">C</text> - <text x="4604" y="6009">o</text> - <text x="4799" y="6009">m</text> - <text x="5099" y="6009">p</text> - <text x="5294" y="6009">a</text> - <text x="5489" y="6009">r</text> - <text x="5607" y="6009">e</text> - <text x="5802" y="6009"> </text> - <text x="5899" y="6009">v</text> - <text x="6073" y="6009">a</text> - <text x="6268" y="6009">l</text> - <text x="6344" y="6009">u</text> - <text x="6539" y="6009">e</text> - <text x="6733" y="6009"> </text> - <text x="6831" y="6009">h</text> - <text x="7025" y="6009">a</text> - <text x="7220" y="6009">s</text> - <text x="7398" y="6009"> </text> - <text x="7495" y="6009">b</text> - <text x="7690" y="6009">e</text> - <text x="7885" y="6009">e</text> - <text x="8080" y="6009">n</text> - <text x="8274" y="6009"> </text> - <text x="8372" y="6009">c</text> - <text x="8549" y="6009">h</text> - <text x="8744" y="6009">a</text> - <text x="8939" y="6009">n</text> - <text x="9134" y="6009">g</text> - <text x="9328" y="6009">e</text> - <text x="9523" y="6009">d</text> - <text x="9718" y="6009"> </text> - <text fill="rgb(0,0,0)" stroke="none" x="4350" y="6398">w</text> - <text x="4600" y="6398">i</text> - <text x="4676" y="6398">t</text> - <text x="4773" y="6398">h</text> - <text x="4968" y="6398"> </text> - <text x="5065" y="6398">t</text> - <text x="5163" y="6398">c</text> - <text x="5341" y="6398">_</text> - <text x="5535" y="6398">s</text> - <text x="5713" y="6398">e</text> - <text x="5908" y="6398">t</text> - <text x="6005" y="6398">_</text> - <text x="6200" y="6398">c</text> - <text x="6378" y="6398">o</text> - <text x="6573" y="6398">m</text> - <text x="6873" y="6398">p</text> - <text x="7068" y="6398">a</text> - <text x="7263" y="6398">r</text> - <text x="7381" y="6398">e</text> - <text x="7576" y="6398">_</text> - <text x="7771" y="6398">v</text> - <text x="7944" y="6398">a</text> - <text x="8139" y="6398">l</text> - <text x="8215" y="6398">u</text> - <text x="8410" y="6398">e</text> - <text x="8605" y="6398">(</text> - <text x="8723" y="6398">)</text> - <text x="8842" y="6398"> </text> - </g> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 4800,5500 L 4393,5093"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_52_0" d="M 4100,4800 L 4344,5288 4588,5044 4100,4800 Z"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 9600,5500 L 11899,4904"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_53_0" d="M 12300,4800 L 11756,4763 11842,5097 12300,4800 Z"/> - </g> - <g> - <path fill="none" stroke="rgb(0,0,0)" d="M 9085,5400 L 9554,5048"/> - <path fill="rgb(0,0,0)" stroke="none" id="Drawing_54_0" d="M 9885,4800 L 9368,4973 9575,5249 9885,4800 Z"/> - </g> - <g id="Drawing_55"> - <rect fill="none" stroke="none" x="12600" y="1360" width="2601" height="641"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="353" font-style="normal" font-weight="400"> - <text x="12850" y="1798">T</text> - <text x="13066" y="1798">O</text> - <text x="13341" y="1798">P</text> - <text x="13570" y="1798"> </text> - <text x="13667" y="1798">=</text> - <text x="13870" y="1798"> </text> - <text x="13968" y="1798">M</text> - <text x="14260" y="1798">a</text> - <text x="14454" y="1798">x</text> - </g> - </g> - <g id="Drawing_56"> - <rect fill="none" stroke="none" x="13100" y="2782" width="2101" height="1419"/> - <g fill="rgb(0,0,0)" stroke="none" font-family="Arial" font-size="353" font-style="normal" font-weight="400"> - <text x="13350" y="3220">C</text> - <text x="13604" y="3220">o</text> - <text x="13799" y="3220">m</text> - <text x="14099" y="3220">p</text> - <text x="14294" y="3220">a</text> - <text x="14489" y="3220">r</text> - <text x="14607" y="3220">e</text> - <text x="14802" y="3220"> </text> - <text fill="rgb(0,0,0)" stroke="none" x="13350" y="3609">m</text> - <text x="13651" y="3609">a</text> - <text x="13845" y="3609">t</text> - <text x="13943" y="3609">c</text> - <text x="14120" y="3609">h</text> - <text x="14315" y="3609"> </text> - <text fill="rgb(0,0,0)" stroke="none" x="13350" y="3998">v</text> - <text x="13524" y="3998">a</text> - <text x="13718" y="3998">l</text> - <text x="13795" y="3998">u</text> - <text x="13989" y="3998">e</text> - </g> - </g> - </g> -</svg>
\ No newline at end of file diff --git a/atmel-samd/asf/sam0/drivers/tc/tc.h b/atmel-samd/asf/sam0/drivers/tc/tc.h deleted file mode 100644 index 7bf742046..000000000 --- a/atmel-samd/asf/sam0/drivers/tc/tc.h +++ /dev/null @@ -1,1790 +0,0 @@ -/** - * \file - * - * \brief SAM TC - Timer Counter Driver - * - * Copyright (C) 2013-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef TC_H_INCLUDED -#define TC_H_INCLUDED - -/** - * \defgroup asfdoc_sam0_tc_group SAM Timer/Counter (TC) Driver - * - * This driver for Atmel® | SMART ARM®-based microcontrollers provides an interface for the configuration - * and management of the timer modules within the device, for waveform - * generation and timing operations. The following driver API modes are covered - * by this manual: - * - * - Polled APIs - * \if TC_CALLBACK_MODE - * - Callback APIs - * \endif - * - * - * The following peripheral is used by this module: - * - TC (Timer/Counter) - * - * The following devices can use this module: - * - Atmel | SMART SAM D20/D21 - * - Atmel | SMART SAM R21 - * - Atmel | SMART SAM D09/D10/D11 - * - Atmel | SMART SAM L21/L22 - * - Atmel | SMART SAM DA1 - * - Atmel | SMART SAM C20/C21 - * - * The outline of this documentation is as follows: - * - \ref asfdoc_sam0_tc_prerequisites - * - \ref asfdoc_sam0_tc_module_overview - * - \ref asfdoc_sam0_tc_special_considerations - * - \ref asfdoc_sam0_tc_extra_info - * - \ref asfdoc_sam0_tc_examples - * - \ref asfdoc_sam0_tc_api_overview - * - * - * \section asfdoc_sam0_tc_prerequisites Prerequisites - * - * There are no prerequisites for this module. - * - * - * \section asfdoc_sam0_tc_module_overview Module Overview - * - * The Timer/Counter (TC) module provides a set of timing and counting related - * functionality, such as the generation of periodic waveforms, the capturing - * of a periodic waveform's frequency/duty cycle, and software timekeeping for - * periodic operations. TC modules can be configured to use an 8-, 16-, or - * 32-bit counter size. - * - * This TC module for the SAM is capable of the following functions: - * - * - Generation of PWM signals - * - Generation of timestamps for events - * - General time counting - * - Waveform period capture - * - Waveform frequency capture - * - * \ref asfdoc_sam0_tc_block_diagram "The diagram below" shows the overview - * of the TC module design. - * - * \anchor asfdoc_sam0_tc_block_diagram - * \image html overview.svg "Basic Overview of the TC Module" - * - * - * \subsection asfdoc_sam0_tc_features Driver Feature Macro Definition - * <table> - * <tr> - * <th>Driver Feature Macro</th> - * <th>Supported devices</th> - * </tr> - * <tr> - * <td>FEATURE_TC_DOUBLE_BUFFERED</td> - * <td>SAM L21/L22/C20/C21</td> - * </tr> - * <tr> - * <td>FEATURE_TC_SYNCBUSY_SCHEME_VERSION_2</td> - * <td>SAM L21/L22/C20/C21</td> - * </tr> - * <tr> - * <td>FEATURE_TC_STAMP_PW_CAPTURE</td> - * <td>SAM L21/L22/C20/C21</td> - * </tr> - * <tr> - * <td>FEATURE_TC_READ_SYNC</td> - * <td>SAM L21/L22/C20/C21</td> - * </tr> - * <tr> - * <td>FEATURE_TC_IO_CAPTURE</td> - * <td>SAM L21/L22/C20/C21</td> - * </tr> - * <tr> - * <td>FEATURE_TC_GENERATE_DMA_TRIGGER</td> - * <td>SAM L21/L22</td> - * </tr> - * </table> - * \note The specific features are only available in the driver when the - * selected device supports those features. - * - * \subsection asfdoc_sam0_tc_module_overview_func_desc Functional Description - * Independent of the configured counter size, each TC module can be set up - * in one of two different modes; capture and compare. - * - * In capture mode, the counter value is stored when a configurable event - * occurs. This mode can be used to generate timestamps used in event capture, - * or it can be used for the measurement of a periodic input signal's - * frequency/duty cycle. - * - * In compare mode, the counter value is compared against one or more of the - * configured channel compare values. When the counter value coincides with a - * compare value an action can be taken automatically by the module, such as - * generating an output event or toggling a pin when used for frequency or - * Pulse Width Modulation (PWM) signal generation. - * - * \note The connection of events between modules requires the use of the - * \ref asfdoc_sam0_events_group "SAM Event System Driver (EVENTS)" - * to route output event of one module to the input event of another. - * For more information on event routing, refer to the event driver - * documentation. - * - * \subsection asfdoc_sam0_tc_module_overview_tc_size Timer/Counter Size - * Each timer module can be configured in one of three different counter - * sizes; 8-, 16-, and 32-bit. The size of the counter determines the maximum - * value it can count to before an overflow occurs and the count is reset back - * to zero. \ref asfdoc_sam0_tc_count_size_vs_top "The table below" shows the - * maximum values for each of the possible counter sizes. - * - * \anchor asfdoc_sam0_tc_count_size_vs_top - * <table> - * <caption>Timer Counter Sizes and Their Maximum Count Values</caption> - * <tr> - * <th>Counter size</th> - * <th>Max. (hexadecimal)</th> - * <th>Max. (decimal)</th> - * </tr> - * <tr> - * <td>8-bit</td> - * <td>0xFF</td> - * <td>255</td> - * </tr> - * <tr> - * <td>16-bit</td> - * <td>0xFFFF</td> - * <td>65,535</td> - * </tr> - * <tr> - * <td>32-bit</td> - * <td>0xFFFFFFFF</td> - * <td>4,294,967,295</td> - * </tr> - * </table> - * - * When using the counter in 16- or 32-bit count mode, Compare Capture - * register 0 (CC0) is used to store the period value when running in PWM - * generation match mode. - * - * When using 32-bit counter size, two 16-bit counters are chained together - * in a cascade formation. Except in SAM D09/D10/D11. Even numbered TC modules - * (e.g. TC0, TC2) can be configured as 32-bit counters. The odd numbered - * counters will act as slaves to the even numbered masters, and will not - * be reconfigurable until the master timer is disabled. The pairing of timer - * modules for 32-bit mode is shown in \ref asfdoc_sam0_tc_module_ms_pairs - * "the table below". - * - * \anchor asfdoc_sam0_tc_module_ms_pairs - * <table> - * <caption>TC Master and Slave Module Pairings</caption> - * <tr> - * <th>Master TC module</th> - * <th>Slave TC module</th> - * </tr> - * <tr> - * <td>TC0</td> - * <td>TC1</td> - * </tr> - * <tr> - * <td>TC2</td> - * <td>TC3</td> - * </tr> - * <tr> - * <td>...</td> - * <td>...</td> - * </tr> - * <tr> - * <td>TCn-1</td> - * <td>TCn</td> - * </tr> - * </table> - * - * In SAM D09/D10/D11, odd numbered TC modules (e.g. TC1) can be configured as 32-bit - * counters. The even numbered (e.g. TC2) counters will act as slaves to the odd - * numbered masters. - * - * \subsection asfdoc_sam0_tc_module_overview_clock Clock Settings - * - * \subsubsection asfdoc_sam0_tc_module_overview_clock_selection Clock Selection - * Each TC peripheral is clocked asynchronously to the system clock by a GCLK - * (Generic Clock) channel. The GCLK channel connects to any of the GCLK - * generators. The GCLK generators are configured to use one of the available - * clock sources on the system such as internal oscillator, external crystals, - * etc. See the \ref asfdoc_sam0_system_clock_group "Generic Clock driver" - *for - * more information. - * - * \subsubsection asfdoc_sam0_tc_module_overview_clock_prescaler Prescaler - * Each TC module in the SAM has its own individual clock prescaler, which - * can be used to divide the input clock frequency used in the counter. This - * prescaler only scales the clock used to provide clock pulses for the counter - * to count, and does not affect the digital register interface portion of - * the module, thus the timer registers will synchronize to the raw GCLK - * frequency input to the module. - * - * As a result of this, when selecting a GCLK frequency and timer prescaler - * value the user application should consider both the timer resolution - * required and the synchronization frequency, to avoid lengthy - * synchronization times of the module if a very slow GCLK frequency is fed - * into the TC module. It is preferable to use a higher module GCLK frequency - * as the input to the timer, and prescale this down as much as possible to - * obtain a suitable counter frequency in latency-sensitive applications. - * - * \subsubsection asfdoc_sam0_tc_module_overview_clock_reloading Reloading - * Timer modules also contain a configurable reload action, used when a - * re-trigger event occurs. Examples of a re-trigger event are the counter - * reaching the maximum value when counting up, or when an event from the event - * system tells the counter to re-trigger. The reload action determines if the - * prescaler should be reset, and when this should happen. The counter will - * always be reloaded with the value it is set to start counting from. The user - * can choose between three different reload actions, described in - * \ref asfdoc_sam0_tc_module_reload_act "the table below". - * - * \anchor asfdoc_sam0_tc_module_reload_act - * <table> - * <caption>TC Module Reload Actions</caption> - * <tr> - * <th>Reload action</th> - * <th>Description</th> - * </tr> - * <tr> - * <td>\ref TC_RELOAD_ACTION_GCLK </td> - * <td>Reload TC counter value on next GCLK cycle. Leave prescaler - * as-is.</td> - * </tr> - * <tr> - * <td>\ref TC_RELOAD_ACTION_PRESC </td> - * <td>Reloads TC counter value on next prescaler clock. Leave prescaler - * as-is.</td> - * </tr> - * <tr> - * <td> \ref TC_RELOAD_ACTION_RESYNC </td> - * <td>Reload TC counter value on next GCLK cycle. Clear prescaler to - * zero.</td> - * </tr> - * </table> - * - * The reload action to use will depend on the specific application being - * implemented. One example is when an external trigger for a reload occurs; if - * the TC uses the prescaler, the counter in the prescaler should not have a - * value between zero and the division factor. The TC counter and the counter - * in the prescaler should both start at zero. When the counter is set to - * re-trigger when it reaches the maximum value on the other hand, this is not the - * right option to use. In such a case it would be better if the prescaler is - * left unaltered when the re-trigger happens, letting the counter reset on the - * next GCLK cycle. - * - * \subsection asfdoc_sam0_tc_module_overview_compare_match Compare Match Operations - * In compare match operation, Compare/Capture registers are used in comparison - * with the counter value. When the timer's count value matches the value of a - * compare channel, a user defined action can be taken. - * - * \subsubsection asfdoc_sam0_tc_module_overview_compare_match_timer Basic Timer - * - * A Basic Timer is a simple application where compare match operations are used - * to determine when a specific period has elapsed. In Basic Timer operations, - * one or more values in the module's Compare/Capture registers are used to - * specify the time (as a number of prescaled GCLK cycles) when an action should - * be taken by the microcontroller. This can be an Interrupt Service Routine - * (ISR), event generator via the event system, or a software flag that is - * polled via the user application. - * - * \subsubsection asfdoc_sam0_tc_module_overview_compare_match_wg Waveform Generation - * - * Waveform generation enables the TC module to generate square waves, or if - * combined with an external passive low-pass filter; analog waveforms. - * - * \subsubsection asfdoc_sam0_tc_module_overview_compare_match_wg_pwm Waveform Generation - PWM - * - * Pulse width modulation is a form of waveform generation and a signalling - * technique that can be useful in many situations. When PWM mode is used, - * a digital pulse train with a configurable frequency and duty cycle can be - * generated by the TC module and output to a GPIO pin of the device. - * - * Often PWM is used to communicate a control or information parameter to an - * external circuit or component. Differing impedances of the source generator - * and sink receiver circuits are less of an issue when using PWM compared to - * using an analog voltage value, as noise will not generally affect the - * signal's integrity to a meaningful extent. - * - * \ref asfdoc_sam0_tc_module_pwm_normal_diag "The figure below" illustrates - * operations and different states of the counter and its output when running - * the counter in PWM normal mode. As can be seen, the TOP value is unchanged - * and is set to MAX. The compare match value is changed at several points to - * illustrate the resulting waveform output changes. The PWM output is set to - * normal (i.e. non-inverted) output mode. - * - * \anchor asfdoc_sam0_tc_module_pwm_normal_diag - * \image html pwm_normal_ex.svg "Example of PWM in Normal Mode, and Different Counter Operations" - * - * - * In \ref asfdoc_sam0_tc_module_pwm_match_diag "the figure below", the - * counter is set to generate PWM in Match mode. The PWM output is inverted via - * the appropriate configuration option in the TC driver configuration - * structure. In this example, the counter value is changed once, but the - * compare match value is kept unchanged. As can be seen, it is possible to - * change the TOP value when running in PWM match mode. - * - * \anchor asfdoc_sam0_tc_module_pwm_match_diag - * \image html pwm_match_ex.svg "Example of PWM in Match Mode and Different Counter Operations" - * - * \subsubsection asfdoc_sam0_tc_module_overview_compare_match_wg_freq Waveform Generation - Frequency - * - * Frequency Generation mode is in many ways identical to PWM - * generation. However, in Frequency Generation a toggle only occurs - * on the output when a match on a capture channels occurs. When the - * match is made, the timer value is reset, resulting in a variable - * frequency square wave with a fixed 50% duty cycle. - * - * \subsubsection asfdoc_sam0_tc_module_overview_compare_match_capt Capture Operations - * - * In capture operations, any event from the event system or a pin change can - * trigger a capture of the counter value. This captured counter value can be - * used as a timestamp for the event, or it can be used in frequency and pulse - * width capture. - * - * \subsubsection asfdoc_sam0_tc_module_overview_compare_match_capt_event_capture Capture Operations - Event - * - * Event capture is a simple use of the capture functionality, - * designed to create timestamps for specific events. When the TC - * module's input capture pin is externally toggled, the current timer - * count value is copied into a buffered register which can then be - * read out by the user application. - * - * Note that when performing any capture operation, there is a risk that the - * counter reaches its top value (MAX) when counting up, or the bottom value - * (zero) when counting down, before the capture event occurs. This can distort - * the result, making event timestamps to appear shorter than reality; the - * user application should check for timer overflow when reading a capture - * result in order to detect this situation and perform an appropriate - * adjustment. - * - * Before checking for a new capture, \ref TC_STATUS_COUNT_OVERFLOW - * should be checked. The response to an overflow error is left to the user - * application, however it may be necessary to clear both the capture overflow - * flag and the capture flag upon each capture reading. - * - * \subsubsection asfdoc_sam0_tc_module_overview_compare_match_capt_pwc Capture Operations - Pulse Width - * - * Pulse Width Capture mode makes it possible to measure the pulse width and - * period of PWM signals. This mode uses two capture channels of the counter. - * This means that the counter module used for Pulse Width Capture can not be - * used for any other purpose. There are two modes for pulse width capture; - * Pulse Width Period (PWP) and Period Pulse Width (PPW). In PWP mode, capture - * channel 0 is used for storing the pulse width and capture channel 1 stores - * the observed period. While in PPW mode, the roles of the two capture channels - * are reversed. - * - * As in the above example it is necessary to poll on interrupt flags to see - * if a new capture has happened and check that a capture overflow error has - * not occurred. - * - * \subsection asfdoc_sam0_tc_module_overview_oneshot One-shot Mode - * - * TC modules can be configured into a one-shot mode. When configured in this - * manner, starting the timer will cause it to count until the next overflow - * or underflow condition before automatically halting, waiting to be manually - * triggered by the user application software or an event signal from the event - * system. - * - * \subsubsection asfdoc_sam0_tc_module_overview_inversion Wave Generation Output Inversion - * - * The output of the wave generation can be inverted by hardware if desired, - * resulting in the logically inverted value being output to the configured - * device GPIO pin. - * - * - * \section asfdoc_sam0_tc_special_considerations Special Considerations - * - * The number of capture compare registers in each TC module is dependent on - * the specific SAM device being used, and in some cases the counter size. - * - * The maximum amount of capture compare registers available in any SAM - * device is two when running in 32-bit mode and four in 8- and 16-bit modes. - * - * - * \section asfdoc_sam0_tc_extra_info Extra Information - * - * For extra information, see \ref asfdoc_sam0_tc_extra. This includes: - * - \ref asfdoc_sam0_tc_extra_acronyms - * - \ref asfdoc_sam0_tc_extra_dependencies - * - \ref asfdoc_sam0_tc_extra_errata - * - \ref asfdoc_sam0_tc_extra_history - * - * - * \section asfdoc_sam0_tc_examples Examples - * - * For a list of examples related to this driver, see - * \ref asfdoc_sam0_tc_exqsg. - * - * \section asfdoc_sam0_tc_api_overview API Overview - * @{ - */ - -#include <compiler.h> -#include <clock.h> -#include <gclk.h> -#include <pinmux.h> - -/** - * Define port features set according to different device family - * @{ -*/ -#if (SAML21) || (SAML22) || (SAMC20) || (SAMC21) || (SAMR30) || defined(__DOXYGEN__) -/** TC double buffered. */ -# define FEATURE_TC_DOUBLE_BUFFERED -/** SYNCBUSY scheme version 2. */ -# define FEATURE_TC_SYNCBUSY_SCHEME_VERSION_2 -/** TC time stamp capture and pulse width capture. */ -# define FEATURE_TC_STAMP_PW_CAPTURE -/** Read synchronization of COUNT. */ -# define FEATURE_TC_READ_SYNC -/** I/O pin edge capture. */ -# define FEATURE_TC_IO_CAPTURE -#endif - -#if (SAML21XXXB) || (SAMR30) || defined(__DOXYGEN__) -/** Generate Direct Memory Access (DMA) triggers. */ -# define FEATURE_TC_GENERATE_DMA_TRIGGER -#endif -/*@}*/ - -#if !defined(__DOXYGEN__) -#if SAMD20 || SAML21 || SAML22 || SAMC20 || SAMC21 || SAMR30 -# define TC_INSTANCE_OFFSET 0 -#endif -#if SAMD21 || SAMR21 || SAMDA1 -# define TC_INSTANCE_OFFSET 3 -#endif -#if SAMD09 || SAMD10 || SAMD11 -# define TC_INSTANCE_OFFSET 1 -#endif - -#if SAMD20 -# define NUMBER_OF_COMPARE_CAPTURE_CHANNELS TC0_CC8_NUM -#elif SAML21 || SAML22 || SAMC20 || SAMC21 || SAMR30 -# define NUMBER_OF_COMPARE_CAPTURE_CHANNELS TC0_CC_NUM -#elif SAMD09 || SAMD10 || SAMD11 -# define NUMBER_OF_COMPARE_CAPTURE_CHANNELS TC1_CC8_NUM -#else -# define NUMBER_OF_COMPARE_CAPTURE_CHANNELS TC3_CC8_NUM - /* Same number for 8-, 16- or 32-bit TC and all TC instances */ -#endif - -/** TC Instance MAX ID Number. */ -#if SAMD20E || SAMD20G || SAMD21G || SAMD21E || SAMR21 -# if SAMD21GXXL -# define TC_INST_MAX_ID 7 -# else -# define TC_INST_MAX_ID 5 -# endif -#elif SAML21 || SAMC20 || SAMC21 || SAMR30 -# define TC_INST_MAX_ID 4 -#elif SAML22 -# define TC_INST_MAX_ID 3 -#elif SAMD09 || SAMD10 || SAMD11 -# define TC_INST_MAX_ID 2 -#else -# define TC_INST_MAX_ID 7 -#endif - -#endif - -#if TC_ASYNC == true -# include <system_interrupt.h> -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#if TC_ASYNC == true -/** Enum for the possible callback types for the TC module. */ -enum tc_callback { - /** Callback for TC overflow */ - TC_CALLBACK_OVERFLOW, - /** Callback for capture overflow error */ - TC_CALLBACK_ERROR, - /** Callback for capture compare channel 0 */ - TC_CALLBACK_CC_CHANNEL0, - /** Callback for capture compare channel 1 */ - TC_CALLBACK_CC_CHANNEL1, -# if !defined(__DOXYGEN__) - /** Number of available callbacks */ - TC_CALLBACK_N, -# endif -}; -#endif - -/** - * \name Module Status Flags - * - * TC status flags, returned by \ref tc_get_status() and cleared by - * \ref tc_clear_status(). - * - * @{ - */ - -/** Timer channel 0 has matched against its compare value, or has captured a - * new value. - */ -#define TC_STATUS_CHANNEL_0_MATCH (1UL << 0) - -/** Timer channel 1 has matched against its compare value, or has captured a - * new value. - */ -#define TC_STATUS_CHANNEL_1_MATCH (1UL << 1) - -/** Timer register synchronization has completed, and the synchronized count - * value may be read. - */ -#define TC_STATUS_SYNC_READY (1UL << 2) - -/** A new value was captured before the previous value was read, resulting in - * lost data. - */ -#define TC_STATUS_CAPTURE_OVERFLOW (1UL << 3) - -/** The timer count value has overflowed from its maximum value to its minimum - * when counting upward, or from its minimum value to its maximum when - * counting downward. - */ -#define TC_STATUS_COUNT_OVERFLOW (1UL << 4) - -#ifdef FEATURE_TC_DOUBLE_BUFFERED -/** Channel 0 compare or capture buffer valid. */ -#define TC_STATUS_CHN0_BUFFER_VALID (1UL << 5) -/** Channel 1 compare or capture buffer valid. */ -#define TC_STATUS_CHN1_BUFFER_VALID (1UL << 6) -/** Period buffer valid. */ -#define TC_STATUS_PERIOD_BUFFER_VALID (1UL << 7) -#endif -/** @} */ - -/** - * \brief Index of the compare capture channels. - * - * This enum is used to specify which capture/compare channel to do - * operations on. - */ -enum tc_compare_capture_channel { - /** Index of compare capture channel 0 */ - TC_COMPARE_CAPTURE_CHANNEL_0, - /** Index of compare capture channel 1 */ - TC_COMPARE_CAPTURE_CHANNEL_1, -}; - -/** - * \name TC Wave Generation Mode - * - * @{ - */ -#if SAML21 || SAML22 || SAMC20 || SAMC21 || SAMR30 -/** TC wave generation mode: normal frequency. */ -#define TC_WAVE_GENERATION_NORMAL_FREQ_MODE TC_WAVE_WAVEGEN_NFRQ -/** TC wave generation mode: match frequency. */ -#define TC_WAVE_GENERATION_MATCH_FREQ_MODE TC_WAVE_WAVEGEN_MFRQ -/** TC wave generation mode: normal PWM. */ -#define TC_WAVE_GENERATION_NORMAL_PWM_MODE TC_WAVE_WAVEGEN_NPWM -/** TC wave generation mode: match PWM. */ -#define TC_WAVE_GENERATION_MATCH_PWM_MODE TC_WAVE_WAVEGEN_MPWM -#else -/** TC wave generation mode: normal frequency. */ -#define TC_WAVE_GENERATION_NORMAL_FREQ_MODE TC_CTRLA_WAVEGEN_NFRQ -/** TC wave generation mode: match frequency. */ -#define TC_WAVE_GENERATION_MATCH_FREQ_MODE TC_CTRLA_WAVEGEN_MFRQ -/** TC wave generation mode: normal PWM. */ -#define TC_WAVE_GENERATION_NORMAL_PWM_MODE TC_CTRLA_WAVEGEN_NPWM -/** TC wave generation mode: match PWM. */ -#define TC_WAVE_GENERATION_MATCH_PWM_MODE TC_CTRLA_WAVEGEN_MPWM -#endif -/** @} */ - -/** - * \brief TC wave generation mode enum. - * - * This enum is used to select which mode to run the wave - * generation in. - * - */ -enum tc_wave_generation { - /** Top is maximum, except in 8-bit counter size where it is the PER - * register - */ - TC_WAVE_GENERATION_NORMAL_FREQ = TC_WAVE_GENERATION_NORMAL_FREQ_MODE, - - /** Top is CC0, except in 8-bit counter size where it is the PER - * register - */ - TC_WAVE_GENERATION_MATCH_FREQ = TC_WAVE_GENERATION_MATCH_FREQ_MODE, - - /** Top is maximum, except in 8-bit counter size where it is the PER - * register - */ - TC_WAVE_GENERATION_NORMAL_PWM = TC_WAVE_GENERATION_NORMAL_PWM_MODE, - - /** Top is CC0, except in 8-bit counter size where it is the PER - * register - */ - TC_WAVE_GENERATION_MATCH_PWM = TC_WAVE_GENERATION_MATCH_PWM_MODE, -}; - -/** - * \brief Specifies if the counter is 8-, 16-, or 32-bit. - * - * This enum specifies the maximum value it is possible to count to. - */ -enum tc_counter_size { - /** The counter's maximum value is 0xFF, the period register is - * available to be used as top value - */ - TC_COUNTER_SIZE_8BIT = TC_CTRLA_MODE_COUNT8, - - /** The counter's maximum value is 0xFFFF. There is no separate - * period register, to modify top one of the capture compare - * registers has to be used. This limits the amount of - * available channels. - */ - TC_COUNTER_SIZE_16BIT = TC_CTRLA_MODE_COUNT16, - - /** The counter's maximum value is 0xFFFFFFFF. There is no separate - * period register, to modify top one of the capture compare - * registers has to be used. This limits the amount of - * available channels. - */ - TC_COUNTER_SIZE_32BIT = TC_CTRLA_MODE_COUNT32, -}; - -/** - * \brief TC Counter reload action enum. - * - * This enum specify how the counter and prescaler should reload. - */ -enum tc_reload_action { - /** The counter is reloaded/reset on the next GCLK and starts - * counting on the prescaler clock - */ - TC_RELOAD_ACTION_GCLK = TC_CTRLA_PRESCSYNC_GCLK, - - /** The counter is reloaded/reset on the next prescaler clock - */ - TC_RELOAD_ACTION_PRESC = TC_CTRLA_PRESCSYNC_PRESC, - - /** The counter is reloaded/reset on the next GCLK, and the - * prescaler is restarted as well - */ - TC_RELOAD_ACTION_RESYNC = TC_CTRLA_PRESCSYNC_RESYNC, -}; - -/** - * \brief TC clock prescaler values. - * - * This enum is used to choose the clock prescaler - * configuration. The prescaler divides the clock frequency of the TC - * module to make the counter count slower. - */ -enum tc_clock_prescaler { - /** Divide clock by 1 */ - TC_CLOCK_PRESCALER_DIV1 = TC_CTRLA_PRESCALER(0), - /** Divide clock by 2 */ - TC_CLOCK_PRESCALER_DIV2 = TC_CTRLA_PRESCALER(1), - /** Divide clock by 4 */ - TC_CLOCK_PRESCALER_DIV4 = TC_CTRLA_PRESCALER(2), - /** Divide clock by 8 */ - TC_CLOCK_PRESCALER_DIV8 = TC_CTRLA_PRESCALER(3), - /** Divide clock by 16 */ - TC_CLOCK_PRESCALER_DIV16 = TC_CTRLA_PRESCALER(4), - /** Divide clock by 64 */ - TC_CLOCK_PRESCALER_DIV64 = TC_CTRLA_PRESCALER(5), - /** Divide clock by 256 */ - TC_CLOCK_PRESCALER_DIV256 = TC_CTRLA_PRESCALER(6), - /** Divide clock by 1024 */ - TC_CLOCK_PRESCALER_DIV1024 = TC_CTRLA_PRESCALER(7), -}; - -/** - * \brief TC module count direction. - * - * Timer/Counter count direction. - */ -enum tc_count_direction { - /** Timer should count upward from zero to MAX */ - TC_COUNT_DIRECTION_UP, - - /** Timer should count downward to zero from MAX */ - TC_COUNT_DIRECTION_DOWN, -}; - -/** - * \name Waveform Inversion Mode - * - * @{ - */ -#if SAML21 || SAML22 || SAMC20 || SAMC21 || SAMR30 -/** Waveform inversion CC0 mode. */ -#define TC_WAVEFORM_INVERT_CC0_MODE TC_DRVCTRL_INVEN(1) -/** Waveform inversion CC1 mode. */ -#define TC_WAVEFORM_INVERT_CC1_MODE TC_DRVCTRL_INVEN(2) -#else -/** Waveform inversion CC0 mode. */ -#define TC_WAVEFORM_INVERT_CC0_MODE TC_CTRLC_INVEN(1) -/** Waveform inversion CC1 mode. */ -#define TC_WAVEFORM_INVERT_CC1_MODE TC_CTRLC_INVEN(2) -#endif - -/** - * \brief Waveform inversion mode. - * - * Output waveform inversion mode. - */ -enum tc_waveform_invert_output { - /** No inversion of the waveform output */ - TC_WAVEFORM_INVERT_OUTPUT_NONE = 0, - /** Invert output from compare channel 0 */ - TC_WAVEFORM_INVERT_OUTPUT_CHANNEL_0 = TC_WAVEFORM_INVERT_CC0_MODE, - /** Invert output from compare channel 1 */ - TC_WAVEFORM_INVERT_OUTPUT_CHANNEL_1 = TC_WAVEFORM_INVERT_CC1_MODE, -}; - -/** - * \brief Action to perform when the TC module is triggered by an event. - * - * Event action to perform when the module is triggered by an event. - */ -enum tc_event_action { - /** No event action */ - TC_EVENT_ACTION_OFF = TC_EVCTRL_EVACT_OFF, - /** Re-trigger on event */ - TC_EVENT_ACTION_RETRIGGER = TC_EVCTRL_EVACT_RETRIGGER, - /** Increment counter on event */ - TC_EVENT_ACTION_INCREMENT_COUNTER = TC_EVCTRL_EVACT_COUNT, - /** Start counter on event */ - TC_EVENT_ACTION_START = TC_EVCTRL_EVACT_START, - - /** Store period in capture register 0, pulse width in capture - * register 1 - */ - TC_EVENT_ACTION_PPW = TC_EVCTRL_EVACT_PPW, - - /** Store pulse width in capture register 0, period in capture - * register 1 - */ - TC_EVENT_ACTION_PWP = TC_EVCTRL_EVACT_PWP, -#ifdef FEATURE_TC_STAMP_PW_CAPTURE - /** Time stamp capture */ - TC_EVENT_ACTION_STAMP = TC_EVCTRL_EVACT_STAMP, - /** Pulse width capture */ - TC_EVENT_ACTION_PW = TC_EVCTRL_EVACT_PW, -#endif -}; - -/** - * \brief TC event enable/disable structure. - * - * Event flags for the \ref tc_enable_events() and \ref tc_disable_events(). - */ -struct tc_events { - /** Generate an output event on a compare channel match */ - bool generate_event_on_compare_channel - [NUMBER_OF_COMPARE_CAPTURE_CHANNELS]; - /** Generate an output event on counter overflow */ - bool generate_event_on_overflow; - /** Perform the configured event action when an incoming event is signalled */ - bool on_event_perform_action; - /** Specifies if the input event source is inverted, when used in PWP or - * PPW event action modes - */ - bool invert_event_input; - /** Specifies which event to trigger if an event is triggered */ - enum tc_event_action event_action; -}; - -/** - * \brief Configuration struct for TC module in 8-bit size counter mode. - */ -struct tc_8bit_config { - /** Initial timer count value */ - uint8_t value; - /** Where to count to or from depending on the direction on the counter */ - uint8_t period; - /** Value to be used for compare match on each channel */ - uint8_t compare_capture_channel[NUMBER_OF_COMPARE_CAPTURE_CHANNELS]; -}; - -/** - * \brief Configuration struct for TC module in 16-bit size counter mode. - */ -struct tc_16bit_config { - /** Initial timer count value */ - uint16_t value; - /** Value to be used for compare match on each channel */ - uint16_t compare_capture_channel[NUMBER_OF_COMPARE_CAPTURE_CHANNELS]; -}; - -/** - * \brief Configuration struct for TC module in 32-bit size counter mode. - */ -struct tc_32bit_config { - /** Initial timer count value */ - uint32_t value; - /** Value to be used for compare match on each channel */ - uint32_t compare_capture_channel[NUMBER_OF_COMPARE_CAPTURE_CHANNELS]; -}; - -/** - * \brief Configuration struct for TC module in 32-bit size counter mode. - */ -struct tc_pwm_channel { - /** When \c true, PWM output for the given channel is enabled */ - bool enabled; - /** Specifies pin output for each channel */ - uint32_t pin_out; - /** Specifies Multiplexer (MUX) setting for each output channel pin */ - uint32_t pin_mux; -}; - -/** - * \brief TC configuration structure. - * - * Configuration struct for a TC instance. This structure should be - * initialized by the \ref tc_get_config_defaults function before being - * modified by the user application. - */ -struct tc_config { - /** GCLK generator used to clock the peripheral */ - enum gclk_generator clock_source; - - /** When \c true the module is enabled during standby */ - bool run_in_standby; -#if (SAML21) || (SAML22) || (SAMC20) || (SAMC21) || (SAMR30) - /** Run on demand */ - bool on_demand; -#endif - /** Specifies either 8-, 16-, or 32-bit counter size */ - enum tc_counter_size counter_size; - /** Specifies the prescaler value for GCLK_TC */ - enum tc_clock_prescaler clock_prescaler; - /** Specifies which waveform generation mode to use */ - enum tc_wave_generation wave_generation; - - /** Specifies the reload or reset time of the counter and prescaler - * resynchronization on a re-trigger event for the TC - */ - enum tc_reload_action reload_action; - - /** Specifies which channel(s) to invert the waveform on. - For SAM L21/L22/C20/C21, it's also used to invert I/O input pin. */ - uint8_t waveform_invert_output; - - /** Specifies which channel(s) to enable channel capture - * operation on - */ - bool enable_capture_on_channel[NUMBER_OF_COMPARE_CAPTURE_CHANNELS]; -#ifdef FEATURE_TC_IO_CAPTURE - /** Specifies which channel(s) to enable I/O capture - * operation on - */ - bool enable_capture_on_IO[NUMBER_OF_COMPARE_CAPTURE_CHANNELS]; -#endif - - /** When \c true, one-shot will stop the TC on next hardware or software - * re-trigger event or overflow/underflow - */ - bool oneshot; - - /** Specifies the direction for the TC to count */ - enum tc_count_direction count_direction; - - /** Specifies the PWM channel for TC */ - struct tc_pwm_channel pwm_channel[NUMBER_OF_COMPARE_CAPTURE_CHANNELS]; - - /** Access the different counter size settings through this configuration member. */ - union { - /** Struct for 8-bit specific timer configuration */ - struct tc_8bit_config counter_8_bit; - /** Struct for 16-bit specific timer configuration */ - struct tc_16bit_config counter_16_bit; - /** Struct for 32-bit specific timer configuration */ - struct tc_32bit_config counter_32_bit; - }; - -#ifdef FEATURE_TC_DOUBLE_BUFFERED - /** Set to \c true to enable double buffering write. When enabled any write - * through \ref tc_set_top_value(), \ref tc_set_compare_value() and - * will direct to the buffer register as buffered - * value, and the buffered value will be committed to effective register - * on UPDATE condition, if update is not locked. - */ - bool double_buffering_enabled; -#endif -}; - -#if TC_ASYNC == true -/** Forward Declaration for the device instance. */ -struct tc_module; - -/** Type of the callback functions. */ -typedef void (*tc_callback_t)(struct tc_module *const module); -#endif - -/** - * \brief TC software device instance structure. - * - * TC software instance structure, used to retain software state information - * of an associated hardware module instance. - * - * \note The fields of this structure should not be altered by the user - * application; they are reserved for module-internal use only. - */ -struct tc_module { -#if !defined(__DOXYGEN__) - /** Hardware module pointer of the associated Timer/Counter peripheral */ - Tc *hw; - - /** Size of the initialized Timer/Counter module configuration */ - enum tc_counter_size counter_size; -# if TC_ASYNC == true - /** Array of callbacks */ - tc_callback_t callback[TC_CALLBACK_N]; - /** Bit mask for callbacks registered */ - uint8_t register_callback_mask; - /** Bit mask for callbacks enabled */ - uint8_t enable_callback_mask; -# endif -#ifdef FEATURE_TC_DOUBLE_BUFFERED - /** Set to \c true to enable double buffering write */ - bool double_buffering_enabled; -#endif -#endif -}; - -#if !defined(__DOXYGEN__) -uint8_t _tc_get_inst_index( - Tc *const hw); -#endif - -/** - * \name Driver Initialization and Configuration - * @{ - */ - -/** - * \brief Determines if the hardware module(s) are currently synchronizing to - * the bus. - * - * Checks to see if the underlying hardware peripheral module(s) are currently - * synchronizing across multiple clock domains to the hardware bus. This - * function can be used to delay further operations on a module until such time - * that it is ready, to prevent blocking delays for synchronization in the - * user application. - * - * \param[in] module_inst Pointer to the software module instance struct - * - * \return Synchronization status of the underlying hardware module(s). - * - * \retval false If the module has completed synchronization - * \retval true If the module synchronization is ongoing - */ -static inline bool tc_is_syncing( - const struct tc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance */ - TcCount8 *const tc_module = &(module_inst->hw->COUNT8); - -#if (SAML21) || (SAML22) || (SAMC20) || (SAMC21) || (SAMR30) - return (tc_module->SYNCBUSY.reg); -#else - return (tc_module->STATUS.reg & TC_STATUS_SYNCBUSY); -#endif -} - -/** - * \brief Initializes config with predefined default values. - * - * This function will initialize a given TC configuration structure to - * a set of known default values. This function should be called on - * any new instance of the configuration structures before being - * modified by the user application. - * - * The default configuration is as follows: - * \li GCLK generator 0 (GCLK main) clock source - * \li 16-bit counter size on the counter - * \li No prescaler - * \li Normal frequency wave generation - * \li GCLK reload action - * \li Don't run in standby - * \li Don't run on demand for SAM L21/L22/C20/C21 - * \li No inversion of waveform output - * \li No capture enabled - * \li No I/O capture enabled for SAM L21/L22/C20/C21 - * \li No event input enabled - * \li Count upward - * \li Don't perform one-shot operations - * \li No event action - * \li No channel 0 PWM output - * \li No channel 1 PWM output - * \li Counter starts on 0 - * \li Capture compare channel 0 set to 0 - * \li Capture compare channel 1 set to 0 - * \li No PWM pin output enabled - * \li Pin and MUX configuration not set - * \li Double buffer disabled (if have this feature) - * - * \param[out] config Pointer to a TC module configuration structure to set - */ -static inline void tc_get_config_defaults( - struct tc_config *const config) -{ - /* Sanity check arguments */ - Assert(config); - - /* Write default config to config struct */ - config->clock_source = GCLK_GENERATOR_0; - config->counter_size = TC_COUNTER_SIZE_16BIT; - config->clock_prescaler = TC_CLOCK_PRESCALER_DIV1; - config->wave_generation = TC_WAVE_GENERATION_NORMAL_FREQ; - config->reload_action = TC_RELOAD_ACTION_GCLK; - config->run_in_standby = false; -#if (SAML21) || (SAML22) || (SAMC20) || (SAMC21) || (SAMR30) - config->on_demand = false; -#endif - config->waveform_invert_output = TC_WAVEFORM_INVERT_OUTPUT_NONE; - config->enable_capture_on_channel[TC_COMPARE_CAPTURE_CHANNEL_0] = false; - config->enable_capture_on_channel[TC_COMPARE_CAPTURE_CHANNEL_1] = false; -#ifdef FEATURE_TC_IO_CAPTURE - config->enable_capture_on_IO[TC_COMPARE_CAPTURE_CHANNEL_0] = false; - config->enable_capture_on_IO[TC_COMPARE_CAPTURE_CHANNEL_1] = false; -#endif - - config->count_direction = TC_COUNT_DIRECTION_UP; - config->oneshot = false; - - config->pwm_channel[TC_COMPARE_CAPTURE_CHANNEL_0].enabled = false; - config->pwm_channel[TC_COMPARE_CAPTURE_CHANNEL_0].pin_out = 0; - config->pwm_channel[TC_COMPARE_CAPTURE_CHANNEL_0].pin_mux = 0; - - config->pwm_channel[TC_COMPARE_CAPTURE_CHANNEL_1].enabled = false; - config->pwm_channel[TC_COMPARE_CAPTURE_CHANNEL_1].pin_out = 0; - config->pwm_channel[TC_COMPARE_CAPTURE_CHANNEL_1].pin_mux = 0; - - config->counter_16_bit.value = 0x0000; - config->counter_16_bit.compare_capture_channel\ - [TC_COMPARE_CAPTURE_CHANNEL_0] = 0x0000; - config->counter_16_bit.compare_capture_channel\ - [TC_COMPARE_CAPTURE_CHANNEL_1] = 0x0000; -#ifdef FEATURE_TC_DOUBLE_BUFFERED - config->double_buffering_enabled = false; -#endif - -} - -enum status_code tc_init( - struct tc_module *const module_inst, - Tc *const hw, - const struct tc_config *const config); - -/** @} */ - -/** - * \name Event Management - * @{ - */ - -/** - * \brief Enables a TC module event input or output. - * - * Enables one or more input or output events to or from the TC module. - * See \ref tc_events for a list of events this module supports. - * - * \note Events cannot be altered while the module is enabled. - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] events Struct containing flags of events to enable - */ -static inline void tc_enable_events( - struct tc_module *const module_inst, - struct tc_events *const events) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - Assert(events); - - Tc *const tc_module = module_inst->hw; - - uint32_t event_mask = 0; - - if (events->invert_event_input == true) { - event_mask |= TC_EVCTRL_TCINV; - } - - if (events->on_event_perform_action == true) { - event_mask |= TC_EVCTRL_TCEI; - } - - if (events->generate_event_on_overflow == true) { - event_mask |= TC_EVCTRL_OVFEO; - } - - for (uint8_t i = 0; i < NUMBER_OF_COMPARE_CAPTURE_CHANNELS; i++) { - if (events->generate_event_on_compare_channel[i] == true) { - event_mask |= (TC_EVCTRL_MCEO(1) << i); - } - } - - tc_module->COUNT8.EVCTRL.reg |= event_mask | events->event_action; -} - -/** - * \brief Disables a TC module event input or output. - * - * Disables one or more input or output events to or from the TC module. - * See \ref tc_events for a list of events this module supports. - * - * \note Events cannot be altered while the module is enabled. - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] events Struct containing flags of events to disable - */ -static inline void tc_disable_events( - struct tc_module *const module_inst, - struct tc_events *const events) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - Assert(events); - - Tc *const tc_module = module_inst->hw; - - uint32_t event_mask = 0; - - if (events->invert_event_input == true) { - event_mask |= TC_EVCTRL_TCINV; - } - - if (events->on_event_perform_action == true) { - event_mask |= TC_EVCTRL_TCEI; - } - - if (events->generate_event_on_overflow == true) { - event_mask |= TC_EVCTRL_OVFEO; - } - - for (uint8_t i = 0; i < NUMBER_OF_COMPARE_CAPTURE_CHANNELS; i++) { - if (events->generate_event_on_compare_channel[i] == true) { - event_mask |= (TC_EVCTRL_MCEO(1) << i); - } - } - - tc_module->COUNT8.EVCTRL.reg &= ~event_mask; -} - -/** @} */ - -/** - * \name Enable/Disable/Reset - * @{ - */ - -enum status_code tc_reset( - const struct tc_module *const module_inst); - -/** - * \brief Enable the TC module. - * - * Enables a TC module that has been previously initialized. The counter will - * start when the counter is enabled. - * - * \note When the counter is configured to re-trigger on an event, the counter - * will not start until the start function is used. - * - * \param[in] module_inst Pointer to the software module instance struct - */ -static inline void tc_enable( - const struct tc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance */ - TcCount8 *const tc_module = &(module_inst->hw->COUNT8); - - while (tc_is_syncing(module_inst)) { - /* Wait for sync */ - } - - /* Enable TC module */ - tc_module->CTRLA.reg |= TC_CTRLA_ENABLE; -} - -/** - * \brief Disables the TC module. - * - * Disables a TC module and stops the counter. - * - * \param[in] module_inst Pointer to the software module instance struct - */ -static inline void tc_disable( - const struct tc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance */ - TcCount8 *const tc_module = &(module_inst->hw->COUNT8); - - while (tc_is_syncing(module_inst)) { - /* Wait for sync */ - } - - /* Disbale interrupt */ - tc_module->INTENCLR.reg = TC_INTENCLR_MASK; - /* Clear interrupt flag */ - tc_module->INTFLAG.reg = TC_INTFLAG_MASK; - - /* Disable TC module */ - tc_module->CTRLA.reg &= ~TC_CTRLA_ENABLE; -} - -/** @} */ - -/** - * \name Get/Set Count Value - * @{ - */ - -uint32_t tc_get_count_value( - const struct tc_module *const module_inst); - -enum status_code tc_set_count_value( - const struct tc_module *const module_inst, - const uint32_t count); - -/** @} */ - -/** - * \name Start/Stop Counter - * @{ - */ - -/** - * \brief Stops the counter. - * - * This function will stop the counter. When the counter is stopped - * the value in the count value is set to 0 if the counter was - * counting up, or maximum if the counter was counting - * down when stopped. - * - * \param[in] module_inst Pointer to the software module instance struct - */ -static inline void tc_stop_counter( - const struct tc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance */ - TcCount8 *const tc_module = &(module_inst->hw->COUNT8); - - while (tc_is_syncing(module_inst)) { - /* Wait for sync */ - } - - /* Write command to execute */ - tc_module->CTRLBSET.reg = TC_CTRLBSET_CMD(TC_CTRLBSET_CMD_STOP_Val); -} - -/** - * \brief Starts the counter. - * - * Starts or restarts an initialized TC module's counter. - * - * \param[in] module_inst Pointer to the software module instance struct - */ -static inline void tc_start_counter( - const struct tc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance */ - TcCount8 *const tc_module = &(module_inst->hw->COUNT8); - - while (tc_is_syncing(module_inst)) { - /* Wait for sync */ - } - - /* Make certain that there are no conflicting commands in the register */ - tc_module->CTRLBCLR.reg = TC_CTRLBCLR_CMD_NONE; - - while (tc_is_syncing(module_inst)) { - /* Wait for sync */ - } - - /* Write command to execute */ - tc_module->CTRLBSET.reg = TC_CTRLBSET_CMD(TC_CTRLBSET_CMD_RETRIGGER_Val); -} - -/** @} */ - -#ifdef FEATURE_TC_DOUBLE_BUFFERED -/** - * \name Double Buffering - * @{ - */ - -/** - * \brief Update double buffer. - * - * Update double buffer. - * - * \param[in] module_inst Pointer to the software module instance struct - */ -static inline void tc_update_double_buffer( - const struct tc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance */ - TcCount8 *const tc_module = &(module_inst->hw->COUNT8); - - while (tc_is_syncing(module_inst)) { - /* Wait for sync */ - } - - /* Make certain that there are no conflicting commands in the register */ - tc_module->CTRLBCLR.reg = TC_CTRLBCLR_CMD_NONE; - - while (tc_is_syncing(module_inst)) { - /* Wait for sync */ - } - - /* Write command to execute */ - tc_module->CTRLBSET.reg = TC_CTRLBSET_CMD(TC_CTRLBSET_CMD_UPDATE_Val); -} -/** @} */ -#endif - -#ifdef FEATURE_TC_READ_SYNC -/** - * \name Count Read Synchronization - * @{ - */ - -/** - * \brief Read synchronization of COUNT. - * - * Read synchronization of COUNT. - * - * \param[in] module_inst Pointer to the software module instance struct - */ -static inline void tc_sync_read_count( - const struct tc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance */ - TcCount8 *const tc_module = &(module_inst->hw->COUNT8); - - while (tc_is_syncing(module_inst)) { - /* Wait for sync */ - } - - /* Make certain that there are no conflicting commands in the register */ - tc_module->CTRLBCLR.reg = TC_CTRLBCLR_CMD_NONE; - - while (tc_is_syncing(module_inst)) { - /* Wait for sync */ - } - - /* Write command to execute */ - tc_module->CTRLBSET.reg = TC_CTRLBSET_CMD(TC_CTRLBSET_CMD_READSYNC_Val); -} -/** @} */ -#endif - -#ifdef FEATURE_TC_GENERATE_DMA_TRIGGER -/** - * \name Generate TC DMA Triggers Command - * @{ - */ - -/** - * \brief TC DMA Trigger. - * - * TC DMA trigger command. - * - * \param[in] module_inst Pointer to the software module instance struct - */ -static inline void tc_dma_trigger_command( - const struct tc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance */ - TcCount8 *const tc_module = &(module_inst->hw->COUNT8); - - while (tc_is_syncing(module_inst)) { - /* Wait for sync */ - } - - /* Make certain that there are no conflicting commands in the register */ - tc_module->CTRLBCLR.reg = TC_CTRLBCLR_CMD_NONE; - - while (tc_is_syncing(module_inst)) { - /* Wait for sync */ - } - -#if (SAMC20) || (SAMC21) || (SAML22) || (SAML21XXXB) || (SAMR30) - /* Write command to execute */ - tc_module->CTRLBSET.reg = TC_CTRLBSET_CMD(TC_CTRLBSET_CMD_DMAOS_Val); -#endif -} -/** @} */ -#endif - -/** - * \name Get Capture Set Compare - * @{ - */ - -uint32_t tc_get_capture_value( - const struct tc_module *const module_inst, - const enum tc_compare_capture_channel channel_index); - -enum status_code tc_set_compare_value( - const struct tc_module *const module_inst, - const enum tc_compare_capture_channel channel_index, - const uint32_t compare_value); - -/** @} */ - -/** - * \name Set Top Value - * @{ - */ - -enum status_code tc_set_top_value( - const struct tc_module *const module_inst, - const uint32_t top_value); - -/** @} */ - -/** - * \name Status Management - * @{ - */ - -/** - * \brief Retrieves the current module status. - * - * Retrieves the status of the module, giving overall state information. - * - * \param[in] module_inst Pointer to the TC software instance struct - * - * \return Bitmask of \c TC_STATUS_* flags. - * - * \retval TC_STATUS_CHANNEL_0_MATCH Timer channel 0 compare/capture match - * \retval TC_STATUS_CHANNEL_1_MATCH Timer channel 1 compare/capture match - * \retval TC_STATUS_SYNC_READY Timer read synchronization has completed - * \retval TC_STATUS_CAPTURE_OVERFLOW Timer capture data has overflowed - * \retval TC_STATUS_COUNT_OVERFLOW Timer count value has overflowed - * \retval TC_STATUS_CHN0_BUFFER_VALID Timer count channel 0 compare/capture buffer valid - * \retval TC_STATUS_CHN1_BUFFER_VALID Timer count channel 1 compare/capture buffer valid - * \retval TC_STATUS_PERIOD_BUFFER_VALID Timer count period buffer valid - */ -static inline uint32_t tc_get_status( - struct tc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance */ - TcCount8 *const tc_module = &(module_inst->hw->COUNT8); - - uint32_t int_flags = tc_module->INTFLAG.reg; - - uint32_t status_flags = 0; - - /* Check for TC channel 0 match */ - if (int_flags & TC_INTFLAG_MC(1)) { - status_flags |= TC_STATUS_CHANNEL_0_MATCH; - } - - /* Check for TC channel 1 match */ - if (int_flags & TC_INTFLAG_MC(2)) { - status_flags |= TC_STATUS_CHANNEL_1_MATCH; - } - -#if !defined(FEATURE_TC_SYNCBUSY_SCHEME_VERSION_2) - /* Check for TC read synchronization ready */ - if (int_flags & TC_INTFLAG_SYNCRDY) { - status_flags |= TC_STATUS_SYNC_READY; - } -#endif - - /* Check for TC capture overflow */ - if (int_flags & TC_INTFLAG_ERR) { - status_flags |= TC_STATUS_CAPTURE_OVERFLOW; - } - - /* Check for TC count overflow */ - if (int_flags & TC_INTFLAG_OVF) { - status_flags |= TC_STATUS_COUNT_OVERFLOW; - } -#ifdef FEATURE_TC_DOUBLE_BUFFERED - uint8_t double_buffer_valid_status = tc_module->STATUS.reg; - - /* Check channel 0 compare or capture buffer valid */ - if (double_buffer_valid_status & TC_STATUS_CCBUFV0) { - status_flags |= TC_STATUS_CHN0_BUFFER_VALID; - } - /* Check channel 0 compare or capture buffer valid */ - if (double_buffer_valid_status & TC_STATUS_CCBUFV1) { - status_flags |= TC_STATUS_CHN1_BUFFER_VALID; - } - /* Check period buffer valid */ - if (double_buffer_valid_status & TC_STATUS_PERBUFV) { - status_flags |= TC_STATUS_PERIOD_BUFFER_VALID; - } -#endif - - return status_flags; -} - -/** - * \brief Clears a module status flag. - * - * Clears the given status flag of the module. - * - * \param[in] module_inst Pointer to the TC software instance struct - * \param[in] status_flags Bitmask of \c TC_STATUS_* flags to clear - */ -static inline void tc_clear_status( - struct tc_module *const module_inst, - const uint32_t status_flags) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance */ - TcCount8 *const tc_module = &(module_inst->hw->COUNT8); - - uint32_t int_flags = 0; - - /* Check for TC channel 0 match */ - if (status_flags & TC_STATUS_CHANNEL_0_MATCH) { - int_flags |= TC_INTFLAG_MC(1); - } - - /* Check for TC channel 1 match */ - if (status_flags & TC_STATUS_CHANNEL_1_MATCH) { - int_flags |= TC_INTFLAG_MC(2); - } - -#if !defined(FEATURE_TC_SYNCBUSY_SCHEME_VERSION_2) - /* Check for TC read synchronization ready */ - if (status_flags & TC_STATUS_SYNC_READY) { - int_flags |= TC_INTFLAG_SYNCRDY; - } -#endif - - /* Check for TC capture overflow */ - if (status_flags & TC_STATUS_CAPTURE_OVERFLOW) { - int_flags |= TC_INTFLAG_ERR; - } - - /* Check for TC count overflow */ - if (status_flags & TC_STATUS_COUNT_OVERFLOW) { - int_flags |= TC_INTFLAG_OVF; - } - - /* Clear interrupt flag */ - tc_module->INTFLAG.reg = int_flags; -} - -/** @} */ - -/** @} */ - -#ifdef __cplusplus -} -#endif - -/** - * \page asfdoc_sam0_tc_extra Extra Information for TC Driver - * - * \section asfdoc_sam0_tc_extra_acronyms Acronyms - * The table below presents the acronyms used in this module: - * - * <table> - * <tr> - * <th>Acronym</th> - * <th>Description</th> - * </tr> - * <tr> - * <td>DMA</td> - * <td>Direct Memory Access</td> - * </tr> - * <tr> - * <td>TC</td> - * <td>Timer Counter</td> - * </tr> - * <tr> - * <td>PWM</td> - * <td>Pulse Width Modulation</td> - * </tr> - * <tr> - * <td>PWP</td> - * <td>Pulse Width Period</td> - * </tr> - * <tr> - * <td>PPW</td> - * <td>Period Pulse Width</td> - * </tr> - * </table> - * - * - * \section asfdoc_sam0_tc_extra_dependencies Dependencies - * This driver has the following dependencies: - * - * - \ref asfdoc_sam0_system_pinmux_group "System Pin Multiplexer Driver" - * - * - * \section asfdoc_sam0_tc_extra_errata Errata - * There are no errata related to this driver. - * - * - * \section asfdoc_sam0_tc_extra_history Module History - * An overview of the module history is presented in the table below, with - * details on the enhancements and fixes made to the module since its first - * release. The current version of this corresponds to the newest version in - * the table. - * - * <table> - * <tr> - * <th>Changelog</th> - * </tr> - * <tr> - * <td>Added support for SAM D21 and do some modifications as below: - * \li Clean up in the configuration structure, the counter size - * setting specific registers is accessed through the counter_8_bit, - * counter_16_bit, and counter_32_bit structures - * \li All event related settings moved into the tc_event structure </td> - * </tr> - * <tr> - * <td>Added automatic digital clock interface enable for the slave TC - * module when a timer is initialized in 32-bit mode</td> - * </tr> - * <tr> - * <td>Initial release</td> - * </tr> - * </table> - */ - -/** - * \page asfdoc_sam0_tc_exqsg Examples for TC Driver - * - * This is a list of the available Quick Start guides (QSGs) and example - * applications for \ref asfdoc_sam0_tc_group. QSGs are simple examples with - * step-by-step instructions to configure and use this driver in a selection of - * use cases. Note that QSGs can be compiled as a standalone application or be - * added to the user application. - * - * - \subpage asfdoc_sam0_tc_basic_use_case - * - \subpage asfdoc_sam0_tc_macth_freq_use_case - * \if TC_CALLBACK_MODE - * - \subpage asfdoc_sam0_tc_timer_use_case - * - \subpage asfdoc_sam0_tc_callback_use_case - * \endif - * - \subpage asfdoc_sam0_tc_dma_use_case - * - * \page asfdoc_sam0_tc_document_revision_history Document Revision History - * - * <table> - * <tr> - * <th>Doc. Rev.</td> - * <th>Date</td> - * <th>Comments</td> - * </tr> - * <tr> - * <td>42123E</td> - * <td>12/2015</td> - * <td>Added support for SAM L21/L22, SAM DA1, SAM D09, and SAM C21</td> - * </tr> - * <tr> - * <td>42123D</td> - * <td>12/2014</td> - * <td>Added timer use case. - * Added support for SAM R21 and SAM D10/D11</td> - * </tr> - * <tr> - * <td>42123C</td> - * <td>01/2014</td> - * <td>Added support for SAM D21</td> - * </tr> - * <tr> - * <td>42123B</td> - * <td>06/2013</td> - * <td>Corrected documentation typos</td> - * </tr> - * <tr> - * <td>42123A</td> - * <td>06/2013</td> - * <td>Initial document release</td> - * </tr> - * </table> - */ - -#endif /* TC_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/tc/tc_interrupt.c b/atmel-samd/asf/sam0/drivers/tc/tc_interrupt.c deleted file mode 100644 index 3a5cf7e45..000000000 --- a/atmel-samd/asf/sam0/drivers/tc/tc_interrupt.c +++ /dev/null @@ -1,199 +0,0 @@ -/** - * \file - * - * \brief SAM TC - Timer Counter Callback Driver - * - * Copyright (C) 2013-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ - -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#include "tc_interrupt.h" - -void *_tc_instances[TC_INST_NUM]; - -void _tc_interrupt_handler(uint8_t instance); - -/** - * \brief Registers a callback. - * - * Registers a callback function which is implemented by the user. - * - * \note The callback must be enabled by \ref tc_enable_callback, - * in order for the interrupt handler to call it when the conditions for the - * callback type is met. - * - * \param[in] module Pointer to TC software instance struct - * \param[in] callback_func Pointer to callback function - * \param[in] callback_type Callback type given by an enum - */ -enum status_code tc_register_callback( - struct tc_module *const module, - tc_callback_t callback_func, - const enum tc_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module); - Assert(callback_func); - - /* Register callback function */ - module->callback[callback_type] = callback_func; - - /* Set the bit corresponding to the callback_type */ - if (callback_type == TC_CALLBACK_CC_CHANNEL0) { - module->register_callback_mask |= TC_INTFLAG_MC(1); - } - else if (callback_type == TC_CALLBACK_CC_CHANNEL1) { - module->register_callback_mask |= TC_INTFLAG_MC(2); - } - else { - module->register_callback_mask |= (1 << callback_type); - } - return STATUS_OK; -} - -/** - * \brief Unregisters a callback. - * - * Unregisters a callback function implemented by the user. The callback should be - * disabled before it is unregistered. - * - * \param[in] module Pointer to TC software instance struct - * \param[in] callback_type Callback type given by an enum - */ -enum status_code tc_unregister_callback( - struct tc_module *const module, - const enum tc_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module); - - /* Unregister callback function */ - module->callback[callback_type] = NULL; - - /* Clear the bit corresponding to the callback_type */ - if (callback_type == TC_CALLBACK_CC_CHANNEL0) { - module->register_callback_mask &= ~TC_INTFLAG_MC(1); - } - else if (callback_type == TC_CALLBACK_CC_CHANNEL1) { - module->register_callback_mask &= ~TC_INTFLAG_MC(2); - } - else { - module->register_callback_mask &= ~(1 << callback_type); - } - return STATUS_OK; -} - -/** - * \internal ISR handler for TC - * - * Auto-generate a set of interrupt handlers for each TC in the device. - */ -#define _TC_INTERRUPT_HANDLER(n, m) \ - void TC##n##_Handler(void) \ - { \ - _tc_interrupt_handler(m); \ - } - -#if (SAML21E) || (SAML21G) || (SAMR30E) || (SAMR30G) - _TC_INTERRUPT_HANDLER(0,0) - _TC_INTERRUPT_HANDLER(1,1) - _TC_INTERRUPT_HANDLER(4,2) -#else - MRECURSION(TC_INST_NUM, _TC_INTERRUPT_HANDLER, TC_INST_MAX_ID) -#endif - - -/** - * \internal Interrupt Handler for TC module - * - * Handles interrupts as they occur, it will run the callback functions - * that are registered and enabled. - * - * \param[in] instance ID of the TC instance calling the interrupt - * handler - */ -void _tc_interrupt_handler( - uint8_t instance) -{ - /* Temporary variable */ - uint8_t interrupt_and_callback_status_mask; - - /* Get device instance from the look-up table */ - struct tc_module *module - = (struct tc_module *)_tc_instances[instance]; - - /* Read and mask interrupt flag register */ - interrupt_and_callback_status_mask = module->hw->COUNT8.INTFLAG.reg & - module->register_callback_mask & - module->enable_callback_mask; - - /* Check if an Overflow interrupt has occurred */ - if (interrupt_and_callback_status_mask & TC_INTFLAG_OVF) { - /* Invoke registered and enabled callback function */ - (module->callback[TC_CALLBACK_OVERFLOW])(module); - /* Clear interrupt flag */ - module->hw->COUNT8.INTFLAG.reg = TC_INTFLAG_OVF; - } - - /* Check if an Error interrupt has occurred */ - if (interrupt_and_callback_status_mask & TC_INTFLAG_ERR) { - /* Invoke registered and enabled callback function */ - (module->callback[TC_CALLBACK_ERROR])(module); - /* Clear interrupt flag */ - module->hw->COUNT8.INTFLAG.reg = TC_INTFLAG_ERR; - } - - /* Check if an Match/Capture Channel 0 interrupt has occurred */ - if (interrupt_and_callback_status_mask & TC_INTFLAG_MC(1)) { - /* Invoke registered and enabled callback function */ - (module->callback[TC_CALLBACK_CC_CHANNEL0])(module); - /* Clear interrupt flag */ - module->hw->COUNT8.INTFLAG.reg = TC_INTFLAG_MC(1); - } - - /* Check if an Match/Capture Channel 1 interrupt has occurred */ - if (interrupt_and_callback_status_mask & TC_INTFLAG_MC(2)) { - /* Invoke registered and enabled callback function */ - (module->callback[TC_CALLBACK_CC_CHANNEL1])(module); - /* Clear interrupt flag */ - module->hw->COUNT8.INTFLAG.reg = TC_INTFLAG_MC(2); - } -} diff --git a/atmel-samd/asf/sam0/drivers/tc/tc_interrupt.h b/atmel-samd/asf/sam0/drivers/tc/tc_interrupt.h deleted file mode 100644 index 56c7264ad..000000000 --- a/atmel-samd/asf/sam0/drivers/tc/tc_interrupt.h +++ /dev/null @@ -1,179 +0,0 @@ -/** - * \file - * - * \brief SAM TC - Timer Counter Callback Driver - * - * Copyright (C) 2013-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ - -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef TC_INTERRUPT_H_INCLUDED -#define TC_INTERRUPT_H_INCLUDED - -#include "tc.h" -#include <system_interrupt.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(__DOXYGEN__) -extern void *_tc_instances[TC_INST_NUM]; - -# define _TC_INTERRUPT_VECT_NUM(n, unused) \ - SYSTEM_INTERRUPT_MODULE_TC##n, -/** - * \internal Get the interrupt vector for the given device instance - * - * \param[in] TC module instance number - * - * \return Interrupt vector for of the given TC module instance. - */ -static enum system_interrupt_vector _tc_interrupt_get_interrupt_vector( - uint32_t inst_num) -{ - static uint8_t tc_interrupt_vectors[TC_INST_NUM] = - { -#if (SAML21E) || (SAML21G) || (SAMR30E) || (SAMR30G) - SYSTEM_INTERRUPT_MODULE_TC0, - SYSTEM_INTERRUPT_MODULE_TC1, - SYSTEM_INTERRUPT_MODULE_TC4 -#else - MRECURSION(TC_INST_NUM, _TC_INTERRUPT_VECT_NUM, TC_INST_MAX_ID) -#endif - }; - - return (enum system_interrupt_vector)tc_interrupt_vectors[inst_num]; -} -#endif /* !defined(__DOXYGEN__) */ - -/** - * \name Callback Management - * {@ - */ - -enum status_code tc_register_callback( - struct tc_module *const module, - tc_callback_t callback_func, - const enum tc_callback callback_type); - -enum status_code tc_unregister_callback( - struct tc_module *const module, - const enum tc_callback callback_type); - -/** - * \brief Enables callback. - * - * Enables the callback function registered by the \ref - * tc_register_callback. The callback function will be called from the - * interrupt handler when the conditions for the callback type are - * met. This function will also enable the appropriate interrupts. - * - * \param[in] module Pointer to TC software instance struct - * \param[in] callback_type Callback type given by an enum - */ -static inline void tc_enable_callback( - struct tc_module *const module, - const enum tc_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module); - - - /* Enable interrupts for this TC module */ - system_interrupt_enable(_tc_interrupt_get_interrupt_vector(_tc_get_inst_index(module->hw))); - - /* Enable callback */ - if (callback_type == TC_CALLBACK_CC_CHANNEL0) { - module->enable_callback_mask |= TC_INTFLAG_MC(1); - module->hw->COUNT8.INTENSET.reg = TC_INTFLAG_MC(1); - } - else if (callback_type == TC_CALLBACK_CC_CHANNEL1) { - module->enable_callback_mask |= TC_INTFLAG_MC(2); - module->hw->COUNT8.INTENSET.reg = TC_INTFLAG_MC(2); - } - else { - module->enable_callback_mask |= (1 << callback_type); - module->hw->COUNT8.INTENSET.reg = (1 << callback_type); - } -} - -/** - * \brief Disables callback. - * - * Disables the callback function registered by the \ref - * tc_register_callback, and the callback will not be called from the - * interrupt routine. The function will also disable the appropriate - * interrupts. - * - * \param[in] module Pointer to TC software instance struct - * \param[in] callback_type Callback type given by an enum - */ -static inline void tc_disable_callback( - struct tc_module *const module, - const enum tc_callback callback_type){ - /* Sanity check arguments */ - Assert(module); - - /* Disable callback */ - if (callback_type == TC_CALLBACK_CC_CHANNEL0) { - module->hw->COUNT8.INTENCLR.reg = TC_INTFLAG_MC(1); - module->enable_callback_mask &= ~TC_INTFLAG_MC(1); - } - else if (callback_type == TC_CALLBACK_CC_CHANNEL1) { - module->hw->COUNT8.INTENCLR.reg = TC_INTFLAG_MC(2); - module->enable_callback_mask &= ~TC_INTFLAG_MC(2); - } - else { - module->hw->COUNT8.INTENCLR.reg = (1 << callback_type); - module->enable_callback_mask &= ~(1 << callback_type); - } -} - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /* TC_INTERRUPT_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/tc/tc_sam_d_r/tc.c b/atmel-samd/asf/sam0/drivers/tc/tc_sam_d_r/tc.c deleted file mode 100644 index 3d4a428b7..000000000 --- a/atmel-samd/asf/sam0/drivers/tc/tc_sam_d_r/tc.c +++ /dev/null @@ -1,685 +0,0 @@ -/** - * \file - * - * \brief SAM TC - Timer Counter Driver - * - * Copyright (C) 2013-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#include "tc.h" - -#if TC_ASYNC == true -# include "tc_interrupt.h" -# include <system_interrupt.h> - -/** \internal - * Converts a given TC index to its interrupt vector index. - */ -# define _TC_INTERRUPT_VECT_NUM(n, unused) \ - SYSTEM_INTERRUPT_MODULE_TC##n, -#endif - -#if !defined(__DOXYGEN__) -# define _TC_GCLK_ID(n,unused) TPASTE3(TC,n,_GCLK_ID) , -# define _TC_PM_APBCMASK(n,unused) TPASTE2(PM_APBCMASK_TC,n) , - -# define TC_INST_GCLK_ID { MRECURSION(TC_INST_NUM, _TC_GCLK_ID, TC_INST_MAX_ID) } -# define TC_INST_PM_APBCMASK { MRECURSION(TC_INST_NUM, _TC_PM_APBCMASK, TC_INST_MAX_ID) } - -#endif - -/** - * \internal Find the index of given TC module instance. - * - * \param[in] TC module instance pointer - * - * \return Index of the given TC module instance. - */ -uint8_t _tc_get_inst_index( - Tc *const hw) -{ - /* List of available TC modules. */ - Tc *const tc_modules[TC_INST_NUM] = TC_INSTS; - - /* Find index for TC instance. */ - for (uint32_t i = 0; i < TC_INST_NUM; i++) { - if (hw == tc_modules[i]) { - return i; - } - } - - /* Invalid data given. */ - Assert(false); - return 0; -} - - -/** - * \brief Initializes a hardware TC module instance. - * - * Enables the clock and initializes the TC module, based on the given - * configuration values. - * - * \param[in,out] module_inst Pointer to the software module instance struct - * \param[in] hw Pointer to the TC hardware module - * \param[in] config Pointer to the TC configuration options struct - * - * \return Status of the initialization procedure. - * - * \retval STATUS_OK The module was initialized successfully - * \retval STATUS_BUSY Hardware module was busy when the - * initialization procedure was attempted - * \retval STATUS_INVALID_ARG An invalid configuration option or argument - * was supplied - * \retval STATUS_ERR_DENIED Hardware module was already enabled, or the - * hardware module is configured in 32-bit - * slave mode - */ -enum status_code tc_init( - struct tc_module *const module_inst, - Tc *const hw, - const struct tc_config *const config) -{ - /* Sanity check arguments */ - Assert(hw); - Assert(module_inst); - Assert(config); - - /* Temporary variable to hold all updates to the CTRLA - * register before they are written to it */ - uint16_t ctrla_tmp = 0; - /* Temporary variable to hold all updates to the CTRLBSET - * register before they are written to it */ - uint8_t ctrlbset_tmp = 0; - /* Temporary variable to hold all updates to the CTRLC - * register before they are written to it */ - uint8_t ctrlc_tmp = 0; - /* Temporary variable to hold TC instance number */ - uint8_t instance = _tc_get_inst_index(hw); - - /* Array of GLCK ID for different TC instances */ - uint8_t inst_gclk_id[] = TC_INST_GCLK_ID; - /* Array of PM APBC mask bit position for different TC instances */ - uint16_t inst_pm_apbmask[] = TC_INST_PM_APBCMASK; - - //struct system_pinmux_config pin_config; - struct system_gclk_chan_config gclk_chan_config; - -#if TC_ASYNC == true - /* Initialize parameters */ - for (uint8_t i = 0; i < TC_CALLBACK_N; i++) { - module_inst->callback[i] = NULL; - } - module_inst->register_callback_mask = 0x00; - module_inst->enable_callback_mask = 0x00; - - /* Register this instance for callbacks*/ - _tc_instances[instance] = module_inst; -#endif - - /* Associate the given device instance with the hardware module */ - module_inst->hw = hw; - -#if SAMD09 || SAMD10 || SAMD11 - /* Check if even numbered TC modules are being configured in 32-bit - * counter size. Only odd numbered counters are allowed to be - * configured in 32-bit counter size. - */ - if ((config->counter_size == TC_COUNTER_SIZE_32BIT) && - !((instance + TC_INSTANCE_OFFSET) & 0x01)) { - Assert(false); - return STATUS_ERR_INVALID_ARG; - } -#else - // /* Check if odd numbered TC modules are being configured in 32-bit - // * counter size. Only even numbered counters are allowed to be - // * configured in 32-bit counter size. - // */ - // if ((config->counter_size == TC_COUNTER_SIZE_32BIT) && - // ((instance + TC_INSTANCE_OFFSET) & 0x01)) { - // Assert(false); - // return STATUS_ERR_INVALID_ARG; - // } -#endif - - /* Make the counter size variable in the module_inst struct reflect - * the counter size in the module - */ - module_inst->counter_size = config->counter_size; - - if (hw->COUNT8.CTRLA.reg & TC_CTRLA_SWRST) { - /* We are in the middle of a reset. Abort. */ - return STATUS_BUSY; - } - - if (hw->COUNT8.STATUS.reg & TC_STATUS_SLAVE) { - /* Module is used as a slave */ - return STATUS_ERR_DENIED; - } - - if (hw->COUNT8.CTRLA.reg & TC_CTRLA_ENABLE) { - /* Module must be disabled before initialization. Abort. */ - return STATUS_ERR_DENIED; - } - - // /* Set up the TC PWM out pin for channel 0 */ - // if (config->pwm_channel[0].enabled) { - // system_pinmux_get_config_defaults(&pin_config); - // pin_config.mux_position = config->pwm_channel[0].pin_mux; - // pin_config.direction = SYSTEM_PINMUX_PIN_DIR_OUTPUT; - // system_pinmux_pin_set_config( - // config->pwm_channel[0].pin_out, &pin_config); - // } - // - // /* Set up the TC PWM out pin for channel 1 */ - // if (config->pwm_channel[1].enabled) { - // system_pinmux_get_config_defaults(&pin_config); - // pin_config.mux_position = config->pwm_channel[1].pin_mux; - // pin_config.direction = SYSTEM_PINMUX_PIN_DIR_OUTPUT; - // system_pinmux_pin_set_config( - // config->pwm_channel[1].pin_out, &pin_config); - // } - - /* Enable the user interface clock in the PM */ - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBC, - inst_pm_apbmask[instance]); - - // /* Enable the slave counter if counter_size is 32-bit */ - // if ((config->counter_size == TC_COUNTER_SIZE_32BIT)) - // { - // /* Enable the user interface clock in the PM */ - // system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBC, - // inst_pm_apbmask[instance + 1]); - // } - - /* Setup clock for module */ - system_gclk_chan_get_config_defaults(&gclk_chan_config); - gclk_chan_config.source_generator = config->clock_source; - system_gclk_chan_set_config(inst_gclk_id[instance], &gclk_chan_config); - system_gclk_chan_enable(inst_gclk_id[instance]); - - /* Set ctrla register */ - ctrla_tmp = - (uint32_t)config->counter_size | - (uint32_t)config->wave_generation | - (uint32_t)config->reload_action | - (uint32_t)config->clock_prescaler; - - if (config->run_in_standby) { - ctrla_tmp |= TC_CTRLA_RUNSTDBY; - } - - /* Write configuration to register */ - while (tc_is_syncing(module_inst)) { - /* Wait for sync */ - } - hw->COUNT8.CTRLA.reg = ctrla_tmp; - - /* Set ctrlb register */ - if (config->oneshot) { - ctrlbset_tmp = TC_CTRLBSET_ONESHOT; - } - - if (config->count_direction) { - ctrlbset_tmp |= TC_CTRLBSET_DIR; - } - - /* Clear old ctrlb configuration */ - while (tc_is_syncing(module_inst)) { - /* Wait for sync */ - } - hw->COUNT8.CTRLBCLR.reg = 0xFF; - - /* Check if we actually need to go into a wait state. */ - if (ctrlbset_tmp) { - while (tc_is_syncing(module_inst)) { - /* Wait for sync */ - } - /* Write configuration to register */ - hw->COUNT8.CTRLBSET.reg = ctrlbset_tmp; - } - - /* Set ctrlc register*/ - ctrlc_tmp = config->waveform_invert_output; - for (uint8_t i = 0; i < NUMBER_OF_COMPARE_CAPTURE_CHANNELS; i++) { - if (config->enable_capture_on_channel[i] == true) { - ctrlc_tmp |= (TC_CTRLC_CPTEN(1) << i); - } - } - - /* Write configuration to register */ - while (tc_is_syncing(module_inst)) { - /* Wait for sync */ - } - hw->COUNT8.CTRLC.reg = ctrlc_tmp; - - /* Write configuration to register */ - while (tc_is_syncing(module_inst)) { - /* Wait for sync */ - } - - /* Switch for TC counter size */ - switch (module_inst->counter_size) { - case TC_COUNTER_SIZE_8BIT: - // while (tc_is_syncing(module_inst)) { - // /* Wait for sync */ - // } - // - // hw->COUNT8.COUNT.reg = - // config->counter_8_bit.value; - // - // - // while (tc_is_syncing(module_inst)) { - // /* Wait for sync */ - // } - // - // hw->COUNT8.PER.reg = - // config->counter_8_bit.period; - // - // while (tc_is_syncing(module_inst)) { - // /* Wait for sync */ - // } - // - // hw->COUNT8.CC[0].reg = - // config->counter_8_bit.compare_capture_channel[0]; - // - // while (tc_is_syncing(module_inst)) { - // /* Wait for sync */ - // } - // - // hw->COUNT8.CC[1].reg = - // config->counter_8_bit.compare_capture_channel[1]; - - return STATUS_OK; - - case TC_COUNTER_SIZE_16BIT: - while (tc_is_syncing(module_inst)) { - /* Wait for sync */ - } - - hw->COUNT16.COUNT.reg - = config->counter_16_bit.value; - - while (tc_is_syncing(module_inst)) { - /* Wait for sync */ - } - - hw->COUNT16.CC[0].reg = - config->counter_16_bit.compare_capture_channel[0]; - - while (tc_is_syncing(module_inst)) { - /* Wait for sync */ - } - - hw->COUNT16.CC[1].reg = - config->counter_16_bit.compare_capture_channel[1]; - - return STATUS_OK; - - case TC_COUNTER_SIZE_32BIT: - // while (tc_is_syncing(module_inst)) { - // /* Wait for sync */ - // } - // - // hw->COUNT32.COUNT.reg - // = config->counter_32_bit.value; - // - // while (tc_is_syncing(module_inst)) { - // /* Wait for sync */ - // } - // - // hw->COUNT32.CC[0].reg = - // config->counter_32_bit.compare_capture_channel[0]; - // - // while (tc_is_syncing(module_inst)) { - // /* Wait for sync */ - // } - // - // hw->COUNT32.CC[1].reg = - // config->counter_32_bit.compare_capture_channel[1]; - - return STATUS_OK; - } - - Assert(false); - return STATUS_ERR_INVALID_ARG; -} - -/** - * \brief Sets TC module count value. - * - * Sets the current timer count value of a initialized TC module. The - * specified TC module may be started or stopped. - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] count New timer count value to set - * - * \return Status of the count update procedure. - * - * \retval STATUS_OK The timer count was updated successfully - * \retval STATUS_ERR_INVALID_ARG An invalid timer counter size was specified - */ -enum status_code tc_set_count_value( - const struct tc_module *const module_inst, - const uint32_t count) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance*/ - Tc *const tc_module = module_inst->hw; - - while (tc_is_syncing(module_inst)) { - /* Wait for sync */ - } - - /* Write to based on the TC counter_size */ - switch (module_inst->counter_size) { - case TC_COUNTER_SIZE_8BIT: - tc_module->COUNT8.COUNT.reg = (uint8_t)count; - return STATUS_OK; - - case TC_COUNTER_SIZE_16BIT: - tc_module->COUNT16.COUNT.reg = (uint16_t)count; - return STATUS_OK; - - case TC_COUNTER_SIZE_32BIT: - tc_module->COUNT32.COUNT.reg = (uint32_t)count; - return STATUS_OK; - - default: - return STATUS_ERR_INVALID_ARG; - } -} - -/** - * \brief Get TC module count value. - * - * Retrieves the current count value of a TC module. The specified TC module - * may be started or stopped. - * - * \param[in] module_inst Pointer to the software module instance struct - * - * \return Count value of the specified TC module. - */ -uint32_t tc_get_count_value( - const struct tc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance */ - Tc *const tc_module = module_inst->hw; - - while (tc_is_syncing(module_inst)) { - /* Wait for sync */ - } - - /* Read from based on the TC counter size */ - switch (module_inst->counter_size) { - case TC_COUNTER_SIZE_8BIT: - return (uint32_t)tc_module->COUNT8.COUNT.reg; - - case TC_COUNTER_SIZE_16BIT: - return (uint32_t)tc_module->COUNT16.COUNT.reg; - - case TC_COUNTER_SIZE_32BIT: - return tc_module->COUNT32.COUNT.reg; - } - - Assert(false); - return 0; -} - -/** - * \brief Gets the TC module capture value. - * - * Retrieves the capture value in the indicated TC module capture channel. - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] channel_index Index of the Compare Capture channel to read - * - * \return Capture value stored in the specified timer channel. - */ -uint32_t tc_get_capture_value( - const struct tc_module *const module_inst, - const enum tc_compare_capture_channel channel_index) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance */ - Tc *const tc_module = module_inst->hw; - - while (tc_is_syncing(module_inst)) { - /* Wait for sync */ - } - - /* Read out based on the TC counter size */ - switch (module_inst->counter_size) { - case TC_COUNTER_SIZE_8BIT: - if (channel_index < - NUMBER_OF_COMPARE_CAPTURE_CHANNELS) { - return tc_module->COUNT8.CC[channel_index].reg; - } - - case TC_COUNTER_SIZE_16BIT: - if (channel_index < - NUMBER_OF_COMPARE_CAPTURE_CHANNELS) { - return tc_module->COUNT16.CC[channel_index].reg; - } - - case TC_COUNTER_SIZE_32BIT: - if (channel_index < - NUMBER_OF_COMPARE_CAPTURE_CHANNELS) { - return tc_module->COUNT32.CC[channel_index].reg; - } - } - - Assert(false); - return 0; -} - -/** - * \brief Sets a TC module compare value. - * - * Writes a compare value to the given TC module compare/capture channel. - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] channel_index Index of the compare channel to write to - * \param[in] compare New compare value to set - * - * \return Status of the compare update procedure. - * - * \retval STATUS_OK The compare value was updated successfully - * \retval STATUS_ERR_INVALID_ARG An invalid channel index was supplied - */ -enum status_code tc_set_compare_value( - const struct tc_module *const module_inst, - const enum tc_compare_capture_channel channel_index, - const uint32_t compare) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance */ - Tc *const tc_module = module_inst->hw; - - while (tc_is_syncing(module_inst)) { - /* Wait for sync */ - } - - /* Read out based on the TC counter size */ - switch (module_inst->counter_size) { - case TC_COUNTER_SIZE_8BIT: - if (channel_index < - NUMBER_OF_COMPARE_CAPTURE_CHANNELS) { - tc_module->COUNT8.CC[channel_index].reg = - (uint8_t)compare; - return STATUS_OK; - } - - case TC_COUNTER_SIZE_16BIT: - if (channel_index < - NUMBER_OF_COMPARE_CAPTURE_CHANNELS) { - tc_module->COUNT16.CC[channel_index].reg = - (uint16_t)compare; - return STATUS_OK; - } - - case TC_COUNTER_SIZE_32BIT: - if (channel_index < - NUMBER_OF_COMPARE_CAPTURE_CHANNELS) { - tc_module->COUNT32.CC[channel_index].reg = - (uint32_t)compare; - return STATUS_OK; - } - } - - return STATUS_ERR_INVALID_ARG; -} - -/** - * \brief Resets the TC module. - * - * Resets the TC module, restoring all hardware module registers to their - * default values and disabling the module. The TC module will not be - * accessible while the reset is being performed. - * - * \note When resetting a 32-bit counter only the master TC module's instance - * structure should be passed to the function. - * - * \param[in] module_inst Pointer to the software module instance struct - * - * \return Status of the procedure. - * \retval STATUS_OK The module was reset successfully - * \retval STATUS_ERR_UNSUPPORTED_DEV A 32-bit slave TC module was passed to - * the function. Only use reset on master - * TC - */ -enum status_code tc_reset( - const struct tc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module hardware instance */ - TcCount8 *const tc_module = &(module_inst->hw->COUNT8); - - if (tc_module->STATUS.reg & TC_STATUS_SLAVE) { - return STATUS_ERR_UNSUPPORTED_DEV; - } - - /* Disable this module if it is running */ - if (tc_module->CTRLA.reg & TC_CTRLA_ENABLE) { - tc_disable(module_inst); - while (tc_is_syncing(module_inst)) { - /* wait while module is disabling */ - } - } - - /* Reset this TC module */ - tc_module->CTRLA.reg |= TC_CTRLA_SWRST; - - return STATUS_OK; -} - -/** - * \brief Set the timer TOP/period value. - * - * For 8-bit counter size this function writes the top value to the period - * register. - * - * For 16- and 32-bit counter size this function writes the top value to - * Capture Compare register 0. The value in this register can not be used for - * any other purpose. - * - * \note This function is designed to be used in PWM or frequency - * match modes only, when the counter is set to 16- or 32-bit counter - * size. In 8-bit counter size it will always be possible to change the - * top value even in normal mode. - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] top_value New timer TOP value to set - * - * \return Status of the TOP set procedure. - * - * \retval STATUS_OK The timer TOP value was updated successfully - * \retval STATUS_ERR_INVALID_ARG The configured TC module counter size in the - * module instance is invalid - */ -enum status_code tc_set_top_value ( - const struct tc_module *const module_inst, - const uint32_t top_value) -{ - Assert(module_inst); - Assert(module_inst->hw); - Assert(top_value); - - Tc *const tc_module = module_inst->hw; - - while (tc_is_syncing(module_inst)) { - /* Wait for sync */ - } - - switch (module_inst->counter_size) { - case TC_COUNTER_SIZE_8BIT: - tc_module->COUNT8.PER.reg = (uint8_t)top_value; - return STATUS_OK; - - case TC_COUNTER_SIZE_16BIT: - tc_module->COUNT16.CC[0].reg = (uint16_t)top_value; - return STATUS_OK; - - case TC_COUNTER_SIZE_32BIT: - tc_module->COUNT32.CC[0].reg = (uint32_t)top_value; - return STATUS_OK; - - default: - Assert(false); - return STATUS_ERR_INVALID_ARG; - } -} diff --git a/atmel-samd/asf/sam0/drivers/tcc/docimg/overview.svg b/atmel-samd/asf/sam0/drivers/tcc/docimg/overview.svg deleted file mode 100644 index b3d7ef0b3..000000000 --- a/atmel-samd/asf/sam0/drivers/tcc/docimg/overview.svg +++ /dev/null @@ -1,2278 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> - -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - version="1.2" - width="1015.2" - height="638.09998" - id="svg16945"> - <title - id="title22270">TCC_Block</title> - <defs - id="defs16947" /> - <metadata - id="metadata16951"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title>TCC_Block</dc:title> - </cc:Work> - </rdf:RDF> - </metadata> - <g - transform="translate(0,-126.9)" - id="layer1"> - <g - transform="matrix(0.6108612,0,0,0.59248808,0.55829414,130.78209)" - id="g20883"> - <path - d="m 2.8883488,2.8883488 0,560.5738512 796.6378212,0 0,-560.5738512 -796.6378212,0 z" - id="path20901" - style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 2.8883488,563.4622 796.6378212,0 0,-560.5738512 -796.6378212,0 0,560.5738512 z" - id="path20903" - style="fill:none;stroke:#000000;stroke-width:0.46838087px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <text - x="7.4940939" - y="26.229328" - id="text20905" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">Base Counter</text> - <path - d="m 47.150342,637.23219 0,383.52591 796.637818,0 0,-383.52591 -796.637818,0 z" - id="path20907" - style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 47.150342,1020.7581 796.637818,0 0,-383.52591 -796.637818,0 0,383.52591 z" - id="path20909" - style="fill:none;stroke:#000000;stroke-width:0.46838087px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 32.396344,651.98619 0,383.52591 796.637816,0 0,-383.52591 -796.637816,0 z" - id="path20911" - style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 32.396344,1035.5121 796.637816,0 0,-383.52591 -796.637816,0 0,383.52591 z" - id="path20913" - style="fill:none;stroke:#000000;stroke-width:0.46838087px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 17.642347,666.74019 0,383.52591 796.637823,0 0,-383.52591 -796.637823,0 z" - id="path20915" - style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 17.642347,1050.2661 796.637823,0 0,-383.52591 -796.637823,0 0,383.52591 z" - id="path20917" - style="fill:none;stroke:#000000;stroke-width:0.46838087px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 2.8883488,681.49419 0,383.52591 796.6378212,0 0,-383.52591 -796.6378212,0 z" - id="path20919" - style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 2.8883488,1065.0201 796.6378212,0 0,-383.52591 -796.6378212,0 0,383.52591 z" - id="path20921" - style="fill:none;stroke:#000000;stroke-width:0.46838087px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <text - x="7.4940939" - y="704.44482" - id="text20923" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">Compare</text> - <text - x="97.423225" - y="704.44482" - id="text20925" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">/</text> - <text - x="102.41929" - y="704.44482" - id="text20927" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">Capture</text> - <text - x="7.4940939" - y="729.42517" - id="text20929" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">(</text> - <text - x="13.739173" - y="729.42517" - id="text20931" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">Unit x </text> - <text - x="77.438972" - y="729.42517" - id="text20933" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">= </text> - <text - x="94.925194" - y="729.42517" - id="text20935" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">{</text> - <text - x="103.6683" - y="729.42517" - id="text20937" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">0</text> - <text - x="114.90944" - y="729.42517" - id="text20939" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">,</text> - <text - x="121.15452" - y="729.42517" - id="text20941" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">1</text> - <text - x="132.39566" - y="729.42517" - id="text20943" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">,</text> - <text - x="138.64075" - y="729.42517" - id="text20945" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">…</text> - <text - x="158.62498" - y="729.42517" - id="text20947" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">,</text> - <text - x="164.87007" - y="729.42517" - id="text20949" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">3</text> - <text - x="176.11121" - y="729.42517" - id="text20951" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">}</text> - <text - x="184.85432" - y="729.42517" - id="text20953" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">)</text> - <path - d="m 61.90434,238.87425 0,118.03198 354.01788,0 0,-118.03198 -354.01788,0 z" - id="path20955" - style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 62.528848,240.12327 0,8.74311 c 0,0.39031 -0.312254,0.6245 -0.624508,0.6245 -0.390317,0 -0.624508,-0.23419 -0.624508,-0.6245 l 0,-8.74311 c 0,-0.31226 0.234191,-0.62451 0.624508,-0.62451 0.312254,0 0.624508,0.31225 0.624508,0.62451 z m 0,14.98818 0,8.74311 c 0,0.39032 -0.312254,0.62451 -0.624508,0.62451 -0.390317,0 -0.624508,-0.23419 -0.624508,-0.62451 l 0,-8.74311 c 0,-0.31225 0.234191,-0.6245 0.624508,-0.6245 0.312254,0 0.624508,0.31225 0.624508,0.6245 z m 0,14.98819 0,8.74311 c 0,0.39032 -0.312254,0.62451 -0.624508,0.62451 -0.390317,0 -0.624508,-0.23419 -0.624508,-0.62451 l 0,-8.74311 c 0,-0.31225 0.234191,-0.62451 0.624508,-0.62451 0.312254,0 0.624508,0.31226 0.624508,0.62451 z m 0,14.98819 0,8.74311 c 0,0.39032 -0.312254,0.62451 -0.624508,0.62451 -0.390317,0 -0.624508,-0.23419 -0.624508,-0.62451 l 0,-8.74311 c 0,-0.31225 0.234191,-0.62451 0.624508,-0.62451 0.312254,0 0.624508,0.31226 0.624508,0.62451 z m 0,14.98819 0,8.74311 c 0,0.39032 -0.312254,0.62451 -0.624508,0.62451 -0.390317,0 -0.624508,-0.23419 -0.624508,-0.62451 l 0,-8.74311 c 0,-0.31225 0.234191,-0.62451 0.624508,-0.62451 0.312254,0 0.624508,0.31226 0.624508,0.62451 z m 0,14.98819 0,8.74311 c 0,0.39031 -0.312254,0.62451 -0.624508,0.62451 -0.390317,0 -0.624508,-0.2342 -0.624508,-0.62451 l 0,-8.74311 c 0,-0.31226 0.234191,-0.62451 0.624508,-0.62451 0.312254,0 0.624508,0.31225 0.624508,0.62451 z m 0,14.98819 0,8.74311 c 0,0.39031 -0.312254,0.6245 -0.624508,0.6245 -0.390317,0 -0.624508,-0.23419 -0.624508,-0.6245 l 0,-8.74311 c 0,-0.31226 0.234191,-0.62451 0.624508,-0.62451 0.312254,0 0.624508,0.31225 0.624508,0.62451 z m 0,14.98818 0,8.74311 c 0,0.39032 -0.312254,0.62451 -0.624508,0.62451 -0.390317,0 -0.624508,-0.23419 -0.624508,-0.62451 l 0,-8.74311 c 0,-0.31225 0.234191,-0.6245 0.624508,-0.6245 0.312254,0 0.624508,0.31225 0.624508,0.6245 z m 2.498031,11.24115 8.74311,0 c 0.312254,0 0.624508,0.31225 0.624508,0.6245 0,0.39032 -0.312254,0.62451 -0.624508,0.62451 l -8.74311,0 c -0.312254,0 -0.624508,-0.23419 -0.624508,-0.62451 0,-0.31225 0.312254,-0.6245 0.624508,-0.6245 z m 14.988189,0 8.743109,0 c 0.312254,0 0.624508,0.31225 0.624508,0.6245 0,0.39032 -0.312254,0.62451 -0.624508,0.62451 l -8.743109,0 c -0.312254,0 -0.624508,-0.23419 -0.624508,-0.62451 0,-0.31225 0.312254,-0.6245 0.624508,-0.6245 z m 14.988188,0 8.743114,0 c 0.31225,0 0.6245,0.31225 0.6245,0.6245 0,0.39032 -0.31225,0.62451 -0.6245,0.62451 l -8.743114,0 c -0.312254,0 -0.624508,-0.23419 -0.624508,-0.62451 0,-0.31225 0.312254,-0.6245 0.624508,-0.6245 z m 14.988184,0 8.74311,0 c 0.31226,0 0.62451,0.31225 0.62451,0.6245 0,0.39032 -0.31225,0.62451 -0.62451,0.62451 l -8.74311,0 c -0.31225,0 -0.6245,-0.23419 -0.6245,-0.62451 0,-0.31225 0.31225,-0.6245 0.6245,-0.6245 z m 14.98819,0 8.74311,0 c 0.31226,0 0.62451,0.31225 0.62451,0.6245 0,0.39032 -0.31225,0.62451 -0.62451,0.62451 l -8.74311,0 c -0.31225,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31226,-0.6245 0.62451,-0.6245 z m 14.98819,0 8.74311,0 c 0.31225,0 0.62451,0.31225 0.62451,0.6245 0,0.39032 -0.31226,0.62451 -0.62451,0.62451 l -8.74311,0 c -0.31225,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31226,-0.6245 0.62451,-0.6245 z m 14.98819,0 8.74311,0 c 0.31225,0 0.62451,0.31225 0.62451,0.6245 0,0.39032 -0.31226,0.62451 -0.62451,0.62451 l -8.74311,0 c -0.31226,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31225,-0.6245 0.62451,-0.6245 z m 14.98819,0 8.74311,0 c 0.31225,0 0.6245,0.31225 0.6245,0.6245 0,0.39032 -0.31225,0.62451 -0.6245,0.62451 l -8.74311,0 c -0.31226,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31225,-0.6245 0.62451,-0.6245 z m 14.98819,0 8.74311,0 c 0.31225,0 0.6245,0.31225 0.6245,0.6245 0,0.39032 -0.31225,0.62451 -0.6245,0.62451 l -8.74311,0 c -0.31226,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31225,-0.6245 0.62451,-0.6245 z m 14.98818,0 8.74311,0 c 0.31226,0 0.62451,0.31225 0.62451,0.6245 0,0.39032 -0.31225,0.62451 -0.62451,0.62451 l -8.74311,0 c -0.31225,0 -0.6245,-0.23419 -0.6245,-0.62451 0,-0.31225 0.31225,-0.6245 0.6245,-0.6245 z m 14.98819,0 8.74311,0 c 0.31226,0 0.62451,0.31225 0.62451,0.6245 0,0.39032 -0.31225,0.62451 -0.62451,0.62451 l -8.74311,0 c -0.31225,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31226,-0.6245 0.62451,-0.6245 z m 14.98819,0 8.74311,0 c 0.31225,0 0.62451,0.31225 0.62451,0.6245 0,0.39032 -0.31226,0.62451 -0.62451,0.62451 l -8.74311,0 c -0.31225,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31226,-0.6245 0.62451,-0.6245 z m 14.98819,0 8.74311,0 c 0.31225,0 0.62451,0.31225 0.62451,0.6245 0,0.39032 -0.31226,0.62451 -0.62451,0.62451 l -8.74311,0 c -0.31226,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31225,-0.6245 0.62451,-0.6245 z m 14.98819,0 8.74311,0 c 0.31225,0 0.6245,0.31225 0.6245,0.6245 0,0.39032 -0.31225,0.62451 -0.6245,0.62451 l -8.74311,0 c -0.31226,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31225,-0.6245 0.62451,-0.6245 z m 14.98819,0 8.7431,0 c 0.31226,0 0.62451,0.31225 0.62451,0.6245 0,0.39032 -0.31225,0.62451 -0.62451,0.62451 l -8.7431,0 c -0.31226,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31225,-0.6245 0.62451,-0.6245 z m 14.98818,0 8.74311,0 c 0.31226,0 0.62451,0.31225 0.62451,0.6245 0,0.39032 -0.31225,0.62451 -0.62451,0.62451 l -8.74311,0 c -0.31225,0 -0.6245,-0.23419 -0.6245,-0.62451 0,-0.31225 0.31225,-0.6245 0.6245,-0.6245 z m 14.98819,0 8.74311,0 c 0.31226,0 0.62451,0.31225 0.62451,0.6245 0,0.39032 -0.31225,0.62451 -0.62451,0.62451 l -8.74311,0 c -0.31225,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31226,-0.6245 0.62451,-0.6245 z m 14.98819,0 8.74311,0 c 0.31225,0 0.62451,0.31225 0.62451,0.6245 0,0.39032 -0.31226,0.62451 -0.62451,0.62451 l -8.74311,0 c -0.31225,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31226,-0.6245 0.62451,-0.6245 z m 14.98819,0 8.74311,0 c 0.31225,0 0.62451,0.31225 0.62451,0.6245 0,0.39032 -0.31226,0.62451 -0.62451,0.62451 l -8.74311,0 c -0.31226,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31225,-0.6245 0.62451,-0.6245 z m 14.98819,0 8.74311,0 c 0.31225,0 0.6245,0.31225 0.6245,0.6245 0,0.39032 -0.31225,0.62451 -0.6245,0.62451 l -8.74311,0 c -0.31226,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31225,-0.6245 0.62451,-0.6245 z m 14.98818,0 8.74311,0 c 0.31226,0 0.62451,0.31225 0.62451,0.6245 0,0.39032 -0.31225,0.62451 -0.62451,0.62451 l -8.74311,0 c -0.31225,0 -0.6245,-0.23419 -0.6245,-0.62451 0,-0.31225 0.31225,-0.6245 0.6245,-0.6245 z m 14.98819,0 8.74311,0 c 0.31226,0 0.62451,0.31225 0.62451,0.6245 0,0.39032 -0.31225,0.62451 -0.62451,0.62451 l -8.74311,0 c -0.31225,0 -0.6245,-0.23419 -0.6245,-0.62451 0,-0.31225 0.31225,-0.6245 0.6245,-0.6245 z m 14.98819,0 8.74311,0 c 0.31225,0 0.62451,0.31225 0.62451,0.6245 0,0.39032 -0.31226,0.62451 -0.62451,0.62451 l -8.74311,0 c -0.31225,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31226,-0.6245 0.62451,-0.6245 z m 14.98819,0 6.16701,0 -0.6245,0.6245 0,-2.49803 c 0,-0.39032 0.31225,-0.62451 0.6245,-0.62451 0.39032,0 0.62451,0.23419 0.62451,0.62451 l 0,2.49803 c 0,0.39032 -0.23419,0.62451 -0.62451,0.62451 l -6.16701,0 c -0.31225,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31226,-0.6245 0.62451,-0.6245 z m 5.54251,-8.11861 0,-8.74311 c 0,-0.39031 0.31225,-0.6245 0.6245,-0.6245 0.39032,0 0.62451,0.23419 0.62451,0.6245 l 0,8.74311 c 0,0.31226 -0.23419,0.62451 -0.62451,0.62451 -0.31225,0 -0.6245,-0.31225 -0.6245,-0.62451 z m 0,-14.98818 0,-8.74311 c 0,-0.39032 0.31225,-0.62451 0.6245,-0.62451 0.39032,0 0.62451,0.23419 0.62451,0.62451 l 0,8.74311 c 0,0.31225 -0.23419,0.6245 -0.62451,0.6245 -0.31225,0 -0.6245,-0.31225 -0.6245,-0.6245 z m 0,-14.98819 0,-8.74311 c 0,-0.39032 0.31225,-0.62451 0.6245,-0.62451 0.39032,0 0.62451,0.23419 0.62451,0.62451 l 0,8.74311 c 0,0.31225 -0.23419,0.6245 -0.62451,0.6245 -0.31225,0 -0.6245,-0.31225 -0.6245,-0.6245 z m 0,-14.98819 0,-8.74311 c 0,-0.39032 0.31225,-0.62451 0.6245,-0.62451 0.39032,0 0.62451,0.23419 0.62451,0.62451 l 0,8.74311 c 0,0.31225 -0.23419,0.62451 -0.62451,0.62451 -0.31225,0 -0.6245,-0.31226 -0.6245,-0.62451 z m 0,-14.98819 0,-8.74311 c 0,-0.39032 0.31225,-0.62451 0.6245,-0.62451 0.39032,0 0.62451,0.23419 0.62451,0.62451 l 0,8.74311 c 0,0.31225 -0.23419,0.62451 -0.62451,0.62451 -0.31225,0 -0.6245,-0.31226 -0.6245,-0.62451 z m 0,-14.98819 0,-8.74311 c 0,-0.39032 0.31225,-0.62451 0.6245,-0.62451 0.39032,0 0.62451,0.23419 0.62451,0.62451 l 0,8.74311 c 0,0.31226 -0.23419,0.62451 -0.62451,0.62451 -0.31225,0 -0.6245,-0.31225 -0.6245,-0.62451 z m 0,-14.98819 0,-8.74311 c 0,-0.39031 0.31225,-0.6245 0.6245,-0.6245 0.39032,0 0.62451,0.23419 0.62451,0.6245 l 0,8.74311 c 0,0.31226 -0.23419,0.62451 -0.62451,0.62451 -0.31225,0 -0.6245,-0.31225 -0.6245,-0.62451 z m 0,-14.98818 0,-4.37156 0.6245,0.62451 -4.44961,0 c -0.31226,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31225,-0.62451 0.62451,-0.62451 l 4.44961,0 c 0.39032,0 0.62451,0.31226 0.62451,0.62451 l 0,4.37156 c 0,0.31225 -0.23419,0.6245 -0.62451,0.6245 -0.31225,0 -0.6245,-0.31225 -0.6245,-0.6245 z m -10.07019,-3.74705 -8.74311,0 c -0.31226,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31225,-0.62451 0.62451,-0.62451 l 8.74311,0 c 0.39031,0 0.62451,0.31226 0.62451,0.62451 0,0.39032 -0.2342,0.62451 -0.62451,0.62451 z m -14.98819,0 -8.74311,0 c -0.31225,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31226,-0.62451 0.62451,-0.62451 l 8.74311,0 c 0.39032,0 0.62451,0.31226 0.62451,0.62451 0,0.39032 -0.23419,0.62451 -0.62451,0.62451 z m -14.98819,0 -8.74311,0 c -0.31225,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31226,-0.62451 0.62451,-0.62451 l 8.74311,0 c 0.39032,0 0.62451,0.31226 0.62451,0.62451 0,0.39032 -0.23419,0.62451 -0.62451,0.62451 z m -14.98819,0 -8.74311,0 c -0.31225,0 -0.6245,-0.23419 -0.6245,-0.62451 0,-0.31225 0.31225,-0.62451 0.6245,-0.62451 l 8.74311,0 c 0.39032,0 0.62451,0.31226 0.62451,0.62451 0,0.39032 -0.23419,0.62451 -0.62451,0.62451 z m -14.98819,0 -8.74311,0 c -0.31225,0 -0.6245,-0.23419 -0.6245,-0.62451 0,-0.31225 0.31225,-0.62451 0.6245,-0.62451 l 8.74311,0 c 0.39032,0 0.62451,0.31226 0.62451,0.62451 0,0.39032 -0.23419,0.62451 -0.62451,0.62451 z m -14.98818,0 -8.74311,0 c -0.31226,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31225,-0.62451 0.62451,-0.62451 l 8.74311,0 c 0.39031,0 0.6245,0.31226 0.6245,0.62451 0,0.39032 -0.23419,0.62451 -0.6245,0.62451 z m -14.98819,0 -8.74311,0 c -0.31226,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31225,-0.62451 0.62451,-0.62451 l 8.74311,0 c 0.39032,0 0.62451,0.31226 0.62451,0.62451 0,0.39032 -0.23419,0.62451 -0.62451,0.62451 z m -14.98819,0 -8.74311,0 c -0.31225,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31226,-0.62451 0.62451,-0.62451 l 8.74311,0 c 0.39032,0 0.62451,0.31226 0.62451,0.62451 0,0.39032 -0.23419,0.62451 -0.62451,0.62451 z m -14.98819,0 -8.74311,0 c -0.31225,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31226,-0.62451 0.62451,-0.62451 l 8.74311,0 c 0.39032,0 0.62451,0.31226 0.62451,0.62451 0,0.39032 -0.23419,0.62451 -0.62451,0.62451 z m -14.98819,0 -8.74311,0 c -0.31225,0 -0.6245,-0.23419 -0.6245,-0.62451 0,-0.31225 0.31225,-0.62451 0.6245,-0.62451 l 8.74311,0 c 0.39032,0 0.62451,0.31226 0.62451,0.62451 0,0.39032 -0.23419,0.62451 -0.62451,0.62451 z m -14.98819,0 -8.7431,0 c -0.31226,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31225,-0.62451 0.62451,-0.62451 l 8.7431,0 c 0.39032,0 0.62451,0.31226 0.62451,0.62451 0,0.39032 -0.23419,0.62451 -0.62451,0.62451 z m -14.98818,0 -8.74311,0 c -0.31226,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31225,-0.62451 0.62451,-0.62451 l 8.74311,0 c 0.39031,0 0.6245,0.31226 0.6245,0.62451 0,0.39032 -0.23419,0.62451 -0.6245,0.62451 z m -14.98819,0 -8.74311,0 c -0.31226,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31225,-0.62451 0.62451,-0.62451 l 8.74311,0 c 0.39032,0 0.62451,0.31226 0.62451,0.62451 0,0.39032 -0.23419,0.62451 -0.62451,0.62451 z m -14.98819,0 -8.74311,0 c -0.31225,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31226,-0.62451 0.62451,-0.62451 l 8.74311,0 c 0.39032,0 0.62451,0.31226 0.62451,0.62451 0,0.39032 -0.23419,0.62451 -0.62451,0.62451 z m -14.98819,0 -8.74311,0 c -0.31225,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31226,-0.62451 0.62451,-0.62451 l 8.74311,0 c 0.39032,0 0.62451,0.31226 0.62451,0.62451 0,0.39032 -0.23419,0.62451 -0.62451,0.62451 z m -14.98819,0 -8.74311,0 c -0.31225,0 -0.6245,-0.23419 -0.6245,-0.62451 0,-0.31225 0.31225,-0.62451 0.6245,-0.62451 l 8.74311,0 c 0.39032,0 0.62451,0.31226 0.62451,0.62451 0,0.39032 -0.23419,0.62451 -0.62451,0.62451 z m -14.98818,0 -8.74311,0 c -0.31226,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31225,-0.62451 0.62451,-0.62451 l 8.74311,0 c 0.39031,0 0.6245,0.31226 0.6245,0.62451 0,0.39032 -0.23419,0.62451 -0.6245,0.62451 z m -14.98819,0 -8.74311,0 c -0.31226,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31225,-0.62451 0.62451,-0.62451 l 8.74311,0 c 0.39031,0 0.6245,0.31226 0.6245,0.62451 0,0.39032 -0.23419,0.62451 -0.6245,0.62451 z m -14.98819,0 -8.74311,0 c -0.31225,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31226,-0.62451 0.62451,-0.62451 l 8.74311,0 c 0.39032,0 0.62451,0.31226 0.62451,0.62451 0,0.39032 -0.23419,0.62451 -0.62451,0.62451 z m -14.98819,0 -8.74311,0 c -0.31225,0 -0.62451,-0.23419 -0.62451,-0.62451 0,-0.31225 0.31226,-0.62451 0.62451,-0.62451 l 8.74311,0 c 0.39032,0 0.62451,0.31226 0.62451,0.62451 0,0.39032 -0.23419,0.62451 -0.62451,0.62451 z m -14.98819,0 -8.743108,0 c -0.312254,0 -0.624507,-0.23419 -0.624507,-0.62451 0,-0.31225 0.312253,-0.62451 0.624507,-0.62451 l 8.743108,0 c 0.39032,0 0.62451,0.31226 0.62451,0.62451 0,0.39032 -0.23419,0.62451 -0.62451,0.62451 z m -14.988186,0 -8.74311,0 c -0.312254,0 -0.624508,-0.23419 -0.624508,-0.62451 0,-0.31225 0.312254,-0.62451 0.624508,-0.62451 l 8.74311,0 c 0.390317,0 0.624508,0.31226 0.624508,0.62451 0,0.39032 -0.234191,0.62451 -0.624508,0.62451 z m -14.988188,0 -8.74311,0 c -0.312254,0 -0.624508,-0.23419 -0.624508,-0.62451 0,-0.31225 0.312254,-0.62451 0.624508,-0.62451 l 8.74311,0 c 0.390317,0 0.624508,0.31226 0.624508,0.62451 0,0.39032 -0.234191,0.62451 -0.624508,0.62451 z" - id="path20957" - style="fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.24901569px;stroke-linecap:butt;stroke-linejoin:bevel;stroke-opacity:1;stroke-dasharray:none" /> - <text - x="66.19783" - y="262.2933" - id="text20959" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">Counter</text> - <path - d="m 238.87425,829.03416 0,41.60784" - id="path20961" - style="fill:none;stroke:#000000;stroke-width:8.50891972px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 238.87425,887.97209 -11.47533,-22.95066 c 7.2599,3.59092 15.76882,3.59092 23.02873,0 l 0,0 -11.5534,22.95066 z" - id="path20963" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 238.87425,917.48009 0,71.11583" - id="path20965" - style="fill:none;stroke:#000000;stroke-width:8.50891972px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 238.87425,1006.0041 -11.47533,-22.95069 c 7.2599,3.59092 15.76882,3.59092 23.02873,0 l 0,0 -11.5534,22.95069 z" - id="path20967" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 209.44432,1006.0041 0,29.508 117.95392,0 0,-29.508 -117.95392,0 z" - id="path20969" - style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 209.44432,1035.5121 117.95392,0 0,-29.508 -117.95392,0 0,29.508 z" - id="path20971" - style="fill:none;stroke:#000000;stroke-width:2.49803138px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <text - x="261.04428" - y="1027.9399" - id="text20973" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">=</text> - <path - d="m 91.412336,887.97209 0,29.508 295.001894,0 0,-29.508 -295.001894,0 z" - id="path20975" - style="fill:#36a8e4;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 91.412336,917.48009 295.001894,0 0,-29.508 -295.001894,0 0,29.508 z" - id="path20977" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <text - x="213.58168" - y="910.53241" - id="text20979" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">CCx</text> - <path - d="m 91.412336,799.52617 0,29.50799 295.001894,0 0,-29.50799 -295.001894,0 z" - id="path20981" - style="fill:#36a8e4;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 91.412336,829.03416 295.001894,0 0,-29.50799 -295.001894,0 0,29.50799 z" - id="path20983" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <text - x="204.83858" - y="821.85229" - id="text20985" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">CCBx</text> - <path - d="m 415.92222,740.51018 -177.04797,0 0,41.60783" - id="path20987" - style="fill:none;stroke:#000000;stroke-width:8.50891972px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 238.87425,799.52617 11.5534,-23.02873 c -7.25991,3.66898 -15.76883,3.66898 -23.02873,0 l 11.47533,23.02873 z" - id="path20989" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 415.92222,740.51018 0,206.4779 -118.03198,0 0,41.60784" - id="path20991" - style="fill:none;stroke:#000000;stroke-width:8.50891972px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 297.89024,1006.0041 11.5534,-22.95069 c -7.25991,3.59092 -15.76883,3.59092 -23.02873,0 l 11.47533,22.95069 z" - id="path20993" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 637.23219,887.97209 0,88.52399 147.53998,0 0,-88.52399 -147.53998,0 z" - id="path20995" - style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 637.23219,976.49608 147.53998,0 0,-88.52399 -147.53998,0 0,88.52399 z" - id="path20997" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <text - x="660.72931" - y="925.52063" - id="text20999" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">Waveform </text> - <text - x="655.73322" - y="950.50092" - id="text21001" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">Generation</text> - <path - d="m 238.87425,327.39824 0,59.01599 177.04797,0 0,41.60783" - id="path21003" - style="fill:none;stroke:#000000;stroke-width:8.50891972px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 415.92222,445.43022 -11.47533,-22.95066 c 7.25991,3.59092 15.76883,3.59092 22.95067,0 l 0,0 -11.47534,22.95066 z" - id="path21005" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 238.87425,91.412336 0,41.607834" - id="path21007" - style="fill:none;stroke:#000000;stroke-width:8.50891972px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="M 238.87425,150.42833 227.39892,127.3996 c 7.2599,3.66898 15.76882,3.66898 23.02873,0 l 0,0 -11.5534,23.02873 z" - id="path21009" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 238.87425,179.93632 0,100.62383" - id="path21011" - style="fill:none;stroke:#000000;stroke-width:8.50891972px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 238.87425,297.89024 -11.47533,-22.95066 c 7.2599,3.59092 15.76882,3.59092 23.02873,0 l 0,0 -11.5534,22.95066 z" - id="path21013" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 474.93822,356.90623 0,71.11583" - id="path21015" - style="fill:none;stroke:#000000;stroke-width:8.50891972px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 474.93822,445.43022 -11.47534,-22.95066 c 7.25991,3.59092 15.76883,3.59092 22.95067,0 l -11.47533,22.95066 z" - id="path21017" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 238.87425,179.93632 0,29.508 236.06397,0 0,147.46191" - id="path21019" - style="fill:none;stroke:#000000;stroke-width:8.50891972px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 47.150342,799.52617 0,29.50799 44.261994,0 0,-29.50799 -44.261994,0 z" - id="path21021" - style="fill:#36a8e4;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 47.150342,829.03416 44.261994,0 0,-29.50799 -44.261994,0 0,29.50799 z" - id="path21023" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <text - x="52.45866" - y="821.85229" - id="text21025" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">BV</text> - <path - d="m 238.87425,327.39824 0,59.01599 118.03198,0 0,100.62383" - id="path21027" - style="fill:none;stroke:#000000;stroke-width:8.50891972px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="M 356.90623,504.44621 345.4309,481.49555 c 7.25991,3.59092 15.76882,3.59092 23.02873,0 l -11.5534,22.95066 z" - id="path21029" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 386.41423,445.43022 0,29.508 118.03198,0 0,-29.508 -118.03198,0 z" - id="path21031" - style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 386.41423,474.93822 118.03198,0 0,-29.508 -118.03198,0 0,29.508 z" - id="path21033" - style="fill:none;stroke:#000000;stroke-width:2.49803138px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <text - x="438.40451" - y="467.13187" - id="text21035" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">=</text> - <path - d="m 91.412336,61.90434 0,29.507996 295.001894,0 0,-29.507996 -295.001894,0 z" - id="path21037" - style="fill:#36a8e4;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 91.412336,91.412336 295.001894,0 0,-29.507996 -295.001894,0 0,29.507996 z" - id="path21039" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <text - x="203.58955" - y="83.684052" - id="text21041" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">PER</text> - <text - x="256.04822" - y="83.684052" - id="text21043" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">B</text> - <path - d="m 91.412336,150.42833 0,29.50799 295.001894,0 0,-29.50799 -295.001894,0 z" - id="path21045" - style="fill:#36a8e4;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 91.412336,179.93632 295.001894,0 0,-29.50799 -295.001894,0 0,29.50799 z" - id="path21047" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <text - x="213.58168" - y="172.36417" - id="text21049" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">PER</text> - <path - d="m 91.412336,297.89024 0,29.508 295.001894,0 0,-29.508 -295.001894,0 z" - id="path21051" - style="fill:#36a8e4;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 91.412336,327.39824 295.001894,0 0,-29.508 -295.001894,0 0,29.508 z" - id="path21053" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <text - x="194.84645" - y="319.74802" - id="text21055" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">COUNT</text> - <path - d="m 47.150342,61.90434 0,29.507996 44.261994,0 0,-29.507996 -44.261994,0 z" - id="path21057" - style="fill:#36a8e4;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 47.150342,91.412336 44.261994,0 0,-29.507996 -44.261994,0 0,29.507996 z" - id="path21059" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <text - x="52.45866" - y="83.684052" - id="text21061" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">BV</text> - <path - d="m 297.89024,504.44621 0,29.508 118.03198,0 0,-29.508 -118.03198,0 z" - id="path21063" - style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 297.89024,533.95421 118.03198,0 0,-29.508 -118.03198,0 0,29.508 z" - id="path21065" - style="fill:none;stroke:#000000;stroke-width:2.49803138px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <text - x="339.73227" - y="527.08459" - id="text21067" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">= </text> - <text - x="360.96552" - y="527.08459" - id="text21069" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">0</text> - <text - x="508.3494" - y="244.80708" - id="text21071" - xml:space="preserve" - style="font-size:21.23326683px;font-style:italic;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">"</text> - <text - x="515.84351" - y="244.80708" - id="text21073" - xml:space="preserve" - style="font-size:21.23326683px;font-style:italic;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">count</text> - <text - x="567.0531" - y="244.80708" - id="text21075" - xml:space="preserve" - style="font-size:21.23326683px;font-style:italic;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">"</text> - <text - x="508.3494" - y="274.78345" - id="text21077" - xml:space="preserve" - style="font-size:21.23326683px;font-style:italic;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">"</text> - <text - x="515.84351" - y="274.78345" - id="text21079" - xml:space="preserve" - style="font-size:21.23326683px;font-style:italic;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">clear</text> - <text - x="560.80804" - y="274.78345" - id="text21081" - xml:space="preserve" - style="font-size:21.23326683px;font-style:italic;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">"</text> - <text - x="508.3494" - y="333.48718" - id="text21083" - xml:space="preserve" - style="font-size:21.23326683px;font-style:italic;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">"</text> - <text - x="515.84351" - y="333.48718" - id="text21085" - xml:space="preserve" - style="font-size:21.23326683px;font-style:italic;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">direction</text> - <text - x="594.53149" - y="333.48718" - id="text21087" - xml:space="preserve" - style="font-size:21.23326683px;font-style:italic;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">"</text> - <text - x="508.3494" - y="303.5108" - id="text21089" - xml:space="preserve" - style="font-size:21.23326683px;font-style:italic;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">"</text> - <text - x="515.84351" - y="303.5108" - id="text21091" - xml:space="preserve" - style="font-size:21.23326683px;font-style:italic;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">load</text> - <text - x="555.81195" - y="303.5108" - id="text21093" - xml:space="preserve" - style="font-size:21.23326683px;font-style:italic;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">"</text> - <path - d="m 426.14854,253.62825 196.32965,0" - id="path21095" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 415.92222,253.62825 13.50499,-6.71346 c -2.10772,4.21543 -2.10772,9.21149 0,13.50498 l -13.50499,-6.79152 z" - id="path21097" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 426.14854,283.13624 196.32965,0" - id="path21099" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 415.92222,283.13624 13.50499,-6.71346 c -2.10772,4.21543 -2.10772,9.2115 0,13.50499 l -13.50499,-6.79153 z" - id="path21101" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 426.14854,312.64424 196.32965,0" - id="path21103" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 415.92222,312.64424 13.50499,-6.71346 c -2.10772,4.21543 -2.10772,9.21149 0,13.50498 l -13.50499,-6.79152 z" - id="path21105" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 426.14854,342.15224 196.32965,0" - id="path21107" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 415.92222,342.15224 13.50499,-6.71346 c -2.10772,4.21542 -2.10772,9.21149 0,13.50498 l -13.50499,-6.79152 z" - id="path21109" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 622.47819,224.19832 0,176.96991 147.53998,0 0,-176.96991 -147.53998,0 z" - id="path21111" - style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 622.47819,401.16823 147.53998,0 0,-176.96991 -147.53998,0 0,176.96991 z" - id="path21113" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <text - x="628.25488" - y="318.49899" - id="text21115" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">Control Logic</text> - <path - d="m 474.93822,150.42833 0,29.50799 147.53997,0 0,-29.50799 -147.53997,0 z" - id="path21117" - style="fill:#36a8e4;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 474.93822,179.93632 147.53997,0 0,-29.50799 -147.53997,0 0,29.50799 z" - id="path21119" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <text - x="492.11218" - y="172.36417" - id="text21121" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">Prescaler</text> - <path - d="m 818.80785,253.62825 -48.78968,0" - id="path21123" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 829.03416,253.62825 -13.50498,6.79152 c 2.10772,-4.29349 2.10772,-9.28955 0,-13.50498 l 0,0 13.50498,6.71346 z" - id="path21125" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <text - x="833.09344" - y="259.79526" - id="text21127" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">OVF</text> - <text - x="879.8587" - y="258.42081" - id="text21133" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">(</text> - <text - x="886.10382" - y="258.42081" - id="text21135" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">INT</text> - <text - x="919.82721" - y="258.42081" - id="text21137" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">/</text> - <text - x="926.07233" - y="258.42081" - id="text21139" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">Event</text> - <text - x="978.53088" - y="258.42081" - id="text21141" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">/</text> - <text - x="984.776" - y="258.42081" - id="text21143" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">DMA Req</text> - <text - x="1074.7052" - y="258.42081" - id="text21145" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">.)</text> - <path - d="m 818.80785,283.13624 -48.78968,0" - id="path21147" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 829.03416,283.13624 -13.50498,6.79153 c 2.10772,-4.29349 2.10772,-9.28956 0,-13.50499 l 0,0 13.50498,6.71346 z" - id="path21149" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <text - x="833.09344" - y="289.77164" - id="text21151" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">ERR</text> - <text - x="881.40454" - y="288.31381" - id="text21153" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">(</text> - <text - x="888.89862" - y="288.31381" - id="text21155" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">INT Req</text> - <text - x="966.33759" - y="288.31381" - id="text21157" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">.)</text> - <text - x="538.32574" - y="452.14368" - id="text21159" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">TOP</text> - <text - x="434.65747" - y="1011.7027" - id="text21161" - xml:space="preserve" - style="font-size:21.23326683px;font-style:italic;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">"</text> - <text - x="442.15155" - y="1011.7027" - id="text21163" - xml:space="preserve" - style="font-size:21.23326683px;font-style:italic;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">match</text> - <text - x="498.35727" - y="1011.7027" - id="text21165" - xml:space="preserve" - style="font-size:21.23326683px;font-style:italic;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">"</text> - <path - d="m 238.87425,386.41423 0,336.68779" - id="path21167" - style="fill:none;stroke:#000000;stroke-width:8.50891972px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 238.87425,740.51018 -11.47533,-23.02873 c 7.2599,3.66898 15.76882,3.66898 23.02873,0 l 0,0 -11.5534,23.02873 z" - id="path21169" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 681.49419,419.74733 0,99.45288 -265.57197,0" - id="path21171" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 674.70266,421.38667 6.79153,-20.21844 6.71345,20.21844 -13.50498,0 z" - id="path21173" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 651.98619,419.74733 0,40.43689 -147.53998,0" - id="path21175" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 645.19467,421.38667 6.79152,-20.21844 6.71346,20.21844 -13.50498,0 z" - id="path21177" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 711.00218,986.72239 0,34.03571 -383.60394,0" - id="path21179" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 711.00218,976.49608 6.71346,13.50498 c -4.21543,-2.10771 -9.21149,-2.10771 -13.50498,0 l 0,0 6.79152,-13.50498 z" - id="path21181" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <text - x="1357.4336" - y="1028.2067" - id="text21183" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">MC</text> - <text - x="1389.9081" - y="1028.2067" - id="text21185" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">x</text> - <text - x="1406.1453" - y="1028.2067" - id="text21187" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">(</text> - <text - x="1413.6394" - y="1028.2067" - id="text21189" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">INT</text> - <text - x="1447.3628" - y="1028.2067" - id="text21191" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">/</text> - <text - x="1453.6078" - y="1028.2067" - id="text21193" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">Event</text> - <text - x="1506.0665" - y="1028.2067" - id="text21195" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">/</text> - <text - x="1512.3115" - y="1028.2067" - id="text21197" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">DMA Req</text> - <text - x="1602.2407" - y="1028.2067" - id="text21199" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">.)</text> - <path - d="m 711.00218,401.16823 0,358.62363" - id="path21201" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 711.00218,770.01817 -6.79152,-13.50498 c 4.29349,2.10771 9.28955,2.10771 13.50498,0 l 0,0 -6.71346,13.50498 z" - id="path21203" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 637.23219,770.01817 0,88.44593 147.53998,0 0,-88.44593 -147.53998,0 z" - id="path21205" - style="fill:#ffffff;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 637.23219,858.4641 147.53998,0 0,-88.44593 -147.53998,0 0,88.44593 z" - id="path21207" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <text - x="643.2431" - y="820.60333" - id="text21209" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">Control Logic</text> - <text - x="434.65747" - y="805.61511" - id="text21211" - xml:space="preserve" - style="font-size:21.23326683px;font-style:italic;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">"</text> - <text - x="442.15155" - y="805.61511" - id="text21213" - xml:space="preserve" - style="font-size:21.23326683px;font-style:italic;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">capture</text> - <text - x="512.09644" - y="805.61511" - id="text21215" - xml:space="preserve" - style="font-size:21.23326683px;font-style:italic;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">"</text> - <path - d="m 396.64054,814.28017 240.59165,0" - id="path21217" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 386.41423,814.28017 13.50498,-6.79153 c -2.10771,4.29349 -2.10771,9.28956 0,13.50499 l -13.50498,-6.71346 z" - id="path21219" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 740.51018,401.16823 0,358.62363" - id="path21221" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 740.51018,770.01817 -6.79153,-13.50498 c 4.2935,2.10771 9.28956,2.10771 13.50499,0 l 0,0 -6.71346,13.50498 z" - id="path21223" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 710.19064,991.21821 0,29.57179 625.90416,0" - id="path21225" - style="fill:none;stroke:#000000;stroke-width:1.42044067px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1348.4954,1020.7581 -13.505,-6.7135 c 2.1077,4.2154 2.1077,9.2115 0,13.505 l 0,0 13.505,-6.7915 z" - id="path21227" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <text - x="701.94684" - y="529.58264" - transform="matrix(0,-1,1,0,172.36417,1231.5295)" - id="text21229" - xml:space="preserve" - style="font-size:21.23326683px;font-style:italic;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">"</text> - <text - x="701.94684" - y="522.08856" - transform="matrix(0,-1,1,0,179.85826,1224.0354)" - id="text21231" - xml:space="preserve" - style="font-size:21.23326683px;font-style:italic;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">e</text> - <text - x="701.94684" - y="510.84741" - transform="matrix(0,-1,1,0,191.0994,1212.7942)" - id="text21233" - xml:space="preserve" - style="font-size:21.23326683px;font-style:italic;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">v</text> - <text - x="701.94684" - y="500.85529" - transform="matrix(0,-1,1,0,201.09153,1202.8021)" - id="text21235" - xml:space="preserve" - style="font-size:21.23326683px;font-style:italic;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">"</text> - <text - x="731.92322" - y="529.58264" - transform="matrix(0,-1,1,0,202.34054,1261.5058)" - id="text21237" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">U</text> - <text - x="731.92322" - y="514.59448" - transform="matrix(0,-1,1,0,217.32873,1246.5177)" - id="text21239" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">P</text> - <text - x="731.92322" - y="500.85529" - transform="matrix(0,-1,1,0,231.0679,1232.7785)" - id="text21241" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">D</text> - <text - x="731.92322" - y="485.8671" - transform="matrix(0,-1,1,0,246.05609,1217.7903)" - id="text21243" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">A</text> - <text - x="731.92322" - y="470.87891" - transform="matrix(0,-1,1,0,261.04428,1202.8021)" - id="text21245" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">T</text> - <text - x="731.92322" - y="458.38876" - transform="matrix(0,-1,1,0,273.53443,1190.312)" - id="text21247" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">E</text> - <text - x="538.32574" - y="510.84741" - id="text21249" - xml:space="preserve" - style="font-size:21.23326683px;font-style:normal;font-weight:bold;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">BOTTOM</text> - <g - id="g3928"> - <path - d="m 874.62309,931.81135 -74.91434,0" - id="path21251" - style="fill:none;stroke:#000000;stroke-width:1.42971087px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 885.22802,932.0121 -13.42692,6.79153 c 2.10772,-4.29349 2.10772,-9.28956 0,-13.50498 l 13.42692,6.71345 z" - id="path21253" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - </g> - <path - d="m 474.93822,165.18232 -70.80358,0 0,63.54368" - id="path21255" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 404.13464,238.87425 -6.71346,-13.42692 c 4.21543,2.10772 9.21149,2.10772 13.42692,0 l 0,0 -6.71346,13.42692 z" - id="path21257" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 938.84697,991.78523 0,-136.19255 -53.10759,0 0,136.19255 53.10759,0 z" - id="path21259" - style="fill:none;stroke:#000000;stroke-width:1.51137304px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <text - x="-961.35443" - y="910.47162" - transform="matrix(0,-1,1,0,0,0)" - id="text21261" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">Recoverable</text> - <text - x="-937.62317" - y="930.45587" - transform="matrix(0,-1,1,0,0,0)" - id="text21285" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">Faults</text> - <g - id="g3924"> - <path - d="m 872.7487,887.53034 -58.14973,0" - id="path21297" - style="fill:none;stroke:#000000;stroke-width:1.42635524px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 884.94583,888.01806 -13.42692,6.79152 c 2.10772,-4.29349 2.10772,-9.28955 0,-13.50498 l 0,0 13.42692,6.71346 z" - id="path21299" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - </g> - <g - transform="matrix(1,0,0,1.0190469,-62.772695,-3.3029105)" - id="g3447"> - <path - d="m 1094.5281,976.49608 0,-398.27988 -59.016,0 0,398.27988 59.016,0 z" - id="path21301" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <text - x="1060.4143" - y="801.86804" - transform="matrix(0,-1,1,0,258.54623,1862.2824)" - id="text21303" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">O</text> - <text - x="1060.4143" - y="789.37793" - transform="matrix(0,-1,1,0,271.03638,1849.7922)" - id="text21305" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">u</text> - <text - x="1060.4143" - y="780.63483" - transform="matrix(0,-1,1,0,279.77949,1841.0491)" - id="text21307" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">t</text> - <text - x="1060.4143" - y="775.63873" - transform="matrix(0,-1,1,0,284.77556,1836.053)" - id="text21309" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">p</text> - <text - x="1060.4143" - y="765.64661" - transform="matrix(0,-1,1,0,294.76768,1826.0609)" - id="text21311" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">u</text> - <text - x="1060.4143" - y="756.9035" - transform="matrix(0,-1,1,0,303.51079,1817.3178)" - id="text21313" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">t</text> - <text - x="1080.3986" - y="800.61908" - transform="matrix(0,-1,1,0,279.77954,1881.0177)" - id="text21315" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">M</text> - <text - x="1080.3986" - y="785.63086" - transform="matrix(0,-1,1,0,294.76773,1866.0295)" - id="text21317" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">a</text> - <text - x="1080.3986" - y="776.88776" - transform="matrix(0,-1,1,0,303.51084,1857.2864)" - id="text21319" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">t</text> - <text - x="1080.3986" - y="771.89172" - transform="matrix(0,-1,1,0,308.5069,1852.2903)" - id="text21321" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">r</text> - <text - x="1080.3986" - y="766.89563" - transform="matrix(0,-1,1,0,313.50297,1847.2942)" - id="text21323" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">i</text> - <text - x="1080.3986" - y="763.14856" - transform="matrix(0,-1,1,0,317.25001,1843.5472)" - id="text21325" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">x</text> - </g> - <g - transform="translate(-15.436818,3.5135653)" - id="g4299"> - <path - d="m 1134.1557,988.24819 0,-214.98041 -58.9427,0 0,214.98041 58.9427,0 z" - id="path21327" - style="fill:none;stroke:#000000;stroke-width:1.55761099px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <text - x="-923.74011" - y="1100.2346" - transform="matrix(0,-1,1,0,0,0)" - id="text21329" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">D</text> - <text - x="-911.24988" - y="1100.2346" - transform="matrix(0,-1,1,0,0,0)" - id="text21331" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">e</text> - <text - x="-902.50677" - y="1100.2346" - transform="matrix(0,-1,1,0,0,0)" - id="text21333" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">a</text> - <text - x="-892.51471" - y="1100.2346" - transform="matrix(0,-1,1,0,0,0)" - id="text21335" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">d</text> - <text - x="-883.77161" - y="1100.2346" - transform="matrix(0,-1,1,0,0,0)" - id="text21337" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">-</text> - <text - x="-878.77551" - y="1100.2346" - transform="matrix(0,-1,1,0,0,0)" - id="text21339" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">T</text> - <text - x="-867.53436" - y="1100.2346" - transform="matrix(0,-1,1,0,0,0)" - id="text21341" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">i</text> - <text - x="-863.78729" - y="1100.2346" - transform="matrix(0,-1,1,0,0,0)" - id="text21343" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">m</text> - <text - x="-850.0481" - y="1100.2346" - transform="matrix(0,-1,1,0,0,0)" - id="text21345" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">e</text> - <text - x="-913.7478" - y="1120.2189" - transform="matrix(0,-1,1,0,0,0)" - id="text21347" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">I</text> - <text - x="-910.00079" - y="1120.2189" - transform="matrix(0,-1,1,0,0,0)" - id="text21349" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">n</text> - <text - x="-900.00873" - y="1120.2189" - transform="matrix(0,-1,1,0,0,0)" - id="text21351" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">s</text> - <text - x="-892.51459" - y="1120.2189" - transform="matrix(0,-1,1,0,0,0)" - id="text21353" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">e</text> - <text - x="-882.5224" - y="1120.219" - transform="matrix(0,-1,1,0,0,0)" - id="text21355" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">r</text> - <text - x="-877.52643" - y="1120.2189" - transform="matrix(0,-1,1,0,0,0)" - id="text21357" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">t</text> - <text - x="-872.53033" - y="1120.2189" - transform="matrix(0,-1,1,0,0,0)" - id="text21359" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">i</text> - <text - x="-868.78333" - y="1120.2189" - transform="matrix(0,-1,1,0,0,0)" - id="text21361" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">o</text> - <text - x="-860.04022" - y="1120.2189" - transform="matrix(0,-1,1,0,0,0)" - id="text21363" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">n</text> - </g> - <path - d="m 1271.2616,991.7827 0,-405.86091 -58.3872,0 0,405.86091 58.3872,0 z" - id="path21365" - style="fill:none;stroke:#000000;stroke-width:1.51635635;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> - <text - x="-807.54523" - y="1253.1334" - transform="matrix(0,-1,1,0,0,0)" - id="text21367" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">SWAP</text> - <path - d="m 1360.2389,991.79247 0,-405.88045 -59.0022,0 0,405.88045 59.0022,0 z" - id="path21375" - style="fill:none;stroke:#000000;stroke-width:1.49711788px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <text - x="1325.2056" - y="804.36609" - transform="matrix(0,-1,1,0,520.8395,2129.5717)" - id="text21377" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">P</text> - <text - x="1325.2056" - y="793.12494" - transform="matrix(0,-1,1,0,532.08064,2118.3306)" - id="text21379" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">a</text> - <text - x="1325.2056" - y="784.38184" - transform="matrix(0,-1,1,0,540.82375,2109.5875)" - id="text21381" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">t</text> - <text - x="1325.2056" - y="779.3858" - transform="matrix(0,-1,1,0,545.81981,2104.5914)" - id="text21383" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">t</text> - <text - x="1325.2056" - y="774.38971" - transform="matrix(0,-1,1,0,550.81587,2099.5953)" - id="text21385" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">e</text> - <text - x="1325.2056" - y="765.64661" - transform="matrix(0,-1,1,0,559.55898,2090.8522)" - id="text21387" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">r</text> - <text - x="1325.2056" - y="759.40155" - transform="matrix(0,-1,1,0,565.80406,2084.6071)" - id="text21389" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">n</text> - <text - x="1345.1899" - y="818.10529" - transform="matrix(0,-1,1,0,527.08462,2163.2952)" - id="text21391" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">G</text> - <text - x="1345.1899" - y="805.61511" - transform="matrix(0,-1,1,0,539.57478,2150.805)" - id="text21393" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">e</text> - <text - x="1345.1899" - y="796.87201" - transform="matrix(0,-1,1,0,548.31789,2142.0619)" - id="text21395" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">n</text> - <text - x="1345.1899" - y="786.87988" - transform="matrix(0,-1,1,0,558.31002,2132.0698)" - id="text21397" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">e</text> - <text - x="1345.1899" - y="778.13678" - transform="matrix(0,-1,1,0,567.05313,2123.3267)" - id="text21399" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">r</text> - <text - x="1345.1899" - y="771.89172" - transform="matrix(0,-1,1,0,573.2982,2117.0816)" - id="text21401" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">a</text> - <text - x="1345.1899" - y="763.14856" - transform="matrix(0,-1,1,0,582.04131,2108.3385)" - id="text21403" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">t</text> - <text - x="1345.1899" - y="758.15253" - transform="matrix(0,-1,1,0,587.03738,2103.3424)" - id="text21405" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">i</text> - <text - x="1345.1899" - y="754.40546" - transform="matrix(0,-1,1,0,590.78442,2099.5954)" - id="text21407" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">o</text> - <text - x="1345.1899" - y="745.66235" - transform="matrix(0,-1,1,0,599.52753,2090.8523)" - id="text21409" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">n</text> - <path - d="m 1448.6171,991.78588 0,-405.91823 -59.0022,0 0,405.91823 59.0022,0 z" - id="path21411" - style="fill:none;stroke:#000000;stroke-width:1.51009905;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> - <text - x="1413.8857" - y="839.33856" - transform="matrix(0,-1,1,0,574.54726,2253.2243)" - id="text21413" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">N</text> - <text - x="1413.8857" - y="826.84839" - transform="matrix(0,-1,1,0,587.03741,2240.7342)" - id="text21415" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">o</text> - <text - x="1413.8857" - y="818.10529" - transform="matrix(0,-1,1,0,595.78052,2231.9911)" - id="text21417" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">n</text> - <text - x="1413.8857" - y="808.11316" - transform="matrix(0,-1,1,0,605.77265,2221.999)" - id="text21419" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">-</text> - <text - x="1413.8857" - y="803.11707" - transform="matrix(0,-1,1,0,610.76871,2217.0029)" - id="text21421" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">r</text> - <text - x="1413.8857" - y="796.87201" - transform="matrix(0,-1,1,0,617.01379,2210.7578)" - id="text21423" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">e</text> - <text - x="1413.8857" - y="788.12891" - transform="matrix(0,-1,1,0,625.7569,2202.0147)" - id="text21425" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">c</text> - <text - x="1413.8857" - y="779.3858" - transform="matrix(0,-1,1,0,634.50001,2193.2716)" - id="text21427" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">o</text> - <text - x="1413.8857" - y="770.6427" - transform="matrix(0,-1,1,0,643.24312,2184.5285)" - id="text21429" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">v</text> - <text - x="1413.8857" - y="761.8996" - transform="matrix(0,-1,1,0,651.98623,2175.7854)" - id="text21431" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">e</text> - <text - x="1413.8857" - y="753.15643" - transform="matrix(0,-1,1,0,660.72934,2167.0423)" - id="text21433" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">r</text> - <text - x="1413.8857" - y="746.91138" - transform="matrix(0,-1,1,0,666.97442,2160.7972)" - id="text21435" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">a</text> - <text - x="1413.8857" - y="738.16827" - transform="matrix(0,-1,1,0,675.71753,2152.0541)" - id="text21437" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">b</text> - <text - x="1413.8857" - y="728.17615" - transform="matrix(0,-1,1,0,685.70965,2142.062)" - id="text21439" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">l</text> - <text - x="1413.8857" - y="724.42908" - transform="matrix(0,-1,1,0,689.4567,2138.3149)" - id="text21441" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">e</text> - <text - x="1433.87" - y="800.61908" - transform="matrix(0,-1,1,0,633.25094,2234.4891)" - id="text21443" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">F</text> - <text - x="1433.87" - y="789.37793" - transform="matrix(0,-1,1,0,644.49208,2223.2479)" - id="text21445" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">a</text> - <text - x="1433.87" - y="780.63483" - transform="matrix(0,-1,1,0,653.23519,2214.5048)" - id="text21447" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">u</text> - <text - x="1433.87" - y="771.89172" - transform="matrix(0,-1,1,0,661.9783,2205.7617)" - id="text21449" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">l</text> - <text - x="1433.87" - y="768.14465" - transform="matrix(0,-1,1,0,665.72535,2202.0147)" - id="text21451" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">t</text> - <text - x="1433.87" - y="763.14856" - transform="matrix(0,-1,1,0,670.72141,2197.0186)" - id="text21453" - xml:space="preserve" - style="font-size:16.2372036px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">s</text> - <g - transform="translate(0,-3.2192186e-6)" - id="g3916"> - <path - d="m 960.57849,799.46003 -116.4104,0" - id="path21471" - style="fill:none;stroke:#000000;stroke-width:1.45568323;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 972.4447,799.60465 -13.50504,6.71346 c 2.1858,-4.21543 2.1858,-9.21149 0,-13.50498 l 0,0 13.50504,6.79152 z" - id="path21473" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - </g> - <path - d="m 1271.576,933.57932 19.2817,0" - id="path21535" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1301.6038,934.37769 -13.505,6.79153 c 2.1078,-4.29349 2.1078,-9.28956 0,-13.50498 l 13.505,6.71345 z" - id="path21537" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1271.576,887.97209 19.2817,0" - id="path21539" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1301.084,887.97209 -13.505,6.79152 c 2.1078,-4.29349 2.1078,-9.28955 0,-13.50498 l 0,0 13.505,6.71346 z" - id="path21541" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1271.576,843.78816 19.2817,0" - id="path21543" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1301.084,843.78816 -13.505,6.71346 c 2.1078,-4.21543 2.1078,-9.21149 0,-13.50498 l 13.505,6.79152 z" - id="path21545" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1271.576,799.52617 19.2817,0" - id="path21547" - style="fill:none;stroke:#000000;stroke-width:1.49599946;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1301.084,799.52617 -13.505,6.71346 c 2.1078,-4.21543 2.1078,-9.21149 0,-13.50498 l 0,0 13.505,6.79152 z" - id="path21549" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1360.1,932.23408 19.2817,0" - id="path21551" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1389.608,932.23408 -13.505,6.79153 c 2.1077,-4.29349 2.1077,-9.28956 0,-13.50498 l 13.505,6.71345 z" - id="path21553" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1360.1,887.97209 19.2817,0" - id="path21555" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1389.608,887.97209 -13.505,6.79152 c 2.1077,-4.29349 2.1077,-9.28955 0,-13.50498 l 0,0 13.505,6.71346 z" - id="path21557" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1360.1,843.78816 19.2817,0" - id="path21559" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1389.608,843.78816 -13.505,6.71346 c 2.1077,-4.21543 2.1077,-9.21149 0,-13.50498 l 13.505,6.79152 z" - id="path21561" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1360.1,799.52617 19.2817,0" - id="path21563" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1389.608,799.52617 -13.505,6.71346 c 2.1077,-4.21543 2.1077,-9.21149 0,-13.50498 l 0,0 13.505,6.79152 z" - id="path21565" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1360.1,755.26417 19.2817,0" - id="path21567" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1389.608,755.26417 -13.505,6.71346 c 2.1077,-4.21542 2.1077,-9.21149 0,-13.50498 l 13.505,6.79152 z" - id="path21569" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1360.1,711.00218 19.2817,0" - id="path21571" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1389.608,711.00218 -13.505,6.71346 c 2.1077,-4.21543 2.1077,-9.21149 0,-13.50498 l 13.505,6.79152 z" - id="path21573" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1360.1,666.74019 19.2817,0" - id="path21575" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1389.608,666.74019 -13.505,6.71346 c 2.1077,-4.21543 2.1077,-9.21149 0,-13.50499 l 13.505,6.79153 z" - id="path21577" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1360.1,622.47819 19.2817,0" - id="path21579" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1389.608,622.47819 -13.505,6.71346 c 2.1077,-4.21542 2.1077,-9.21149 0,-13.50498 l 13.505,6.79152 z" - id="path21581" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1448.624,932.9067 19.2817,0" - id="path21583" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,932.23408 -13.505,6.79153 c 2.1077,-4.29349 2.1077,-9.28956 0,-13.50498 l 13.505,6.71345 z" - id="path21585" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1448.624,887.97209 19.2817,0" - id="path21587" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,887.97209 -13.505,6.79152 c 2.1077,-4.29349 2.1077,-9.28955 0,-13.50498 l 0,0 13.505,6.71346 z" - id="path21589" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1448.624,843.78816 19.2817,0" - id="path21591" - style="fill:none;stroke:#000000;stroke-width:1.49599946;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,843.78816 -13.505,6.71346 c 2.1077,-4.21543 2.1077,-9.21149 0,-13.50498 l 13.505,6.79152 z" - id="path21593" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1448.624,799.52617 19.2817,0" - id="path21595" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,799.52617 -13.505,6.71346 c 2.1077,-4.21543 2.1077,-9.21149 0,-13.50498 l 0,0 13.505,6.79152 z" - id="path21597" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1448.624,755.26417 19.2817,0" - id="path21599" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,755.26417 -13.505,6.71346 c 2.1077,-4.21542 2.1077,-9.21149 0,-13.50498 l 13.505,6.79152 z" - id="path21601" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1448.624,711.00218 19.2817,0" - id="path21603" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,711.00218 -13.505,6.71346 c 2.1077,-4.21543 2.1077,-9.21149 0,-13.50498 l 13.505,6.79152 z" - id="path21605" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1448.624,666.74019 19.2817,0" - id="path21607" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,666.74019 -13.505,6.71346 c 2.1077,-4.21543 2.1077,-9.21149 0,-13.50499 l 13.505,6.79153 z" - id="path21609" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1448.624,622.47819 19.2817,0" - id="path21611" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,622.47819 -13.505,6.71346 c 2.1077,-4.21542 2.1077,-9.21149 0,-13.50498 l 13.505,6.79152 z" - id="path21613" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1478.132,917.48009 0,29.50799 29.4299,0 0,-29.50799 -29.4299,0 z" - id="path21615" - style="fill:#c0c0c0;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1478.132,946.98808 29.4299,0 0,-29.50799 -29.4299,0 0,29.50799 z" - id="path21617" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,946.98808 29.4299,-29.50799" - id="path21619" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,917.48009 29.4299,29.50799" - id="path21621" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,873.21809 0,29.508 29.4299,0 0,-29.508 -29.4299,0 z" - id="path21623" - style="fill:#c0c0c0;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1478.132,902.72609 29.4299,0 0,-29.508 -29.4299,0 0,29.508 z" - id="path21625" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,902.72609 29.4299,-29.508" - id="path21627" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,873.21809 29.4299,29.508" - id="path21629" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,829.03416 0,29.42994 29.4299,0 0,-29.42994 -29.4299,0 z" - id="path21631" - style="fill:#c0c0c0;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1478.132,858.4641 29.4299,0 0,-29.42994 -29.4299,0 0,29.42994 z" - id="path21633" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,858.4641 29.4299,-29.42994" - id="path21635" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,829.03416 29.4299,29.42994" - id="path21637" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,784.77217 0,29.508 29.4299,0 0,-29.508 -29.4299,0 z" - id="path21639" - style="fill:#c0c0c0;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1478.132,814.28017 29.4299,0 0,-29.508 -29.4299,0 0,29.508 z" - id="path21641" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,814.28017 29.4299,-29.508" - id="path21643" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,784.77217 29.4299,29.508" - id="path21645" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,740.51018 0,29.50799 29.4299,0 0,-29.50799 -29.4299,0 z" - id="path21647" - style="fill:#c0c0c0;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1478.132,770.01817 29.4299,0 0,-29.50799 -29.4299,0 0,29.50799 z" - id="path21649" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,770.01817 29.4299,-29.50799" - id="path21651" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,740.51018 29.4299,29.50799" - id="path21653" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,696.24818 0,29.508 29.4299,0 0,-29.508 -29.4299,0 z" - id="path21655" - style="fill:#c0c0c0;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1478.132,725.75618 29.4299,0 0,-29.508 -29.4299,0 0,29.508 z" - id="path21657" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,725.75618 29.4299,-29.508" - id="path21659" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,696.24818 29.4299,29.508" - id="path21661" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,651.98619 0,29.508 29.4299,0 0,-29.508 -29.4299,0 z" - id="path21663" - style="fill:#c0c0c0;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1478.132,681.49419 29.4299,0 0,-29.508 -29.4299,0 0,29.508 z" - id="path21665" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,681.49419 29.4299,-29.508" - id="path21667" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,651.98619 29.4299,29.508" - id="path21669" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,607.7242 0,29.50799 29.4299,0 0,-29.50799 -29.4299,0 z" - id="path21671" - style="fill:#c0c0c0;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1478.132,637.23219 29.4299,0 0,-29.50799 -29.4299,0 0,29.50799 z" - id="path21673" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,637.23219 29.4299,-29.50799" - id="path21675" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1478.132,607.7242 29.4299,29.50799" - id="path21677" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <text - x="1516.3051" - y="939.25983" - id="text21679" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">WO</text> - <text - x="1560.0206" - y="939.25983" - id="text21681" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">[</text> - <text - x="1566.2657" - y="939.25983" - id="text21683" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">0</text> - <text - x="1580.0048" - y="939.25983" - id="text21685" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">]</text> - <text - x="1516.3051" - y="895.54425" - id="text21687" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">WO</text> - <text - x="1560.0206" - y="895.54425" - id="text21689" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">[</text> - <text - x="1566.2657" - y="895.54425" - id="text21691" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">1</text> - <text - x="1580.0048" - y="895.54425" - id="text21693" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">]</text> - <text - x="1516.3051" - y="851.82867" - id="text21695" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">WO</text> - <text - x="1560.0206" - y="851.82867" - id="text21697" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">[</text> - <text - x="1566.2657" - y="851.82867" - id="text21699" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">2</text> - <text - x="1580.0048" - y="851.82867" - id="text21701" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">]</text> - <text - x="1516.3051" - y="806.86414" - id="text21703" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">WO</text> - <text - x="1560.0206" - y="806.86414" - id="text21705" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">[</text> - <text - x="1566.2657" - y="806.86414" - id="text21707" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">3</text> - <text - x="1580.0048" - y="806.86414" - id="text21709" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">]</text> - <text - x="1516.3051" - y="763.14856" - id="text21711" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">WO</text> - <text - x="1560.0206" - y="763.14856" - id="text21713" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">[</text> - <text - x="1566.2657" - y="763.14856" - id="text21715" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">4</text> - <text - x="1580.0048" - y="763.14856" - id="text21717" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">]</text> - <text - x="1516.3051" - y="718.18402" - id="text21719" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">WO</text> - <text - x="1560.0206" - y="718.18402" - id="text21721" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">[</text> - <text - x="1566.2657" - y="718.18402" - id="text21723" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">5</text> - <text - x="1580.0048" - y="718.18402" - id="text21725" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">]</text> - <text - x="1516.3051" - y="674.46844" - id="text21727" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">WO</text> - <text - x="1560.0206" - y="674.46844" - id="text21729" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">[</text> - <text - x="1566.2657" - y="674.46844" - id="text21731" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">6</text> - <text - x="1580.0048" - y="674.46844" - id="text21733" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">]</text> - <text - x="1516.3051" - y="629.50391" - id="text21735" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">WO</text> - <text - x="1560.0206" - y="629.50391" - id="text21737" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">[</text> - <text - x="1566.2657" - y="629.50391" - id="text21739" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">7</text> - <text - x="1580.0048" - y="629.50391" - id="text21741" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">]</text> - <path - d="m 1035.5121,430.67622 0,88.52399 103.278,0 0,-88.52399 -103.278,0 z" - id="path21743" - style="fill:#c0c0c0;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1035.5121,519.20021 103.278,0 0,-88.52399 -103.278,0 0,88.52399 z" - id="path21745" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <text - x="1055.4183" - y="467.13187" - id="text21747" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">Event</text> - <text - x="1045.4261" - y="497.10825" - id="text21749" - xml:space="preserve" - style="font-size:24.98031425px;font-style:normal;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">System</text> - <path - d="m 1035.5121,474.93822 -265.49393,0 0,284.85364" - id="path21751" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 770.01817,770.01817 -6.79152,-13.50498 c 4.29349,2.10771 9.28955,2.10771 13.50498,0 l 0,0 -6.71346,13.50498 z" - id="path21753" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <text - x="900.771" - y="347.10092" - id="text21779" - xml:space="preserve" - style="font-size:21.23326683px;font-style:italic;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">"TCCx_EV0"</text> - <path - d="m 780.16642,386.41423 624.19558,0 0,181.57565" - id="path21789" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 770.01817,386.41423 13.42692,-6.71346 c -2.10771,4.21543 -2.10771,9.21149 0,13.50498 l 0,0 -13.42692,-6.79152 z" - id="path21791" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1404.362,578.2162 -6.7915,-13.50498 c 4.2935,2.10771 9.2895,2.10771 13.505,0 l -6.7135,13.50498 z" - id="path21793" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 780.16642,356.90623 653.70358,0 0,211.08365" - id="path21795" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 770.01817,356.90623 13.42692,-6.71346 c -2.10771,4.21543 -2.10771,9.21149 0,13.50499 l -13.42692,-6.79153 z" - id="path21797" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1433.87,578.2162 -6.7915,-13.50498 c 4.2935,2.10771 9.2895,2.10771 13.505,0 l 0,0 -6.7135,13.50498 z" - id="path21799" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1079.7741,430.67622 0,-44.26199" - id="path21801" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1094.5281,430.67622 0,-73.76999" - id="path21803" - style="fill:none;stroke:#000000;stroke-width:1.48320615px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <text - x="897.35315" - y="378.86383" - id="text21779-1" - xml:space="preserve" - style="font-size:21.23326683px;font-style:italic;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">"TCCx_EV1"</text> - <text - x="900.01935" - y="467.17191" - id="text21779-1-7" - xml:space="preserve" - style="font-size:21.23326683px;font-style:italic;font-weight:normal;text-align:start;text-anchor:start;fill:#000000;font-family:Arial">"TCCx_MCx"</text> - <flowRoot - id="flowRoot4320" - xml:space="preserve" - style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"><flowRegion - id="flowRegion4322"><rect - width="14.60575" - height="46.35738" - x="545.65179" - y="518.87262" - id="rect4324" /></flowRegion><flowPara - id="flowPara4326" /></flowRoot> <path - d="m 1205.82,663.94475 -173.146,0" - id="path21471-8" - style="fill:none;stroke:#000000;stroke-width:1.45084238px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1203.989,618.88695 -171.5054,0" - id="path21471-8-8" - style="fill:none;stroke:#000000;stroke-width:1.44395244px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1202.7088,709.00252 -170.0476,0" - id="path21471-8-2" - style="fill:none;stroke:#000000;stroke-width:1.43780196px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1203.806,754.06029 -171.3233,0" - id="path21471-8-4" - style="fill:none;stroke:#000000;stroke-width:1.44318497px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1119.5256,806.77156 82.7262,0" - id="path21503-4-5" - style="fill:none;stroke:#000000;stroke-width:1.55515647;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1119.7321,849.03594 84.7021,0" - id="path21503-4-5-5" - style="fill:none;stroke:#000000;stroke-width:1.55745232;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1119.7426,891.55548 85.6,0" - id="path21503-4-5-1" - style="fill:none;stroke:#000000;stroke-width:1.55847919;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1118.849,934.29139 87.7547,0" - id="path21503-4-5-7" - style="fill:none;stroke:#000000;stroke-width:1.56090248;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1133.4527,785.11918 0,-163.09966" - id="path21803-1" - style="fill:none;stroke:#000000;stroke-width:1.40398824;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1147.8308,827.31498 0,-159.22821" - id="path21803-15" - style="fill:none;stroke:#000000;stroke-width:1.46569908px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1162.1587,869.91868 0,-156.37225" - id="path21803-15-7" - style="fill:none;stroke:#000000;stroke-width:1.43717289px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1176.505,912.76546 0,-154.32872" - id="path21803-15-6" - style="fill:none;stroke:#000000;stroke-width:1.44554079px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1212.8508,619.15195 -13.5051,6.71346 c 2.1858,-4.21543 2.1858,-9.21149 0,-13.50498 l 0,0 13.5051,6.79152 z" - id="path21473-1" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1212.8508,663.29856 -13.5051,6.71346 c 2.1858,-4.21543 2.1858,-9.21149 0,-13.50498 l 0,0 13.5051,6.79152 z" - id="path21473-7" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1212.2994,708.39253 -13.5051,6.71346 c 2.1858,-4.21543 2.1858,-9.21149 0,-13.50498 l 0,0 13.5051,6.79152 z" - id="path21473-4" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1212.1157,753.48648 -13.5051,6.71346 c 2.1858,-4.21543 2.1858,-9.21149 0,-13.50498 l 0,0 13.5051,6.79152 z" - id="path21473-0" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1212.2772,806.84097 -13.5051,6.71346 c 2.1858,-4.21543 2.1858,-9.21149 0,-13.50498 l 0,0 13.5051,6.79152 z" - id="path21473-0-9" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1212.2994,933.67285 -13.5051,6.71346 c 2.1858,-4.21543 2.1858,-9.21149 0,-13.50498 l 0,0 13.5051,6.79152 z" - id="path21473-0-4" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1212.2995,891.264 -13.5051,6.71346 c 2.1858,-4.21543 2.1858,-9.21149 0,-13.50498 l 0,0 13.5051,6.79152 z" - id="path21473-0-8" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1212.3756,848.93196 -13.5051,6.71346 c 2.1858,-4.21543 2.1858,-9.21149 0,-13.50498 l 0,0 13.5051,6.79152 z" - id="path21473-0-82" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1271.6873,756.43118 19.2817,0" - id="path21547-4" - style="fill:none;stroke:#000000;stroke-width:1.49599946;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1301.1953,756.43118 -13.505,6.71346 c 2.1078,-4.21543 2.1078,-9.21149 0,-13.50498 l 0,0 13.505,6.79152 z" - id="path21549-5" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1272.467,712.75506 19.2817,0" - id="path21547-5" - style="fill:none;stroke:#000000;stroke-width:1.49599946;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1301.975,712.75506 -13.505,6.71346 c 2.1078,-4.21543 2.1078,-9.21149 0,-13.50498 l 0,0 13.505,6.79152 z" - id="path21549-1" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1271.9472,668.00713 19.2817,0" - id="path21547-7" - style="fill:none;stroke:#000000;stroke-width:1.49599946;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1301.4552,668.00713 -13.505,6.71346 c 2.1078,-4.21543 2.1078,-9.21149 0,-13.50498 l 0,0 13.505,6.79152 z" - id="path21549-11" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1272.4669,620.31174 19.2817,0" - id="path21547-52" - style="fill:none;stroke:#000000;stroke-width:1.49599946;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1301.9749,620.31174 -13.505,6.71346 c 2.1078,-4.21543 2.1078,-9.21149 0,-13.50498 l 0,0 13.505,6.79152 z" - id="path21549-7" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <g - transform="translate(0,4.9016106)" - id="g3912"> - <path - d="m 971.91819,884.50777 -13.50504,6.79152 c 2.1858,-4.29349 2.1858,-9.28955 0,-13.50498 l 0,0 13.50504,6.71346 z" - id="path21481" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 939.61578,884.18204 21.16083,0" - id="path21551-6" - style="fill:none;stroke:#000000;stroke-width:1.55380034px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - </g> - <g - transform="translate(-0.5197847,4.8231295)" - id="g3908"> - <path - d="m 972.28565,929.52763 -13.50496,6.79153 c 2.1858,-4.29349 2.1858,-9.28956 0,-13.50498 l 13.50496,6.71345 z" - id="path21485" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 939.95097,929.46547 20.30668,0" - id="path21551-1" - style="fill:none;stroke:#000000;stroke-width:1.52211797px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - </g> - <g - id="g3920"> - <path - d="m 972.11087,843.97763 -13.50499,6.71346 c 2.1858,-4.21543 2.1858,-9.21149 0,-13.50498 l 13.50499,6.79152 z" - id="path21477" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 961.22563,844.50701 -131.67954,0" - id="path21471-2" - style="fill:none;stroke:#000000;stroke-width:1.54821098;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> - </g> - <g - transform="translate(0,-8.5744493)" - id="g3892"> - <path - d="m 1032.4854,809.26303 20.4269,0" - id="path21503-4" - style="fill:none;stroke:#000000;stroke-width:1.42498088;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1059.1823,809.4856 -13.505,6.71346 c 2.1858,-4.21543 2.1858,-9.21149 0,-13.50498 l 13.505,6.79152 z" - id="path21477-1" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - </g> - <g - transform="translate(0,-8.3065041)" - id="g3896"> - <path - d="m 1031.5608,853.92654 20.4269,0" - id="path21503-4-4" - style="fill:none;stroke:#000000;stroke-width:1.42498088;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1059.4421,853.69762 -13.505,6.71346 c 2.1858,-4.21543 2.1858,-9.21149 0,-13.50498 l 13.505,6.79152 z" - id="path21477-7" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - </g> - <g - transform="translate(0,-7.7705911)" - id="g3900"> - <path - d="m 1031.8206,897.87061 20.4269,0" - id="path21503-4-2" - style="fill:none;stroke:#000000;stroke-width:1.42498088;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1059.4421,897.64169 -13.505,6.71346 c 2.1858,-4.21543 2.1858,-9.21149 0,-13.50498 l 13.505,6.79152 z" - id="path21477-4" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - </g> - <g - transform="translate(0,-8.5744525)" - id="g3904"> - <path - d="m 1031.8206,942.61854 20.4269,0" - id="path21503-4-3" - style="fill:none;stroke:#000000;stroke-width:1.42498088;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1059.702,942.92552 -13.505,6.71346 c 2.1858,-4.21543 2.1858,-9.21149 0,-13.50498 l 13.505,6.79152 z" - id="path21477-0" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - </g> - <path - d="m 1133.2705,619.35085 6.5115,13.9239 c -4.0886,-2.25358 -8.9344,-2.25358 -13.0987,0 l 0,0 6.5872,-13.9239 z" - id="path21473-1-1" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1147.6967,664.53954 6.5115,13.9239 c -4.0886,-2.25358 -8.9344,-2.25358 -13.0987,0 l 0,0 6.5872,-13.9239 z" - id="path21473-1-1-4" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1162.0309,709.6335 6.5115,13.9239 c -4.0886,-2.25358 -8.9344,-2.25358 -13.0987,0 l 0,0 6.5872,-13.9239 z" - id="path21473-1-1-0" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1176.4569,754.63273 6.5115,13.9239 c -4.0886,-2.25358 -8.9344,-2.25358 -13.0987,0 l 0,0 6.5872,-13.9239 z" - id="path21473-1-1-9" - style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:none" /> - <path - d="m 1119.5366,912.92282 56.7957,0" - id="path21543-4" - style="fill:none;stroke:#000000;stroke-width:1.56713641px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1119.3663,870.29545 42.6183,0" - id="path21543-4-8" - style="fill:none;stroke:#000000;stroke-width:1.35752261px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1118.9023,827.54528 28.3852,0" - id="path21543-4-82" - style="fill:none;stroke:#000000;stroke-width:1.44087696px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - <path - d="m 1119.2803,785.47341 13.9382,0" - id="path21543-4-4" - style="fill:none;stroke:#000000;stroke-width:1.4359076px;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-dasharray:none" /> - </g> - </g> -</svg> diff --git a/atmel-samd/asf/sam0/drivers/tcc/docimg/pwm_match_ex.svg b/atmel-samd/asf/sam0/drivers/tcc/docimg/pwm_match_ex.svg deleted file mode 100644 index dbce68d31..000000000 --- a/atmel-samd/asf/sam0/drivers/tcc/docimg/pwm_match_ex.svg +++ /dev/null @@ -1,1464 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> - -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="581.41901" - height="318.89764" - id="svg2" - version="1.1" - inkscape:version="0.48.4 r9939" - sodipodi:docname="pwm_match_ex.svg"> - <defs - id="defs4"> - <font - horiz-adv-x="2048" - id="EmbeddedFont_1" - horiz-origin-x="0" - horiz-origin-y="0" - vert-origin-x="45" - vert-origin-y="90" - vert-adv-y="90"> - <font-face - id="font-face2990" - descent="450" - ascent="1852" - font-style="normal" - font-weight="normal" - units-per-em="2048" - font-family="Arial" /> - <missing-glyph - id="missing-glyph2992" - d="M 0,0 L 2047,0 2047,2047 0,2047 0,0 Z" - horiz-adv-x="2048" /> - <glyph - id="glyph2994" - d="M 15,0 L 403,552 44,1062 269,1062 432,813 C 463,766 487,726 506,694 535,738 562,777 587,811 L 766,1062 981,1062 614,562 1009,0 788,0 570,330 512,419 233,0 15,0 Z" - horiz-adv-x="954" - unicode="x" /> - <glyph - id="glyph2996" - d="M 331,0 L 6,1062 192,1062 361,449 424,221 C 427,232 445,305 479,440 L 648,1062 833,1062 992,446 1045,243 1106,448 1288,1062 1463,1062 1131,0 944,0 775,636 734,817 519,0 331,0 Z" - horiz-adv-x="1430" - unicode="w" /> - <glyph - id="glyph2998" - d="M 430,0 L 26,1062 216,1062 444,426 C 469,357 491,286 512,212 528,268 550,335 579,414 L 815,1062 1000,1062 598,0 430,0 Z" - horiz-adv-x="954" - unicode="v" /> - <glyph - id="glyph3000" - d="M 831,0 L 831,156 C 748,36 636,-24 494,-24 431,-24 373,-12 319,12 264,36 224,66 198,103 171,139 153,183 142,236 135,271 131,327 131,404 L 131,1062 311,1062 311,473 C 311,379 315,316 322,283 333,236 357,199 394,172 431,145 476,131 530,131 584,131 635,145 682,173 729,200 763,238 783,286 802,333 812,402 812,493 L 812,1062 992,1062 992,0 831,0 Z" - horiz-adv-x="848" - unicode="u" /> - <glyph - id="glyph3002" - d="M 528,161 L 554,2 C 503,-9 458,-14 418,-14 353,-14 302,-4 266,17 230,38 205,65 190,99 175,132 168,203 168,311 L 168,922 36,922 36,1062 168,1062 168,1325 347,1433 347,1062 528,1062 528,922 347,922 347,301 C 347,250 350,217 357,202 363,187 373,176 388,167 402,158 422,154 449,154 469,154 495,156 528,161 Z" - horiz-adv-x="504" - unicode="t" /> - <glyph - id="glyph3004" - d="M 63,317 L 241,345 C 251,274 279,219 325,181 370,143 434,124 516,124 599,124 660,141 700,175 740,208 760,248 760,293 760,334 742,366 707,389 682,405 621,425 523,450 391,483 300,512 249,537 198,561 159,595 133,638 106,681 93,728 93,780 93,827 104,871 126,912 147,952 177,985 214,1012 242,1033 280,1050 329,1065 377,1079 429,1086 484,1086 567,1086 641,1074 704,1050 767,1026 813,994 843,953 873,912 894,857 905,788 L 729,764 C 721,819 698,861 660,892 621,923 567,938 497,938 414,938 355,924 320,897 285,870 267,838 267,801 267,778 274,757 289,738 304,719 327,703 358,690 376,683 429,668 517,644 644,610 733,582 784,561 834,539 873,507 902,466 931,425 945,373 945,312 945,252 928,196 893,143 858,90 807,49 741,20 675,-9 600,-24 517,-24 379,-24 274,5 202,62 129,119 83,204 63,317 Z" - horiz-adv-x="874" - unicode="s" /> - <glyph - id="glyph3006" - d="M 133,0 L 133,1062 295,1062 295,901 C 336,976 375,1026 410,1050 445,1074 483,1086 525,1086 586,1086 647,1067 710,1028 L 648,861 C 604,887 560,900 516,900 477,900 441,888 410,865 379,841 356,808 343,766 323,702 313,632 313,556 L 313,0 133,0 Z" - horiz-adv-x="557" - unicode="r" /> - <glyph - id="glyph3008" - d="M 135,-407 L 135,1062 299,1062 299,924 C 338,978 381,1019 430,1046 479,1073 538,1086 607,1086 698,1086 778,1063 847,1016 916,969 969,904 1004,819 1039,734 1057,640 1057,539 1057,430 1038,333 999,246 960,159 903,92 829,46 754,-1 676,-24 594,-24 534,-24 480,-11 433,14 385,39 346,71 315,110 L 315,-407 135,-407 Z M 298,525 C 298,388 326,287 381,222 436,157 503,124 582,124 662,124 731,158 788,226 845,293 873,398 873,540 873,675 845,777 790,844 734,911 667,945 590,945 513,945 446,909 387,838 328,766 298,662 298,525 Z" - horiz-adv-x="901" - unicode="p" /> - <glyph - id="glyph3010" - d="M 68,531 C 68,728 123,873 232,968 323,1047 435,1086 566,1086 712,1086 831,1038 924,943 1017,847 1063,715 1063,546 1063,409 1043,302 1002,224 961,145 901,84 823,41 744,-2 659,-24 566,-24 417,-24 297,24 206,119 114,214 68,352 68,531 Z M 253,531 C 253,395 283,293 342,226 401,158 476,124 566,124 655,124 730,158 789,226 848,294 878,398 878,537 878,668 848,768 789,836 729,903 655,937 566,937 476,937 401,903 342,836 283,769 253,667 253,531 Z" - horiz-adv-x="980" - unicode="o" /> - <glyph - id="glyph3012" - d="M 135,0 L 135,1062 297,1062 297,911 C 375,1028 488,1086 635,1086 699,1086 758,1075 812,1052 865,1029 905,998 932,961 959,924 977,879 988,828 995,795 998,736 998,653 L 998,0 818,0 818,646 C 818,719 811,774 797,811 783,847 758,876 723,898 687,919 645,930 597,930 520,930 454,906 399,857 343,808 315,716 315,580 L 315,0 135,0 Z" - horiz-adv-x="848" - unicode="n" /> - <glyph - id="glyph3014" - d="M 135,0 L 135,1062 296,1062 296,913 C 329,965 374,1007 429,1039 484,1070 547,1086 618,1086 697,1086 761,1070 812,1037 862,1004 897,959 918,900 1002,1024 1111,1086 1246,1086 1351,1086 1432,1057 1489,999 1546,940 1574,850 1574,729 L 1574,0 1395,0 1395,669 C 1395,741 1389,793 1378,825 1366,856 1345,882 1314,901 1283,920 1247,930 1206,930 1131,930 1069,905 1020,856 971,806 946,726 946,617 L 946,0 766,0 766,690 C 766,770 751,830 722,870 693,910 645,930 578,930 527,930 481,917 438,890 395,863 363,824 344,773 325,722 315,648 315,551 L 315,0 135,0 Z" - horiz-adv-x="1457" - unicode="m" /> - <glyph - id="glyph3016" - d="M 131,0 L 131,1466 311,1466 311,0 131,0 Z" - horiz-adv-x="186" - unicode="l" /> - <glyph - id="glyph3018" - d="M 136,1259 L 136,1466 316,1466 316,1259 136,1259 Z M 136,0 L 136,1062 316,1062 316,0 136,0 Z" - horiz-adv-x="160" - unicode="i" /> - <glyph - id="glyph3020" - d="M 135,0 L 135,1466 315,1466 315,940 C 399,1037 505,1086 633,1086 712,1086 780,1071 838,1040 896,1009 938,966 963,911 988,856 1000,777 1000,673 L 1000,0 820,0 820,673 C 820,763 801,829 762,870 723,911 667,931 596,931 543,931 493,917 446,890 399,862 365,824 345,777 325,730 315,664 315,581 L 315,0 135,0 Z" - horiz-adv-x="848" - unicode="h" /> - <glyph - id="glyph3022" - d="M 102,-88 L 277,-114 C 284,-168 305,-207 338,-232 383,-265 444,-282 521,-282 604,-282 669,-265 714,-232 759,-199 790,-152 806,-92 815,-55 820,22 819,139 740,46 642,0 525,0 379,0 266,53 186,158 106,263 66,390 66,537 66,638 84,732 121,818 158,903 211,969 281,1016 350,1063 432,1086 526,1086 651,1086 755,1035 836,934 L 836,1062 1002,1062 1002,144 C 1002,-21 985,-138 952,-207 918,-276 865,-331 792,-371 719,-411 629,-431 522,-431 395,-431 293,-402 215,-345 137,-288 99,-203 102,-88 Z M 251,550 C 251,411 279,309 334,245 389,181 459,149 542,149 625,149 694,181 750,245 806,308 834,408 834,544 834,674 805,772 748,838 690,904 620,937 539,937 459,937 391,905 335,840 279,775 251,678 251,550 Z" - horiz-adv-x="927" - unicode="g" /> - <glyph - id="glyph3024" - d="M 862,342 L 1048,319 C 1019,210 964,126 885,66 806,6 704,-24 581,-24 426,-24 303,24 212,120 121,215 75,349 75,522 75,701 121,839 213,938 305,1037 424,1086 571,1086 713,1086 829,1038 919,941 1009,844 1054,708 1054,533 1054,522 1054,506 1053,485 L 261,485 C 268,368 301,279 360,217 419,155 493,124 582,124 648,124 704,141 751,176 798,211 835,266 862,342 Z M 271,633 L 864,633 C 856,722 833,789 796,834 739,903 664,938 573,938 490,938 421,910 365,855 308,800 277,726 271,633 Z" - horiz-adv-x="980" - unicode="e" /> - <glyph - id="glyph3026" - d="M 824,0 L 824,134 C 757,29 658,-24 527,-24 442,-24 365,-1 294,46 223,93 168,158 129,242 90,325 70,421 70,530 70,636 88,732 123,819 158,905 211,971 282,1017 353,1063 432,1086 519,1086 583,1086 640,1073 690,1046 740,1019 781,983 812,940 L 812,1466 991,1466 991,0 824,0 Z M 255,530 C 255,394 284,292 341,225 398,158 466,124 544,124 623,124 690,156 745,221 800,285 827,383 827,515 827,660 799,767 743,835 687,903 618,937 536,937 456,937 389,904 336,839 282,774 255,671 255,530 Z" - horiz-adv-x="927" - unicode="d" /> - <glyph - id="glyph3028" - d="M 828,389 L 1005,366 C 986,244 936,149 857,80 777,11 679,-24 563,-24 418,-24 301,24 213,119 124,214 80,350 80,527 80,642 99,742 137,828 175,914 233,979 311,1022 388,1065 473,1086 564,1086 679,1086 774,1057 847,999 920,940 967,857 988,750 L 813,723 C 796,794 767,848 725,884 682,920 631,938 571,938 480,938 407,906 350,841 293,776 265,673 265,532 265,389 292,286 347,221 402,156 473,124 561,124 632,124 691,146 738,189 785,232 815,299 828,389 Z" - horiz-adv-x="927" - unicode="c" /> - <glyph - id="glyph3030" - d="M 301,0 L 134,0 134,1466 314,1466 314,943 C 390,1038 487,1086 605,1086 670,1086 732,1073 791,1047 849,1020 897,983 935,936 972,888 1002,830 1023,763 1044,696 1055,624 1055,547 1055,365 1010,224 920,125 830,26 722,-24 596,-24 471,-24 372,28 301,133 L 301,0 Z M 299,539 C 299,412 316,320 351,263 408,170 484,124 581,124 660,124 728,158 785,227 842,295 871,397 871,532 871,671 844,773 789,839 734,905 667,938 589,938 510,938 442,904 385,836 328,767 299,668 299,539 Z" - horiz-adv-x="901" - unicode="b" /> - <glyph - id="glyph3032" - d="M 828,131 C 761,74 697,34 636,11 574,-12 508,-24 437,-24 320,-24 231,5 168,62 105,119 74,191 74,280 74,332 86,380 110,423 133,466 164,500 203,526 241,552 284,572 332,585 367,594 421,603 492,612 637,629 744,650 813,674 814,699 814,714 814,721 814,794 797,846 763,876 717,917 649,937 558,937 473,937 411,922 371,893 330,863 300,810 281,735 L 105,759 C 121,834 147,895 184,942 221,988 274,1024 343,1049 412,1074 493,1086 584,1086 675,1086 748,1075 805,1054 862,1033 903,1006 930,974 957,941 975,900 986,851 992,820 995,765 995,685 L 995,445 C 995,278 999,172 1007,128 1014,83 1029,41 1052,0 L 864,0 C 845,37 833,81 828,131 Z M 813,533 C 748,506 650,484 519,465 445,454 393,442 362,429 331,416 308,396 291,371 274,345 266,316 266,285 266,237 284,197 321,165 357,133 410,117 480,117 549,117 611,132 665,163 719,193 759,234 784,287 803,328 813,388 813,467 L 813,533 Z" - horiz-adv-x="980" - unicode="a" /> - <glyph - id="glyph3034" - d="M -31,-407 L -31,-277 1162,-277 1162,-407 -31,-407 Z" - horiz-adv-x="1192" - unicode="_" /> - <glyph - id="glyph3036" - d="M 414,0 L 25,1466 224,1466 447,505 C 471,404 492,304 509,205 546,362 568,452 575,476 L 854,1466 1088,1466 1298,724 C 1351,540 1389,367 1412,205 1431,298 1455,404 1485,524 L 1715,1466 1910,1466 1508,0 1321,0 1012,1117 C 986,1210 971,1268 966,1289 951,1222 936,1164 923,1117 L 612,0 414,0 Z" - horiz-adv-x="1986" - unicode="W" /> - <glyph - id="glyph3038" - d="M 531,0 L 531,1293 48,1293 48,1466 1210,1466 1210,1293 725,1293 725,0 531,0 Z" - horiz-adv-x="1166" - unicode="T" /> - <glyph - id="glyph3040" - d="M 161,0 L 161,1466 811,1466 C 942,1466 1041,1453 1109,1427 1177,1400 1231,1354 1272,1287 1313,1220 1333,1147 1333,1066 1333,962 1299,874 1232,803 1165,732 1061,686 920,667 971,642 1010,618 1037,594 1094,542 1147,477 1198,399 L 1453,0 1209,0 1015,305 C 958,393 912,460 875,507 838,554 806,586 777,605 748,624 718,637 688,644 666,649 630,651 580,651 L 355,651 355,0 161,0 Z M 355,819 L 772,819 C 861,819 930,828 980,847 1030,865 1068,894 1094,935 1120,975 1133,1019 1133,1066 1133,1135 1108,1192 1058,1237 1007,1282 928,1304 819,1304 L 355,1304 355,819 Z" - horiz-adv-x="1271" - unicode="R" /> - <glyph - id="glyph3042" - d="M 158,0 L 158,1466 711,1466 C 808,1466 883,1461 934,1452 1006,1440 1066,1417 1115,1384 1164,1350 1203,1303 1233,1242 1262,1181 1277,1115 1277,1042 1277,917 1237,812 1158,726 1079,639 935,596 728,596 L 352,596 352,0 158,0 Z M 352,769 L 731,769 C 856,769 945,792 998,839 1051,886 1077,951 1077,1036 1077,1097 1062,1150 1031,1194 1000,1237 959,1266 908,1280 875,1289 815,1293 727,1293 L 352,1293 352,769 Z" - horiz-adv-x="1113" - unicode="P" /> - <glyph - id="glyph3044" - d="M 99,714 C 99,957 164,1148 295,1286 426,1423 594,1492 801,1492 936,1492 1058,1460 1167,1395 1276,1330 1359,1240 1416,1125 1473,1009 1501,878 1501,731 1501,582 1471,449 1411,332 1351,215 1266,126 1156,66 1046,5 927,-25 800,-25 662,-25 539,8 430,75 321,142 239,233 183,348 127,463 99,585 99,714 Z M 299,711 C 299,534 347,395 442,294 537,192 656,141 799,141 945,141 1065,192 1160,295 1254,398 1301,543 1301,732 1301,851 1281,956 1241,1045 1200,1134 1141,1203 1064,1252 986,1301 899,1325 802,1325 665,1325 547,1278 448,1184 349,1089 299,932 299,711 Z" - horiz-adv-x="1404" - unicode="O" /> - <glyph - id="glyph3046" - d="M 152,0 L 152,1466 444,1466 791,428 C 823,331 846,259 861,211 878,264 904,343 939,446 L 1290,1466 1551,1466 1551,0 1364,0 1364,1227 938,0 763,0 339,1248 339,0 152,0 Z" - horiz-adv-x="1377" - unicode="M" /> - <glyph - id="glyph3048" - d="M 1204,514 L 1398,465 C 1357,306 1284,184 1179,101 1073,17 944,-25 791,-25 633,-25 505,7 406,72 307,136 231,229 180,351 128,473 102,604 102,744 102,897 131,1030 190,1144 248,1257 331,1344 439,1403 546,1462 665,1491 794,1491 941,1491 1064,1454 1164,1379 1264,1304 1334,1199 1373,1064 L 1182,1019 C 1148,1126 1099,1203 1034,1252 969,1301 888,1325 790,1325 677,1325 583,1298 508,1244 432,1190 379,1118 348,1027 317,936 302,842 302,745 302,620 320,512 357,419 393,326 449,256 526,210 603,164 686,141 775,141 884,141 976,172 1051,235 1126,298 1177,391 1204,514 Z" - horiz-adv-x="1298" - unicode="C" /> - <glyph - id="glyph3050" - d="M 253,-431 L 124,-431 C 323,-111 423,209 423,530 423,655 409,780 380,903 357,1003 326,1099 285,1191 259,1251 205,1351 124,1491 L 253,1491 C 378,1324 471,1156 531,987 582,842 608,690 608,531 608,351 574,177 505,9 436,-159 352,-306 253,-431 Z" - horiz-adv-x="477" - unicode=")" /> - <glyph - id="glyph3052" - d="M 479,-431 C 380,-306 296,-159 227,9 158,177 124,351 124,531 124,690 150,842 201,987 261,1156 354,1324 479,1491 L 608,1491 C 527,1352 474,1253 448,1194 407,1102 375,1006 352,906 323,781 309,656 309,530 309,209 409,-111 608,-431 L 479,-431 Z" - horiz-adv-x="478" - unicode="(" /> - <glyph - id="glyph3054" - horiz-adv-x="556" - unicode=" " /> - </font> - </defs> - <sodipodi:namedview - id="base" - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1.0" - inkscape:pageopacity="0.0" - inkscape:pageshadow="2" - inkscape:zoom="1.979899" - inkscape:cx="305.84649" - inkscape:cy="179.82498" - inkscape:document-units="px" - inkscape:current-layer="layer1" - showgrid="false" - inkscape:window-width="1366" - inkscape:window-height="716" - inkscape:window-x="1592" - inkscape:window-y="33" - inkscape:window-maximized="1" - fit-margin-top="0" - fit-margin-left="0" - fit-margin-right="0" - fit-margin-bottom="0" /> - <metadata - id="metadata7"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title /> - </cc:Work> - </rdf:RDF> - </metadata> - <g - inkscape:label="Layer 1" - inkscape:groupmode="layer" - id="layer1" - transform="translate(-185.10687,-464.34194)"> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - visibility="visible" - id="MasterSlide_1_Default" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <desc - id="desc3057">Master slide - </desc> - <rect - style="fill:none;stroke:none" - x="0" - y="0" - width="16000" - height="9000" - id="rect3059" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3062" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - id="path3064" - d="m 2600,5382 0,-3650" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000" /> - <path - d="m 2600,1282 -187,563 375,0 -188,-563 z" - id="Drawing_1_0" - inkscape:connector-curvature="0" - style="fill:#000000;stroke:none" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3067" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - id="path3069" - d="m 2600,5382 11250,0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000" /> - <path - d="m 14300,5382 -562,-187 0,375 562,-188 z" - id="Drawing_2_0" - inkscape:connector-curvature="0" - style="fill:#000000;stroke:none" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="Drawing_3" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <rect - id="rect3073" - height="641" - width="1301" - y="5682" - x="13200" - style="fill:none;stroke:none" /> - <g - id="g3075" - font-weight="400" - font-style="normal" - font-size="353" - style="font-size:353px;font-style:normal;font-weight:400;fill:#000000;stroke:none;font-family:Arial"> - <text - id="text3077" - y="6120" - x="13450">T</text> - <text - id="text3079" - y="6120" - x="13657">i</text> - <text - id="text3081" - y="6120" - x="13734">m</text> - <text - id="text3083" - y="6120" - x="14034">e</text> - </g> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3085" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 3100,5382 0,-2500" - id="Drawing_4_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3088" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="M 3100,5382 2600,4882" - id="Drawing_5_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3091" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 5600,5382 0,-3000" - id="Drawing_6_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3094" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="M 8601,5381 5601,2383" - id="Drawing_7_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3097" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="M 13600,5381 12600,4382" - id="Drawing_8_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3100" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 2600,2382 11400,0" - id="Drawing_9_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:30;stroke-linejoin:round;stroke-dasharray:508, 508, 508, 508" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3146" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 8600,5382 0,-2000" - id="Drawing_11_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3149" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="M 9601,4383 8601,3383" - id="Drawing_12_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3152" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 9601,4382 0,-2000" - id="Drawing_13_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3155" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="M 12602,5383 9601,2382" - id="Drawing_14_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3158" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 12600,5382 0,-1000" - id="Drawing_15_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="Drawing_16" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,458.34194)"> - <rect - id="rect3162" - height="641" - width="4401" - y="6542" - x="6000" - style="fill:none;stroke:none" /> - <g - id="g3164" - font-weight="400" - font-style="normal" - font-size="353" - style="font-size:353px;font-style:normal;font-weight:400;fill:#000000;stroke:none;font-family:Arial"> - <text - id="text3166" - y="6980" - x="6250">R</text> - <text - id="text3168" - y="6980" - x="6504">e</text> - <text - id="text3170" - y="6980" - x="6699">l</text> - <text - id="text3172" - y="6980" - x="6775">o</text> - <text - id="text3174" - y="6980" - x="6970">a</text> - <text - id="text3176" - y="6980" - x="7164">d</text> - <text - id="text3178" - y="6980" - x="7359" /> - <text - id="text3180" - y="6980" - x="7457">t</text> - <text - id="text3182" - y="6980" - x="7554">o</text> - <text - id="text3184" - y="6980" - x="7749" /> - <text - id="text3186" - y="6980" - x="7842">T</text> - <text - id="text3188" - y="6980" - x="8058">O</text> - <text - id="text3190" - y="6980" - x="8333">P</text> - <text - id="text3192" - y="6980" - x="8561" /> - <text - id="text3194" - y="6980" - x="8659">v</text> - <text - id="text3196" - y="6980" - x="8832">a</text> - <text - id="text3198" - y="6980" - x="9027">l</text> - <text - id="text3200" - y="6980" - x="9103">u</text> - <text - id="text3202" - y="6980" - x="9298">e</text> - </g> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3204" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - id="path3206" - d="m 8400,6482 119,-594" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000" /> - <path - d="m 8600,5482 -271,474 339,67 -68,-541 z" - id="Drawing_17_0" - inkscape:connector-curvature="0" - style="fill:#000000;stroke:none" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3209" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - id="path3211" - d="m 9600,6682 2317,-944" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000" /> - <path - d="m 12300,5582 -544,36 130,319 414,-355 z" - id="Drawing_18_0" - inkscape:connector-curvature="0" - style="fill:#000000;stroke:none" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3214" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - id="path3216" - d="m 9700,2282 842,-491" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000" /> - <path - d="m 10900,1582 -534,112 174,298 360,-410 z" - id="Drawing_19_0" - inkscape:connector-curvature="0" - style="fill:#000000;stroke:none" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="Drawing_20" - transform="matrix(0.03543307,0,0,0.03543307,175.10687,464.34194)"> - <rect - id="rect3220" - height="1030" - width="4150" - y="553" - x="10651" - style="fill:none;stroke:none" /> - <g - id="g3222" - font-weight="400" - font-style="normal" - font-size="353" - style="font-size:353px;font-style:normal;font-weight:400;fill:#000000;stroke:none;font-family:Arial"> - <text - id="text3224" - y="991" - x="10901">C</text> - <text - id="text3226" - y="991" - x="11155">o</text> - <text - id="text3228" - y="991" - x="11350">u</text> - <text - id="text3230" - y="991" - x="11544">n</text> - <text - id="text3232" - y="991" - x="11739">t</text> - <text - id="text3234" - y="991" - x="11837" /> - <text - id="text3236" - y="991" - x="11934">i</text> - <text - id="text3238" - y="991" - x="12010">s</text> - <text - id="text3240" - y="991" - x="12188" /> - <text - id="text3242" - y="991" - x="12285">w</text> - <text - id="text3244" - y="991" - x="12535">r</text> - <text - id="text3246" - y="991" - x="12654">i</text> - <text - id="text3248" - y="991" - x="12730">t</text> - <text - id="text3250" - y="991" - x="12827">t</text> - <text - id="text3252" - y="991" - x="12925">e</text> - <text - id="text3254" - y="991" - x="13119">n</text> - <text - id="text3256" - y="991" - x="13314" /> - <text - id="text3268" - y="991" - x="14250" /> - </g> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3310" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - id="path3312" - d="m 5800,2182 352,-469" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000" /> - <path - d="m 6400,1382 -448,311 276,207 172,-518 z" - id="Drawing_21_0" - inkscape:connector-curvature="0" - style="fill:#000000;stroke:none" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3315" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - id="path3317" - d="M 8300,2982 7519,1733" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000" /> - <path - d="m 7300,1382 128,530 293,-183 -421,-347 z" - id="Drawing_22_0" - inkscape:connector-curvature="0" - style="fill:#000000;stroke:none" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="Drawing_23" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <rect - id="rect3321" - height="1030" - width="5601" - y="482" - x="4500" - style="fill:none;stroke:none" /> - <g - id="g3323" - font-weight="400" - font-style="normal" - font-size="353" - style="font-size:353px;font-style:normal;font-weight:400;fill:#000000;stroke:none;font-family:Arial"> - <text - id="text3325" - y="920" - x="4750">T</text> - <text - id="text3327" - y="920" - x="4966">O</text> - <text - id="text3329" - y="920" - x="5241">P</text> - <text - id="text3331" - y="920" - x="5470" /> - <text - id="text3333" - y="920" - x="5567">v</text> - <text - id="text3335" - y="920" - x="5741">a</text> - <text - id="text3337" - y="920" - x="5935">l</text> - <text - id="text3339" - y="920" - x="6012">u</text> - <text - id="text3341" - y="920" - x="6206">e</text> - <text - id="text3343" - y="920" - x="6401" /> - <text - id="text3345" - y="920" - x="6498">h</text> - <text - id="text3347" - y="920" - x="6693">a</text> - <text - id="text3349" - y="920" - x="6888">s</text> - <text - id="text3351" - y="920" - x="7066" /> - <text - id="text3353" - y="920" - x="7163">b</text> - <text - id="text3355" - y="920" - x="7358">e</text> - <text - id="text3357" - y="920" - x="7552">e</text> - <text - id="text3359" - y="920" - x="7747">n</text> - <text - id="text3361" - y="920" - x="7942" /> - <text - id="text3363" - y="920" - x="8039">c</text> - <text - id="text3365" - y="920" - x="8217">h</text> - <text - id="text3367" - y="920" - x="8412">a</text> - <text - id="text3369" - y="920" - x="8607">n</text> - <text - id="text3371" - y="920" - x="8801">g</text> - <text - id="text3373" - y="920" - x="8996">e</text> - <text - id="text3375" - y="920" - x="9191">d</text> - <text - id="text3377" - y="920" - x="9386" /> - <text - id="text3389" - y="1309" - x="5588" /> - </g> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3427" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 2600,4882 11600,0" - id="Drawing_24_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:100;stroke-linejoin:round;stroke-dasharray:197, 197" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3430" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 3100,8407 2000,0" - id="Drawing_25_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3433" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 5100,7407 0,1000" - id="Drawing_26_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3436" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 5100,7407 500,0" - id="Drawing_27_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3439" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 5600,7407 0,1000" - id="Drawing_28_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3442" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 5600,8407 2000,0" - id="Drawing_29_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3445" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 7600,7407 0,1000" - id="Drawing_30_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3448" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 7600,7407 500,0" - id="Drawing_31_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3451" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 8100,7407 0,1000" - id="Drawing_32_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3454" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 12100,7407 0,1000" - id="Drawing_33_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3457" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 12100,7407 500,0" - id="Drawing_34_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3460" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 12600,7407 0,1000" - id="Drawing_35_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3463" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 13100,7407 0,1000" - id="Drawing_36_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3466" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 13100,7407 500,0" - id="Drawing_37_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3469" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 13600,7407 0,1000" - id="Drawing_38_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3472" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 8100,8407 4000,0" - id="Drawing_39_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3475" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 4953,4649 250,433" - id="Drawing_40_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3478" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 5300,4742 -433,250" - id="Drawing_41_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3481" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 7986,4682 250,433" - id="Drawing_42_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3484" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 8333,4775 -433,250" - id="Drawing_43_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3487" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 11986,4649 250,433" - id="Drawing_44_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3490" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 12333,4742 -433,250" - id="Drawing_45_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3493" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 12986,4682 250,433" - id="Drawing_46_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3496" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 13333,4775 -433,250" - id="Drawing_47_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - id="g4702"> - <g - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)" - id="g3499" - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible"> - <path - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" - inkscape:connector-curvature="0" - id="Drawing_48_0" - d="m 12853,6453 250,433" /> - </g> - <g - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)" - id="g3502" - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible"> - <path - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" - inkscape:connector-curvature="0" - id="Drawing_49_0" - d="m 13200,6546 -433,250" /> - </g> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="Drawing_50" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <rect - id="rect3506" - height="641" - width="1701" - y="6413" - x="13200" - style="fill:none;stroke:none" /> - <g - id="g3508" - font-weight="400" - font-style="normal" - font-size="353" - style="font-size:353px;font-style:normal;font-weight:400;fill:#000000;stroke:none;font-family:Arial"> - <text - id="text3510" - y="6851" - x="13450">M</text> - <text - id="text3512" - y="6851" - x="13742">a</text> - <text - id="text3514" - y="6851" - x="13937">t</text> - <text - id="text3516" - y="6851" - x="14034">c</text> - <text - id="text3518" - y="6851" - x="14212">h</text> - </g> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3520" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 12600,8407 500,0" - id="Drawing_51_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="Drawing_52" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <rect - id="rect3524" - height="1419" - width="2601" - y="7182" - x="600" - style="fill:none;stroke:none" /> - <g - id="g3526" - font-weight="400" - font-style="normal" - font-size="353" - style="font-size:353px;font-style:normal;font-weight:400;fill:#000000;stroke:none;font-family:Arial"> - <text - id="text3528" - y="7620" - x="850">P</text> - <text - id="text3530" - y="7620" - x="1083">W</text> - <text - id="text3532" - y="7620" - x="1434">M</text> - <text - id="text3534" - y="7620" - x="1726" /> - <text - id="text3536" - y="8009" - x="850" - style="fill:#000000;stroke:none">i</text> - <text - id="text3538" - y="8009" - x="926">n</text> - <text - id="text3540" - y="8009" - x="1121">v</text> - <text - id="text3542" - y="8009" - x="1295">e</text> - <text - id="text3544" - y="8009" - x="1489">r</text> - <text - id="text3546" - y="8009" - x="1608">t</text> - <text - id="text3548" - y="8009" - x="1705">e</text> - <text - id="text3550" - y="8009" - x="1900">d</text> - <text - id="text3552" - y="8009" - x="2095" /> - <text - id="text3554" - y="8398" - x="850" - style="fill:#000000;stroke:none">o</text> - <text - id="text3556" - y="8398" - x="1045">u</text> - <text - id="text3558" - y="8398" - x="1239">t</text> - <text - id="text3560" - y="8398" - x="1337">p</text> - <text - id="text3562" - y="8398" - x="1532">u</text> - <text - id="text3564" - y="8398" - x="1726">t</text> - </g> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="Drawing_53" - transform="matrix(0.03543307,0,0,0.03543307,220.82115,475.77051)"> - <rect - id="rect3567" - height="641" - width="2101" - y="1742" - x="13300" - style="fill:none;stroke:none" /> - <g - id="g3569" - font-weight="400" - font-style="normal" - font-size="353" - style="font-size:353px;font-style:normal;font-weight:400;fill:#000000;stroke:none;font-family:Arial"> - <text - id="text3571" - y="2180" - x="13550">M</text> - <text - id="text3573" - y="2180" - x="13842">a</text> - <text - id="text3575" - y="2180" - x="14037">x</text> - </g> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="Drawing_54" - transform="matrix(0.03543307,0,0,0.03543307,197.24973,461.4848)"> - <rect - id="rect3578" - height="1030" - width="2001" - y="1171" - x="0" - style="fill:none;stroke:none" /> - <g - id="g3580" - font-weight="400" - font-style="normal" - font-size="353" - style="font-size:353px;font-style:normal;font-weight:400;fill:#000000;stroke:none;font-family:Arial"> - <text - id="text3582" - y="1609" - x="376">C</text> - <text - id="text3584" - y="1609" - x="630">o</text> - <text - id="text3586" - y="1609" - x="825">u</text> - <text - id="text3588" - y="1609" - x="1019">n</text> - <text - id="text3590" - y="1609" - x="1214">t</text> - <text - id="text3592" - y="1609" - x="1312">e</text> - <text - id="text3594" - y="1609" - x="1506">r</text> - <text - id="text3596" - y="1609" - x="1625" /> - <text - id="text3598" - y="1998" - x="583" - style="fill:#000000;stroke:none">v</text> - <text - id="text3600" - y="1998" - x="757">a</text> - <text - id="text3602" - y="1998" - x="951">l</text> - <text - id="text3604" - y="1998" - x="1028">u</text> - <text - id="text3606" - y="1998" - x="1222">e</text> - </g> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3608" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="M 5600,5379 3100,2880" - id="Drawing_55_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3611" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 2600,7407 0,1000" - id="Drawing_56_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3614" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 2600,7407 500,0" - id="Drawing_57_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3617" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - d="m 3100,7407 0,1000" - id="Drawing_58_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3620" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - id="path3622" - d="M 6700,6482 6175,5891" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000" /> - <path - d="m 5900,5582 215,501 258,-229 -473,-272 z" - id="Drawing_59_0" - inkscape:connector-curvature="0" - style="fill:#000000;stroke:none" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3625" - transform="matrix(0.03543307,0,0,0.03543307,185.10687,464.34194)"> - <path - id="path3627" - d="M 6000,6682 3590,5821" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000" /> - <path - d="m 3200,5682 429,337 116,-325 -545,-12 z" - id="Drawing_60_0" - inkscape:connector-curvature="0" - style="fill:#000000;stroke:none" /> - </g> - <text - xml:space="preserve" - style="font-size:12px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Arial" - x="231.28572" - y="546.64789" - id="text4620" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan4622" - x="231.28572" - y="546.64789">(COUNT)</tspan></text> - <text - xml:space="preserve" - style="font-size:12px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Arial" - x="463.57144" - y="715.93365" - id="text4624" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan4626" - x="463.57144" - y="715.93365">(CC0)</tspan></text> - <text - xml:space="preserve" - style="font-size:12px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Arial" - x="435.57367" - y="509.03906" - id="text4624-1" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan4626-7" - x="435.57367" - y="509.03906">(CC0)</tspan></text> - <text - xml:space="preserve" - style="font-size:12px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Arial" - x="605.43085" - y="511.89914" - id="text4620-4" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan4622-0" - x="605.43085" - y="511.89914">(COUNT)</tspan></text> - <text - xml:space="preserve" - style="font-size:12px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Arial" - x="710" - y="624.50507" - id="text4670" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan4672" - x="710" - y="624.50507">Compare/Match</tspan><tspan - sodipodi:role="line" - x="710" - y="639.50507" - id="tspan4674">value</tspan><tspan - sodipodi:role="line" - x="710" - y="654.50507" - id="tspan4676">(CCx)</tspan></text> - </g> -</svg> diff --git a/atmel-samd/asf/sam0/drivers/tcc/docimg/pwm_single_ex.svg b/atmel-samd/asf/sam0/drivers/tcc/docimg/pwm_single_ex.svg deleted file mode 100644 index 8450d0440..000000000 --- a/atmel-samd/asf/sam0/drivers/tcc/docimg/pwm_single_ex.svg +++ /dev/null @@ -1,1387 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> - -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="608.82367" - height="318.89764" - id="svg2" - version="1.1" - inkscape:version="0.48.4 r9939" - sodipodi:docname="pwm_single_ex.svg"> - <defs - id="defs4"> - <font - horiz-adv-x="2048" - id="EmbeddedFont_1" - horiz-origin-x="0" - horiz-origin-y="0" - vert-origin-x="45" - vert-origin-y="90" - vert-adv-y="90"> - <font-face - id="font-face2990" - descent="450" - ascent="1852" - font-style="normal" - font-weight="normal" - units-per-em="2048" - font-family="Arial" /> - <missing-glyph - id="missing-glyph2992" - d="M 0,0 L 2047,0 2047,2047 0,2047 0,0 Z" - horiz-adv-x="2048" /> - <glyph - id="glyph2994" - d="M 40,0 L 40,146 716,922 C 639,918 572,916 513,916 L 80,916 80,1062 948,1062 948,943 373,269 262,146 C 343,152 418,155 489,155 L 980,155 980,0 40,0 Z" - horiz-adv-x="928" - unicode="z" /> - <glyph - id="glyph2996" - d="M 15,0 L 403,552 44,1062 269,1062 432,813 C 463,766 487,726 506,694 535,738 562,777 587,811 L 766,1062 981,1062 614,562 1009,0 788,0 570,330 512,419 233,0 15,0 Z" - horiz-adv-x="954" - unicode="x" /> - <glyph - id="glyph2998" - d="M 331,0 L 6,1062 192,1062 361,449 424,221 C 427,232 445,305 479,440 L 648,1062 833,1062 992,446 1045,243 1106,448 1288,1062 1463,1062 1131,0 944,0 775,636 734,817 519,0 331,0 Z" - horiz-adv-x="1430" - unicode="w" /> - <glyph - id="glyph3000" - d="M 430,0 L 26,1062 216,1062 444,426 C 469,357 491,286 512,212 528,268 550,335 579,414 L 815,1062 1000,1062 598,0 430,0 Z" - horiz-adv-x="954" - unicode="v" /> - <glyph - id="glyph3002" - d="M 831,0 L 831,156 C 748,36 636,-24 494,-24 431,-24 373,-12 319,12 264,36 224,66 198,103 171,139 153,183 142,236 135,271 131,327 131,404 L 131,1062 311,1062 311,473 C 311,379 315,316 322,283 333,236 357,199 394,172 431,145 476,131 530,131 584,131 635,145 682,173 729,200 763,238 783,286 802,333 812,402 812,493 L 812,1062 992,1062 992,0 831,0 Z" - horiz-adv-x="848" - unicode="u" /> - <glyph - id="glyph3004" - d="M 528,161 L 554,2 C 503,-9 458,-14 418,-14 353,-14 302,-4 266,17 230,38 205,65 190,99 175,132 168,203 168,311 L 168,922 36,922 36,1062 168,1062 168,1325 347,1433 347,1062 528,1062 528,922 347,922 347,301 C 347,250 350,217 357,202 363,187 373,176 388,167 402,158 422,154 449,154 469,154 495,156 528,161 Z" - horiz-adv-x="504" - unicode="t" /> - <glyph - id="glyph3006" - d="M 63,317 L 241,345 C 251,274 279,219 325,181 370,143 434,124 516,124 599,124 660,141 700,175 740,208 760,248 760,293 760,334 742,366 707,389 682,405 621,425 523,450 391,483 300,512 249,537 198,561 159,595 133,638 106,681 93,728 93,780 93,827 104,871 126,912 147,952 177,985 214,1012 242,1033 280,1050 329,1065 377,1079 429,1086 484,1086 567,1086 641,1074 704,1050 767,1026 813,994 843,953 873,912 894,857 905,788 L 729,764 C 721,819 698,861 660,892 621,923 567,938 497,938 414,938 355,924 320,897 285,870 267,838 267,801 267,778 274,757 289,738 304,719 327,703 358,690 376,683 429,668 517,644 644,610 733,582 784,561 834,539 873,507 902,466 931,425 945,373 945,312 945,252 928,196 893,143 858,90 807,49 741,20 675,-9 600,-24 517,-24 379,-24 274,5 202,62 129,119 83,204 63,317 Z" - horiz-adv-x="874" - unicode="s" /> - <glyph - id="glyph3008" - d="M 133,0 L 133,1062 295,1062 295,901 C 336,976 375,1026 410,1050 445,1074 483,1086 525,1086 586,1086 647,1067 710,1028 L 648,861 C 604,887 560,900 516,900 477,900 441,888 410,865 379,841 356,808 343,766 323,702 313,632 313,556 L 313,0 133,0 Z" - horiz-adv-x="557" - unicode="r" /> - <glyph - id="glyph3010" - d="M 135,-407 L 135,1062 299,1062 299,924 C 338,978 381,1019 430,1046 479,1073 538,1086 607,1086 698,1086 778,1063 847,1016 916,969 969,904 1004,819 1039,734 1057,640 1057,539 1057,430 1038,333 999,246 960,159 903,92 829,46 754,-1 676,-24 594,-24 534,-24 480,-11 433,14 385,39 346,71 315,110 L 315,-407 135,-407 Z M 298,525 C 298,388 326,287 381,222 436,157 503,124 582,124 662,124 731,158 788,226 845,293 873,398 873,540 873,675 845,777 790,844 734,911 667,945 590,945 513,945 446,909 387,838 328,766 298,662 298,525 Z" - horiz-adv-x="901" - unicode="p" /> - <glyph - id="glyph3012" - d="M 68,531 C 68,728 123,873 232,968 323,1047 435,1086 566,1086 712,1086 831,1038 924,943 1017,847 1063,715 1063,546 1063,409 1043,302 1002,224 961,145 901,84 823,41 744,-2 659,-24 566,-24 417,-24 297,24 206,119 114,214 68,352 68,531 Z M 253,531 C 253,395 283,293 342,226 401,158 476,124 566,124 655,124 730,158 789,226 848,294 878,398 878,537 878,668 848,768 789,836 729,903 655,937 566,937 476,937 401,903 342,836 283,769 253,667 253,531 Z" - horiz-adv-x="980" - unicode="o" /> - <glyph - id="glyph3014" - d="M 135,0 L 135,1062 297,1062 297,911 C 375,1028 488,1086 635,1086 699,1086 758,1075 812,1052 865,1029 905,998 932,961 959,924 977,879 988,828 995,795 998,736 998,653 L 998,0 818,0 818,646 C 818,719 811,774 797,811 783,847 758,876 723,898 687,919 645,930 597,930 520,930 454,906 399,857 343,808 315,716 315,580 L 315,0 135,0 Z" - horiz-adv-x="848" - unicode="n" /> - <glyph - id="glyph3016" - d="M 135,0 L 135,1062 296,1062 296,913 C 329,965 374,1007 429,1039 484,1070 547,1086 618,1086 697,1086 761,1070 812,1037 862,1004 897,959 918,900 1002,1024 1111,1086 1246,1086 1351,1086 1432,1057 1489,999 1546,940 1574,850 1574,729 L 1574,0 1395,0 1395,669 C 1395,741 1389,793 1378,825 1366,856 1345,882 1314,901 1283,920 1247,930 1206,930 1131,930 1069,905 1020,856 971,806 946,726 946,617 L 946,0 766,0 766,690 C 766,770 751,830 722,870 693,910 645,930 578,930 527,930 481,917 438,890 395,863 363,824 344,773 325,722 315,648 315,551 L 315,0 135,0 Z" - horiz-adv-x="1457" - unicode="m" /> - <glyph - id="glyph3018" - d="M 131,0 L 131,1466 311,1466 311,0 131,0 Z" - horiz-adv-x="186" - unicode="l" /> - <glyph - id="glyph3020" - d="M 136,1259 L 136,1466 316,1466 316,1259 136,1259 Z M 136,0 L 136,1062 316,1062 316,0 136,0 Z" - horiz-adv-x="160" - unicode="i" /> - <glyph - id="glyph3022" - d="M 135,0 L 135,1466 315,1466 315,940 C 399,1037 505,1086 633,1086 712,1086 780,1071 838,1040 896,1009 938,966 963,911 988,856 1000,777 1000,673 L 1000,0 820,0 820,673 C 820,763 801,829 762,870 723,911 667,931 596,931 543,931 493,917 446,890 399,862 365,824 345,777 325,730 315,664 315,581 L 315,0 135,0 Z" - horiz-adv-x="848" - unicode="h" /> - <glyph - id="glyph3024" - d="M 102,-88 L 277,-114 C 284,-168 305,-207 338,-232 383,-265 444,-282 521,-282 604,-282 669,-265 714,-232 759,-199 790,-152 806,-92 815,-55 820,22 819,139 740,46 642,0 525,0 379,0 266,53 186,158 106,263 66,390 66,537 66,638 84,732 121,818 158,903 211,969 281,1016 350,1063 432,1086 526,1086 651,1086 755,1035 836,934 L 836,1062 1002,1062 1002,144 C 1002,-21 985,-138 952,-207 918,-276 865,-331 792,-371 719,-411 629,-431 522,-431 395,-431 293,-402 215,-345 137,-288 99,-203 102,-88 Z M 251,550 C 251,411 279,309 334,245 389,181 459,149 542,149 625,149 694,181 750,245 806,308 834,408 834,544 834,674 805,772 748,838 690,904 620,937 539,937 459,937 391,905 335,840 279,775 251,678 251,550 Z" - horiz-adv-x="927" - unicode="g" /> - <glyph - id="glyph3026" - d="M 862,342 L 1048,319 C 1019,210 964,126 885,66 806,6 704,-24 581,-24 426,-24 303,24 212,120 121,215 75,349 75,522 75,701 121,839 213,938 305,1037 424,1086 571,1086 713,1086 829,1038 919,941 1009,844 1054,708 1054,533 1054,522 1054,506 1053,485 L 261,485 C 268,368 301,279 360,217 419,155 493,124 582,124 648,124 704,141 751,176 798,211 835,266 862,342 Z M 271,633 L 864,633 C 856,722 833,789 796,834 739,903 664,938 573,938 490,938 421,910 365,855 308,800 277,726 271,633 Z" - horiz-adv-x="980" - unicode="e" /> - <glyph - id="glyph3028" - d="M 824,0 L 824,134 C 757,29 658,-24 527,-24 442,-24 365,-1 294,46 223,93 168,158 129,242 90,325 70,421 70,530 70,636 88,732 123,819 158,905 211,971 282,1017 353,1063 432,1086 519,1086 583,1086 640,1073 690,1046 740,1019 781,983 812,940 L 812,1466 991,1466 991,0 824,0 Z M 255,530 C 255,394 284,292 341,225 398,158 466,124 544,124 623,124 690,156 745,221 800,285 827,383 827,515 827,660 799,767 743,835 687,903 618,937 536,937 456,937 389,904 336,839 282,774 255,671 255,530 Z" - horiz-adv-x="927" - unicode="d" /> - <glyph - id="glyph3030" - d="M 828,389 L 1005,366 C 986,244 936,149 857,80 777,11 679,-24 563,-24 418,-24 301,24 213,119 124,214 80,350 80,527 80,642 99,742 137,828 175,914 233,979 311,1022 388,1065 473,1086 564,1086 679,1086 774,1057 847,999 920,940 967,857 988,750 L 813,723 C 796,794 767,848 725,884 682,920 631,938 571,938 480,938 407,906 350,841 293,776 265,673 265,532 265,389 292,286 347,221 402,156 473,124 561,124 632,124 691,146 738,189 785,232 815,299 828,389 Z" - horiz-adv-x="927" - unicode="c" /> - <glyph - id="glyph3032" - d="M 301,0 L 134,0 134,1466 314,1466 314,943 C 390,1038 487,1086 605,1086 670,1086 732,1073 791,1047 849,1020 897,983 935,936 972,888 1002,830 1023,763 1044,696 1055,624 1055,547 1055,365 1010,224 920,125 830,26 722,-24 596,-24 471,-24 372,28 301,133 L 301,0 Z M 299,539 C 299,412 316,320 351,263 408,170 484,124 581,124 660,124 728,158 785,227 842,295 871,397 871,532 871,671 844,773 789,839 734,905 667,938 589,938 510,938 442,904 385,836 328,767 299,668 299,539 Z" - horiz-adv-x="901" - unicode="b" /> - <glyph - id="glyph3034" - d="M 828,131 C 761,74 697,34 636,11 574,-12 508,-24 437,-24 320,-24 231,5 168,62 105,119 74,191 74,280 74,332 86,380 110,423 133,466 164,500 203,526 241,552 284,572 332,585 367,594 421,603 492,612 637,629 744,650 813,674 814,699 814,714 814,721 814,794 797,846 763,876 717,917 649,937 558,937 473,937 411,922 371,893 330,863 300,810 281,735 L 105,759 C 121,834 147,895 184,942 221,988 274,1024 343,1049 412,1074 493,1086 584,1086 675,1086 748,1075 805,1054 862,1033 903,1006 930,974 957,941 975,900 986,851 992,820 995,765 995,685 L 995,445 C 995,278 999,172 1007,128 1014,83 1029,41 1052,0 L 864,0 C 845,37 833,81 828,131 Z M 813,533 C 748,506 650,484 519,465 445,454 393,442 362,429 331,416 308,396 291,371 274,345 266,316 266,285 266,237 284,197 321,165 357,133 410,117 480,117 549,117 611,132 665,163 719,193 759,234 784,287 803,328 813,388 813,467 L 813,533 Z" - horiz-adv-x="980" - unicode="a" /> - <glyph - id="glyph3036" - d="M -31,-407 L -31,-277 1162,-277 1162,-407 -31,-407 Z" - horiz-adv-x="1192" - unicode="_" /> - <glyph - id="glyph3038" - d="M 414,0 L 25,1466 224,1466 447,505 C 471,404 492,304 509,205 546,362 568,452 575,476 L 854,1466 1088,1466 1298,724 C 1351,540 1389,367 1412,205 1431,298 1455,404 1485,524 L 1715,1466 1910,1466 1508,0 1321,0 1012,1117 C 986,1210 971,1268 966,1289 951,1222 936,1164 923,1117 L 612,0 414,0 Z" - horiz-adv-x="1986" - unicode="W" /> - <glyph - id="glyph3040" - d="M 531,0 L 531,1293 48,1293 48,1466 1210,1466 1210,1293 725,1293 725,0 531,0 Z" - horiz-adv-x="1166" - unicode="T" /> - <glyph - id="glyph3042" - d="M 161,0 L 161,1466 811,1466 C 942,1466 1041,1453 1109,1427 1177,1400 1231,1354 1272,1287 1313,1220 1333,1147 1333,1066 1333,962 1299,874 1232,803 1165,732 1061,686 920,667 971,642 1010,618 1037,594 1094,542 1147,477 1198,399 L 1453,0 1209,0 1015,305 C 958,393 912,460 875,507 838,554 806,586 777,605 748,624 718,637 688,644 666,649 630,651 580,651 L 355,651 355,0 161,0 Z M 355,819 L 772,819 C 861,819 930,828 980,847 1030,865 1068,894 1094,935 1120,975 1133,1019 1133,1066 1133,1135 1108,1192 1058,1237 1007,1282 928,1304 819,1304 L 355,1304 355,819 Z" - horiz-adv-x="1271" - unicode="R" /> - <glyph - id="glyph3044" - d="M 158,0 L 158,1466 711,1466 C 808,1466 883,1461 934,1452 1006,1440 1066,1417 1115,1384 1164,1350 1203,1303 1233,1242 1262,1181 1277,1115 1277,1042 1277,917 1237,812 1158,726 1079,639 935,596 728,596 L 352,596 352,0 158,0 Z M 352,769 L 731,769 C 856,769 945,792 998,839 1051,886 1077,951 1077,1036 1077,1097 1062,1150 1031,1194 1000,1237 959,1266 908,1280 875,1289 815,1293 727,1293 L 352,1293 352,769 Z" - horiz-adv-x="1113" - unicode="P" /> - <glyph - id="glyph3046" - d="M 99,714 C 99,957 164,1148 295,1286 426,1423 594,1492 801,1492 936,1492 1058,1460 1167,1395 1276,1330 1359,1240 1416,1125 1473,1009 1501,878 1501,731 1501,582 1471,449 1411,332 1351,215 1266,126 1156,66 1046,5 927,-25 800,-25 662,-25 539,8 430,75 321,142 239,233 183,348 127,463 99,585 99,714 Z M 299,711 C 299,534 347,395 442,294 537,192 656,141 799,141 945,141 1065,192 1160,295 1254,398 1301,543 1301,732 1301,851 1281,956 1241,1045 1200,1134 1141,1203 1064,1252 986,1301 899,1325 802,1325 665,1325 547,1278 448,1184 349,1089 299,932 299,711 Z" - horiz-adv-x="1404" - unicode="O" /> - <glyph - id="glyph3048" - d="M 152,0 L 152,1466 444,1466 791,428 C 823,331 846,259 861,211 878,264 904,343 939,446 L 1290,1466 1551,1466 1551,0 1364,0 1364,1227 938,0 763,0 339,1248 339,0 152,0 Z" - horiz-adv-x="1377" - unicode="M" /> - <glyph - id="glyph3050" - d="M 1204,514 L 1398,465 C 1357,306 1284,184 1179,101 1073,17 944,-25 791,-25 633,-25 505,7 406,72 307,136 231,229 180,351 128,473 102,604 102,744 102,897 131,1030 190,1144 248,1257 331,1344 439,1403 546,1462 665,1491 794,1491 941,1491 1064,1454 1164,1379 1264,1304 1334,1199 1373,1064 L 1182,1019 C 1148,1126 1099,1203 1034,1252 969,1301 888,1325 790,1325 677,1325 583,1298 508,1244 432,1190 379,1118 348,1027 317,936 302,842 302,745 302,620 320,512 357,419 393,326 449,256 526,210 603,164 686,141 775,141 884,141 976,172 1051,235 1126,298 1177,391 1204,514 Z" - horiz-adv-x="1298" - unicode="C" /> - <glyph - id="glyph3052" - d="M 1082,862 L 114,862 114,1030 1082,1030 1082,862 Z M 1082,417 L 114,417 114,585 1082,585 1082,417 Z" - horiz-adv-x="953" - unicode="=" /> - <glyph - id="glyph3054" - d="M 253,-431 L 124,-431 C 323,-111 423,209 423,530 423,655 409,780 380,903 357,1003 326,1099 285,1191 259,1251 205,1351 124,1491 L 253,1491 C 378,1324 471,1156 531,987 582,842 608,690 608,531 608,351 574,177 505,9 436,-159 352,-306 253,-431 Z" - horiz-adv-x="477" - unicode=")" /> - <glyph - id="glyph3056" - d="M 479,-431 C 380,-306 296,-159 227,9 158,177 124,351 124,531 124,690 150,842 201,987 261,1156 354,1324 479,1491 L 608,1491 C 527,1352 474,1253 448,1194 407,1102 375,1006 352,906 323,781 309,656 309,530 309,209 409,-111 608,-431 L 479,-431 Z" - horiz-adv-x="478" - unicode="(" /> - <glyph - id="glyph3058" - horiz-adv-x="556" - unicode=" " /> - </font> - </defs> - <sodipodi:namedview - id="base" - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1.0" - inkscape:pageopacity="0.0" - inkscape:pageshadow="2" - inkscape:zoom="0.98994949" - inkscape:cx="49.748038" - inkscape:cy="193.17154" - inkscape:document-units="px" - inkscape:current-layer="layer1" - showgrid="false" - fit-margin-top="0" - fit-margin-left="0" - fit-margin-right="0" - fit-margin-bottom="0" - inkscape:window-width="1366" - inkscape:window-height="716" - inkscape:window-x="1592" - inkscape:window-y="33" - inkscape:window-maximized="1" /> - <metadata - id="metadata7"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title /> - </cc:Work> - </rdf:RDF> - </metadata> - <g - inkscape:label="Layer 1" - inkscape:groupmode="layer" - id="layer1" - transform="translate(9.1788457,-321.4848)"> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - visibility="visible" - id="MasterSlide_1_Default" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <desc - id="desc3061">Master slide - </desc> - <rect - style="fill:none;stroke:none" - x="0" - y="0" - width="16000" - height="9000" - id="rect3063" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="Drawing_1" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <rect - id="rect3067" - height="1030" - width="1801" - y="1171" - x="200" - style="fill:none;stroke:none" /> - <g - id="g3069" - font-weight="400" - font-style="normal" - font-size="353" - style="font-size:353px;font-style:normal;font-weight:400;fill:#000000;stroke:none;font-family:Arial"> - <text - id="text3071" - y="1609" - x="476">C</text> - <text - id="text3073" - y="1609" - x="730">o</text> - <text - id="text3075" - y="1609" - x="925">u</text> - <text - id="text3077" - y="1609" - x="1119">n</text> - <text - id="text3079" - y="1609" - x="1314">t</text> - <text - id="text3081" - y="1609" - x="1412">e</text> - <text - id="text3083" - y="1609" - x="1606">r</text> - <text - id="text3085" - y="1609" - x="1725" /> - <text - id="text3087" - y="1998" - x="683" - style="fill:#000000;stroke:none">v</text> - <text - id="text3089" - y="1998" - x="857">a</text> - <text - id="text3091" - y="1998" - x="1051">l</text> - <text - id="text3093" - y="1998" - x="1128">u</text> - <text - id="text3095" - y="1998" - x="1322">e</text> - </g> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3097" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - d="m 12486,1900 250,433" - id="Drawing_2_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3100" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - d="m 12833,1993 -433,250" - id="Drawing_3_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3103" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - id="path3105" - d="m 2100,4600 0,-3650" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000" /> - <path - d="m 2100,500 -187,563 375,0 -188,-563 z" - id="Drawing_4_0" - inkscape:connector-curvature="0" - style="fill:#000000;stroke:none" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3108" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - id="path3110" - d="m 2100,4600 11250,0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000" /> - <path - d="m 13800,4600 -562,-187 0,375 562,-188 z" - id="Drawing_5_0" - inkscape:connector-curvature="0" - style="fill:#000000;stroke:none" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3113" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - d="M 2600,4600 5100,2100" - id="Drawing_6_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3116" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - d="m 5100,4600 0,-2500" - id="Drawing_7_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3119" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - d="M 5100,4600 7600,2100" - id="Drawing_8_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3122" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - d="m 7600,4600 0,-2500" - id="Drawing_9_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3125" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - d="M 7600,4600 10100,2100" - id="Drawing_10_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3128" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - d="m 10100,4600 0,-2500" - id="Drawing_11_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3131" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - d="M 10100,4600 12600,2100" - id="Drawing_12_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3134" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - d="m 12590,4556 0,-2500" - id="Drawing_13_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3137" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - d="m 2100,2100 11400,0" - id="Drawing_14_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:30;stroke-linejoin:round;stroke-dasharray:508, 508, 508, 508" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="Drawing_15" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <rect - id="rect3141" - height="641" - width="1301" - y="4967" - x="12600" - style="fill:none;stroke:none" /> - <g - id="g3143" - font-weight="400" - font-style="normal" - font-size="353" - style="font-size:353px;font-style:normal;font-weight:400;fill:#000000;stroke:none;font-family:Arial"> - <text - id="text3145" - y="5405" - x="12850">T</text> - <text - id="text3147" - y="5405" - x="13057">i</text> - <text - id="text3149" - y="5405" - x="13134">m</text> - <text - id="text3151" - y="5405" - x="13434">e</text> - </g> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3153" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - d="m 2100,3630 2000,0" - id="Drawing_16_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:100;stroke-linejoin:round;stroke-dasharray:197, 197" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3156" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - d="m 4100,4600 3500,0" - id="Drawing_17_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:100;stroke-linejoin:round;stroke-dasharray:197, 197" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3159" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,325.4848)"> - <path - d="m 7600,3200 500,0" - id="Drawing_18_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:100;stroke-linejoin:round;stroke-dasharray:197, 197" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3162" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,323.4848)"> - <path - d="m 8100,4300 2000,0" - id="Drawing_19_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:100;stroke-linejoin:round;stroke-dasharray:197, 197" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3165" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - d="m 10100,2100 2500,0" - id="Drawing_20_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:100;stroke-linejoin:round;stroke-dasharray:197, 197" /> - </g> - <g - id="g4642" - transform="translate(2,2)"> - <g - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)" - id="g3168" - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible"> - <path - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" - inkscape:connector-curvature="0" - id="Drawing_21_0" - d="m 3386,3367 250,433" /> - </g> - <g - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)" - id="g3171" - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible"> - <path - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" - inkscape:connector-curvature="0" - id="Drawing_22_0" - d="m 3733,3460 -433,250" /> - </g> - </g> - <g - id="g4648" - transform="translate(-2.9898475,-1.3686547)"> - <g - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)" - id="g3174" - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible"> - <path - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" - inkscape:connector-curvature="0" - id="Drawing_23_0" - d="m 5053,4400 250,433" /> - </g> - <g - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)" - id="g3177" - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible"> - <path - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" - inkscape:connector-curvature="0" - id="Drawing_24_0" - d="m 5400,4493 -433,250" /> - </g> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3180" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - d="m 12600,4600 500,-500" - id="Drawing_25_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3183" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - d="m 2600,7100 1000,0" - id="Drawing_26_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3186" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - d="m 2600,8100 0,-1000" - id="Drawing_27_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3189" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - d="m 3600,7100 0,1000" - id="Drawing_28_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3192" - transform="matrix(0.04076838,0,0,0.03543307,-28.252589,321.4848)"> - <path - d="m 3600,8100 3500,0" - id="Drawing_29_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:46.61360168;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3195" - transform="matrix(0.03246476,0,0,0.03543307,29.765343,321.4848)"> - <path - d="m 7100,7100 5800,0" - id="Drawing_30_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:52.23580933;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3198" - transform="matrix(0.03543307,0,0,0.03543307,8.8211543,321.4848)"> - <path - d="m 7100,7100 0,1000" - id="Drawing_31_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3201" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - d="m 12900,7100 0,1000" - id="Drawing_32_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3204" - transform="matrix(0.02461001,0,0,0.03543307,126.65059,321.4848)"> - <path - d="m 12600,4300 2000,0" - id="Drawing_33_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:119.99095917;stroke-linejoin:round;stroke-dasharray:236.38218807, 236.38218807" /> - </g> - <g - id="g4636" - transform="translate(51.7995,13.637056)"> - <g - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)" - id="g3207" - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible"> - <path - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" - inkscape:connector-curvature="0" - id="Drawing_34_0" - d="m 11686,5800 250,433" /> - </g> - <g - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)" - id="g3210" - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible"> - <path - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" - inkscape:connector-curvature="0" - id="Drawing_35_0" - d="m 12033,5893 -433,250" /> - </g> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="Drawing_36" - transform="matrix(0.03543307,0,0,0.03543307,34.539434,332.09141)"> - <rect - id="rect3214" - height="641" - width="1701" - y="5760" - x="12300" - style="fill:none;stroke:none" /> - <g - id="g3216" - font-weight="400" - font-style="normal" - font-size="353" - style="font-size:353px;font-style:normal;font-weight:400;fill:#000000;stroke:none;font-family:Arial"> - <text - id="text3218" - y="6198" - x="12550">M</text> - <text - id="text3220" - y="6198" - x="12842">a</text> - <text - id="text3222" - y="6198" - x="13037">t</text> - <text - id="text3224" - y="6198" - x="13134">c</text> - <text - id="text3226" - y="6198" - x="13312">h</text> - </g> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3228" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - d="m 12853,4067 250,433" - id="Drawing_37_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3231" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - d="m 13200,4160 -433,250" - id="Drawing_38_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3234" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - d="m 12900,8100 600,0" - id="Drawing_39_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3237" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - d="m 2100,8100 500,0" - id="Drawing_40_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3240" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - d="m 2600,4600 0,-2500" - id="Drawing_41_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3243" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - d="m 2100,2600 500,-500" - id="Drawing_42_0" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:50;stroke-linejoin:round" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="Drawing_43" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <rect - id="rect3247" - height="1030" - width="1901" - y="7171" - x="500" - style="fill:none;stroke:none" /> - <g - id="g3249" - font-weight="400" - font-style="normal" - font-size="353" - style="font-size:353px;font-style:normal;font-weight:400;fill:#000000;stroke:none;font-family:Arial"> - <text - id="text3251" - y="7609" - x="750">P</text> - <text - id="text3253" - y="7609" - x="983">W</text> - <text - id="text3255" - y="7609" - x="1334">M</text> - <text - id="text3257" - y="7609" - x="1626" /> - <text - id="text3259" - y="7998" - x="750" - style="fill:#000000;stroke:none">o</text> - <text - id="text3261" - y="7998" - x="945">u</text> - <text - id="text3263" - y="7998" - x="1139">t</text> - <text - id="text3265" - y="7998" - x="1237">p</text> - <text - id="text3267" - y="7998" - x="1432">u</text> - <text - id="text3269" - y="7998" - x="1626">t</text> - </g> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="Drawing_44" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <rect - id="rect3272" - height="641" - width="4401" - y="200" - x="6000" - style="fill:none;stroke:none" /> - <g - id="g3274" - font-weight="400" - font-style="normal" - font-size="353" - style="font-size:353px;font-style:normal;font-weight:400;fill:#000000;stroke:none;font-family:Arial"> - <text - id="text3276" - y="638" - x="6250">R</text> - <text - id="text3278" - y="638" - x="6504">e</text> - <text - id="text3280" - y="638" - x="6699">l</text> - <text - id="text3282" - y="638" - x="6775">o</text> - <text - id="text3284" - y="638" - x="6970">a</text> - <text - id="text3286" - y="638" - x="7164">d</text> - <text - id="text3288" - y="638" - x="7359" /> - <text - id="text3290" - y="638" - x="7457">c</text> - <text - id="text3292" - y="638" - x="7634">o</text> - <text - id="text3294" - y="638" - x="7829">u</text> - <text - id="text3296" - y="638" - x="8024">n</text> - <text - id="text3298" - y="638" - x="8219">t</text> - <text - id="text3300" - y="638" - x="8316">e</text> - <text - id="text3302" - y="638" - x="8511">r</text> - <text - id="text3304" - y="638" - x="8629" /> - <text - id="text3306" - y="638" - x="8727">t</text> - <text - id="text3308" - y="638" - x="8824">o</text> - <text - id="text3310" - y="638" - x="9019" /> - <text - id="text3312" - y="638" - x="9116">z</text> - <text - id="text3314" - y="638" - x="9285">e</text> - <text - id="text3316" - y="638" - x="9480">r</text> - <text - id="text3318" - y="638" - x="9599">o</text> - </g> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3320" - transform="matrix(0.03543307,0,0,0.03543307,-7.1788457,319.4848)"> - <path - id="path3322" - d="m 9200,800 2710,962" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000" /> - <path - d="m 12300,1900 -430,-336 -115,326 545,10 z" - id="Drawing_45_0" - inkscape:connector-curvature="0" - style="fill:#000000;stroke:none" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3325" - transform="matrix(0.03543307,0,0,0.03543307,-7.1788457,319.4848)"> - <path - id="path3327" - d="m 8500,800 1086,931" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000" /> - <path - d="m 9900,2000 -281,-468 -224,262 505,206 z" - id="Drawing_46_0" - inkscape:connector-curvature="0" - style="fill:#000000;stroke:none" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3330" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,323.4848)"> - <path - id="path3332" - d="m 7800,700 -132,792" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000" /> - <path - d="m 7600,1900 255,-482 -340,-57 85,539 z" - id="Drawing_47_0" - inkscape:connector-curvature="0" - style="fill:#000000;stroke:none" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3335" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - id="path3337" - d="M 7200,700 5452,1782" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000" /> - <path - d="m 5100,2000 531,-126 -182,-293 -349,419 z" - id="Drawing_48_0" - inkscape:connector-curvature="0" - style="fill:#000000;stroke:none" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3340" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <path - id="path3342" - d="M 6600,700 3294,1772" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000" /> - <path - d="m 2900,1900 545,4 -106,-328 -439,324 z" - id="Drawing_49_0" - inkscape:connector-curvature="0" - style="fill:#000000;stroke:none" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3345" - transform="matrix(0.0345472,-0.00787358,0.00787358,0.0345472,-42.384721,387.83566)"> - <path - id="path3347" - d="m 7700,5400 170,-256" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000;stroke-width:28.22200012" /> - <path - d="m 8100,4800 -431,335 287,191 144,-526 z" - id="Drawing_50_0" - inkscape:connector-curvature="0" - style="fill:#000000;stroke:none" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="Drawing_51" - transform="matrix(0.03543307,0,0,0.03543307,-9.1788457,321.4848)"> - <rect - id="rect3351" - height="1030" - width="5901" - y="5571" - x="4100" - style="fill:none;stroke:none" /> - <g - id="g3353" - font-weight="400" - font-style="normal" - font-size="353" - style="font-size:353px;font-style:normal;font-weight:400;fill:#000000;stroke:none;font-family:Arial"> - <text - id="text3355" - y="6009" - x="4350">C</text> - <text - id="text3357" - y="6009" - x="4604">o</text> - <text - id="text3359" - y="6009" - x="4799">m</text> - <text - id="text3361" - y="6009" - x="5099">p</text> - <text - id="text3363" - y="6009" - x="5294">a</text> - <text - id="text3365" - y="6009" - x="5489">r</text> - <text - id="text3367" - y="6009" - x="5607">e</text> - <text - id="text3369" - y="6009" - x="5802" /> - <text - id="text3371" - y="6009" - x="5899">v</text> - <text - id="text3373" - y="6009" - x="6073">a</text> - <text - id="text3375" - y="6009" - x="6268">l</text> - <text - id="text3377" - y="6009" - x="6344">u</text> - <text - id="text3379" - y="6009" - x="6539">e</text> - <text - id="text3381" - y="6009" - x="6733" /> - <text - id="text3383" - y="6009" - x="6831">h</text> - <text - id="text3385" - y="6009" - x="7025">a</text> - <text - id="text3387" - y="6009" - x="7220">s</text> - <text - id="text3389" - y="6009" - x="7398" /> - <text - id="text3391" - y="6009" - x="7495">b</text> - <text - id="text3393" - y="6009" - x="7690">e</text> - <text - id="text3395" - y="6009" - x="7885">e</text> - <text - id="text3397" - y="6009" - x="8080">n</text> - <text - id="text3399" - y="6009" - x="8274" /> - <text - id="text3401" - y="6009" - x="8372">c</text> - <text - id="text3403" - y="6009" - x="8549">h</text> - <text - id="text3405" - y="6009" - x="8744">a</text> - <text - id="text3407" - y="6009" - x="8939">n</text> - <text - id="text3409" - y="6009" - x="9134">g</text> - <text - id="text3411" - y="6009" - x="9328">e</text> - <text - id="text3413" - y="6009" - x="9523">d</text> - <text - id="text3415" - y="6009" - x="9718" /> - <text - id="text3425" - y="6398" - x="4968" /> - <text - id="text3471" - y="6398" - x="8842" /> - </g> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3473" - transform="matrix(0.03543307,0,0,0.03543307,-7.532909,321.4848)"> - <path - id="path3475" - d="M 4800,5500 4393,5093" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000" /> - <path - d="m 4100,4800 244,488 244,-244 -488,-244 z" - id="Drawing_52_0" - inkscape:connector-curvature="0" - style="fill:#000000;stroke:none" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3478" - transform="matrix(0.03543307,0,0,0.03543307,-3.1788457,319.4848)"> - <path - id="path3480" - d="m 9600,5500 2299,-596" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000" /> - <path - d="m 12300,4800 -544,-37 86,334 458,-297 z" - id="Drawing_53_0" - inkscape:connector-curvature="0" - style="fill:#000000;stroke:none" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="g3483" - transform="matrix(0.03543307,0,0,0.03543307,-5.1788457,321.4848)"> - <path - id="path3485" - d="m 9085,5400 469,-352" - inkscape:connector-curvature="0" - style="fill:none;stroke:#000000" /> - <path - d="m 9885,4800 -517,173 207,276 310,-449 z" - id="Drawing_54_0" - inkscape:connector-curvature="0" - style="fill:#000000;stroke:none" /> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="Drawing_55" - transform="matrix(0.03543307,0,0,0.03543307,61.026756,342.698)"> - <rect - id="rect3489" - height="641" - width="2601" - y="1360" - x="12600" - style="fill:none;stroke:none" /> - <g - id="g3491" - font-weight="400" - font-style="normal" - font-size="353" - style="font-size:353px;font-style:normal;font-weight:400;fill:#000000;stroke:none;font-family:Arial"> - <text - id="text3499" - y="1798" - x="13570" /> - <text - id="text3503" - y="1798" - x="13870" /> - <text - xml:space="preserve" - style="font-size:338.66668701px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Arial" - x="12303.818" - y="719.92755" - id="text4654" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan4656" - x="12303.818" - y="719.92755">TOP/Period</tspan><tspan - sodipodi:role="line" - x="12303.818" - y="1143.2609" - id="tspan4658">= Max</tspan><tspan - sodipodi:role="line" - x="12303.818" - y="1566.5942" - id="tspan3273">(PER)</tspan></text> - </g> - </g> - <g - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible" - id="Drawing_56" - transform="matrix(0.03543307,0,0,0.03543307,-21.300676,314.9188)"> - <rect - id="rect3512" - height="1419" - width="2101" - y="2782" - x="13100" - style="fill:none;stroke:none" /> - <text - xml:space="preserve" - style="font-size:338.66668701px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Arial" - x="14924.331" - y="3697.373" - id="text3275" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan3277" - x="14924.331" - y="3697.373">Compare/Match</tspan><tspan - sodipodi:role="line" - x="14924.331" - y="4120.7065" - id="tspan3279">value</tspan><tspan - sodipodi:role="line" - x="14924.331" - y="4544.0396" - id="tspan3281">(CCx)</tspan></text> - </g> - <g - transform="matrix(0.03340287,-0.01182162,0.01182162,0.03340287,-68.221798,424.53532)" - id="g4660" - style="fill-rule:evenodd;stroke-width:28.22200012;stroke-linejoin:round;visibility:visible"> - <path - style="fill:none;stroke:#000000" - inkscape:connector-curvature="0" - d="m 7700,5400 170,-256" - id="path4662" /> - <path - style="fill:#000000;stroke:none" - inkscape:connector-curvature="0" - id="path4664" - d="m 8100,4800 -431,335 287,191 144,-526 z" /> - </g> - <text - xml:space="preserve" - style="font-size:12px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Arial" - x="243.64101" - y="545.89258" - id="text4666" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan4668" - x="243.64101" - y="545.89258">(CCx)</tspan></text> - <text - xml:space="preserve" - style="font-size:12px;font-style:normal;font-weight:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Arial" - x="28.701876" - y="407.54227" - id="text4670" - sodipodi:linespacing="125%"><tspan - sodipodi:role="line" - id="tspan4672" - x="28.701876" - y="407.54227">(COUNT)</tspan></text> - </g> -</svg> diff --git a/atmel-samd/asf/sam0/drivers/tcc/tcc.c b/atmel-samd/asf/sam0/drivers/tcc/tcc.c deleted file mode 100644 index e46cf287a..000000000 --- a/atmel-samd/asf/sam0/drivers/tcc/tcc.c +++ /dev/null @@ -1,1604 +0,0 @@ -/** - * \file - * - * \brief SAM TCC - Timer Counter for Control Applications Driver - * - * Copyright (C) 2013-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#include "tcc.h" - -#if TCC_ASYNC == true -# include "tcc_callback.h" -# include <system_interrupt.h> - -/** \internal - * Converts a given TCC index to its interrupt vector index. - */ -# define _TCC_INTERRUPT_VECT_NUM(n, unused) \ - SYSTEM_INTERRUPT_MODULE_TCC##n, -#endif - -#define _SIZE_MAX(size) ((size==32u) ? 0xFFFFFFFF : ( \ - (1u << size) - 1)) - -#define _SIZE_MAX_WITH_DITHER 0x03FFFFFF - -/* Extension support mapping bits */ -#define _TCC_DITHERING_B 16u -#define _TCC_PG_B 8u -#define _TCC_SWAP_B 4u -#define _TCC_DTI_B 2u -#define _TCC_OTMX_B 1u - -#if !defined(__DOXYGEN__) - -# define _TCC_GCLK_ID(n,unused) TPASTE3(TCC,n,_GCLK_ID), -# if (SAML21) || (SAML22) || (SAMC20) || (SAMC21) || (SAMR30) -# define _TCC_APBCMASK(n,unused) TPASTE2(MCLK_APBCMASK_TCC,n), -# else -# define _TCC_APBCMASK(n,unused) TPASTE2(PM_APBCMASK_TCC,n), -# endif - -# define _TCC_SIZE(n,unused) TPASTE3(TCC,n,_SIZE), -# define _TCC_MAX(n,unused) _SIZE_MAX(TPASTE3(TCC,n,_SIZE)), -# define _TCC_EXT(n,unused) TPASTE3(TCC,n,_EXT), -# define _TCC_CC_NUM(n,unused) min(TPASTE3(TCC,n,_CC_NUM),TCC_NUM_CHANNELS), -# define _TCC_OW_NUM(n,unused) min(TPASTE3(TCC,n,_OW_NUM),TCC_NUM_WAVE_OUTPUTS), - -# define TCC_GCLK_IDS { MREPEAT(TCC_INST_NUM, _TCC_GCLK_ID, 0) } -# define TCC_APBCMASKS { MREPEAT(TCC_INST_NUM, _TCC_APBCMASK, 0) } - -# define TCC_SIZES { MREPEAT(TCC_INST_NUM, _TCC_SIZE, 0) } -# define TCC_MAXS { MREPEAT(TCC_INST_NUM, _TCC_MAX, 0) } -# define TCC_EXTS { MREPEAT(TCC_INST_NUM, _TCC_EXT, 0) } -# define TCC_CC_NUMS { MREPEAT(TCC_INST_NUM, _TCC_CC_NUM, 0) } -# define TCC_OW_NUMS { MREPEAT(TCC_INST_NUM, _TCC_OW_NUM, 0) } - -#endif - -/* List of available TCC modules. */ -const Tcc *const tcc_modules[TCC_INST_NUM] = TCC_INSTS; - -/* List of TCC GCLK IDs */ -const uint8_t _tcc_gclk_ids[TCC_INST_NUM] = TCC_GCLK_IDS; - -/* List of TCC APBC Masks */ -const uint32_t _tcc_apbcmasks[TCC_INST_NUM] = TCC_APBCMASKS; - -/* List of extension support of TCC modules. */ -const uint8_t _tcc_exts[TCC_INST_NUM] = TCC_EXTS; - -/* List of sizes support of TCC modules. */ -const uint8_t _tcc_sizes[TCC_INST_NUM] = TCC_SIZES; - -/* List of maximumvalues supported of TCC modules. */ -const uint32_t _tcc_maxs[TCC_INST_NUM] = TCC_MAXS; - -/* List of available channel number of TCC modules. */ -const uint8_t _tcc_cc_nums[TCC_INST_NUM] = TCC_CC_NUMS; - -/* List of available output number of TCC modules. */ -const uint8_t _tcc_ow_nums[TCC_INST_NUM] = TCC_OW_NUMS; - -/** - * \internal Find the index of the given TCC module instance. - * - * \param[in] The TCC module instance pointer - * - * \return Index of the given TCC module instance. - */ -uint8_t _tcc_get_inst_index( - Tcc *const hw) -{ - /* Find index for TCC instance. */ - for (uint32_t i = 0; i < TCC_INST_NUM; i++) { - if (hw == tcc_modules[i]) { - return i; - } - } - - /* Invalid data given. */ - Assert(false); - return 0; -} - -/** - * \brief Initializes config with predefined default values. - * - * This function will initialize a given TCC configuration structure to - * a set of known default values. This function should be called on - * any new instance of the configuration structures before being - * modified by the user application. - * - * The default configuration is as follows: - * \li Don't run in standby - * \li When setting top, compare, or pattern by API, do double buffering write - * \li The base timer/counter configurations: - * - GCLK generator 0 clock source - * - No prescaler - * - GCLK reload action - * - Count upward - * - Don't perform one-shot operations - * - Counter starts on 0 - * - Period/top value set to maximum - * \li The match/capture configurations: - * - All Capture compare channel value set to 0 - * - No capture enabled (all channels use compare function) - * - Normal frequency wave generation - * - Waveform generation polarity set to 0 - * - Don't perform ramp on waveform - * \li The waveform extension configurations: - * - No recoverable fault is enabled, fault actions are disabled, filter - * is set to 0 - * - No non-recoverable fault state output is enabled and filter is 0 - * - No inversion of waveform output - * \li No channel output enabled - * \li No PWM pin output enabled - * \li Pin and MUX configuration not set - * - * \param[out] config Pointer to a TCC module configuration structure to set - * \param[in] hw Pointer to the TCC hardware module - * - */ -void tcc_get_config_defaults( - struct tcc_config *const config, - Tcc *const hw) -{ - /* TCC instance index */ - uint8_t module_index = _tcc_get_inst_index(hw); - - /* Base counter defaults */ - config->counter.count = 0; - - config->counter.period = _tcc_maxs[module_index]; - - config->counter.clock_source = GCLK_GENERATOR_0; - config->counter.clock_prescaler = TCC_CLOCK_PRESCALER_DIV1; - config->counter.reload_action = TCC_RELOAD_ACTION_GCLK; - - config->counter.direction = TCC_COUNT_DIRECTION_UP; - config->counter.oneshot = false; - -#ifdef FEATURE_TCC_GENERATE_DMA_TRIGGER - config->counter.dma_trigger_mode = TCC_COUNT_OVERFLOW_DMA_TRIGGER_MODE_CONTINUE; -#endif - - /* Match/Capture defaults */ -# define _TCC_CHANNEL_MATCH_VALUE_INIT(n, value) \ - config->compare.match[n] = value; - MREPEAT(TCC_NUM_CHANNELS, - _TCC_CHANNEL_MATCH_VALUE_INIT, 0) -# undef _TCC_CHANNEL_MATCH_VALUE_INIT - - /* Wave polarity defaults */ -# define _TCC_CHANNEL_WAVE_POLARITY_INIT(n, value) \ - config->compare.wave_polarity[n] = value; - MREPEAT(TCC_NUM_CHANNELS, - _TCC_CHANNEL_WAVE_POLARITY_INIT, TCC_WAVE_POLARITY_0) -# undef _TCC_CHANNEL_WAVE_POLARITY_INIT - - config->compare.wave_generation = TCC_WAVE_GENERATION_NORMAL_FREQ; - config->compare.wave_ramp = TCC_RAMP_RAMP1; - -# define _TCC_CHANNEL_FUNCTION_INIT(n, value) \ - config->compare.channel_function[n] = value; - MREPEAT(TCC_NUM_CHANNELS, - _TCC_CHANNEL_FUNCTION_INIT, TCC_CHANNEL_FUNCTION_COMPARE) -# undef _TCC_CHANNEL_FUNCTION_INIT - - /* Recoverable fault defaults */ -# define _TCC_FAULT_FUNCTION_INIT(n, dummy) \ - config->wave_ext.recoverable_fault[n].filter_value = 0; \ - config->wave_ext.recoverable_fault[n].blanking_cycles = 0; \ - config->wave_ext.recoverable_fault[n].restart = false; \ - config->wave_ext.recoverable_fault[n].keep = false; \ - config->wave_ext.recoverable_fault[n].qualification = false; \ - config->wave_ext.recoverable_fault[n].source = TCC_FAULT_SOURCE_DISABLE; \ - config->wave_ext.recoverable_fault[n].blanking = TCC_FAULT_BLANKING_DISABLE; \ - config->wave_ext.recoverable_fault[n].halt_action = TCC_FAULT_HALT_ACTION_DISABLE; \ - config->wave_ext.recoverable_fault[n].capture_action = TCC_FAULT_CAPTURE_DISABLE; \ - config->wave_ext.recoverable_fault[n].capture_channel = TCC_FAULT_CAPTURE_CHANNEL_0; - MREPEAT(TCC_NUM_FAULTS, _TCC_FAULT_FUNCTION_INIT, 0) -# undef _TCC_FAULT_FUNCTION_INIT - - /* Non-recoverable fault defaults */ -# define _TCC_NRF_FUNCTION_INIT(n, dummy) \ - config->wave_ext.non_recoverable_fault[n].filter_value = 0; \ - config->wave_ext.non_recoverable_fault[n].output = TCC_FAULT_STATE_OUTPUT_OFF; - MREPEAT(TCC_NUM_WAVE_OUTPUTS, _TCC_NRF_FUNCTION_INIT, 0) -# undef _TCC_NRF_FUNCTION_INIT - - /* Output inversion defaults */ -# define _TCC_OUT_INVERT_INIT(n, value) \ - config->wave_ext.invert[n] = value; - MREPEAT(TCC_NUM_WAVE_OUTPUTS, _TCC_OUT_INVERT_INIT, false) -# undef _TCC_OUT_INVERT_INIT - -# define _TCC_CHANNEL_OUT_PIN_INIT(n, dummy) \ - config->pins.enable_wave_out_pin[n] = false;\ - config->pins.wave_out_pin[TCC_WAVE_OUTPUT_##n] = 0; \ - config->pins.wave_out_pin_mux[TCC_WAVE_OUTPUT_##n] = 0; - MREPEAT(TCC_NUM_WAVE_OUTPUTS, _TCC_CHANNEL_OUT_PIN_INIT, 0) -# undef _TCC_CHANNEL_OUT_PIN_INIT - - config->double_buffering_enabled = true; - config->run_in_standby = false; -} - - -/** - * \brief Build CTRLA register value from configuration. - * - * \param[in] module_index The software module instance index - * \param[in] config Pointer to the TCC configuration options struct - * \param[out] value_buffer Pointer to the buffer to fill with built value - * - * \return Configuration validation status. - * - * \retval STATUS_OK Configuration values are good and register - * value built and save to buffer - * \retval STATUS_ERR_INVALID_ARG Invalid parameter found: - * assigned dither mode is invalid for module; - * used capture channel is invalid for module - */ -static inline enum status_code _tcc_build_ctrla( - const uint8_t module_index, - const struct tcc_config *const config, - uint32_t *value_buffer) -{ - uint32_t ctrla = 0; - - int i; - for (i = 0; i < TCC_NUM_CHANNELS; i ++) { - if (config->capture.channel_function[i] == - TCC_CHANNEL_FUNCTION_CAPTURE) { - - if (i > _tcc_cc_nums[module_index]) { - /* Channel not supported */ - return STATUS_ERR_INVALID_ARG; - } - ctrla |= (TCC_CTRLA_CPTEN0 << i); - } - } - - if (config->run_in_standby) { - ctrla |= TCC_CTRLA_RUNSTDBY; - } - ctrla |= config->counter.reload_action << TCC_CTRLA_PRESCSYNC_Pos; - ctrla |= config->counter.clock_prescaler << TCC_CTRLA_PRESCALER_Pos; - - *value_buffer = ctrla; - return STATUS_OK; -} - -/** - * \brief Build CTRLB register value from configuration. - * - * \param[in] module_index The software module instance index - * \param[in] config Pointer to the TCC configuration options struct - * \param[out] value_buffer Pointer to the buffer to fill with built value - */ -static inline void _tcc_build_ctrlb( - const uint8_t module_index, - const struct tcc_config *const config, - uint8_t *value_buffer) -{ - uint8_t ctrlb = 0; - - // if (config->counter.oneshot) { - // ctrlb |= TCC_CTRLBSET_ONESHOT; - // } - // if (config->counter.direction == TCC_COUNT_DIRECTION_DOWN) { - // ctrlb |= TCC_CTRLBSET_DIR; - // } - - *value_buffer = ctrlb; -} - -/** - * \brief Build FAULTs register values from configuration. - * - * \param[in] module_index The software module instance index - * \param[in] config Pointer to the TCC configuration options struct - * \param[out] value_buffer Pointer to the buffer to fill with built values - * - * \retval STATUS_OK Configuration values are good and register - * value built and save to buffer - * \retval STATUS_ERR_INVALID_ARG Invalid parameter found: assigned fault - * capture channel is invalid; assigned filter - * value is invalid - */ -static inline enum status_code _tcc_build_faults( - const uint8_t module_index, - const struct tcc_config *const config, - uint32_t *value_buffer) -{ - struct tcc_recoverable_fault_config *cfg; - uint8_t cc_num = _tcc_cc_nums[module_index]; - uint32_t fault; - int i; - for (i = 0; i < TCC_NUM_FAULTS; i ++) { - cfg = (struct tcc_recoverable_fault_config *) - &config->wave_ext.recoverable_fault[i]; - if (cfg->capture_channel >= cc_num) { - return STATUS_ERR_INVALID_ARG; - } - if (cfg->filter_value > 0xF) { - return STATUS_ERR_INVALID_ARG; - } - fault = TCC_FCTRLA_FILTERVAL(cfg->filter_value) - | TCC_FCTRLA_BLANKVAL(cfg->blanking_cycles) - | (cfg->restart ? TCC_FCTRLA_RESTART : 0) - | (cfg->keep ? TCC_FCTRLA_KEEP : 0) - | (cfg->qualification ? TCC_FCTRLA_QUAL : 0) - | TCC_FCTRLA_SRC(cfg->source) - | TCC_FCTRLA_BLANK(cfg->blanking) - | TCC_FCTRLA_HALT(cfg->halt_action) - | TCC_FCTRLA_CAPTURE(cfg->capture_action) - | TCC_FCTRLA_CHSEL(cfg->capture_channel); - value_buffer[i] = fault; - } - return STATUS_OK; -} - -/** - * \brief Build DRVCTRL register values from configuration. - * - * \param[in] module_index The software module instance index - * \param[in] config Pointer to the TCC configuration options struct - * \param[out] value_buffer Pointer to the buffer to fill with built value - * - * \retval STATUS_OK Configuration values are good and register - * value built and save to buffer - * \retval STATUS_ERR_INVALID_ARG Invalid parameter found: assigned output line - * is invalid; filter value is invalid - */ -static inline enum status_code _tcc_build_drvctrl( - const uint8_t module_index, - const struct tcc_config *const config, - uint32_t *value_buffer) -{ - uint32_t i; - uint8_t ow_num = _tcc_ow_nums[module_index]; - uint32_t drvctrl; - - drvctrl = 0; - - for (i = 0; i < TCC_NUM_WAVE_OUTPUTS; i ++) { - if (config->wave_ext.invert[i]) { - if (i >= ow_num) { - return STATUS_ERR_INVALID_ARG; - } - drvctrl |= (TCC_DRVCTRL_INVEN0 << i); - } - if (config->wave_ext.non_recoverable_fault[i].output != - TCC_FAULT_STATE_OUTPUT_OFF) { - if (i >= ow_num) { - return STATUS_ERR_INVALID_ARG; - } - if (config->wave_ext.non_recoverable_fault[i].output == - TCC_FAULT_STATE_OUTPUT_1) { - drvctrl |= (TCC_DRVCTRL_NRE0 | TCC_DRVCTRL_NRV0) << i; - } else { - drvctrl |= (TCC_DRVCTRL_NRE0) << i; - } - } - } - *value_buffer = drvctrl; - return STATUS_OK; -} - -/** - * \brief Build WAVE & WAVEB register values from configuration. - * - * \param[in] module_index The software module instance index - * \param[in] config Pointer to the TCC configuration options struct - * \param[out] value_buffer Pointer to the buffer to fill with built value - * - * \retval STATUS_OK Configuration values are good and register - * value built and save to buffer - * \retval STATUS_ERR_INVALID_ARG Invalid parameter found: assigned output line - * is invalid; circular and double buffering - * conflict; assigned function not supported by - * module - */ -static inline enum status_code _tcc_build_waves( - const uint8_t module_index, - const struct tcc_config *const config, - uint32_t *value_buffer) -{ - int n; - - uint8_t cc_num = _tcc_cc_nums[module_index]; - struct tcc_match_wave_config const *wav_cfg = &config->compare; - - uint32_t wave; - - wave = TCC_WAVE_RAMP(wav_cfg->wave_ramp) | - TCC_WAVE_WAVEGEN(wav_cfg->wave_generation); - - for (n = 0; n < TCC_NUM_CHANNELS; n++) { - if (wav_cfg->wave_polarity[n]) { - if (n >= cc_num) { - return STATUS_ERR_INVALID_ARG; - } - wave |= (TCC_WAVE_POL0 << n); - } - } - - value_buffer[0] = wave; - - return STATUS_OK; -} - -/** - * \brief Initializes a hardware TCC module instance. - * - * Enables the clock and initializes the given TCC module, based on the given - * configuration values. - * - * \param[in,out] module_inst Pointer to the software module instance struct - * \param[in] hw Pointer to the TCC hardware module - * \param[in] config Pointer to the TCC configuration options struct - * - * \return Status of the initialization procedure. - * - * \retval STATUS_OK The module was initialized successfully - * \retval STATUS_BUSY The hardware module was busy when the - * initialization procedure was attempted - * \retval STATUS_INVALID_ARG An invalid configuration option or argument - * was supplied - * \retval STATUS_ERR_DENIED The hardware module was already enabled - */ -enum status_code tcc_init( - struct tcc_module *const module_inst, - Tcc *const hw, - const struct tcc_config *const config) -{ - int i; - - /* Sanity check arguments */ - Assert(hw); - Assert(module_inst); - Assert(config); - - /* TCC instance index */ - uint8_t module_index = _tcc_get_inst_index(hw); - - /* Enable the user interface clock for TCC */ - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBC, - _tcc_apbcmasks[module_index]); - - /* Check if it's enabled. */ - if (hw->CTRLA.reg & TCC_CTRLA_ENABLE) { - return STATUS_ERR_DENIED; - } - /* Check if it's resetting */ - if (hw->CTRLA.reg & TCC_CTRLA_SWRST) { - return STATUS_ERR_DENIED; - } - - enum status_code status; - - /* Check COUNT, PER, CCx */ - uint32_t count_max = _tcc_maxs[module_index]; - - /* Check all counter values */ - if ((config->counter.count > count_max) - || (config->counter.period > count_max) - ) { - return STATUS_ERR_INVALID_ARG; - } - - /* Check all channel values */ - for (i = 0; i < TCC_NUM_CHANNELS; i ++) { - if ((config->compare.match[i] > count_max) - ) { - return STATUS_ERR_INVALID_ARG; - } - } - - /* Check all outputs */ - for (i = 0; i < TCC_NUM_WAVE_OUTPUTS; i ++) { - if (!config->pins.enable_wave_out_pin[i]) { - continue; - } - /* Output line is not supported */ - if (i >= _tcc_ow_nums[module_index]) { - return STATUS_ERR_INVALID_ARG; - } - } - - /* CTRLA settings */ - uint32_t ctrla = 0; - status = _tcc_build_ctrla(module_index, config, &ctrla); - if (STATUS_OK != status) { - return status; - } - - /* CTRLB settings */ - uint8_t ctrlb; - _tcc_build_ctrlb(module_index, config, &ctrlb); - - /* FAULTs settings */ - uint32_t faults[TCC_NUM_FAULTS]; - - status = _tcc_build_faults(module_index, config, faults); - if (STATUS_OK != status) { - return status; - } - - /* DRVCTRL */ - uint32_t drvctrl = 0; - - status = _tcc_build_drvctrl(module_index, config, &drvctrl); - if (STATUS_OK != status) { - return status; - } - - /* WAVE */ - uint32_t waves[1]; - - status = _tcc_build_waves(module_index, config, waves); - if (STATUS_OK != status) { - return status; - } - - /* Initialize module */ -#if TCC_ASYNC - /* Initialize parameters */ - for (i = 0; i < TCC_CALLBACK_N; i ++) { - module_inst->callback[i] = NULL; - } - module_inst->register_callback_mask = 0; - module_inst->enable_callback_mask = 0; - _tcc_instances[module_index] = module_inst; -#endif - - module_inst->hw = hw; - - module_inst->double_buffering_enabled = config->double_buffering_enabled; - - /* Setup clock for module */ - struct system_gclk_chan_config gclk_chan_config; - system_gclk_chan_get_config_defaults(&gclk_chan_config); - gclk_chan_config.source_generator = config->counter.clock_source; - system_gclk_chan_set_config(_tcc_gclk_ids[module_index], &gclk_chan_config); - system_gclk_chan_enable(_tcc_gclk_ids[module_index]); - - /* Initialize pins */ - // struct system_pinmux_config pin_config; - // for (i = 0; i < _tcc_ow_nums[module_index]; i ++) { - // if (!config->pins.enable_wave_out_pin[i]) { - // continue; - // } - // - // system_pinmux_get_config_defaults(&pin_config); - // pin_config.mux_position = config->pins.wave_out_pin_mux[i]; - // pin_config.direction = SYSTEM_PINMUX_PIN_DIR_OUTPUT; - // system_pinmux_pin_set_config( - // config->pins.wave_out_pin[i], &pin_config); - // } - - /* Write to registers */ - - hw->CTRLA.reg = ctrla; - while (hw->SYNCBUSY.reg & TCC_SYNCBUSY_CTRLB) { - /* Wait for sync */ - } - - hw->CTRLBCLR.reg = 0xFF; - while (hw->SYNCBUSY.reg & TCC_SYNCBUSY_CTRLB) { - /* Wait for sync */ - } - hw->CTRLBSET.reg = ctrlb; - - hw->FCTRLA.reg = faults[0]; - hw->FCTRLB.reg = faults[1]; - - hw->DRVCTRL.reg = drvctrl; - -#if (!SAML21) && (!SAMC20) && (!SAMC21) && (!SAML22) && (!SAMR30) - while (hw->SYNCBUSY.reg & (TCC_SYNCBUSY_WAVE | TCC_SYNCBUSY_WAVEB)) { - /* Wait for sync */ - } -#endif - hw->WAVE.reg = waves[0]; - - while (hw->SYNCBUSY.reg & TCC_SYNCBUSY_COUNT) { - /* Wait for sync */ - } - hw->COUNT.reg = config->counter.count; - -#if (!SAML21) && (!SAMC20) && (!SAMC21) && (!SAML22) && (!SAMR30) - while (hw->SYNCBUSY.reg & (TCC_SYNCBUSY_PER | TCC_SYNCBUSY_PERB)) { - /* Wait for sync */ - } -#endif - hw->PER.reg = (config->counter.period); - - for (i = 0; i < _tcc_cc_nums[module_index]; i ++) { -#if (!SAML21) && (!SAMC20) && (!SAMC21) && (!SAML22) && (!SAMR30) - while (hw->SYNCBUSY.reg & ( - (TCC_SYNCBUSY_CC0 | TCC_SYNCBUSY_CCB0) << i)) { - /* Wait for sync */ - } -#endif - hw->CC[i].reg = (config->compare.match[i]); - } - - return STATUS_OK; -} - - -/** - * \brief Enables the TCC module event input or output. - * - * Enables one or more input or output events to or from the TCC module. - * See \ref tcc_events for a list of events this module supports. - * - * \note Events cannot be altered while the module is enabled. - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] events Struct containing flags of events to enable or - * configure - * - * \return Status of the events setup procedure. - * - * \retval STATUS_OK The module was initialized successfully - * \retval STATUS_INVALID_ARG An invalid configuration option or argument - * was supplied - */ -enum status_code tcc_enable_events( - struct tcc_module *const module_inst, - struct tcc_events *const events) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - Assert(events); - - Tcc *const tcc_module = module_inst->hw; - - /* Check if it's enabled or resetting. */ - if (tcc_module->CTRLA.reg & (TCC_CTRLA_ENABLE | TCC_CTRLA_SWRST)) { - return STATUS_ERR_DENIED; - } - - uint32_t evctrl = tcc_module->EVCTRL.reg; - - /* Setup event output action */ - if (events->output_config.modify_generation_selection) { - evctrl &= ~ TCC_EVCTRL_CNTSEL_Msk; - switch(events->output_config.generation_selection) { - case TCC_EVENT_GENERATION_SELECTION_START: - evctrl |= TCC_EVCTRL_CNTSEL_START; - break; - case TCC_EVENT_GENERATION_SELECTION_END: - evctrl |= TCC_EVCTRL_CNTSEL_END; - break; - case TCC_EVENT_GENERATION_SELECTION_BETWEEN: - evctrl |= TCC_EVCTRL_CNTSEL_BETWEEN; - break; - case TCC_EVENT_GENERATION_SELECTION_BOUNDARY: - evctrl |= TCC_EVCTRL_CNTSEL_BOUNDARY; - break; - default: - Assert(false); - /* Wrong configuration */ - return STATUS_ERR_INVALID_ARG; - } - } - /* Setup input event0 */ - if (events->on_input_event_perform_action[0]) { - evctrl |= TCC_EVCTRL_TCEI0; - } - if (events->input_config[0].invert) { - evctrl |= TCC_EVCTRL_TCINV0; - } - if (events->input_config[0].modify_action) { - evctrl &= ~ TCC_EVCTRL_EVACT0_Msk; - switch(events->input_config[0].action) { - case TCC_EVENT0_ACTION_OFF: - evctrl |= TCC_EVCTRL_EVACT0_OFF; - break; - case TCC_EVENT0_ACTION_RETRIGGER: - evctrl |= TCC_EVCTRL_EVACT0_RETRIGGER; - break; - case TCC_EVENT0_ACTION_COUNT_EVENT: - evctrl |= TCC_EVCTRL_EVACT0_COUNTEV; - break; - case TCC_EVENT0_ACTION_START: - evctrl |= TCC_EVCTRL_EVACT0_START; - break; - case TCC_EVENT0_ACTION_INCREMENT: - evctrl |= TCC_EVCTRL_EVACT0_INC; - break; - case TCC_EVENT0_ACTION_COUNT_DURING_ACTIVE: - evctrl |= TCC_EVCTRL_EVACT0_COUNT; - break; - case TCC_EVENT0_ACTION_NON_RECOVERABLE_FAULT: - evctrl |= TCC_EVCTRL_EVACT0_FAULT; - break; - default: - Assert(false); - /* Wrong configuration */ - return STATUS_ERR_INVALID_ARG; - } - } - /* Setup input event1 */ - if (events->on_input_event_perform_action[1]) { - evctrl |= TCC_EVCTRL_TCEI1; - } - if (events->input_config[1].invert) { - evctrl |= TCC_EVCTRL_TCINV1; - } - if (events->input_config[1].modify_action) { - evctrl &= ~ TCC_EVCTRL_EVACT1_Msk; - switch(events->input_config[1].action) { - case TCC_EVENT1_ACTION_OFF: - evctrl |= TCC_EVCTRL_EVACT1_OFF; - break; - case TCC_EVENT1_ACTION_RETRIGGER: - evctrl |= TCC_EVCTRL_EVACT1_RETRIGGER; - break; - case TCC_EVENT1_ACTION_DIR_CONTROL: - evctrl |= TCC_EVCTRL_EVACT1_DIR; - break; - case TCC_EVENT1_ACTION_STOP: - evctrl |= TCC_EVCTRL_EVACT1_STOP; - break; - case TCC_EVENT1_ACTION_DECREMENT: - evctrl |= TCC_EVCTRL_EVACT1_DEC; - break; - case TCC_EVENT1_ACTION_PERIOD_PULSE_WIDTH_CAPTURE: - evctrl |= TCC_EVCTRL_EVACT1_PPW | - TCC_EVCTRL_MCEI0 | TCC_EVCTRL_MCEI1; - break; - case TCC_EVENT1_ACTION_PULSE_WIDTH_PERIOD_CAPTURE: - evctrl |= TCC_EVCTRL_EVACT1_PWP | - TCC_EVCTRL_MCEI0 | TCC_EVCTRL_MCEI1; - break; - case TCC_EVENT1_ACTION_NON_RECOVERABLE_FAULT: - evctrl |= TCC_EVCTRL_EVACT1_FAULT; - break; - default: - Assert(false); - /* Wrong configuration */ - return STATUS_ERR_INVALID_ARG; - } - } - uint32_t ch; - for(ch = 0; ch < TCC_NUM_CHANNELS; ch ++) { - if (events->generate_event_on_channel[ch]) { - evctrl |= (TCC_EVCTRL_MCEO(1) << ch); - } - if (events->on_event_perform_channel_action[ch]) { - evctrl |= (TCC_EVCTRL_MCEI(1) << ch); - } - } - if (events->generate_event_on_counter_overflow) { - evctrl |= TCC_EVCTRL_OVFEO; - } - if (events->generate_event_on_counter_retrigger) { - evctrl |= TCC_EVCTRL_TRGEO; - } - if (events->generate_event_on_counter_event) { - evctrl |= TCC_EVCTRL_CNTEO; - } - - tcc_module->EVCTRL.reg = evctrl; - - return STATUS_OK; -} - -/** - * \brief Disables the event input or output of a TCC instance. - * - * Disables one or more input or output events for the given TCC module. - * See \ref tcc_events for a list of events this module supports. - * - * \note Events cannot be altered while the module is enabled. - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] events Struct containing flags of events to disable - */ -void tcc_disable_events( - struct tcc_module *const module_inst, - struct tcc_events *const events) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - Assert(events); - - Tcc *const tcc_module = module_inst->hw; - - /* Check if it's enabled or resetting. */ - if (tcc_module->CTRLA.reg & (TCC_CTRLA_ENABLE | TCC_CTRLA_SWRST)) { - return; - } - - - uint32_t evctrl = 0; - uint32_t ch; - for(ch = 0; ch < TCC_NUM_CHANNELS; ch ++) { - if (events->generate_event_on_channel[ch]) { - evctrl |= (TCC_EVCTRL_MCEO(1) << ch); - } - if (events->on_event_perform_channel_action[ch]) { - evctrl |= (TCC_EVCTRL_MCEI(1) << ch); - } - } - if (events->generate_event_on_counter_overflow) { - evctrl |= TCC_EVCTRL_OVFEO; - } - if (events->generate_event_on_counter_retrigger) { - evctrl |= TCC_EVCTRL_TRGEO; - } - if (events->generate_event_on_counter_event) { - evctrl |= TCC_EVCTRL_CNTEO; - } - if (events->on_input_event_perform_action[0]) { - evctrl |= TCC_EVCTRL_TCEI0; - } - if (events->on_input_event_perform_action[1]) { - evctrl |= TCC_EVCTRL_TCEI1; - } - if (events->input_config[0].invert) { - evctrl |= TCC_EVCTRL_TCINV0; - } - if (events->input_config[1].invert) { - evctrl |= TCC_EVCTRL_TCINV1; - } - - tcc_module->EVCTRL.reg &= ~evctrl; -} - - - -/** - * \brief Sets count value for the given TCC module. - * - * Sets the timer count value of an initialized TCC module. The - * specified TCC module can remain running or stopped. - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] count New timer count value to set - * - * \return Status which indicates whether the new value is set. - * - * \retval STATUS_OK The timer count was updated successfully - * \retval STATUS_ERR_INVALID_ARG An invalid timer counter size was specified - */ -enum status_code tcc_set_count_value( - const struct tcc_module *const module_inst, - const uint32_t count) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance*/ - Tcc *const tcc_module = module_inst->hw; - /* Get a index of the module */ - uint8_t module_index = _tcc_get_inst_index(tcc_module); - - uint32_t max_count = _tcc_maxs[module_index]; - - if (count > max_count) { - return STATUS_ERR_INVALID_ARG; - } - - while (tcc_module->SYNCBUSY.reg & TCC_SYNCBUSY_COUNT) { - /* Wait for sync */ - } - - /* Write to based on the TCC dithering */ - tcc_module->COUNT.reg = (count); - - return STATUS_OK; -} - -/** - * \brief Get count value of the given TCC module. - * - * Retrieves the current count value of a TCC module. The specified TCC module - * can remain running or stopped. - * - * \param[in] module_inst Pointer to the software module instance struct - * - * \return Count value of the specified TCC module. - */ -uint32_t tcc_get_count_value( - const struct tcc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance*/ - Tcc *const tcc_module = module_inst->hw; - uint32_t last_cmd; - - /* Wait last command done */ - do { - while (tcc_module->SYNCBUSY.reg & TCC_SYNCBUSY_CTRLB) { - /* Wait for sync */ - } - last_cmd = tcc_module->CTRLBSET.reg & TCC_CTRLBSET_CMD_Msk; - if (TCC_CTRLBSET_CMD_NONE == last_cmd) { - /* Issue read command and break */ - tcc_module->CTRLBSET.bit.CMD = TCC_CTRLBSET_CMD_READSYNC_Val; - while (tcc_module->SYNCBUSY.reg & TCC_SYNCBUSY_CTRLB) { - /* Wait for sync */ - } - break; - } else if (TCC_CTRLBSET_CMD_READSYNC == last_cmd) { - /* Command have been issued */ - break; - } - } while (1); - - while (tcc_module->SYNCBUSY.reg & TCC_SYNCBUSY_COUNT) { - /* Wait for sync */ - } - return (tcc_module->COUNT.reg); -} - - - -/** - * \brief Gets the TCC module capture value. - * - * Retrieves the capture value in the indicated TCC module capture channel. - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] channel_index Index of the Compare Capture channel to read - * - * \return Capture value stored in the specified timer channel. - */ -uint32_t tcc_get_capture_value( - const struct tcc_module *const module_inst, - const enum tcc_match_capture_channel channel_index) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - Assert(channel_index < _tcc_cc_nums[_tcc_get_inst_index(module_inst->hw)]); - - /* Get a pointer to the module's hardware instance */ - Tcc *const tcc_module = module_inst->hw; - - while(tcc_module->SYNCBUSY.reg & (TCC_SYNCBUSY_CC0 << channel_index)) { - /* Sync wait */ - } - - return tcc_module->CC[channel_index].reg; -} - -/** - * \internal - * \brief Sets a TCC module compare value/buffer. - * - * Writes a compare value to the given TCC module compare/capture channel or - * buffer one. - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] channel_index Index of the compare channel to write to - * \param[in] compare New compare value/buffer value to set - * \param[in] double_buffering_enabled Set to \c true to write to CCBx - * - * \return Status of the compare update procedure. - * - * \retval STATUS_OK The compare value was updated successfully - * \retval STATUS_ERR_INVALID_ARG An invalid channel index was supplied or - * compare value exceed resolution - */ -static enum status_code _tcc_set_compare_value( - const struct tcc_module *const module_inst, - const enum tcc_match_capture_channel channel_index, - const uint32_t compare, - const bool double_buffering_enabled) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance */ - Tcc *const tcc_module = module_inst->hw; - /* Get a index of the module */ - uint8_t module_index = _tcc_get_inst_index(tcc_module); - - /* Check index */ - if (channel_index >= _tcc_cc_nums[module_index]) { - return STATUS_ERR_INVALID_ARG; - } - - uint32_t max_count = _tcc_maxs[module_index]; - - /* Check compare value */ - if (compare > max_count) { - return STATUS_ERR_INVALID_ARG; - } - - if (double_buffering_enabled) { -#if (SAML21) || (SAMC20) || (SAMC21) || (SAML22) || (SAMR30) - tcc_module->CCBUF[channel_index].reg = compare; -#else - while(tcc_module->SYNCBUSY.reg & - (TCC_SYNCBUSY_CCB0 << channel_index)) { - /* Sync wait */ - } - tcc_module->CCB[channel_index].reg = compare; -#endif - } else { - while(tcc_module->SYNCBUSY.reg & (TCC_SYNCBUSY_CC0 << channel_index)) { - /* Sync wait */ - } - tcc_module->CC[channel_index].reg = compare; - } - return STATUS_OK; -} - - -/** - * \brief Sets a TCC module compare value. - * - * Writes a compare value to the given TCC module compare/capture channel. - * - * If double buffering is enabled it always write to the buffer - * register. The value will then be updated immediately by calling - * \ref tcc_force_double_buffer_update(), or be updated when the lock update bit - * is cleared and the UPDATE condition happen. - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] channel_index Index of the compare channel to write to - * \param[in] compare New compare value to set - * - * \return Status of the compare update procedure. - * - * \retval STATUS_OK The compare value was updated successfully - * \retval STATUS_ERR_INVALID_ARG An invalid channel index was supplied or - * compare value exceed resolution - */ -enum status_code tcc_set_compare_value( - const struct tcc_module *const module_inst, - const enum tcc_match_capture_channel channel_index, - const uint32_t compare) -{ - /* Sanity check arguments */ - Assert(module_inst); - - return _tcc_set_compare_value(module_inst, channel_index, compare, - module_inst->double_buffering_enabled); -} - -/** - * \brief Sets a TCC module compare value and buffer value. - * - * Writes compare value and buffer to the given TCC module compare/capture - * channel. Usually as preparation for double buffer or circulared double buffer - * (circular buffer). - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] channel_index Index of the compare channel to write to - * \param[in] compare New compare value to set - * \param[in] compare_buffer New compare buffer value to set - * - * \return Status of the compare update procedure. - * - * \retval STATUS_OK The compare value was updated successfully - * \retval STATUS_ERR_INVALID_ARG An invalid channel index was supplied or - * compare value exceed resolution - */ -enum status_code tcc_set_double_buffer_compare_values( - struct tcc_module *const module_inst, - const enum tcc_match_capture_channel channel_index, - const uint32_t compare, const uint32_t compare_buffer) -{ - /* Sanity check arguments */ - Assert(module_inst); - - enum status_code status; - status = _tcc_set_compare_value(module_inst, channel_index, compare, false); - if (status != STATUS_OK) { - return status; - } - return _tcc_set_compare_value(module_inst, channel_index, compare_buffer, - true); -} - - -/** - * \internal - * \brief Set the timer TOP/PERIOD buffer/value. - * - * This function writes the given value to the PER/PERB register. - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] top_value New value to be loaded into the PER/PERB register - * \param[in] double_buffering_enabled Set to \c true to write to PERB - * - * \return Status of the TOP set procedure. - * - * \retval STATUS_OK The timer TOP value was updated successfully - * \retval STATUS_ERR_INVALID_ARG An invalid channel index was supplied or - * top/period value exceed resolution - */ -static enum status_code _tcc_set_top_value( - const struct tcc_module *const module_inst, - const uint32_t top_value, - const bool double_buffering_enabled) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance */ - Tcc *const tcc_module = module_inst->hw; - /* Get a index of the module */ - uint8_t module_index = _tcc_get_inst_index(tcc_module); - - uint32_t max_count = _tcc_maxs[module_index]; - - /* Check compare value */ - if (top_value > max_count) { - return STATUS_ERR_INVALID_ARG; - } - - if (double_buffering_enabled) { -#if (SAML21) || (SAMC20) || (SAMC21) || (SAML22) || (SAMR30) - tcc_module->PERBUF.reg = top_value; -#else - while(tcc_module->SYNCBUSY.reg & TCC_SYNCBUSY_PERB) { - /* Sync wait */ - } - tcc_module->PERB.reg = top_value; -#endif - } else { - while(tcc_module->SYNCBUSY.reg & TCC_SYNCBUSY_PER) { - /* Sync wait */ - } - tcc_module->PER.reg = top_value; - } - return STATUS_OK; -} - - -/** - * \brief Set the timer TOP/PERIOD value. - * - * This function writes the given value to the PER/PERB register. - * - * If double buffering is enabled it always write to the buffer - * register (PERB). The value will then be updated immediately by calling - * \ref tcc_force_double_buffer_update(), or be updated when the lock update bit - * is cleared and the UPDATE condition happen. - * - * When using MFRQ, the top value is defined by the CC0 register value and the - * PER value is ignored, so - * \ref tcc_set_compare_value (module,channel_0,value) must be used instead of - * this function to change the actual top value in that case. - * For all other waveforms operation the top value is defined by PER register - * value. - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] top_value New value to be loaded into the PER/PERB register - * - * \return Status of the TOP set procedure. - * - * \retval STATUS_OK The timer TOP value was updated successfully - * \retval STATUS_ERR_INVALID_ARG An invalid channel index was supplied or - * top/period value exceed resolution - */ -enum status_code tcc_set_top_value( - const struct tcc_module *const module_inst, - const uint32_t top_value) -{ - /* Sanity check arguments */ - Assert(module_inst); - - return _tcc_set_top_value(module_inst, top_value, - module_inst->double_buffering_enabled); -} - -/** - * \brief Set the timer TOP/PERIOD value and buffer value. - * - * This function writes the given value to the PER and PERB register. Usually as - * preparation for double buffer or circulared double buffer (circular buffer). - * - * When using MFRQ, the top values are defined by the CC0 and CCB0, the PER and - * PERB values are ignored, so - * \ref tcc_set_double_buffer_compare_values (module,channel_0,value,buffer) must - * be used instead of this function to change the actual top values in that - * case. For all other waveforms operation the top values are defined by PER and - * PERB registers values. - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] top_value New value to be loaded into the PER register - * \param[in] top_buffer_value New value to be loaded into the PERB register - * - * \return Status of the TOP set procedure. - * - * \retval STATUS_OK The timer TOP value was updated successfully - * \retval STATUS_ERR_INVALID_ARG An invalid channel index was supplied or - * top/period value exceed resolution - */ -enum status_code tcc_set_double_buffer_top_values( - const struct tcc_module *const module_inst, - const uint32_t top_value, const uint32_t top_buffer_value) -{ - /* Sanity check arguments */ - Assert(module_inst); - - enum status_code status; - status = _tcc_set_top_value(module_inst, top_value, false); - if (status != STATUS_OK) { - return status; - } - return _tcc_set_top_value(module_inst, top_buffer_value, true); -} - - -/** - * \brief Sets the TCC module waveform output pattern. - * - * Force waveform output line to generate specific pattern (0, 1, or as is). - * - * If double buffering is enabled it always write to the buffer - * register. The value will then be updated immediately by calling - * \ref tcc_force_double_buffer_update(), or be updated when the lock update bit - * is cleared and the UPDATE condition happen. - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] line_index Output line index - * \param[in] pattern Output pattern to use (\ref tcc_output_pattern) - * - * \return Status of the pattern set procedure. - * - * \retval STATUS_OK The PATT register is updated successfully - * \retval STATUS_ERR_INVALID_ARG An invalid line index was supplied - */ -enum status_code tcc_set_pattern( - const struct tcc_module *const module_inst, - const uint32_t line_index, - const enum tcc_output_pattern pattern) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance */ - Tcc *const tcc_module = module_inst->hw; - /* Get a index of the module */ - uint8_t module_index = _tcc_get_inst_index(tcc_module); - /* Get number of output lines */ - uint8_t ow_num = _tcc_ow_nums[module_index]; - - /* Check if line number is OK */ - if (line_index >= ow_num) { - return STATUS_ERR_INVALID_ARG; - } - - uint32_t patt_value; - - while(tcc_module->SYNCBUSY.reg & TCC_SYNCBUSY_PATT) { - /* Sync wait */ - } - patt_value = tcc_module->PATT.reg; - if (TCC_OUTPUT_PATTERN_DISABLE == pattern) { - patt_value &= ~(TCC_PATT_PGE0 << line_index); - } else if (TCC_OUTPUT_PATTERN_0 == pattern) { - patt_value &= ~(TCC_PATT_PGV0 << line_index); - patt_value |= (TCC_PATT_PGE0 << line_index); - } else { - patt_value |= ((TCC_PATT_PGE0 | TCC_PATT_PGV0) << line_index); - } - - if (module_inst->double_buffering_enabled) { -#if (SAML21) || (SAMC20) || (SAMC21) || (SAML22) || (SAMR30) - tcc_module->PATTBUF.reg = patt_value; -#else - while(tcc_module->SYNCBUSY.reg & TCC_SYNCBUSY_PATTB) { - /* Sync wait */ - } - tcc_module->PATTB.reg = patt_value; -#endif - } else { - tcc_module->PATT.reg = patt_value; - } - return STATUS_OK; -} - -/** - * \brief Retrieves the current module status. - * - * Retrieves the status of the module, giving overall state information. - * - * \param[in] module_inst Pointer to the TCC software instance struct - * - * \return Bitmask of \c TCC_STATUS_* flags. - * - * \retval TCC_STATUS_CHANNEL_MATCH_CAPTURE(n) Channel n match/capture has occured - * \retval TCC_STATUS_CHANNEL_OUTPUT(n) Channel n match/capture output state - * \retval TCC_STATUS_NON_RECOVERABLE_FAULT_OCCUR(x) Non-recoverable fault x has occured - * \retval TCC_STATUS_RECOVERABLE_FAULT_OCCUR(n) Recoverable fault n has occured - * \retval TCC_STATUS_NON_RECOVERABLE_FAULT_PRESENT(x) Non-recoverable fault x input present - * \retval TCC_STATUS_RECOVERABLE_FAULT_PRESENT(n) Recoverable fault n input present - * \retval TCC_STATUS_SYNC_READY None of register is syncing - * \retval TCC_STATUS_CAPTURE_OVERFLOW Timer capture data has overflowed - * \retval TCC_STATUS_COUNTER_EVENT Timer counter event has occurred - * \retval TCC_STATUS_COUNT_OVERFLOW Timer count value has overflowed - * \retval TCC_STATUS_COUNTER_RETRIGGERED Timer counter has been retriggered - * \retval TCC_STATUS_STOP Timer counter has been stopped - * \retval TCC_STATUS_RAMP_CYCLE_INDEX Wave ramp index for cycle - */ -uint32_t tcc_get_status( - struct tcc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - uint32_t int_flags = module_inst->hw->INTFLAG.reg; - uint32_t status_flags = module_inst->hw->STATUS.reg; - uint32_t status = 0; - int i; - - /* SYNC */ - if (module_inst->hw->SYNCBUSY.reg == 0) { - status |= TCC_STATUS_SYNC_READY; - } - - /* Channels */ - for (i = 0; i < TCC_NUM_CHANNELS; i++) { - if (int_flags & TCC_INTFLAG_MC(i)) { - status |= TCC_STATUS_CHANNEL_MATCH_CAPTURE(i); - } - if (status_flags & TCC_STATUS_CMP(i)) { - status |= TCC_STATUS_CHANNEL_OUTPUT(i); - } - } - /* Non-recoverable fault state */ - if ((int_flags & TCC_INTFLAG_FAULT1) || - (status_flags & TCC_STATUS_FAULT1)) { - status |= TCC_STATUS_NON_RECOVERABLE_FAULT_OCCUR(1); - } - if ((int_flags & TCC_INTFLAG_FAULT0) || - (status_flags & TCC_STATUS_FAULT0)) { - status |= TCC_STATUS_NON_RECOVERABLE_FAULT_OCCUR(0); - } - /* Non-recoverable fault inputs */ - if (status_flags & TCC_STATUS_FAULT0IN) { - status |= TCC_STATUS_NON_RECOVERABLE_FAULT_PRESENT(0); - } - if (status_flags & TCC_STATUS_FAULT1IN) { - status |= TCC_STATUS_NON_RECOVERABLE_FAULT_PRESENT(1); - } - /* Recoverable fault state */ - if ((int_flags & TCC_INTFLAG_FAULTB) || - (status_flags & TCC_STATUS_FAULTB)) { - status |= TCC_STATUS_RECOVERABLE_FAULT_OCCUR(1); - } - if ((int_flags & TCC_INTFLAG_FAULTA) || - (status_flags & TCC_STATUS_FAULTA)) { - status |= TCC_STATUS_RECOVERABLE_FAULT_OCCUR(0); - } - /* Recoverable fault inputs */ - if (status_flags & TCC_STATUS_FAULTAIN) { - status |= TCC_STATUS_RECOVERABLE_FAULT_PRESENT(0); - } - if (status_flags & TCC_STATUS_FAULTBIN) { - status |= TCC_STATUS_RECOVERABLE_FAULT_PRESENT(1); - } - - /* Check for TCC capture overflow */ - if (int_flags & TCC_INTFLAG_ERR) { - status |= TCC_STATUS_CAPTURE_OVERFLOW; - } - /* Check for TCC count counter */ - if (int_flags & TCC_INTFLAG_CNT) { - status |= TCC_STATUS_COUNTER_EVENT; - } - /* Check for TCC count retrigger */ - if (int_flags & TCC_INTFLAG_TRG) { - status |= TCC_STATUS_COUNTER_RETRIGGERED; - } - /* Check for TCC count overflow */ - if (int_flags & TCC_INTFLAG_OVF) { - status |= TCC_STATUS_COUNT_OVERFLOW; - } - /* Check for TCC count stop */ - if (status_flags & TCC_STATUS_STOP) { - status |= TCC_STATUS_STOPPED; - } - /* Check for TCC RAMP index */ - if (status_flags & TCC_STATUS_IDX) { - status |= TCC_STATUS_RAMP_CYCLE_INDEX; - } - return status; -} - -/** - * \brief Clears a module status flag. - * - * Clears the given status flag of the module. - * - * \param[in] module_inst Pointer to the TCC software instance struct - * \param[in] status_flags Bitmask of \c TCC_STATUS_* flags to clear - */ -void tcc_clear_status( - struct tcc_module *const module_inst, - const uint32_t status_flags) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - uint32_t int_clr = 0; - uint32_t status_clr = 0; - int i; - - /* Channels */ - for (i = 0; i < TCC_NUM_CHANNELS; i++) { - if (status_flags & TCC_STATUS_CHANNEL_MATCH_CAPTURE(i)) { - int_clr |= TCC_INTFLAG_MC(i); - } - } - /* Faults */ - if (status_flags & TCC_STATUS_NON_RECOVERABLE_FAULT_OCCUR(1)) { - int_clr |= TCC_INTFLAG_FAULT1; - status_clr |= TCC_STATUS_FAULT1; - } - if (status_flags & TCC_STATUS_NON_RECOVERABLE_FAULT_OCCUR(0)) { - int_clr |= TCC_INTFLAG_FAULT0; - status_clr |= TCC_STATUS_FAULT0; - } - if (status_flags & TCC_STATUS_RECOVERABLE_FAULT_OCCUR(1)) { - int_clr |= TCC_INTFLAG_FAULTB; - status_clr |= TCC_STATUS_FAULTB; - } - if (status_flags & TCC_STATUS_RECOVERABLE_FAULT_OCCUR(0)) { - int_clr |= TCC_INTFLAG_FAULTA; - status_clr |= TCC_STATUS_FAULTA; - } - /* Check for TCC capture overflow */ - if (status_flags & TCC_STATUS_CAPTURE_OVERFLOW) { - int_clr |= TCC_INTFLAG_ERR; - } - /* Check for TCC count counter */ - if (status_flags & TCC_STATUS_COUNTER_EVENT) { - int_clr |= TCC_INTFLAG_CNT; - } - /* Check for TCC count retrigger */ - if (status_flags & TCC_STATUS_COUNTER_RETRIGGERED) { - int_clr = TCC_INTFLAG_TRG; - } - /* Check for TCC count overflow */ - if (status_flags & TCC_STATUS_COUNT_OVERFLOW) { - int_clr |= TCC_INTFLAG_OVF; - } - /* Clear status flag */ - module_inst->hw->STATUS.reg = status_clr; - /* Clear interrupt flag */ - module_inst->hw->INTFLAG.reg = int_clr; -} - -/** - * \brief Enable circular option for double buffered compare values. - * - * Enable circular option for the double buffered channel compare values. - * On each UPDATE condition, the contents of CCBx and CCx are switched, meaning - * that the contents of CCBx are transferred to CCx and the contents of CCx are - * transferred to CCBx. - * - * \param[in] module_inst Pointer to the TCC software instance struct - * \param[in] channel_index Index of the compare channel to set up to - * - * \retval STATUS_OK The module was initialized successfully - * \retval STATUS_INVALID_ARG An invalid channel index is supplied - */ -enum status_code tcc_enable_circular_buffer_compare( - struct tcc_module *const module_inst, - enum tcc_match_capture_channel channel_index) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance */ - Tcc *const tcc_module = module_inst->hw; - /* Get a index of the module */ - uint8_t module_index = _tcc_get_inst_index(tcc_module); - - /* Check index */ - if (channel_index > 3) { - return STATUS_ERR_INVALID_ARG; - } - if (channel_index >= _tcc_cc_nums[module_index]) { - return STATUS_ERR_INVALID_ARG; - } - - tcc_module->WAVE.reg |= (TCC_WAVE_CICCEN0 << channel_index); - - return STATUS_OK; -} - -/** - * \brief Disable circular option for double buffered compare values. - * - * Stop circularing the double buffered compare values. - * - * \param[in] module_inst Pointer to the TCC software instance struct - * \param[in] channel_index Index of the compare channel to set up to - * - * \retval STATUS_OK The module was initialized successfully - * \retval STATUS_INVALID_ARG An invalid channel index is supplied - */ -enum status_code tcc_disable_circular_buffer_compare( - struct tcc_module *const module_inst, - enum tcc_match_capture_channel channel_index) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance */ - Tcc *const tcc_module = module_inst->hw; - /* Get a index of the module */ - uint8_t module_index = _tcc_get_inst_index(tcc_module); - - /* Check index */ - if (channel_index > 3) { - return STATUS_ERR_INVALID_ARG; - } - if (channel_index >= _tcc_cc_nums[module_index]) { - return STATUS_ERR_INVALID_ARG; - } - - tcc_module->WAVE.reg &= ~(TCC_WAVE_CICCEN0 << channel_index); - - return STATUS_OK; -} diff --git a/atmel-samd/asf/sam0/drivers/tcc/tcc.h b/atmel-samd/asf/sam0/drivers/tcc/tcc.h deleted file mode 100644 index 782c4322b..000000000 --- a/atmel-samd/asf/sam0/drivers/tcc/tcc.h +++ /dev/null @@ -1,2494 +0,0 @@ -/** - * \file - * - * \brief SAM TCC - Timer Counter for Control Applications Driver - * - * Copyright (C) 2013-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef TCC_H_INCLUDED -#define TCC_H_INCLUDED - -/** - * \defgroup asfdoc_sam0_tcc_group SAM Timer Counter for Control Applications (TCC) Driver - * - * This driver for Atmel® | SMART ARM®-based microcontrollers provides an interface for the configuration - * and management of the TCC module within the device, for waveform - * generation and timing operations. It also provides extended options for - * control applications. - * - * The following driver API modes are covered - * by this manual: - * - * - Polled APIs - * \if TCC_CALLBACK_MODE - * - Callback APIs - * \endif - * - * The following peripheral is used by this module: - * - TCC (Timer/Counter for Control Applications) - * - * The following devices can use this module: - * - Atmel | SMART SAM D21 - * - Atmel | SMART SAM R21 - * - Atmel | SMART SAM D10/D11 - * - Atmel | SMART SAM L21/L22 - * - Atmel | SMART SAM DA1 - * - Atmel | SMART SAM C20/C21 - * - Atmel | SMART SAM R30 - * - * The outline of this documentation is as follows: - * - \ref asfdoc_sam0_tcc_prerequisites - * - \ref asfdoc_sam0_tcc_module_overview - * - \ref asfdoc_sam0_tcc_special_considerations - * - \ref asfdoc_sam0_tcc_extra_info - * - \ref asfdoc_sam0_tcc_examples - * - \ref asfdoc_sam0_tcc_api_overview - * - * \section asfdoc_sam0_tcc_prerequisites Prerequisites - * - * There are no prerequisites for this module. - * - * \section asfdoc_sam0_tcc_module_overview Module Overview - * - * The Timer/Counter for Control Applications (TCC) module provides a set of - * timing and counting related functionality, such as the generation of periodic - * waveforms, the capturing of a periodic waveform's frequency/duty cycle, - * software timekeeping for periodic operations, waveform extension control, - * fault detection etc. - * - * The counter size of the TCC modules can be 16- or 24-bit depending on - * the TCC instance. - * Refer \ref asfdoc_sam0_tcc_special_considerations_tcc_d21 and - * \ref asfdoc_sam0_tcc_special_considerations_tcc_d11 for details on TCC instances. - * - * The TCC module for the SAM includes the following functions: - * - * - Generation of PWM signals - * - Generation of timestamps for events - * - General time counting - * - Waveform period capture - * - Waveform frequency capture - * - Additional control for generated waveform outputs - * - Fault protection for waveform generation - * - * \ref asfdoc_sam0_tcc_block_diagram "The diagram below" shows the overview - * of the TCC Module. - * - * \anchor asfdoc_sam0_tcc_block_diagram - * \image html overview.svg "Overview of the TCC Module" - * - * \subsection asfdoc_sam0_tcc_module_overview_parts Functional Description - * The TCC module consists of following sections: - * - Base Counter - * - Compare/Capture channels, with waveform generation - * - Waveform extension control and fault detection - * - Interface to the event system, DMAC, and the interrupt system - * - * The base counter can be configured to either count a prescaled generic - * clock or events from the event system.(TCEx, with event action configured - * to counting). - * The counter value can be used by compare/capture channels which can be - * set up either in compare mode or capture mode. - * - * In capture mode, the counter value is stored when a configurable event - * occurs. This mode can be used to generate timestamps used in event capture, - * or it can be used for the measurement of a periodic input signal's - * frequency/duty cycle. - * - * In compare mode, the counter value is compared against one or more of the - * configured channels' compare values. When the counter value coincides with a - * compare value an action can be taken automatically by the module, such as - * generating an output event or toggling a pin when used for frequency or PWM - * signal generation. - * - * \note The connection of events between modules requires the use of the - * \ref asfdoc_sam0_events_group "SAM Event System Driver (EVENTS)" - * to route output event of one module to the the input event of another. - * For more information on event routing, refer to the event driver - * documentation. - * - * In compare mode, when output signal is generated, extended waveform controls - * are available, to arrange the compare outputs into specific formats. - * The Output matrix can change the channel output routing. Pattern generation - * unit can overwrite the output signal line to specific state. - * The Fault protection feature of the TCC supports recoverable and - * non-recoverable faults. - * - * \subsection asfdoc_sam0_tcc_module_overview_tc Base Timer/Counter - * - * \subsubsection asfdoc_sam0_tcc_module_overview_tc_size Timer/Counter Size - * Each TCC has a counter size of either 16- or 24-bits. The size of the - * counter determines the maximum value it can count to before an overflow - * occurs. - * \ref asfdoc_sam0_tcc_count_size_vs_top "The table below" shows the - * maximum values for each of the possible counter sizes. - * - * \anchor asfdoc_sam0_tcc_count_size_vs_top - * <table> - * <caption>Timer Counter Sizes and Their Maximum Count Values</caption> - * <tr> - * <th>Counter size</th> - * <th>Max. (hexadecimal)</th> - * <th>Max. (decimal)</th> - * </tr> - * <tr> - * <td>16-bit</td> - * <td>0xFFFF</td> - * <td>65,535</td> - * </tr> - * <tr> - * <td>24-bit</td> - * <td>0xFFFFFF</td> - * <td>16,777,215</td> - * </tr> - * </table> - * - * The period/top value of the counter can be set, to define counting period. - * This will allow the counter to overflow when the counter value reaches the - * period/top value. - * - * \subsubsection asfdoc_sam0_tcc_module_overview_tc_clk Timer/Counter Clock and Prescaler - * TCC is clocked asynchronously to the system clock by a GCLK - * (Generic Clock) channel. The GCLK channel can be connected to any of the GCLK - * generators. The GCLK generators are configured to use one of the available - * clock sources in the system such as internal oscillator, external crystals, - * etc. See the \ref asfdoc_sam0_system_clock_group "Generic Clock driver" for - * more information. - * - * Each TCC module in the SAM has its own individual clock prescaler, which - * can be used to divide the input clock frequency used by the counter. This - * prescaler only scales the clock used to provide clock pulses for the counter - * to count, and does not affect the digital register interface portion of - * the module, thus the timer registers will be synchronized to the raw GCLK - * frequency input to the module. - * - * As a result of this, when selecting a GCLK frequency and timer prescaler - * value, the user application should consider both the timer resolution - * required and the synchronization frequency to avoid lengthy - * synchronization times of the module if a very slow GCLK frequency is fed - * into the TCC module. It is preferable to use a higher module GCLK frequency - * as the input to the timer, and prescale this down as much as possible to - * obtain a suitable counter frequency in latency-sensitive applications. - * - * \subsubsection asfdoc_sam0_tcc_module_overview_tc_ctrl Timer/Counter Control Inputs (Events) - * - * The TCC can take several actions on the occurrence of an input event. - * The event actions are listed - * in \ref asfdoc_sam0_tcc_module_event_act "events action settings". - * - * \anchor asfdoc_sam0_tcc_module_event_act - * <table> - * <caption>TCC Module Event Actions</caption> - * <tr> - * <th>Event action</th> - * <th>Description</th> - * <th>Applied event</th> - * </tr> - * <tr> - * <td>TCC_EVENT_ACTION_OFF</td> - * <td>No action on the event input</td> - * <td>All</td> - * </tr> - * <tr> - * <td>TCC_EVENT_ACTION_RETRIGGER</td> - * <td>Re-trigger Counter on event</td> - * <td>All</td> - * </tr> - * <tr> - * <td>TCC_EVENT_ACTION_NON_RECOVERABLE_FAULT</td> - * <td>Generate Non-Recoverable Fault on event</td> - * <td>All</td> - * </tr> - * <tr> - * <td>TCC_EVENT_ACTION_START</td> - * <td>Counter start on event</td> - * <td>EV0</td> - * </tr> - * <tr> - * <td>TCC_EVENT_ACTION_DIR_CONTROL</td> - * <td>Counter direction control</td> - * <td>EV0</td> - * </tr> - * <tr> - * <td>TCC_EVENT_ACTION_DECREMENT</td> - * <td>Counter decrement on event</td> - * <td>EV0</td> - * </tr> - * <tr> - * <td>TCC_EVENT_ACTION_PERIOD_PULSE_WIDTH_CAPTURE</td> - * <td>Capture pulse period and pulse width</td> - * <td>EV0</td> - * </tr> - * <tr> - * <td>TCC_EVENT_ACTION_PULSE_WIDTH_PERIOD_CAPTURE</td> - * <td>Capture pulse width and pulse period</td> - * <td>EV0</td> - * </tr> - * <tr> - * <td>TCC_EVENT_ACTION_STOP</td> - * <td>Counter stop on event</td> - * <td>EV1</td> - * </tr> - * <tr> - * <td>TCC_EVENT_ACTION_COUNT_EVENT</td> - * <td>Counter count on event</td> - * <td>EV1</td> - * </tr> - * <tr> - * <td>TCC_EVENT_ACTION_INCREMENT</td> - * <td>Counter increment on event</td> - * <td>EV1</td> - * </tr> - * <tr> - * <td>TCC_EVENT_ACTION_COUNT_DURING_ACTIVE</td> - * <td>Counter count during active state of asynchronous event</td> - * <td>EV1</td> - * </tr> - * </table> - * - * \subsubsection asfdoc_sam0_tcc_module_overview_tc_reload Timer/Counter Reloading - * - * The TCC also has a configurable reload action, used when a - * re-trigger event occurs. Examples of a re-trigger event could be the counter - * reaching the maximum value when counting up, or when an event from the event - * system makes the counter to re-trigger. The reload action determines if the - * prescaler should be reset, and on which clock. The counter will - * always be reloaded with the value it is set to start counting. The user - * can choose between three different reload actions, described in - * \ref asfdoc_sam0_tcc_module_reload_act "the table below". - * - * \anchor asfdoc_sam0_tcc_module_reload_act - * <table> - * <caption>TCC Module Reload Actions</caption> - * <tr> - * <th>Reload action</th> - * <th>Description</th> - * </tr> - * <tr> - * <td>TCC_RELOAD_ACTION_GCLK</td> - * <td>Reload TCC counter value on next GCLK cycle. Leave prescaler - * as-is.</td> - * </tr> - * <tr> - * <td>TCC_RELOAD_ACTION_PRESC</td> - * <td>Reloads TCC counter value on next prescaler clock. Leave prescaler - * as-is.</td> - * </tr> - * <tr> - * <td>TCC_RELOAD_ACTION_RESYNC</td> - * <td>Reload TCC counter value on next GCLK cycle. Clear prescaler to - * zero.</td> - * </tr> - * </table> - * - * The reload action to use will depend on the specific application being - * implemented. One example is when an external trigger for a reload occurs; if - * the TCC uses the prescaler, the counter in the prescaler should not have a - * value between zero and the division factor. The counter in the TCC module - * and the counter in the prescaler should both start at zero. - * If the counter is set to re-trigger when it reaches the maximum value, - * this is not the right option to use. In such a case it would be better if - * the prescaler is left unaltered when the re-trigger happens, letting the - * counter reset on the next GCLK cycle. - * - * \subsubsection asfdoc_sam0_tcc_module_overview_tc_oneshot One-shot Mode - * - * The TCC module can be configured in one-shot mode. When configured in this - * manner, starting the timer will cause it to count until the next overflow - * or underflow condition before automatically halting, waiting to be manually - * triggered by the user application software or an event from the event - * system. - * - * \subsection asfdoc_sam0_tcc_module_overview_capt Capture Operations - * - * In capture operations, any event from the event system or a pin change can - * trigger a capture of the counter value. This captured counter value can be - * used as timestamps for the events, or it can be used in frequency and pulse - * width capture. - * - * \subsubsection asfdoc_sam0_tcc_module_overview_capt_ev Capture Operations - Event - * - * Event capture is a simple use of the capture functionality, - * designed to create timestamps for specific events. When the input event - * appears, the current counter value is copied into the corresponding - * compare/capture register, which can then be read by the user application. - * - * Note that when performing any capture operation, there is a risk that the - * counter reaches its top value (MAX) when counting up, or the bottom value - * (zero) when counting down, before the capture event occurs. This can distort - * the result, making event timestamps to appear shorter than they really are. - * In this case, the user application should check for timer overflow when - * reading a capture result in order to detect this situation and perform an - * appropriate adjustment. - * - * Before checking for a new capture, \ref TCC_STATUS_COUNT_OVERFLOW - * should be checked. The response to an overflow error is left to the user - * application, however, it may be necessary to clear both the overflow - * flag and the capture flag upon each capture reading. - * - * \subsubsection asfdoc_sam0_tcc_module_overview_capt_pulse Capture Operations - Pulse Width - * - * Pulse Width Capture mode makes it possible to measure the pulse width and - * period of PWM signals. This mode uses two capture channels of the counter. - * There are two modes for pulse width capture; - * Pulse Width Period (PWP) and Period Pulse Width (PPW). In PWP mode, capture - * channel 0 is used for storing the pulse width and capture channel 1 stores - * the observed period. While in PPW mode, the roles of the two capture channels - * are reversed. - * - * As in the above example it is necessary to poll on interrupt flags to see - * if a new capture has happened and check that a capture overflow error has - * not occurred. - * - * Refer to \ref asfdoc_sam0_tcc_module_overview_tc_ctrl to set up the input - * event to perform pulse width capture. - * - * \subsection asfdoc_sam0_tcc_module_overview_mc Compare Match Operation - * - * In compare match operation, Compare/Capture registers are compared - * with the counter value. When the timer's count value matches the value of a - * compare channel, a user defined action can be taken. - * - * \subsubsection asfdoc_sam0_tcc_module_overview_mc_timer Basic Timer - * - * A Basic Timer is a simple application where compare match operation is used - * to determine when a specific period has elapsed. In Basic Timer operations, - * one or more values in the module's Compare/Capture registers are used to - * specify the time (in terms of the number of prescaled GCLK cycles, or - * input events) at which - * an action should be taken by the microcontroller. This can be an Interrupt - * Service Routine (ISR), event generation via the event system, or a software - * flag that is polled from the user application. - * - * \subsubsection asfdoc_sam0_tcc_module_overview_mc_wave Waveform Generation - * - * Waveform generation enables the TCC module to generate square waves, or, if - * combined with an external passive low-pass filter, analog waveforms. - * - * \subsubsection asfdoc_sam0_tcc_module_overview_mc_wave_pwm Waveform Generation - PWM - * - * Pulse width modulation is a form of waveform generation and a signalling - * technique that can be useful in many applications. When PWM mode is used, - * a digital pulse train with a configurable frequency and duty cycle can be - * generated by the TCC module and output to a GPIO pin of the device. - * - * Often PWM is used to communicate a control or information parameter to an - * external circuit or component. Differing impedances of the source generator - * and sink receiver circuits is less of an issue when using PWM compared to - * using an analog voltage value, as noise will not generally affect the - * signal's integrity to a meaningful extent. - * - * \ref asfdoc_sam0_tcc_module_pwm_single_diag "The figure below" illustrates - * operations and different states of the counter and its output when using - * the timer in Normal PWM mode (Single Slope). As can be seen, the TOP/PERIOD - * value is - * unchanged and is set to MAX. The compare match value is changed at several - * points to illustrate the resulting waveform output changes. The PWM output is - * set to normal (i.e. non-inverted) output mode. - * - * \anchor asfdoc_sam0_tcc_module_pwm_single_diag - * \image html pwm_single_ex.svg "Example Of PWM In Single-Slope Mode, and Different Counter Operations" - * - * Several PWM modes are supported by the TCC module, refer to - * datasheet for the details on PWM waveform generation. - * - * \subsubsection asfdoc_sam0_tcc_module_overview_mc_wave_freq Waveform Generation - Frequency - * - * Normal Frequency Generation is in many ways identical to PWM generation. - * However, only in Frequency Generation, a toggle occurs on the output when a - * match on a compare channels occurs. - * - * When the Match Frequency Generation is used, the timer value is reset on - * match condition, resulting in a variable frequency square wave with a - * fixed 50% duty cycle. - * - * \subsection asfdoc_sam0_tcc_module_overview_ext Waveform Extended Controls - * - * \subsubsection asfdoc_sam0_tcc_module_overview_ext_pat Pattern Generation - * - * Pattern insertion allows the TCC module to change the actual pin output level - * without modifying the compare/match settings. - * - * \anchor asfdoc_sam0_tcc_module_pattern_gen - * <table> - * <caption>TCC Module Output Pattern Generation</caption> - * <tr> - * <th>Pattern</th> - * <th>Description</th> - * </tr> - * <tr> - * <td>TCC_OUTPUT_PATTERN_DISABLE</td> - * <td>Pattern disabled, generate output as is</td> - * </tr> - * <tr> - * <td>TCC_OUTPUT_PATTERN_0</td> - * <td>Generate pattern 0 on output (keep the output LOW)</td> - * </tr> - * <tr> - * <td>TCC_OUTPUT_PATTERN_1</td> - * <td>Generate pattern 1 on output (keep the output HIGH)</td> - * </tr> - * </table> - * - * \subsubsection asfdoc_sam0_tcc_module_overview_ext_r_fault Recoverable Faults - * - * The recoverable faults can trigger one or several of following fault actions: - * -# *Halt* action: The recoverable faults can halt the TCC timer/counter, - * so that the final output wave is kept at a defined state. When the fault - * state is removed it is possible to recover the counter and waveform - * generation. The halt action is defined as: - * \anchor asfdoc_sam0_tcc_module_fault_halt_action - * <table> - * <caption>TCC Module Recoverable Fault Halt Actions</caption> - * <tr> - * <th>Action</th> - * <th>Description</th> - * </tr> - * <tr> - * <td>TCC_FAULT_HALT_ACTION_DISABLE</td> - * <td>Halt action is disabled</td> - * </tr> - * <tr> - * <td>TCC_FAULT_HALT_ACTION_HW_HALT</td> - * <td>The timer/counter is halted as long as the corresponding fault is - * present</td> - * </tr> - * <tr> - * <td>TCC_FAULT_HALT_ACTION_SW_HALT</td> - * <td>The timer/counter is halted until the corresponding fault is removed - * and fault state cleared by software</td> - * </tr> - * <tr> - * <td>TCC_FAULT_HALT_ACTION_NON_RECOVERABLE</td> - * <td>Force all the TCC output pins to a pre-defined level, as what - * Non-Recoverable Fault do</td> - * </tr> - * </table> - * -# *Restart* action: When enabled, the recoverable faults can restart the TCC - * timer/counter. - * -# *Keep* action: When enabled, the recoverable faults can keep the - * corresponding channel output to zero when the fault condition is present. - * -# *Capture* action: When the recoverable fault occurs, the capture action can - * time stamps the corresponding fault. The following capture mode is - * supported: - * \anchor asfdoc_sam0_tcc_module_fault_capt_action - * <table> - * <caption>TCC Module Recoverable Fault Capture Actions</caption> - * <tr> - * <th>Action</th> - * <th>Description</th> - * </tr> - * <tr> - * <td>TCC_FAULT_CAPTURE_DISABLE</td> - * <td>Capture action is disabled</td> - * </tr> - * <tr> - * <td>TCC_FAULT_CAPTURE_EACH</td> - * <td>Equivalent to standard capture operation, on each fault occurrence - * the time stamp is captured</td> - * </tr> - * <tr> - * <td>TCC_FAULT_CAPTURE_MINIMUM</td> - * <td>Get the minimum time stamped value in all time stamps</td> - * </tr> - * <tr> - * <td>TCC_FAULT_CAPTURE_MAXIMUM</td> - * <td>Get the maximum time stamped value in all time stamps</td> - * </tr> - * <tr> - * <td>TCC_FAULT_CAPTURE_SMALLER</td> - * <td>Time stamp the fault input if the value is smaller than last one</td> - * </tr> - * <tr> - * <td>TCC_FAULT_CAPTURE_BIGGER</td> - * <td>Time stamp the fault input if the value is bigger than last one</td> - * </tr> - * <tr> - * <td>TCC_FAULT_CAPTURE_CHANGE</td> - * <td>Time stamp the fault input if the time stamps changes its increment - * direction</td> - * </tr> - * </table> - * - * In TCC module, only the first two compare channels (CC0 and CC1) can work - * with recoverable fault inputs. The corresponding event inputs (TCCx MC0 - * and TCCx MC1) are then used as fault inputs respectively. - * The faults are called Fault A and Fault B. - * - * The recoverable fault can be filtered or effected by corresponding channel - * output. On fault condition there are many other settings that can be chosen. - * Refer to data sheet for more details about the recoverable fault - * operations. - * - * \subsubsection asfdoc_sam0_tcc_module_overview_ext_n_fault Non-Recoverable Faults - * - * The non-recoverable faults force all the TCC output pins to a pre-defined - * level (can be forced to 0 or 1). The input control signal of non-recoverable - * fault is from timer/counter event (TCCx EV0 and TCCx EV1). - * To enable non-recoverable fault, - * corresponding TCEx event action must be set to non-recoverable fault action - * (\ref TCC_EVENT_ACTION_NON_RECOVERABLE_FAULT). - * Refer to \ref asfdoc_sam0_tcc_module_overview_tc_ctrl to see the available - * event input action. - * - * \subsection asfdoc_sam0_tcc_module_overview_buffering Double and Circular Buffering - * - * The pattern, period, and the compare channels registers are double buffered. - * For these options there are effective registers (PATT, PER, and CCx) and - * buffer registers (PATTB, PERB, and CCx). When writing to the buffer - * registers, the values are buffered and will be committed to effective - * registers on UPDATE condition. - * - * Usually the buffered value is cleared after it is committed, but there is also - * an option to circular the register buffers. The period (PER) and four lowest - * compare channels register (CCx, x is 0 ~ 3) support this function. When - * circular buffer is used, on UPDATE the previous period or compare values are - * copied back into the corresponding period buffer and compare buffers. - * This way, the register value and its buffer register value is actually - * switched on UPDATE condition, and will be switched back on next UPDATE - * condition. - * - * For input capture, the buffer register (CCBx) and the corresponding capture - * channel register (CCx) act like a FIFO. When regular register (CCx) is empty - * or read, any content in the buffer register is passed to regular one. - * - * In TCC module driver, when the double buffering write is enabled, any - * write through \ref tcc_set_top_value(), \ref tcc_set_compare_value(), and - * \ref tcc_set_pattern() will be done to the corresponding buffer register. - * Then the value in the buffer register will be transferred to the regular - * register on the next UPDATE condition or by a force UPDATE using - * \ref tcc_force_double_buffer_update(). - * - * \subsection asfdoc_sam0_tcc_module_overview_sleep Sleep Mode - * - * TCC modules can be configured to operate in any sleep mode, with its "run - * in standby" function enabled. It can wake up the device using interrupts or - * perform internal actions with the help of the Event System. - * - * \section asfdoc_sam0_tcc_special_considerations Special Considerations - * - * \subsection asfdoc_sam0_tcc_special_considerations_specific_features Driver Feature Macro Definition - * \ref asfdoc_sam0_tcc_feature_table "The table below" shows some specific features - * of the TCC Module. - * - * \anchor asfdoc_sam0_tcc_feature_table - * <table> - * <caption>TCC Module Specific Features</caption> - * <tr> - * <th>Driver Feature Macro</th> - * <th>Supported devices</th> - * </tr> - * <tr> - * <td>FEATURE_TCC_GENERATE_DMA_TRIGGER</td> - * <td>SAM L21/L22/R30</td> - * </tr> - * </table> - * - * \note The specific features are only available in the driver when the - * selected device supports those features. - * - * \subsection asfdoc_sam0_tcc_special_considerations_tcc_feature Module Features - * - * The features of TCC, such as timer/counter size, number of compare capture - * channels, and number of outputs, are dependent on the TCC module instance being - * used. - * - * \subsubsection asfdoc_sam0_tcc_special_considerations_tcc_d21 SAM TCC Feature List - * For SAM D21/R21/L21/L22/DA1/C21/R30, the TCC features are: - * \anchor asfdoc_sam0_tcc_features_d21 - * <table> - * <caption>TCC module features for SAM D21/R21/L21/L22/DA1/C21/R30</caption> - * <tr> - * <th>TCC#</th> - * <th>Match/Capture channels</th> - * <th>Wave outputs</th> - * <th>Counter size [bits]</th> - * <th>Fault</th> - * <th>Dithering</th> - * <th>Output matrix</th> - * <th>Dead-Time insertion</th> - * <th>SWAP</th> - * <th>Pattern</th> - * </tr> - * <tr> - * <td>0</td> - * <td>4</td> - * <td>8</td> - * <td>24</td> - * <td>Y</td> - * <td>Y</td> - * <td>Y</td> - * <td>Y</td> - * <td>Y</td> - * <td>Y</td> - * </tr> - * <tr> - * <td>1</td> - * <td>2</td> - * <td>4</td> - * <td>24</td> - * <td>Y</td> - * <td>Y</td> - * <td></td> - * <td></td> - * <td></td> - * <td>Y</td> - * </tr> - * <tr> - * <td>2</td> - * <td>2</td> - * <td>2</td> - * <td>16</td> - * <td>Y</td> - * <td></td> - * <td></td> - * <td></td> - * <td></td> - * <td></td> - * </tr> - * </table> - * - * \subsubsection asfdoc_sam0_tcc_special_considerations_tcc_d11 SAM D10/D11 TCC Feature List - * For SAM D10/D11, the TCC features are: - * \anchor asfdoc_sam0_tcc_features_d11 - * <table> - * <caption>TCC Module Features For SAM D10/D11</caption> - * <tr> - * <th>TCC#</th> - * <th>Match/Capture channels</th> - * <th>Wave outputs</th> - * <th>Counter size [bits]</th> - * <th>Fault</th> - * <th>Dithering</th> - * <th>Output matrix</th> - * <th>Dead-Time insertion</th> - * <th>SWAP</th> - * <th>Pattern</th> - * </tr> - * <tr> - * <td>0</td> - * <td>4</td> - * <td>8</td> - * <td>24</td> - * <td>Y</td> - * <td>Y</td> - * <td>Y</td> - * <td>Y</td> - * <td>Y</td> - * <td>Y</td> - * </tr> - * </table> - * - * \subsection asfdoc_sam0_tcc_special_considerations_tcc_pin Channels vs. Pinouts - * - * As the TCC module may have more waveform output pins than the number of - * compare/capture channels, the free pins (with number higher than number of - * channels) will reuse the waveform generated by channels subsequently. E.g., - * if the number of channels is four and the number of wave output pins is eight, channel - * 0 output will be available on out pin 0 and 4, channel 1 output - * on wave out pin 1 and 5, and so on. - * - * \section asfdoc_sam0_tcc_extra_info Extra Information - * - * For extra information, see \ref asfdoc_sam0_tcc_extra. This includes: - * - \ref asfdoc_sam0_tcc_extra_acronyms - * - \ref asfdoc_sam0_tcc_extra_dependencies - * - \ref asfdoc_sam0_tcc_extra_errata - * - \ref asfdoc_sam0_tcc_extra_history - * - * - * \section asfdoc_sam0_tcc_examples Examples - * - * For a list of examples related to this driver, see - * \ref asfdoc_sam0_tcc_exqsg. - * - * \section asfdoc_sam0_tcc_api_overview API Overview - * @{ - */ - -#include <compiler.h> -#include <clock.h> -#include <gclk.h> -#include <pinmux.h> - -/** Maximum number of channels supported by the driver - * (Channel index from 0 to \c TCC_NUM_CHANNELS - 1). - */ -#define TCC_NUM_CHANNELS 4 - -/** Maximum number of wave outputs lines supported by the driver - * (Output line index from 0 to \c TCC_NUM_WAVE_OUTPUTS - 1). - */ -#define TCC_NUM_WAVE_OUTPUTS 8 - -/** Maximum number of (recoverable) faults supported by the driver. */ -#define TCC_NUM_FAULTS 2 - -#if TCC_ASYNC == true -# include <system_interrupt.h> -#endif - -/** - * \name Driver Feature Definition - * Define port features set according to different device family. - * @{ -*/ -#if (SAML21) || (SAML22) || (SAMR30) || defined(__DOXYGEN__) -/** Generate DMA triggers */ -# define FEATURE_TCC_GENERATE_DMA_TRIGGER -#endif -/*@}*/ - -#ifdef __cplusplus -extern "C" { -#endif - -/** Generates a table enum list entry for a given type - and index (e.g. "TCC_CALLBACK_MC_CHANNEL_0,"). */ -#define _TCC_ENUM(n, type) TCC_##type##_##n, - -/** Generates table enum list entries for all channels of a - given type and channel number on TCC module. */ -#define _TCC_CHANNEL_ENUM_LIST(type) \ - MREPEAT(TCC_NUM_CHANNELS, _TCC_ENUM, type##_CHANNEL) -/** Generates table enum list entries for all output of a - given type and waveform output number on TCC module. */ -#define _TCC_WO_ENUM_LIST(type) \ - MREPEAT(TCC_NUM_WAVE_OUTPUTS, _TCC_ENUM, type) - - -#if TCC_ASYNC == true -/** Enum for the possible callback types for the TCC module. */ -enum tcc_callback { - /** Callback for TCC overflow */ - TCC_CALLBACK_OVERFLOW, - /** Callback for TCC Retrigger */ - TCC_CALLBACK_RETRIGGER, - /** Callback for TCC counter event */ - TCC_CALLBACK_COUNTER_EVENT, - /** Callback for capture overflow error */ - TCC_CALLBACK_ERROR, - /** Callback for Recoverable Fault A */ - TCC_CALLBACK_FAULTA, - /** Callback for Recoverable Fault B */ - TCC_CALLBACK_FAULTB, - /** Callback for Non-Recoverable Fault 0 */ - TCC_CALLBACK_FAULT0, - /** Callback for Non-Recoverable Fault 1 */ - TCC_CALLBACK_FAULT1, - -# if defined(__DOXYGEN__) - /** Channel callback type table for TCC - * - * Each TCC module may contain several callback types for channels; each - * channel will have its own callback type in the table, with the channel - * index number substituted for "n" in the channel callback type - * (e.g. \c TCC_MATCH_CAPTURE_CHANNEL_0). - */ - TCC_CALLBACK_CHANNEL_n = n, -# else - /** Callbacks for Match/Capture channels, e.g., TCC_CALLBACK_CHANNEL_0 */ - _TCC_CHANNEL_ENUM_LIST(CALLBACK) -# endif - -# if !defined(__DOXYGEN__) - /** Number of available callbacks */ - TCC_CALLBACK_N -# endif -}; -#endif /* #if TCC_ASYNC == true */ - -/** - * \name Module Status Flags - * - * TCC status flags, returned by \ref tcc_get_status() and cleared by - * \ref tcc_clear_status(). - * - * @{ - */ - -/** Timer channel \c ch (0 ~ 3) has matched against its compare value, - * or has captured a new value. - */ -#define TCC_STATUS_CHANNEL_MATCH_CAPTURE(ch) (1UL << (ch)) -/** Timer channel \c ch (0 ~ 3) match/compare output state. */ -#define TCC_STATUS_CHANNEL_OUTPUT(ch) (1UL << ((ch)+8)) -/** A Non-Recoverable Fault \c x (0 ~ 1) has occurred. */ -#define TCC_STATUS_NON_RECOVERABLE_FAULT_OCCUR(x) (1UL << ((x)+16)) -/** A Recoverable Fault \c n (0 ~ 1 representing A ~ B) has occured. */ -#define TCC_STATUS_RECOVERABLE_FAULT_OCCUR(n) (1UL << ((n)+18)) -/** The Non-Recoverable Fault \c x (0 ~ 1) input is present. */ -#define TCC_STATUS_NON_RECOVERABLE_FAULT_PRESENT(x) (1UL << ((x)+20)) -/** A Recoverable Fault \c n (0 ~ 1 representing A ~ B) is present. */ -#define TCC_STATUS_RECOVERABLE_FAULT_PRESENT(n) (1UL << ((n)+22)) -/** Timer registers synchronization has completed, and the synchronized count - * value may be read. - */ -#define TCC_STATUS_SYNC_READY (1UL << 23) -/** A new value was captured before the previous value was read, resulting in - * lost data. - */ -#define TCC_STATUS_CAPTURE_OVERFLOW (1UL << 24) -/** A counter event occurred. */ -#define TCC_STATUS_COUNTER_EVENT (1UL << 25) -/** A counter retrigger occurred. */ -#define TCC_STATUS_COUNTER_RETRIGGERED (1UL << 26) -/** The timer count value has overflowed from its maximum value to its minimum - * when counting upward, or from its minimum value to its maximum when - * counting downward. - */ -#define TCC_STATUS_COUNT_OVERFLOW (1UL << 27) -/** Ramp period cycle index. - * In ramp operation, each two period cycles are marked as cycle A and B, - * the index 0 represents cycle A and 1 represents cycle B. */ -#define TCC_STATUS_RAMP_CYCLE_INDEX (1UL << 28) -/** The counter has been stopped (due to disable, stop command, or one-shot). */ -#define TCC_STATUS_STOPPED (1UL << 29) - -/** @} */ - -/** - * \brief Index of the match capture channels - * - * This enum is used to specify which capture/match channel to do - * operations on. - */ -enum tcc_match_capture_channel { -# if defined(__DOXYGEN__) - /** Match capture channel index table for TCC - * - * Each TCC module may contain several match capture channels; each channel - * will have its own index in the table, with the index number substituted - * for "n" in the index name (e.g. \c TCC_MATCH_CAPTURE_CHANNEL_0). - */ - TCC_MATCH_CAPTURE_CHANNEL_n = n, -# else - /** Indexes of match capture channels, e.g., TCC_MATCH_CAPTURE_CHANNEL_0 */ - _TCC_CHANNEL_ENUM_LIST(MATCH_CAPTURE) -# endif -# if !defined(__DOXYGEN__) - /** Number of supported channels */ - TCC_MATCH_CAPTURE_CHANNEL_N -# endif -}; - -/** - * \brief Index of the wave outputs - * - * This enum is used to specify which wave output to do - * operations on. - */ -enum tcc_wave_output { -# if defined(__DOXYGEN__) - /** Waveform output index table for TCC - * - * Each TCC module may contain several wave outputs; each output - * will have its own index in the table, with the index number substituted - * for "n" in the index name (e.g. \c TCC_WAVE_OUTPUT_0). - */ - TCC_WAVE_OUTPUT_n = n, -# else - /** Indexes of match capture channels, e.g., TCC_WAVEFORM_OUTPUT_0 */ - _TCC_WO_ENUM_LIST(WAVE_OUTPUT) -# endif -# if !defined(__DOXYGEN__) - /** Number of supported channels */ - TCC_WAVE_OUTPUT_N -# endif -}; - -/** - * \brief TCC wave generation mode enum - * - * This enum is used to specify the waveform generation mode. - * - */ -enum tcc_wave_generation { - /** Normal Frequency: Top is the PER register, output toggled on each - * compare match */ - TCC_WAVE_GENERATION_NORMAL_FREQ = 0, - /** Match Frequency: Top is CC0 register, output toggles on each update - * condition */ - TCC_WAVE_GENERATION_MATCH_FREQ = 1, - /** Single-Slope PWM: Top is the PER register, CCx controls duty cycle - * (output active when count is greater than CCx) */ - TCC_WAVE_GENERATION_SINGLE_SLOPE_PWM = 2, - - /** Double-slope (count up and down), non centre-aligned: Top is the PER - * register, CC[x] controls duty cycle while counting up and CC[x+N/2] - * controls it while counting down */ - TCC_WAVE_GENERATION_DOUBLE_SLOPE_CRITICAL = 4, - /** Double-slope (count up and down), interrupt/event at Bottom (Top is the - * PER register, output active when count is greater than CCx) */ - TCC_WAVE_GENERATION_DOUBLE_SLOPE_BOTTOM = 5, - /** Double-slope (count up and down), interrupt/event at Bottom and Top: (Top is the - * PER register, output active when count is lower than CCx) */ - TCC_WAVE_GENERATION_DOUBLE_SLOPE_BOTH = 6, - /** Double-slope (count up and down), interrupt/event at Top (Top is the - * PER register, output active when count is greater than CCx) */ - TCC_WAVE_GENERATION_DOUBLE_SLOPE_TOP = 7, -}; - -/** - * \brief Polarity of TCC wave generation on channels - * - * Specifies whether the wave output needs to be inverted or not. - */ -enum tcc_wave_polarity { - /** Wave output is not inverted */ - TCC_WAVE_POLARITY_0, - /** Wave output is inverted */ - TCC_WAVE_POLARITY_1 -}; - -/** - * \brief TCC pattern generator for outputs - * - * Used when disabling output pattern or when selecting a specific pattern. - */ -enum tcc_output_pattern { - /** SWAP output pattern is not used */ - TCC_OUTPUT_PATTERN_DISABLE, - /** Pattern 0 is applied to SWAP output */ - TCC_OUTPUT_PATTERN_0, - /** Pattern 1 is applied to SWAP output */ - TCC_OUTPUT_PATTERN_1 -}; - -/** - * \brief Ramp Operations which are supported in single-slope PWM generation - * - * Ramp operations which are supported in single-slope PWM generation. - */ -enum tcc_ramp { - /** Default timer/counter PWM operation */ - TCC_RAMP_RAMP1 = 0, - - /** Uses a single channel (CC0) to control both CC0/CC1 compare outputs. - * In cycle A, the channel 0 output is disabled, and - * in cycle B, the channel 1 output is disabled. */ - TCC_RAMP_RAMP2A, - - /** Uses channels CC0 and CC1 to control compare outputs. - * In cycle A, the channel 0 output is disabled, and - * in cycle B, the channel 1 output is disabled.*/ - TCC_RAMP_RAMP2 -}; - -/** - * \brief Ramp Index for TCC wave generation - * - * In ramp operation, each two period cycles are marked as cycle A and B, - * the index 0 represents cycle A and 1 represents cycle B. - */ -enum tcc_ramp_index { - /** Default, cycle index toggles. */ - TCC_RAMP_INDEX_DEFAULT, - /** Force next cycle to be cycle B (set to 1) */ - TCC_RAMP_INDEX_FORCE_B, - /** Force next cycle to be cycle A (clear to 0) */ - TCC_RAMP_INDEX_FORCE_A, - /** Force next cycle keeping the same as current */ - TCC_RAMP_INDEX_FORCE_KEEP -}; - -/** - * \brief TCC output inversion - * - * Used when enabling or disabling output inversion. - */ -enum tcc_output_invertion { - /** Output inversion not to be enabled */ - TCC_OUTPUT_INVERTION_DISABLE, - /** Invert the output from WO[x] */ - TCC_OUTPUT_INVERTION_ENABLE -}; - -/** - * \brief TCC Counter reload action enum - * - * This enum specify how the counter is reloaded and whether the prescaler - * should be restarted. - */ -enum tcc_reload_action { - /** The counter is reloaded/reset on the next GCLK and starts - * counting on the prescaler clock - */ - TCC_RELOAD_ACTION_GCLK, - /** The counter is reloaded/reset on the next prescaler clock - */ - TCC_RELOAD_ACTION_PRESC, - /** The counter is reloaded/reset on the next GCLK, and the - * prescaler is restarted as well - */ - TCC_RELOAD_ACTION_RESYNC -}; - - -/** - * \brief TCC clock prescaler values - * - * This enum is used to choose the clock prescaler - * configuration. The prescaler divides the clock frequency of the TCC - * module to operate TCC at a slower clock rate. - */ -enum tcc_clock_prescaler { - /** Divide clock by 1 */ - TCC_CLOCK_PRESCALER_DIV1, - /** Divide clock by 2 */ - TCC_CLOCK_PRESCALER_DIV2, - /** Divide clock by 4 */ - TCC_CLOCK_PRESCALER_DIV4, - /** Divide clock by 8 */ - TCC_CLOCK_PRESCALER_DIV8, - /** Divide clock by 16 */ - TCC_CLOCK_PRESCALER_DIV16, - /** Divide clock by 64 */ - TCC_CLOCK_PRESCALER_DIV64, - /** Divide clock by 256 */ - TCC_CLOCK_PRESCALER_DIV256, - /** Divide clock by 1024 */ - TCC_CLOCK_PRESCALER_DIV1024 -}; - -/** - * \brief TCC module count direction - * - * Used when selecting the Timer/Counter count direction. - */ -enum tcc_count_direction { - /** Timer should count upward */ - TCC_COUNT_DIRECTION_UP, - /** Timer should count downward */ - TCC_COUNT_DIRECTION_DOWN, -}; - -#ifdef FEATURE_TCC_GENERATE_DMA_TRIGGER -/** - * \brief TCC module counter overflow DMA request mode - * - * Used when selecting the Timer/Counter overflow DMA request mode. - */ -enum tcc_count_overflow_dma_trigger_mode { - /** TCC generates a DMA request on each cycle when an update condition - * is detected - */ - TCC_COUNT_OVERFLOW_DMA_TRIGGER_MODE_CONTINUE, - /** When an update condition is detected, the TCC generates a DMA trigger - * on the cycle following the DMA One-Shot Command written to the Control - * B register - */ - TCC_COUNT_OVERFLOW_DMA_TRIGGER_MODE_ONE_SHOT, -}; -#endif - -/** - * \brief Action to perform when the TCC module is triggered by events - * - * Event action to perform when the module is triggered by events. - */ -enum tcc_event_action { - /** No event action */ - TCC_EVENT_ACTION_OFF, - /** Stop counting, the counter will maintain its current value, waveforms - * are set to a defined Non-Recoverable State output - * (\ref tcc_non_recoverable_state_output). */ - TCC_EVENT_ACTION_STOP, - /** Re-trigger counter on event, may generate an event if the re-trigger - * event output is enabled. - * \note When re-trigger event action is enabled, enabling the counter - * will not start until the next incoming event appears. */ - TCC_EVENT_ACTION_RETRIGGER, - - /** Start counter when previously stopped. - * Start counting on the event rising edge. Further events will not - * restart the counter; - * the counter keeps on counting using prescaled GCLK_TCCx, until it - * reaches TOP or Zero - * depending on the direction. */ - TCC_EVENT_ACTION_START, - /** Count events; i.e. Increment or decrement depending on count - * direction. */ - TCC_EVENT_ACTION_COUNT_EVENT, - /** The event source must be an asynchronous event, input value will - * overrides the direction settings (input low: counting up, input high: - * counting down). */ - TCC_EVENT_ACTION_DIR_CONTROL, - /** Increment the counter on event, irrespective of count direction */ - TCC_EVENT_ACTION_INCREMENT, - /** Decrement the counter on event, irrespective of count direction */ - TCC_EVENT_ACTION_DECREMENT, - /** Count during active state of asynchronous event. In this case, - * depending on the count direction, the count will be incremented - * or decremented on each prescaled GCLK_TCCx, as long as the input - * event remains active. */ - TCC_EVENT_ACTION_COUNT_DURING_ACTIVE, - - /** Store period in capture register 0, pulse width in capture - * register 1 - */ - TCC_EVENT_ACTION_PERIOD_PULSE_WIDTH_CAPTURE, - /** Store pulse width in capture register 0, period in capture - * register 1 - */ - TCC_EVENT_ACTION_PULSE_WIDTH_PERIOD_CAPTURE, - - /** Generate Non-Recoverable Fault on event */ - TCC_EVENT_ACTION_NON_RECOVERABLE_FAULT, -}; - - -/** - * \brief Action to be performed when the TCC module is triggered by event0 - * - * Event action to perform when the module is triggered by event0. - */ -enum tcc_event0_action { - /** No event action */ - TCC_EVENT0_ACTION_OFF = TCC_EVENT_ACTION_OFF, - /** Re-trigger Counter on event */ - TCC_EVENT0_ACTION_RETRIGGER = TCC_EVENT_ACTION_RETRIGGER, - /** Count events (increment or decrement, depending on count direction) - */ - TCC_EVENT0_ACTION_COUNT_EVENT = TCC_EVENT_ACTION_COUNT_EVENT, - /** Start counter on event */ - TCC_EVENT0_ACTION_START = TCC_EVENT_ACTION_START, - /** Increment counter on event */ - TCC_EVENT0_ACTION_INCREMENT = TCC_EVENT_ACTION_INCREMENT, - /** Count during active state of asynchronous event */ - TCC_EVENT0_ACTION_COUNT_DURING_ACTIVE = TCC_EVENT_ACTION_COUNT_DURING_ACTIVE, - - /** Generate Non-Recoverable Fault on event */ - TCC_EVENT0_ACTION_NON_RECOVERABLE_FAULT = TCC_EVENT_ACTION_NON_RECOVERABLE_FAULT -}; - -/** - * \brief Action to perform when the TCC module is triggered by event1 - * - * Event action to perform when the module is triggered by event1. - */ -enum tcc_event1_action { - /** No event action */ - TCC_EVENT1_ACTION_OFF = TCC_EVENT_ACTION_OFF, - /** Re-trigger Counter on event */ - TCC_EVENT1_ACTION_RETRIGGER = TCC_EVENT_ACTION_RETRIGGER, - /** The event source must be an asynchronous event, and the input value - * will override the direction settings. - * If TCEINVx is 0 and input event is LOW: counter will count up. - * If TCEINVx is 0 and input event is HIGH: counter will count down. - */ - TCC_EVENT1_ACTION_DIR_CONTROL = TCC_EVENT_ACTION_DIR_CONTROL, - /** Stop counter on event */ - TCC_EVENT1_ACTION_STOP = TCC_EVENT_ACTION_STOP, - /** Decrement on event */ - TCC_EVENT1_ACTION_DECREMENT = TCC_EVENT_ACTION_DECREMENT, - - /** Store period in capture register 0, pulse width in capture - * register 1 - */ - TCC_EVENT1_ACTION_PERIOD_PULSE_WIDTH_CAPTURE = TCC_EVENT_ACTION_PERIOD_PULSE_WIDTH_CAPTURE, - /** Store pulse width in capture register 0, period in capture - * register 1 - */ - TCC_EVENT1_ACTION_PULSE_WIDTH_PERIOD_CAPTURE = TCC_EVENT_ACTION_PULSE_WIDTH_PERIOD_CAPTURE, - - /** Generate Non-Recoverable Fault on event */ - TCC_EVENT1_ACTION_NON_RECOVERABLE_FAULT = TCC_EVENT_ACTION_NON_RECOVERABLE_FAULT -}; - -/** - * \brief On which part of the counter cycle the counter event output is generated - * - * This enum is used to define the point at which the counter event is generated. - */ -enum tcc_event_generation_selection { - /** Counter Event is generated when a new counter cycle starts */ - TCC_EVENT_GENERATION_SELECTION_START, - /** Counter Event is generated when a counter cycle ends */ - TCC_EVENT_GENERATION_SELECTION_END, - /** Counter Event is generated when a counter cycle ends, except for the - * first and last cycles */ - TCC_EVENT_GENERATION_SELECTION_BETWEEN, - /** Counter Event is generated when a new counter cycle starts or ends */ - TCC_EVENT_GENERATION_SELECTION_BOUNDARY -}; - -/** - * \brief TCC channel operation modes - * - * To set a timer channel either in compare or in capture mode. - */ -enum tcc_channel_function { - /** TCC channel performs compare operation */ - TCC_CHANNEL_FUNCTION_COMPARE, - /** TCC channel performs capture operation */ - TCC_CHANNEL_FUNCTION_CAPTURE -}; - -/** - * \brief TCC (recoverable) fault Halt action - */ -enum tcc_fault_halt_action { - /** Halt action disabled. */ - TCC_FAULT_HALT_ACTION_DISABLE, - /** Hardware halt action, counter is halted until restart */ - TCC_FAULT_HALT_ACTION_HW_HALT, - /** Software halt action, counter is halted until fault bit cleared */ - TCC_FAULT_HALT_ACTION_SW_HALT, - /** Non-Recoverable fault, force output to pre-defined level */ - TCC_FAULT_HALT_ACTION_NON_RECOVERABLE -}; - -/** - * \brief TCC (recoverable) fault Capture action - */ -enum tcc_fault_capture_action { - /** Capture disabled */ - TCC_FAULT_CAPTURE_DISABLE, - /** Capture on Fault, each value is captured */ - TCC_FAULT_CAPTURE_EACH, - /** Capture the minimum detection, but notify on smaller ones */ - TCC_FAULT_CAPTURE_MINIMUM, - /** Capture the maximum detection, but notify on bigger ones */ - TCC_FAULT_CAPTURE_MAXIMUM, - /** Capture if the value is smaller than last, notify event or interrupt - * if previous stamp is confirmed to be "local minimum" (not bigger than - * current stamp). */ - TCC_FAULT_CAPTURE_SMALLER, - /** Capture if the value is bigger than last, notify event or interrupt - * if previous stamp is confirmed to be "local maximum" (not smaller than - * current stamp). */ - TCC_FAULT_CAPTURE_BIGGER, - /** Capture if the time stamps changes its increment direction */ - TCC_FAULT_CAPTURE_CHANGE -}; - -/** - * \brief Capture Channel triggered by TCC (recoverable) fault - */ -enum tcc_fault_capture_channel { - /** Recoverable fault triggers channel 0 capture operation */ - TCC_FAULT_CAPTURE_CHANNEL_0, - /** Recoverable fault triggers channel 1 capture operation */ - TCC_FAULT_CAPTURE_CHANNEL_1, - /** Recoverable fault triggers channel 2 capture operation */ - TCC_FAULT_CAPTURE_CHANNEL_2, - /** Recoverable fault triggers channel 3 capture operation */ - TCC_FAULT_CAPTURE_CHANNEL_3 -}; - -/** - * \brief TCC (recoverable) fault Input Source - */ -enum tcc_fault_source { - /** Fault input is disabled */ - TCC_FAULT_SOURCE_DISABLE, - /** Match Capture Event x (x=0,1) input */ - TCC_FAULT_SOURCE_ENABLE, - /** Inverted MCEx (x=0,1) event input */ - TCC_FAULT_SOURCE_INVERT, - /** Alternate fault (A or B) state at the end of the previous period */ - TCC_FAULT_SOURCE_ALTFAULT -}; - -/** - * \brief TCC (recoverable) fault Input Blanking Start Point - */ -enum tcc_fault_blanking { - /** No blanking */ - TCC_FAULT_BLANKING_DISABLE, - /** Blanking applied from rising edge of the output waveform */ - TCC_FAULT_BLANKING_RISING_EDGE, - /** Blanking applied from falling edge of the output waveform */ - TCC_FAULT_BLANKING_FALLING_EDGE, - /** Blanking applied from each toggle of the output waveform */ - TCC_FAULT_BLANKING_BOTH_EDGE -}; - -/** - * \brief TCC (recoverable) fault Input Qualification Action - */ -enum tcc_fault_qualification { - /** The input is not disabled on compare condition */ - TCC_FAULT_QUALIFICATION_DISABLE, - /** The input is disabled when match output signal is at inactive level */ - TCC_FAULT_QUALIFICATION_BY_OUTPUT -}; - -/** - * \brief TCC (recoverable) fault Output Keep Action - */ -enum tcc_fault_keep { - /** Disable keeping, wave output released as soon as fault is released */ - TCC_FAULT_KEEP_DISABLE, - /** Keep wave output until end of TCC cycle */ - TCC_FAULT_KEEP_TILL_END -}; - -/** - * \brief TCC Non-recoverable State Outupt - */ -enum tcc_fault_state_output { - /** Non-recoverable fault output is tri-stated */ - TCC_FAULT_STATE_OUTPUT_OFF, - /** Non-recoverable fault force output 0 */ - TCC_FAULT_STATE_OUTPUT_0, - /** Non-recoverable fault force output 1 */ - TCC_FAULT_STATE_OUTPUT_1 -}; - -/** - * \brief TCC (recoverable) fault Restart Action - */ -enum tcc_fault_restart { - /** Restart Action disabled */ - TCC_FAULT_RESTART_DISABLE, - /** Restart Action enabled */ - TCC_FAULT_RESTART_ENABLE -}; - -/** - * \brief Configuration struct for TCC module recoverable fault - */ -struct tcc_recoverable_fault_config { - /** Fault filter value applied on MCEx event input line (0x0 ~ 0xF). - * Must be 0 when MCEx event is used as synchronous event. - * Apply to both recoverable and non-recoverable fault. */ - uint8_t filter_value; - /** Fault blanking value (0 ~ 255), disable input source for several TCC - * clocks after the detection of the waveform edge */ - uint8_t blanking_cycles; - - /** Set to \c true to enable restart action */ - bool restart; - /** Set to \c true to enable keep action (keep until end of TCC cycle) */ - bool keep; - - /** Set to \c true to enable input qualification - * (disable input when output is inactive) */ - bool qualification; - - /** Specifies if the event input generates recoverable Fault. - * The event system channel connected to MCEx event input must be - * configured as asynchronous. - */ - enum tcc_fault_source source; - /** Fault Blanking Start Point for recoverable Fault */ - enum tcc_fault_blanking blanking; - - /** Halt action for recoverable Fault */ - enum tcc_fault_halt_action halt_action; - /** Capture action for recoverable Fault */ - enum tcc_fault_capture_action capture_action; - /** Channel triggered by recoverable Fault */ - enum tcc_fault_capture_channel capture_channel; -}; - -/** - * \brief Configuration struct for TCC module non-recoverable fault - */ -struct tcc_non_recoverable_fault_config { - /** Fault filter value applied on TCEx event input line (0x0 ~ 0xF). - * Must be 0 when TCEx event is used as synchronous event. */ - uint8_t filter_value; - /** Output */ - enum tcc_fault_state_output output; -}; - -/** - * \brief TCC input event enable/disable/configure structure - * - * For configuring an input event. - */ -struct tcc_input_event_config { - /** Event action on incoming event */ - enum tcc_event_action action; - /** Modify event action */ - bool modify_action; - /** Invert incoming event input line */ - bool invert; -}; - -/** - * \brief TCC output event enable/disable/configure structure - * - * Structure used for configuring an output event. - */ -struct tcc_output_event_config { - /** It decides which part of the counter cycle the counter event output - * is generated */ - enum tcc_event_generation_selection generation_selection; - /** A switch to allow enable/disable of events, without modifying the - * event output configuration - */ - bool modify_generation_selection; -}; - -/** - * \brief TCC event enable/disable structure - * - * Event flags for the \ref tcc_enable_events() and \ref tcc_disable_events(). - */ -struct tcc_events { - /** Input events configuration */ - struct tcc_input_event_config input_config[2]; - /** Output event configuration */ - struct tcc_output_event_config output_config; - - /** Perform the configured event action when an incoming event is - * signalled */ - bool on_input_event_perform_action[2]; - - /** Perform the configured event action when an incoming channel event is - * signalled */ - bool on_event_perform_channel_action[TCC_NUM_CHANNELS]; - /** Generate an output event on a channel capture/match. - * Specify which channels will generate events */ - bool generate_event_on_channel[TCC_NUM_CHANNELS]; - - /** Generate an output event on counter overflow/underflow */ - bool generate_event_on_counter_overflow; - /** Generate an output event on counter retrigger */ - bool generate_event_on_counter_retrigger; - /** Generate an output event on counter boundary. - * See \ref tcc_event_output_action. */ - bool generate_event_on_counter_event; -}; - -/** - * \brief Configuration struct for the TCC module base counter - * - * Structure for configuring a TCC as a counter. - */ -struct tcc_counter_config { - /** Value to initialize the count register */ - uint32_t count; - /** Period/top and period/top buffer values for counter */ - uint32_t period; - - /** When \c true, the counter will be stopped on the next hardware or - * software re-trigger event or overflow/underflow - */ - bool oneshot; - -#ifdef FEATURE_TCC_GENERATE_DMA_TRIGGER - /** Counter overflow trigger a DMA request mode */ - enum tcc_count_overflow_dma_trigger_mode dma_trigger_mode; -#endif - - /** Specifies the direction for the TCC to count */ - enum tcc_count_direction direction; - - /** GCLK generator used to clock the peripheral */ - enum gclk_generator clock_source; - /** Specifies the prescaler value for GCLK_TCC */ - enum tcc_clock_prescaler clock_prescaler; - /** Specifies the reload or reset time of the counter and prescaler - * resynchronization on a re-trigger event for the TCC - */ - enum tcc_reload_action reload_action; -}; - -/** - * \brief Configuration struct for the TCC module capture - * - * Structure used when configuring TCC channels in capture mode. - */ -struct tcc_capture_config { - /** Channel functions selection (capture/match) */ - enum tcc_channel_function channel_function[TCC_NUM_CHANNELS]; -}; - -/** - * \brief Configuration struct for the TCC module match/wave generation - * - * The structure, which helps to configure a TCC channel for compare - * operation and wave generation. - */ -struct tcc_match_wave_config { - /** Channel functions selection (capture/match) */ - enum tcc_channel_function channel_function[TCC_NUM_CHANNELS]; - - /** Specifies polarity for match output waveform generation */ - enum tcc_wave_polarity wave_polarity[TCC_NUM_CHANNELS]; - /** Specifies which waveform generation mode to use */ - enum tcc_wave_generation wave_generation; - /** Specifies Ramp mode for waveform generation */ - enum tcc_ramp wave_ramp; - - /** Value to be used for compare match on each channel */ - uint32_t match[TCC_NUM_CHANNELS]; -}; - -/** - * \brief Configuration struct for the TCC module waveform extension - * - * This structure is used to specify the waveform extension features for TCC. - */ -struct tcc_wave_extension_config { - /** Configuration for recoverable faults */ - struct tcc_recoverable_fault_config - recoverable_fault[TCC_NUM_FAULTS]; - /** Configuration for non-recoverable faults */ - struct tcc_non_recoverable_fault_config - non_recoverable_fault[TCC_NUM_WAVE_OUTPUTS]; - - /** Invert waveform final outputs lines */ - bool invert[TCC_NUM_WAVE_OUTPUTS]; -}; - -/** - * \brief Configuration struct for the TCC module output pins - * - * Structure which is used when taking wave output from TCC. - */ -struct tcc_pins_config { - /** Specifies pin output for each channel */ - uint32_t wave_out_pin[TCC_NUM_WAVE_OUTPUTS]; - /** Specifies MUX setting for each output channel pin */ - uint32_t wave_out_pin_mux[TCC_NUM_WAVE_OUTPUTS]; - /** When \c true, PWM output pin for the given channel is enabled */ - bool enable_wave_out_pin[TCC_NUM_WAVE_OUTPUTS]; -}; - -/** - * \brief TCC configuration structure - * - * Configuration struct for a TCC instance. This structure should be - * initialized by the \ref tcc_get_config_defaults function before being - * modified by the user application. - */ -struct tcc_config { - /** Structure for configuring TCC base timer/counter */ - struct tcc_counter_config counter; - /** TCC match/capture configurations */ - union { - /** Helps to configure a TCC channel in capture mode */ - struct tcc_capture_config capture; - /** For configuring a TCC channel in compare mode */ - struct tcc_match_wave_config compare; - /** Serves the same purpose as compare. Used as an alias for - * compare, - * when a TCC channel is configured for wave generation */ - struct tcc_match_wave_config wave; - }; - - /** Structure for configuring TCC waveform extension */ - struct tcc_wave_extension_config wave_ext; - - /** Structure for configuring TCC output pins */ - struct tcc_pins_config pins; - - /** Set to \c true to enable double buffering write. When enabled any write - * through \ref tcc_set_top_value(), \ref tcc_set_compare_value() and - * \ref tcc_set_pattern() will direct to the buffer register as buffered - * value, and the buffered value will be committed to effective register - * on UPDATE condition, if update is not locked. - * - * \note The init values in \ref tcc_config for \ref tcc_init are always - * filled to effective registers, no matter if double buffering is - * enabled or not. - */ - bool double_buffering_enabled; - - /** When \c true the module is enabled during standby */ - bool run_in_standby; -}; - -#if TCC_ASYNC == true -/* Forward Declaration for the device instance. */ -struct tcc_module; - -/** Type definition for the TCC callback function. */ -typedef void (*tcc_callback_t)(struct tcc_module *const module); -#endif - -/** - * \brief TCC software device instance structure - * - * TCC software instance structure, used to retain software state information - * of an associated hardware module instance. - * - * \note The fields of this structure should not be altered by the user - * application; they are reserved only for module-internal use. - */ -struct tcc_module { - /** Hardware module pointer of the associated Timer/Counter peripheral. */ - Tcc *hw; - -# if TCC_ASYNC == true - /** Array of callbacks */ - tcc_callback_t callback[TCC_CALLBACK_N]; - /** Bit mask for callbacks registered */ - uint32_t register_callback_mask; - /** Bit mask for callbacks enabled */ - uint32_t enable_callback_mask; -# endif - - /** Set to \c true to write to buffered registers */ - bool double_buffering_enabled; -}; - -#if !defined(__DOXYGEN__) -uint8_t _tcc_get_inst_index( - Tcc *const hw); -#endif - -/** - * \name Driver Initialization and Configuration - * @{ - */ - -/** - * \brief Determines if the hardware module is currently synchronizing to the bus - * - * Checks to see if the underlying hardware peripheral module is currently - * synchronizing across multiple clock domains to the hardware bus. This - * function can be used to delay further operations on a module until such time - * that it is ready, to prevent blocking delays for synchronization in the - * user application. - * - * \param[in] module_inst Pointer to the software module instance struct - * - * \return Synchronization status of the underlying hardware module. - * - * \retval false If the module has completed synchronization - * \retval true If the module synchronization is ongoing - */ -static inline bool tcc_is_syncing( - const struct tcc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - return (module_inst->hw->SYNCBUSY.reg > 0); -} - - -void tcc_get_config_defaults( - struct tcc_config *const config, - Tcc *const hw); - -enum status_code tcc_init( - struct tcc_module *const module_inst, - Tcc *const hw, - const struct tcc_config *const config); - -/** @} */ - -/** - * \name Event Management - * @{ - */ - -enum status_code tcc_enable_events( - struct tcc_module *const module_inst, - struct tcc_events *const events); - -void tcc_disable_events( - struct tcc_module *const module_inst, - struct tcc_events *const events); - -/** @} */ - -/** - * \name Enable/Disable/Reset - * @{ - */ - -/** - * \brief Enable the TCC module - * - * Enables a TCC module that has been previously initialized. The counter will - * start when the counter is enabled. - * - * \note When the counter is configured to re-trigger on an event, the counter - * will not start until the next incoming event appears. Then it - * restarts on any following event. - * - * \param[in] module_inst Pointer to the software module instance struct - */ -static inline void tcc_enable( - const struct tcc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance */ - Tcc *const tcc_module = module_inst->hw; - - while (tcc_module->SYNCBUSY.reg & TCC_SYNCBUSY_ENABLE) { - /* Wait for sync */ - } - - /* Enable the TCC module */ - tcc_module->CTRLA.reg |= TCC_CTRLA_ENABLE; -} - -/** - * \brief Disables the TCC module - * - * Disables a TCC module and stops the counter. - * - * \param[in] module_inst Pointer to the software module instance struct - */ -static inline void tcc_disable( - const struct tcc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance */ - Tcc *const tcc_module = module_inst->hw; - - while (tcc_module->SYNCBUSY.reg & TCC_SYNCBUSY_ENABLE) { - /* Wait for sync */ - } - - /* Disbale interrupt */ - tcc_module->INTENCLR.reg = TCC_INTENCLR_MASK; - /* Clear interrupt flag */ - tcc_module->INTFLAG.reg = TCC_INTFLAG_MASK; - - /* Disable the TCC module */ - tcc_module->CTRLA.reg &= ~TC_CTRLA_ENABLE; -} - -/** - * \brief Resets the TCC module - * - * Resets the TCC module, restoring all hardware module registers to their - * default values and disabling the module. The TCC module will not be - * accessible while the reset is being performed. - * - * \note When resetting a 32-bit counter only the master TCC module's instance - * structure should be passed to the function. - * - * \param[in] module_inst Pointer to the software module instance struct - * - */ -static inline void tcc_reset( - const struct tcc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module hardware instance */ - Tcc *const tcc_module = module_inst->hw; - - /* Disable this module if it is running */ - if (tcc_module->CTRLA.reg & TCC_CTRLA_ENABLE) { - tcc_disable(module_inst); - while (tcc_is_syncing(module_inst)) { - /* wait while module is disabling */ - } - } - - /* Reset this TC module */ - tcc_module->CTRLA.reg |= TCC_CTRLA_SWRST; -} - -/** @} */ - - -/** - * \name Set/Toggle Count Direction - * @{ - */ - -/** - * \brief Sets the TCC module count direction - * - * Sets the count direction of an initialized TCC module. The - * specified TCC module can remain running or stopped. - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] dir New timer count direction to set - */ -static inline void tcc_set_count_direction( - const struct tcc_module *const module_inst, - enum tcc_count_direction dir) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance */ - Tcc *const tcc_module = module_inst->hw; - - while (tcc_module->SYNCBUSY.reg & TCC_SYNCBUSY_CTRLB) { - /* Wait for sync */ - } - - /* Set count direction */ - if (TCC_COUNT_DIRECTION_DOWN == dir) { - tcc_module->CTRLBSET.reg = TCC_CTRLBSET_DIR; - return; - } - tcc_module->CTRLBCLR.reg = TCC_CTRLBCLR_DIR; -} - -/** - * \brief Toggles the TCC module count direction - * - * Toggles the count direction of an initialized TCC module. The - * specified TCC module can remain running or stopped. - * - * \param[in] module_inst Pointer to the software module instance struct - */ -static inline void tcc_toggle_count_direction( - const struct tcc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance */ - Tcc *const tcc_module = module_inst->hw; - - while (tcc_module->SYNCBUSY.reg & TCC_SYNCBUSY_CTRLB) { - /* Wait for sync */ - } - bool dir_value_1 = tcc_module->CTRLBSET.bit.DIR; - if (dir_value_1) { - tcc_module->CTRLBCLR.reg = TCC_CTRLBCLR_DIR; - } else { - tcc_module->CTRLBSET.reg = TCC_CTRLBSET_DIR; - } -} - -/** @} */ - -/** - * \name Get/Set Count Value - * @{ - */ - -uint32_t tcc_get_count_value( - const struct tcc_module *const module_inst); - -enum status_code tcc_set_count_value( - const struct tcc_module *const module_inst, - const uint32_t count); - -/** @} */ - -/** - * \name Stop/Restart Counter - * @{ - */ - -/** - * \brief Stops the counter - * - * This function will stop the counter. When the counter is stopped - * the value in the count register is set to 0 if the counter was - * counting up, or maximum or the top value if the counter was counting - * down. - * - * \param[in] module_inst Pointer to the software module instance struct - */ -static inline void tcc_stop_counter( - const struct tcc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance */ - Tcc *const tcc_module = module_inst->hw; - uint32_t last_cmd; - - /* Wait until last command is done */ - do { - while (tcc_module->SYNCBUSY.reg & TCC_SYNCBUSY_CTRLB) { - /* Wait for sync */ - } - last_cmd = tcc_module->CTRLBSET.reg & TCC_CTRLBSET_CMD_Msk; - if (last_cmd == TCC_CTRLBSET_CMD_NONE) { - break; - } else if (last_cmd == TCC_CTRLBSET_CMD_STOP) { - /* Command have been issued */ - return; - } else if (last_cmd == TCC_CTRLBSET_CMD_RETRIGGER) { - /* Cancel RETRIGGER command and issue STOP */ - tcc_module->CTRLBCLR.reg = TCC_CTRLBCLR_CMD_Msk; - } - } while (1); - - /* Write command to execute */ - tcc_module->CTRLBSET.reg = TCC_CTRLBSET_CMD_STOP; -} - -/** - * \brief Starts the counter from beginning - * - * Restarts an initialized TCC module's counter. - * - * \param[in] module_inst Pointer to the software module instance struct - */ -static inline void tcc_restart_counter( - const struct tcc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance */ - Tcc *const tcc_module = module_inst->hw; - uint32_t last_cmd; - - /* Wait until last command is done */ - do { - while (tcc_module->SYNCBUSY.reg & TCC_SYNCBUSY_CTRLB) { - /* Wait for sync */ - } - last_cmd = tcc_module->CTRLBSET.reg & TCC_CTRLBSET_CMD_Msk; - if (last_cmd == TCC_CTRLBSET_CMD_NONE) { - break; - } else if (last_cmd == TCC_CTRLBSET_CMD_RETRIGGER) { - /* Command have been issued */ - return; - } else if (last_cmd == TCC_CTRLBSET_CMD_STOP) { - /* Cancel STOP command and issue RETRIGGER */ - tcc_module->CTRLBCLR.reg = TCC_CTRLBCLR_CMD_Msk; - } - } while (1); - - /* Write command to execute */ - tcc_module->CTRLBSET.reg = TCC_CTRLBSET_CMD_RETRIGGER; -} - -/** @} */ - -#ifdef FEATURE_TCC_GENERATE_DMA_TRIGGER -/** - * \name Generate TCC DMA Triggers Command - * @{ - */ - -/** - * \brief TCC DMA Trigger. - * - * TCC DMA trigger command. - * - * \param[in] module_inst Pointer to the software module instance struct - */ -static inline void tcc_dma_trigger_command( - const struct tcc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance */ - Tcc *const tcc_module = module_inst->hw; - - while (tcc_module->SYNCBUSY.reg & TCC_SYNCBUSY_CTRLB) { - /* Wait for sync */ - } - - /* Make certain that there are no conflicting commands in the register */ - tcc_module->CTRLBCLR.reg = TCC_CTRLBCLR_CMD_NONE; - - while (tcc_module->SYNCBUSY.reg & TCC_SYNCBUSY_CTRLB) { - /* Wait for sync */ - } - -#if !(SAML21 || SAML22 || SAMR30) - /* Write command to execute */ - tcc_module->CTRLBSET.reg = TCC_CTRLBSET_CMD_DMATRG; -#endif - -#if (SAML21XXXB) || (SAML22) || (SAMR30) - /* Write command to execute */ - tcc_module->CTRLBSET.reg = TCC_CTRLBSET_CMD_DMAOS; -#endif -} -/** @} */ -#endif - -/** - * \name Get/Set Compare/Capture Register - * @{ - */ - -uint32_t tcc_get_capture_value( - const struct tcc_module *const module_inst, - const enum tcc_match_capture_channel channel_index); - -enum status_code tcc_set_compare_value( - const struct tcc_module *const module_inst, - const enum tcc_match_capture_channel channel_index, - const uint32_t compare); - -/** @} */ - -/** - * \name Set Top Value - * @{ - */ - -enum status_code tcc_set_top_value( - const struct tcc_module *const module_inst, - const uint32_t top_value); - -/** @} */ - - -/** - * \name Set Output Pattern - * @{ - */ - -enum status_code tcc_set_pattern( - const struct tcc_module *const module_inst, - const uint32_t line_index, - const enum tcc_output_pattern pattern); - -/** @} */ - - -/** - * \name Set Ramp Index - * @{ - */ - -/** - * \brief Sets the TCC module ramp index on next cycle - * - * In RAMP2 and RAMP2A operation, we can force either cycle A or cycle B at - * the output, on the next clock cycle. - * When ramp index command is disabled, cycle A and cycle B will appear at - * the output, on alternate clock cycles. - * See \ref tcc_ramp. - * - * \param[in] module_inst Pointer to the software module instance struct - * \param[in] ramp_index Ramp index (\ref tcc_ramp_index) of the next cycle - */ -static inline void tcc_set_ramp_index( - const struct tcc_module *const module_inst, - const enum tcc_ramp_index ramp_index) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance */ - Tcc *const tcc_module = module_inst->hw; - uint32_t last_cmd; - - /* Wait until last command is done */ - do { - while (tcc_module->SYNCBUSY.reg & TCC_SYNCBUSY_CTRLB) { - /* Wait for sync */ - } - if (TCC_RAMP_INDEX_DEFAULT == ramp_index) { - /* Cancel pending command */ - tcc_module->CTRLBCLR.reg = TCC_CTRLBSET_IDXCMD_HOLD; - return; - } - last_cmd = tcc_module->CTRLBSET.reg & TCC_CTRLBSET_IDXCMD_Msk; - if (last_cmd == TCC_CTRLBSET_IDXCMD_DISABLE) { - break; - } else if (last_cmd == TCC_CTRLBSET_IDXCMD(ramp_index)) { - /* Command have been issued */ - return; - } - } while (1); - - /* Write command to execute */ - tcc_module->CTRLBSET.reg = TCC_CTRLBSET_IDXCMD(ramp_index); -} - -/** @} */ - -/** - * \name Status Management - * @{ - */ - -/** - * \brief Checks if the timer/counter is running - * - * \param[in] module_inst Pointer to the TCC software instance struct - * - * \return Status which indicates whether the module is running. - * - * \retval true The timer/counter is running - * \retval false The timer/counter is stopped - */ -static inline bool tcc_is_running( - struct tcc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - return !module_inst->hw->STATUS.bit.STOP; -} - -uint32_t tcc_get_status( - struct tcc_module *const module_inst); - -void tcc_clear_status( - struct tcc_module *const module_inst, - const uint32_t status_flags); - -/** @} */ - -/** - * \name Double Buffering Management - * @{ - */ - -/** - * \brief Enable TCC double buffering write - * - * When double buffering write is enabled, the following function will write - * values to buffered registers instead of effective ones (buffered): - * - PERB: through \ref tcc_set_top_value() - * - CCBx(x is 0~3): through \ref tcc_set_compare_value() - * - PATTB: through \ref tcc_set_pattern() - * - * Then, on UPDATE condition the buffered registers are committed to regular ones - * to take effect. - * - * \param[in] module_inst Pointer to the TCC software instance struct - */ -static inline void tcc_enable_double_buffering( - struct tcc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - - module_inst->double_buffering_enabled = true; -} - -/** - * \brief Disable TCC double buffering Write - * - * When double buffering write is disabled, following function will write values - * to effective registers (not buffered): - * - PER: through \ref tcc_set_top_value() - * - CCx(x is 0~3): through \ref tcc_set_compare_value() - * - PATT: through \ref tcc_set_pattern() - * - * \note This function does not lock double buffer update, which means on next - * UPDATE condition the last written buffered values will be committed to - * take effect. Invoke \ref tcc_lock_double_buffer_update() before this - * function to disable double buffering update, if this change is not - * expected. - * - * \param[in] module_inst Pointer to the TCC software instance struct - */ -static inline void tcc_disable_double_buffering( - struct tcc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - module_inst->double_buffering_enabled = false; -} - -/** - * \brief Lock the TCC double buffered registers updates - * - * Locks the double buffered registers so they will not be updated through - * their buffered values on UPDATE conditions. - * - * \param[in] module_inst Pointer to the TCC software instance struct - * - */ -static inline void tcc_lock_double_buffer_update( - struct tcc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - while (module_inst->hw->SYNCBUSY.reg & TCC_SYNCBUSY_CTRLB) { - /* Wait for sync */ - } - module_inst->hw->CTRLBSET.reg = TCC_CTRLBSET_LUPD; -} - -/** - * \brief Unlock the TCC double buffered registers updates - * - * Unlock the double buffered registers so they will be updated through - * their buffered values on UPDATE conditions. - * - * \param[in] module_inst Pointer to the TCC software instance struct - * - */ -static inline void tcc_unlock_double_buffer_update( - struct tcc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - while (module_inst->hw->SYNCBUSY.reg & TCC_SYNCBUSY_CTRLB) { - /* Wait for sync */ - } - module_inst->hw->CTRLBCLR.reg = TCC_CTRLBCLR_LUPD; -} - -/** - * \brief Force the TCC double buffered registers to update once - * - * \param[in] module_inst Pointer to the TCC software instance struct - * - */ -static inline void tcc_force_double_buffer_update( - struct tcc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Get a pointer to the module's hardware instance */ - Tcc *const tcc_module = module_inst->hw; - uint32_t last_cmd; - - /* Wait until last command is done */ - do { - while (tcc_module->SYNCBUSY.reg & TCC_SYNCBUSY_CTRLB) { - /* Wait for sync */ - } - last_cmd = tcc_module->CTRLBSET.reg & TCC_CTRLBSET_CMD_Msk; - if (last_cmd == TCC_CTRLBSET_CMD_NONE) { - break; - } else if (last_cmd == TCC_CTRLBSET_CMD_UPDATE) { - /* Command have been issued */ - return; - } - } while (1); - - /* Write command to execute */ - tcc_module->CTRLBSET.reg = TCC_CTRLBSET_CMD_UPDATE; -} - -/** - * \brief Enable Circular option for double buffered Top/Period Values - * - * Enable circular option for the double buffered top/period values. - * On each UPDATE condition, the contents of PERB and PER are switched, meaning - * that the contents of PERB are transferred to PER and the contents of PER are - * transferred to PERB. - * - * \param[in] module_inst Pointer to the TCC software instance struct - */ -static inline void tcc_enable_circular_buffer_top( - struct tcc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - module_inst->hw->WAVE.reg |= TCC_WAVE_CIPEREN; -} - -/** - * \brief Disable Circular option for double buffered Top/Period Values - * - * Stop circularing the double buffered top/period values. - * - * \param[in] module_inst Pointer to the TCC software instance struct - */ -static inline void tcc_disable_circular_buffer_top( - struct tcc_module *const module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - module_inst->hw->WAVE.reg &= ~TCC_WAVE_CIPEREN; -} - -enum status_code tcc_set_double_buffer_top_values( - const struct tcc_module *const module_inst, - const uint32_t top_value, const uint32_t top_buffer_value); - - -enum status_code tcc_enable_circular_buffer_compare( - struct tcc_module *const module_inst, - enum tcc_match_capture_channel channel_index); -enum status_code tcc_disable_circular_buffer_compare( - struct tcc_module *const module_inst, - enum tcc_match_capture_channel channel_index); -enum status_code tcc_set_double_buffer_compare_values( - struct tcc_module *const module_inst, - enum tcc_match_capture_channel channel_index, - const uint32_t compare, - const uint32_t compare_buffer); - - -/** @} */ - -/** @} */ - -#ifdef __cplusplus -} -#endif - -/** - * \page asfdoc_sam0_tcc_extra Extra Information for TCC Driver - * - * \section asfdoc_sam0_tcc_extra_acronyms Acronyms - * The table below presents the acronyms used in this module: - * - * <table> - * <tr> - * <th>Acronym</th> - * <th>Description</th> - * </tr> - * <tr> - * <td>DMA</td> - * <td>Direct Memory Access</td> - * </tr> - * <tr> - * <td>TCC</td> - * <td>Timer Counter for Control Applications</td> - * </tr> - * <tr> - * <td>PWM</td> - * <td>Pulse Width Modulation</td> - * </tr> - * <tr> - * <td>PWP</td> - * <td>Pulse Width Period</td> - * </tr> - * <tr> - * <td>PPW</td> - * <td>Period Pulse Width</td> - * </tr> - * </table> - * - * - * \section asfdoc_sam0_tcc_extra_dependencies Dependencies - * This driver has the following dependencies: - * - * - \ref asfdoc_sam0_system_pinmux_group "System Pin Multiplexer Driver" - * - * - * \section asfdoc_sam0_tcc_extra_errata Errata - * There are no errata related to this driver. - * - * - * \section asfdoc_sam0_tcc_extra_history Module History - * An overview of the module history is presented in the table below, with - * details on the enhancements and fixes made to the module since its first - * release. The current version of this corresponds to the newest version in - * the table. - * - * <table> - * <tr> - * <th>Changelog</th> - * </tr> - * <tr> - * <td>Add double buffering functionality</td> - * </tr> - * <tr> - * <td>Add fault handling functionality</td> - * </tr> - * <tr> - * <td>Initial Release</td> - * </tr> - * </table> - */ - -/** - * \page asfdoc_sam0_tcc_exqsg Examples for TCC Driver - * - * This is a list of the available Quick Start guides (QSGs) and example - * applications for \ref asfdoc_sam0_tcc_group. QSGs are simple examples with - * step-by-step instructions to configure and use this driver in a selection of - * use cases. Note that QSGs can be compiled as a standalone application or be - * added to the user application. - * - * - \subpage asfdoc_sam0_tcc_basic_use_case - * - \subpage asfdoc_sam0_tcc_buffering_use_case - * \if TCC_CALLBACK_MODE - * - \subpage asfdoc_sam0_tcc_timer_use_case - * - \subpage asfdoc_sam0_tcc_callback_use_case - * - \subpage asfdoc_sam0_tcc_faultx_use_case - * - \subpage asfdoc_sam0_tcc_faultn_use_case - * \endif - * - \subpage asfdoc_sam0_tcc_dma_use_case - * - * \page asfdoc_sam0_tcc_document_revision_history Document Revision History - * - * <table> - * <tr> - * <th>Doc. Rev.</th> - * <th>Date</th> - * <th>Comments</th> - * </tr> - * <tr> - * <td>42256C</td> - * <td>12/2015</td> - * <td>Added support for SAM L21/L22, SAM DA1, and SAM C20/C21</td> - * </tr> - * <tr> - * <td>42256B</td> - * <td>12/2014</td> - * <td>Added fault handling functionality. - * Added double buffering functionality with use case. - * Added timer use case. - * Added SAM R21/D10/D11 support.</td> - * </tr> - * <tr> - * <td>42256A</td> - * <td>01/2014</td> - * <td>Initial release</td> - * </tr> - * </table> - */ - -#endif /* TCC_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/tcc/tcc_callback.c b/atmel-samd/asf/sam0/drivers/tcc/tcc_callback.c deleted file mode 100644 index aa1d5e3e9..000000000 --- a/atmel-samd/asf/sam0/drivers/tcc/tcc_callback.c +++ /dev/null @@ -1,245 +0,0 @@ -/** - * \file - * - * \brief SAM TCC - Timer Counter for Control Applications Callback Driver - * - * Copyright (C) 2013-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#include "tcc_callback.h" - -void *_tcc_instances[TCC_INST_NUM]; - -void _tcc_interrupt_handler(uint8_t module_index); - -const uint32_t _tcc_intflag[TCC_CALLBACK_N] = { - TCC_INTFLAG_OVF, - TCC_INTFLAG_TRG, - TCC_INTFLAG_CNT, - TCC_INTFLAG_ERR, - TCC_INTFLAG_FAULTA, - TCC_INTFLAG_FAULTB, - TCC_INTFLAG_FAULT0, - TCC_INTFLAG_FAULT1, -#define _TCC_INTFLAG_MC(n,dummy) TCC_INTFLAG_MC##n, - /* TCC_INTFLAG_MC0 ~ ... */ - MREPEAT(TCC_NUM_CHANNELS, _TCC_INTFLAG_MC, 0) -#undef _TCC_INTFLAG_MC -}; - -# define _TCC_INTERRUPT_VECT_NUM(n, unused) \ - SYSTEM_INTERRUPT_MODULE_TCC##n, -/** - * \internal Get the interrupt vector for the given device instance - * - * \param[in] The TCC module instance number - * - * \return Interrupt vector for of the given TCC module instance. - */ -static enum system_interrupt_vector _tcc_interrupt_get_interrupt_vector( - uint32_t inst_num) -{ - static uint8_t tcc_interrupt_vectors[TCC_INST_NUM] = { - MREPEAT(TCC_INST_NUM, _TCC_INTERRUPT_VECT_NUM, 0) - }; - - return (enum system_interrupt_vector)tcc_interrupt_vectors[inst_num]; -} - -/** - * \brief Registers a callback - * - * Registers a callback function which is implemented by the user. - * - * \note The callback must be enabled by \ref tcc_enable_callback, - * in order for the interrupt handler to call it when the conditions for the - * callback type is met. - * - * \param[in] module Pointer to TCC software instance struct - * \param[in] callback_func Pointer to callback function - * \param[in] callback_type Callback type given by an enum - */ -enum status_code tcc_register_callback( - struct tcc_module *const module, - tcc_callback_t callback_func, - const enum tcc_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module); - Assert(callback_func); - - /* Register callback function */ - module->callback[callback_type] = callback_func; - - /* Set the bit corresponding to the callback_type */ - module->register_callback_mask |= _tcc_intflag[callback_type]; - - return STATUS_OK; -} - -/** - * \brief Unregisters a callback - * - * Unregisters a callback function implemented by the user. The callback should - * be disabled before it is unregistered. - * - * \param[in] module Pointer to TCC software instance struct - * \param[in] callback_type Callback type given by an enum - */ -enum status_code tcc_unregister_callback( - struct tcc_module *const module, - const enum tcc_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module); - - /* Unregister callback function */ - module->callback[callback_type] = NULL; - - /* Clear the bit corresponding to the callback_type */ - module->register_callback_mask &= ~_tcc_intflag[callback_type]; - - return STATUS_OK; -} - -/** - * \brief Enables callback - * - * Enables the callback function registered by the \ref - * tcc_register_callback. The callback function will be called from the - * interrupt handler when the conditions for the callback type are - * met. This function will also enable the appropriate interrupts. - * - * \param[in] module Pointer to TCC software instance struct - * \param[in] callback_type Callback type given by an enum - */ -void tcc_enable_callback( - struct tcc_module *const module, - const enum tcc_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - /* Enable interrupts for this TCC module */ - system_interrupt_enable(_tcc_interrupt_get_interrupt_vector( - _tcc_get_inst_index(module->hw))); - - /* Enable channel or other callbacks */ - module->enable_callback_mask |= _tcc_intflag[callback_type]; - module->hw->INTENSET.reg = _tcc_intflag[callback_type]; -} - -/** - * \brief Disables callback - * - * Disables the callback function registered by the \ref - * tcc_register_callback, and the callback will not be called from the - * interrupt routine. The function will also disable the appropriate - * interrupts. - * - * \param[in] module Pointer to TCC software instance struct - * \param[in] callback_type Callback type given by an enum - */ -void tcc_disable_callback( - struct tcc_module *const module, - const enum tcc_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module); - Assert(module->hw); - - /* Disable interrupts for this TCC module */ - system_interrupt_disable(_tcc_interrupt_get_interrupt_vector( - _tcc_get_inst_index(module->hw))); - - /* Disable channel or other callbacks */ - module->enable_callback_mask &= ~_tcc_intflag[callback_type]; - module->hw->INTENCLR.reg = _tcc_intflag[callback_type]; -} - - -/** - * \internal ISR handler for TCC - * - * Auto-generate a set of interrupt handlers for each TCC in the device. - */ -#define _TCC_INTERRUPT_HANDLER(n, m) \ - void TCC##n##_Handler(void) \ - { \ - _tcc_interrupt_handler(n); \ - } - -MREPEAT(TCC_INST_NUM, _TCC_INTERRUPT_HANDLER, 0) - -/** - * \internal Interrupt handler for the TCC module - * - * Handles interrupts as they occur, it will run the callback functions - * that are registered and enabled. - * - * \param[in] module_index ID of the TCC instance calling the interrupt - * handler - */ -void _tcc_interrupt_handler( - uint8_t module_index) -{ - int i; - - uint32_t interrupt_and_callback_status_mask; - - struct tcc_module *module = - (struct tcc_module *)_tcc_instances[module_index]; - - interrupt_and_callback_status_mask = (module->hw->INTFLAG.reg & - module->register_callback_mask & - module->enable_callback_mask); - - /* Check if callback interrupt has occured */ - for (i = 0; i < TCC_CALLBACK_N; i ++) { - if (interrupt_and_callback_status_mask & _tcc_intflag[i]) { - /* Invoke the registered and enabled callback function */ - (module->callback[i])(module); - /* Clear interrupt flag */ - module->hw->INTFLAG.reg = _tcc_intflag[i]; - } - } -} diff --git a/atmel-samd/asf/sam0/drivers/tcc/tcc_callback.h b/atmel-samd/asf/sam0/drivers/tcc/tcc_callback.h deleted file mode 100644 index 37b0bbb72..000000000 --- a/atmel-samd/asf/sam0/drivers/tcc/tcc_callback.h +++ /dev/null @@ -1,93 +0,0 @@ -/** - * \file - * - * \brief SAM TCC - Timer Counter for Control Applications Callback Driver - * - * Copyright (C) 2013-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - - -#ifndef TCC_CALLBACK_H_INCLUDED -#define TCC_CALLBACK_H_INCLUDED - -#include "tcc.h" -#include <system_interrupt.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#if !defined(__DOXYGEN__) -extern void *_tcc_instances[TCC_INST_NUM]; -#endif - - -/** - * \name Callback Management - * {@ - */ - -enum status_code tcc_register_callback( - struct tcc_module *const module, - tcc_callback_t callback_func, - const enum tcc_callback callback_type); - -enum status_code tcc_unregister_callback( - struct tcc_module *const module, - const enum tcc_callback callback_type); - -void tcc_enable_callback( - struct tcc_module *const module, - const enum tcc_callback callback_type); - -void tcc_disable_callback( - struct tcc_module *const module, - const enum tcc_callback callback_type); - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif - -#endif /* TCC_CALLBACK_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/usb/stack_interface/doxygen/sam0.drivers.usb.dual/doxyfile.doxygen b/atmel-samd/asf/sam0/drivers/usb/stack_interface/doxygen/sam0.drivers.usb.dual/doxyfile.doxygen deleted file mode 100644 index 2fa7ea9d1..000000000 --- a/atmel-samd/asf/sam0/drivers/usb/stack_interface/doxygen/sam0.drivers.usb.dual/doxyfile.doxygen +++ /dev/null @@ -1,1645 +0,0 @@ -# Doxyfile 1.7.1 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = "SAM D21/R21/D11/L21/DA1/L22 USB Dual role interface" - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = . - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, -# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English -# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, -# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, -# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = NO - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = YES - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES += asf_license_start=" " -ALIASES += asf_license_stop=" " - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given extension. -# Doxygen has a built-in mapping, but you can override or extend it using this -# tag. The format is ext=language, where ext is a file extension, and language -# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, -# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make -# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C -# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions -# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate getter -# and setter methods for a property. Setting this option to YES (the default) -# will make doxygen to replace the get and set methods by a property in the -# documentation. This will only work if the methods are indeed getting or -# setting a simple type. If this is not the case, or you want to show the -# methods anyway, you should set this option to NO. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. - -TYPEDEF_HIDES_STRUCT = NO - -# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to -# determine which symbols to keep in memory and which to flush to disk. -# When the cache is full, less often used symbols will be written to disk. -# For small to medium size projects (<1000 input files) the default value is -# probably good enough. For larger projects a too small cache size can cause -# doxygen to be busy swapping symbols to and from disk most of the time -# causing a significant performance penality. -# If the system has enough physical memory increasing the cache will improve the -# performance by keeping more symbols in memory. Note that the value works on -# a logarithmic scale so increasing the size by one will rougly double the -# memory usage. The cache size is given by this formula: -# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols - -SYMBOL_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespace are hidden. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = YES - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = NO - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen -# will list include files with double quotes in the documentation -# rather than with sharp brackets. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = YES - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen -# will sort the (brief and detailed) documentation of class members so that -# constructors and destructors are listed first. If set to NO (the default) -# the constructors will appear in the respective orders defined by -# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. -# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO -# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) -# the group names will appear in their defined order. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = NO - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - -SHOW_DIRECTORIES = NO - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the -# Folder Tree View (if specified). The default is YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. -# This will remove the Namespaces entry from the Quick Index -# and from the Folder Tree View (if specified). The default is YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command <command> <input-file>, where <command> is the value of -# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. The create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. -# You can optionally specify a file name after the option, if omitted -# DoxygenLayout.xml will be used as the name of the layout file. - -LAYOUT_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = YES - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be abled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "[WARNING]$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = doxygen_module_mainpage.h ../../usb_dual.c ../../usb_dual.h - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for -# the list of possible encodings. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx -# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 - -FILE_PATTERNS = *.c \ - *.h \ - *.s \ - *.S - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = ./ - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command <filter> <input-file>, where <filter> -# is the value of the INPUT_FILTER tag, and <input-file> is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. -# If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. -# Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. -# The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = YES - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = YES - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = YES - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. -# Otherwise they will link to the documentation. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = NO - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. -# Doxygen will adjust the colors in the stylesheet and background images -# according to this color. Hue is specified as an angle on a colorwheel, -# see http://en.wikipedia.org/wiki/Hue for more information. -# For instance the value 0 represents red, 60 is yellow, 120 is green, -# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. -# The allowed range is 0 to 359. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of -# the colors in the HTML output. For a value of 0 the output will use -# grayscales only. A value of 255 will produce the most vivid colors. - -HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to -# the luminance component of the colors in the HTML output. Values below -# 100 gradually make the output lighter, whereas values above 100 make -# the output darker. The value divided by 100 is the actual gamma applied, -# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, -# and 100 does not change the gamma. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting -# this to NO can help when comparing the output of multiple runs. - -HTML_TIMESTAMP = YES - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. For this to work a browser that supports -# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox -# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). - -HTML_DYNAMIC_SECTIONS = NO - -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). -# To create a documentation set, doxygen will generate a Makefile in the -# HTML output directory. Running make will produce the docset in that -# directory and running "make install" will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find -# it at startup. -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. - -GENERATE_DOCSET = NO - -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the -# feed. A documentation feed provides an umbrella under which multiple -# documentation sets from a single provider (such as a company or product suite) -# can be grouped. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that -# should uniquely identify the documentation set bundle. This should be a -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen -# will append .docset to the name. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify -# the documentation publisher. This should be a reverse domain-name style -# string, e.g. com.mycompany.MyDocSet.documentation. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING -# is used to encode HtmlHelp index (hhk), content (hhc) and project file -# content. - -CHM_INDEX_ENCODING = - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated -# that can be used as input for Qt's qhelpgenerator to generate a -# Qt Compressed Help (.qch) of the generated HTML documentation. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can -# be used to specify the file name of the resulting .qch file. -# The path specified is relative to the HTML output folder. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders - -QHP_VIRTUAL_FOLDER = doc - -# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to -# add. For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see -# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters"> -# Qt Help Project / Custom Filters</a>. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's -# filter section matches. -# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes"> -# Qt Help Project / Filter Attributes</a>. - -QHP_SECT_FILTER_ATTRS = - -# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can -# be used to specify the location of Qt's qhelpgenerator. -# If non-empty doxygen will try to run qhelpgenerator on the generated -# .qhp file. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files -# will be generated, which together with the HTML files, form an Eclipse help -# plugin. To install this plugin and make it available under the help contents -# menu in Eclipse, the contents of the directory containing the HTML and XML -# files needs to be copied into the plugins directory of eclipse. The name of -# the directory within the plugins directory should be the same as -# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before -# the help appears. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have -# this name. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 1 - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. -# If the tag value is set to YES, a side panel will be generated -# containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). -# Windows users are probably better off using the HTML help feature. - -GENERATE_TREEVIEW = NO - -# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, -# and Class Hierarchy pages using a tree view instead of an ordered list. - -USE_INLINE_TREES = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open -# links to external symbols imported via tag files in a separate window. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of Latex formulas included -# as images in the HTML documentation. The default is 10. Note that -# when you change the font size after a successful doxygen run you need -# to manually remove any form_*.png images from the HTML output directory -# to force them to be regenerated. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are -# not supported properly for IE 6.0, but are supported on all modern browsers. -# Note that when changing this option you need to delete any form_*.png files -# in the HTML output before the changes have effect. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering -# instead of using prerendered bitmaps. Use this if you do not have LaTeX -# installed or if you want to formulas look prettier in the HTML output. When -# enabled you may also need to install MathJax separately and configure the path -# to it using the MATHJAX_RELPATH option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -USE_MATHJAX = NO - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box -# for the HTML output. The underlying search engine uses javascript -# and DHTML and should work on any modern browser. Note that when using -# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets -# (GENERATE_DOCSET) there is already a search function so this one should -# typically be disabled. For large projects the javascript based search engine -# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. - -SEARCHENGINE = YES - -# When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a PHP enabled web server instead of at the web client -# using Javascript. Doxygen will generate the search PHP script and index -# file to put on the web server. The advantage of the server -# based approach is that it scales better to large projects and allows -# full text search. The disadvances is that it is more difficult to setup -# and does not have live searching capabilities. - -SERVER_BASED_SEARCH = NO - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. -# Note that when enabling USE_PDFLATEX this option is only used for -# generating bitmaps for formulas in the HTML output, but not in the -# Makefile that is written to the output directory. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = NO - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = NO - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -# If LATEX_SOURCE_CODE is set to YES then doxygen will include -# source code with syntax highlighting in the LaTeX output. -# Note that which sources are shown also depends on other settings -# such as SOURCE_BROWSER. - -LATEX_SOURCE_CODE = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = RTF - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = YES - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. -# This is useful -# if you want to understand what is going on. -# On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = YES - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = YES - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = ../.. - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = __DOXYGEN__ __AVR32_ABI_COMPILER__ __attribute__()= __GNUC__=4 - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse -# the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option is superseded by the HAVE_DOT option below. This is only a -# fallback. It is recommended to install and use dot, since it yields more -# powerful graphs. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = YES - -# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is -# allowed to run in parallel. When set to 0 (the default) doxygen will -# base this on the number of processors available in the system. You can set it -# explicitly to a value larger than 0 to get control over the balance -# between CPU load and processing speed. - -DOT_NUM_THREADS = 0 - -# By default doxygen will write a font called FreeSans.ttf to the output -# directory and reference it in all dot files that doxygen generates. This -# font does not include all possible unicode characters however, so when you need -# these (or just want a differently looking font) you can specify the font name -# using DOT_FONTNAME. You need need to make sure dot is able to find the font, -# which can be done by putting it in a standard location or by setting the -# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory -# containing the font. - -DOT_FONTNAME = FreeSans - -# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. -# The default size is 10pt. - -DOT_FONTSIZE = 10 - -# By default doxygen will tell dot to use the output directory to look for the -# FreeSans.ttf font (which doxygen will put there itself). If you specify a -# different font using DOT_FONTNAME you can set the path where dot -# can find it using this tag. - -DOT_FONTPATH = - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = YES - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT options are set to YES then -# doxygen will generate a call dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable call graphs -# for selected functions only using the \callgraph command. - -CALL_GRAPH = YES - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then -# doxygen will generate a caller dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable caller -# graphs for selected functions only using the \callergraph command. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = gif - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the -# number of direct children of the root node in a graph is already larger than -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 50 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 0 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not -# seem to support this out of the box. Warning: Depending on the platform used, -# enabling this option may lead to badly anti-aliased labels on the edges of -# a graph (i.e. they become hard to read). - -DOT_TRANSPARENT = NO - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = YES - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES diff --git a/atmel-samd/asf/sam0/drivers/usb/stack_interface/doxygen/sam0.drivers.usb.dual/doxygen_module_mainpage.h b/atmel-samd/asf/sam0/drivers/usb/stack_interface/doxygen/sam0.drivers.usb.dual/doxygen_module_mainpage.h deleted file mode 100644 index 26566747f..000000000 --- a/atmel-samd/asf/sam0/drivers/usb/stack_interface/doxygen/sam0.drivers.usb.dual/doxygen_module_mainpage.h +++ /dev/null @@ -1,58 +0,0 @@ - -/** - * Copyright (c) 2012 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - * \mainpage - * - * \section intro Introduction - * This documentation has been automatically generated, and documents the source - * code found in the Atmel Software Framework (ASF). <p> - * Use the above menu to navigate in the documentation, or use the links below: <br> - * <ul> - * <li> <a href="globals_func.html">Functions</a> - * <li> <a href="annotated.html">Data structures</a> - * <li> <a href="globals_type.html">Defines</a> - * </ul> - * - * \section main_licence License - * <ul> - * <li>\ref License - * </ul> - * \section contactinfo Contact Information - * For further information, visit <a href="http://www.atmel.com/">Atmel</a>.\n - * - */ diff --git a/atmel-samd/asf/sam0/drivers/usb/stack_interface/doxygen/sam0.drivers.usb.udd/doxyfile.doxygen b/atmel-samd/asf/sam0/drivers/usb/stack_interface/doxygen/sam0.drivers.usb.udd/doxyfile.doxygen deleted file mode 100644 index 808782835..000000000 --- a/atmel-samd/asf/sam0/drivers/usb/stack_interface/doxygen/sam0.drivers.usb.udd/doxyfile.doxygen +++ /dev/null @@ -1,1645 +0,0 @@ -# Doxyfile 1.7.1 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = "SAM D21/R21/D11/L21/L22/DA1 USB UDD interface" - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = . - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, -# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English -# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, -# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, -# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = NO - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = YES - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES += asf_license_start=" " -ALIASES += asf_license_stop=" " - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given extension. -# Doxygen has a built-in mapping, but you can override or extend it using this -# tag. The format is ext=language, where ext is a file extension, and language -# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, -# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make -# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C -# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions -# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate getter -# and setter methods for a property. Setting this option to YES (the default) -# will make doxygen to replace the get and set methods by a property in the -# documentation. This will only work if the methods are indeed getting or -# setting a simple type. If this is not the case, or you want to show the -# methods anyway, you should set this option to NO. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. - -TYPEDEF_HIDES_STRUCT = NO - -# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to -# determine which symbols to keep in memory and which to flush to disk. -# When the cache is full, less often used symbols will be written to disk. -# For small to medium size projects (<1000 input files) the default value is -# probably good enough. For larger projects a too small cache size can cause -# doxygen to be busy swapping symbols to and from disk most of the time -# causing a significant performance penality. -# If the system has enough physical memory increasing the cache will improve the -# performance by keeping more symbols in memory. Note that the value works on -# a logarithmic scale so increasing the size by one will rougly double the -# memory usage. The cache size is given by this formula: -# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols - -SYMBOL_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespace are hidden. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = YES - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = NO - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen -# will list include files with double quotes in the documentation -# rather than with sharp brackets. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = YES - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen -# will sort the (brief and detailed) documentation of class members so that -# constructors and destructors are listed first. If set to NO (the default) -# the constructors will appear in the respective orders defined by -# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. -# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO -# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) -# the group names will appear in their defined order. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = NO - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - -SHOW_DIRECTORIES = NO - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the -# Folder Tree View (if specified). The default is YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. -# This will remove the Namespaces entry from the Quick Index -# and from the Folder Tree View (if specified). The default is YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command <command> <input-file>, where <command> is the value of -# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. The create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. -# You can optionally specify a file name after the option, if omitted -# DoxygenLayout.xml will be used as the name of the layout file. - -LAYOUT_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = YES - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be abled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "[WARNING]$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = doxygen_module_mainpage.h ../../usb_device_udd.c - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for -# the list of possible encodings. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx -# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 - -FILE_PATTERNS = *.c \ - *.h \ - *.s \ - *.S - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = ./ - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command <filter> <input-file>, where <filter> -# is the value of the INPUT_FILTER tag, and <input-file> is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. -# If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. -# Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. -# The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = YES - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = YES - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = YES - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. -# Otherwise they will link to the documentation. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = NO - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. -# Doxygen will adjust the colors in the stylesheet and background images -# according to this color. Hue is specified as an angle on a colorwheel, -# see http://en.wikipedia.org/wiki/Hue for more information. -# For instance the value 0 represents red, 60 is yellow, 120 is green, -# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. -# The allowed range is 0 to 359. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of -# the colors in the HTML output. For a value of 0 the output will use -# grayscales only. A value of 255 will produce the most vivid colors. - -HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to -# the luminance component of the colors in the HTML output. Values below -# 100 gradually make the output lighter, whereas values above 100 make -# the output darker. The value divided by 100 is the actual gamma applied, -# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, -# and 100 does not change the gamma. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting -# this to NO can help when comparing the output of multiple runs. - -HTML_TIMESTAMP = YES - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. For this to work a browser that supports -# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox -# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). - -HTML_DYNAMIC_SECTIONS = NO - -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). -# To create a documentation set, doxygen will generate a Makefile in the -# HTML output directory. Running make will produce the docset in that -# directory and running "make install" will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find -# it at startup. -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. - -GENERATE_DOCSET = NO - -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the -# feed. A documentation feed provides an umbrella under which multiple -# documentation sets from a single provider (such as a company or product suite) -# can be grouped. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that -# should uniquely identify the documentation set bundle. This should be a -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen -# will append .docset to the name. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify -# the documentation publisher. This should be a reverse domain-name style -# string, e.g. com.mycompany.MyDocSet.documentation. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING -# is used to encode HtmlHelp index (hhk), content (hhc) and project file -# content. - -CHM_INDEX_ENCODING = - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated -# that can be used as input for Qt's qhelpgenerator to generate a -# Qt Compressed Help (.qch) of the generated HTML documentation. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can -# be used to specify the file name of the resulting .qch file. -# The path specified is relative to the HTML output folder. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders - -QHP_VIRTUAL_FOLDER = doc - -# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to -# add. For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see -# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters"> -# Qt Help Project / Custom Filters</a>. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's -# filter section matches. -# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes"> -# Qt Help Project / Filter Attributes</a>. - -QHP_SECT_FILTER_ATTRS = - -# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can -# be used to specify the location of Qt's qhelpgenerator. -# If non-empty doxygen will try to run qhelpgenerator on the generated -# .qhp file. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files -# will be generated, which together with the HTML files, form an Eclipse help -# plugin. To install this plugin and make it available under the help contents -# menu in Eclipse, the contents of the directory containing the HTML and XML -# files needs to be copied into the plugins directory of eclipse. The name of -# the directory within the plugins directory should be the same as -# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before -# the help appears. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have -# this name. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 1 - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. -# If the tag value is set to YES, a side panel will be generated -# containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). -# Windows users are probably better off using the HTML help feature. - -GENERATE_TREEVIEW = NO - -# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, -# and Class Hierarchy pages using a tree view instead of an ordered list. - -USE_INLINE_TREES = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open -# links to external symbols imported via tag files in a separate window. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of Latex formulas included -# as images in the HTML documentation. The default is 10. Note that -# when you change the font size after a successful doxygen run you need -# to manually remove any form_*.png images from the HTML output directory -# to force them to be regenerated. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are -# not supported properly for IE 6.0, but are supported on all modern browsers. -# Note that when changing this option you need to delete any form_*.png files -# in the HTML output before the changes have effect. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering -# instead of using prerendered bitmaps. Use this if you do not have LaTeX -# installed or if you want to formulas look prettier in the HTML output. When -# enabled you may also need to install MathJax separately and configure the path -# to it using the MATHJAX_RELPATH option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -USE_MATHJAX = NO - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box -# for the HTML output. The underlying search engine uses javascript -# and DHTML and should work on any modern browser. Note that when using -# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets -# (GENERATE_DOCSET) there is already a search function so this one should -# typically be disabled. For large projects the javascript based search engine -# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. - -SEARCHENGINE = YES - -# When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a PHP enabled web server instead of at the web client -# using Javascript. Doxygen will generate the search PHP script and index -# file to put on the web server. The advantage of the server -# based approach is that it scales better to large projects and allows -# full text search. The disadvances is that it is more difficult to setup -# and does not have live searching capabilities. - -SERVER_BASED_SEARCH = NO - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. -# Note that when enabling USE_PDFLATEX this option is only used for -# generating bitmaps for formulas in the HTML output, but not in the -# Makefile that is written to the output directory. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = NO - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = NO - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -# If LATEX_SOURCE_CODE is set to YES then doxygen will include -# source code with syntax highlighting in the LaTeX output. -# Note that which sources are shown also depends on other settings -# such as SOURCE_BROWSER. - -LATEX_SOURCE_CODE = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = RTF - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = YES - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. -# This is useful -# if you want to understand what is going on. -# On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = YES - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = YES - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = ../.. - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = __DOXYGEN__ __AVR32_ABI_COMPILER__ __attribute__()= __GNUC__=4 - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse -# the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option is superseded by the HAVE_DOT option below. This is only a -# fallback. It is recommended to install and use dot, since it yields more -# powerful graphs. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = YES - -# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is -# allowed to run in parallel. When set to 0 (the default) doxygen will -# base this on the number of processors available in the system. You can set it -# explicitly to a value larger than 0 to get control over the balance -# between CPU load and processing speed. - -DOT_NUM_THREADS = 0 - -# By default doxygen will write a font called FreeSans.ttf to the output -# directory and reference it in all dot files that doxygen generates. This -# font does not include all possible unicode characters however, so when you need -# these (or just want a differently looking font) you can specify the font name -# using DOT_FONTNAME. You need need to make sure dot is able to find the font, -# which can be done by putting it in a standard location or by setting the -# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory -# containing the font. - -DOT_FONTNAME = FreeSans - -# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. -# The default size is 10pt. - -DOT_FONTSIZE = 10 - -# By default doxygen will tell dot to use the output directory to look for the -# FreeSans.ttf font (which doxygen will put there itself). If you specify a -# different font using DOT_FONTNAME you can set the path where dot -# can find it using this tag. - -DOT_FONTPATH = - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = YES - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT options are set to YES then -# doxygen will generate a call dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable call graphs -# for selected functions only using the \callgraph command. - -CALL_GRAPH = YES - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then -# doxygen will generate a caller dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable caller -# graphs for selected functions only using the \callergraph command. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = gif - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the -# number of direct children of the root node in a graph is already larger than -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 50 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 0 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not -# seem to support this out of the box. Warning: Depending on the platform used, -# enabling this option may lead to badly anti-aliased labels on the edges of -# a graph (i.e. they become hard to read). - -DOT_TRANSPARENT = NO - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = YES - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES diff --git a/atmel-samd/asf/sam0/drivers/usb/stack_interface/doxygen/sam0.drivers.usb.udd/doxygen_module_mainpage.h b/atmel-samd/asf/sam0/drivers/usb/stack_interface/doxygen/sam0.drivers.usb.udd/doxygen_module_mainpage.h deleted file mode 100644 index 26566747f..000000000 --- a/atmel-samd/asf/sam0/drivers/usb/stack_interface/doxygen/sam0.drivers.usb.udd/doxygen_module_mainpage.h +++ /dev/null @@ -1,58 +0,0 @@ - -/** - * Copyright (c) 2012 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - * \mainpage - * - * \section intro Introduction - * This documentation has been automatically generated, and documents the source - * code found in the Atmel Software Framework (ASF). <p> - * Use the above menu to navigate in the documentation, or use the links below: <br> - * <ul> - * <li> <a href="globals_func.html">Functions</a> - * <li> <a href="annotated.html">Data structures</a> - * <li> <a href="globals_type.html">Defines</a> - * </ul> - * - * \section main_licence License - * <ul> - * <li>\ref License - * </ul> - * \section contactinfo Contact Information - * For further information, visit <a href="http://www.atmel.com/">Atmel</a>.\n - * - */ diff --git a/atmel-samd/asf/sam0/drivers/usb/stack_interface/doxygen/sam0.drivers.usb.uhd/doxyfile.doxygen b/atmel-samd/asf/sam0/drivers/usb/stack_interface/doxygen/sam0.drivers.usb.uhd/doxyfile.doxygen deleted file mode 100644 index 917c97665..000000000 --- a/atmel-samd/asf/sam0/drivers/usb/stack_interface/doxygen/sam0.drivers.usb.uhd/doxyfile.doxygen +++ /dev/null @@ -1,1645 +0,0 @@ -# Doxyfile 1.7.1 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = "SAM D21/R21/L21/DA1 USB UHD interface" - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = . - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, -# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English -# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, -# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, -# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = NO - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = YES - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES += asf_license_start=" " -ALIASES += asf_license_stop=" " - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given extension. -# Doxygen has a built-in mapping, but you can override or extend it using this -# tag. The format is ext=language, where ext is a file extension, and language -# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C, -# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make -# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C -# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions -# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate getter -# and setter methods for a property. Setting this option to YES (the default) -# will make doxygen to replace the get and set methods by a property in the -# documentation. This will only work if the methods are indeed getting or -# setting a simple type. If this is not the case, or you want to show the -# methods anyway, you should set this option to NO. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. - -TYPEDEF_HIDES_STRUCT = NO - -# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to -# determine which symbols to keep in memory and which to flush to disk. -# When the cache is full, less often used symbols will be written to disk. -# For small to medium size projects (<1000 input files) the default value is -# probably good enough. For larger projects a too small cache size can cause -# doxygen to be busy swapping symbols to and from disk most of the time -# causing a significant performance penality. -# If the system has enough physical memory increasing the cache will improve the -# performance by keeping more symbols in memory. Note that the value works on -# a logarithmic scale so increasing the size by one will rougly double the -# memory usage. The cache size is given by this formula: -# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols - -SYMBOL_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespace are hidden. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = YES - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = NO - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = NO - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen -# will list include files with double quotes in the documentation -# rather than with sharp brackets. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = YES - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen -# will sort the (brief and detailed) documentation of class members so that -# constructors and destructors are listed first. If set to NO (the default) -# the constructors will appear in the respective orders defined by -# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. -# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO -# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) -# the group names will appear in their defined order. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = NO - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - -SHOW_DIRECTORIES = NO - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the -# Folder Tree View (if specified). The default is YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. -# This will remove the Namespaces entry from the Quick Index -# and from the Folder Tree View (if specified). The default is YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command <command> <input-file>, where <command> is the value of -# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. The create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. -# You can optionally specify a file name after the option, if omitted -# DoxygenLayout.xml will be used as the name of the layout file. - -LAYOUT_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = YES - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be abled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "[WARNING]$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = doxygen_module_mainpage.h ../../usb_host_uhd.c - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for -# the list of possible encodings. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx -# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 - -FILE_PATTERNS = *.c \ - *.h \ - *.s \ - *.S - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = ./ - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command <filter> <input-file>, where <filter> -# is the value of the INPUT_FILTER tag, and <input-file> is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. -# If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. -# Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. -# The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = YES - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = YES - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = YES - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. -# Otherwise they will link to the documentation. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = NO - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. -# Doxygen will adjust the colors in the stylesheet and background images -# according to this color. Hue is specified as an angle on a colorwheel, -# see http://en.wikipedia.org/wiki/Hue for more information. -# For instance the value 0 represents red, 60 is yellow, 120 is green, -# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. -# The allowed range is 0 to 359. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of -# the colors in the HTML output. For a value of 0 the output will use -# grayscales only. A value of 255 will produce the most vivid colors. - -HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to -# the luminance component of the colors in the HTML output. Values below -# 100 gradually make the output lighter, whereas values above 100 make -# the output darker. The value divided by 100 is the actual gamma applied, -# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, -# and 100 does not change the gamma. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting -# this to NO can help when comparing the output of multiple runs. - -HTML_TIMESTAMP = YES - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. For this to work a browser that supports -# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox -# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). - -HTML_DYNAMIC_SECTIONS = NO - -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). -# To create a documentation set, doxygen will generate a Makefile in the -# HTML output directory. Running make will produce the docset in that -# directory and running "make install" will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find -# it at startup. -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. - -GENERATE_DOCSET = NO - -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the -# feed. A documentation feed provides an umbrella under which multiple -# documentation sets from a single provider (such as a company or product suite) -# can be grouped. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that -# should uniquely identify the documentation set bundle. This should be a -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen -# will append .docset to the name. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify -# the documentation publisher. This should be a reverse domain-name style -# string, e.g. com.mycompany.MyDocSet.documentation. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING -# is used to encode HtmlHelp index (hhk), content (hhc) and project file -# content. - -CHM_INDEX_ENCODING = - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated -# that can be used as input for Qt's qhelpgenerator to generate a -# Qt Compressed Help (.qch) of the generated HTML documentation. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can -# be used to specify the file name of the resulting .qch file. -# The path specified is relative to the HTML output folder. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders - -QHP_VIRTUAL_FOLDER = doc - -# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to -# add. For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see -# <a href="http://doc.trolltech.com/qthelpproject.html#custom-filters"> -# Qt Help Project / Custom Filters</a>. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's -# filter section matches. -# <a href="http://doc.trolltech.com/qthelpproject.html#filter-attributes"> -# Qt Help Project / Filter Attributes</a>. - -QHP_SECT_FILTER_ATTRS = - -# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can -# be used to specify the location of Qt's qhelpgenerator. -# If non-empty doxygen will try to run qhelpgenerator on the generated -# .qhp file. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files -# will be generated, which together with the HTML files, form an Eclipse help -# plugin. To install this plugin and make it available under the help contents -# menu in Eclipse, the contents of the directory containing the HTML and XML -# files needs to be copied into the plugins directory of eclipse. The name of -# the directory within the plugins directory should be the same as -# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before -# the help appears. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have -# this name. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 1 - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. -# If the tag value is set to YES, a side panel will be generated -# containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). -# Windows users are probably better off using the HTML help feature. - -GENERATE_TREEVIEW = NO - -# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, -# and Class Hierarchy pages using a tree view instead of an ordered list. - -USE_INLINE_TREES = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open -# links to external symbols imported via tag files in a separate window. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of Latex formulas included -# as images in the HTML documentation. The default is 10. Note that -# when you change the font size after a successful doxygen run you need -# to manually remove any form_*.png images from the HTML output directory -# to force them to be regenerated. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are -# not supported properly for IE 6.0, but are supported on all modern browsers. -# Note that when changing this option you need to delete any form_*.png files -# in the HTML output before the changes have effect. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering -# instead of using prerendered bitmaps. Use this if you do not have LaTeX -# installed or if you want to formulas look prettier in the HTML output. When -# enabled you may also need to install MathJax separately and configure the path -# to it using the MATHJAX_RELPATH option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -USE_MATHJAX = NO - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box -# for the HTML output. The underlying search engine uses javascript -# and DHTML and should work on any modern browser. Note that when using -# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets -# (GENERATE_DOCSET) there is already a search function so this one should -# typically be disabled. For large projects the javascript based search engine -# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. - -SEARCHENGINE = YES - -# When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a PHP enabled web server instead of at the web client -# using Javascript. Doxygen will generate the search PHP script and index -# file to put on the web server. The advantage of the server -# based approach is that it scales better to large projects and allows -# full text search. The disadvances is that it is more difficult to setup -# and does not have live searching capabilities. - -SERVER_BASED_SEARCH = NO - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. -# Note that when enabling USE_PDFLATEX this option is only used for -# generating bitmaps for formulas in the HTML output, but not in the -# Makefile that is written to the output directory. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = NO - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = NO - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -# If LATEX_SOURCE_CODE is set to YES then doxygen will include -# source code with syntax highlighting in the LaTeX output. -# Note that which sources are shown also depends on other settings -# such as SOURCE_BROWSER. - -LATEX_SOURCE_CODE = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = RTF - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = YES - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. -# This is useful -# if you want to understand what is going on. -# On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = YES - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = YES - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = ../.. - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = __DOXYGEN__ __AVR32_ABI_COMPILER__ __attribute__()= __GNUC__=4 - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse -# the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option is superseded by the HAVE_DOT option below. This is only a -# fallback. It is recommended to install and use dot, since it yields more -# powerful graphs. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = YES - -# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is -# allowed to run in parallel. When set to 0 (the default) doxygen will -# base this on the number of processors available in the system. You can set it -# explicitly to a value larger than 0 to get control over the balance -# between CPU load and processing speed. - -DOT_NUM_THREADS = 0 - -# By default doxygen will write a font called FreeSans.ttf to the output -# directory and reference it in all dot files that doxygen generates. This -# font does not include all possible unicode characters however, so when you need -# these (or just want a differently looking font) you can specify the font name -# using DOT_FONTNAME. You need need to make sure dot is able to find the font, -# which can be done by putting it in a standard location or by setting the -# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory -# containing the font. - -DOT_FONTNAME = FreeSans - -# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. -# The default size is 10pt. - -DOT_FONTSIZE = 10 - -# By default doxygen will tell dot to use the output directory to look for the -# FreeSans.ttf font (which doxygen will put there itself). If you specify a -# different font using DOT_FONTNAME you can set the path where dot -# can find it using this tag. - -DOT_FONTPATH = - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = YES - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT options are set to YES then -# doxygen will generate a call dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable call graphs -# for selected functions only using the \callgraph command. - -CALL_GRAPH = YES - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then -# doxygen will generate a caller dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable caller -# graphs for selected functions only using the \callergraph command. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = gif - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the -# number of direct children of the root node in a graph is already larger than -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 50 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 0 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not -# seem to support this out of the box. Warning: Depending on the platform used, -# enabling this option may lead to badly anti-aliased labels on the edges of -# a graph (i.e. they become hard to read). - -DOT_TRANSPARENT = NO - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = YES - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES diff --git a/atmel-samd/asf/sam0/drivers/usb/stack_interface/doxygen/sam0.drivers.usb.uhd/doxygen_module_mainpage.h b/atmel-samd/asf/sam0/drivers/usb/stack_interface/doxygen/sam0.drivers.usb.uhd/doxygen_module_mainpage.h deleted file mode 100644 index 26566747f..000000000 --- a/atmel-samd/asf/sam0/drivers/usb/stack_interface/doxygen/sam0.drivers.usb.uhd/doxygen_module_mainpage.h +++ /dev/null @@ -1,58 +0,0 @@ - -/** - * Copyright (c) 2012 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - * \mainpage - * - * \section intro Introduction - * This documentation has been automatically generated, and documents the source - * code found in the Atmel Software Framework (ASF). <p> - * Use the above menu to navigate in the documentation, or use the links below: <br> - * <ul> - * <li> <a href="globals_func.html">Functions</a> - * <li> <a href="annotated.html">Data structures</a> - * <li> <a href="globals_type.html">Defines</a> - * </ul> - * - * \section main_licence License - * <ul> - * <li>\ref License - * </ul> - * \section contactinfo Contact Information - * For further information, visit <a href="http://www.atmel.com/">Atmel</a>.\n - * - */ diff --git a/atmel-samd/asf/sam0/drivers/usb/stack_interface/usb_device_udd.c b/atmel-samd/asf/sam0/drivers/usb/stack_interface/usb_device_udd.c deleted file mode 100644 index d40b02126..000000000 --- a/atmel-samd/asf/sam0/drivers/usb/stack_interface/usb_device_udd.c +++ /dev/null @@ -1,1276 +0,0 @@ -/** - * \file - * - * \brief USB Device wrapper layer for compliance with common driver UDD - * - * Copyright (C) 2014-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#include <string.h> -#include <stdlib.h> - -// Get USB device configuration -#include "conf_usb.h" -#include "udd.h" -#include "usb.h" -#include "usb_dual.h" -#include "sleepmgr.h" - -/** - * \ingroup usb_device_group - * \defgroup usb_device_udd_group USB Device Driver Implement (UDD) - * USB low-level driver for USB device mode - * @{ - */ -// Check USB device configuration -#ifdef USB_DEVICE_HS_SUPPORT -# error The High speed mode is not supported on this part, please remove USB_DEVICE_HS_SUPPORT in conf_usb.h -#endif - -#if !(SAMD21) && !(SAMR21) && !(SAMD11) && !(SAML21) && !(SAML22) && !(SAMDA1) && !(SAMR30) -# error The current USB Device Driver supports only SAMD21/R21/D11/L21/L22/DA1 -#endif - -#ifndef UDC_REMOTEWAKEUP_LPM_ENABLE -#define UDC_REMOTEWAKEUP_LPM_ENABLE() -#endif -#ifndef UDC_REMOTEWAKEUP_LPM_DISABLE -#define UDC_REMOTEWAKEUP_LPM_DISABLE() -#endif -#ifndef UDC_SUSPEND_LPM_EVENT -#define UDC_SUSPEND_LPM_EVENT() -#endif - -/* for debug text */ -#ifdef USB_DEBUG -# define dbg_print printf -#else -# define dbg_print(...) -#endif - -/** Maximum size of a transfer in multi-packet mode */ -#define UDD_ENDPOINT_MAX_TRANS ((8*1024)-1) - -/** USB software device instance structure */ -struct usb_module usb_device; - -/** - * \name Clock management - * - * @{ - */ -#ifndef UDD_CLOCK_GEN -#if (SAML21) || (SAML22) || (SAMR30) -# define UDD_CLOCK_GEN GCLK_GENERATOR_3 -#elif (SAMDA1) -# define UDD_CLOCK_GEN GCLK_GENERATOR_1 -#else -# define UDD_CLOCK_GEN GCLK_GENERATOR_0 -#endif -#endif -#ifndef UDD_CLOCK_SOURCE -# define UDD_CLOCK_SOURCE SYSTEM_CLOCK_SOURCE_DFLL -#endif -static inline void udd_wait_clock_ready(void) -{ - - if (UDD_CLOCK_SOURCE == SYSTEM_CLOCK_SOURCE_DPLL) { -#if (SAML21) || (SAML22) || (SAMR30) - #define DPLL_READY_FLAG (OSCCTRL_DPLLSTATUS_CLKRDY | OSCCTRL_DPLLSTATUS_LOCK) - - while((OSCCTRL->DPLLSTATUS.reg & DPLL_READY_FLAG) != DPLL_READY_FLAG); - } -#else -#define DPLL_READY_FLAG (SYSCTRL_DPLLSTATUS_ENABLE | \ - SYSCTRL_DPLLSTATUS_CLKRDY | SYSCTRL_DPLLSTATUS_LOCK) - - while((SYSCTRL->DPLLSTATUS.reg & DPLL_READY_FLAG) != DPLL_READY_FLAG); - } -#endif - - if (UDD_CLOCK_SOURCE == SYSTEM_CLOCK_SOURCE_DFLL) { -#if (SAML21) || (SAML22) || (SAMR30) -#define DFLL_READY_FLAG (OSCCTRL_STATUS_DFLLRDY | \ - OSCCTRL_STATUS_DFLLLCKF | OSCCTRL_STATUS_DFLLLCKC) - - /* In USB recovery mode the status is not checked */ - if (!(OSCCTRL->DFLLCTRL.reg & OSCCTRL_DFLLCTRL_USBCRM)) { - while((OSCCTRL->STATUS.reg & DFLL_READY_FLAG) != DFLL_READY_FLAG); - } else { - while((OSCCTRL->STATUS.reg & OSCCTRL_STATUS_DFLLRDY) != OSCCTRL_STATUS_DFLLRDY); - } - } -#else -#define DFLL_READY_FLAG (SYSCTRL_PCLKSR_DFLLRDY | \ - SYSCTRL_PCLKSR_DFLLLCKF | SYSCTRL_PCLKSR_DFLLLCKC) - - /* In USB recovery mode the status is not checked */ - if (!(SYSCTRL->DFLLCTRL.reg & SYSCTRL_DFLLCTRL_USBCRM)) { - while((SYSCTRL->PCLKSR.reg & DFLL_READY_FLAG) != DFLL_READY_FLAG); - } else { - while((SYSCTRL->PCLKSR.reg & SYSCTRL_PCLKSR_DFLLRDY) != SYSCTRL_PCLKSR_DFLLRDY); - } - } -#endif -} -/** @} */ - -/** - * \name Power management - * - * @{ - */ -#ifndef UDD_NO_SLEEP_MGR - -#include "sleepmgr.h" -/** States of USB interface */ -enum udd_usb_state_enum { - UDD_STATE_OFF, - UDD_STATE_SUSPEND, - UDD_STATE_SUSPEND_LPM, - UDD_STATE_IDLE, -}; - -/** \brief Manages the sleep mode following the USB state - * - * \param new_state New USB state - */ -static void udd_sleep_mode(enum udd_usb_state_enum new_state) -{ - enum sleepmgr_mode sleep_mode[] = { - SLEEPMGR_ACTIVE, /* UDD_STATE_OFF (not used) */ - #if (SAML21) || (SAML22) || (SAMR30) - SLEEPMGR_IDLE, /* UDD_STATE_SUSPEND */ - SLEEPMGR_IDLE, /* UDD_STATE_SUSPEND_LPM */ - SLEEPMGR_IDLE, /* UDD_STATE_IDLE */ - #else - SLEEPMGR_IDLE_2, /* UDD_STATE_SUSPEND */ - SLEEPMGR_IDLE_1, /* UDD_STATE_SUSPEND_LPM */ - SLEEPMGR_IDLE_0, /* UDD_STATE_IDLE */ - #endif - }; - - static enum udd_usb_state_enum udd_state = UDD_STATE_OFF; - - if (udd_state == new_state) { - return; // No change - } - if (new_state != UDD_STATE_OFF) { - /* Lock new limit */ - sleepmgr_lock_mode(sleep_mode[new_state]); - } - if (udd_state != UDD_STATE_OFF) { - /* Unlock old limit */ - sleepmgr_unlock_mode(sleep_mode[udd_state]); - } - udd_state = new_state; -} - -#else -# define udd_sleep_mode(arg) -#endif -/** @} */ - -/** - * \name Control endpoint low level management routine. - * - * This function performs control endpoint management. - * It handles the SETUP/DATA/HANDSHAKE phases of a control transaction. - * - * @{ - */ - -/** - * \brief Buffer to store the data received on control endpoint (SETUP/OUT endpoint 0) - * - * Used to avoid a RAM buffer overflow in case of the payload buffer - * is smaller than control endpoint size - */ -UDC_BSS(4) -uint8_t udd_ctrl_buffer[USB_DEVICE_EP_CTRL_SIZE]; - -/** Bit definitions about endpoint control state machine for udd_ep_control_state */ -typedef enum { - UDD_EPCTRL_SETUP = 0, //!< Wait a SETUP packet - UDD_EPCTRL_DATA_OUT = 1, //!< Wait a OUT data packet - UDD_EPCTRL_DATA_IN = 2, //!< Wait a IN data packet - UDD_EPCTRL_HANDSHAKE_WAIT_IN_ZLP = 3, //!< Wait a IN ZLP packet - UDD_EPCTRL_HANDSHAKE_WAIT_OUT_ZLP = 4, //!< Wait a OUT ZLP packet - UDD_EPCTRL_STALL_REQ = 5, //!< STALL enabled on IN & OUT packet -} udd_ctrl_ep_state_t; - -/** Global variable to give and record information of the set up request management */ -udd_ctrl_request_t udd_g_ctrlreq; - -/** State of the endpoint control management */ -static udd_ctrl_ep_state_t udd_ep_control_state; - -/** Total number of data received/sent during data packet phase with previous payload buffers */ -static uint16_t udd_ctrl_prev_payload_nb_trans; - -/** Number of data received/sent to/from udd_g_ctrlreq.payload buffer */ -static uint16_t udd_ctrl_payload_nb_trans; - -/** @} */ - -/** - * \name Management of bulk/interrupt/isochronous endpoints - * - * The UDD manages the data transfer on endpoints: - * - Start data transfer on endpoint with USB Device DMA - * - Send a ZLP packet if requested - * - Call callback registered to signal end of transfer - * The transfer abort and stall feature are supported. - * - * @{ - */ - -/** - * \brief Buffer to store the data received on bulk/interrupt endpoints - * - * Used to avoid a RAM buffer overflow in case of the user buffer - * is smaller than endpoint size - * - * \warning The protected interrupt endpoint size is 512 bytes maximum. - * \warning The isochronous and endpoint is not protected by this system and - * the user must always use a buffer corresponding at endpoint size. - */ -#if (defined USB_DEVICE_LOW_SPEED) -UDC_BSS(4) uint8_t udd_ep_out_cache_buffer[USB_DEVICE_MAX_EP][8]; -#elif (defined USB_DEVICE_HS_SUPPORT) -UDC_BSS(4) uint8_t udd_ep_out_cache_buffer[USB_DEVICE_MAX_EP][512]; -#else -UDC_BSS(4) uint8_t udd_ep_out_cache_buffer[USB_DEVICE_MAX_EP][64]; -#endif - -/** Structure definition about job registered on an endpoint */ -typedef struct { - union { - //! Callback to call at the end of transfer - udd_callback_trans_t call_trans; - //! Callback to call when the endpoint halt is cleared - udd_callback_halt_cleared_t call_nohalt; - }; - //! Buffer located in internal RAM to send or fill during job - uint8_t *buf; - //! Size of buffer to send or fill - iram_size_t buf_size; - //! Total number of data transferred on endpoint - iram_size_t nb_trans; - //! Endpoint size - uint16_t ep_size; - //! A job is registered on this endpoint - uint8_t busy:1; - //! A short packet is requested for this job on endpoint IN - uint8_t b_shortpacket:1; - //! The cache buffer is currently used on endpoint OUT - uint8_t b_use_out_cache_buffer:1; -} udd_ep_job_t; - -/** Array to register a job on bulk/interrupt/isochronous endpoint */ -static udd_ep_job_t udd_ep_job[2 * USB_DEVICE_MAX_EP]; - -/** @} */ - -/** - * \brief Get the detailed job by endpoint number - * \param[in] ep Endpoint Address - * \retval pointer to an udd_ep_job_t structure instance - */ -static udd_ep_job_t* udd_ep_get_job(udd_ep_id_t ep) -{ - return &udd_ep_job[(2 * (ep & USB_EP_ADDR_MASK) + ((ep & USB_EP_DIR_IN) ? 1 : 0)) - 2]; -} - -/** - * \brief Endpoint IN process, continue to send packets or zero length packet - * \param[in] pointer Pointer to the endpoint transfer status parameter struct from driver layer. - */ -static void udd_ep_trans_in_next(void* pointer) -{ - struct usb_endpoint_callback_parameter *ep_callback_para = (struct usb_endpoint_callback_parameter*)pointer; - udd_ep_id_t ep = ep_callback_para->endpoint_address; - uint16_t ep_size, nb_trans; - uint16_t next_trans; - udd_ep_id_t ep_num; - udd_ep_job_t *ptr_job; - - ptr_job = udd_ep_get_job(ep); - ep_num = ep & USB_EP_ADDR_MASK; - - ep_size = ptr_job->ep_size; - /* Update number of data transferred */ - nb_trans = ep_callback_para->sent_bytes; - ptr_job->nb_trans += nb_trans; - - /* Need to send other data */ - if (ptr_job->nb_trans != ptr_job->buf_size) { - next_trans = ptr_job->buf_size - ptr_job->nb_trans; - if (UDD_ENDPOINT_MAX_TRANS < next_trans) { - /* The USB hardware support a maximum - * transfer size of UDD_ENDPOINT_MAX_TRANS Bytes */ - next_trans = UDD_ENDPOINT_MAX_TRANS -(UDD_ENDPOINT_MAX_TRANS % ep_size); - } - /* Need ZLP, if requested and last packet is not a short packet */ - ptr_job->b_shortpacket = ptr_job->b_shortpacket && (0 == (next_trans % ep_size)); - usb_device_endpoint_write_buffer_job(&usb_device,ep_num,&ptr_job->buf[ptr_job->nb_trans],next_trans); - return; - } - - /* Need to send a ZLP after all data transfer */ - if (ptr_job->b_shortpacket) { - ptr_job->b_shortpacket = false; - /* Start new transfer */ - usb_device_endpoint_write_buffer_job(&usb_device,ep_num,&ptr_job->buf[ptr_job->nb_trans],0); - return; - } - - /* Job complete then call callback */ - ptr_job->busy = false; - if (NULL != ptr_job->call_trans) { - ptr_job->call_trans(UDD_EP_TRANSFER_OK, ptr_job->nb_trans, ep); - } -} - -/** - * \brief Endpoint OUT process, continue to receive packets or zero length packet - * \param[in] pointer Pointer to the endpoint transfer status parameter struct from driver layer. - */ -static void udd_ep_trans_out_next(void* pointer) -{ - struct usb_endpoint_callback_parameter *ep_callback_para = (struct usb_endpoint_callback_parameter*)pointer; - udd_ep_id_t ep = ep_callback_para->endpoint_address; - uint16_t ep_size, nb_trans; - uint16_t next_trans; - udd_ep_id_t ep_num; - udd_ep_job_t *ptr_job; - - ptr_job = udd_ep_get_job(ep); - ep_num = ep & USB_EP_ADDR_MASK; - - ep_size = ptr_job->ep_size; - /* Update number of data transferred */ - nb_trans = ep_callback_para->received_bytes; - - /* Can be necessary to copy data receive from cache buffer to user buffer */ - if (ptr_job->b_use_out_cache_buffer) { - memcpy(&ptr_job->buf[ptr_job->nb_trans], udd_ep_out_cache_buffer[ep_num - 1], ptr_job->buf_size % ep_size); - } - - /* Update number of data transferred */ - ptr_job->nb_trans += nb_trans; - if (ptr_job->nb_trans > ptr_job->buf_size) { - ptr_job->nb_trans = ptr_job->buf_size; - } - - /* If all previous data requested are received and user buffer not full - * then need to receive other data */ - if ((nb_trans == ep_callback_para->out_buffer_size) && (ptr_job->nb_trans != ptr_job->buf_size)) { - next_trans = ptr_job->buf_size - ptr_job->nb_trans; - if (UDD_ENDPOINT_MAX_TRANS < next_trans) { - /* The USB hardware support a maximum transfer size - * of UDD_ENDPOINT_MAX_TRANS Bytes */ - next_trans = UDD_ENDPOINT_MAX_TRANS - (UDD_ENDPOINT_MAX_TRANS % ep_size); - } else { - next_trans -= next_trans % ep_size; - } - - if (next_trans < ep_size) { - /* Use the cache buffer for Bulk or Interrupt size endpoint */ - ptr_job->b_use_out_cache_buffer = true; - usb_device_endpoint_read_buffer_job(&usb_device,ep_num,udd_ep_out_cache_buffer[ep_num - 1],ep_size); - } else { - usb_device_endpoint_read_buffer_job(&usb_device,ep_num,&ptr_job->buf[ptr_job->nb_trans],next_trans); - } - return; - } - - /* Job complete then call callback */ - ptr_job->busy = false; - if (NULL != ptr_job->call_trans) { - ptr_job->call_trans(UDD_EP_TRANSFER_OK, ptr_job->nb_trans, ep); - } -} - -/** - * \brief Endpoint Transfer Complete callback function, to do the next transfer depends on the direction(IN or OUT) - * \param[in] module_inst Pointer to USB module instance - * \param[in] pointer Pointer to the endpoint transfer status parameter struct from driver layer. - */ -static void udd_ep_transfer_process(struct usb_module *module_inst, void* pointer) -{ - struct usb_endpoint_callback_parameter *ep_callback_para = (struct usb_endpoint_callback_parameter*)pointer; - udd_ep_id_t ep = ep_callback_para->endpoint_address; - - if (ep & USB_EP_DIR_IN) { - udd_ep_trans_in_next(pointer); - } else { - udd_ep_trans_out_next(pointer); - } -} - -void udd_ep_abort(udd_ep_id_t ep) -{ - udd_ep_job_t *ptr_job; - - usb_device_endpoint_abort_job(&usb_device, ep); - - /* Job complete then call callback */ - ptr_job = udd_ep_get_job(ep); - if (!ptr_job->busy) { - return; - } - ptr_job->busy = false; - if (NULL != ptr_job->call_trans) { - /* It can be a Transfer or stall callback */ - ptr_job->call_trans(UDD_EP_TRANSFER_ABORT, ptr_job->nb_trans, ep); - } -} - -bool udd_is_high_speed(void) -{ -#if SAMD21 || SAMR21 || SAMD11 || SAML21 || SAML22 || SAMDA1 || SAMR30 - return false; -#endif -} - -uint16_t udd_get_frame_number(void) -{ - return usb_device_get_frame_number(&usb_device); -} - -uint16_t udd_get_micro_frame_number(void) -{ - return usb_device_get_micro_frame_number(&usb_device); -} - -void udd_ep_free(udd_ep_id_t ep) -{ - struct usb_device_endpoint_config config_ep; - usb_device_endpoint_get_config_defaults(&config_ep); - - uint8_t ep_num = ep & USB_EP_ADDR_MASK; - udd_ep_abort(ep); - - config_ep.ep_address = ep; - config_ep.ep_type = USB_DEVICE_ENDPOINT_TYPE_DISABLE; - usb_device_endpoint_set_config(&usb_device, &config_ep); - usb_device_endpoint_unregister_callback(&usb_device,ep_num,USB_DEVICE_ENDPOINT_CALLBACK_TRCPT); - usb_device_endpoint_disable_callback(&usb_device,ep,USB_DEVICE_ENDPOINT_CALLBACK_TRCPT); -} - -bool udd_ep_alloc(udd_ep_id_t ep, uint8_t bmAttributes, uint16_t MaxEndpointSize) -{ - struct usb_device_endpoint_config config_ep; - usb_device_endpoint_get_config_defaults(&config_ep); - - config_ep.ep_address = ep; - - if(MaxEndpointSize <= 8) { - config_ep.ep_size = USB_ENDPOINT_8_BYTE; - } else if(MaxEndpointSize <= 16) { - config_ep.ep_size = USB_ENDPOINT_16_BYTE; - } else if(MaxEndpointSize <= 32) { - config_ep.ep_size = USB_ENDPOINT_32_BYTE; - } else if(MaxEndpointSize <= 64) { - config_ep.ep_size = USB_ENDPOINT_64_BYTE; - } else if(MaxEndpointSize <= 128) { - config_ep.ep_size = USB_ENDPOINT_128_BYTE; - } else if(MaxEndpointSize <= 256) { - config_ep.ep_size = USB_ENDPOINT_256_BYTE; - } else if(MaxEndpointSize <= 512) { - config_ep.ep_size = USB_ENDPOINT_512_BYTE; - } else if(MaxEndpointSize <= 1023) { - config_ep.ep_size = USB_ENDPOINT_1023_BYTE; - } else { - return false; - } - udd_ep_job_t *ptr_job = udd_ep_get_job(ep); - ptr_job->ep_size = MaxEndpointSize; - - bmAttributes = bmAttributes & USB_EP_TYPE_MASK; - - /* Check endpoint type */ - if(USB_EP_TYPE_ISOCHRONOUS == bmAttributes) { - config_ep.ep_type = USB_DEVICE_ENDPOINT_TYPE_ISOCHRONOUS; - } else if (USB_EP_TYPE_BULK == bmAttributes) { - config_ep.ep_type = USB_DEVICE_ENDPOINT_TYPE_BULK; - } else if (USB_EP_TYPE_INTERRUPT == bmAttributes) { - config_ep.ep_type = USB_DEVICE_ENDPOINT_TYPE_INTERRUPT; - } else { - return false; - } - - uint8_t ep_num = ep & USB_EP_ADDR_MASK; - - if (STATUS_OK != usb_device_endpoint_set_config(&usb_device, &config_ep)) { - return false; - } - usb_device_endpoint_register_callback(&usb_device,ep_num,USB_DEVICE_ENDPOINT_CALLBACK_TRCPT,udd_ep_transfer_process); - usb_device_endpoint_enable_callback(&usb_device,ep,USB_DEVICE_ENDPOINT_CALLBACK_TRCPT); - usb_device_endpoint_enable_callback(&usb_device,ep,USB_DEVICE_ENDPOINT_CALLBACK_TRFAIL); - - return true; -} - -bool udd_ep_is_halted(udd_ep_id_t ep) -{ - return usb_device_endpoint_is_halted(&usb_device, ep); -} - -bool udd_ep_set_halt(udd_ep_id_t ep) -{ - uint8_t ep_num = ep & USB_EP_ADDR_MASK; - - if (USB_DEVICE_MAX_EP < ep_num) { - return false; - } - - usb_device_endpoint_set_halt(&usb_device, ep); - - udd_ep_abort(ep); - return true; -} - -bool udd_ep_clear_halt(udd_ep_id_t ep) -{ - udd_ep_job_t *ptr_job; - uint8_t ep_num = ep & USB_EP_ADDR_MASK; - - if (USB_DEVICE_MAX_EP < ep_num) { - return false; - } - ptr_job = udd_ep_get_job(ep); - - usb_device_endpoint_clear_halt(&usb_device, ep); - - /* If a job is register on clear halt action then execute callback */ - if (ptr_job->busy == true) { - ptr_job->busy = false; - ptr_job->call_nohalt(); - } - - return true; -} - -bool udd_ep_wait_stall_clear(udd_ep_id_t ep, udd_callback_halt_cleared_t callback) -{ - udd_ep_id_t ep_num; - udd_ep_job_t *ptr_job; - - ep_num = ep & USB_EP_ADDR_MASK; - if (USB_DEVICE_MAX_EP < ep_num) { - return false; - } - - ptr_job = udd_ep_get_job(ep); - if (ptr_job->busy == true) { - return false; /* Job already on going */ - } - - /* Wait clear halt endpoint */ - if (usb_device_endpoint_is_halted(&usb_device, ep)) { - /* Endpoint halted then registers the callback */ - ptr_job->busy = true; - ptr_job->call_nohalt = callback; - return true; - } else if (usb_device_endpoint_is_configured(&usb_device, ep)) { - callback(); /* Endpoint not halted then call directly callback */ - return true; - } else { - return false; - } -} - -/** - * \brief Control Endpoint stall sending data - */ -static void udd_ctrl_stall_data(void) -{ - udd_ep_control_state = UDD_EPCTRL_STALL_REQ; - - usb_device_endpoint_set_halt(&usb_device, USB_EP_DIR_IN); - usb_device_endpoint_clear_halt(&usb_device, USB_EP_DIR_OUT); -} - -bool udd_ep_run(udd_ep_id_t ep, bool b_shortpacket, uint8_t * buf, iram_size_t buf_size, udd_callback_trans_t callback) -{ - udd_ep_id_t ep_num; - udd_ep_job_t *ptr_job; - irqflags_t flags; - - ep_num = ep & USB_EP_ADDR_MASK; - - if ((USB_DEVICE_MAX_EP < ep_num) || (udd_ep_is_halted(ep))) { - return false; - } - - ptr_job = udd_ep_get_job(ep); - - flags = cpu_irq_save(); - if (ptr_job->busy == true) { - cpu_irq_restore(flags); - return false; /* Job already on going */ - } - ptr_job->busy = true; - cpu_irq_restore(flags); - - /* No job running, set up a new one */ - ptr_job->buf = buf; - ptr_job->buf_size = buf_size; - ptr_job->nb_trans = 0; - ptr_job->call_trans = callback; - ptr_job->b_shortpacket = b_shortpacket; - ptr_job->b_use_out_cache_buffer = false; - - /* Initialize value to simulate a empty transfer */ - uint16_t next_trans; - - if (ep & USB_EP_DIR_IN) { - if (0 != ptr_job->buf_size) { - next_trans = ptr_job->buf_size; - if (UDD_ENDPOINT_MAX_TRANS < next_trans) { - next_trans = UDD_ENDPOINT_MAX_TRANS - - (UDD_ENDPOINT_MAX_TRANS % ptr_job->ep_size); - } - ptr_job->b_shortpacket = ptr_job->b_shortpacket && - (0 == (next_trans % ptr_job->ep_size)); - } else if (true == ptr_job->b_shortpacket) { - ptr_job->b_shortpacket = false; /* avoid to send zero length packet again */ - next_trans = 0; - } else { - ptr_job->busy = false; - if (NULL != ptr_job->call_trans) { - ptr_job->call_trans(UDD_EP_TRANSFER_OK, 0, ep); - } - return true; - } - return (STATUS_OK == - usb_device_endpoint_write_buffer_job(&usb_device, - ep_num,&ptr_job->buf[0],next_trans)); - } else { - if (0 != ptr_job->buf_size) { - next_trans = ptr_job->buf_size; - if (UDD_ENDPOINT_MAX_TRANS < next_trans) { - /* The USB hardware support a maximum transfer size - * of UDD_ENDPOINT_MAX_TRANS Bytes */ - next_trans = UDD_ENDPOINT_MAX_TRANS - - (UDD_ENDPOINT_MAX_TRANS % ptr_job->ep_size); - } else { - next_trans -= next_trans % ptr_job->ep_size; - } - if (next_trans < ptr_job->ep_size) { - ptr_job->b_use_out_cache_buffer = true; - return (STATUS_OK == - usb_device_endpoint_read_buffer_job(&usb_device, ep_num, - udd_ep_out_cache_buffer[ep_num - 1], - ptr_job->ep_size)); - } else { - return (STATUS_OK == - usb_device_endpoint_read_buffer_job(&usb_device, ep_num, - &ptr_job->buf[0],next_trans)); - } - } else { - ptr_job->busy = false; - if (NULL != ptr_job->call_trans) { - ptr_job->call_trans(UDD_EP_TRANSFER_OK, 0, ep); - } - return true; - } - } -} - -void udd_set_address(uint8_t address) -{ - usb_device_set_address(&usb_device,address); -} - -uint8_t udd_getaddress(void) -{ - return usb_device_get_address(&usb_device); -} - -void udd_send_remotewakeup(void) -{ - uint32_t try = 5; - udd_wait_clock_ready(); - udd_sleep_mode(UDD_STATE_IDLE); - while(2 != usb_get_state_machine_status(&usb_device) && try --) { - usb_device_send_remote_wake_up(&usb_device); - } -} - -void udd_set_setup_payload( uint8_t *payload, uint16_t payload_size ) -{ - udd_g_ctrlreq.payload = payload; - udd_g_ctrlreq.payload_size = payload_size; -} - -/** - * \brief Control Endpoint translate the data in buffer into Device Request Struct - */ -static void udd_ctrl_fetch_ram(void) -{ - udd_g_ctrlreq.req.bmRequestType = udd_ctrl_buffer[0]; - udd_g_ctrlreq.req.bRequest = udd_ctrl_buffer[1]; - udd_g_ctrlreq.req.wValue = ((uint16_t)(udd_ctrl_buffer[3]) << 8) + udd_ctrl_buffer[2]; - udd_g_ctrlreq.req.wIndex = ((uint16_t)(udd_ctrl_buffer[5]) << 8) + udd_ctrl_buffer[4]; - udd_g_ctrlreq.req.wLength = ((uint16_t)(udd_ctrl_buffer[7]) << 8) + udd_ctrl_buffer[6]; -} - -/** - * \brief Control Endpoint send out zero length packet - */ -static void udd_ctrl_send_zlp_in(void) -{ - udd_ep_control_state = UDD_EPCTRL_HANDSHAKE_WAIT_IN_ZLP; - usb_device_endpoint_setup_buffer_job(&usb_device,udd_ctrl_buffer); - usb_device_endpoint_write_buffer_job(&usb_device,0,udd_g_ctrlreq.payload,0); -} - -/** - * \brief Process control endpoint IN transaction - */ -static void udd_ctrl_in_sent(void) -{ - static bool b_shortpacket = false; - uint16_t nb_remain; - - nb_remain = udd_g_ctrlreq.payload_size - udd_ctrl_payload_nb_trans; - - if (0 == nb_remain) { - /* All content of current buffer payload are sent Update number of total data sending by previous payload buffer */ - udd_ctrl_prev_payload_nb_trans += udd_ctrl_payload_nb_trans; - if ((udd_g_ctrlreq.req.wLength == udd_ctrl_prev_payload_nb_trans) || b_shortpacket) { - /* All data requested are transferred or a short packet has been sent, then it is the end of data phase. - * Generate an OUT ZLP for handshake phase */ - udd_ep_control_state = UDD_EPCTRL_HANDSHAKE_WAIT_OUT_ZLP; - usb_device_endpoint_setup_buffer_job(&usb_device,udd_ctrl_buffer); - return; - } - /* Need of new buffer because the data phase is not complete */ - if ((!udd_g_ctrlreq.over_under_run) || (!udd_g_ctrlreq.over_under_run())) { - /* Under run then send zlp on IN - * Here nb_remain=0, this allows to send a IN ZLP */ - } else { - /* A new payload buffer is given */ - udd_ctrl_payload_nb_trans = 0; - nb_remain = udd_g_ctrlreq.payload_size; - } - } - - /* Continue transfer and send next data */ - if (nb_remain >= USB_DEVICE_EP_CTRL_SIZE) { - nb_remain = USB_DEVICE_EP_CTRL_SIZE; - b_shortpacket = false; - } else { - b_shortpacket = true; - } - - /* Link payload buffer directly on USB hardware */ - usb_device_endpoint_write_buffer_job(&usb_device,0,udd_g_ctrlreq.payload + udd_ctrl_payload_nb_trans,nb_remain); - - udd_ctrl_payload_nb_trans += nb_remain; -} - -/** - * \brief Process control endpoint OUT transaction - * \param[in] pointer Pointer to the endpoint transfer status parameter struct from driver layer. - */ -static void udd_ctrl_out_received(void* pointer) -{ - struct usb_endpoint_callback_parameter *ep_callback_para = (struct usb_endpoint_callback_parameter*)pointer; - - uint16_t nb_data; - nb_data = ep_callback_para->received_bytes; /* Read data received during OUT phase */ - - if (udd_g_ctrlreq.payload_size < (udd_ctrl_payload_nb_trans + nb_data)) { - /* Payload buffer too small */ - nb_data = udd_g_ctrlreq.payload_size - udd_ctrl_payload_nb_trans; - } - - memcpy((uint8_t *) (udd_g_ctrlreq.payload + udd_ctrl_payload_nb_trans), udd_ctrl_buffer, nb_data); - udd_ctrl_payload_nb_trans += nb_data; - - if ((USB_DEVICE_EP_CTRL_SIZE != nb_data) || \ - (udd_g_ctrlreq.req.wLength <= (udd_ctrl_prev_payload_nb_trans + udd_ctrl_payload_nb_trans))) { - /* End of reception because it is a short packet - * or all data are transferred */ - - /* Before send ZLP, call intermediate callback - * in case of data receive generate a stall */ - udd_g_ctrlreq.payload_size = udd_ctrl_payload_nb_trans; - if (NULL != udd_g_ctrlreq.over_under_run) { - if (!udd_g_ctrlreq.over_under_run()) { - /* Stall ZLP */ - udd_ep_control_state = UDD_EPCTRL_STALL_REQ; - /* Stall all packets on IN & OUT control endpoint */ - udd_ep_set_halt(0); - /* Ack reception of OUT to replace NAK by a STALL */ - return; - } - } - /* Send IN ZLP to ACK setup request */ - udd_ctrl_send_zlp_in(); - return; - } - - if (udd_g_ctrlreq.payload_size == udd_ctrl_payload_nb_trans) { - /* Overrun then request a new payload buffer */ - if (!udd_g_ctrlreq.over_under_run) { - /* No callback available to request a new payload buffer - * Stall ZLP */ - udd_ep_control_state = UDD_EPCTRL_STALL_REQ; - /* Stall all packets on IN & OUT control endpoint */ - udd_ep_set_halt(0); - return; - } - if (!udd_g_ctrlreq.over_under_run()) { - /* No new payload buffer delivered - * Stall ZLP */ - udd_ep_control_state = UDD_EPCTRL_STALL_REQ; - /* Stall all packets on IN & OUT control endpoint */ - udd_ep_set_halt(0); - return; - } - /* New payload buffer available - * Update number of total data received */ - udd_ctrl_prev_payload_nb_trans += udd_ctrl_payload_nb_trans; - - /* Reinitialize reception on payload buffer */ - udd_ctrl_payload_nb_trans = 0; - } - usb_device_endpoint_read_buffer_job(&usb_device,0,udd_ctrl_buffer,USB_DEVICE_EP_CTRL_SIZE); -} - -/** - * \internal - * \brief Endpoint 0 (control) SETUP received callback - * \param[in] module_inst pointer to USB module instance - * \param[in] pointer Pointer to the endpoint transfer status parameter struct from driver layer. - */ -static void _usb_ep0_on_setup(struct usb_module *module_inst, void* pointer) -{ - struct usb_endpoint_callback_parameter *ep_callback_para = (struct usb_endpoint_callback_parameter*)pointer; - - if (UDD_EPCTRL_SETUP != udd_ep_control_state) { - if (NULL != udd_g_ctrlreq.callback) { - udd_g_ctrlreq.callback(); - } - udd_ep_control_state = UDD_EPCTRL_SETUP; - } - if ( 8 != ep_callback_para->received_bytes) { - udd_ctrl_stall_data(); - return; - } else { - udd_ctrl_fetch_ram(); - if (false == udc_process_setup()) { - udd_ctrl_stall_data(); - return; - } else if (Udd_setup_is_in()) { - udd_ctrl_prev_payload_nb_trans = 0; - udd_ctrl_payload_nb_trans = 0; - udd_ep_control_state = UDD_EPCTRL_DATA_IN; - usb_device_endpoint_read_buffer_job(&usb_device,0,udd_ctrl_buffer,USB_DEVICE_EP_CTRL_SIZE); - udd_ctrl_in_sent(); - } else { - if(0 == udd_g_ctrlreq.req.wLength) { - udd_ctrl_send_zlp_in(); - return; - } else { - udd_ctrl_prev_payload_nb_trans = 0; - udd_ctrl_payload_nb_trans = 0; - udd_ep_control_state = UDD_EPCTRL_DATA_OUT; - /* Initialize buffer size and enable OUT bank */ - usb_device_endpoint_read_buffer_job(&usb_device,0,udd_ctrl_buffer,USB_DEVICE_EP_CTRL_SIZE); - } - } - } -} - -/** - * \brief Control Endpoint Process when underflow condition has occurred - * \param[in] pointer Pointer to the endpoint transfer status parameter struct from driver layer. - */ -static void udd_ctrl_underflow(void* pointer) -{ - struct usb_endpoint_callback_parameter *ep_callback_para = (struct usb_endpoint_callback_parameter*)pointer; - - if (UDD_EPCTRL_DATA_OUT == udd_ep_control_state) { - /* Host want to stop OUT transaction - * then stop to wait OUT data phase and wait IN ZLP handshake */ - udd_ctrl_send_zlp_in(); - } else if (UDD_EPCTRL_HANDSHAKE_WAIT_OUT_ZLP == udd_ep_control_state) { - /* A OUT handshake is waiting by device, - * but host want extra IN data then stall extra IN data */ - usb_device_endpoint_set_halt(&usb_device, ep_callback_para->endpoint_address); - } -} - -/** - * \brief Control Endpoint Process when overflow condition has occurred - * \param[in] pointer Pointer to the endpoint transfer status parameter struct from driver layer. - */ -static void udd_ctrl_overflow(void* pointer) -{ - struct usb_endpoint_callback_parameter *ep_callback_para = (struct usb_endpoint_callback_parameter*)pointer; - - if (UDD_EPCTRL_DATA_IN == udd_ep_control_state) { - /* Host want to stop IN transaction - * then stop to wait IN data phase and wait OUT ZLP handshake */ - udd_ep_control_state = UDD_EPCTRL_HANDSHAKE_WAIT_OUT_ZLP; - } else if (UDD_EPCTRL_HANDSHAKE_WAIT_IN_ZLP == udd_ep_control_state) { - /* A IN handshake is waiting by device, - * but host want extra OUT data then stall extra OUT data and following status stage */ - usb_device_endpoint_set_halt(&usb_device, ep_callback_para->endpoint_address); - } -} - -/** - * \internal - * \brief Control endpoint transfer fail callback function - * \param[in] module_inst Pointer to USB module instance - * \param[in] pointer Pointer to the endpoint transfer status parameter struct from driver layer. - */ -static void _usb_ep0_on_tansfer_fail(struct usb_module *module_inst, void* pointer) -{ - struct usb_endpoint_callback_parameter *ep_callback_para = (struct usb_endpoint_callback_parameter*)pointer; - - if(ep_callback_para->endpoint_address & USB_EP_DIR_IN) { - udd_ctrl_underflow(pointer); - } else { - udd_ctrl_overflow(pointer); - } -} - -/** - * \internal - * \brief Control endpoint transfer complete callback function - * \param[in] module_inst Pointer to USB module instance - * \param[in] pointer Pointer to the endpoint transfer status parameter struct from driver layer. - */ -static void _usb_ep0_on_tansfer_ok(struct usb_module *module_inst, void * pointer) -{ - if (UDD_EPCTRL_DATA_OUT == udd_ep_control_state) { /* handshake Out for status stage */ - udd_ctrl_out_received(pointer); - } else if (UDD_EPCTRL_DATA_IN == udd_ep_control_state) { /* handshake In for status stage */ - udd_ctrl_in_sent(); - } else { - if (NULL != udd_g_ctrlreq.callback) { - udd_g_ctrlreq.callback(); - } - udd_ep_control_state = UDD_EPCTRL_SETUP; - } -} - -/** - * \brief Enable Control Endpoint - * \param[in] module_inst Pointer to USB module instance - */ -static void udd_ctrl_ep_enable(struct usb_module *module_inst) -{ - /* USB Device Endpoint0 Configuration */ - struct usb_device_endpoint_config config_ep0; - - usb_device_endpoint_get_config_defaults(&config_ep0); - config_ep0.ep_size = (enum usb_endpoint_size)(32 - clz(((uint32_t)Min(Max(USB_DEVICE_EP_CTRL_SIZE, 8), 1024) << 1) - 1) - 1 - 3); - usb_device_endpoint_set_config(module_inst,&config_ep0); - - usb_device_endpoint_setup_buffer_job(module_inst,udd_ctrl_buffer); - - usb_device_endpoint_register_callback(module_inst,0,USB_DEVICE_ENDPOINT_CALLBACK_RXSTP, _usb_ep0_on_setup ); - usb_device_endpoint_register_callback(module_inst,0,USB_DEVICE_ENDPOINT_CALLBACK_TRCPT,_usb_ep0_on_tansfer_ok ); - usb_device_endpoint_register_callback(module_inst,0,USB_DEVICE_ENDPOINT_CALLBACK_TRFAIL,_usb_ep0_on_tansfer_fail ); - usb_device_endpoint_enable_callback(module_inst,0,USB_DEVICE_ENDPOINT_CALLBACK_RXSTP); - usb_device_endpoint_enable_callback(module_inst,0,USB_DEVICE_ENDPOINT_CALLBACK_TRCPT); - usb_device_endpoint_enable_callback(module_inst,0,USB_DEVICE_ENDPOINT_CALLBACK_TRFAIL); - -#ifdef USB_DEVICE_LPM_SUPPORT - // Enable LPM feature - usb_device_set_lpm_mode(module_inst, USB_DEVICE_LPM_ACK); -#endif - - udd_ep_control_state = UDD_EPCTRL_SETUP; -} - -/** - * \internal - * \brief Control endpoint Suspend callback function - * \param[in] module_inst Pointer to USB module instance - * \param[in] pointer Pointer to the callback parameter from driver layer. - */ -static void _usb_on_suspend(struct usb_module *module_inst, void *pointer) -{ - usb_device_disable_callback(&usb_device, USB_DEVICE_CALLBACK_SUSPEND); - usb_device_enable_callback(&usb_device, USB_DEVICE_CALLBACK_WAKEUP); - udd_sleep_mode(UDD_STATE_SUSPEND); -#ifdef UDC_SUSPEND_EVENT - UDC_SUSPEND_EVENT(); -#endif -} - -#ifdef USB_DEVICE_LPM_SUPPORT -static void _usb_device_lpm_suspend(struct usb_module *module_inst, void *pointer) -{ - dbg_print("LPM_SUSP\n"); - - uint32_t *lpm_wakeup_enable; - lpm_wakeup_enable = (uint32_t *)pointer; - - usb_device_disable_callback(&usb_device, USB_DEVICE_CALLBACK_LPMSUSP); - usb_device_disable_callback(&usb_device, USB_DEVICE_CALLBACK_SUSPEND); - usb_device_enable_callback(&usb_device, USB_DEVICE_CALLBACK_WAKEUP); - -//#warning Here the sleep mode must be choose to have a DFLL startup time < bmAttribut.HIRD - udd_sleep_mode(UDD_STATE_SUSPEND_LPM); // Enter in LPM SUSPEND mode - if ((*lpm_wakeup_enable)) { - UDC_REMOTEWAKEUP_LPM_ENABLE(); - } - if (!(*lpm_wakeup_enable)) { - UDC_REMOTEWAKEUP_LPM_DISABLE(); - } - UDC_SUSPEND_LPM_EVENT(); -} -#endif - -/** - * \internal - * \brief Control endpoint SOF callback function - * \param[in] module_inst Pointer to USB module instance - * \param[in] pointer Pointer to the callback parameter from driver layer. - */ -static void _usb_on_sof_notify(struct usb_module *module_inst, void *pointer) -{ - udc_sof_notify(); -#ifdef UDC_SOF_EVENT - UDC_SOF_EVENT(); -#endif -} - -/** - * \internal - * \brief Control endpoint Reset callback function - * \param[in] module_inst Pointer to USB module instance - * \param[in] pointer Pointer to the callback parameter from driver layer. - */ -static void _usb_on_bus_reset(struct usb_module *module_inst, void *pointer) -{ - // Reset USB Device Stack Core - udc_reset(); - usb_device_set_address(module_inst,0); - udd_ctrl_ep_enable(module_inst); -} - -/** - * \internal - * \brief Control endpoint Wakeup callback function - * \param[in] module_inst Pointer to USB module instance - * \param[in] pointer Pointer to the callback parameter from driver layer. - */ -static void _usb_on_wakeup(struct usb_module *module_inst, void *pointer) -{ - udd_wait_clock_ready(); - - usb_device_disable_callback(&usb_device, USB_DEVICE_CALLBACK_WAKEUP); - usb_device_enable_callback(&usb_device, USB_DEVICE_CALLBACK_SUSPEND); -#ifdef USB_DEVICE_LPM_SUPPORT - usb_device_register_callback(&usb_device, USB_DEVICE_CALLBACK_LPMSUSP, _usb_device_lpm_suspend); - usb_device_enable_callback(&usb_device, USB_DEVICE_CALLBACK_LPMSUSP); -#endif - udd_sleep_mode(UDD_STATE_IDLE); -#ifdef UDC_RESUME_EVENT - UDC_RESUME_EVENT(); -#endif -} - -void udd_detach(void) -{ - usb_device_detach(&usb_device); - udd_sleep_mode(UDD_STATE_SUSPEND); -} - -void udd_attach(void) -{ - udd_sleep_mode(UDD_STATE_IDLE); - usb_device_attach(&usb_device); - - usb_device_register_callback(&usb_device, USB_DEVICE_CALLBACK_SUSPEND, _usb_on_suspend); - usb_device_register_callback(&usb_device, USB_DEVICE_CALLBACK_SOF, _usb_on_sof_notify); - usb_device_register_callback(&usb_device, USB_DEVICE_CALLBACK_RESET, _usb_on_bus_reset); - usb_device_register_callback(&usb_device, USB_DEVICE_CALLBACK_WAKEUP, _usb_on_wakeup); - - usb_device_enable_callback(&usb_device, USB_DEVICE_CALLBACK_SUSPEND); - usb_device_enable_callback(&usb_device, USB_DEVICE_CALLBACK_SOF); - usb_device_enable_callback(&usb_device, USB_DEVICE_CALLBACK_RESET); - usb_device_enable_callback(&usb_device, USB_DEVICE_CALLBACK_WAKEUP); -#ifdef USB_DEVICE_LPM_SUPPORT - usb_device_register_callback(&usb_device, USB_DEVICE_CALLBACK_LPMSUSP, _usb_device_lpm_suspend); - usb_device_enable_callback(&usb_device, USB_DEVICE_CALLBACK_LPMSUSP); -#endif -} - -#if USB_VBUS_EIC -/** - * \name USB VBUS PAD management - * - * @{ - */ - - /** Check if USB VBus is available */ -# define is_usb_vbus_high() port_pin_get_input_level(USB_VBUS_PIN) - -/** - * \internal - * \brief USB VBUS pin change handler - */ -static void _uhd_vbus_handler(void) -{ - extint_chan_disable_callback(USB_VBUS_EIC_LINE, - EXTINT_CALLBACK_TYPE_DETECT); -# ifndef USB_DEVICE_ATTACH_AUTO_DISABLE - if (is_usb_vbus_high()) { - udd_attach(); - } else { - udd_detach(); - } -# endif -# ifdef UDC_VBUS_EVENT - UDC_VBUS_EVENT(is_usb_vbus_high()); -# endif - extint_chan_enable_callback(USB_VBUS_EIC_LINE, - EXTINT_CALLBACK_TYPE_DETECT); -} - -/** - * \internal - * \brief USB VBUS pin configuration - */ -static void _usb_vbus_config(void) -{ - - /* Initialize EIC for vbus checking */ - struct extint_chan_conf eint_chan_conf; - extint_chan_get_config_defaults(&eint_chan_conf); - - eint_chan_conf.gpio_pin = USB_VBUS_PIN; - eint_chan_conf.gpio_pin_mux = USB_VBUS_EIC_MUX; - eint_chan_conf.gpio_pin_pull = EXTINT_PULL_NONE; - eint_chan_conf.detection_criteria = EXTINT_DETECT_BOTH; - eint_chan_conf.filter_input_signal = true; - - extint_chan_disable_callback(USB_VBUS_EIC_LINE, - EXTINT_CALLBACK_TYPE_DETECT); - extint_chan_set_config(USB_VBUS_EIC_LINE, &eint_chan_conf); - extint_register_callback(_uhd_vbus_handler, - USB_VBUS_EIC_LINE, - EXTINT_CALLBACK_TYPE_DETECT); - extint_chan_enable_callback(USB_VBUS_EIC_LINE, - EXTINT_CALLBACK_TYPE_DETECT); -} -/** @} */ -#endif - -bool udd_include_vbus_monitoring(void) -{ -#if USB_VBUS_EIC - return true; -#else - return false; -#endif -} - -void udd_enable(void) -{ - irqflags_t flags; - - /* To avoid USB interrupt before end of initialization */ - flags = cpu_irq_save(); - -#if USB_ID_EIC - if (usb_dual_enable()) { - /* The current mode has been started by otg_dual_enable() */ - cpu_irq_restore(flags); - return; - } -#endif - struct usb_config config_usb; - - /* USB Module configuration */ - usb_get_config_defaults(&config_usb); - config_usb.source_generator = UDD_CLOCK_GEN; - usb_init(&usb_device, USB, &config_usb); - - /* USB Module Enable */ - usb_enable(&usb_device); - - /* Check clock after enable module, request the clock */ - udd_wait_clock_ready(); - - udd_sleep_mode(UDD_STATE_SUSPEND); - -#if USB_VBUS_EIC - _usb_vbus_config(); - if (is_usb_vbus_high()) { - /* USB Attach */ - _uhd_vbus_handler(); - } -#else - // No VBus detect, assume always high -# ifndef USB_DEVICE_ATTACH_AUTO_DISABLE - udd_attach(); -# endif -#endif - - cpu_irq_restore(flags); -} - -void udd_disable(void) -{ - irqflags_t flags; - - udd_detach(); - - udd_sleep_mode(UDD_STATE_OFF); - - flags = cpu_irq_save(); - usb_dual_disable(); - cpu_irq_restore(flags); -} -/** @} */ diff --git a/atmel-samd/asf/sam0/drivers/usb/stack_interface/usb_dual.c b/atmel-samd/asf/sam0/drivers/usb/stack_interface/usb_dual.c deleted file mode 100644 index 4b9adee94..000000000 --- a/atmel-samd/asf/sam0/drivers/usb/stack_interface/usb_dual.c +++ /dev/null @@ -1,178 +0,0 @@ -/** - * \file - * - * \brief SAM USB Dual Role driver file. - * - * Copyright (C) 2014-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#include <compiler.h> -#include "usb_dual.h" - -#ifndef UDD_ENABLE -# define udc_start() -# define udc_stop() -#else -#include <udc.h> -#endif - -#ifndef UHD_ENABLE -# define uhc_start(void) -# define uhc_stop(b_id_stop) -#else -#include <uhc.h> -#endif - -/* State of USB dual role initialization */ -static bool _initialized = false; - -#define _usb_is_id_device() port_pin_get_input_level(USB_ID_PIN) - -#if USB_ID_EIC -static void usb_id_handler(void); - -/** - * \name USB ID PAD management - * - * @{ - */ - -/** - * USB ID pin configuration - */ -static void usb_id_config(void) -{ - struct extint_chan_conf eint_chan_conf; - extint_chan_get_config_defaults(&eint_chan_conf); - - eint_chan_conf.gpio_pin = USB_ID_PIN; - eint_chan_conf.gpio_pin_mux = USB_ID_EIC_MUX; - eint_chan_conf.detection_criteria = EXTINT_DETECT_BOTH; - eint_chan_conf.filter_input_signal = true; - - extint_chan_disable_callback(USB_ID_EIC_LINE, - EXTINT_CALLBACK_TYPE_DETECT); - extint_chan_set_config(USB_ID_EIC_LINE, &eint_chan_conf); - extint_register_callback(usb_id_handler, - USB_ID_EIC_LINE, - EXTINT_CALLBACK_TYPE_DETECT); - extint_chan_enable_callback(USB_ID_EIC_LINE, - EXTINT_CALLBACK_TYPE_DETECT); -} - -/** - * USB ID pin change handler - */ -static void usb_id_handler(void) -{ - extint_chan_disable_callback(USB_ID_EIC_LINE, - EXTINT_CALLBACK_TYPE_DETECT); - if (_usb_is_id_device()) { - uhc_stop(false); - UHC_MODE_CHANGE(false); - udc_start(); - } else { - udc_stop(); - UHC_MODE_CHANGE(true); - uhc_start(); - } - extint_chan_enable_callback(USB_ID_EIC_LINE, - EXTINT_CALLBACK_TYPE_DETECT); -} -#endif -/** @} */ - -/** - * \brief Initialize the USB peripheral and set right role according to ID pin - * - * \return \c true if the ID pin management has been started, otherwise \c false. - */ -bool usb_dual_enable(void) -{ - if (_initialized) { - return false; // Dual role already initialized - } - -#if USB_ID_EIC - _initialized = true; - - struct port_config pin_conf; - port_get_config_defaults(&pin_conf); - - /* Set USB ID Pin as inputs */ - pin_conf.direction = PORT_PIN_DIR_INPUT; - pin_conf.input_pull = PORT_PIN_PULL_UP; - port_pin_set_config(USB_ID_PIN, &pin_conf); - - usb_id_config(); - if (_usb_is_id_device()) { - UHC_MODE_CHANGE(false); - udc_start(); - } else { - UHC_MODE_CHANGE(true); - uhc_start(); - } - - /** - * End of host or device startup, - * the current mode selected is already started now - */ - return true; // ID pin management has been enabled -#else - return false; // ID pin management has not been enabled -#endif -} - -/** - * \brief Deinitialize the dual role driver - */ -void usb_dual_disable(void) -{ - if (!_initialized) { - return; // Dual role not initialized - } - _initialized = false; - -#if USB_ID_EIC - extint_chan_disable_callback(USB_ID_EIC_LINE, - EXTINT_CALLBACK_TYPE_DETECT); -#endif -} - diff --git a/atmel-samd/asf/sam0/drivers/usb/stack_interface/usb_dual.h b/atmel-samd/asf/sam0/drivers/usb/stack_interface/usb_dual.h deleted file mode 100644 index 60125d3d6..000000000 --- a/atmel-samd/asf/sam0/drivers/usb/stack_interface/usb_dual.h +++ /dev/null @@ -1,111 +0,0 @@ -/** - * \file - * - * \brief SAM USB Dual Role driver header file. - * - * Copyright (c) 2014-2015 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ - -#ifndef _USB_DUAL_H_ -#define _USB_DUAL_H_ - -#include "compiler.h" -#include "preprocessor.h" - -/* Get USB pads pins configuration in board configuration */ -#include "conf_board.h" -#include "board.h" -#include "extint.h" -#include "port.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \ingroup usb_group - * \defgroup usb_dual_group USB dual role driver - * USB low-level driver for dual role features - * - * @{ - */ - -bool usb_dual_enable(void); -void usb_dual_disable(void); - -/** - * @name USB ID pin management - * - * The ID pin come from the USB connector (A and B receptable) and - * allows to select the USB mode between host or device. - * The ID pin can be managed through EIC pin. - * This feature is optional, and it is enabled if USB_ID_PIN - * is defined in board.h and CONF_BOARD_USB_ID_DETECT defined in - * conf_board.h. -* -* @{ -*/ -#define USB_ID_DETECT (defined(CONF_BOARD_USB_ID_DETECT)) -#define USB_ID_EIC (defined(USB_ID_PIN) && USB_ID_DETECT) -/** @} */ - -/** - * @name USB Vbus management - * - * The VBus line can be monitored through a EIC pin and - * a basic resistor voltage divider. - * This feature is optional, and it is enabled if USB_VBUS_PIN - * is defined in board.h and CONF_BOARD_USB_VBUS_DETECT defined in - * conf_board.h. - * - * @{ - */ -#define USB_VBUS_DETECT (defined(CONF_BOARD_USB_VBUS_DETECT)) -#define USB_VBUS_EIC (defined(USB_VBUS_PIN) && USB_VBUS_DETECT) -/** @} */ - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif // _USB_DUAL_H_ diff --git a/atmel-samd/asf/sam0/drivers/usb/usb.h b/atmel-samd/asf/sam0/drivers/usb/usb.h deleted file mode 100644 index fa29b1ffe..000000000 --- a/atmel-samd/asf/sam0/drivers/usb/usb.h +++ /dev/null @@ -1,833 +0,0 @@ -/** - * \file - * - * \brief SAM USB Driver - * - * Copyright (C) 2014-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#ifndef USB_H_INCLUDED -#define USB_H_INCLUDED - -#include <compiler.h> -#include <clock.h> -#include <gclk.h> -#include <pinmux.h> -#include <system_interrupt.h> - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * \defgroup asfdoc_sam0_usb_group SAM Universal Serial Bus (USB) - * - * The Universal Serial Bus (USB) module complies with the USB 2.1 specification. - * - * The following peripherals are used by this module: - * - USB (Universal Serial Bus) - * - * The following devices can use this module: - * - Atmel | SMART SAM D21 - * - Atmel | SMART SAM R21 - * - Atmel | SMART SAM D11 (Only USB device support on SAM D11 device) - * - Atmel | SMART SAM L21 - * - Atmel | SMART SAM L22 (Only USB device support on SAM L22 device) - * - Atmel | SMART SAM DA1 - * - * The USB module covers following mode: - * \if USB_DEVICE_MODE - * - USB Device Mode - * \endif - * \if USB_HOST_MODE - * - USB Host Mode - * \endif - * - * The USB module covers following speed: - * \if USB_HS_MODE - * - USB High Speed (480Mbit/s) - * \endif - * - USB Full Speed (12Mbit/s) - * \if USB_LS_MODE - * - USB Low Speed (1.5Mbit/s) - * \endif - * - * \if USB_LPM_MODE - * The USB module supports Link Power Management (LPM-L1) protocol. - * \endif - * - * USB support needs whole set of enumeration process, to make the device - * recognizable and usable. The USB driver is designed to interface to the - * USB Stack in Atmel Software Framework (ASF). - * - * \if USB_DEVICE_MODE - * \section asfdoc_sam0_usb_device USB Device Mode - * The ASF USB Device Stack has defined the USB Device Driver (UDD) interface, - * to support USB device operations. The USB module device driver complies with - * this interface, so that the USB Device Stack can work based on the - * USB module. - * - * Refer to <a href="http://www.atmel.com/images/doc8360.pdf"> - * "ASF - USB Device Stack"</a> for more details. - * \endif - * - * \if USB_HOST_MODE - * \section adfdoc_sam0_usb_host USB Host Mode - * The ASF USB Host Stack has defined the USB Host Driver (UHD) interface, - * to support USB host operations. The USB module host driver complies with - * this interface, so that the USB Host Stack can work based on the USB module. - * - * Refer to <a href="http://www.atmel.com/images/doc8486.pdf"> - * "ASF - USB Host Stack"</a> for more details. - * \endif - */ - -/** Enum for the speed status for the USB module */ -enum usb_speed { - USB_SPEED_LOW, - USB_SPEED_FULL, -}; - -/** Enum for the possible callback types for the USB in host module */ -enum usb_host_callback { - USB_HOST_CALLBACK_SOF, - USB_HOST_CALLBACK_RESET, - USB_HOST_CALLBACK_WAKEUP, - USB_HOST_CALLBACK_DNRSM, - USB_HOST_CALLBACK_UPRSM, - USB_HOST_CALLBACK_RAMACER, - USB_HOST_CALLBACK_CONNECT, - USB_HOST_CALLBACK_DISCONNECT, - USB_HOST_CALLBACK_N, -}; - -/** Enum for the possible callback types for the USB pipe in host module */ -enum usb_host_pipe_callback { - USB_HOST_PIPE_CALLBACK_TRANSFER_COMPLETE, - USB_HOST_PIPE_CALLBACK_ERROR, - USB_HOST_PIPE_CALLBACK_SETUP, - USB_HOST_PIPE_CALLBACK_STALL, - USB_HOST_PIPE_CALLBACK_N, -}; - -/** - * \brief Host pipe types. - */ -enum usb_host_pipe_type { - USB_HOST_PIPE_TYPE_DISABLE, - USB_HOST_PIPE_TYPE_CONTROL, - USB_HOST_PIPE_TYPE_ISO, - USB_HOST_PIPE_TYPE_BULK, - USB_HOST_PIPE_TYPE_INTERRUPT, - USB_HOST_PIPE_TYPE_EXTENDED, -}; - -/** - * \brief Host pipe token types. - */ -enum usb_host_pipe_token { - USB_HOST_PIPE_TOKEN_SETUP, - USB_HOST_PIPE_TOKEN_IN, - USB_HOST_PIPE_TOKEN_OUT, -}; - -/** - * \brief Enumeration for the possible callback types for the USB in device module - */ -enum usb_device_callback { - USB_DEVICE_CALLBACK_SOF, - USB_DEVICE_CALLBACK_RESET, - USB_DEVICE_CALLBACK_WAKEUP, - USB_DEVICE_CALLBACK_RAMACER, - USB_DEVICE_CALLBACK_SUSPEND, - USB_DEVICE_CALLBACK_LPMNYET, - USB_DEVICE_CALLBACK_LPMSUSP, - USB_DEVICE_CALLBACK_N, -}; - -/** - * \brief Enumeration for the possible callback types for the USB endpoint in device module - */ -enum usb_device_endpoint_callback { - USB_DEVICE_ENDPOINT_CALLBACK_TRCPT, - USB_DEVICE_ENDPOINT_CALLBACK_TRFAIL, - USB_DEVICE_ENDPOINT_CALLBACK_RXSTP, - USB_DEVICE_ENDPOINT_CALLBACK_STALL, - USB_DEVICE_EP_CALLBACK_N, -}; - -/** - * \brief Device Endpoint types. - */ -enum usb_device_endpoint_type { - USB_DEVICE_ENDPOINT_TYPE_DISABLE, - USB_DEVICE_ENDPOINT_TYPE_CONTROL, - USB_DEVICE_ENDPOINT_TYPE_ISOCHRONOUS, - USB_DEVICE_ENDPOINT_TYPE_BULK, - USB_DEVICE_ENDPOINT_TYPE_INTERRUPT, -}; - -/** - * \brief Endpoint Size - */ -enum usb_endpoint_size { - USB_ENDPOINT_8_BYTE, - USB_ENDPOINT_16_BYTE, - USB_ENDPOINT_32_BYTE, - USB_ENDPOINT_64_BYTE, - USB_ENDPOINT_128_BYTE, - USB_ENDPOINT_256_BYTE, - USB_ENDPOINT_512_BYTE, - USB_ENDPOINT_1023_BYTE, -}; - -/** - * \brief Link Power Management Handshake. - */ -enum usb_device_lpm_mode { - USB_DEVICE_LPM_NOT_SUPPORT, - USB_DEVICE_LPM_ACK, - USB_DEVICE_LPM_NYET, -}; - -/** - * \brief Module structure - */ -struct usb_module; - -/** - * \name Host Callback Functions Types - * @{ - */ -typedef void (*usb_host_callback_t)(struct usb_module *module_inst); -typedef void (*usb_host_pipe_callback_t)(struct usb_module *module_inst, void *); -/** @} */ - -/** - * \name Device Callback Functions Types - * @{ - */ -typedef void (*usb_device_callback_t)(struct usb_module *module_inst, void* pointer); -typedef void (*usb_device_endpoint_callback_t)(struct usb_module *module_inst, void* pointer); -/** @} */ - - -/** USB configurations */ -struct usb_config { - /** \c true for host, \c false for device. */ - bool select_host_mode; - /** When \c true the module is enabled during standby. */ - bool run_in_standby; - /** Generic Clock Generator source channel. */ - enum gclk_generator source_generator; - /** Speed mode */ - enum usb_speed speed_mode; -}; - -/** - * \brief USB software module instance structure. - * - * USB software module instance structure, used to retain software state - * information of an associated hardware module instance. - * - */ -struct usb_module { - /** Hardware module pointer of the associated USB peripheral. */ - Usb *hw; - -#if !SAMD11 && !SAML22 - /** Array to store host related callback functions */ - usb_host_callback_t host_callback[USB_HOST_CALLBACK_N]; - usb_host_pipe_callback_t host_pipe_callback[USB_PIPE_NUM][USB_HOST_PIPE_CALLBACK_N]; - /** Bit mask for host callbacks registered */ - uint8_t host_registered_callback_mask; - /** Bit mask for host callbacks enabled */ - uint8_t host_enabled_callback_mask; - /** Bit mask for host pipe callbacks registered */ - uint8_t host_pipe_registered_callback_mask[USB_PIPE_NUM]; - /** Bit mask for host pipe callbacks enabled */ - uint8_t host_pipe_enabled_callback_mask[USB_PIPE_NUM]; -#endif - - /** Array to store device related callback functions */ - usb_device_callback_t device_callback[USB_DEVICE_CALLBACK_N]; - usb_device_endpoint_callback_t device_endpoint_callback[USB_EPT_NUM][USB_DEVICE_EP_CALLBACK_N]; - /** Bit mask for device callbacks registered */ - uint16_t device_registered_callback_mask; - /** Bit mask for device callbacks enabled */ - uint16_t device_enabled_callback_mask; - /** Bit mask for device endpoint callbacks registered */ - uint8_t device_endpoint_registered_callback_mask[USB_EPT_NUM]; - /** Bit mask for device endpoint callbacks enabled */ - uint8_t device_endpoint_enabled_callback_mask[USB_EPT_NUM]; -}; - -/** USB host pipe configurations */ -struct usb_host_pipe_config { - /** device address */ - uint8_t device_address; - /** endpoint address */ - uint8_t endpoint_address; - /** Pipe type */ - enum usb_host_pipe_type pipe_type; - /** interval */ - uint8_t binterval; - /** pipe size */ - uint16_t size; -}; - -/** USB device endpoint configurations */ -struct usb_device_endpoint_config { - /** device address */ - uint8_t ep_address; - /** endpoint size */ - enum usb_endpoint_size ep_size; - /** automatic zero length packet mode, \c true to enable */ - bool auto_zlp; - /** type of endpoint with Bank */ - enum usb_device_endpoint_type ep_type; -}; - -/** USB host pipe callback status parameter structure */ -struct usb_pipe_callback_parameter { - /** current pipe number */ - uint8_t pipe_num; - /** pipe error status */ - uint8_t pipe_error_status; - /** actual transferred data size */ - uint16_t transfered_size; - /** required data size */ - uint16_t required_size; -}; - -/** USB device endpoint callback status parameter structure */ -struct usb_endpoint_callback_parameter { - uint16_t received_bytes; - uint16_t sent_bytes; - uint16_t out_buffer_size; - uint8_t endpoint_address; -}; - -void usb_enable(struct usb_module *module_inst); -void usb_disable(struct usb_module *module_inst); - -/** - * \brief Get the status of USB module's state machine - * - * \param module_inst Pointer to USB module instance - */ -static inline uint8_t usb_get_state_machine_status(struct usb_module *module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - return module_inst->hw->DEVICE.FSMSTATUS.reg; -} - -void usb_get_config_defaults(struct usb_config *module_config); -enum status_code usb_init(struct usb_module *module_inst, Usb *const hw, - struct usb_config *module_config); - -#if !SAMD11 && !SAML22 -/** - * \brief Enable the USB host by setting the VBUS OK - * - * \param module_inst Pointer to USB software instance struct - */ -static inline void usb_host_enable(struct usb_module *module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - module_inst->hw->HOST.CTRLB.bit.VBUSOK = 1; -} - -/** - * \brief Send the USB reset - * - * \param module_inst Pointer to USB software instance struct - */ -static inline void usb_host_send_reset(struct usb_module *module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - module_inst->hw->HOST.CTRLB.bit.BUSRESET = 1; -} - -/** - * \brief Enable the USB SOF generation - * - * \param module_inst Pointer to USB software instance struct - */ -static inline void usb_host_enable_sof(struct usb_module *module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - module_inst->hw->HOST.CTRLB.bit.SOFE = 1; -} - -/** - * \brief Disable the USB SOF generation - * - * \param module_inst Pointer to USB software instance struct - */ -static inline void usb_host_disable_sof(struct usb_module *module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - module_inst->hw->HOST.CTRLB.bit.SOFE = 0; -} - -/** - * \brief Check the USB SOF generation status - * - * \param module_inst Pointer to USB software instance struct - * - * \return USB SOF generation status, \c true if SOF generation is ON. - */ -static inline bool usb_host_is_sof_enabled(struct usb_module *module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - return module_inst->hw->HOST.CTRLB.bit.SOFE; -} - -/** - * \brief Send the USB host resume - * - * \param module_inst Pointer to USB software instance struct - */ -static inline void usb_host_send_resume(struct usb_module *module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - module_inst->hw->HOST.CTRLB.bit.RESUME= 1; -} - -/** - * \brief Send the USB host LPM resume - * - * \param module_inst Pointer to USB software instance struct - */ -static inline void usb_host_send_l1_resume(struct usb_module *module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - module_inst->hw->HOST.CTRLB.bit.L1RESUME = 1; -} - -/** - * \brief Get the speed mode of USB host - * - * \param module_inst Pointer to USB module instance struct - * - * \return USB speed mode (\ref usb_speed). - */ -static inline enum usb_speed usb_host_get_speed(struct usb_module *module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - if (module_inst->hw->HOST.STATUS.bit.SPEED == 0) { - return USB_SPEED_FULL; - } else { - return USB_SPEED_LOW; - } -} - -/** - * \brief Get the frame number - * - * \param module_inst Pointer to USB software instance struct - * - * \return frame number value. - */ -static inline uint16_t usb_host_get_frame_number(struct usb_module *module_inst) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - return (uint16_t)(module_inst->hw->HOST.FNUM.bit.FNUM); -} -#endif - -/** - * \brief Attach USB device to the bus - * - * \param module_inst Pointer to USB device module instance - */ -static inline void usb_device_attach(struct usb_module *module_inst) -{ - module_inst->hw->DEVICE.CTRLB.reg &= ~USB_DEVICE_CTRLB_DETACH; -} - -/** - * \brief Detach USB device from the bus - * - * \param module_inst Pointer to USB device module instance - */ -static inline void usb_device_detach(struct usb_module *module_inst) -{ - module_inst->hw->DEVICE.CTRLB.reg |= USB_DEVICE_CTRLB_DETACH; -} - -/** - * \brief Get the speed mode of USB device - * - * \param module_inst Pointer to USB device module instance - * \return USB Speed mode (\ref usb_speed). - */ -static inline enum usb_speed usb_device_get_speed(struct usb_module *module_inst) -{ - if (!(module_inst->hw->DEVICE.STATUS.reg & USB_DEVICE_STATUS_SPEED_Msk)) { - return USB_SPEED_FULL; - } else { - return USB_SPEED_LOW; - } -} - -/** - * \brief Get the address of USB device - * - * \param module_inst Pointer to USB device module instance - * \return USB device address value. - */ -static inline uint8_t usb_device_get_address(struct usb_module *module_inst) -{ - return ((uint8_t)(module_inst->hw->DEVICE.DADD.bit.DADD)); -} - -/** - * \brief Set the speed mode of USB device - * - * \param module_inst Pointer to USB device module instance - * \param address USB device address value - */ -static inline void usb_device_set_address(struct usb_module *module_inst, uint8_t address) -{ - module_inst->hw->DEVICE.DADD.reg = USB_DEVICE_DADD_ADDEN | address; -} - -/** - * \brief Get the frame number of USB device - * - * \param module_inst Pointer to USB device module instance - * \return USB device frame number value. - */ -static inline uint16_t usb_device_get_frame_number(struct usb_module *module_inst) -{ - return ((uint16_t)(module_inst->hw->DEVICE.FNUM.bit.FNUM)); -} - -/** - * \brief Get the micro-frame number of USB device - * - * \param module_inst Pointer to USB device module instance - * \return USB device micro-frame number value. - */ -static inline uint16_t usb_device_get_micro_frame_number(struct usb_module *module_inst) -{ - return ((uint16_t)(module_inst->hw->DEVICE.FNUM.reg)); -} - -/** - * \brief USB device send the resume wakeup - * - * \param module_inst Pointer to USB device module instance - */ -static inline void usb_device_send_remote_wake_up(struct usb_module *module_inst) -{ - module_inst->hw->DEVICE.CTRLB.reg |= USB_DEVICE_CTRLB_UPRSM; -} - -/** - * \brief USB device set the LPM mode - * - * \param module_inst Pointer to USB device module instance - * \param lpm_mode LPM mode - */ -static inline void usb_device_set_lpm_mode(struct usb_module *module_inst, - enum usb_device_lpm_mode lpm_mode) -{ - module_inst->hw->DEVICE.CTRLB.bit.LPMHDSK = lpm_mode; -} - -/** - * \name USB Host Callback Management - * @{ - */ -enum status_code usb_host_register_callback(struct usb_module *module_inst, - enum usb_host_callback callback_type, - usb_host_callback_t callback_func); -enum status_code usb_host_unregister_callback(struct usb_module *module_inst, - enum usb_host_callback callback_type); -enum status_code usb_host_enable_callback(struct usb_module *module_inst, - enum usb_host_callback callback_type); -enum status_code usb_host_disable_callback(struct usb_module *module_inst, - enum usb_host_callback callback_type); -/** @} */ - -/** - * \name USB Device Callback Management - * @{ - */ -enum status_code usb_device_register_callback(struct usb_module *module_inst, - enum usb_device_callback callback_type, - usb_device_callback_t callback_func); -enum status_code usb_device_unregister_callback(struct usb_module *module_inst, - enum usb_device_callback callback_type); -enum status_code usb_device_enable_callback(struct usb_module *module_inst, - enum usb_device_callback callback_type); -enum status_code usb_device_disable_callback(struct usb_module *module_inst, - enum usb_device_callback callback_type); -/** @} */ - -/** - * \name USB Host Pipe Configuration - * @{ - */ -void usb_host_pipe_get_config_defaults(struct usb_host_pipe_config *ep_config); -enum status_code usb_host_pipe_set_config(struct usb_module *module_inst, uint8_t pipe_num, - struct usb_host_pipe_config *ep_config); -enum status_code usb_host_pipe_get_config(struct usb_module *module_inst, uint8_t pipe_num, - struct usb_host_pipe_config *ep_config); -/** @} */ - -/** - * \name USB Device Endpoint Configuration - * @{ - */ -void usb_device_endpoint_get_config_defaults(struct usb_device_endpoint_config *ep_config); -enum status_code usb_device_endpoint_set_config(struct usb_module *module_inst, - struct usb_device_endpoint_config *ep_config); -bool usb_device_endpoint_is_configured(struct usb_module *module_inst, uint8_t ep); -/** @} */ - -/** - * \name USB Host Pipe Callback Management - * @{ - */ -enum status_code usb_host_pipe_register_callback( - struct usb_module *module_inst, uint8_t pipe_num, - enum usb_host_pipe_callback callback_type, - usb_host_pipe_callback_t callback_func); -enum status_code usb_host_pipe_unregister_callback( - struct usb_module *module_inst, uint8_t pipe_num, - enum usb_host_pipe_callback callback_type); -enum status_code usb_host_pipe_enable_callback( - struct usb_module *module_inst, uint8_t pipe_num, - enum usb_host_pipe_callback callback_type); -enum status_code usb_host_pipe_disable_callback( - struct usb_module *module_inst, uint8_t pipe_num, - enum usb_host_pipe_callback callback_type); -/** @} */ - -/** - * \name USB Device Endpoint Callback Management - * @{ - */ -enum status_code usb_device_endpoint_register_callback( - struct usb_module *module_inst, uint8_t ep_num, - enum usb_device_endpoint_callback callback_type, - usb_device_endpoint_callback_t callback_func); -enum status_code usb_device_endpoint_unregister_callback( - struct usb_module *module_inst, uint8_t ep_num, - enum usb_device_endpoint_callback callback_type); -enum status_code usb_device_endpoint_enable_callback( - struct usb_module *module_inst, uint8_t ep, - enum usb_device_endpoint_callback callback_type); -enum status_code usb_device_endpoint_disable_callback( - struct usb_module *module_inst, uint8_t ep, - enum usb_device_endpoint_callback callback_type); -/** @} */ - -/** - * \name USB Host Pipe Job Management - * @{ - */ -enum status_code usb_host_pipe_setup_job(struct usb_module *module_inst, - uint8_t pipe_num, uint8_t *buf); -enum status_code usb_host_pipe_read_job(struct usb_module *module_inst, - uint8_t pipe_num, uint8_t *buf, uint32_t buf_size); -enum status_code usb_host_pipe_write_job(struct usb_module *module_inst, - uint8_t pipe_num, uint8_t *buf, uint32_t buf_size); -enum status_code usb_host_pipe_abort_job(struct usb_module *module_inst, uint8_t pipe_num); -enum status_code usb_host_pipe_lpm_job(struct usb_module *module_inst, - uint8_t pipe_num, bool b_remotewakeup, uint8_t hird); -/** @} */ - -/** - * \name USB Device Endpoint Job Management - * @{ - */ -enum status_code usb_device_endpoint_write_buffer_job(struct usb_module *module_inst,uint8_t ep_num, - uint8_t* pbuf, uint32_t buf_size); -enum status_code usb_device_endpoint_read_buffer_job(struct usb_module *module_inst,uint8_t ep_num, - uint8_t* pbuf, uint32_t buf_size); -enum status_code usb_device_endpoint_setup_buffer_job(struct usb_module *module_inst, - uint8_t* pbuf); -void usb_device_endpoint_abort_job(struct usb_module *module_inst, uint8_t ep); -/** @} */ - -#if !SAMD11 && !SAML22 -/** - * \name USB Host Pipe Operations - * @{ - */ - -/** - * \brief Freeze a pipe - * - * \param module_inst Pointer to USB module instance - * \param pipe_num Pipe number - */ -static inline void usb_host_pipe_freeze(struct usb_module *module_inst, uint8_t pipe_num) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - module_inst->hw->HOST.HostPipe[pipe_num].PSTATUSSET.reg = USB_HOST_PSTATUSSET_PFREEZE; -} - -/** - * \brief Unfreeze a pipe - * - * \param module_inst Pointer to USB module instance - * \param pipe_num Pipe number - */ -static inline void usb_host_pipe_unfreeze(struct usb_module *module_inst, uint8_t pipe_num) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - module_inst->hw->HOST.HostPipe[pipe_num].PSTATUSCLR.reg = USB_HOST_PSTATUSCLR_PFREEZE; -} - -/** - * \brief Check if the pipe is frozen - * - * \param module_inst Pointer to USB module instance - * \param pipe_num Pipe number - */ -static inline bool usb_host_pipe_is_frozen(struct usb_module *module_inst, uint8_t pipe_num) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - return (module_inst->hw->HOST.HostPipe[pipe_num].PSTATUS.bit.PFREEZE == 1); -} - -/** - * \brief Set the data toggle bit of pipe - * - * \param module_inst Pointer to USB module instance - * \param pipe_num Pipe number - */ -static inline void usb_host_pipe_set_toggle(struct usb_module *module_inst, uint8_t pipe_num) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - module_inst->hw->HOST.HostPipe[pipe_num].PSTATUSSET.reg = USB_HOST_PSTATUSSET_DTGL; -} - -/** - * \brief Clear the data toggle bit of pipe - * - * \param module_inst Pointer to USB module instance - * \param pipe_num Pipe number - */ -static inline void usb_host_pipe_clear_toggle(struct usb_module *module_inst, uint8_t pipe_num) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - module_inst->hw->HOST.HostPipe[pipe_num].PSTATUSCLR.reg = USB_HOST_PSTATUSCLR_DTGL; -} - -/** - * \brief Set the auto zero length packet of pipe - * - * \param module_inst Pointer to USB module instance - * \param pipe_num Pipe number - * \param value \c true to enable auto ZLP and \c false to disable - */ -void usb_host_pipe_set_auto_zlp(struct usb_module *module_inst, uint8_t pipe_num, bool value); - -/** @} */ -#endif - -/** - * \name USB Device Endpoint Operations - * @{ - */ - -bool usb_device_endpoint_is_halted(struct usb_module *module_inst, uint8_t ep); -void usb_device_endpoint_set_halt(struct usb_module *module_inst, uint8_t ep); -void usb_device_endpoint_clear_halt(struct usb_module *module_inst, uint8_t ep); - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif /* USB_H_INCLUDED */ diff --git a/atmel-samd/asf/sam0/drivers/usb/usb_sam_d_r/usb.c b/atmel-samd/asf/sam0/drivers/usb/usb_sam_d_r/usb.c deleted file mode 100644 index a6fe3420d..000000000 --- a/atmel-samd/asf/sam0/drivers/usb/usb_sam_d_r/usb.c +++ /dev/null @@ -1,2041 +0,0 @@ -/** - * \file - * - * \brief SAM USB Driver. - * - * Copyright (C) 2014-2016 Atmel Corporation. All rights reserved. - * - * \asf_license_start - * - * \page License - * - * 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. The name of Atmel may not be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * 4. This software may only be redistributed and used in connection with an - * Atmel microcontroller product. - * - * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE - * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. - * - * \asf_license_stop - * - */ -/* - * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> - */ -#include <string.h> -#include "usb.h" - -/** Fields definition from a LPM TOKEN */ -#define USB_LPM_ATTRIBUT_BLINKSTATE_MASK (0xF << 0) -#define USB_LPM_ATTRIBUT_HIRD_MASK (0xF << 4) -#define USB_LPM_ATTRIBUT_REMOTEWAKE_MASK (1 << 8) -#define USB_LPM_ATTRIBUT_BLINKSTATE(value) ((value & 0xF) << 0) -#define USB_LPM_ATTRIBUT_HIRD(value) ((value & 0xF) << 4) -#define USB_LPM_ATTRIBUT_REMOTEWAKE(value) ((value & 1) << 8) -#define USB_LPM_ATTRIBUT_BLINKSTATE_L1 USB_LPM_ATTRIBUT_BLINKSTATE(1) - -/** - * \brief Mask selecting the index part of an endpoint address - */ -#define USB_EP_ADDR_MASK 0x0f - -/** - * \brief Endpoint transfer direction is IN - */ -#define USB_EP_DIR_IN 0x80 - -/** - * \brief Endpoint transfer direction is OUT - */ -#define USB_EP_DIR_OUT 0x00 - -/** - * \name USB SRAM data containing pipe descriptor table - * The content of the USB SRAM can be : - * - modified by USB hardware interface to update pipe status. - * Thereby, it is read by software. - * - modified by USB software to control pipe. - * Thereby, it is read by hardware. - * This data section is volatile. - * - * @{ - */ -COMPILER_PACK_SET(1) -COMPILER_WORD_ALIGNED -union { - UsbDeviceDescriptor usb_endpoint_table[USB_EPT_NUM]; -#if !SAMD11 - UsbHostDescriptor usb_pipe_table[USB_PIPE_NUM]; -#endif -} usb_descriptor_table; -COMPILER_PACK_RESET() -/** @} */ - -/** - * \brief Local USB module instance - */ -static struct usb_module *_usb_instances; - -#if !SAMD11 -/** - * \brief Host pipe callback structure variable - */ -static struct usb_pipe_callback_parameter pipe_callback_para; -#endif - -/* Device LPM callback variable */ -static uint32_t device_callback_lpm_wakeup_enable; - -/** - * \brief Device endpoint callback parameter variable, used to transfer info to UDD wrapper layer - */ -static struct usb_endpoint_callback_parameter ep_callback_para; - -/** - * \internal USB Device IRQ Mask Bits Map - */ -static const uint16_t _usb_device_irq_bits[USB_DEVICE_CALLBACK_N] = { - USB_DEVICE_INTFLAG_SOF, - USB_DEVICE_INTFLAG_EORST, - USB_DEVICE_INTFLAG_WAKEUP | USB_DEVICE_INTFLAG_EORSM | USB_DEVICE_INTFLAG_UPRSM, - USB_DEVICE_INTFLAG_RAMACER, - USB_DEVICE_INTFLAG_SUSPEND, - USB_DEVICE_INTFLAG_LPMNYET, - USB_DEVICE_INTFLAG_LPMSUSP, -}; - -/** - * \internal USB Device IRQ Mask Bits Map - */ -static const uint8_t _usb_endpoint_irq_bits[USB_DEVICE_EP_CALLBACK_N] = { - USB_DEVICE_EPINTFLAG_TRCPT_Msk, - USB_DEVICE_EPINTFLAG_TRFAIL_Msk, - USB_DEVICE_EPINTFLAG_RXSTP, - USB_DEVICE_EPINTFLAG_STALL_Msk -}; - -#if !SAMD11 -/** - * \brief Bit mask for pipe job busy status - */ -uint32_t host_pipe_job_busy_status = 0; - -/** - * \brief Registers a USB host callback - * - * Registers a callback function which is implemented by the user. - * - * \note The callback must be enabled by \ref usb_host_enable_callback, - * in order for the interrupt handler to call it when the conditions for the - * callback type is met. - * - * \param[in] module_inst Pointer to USB software instance struct - * \param[in] callback_type Callback type given by an enum - * \param[in] callback_func Pointer to callback function - * - * \return Status of the registration operation. - * \retval STATUS_OK The callback was registered successfully. - */ -enum status_code usb_host_register_callback(struct usb_module *module_inst, - enum usb_host_callback callback_type, - usb_host_callback_t callback_func) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(callback_func); - - /* Register callback function */ - module_inst->host_callback[callback_type] = callback_func; - - /* Set the bit corresponding to the callback_type */ - module_inst->host_registered_callback_mask |= (1 << callback_type); - - return STATUS_OK; -} - -/** - * \brief Unregisters a USB host callback - * - * Unregisters an asynchronous callback implemented by the user. Removing it - * from the internal callback registration table. - * - * \param[in] module_inst Pointer to USB software instance struct - * \param[in] callback_type Callback type given by an enum - * - * \return Status of the de-registration operation. - * \retval STATUS_OK The callback was unregistered successfully. - */ -enum status_code usb_host_unregister_callback(struct usb_module *module_inst, - enum usb_host_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module_inst); - - /* Unregister callback function */ - module_inst->host_callback[callback_type] = NULL; - - /* Clear the bit corresponding to the callback_type */ - module_inst->host_registered_callback_mask &= ~(1 << callback_type); - - return STATUS_OK; -} - -/** - * \brief Enables USB host callback generation for a given type. - * - * Enables asynchronous callbacks for a given logical type. - * This must be called before USB host generate callback events. - * - * \param[in] module_inst Pointer to USB software instance struct - * \param[in] callback_type Callback type given by an enum - * - * \return Status of the callback enable operation. - * \retval STATUS_OK The callback was enabled successfully. - */ -enum status_code usb_host_enable_callback(struct usb_module *module_inst, - enum usb_host_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Enable callback */ - module_inst->host_enabled_callback_mask |= (1 << callback_type); - - if (callback_type == USB_HOST_CALLBACK_SOF) { - module_inst->hw->HOST.INTENSET.reg = USB_HOST_INTENSET_HSOF; - } - if (callback_type == USB_HOST_CALLBACK_RESET) { - module_inst->hw->HOST.INTENSET.reg = USB_HOST_INTENSET_RST; - } - if (callback_type == USB_HOST_CALLBACK_WAKEUP) { - module_inst->hw->HOST.INTENSET.reg = USB_HOST_INTENSET_WAKEUP; - } - if (callback_type == USB_HOST_CALLBACK_DNRSM) { - module_inst->hw->HOST.INTENSET.reg = USB_HOST_INTENSET_DNRSM; - } - if (callback_type == USB_HOST_CALLBACK_UPRSM) { - module_inst->hw->HOST.INTENSET.reg = USB_HOST_INTENSET_UPRSM; - } - if (callback_type == USB_HOST_CALLBACK_RAMACER) { - module_inst->hw->HOST.INTENSET.reg = USB_HOST_INTENSET_RAMACER; - } - if (callback_type == USB_HOST_CALLBACK_CONNECT) { - module_inst->hw->HOST.INTENSET.reg = USB_HOST_INTENSET_DCONN; - } - if (callback_type == USB_HOST_CALLBACK_DISCONNECT) { - module_inst->hw->HOST.INTENSET.reg = USB_HOST_INTENSET_DDISC; - } - - return STATUS_OK; -} - -/** - * \brief Disables USB host callback generation for a given type. - * - * Disables asynchronous callbacks for a given logical type. - * - * \param[in] module_inst Pointer to USB software instance struct - * \param[in] callback_type Callback type given by an enum - * - * \return Status of the callback disable operation. - * \retval STATUS_OK The callback was disabled successfully. - */ -enum status_code usb_host_disable_callback(struct usb_module *module_inst, - enum usb_host_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Disable callback */ - module_inst->host_enabled_callback_mask &= ~(1 << callback_type); - - if (callback_type == USB_HOST_CALLBACK_SOF) { - module_inst->hw->HOST.INTENCLR.reg = USB_HOST_INTENCLR_HSOF; - } - if (callback_type == USB_HOST_CALLBACK_RESET) { - module_inst->hw->HOST.INTENCLR.reg = USB_HOST_INTENCLR_RST; - } - if (callback_type == USB_HOST_CALLBACK_WAKEUP) { - module_inst->hw->HOST.INTENCLR.reg = USB_HOST_INTENCLR_WAKEUP; - } - if (callback_type == USB_HOST_CALLBACK_DNRSM) { - module_inst->hw->HOST.INTENCLR.reg = USB_HOST_INTENCLR_DNRSM; - } - if (callback_type == USB_HOST_CALLBACK_UPRSM) { - module_inst->hw->HOST.INTENCLR.reg = USB_HOST_INTENCLR_UPRSM; - } - if (callback_type == USB_HOST_CALLBACK_RAMACER) { - module_inst->hw->HOST.INTENCLR.reg = USB_HOST_INTENCLR_RAMACER; - } - if (callback_type == USB_HOST_CALLBACK_CONNECT) { - module_inst->hw->HOST.INTENCLR.reg = USB_HOST_INTENCLR_DCONN; - } - if (callback_type == USB_HOST_CALLBACK_DISCONNECT) { - module_inst->hw->HOST.INTENCLR.reg = USB_HOST_INTENCLR_DDISC; - } - - return STATUS_OK; -} - -/** - * \brief Initializes an USB host pipe configuration structure to defaults. - * - * Initializes a given USB host pipe configuration structure to a - * set of known default values. This function should be called on all new - * instances of these configuration structures before being modified by the - * user application. - * - * The default configuration is as follows: - * \li device address is 0 - * \li endpoint address is 0 - * \li pipe type is control - * \li interval is 0 - * \li pipe size is 8 - * - * \param[out] ep_config Configuration structure to initialize to default values - */ -void usb_host_pipe_get_config_defaults(struct usb_host_pipe_config *ep_config) -{ - /* Sanity check arguments */ - Assert(ep_config); - /* Write default config to config struct */ - ep_config->device_address = 0; - ep_config->endpoint_address = 0; - ep_config->pipe_type = USB_HOST_PIPE_TYPE_CONTROL; - ep_config->binterval = 0; - ep_config->size = 8; -} - -/** - * \brief Writes an USB host pipe configuration to the hardware module. - * - * Writes out a given configuration of an USB host pipe - * configuration to the hardware module. If the pipe is already configured, - * the new configuration will replace the existing one. - * - * \param[in] module_inst Pointer to USB software instance struct - * \param[in] pipe_num Pipe to configure - * \param[in] ep_config Configuration settings for the pipe - * - * \return Status of the host pipe configuration operation. - * \retval STATUS_OK The host pipe was configured successfully. - */ -enum status_code usb_host_pipe_set_config(struct usb_module *module_inst, uint8_t pipe_num, - struct usb_host_pipe_config *ep_config) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - Assert(pipe_num < USB_PIPE_NUM); - Assert(ep_config); - - /* set pipe config */ - module_inst->hw->HOST.HostPipe[pipe_num].PCFG.bit.BK = 0; - module_inst->hw->HOST.HostPipe[pipe_num].PCFG.bit.PTYPE = ep_config->pipe_type; - module_inst->hw->HOST.HostPipe[pipe_num].BINTERVAL.reg = - ep_config->binterval; - if (ep_config->endpoint_address == 0) { - module_inst->hw->HOST.HostPipe[pipe_num].PCFG.bit.PTOKEN = - USB_HOST_PIPE_TOKEN_SETUP; - } else if (ep_config->endpoint_address & USB_EP_DIR_IN) { - module_inst->hw->HOST.HostPipe[pipe_num].PCFG.bit.PTOKEN = - USB_HOST_PIPE_TOKEN_IN; - module_inst->hw->HOST.HostPipe[pipe_num].PSTATUSSET.reg = - USB_HOST_PSTATUSSET_BK0RDY; - } else { - module_inst->hw->HOST.HostPipe[pipe_num].PCFG.bit.PTOKEN = - USB_HOST_PIPE_TOKEN_OUT; - module_inst->hw->HOST.HostPipe[pipe_num].PSTATUSCLR.reg = - USB_HOST_PSTATUSCLR_BK0RDY; - } - - memset((uint8_t *)&usb_descriptor_table.usb_pipe_table[pipe_num], 0, - sizeof(usb_descriptor_table.usb_pipe_table[0])); - usb_descriptor_table.usb_pipe_table[pipe_num].HostDescBank[0].CTRL_PIPE.bit.PDADDR = - ep_config->device_address; - usb_descriptor_table.usb_pipe_table[pipe_num].HostDescBank[0].CTRL_PIPE.bit.PEPNUM = - ep_config->endpoint_address & USB_EP_ADDR_MASK; - if (ep_config->size == 1023) { - usb_descriptor_table.usb_pipe_table[pipe_num].HostDescBank[0].PCKSIZE.bit.SIZE = 0x07; - } else { - usb_descriptor_table.usb_pipe_table[pipe_num].HostDescBank[0].PCKSIZE.bit.SIZE = - (32 - clz(((uint32_t)min(max(ep_config->size, 8), 1024) << 1) - 1) - 1 - 3); - } - - /* Clear busy status */ - host_pipe_job_busy_status &= ~(1 << pipe_num); - - return STATUS_OK; -} - -/** - * \brief Gets an USB host pipe configuration. - * - * Gets out the configuration of an USB host pipe from the hardware module. - * - * \param[in] module_inst Pointer to USB software instance struct - * \param[in] pipe_num Pipe to configure - * \param[out] ep_config Configuration settings for the pipe - * - * \return Status of the get host pipe configuration operation. - * \retval STATUS_OK The host pipe configuration was read successfully. - */ -enum status_code usb_host_pipe_get_config(struct usb_module *module_inst, uint8_t pipe_num, - struct usb_host_pipe_config *ep_config) -{ - uint32_t size; - - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - Assert(pipe_num < USB_PIPE_NUM); - Assert(ep_config); - /* get pipe config from setting register */ - ep_config->device_address = - usb_descriptor_table.usb_pipe_table[pipe_num].HostDescBank[0].CTRL_PIPE.bit.PDADDR; - ep_config->endpoint_address = - usb_descriptor_table.usb_pipe_table[pipe_num].HostDescBank[0].CTRL_PIPE.bit.PEPNUM; - - if (module_inst->hw->HOST.HostPipe[pipe_num].PCFG.bit.PTOKEN == - USB_HOST_PIPE_TOKEN_IN) { - ep_config->endpoint_address |= USB_EP_DIR_IN; - } - - ep_config->pipe_type = (enum usb_host_pipe_type)module_inst->hw->HOST.HostPipe[pipe_num].PCFG.bit.PTYPE; - ep_config->binterval = - module_inst->hw->HOST.HostPipe[pipe_num].BINTERVAL.reg; - size = usb_descriptor_table.usb_pipe_table[pipe_num].HostDescBank[0].PCKSIZE.bit.SIZE; - if (size == 0x07) { - ep_config->size = 1023; - } else { - ep_config->size = (8 << size); - } - - return STATUS_OK; -} - -/** - * \brief Registers a USB host pipe callback - * - * Registers a callback function which is implemented by the user. - * - * \note The callback must be enabled by \ref usb_host_pipe_enable_callback, - * in order for the interrupt handler to call it when the conditions for the - * callback type is met. - * - * \param[in] module_inst Pointer to USB software instance struct - * \param[in] pipe_num Pipe to configure - * \param[in] callback_type Callback type given by an enum - * \param[in] callback_func Pointer to callback function - * - * \return Status of the registration operation. - * \retval STATUS_OK The callback was registered successfully. - */ -enum status_code usb_host_pipe_register_callback( - struct usb_module *module_inst, uint8_t pipe_num, - enum usb_host_pipe_callback callback_type, - usb_host_pipe_callback_t callback_func) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(pipe_num < USB_PIPE_NUM); - Assert(callback_func); - - /* Register callback function */ - module_inst->host_pipe_callback[pipe_num][callback_type] = callback_func; - - /* Set the bit corresponding to the callback_type */ - module_inst->host_pipe_registered_callback_mask[pipe_num] |= (1 << callback_type); - - return STATUS_OK; -} - -/** - * \brief Unregisters a USB host pipe callback - * - * Unregisters an asynchronous callback implemented by the user. Removing it - * from the internal callback registration table. - * - * \param[in] module_inst Pointer to USB software instance struct - * \param[in] pipe_num Pipe to configure - * \param[in] callback_type Callback type given by an enum - * - * \return Status of the de-registration operation. - * \retval STATUS_OK The callback was unregistered successfully. - */ -enum status_code usb_host_pipe_unregister_callback( - struct usb_module *module_inst, uint8_t pipe_num, - enum usb_host_pipe_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(pipe_num < USB_PIPE_NUM); - - /* Unregister callback function */ - module_inst->host_pipe_callback[pipe_num][callback_type] = NULL; - - /* Clear the bit corresponding to the callback_type */ - module_inst->host_pipe_registered_callback_mask[pipe_num] &= ~(1 << callback_type); - - return STATUS_OK; -} - -/** - * \brief Enables USB host pipe callback generation for a given type. - * - * Enables asynchronous callbacks for a given logical type. - * This must be called before USB host pipe generate callback events. - * - * \param[in] module_inst Pointer to USB software instance struct - * \param[in] pipe_num Pipe to configure - * \param[in] callback_type Callback type given by an enum - * - * \return Status of the callback enable operation. - * \retval STATUS_OK The callback was enabled successfully. - */ -enum status_code usb_host_pipe_enable_callback( - struct usb_module *module_inst, uint8_t pipe_num, - enum usb_host_pipe_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - Assert(pipe_num < USB_PIPE_NUM); - - /* Enable callback */ - module_inst->host_pipe_enabled_callback_mask[pipe_num] |= (1 << callback_type); - - if (callback_type == USB_HOST_PIPE_CALLBACK_TRANSFER_COMPLETE) { - module_inst->hw->HOST.HostPipe[pipe_num].PINTENSET.reg = USB_HOST_PINTENSET_TRCPT_Msk; - } - if (callback_type == USB_HOST_PIPE_CALLBACK_ERROR) { - module_inst->hw->HOST.HostPipe[pipe_num].PINTENSET.reg = - USB_HOST_PINTENSET_TRFAIL | USB_HOST_PINTENSET_PERR; - } - if (callback_type == USB_HOST_PIPE_CALLBACK_SETUP) { - module_inst->hw->HOST.HostPipe[pipe_num].PINTENSET.reg = USB_HOST_PINTENSET_TXSTP; - } - if (callback_type == USB_HOST_PIPE_CALLBACK_STALL) { - module_inst->hw->HOST.HostPipe[pipe_num].PINTENSET.reg = USB_HOST_PINTENSET_STALL; - } - - return STATUS_OK; -} - -/** - * \brief Disables USB host callback generation for a given type. - * - * Disables asynchronous callbacks for a given logical type. - * - * \param[in] module_inst Pointer to USB software instance struct - * \param[in] pipe_num Pipe to configure - * \param[in] callback_type Callback type given by an enum - * - * \return Status of the callback disable operation. - * \retval STATUS_OK The callback was disabled successfully. - */ -enum status_code usb_host_pipe_disable_callback( - struct usb_module *module_inst, uint8_t pipe_num, - enum usb_host_pipe_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - Assert(pipe_num < USB_PIPE_NUM); - - /* Enable callback */ - module_inst->host_pipe_enabled_callback_mask[pipe_num] &= ~(1 << callback_type); - - if (callback_type == USB_HOST_PIPE_CALLBACK_TRANSFER_COMPLETE) { - module_inst->hw->HOST.HostPipe[pipe_num].PINTENCLR.reg = USB_HOST_PINTENCLR_TRCPT_Msk; - } - if (callback_type == USB_HOST_PIPE_CALLBACK_ERROR) { - module_inst->hw->HOST.HostPipe[pipe_num].PINTENCLR.reg = - USB_HOST_PINTENCLR_TRFAIL| USB_HOST_PINTENCLR_PERR; - } - if (callback_type == USB_HOST_PIPE_CALLBACK_SETUP) { - module_inst->hw->HOST.HostPipe[pipe_num].PINTENCLR.reg = USB_HOST_PINTENCLR_TXSTP; - } - if (callback_type == USB_HOST_PIPE_CALLBACK_STALL) { - module_inst->hw->HOST.HostPipe[pipe_num].PINTENCLR.reg = USB_HOST_PINTENCLR_STALL; - } - - return STATUS_OK; -} - -/** - * \brief Sends the setup package. - * - * Sends the setup package. - * - * \param[in] module_inst Pointer to USB software instance struct - * \param[in] pipe_num Pipe to configure - * \param[in] buf Pointer to data buffer - * - * \return Status of the setup operation. - * \retval STATUS_OK The setup job was set successfully. - * \retval STATUS_BUSY The pipe is busy. - * \retval STATUS_ERR_NOT_INITIALIZED The pipe has not been configured. - */ -enum status_code usb_host_pipe_setup_job(struct usb_module *module_inst, - uint8_t pipe_num, uint8_t *buf) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - Assert(pipe_num < USB_PIPE_NUM); - - if (host_pipe_job_busy_status & (1 << pipe_num)) { - return STATUS_BUSY; - } - - /* Set busy status */ - host_pipe_job_busy_status |= 1 << pipe_num; - - if (module_inst->hw->HOST.HostPipe[pipe_num].PCFG.bit.PTYPE == - USB_HOST_PIPE_TYPE_DISABLE) { - return STATUS_ERR_NOT_INITIALIZED; - } - - /* get pipe config from setting register */ - usb_descriptor_table.usb_pipe_table[pipe_num].HostDescBank[0].ADDR.reg = (uint32_t)buf; - usb_descriptor_table.usb_pipe_table[pipe_num].HostDescBank[0].PCKSIZE.bit.BYTE_COUNT = - 8; - usb_descriptor_table.usb_pipe_table[pipe_num].HostDescBank[0].PCKSIZE.bit.MULTI_PACKET_SIZE = - 0; - module_inst->hw->HOST.HostPipe[pipe_num].PCFG.bit.PTOKEN = - USB_HOST_PIPE_TOKEN_SETUP; - - module_inst->hw->HOST.HostPipe[pipe_num].PSTATUSSET.reg = USB_HOST_PSTATUSSET_BK0RDY; - usb_host_pipe_unfreeze(module_inst, pipe_num); - - return STATUS_OK; -} - -/** - * \brief USB host pipe read job. - * - * USB host pipe read job by set and start an in transaction transfer. - * - * \param[in] module_inst Pointer to USB software instance struct - * \param[in] pipe_num Pipe to configure - * \param[in] buf Pointer to data buffer - * \param[in] buf_size Data buffer size - * \note The buffer length should not larger than 0x3FFF - * - * \return Status of the setting operation. - * \retval STATUS_OK The read job was set successfully. - * \retval STATUS_BUSY The pipe is busy. - * \retval STATUS_ERR_NOT_INITIALIZED The pipe has not been configured. - */ -enum status_code usb_host_pipe_read_job(struct usb_module *module_inst, - uint8_t pipe_num, uint8_t *buf, uint32_t buf_size) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - Assert(pipe_num < USB_PIPE_NUM); - - if (host_pipe_job_busy_status & (1 << pipe_num)) { - return STATUS_BUSY; - } - - /* Set busy status */ - host_pipe_job_busy_status |= 1 << pipe_num; - - if (module_inst->hw->HOST.HostPipe[pipe_num].PCFG.bit.PTYPE == - USB_HOST_PIPE_TYPE_DISABLE) { - return STATUS_ERR_NOT_INITIALIZED; - } - - /* get pipe config from setting register */ - usb_descriptor_table.usb_pipe_table[pipe_num].HostDescBank[0].ADDR.reg = (uint32_t)buf; - usb_descriptor_table.usb_pipe_table[pipe_num].HostDescBank[0].PCKSIZE.bit.BYTE_COUNT = - 0; - usb_descriptor_table.usb_pipe_table[pipe_num].HostDescBank[0].PCKSIZE.bit.MULTI_PACKET_SIZE = - buf_size; - module_inst->hw->HOST.HostPipe[pipe_num].PCFG.bit.PTOKEN = - USB_HOST_PIPE_TOKEN_IN; - - /* Start transfer */ - module_inst->hw->HOST.HostPipe[pipe_num].PSTATUSCLR.reg = USB_HOST_PSTATUSCLR_BK0RDY; - usb_host_pipe_unfreeze(module_inst, pipe_num); - - return STATUS_OK; -} - -/** - * \brief USB host pipe write job. - * - * USB host pipe write job by set and start an out transaction transfer. - * - * \param[in] module_inst Pointer to USB software instance struct - * \param[in] pipe_num Pipe to configure - * \param[in] buf Pointer to data buffer - * \param[in] buf_size Data buffer size - * \note The buffer length should not larger than 0x3FFF - * - * \return Status of the setting operation. - * \retval STATUS_OK The write job was set successfully. - * \retval STATUS_BUSY The pipe is busy. - * \retval STATUS_ERR_NOT_INITIALIZED The pipe has not been configured. - */ -enum status_code usb_host_pipe_write_job(struct usb_module *module_inst, - uint8_t pipe_num, uint8_t *buf, uint32_t buf_size) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - Assert(pipe_num < USB_PIPE_NUM); - - if (host_pipe_job_busy_status & (1 << pipe_num)) { - return STATUS_BUSY; - } - - /* Set busy status */ - host_pipe_job_busy_status |= 1 << pipe_num; - - if (module_inst->hw->HOST.HostPipe[pipe_num].PCFG.bit.PTYPE == - USB_HOST_PIPE_TYPE_DISABLE) { - return STATUS_ERR_NOT_INITIALIZED; - } - - /* get pipe config from setting register */ - usb_descriptor_table.usb_pipe_table[pipe_num].HostDescBank[0].ADDR.reg = (uint32_t)buf; - usb_descriptor_table.usb_pipe_table[pipe_num].HostDescBank[0].PCKSIZE.bit.BYTE_COUNT = - buf_size; - usb_descriptor_table.usb_pipe_table[pipe_num].HostDescBank[0].PCKSIZE.bit.MULTI_PACKET_SIZE = - 0; - module_inst->hw->HOST.HostPipe[pipe_num].PCFG.bit.PTOKEN = - USB_HOST_PIPE_TOKEN_OUT; - - /* Start transfer */ - module_inst->hw->HOST.HostPipe[pipe_num].PSTATUSSET.reg = USB_HOST_PSTATUSSET_BK0RDY; - usb_host_pipe_unfreeze(module_inst, pipe_num); - - return STATUS_OK; -} - -/** - * \brief USB host abort a pipe job. - * - * USB host pipe abort job by freeze the pipe. - * - * \param[in] module_inst Pointer to USB software instance struct - * \param[in] pipe_num Pipe to configure - * - * \return Status of the setting operation. - * \retval STATUS_OK The abort job was set successfully. - * \retval STATUS_ERR_NOT_INITIALIZED The pipe has not been configured. - */ -enum status_code usb_host_pipe_abort_job(struct usb_module *module_inst, uint8_t pipe_num) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - Assert(pipe_num < USB_PIPE_NUM); - - if (module_inst->hw->HOST.HostPipe[pipe_num].PCFG.bit.PTYPE == - USB_HOST_PIPE_TYPE_DISABLE) { - return STATUS_ERR_NOT_INITIALIZED; - } - - module_inst->hw->HOST.HostPipe[pipe_num].PSTATUSSET.reg = USB_HOST_PSTATUSSET_PFREEZE; - - /* Clear busy status */ - host_pipe_job_busy_status &= ~(1 << pipe_num); - - return STATUS_OK; -} - -/** - * \brief Sends the LPM package. - * - * Sends the LPM package. - * - * \param[in] module_inst Pointer to USB software instance struct - * \param[in] pipe_num Pipe to configure - * \param[in] b_remotewakeup Remote wake up flag - * \param[in] hird Host Initiated Resume Duration - * - * \return Status of the setup operation. - * \retval STATUS_OK The setup job was set successfully. - * \retval STATUS_BUSY The pipe is busy. - * \retval STATUS_ERR_NOT_INITIALIZED The pipe has not been configured. - */ -enum status_code usb_host_pipe_lpm_job(struct usb_module *module_inst, - uint8_t pipe_num, bool b_remotewakeup, uint8_t hird) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - Assert(pipe_num < USB_PIPE_NUM); - - if (host_pipe_job_busy_status & (1 << pipe_num)) { - return STATUS_BUSY; - } - - /* Set busy status */ - host_pipe_job_busy_status |= 1 << pipe_num; - - if (module_inst->hw->HOST.HostPipe[pipe_num].PCFG.bit.PTYPE == - USB_HOST_PIPE_TYPE_DISABLE) { - return STATUS_ERR_NOT_INITIALIZED; - } - - module_inst->hw->HOST.HostPipe[pipe_num].PCFG.bit.PTYPE = - USB_HOST_PIPE_TYPE_EXTENDED; - - /* get pipe config from setting register */ - usb_descriptor_table.usb_pipe_table[pipe_num].HostDescBank[0].EXTREG.bit.SUBPID = 0x3; - usb_descriptor_table.usb_pipe_table[pipe_num].HostDescBank[0].EXTREG.bit.VARIABLE = - USB_LPM_ATTRIBUT_REMOTEWAKE(b_remotewakeup) | - USB_LPM_ATTRIBUT_HIRD(hird) | - USB_LPM_ATTRIBUT_BLINKSTATE_L1; - - module_inst->hw->HOST.HostPipe[pipe_num].PSTATUSSET.reg = USB_HOST_PSTATUSSET_BK0RDY; - usb_host_pipe_unfreeze(module_inst, pipe_num); - - return STATUS_OK; -} - -/** - * \internal - * \brief Function called by USB interrupt to manage USB host interrupts - * - * USB host interrupt events are split into four sections: - * - USB line events - * (Device dis/connection, SOF, reset, resume, wakeup, error) - * - Pipe events - * (End of data transfer, setup, stall, error) - */ -static void _usb_host_interrupt_handler(void) -{ - uint32_t pipe_int; - uint32_t flags; - - /* Manage pipe interrupts */ - pipe_int = ctz(_usb_instances->hw->HOST.PINTSMRY.reg); - if (pipe_int < 32) { - /* pipe interrupts */ - - /* get interrupt flags */ - flags = _usb_instances->hw->HOST.HostPipe[pipe_int].PINTFLAG.reg; - - /* host pipe transfer complete interrupt */ - if (flags & USB_HOST_PINTFLAG_TRCPT_Msk) { - /* Clear busy status */ - host_pipe_job_busy_status &= ~(1 << pipe_int); - /* clear the flag */ - _usb_instances->hw->HOST.HostPipe[pipe_int].PINTFLAG.reg = - USB_HOST_PINTFLAG_TRCPT_Msk; - if(_usb_instances->host_pipe_enabled_callback_mask[pipe_int] & - (1 << USB_HOST_PIPE_CALLBACK_TRANSFER_COMPLETE)) { - pipe_callback_para.pipe_num = pipe_int; - if (_usb_instances->hw->HOST.HostPipe[pipe_int].PCFG.bit.PTOKEN == - USB_HOST_PIPE_TOKEN_IN) { - /* in */ - pipe_callback_para.transfered_size = usb_descriptor_table.usb_pipe_table[pipe_int].HostDescBank[0].PCKSIZE.bit.BYTE_COUNT; - pipe_callback_para.required_size = usb_descriptor_table.usb_pipe_table[pipe_int].HostDescBank[0].PCKSIZE.bit.MULTI_PACKET_SIZE; - usb_descriptor_table.usb_pipe_table[pipe_int].HostDescBank[0].PCKSIZE.bit.BYTE_COUNT = 0; - } else { - /* out */ - pipe_callback_para.transfered_size = usb_descriptor_table.usb_pipe_table[pipe_int].HostDescBank[0].PCKSIZE.bit.MULTI_PACKET_SIZE; - pipe_callback_para.required_size = usb_descriptor_table.usb_pipe_table[pipe_int].HostDescBank[0].PCKSIZE.bit.BYTE_COUNT; - usb_descriptor_table.usb_pipe_table[pipe_int].HostDescBank[0].PCKSIZE.bit.MULTI_PACKET_SIZE = 0; - if (0 == pipe_callback_para.transfered_size) { - pipe_callback_para.transfered_size = usb_descriptor_table.usb_pipe_table[pipe_int].HostDescBank[0].PCKSIZE.bit.BYTE_COUNT; - } - } - (_usb_instances->host_pipe_callback[pipe_int] - [USB_HOST_PIPE_CALLBACK_TRANSFER_COMPLETE])(_usb_instances, &pipe_callback_para); - } - } - - /* host pipe transfer fail interrupt */ - if (flags & USB_HOST_PINTFLAG_TRFAIL) { - /* Clear busy status */ - host_pipe_job_busy_status &= ~(1 << pipe_int); - /* clear the flag */ - _usb_instances->hw->HOST.HostPipe[pipe_int].PINTFLAG.reg = - USB_HOST_PINTFLAG_TRFAIL; - } - - /* host pipe error interrupt */ - if (flags & USB_HOST_PINTFLAG_PERR) { - /* Clear busy status */ - host_pipe_job_busy_status &= ~(1 << pipe_int); - /* clear the flag */ - _usb_instances->hw->HOST.HostPipe[pipe_int].PINTFLAG.reg = - USB_HOST_PINTFLAG_PERR; - if(_usb_instances->host_pipe_enabled_callback_mask[pipe_int] & - (1 << USB_HOST_PIPE_CALLBACK_ERROR)) { - pipe_callback_para.pipe_num = pipe_int; - pipe_callback_para.pipe_error_status = - usb_descriptor_table.usb_pipe_table[pipe_int].HostDescBank[0].STATUS_PIPE.reg & 0x1F; - (_usb_instances->host_pipe_callback[pipe_int] - [USB_HOST_PIPE_CALLBACK_ERROR])(_usb_instances, &pipe_callback_para); - } - } - - /* host pipe transmitted setup interrupt */ - if (flags & USB_HOST_PINTFLAG_TXSTP) { - /* Clear busy status */ - host_pipe_job_busy_status &= ~(1 << pipe_int); - /* clear the flag */ - _usb_instances->hw->HOST.HostPipe[pipe_int].PINTFLAG.reg = - USB_HOST_PINTFLAG_TXSTP; - if(_usb_instances->host_pipe_enabled_callback_mask[pipe_int] & - (1 << USB_HOST_PIPE_CALLBACK_SETUP)) { - pipe_callback_para.pipe_num = pipe_int; - pipe_callback_para.transfered_size = usb_descriptor_table.usb_pipe_table[pipe_int].HostDescBank[0].PCKSIZE.bit.MULTI_PACKET_SIZE; - (_usb_instances->host_pipe_callback[pipe_int] - [USB_HOST_PIPE_CALLBACK_SETUP])(_usb_instances, NULL); - } - } - - /* host pipe stall interrupt */ - if (flags & USB_HOST_PINTFLAG_STALL) { - /* Clear busy status */ - host_pipe_job_busy_status &= ~(1 << pipe_int); - /* clear the flag */ - _usb_instances->hw->HOST.HostPipe[pipe_int].PINTFLAG.reg = - USB_HOST_PINTFLAG_STALL; - if(_usb_instances->host_pipe_enabled_callback_mask[pipe_int] & - (1 << USB_HOST_PIPE_CALLBACK_STALL)) { - pipe_callback_para.pipe_num = pipe_int; - (_usb_instances->host_pipe_callback[pipe_int] - [USB_HOST_PIPE_CALLBACK_STALL])(_usb_instances, &pipe_callback_para); - } - } - - } else { - /* host interrupts */ - - /* get interrupt flags */ - flags = _usb_instances->hw->HOST.INTFLAG.reg; - - /* host SOF interrupt */ - if (flags & USB_HOST_INTFLAG_HSOF) { - /* clear the flag */ - _usb_instances->hw->HOST.INTFLAG.reg = USB_HOST_INTFLAG_HSOF; - if(_usb_instances->host_enabled_callback_mask & (1 << USB_HOST_CALLBACK_SOF)) { - (_usb_instances->host_callback[USB_HOST_CALLBACK_SOF])(_usb_instances); - } - } - - /* host reset interrupt */ - if (flags & USB_HOST_INTFLAG_RST) { - /* Clear busy status */ - host_pipe_job_busy_status = 0; - /* clear the flag */ - _usb_instances->hw->HOST.INTFLAG.reg = USB_HOST_INTFLAG_RST; - if(_usb_instances->host_enabled_callback_mask & (1 << USB_HOST_CALLBACK_RESET)) { - (_usb_instances->host_callback[USB_HOST_CALLBACK_RESET])(_usb_instances); - } - } - - /* host upstream resume interrupts */ - if (flags & USB_HOST_INTFLAG_UPRSM) { - /* clear the flags */ - _usb_instances->hw->HOST.INTFLAG.reg = USB_HOST_INTFLAG_UPRSM; - if(_usb_instances->host_enabled_callback_mask & (1 << USB_HOST_CALLBACK_UPRSM)) { - (_usb_instances->host_callback[USB_HOST_CALLBACK_UPRSM])(_usb_instances); - } - } - - /* host downstream resume interrupts */ - if (flags & USB_HOST_INTFLAG_DNRSM) { - /* clear the flags */ - _usb_instances->hw->HOST.INTFLAG.reg = USB_HOST_INTFLAG_DNRSM; - if(_usb_instances->host_enabled_callback_mask & (1 << USB_HOST_CALLBACK_DNRSM)) { - (_usb_instances->host_callback[USB_HOST_CALLBACK_DNRSM])(_usb_instances); - } - } - - /* host wakeup interrupts */ - if (flags & USB_HOST_INTFLAG_WAKEUP) { - /* clear the flags */ - _usb_instances->hw->HOST.INTFLAG.reg = USB_HOST_INTFLAG_WAKEUP; - if(_usb_instances->host_enabled_callback_mask & (1 << USB_HOST_CALLBACK_WAKEUP)) { - (_usb_instances->host_callback[USB_HOST_CALLBACK_WAKEUP])(_usb_instances); - } - } - - /* host ram access interrupt */ - if (flags & USB_HOST_INTFLAG_RAMACER) { - /* Clear busy status */ - host_pipe_job_busy_status = 0; - /* clear the flag */ - _usb_instances->hw->HOST.INTFLAG.reg = USB_HOST_INTFLAG_RAMACER; - if(_usb_instances->host_enabled_callback_mask & (1 << USB_HOST_CALLBACK_RAMACER)) { - (_usb_instances->host_callback[USB_HOST_CALLBACK_RAMACER])(_usb_instances); - } - } - - /* host connect interrupt */ - if (flags & USB_HOST_INTFLAG_DCONN) { - /* Clear busy status */ - host_pipe_job_busy_status = 0; - /* clear the flag */ - _usb_instances->hw->HOST.INTFLAG.reg = USB_HOST_INTFLAG_DCONN; - if(_usb_instances->host_enabled_callback_mask & (1 << USB_HOST_CALLBACK_CONNECT)) { - (_usb_instances->host_callback[USB_HOST_CALLBACK_CONNECT])(_usb_instances); - } - } - - /* host disconnect interrupt */ - if (flags & USB_HOST_INTFLAG_DDISC) { - /* Clear busy status */ - host_pipe_job_busy_status = 0; - /* clear the flag */ - _usb_instances->hw->HOST.INTFLAG.reg = USB_HOST_INTFLAG_DDISC; - if(_usb_instances->host_enabled_callback_mask & (1 << USB_HOST_CALLBACK_DISCONNECT)) { - (_usb_instances->host_callback[USB_HOST_CALLBACK_DISCONNECT])(_usb_instances); - } - } - - } -} - -/** - * \brief Sets USB host pipe auto ZLP setting value - * - * \param[in] module_inst Pointer to USB software instance struct - * \param[in] pipe_num Pipe to configure - * \param[in] value Auto ZLP setting value, \c true to enable - * - */ -void usb_host_pipe_set_auto_zlp(struct usb_module *module_inst, uint8_t pipe_num, bool value) -{ - Assert(module_inst); - - usb_descriptor_table.usb_pipe_table[pipe_num].HostDescBank[0].PCKSIZE.bit.AUTO_ZLP = value; -} -#endif - -/** - * \brief Registers a USB device callback - * - * Registers a callback function which is implemented by the user. - * - * \note The callback must be enabled by \ref usb_device_enable_callback, - * in order for the interrupt handler to call it when the conditions for the - * callback type is met. - * - * \param[in] module_inst Pointer to USB software instance struct - * \param[in] callback_type Callback type given by an enum - * \param[in] callback_func Pointer to callback function - * - * \return Status of the registration operation. - * \retval STATUS_OK The callback was registered successfully. - */ -enum status_code usb_device_register_callback(struct usb_module *module_inst, - enum usb_device_callback callback_type, - usb_device_callback_t callback_func) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(callback_func); - - /* Register callback function */ - module_inst->device_callback[callback_type] = callback_func; - - /* Set the bit corresponding to the callback_type */ - module_inst->device_registered_callback_mask |= _usb_device_irq_bits[callback_type]; - - return STATUS_OK; -} - -/** - * \brief Unregisters a USB device callback - * - * Unregisters an asynchronous callback implemented by the user. Removing it - * from the internal callback registration table. - * - * \param[in] module_inst Pointer to USB software instance struct - * \param[in] callback_type Callback type given by an enum - * - * \return Status of the de-registration operation. - * \retval STATUS_OK The callback was unregistered successfully. - */ -enum status_code usb_device_unregister_callback(struct usb_module *module_inst, - enum usb_device_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module_inst); - - /* Unregister callback function */ - module_inst->device_callback[callback_type] = NULL; - - /* Clear the bit corresponding to the callback_type */ - module_inst->device_registered_callback_mask &= ~_usb_device_irq_bits[callback_type]; - - return STATUS_OK; -} - -/** - * \brief Enables USB device callback generation for a given type. - * - * Enables asynchronous callbacks for a given logical type. - * This must be called before USB device generate callback events. - * - * \param[in] module_inst Pointer to USB software instance struct - * \param[in] callback_type Callback type given by an enum - * - * \return Status of the callback enable operation. - * \retval STATUS_OK The callback was enabled successfully. - */ -enum status_code usb_device_enable_callback(struct usb_module *module_inst, - enum usb_device_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* clear related flag */ - module_inst->hw->DEVICE.INTFLAG.reg = _usb_device_irq_bits[callback_type]; - - /* Enable callback */ - module_inst->device_enabled_callback_mask |= _usb_device_irq_bits[callback_type]; - - module_inst->hw->DEVICE.INTENSET.reg = _usb_device_irq_bits[callback_type]; - - return STATUS_OK; -} - -/** - * \brief Disables USB device callback generation for a given type. - * - * Disables asynchronous callbacks for a given logical type. - * - * \param[in] module_inst Pointer to USB software instance struct - * \param[in] callback_type Callback type given by an enum - * - * \return Status of the callback disable operation. - * \retval STATUS_OK The callback was disabled successfully. - */ -enum status_code usb_device_disable_callback(struct usb_module *module_inst, - enum usb_device_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* Disable callback */ - module_inst->device_enabled_callback_mask &= ~_usb_device_irq_bits[callback_type]; - - module_inst->hw->DEVICE.INTENCLR.reg = _usb_device_irq_bits[callback_type]; - - return STATUS_OK; -} - -/** - * \brief Registers a USB device endpoint callback - * - * Registers a callback function which is implemented by the user. - * - * \note The callback must be enabled by \ref usb_device_endpoint_enable_callback, - * in order for the interrupt handler to call it when the conditions for the - * callback type is met. - * - * \param[in] module_inst Pointer to USB software instance struct - * \param[in] ep_num Endpoint to configure - * \param[in] callback_type Callback type given by an enum - * \param[in] callback_func Pointer to callback function - * - * \return Status of the registration operation. - * \retval STATUS_OK The callback was registered successfully. - */ -enum status_code usb_device_endpoint_register_callback( - struct usb_module *module_inst, uint8_t ep_num, - enum usb_device_endpoint_callback callback_type, - usb_device_endpoint_callback_t callback_func) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(ep_num < USB_EPT_NUM); - Assert(callback_func); - - /* Register callback function */ - module_inst->device_endpoint_callback[ep_num][callback_type] = callback_func; - - /* Set the bit corresponding to the callback_type */ - module_inst->device_endpoint_registered_callback_mask[ep_num] |= _usb_endpoint_irq_bits[callback_type]; - - return STATUS_OK; -} - -/** - * \brief Unregisters a USB device endpoint callback - * - * Unregisters an callback implemented by the user. Removing it - * from the internal callback registration table. - * - * \param[in] module_inst Pointer to USB software instance struct - * \param[in] ep_num Endpoint to configure - * \param[in] callback_type Callback type given by an enum - * - * \return Status of the de-registration operation. - * \retval STATUS_OK The callback was unregistered successfully. - */ -enum status_code usb_device_endpoint_unregister_callback( - struct usb_module *module_inst, uint8_t ep_num, - enum usb_device_endpoint_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(ep_num < USB_EPT_NUM); - - /* Unregister callback function */ - module_inst->device_endpoint_callback[ep_num][callback_type] = NULL; - - /* Clear the bit corresponding to the callback_type */ - module_inst->device_endpoint_registered_callback_mask[ep_num] &= ~_usb_endpoint_irq_bits[callback_type]; - - return STATUS_OK; -} - -/** - * \brief Enables USB device endpoint callback generation for a given type. - * - * Enables callbacks for a given logical type. - * This must be called before USB device pipe generate callback events. - * - * \param[in] module_inst Pointer to USB software instance struct - * \param[in] ep Endpoint to configure - * \param[in] callback_type Callback type given by an enum - * - * \return Status of the callback enable operation. - * \retval STATUS_OK The callback was enabled successfully. - */ -enum status_code usb_device_endpoint_enable_callback( - struct usb_module *module_inst, uint8_t ep, - enum usb_device_endpoint_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - uint8_t ep_num = ep & USB_EP_ADDR_MASK; - Assert(ep_num < USB_EPT_NUM); - - /* Enable callback */ - module_inst->device_endpoint_enabled_callback_mask[ep_num] |= _usb_endpoint_irq_bits[callback_type]; - - if (callback_type == USB_DEVICE_ENDPOINT_CALLBACK_TRCPT) { - if (ep_num == 0) { // control endpoint - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPINTENSET.reg = USB_DEVICE_EPINTENSET_TRCPT0 | USB_DEVICE_EPINTENSET_TRCPT1; - } else if (ep & USB_EP_DIR_IN) { - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPINTENSET.reg = USB_DEVICE_EPINTENSET_TRCPT1; - } else { - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPINTENSET.reg = USB_DEVICE_EPINTENSET_TRCPT0; - } - } - - if (callback_type == USB_DEVICE_ENDPOINT_CALLBACK_TRFAIL) { - if (ep_num == 0) { // control endpoint - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPINTENSET.reg = USB_DEVICE_EPINTENSET_TRFAIL0 | USB_DEVICE_EPINTENSET_TRFAIL1; - } else if (ep & USB_EP_DIR_IN) { - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPINTENSET.reg = USB_DEVICE_EPINTENSET_TRFAIL1; - } else { - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPINTENSET.reg = USB_DEVICE_EPINTENSET_TRFAIL0; - } - } - - if (callback_type == USB_DEVICE_ENDPOINT_CALLBACK_RXSTP) { - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPINTENSET.reg = USB_DEVICE_EPINTENSET_RXSTP; - } - - if (callback_type == USB_DEVICE_ENDPOINT_CALLBACK_STALL) { - if (ep & USB_EP_DIR_IN) { - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPINTENSET.reg = USB_DEVICE_EPINTENSET_STALL1; - } else { - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPINTENSET.reg = USB_DEVICE_EPINTENSET_STALL0; - } - } - - return STATUS_OK; -} - -/** - * \brief Disables USB device endpoint callback generation for a given type. - * - * Disables callbacks for a given logical type. - * - * \param[in] module_inst Pointer to USB software instance struct - * \param[in] ep Endpoint to configure - * \param[in] callback_type Callback type given by an enum - * - * \return Status of the callback disable operation. - * \retval STATUS_OK The callback was disabled successfully. - */ -enum status_code usb_device_endpoint_disable_callback( - struct usb_module *module_inst, uint8_t ep, - enum usb_device_endpoint_callback callback_type) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - uint8_t ep_num = ep & USB_EP_ADDR_MASK; - Assert(ep_num < USB_EPT_NUM); - - /* Enable callback */ - module_inst->device_endpoint_enabled_callback_mask[ep_num] &= ~_usb_endpoint_irq_bits[callback_type]; - - if (callback_type == USB_DEVICE_ENDPOINT_CALLBACK_TRCPT) { - if (ep_num == 0) { // control endpoint - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPINTENCLR.reg = USB_DEVICE_EPINTENCLR_TRCPT0 | USB_DEVICE_EPINTENCLR_TRCPT1; - } else if (ep & USB_EP_DIR_IN) { - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPINTENCLR.reg = USB_DEVICE_EPINTENCLR_TRCPT1; - } else { - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPINTENCLR.reg = USB_DEVICE_EPINTENCLR_TRCPT0; - } - } - - if (callback_type == USB_DEVICE_ENDPOINT_CALLBACK_TRFAIL) { - if (ep_num == 0) { // control endpoint - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPINTENCLR.reg = USB_DEVICE_EPINTENCLR_TRFAIL0 | USB_DEVICE_EPINTENCLR_TRFAIL1; - } else if (ep & USB_EP_DIR_IN) { - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPINTENCLR.reg = USB_DEVICE_EPINTENCLR_TRFAIL1; - } else { - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPINTENCLR.reg = USB_DEVICE_EPINTENCLR_TRFAIL0; - } - } - - if (callback_type == USB_DEVICE_ENDPOINT_CALLBACK_RXSTP) { - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPINTENCLR.reg = USB_DEVICE_EPINTENCLR_RXSTP; - } - - if (callback_type == USB_DEVICE_ENDPOINT_CALLBACK_STALL) { - if (ep & USB_EP_DIR_IN) { - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPINTENCLR.reg = USB_DEVICE_EPINTENCLR_STALL1; - } else { - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPINTENCLR.reg = USB_DEVICE_EPINTENCLR_STALL0; - } - } - - return STATUS_OK; -} - -/** - * \brief Initializes an USB device endpoint configuration structure to defaults. - * - * Initializes a given USB device endpoint configuration structure to a - * set of known default values. This function should be called on all new - * instances of these configuration structures before being modified by the - * user application. - * - * The default configuration is as follows: - * \li endpoint address is 0 - * \li endpoint size is 8 bytes - * \li auto_zlp is false - * \li endpoint type is control - * - * \param[out] ep_config Configuration structure to initialize to default values - */ -void usb_device_endpoint_get_config_defaults(struct usb_device_endpoint_config *ep_config) -{ - /* Sanity check arguments */ - Assert(ep_config); - - /* Write default config to config struct */ - ep_config->ep_address = 0; - ep_config->ep_size = USB_ENDPOINT_8_BYTE; - ep_config->auto_zlp = false; - ep_config->ep_type = USB_DEVICE_ENDPOINT_TYPE_CONTROL; -} - -/** - * \brief Writes an USB device endpoint configuration to the hardware module. - * - * Writes out a given configuration of an USB device endpoint - * configuration to the hardware module. If the pipe is already configured, - * the new configuration will replace the existing one. - * - * \param[in] module_inst Pointer to USB software instance struct - * \param[in] ep_config Configuration settings for the endpoint - * - * \return Status of the device endpoint configuration operation - * \retval STATUS_OK The device endpoint was configured successfully - * \retval STATUS_ERR_DENIED The endpoint address is already configured - */ -enum status_code usb_device_endpoint_set_config(struct usb_module *module_inst, - struct usb_device_endpoint_config *ep_config) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(ep_config); - - uint8_t ep_num = ep_config->ep_address & USB_EP_ADDR_MASK; - uint8_t ep_bank = (ep_config->ep_address & USB_EP_DIR_IN) ? 1 : 0; - - switch (ep_config->ep_type) { - case USB_DEVICE_ENDPOINT_TYPE_DISABLE: - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPCFG.reg = USB_DEVICE_EPCFG_EPTYPE0(0) | USB_DEVICE_EPCFG_EPTYPE1(0); - return STATUS_OK; - - case USB_DEVICE_ENDPOINT_TYPE_CONTROL: - if ((module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPCFG.reg & USB_DEVICE_EPCFG_EPTYPE0_Msk) == 0 && \ - (module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPCFG.reg & USB_DEVICE_EPCFG_EPTYPE1_Msk) == 0) { - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPCFG.reg = USB_DEVICE_EPCFG_EPTYPE0(1) | USB_DEVICE_EPCFG_EPTYPE1(1); - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPSTATUSSET.reg = USB_DEVICE_EPSTATUSSET_BK0RDY; - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPSTATUSCLR.reg = USB_DEVICE_EPSTATUSCLR_BK1RDY; - } else { - return STATUS_ERR_DENIED; - } - if (true == ep_config->auto_zlp) { - usb_descriptor_table.usb_endpoint_table[ep_num].DeviceDescBank[0].PCKSIZE.reg |= USB_DEVICE_PCKSIZE_AUTO_ZLP; - usb_descriptor_table.usb_endpoint_table[ep_num].DeviceDescBank[1].PCKSIZE.reg |= USB_DEVICE_PCKSIZE_AUTO_ZLP; - } else { - usb_descriptor_table.usb_endpoint_table[ep_num].DeviceDescBank[0].PCKSIZE.reg &= ~USB_DEVICE_PCKSIZE_AUTO_ZLP; - usb_descriptor_table.usb_endpoint_table[ep_num].DeviceDescBank[1].PCKSIZE.reg &= ~USB_DEVICE_PCKSIZE_AUTO_ZLP; - } - usb_descriptor_table.usb_endpoint_table[ep_num].DeviceDescBank[0].PCKSIZE.bit.SIZE = ep_config->ep_size; - usb_descriptor_table.usb_endpoint_table[ep_num].DeviceDescBank[1].PCKSIZE.bit.SIZE = ep_config->ep_size; - return STATUS_OK; - - case USB_DEVICE_ENDPOINT_TYPE_ISOCHRONOUS: - if (ep_bank) { - if ((module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPCFG.reg & USB_DEVICE_EPCFG_EPTYPE1_Msk) == 0){ - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPCFG.reg |= USB_DEVICE_EPCFG_EPTYPE1(2); - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPSTATUSCLR.reg = USB_DEVICE_EPSTATUSCLR_BK1RDY; - } else { - return STATUS_ERR_DENIED; - } - } else { - if ((module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPCFG.reg & USB_DEVICE_EPCFG_EPTYPE0_Msk) == 0){ - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPCFG.reg |= USB_DEVICE_EPCFG_EPTYPE0(2); - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPSTATUSSET.reg = USB_DEVICE_EPSTATUSSET_BK0RDY; - } else { - return STATUS_ERR_DENIED; - } - } - break; - - case USB_DEVICE_ENDPOINT_TYPE_BULK: - if (ep_bank) { - if ((module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPCFG.reg & USB_DEVICE_EPCFG_EPTYPE1_Msk) == 0){ - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPCFG.reg |= USB_DEVICE_EPCFG_EPTYPE1(3); - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPSTATUSCLR.reg = USB_DEVICE_EPSTATUSCLR_BK1RDY; - } else { - return STATUS_ERR_DENIED; - } - } else { - if ((module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPCFG.reg & USB_DEVICE_EPCFG_EPTYPE0_Msk) == 0){ - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPCFG.reg |= USB_DEVICE_EPCFG_EPTYPE0(3); - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPSTATUSSET.reg = USB_DEVICE_EPSTATUSSET_BK0RDY; - } else { - return STATUS_ERR_DENIED; - } - } - break; - - case USB_DEVICE_ENDPOINT_TYPE_INTERRUPT: - if (ep_bank) { - if ((module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPCFG.reg & USB_DEVICE_EPCFG_EPTYPE1_Msk) == 0){ - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPCFG.reg |= USB_DEVICE_EPCFG_EPTYPE1(4); - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPSTATUSCLR.reg = USB_DEVICE_EPSTATUSCLR_BK1RDY; - } else { - return STATUS_ERR_DENIED; - } - } else { - if ((module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPCFG.reg & USB_DEVICE_EPCFG_EPTYPE0_Msk) == 0){ - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPCFG.reg |= USB_DEVICE_EPCFG_EPTYPE0(4); - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPSTATUSSET.reg = USB_DEVICE_EPSTATUSSET_BK0RDY; - } else { - return STATUS_ERR_DENIED; - } - } - break; - - default: - break; - } - - usb_descriptor_table.usb_endpoint_table[ep_num].DeviceDescBank[ep_bank].PCKSIZE.bit.SIZE = ep_config->ep_size; - - if (true == ep_config->auto_zlp) { - usb_descriptor_table.usb_endpoint_table[ep_num].DeviceDescBank[ep_bank].PCKSIZE.reg |= USB_DEVICE_PCKSIZE_AUTO_ZLP; - } else { - usb_descriptor_table.usb_endpoint_table[ep_num].DeviceDescBank[ep_bank].PCKSIZE.reg &= ~USB_DEVICE_PCKSIZE_AUTO_ZLP; - } - - return STATUS_OK; -} - -/** - * \brief Check if current endpoint is configured - * - * \param module_inst Pointer to USB software instance struct - * \param ep Endpoint address (direction & number) - * - * \return \c true if endpoint is configured and ready to use - */ -bool usb_device_endpoint_is_configured(struct usb_module *module_inst, uint8_t ep) -{ - uint8_t ep_num = ep & USB_EP_ADDR_MASK; - uint8_t flag; - - if (ep & USB_EP_DIR_IN) { - flag = (uint8_t)(module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPCFG.bit.EPTYPE1); - } else { - flag = (uint8_t)(module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPCFG.bit.EPTYPE0); - } - return ((enum usb_device_endpoint_type)(flag) != USB_DEVICE_ENDPOINT_TYPE_DISABLE); -} - - -/** - * \brief Abort ongoing job on the endpoint - * - * \param module_inst Pointer to USB software instance struct - * \param ep Endpoint address - */ -void usb_device_endpoint_abort_job(struct usb_module *module_inst, uint8_t ep) -{ - uint8_t ep_num; - ep_num = ep & USB_EP_ADDR_MASK; - - // Stop transfer - if (ep & USB_EP_DIR_IN) { - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPSTATUSCLR.reg = USB_DEVICE_EPSTATUSCLR_BK1RDY; - // Eventually ack a transfer occur during abort - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_TRCPT1; - } else { - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPSTATUSSET.reg = USB_DEVICE_EPSTATUSSET_BK0RDY; - // Eventually ack a transfer occur during abort - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_TRCPT0; - } -} - -/** - * \brief Check if endpoint is halted - * - * \param module_inst Pointer to USB software instance struct - * \param ep Endpoint address - * - * \return \c true if the endpoint is halted - */ -bool usb_device_endpoint_is_halted(struct usb_module *module_inst, uint8_t ep) -{ - uint8_t ep_num = ep & USB_EP_ADDR_MASK; - - if (ep & USB_EP_DIR_IN) { - return (module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPSTATUS.reg & USB_DEVICE_EPSTATUSSET_STALLRQ1); - } else { - return (module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPSTATUS.reg & USB_DEVICE_EPSTATUSSET_STALLRQ0); - } -} - -/** - * \brief Halt the endpoint (send STALL) - * - * \param module_inst Pointer to USB software instance struct - * \param ep Endpoint address - */ -void usb_device_endpoint_set_halt(struct usb_module *module_inst, uint8_t ep) -{ - uint8_t ep_num = ep & USB_EP_ADDR_MASK; - - // Stall endpoint - if (ep & USB_EP_DIR_IN) { - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPSTATUSSET.reg = USB_DEVICE_EPSTATUSSET_STALLRQ1; - } else { - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPSTATUSSET.reg = USB_DEVICE_EPSTATUSSET_STALLRQ0; - } -} - -/** - * \brief Clear endpoint halt state - * - * \param module_inst Pointer to USB software instance struct - * \param ep Endpoint address - */ -void usb_device_endpoint_clear_halt(struct usb_module *module_inst, uint8_t ep) -{ - uint8_t ep_num = ep & USB_EP_ADDR_MASK; - - if (ep & USB_EP_DIR_IN) { - if (module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPSTATUS.reg & USB_DEVICE_EPSTATUSSET_STALLRQ1) { - // Remove stall request - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPSTATUSCLR.reg = USB_DEVICE_EPSTATUSCLR_STALLRQ1; - if (module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPINTFLAG.reg & USB_DEVICE_EPINTFLAG_STALL1) { - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_STALL1; - // The Stall has occurred, then reset data toggle - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPSTATUSCLR.reg = USB_DEVICE_EPSTATUSSET_DTGLIN; - } - } - } else { - if (module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPSTATUS.reg & USB_DEVICE_EPSTATUSSET_STALLRQ0) { - // Remove stall request - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPSTATUSCLR.reg = USB_DEVICE_EPSTATUSCLR_STALLRQ0; - if (module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPINTFLAG.reg & USB_DEVICE_EPINTFLAG_STALL0) { - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_STALL0; - // The Stall has occurred, then reset data toggle - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPSTATUSCLR.reg = USB_DEVICE_EPSTATUSSET_DTGLOUT; - } - } - } -} - -/** - * \brief Start write buffer job on a endpoint - * - * \param module_inst Pointer to USB module instance - * \param ep_num Endpoint number - * \param pbuf Pointer to buffer - * \param buf_size Size of buffer - * - * \return Status of procedure - * \retval STATUS_OK Job started successfully - * \retval STATUS_ERR_DENIED Endpoint is not ready - */ -enum status_code usb_device_endpoint_write_buffer_job(struct usb_module *module_inst,uint8_t ep_num, - uint8_t* pbuf, uint32_t buf_size) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - Assert(ep_num < USB_EPT_NUM); - - uint8_t flag; - flag = (uint8_t)(module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPCFG.bit.EPTYPE1); - if ((enum usb_device_endpoint_type)(flag) == USB_DEVICE_ENDPOINT_TYPE_DISABLE) { - return STATUS_ERR_DENIED; - }; - - /* get endpoint configuration from setting register */ - usb_descriptor_table.usb_endpoint_table[ep_num].DeviceDescBank[1].ADDR.reg = (uint32_t)pbuf; - usb_descriptor_table.usb_endpoint_table[ep_num].DeviceDescBank[1].PCKSIZE.bit.MULTI_PACKET_SIZE = 0; - usb_descriptor_table.usb_endpoint_table[ep_num].DeviceDescBank[1].PCKSIZE.bit.BYTE_COUNT = buf_size; - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPSTATUSSET.reg = USB_DEVICE_EPSTATUSSET_BK1RDY; - - return STATUS_OK; -} - -/** - * \brief Start read buffer job on a endpoint - * - * \param module_inst Pointer to USB module instance - * \param ep_num Endpoint number - * \param pbuf Pointer to buffer - * \param buf_size Size of buffer - * - * \return Status of procedure - * \retval STATUS_OK Job started successfully - * \retval STATUS_ERR_DENIED Endpoint is not ready - */ -enum status_code usb_device_endpoint_read_buffer_job(struct usb_module *module_inst,uint8_t ep_num, - uint8_t* pbuf, uint32_t buf_size) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - Assert(ep_num < USB_EPT_NUM); - - uint8_t flag; - flag = (uint8_t)(module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPCFG.bit.EPTYPE0); - if ((enum usb_device_endpoint_type)(flag) == USB_DEVICE_ENDPOINT_TYPE_DISABLE) { - return STATUS_ERR_DENIED; - }; - - /* get endpoint configuration from setting register */ - usb_descriptor_table.usb_endpoint_table[ep_num].DeviceDescBank[0].ADDR.reg = (uint32_t)pbuf; - usb_descriptor_table.usb_endpoint_table[ep_num].DeviceDescBank[0].PCKSIZE.bit.MULTI_PACKET_SIZE = buf_size; - usb_descriptor_table.usb_endpoint_table[ep_num].DeviceDescBank[0].PCKSIZE.bit.BYTE_COUNT = 0; - module_inst->hw->DEVICE.DeviceEndpoint[ep_num].EPSTATUSCLR.reg = USB_DEVICE_EPSTATUSCLR_BK0RDY; - - return STATUS_OK; -} - -/** - * \brief Start setup packet read job on a endpoint - * - * \param module_inst Pointer to USB device module instance - * \param pbuf Pointer to buffer - * - * \return Status of procedure - * \retval STATUS_OK Job started successfully - * \retval STATUS_ERR_DENIED Endpoint is not ready - */ -enum status_code usb_device_endpoint_setup_buffer_job(struct usb_module *module_inst, - uint8_t* pbuf) -{ - /* Sanity check arguments */ - Assert(module_inst); - Assert(module_inst->hw); - - /* get endpoint configuration from setting register */ - usb_descriptor_table.usb_endpoint_table[0].DeviceDescBank[0].ADDR.reg = (uint32_t)pbuf; - usb_descriptor_table.usb_endpoint_table[0].DeviceDescBank[0].PCKSIZE.bit.MULTI_PACKET_SIZE = 8; - usb_descriptor_table.usb_endpoint_table[0].DeviceDescBank[0].PCKSIZE.bit.BYTE_COUNT = 0; - module_inst->hw->DEVICE.DeviceEndpoint[0].EPSTATUSCLR.reg = USB_DEVICE_EPSTATUSCLR_BK0RDY; - - return STATUS_OK; -} - -static void _usb_device_interrupt_handler(void) -{ - uint16_t ep_inst; - uint16_t flags, flags_run; - ep_inst = _usb_instances->hw->DEVICE.EPINTSMRY.reg; - - /* device interrupt */ - if (0 == ep_inst) { - int i; - - /* get interrupt flags */ - flags = _usb_instances->hw->DEVICE.INTFLAG.reg; - flags_run = flags & - _usb_instances->device_enabled_callback_mask & - _usb_instances->device_registered_callback_mask; - - for (i = 0; i < USB_DEVICE_CALLBACK_N; i ++) { - if (flags & _usb_device_irq_bits[i]) { - _usb_instances->hw->DEVICE.INTFLAG.reg = - _usb_device_irq_bits[i]; - } - if (flags_run & _usb_device_irq_bits[i]) { - if (i == USB_DEVICE_CALLBACK_LPMSUSP) { - device_callback_lpm_wakeup_enable = - usb_descriptor_table.usb_endpoint_table[0].DeviceDescBank[0].EXTREG.bit.VARIABLE - & USB_LPM_ATTRIBUT_REMOTEWAKE_MASK; - } - (_usb_instances->device_callback[i])(_usb_instances, &device_callback_lpm_wakeup_enable); - } - } - - } else { - /* endpoint interrupt */ - - for (uint8_t i = 0; i < USB_EPT_NUM; i++) { - - if (ep_inst & (1 << i)) { - flags = _usb_instances->hw->DEVICE.DeviceEndpoint[i].EPINTFLAG.reg; - flags_run = flags & - _usb_instances->device_endpoint_enabled_callback_mask[i] & - _usb_instances->device_endpoint_registered_callback_mask[i]; - - // endpoint transfer stall interrupt - if (flags & USB_DEVICE_EPINTFLAG_STALL_Msk) { - if (_usb_instances->hw->DEVICE.DeviceEndpoint[i].EPINTFLAG.reg & USB_DEVICE_EPINTFLAG_STALL1) { - _usb_instances->hw->DEVICE.DeviceEndpoint[i].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_STALL1; - ep_callback_para.endpoint_address = USB_EP_DIR_IN | i; - } else if (_usb_instances->hw->DEVICE.DeviceEndpoint[i].EPINTFLAG.reg & USB_DEVICE_EPINTFLAG_STALL0) { - _usb_instances->hw->DEVICE.DeviceEndpoint[i].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_STALL0; - ep_callback_para.endpoint_address = USB_EP_DIR_OUT | i; - } - - if (flags_run & USB_DEVICE_EPINTFLAG_STALL_Msk) { - (_usb_instances->device_endpoint_callback[i][USB_DEVICE_ENDPOINT_CALLBACK_STALL])(_usb_instances,&ep_callback_para); - } - return; - } - - // endpoint received setup interrupt - if (flags & USB_DEVICE_EPINTFLAG_RXSTP) { - _usb_instances->hw->DEVICE.DeviceEndpoint[i].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_RXSTP; - if(_usb_instances->device_endpoint_enabled_callback_mask[i] & _usb_endpoint_irq_bits[USB_DEVICE_ENDPOINT_CALLBACK_RXSTP]) { - ep_callback_para.received_bytes = (uint16_t)(usb_descriptor_table.usb_endpoint_table[i].DeviceDescBank[0].PCKSIZE.bit.BYTE_COUNT); - (_usb_instances->device_endpoint_callback[i][USB_DEVICE_ENDPOINT_CALLBACK_RXSTP])(_usb_instances,&ep_callback_para); - } - return; - } - - // endpoint transfer complete interrupt - if (flags & USB_DEVICE_EPINTFLAG_TRCPT_Msk) { - if (_usb_instances->hw->DEVICE.DeviceEndpoint[i].EPINTFLAG.reg & USB_DEVICE_EPINTFLAG_TRCPT1) { - _usb_instances->hw->DEVICE.DeviceEndpoint[i].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_TRCPT1; - ep_callback_para.endpoint_address = USB_EP_DIR_IN | i; - ep_callback_para.sent_bytes = (uint16_t)(usb_descriptor_table.usb_endpoint_table[i].DeviceDescBank[1].PCKSIZE.bit.BYTE_COUNT); - - } else if (_usb_instances->hw->DEVICE.DeviceEndpoint[i].EPINTFLAG.reg & USB_DEVICE_EPINTFLAG_TRCPT0) { - _usb_instances->hw->DEVICE.DeviceEndpoint[i].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_TRCPT0; - ep_callback_para.endpoint_address = USB_EP_DIR_OUT | i; - ep_callback_para.received_bytes = (uint16_t)(usb_descriptor_table.usb_endpoint_table[i].DeviceDescBank[0].PCKSIZE.bit.BYTE_COUNT); - ep_callback_para.out_buffer_size = (uint16_t)(usb_descriptor_table.usb_endpoint_table[i].DeviceDescBank[0].PCKSIZE.bit.MULTI_PACKET_SIZE); - } - if(flags_run & USB_DEVICE_EPINTFLAG_TRCPT_Msk) { - (_usb_instances->device_endpoint_callback[i][USB_DEVICE_ENDPOINT_CALLBACK_TRCPT])(_usb_instances,&ep_callback_para); - } - return; - } - - // endpoint transfer fail interrupt - if (flags & USB_DEVICE_EPINTFLAG_TRFAIL_Msk) { - if (_usb_instances->hw->DEVICE.DeviceEndpoint[i].EPINTFLAG.reg & USB_DEVICE_EPINTFLAG_TRFAIL1) { - _usb_instances->hw->DEVICE.DeviceEndpoint[i].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_TRFAIL1; - if (usb_descriptor_table.usb_endpoint_table[i].DeviceDescBank[1].STATUS_BK.reg & USB_DEVICE_STATUS_BK_ERRORFLOW) { - usb_descriptor_table.usb_endpoint_table[i].DeviceDescBank[1].STATUS_BK.reg &= ~USB_DEVICE_STATUS_BK_ERRORFLOW; - } - ep_callback_para.endpoint_address = USB_EP_DIR_IN | i; - if (_usb_instances->hw->DEVICE.DeviceEndpoint[i].EPINTFLAG.reg & USB_DEVICE_EPINTFLAG_TRCPT1) { - return; - } - } else if(_usb_instances->hw->DEVICE.DeviceEndpoint[i].EPINTFLAG.reg & USB_DEVICE_EPINTFLAG_TRFAIL0) { - _usb_instances->hw->DEVICE.DeviceEndpoint[i].EPINTFLAG.reg = USB_DEVICE_EPINTFLAG_TRFAIL0; - if (usb_descriptor_table.usb_endpoint_table[i].DeviceDescBank[0].STATUS_BK.reg & USB_DEVICE_STATUS_BK_ERRORFLOW) { - usb_descriptor_table.usb_endpoint_table[i].DeviceDescBank[0].STATUS_BK.reg &= ~USB_DEVICE_STATUS_BK_ERRORFLOW; - } - ep_callback_para.endpoint_address = USB_EP_DIR_OUT | i; - if (_usb_instances->hw->DEVICE.DeviceEndpoint[i].EPINTFLAG.reg & USB_DEVICE_EPINTFLAG_TRCPT0) { - return; - } - } - - if(flags_run & USB_DEVICE_EPINTFLAG_TRFAIL_Msk) { - (_usb_instances->device_endpoint_callback[i][USB_DEVICE_ENDPOINT_CALLBACK_TRFAIL])(_usb_instances,&ep_callback_para); - } - return; - } - } - } - } -} - -/** - * \brief Enable the USB module peripheral - * - * \param module_inst pointer to USB module instance - */ -void usb_enable(struct usb_module *module_inst) -{ - Assert(module_inst); - Assert(module_inst->hw); - - module_inst->hw->DEVICE.CTRLA.reg |= USB_CTRLA_ENABLE; - while (module_inst->hw->DEVICE.SYNCBUSY.reg == USB_SYNCBUSY_ENABLE); -} - -/** - * \brief Disable the USB module peripheral - * - * \param module_inst pointer to USB module instance - */ -void usb_disable(struct usb_module *module_inst) -{ - Assert(module_inst); - Assert(module_inst->hw); - - module_inst->hw->DEVICE.INTENCLR.reg = USB_DEVICE_INTENCLR_MASK; - module_inst->hw->DEVICE.INTFLAG.reg = USB_DEVICE_INTFLAG_MASK; - module_inst->hw->DEVICE.CTRLA.reg &= ~USB_CTRLA_ENABLE; - while (module_inst->hw->DEVICE.SYNCBUSY.reg == USB_SYNCBUSY_ENABLE); -} - -/** - * \brief Interrupt handler for the USB module. - */ -void USB_Handler(void) -{ - if (_usb_instances->hw->DEVICE.CTRLA.bit.MODE) { -#if !SAMD11 - /*host mode ISR */ - _usb_host_interrupt_handler(); -#endif - } else { - /*device mode ISR */ - _usb_device_interrupt_handler(); - } -} - -/** - * \brief Get the default USB module settings - * - * \param[out] module_config Configuration structure to initialize to default values - */ -void usb_get_config_defaults(struct usb_config *module_config) -{ - Assert(module_config); - - /* Sanity check arguments */ - Assert(module_config); - /* Write default configuration to config struct */ - module_config->select_host_mode = 0; - module_config->run_in_standby = 1; - module_config->source_generator = GCLK_GENERATOR_0; - module_config->speed_mode = USB_SPEED_FULL; -} - -#define NVM_USB_PAD_TRANSN_POS 45 -#define NVM_USB_PAD_TRANSN_SIZE 5 -#define NVM_USB_PAD_TRANSP_POS 50 -#define NVM_USB_PAD_TRANSP_SIZE 5 -#define NVM_USB_PAD_TRIM_POS 55 -#define NVM_USB_PAD_TRIM_SIZE 3 - -/** - * \brief Initializes USB module instance - * - * Enables the clock and initializes the USB module, based on the given - * configuration values. - * - * \param[in,out] module_inst Pointer to the software module instance struct - * \param[in] hw Pointer to the USB hardware module - * \param[in] module_config Pointer to the USB configuration options struct - * - * \return Status of the initialization procedure. - * - * \retval STATUS_OK The module was initialized successfully - */ -enum status_code usb_init(struct usb_module *module_inst, Usb *const hw, - struct usb_config *module_config) -{ - /* Sanity check arguments */ - Assert(hw); - Assert(module_inst); - Assert(module_config); - - uint32_t i,j; - uint32_t pad_transn, pad_transp, pad_trim; - struct system_pinmux_config pin_config; - struct system_gclk_chan_config gclk_chan_config; - -#if !SAMD11 - host_pipe_job_busy_status = 0; -#endif - - _usb_instances = module_inst; - - /* Associate the software module instance with the hardware module */ - module_inst->hw = hw; - - /* Turn on the digital interface clock */ - system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBB, PM_APBBMASK_USB); - - /* Set up the USB DP/DN pins */ - system_pinmux_get_config_defaults(&pin_config); - pin_config.mux_position = MUX_PA24G_USB_DM; - system_pinmux_pin_set_config(PIN_PA24G_USB_DM, &pin_config); - pin_config.mux_position = MUX_PA25G_USB_DP; - system_pinmux_pin_set_config(PIN_PA25G_USB_DP, &pin_config); - - /* Setup clock for module */ - system_gclk_chan_get_config_defaults(&gclk_chan_config); - gclk_chan_config.source_generator = module_config->source_generator; - system_gclk_chan_set_config(USB_GCLK_ID, &gclk_chan_config); - system_gclk_chan_enable(USB_GCLK_ID); - - /* Reset */ - hw->DEVICE.CTRLA.bit.SWRST = 1; - while (hw->DEVICE.SYNCBUSY.bit.SWRST) { - /* Sync wait */ - } - - /* Change QOS values to have the best performance and correct USB behaviour */ - USB->DEVICE.QOSCTRL.bit.CQOS = 2; - USB->DEVICE.QOSCTRL.bit.DQOS = 2; - - /* Load Pad Calibration */ - pad_transn =( *((uint32_t *)(NVMCTRL_OTP4) - + (NVM_USB_PAD_TRANSN_POS / 32)) - >> (NVM_USB_PAD_TRANSN_POS % 32)) - & ((1 << NVM_USB_PAD_TRANSN_SIZE) - 1); - - if (pad_transn == 0x1F) { - pad_transn = 5; - } - - hw->DEVICE.PADCAL.bit.TRANSN = pad_transn; - - pad_transp =( *((uint32_t *)(NVMCTRL_OTP4) - + (NVM_USB_PAD_TRANSP_POS / 32)) - >> (NVM_USB_PAD_TRANSP_POS % 32)) - & ((1 << NVM_USB_PAD_TRANSP_SIZE) - 1); - - if (pad_transp == 0x1F) { - pad_transp = 29; - } - - hw->DEVICE.PADCAL.bit.TRANSP = pad_transp; - - pad_trim =( *((uint32_t *)(NVMCTRL_OTP4) - + (NVM_USB_PAD_TRIM_POS / 32)) - >> (NVM_USB_PAD_TRIM_POS % 32)) - & ((1 << NVM_USB_PAD_TRIM_SIZE) - 1); - - if (pad_trim == 0x7) { - pad_trim = 3; - } - - hw->DEVICE.PADCAL.bit.TRIM = pad_trim; - - /* Set the configuration */ - hw->DEVICE.CTRLA.bit.MODE = module_config->select_host_mode; - hw->DEVICE.CTRLA.bit.RUNSTDBY = module_config->run_in_standby; - hw->DEVICE.DESCADD.reg = (uint32_t)(&usb_descriptor_table.usb_endpoint_table[0]); - if (USB_SPEED_FULL == module_config->speed_mode) { - module_inst->hw->DEVICE.CTRLB.bit.SPDCONF = USB_DEVICE_CTRLB_SPDCONF_FS_Val; - } else if(USB_SPEED_LOW == module_config->speed_mode) { - module_inst->hw->DEVICE.CTRLB.bit.SPDCONF = USB_DEVICE_CTRLB_SPDCONF_LS_Val; - } - - memset((uint8_t *)(&usb_descriptor_table.usb_endpoint_table[0]), 0, - sizeof(usb_descriptor_table.usb_endpoint_table)); - -#if !SAMD11 - /* callback related init */ - for (i = 0; i < USB_HOST_CALLBACK_N; i++) { - module_inst->host_callback[i] = NULL; - }; - for (i = 0; i < USB_PIPE_NUM; i++) { - for (j = 0; j < USB_HOST_PIPE_CALLBACK_N; j++) { - module_inst->host_pipe_callback[i][j] = NULL; - } - }; - module_inst->host_registered_callback_mask = 0; - module_inst->host_enabled_callback_mask = 0; - for (i = 0; i < USB_PIPE_NUM; i++) { - module_inst->host_pipe_registered_callback_mask[i] = 0; - module_inst->host_pipe_enabled_callback_mask[i] = 0; - } -#endif - - /* device callback related */ - for (i = 0; i < USB_DEVICE_CALLBACK_N; i++) { - module_inst->device_callback[i] = NULL; - } - for (i = 0; i < USB_EPT_NUM; i++) { - for(j = 0; j < USB_DEVICE_EP_CALLBACK_N; j++) { - module_inst->device_endpoint_callback[i][j] = NULL; - } - } - module_inst->device_registered_callback_mask = 0; - module_inst->device_enabled_callback_mask = 0; - for (j = 0; j < USB_EPT_NUM; j++) { - module_inst->device_endpoint_registered_callback_mask[j] = 0; - module_inst->device_endpoint_enabled_callback_mask[j] = 0; - } - - /* Enable interrupts for this USB module */ - system_interrupt_enable(SYSTEM_INTERRUPT_MODULE_USB); - - return STATUS_OK; -} - - |
