2009-11-29 08:50:13 +00:00
|
|
|
/*
|
2013-03-30 10:32:37 +00:00
|
|
|
ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
|
2009-11-29 08:50:13 +00:00
|
|
|
|
2013-03-30 10:32:37 +00:00
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
2009-11-29 08:50:13 +00:00
|
|
|
|
2013-03-30 10:32:37 +00:00
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
2009-11-29 08:50:13 +00:00
|
|
|
|
2013-03-30 10:32:37 +00:00
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
2009-11-29 08:50:13 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2010-02-06 16:17:30 +00:00
|
|
|
* @file templates/xxx_lld.c
|
|
|
|
* @brief XXX Driver subsystem low level driver source template.
|
|
|
|
*
|
2010-10-25 18:48:13 +00:00
|
|
|
* @addtogroup XXX
|
2009-11-29 08:50:13 +00:00
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2009-12-07 16:13:01 +00:00
|
|
|
#include "ch.h"
|
|
|
|
#include "hal.h"
|
2009-11-29 08:50:13 +00:00
|
|
|
|
2010-11-01 17:29:56 +00:00
|
|
|
#if HAL_USE_XXX || defined(__DOXYGEN__)
|
2009-12-08 15:33:39 +00:00
|
|
|
|
2011-08-26 13:47:22 +00:00
|
|
|
/*===========================================================================*/
|
|
|
|
/* Driver local definitions. */
|
|
|
|
/*===========================================================================*/
|
|
|
|
|
2009-11-29 08:50:13 +00:00
|
|
|
/*===========================================================================*/
|
2009-12-29 11:12:05 +00:00
|
|
|
/* Driver exported variables. */
|
2009-11-29 08:50:13 +00:00
|
|
|
/*===========================================================================*/
|
|
|
|
|
2013-02-25 11:58:40 +00:00
|
|
|
/**
|
|
|
|
* @brief XXX1 driver identifier.
|
|
|
|
*/
|
2013-02-24 10:07:54 +00:00
|
|
|
#if PLATFORM_XXX_USE_XXX1 || defined(__DOXYGEN__)
|
|
|
|
XXXDriver XXXD1;
|
|
|
|
#endif
|
|
|
|
|
2009-11-29 08:50:13 +00:00
|
|
|
/*===========================================================================*/
|
2013-02-28 16:23:19 +00:00
|
|
|
/* Driver local types. */
|
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
/*===========================================================================*/
|
|
|
|
/* Driver local variables and types. */
|
2009-11-29 08:50:13 +00:00
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
/*===========================================================================*/
|
2009-12-29 11:12:05 +00:00
|
|
|
/* Driver local functions. */
|
2009-11-29 08:50:13 +00:00
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
/*===========================================================================*/
|
2009-12-29 11:12:05 +00:00
|
|
|
/* Driver interrupt handlers. */
|
2009-11-29 08:50:13 +00:00
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
/*===========================================================================*/
|
2009-12-29 11:12:05 +00:00
|
|
|
/* Driver exported functions. */
|
2009-11-29 08:50:13 +00:00
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
/**
|
2010-02-06 16:17:30 +00:00
|
|
|
* @brief Low level XXX driver initialization.
|
2010-10-04 17:16:18 +00:00
|
|
|
*
|
|
|
|
* @notapi
|
2009-11-29 08:50:13 +00:00
|
|
|
*/
|
|
|
|
void xxx_lld_init(void) {
|
|
|
|
|
2013-02-24 10:07:54 +00:00
|
|
|
#if PLATFORM_XXX_USE_XXX1
|
|
|
|
/* Driver initialization.*/
|
|
|
|
xxxObjectInit(&XXXD1);
|
|
|
|
#endif /* PLATFORM_XXX_USE_XXX1 */
|
2009-11-29 08:50:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-02-06 16:17:30 +00:00
|
|
|
* @brief Configures and activates the XXX peripheral.
|
2009-11-29 08:50:13 +00:00
|
|
|
*
|
2010-02-06 16:17:30 +00:00
|
|
|
* @param[in] xxxp pointer to the @p XXXDriver object
|
2010-10-04 17:16:18 +00:00
|
|
|
*
|
|
|
|
* @notapi
|
2009-11-29 08:50:13 +00:00
|
|
|
*/
|
|
|
|
void xxx_lld_start(XXXDriver *xxxp) {
|
|
|
|
|
2011-02-28 18:44:46 +00:00
|
|
|
if (xxxp->state == XXX_STOP) {
|
2013-02-27 10:42:09 +00:00
|
|
|
/* Enables the peripheral.*/
|
2013-02-24 10:07:54 +00:00
|
|
|
#if PLATFORM_XXX_USE_XXX1
|
|
|
|
if (&XXXD1 == xxxp) {
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif /* PLATFORM_XXX_USE_XXX1 */
|
2009-11-29 08:50:13 +00:00
|
|
|
}
|
2013-02-24 10:07:54 +00:00
|
|
|
/* Configures the peripheral.*/
|
|
|
|
|
2009-11-29 08:50:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2010-02-06 16:17:30 +00:00
|
|
|
* @brief Deactivates the XXX peripheral.
|
2009-11-29 08:50:13 +00:00
|
|
|
*
|
2010-02-06 16:17:30 +00:00
|
|
|
* @param[in] xxxp pointer to the @p XXXDriver object
|
2010-10-04 17:16:18 +00:00
|
|
|
*
|
|
|
|
* @notapi
|
2009-11-29 08:50:13 +00:00
|
|
|
*/
|
|
|
|
void xxx_lld_stop(XXXDriver *xxxp) {
|
|
|
|
|
2011-02-28 18:44:46 +00:00
|
|
|
if (xxxp->state == XXX_READY) {
|
2013-02-24 10:07:54 +00:00
|
|
|
/* Resets the peripheral.*/
|
|
|
|
|
|
|
|
/* Disables the peripheral.*/
|
|
|
|
#if PLATFORM_XXX_USE_XXX1
|
|
|
|
if (&XXXD1 == xxxp) {
|
2011-02-28 18:44:46 +00:00
|
|
|
|
2013-02-24 10:07:54 +00:00
|
|
|
}
|
|
|
|
#endif /* PLATFORM_XXX_USE_XXX1 */
|
2011-02-28 18:44:46 +00:00
|
|
|
}
|
2009-11-29 08:50:13 +00:00
|
|
|
}
|
|
|
|
|
2010-11-01 17:29:56 +00:00
|
|
|
#endif /* HAL_USE_XXX */
|
2009-12-08 15:33:39 +00:00
|
|
|
|
2009-11-29 08:50:13 +00:00
|
|
|
/** @} */
|