summaryrefslogtreecommitdiffstats
path: root/firmware/target/mips
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/mips')
-rw-r--r--firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c10
-rw-r--r--firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c12
-rw-r--r--firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c8
-rw-r--r--firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c8
-rw-r--r--firmware/target/mips/ingenic_jz47xx/usb-jz4740.c8
5 files changed, 23 insertions, 23 deletions
diff --git a/firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c b/firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c
index 22c1dc56e1..b7b239e3b9 100644
--- a/firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c
+++ b/firmware/target/mips/ingenic_jz47xx/ata-nand-jz4740.c
@@ -117,7 +117,7 @@ static struct nand_param internal_param;
static struct mutex nand_mtx;
#ifdef USE_DMA
static struct mutex nand_dma_mtx;
-static struct wakeup nand_wkup;
+static struct semaphore nand_dma_complete;
#endif
static unsigned char temp_page[4096]; /* Max page size */
@@ -170,7 +170,7 @@ static void jz_nand_write_dma(void *source, unsigned int len, int bw)
yield();
#else
REG_DMAC_DCMD(DMA_NAND_CHANNEL) |= DMAC_DCMD_TIE; /* Enable DMA interrupt */
- wakeup_wait(&nand_wkup, TIMEOUT_BLOCK);
+ semaphore_wait(&nand_dma_complete, TIMEOUT_BLOCK);
#endif
REG_DMAC_DCCSR(DMA_NAND_CHANNEL) &= ~DMAC_DCCSR_EN; /* Disable DMA channel */
@@ -202,7 +202,7 @@ static void jz_nand_read_dma(void *target, unsigned int len, int bw)
yield();
#else
REG_DMAC_DCMD(DMA_NAND_CHANNEL) |= DMAC_DCMD_TIE; /* Enable DMA interrupt */
- wakeup_wait(&nand_wkup, TIMEOUT_BLOCK);
+ semaphore_wait(&nand_dma_complete, TIMEOUT_BLOCK);
#endif
//REG_DMAC_DCCSR(DMA_NAND_CHANNEL) &= ~DMAC_DCCSR_EN; /* Disable DMA channel */
@@ -226,7 +226,7 @@ void DMA_CALLBACK(DMA_NAND_CHANNEL)(void)
if (REG_DMAC_DCCSR(DMA_NAND_CHANNEL) & DMAC_DCCSR_TT)
REG_DMAC_DCCSR(DMA_NAND_CHANNEL) &= ~DMAC_DCCSR_TT;
- wakeup_signal(&nand_wkup);
+ semaphore_release(&nand_dma_complete);
}
#endif /* USE_DMA */
@@ -603,7 +603,7 @@ int nand_init(void)
mutex_init(&nand_mtx);
#ifdef USE_DMA
mutex_init(&nand_dma_mtx);
- wakeup_init(&nand_wkup);
+ semaphore_init(&nand_dma_complete, 1, 0);
system_enable_irq(DMA_IRQ(DMA_NAND_CHANNEL));
#endif
diff --git a/firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c b/firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c
index efca66445a..846b9095f1 100644
--- a/firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c
+++ b/firmware/target/mips/ingenic_jz47xx/ata-sd-jz4740.c
@@ -47,7 +47,7 @@ static long sd_stack[(DEFAULT_STACK_SIZE*2 + 0x1c0)/sizeof(long)];
static const char sd_thread_name[] = "ata/sd";
static struct event_queue sd_queue;
static struct mutex sd_mtx;
-static struct wakeup sd_wakeup;
+static struct semaphore sd_wakeup;
static void sd_thread(void) NORETURN_ATTR;
static int use_4bit;
@@ -831,7 +831,7 @@ static int jz_sd_exec_cmd(struct sd_request *request)
/* Wait for command completion */
//__intc_unmask_irq(IRQ_MSC);
- //wakeup_wait(&sd_wakeup, 100);
+ //semaphore_wait(&sd_wakeup, 100);
while (timeout-- && !(REG_MSC_STAT & MSC_STAT_END_CMD_RES));
@@ -881,7 +881,7 @@ static int jz_sd_exec_cmd(struct sd_request *request)
#endif
}
//__intc_unmask_irq(IRQ_MSC);
- //wakeup_wait(&sd_wakeup, 100);
+ //semaphore_wait(&sd_wakeup, 100);
/* Wait for Data Done */
while (!(REG_MSC_IREG & MSC_IREG_DATA_TRAN_DONE));
REG_MSC_IREG = MSC_IREG_DATA_TRAN_DONE; /* clear status */
@@ -891,7 +891,7 @@ static int jz_sd_exec_cmd(struct sd_request *request)
if (events & SD_EVENT_PROG_DONE)
{
//__intc_unmask_irq(IRQ_MSC);
- //wakeup_wait(&sd_wakeup, 100);
+ //semaphore_wait(&sd_wakeup, 100);
while (!(REG_MSC_IREG & MSC_IREG_PRG_DONE));
REG_MSC_IREG = MSC_IREG_PRG_DONE; /* clear status */
}
@@ -945,7 +945,7 @@ static void jz_sd_rx_handler(unsigned int arg)
/* MSC interrupt handler */
void MSC(void)
{
- //wakeup_signal(&sd_wakeup);
+ //semaphore_release(&sd_wakeup);
logf("MSC interrupt");
}
@@ -1228,7 +1228,7 @@ int sd_init(void)
static bool inited = false;
if(!inited)
{
- wakeup_init(&sd_wakeup);
+ semaphore_init(&sd_wakeup, 1, 0);
mutex_init(&sd_mtx);
queue_init(&sd_queue, true);
create_thread(sd_thread, sd_stack, sizeof(sd_stack), 0,
diff --git a/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c b/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c
index ef45317c3f..e74e227e47 100644
--- a/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c
+++ b/firmware/target/mips/ingenic_jz47xx/lcd-jz4740.c
@@ -34,7 +34,7 @@
static volatile bool lcd_is_on = false;
static struct mutex lcd_mtx;
-static struct wakeup lcd_wkup;
+static struct semaphore lcd_wkup;
static int lcd_count = 0;
void lcd_clock_enable(void)
@@ -56,7 +56,7 @@ void lcd_init_device(void)
lcd_is_on = true;
mutex_init(&lcd_mtx);
- wakeup_init(&lcd_wkup);
+ semaphore_init(&lcd_wkup, 1, 0);
system_enable_irq(DMA_IRQ(DMA_LCD_CHANNEL));
}
@@ -118,7 +118,7 @@ void lcd_update_rect(int x, int y, int width, int height)
REG_DMAC_DCCSR(DMA_LCD_CHANNEL) |= DMAC_DCCSR_EN; /* Enable DMA channel */
REG_DMAC_DCMD(DMA_LCD_CHANNEL) |= DMAC_DCMD_TIE; /* Enable DMA interrupt */
- wakeup_wait(&lcd_wkup, TIMEOUT_BLOCK); /* Sleeping in lcd_update() should be safe */
+ semaphore_wait(&lcd_wkup, TIMEOUT_BLOCK); /* Sleeping in lcd_update() should be safe */
REG_DMAC_DCCSR(DMA_LCD_CHANNEL) &= ~DMAC_DCCSR_EN; /* Disable DMA channel */
dma_disable();
@@ -145,7 +145,7 @@ void DMA_CALLBACK(DMA_LCD_CHANNEL)(void)
if (REG_DMAC_DCCSR(DMA_LCD_CHANNEL) & DMAC_DCCSR_TT)
REG_DMAC_DCCSR(DMA_LCD_CHANNEL) &= ~DMAC_DCCSR_TT;
- wakeup_signal(&lcd_wkup);
+ semaphore_release(&lcd_wkup);
}
/* Update the display.
diff --git a/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c b/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c
index 92cf0d7552..99d73fa3c7 100644
--- a/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c
+++ b/firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c
@@ -74,7 +74,7 @@ static int datacount = 0;
static volatile int cur_touch = 0;
static volatile bool pen_down = false;
static struct mutex battery_mtx;
-static struct wakeup battery_wkup;
+static struct semaphore battery_done;
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
{
@@ -113,7 +113,7 @@ unsigned int battery_adc_voltage(void)
REG_SADC_ENA |= SADC_ENA_PBATEN;
- wakeup_wait(&battery_wkup, HZ/4);
+ semaphore_wait(&battery_done, HZ/4);
bat_val = REG_SADC_BATDAT;
logf("%d %d", bat_val, (bat_val * BATTERY_SCALE_FACTOR) / 4096);
@@ -268,7 +268,7 @@ void SADC(void)
if(state & SADC_CTRL_PBATRDYM)
{
/* Battery AD IRQ */
- wakeup_signal(&battery_wkup);
+ semaphore_release(&battery_done);
}
}
@@ -290,7 +290,7 @@ void adc_init(void)
REG_SADC_ENA = SADC_ENA_TSEN;
mutex_init(&battery_mtx);
- wakeup_init(&battery_wkup);
+ semaphore_init(&battery_done, 1, 0);
}
void adc_close(void)
diff --git a/firmware/target/mips/ingenic_jz47xx/usb-jz4740.c b/firmware/target/mips/ingenic_jz47xx/usb-jz4740.c
index f12f1bed82..a615d3d4da 100644
--- a/firmware/target/mips/ingenic_jz47xx/usb-jz4740.c
+++ b/firmware/target/mips/ingenic_jz47xx/usb-jz4740.c
@@ -69,7 +69,7 @@ struct usb_endpoint
unsigned short fifo_size;
bool wait;
- struct wakeup wakeup;
+ struct semaphore complete;
};
static unsigned char ep0_rx_buf[64];
@@ -171,7 +171,7 @@ static inline void ep_transfer_completed(struct usb_endpoint* ep)
ep->buf = NULL;
ep->busy = false;
if(ep->wait)
- wakeup_signal(&ep->wakeup);
+ semaphore_release(&ep->complete);
}
static void EP0_send(void)
@@ -598,7 +598,7 @@ void usb_init_device(void)
system_enable_irq(IRQ_UDC);
for(i=0; i<TOTAL_EP(); i++)
- wakeup_init(&endpoints[i].wakeup);
+ semaphore_init(&endpoints[i].complete, 1, 0);
}
#ifdef USB_GPIO_IRQ
@@ -715,7 +715,7 @@ static void usb_drv_send_internal(struct usb_endpoint* ep, void* ptr, int length
if(blocking)
{
- wakeup_wait(&ep->wakeup, TIMEOUT_BLOCK);
+ semaphore_wait(&ep->complete, TIMEOUT_BLOCK);
ep->wait = false;
}
}