/*************************************************************************** * __________ __ ___. * Open \______ \ ____ ____ | | _\_ |__ _______ ___ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ * \/ \/ \/ \/ \/ * $Id$ * * Copyright (C) 2008 Rafaël Carré * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY * KIND, either express or implied. * ****************************************************************************/ .text /* AS3525 hardware registers */ .set GPIOA, 0xC80B0000 .set GPIOB, 0xC80C0000 .set GPIOC, 0xC80D0000 .set GPIOD, 0xC80E0000 .set CGU_PERI, 0xC80F0014 .set I2C_BASE, 0xC8070000 .set I2C_DATA, 0x00 .set I2C_SLAD0, 0x04 .set I2C_CNTRL, 0x0c .set I2C_DACNT, 0x10 .set I2C_CPSR0, 0x1c .set I2C_CPSR1, 0x20 .set I2C_IMR, 0x24 .set I2C_SR, 0x30 .set I2C_SADDR, 0x44 .set AS3514_I2C_ADDR, 0x46 .set AS3514_IRQ_ENRD0, 0x25 .set PCLK, 24000000 .set I2C_CLK, 400000 .set I2C_PRESCALER, ((PCLK + I2C_CLK -1) / I2C_CLK) .set I2C_PRESCALER_LOW, (I2C_PRESCALER & 0xff) .set I2C_PRESCALER_HIGH, (I2C_PRESCALER >> 8) #if I2C_PRESCALER_HIGH > 3 #error i2c prescaler too big! #endif /* Vectors */ ldr pc, =start /* reset vector */ /* next vectors are unused, halt cpu */ 1: b 1b 1: b 1b 1: b 1b 1: b 1b 1: b 1b 1: b 1b 1: b 1b /* These values are filled in by mkamsboot - don't move them from offset 0x20 */ uclunpack_end: .word 0 /* End of the ucl_unpack function */ uclunpack_size: .word 0 /* Size in bytes of the ucl_unpack function */ ucl_of_end: .word 0 /* End of the ucl-compressed OF image */ ucl_of_size: .word 0 /* Size in bytes of the compressed OF image */ ucl_rb_end: .word 0 /* End of the ucl-compressed RB image */ ucl_rb_size: .word 0 /* Size in bytes of the compressed RB image */ ucl_dest: .word 0 /* End of our destination buffer (end of memory) */ start: /* First copy the UCL unpack function to the end of RAM */ ldr r0, uclunpack_end /* Source */ ldr r1, uclunpack_size /* Source length */ sub r2, r0, r1 /* Source start - 1*/ ldr r3, ucl_dest /* Destination end */ uclcopy: ldrb r4, [r0], #-1 strb r4, [r3], #-1 cmp r2, r0 bne uclcopy /* store the new destination buffer */ str r3, ucl_dest /* enable gpio clock */ ldr r0, =CGU_PERI ldr r1, [r0] orr r1, r1, #(1<<16) str r1, [r0] /* TODO : M200V4 ? */ #if defined(SANSA_CLIP) || defined(SANSA_CLIPV2) #define USB_PIN 6 #elif defined(SANSA_FUZE) || defined(SANSA_E200V2) || defined(SANSA_FUZEV2) #define USB_PIN 3 #endif #ifdef USB_PIN /* TODO : remove this check when we'll have an USB driver */ ldr r0, =GPIOA mov r1, #0 str r1, [r0, #0x400] ldr r1, [r0, #(4*(1<