mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-10-10 08:03:04 -04:00
s3c2440: Fix some compilation failures in the mini2440 bootloader
This whole platform has bitrotten, may be prudent to just nuke it. Change-Id: Ia12e7ebc160484e57a74dd689d6095d22f3dbfd9
This commit is contained in:
parent
b562c9d58f
commit
33678c6c3c
4 changed files with 43 additions and 44 deletions
|
|
@ -34,13 +34,13 @@ static int dma_used = 0;
|
||||||
/* Status flags */
|
/* Status flags */
|
||||||
#define STATUS_CHANNEL_ACTIVE (1<<0)
|
#define STATUS_CHANNEL_ACTIVE (1<<0)
|
||||||
|
|
||||||
static struct dma_channel_state
|
static struct dma_channel_state
|
||||||
{
|
{
|
||||||
volatile unsigned status;
|
volatile unsigned status;
|
||||||
void (*callback)(void);
|
void (*callback)(void);
|
||||||
} dma_state [NUM_CHANNELS];
|
} dma_state [NUM_CHANNELS];
|
||||||
|
|
||||||
struct dma_channel_regs
|
struct dma_channel_regs
|
||||||
{
|
{
|
||||||
volatile unsigned long disrc;
|
volatile unsigned long disrc;
|
||||||
volatile unsigned long disrcc;
|
volatile unsigned long disrcc;
|
||||||
|
|
@ -51,7 +51,7 @@ struct dma_channel_regs
|
||||||
volatile unsigned long dcsrc;
|
volatile unsigned long dcsrc;
|
||||||
volatile unsigned long dcdst;
|
volatile unsigned long dcdst;
|
||||||
volatile unsigned long dmasktrig;
|
volatile unsigned long dmasktrig;
|
||||||
volatile unsigned long reserved [7]; /* pad to 0x40 bytes */
|
volatile unsigned long reserved [7]; /* pad to 0x40 bytes */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -61,7 +61,7 @@ struct dma_channel_regs *dma_regs [4] =
|
||||||
(struct dma_channel_regs *) &DISRC1,
|
(struct dma_channel_regs *) &DISRC1,
|
||||||
(struct dma_channel_regs *) &DISRC2,
|
(struct dma_channel_regs *) &DISRC2,
|
||||||
(struct dma_channel_regs *) &DISRC3
|
(struct dma_channel_regs *) &DISRC3
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -73,7 +73,7 @@ void dma_init(void)
|
||||||
/* Clear pending source */
|
/* Clear pending source */
|
||||||
SRCPND = DMA0_MASK | DMA1_MASK | DMA2_MASK | DMA3_MASK;
|
SRCPND = DMA0_MASK | DMA1_MASK | DMA2_MASK | DMA3_MASK;
|
||||||
INTPND = DMA0_MASK | DMA1_MASK | DMA2_MASK | DMA3_MASK;
|
INTPND = DMA0_MASK | DMA1_MASK | DMA2_MASK | DMA3_MASK;
|
||||||
|
|
||||||
/* Enable interrupt in controller */
|
/* Enable interrupt in controller */
|
||||||
bitclr32(&INTMOD, DMA0_MASK | DMA1_MASK | DMA2_MASK | DMA3_MASK);
|
bitclr32(&INTMOD, DMA0_MASK | DMA1_MASK | DMA2_MASK | DMA3_MASK);
|
||||||
bitclr32(&INTMSK, DMA0_MASK | DMA1_MASK | DMA2_MASK | DMA3_MASK);
|
bitclr32(&INTMSK, DMA0_MASK | DMA1_MASK | DMA2_MASK | DMA3_MASK);
|
||||||
|
|
@ -101,15 +101,15 @@ void dma_release(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void dma_disable_channel(int channel)
|
void dma_disable_channel(int channel)
|
||||||
{
|
{
|
||||||
struct dma_channel_regs *regs = dma_regs [channel];
|
struct dma_channel_regs *regs = dma_regs [channel];
|
||||||
|
|
||||||
/* disable the specified channel */
|
/* disable the specified channel */
|
||||||
|
|
||||||
/* Reset the channel */
|
/* Reset the channel */
|
||||||
regs->dmasktrig |= DMASKTRIG_STOP;
|
regs->dmasktrig |= DMASKTRIG_STOP;
|
||||||
|
|
||||||
/* Wait for DMA controller to be ready */
|
/* Wait for DMA controller to be ready */
|
||||||
while(regs->dmasktrig & DMASKTRIG_ON)
|
while(regs->dmasktrig & DMASKTRIG_ON)
|
||||||
;
|
;
|
||||||
|
|
@ -120,35 +120,35 @@ inline void dma_disable_channel(int channel)
|
||||||
void dma_enable_channel(int channel, struct dma_request *request)
|
void dma_enable_channel(int channel, struct dma_request *request)
|
||||||
{
|
{
|
||||||
struct dma_channel_regs *regs = dma_regs [channel];
|
struct dma_channel_regs *regs = dma_regs [channel];
|
||||||
|
|
||||||
/* TODO - transfer sizes (assumes word) */
|
/* TODO - transfer sizes (assumes word) */
|
||||||
|
|
||||||
if (DMA_GET_SRC(request->source_map, channel) == DMA_INVALID)
|
if (DMA_GET_SRC(request->source_map, channel) == DMA_INVALID)
|
||||||
panicf ("DMA: invalid channel");
|
panicf ("DMA: invalid channel");
|
||||||
|
|
||||||
/* setup a transfer on specified channel */
|
/* setup a transfer on specified channel */
|
||||||
dma_disable_channel (channel);
|
dma_disable_channel(channel);
|
||||||
|
|
||||||
if((unsigned long)request->source_addr < UNCACHED_BASE_ADDR)
|
if((unsigned long)request->source_addr < UNCACHED_BASE_ADDR)
|
||||||
regs->disrc = (unsigned long)request->source_addr + UNCACHED_BASE_ADDR;
|
regs->disrc = (unsigned long)request->source_addr + UNCACHED_BASE_ADDR;
|
||||||
else
|
else
|
||||||
regs->disrc = (unsigned long)request->source_addr;
|
regs->disrc = (unsigned long)request->source_addr;
|
||||||
regs->disrcc = request->source_control;
|
regs->disrcc = request->source_control;
|
||||||
|
|
||||||
if((unsigned long)request->dest_addr < UNCACHED_BASE_ADDR)
|
if((unsigned long)request->dest_addr < UNCACHED_BASE_ADDR)
|
||||||
regs->didst = (unsigned long)request->dest_addr + UNCACHED_BASE_ADDR;
|
regs->didst = (unsigned long)request->dest_addr + UNCACHED_BASE_ADDR;
|
||||||
else
|
else
|
||||||
regs->didst = (unsigned long)request->dest_addr;
|
regs->didst = (unsigned long)request->dest_addr;
|
||||||
regs->didstc = request->dest_control;
|
regs->didstc = request->dest_control;
|
||||||
|
|
||||||
regs->dcon = request->control | request->count |
|
regs->dcon = request->control | request->count |
|
||||||
DMA_GET_SRC(request->source_map, channel) * DCON_HWSRCSEL;
|
DMA_GET_SRC(request->source_map, channel) * DCON_HWSRCSEL;
|
||||||
|
|
||||||
dma_state [channel].callback = request->callback;
|
dma_state [channel].callback = request->callback;
|
||||||
|
|
||||||
/* Activate the channel */
|
/* Activate the channel */
|
||||||
commit_discard_dcache_range((void *)request->dest_addr, request->count * 4);
|
commit_discard_dcache_range((void *)request->dest_addr, request->count * 4);
|
||||||
|
|
||||||
dma_state [channel].status |= STATUS_CHANNEL_ACTIVE;
|
dma_state [channel].status |= STATUS_CHANNEL_ACTIVE;
|
||||||
regs->dmasktrig = DMASKTRIG_ON;
|
regs->dmasktrig = DMASKTRIG_ON;
|
||||||
|
|
||||||
|
|
@ -157,7 +157,7 @@ void dma_enable_channel(int channel, struct dma_request *request)
|
||||||
/* Start DMA */
|
/* Start DMA */
|
||||||
regs->dmasktrig |= DMASKTRIG_SW_TRIG;
|
regs->dmasktrig |= DMASKTRIG_SW_TRIG;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ISRs */
|
/* ISRs */
|
||||||
|
|
@ -168,7 +168,7 @@ static inline void generic_isr (unsigned channel)
|
||||||
if (dma_state [channel].callback)
|
if (dma_state [channel].callback)
|
||||||
/* call callback for relevant channel */
|
/* call callback for relevant channel */
|
||||||
dma_state [channel].callback();
|
dma_state [channel].callback();
|
||||||
|
|
||||||
dma_state [channel].status &= ~STATUS_CHANNEL_ACTIVE;
|
dma_state [channel].status &= ~STATUS_CHANNEL_ACTIVE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@
|
||||||
#error Unsupported target
|
#error Unsupported target
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct dma_request
|
struct dma_request
|
||||||
{
|
{
|
||||||
volatile void *source_addr;
|
volatile void *source_addr;
|
||||||
volatile void *dest_addr;
|
volatile void *dest_addr;
|
||||||
|
|
@ -51,7 +51,7 @@ struct dma_request
|
||||||
void dma_init(void);
|
void dma_init(void);
|
||||||
void dma_enable_channel(int channel, struct dma_request *request);
|
void dma_enable_channel(int channel, struct dma_request *request);
|
||||||
|
|
||||||
inline void dma_disable_channel(int channel);
|
void dma_disable_channel(int channel);
|
||||||
|
|
||||||
void dma_retain(void);
|
void dma_retain(void);
|
||||||
void dma_release(void);
|
void dma_release(void);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* __________ __ ___.
|
* __________ __ ___.
|
||||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___void
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___void
|
||||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "stdlib.h"
|
#include "stdlib.h"
|
||||||
#include "button.h"
|
#include "button.h"
|
||||||
|
#include "tick.h"
|
||||||
#include "touchscreen.h"
|
#include "touchscreen.h"
|
||||||
|
|
||||||
#define NO_OF_TOUCH_DATA 5
|
#define NO_OF_TOUCH_DATA 5
|
||||||
|
|
@ -99,9 +100,9 @@ void touchscreen_scan_device()
|
||||||
static int touch_data_index = 0;
|
static int touch_data_index = 0;
|
||||||
|
|
||||||
int saveADCDLY;
|
int saveADCDLY;
|
||||||
|
|
||||||
/* check touch state */
|
/* check touch state */
|
||||||
if(ADCDAT1 & (1<<15))
|
if(ADCDAT1 & (1<<15))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -111,23 +112,23 @@ void touchscreen_scan_device()
|
||||||
/* resets the index if the last touch could not be read 5 times */
|
/* resets the index if the last touch could not be read 5 times */
|
||||||
touch_data_index = 0;
|
touch_data_index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read touch data */
|
/* read touch data */
|
||||||
saveADCDLY = ADCDLY;
|
saveADCDLY = ADCDLY;
|
||||||
ADCDLY = 40000; /*delay ~0.8ms (1/50M)*4000 */
|
ADCDLY = 40000; /*delay ~0.8ms (1/50M)*4000 */
|
||||||
ADCTSC = (1<<3)|(1<<2); /* pullup disable, seq x,y pos measure */
|
ADCTSC = (1<<3)|(1<<2); /* pullup disable, seq x,y pos measure */
|
||||||
/* start adc */
|
/* start adc */
|
||||||
ADCCON|= 0x1;
|
ADCCON|= 0x1;
|
||||||
/* wait for start and end */
|
/* wait for start and end */
|
||||||
while(ADCCON & 0x1);
|
while(ADCCON & 0x1);
|
||||||
while(!(ADCCON & 0x8000));
|
while(!(ADCCON & 0x8000));
|
||||||
|
|
||||||
x[touch_data_index] = ADCDAT0&0x3ff;
|
x[touch_data_index] = ADCDAT0&0x3ff;
|
||||||
y[touch_data_index] = ADCDAT1&0x3ff;
|
y[touch_data_index] = ADCDAT1&0x3ff;
|
||||||
|
|
||||||
ADCTSC = 0xd3; /* back to interrupt mode */
|
ADCTSC = 0xd3; /* back to interrupt mode */
|
||||||
ADCDLY = saveADCDLY;
|
ADCDLY = saveADCDLY;
|
||||||
|
|
||||||
touch_data_index++;
|
touch_data_index++;
|
||||||
|
|
||||||
if (touch_data_index > NO_OF_TOUCH_DATA - 1)
|
if (touch_data_index > NO_OF_TOUCH_DATA - 1)
|
||||||
|
|
@ -161,18 +162,18 @@ int touchscreen_read_device(int *data, int *old_data)
|
||||||
/* sort the 5 data taken and use the median value */
|
/* sort the 5 data taken and use the median value */
|
||||||
qsort(x, NO_OF_TOUCH_DATA, sizeof(short), short_cmp);
|
qsort(x, NO_OF_TOUCH_DATA, sizeof(short), short_cmp);
|
||||||
qsort(y, NO_OF_TOUCH_DATA, sizeof(short), short_cmp);
|
qsort(y, NO_OF_TOUCH_DATA, sizeof(short), short_cmp);
|
||||||
|
|
||||||
x_touch = last_x = x[(NO_OF_TOUCH_DATA - 1)/2];
|
x_touch = last_x = x[(NO_OF_TOUCH_DATA - 1)/2];
|
||||||
y_touch = last_y = y[(NO_OF_TOUCH_DATA - 1)/2];
|
y_touch = last_y = y[(NO_OF_TOUCH_DATA - 1)/2];
|
||||||
|
|
||||||
last_touch = current_tick;
|
last_touch = current_tick;
|
||||||
|
|
||||||
touch_hold = true;
|
touch_hold = true;
|
||||||
touch_available = false;
|
touch_available = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
*old_data = *data = touch_to_pixels(x_touch, y_touch);
|
*old_data = *data = touch_to_pixels(x_touch, y_touch);
|
||||||
|
|
||||||
btn |= touchscreen_to_pixels((*data&0xffff0000) >> 16,
|
btn |= touchscreen_to_pixels((*data&0xffff0000) >> 16,
|
||||||
(*data&0x0000ffff),
|
(*data&0x0000ffff),
|
||||||
data);
|
data);
|
||||||
|
|
@ -183,8 +184,6 @@ int touchscreen_read_device(int *data, int *old_data)
|
||||||
/* put the touchscreen back into interrupt mode */
|
/* put the touchscreen back into interrupt mode */
|
||||||
touch_hold = false;
|
touch_hold = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return btn;
|
return btn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -799,7 +799,7 @@ int sd_read_sectors(IF_MD(int card_no,) sector_t start, int incount,
|
||||||
ret = 0; /* assume success */
|
ret = 0; /* assume success */
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
ret = sd_transfer_sectors(card_no, start, incount, inbuf, false);
|
ret = sd_transfer_sectors(IF_MD_DRV(card_no), start, incount, inbuf, false);
|
||||||
dbgprintf ("sd_read, ret=%d\n", ret);
|
dbgprintf ("sd_read, ret=%d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -827,7 +827,7 @@ int sd_write_sectors(IF_MD(int drive,) sector_t start, int count,
|
||||||
return 0; /* assume success */
|
return 0; /* assume success */
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
return sd_transfer_sectors(drive, start, count, (void*)outbuf, true);
|
return sd_transfer_sectors(IF_MD_DRV(drive), start, count, (void*)outbuf, true);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue