summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2007-10-23 14:22:44 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2007-10-23 14:22:44 +0000
commitdbff3731a54b37dfe421e445dbf30f5f0c90c0fd (patch)
treeb5017a7a01d38b4e5892bab47b341cf9edc7321d
parentd40db1901ef33bb9d068efd871c1c1e42d04175f (diff)
downloadrockbox-dbff3731a54b37dfe421e445dbf30f5f0c90c0fd.tar.gz
rockbox-dbff3731a54b37dfe421e445dbf30f5f0c90c0fd.zip
enable the RTC on the mrobe.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15279 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/rtc/rtc_rx5x348ab.c23
-rw-r--r--firmware/export/config-mrobe500.h2
-rw-r--r--firmware/target/arm/tms320dm320/spi-dm320.c5
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
25void rtc_init(void) 30void rtc_init(void)
26{ 31{
27} 32}
28 33
29int rtc_read_datetime(unsigned char* buf) 34int 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}
41int 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,
92void spi_init(void) 92void 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