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:
Solomon Peachy 2026-01-27 07:10:44 -05:00
parent b562c9d58f
commit 33678c6c3c
4 changed files with 43 additions and 44 deletions

View file

@ -34,13 +34,13 @@ static int dma_used = 0;
/* Status flags */
#define STATUS_CHANNEL_ACTIVE (1<<0)
static struct dma_channel_state
static struct dma_channel_state
{
volatile unsigned status;
void (*callback)(void);
} dma_state [NUM_CHANNELS];
struct dma_channel_regs
struct dma_channel_regs
{
volatile unsigned long disrc;
volatile unsigned long disrcc;
@ -51,7 +51,7 @@ struct dma_channel_regs
volatile unsigned long dcsrc;
volatile unsigned long dcdst;
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 *) &DISRC2,
(struct dma_channel_regs *) &DISRC3
}
}
;
@ -73,7 +73,7 @@ void dma_init(void)
/* Clear pending source */
SRCPND = DMA0_MASK | DMA1_MASK | DMA2_MASK | DMA3_MASK;
INTPND = DMA0_MASK | DMA1_MASK | DMA2_MASK | DMA3_MASK;
/* Enable interrupt in controller */
bitclr32(&INTMOD, 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 */
/* Reset the channel */
regs->dmasktrig |= DMASKTRIG_STOP;
/* Wait for DMA controller to be ready */
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)
{
struct dma_channel_regs *regs = dma_regs [channel];
/* TODO - transfer sizes (assumes word) */
if (DMA_GET_SRC(request->source_map, channel) == DMA_INVALID)
panicf ("DMA: invalid channel");
/* setup a transfer on specified channel */
dma_disable_channel (channel);
dma_disable_channel(channel);
if((unsigned long)request->source_addr < UNCACHED_BASE_ADDR)
regs->disrc = (unsigned long)request->source_addr + UNCACHED_BASE_ADDR;
else
regs->disrc = (unsigned long)request->source_addr;
regs->disrcc = request->source_control;
if((unsigned long)request->dest_addr < UNCACHED_BASE_ADDR)
regs->didst = (unsigned long)request->dest_addr + UNCACHED_BASE_ADDR;
else
regs->didst = (unsigned long)request->dest_addr;
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_state [channel].callback = request->callback;
/* Activate the channel */
commit_discard_dcache_range((void *)request->dest_addr, request->count * 4);
dma_state [channel].status |= STATUS_CHANNEL_ACTIVE;
regs->dmasktrig = DMASKTRIG_ON;
@ -157,7 +157,7 @@ void dma_enable_channel(int channel, struct dma_request *request)
/* Start DMA */
regs->dmasktrig |= DMASKTRIG_SW_TRIG;
}
}
/* ISRs */
@ -168,7 +168,7 @@ static inline void generic_isr (unsigned channel)
if (dma_state [channel].callback)
/* call callback for relevant channel */
dma_state [channel].callback();
dma_state [channel].status &= ~STATUS_CHANNEL_ACTIVE;
}
}

View file

@ -36,7 +36,7 @@
#error Unsupported target
#endif
struct dma_request
struct dma_request
{
volatile void *source_addr;
volatile void *dest_addr;
@ -51,7 +51,7 @@ struct dma_request
void dma_init(void);
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_release(void);

View file

@ -1,6 +1,6 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___void
* Open \______ \ ____ ____ | | _\_ |__ _______ ___void
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
@ -25,6 +25,7 @@
#include "system.h"
#include "stdlib.h"
#include "button.h"
#include "tick.h"
#include "touchscreen.h"
#define NO_OF_TOUCH_DATA 5
@ -99,9 +100,9 @@ void touchscreen_scan_device()
static int touch_data_index = 0;
int saveADCDLY;
/* check touch state */
if(ADCDAT1 & (1<<15))
/* check touch state */
if(ADCDAT1 & (1<<15))
{
return;
}
@ -111,23 +112,23 @@ void touchscreen_scan_device()
/* resets the index if the last touch could not be read 5 times */
touch_data_index = 0;
}
/* read touch data */
/* read touch data */
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 */
/* start adc */
ADCCON|= 0x1;
ADCCON|= 0x1;
/* wait for start and end */
while(ADCCON & 0x1);
while(!(ADCCON & 0x8000));
x[touch_data_index] = ADCDAT0&0x3ff;
y[touch_data_index] = ADCDAT1&0x3ff;
ADCTSC = 0xd3; /* back to interrupt mode */
ADCDLY = saveADCDLY;
touch_data_index++;
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 */
qsort(x, 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];
y_touch = last_y = y[(NO_OF_TOUCH_DATA - 1)/2];
last_touch = current_tick;
touch_hold = true;
touch_available = false;
}
*old_data = *data = touch_to_pixels(x_touch, y_touch);
btn |= touchscreen_to_pixels((*data&0xffff0000) >> 16,
(*data&0x0000ffff),
data);
@ -183,8 +184,6 @@ int touchscreen_read_device(int *data, int *old_data)
/* put the touchscreen back into interrupt mode */
touch_hold = false;
}
return btn;
}

View file

@ -799,7 +799,7 @@ int sd_read_sectors(IF_MD(int card_no,) sector_t start, int incount,
ret = 0; /* assume success */
else
#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);
return ret;
}
@ -827,7 +827,7 @@ int sd_write_sectors(IF_MD(int drive,) sector_t start, int count,
return 0; /* assume success */
else
#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
}
/*****************************************************************************/