2014-11-01 17:02:44 +00:00
|
|
|
/*
|
2016-03-18 10:29:35 +00:00
|
|
|
ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
|
2014-11-01 17:02:44 +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
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2016-04-02 07:59:24 +00:00
|
|
|
* @file hal_gpt_lld.c
|
2014-11-02 16:38:13 +00:00
|
|
|
* @brief PLATFORM GPT subsystem low level driver source.
|
2014-11-01 17:02:44 +00:00
|
|
|
*
|
|
|
|
* @addtogroup GPT
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "hal.h"
|
|
|
|
|
2015-03-09 10:48:08 +00:00
|
|
|
#if (HAL_USE_GPT == TRUE) || defined(__DOXYGEN__)
|
2014-11-01 17:02:44 +00:00
|
|
|
|
|
|
|
/*===========================================================================*/
|
|
|
|
/* Driver local definitions. */
|
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
/*===========================================================================*/
|
|
|
|
/* Driver exported variables. */
|
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief GPTD1 driver identifier.
|
|
|
|
*/
|
2015-03-09 10:48:08 +00:00
|
|
|
#if (PLATFORM_GPT_USE_GPT1 == TRUE) || defined(__DOXYGEN__)
|
2014-11-01 17:02:44 +00:00
|
|
|
GPTDriver GPTD1;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*===========================================================================*/
|
|
|
|
/* Driver local variables and types. */
|
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
/*===========================================================================*/
|
|
|
|
/* Driver local functions. */
|
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
/*===========================================================================*/
|
|
|
|
/* Driver interrupt handlers. */
|
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
/*===========================================================================*/
|
|
|
|
/* Driver exported functions. */
|
|
|
|
/*===========================================================================*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Low level GPT driver initialization.
|
|
|
|
*
|
|
|
|
* @notapi
|
|
|
|
*/
|
|
|
|
void gpt_lld_init(void) {
|
|
|
|
|
2015-03-09 10:48:08 +00:00
|
|
|
#if PLATFORM_GPT_USE_GPT1 == TRUE
|
2014-11-01 17:02:44 +00:00
|
|
|
/* Driver initialization.*/
|
|
|
|
gptObjectInit(&GPTD1);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Configures and activates the GPT peripheral.
|
|
|
|
*
|
|
|
|
* @param[in] gptp pointer to the @p GPTDriver object
|
|
|
|
*
|
|
|
|
* @notapi
|
|
|
|
*/
|
|
|
|
void gpt_lld_start(GPTDriver *gptp) {
|
|
|
|
|
|
|
|
if (gptp->state == GPT_STOP) {
|
|
|
|
/* Enables the peripheral.*/
|
2015-03-09 10:48:08 +00:00
|
|
|
#if PLATFORM_GPT_USE_GPT1 == TRUE
|
2014-11-01 17:02:44 +00:00
|
|
|
if (&GPTD1 == gptp) {
|
|
|
|
|
|
|
|
}
|
2015-03-09 10:48:08 +00:00
|
|
|
#endif
|
2014-11-01 17:02:44 +00:00
|
|
|
}
|
|
|
|
/* Configures the peripheral.*/
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Deactivates the GPT peripheral.
|
|
|
|
*
|
|
|
|
* @param[in] gptp pointer to the @p GPTDriver object
|
|
|
|
*
|
|
|
|
* @notapi
|
|
|
|
*/
|
|
|
|
void gpt_lld_stop(GPTDriver *gptp) {
|
|
|
|
|
|
|
|
if (gptp->state == GPT_READY) {
|
|
|
|
/* Resets the peripheral.*/
|
|
|
|
|
|
|
|
/* Disables the peripheral.*/
|
2015-03-09 10:48:08 +00:00
|
|
|
#if PLATFORM_GPT_USE_GPT1 == TRUE
|
2014-11-01 17:02:44 +00:00
|
|
|
if (&GPTD1 == gptp) {
|
|
|
|
|
|
|
|
}
|
2015-03-09 10:48:08 +00:00
|
|
|
#endif
|
2014-11-01 17:02:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Starts the timer in continuous mode.
|
|
|
|
*
|
|
|
|
* @param[in] gptp pointer to the @p GPTDriver object
|
|
|
|
* @param[in] interval period in ticks
|
|
|
|
*
|
|
|
|
* @notapi
|
|
|
|
*/
|
|
|
|
void gpt_lld_start_timer(GPTDriver *gptp, gptcnt_t interval) {
|
|
|
|
|
|
|
|
(void)gptp;
|
|
|
|
(void)interval;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Stops the timer.
|
|
|
|
*
|
|
|
|
* @param[in] gptp pointer to the @p GPTDriver object
|
|
|
|
*
|
|
|
|
* @notapi
|
|
|
|
*/
|
|
|
|
void gpt_lld_stop_timer(GPTDriver *gptp) {
|
|
|
|
|
|
|
|
(void)gptp;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Starts the timer in one shot mode and waits for completion.
|
|
|
|
* @details This function specifically polls the timer waiting for completion
|
|
|
|
* in order to not have extra delays caused by interrupt servicing,
|
|
|
|
* this function is only recommended for short delays.
|
|
|
|
*
|
|
|
|
* @param[in] gptp pointer to the @p GPTDriver object
|
|
|
|
* @param[in] interval time interval in ticks
|
|
|
|
*
|
|
|
|
* @notapi
|
|
|
|
*/
|
|
|
|
void gpt_lld_polled_delay(GPTDriver *gptp, gptcnt_t interval) {
|
|
|
|
|
|
|
|
(void)gptp;
|
|
|
|
(void)interval;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2015-03-09 10:48:08 +00:00
|
|
|
#endif /* HAL_USE_GPT == TRUE */
|
2014-11-01 17:02:44 +00:00
|
|
|
|
|
|
|
/** @} */
|