Documentation fixes. Added missing templates.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@15030 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2021-11-07 09:24:28 +00:00
parent 409bbe578e
commit 0514a6ef99
6 changed files with 440 additions and 17 deletions

View File

@ -1,8 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Refresh" content="0; URL=html/index.html">
</head>
<body>
</body>
</html>

View File

@ -15,15 +15,15 @@
*/
/**
* @defgroup SPI SPI Driver
* @brief Generic SPI Driver.
* @defgroup SPI_V1 SPIv1 Driver
* @brief Generic SPI Driver (legacy).
* @details This module implements a generic SPI (Serial Peripheral Interface)
* driver allowing bidirectional and monodirectional transfers,
* complex atomic transactions are supported as well.
* @pre In order to use the SPI driver the @p HAL_USE_SPI option
* must be enabled in @p halconf.h.
*
* @section spi_1 Driver State Machine
* @section spi_v1_1 Driver State Machine
* The driver implements a state machine internally, not all the driver
* functionalities can be used in any moment, any transition not explicitly
* shown in the following diagram has to be considered an error and shall

View File

@ -15,10 +15,10 @@
*/
/**
* @file hal_spi_lld.c
* @brief PLATFORM SPI subsystem low level driver source.
* @file hal_spi_v1_lld.c
* @brief PLATFORM SPI (v1) subsystem low level driver source.
*
* @addtogroup SPI
* @addtogroup SPI_V1
* @{
*/
@ -80,13 +80,22 @@ void spi_lld_init(void) {
void spi_lld_start(SPIDriver *spip) {
if (spip->state == SPI_STOP) {
/* Enables the peripheral.*/
if (false) {
}
#if PLATFORM_SPI_USE_SPI1 == TRUE
if (&SPID1 == spip) {
}
#endif
else {
osalDbgAssert(false, "invalid SPI instance");
}
}
/* Configures the peripheral.*/
}
@ -101,15 +110,24 @@ void spi_lld_start(SPIDriver *spip) {
void spi_lld_stop(SPIDriver *spip) {
if (spip->state == SPI_READY) {
/* Disables the peripheral.*/
if (false) {
}
#if PLATFORM_SPI_USE_SPI1 == TRUE
if (&SPID1 == spip) {
}
#endif
else {
osalDbgAssert(false, "invalid SPI instance");
}
}
}
#if (SPI_SELECT_MODE == SPI_SELECT_MODE_LLD) || defined(__DOXYGEN__)
/**
* @brief Asserts the slave select signal and prepares for transfers.
*
@ -136,6 +154,7 @@ void spi_lld_unselect(SPIDriver *spip) {
(void)spip;
}
#endif
/**
* @brief Ignores data on the SPI bus.

View File

@ -15,10 +15,10 @@
*/
/**
* @file hal_spi_lld.h
* @brief PLATFORM SPI subsystem low level driver header.
* @file hal_spi_v1_lld.h
* @brief PLATFORM SPI (v1) subsystem low level driver header.
*
* @addtogroup SPI
* @addtogroup SPI_V1
* @{
*/

View File

@ -0,0 +1,291 @@
/*
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
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.
*/
/**
* @file hal_spi_v2_lld.c
* @brief PLATFORM SPI (v2) subsystem low level driver source.
*
* @addtogroup SPI_V2
* @{
*/
#include "hal.h"
#if HAL_USE_SPI || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver local definitions. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported variables. */
/*===========================================================================*/
/**
* @brief SPI1 driver identifier.
*/
#if (PLATFORM_SPI_USE_SPI1 == TRUE) || defined(__DOXYGEN__)
SPIDriver SPID1;
#endif
/*===========================================================================*/
/* Driver local variables and types. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver local functions. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver interrupt handlers. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver exported functions. */
/*===========================================================================*/
/**
* @brief Low level SPI driver initialization.
*
* @notapi
*/
void spi_lld_init(void) {
#if PLATFORM_SPI_USE_SPI1 == TRUE
/* Driver initialization.*/
spiObjectInit(&SPID1);
#endif
}
/**
* @brief Configures and activates the SPI peripheral.
*
* @param[in] spip pointer to the @p SPIDriver object
* @return The operation status.
*
* @notapi
*/
msg_t spi_lld_start(SPIDriver *spip) {
if (spip->state == SPI_STOP) {
/* Enables the peripheral.*/
if (false) {
}
#if PLATFORM_SPI_USE_SPI1 == TRUE
if (&SPID1 == spip) {
}
#endif
else {
osalDbgAssert(false, "invalid SPI instance");
}
}
return HAL_RET_SUCCESS;
}
/**
* @brief Deactivates the SPI peripheral.
*
* @param[in] spip pointer to the @p SPIDriver object
*
* @notapi
*/
void spi_lld_stop(SPIDriver *spip) {
if (spip->state == SPI_READY) {
/* Disables the peripheral.*/
if (false) {
}
#if PLATFORM_SPI_USE_SPI1 == TRUE
if (&SPID1 == spip) {
}
#endif
else {
osalDbgAssert(false, "invalid SPI instance");
}
}
}
#if (SPI_SELECT_MODE == SPI_SELECT_MODE_LLD) || defined(__DOXYGEN__)
/**
* @brief Asserts the slave select signal and prepares for transfers.
*
* @param[in] spip pointer to the @p SPIDriver object
*
* @notapi
*/
void spi_lld_select(SPIDriver *spip) {
(void)spip;
}
/**
* @brief Deasserts the slave select signal.
* @details The previously selected peripheral is unselected.
*
* @param[in] spip pointer to the @p SPIDriver object
*
* @notapi
*/
void spi_lld_unselect(SPIDriver *spip) {
(void)spip;
}
#endif
/**
* @brief Ignores data on the SPI bus.
* @details This synchronous function performs the transmission of a series of
* idle words on the SPI bus and ignores the received data.
* @pre In order to use this function the option @p SPI_USE_SYNCHRONIZATION
* must be enabled.
*
* @param[in] spip pointer to the @p SPIDriver object
* @param[in] n number of words to be ignored
* @return The operation status.
*
* @notapi
*/
msg_t spi_lld_ignore(SPIDriver *spip, size_t n) {
(void)spip;
(void)n;
return HAL_RET_SUCCESS;
}
/**
* @brief Exchanges data on the SPI bus.
* @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.
*
* @param[in] spip pointer to the @p SPIDriver object
* @param[in] n number of words to be exchanged
* @param[in] txbuf the pointer to the transmit buffer
* @param[out] rxbuf the pointer to the receive buffer
* @return The operation status.
*
* @notapi
*/
msg_t spi_lld_exchange(SPIDriver *spip, size_t n,
const void *txbuf, void *rxbuf) {
(void)spip;
(void)n;
(void)txbuf;
(void)rxbuf;
return HAL_RET_SUCCESS;
}
/**
* @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.
*
* @param[in] spip pointer to the @p SPIDriver object
* @param[in] n number of words to send
* @param[in] txbuf the pointer to the transmit buffer
* @return The operation status.
*
* @notapi
*/
msg_t spi_lld_send(SPIDriver *spip, size_t n, const void *txbuf) {
(void)spip;
(void)n;
(void)txbuf;
return HAL_RET_SUCCESS;
}
/**
* @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.
*
* @param[in] spip pointer to the @p SPIDriver object
* @param[in] n number of words to receive
* @param[out] rxbuf the pointer to the receive buffer
* @return The operation status.
*
* @notapi
*/
msg_t spi_lld_receive(SPIDriver *spip, size_t n, void *rxbuf) {
(void)spip;
(void)n;
(void)rxbuf;
return HAL_RET_SUCCESS;
}
/**
* @brief Aborts the ongoing SPI operation, if any.
*
* @param[in] spip pointer to the @p SPIDriver object
* @param[out] sizep pointer to the counter of frames not yet transferred
* or @p NULL
* @return The operation status.
*
* @notapi
*/
msg_t spi_lld_stop_transfer(SPIDriver *spip, size_t *sizep) {
(void)spip;
(void)sizep;
return HAL_RET_SUCCESS;
}
/**
* @brief Exchanges one frame using a polled wait.
* @details This synchronous function exchanges one frame using a polled
* synchronization method. This function is useful when exchanging
* small amount of data on high speed channels, usually in this
* situation is much more efficient just wait for completion using
* polling than suspending the thread waiting for an interrupt.
*
* @param[in] spip pointer to the @p SPIDriver object
* @param[in] frame the data frame to send over the SPI bus
* @return The received data frame from the SPI bus.
*/
uint16_t spi_lld_polled_exchange(SPIDriver *spip, uint16_t frame) {
(void)spip;
(void)frame;
return 0;
}
#endif /* HAL_USE_SPI */
/** @} */

View File

@ -0,0 +1,121 @@
/*
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
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.
*/
/**
* @file hal_spi_v2_lld.h
* @brief PLATFORM SPI (v2) subsystem low level driver header.
*
* @addtogroup SPI_V2
* @{
*/
#ifndef HAL_SPI_V2_LLD_H
#define HAL_SPI_V2_LLD_H
#if HAL_USE_SPI || defined(__DOXYGEN__)
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
/**
* @brief Circular mode support flag.
*/
#define SPI_SUPPORTS_CIRCULAR TRUE
/**
* @brief Slave mode support flag.
*/
#define SPI_SUPPORTS_SLAVE_MODE TRUE
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
/**
* @name PLATFORM configuration options
* @{
*/
/**
* @brief SPI1 driver enable switch.
* @details If set to @p TRUE the support for SPI1 is included.
* @note The default is @p FALSE.
*/
#if !defined(PLATFORM_SPI_USE_SPI1) || defined(__DOXYGEN__)
#define PLATFORM_SPI_USE_SPI1 FALSE
#endif
/** @} */
/*===========================================================================*/
/* Derived constants and error checks. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver data structures and types. */
/*===========================================================================*/
/*===========================================================================*/
/* Driver macros. */
/*===========================================================================*/
/**
* @brief Low level fields of the SPI driver structure.
*/
#define spi_lld_driver_fields \
/* Dummy field, it is not needed.*/ \
uint32_t dummy
/**
* @brief Low level fields of the SPI configuration structure.
*/
#define spi_lld_config_fields \
/* Dummy configuration, it is not needed.*/ \
uint32_t dummy
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
#if (PLATFORM_SPI_USE_SPI1 == TRUE) && !defined(__DOXYGEN__)
extern SPIDriver SPID1;
#endif
#ifdef __cplusplus
extern "C" {
#endif
void spi_lld_init(void);
msg_t spi_lld_start(SPIDriver *spip);
void spi_lld_stop(SPIDriver *spip);
#if (SPI_SELECT_MODE == SPI_SELECT_MODE_LLD) || defined(__DOXYGEN__)
void spi_lld_select(SPIDriver *spip);
void spi_lld_unselect(SPIDriver *spip);
#endif
msg_t spi_lld_ignore(SPIDriver *spip, size_t n);
msg_t spi_lld_exchange(SPIDriver *spip, size_t n,
const void *txbuf, void *rxbuf);
msg_t spi_lld_send(SPIDriver *spip, size_t n, const void *txbuf);
msg_t spi_lld_receive(SPIDriver *spip, size_t n, void *rxbuf);
msg_t spi_lld_stop_transfer(SPIDriver *spip, size_t *sizep);
uint16_t spi_lld_polled_exchange(SPIDriver *spip, uint16_t frame);
#ifdef __cplusplus
}
#endif
#endif /* HAL_USE_SPI */
#endif /* HAL_SPI_V2_LLD_H */
/** @} */