Made bus acquire/release functions in SNOR driver public.

git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12946 27425a3e-05d8-49a3-a47f-9c15f0e5edd8
This commit is contained in:
Giovanni Di Sirio 2019-08-11 06:59:23 +00:00
parent 723ec71674
commit c05c319615
3 changed files with 57 additions and 53 deletions

View File

@ -66,59 +66,6 @@ static const struct SNORDriverVMT snor_vmt = {
/* Driver local functions. */ /* Driver local functions. */
/*===========================================================================*/ /*===========================================================================*/
#if ((SNOR_BUS_DRIVER == SNOR_BUS_DRIVER_WSPI) && \
(SNOR_SHARED_BUS == TRUE)) || defined(__DOXYGEN__)
/**
* @brief Bus acquisition and lock.
*
* @param[in] busp pointer to the bus driver
* @param[in] config bus configuration
*
* @notapi
*/
static void bus_acquire(BUSDriver *busp, const BUSConfig *config) {
(void)config;
wspiAcquireBus(busp);
if (busp->config != config) {
wspiStart(busp, config);
}
}
/**
* @brief Bus release.
*
* @param[in] busp pointer to the bus driver
*
* @notapi
*/
static void bus_release(BUSDriver *busp) {
wspiReleaseBus(busp);
}
#elif (SNOR_BUS_DRIVER == SNOR_BUS_DRIVER_SPI) && \
(SNOR_SHARED_BUS == TRUE)
void bus_acquire(BUSDriver *busp, const BUSConfig *config) {
spiAcquireBus(busp);
if (busp->config != config) {
spiStart(busp, config);
}
}
void bus_release(BUSDriver *busp) {
spiReleaseBus(busp);
}
#else
/* No bus sharing, empty macros.*/
#define bus_acquire(busp)
#define bus_release(busp)
#endif
/** /**
* @brief Returns a pointer to the device descriptor. * @brief Returns a pointer to the device descriptor.
* *
@ -358,6 +305,55 @@ static flash_error_t snor_read_sfdp(void *instance, flash_offset_t offset,
/* Driver exported functions. */ /* Driver exported functions. */
/*===========================================================================*/ /*===========================================================================*/
#if ((SNOR_BUS_DRIVER == SNOR_BUS_DRIVER_WSPI) && \
(SNOR_SHARED_BUS == TRUE)) || defined(__DOXYGEN__)
/**
* @brief Bus acquisition and lock.
*
* @param[in] busp pointer to the bus driver
* @param[in] config bus configuration
*
* @notapi
*/
void bus_acquire(BUSDriver *busp, const BUSConfig *config) {
(void)config;
wspiAcquireBus(busp);
if (busp->config != config) {
wspiStart(busp, config);
}
}
/**
* @brief Bus release.
*
* @param[in] busp pointer to the bus driver
*
* @notapi
*/
void bus_release(BUSDriver *busp) {
wspiReleaseBus(busp);
}
#endif
#if (SNOR_BUS_DRIVER == SNOR_BUS_DRIVER_SPI) && \
(SNOR_SHARED_BUS == TRUE)
void bus_acquire(BUSDriver *busp, const BUSConfig *config) {
spiAcquireBus(busp);
if (busp->config != config) {
spiStart(busp, config);
}
}
void bus_release(BUSDriver *busp) {
spiReleaseBus(busp);
}
#endif
/** /**
* @brief Stops the underlying bus driver. * @brief Stops the underlying bus driver.
* *

View File

@ -144,6 +144,11 @@ typedef struct {
/* Driver macros. */ /* Driver macros. */
/*===========================================================================*/ /*===========================================================================*/
#if SNOR_SHARED_BUS == FALSE
#define bus_acquire(busp)
#define bus_release(busp)
#endif
/*===========================================================================*/ /*===========================================================================*/
/* External declarations. */ /* External declarations. */
/*===========================================================================*/ /*===========================================================================*/
@ -151,6 +156,8 @@ typedef struct {
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
void bus_acquire(BUSDriver *busp, const BUSConfig *config);
void bus_release(BUSDriver *busp);
void bus_cmd(BUSDriver *busp, uint32_t cmd); void bus_cmd(BUSDriver *busp, uint32_t cmd);
void bus_cmd_send(BUSDriver *busp, uint32_t cmd, size_t n, const uint8_t *p); void bus_cmd_send(BUSDriver *busp, uint32_t cmd, size_t n, const uint8_t *p);
void bus_cmd_receive(BUSDriver *busp, void bus_cmd_receive(BUSDriver *busp,

View File

@ -74,6 +74,7 @@
***************************************************************************** *****************************************************************************
*** Next *** *** Next ***
- NEW: Made bus acquire/release functions in SNOR driver public.
- NEW: Added mcuconf.h generator for STM32L052/L053/L062/L063. - NEW: Added mcuconf.h generator for STM32L052/L053/L062/L063.
- NEW: Added mcuconf.h generator for STM32L072/L073. - NEW: Added mcuconf.h generator for STM32L072/L073.
- NEW: Initial STM32G0xx support in HAL. - NEW: Initial STM32G0xx support in HAL.