• R/O
  • SSH
  • HTTPS

chibios: Commit


Commit MetaInfo

Revision12946 (tree)
Time2019-08-11 15:59:23
Authorgdisirio

Log Message

Made bus acquire/release functions in SNOR driver public.

Change Summary

Incremental Difference

--- trunk/os/hal/lib/complex/serial_nor/hal_serial_nor.c (revision 12945)
+++ trunk/os/hal/lib/complex/serial_nor/hal_serial_nor.c (revision 12946)
@@ -66,60 +66,7 @@
6666 /* Driver local functions. */
6767 /*===========================================================================*/
6868
69-#if ((SNOR_BUS_DRIVER == SNOR_BUS_DRIVER_WSPI) && \
70- (SNOR_SHARED_BUS == TRUE)) || defined(__DOXYGEN__)
7169 /**
72- * @brief Bus acquisition and lock.
73- *
74- * @param[in] busp pointer to the bus driver
75- * @param[in] config bus configuration
76- *
77- * @notapi
78- */
79-static void bus_acquire(BUSDriver *busp, const BUSConfig *config) {
80-
81- (void)config;
82-
83- wspiAcquireBus(busp);
84- if (busp->config != config) {
85- wspiStart(busp, config);
86- }
87-}
88-
89-/**
90- * @brief Bus release.
91- *
92- * @param[in] busp pointer to the bus driver
93- *
94- * @notapi
95- */
96-static void bus_release(BUSDriver *busp) {
97-
98- wspiReleaseBus(busp);
99-}
100-
101-#elif (SNOR_BUS_DRIVER == SNOR_BUS_DRIVER_SPI) && \
102- (SNOR_SHARED_BUS == TRUE)
103-void bus_acquire(BUSDriver *busp, const BUSConfig *config) {
104-
105- spiAcquireBus(busp);
106- if (busp->config != config) {
107- spiStart(busp, config);
108- }
109-}
110-
111-void bus_release(BUSDriver *busp) {
112-
113- spiReleaseBus(busp);
114-}
115-
116-#else
117-/* No bus sharing, empty macros.*/
118-#define bus_acquire(busp)
119-#define bus_release(busp)
120-#endif
121-
122-/**
12370 * @brief Returns a pointer to the device descriptor.
12471 *
12572 * @param[in] instance instance pointer
@@ -358,7 +305,56 @@
358305 /* Driver exported functions. */
359306 /*===========================================================================*/
360307
308+#if ((SNOR_BUS_DRIVER == SNOR_BUS_DRIVER_WSPI) && \
309+ (SNOR_SHARED_BUS == TRUE)) || defined(__DOXYGEN__)
361310 /**
311+ * @brief Bus acquisition and lock.
312+ *
313+ * @param[in] busp pointer to the bus driver
314+ * @param[in] config bus configuration
315+ *
316+ * @notapi
317+ */
318+void bus_acquire(BUSDriver *busp, const BUSConfig *config) {
319+
320+ (void)config;
321+
322+ wspiAcquireBus(busp);
323+ if (busp->config != config) {
324+ wspiStart(busp, config);
325+ }
326+}
327+
328+/**
329+ * @brief Bus release.
330+ *
331+ * @param[in] busp pointer to the bus driver
332+ *
333+ * @notapi
334+ */
335+void bus_release(BUSDriver *busp) {
336+
337+ wspiReleaseBus(busp);
338+}
339+#endif
340+
341+#if (SNOR_BUS_DRIVER == SNOR_BUS_DRIVER_SPI) && \
342+ (SNOR_SHARED_BUS == TRUE)
343+void bus_acquire(BUSDriver *busp, const BUSConfig *config) {
344+
345+ spiAcquireBus(busp);
346+ if (busp->config != config) {
347+ spiStart(busp, config);
348+ }
349+}
350+
351+void bus_release(BUSDriver *busp) {
352+
353+ spiReleaseBus(busp);
354+}
355+#endif
356+
357+/**
362358 * @brief Stops the underlying bus driver.
363359 *
364360 * @param[in] busp pointer to the bus driver
--- trunk/os/hal/lib/complex/serial_nor/hal_serial_nor.h (revision 12945)
+++ trunk/os/hal/lib/complex/serial_nor/hal_serial_nor.h (revision 12946)
@@ -144,6 +144,11 @@
144144 /* Driver macros. */
145145 /*===========================================================================*/
146146
147+#if SNOR_SHARED_BUS == FALSE
148+#define bus_acquire(busp)
149+#define bus_release(busp)
150+#endif
151+
147152 /*===========================================================================*/
148153 /* External declarations. */
149154 /*===========================================================================*/
@@ -151,6 +156,8 @@
151156 #ifdef __cplusplus
152157 extern "C" {
153158 #endif
159+ void bus_acquire(BUSDriver *busp, const BUSConfig *config);
160+ void bus_release(BUSDriver *busp);
154161 void bus_cmd(BUSDriver *busp, uint32_t cmd);
155162 void bus_cmd_send(BUSDriver *busp, uint32_t cmd, size_t n, const uint8_t *p);
156163 void bus_cmd_receive(BUSDriver *busp,
--- trunk/readme.txt (revision 12945)
+++ trunk/readme.txt (revision 12946)
@@ -74,6 +74,7 @@
7474 *****************************************************************************
7575
7676 *** Next ***
77+- NEW: Made bus acquire/release functions in SNOR driver public.
7778 - NEW: Added mcuconf.h generator for STM32L052/L053/L062/L063.
7879 - NEW: Added mcuconf.h generator for STM32L072/L073.
7980 - NEW: Initial STM32G0xx support in HAL.
Show on old repository browser