aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/templates
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-10-11 11:48:03 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-10-11 11:48:03 +0000
commit7c2a8e13d969029fb675e67c57349c1deaa09284 (patch)
treeb5ac48d0272cccf258c22f658f9589bcf0f6cc1c /os/hal/templates
parent8cbeb405b96f12df958a75bcbc1af072ceb0e26e (diff)
downloadChibiOS-7c2a8e13d969029fb675e67c57349c1deaa09284.tar.gz
ChibiOS-7c2a8e13d969029fb675e67c57349c1deaa09284.tar.bz2
ChibiOS-7c2a8e13d969029fb675e67c57349c1deaa09284.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@2246 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/templates')
-rw-r--r--os/hal/templates/halconf.h16
-rw-r--r--os/hal/templates/spi_lld.c16
-rw-r--r--os/hal/templates/spi_lld.h12
-rw-r--r--os/hal/templates/uart_lld.h20
4 files changed, 46 insertions, 18 deletions
diff --git a/os/hal/templates/halconf.h b/os/hal/templates/halconf.h
index 321fa3830..dda173a31 100644
--- a/os/hal/templates/halconf.h
+++ b/os/hal/templates/halconf.h
@@ -35,11 +35,6 @@
#ifndef _HALCONF_H_
#define _HALCONF_H_
-/*
- * Enable the following line in order to include a mcu-related
- * settings file. This file can be used to include platform specific
- * header files or to override the low level drivers settings.
- */
#include "mcuconf.h"
/*===========================================================================*/
@@ -154,7 +149,16 @@
#endif
/**
- * @brief Enables the mutual exclusion APIs on the SPI bus.
+ * @brief Enables the "wait" APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(SPI_USE_WAIT) || defined(__DOXYGEN__)
+#define SPI_USE_WAIT TRUE
+#endif
+
+/**
+ * @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
+ * @note Disabling this option saves both code and data space.
*/
#if !defined(SPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
#define SPI_USE_MUTUAL_EXCLUSION TRUE
diff --git a/os/hal/templates/spi_lld.c b/os/hal/templates/spi_lld.c
index 19af51488..d2a9f9557 100644
--- a/os/hal/templates/spi_lld.c
+++ b/os/hal/templates/spi_lld.c
@@ -110,9 +110,9 @@ void spi_lld_unselect(SPIDriver *spip) {
/**
* @brief Ignores data on the SPI bus.
- * @details This function transmits a series of idle words on the SPI bus and
- * ignores the received data. This function can be invoked even
- * when a slave select signal has not been yet asserted.
+ * @details This asynchronous function starts the transmission of a series of
+ * idle words on the SPI bus and ignores the received data.
+ * @post At the end of the operation the configured callback is invoked.
*
* @param[in] spip pointer to the @p SPIDriver object
* @param[in] n number of words to be ignored
@@ -125,7 +125,9 @@ void spi_lld_ignore(SPIDriver *spip, size_t n) {
/**
* @brief Exchanges data on the SPI bus.
- * @details This function performs a simultaneous transmit/receive operation.
+ * @details This asynchronous function starts a simultaneous transmit/receive
+ * operation.
+ * @post At the end of the operation the configured callback is invoked.
* @note The buffers are organized as uint8_t arrays for data sizes below or
* equal to 8 bits else it is organized as uint16_t arrays.
*
@@ -142,7 +144,9 @@ void spi_lld_exchange(SPIDriver *spip, size_t n,
}
/**
- * @brief Sends data ever the SPI bus.
+ * @brief Sends data over the SPI bus.
+ * @details This asynchronous function starts a transmit operation.
+ * @post At the end of the operation the configured callback is invoked.
* @note The buffers are organized as uint8_t arrays for data sizes below or
* equal to 8 bits else it is organized as uint16_t arrays.
*
@@ -158,6 +162,8 @@ void spi_lld_send(SPIDriver *spip, size_t n, const void *txbuf) {
/**
* @brief Receives data from the SPI bus.
+ * @details This asynchronous function starts a receive operation.
+ * @post At the end of the operation the configured callback is invoked.
* @note The buffers are organized as uint8_t arrays for data sizes below or
* equal to 8 bits else it is organized as uint16_t arrays.
*
diff --git a/os/hal/templates/spi_lld.h b/os/hal/templates/spi_lld.h
index 2aa63b455..582b56678 100644
--- a/os/hal/templates/spi_lld.h
+++ b/os/hal/templates/spi_lld.h
@@ -46,6 +46,10 @@
/* Driver data structures and types. */
/*===========================================================================*/
+/**
+ * @brief Type of a structure representing an SPI driver.
+ */
+typedef struct SPIDriver SPIDriver;
/**
* @brief SPI notification callback type.
@@ -65,6 +69,7 @@ typedef struct {
* @brief Operation complete callback.
*/
spicallback_t spc_endcb;
+ /* End of the mandatory fields.*/
} SPIConfig;
/**
@@ -72,7 +77,7 @@ typedef struct {
* @note Implementations may extend this structure to contain more,
* architecture dependent, fields.
*/
-typedef struct {
+struct SPIDriver {
/**
* @brief Driver state.
*/
@@ -97,8 +102,11 @@ typedef struct {
* @brief Current configuration data.
*/
const SPIConfig *spd_config;
+#if defined(SPI_DRIVER_EXT_FIELDS)
+ SPI_DRIVER_EXT_FIELDS
+#endif
/* End of the mandatory fields.*/
-} SPIDriver;
+};
/*===========================================================================*/
/* Driver macros. */
diff --git a/os/hal/templates/uart_lld.h b/os/hal/templates/uart_lld.h
index 4b80633dc..0b9a934f2 100644
--- a/os/hal/templates/uart_lld.h
+++ b/os/hal/templates/uart_lld.h
@@ -87,15 +87,25 @@ typedef void (*uartecb_t)(UARTDriver *uartp, uartflags_t e);
* architecture dependent, fields.
*/
typedef struct {
- /** @brief End of transmission buffer callback.*/
+ /**
+ * @brief End of transmission buffer callback.
+ */
uartcb_t uc_txend1;
- /** @brief Physical end of transmission callback.*/
+ /**
+ * @brief Physical end of transmission callback.
+ */
uartcb_t uc_txend2;
- /** @brief Receive buffer filled callback.*/
+ /**
+ * @brief Receive buffer filled callback.
+ */
uartcb_t uc_rxend;
- /** @brief Character received while out if the @p UART_RECEIVE state.*/
+ /**
+ * @brief Character received while out if the @p UART_RECEIVE state.
+ */
uartcb_t uc_rxchar;
- /** @brief Receive error callback.*/
+ /**
+ * @brief Receive error callback.
+ */
uartcb_t uc_rxerr;
/* End of the mandatory fields.*/
} UARTConfig;