File: 0012-W25Q80BV-Move-SPI-functions-to-top-of-file-since-the.patch

package info (click to toggle)
hackrf 2015.07.2-11
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 69,764 kB
  • ctags: 9,327
  • sloc: ansic: 13,907; python: 696; vhdl: 218; sh: 32; makefile: 15
file content (58 lines) | stat: -rw-r--r-- 1,678 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
From 8edeaaa21e8c96b3c7683daa0b3c240b82d13b78 Mon Sep 17 00:00:00 2001
From: Jared Boone <jboone@earfeast.com>
Date: Tue, 4 Nov 2014 18:25:00 -0800
Subject: [PATCH 12/68] W25Q80BV: Move SPI functions to top of file, since
 they're static and used later.

---
 firmware/common/w25q80bv_drv.c | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/firmware/common/w25q80bv_drv.c b/firmware/common/w25q80bv_drv.c
index d0500b5..1f55512 100644
--- a/firmware/common/w25q80bv_drv.c
+++ b/firmware/common/w25q80bv_drv.c
@@ -30,6 +30,21 @@
 #include <libopencm3/lpc43xx/gpio.h>
 #include <libopencm3/lpc43xx/rgu.h>
 
+static void w25q80bv_spi_select(w25q80bv_hw_t* const hw) {
+	(void)hw;
+	gpio_clear(PORT_SSP0_SSEL, PIN_SSP0_SSEL);
+}
+
+static void w25q80bv_spi_unselect(w25q80bv_hw_t* const hw) {
+	(void)hw;
+	gpio_set(PORT_SSP0_SSEL, PIN_SSP0_SSEL);
+}
+
+static uint16_t w25q80bv_spi_transfer(w25q80bv_hw_t* const hw, const uint16_t tx_data) {
+	(void)hw;
+	return ssp_transfer(SSP0_NUM, tx_data);
+}
+
 void w25q80bv_spi_init(w25q80bv_hw_t* const hw) {
 	const uint8_t serial_clock_rate = 2;
 	const uint8_t clock_prescale_rate = 2;
@@ -74,18 +89,3 @@ void w25q80bv_spi_init(w25q80bv_hw_t* const hw) {
 			SSP_MASTER,
 			SSP_SLAVE_OUT_ENABLE);
 }
-
-void w25q80bv_spi_select(w25q80bv_hw_t* const hw) {
-	(void)hw;
-	gpio_clear(PORT_SSP0_SSEL, PIN_SSP0_SSEL);
-}
-
-void w25q80bv_spi_unselect(w25q80bv_hw_t* const hw) {
-	(void)hw;
-	gpio_set(PORT_SSP0_SSEL, PIN_SSP0_SSEL);
-}
-
-uint16_t w25q80bv_spi_transfer(w25q80bv_hw_t* const hw, const uint16_t tx_data) {
-	(void)hw;
-	return ssp_transfer(SSP0_NUM, tx_data);
-}
-- 
2.1.4