forked from len0rd/rockbox
Creative ZVM:
* Re-enable USB * Acknowledge EP0SETUP packets * Spin disk down when no files get loaded in the bootloader * Clean up/fix some other stuff git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19931 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
e1aee31878
commit
ee1e8be37f
12 changed files with 196 additions and 155 deletions
|
@ -28,6 +28,7 @@
|
|||
#include "backlight.h"
|
||||
#include "button.h"
|
||||
#include "common.h"
|
||||
#include "usb.h"
|
||||
|
||||
|
||||
static void load_fw(unsigned char* ptr, unsigned int len)
|
||||
|
@ -57,6 +58,7 @@ void main(void)
|
|||
lcd_init();
|
||||
font_init();
|
||||
button_init();
|
||||
usb_init();
|
||||
|
||||
lcd_enable(true);
|
||||
lcd_setfont(FONT_SYSFIXED);
|
||||
|
@ -110,5 +112,7 @@ void main(void)
|
|||
}
|
||||
}
|
||||
|
||||
storage_sleepnow();
|
||||
|
||||
while(1);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#include "isp1583.h"
|
||||
#include "thread.h"
|
||||
#include "logf.h"
|
||||
#include <stdio.h>
|
||||
#include "stdio.h"
|
||||
|
||||
#define DIR_RX 0
|
||||
#define DIR_TX 1
|
||||
|
@ -200,7 +200,9 @@ static int usb_receive(int n)
|
|||
len = usb_get_packet(endpoints[n].in_buf + endpoints[n].in_ptr,
|
||||
endpoints[n].in_max_len - endpoints[n].in_ptr);
|
||||
endpoints[n].in_ptr += len;
|
||||
if (endpoints[n].in_ptr >= endpoints[n].in_min_len) {
|
||||
|
||||
if (endpoints[n].in_ptr >= endpoints[n].in_min_len)
|
||||
{
|
||||
endpoints[n].in_min_len = -1;
|
||||
if (endpoints[n].in_done)
|
||||
(*(endpoints[n].in_done))(n, endpoints[n].in_buf,
|
||||
|
@ -261,7 +263,8 @@ static int usb_send(int n)
|
|||
|
||||
p = endpoints[n].out_buf + endpoints[n].out_ptr;
|
||||
i = 0;
|
||||
while (len - i >= 2) {
|
||||
while (len - i >= 2)
|
||||
{
|
||||
ISP1583_DFLOW_DATA = p[i] | (p[i + 1] << 8);
|
||||
i += 2;
|
||||
}
|
||||
|
@ -308,7 +311,11 @@ static void usb_unstall_endpoint(int idx)
|
|||
static void usb_status_ack(int ep, int dir)
|
||||
{
|
||||
logf("usb_status_ack(%d)", dir);
|
||||
if(ep == EP_CONTROL)
|
||||
usb_select_setup_endpoint();
|
||||
else
|
||||
usb_select_endpoint(ep_index(ep, dir));
|
||||
|
||||
ISP1583_DFLOW_CTRLFUN |= DFLOW_CTRLFUN_STATUS;
|
||||
}
|
||||
|
||||
|
@ -326,7 +333,10 @@ static void usb_handle_setup_rx(void)
|
|||
len = usb_get_packet(setup_pkt_buf, 8);
|
||||
|
||||
if (len == 8)
|
||||
{
|
||||
ISP1583_DFLOW_CTRLFUN |= DFLOW_CTRLFUN_STATUS; /* Acknowledge packet */
|
||||
usb_core_control_request((struct usb_ctrlrequest*)setup_pkt_buf);
|
||||
}
|
||||
else
|
||||
{
|
||||
usb_drv_stall(0, true, false);
|
||||
|
@ -388,9 +398,7 @@ void usb_helper(void)
|
|||
{
|
||||
if(ISP1583_GEN_INT_READ & ISP1583_INIT_INTEN_READ)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
logf("Helper detected interrupt... [%d]", current_tick);
|
||||
#endif
|
||||
logf("Helper detected interrupt... [%d]", (int)current_tick);
|
||||
usb_drv_int();
|
||||
}
|
||||
return;
|
||||
|
@ -413,14 +421,6 @@ void usb_drv_init(void)
|
|||
/* Disable all OTG functions */
|
||||
ISP1583_INIT_OTG = 0;
|
||||
|
||||
#if 0
|
||||
#ifdef USE_HIGH_SPEED
|
||||
/* Force device to high speed */
|
||||
ISP1583_GEN_TSTMOD = GEN_TSTMOD_FORCEHS;
|
||||
high_speed_mode = true;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
logf("BUS_CONF/DA0:%d MODE0/DA1: %d MODE1: %d", (bool)(ISP1583_INIT_MODE & INIT_MODE_TEST0), (bool)(ISP1583_INIT_MODE & INIT_MODE_TEST1), (bool)(ISP1583_INIT_MODE & INIT_MODE_TEST2));
|
||||
logf("Chip ID: 0x%x", ISP1583_GEN_CHIPID);
|
||||
|
@ -454,7 +454,7 @@ void usb_drv_init(void)
|
|||
|
||||
ZVM_SPECIFIC;
|
||||
|
||||
tick_add_task(usb_helper);
|
||||
//tick_add_task(usb_helper);
|
||||
|
||||
logf("usb_init_device() finished");
|
||||
}
|
||||
|
@ -482,7 +482,7 @@ void usb_drv_exit(void)
|
|||
ISP1583_INIT_MODE = INIT_MODE_GOSUSP;
|
||||
ISP1583_INIT_MODE = 0;
|
||||
|
||||
tick_remove_task(usb_helper);
|
||||
//tick_remove_task(usb_helper);
|
||||
|
||||
ZVM_SPECIFIC;
|
||||
}
|
||||
|
@ -504,7 +504,7 @@ bool usb_drv_stalled(int endpoint, bool in)
|
|||
static void out_callback(int ep, unsigned char *buf, int len)
|
||||
{
|
||||
(void)buf;
|
||||
logf("out_callback(%d, 0x%x, %d)", ep, &buf, len);
|
||||
logf("out_callback(%d, 0x%x, %d)", ep, (int)buf, len);
|
||||
usb_status_ack(ep, DIR_RX);
|
||||
usb_core_transfer_complete(ep, true, 0, len); /* 0=>status succeeded, haven't worked out status failed yet... */
|
||||
}
|
||||
|
@ -512,14 +512,14 @@ static void out_callback(int ep, unsigned char *buf, int len)
|
|||
static void in_callback(int ep, unsigned char *buf, int len)
|
||||
{
|
||||
(void)buf;
|
||||
logf("in_callback(%d, 0x%x, %d)", ep, &buf, len);
|
||||
logf("in_callback(%d, 0x%x, %d)", ep, (int)buf, len);
|
||||
usb_status_ack(ep, DIR_TX);
|
||||
usb_core_transfer_complete(ep, false, 0, len);
|
||||
}
|
||||
|
||||
int usb_drv_recv(int ep, void* ptr, int length)
|
||||
{
|
||||
logf("usb_drv_recv(%d, 0x%x, %d)", ep, &ptr, length);
|
||||
logf("usb_drv_recv(%d, 0x%x, %d)", ep, (int)ptr, length);
|
||||
if(ep == 0 && length == 0 && ptr == NULL)
|
||||
{
|
||||
usb_status_ack(ep, DIR_TX);
|
||||
|
@ -562,7 +562,7 @@ static void usb_drv_wait(int ep, bool send)
|
|||
|
||||
int usb_drv_send(int ep, void* ptr, int length)
|
||||
{
|
||||
logf("usb_drv_send_nb(%d, 0x%x, %d)", ep, &ptr, length);
|
||||
logf("usb_drv_send_nb(%d, 0x%x, %d)", ep, (int)ptr, length);
|
||||
if(ep == 0 && length == 0 && ptr == NULL)
|
||||
{
|
||||
usb_status_ack(ep, DIR_RX);
|
||||
|
@ -624,8 +624,6 @@ void usb_drv_release_endpoint(int ep)
|
|||
endpoints[ep & 0x7f].allocation &= mask;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void bus_reset(void)
|
||||
{
|
||||
/* Enable CLKAON & GLINTENA */
|
||||
|
@ -660,9 +658,7 @@ void IRAM_ATTR usb_drv_int(void)
|
|||
/* Unlock the device's registers */
|
||||
ISP1583_GEN_UNLCKDEV = ISP1583_UNLOCK_CODE;
|
||||
|
||||
#if 0
|
||||
logf(" handling int [0x%x & 0x%x = 0x%x]", ISP1583_GEN_INT_READ, ISP1583_INIT_INTEN_READ, ints);
|
||||
#endif
|
||||
//logf(" handling int [0x%lx & 0x%lx = 0x%x]", ISP1583_GEN_INT_READ, ISP1583_INIT_INTEN_READ, (int)ints);
|
||||
|
||||
if(ints & INT_IEBRST) /* Bus reset */
|
||||
{
|
||||
|
@ -732,10 +728,35 @@ void usb_drv_set_address(int address)
|
|||
ISP1583_INIT_ADDRESS = (address & 0x7F) | INIT_ADDRESS_DEVEN;
|
||||
|
||||
ZVM_SPECIFIC;
|
||||
|
||||
usb_status_ack(0, DIR_TX);
|
||||
}
|
||||
|
||||
void usb_drv_set_test_mode(int mode)
|
||||
{
|
||||
logf("usb_drv_set_test_mode(%d)", mode);
|
||||
switch(mode){
|
||||
case 0:
|
||||
ISP1583_GEN_TSTMOD = 0;
|
||||
/* Power cycle... */
|
||||
break;
|
||||
case 1:
|
||||
ISP1583_GEN_TSTMOD = GEN_TSTMOD_JSTATE;
|
||||
break;
|
||||
case 2:
|
||||
ISP1583_GEN_TSTMOD = GEN_TSTMOD_KSTATE;
|
||||
break;
|
||||
case 3:
|
||||
ISP1583_GEN_TSTMOD = GEN_TSTMOD_SE0_NAK;
|
||||
break;
|
||||
case 4:
|
||||
//REG_PORTSC1 |= PORTSCX_PTC_PACKET;
|
||||
break;
|
||||
case 5:
|
||||
//REG_PORTSC1 |= PORTSCX_PTC_FORCE_EN;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef BOOTLOADER
|
||||
int dbg_usb_num_items(void)
|
||||
{
|
||||
return 2+USB_NUM_ENDPOINTS*2;
|
||||
|
@ -782,29 +803,4 @@ char* dbg_usb_item(int selected_item, void *data, char *buffer, size_t buffer_le
|
|||
return NULL;
|
||||
(void)data;
|
||||
}
|
||||
|
||||
void usb_drv_set_test_mode(int mode)
|
||||
{
|
||||
logf("usb_drv_set_test_mode(%d)", mode);
|
||||
switch(mode){
|
||||
case 0:
|
||||
ISP1583_GEN_TSTMOD = 0;
|
||||
/* Power cycle... */
|
||||
break;
|
||||
case 1:
|
||||
ISP1583_GEN_TSTMOD = GEN_TSTMOD_JSTATE;
|
||||
break;
|
||||
case 2:
|
||||
ISP1583_GEN_TSTMOD = GEN_TSTMOD_KSTATE;
|
||||
break;
|
||||
case 3:
|
||||
ISP1583_GEN_TSTMOD = GEN_TSTMOD_SE0_NAK;
|
||||
break;
|
||||
case 4:
|
||||
//REG_PORTSC1 |= PORTSCX_PTC_PACKET;
|
||||
break;
|
||||
case 5:
|
||||
//REG_PORTSC1 |= PORTSCX_PTC_FORCE_EN;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -167,8 +167,10 @@
|
|||
|
||||
#define CONFIG_USBOTG USBOTG_ISP1583
|
||||
#define HAVE_USBSTACK
|
||||
#define USE_ROCKBOX_USB
|
||||
#define USB_VENDOR_ID 0x041e
|
||||
#define USB_PRODUCT_ID 0x4133
|
||||
#define USB_NUM_ENDPOINTS 7
|
||||
|
||||
/*DEBUGGING!*/
|
||||
/*
|
||||
|
|
|
@ -43,8 +43,6 @@
|
|||
#define PHY_IO_BASE2 0x00060000
|
||||
#define DM320_REG2(addr) (*(volatile unsigned int *)(PHY_IO_BASE2 + (addr)))
|
||||
|
||||
/* USBOTG */
|
||||
#define USB_NUM_ENDPOINTS 3
|
||||
/* This needs to be 2048 byte aligned, but USB_QHARRAY_ATTR should take care
|
||||
* of that */
|
||||
#define USB_QHARRAY_ATTR __attribute__((section(".qharray"),nocommon,aligned(4)))
|
||||
|
|
|
@ -52,10 +52,10 @@
|
|||
#define ISP1583_GEN_UNLCKDEV (*((volatile unsigned short*)(ISP1583_IOBASE+0x7C)))
|
||||
#define ISP1583_GEN_TSTMOD (*((volatile unsigned char*)(ISP1583_IOBASE+0x84)))
|
||||
|
||||
#define set_int_value(a,b,value) a = value;
|
||||
#define set_int_value(a,b,value) (a) = (value);
|
||||
#endif
|
||||
|
||||
#define ISP1583_UNLOCK_CODE (unsigned short)0xAA37
|
||||
#define ISP1583_UNLOCK_CODE ((unsigned short)0xAA37)
|
||||
|
||||
/* Initialization registers' bits */
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ static unsigned long cfs_start;
|
|||
static unsigned long *sectors;
|
||||
|
||||
#define CFS_START ( ((hdr->partitions[1].start*hdr->sector_size) & ~0xFFFF) + 0x10000 )
|
||||
#define CFS_CLUSTER2CLUSTER(x) ( CFS_START+((x)-1)*64 )
|
||||
#define CFS_CLUSTER2CLUSTER(x) ( (CFS_START/512)+((x)-1)*64 )
|
||||
|
||||
/* Limited version of UCS -> ASCII */
|
||||
static char* ucs2letostring(unsigned char* s)
|
||||
|
@ -211,7 +211,7 @@ static char* ucs2letostring(unsigned char* s)
|
|||
static char res[256];
|
||||
int i;
|
||||
|
||||
for(i=0; (s[i] == 0 && s[i+1] == 0); i++)
|
||||
for(i=0; (s[i] == 0 && s[i+1] == 0 && i<256); i++)
|
||||
res[i] = s[i*2];
|
||||
|
||||
return (char*)&res;
|
||||
|
@ -236,31 +236,46 @@ static void cfs_init(void)
|
|||
_ata_read_sectors(0, 1, §or);
|
||||
hdr = (struct main_header*)§or;
|
||||
|
||||
//printf("CFS is at 0x%x", CFS_START);
|
||||
logf("CFS is at 0x%x [0x%x]", CFS_START, CFS_START/512);
|
||||
|
||||
/* Read CFS header */
|
||||
_ata_read_sectors(CFS_START/512, 64, §or2);
|
||||
cfs = (struct cfs_header*)§or2;
|
||||
|
||||
//printf("First inode = %d", cfs->first_inode);
|
||||
logf("First inode = 0x%x", cfs->first_inode);
|
||||
|
||||
/* Read root inode */
|
||||
_ata_read_sectors(CFS_CLUSTER2CLUSTER(cfs->first_inode), 64, §or2);
|
||||
root_inode = (struct cfs_inode*)§or2;
|
||||
|
||||
logf("Root inode = 0x%x", root_inode);
|
||||
|
||||
logf("0x%x 0x%x", CFS_CLUSTER2CLUSTER(root_inode->first_class_chain[0]), root_inode->first_class_chain[0]);
|
||||
|
||||
/* Read root inode's first sector */
|
||||
_ata_read_sectors(CFS_CLUSTER2CLUSTER(root_inode->first_class_chain[0]), 64, §or2);
|
||||
root_direntry = (struct cfs_direntry*)§or2;
|
||||
root_direntry_items = (struct cfs_direntry_item*)(§or2+sizeof(struct cfs_direntry));
|
||||
|
||||
logf("0x%x", root_direntry->identifier);
|
||||
|
||||
logf("%d", root_direntry->items);
|
||||
|
||||
/* Search VFAT inode */
|
||||
for(i=0; i < root_direntry->items; i++)
|
||||
{
|
||||
//printf(" * [%s] at 0x%x\n", ucs2letostring(&root_direntry_items[i].string[0]), root_direntry_items[i].inode_number);
|
||||
if(root_direntry_items[i].inode_number != 0)
|
||||
{
|
||||
//logf(" * [%s] at 0x%x", ucs2letostring(&root_direntry_items[i].string[0]), root_direntry_items[i].inode_number);
|
||||
if(strcmp(ucs2letostring(&root_direntry_items[i].string[0]), "VFAT") == 0)
|
||||
vfat_inode_nr = root_direntry_items[i].inode_number;
|
||||
}
|
||||
}
|
||||
|
||||
logf("VFAT inode = 0x%x", vfat_inode_nr);
|
||||
|
||||
if(vfat_inode_nr != 0)
|
||||
{
|
||||
/* Read VFAT inode */
|
||||
_ata_read_sectors(CFS_CLUSTER2CLUSTER(vfat_inode_nr), 64, §or2);
|
||||
vfat_inode = (struct cfs_inode*)§or2;
|
||||
|
@ -273,7 +288,7 @@ static void cfs_init(void)
|
|||
/* Search for VFAT's subinodes */
|
||||
for(i=0; i < vfat_direntry->items; i++)
|
||||
{
|
||||
//printf(" * [%s] at 0x%x\n", ucs2letostring(&vfat_direntry_items[i].string[0]), vfat_direntry_items[i].inode_number);
|
||||
logf(" * [%s] at 0x%x\n", ucs2letostring(&vfat_direntry_items[i].string[0]), vfat_direntry_items[i].inode_number);
|
||||
if(i > 0)
|
||||
vfat_inodes_nr[i-1] = vfat_direntry_items[i].inode_number;
|
||||
}
|
||||
|
@ -281,9 +296,14 @@ static void cfs_init(void)
|
|||
/* Determine size of VFAT file */
|
||||
_ata_read_sectors(CFS_CLUSTER2CLUSTER(vfat_inodes_nr[1]), 1, §or);
|
||||
inode = (struct cfs_inode*)§or;
|
||||
#ifndef BOOTLOADER
|
||||
sectors = (unsigned long*)buffer_alloc(VFAT_SECTOR_SIZE(inode->filesize));
|
||||
#else
|
||||
static unsigned long _sector[VFAT_SECTOR_SIZE(1024*1024*1024)]; /* 1GB guess */
|
||||
sectors = _sector;
|
||||
#endif
|
||||
|
||||
//printf("VFAT file size: 0x%x", inode->filesize);
|
||||
logf("VFAT file size: 0x%x", inode->filesize);
|
||||
|
||||
/* Clear data sectors */
|
||||
memset(§ors, 0, VFAT_SECTOR_SIZE(inode->filesize)*sizeof(unsigned long));
|
||||
|
@ -340,7 +360,10 @@ static void cfs_init(void)
|
|||
}
|
||||
}
|
||||
|
||||
//printf("Sector count: %d 0x%x", vfat_sector_count, vfat_sector_count);
|
||||
logf("Sector count: %d 0x%x", vfat_sector_count, vfat_sector_count);
|
||||
}
|
||||
else
|
||||
logf("Cannot find virtual FAT filesystem!"); //TODO: panicf
|
||||
|
||||
cfs_inited = true;
|
||||
}
|
||||
|
@ -386,6 +409,7 @@ int ata_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const v
|
|||
if(!cfs_inited)
|
||||
cfs_init();
|
||||
|
||||
#if 0 /* Disabled for now */
|
||||
/* Check if count is lesser than or equal to 1 native CFS sector */
|
||||
if(count <= 64)
|
||||
return _ata_write_sectors(IF_MV2(drive,) map_sector(start), count, buf);
|
||||
|
@ -406,8 +430,16 @@ int ata_write_sectors(IF_MV2(int drive,) unsigned long start, int count, const v
|
|||
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
(void)start;
|
||||
(void)count;
|
||||
(void)buf;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef BOOTLOADER
|
||||
|
||||
/*
|
||||
---------------------------------------------------------------------------
|
||||
MiniFileSystem parsing code
|
||||
|
@ -487,3 +519,5 @@ int load_minifs_file(char* filename, unsigned char* location)
|
|||
|
||||
return files[found].size;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -82,6 +82,8 @@ void ata_reset(void);
|
|||
void ata_device_init(void);
|
||||
bool ata_is_coldstart(void);
|
||||
void ide_power_enable(bool on);
|
||||
#ifdef BOOTLOADER
|
||||
int load_minifs_file(char* filename, unsigned char* location);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "button-target.h"
|
||||
#include "i2c-dm320.h"
|
||||
#include "sprintf.h"
|
||||
#include "logf.h"
|
||||
|
||||
#ifdef BUTTON_DEBUG
|
||||
#include "lcd-target.h"
|
||||
|
@ -36,22 +37,22 @@
|
|||
|
||||
#ifndef ZEN_VISION
|
||||
/* Creative Zen Vision:M */
|
||||
#define BTN_LEFT 0x5F00
|
||||
#define BTN_RIGHT 0x4F00
|
||||
#define BTN_BACK 0xBF00
|
||||
#define BTN_CUSTOM 0x8F00
|
||||
#define BTN_PLAY 0x2F00
|
||||
#define BTN_POWER 0x0F00
|
||||
#define BTN_MENU 0x9F00
|
||||
#define BTN_HOLD 0x9F06
|
||||
#define BTN_UNHOLD 0xAF06
|
||||
#define BTN_LEFT 0xAF00
|
||||
#define BTN_RIGHT 0xA700
|
||||
#define BTN_BACK 0xDF00
|
||||
#define BTN_CUSTOM 0xC700
|
||||
#define BTN_PLAY 0x9700
|
||||
#define BTN_POWER 0x8700
|
||||
#define BTN_MENU 0xCF00
|
||||
#define BTN_HOLD 0xCF07
|
||||
#define BTN_UNHOLD 0xD707
|
||||
|
||||
#define BTN_REL 1
|
||||
|
||||
#define BTN_TOUCHPAD_PRESS 0x1F00
|
||||
#define BTN_TOUCHPAD_PRESS 0x8F00
|
||||
#define BTN_TOUCHPAD_SCROLL_DOWN 0x0F03
|
||||
#define BTN_TOUCHPAD_CORNER_DOWN 0xAF00
|
||||
#define BTN_TOUCHPAD_CORNER_UP 0x3F00
|
||||
#define BTN_TOUCHPAD_CORNER_DOWN 0xD700
|
||||
#define BTN_TOUCHPAD_CORNER_UP 0x9F00
|
||||
#define BTN_TOUCHPAD_SCROLL_UP 0x0F04
|
||||
|
||||
#define HEADPHONE_PLUGIN_A 0x5707
|
||||
|
@ -63,8 +64,8 @@
|
|||
#define DOCK_UNPLUG 0xDF06
|
||||
#define DOCK_USB_INSERT 0x2F06
|
||||
#define DOCK_USB_UNPLUG 0x3F06
|
||||
#define DOCK_POWER_INSERT 0x2707
|
||||
#define DOCK_POWER_UNPLUG 0x2F07
|
||||
#define DOCK_POWER_INSERT 0x1707
|
||||
#define DOCK_POWER_UNPLUG 0x1F07
|
||||
|
||||
#else
|
||||
/* Creative Zen Vision */
|
||||
|
@ -272,6 +273,8 @@ void GIO0(void)
|
|||
lcd_update();
|
||||
sw = !sw;
|
||||
#endif
|
||||
logf("PIC: 0x%x", (unsigned int)((msg[3] << 24) |
|
||||
(msg[2] << 16) | (msg[1] << 8) | msg[0]));
|
||||
}
|
||||
|
||||
static void send_command_to_pic(const unsigned char in, unsigned char* out,
|
||||
|
@ -336,6 +339,7 @@ bool button_usb_connected(void)
|
|||
return (bool)(nonbtn & NONBUTTON_USB);
|
||||
}
|
||||
|
||||
#ifndef BOOTLOADER
|
||||
int pic_dbg_num_items(void)
|
||||
{
|
||||
return 13;
|
||||
|
@ -376,3 +380,4 @@ char* pic_dbg_item(int selected_item, void *data, char *buffer, size_t buffer_le
|
|||
}
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -37,7 +37,7 @@ bool usb_drv_connected(void)
|
|||
|
||||
int usb_detect(void)
|
||||
{
|
||||
if(button_usb_connected())
|
||||
if(usb_drv_connected())
|
||||
return USB_INSERTED;
|
||||
else
|
||||
return USB_EXTRACTED;
|
||||
|
|
|
@ -65,11 +65,11 @@
|
|||
b = value >> 16;
|
||||
|
||||
|
||||
#define ZVM_SPECIFIC asm volatile( \
|
||||
/*#define ZVM_SPECIFIC asm volatile( \
|
||||
"LDR R12, =0x50FFC000\n" \
|
||||
"LDRH R12, [R12]\n" \
|
||||
: : : "r12")
|
||||
//#define ZVM_SPECIFIC
|
||||
: : : "r12");*/
|
||||
#define ZVM_SPECIFIC
|
||||
|
||||
#define USE_IRAM
|
||||
|
||||
|
|
|
@ -235,7 +235,7 @@ data_abort_handler:
|
|||
mov r1, #2
|
||||
b UIE
|
||||
|
||||
#if defined(STUB) || defined(BOOTLOADER)
|
||||
#ifdef STUB
|
||||
UIE:
|
||||
b UIE
|
||||
#endif
|
||||
|
|
|
@ -146,7 +146,7 @@ int i2c_read(unsigned short address, unsigned char* buf, int count)
|
|||
|
||||
void i2c_init(void)
|
||||
{
|
||||
#if 0 //TODO: mimic OF I2C clock settings; currently this is done by the bootloader
|
||||
#ifdef CREATIVE_ZVx //TODO: mimic OF I2C clock settings; currently this is done by the bootloader
|
||||
IO_CLK_MOD2 &= ~CLK_MOD2_I2C; // turn I²C clock off (just to be sure)
|
||||
IO_CLK_LPCTL1 &= ~1; // set Powerdown mode to off
|
||||
IO_CLK_SEL0 &= ~0x800; // set I²C clock to PLLA
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue