Index: apps/debug_menu.c
===================================================================
RCS file: /cvsroot/rockbox/apps/debug_menu.c,v
retrieving revision 1.229
diff -u -r1.229 debug_menu.c
--- apps/debug_menu.c	13 Nov 2006 23:21:52 -0000	1.229
+++ apps/debug_menu.c	15 Nov 2006 18:38:52 -0000
@@ -397,6 +397,12 @@
     (void)p_device;
     (void)addr1;
     (void)addr2;
+#elif (CONFIG_CPU == PP5024)
+    /* TODO: Implement for Sansa */
+    (void)p_manufacturer;
+    (void)p_device;
+    (void)addr1;
+    (void)addr2;
 #elif CONFIG_CPU == S3C2440
     /* TODO: Implement for Gigabeat */
     (void)p_manufacturer;
Index: apps/tree.c
===================================================================
RCS file: /cvsroot/rockbox/apps/tree.c,v
retrieving revision 1.455
diff -u -r1.455 tree.c
--- apps/tree.c	13 Nov 2006 00:45:20 -0000	1.455
+++ apps/tree.c	15 Nov 2006 18:39:00 -0000
@@ -681,10 +681,11 @@
             need_update = true;
         if (returned_button == ACTION_STD_CANCEL)
             button = ACTION_STD_CANCEL;
-
+		
         switch ( button ) {
             case ACTION_STD_OK:
                 /* nothing to do if no files to display */
+                
                 if ( numentries == 0 )
                     break;
Index: firmware/SOURCES
===================================================================
RCS file: /cvsroot/rockbox/firmware/SOURCES,v
retrieving revision 1.139
diff -u -r1.139 SOURCES
--- firmware/SOURCES	13 Nov 2006 23:21:52 -0000	1.139
+++ firmware/SOURCES	15 Nov 2006 18:39:15 -0000
@@ -312,6 +312,10 @@
 target/arm/sandisk/sansa-e200/ata-e200.c
 target/arm/sandisk/sansa-e200/lcd-e200.c
 target/arm/sandisk/sansa-e200/adc-e200.c
+target/arm/sandisk/sansa-e200/power-e200.c
+target/arm/sandisk/sansa-e200/backlight-e200.c
+target/arm/sandisk/sansa-e200/usb-e200.c
+target/arm/sandisk/sansa-e200/button-e200.c
 #endif /* SIMULATOR */
 #endif /* SANSA_E200 */
 
Index: firmware/app.lds
===================================================================
RCS file: /cvsroot/rockbox/firmware/app.lds,v
retrieving revision 1.77
diff -u -r1.77 app.lds
--- firmware/app.lds	10 Nov 2006 20:26:00 -0000	1.77
+++ firmware/app.lds	15 Nov 2006 18:39:16 -0000
@@ -36,7 +36,7 @@
 #define DRAMORIG 0x31000000 + STUBOFFSET
 #define IRAMORIG 0x10000000
 #define IRAMSIZE 0x10000
-#elif (CONFIG_CPU==PP5002) || (CONFIG_CPU==PP5020)
+#elif (CONFIG_CPU==PP5002) || (CONFIG_CPU==PP5020) || (CONFIG_CPU==PP5024)
 #define DRAMORIG 0x00000000 + STUBOFFSET
 #define IRAMORIG 0x40000000
 #define IRAMSIZE 0xc000
Index: firmware/system.c
===================================================================
RCS file: /cvsroot/rockbox/firmware/system.c,v
retrieving revision 1.129
diff -u -r1.129 system.c
--- firmware/system.c	10 Nov 2006 20:26:00 -0000	1.129
+++ firmware/system.c	15 Nov 2006 18:39:19 -0000
@@ -585,7 +585,7 @@
     }
 }
 
-#if CONFIG_CPU==PP5020
+#if CONFIG_CPU==PP5020||CONFIG_CPU==PP5024
 
 unsigned int ipod_hw_rev;
 
@@ -605,8 +605,7 @@
     else if (CPU_HI_INT_STAT & GPIO_MASK)
         ipod_mini_button_int();
 }
