aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/AVR/TINY/LLD
diff options
context:
space:
mode:
authorTheodore Ateba <tf.ateba@gmail.com>2018-01-20 22:33:54 +0000
committerTheodore Ateba <tf.ateba@gmail.com>2018-01-20 22:33:54 +0000
commit282bc3a8f0c8357737dda060c24abb439763ffd6 (patch)
treee88d9a5b4ae6ab463a7fc42c47ebb290b240597c /os/hal/ports/AVR/TINY/LLD
parent386f0d66f7aa1df1e62ec3a95f10d6c70693a9a4 (diff)
downloadChibiOS-282bc3a8f0c8357737dda060c24abb439763ffd6.tar.gz
ChibiOS-282bc3a8f0c8357737dda060c24abb439763ffd6.tar.bz2
ChibiOS-282bc3a8f0c8357737dda060c24abb439763ffd6.zip
AVR: Cleanup code source.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@11377 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/ports/AVR/TINY/LLD')
-rw-r--r--os/hal/ports/AVR/TINY/LLD/GPIOv1/hal_pal_lld.c40
-rw-r--r--os/hal/ports/AVR/TINY/LLD/GPIOv1/hal_pal_lld.h2
-rw-r--r--os/hal/ports/AVR/TINY/LLD/TIMv1/hal_st_lld.c55
-rw-r--r--os/hal/ports/AVR/TINY/LLD/TIMv1/hal_st_lld.h53
-rw-r--r--os/hal/ports/AVR/TINY/LLD/USARTv1/hal_uart_lld.c42
5 files changed, 94 insertions, 98 deletions
diff --git a/os/hal/ports/AVR/TINY/LLD/GPIOv1/hal_pal_lld.c b/os/hal/ports/AVR/TINY/LLD/GPIOv1/hal_pal_lld.c
index 71be6cb92..74260ee9e 100644
--- a/os/hal/ports/AVR/TINY/LLD/GPIOv1/hal_pal_lld.c
+++ b/os/hal/ports/AVR/TINY/LLD/GPIOv1/hal_pal_lld.c
@@ -26,25 +26,25 @@
#if HAL_USE_PAL || defined(__DOXYGEN__)
-/*===========================================================================*/
-/* Driver exported variables. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver exported variables. */
+/*==========================================================================*/
-/*===========================================================================*/
-/* Driver local variables and types. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver local variables and types. */
+/*==========================================================================*/
-/*===========================================================================*/
-/* Driver local functions. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver local functions. */
+/*==========================================================================*/
-/*===========================================================================*/
-/* Driver interrupt handlers. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver interrupt handlers. */
+/*==========================================================================*/
-/*===========================================================================*/
-/* Driver exported functions. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver exported functions. */
+/*==========================================================================*/
/**
* @brief AVR GPIO ports configuration.
@@ -117,9 +117,9 @@ void _pal_lld_init(const PALConfig *config) {
* @details This function programs a pads group belonging to the same port
* with the specified mode.
*
- * @param[in] port the port identifier
- * @param[in] mask the group mask
- * @param[in] mode the mode
+ * @param[in] port the port identifier
+ * @param[in] mask the group mask
+ * @param[in] mode the mode
*
* @note This function is not meant to be invoked directly by the application
* code.
@@ -129,9 +129,9 @@ void _pal_lld_init(const PALConfig *config) {
*
* @notapi
*/
-void _pal_lld_setgroupmode(ioportid_t port,
+void _pal_lld_setgroupmode(ioportid_t port,
ioportmask_t mask,
- iomode_t mode) {
+ iomode_t mode) {
switch (mode) {
case PAL_MODE_RESET:
diff --git a/os/hal/ports/AVR/TINY/LLD/GPIOv1/hal_pal_lld.h b/os/hal/ports/AVR/TINY/LLD/GPIOv1/hal_pal_lld.h
index d3ec65ee9..ffffde6b6 100644
--- a/os/hal/ports/AVR/TINY/LLD/GPIOv1/hal_pal_lld.h
+++ b/os/hal/ports/AVR/TINY/LLD/GPIOv1/hal_pal_lld.h
@@ -282,7 +282,7 @@ typedef uint8_t ioeventmode_t;
/**
* @brief Low level PAL subsystem initialization.
*
- * @param[in] config the architecture-dependent ports configuration
+ * @param[in] config the architecture-dependent ports configuration
*
* @notapi
*/
diff --git a/os/hal/ports/AVR/TINY/LLD/TIMv1/hal_st_lld.c b/os/hal/ports/AVR/TINY/LLD/TIMv1/hal_st_lld.c
index 1c804de76..58d4089d8 100644
--- a/os/hal/ports/AVR/TINY/LLD/TIMv1/hal_st_lld.c
+++ b/os/hal/ports/AVR/TINY/LLD/TIMv1/hal_st_lld.c
@@ -161,7 +161,7 @@ OSAL_IRQ_HANDLER(TIMER1_COMPA_vect) {
OSAL_IRQ_PROLOGUE();
- // TODO: reset status if required
+ /* TODO: reset status if required. */
osalSysLockFromISR();
osalOsTimerHandlerI();
@@ -189,15 +189,15 @@ void st_lld_init(void) {
* Periodic mode uses Timer 1 (16 bit).
*/
- /* CTC mode, no clock source */
+ /* CTC mode, no clock source. */
TCCR1A = 0;
TCCR1B = _BV(WGM12);
- /* start disabled */
+ /* Start disabled. */
TCCR1C = 0;
OCR1A = 0;
TCNT1 = 0;
- TIFR_REG = _BV(OCF1A); /* Reset pending. */
+ TIFR_REG = _BV(OCF1A); /* Reset pending. */
TIMSK_REG = 0;
TCCR1B = PRESCALER;
@@ -208,38 +208,39 @@ void st_lld_init(void) {
/*
* Periodic mode uses Timer 0 (8 bit).
*/
-#if defined(TCCR0B) /* Timer has multiple output comparators */
- TCCR0A = (1 << WGM01) | (0 << WGM00) | /* CTC mode. */
- (0 << COM0A1) | (0 << COM0A0); /* OC0A disabled. */
- //(0 << COM0B1) | (0 << COM0B0); /* OC0B disabled. */
- // FIXME: See if the line bellow must be delate or recoded.
- //TCCR0B = (0 << WGM02) | AVR_TIMER_PRESCALER_BITS; /* CTC mode. */
+#if defined(TCCR0B) /* Timer has multiple output comparators. */
+ TCCR0A = (1 << WGM01) | (0 << WGM00) | /* CTC mode. */
+ (0 << COM0A1) | (0 << COM0A0); /* OC0A disabled. */
+ //(0 << COM0B1) | (0 << COM0B0); /* OC0B disabled. */
+ /* FIXME: See if the line bellow must be delate or recoded. */
+ //TCCR0B = (0 << WGM02) | AVR_TIMER_PRESCALER_BITS; /* CTC mode. */
OCR0A = AVR_TIMER_COUNTER - 1;
- TCNT0 = 0; /* Reset counter. */
+ TCNT0 = 0; /* Reset counter. */
#if defined(__AVR_ATtiny85__)
- TIFR = (1 << OCF0A); /* Reset pending. */
- TIMSK = (1 << OCIE0A); /* IRQ on compare. */
+ TIFR = (1 << OCF0A); /* Reset pending. */
+ TIMSK = (1 << OCIE0A); /* IRQ on compare. */
#else
- TIFR0 = (1 << OCF0A); /* Reset pending. */
- TIMSK0 = (1 << OCIE0A); /* IRQ on compare. */
+ TIFR0 = (1 << OCF0A); /* Reset pending. */
+ TIMSK0 = (1 << OCIE0A); /* IRQ on compare. */
#endif
-#elif defined(TCCR0A) /* AT90CAN doesn't have TCCR0B and slightly different TCCR0A */
- TCCR0A = (1 << WGM01) | (0 << WGM00) | /* CTC mode. */
- (0 << COM0A1) | (0 << COM0A0); /* OC0A disabled. */
+#elif defined(TCCR0A) /* AT90CAN doesn't have TCCR0B and slightly different */
+ /* TCCR0A. */
+ TCCR0A = (1 << WGM01) | (0 << WGM00) | /* CTC mode. */
+ (0 << COM0A1) | (0 << COM0A0); /* OC0A disabled. */
OCR0A = AVR_TIMER_COUNTER - 1;
- TCNT0 = 0; /* Reset counter. */
- TIFR0 = (1 << OCF0A); /* Reset pending. */
- TIMSK0 = (1 << OCIE0A); /* IRQ on compare. */
+ TCNT0 = 0; /* Reset counter. */
+ TIFR0 = (1 << OCF0A); /* Reset pending. */
+ TIMSK0 = (1 << OCIE0A); /* IRQ on compare. */
-#elif defined(TCCR0) /* Timer has single output comparator */
- TCCR0 = (1 << WGM01) | (0 << WGM00) | /* CTC mode. */
- (0 << COM01) | (0 << COM00) | /* OC0A disabled. */
+#elif defined(TCCR0) /* Timer has single output comparator */
+ TCCR0 = (1 << WGM01) | (0 << WGM00) | /* CTC mode. */
+ (0 << COM01) | (0 << COM00) | /* OC0A disabled. */
AVR_TIMER_PRESCALER_BITS;
OCR0 = AVR_TIMER_COUNTER - 1;
- TCNT0 = 0; /* Reset counter. */
- TIFR = (1 << OCF0); /* Reset pending. */
- TIMSK = (1 << OCIE0); /* IRQ on compare. */
+ TCNT0 = 0; /* Reset counter. */
+ TIFR = (1 << OCF0); /* Reset pending. */
+ TIMSK = (1 << OCIE0); /* IRQ on compare. */
#else
#error "Neither TCCR0A nor TCCR0 registers are defined"
#endif
diff --git a/os/hal/ports/AVR/TINY/LLD/TIMv1/hal_st_lld.h b/os/hal/ports/AVR/TINY/LLD/TIMv1/hal_st_lld.h
index 69ceeeec3..1dc678cf9 100644
--- a/os/hal/ports/AVR/TINY/LLD/TIMv1/hal_st_lld.h
+++ b/os/hal/ports/AVR/TINY/LLD/TIMv1/hal_st_lld.h
@@ -29,38 +29,33 @@
#include <avr/io.h>
-/*===========================================================================*/
-/* Driver constants. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver constants. */
+/*==========================================================================*/
-/*===========================================================================*/
-/* Driver pre-compile time settings. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver pre-compile time settings. */
+/*==========================================================================*/
-/*
- * TODO: for models that have many timers,
- * could add AVR_ST_USE_TIMER
- */
+/* TODO: for models that have many timers, could add AVR_ST_USE_TIMER. */
-/*===========================================================================*/
-/* Derived constants and error checks. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Derived constants and error checks. */
+/*==========================================================================*/
-/*
- * TODO: error checks for valid timer selected
- */
+/* TODO: error checks for valid timer selected. */
-/*===========================================================================*/
-/* Driver data structures and types. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver data structures and types. */
+/*==========================================================================*/
-/*===========================================================================*/
-/* Driver macros. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver macros. */
+/*==========================================================================*/
-/*===========================================================================*/
-/* External declarations. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* External declarations. */
+/*==========================================================================*/
#ifdef __cplusplus
extern "C" {
@@ -79,9 +74,9 @@ extern "C" {
#define TIMSK_REG TIMSK1
#endif
-/*===========================================================================*/
-/* Driver inline functions. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver inline functions. */
+/*==========================================================================*/
/**
* @brief Returns the time counter value.
@@ -154,7 +149,7 @@ static inline systime_t st_lld_get_alarm(void) {
*
* @return The alarm status.
* @retval false if the alarm is not active.
- * @retval true is the alarm is active
+ * @retval true is the alarm is active.
*
* @notapi
*/
diff --git a/os/hal/ports/AVR/TINY/LLD/USARTv1/hal_uart_lld.c b/os/hal/ports/AVR/TINY/LLD/USARTv1/hal_uart_lld.c
index e207dacc7..0fdff3292 100644
--- a/os/hal/ports/AVR/TINY/LLD/USARTv1/hal_uart_lld.c
+++ b/os/hal/ports/AVR/TINY/LLD/USARTv1/hal_uart_lld.c
@@ -31,13 +31,13 @@
/*==========================================================================*/
#define UBRR(b) (((F_CPU / b) >> 5) - 1)
-/*===========================================================================*/
-/* Driver local definitions. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver local definitions. */
+/*==========================================================================*/
-/*===========================================================================*/
-/* Driver exported variables. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver exported variables. */
+/*==========================================================================*/
/** @brief USART1 UART driver identifier.*/
#if AVR_UART_USE_USART1 || defined(__DOXYGEN__)
@@ -49,13 +49,13 @@ UARTDriver UARTD1;
UARTDriver UARTD2;
#endif
-/*===========================================================================*/
-/* Driver local variables and types. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver local variables and types. */
+/*==========================================================================*/
-/*===========================================================================*/
-/* Driver local functions. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver local functions. */
+/*==========================================================================*/
/**
* @brief USART de-initialization.
@@ -94,9 +94,9 @@ static void usart_start(UARTDriver *uartp) {
#endif
}
-/*===========================================================================*/
-/* Driver interrupt handlers. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver interrupt handlers. */
+/*==========================================================================*/
#if AVR_UART_USE_USART1 || defined(__DOXYGEN__)
/**
@@ -108,15 +108,15 @@ OSAL_IRQ_HANDLER(LIN_TC_vect) {
OSAL_IRQ_PROLOGUE();
- // TODO: Manage the UART IRQ.
+ /* TODO: Manage the UART IRQ. */
OSAL_IRQ_EPILOGUE();
}
#endif /* AVR_UART_USE_USART1 */
-/*===========================================================================*/
-/* Driver exported functions. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver exported functions. */
+/*==========================================================================*/
/**
* @brief Low level UART driver initialization.
@@ -196,7 +196,7 @@ void uart_lld_start_send(UARTDriver *uartp, size_t n, const uint8_t *txbuf) {
#if AVR_UART_USE_USART1
if (&UARTD1 == uartp) {
/* Starting transfer.*/
- while(n--) {
+ while (n--) {
while (LINSIR & (1 << LBUSY));
LINDAT = *txbuf;
txbuf++;
@@ -219,7 +219,7 @@ void uart_lld_start_send(UARTDriver *uartp, size_t n, const uint8_t *txbuf) {
void uart_lld_start_receive(UARTDriver *uartp, size_t n, void *rxbuf) {
/* Stopping previous activity (idle state).*/
- // TODO: Implement this function.
+ /* TODO: Implement this function. */
}
#endif /* HAL_USE_UART */