handle CHSR_DONE in mite.c now (in mite_get_status() in particular).
{
mite->channels[i].mite = mite;
mite->channels[i].channel = i;
+ mite->channels[i].done = 1;
}
mite->next=mite_devices;
mite_devices=mite;
{
struct mite_struct *mite = mite_chan->mite;
int chor;
+ unsigned long flags;
MDPRINTK("mite_dma_arm ch%i\n", channel);
/* memory barrier is intended to insure any twiddling with the buffer
smp_mb();
/* arm */
chor = CHOR_START;
+ comedi_spin_lock_irqsave(&mite->lock, flags);
+ mite_chan->done = 0;
writel(chor, mite->mite_io_addr + MITE_CHOR(mite_chan->channel));
+ mmiowb();
+ comedi_spin_unlock_irqrestore(&mite->lock, flags);
// mite_dma_tcr(mite, channel);
}
return 0;
}
+unsigned mite_get_status(struct mite_channel *mite_chan)
+{
+ struct mite_struct *mite = mite_chan->mite;
+ unsigned status;
+ unsigned long flags;
+
+ comedi_spin_lock_irqsave(&mite->lock, flags);
+ status = readl(mite->mite_io_addr + MITE_CHSR(mite_chan->channel));
+ if(status & CHSR_DONE)
+ {
+ mite_chan->done = 1;
+ writel(CHOR_CLRDONE, mite->mite_io_addr + MITE_CHOR(mite_chan->channel));
+ }
+ mmiowb();
+ comedi_spin_unlock_irqrestore(&mite->lock, flags);
+ return status;
+}
+
+int mite_done(const struct mite_channel *mite_chan)
+{
+ struct mite_struct *mite = mite_chan->mite;
+ unsigned long flags;
+ int done;
+
+ comedi_spin_lock_irqsave(&mite->lock, flags);
+ done = mite_chan->done;
+ comedi_spin_unlock_irqrestore(&mite->lock, flags);
+ return done;
+}
+
#ifdef DEBUG_MITE
static void mite_decode(char **bit_str, unsigned int bits);
EXPORT_SYMBOL(mite_bytes_read_from_memory_lb);
EXPORT_SYMBOL(mite_bytes_read_from_memory_ub);
EXPORT_SYMBOL(mite_bytes_in_transit);
+EXPORT_SYMBOL(mite_get_status);
+EXPORT_SYMBOL(mite_done);
#ifdef DEBUG_MITE
EXPORT_SYMBOL(mite_decode);
EXPORT_SYMBOL(mite_dump_regs);
struct mite_struct *mite;
unsigned channel;
int dir;
+ int done;
struct mite_dma_descriptor_ring *ring;
};
u32 mite_bytes_read_from_memory_lb(struct mite_channel *mite_chan);
u32 mite_bytes_read_from_memory_ub(struct mite_channel *mite_chan);
u32 mite_bytes_in_transit(struct mite_channel *mite_chan);
+unsigned mite_get_status(struct mite_channel *mite_chan);
+int mite_done(const struct mite_channel *mite_chan);
#if 0
unsigned long mite_ll_from_kvmem(struct mite_struct *mite,comedi_async *async,int len);
writel(CHOR_DMARESET | CHOR_FRESET, mite_chan->mite->mite_io_addr + MITE_CHOR(mite_chan->channel));
};
-static inline unsigned mite_get_status(struct mite_channel *mite_chan)
-{
- struct mite_struct *mite = mite_chan->mite;
-
- return readl(mite->mite_io_addr + MITE_CHSR(mite_chan->channel));
-}
-
#endif
comedi_spin_lock_irqsave(&devpriv->mite_channel_lock, flags_too);
if(devpriv->ai_mite_chan)
- ai_mite_status = readl(mite->mite_io_addr + MITE_CHSR(devpriv->ai_mite_chan->channel));
+ ai_mite_status = mite_get_status(devpriv->ai_mite_chan);
if(devpriv->ao_mite_chan)
- ao_mite_status = readl(mite->mite_io_addr + MITE_CHSR(devpriv->ao_mite_chan->channel));
+ ao_mite_status = mite_get_status(devpriv->ao_mite_chan);
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags_too);
}
g_status = devpriv->stc_readw(dev, G_Status_Register);
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
return;
}
- gpct_mite_status = readl(mite_chan->mite->mite_io_addr + MITE_CHSR(mite_chan->channel));
+ gpct_mite_status = mite_get_status(mite_chan);
if(gpct_mite_status & CHSR_LINKC)
{
writel(CHOR_CLRLC, devpriv->mite->mite_io_addr + MITE_CHOR(mite_chan->channel));
}
- if(gpct_mite_status & CHSR_DONE)
- {
- writel(CHOR_CLRDONE, devpriv->mite->mite_io_addr + MITE_CHOR(mite_chan->channel));
- }
mite_sync_input_dma(mite_chan, s->async);
comedi_spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
if(mite_chan == NULL ||
mite_chan->dir != COMEDI_INPUT ||
- (mite_get_status(devpriv->counter_dev->counters[counter_index].mite_chan) & CHSR_DONE))
+ (mite_done(devpriv->counter_dev->counters[counter_index].mite_chan)))
{
retval = 1;
}
ni_mio_print_status_a(status);
#endif
#ifdef PCIDMA
- /* Currently, mite.c requires us to handle LINKC and DONE */
+ /* Currently, mite.c requires us to handle LINKC */
if(ai_mite_status & CHSR_LINKC){
writel(CHOR_CLRLC, devpriv->mite->mite_io_addr + MITE_CHOR(devpriv->ai_mite_chan->channel));
ni_sync_ai_dma(dev);
}
- if(ai_mite_status & CHSR_DONE){
- writel(CHOR_CLRDONE, devpriv->mite->mite_io_addr + MITE_CHOR(devpriv->ai_mite_chan->channel));
- }
-
if(ai_mite_status & ~(CHSR_INT | CHSR_LINKC | CHSR_DONE | CHSR_MRDY | CHSR_DRDY | CHSR_DRQ1 | CHSR_DRQ0 | CHSR_ERROR | CHSR_SABORT | CHSR_XFERR | CHSR_LxERR_mask)){
rt_printk("unknown mite interrupt, ack! (ai_mite_status=%08x)\n", ai_mite_status);
//mite_print_chsr(ai_mite_status);
#endif
#ifdef PCIDMA
- /* Currently, mite.c requires us to handle LINKC and DONE */
+ /* Currently, mite.c requires us to handle LINKC */
if(ao_mite_status & CHSR_LINKC){
mite_handle_b_linkc(devpriv->mite, dev);
}
- if(ao_mite_status & CHSR_DONE){
- writel(CHOR_CLRDONE, devpriv->mite->mite_io_addr + MITE_CHOR(devpriv->ao_mite_chan->channel));
- }
-
if(ao_mite_status & ~(CHSR_INT | CHSR_LINKC | CHSR_DONE | CHSR_MRDY | CHSR_DRDY | CHSR_DRQ1 | CHSR_DRQ0 | CHSR_ERROR | CHSR_SABORT | CHSR_XFERR | CHSR_LxERR_mask)){
rt_printk("unknown mite interrupt, ack! (ao_mite_status=%08x)\n", ao_mite_status);
//mite_print_chsr(ao_mite_status);
comedi_spin_lock_irqsave(&devpriv->mite_channel_lock, irq_flags);
if(devpriv->di_mite_chan)
- m_status = readl(mite->mite_io_addr + MITE_CHSR(devpriv->di_mite_chan->channel));
+ m_status = mite_get_status(devpriv->di_mite_chan);
#ifdef MITE_DEBUG
mite_print_chsr(m_status);
#endif
mite_sync_input_dma(devpriv->di_mite_chan, s->async);
/* XXX need to byteswap */
}
- if(m_status & CHSR_DONE){
- writel(CHOR_CLRDONE, mite->mite_io_addr + MITE_CHOR(devpriv->di_mite_chan->channel));
- }
if(m_status & ~(CHSR_INT | CHSR_LINKC | CHSR_DONE | CHSR_DRDY | CHSR_DRQ1 | CHSR_MRDY)){
DPRINTK("unknown mite interrupt, disabling IRQ\n");
async->events |= COMEDI_CB_EOA | COMEDI_CB_ERROR;