aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/AVR/MEGA/LLD/SPIv1
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/MEGA/LLD/SPIv1
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/MEGA/LLD/SPIv1')
-rw-r--r--os/hal/ports/AVR/MEGA/LLD/SPIv1/hal_spi_lld.c70
-rw-r--r--os/hal/ports/AVR/MEGA/LLD/SPIv1/hal_spi_lld.h40
2 files changed, 55 insertions, 55 deletions
diff --git a/os/hal/ports/AVR/MEGA/LLD/SPIv1/hal_spi_lld.c b/os/hal/ports/AVR/MEGA/LLD/SPIv1/hal_spi_lld.c
index e8d772e20..1a4dce95d 100644
--- a/os/hal/ports/AVR/MEGA/LLD/SPIv1/hal_spi_lld.c
+++ b/os/hal/ports/AVR/MEGA/LLD/SPIv1/hal_spi_lld.c
@@ -26,15 +26,15 @@
#if HAL_USE_SPI || defined(__DOXYGEN__)
-/*===========================================================================*/
-/* Driver local definitions. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver local definitions. */
+/*==========================================================================*/
#define DUMMY_SPI_SEND_VALUE 0xFF
-/*===========================================================================*/
-/* Driver exported variables. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver exported variables. */
+/*==========================================================================*/
/**
* @brief SPI1 driver identifier.
@@ -43,17 +43,17 @@
SPIDriver SPID1;
#endif
-/*===========================================================================*/
-/* Driver local variables and types. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver local variables and types. */
+/*==========================================================================*/
-/*===========================================================================*/
-/* Driver local functions. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver local functions. */
+/*==========================================================================*/
-/*===========================================================================*/
-/* Driver interrupt handlers. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver interrupt handlers. */
+/*==========================================================================*/
#if AVR_SPI_USE_SPI1 || defined(__DOXYGEN__)
/**
@@ -66,16 +66,16 @@ OSAL_IRQ_HANDLER(SPI_STC_vect) {
SPIDriver *spip = &SPID1;
- /* a new value has arrived, store it if we are interested in it */
+ /* A new value has arrived, store it if we are interested in it. */
if (spip->rxbuf) spip->rxbuf[spip->exidx] = SPDR;
- /* check if we are done */
+ /* Check if we are done. */
if (++(spip->exidx) >= spip->exbytes) {
_spi_isr_code(spip);
- } else { /* if not done send the next byte */
- if (spip->txbuf) { /* if there is a buffer with values to be send then use it*/
+ } else { /* If not done send the next byte. */
+ if (spip->txbuf) { /* If there is a buffer with values to be send then use it. */
SPDR = spip->txbuf[spip->exidx];
- } else { /* if there isn't a buffer with values to be send then send a the dummy value*/
+ } else { /* If there isn't a buffer with values to be send then send a the dummy value. */
SPDR = DUMMY_SPI_SEND_VALUE;
}
}
@@ -95,7 +95,7 @@ OSAL_IRQ_HANDLER(SPI_STC_vect) {
void spi_lld_init(void) {
#if AVR_SPI_USE_SPI1
- /* Driver initialization.*/
+ /* Driver initialization. */
spiObjectInit(&SPID1);
#endif /* AVR_SPI_USE_SPI1 */
}
@@ -112,10 +112,10 @@ void spi_lld_start(SPIDriver *spip) {
uint8_t dummy;
if (spip->state == SPI_STOP) {
- /* Enables the peripheral.*/
+ /* Enables the peripheral. */
#if AVR_SPI_USE_SPI1
if (&SPID1 == spip) {
- /* Enable SPI clock using Power Reduction Register */
+ /* Enable SPI clock using Power Reduction Register. */
#if defined(PRR0)
PRR0 &= ~(1 << PRSPI);
#elif defined(PRR)
@@ -127,20 +127,20 @@ void spi_lld_start(SPIDriver *spip) {
#if AVR_SPI_USE_SPI1
if (&SPID1 == spip) {
- /* Configures the peripheral.*/
+ /* Configures the peripheral. */
/* Note that some bits are forced:
SPI interrupt disabled,
SPI enabled,
- SPI master enabled */
+ SPI master enabled. */
SPCR = (spip->config->spcr & ~(SPI_CR_SPIE)) | SPI_CR_MSTR | SPI_CR_SPE;
SPSR = spip->config->spsr;
- /* dummy reads before enabling interrupt */
+ /* Dummy reads before enabling interrupt. */
dummy = SPSR;
dummy = SPDR;
- (void) dummy; /* suppress warning about unused variable */
+ (void) dummy; /* Suppress warning about unused variable. */
- /* Enable SPI interrupts */
+ /* Enable SPI interrupts. */
SPCR |= SPI_CR_SPIE;
}
#endif /* AVR_SPI_USE_SPI1 */
@@ -156,14 +156,14 @@ void spi_lld_start(SPIDriver *spip) {
void spi_lld_stop(SPIDriver *spip) {
if (spip->state == SPI_READY) {
- /* Resets the peripheral.*/
+ /* Resets the peripheral. */
- /* Disables the peripheral.*/
+ /* Disables the peripheral. */
#if AVR_SPI_USE_SPI1
if (&SPID1 == spip) {
SPCR &= (SPI_CR_SPIE | SPI_CR_SPE);
}
-/* Disable SPI clock using Power Reduction Register */
+/* Disable SPI clock using Power Reduction Register. */
#if defined(PRR0)
PRR0 |= (1 << PRSPI);
#elif defined(PRR)
@@ -251,7 +251,7 @@ uint16_t spi_lld_polled_exchange(SPIDriver *spip, uint16_t frame) {
uint8_t dummy;
(void)spip;
- /* disable interrupt */
+ /* Disable interrupt. */
SPCR &= ~(SPI_CR_SPIE);
SPDR = frame >> 8;
@@ -264,7 +264,7 @@ uint16_t spi_lld_polled_exchange(SPIDriver *spip, uint16_t frame) {
dummy = SPSR;
dummy = SPDR;
- (void) dummy; /* suppress warning about unused variable */
+ (void) dummy; /* Suppress warning about unused variable. */
SPCR |= SPI_CR_SPIE;
return spdr;
@@ -276,7 +276,7 @@ uint8_t spi_lld_polled_exchange(SPIDriver *spip, uint8_t frame) {
uint8_t dummy;
(void)spip;
- /* disable interrupt */
+ /* Disable interrupt. */
SPCR &= ~(SPI_CR_SPIE);
SPDR = frame;
@@ -285,7 +285,7 @@ uint8_t spi_lld_polled_exchange(SPIDriver *spip, uint8_t frame) {
dummy = SPSR;
dummy = SPDR;
- (void) dummy; /* suppress warning about unused variable */
+ (void) dummy; /* Suppress warning about unused variable. */
SPCR |= SPI_CR_SPIE;
return spdr;
diff --git a/os/hal/ports/AVR/MEGA/LLD/SPIv1/hal_spi_lld.h b/os/hal/ports/AVR/MEGA/LLD/SPIv1/hal_spi_lld.h
index ca0e15543..4617a1cfb 100644
--- a/os/hal/ports/AVR/MEGA/LLD/SPIv1/hal_spi_lld.h
+++ b/os/hal/ports/AVR/MEGA/LLD/SPIv1/hal_spi_lld.h
@@ -27,9 +27,9 @@
#if HAL_USE_SPI || defined(__DOXYGEN__)
-/*===========================================================================*/
-/* Driver constants. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver constants. */
+/*==========================================================================*/
/**
* @name SPI Configuration Register
@@ -72,9 +72,9 @@
#define SPI_SR_SCK_FOSC_128 (0 << SPI2X)
/** @} */
-/*===========================================================================*/
-/* Driver pre-compile time settings. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver pre-compile time settings. */
+/*==========================================================================*/
/**
* @name Configuration options
@@ -89,13 +89,13 @@
#endif
/** @} */
-/*===========================================================================*/
-/* Derived constants and error checks. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Derived constants and error checks. */
+/*==========================================================================*/
-/*===========================================================================*/
-/* Driver data structures and types. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver data structures and types. */
+/*==========================================================================*/
/**
* @brief Type of a structure representing an SPI driver.
@@ -120,7 +120,7 @@ typedef struct {
* @brief Operation complete callback.
*/
spicallback_t end_cb;
- /* End of the mandatory fields.*/
+ /* End of the mandatory fields. */
/**
* @brief Port used of Slave Select
*/
@@ -168,7 +168,7 @@ struct SPIDriver {
#if defined(SPI_DRIVER_EXT_FIELDS)
SPI_DRIVER_EXT_FIELDS
#endif
- /* End of the mandatory fields.*/
+ /* End of the mandatory fields. */
/**
* @brief Pointer to the buffer with data to send.
*/
@@ -187,9 +187,9 @@ struct SPIDriver {
size_t exidx;
};
-/*===========================================================================*/
-/* Driver macros. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* Driver macros. */
+/*==========================================================================*/
/**
* @brief Ignores data on the SPI bus.
@@ -234,9 +234,9 @@ struct SPIDriver {
*/
#define spi_lld_receive(spip, n, rxbuf) spi_lld_exchange(spip, n, NULL, rxbuf)
-/*===========================================================================*/
-/* External declarations. */
-/*===========================================================================*/
+/*==========================================================================*/
+/* External declarations. */
+/*==========================================================================*/
#if AVR_SPI_USE_SPI1 && !defined(__DOXYGEN__)
extern SPIDriver SPID1;