-#elif (defined IRIVER_H10) || (defined IRIVER_H10_5GB) || defined(ELIO_TPJ1022)
-/* TODO: this should really be in the target tree, but moving it there caused
+#elif (defined IRIVER_H10) || (defined IRIVER_H10_5GB) || defined(ELIO_TPJ1022) || defined SANSA_E200/* TODO: this should really be in the target tree, but moving it there caused
    crt0.S not to find it while linking */
 void irq(void)
 {
Index: firmware/timer.c
===================================================================
RCS file: /cvsroot/rockbox/firmware/timer.c,v
retrieving revision 1.15
diff -u -r1.15 timer.c
--- firmware/timer.c	23 Oct 2006 13:11:57 -0000	1.15
+++ firmware/timer.c	15 Nov 2006 18:39:21 -0000
@@ -49,7 +49,7 @@
         pfn_timer();
     TER1 = 0xff; /* clear all events */
 }
-#elif CONFIG_CPU == PP5020 || CONFIG_CPU == PP5002
+#elif CONFIG_CPU == PP5020 || CONFIG_CPU == PP5002 || CONFIG_CPU == PP5024
 void TIMER2(void)
 {
     TIMER2_VAL; /* ACK interrupt */
Index: firmware/usb.c
===================================================================
RCS file: /cvsroot/rockbox/firmware/usb.c,v
retrieving revision 1.98
diff -u -r1.98 usb.c
--- firmware/usb.c	10 Nov 2006 20:26:00 -0000	1.98
+++ firmware/usb.c	15 Nov 2006 18:39:22 -0000
@@ -83,6 +83,9 @@
 #elif CONFIG_KEYPAD == IRIVER_H10_PAD
 #define USBPOWER_BUTTON BUTTON_NONE
 #define USBPOWER_BTN_IGNORE BUTTON_POWER
+#elif CONFIG_KEYPAD == SANSA_E200_PAD
+#define USBPOWER_BUTTON BUTTON_SELECT
+#define USBPOWER_BTN_IGNORE BUTTON_POWER
 #endif
 #endif /* HAVE_USB_POWER */
 
Index: firmware/target/arm/sandisk/sansa-e200/ata-e200.c
===================================================================
RCS file: /cvsroot/rockbox/firmware/target/arm/sandisk/sansa-e200/ata-e200.c,v
retrieving revision 1.1
diff -u -r1.1 ata-e200.c
--- firmware/target/arm/sandisk/sansa-e200/ata-e200.c	1 Aug 2006 22:42:25 -0000	1.1
+++ firmware/target/arm/sandisk/sansa-e200/ata-e200.c	15 Nov 2006 18:39:25 -0000
@@ -18,114 +18,496 @@
  ****************************************************************************/
 
 #include "ata.h"
+#include "cpu.h"
+#include "system.h"
+#include <stdio.h>
 #include <stdbool.h>
 #include <string.h>
+#include "lcd.h" /* TODO: Remove */
+#include "kernel.h"
+#include "thread.h"
+
+#define BLOCK_SIZE      (512)
+#define SECTOR_SIZE      (512)
+
+#define STATUS_REG      (*(volatile unsigned int *)(0x70008204))
+#define REG_1           (*(volatile unsigned int *)(0x70008208)) /* Unknown */
+#define REG_2           (*(volatile unsigned int *)(0x70008210)) /* Unknown */
+#define BLOCK_SIZE_REG  (*(volatile unsigned int *)(0x7000821c))
+#define BLOCK_COUNT_REG (*(volatile unsigned int *)(0x70008220))
+#define REG_5           (*(volatile unsigned int *)(0x70008224))
+#define CMD_REG0        (*(volatile unsigned int *)(0x70008228))
+#define CMD_REG1        (*(volatile unsigned int *)(0x7000822c))
+#define CMD_REG2        (*(volatile unsigned int *)(0x70008230))
+#define RESPONSE_REG    (*(volatile unsigned int *)(0x70008234))
+#define REG_10          (*(volatile unsigned int *)(0x70008238))
+#define REG_11          (*(volatile unsigned int *)(0x70008240))
+#define REG_12          (*(volatile unsigned int *)(0x70008244))
+#define DATA_REG        (*(volatile unsigned int *)(0x70008280))
+
+#define DATA_DONE       (1 << 12)
+#define CMD_DONE        (1 << 13)
+#define ERROR_BITS      (0x3f)
+#define FIFO_FULL       (1 << 7)
+
+#define FIFO_SIZE       16          /* FIFO is 16 words deep */
+
+/* SD Commands */
+#define GO_IDLE_STATE   0
+#define ALL_SEND_CID    2
+#define SEND_RELATIVE_ADDR  3
+#define SWITCH_FUNC     6
+#define SELECT_CARD     7
+#define SEND_CSD        9
+#define SEND_CID        10
+#define STOP_TRANSMISSION   12
+#define SEND_STATUS     13
+#define SET_BLOCKLEN    16
+#define READ_MULTIPLE_BLOCK 18
+
+/* Application Specific commands */
+#define SD_APP_OP_COND  41
+#define SET_BUS_WIDTH   6
 
-#define SECTOR_SIZE     (512)
+#define READ_TIMEOUT    5*HZ
 
 static unsigned short identify_info[SECTOR_SIZE];
 int ata_spinup_time = 0;
 long last_disk_activity = -1;
+static bool delayed_write = false;
 
-void flash_select_chip(int no, int sel)
-{
-
-}
-
-unsigned char flash_read_data(void)
-{
-
-}
-
-void flash_write_data(unsigned char data)
-{
-
-}
-
-void flash_write_cmd(unsigned char cmd)
-{
-
-}
-
-void flash_write_addr(unsigned char addr)
-{
-
-}
-
-void flash_wait_ready(void)
-{
-
-}
-
-int flash_map_sector(int sector, int* chip, int* chip_sector)
-{
-
-}
-
-int flash_read_id(int no)
-{
-
-}
-
-int flash_read_sector(int sector, unsigned char* buf,
-                      unsigned char* oob)
-{
-
-}
-
-int flash_read_sector_oob(int sector, unsigned char* oob)
-{
-
-}
-
-static int flash_get_n_segments(void)
-{
-
-}
-
-static int flash_get_n_phblocks(void)
-{
-
-}
-
-static int flash_get_n_sectors_in_block(void)
-{
-
-}
-
-static int flash_phblock_to_sector(int segment, int block)
-{
-
-}
-
-static int flash_is_bad_block(unsigned char* oob)
-{
-
-}
-
-int flash_disk_scan(void)
-{
-
-}
+static struct mutex ata_mtx;
 
-int flash_disk_find_block(int block)
-{
 
+/* Move these into a struct before committing - see ata_mmc.[ch] */
+static unsigned int cid[3];
+static unsigned int rca = 0;
+static unsigned int ocr = 0;
+static unsigned int csd[3];
+
+static unsigned int read_bl_len = 0;
+static unsigned int c_size = 0;
+static unsigned int c_size_mult = 0;
+static unsigned long mult = 0;
+static unsigned long block_len = 0;
+static unsigned int blocknr = 0;
+unsigned long long capacity = 0;
+
+/* Private Functions */
+bool sd_send_command(unsigned int cmd, unsigned long arg1, unsigned int arg2)
+{
+    bool result = false;
+    while(1) /* TODO: Make this a nicer loop */
+    {
+        CMD_REG0 = cmd;
+        CMD_REG1 = (unsigned int)((arg1 & 0xffff0000) >> 16);
+        CMD_REG2 = (unsigned int)((arg1 & 0xffff));
+        REG_2 = arg2;
+        while ((STATUS_REG & CMD_DONE) == 0)
+        {
+            /* Busy wait */
+        }
+        if ((STATUS_REG & ERROR_BITS) == 0)
+        {
+            result = true;
+            break;
+        }
+    }
+    return result;
+}
+
+void sd_read_response(unsigned int *response, int type)
+{
+    int i;
+    int words; /* Number of 16 bit words to read from RESPONSE_REG */
+    unsigned int response_from_card[8];
+    if(type == 2)
+        words = 8; /* Is this right? It's what MrH says, but the spec says
+                      that R2 types are 136 bits long, which is 9 words */
+    else
+        words = 3;
+
+    for (i = words; i > 0; i--) /* RESPONSE_REG is read MSB first */
+    {
+        response_from_card[i-1] = RESPONSE_REG;
+    }
+
+    switch (type)
+    {
+        case 1:
+            /* Response type 1 has the following structure:
+                Start bit
+                Transmission bit
+                Command index (6 bits)
+                Card Status (32 bits)
+                CRC7 (7 bits)
+                Stop bit
+            */
+            /* TODO: Sanity checks */
+            response[0] = ((response_from_card[2] & 0xff) << 24)
+                       + (response_from_card[1] << 8)
+                       + ((response_from_card[0] & 0xff00) >> 8);
+            break;
+        case 2:
+            response[2] = response_from_card[2];
+            response[1] = response_from_card[1];
+            response[0] = response_from_card[0];
+            break;
+        case 3:
+            /* Response type 3 has the following structure:
+                Start bit
+                Transmission bit
+                Reserved (6 bits)
+                OCR register (32 bits)
+                Reserved (7 bits)
+                Stop bit
+            */
+            response[0] = ((response_from_card[2] & 0xff) << 24)
+                       + (response_from_card[1] << 8)
+                       + ((response_from_card[0] & 0xff00) >> 8);
+        /* Types 4-6 not supported yet */
+    }
+}
+
+bool sd_send_acommand(unsigned int cmd, unsigned long arg1, unsigned int arg2)
+{
+    unsigned int returncode;
+    if (sd_send_command(55, rca<<16, 1) == false)
+        return false;
+    sd_read_response(&returncode, 1);
+    if (sd_send_command(cmd, arg1, arg2) == false)
+        return false;
+    return true;
+}
+
+void sd_init_device(void)
+{
+/* SD Protocol registers */
+    unsigned int dummy;
+
+/* Enable and initialise controller */
+    GPIOG_ENABLE |= (0x3 << 5);
+    GPIOG_OUTPUT_EN |= (0x3 << 5);
+    GPIOG_OUTPUT_VAL |= (0x3 << 5);
+    outl(inl(0x70000088) & ~(0x4), 0x70000088);
+    outl(inl(0x7000008c) & ~(0x4), 0x7000008c);
+    outl(inl(0x70000080) | 0x4, 0x70000080);
+    outl(inl(0x70000084) | 0x4, 0x70000084);
+    REG_1 = 6;
+    outl(inl(0x70000014) & ~(0x3ffff), 0x70000014);
+    outl((inl(0x70000014) & ~(0x3ffff)) | 0x255aa, 0x70000014);
+    outl(0x1010, 0x70000034);
+
+    GPIOA_ENABLE |= (1 << 7);
+    GPIOA_OUTPUT_EN &= ~(1 << 7);
+    GPIOD_ENABLE |= (0x1f);
+    GPIOD_OUTPUT_EN |= (0x1f);
+    GPIOD_OUTPUT_VAL |= (0x1f);
+    outl(inl(0x6000600c) | (1 << 14), 0x6000600c);
+    outl(inl(0x60006004) | (1 << 14), 0x60006004);
+    outl(inl(0x60006004) & ~(1 << 14), 0x60006004); /* Reset Controller? */
+    outl(0, 0x6000b000);
+    outl(0, 0x6000a000); /* Init DMA controller? */
+
+/* Init NAND */
+    REG_11 |= (1 << 15);
+    REG_12 |= (1 << 15);
+    REG_12 &= ~(3 << 12);
+    REG_12 |= (1 << 13);
+    REG_11 &= ~(3 << 12);
+    REG_11 |= (1 << 13);
+
+    REG_10 = 0x4;
+    REG_5 = 0xf;
+
+    sd_send_command(GO_IDLE_STATE, 0, 256);
+    while ((ocr & (1 << 31)) == 0) /* Loop until the card is powered up */
+    {
+        sd_send_acommand(SD_APP_OP_COND, 0x100000, 3);
+        sd_read_response(&ocr, 3);
+
+        if (ocr == 0)
+        {
+            /* TODO: Handle failure */
+        }
+    }
+
+    sd_send_command(ALL_SEND_CID, 0, 2);
+    sd_read_response(cid, 2);
+    sd_send_command(SEND_RELATIVE_ADDR, 0, 1);
+    sd_read_response(&rca, 1);
+    rca >>= 16;
+
+    sd_send_command(SEND_CSD, rca << 16, 2);
+    sd_read_response(csd, 2);
+
+    /* Parse disk geometry */
+    /* These calculations come from the Sandisk SD card product manual */
+    read_bl_len = ((csd[2] >> 16) & 0xf);
+    c_size = ((csd[2] & (0x3ff)) << 2) + ((csd[1] & (0xc0000000)) >> 30);
+    c_size_mult = ((csd[1] >> 15) & 0x7);
+    mult = 2^(c_size_mult + 2);
+    block_len = 2^(read_bl_len);
+    blocknr = (c_size + 1) * mult;
+    capacity = blocknr * block_len;
+
+    outl(0, REG_1);
+    sd_send_command(SELECT_CARD, rca << 16, 129);
+    sd_read_response(&dummy, 1); /* I don't think we use the result from this */
+    sd_send_acommand(SET_BUS_WIDTH, (rca << 16) | 2, 1);
+    sd_read_response(&dummy, 1); /* 4 bit wide bus */
+    sd_send_command(SET_BLOCKLEN, 512, 1);
+    sd_read_response(&dummy, 1);
+    BLOCK_SIZE_REG = BLOCK_SIZE;
+
+    /* If more than one memory bank (how do we figure this out?) */
+    /* If this card is > 4Gb, then we need to enable the second bank */
+#if 0
+    if(capacity > 0x100000000)
+    {
+        REG_10 = 0x4;
+        BLOCK_COUNT_REG = 1;
+        sd_send_command(SWITCH_FUNC, 0x80ffffef, 0x1c05);
+        sd_read_response(&dummy, 1);
+        //Read 512 bytes from the card
+    }
+#endif
+    mutex_init(&ata_mtx);
+}
+
+
+/* This needs to be moved to IRAM */
+static void copy_read_sectors(unsigned char* buf, int wordcount)
+{
+    unsigned int tmp = 0;
+    char c_buf[32];
+    unsigned int tmp_stat = 0;
+
+    if ( (unsigned long)buf & 1)
+    {   /* not 16-bit aligned, copy byte by byte */
+        unsigned char* bufend = buf + wordcount*2;
+        do
+        {
+            tmp = DATA_REG;
+            *buf++ = tmp & 0xff; /* I assume big endian */
+            *buf++ = tmp >> 8;   /*  and don't use the SWAB16 macro */
+        } while (buf < bufend); /* tail loop is faster */
+    }
+    else
+    {   /* 16-bit aligned, can do faster copy */
+        unsigned short* wbuf = (unsigned short*)buf;
+        unsigned short* wbufend = wbuf + wordcount;
+        do
+        {
+#ifdef SWAP_WORDS
+            *wbuf = swap16(DATA_REG);
+#else
+            *wbuf = DATA_REG;
+#endif
+        } while (++wbuf < wbufend); /* tail loop is faster */
+    }
 }
 
-int flash_disk_read_sectors(unsigned long start,
-                            int count,
-                            void* buf)
-{
-
-}
 
+/* API Functions */
 int ata_read_sectors(IF_MV2(int drive,)
                      unsigned long start,
                      int incount,
                      void* inbuf)
 {
+    int ret = 0;
+    long timeout;
+    int count;
+    void* buf;
+    long spinup_start;
+    unsigned int dummy;
+    unsigned int response;
+    char cbuf[32];
+    int tmp;
+    int i;
+
+#ifdef HAVE_MULTIVOLUME
+    (void)drive; /* unused for now */
+#endif
+#if 0
+    mutex_lock(&ata_mtx);
+
+    last_disk_activity = current_tick;
+    spinup_start = current_tick;
+
+    ata_led(true);
+
+    if ( sleeping ) {
+        spinup = true;
+        if (poweroff) {
+            if (ata_power_on()) {
+                mutex_unlock(&ata_mtx);
+                ata_led(false);
+                return -1;
+            }
+        }
+        else {
+            if (perform_soft_reset()) {
+                mutex_unlock(&ata_mtx);
+                ata_led(false);
+                return -1;
+            }
+        }
+    }
+
+    timeout = current_tick + READ_TIMEOUT;
+#endif
+
+    /* TODO: Select device */
+
+
+ retry:
+    buf = inbuf;
+    count = incount;
+//    while (TIME_BEFORE(current_tick, timeout)) {
+        ret = 0;
+//        last_disk_activity = current_tick;
+
+        REG_10 = 4;
+        BLOCK_COUNT_REG = count;
+        sd_send_command(READ_MULTIPLE_BLOCK, start * BLOCK_SIZE, 0x1c25);
+        /* TODO: Is start in blocks or sectors? */
+        sd_read_response(&dummy, 1);
+        /* TODO: Don't assume BLOCK_SIZE == SECTOR_SIZE */
+
+
+        for (i = 0; i < count * BLOCK_SIZE / 2; i += FIFO_SIZE)
+        {
+            /* Wait for the FIFO to be full */
+            while((STATUS_REG & FIFO_FULL) == 0) {}
+
+            copy_read_sectors(buf, FIFO_SIZE);
+            udelay(10); /* Even though we busy wait, with no delay it hangs */
+
+            buf += FIFO_SIZE*2; /* Advance one chunk of 16 words */
+
+//            last_disk_activity = current_tick;
+        }
+        udelay(50);
+        sd_send_command(STOP_TRANSMISSION, 0, 1);
+        sd_read_response(&dummy, 1);
+
+        response = 0;
+        while(((response >> 9) & 0xf) != 4)
+        {
+            sd_send_command(SEND_STATUS, rca << 16, 1);
+            sd_read_response(&response, 1);
+        }
+//        break;
+//    }
+//    ata_led(false);
+
+//    mutex_unlock(&ata_mtx);
+
+    /* only flush if reading went ok */
+//    if ( (ret == 0) && delayed_write )
+//        ata_flush();
+
+    return ret;
+}
 
+
+
+
+void test_read(void)
+{
+    char cbuf[255];
+    unsigned int block_count = 1;
+    unsigned long addr = 0x203;
+    char d_buf[BLOCK_SIZE];
+    unsigned int data;
+    unsigned int i;
+    unsigned int j;
+    unsigned long k;
+    unsigned int response;
+    int my_char = 0;
+    int line = 10;
+    int side = 16;
+    char c1;
+    char c2;
+
+
+
+    do {
+        REG_10 = 4;
+        BLOCK_COUNT_REG = block_count;
+        sd_send_command(READ_MULTIPLE_BLOCK, addr * BLOCK_SIZE, 0x1c25);
+        sd_read_response(&response, 1);
+
+        for(i = 0; i < block_count; i++)
+        {
+            line = 10;
+            my_char = 0;
+            side = 16;
+            for(j = 0; j < (BLOCK_SIZE); j+= 2)
+            {
+                data = DATA_REG;
+                d_buf[j+1] = ((data >> 8) & 0xff);
+                d_buf[j] = (data & 0xff);
+                snprintf(cbuf, sizeof(cbuf), "%02x%02x ", d_buf[j], d_buf[j+1]);
+                lcd_puts(my_char, line, cbuf);
+                if((d_buf[j] > 31) && (d_buf[j] < 127))
+                {
+                    c1 = d_buf[j];
+                } else {
+                    c1 = 46;
+                }
+                if((d_buf[j+1] > 31) && (d_buf[j+1] < 127))
+                {
+                    c2 = d_buf[j+1];
+                } else {
+                    c2 = 46;
+                }
+                snprintf(cbuf, sizeof(cbuf), "%c %c", c1, c2);
+                lcd_puts(my_char, line+1, cbuf);
+                lcd_update();
+                my_char += 5;
+                side += 2;
+                if (my_char > 20)
+                {
+                    my_char = 0;
+                    side = 16;
+                    line += 2;
+                    if(line > 24)
+                    {
+                        line = 10;
+                        if((GPIOF_INPUT_VAL & (1 << 2)) != 0)
+                        {
+                            while((GPIOF_INPUT_VAL & (1 << 4)) != 0)
+                            {
+                            }
+                            while((GPIOF_INPUT_VAL & (1 << 4)) == 0)
+                            {
+                            }
+                            while((GPIOF_INPUT_VAL & (1 << 4)) != 0)
+                            {
+                            }
+                        }
+                        snprintf(cbuf, sizeof(cbuf), "0x%lx + 0x%x", addr, j);
+                        lcd_puts(0, 9, cbuf);
+                        lcd_update();
+                    }
+                }
+            }
+        }
+        sd_send_command(STOP_TRANSMISSION, 0, 1);
+        sd_read_response(&response, 1);
+        response = 0;
+        while(((response & (0xf << 9)) >> 9) != 4)
+        {
+            sd_send_command(SEND_STATUS, rca << 16, 1);
+            sd_read_response(&response, 1);
+        }
+        my_char = 0;
+        addr++;
+    } while(1);
+    lcd_puts(0, 15, "sd_read_blocks done");
+    lcd_update();
 }
 
 int ata_write_sectors(IF_MV2(int drive,)
@@ -139,7 +521,7 @@
     return -1;
 }
 
-/* schedule a single sector write, executed with the the next spinup 
+/* schedule a single sector write, executed with the the next spinup
    (volume 0 only, used for config sector) */
 extern void ata_delayed_write(unsigned long sector, const void* buf)
 {
@@ -189,10 +571,11 @@
 
 unsigned short* ata_get_identify(void)
 {
-
+    return identify_info;
 }
 
 int ata_init(void)
 {
+    sd_init_device();
     return 0;
 }
Index: firmware/target/arm/sandisk/sansa-e200/backlight-target.h
===================================================================
RCS file: /cvsroot/rockbox/firmware/target/arm/sandisk/sansa-e200/backlight-target.h,v
retrieving revision 1.1
diff -u -r1.1 backlight-target.h
--- firmware/target/arm/sandisk/sansa-e200/backlight-target.h	1 Aug 2006 22:28:13 -0000	1.1
+++ firmware/target/arm/sandisk/sansa-e200/backlight-target.h	15 Nov 2006 18:39:25 -0000
@@ -1 +1,25 @@
-/* nothing here yet */
+/***************************************************************************
+ *             __________               __   ___.
+ *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
+ *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
+ *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
+ *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
+ *                     \/            \/     \/    \/            \/
+ * $Id: backlight-target.h,v 1.1 2006-11-10 07:43:36 tomal Exp $
+ *
+ * Copyright (C) 2006 by Barry Wardell
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#ifndef BACKLIGHT_TARGET_H
+#define BACKLIGHT_TARGET_H
+
+void __backlight_on(void);
+void __backlight_off(void);
+
+#endif
Index: firmware/target/arm/sandisk/sansa-e200/lcd-e200.c
===================================================================
RCS file: /cvsroot/rockbox/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c,v
retrieving revision 1.2
diff -u -r1.2 lcd-e200.c
--- firmware/target/arm/sandisk/sansa-e200/lcd-e200.c	16 Oct 2006 17:21:35 -0000	1.2
+++ firmware/target/arm/sandisk/sansa-e200/lcd-e200.c	15 Nov 2006 18:39:26 -0000
@@ -262,3 +262,23 @@
     /* TODO: Implement lcd_set_flip() */
     (void)yesno;
 }
+
+void lcd_blit(const fb_data* data, int x, int by, int width,
+              int bheight, int stride)
+{
+    /* TODO: Implement lcd_blit() */
+    (void)data;
+    (void)x;
+    (void)by;
+    (void)width;
+    (void)bheight;
+    (void)stride;
+}
+
+void lcd_yuv_blit(unsigned char * const src[3],
+                  int src_x, int src_y, int stride,
+                  int x, int y, int width, int height)
+{
+    /* TODO: Implement lcd_blit() */
+
+}
Index: firmware/target/arm/sandisk/sansa-e200/usb-target.h
===================================================================
RCS file: /cvsroot/rockbox/firmware/target/arm/sandisk/sansa-e200/usb-target.h,v
retrieving revision 1.1
diff -u -r1.1 usb-target.h
--- firmware/target/arm/sandisk/sansa-e200/usb-target.h	1 Aug 2006 22:28:14 -0000	1.1
+++ firmware/target/arm/sandisk/sansa-e200/usb-target.h	15 Nov 2006 18:39:26 -0000
@@ -1 +1,24 @@
-/* nothing here yet */
+/***************************************************************************
+ *             __________               __   ___.
+ *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
+ *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
+ *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
+ *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
+ *                     \/            \/     \/    \/            \/
+ * $Id: usb-target.h,v 1.1 2006-10-05 10:58:51 barrywardell Exp $
+ *
+ * Copyright (C) 2006 by Barry Wardelll
+ *
+ * All files in this archive are subject to the GNU General Public License.
+ * See the file COPYING in the source tree root for full license agreement.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#ifndef USB_TARGET_H
+#define USB_TARGET_H
+
+bool usb_init_device(void);
+
+#endif
