diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/rtc/rtc_rx5x348ab.c | 23 | ||||
-rw-r--r-- | firmware/export/config-mrobe500.h | 2 | ||||
-rw-r--r-- | firmware/target/arm/tms320dm320/spi-dm320.c | 5 |
3 files changed, 23 insertions, 7 deletions
diff --git a/firmware/drivers/rtc/rtc_rx5x348ab.c b/firmware/drivers/rtc/rtc_rx5x348ab.c index 4899d99567..429a221b1a 100644 --- a/firmware/drivers/rtc/rtc_rx5x348ab.c +++ b/firmware/drivers/rtc/rtc_rx5x348ab.c | |||
@@ -21,15 +21,32 @@ | |||
21 | #include "spi.h" | 21 | #include "spi.h" |
22 | #include "rtc.h" | 22 | #include "rtc.h" |
23 | #include <stdbool.h> | 23 | #include <stdbool.h> |
24 | 24 | /* Choose one of: */ | |
25 | #define ADDR_READ 0x04 | ||
26 | #define ADDR_WRITE 0x00 | ||
27 | /* and one of: */ | ||
28 | #define ADDR_ONE 0x08 | ||
29 | #define ADDR_BURST 0x00 | ||
25 | void rtc_init(void) | 30 | void rtc_init(void) |
26 | { | 31 | { |
27 | } | 32 | } |
28 | 33 | ||
29 | int rtc_read_datetime(unsigned char* buf) | 34 | int rtc_read_datetime(unsigned char* buf) |
30 | { | 35 | { |
31 | char command = 0x04; /* burst read from the start of the time/date reg */ | 36 | char command = ADDR_READ|ADDR_BURST; /* burst read from the start of the time/date reg */ |
32 | spi_block_transfer(SPI_target_RX5X348AB, | 37 | spi_block_transfer(SPI_target_RX5X348AB, |
33 | &command, 1, buf, 7); | 38 | &command, 1, buf, 7); |
34 | return 1; | 39 | return 1; |
35 | } | 40 | } |
41 | int rtc_write_datetime(unsigned char* buf) | ||
42 | { | ||
43 | char command = ADDR_WRITE|ADDR_BURST; /* burst read from the start of the time/date reg */ | ||
44 | char data[8]; | ||
45 | int i; | ||
46 | data[0] = command; | ||
47 | for (i=1;i<8;i++) | ||
48 | data[i] = buf[i-1]; | ||
49 | spi_block_transfer(SPI_target_RX5X348AB, | ||
50 | data, 8, NULL, 0); | ||
51 | return 1; | ||
52 | } | ||
diff --git a/firmware/export/config-mrobe500.h b/firmware/export/config-mrobe500.h index 9cd7a7c478..04f3d83401 100644 --- a/firmware/export/config-mrobe500.h +++ b/firmware/export/config-mrobe500.h | |||
@@ -84,7 +84,7 @@ | |||
84 | #define CONFIG_CODEC SWCODEC | 84 | #define CONFIG_CODEC SWCODEC |
85 | 85 | ||
86 | /* define this if you have a real-time clock */ | 86 | /* define this if you have a real-time clock */ |
87 | //#define CONFIG_RTC RTC_RX5X348AB | 87 | #define CONFIG_RTC RTC_RX5X348AB |
88 | 88 | ||
89 | /* Define this for LCD backlight available */ | 89 | /* Define this for LCD backlight available */ |
90 | #define HAVE_BACKLIGHT | 90 | #define HAVE_BACKLIGHT |
diff --git a/firmware/target/arm/tms320dm320/spi-dm320.c b/firmware/target/arm/tms320dm320/spi-dm320.c index e9dd2e01a3..f80c3884fc 100644 --- a/firmware/target/arm/tms320dm320/spi-dm320.c +++ b/firmware/target/arm/tms320dm320/spi-dm320.c | |||
@@ -92,9 +92,8 @@ int spi_block_transfer(enum SPI_target target, | |||
92 | void spi_init(void) | 92 | void spi_init(void) |
93 | { | 93 | { |
94 | spinlock_init(&spi_lock); | 94 | spinlock_init(&spi_lock); |
95 | /* Set SCLK idle level = 0 */ | 95 | /* Set SCLK idle level = 1 */ |
96 | IO_SERIAL0_MODE |= (1<<10); | 96 | IO_SERIAL0_MODE &= ~(1<<10); |
97 | |||
98 | /* Enable TX */ | 97 | /* Enable TX */ |
99 | IO_SERIAL0_TX_ENABLE = 0x0001; | 98 | IO_SERIAL0_TX_ENABLE = 0x0001; |
100 | 99 | ||