diff options
| author | Jonathan Gordon <rockbox@jdgordon.info> | 2007-10-23 14:22:44 +0000 |
|---|---|---|
| committer | Jonathan Gordon <rockbox@jdgordon.info> | 2007-10-23 14:22:44 +0000 |
| commit | dbff3731a54b37dfe421e445dbf30f5f0c90c0fd (patch) | |
| tree | b5017a7a01d38b4e5892bab47b341cf9edc7321d | |
| parent | d40db1901ef33bb9d068efd871c1c1e42d04175f (diff) | |
| download | rockbox-dbff3731a54b37dfe421e445dbf30f5f0c90c0fd.zip rockbox-dbff3731a54b37dfe421e445dbf30f5f0c90c0fd.tar.gz rockbox-dbff3731a54b37dfe421e445dbf30f5f0c90c0fd.tar.bz2 rockbox-dbff3731a54b37dfe421e445dbf30f5f0c90c0fd.tar.xz | |
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.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 4899d99..429a221 100644 --- a/firmware/drivers/rtc/rtc_rx5x348ab.c +++ b/firmware/drivers/rtc/rtc_rx5x348ab.c @@ -21,15 +21,32 @@ #include "spi.h" #include "rtc.h" #include <stdbool.h> - +/* Choose one of: */ +#define ADDR_READ 0x04 +#define ADDR_WRITE 0x00 +/* and one of: */ +#define ADDR_ONE 0x08 +#define ADDR_BURST 0x00 void rtc_init(void) { } - + int rtc_read_datetime(unsigned char* buf) { - char command = 0x04; /* burst read from the start of the time/date reg */ + char command = ADDR_READ|ADDR_BURST; /* burst read from the start of the time/date reg */ spi_block_transfer(SPI_target_RX5X348AB, &command, 1, buf, 7); return 1; } +int rtc_write_datetime(unsigned char* buf) +{ + char command = ADDR_WRITE|ADDR_BURST; /* burst read from the start of the time/date reg */ + char data[8]; + int i; + data[0] = command; + for (i=1;i<8;i++) + data[i] = buf[i-1]; + spi_block_transfer(SPI_target_RX5X348AB, + data, 8, NULL, 0); + return 1; +} diff --git a/firmware/export/config-mrobe500.h b/firmware/export/config-mrobe500.h index 9cd7a7c..04f3d83 100644 --- a/firmware/export/config-mrobe500.h +++ b/firmware/export/config-mrobe500.h @@ -84,7 +84,7 @@ #define CONFIG_CODEC SWCODEC /* define this if you have a real-time clock */ -//#define CONFIG_RTC RTC_RX5X348AB +#define CONFIG_RTC RTC_RX5X348AB /* Define this for LCD backlight available */ #define HAVE_BACKLIGHT diff --git a/firmware/target/arm/tms320dm320/spi-dm320.c b/firmware/target/arm/tms320dm320/spi-dm320.c index e9dd2e0..f80c388 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, void spi_init(void) { spinlock_init(&spi_lock); - /* Set SCLK idle level = 0 */ - IO_SERIAL0_MODE |= (1<<10); - + /* Set SCLK idle level = 1 */ + IO_SERIAL0_MODE &= ~(1<<10); /* Enable TX */ IO_SERIAL0_TX_ENABLE = 0x0001; |