summaryrefslogtreecommitdiffstats
path: root/bootloader/mrobe500.c
diff options
context:
space:
mode:
authorCatalin Patulea <cat@vv.carleton.ca>2007-09-21 09:06:02 +0000
committerCatalin Patulea <cat@vv.carleton.ca>2007-09-21 09:06:02 +0000
commitc3126e0f3c8c5c91b77d4a0383ae6dc26cdd9ebe (patch)
tree0b00e9e61bd56595fc88d27f0a404ac83bb8248a /bootloader/mrobe500.c
parent2a6125946d146c0281af57814ad2121481eb5f84 (diff)
downloadrockbox-c3126e0f3c8c5c91b77d4a0383ae6dc26cdd9ebe.tar.gz
rockbox-c3126e0f3c8c5c91b77d4a0383ae6dc26cdd9ebe.tar.bz2
rockbox-c3126e0f3c8c5c91b77d4a0383ae6dc26cdd9ebe.zip
m:robe 500i port: Add primitives for the SPI bus and start moving toward new-style register definitions.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14798 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'bootloader/mrobe500.c')
-rwxr-xr-xbootloader/mrobe500.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/bootloader/mrobe500.c b/bootloader/mrobe500.c
index d0b9c2b717..3b2ede685a 100755
--- a/bootloader/mrobe500.c
+++ b/bootloader/mrobe500.c
@@ -38,6 +38,7 @@
#include "common.h"
#include "rbunicode.h"
#include "usb.h"
+#include "spi-target.h"
void main(void)
{
@@ -55,7 +56,7 @@ void main(void)
uartSetup();
lcd_init();
font_init();
- // dm320_spi_init();
+ dm320_spi_init();
lcd_setfont(FONT_SYSFIXED);
@@ -97,12 +98,8 @@ void main(void)
#endif
printf("ATA");
- int count = 0, i = 0, c = 0;
- char data[64];
- unsigned short out[] = {0x8000};
- unsigned short in[2];
- outw(inw(IO_GIO_DIR1)&~(1<<10), IO_GIO_DIR1); // set GIO26 to output
+ outw(inw(IO_GIO_DIR1)&~(1<<10), IO_GIO_DIR1); // set GIO26 to output
while(true)
{
if (button_read_device() == BUTTON_POWER)
@@ -110,9 +107,19 @@ void main(void)
printf("reset");
outw(1<<10, IO_GIO_BITSET1);
}
- // dm320_spi_block_transfer(0, out, 16, 16, in, 0);
- // printf("%x", in[0]);
-
+
+ // Read X, Y, Z1, Z2 touchscreen coordinates.
+ int page = 0, address = 0;
+ unsigned short command = 0x8000|(page << 11)|(address << 5);
+ unsigned char out[] = {command >> 8, command & 0xff};
+ unsigned char in[8];
+ dm320_spi_block_transfer(out, sizeof(out), in, sizeof(in));
+
+ printf("%02x%02x %02x%02x %02x%02x %02x%02x\n",
+ in[0], in[1],
+ in[2], in[3],
+ in[4], in[5],
+ in[6], in[7]);
}
#if 0
rc = ata_init();