diff options
Diffstat (limited to 'c/src/lib/libbsp/powerpc/gen5200/ide/pcmcia_ide.c')
-rw-r--r-- | c/src/lib/libbsp/powerpc/gen5200/ide/pcmcia_ide.c | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/c/src/lib/libbsp/powerpc/gen5200/ide/pcmcia_ide.c b/c/src/lib/libbsp/powerpc/gen5200/ide/pcmcia_ide.c index dc025cc7ff..bf4d71f81d 100644 --- a/c/src/lib/libbsp/powerpc/gen5200/ide/pcmcia_ide.c +++ b/c/src/lib/libbsp/powerpc/gen5200/ide/pcmcia_ide.c @@ -243,7 +243,7 @@ static void pcmcia_ide_recv_dmairq_hdl(rtems_irq_hdl_param unused) bestcomm_glue_irq_disable(TASK_GEN_DP_BD_0); pcmcia_ide_rxInterrupts++; /* Rx int has occurred */ - + if (pcmcia_ide_hdl_task != 0) { rtems_event_send(pcmcia_ide_hdl_task,PCMCIA_IDE_INTERRUPT_EVENT); } @@ -258,7 +258,7 @@ static void pcmcia_ide_xmit_dmairq_hdl(rtems_irq_hdl_param unused) bestcomm_glue_irq_disable(TASK_GEN_DP_BD_1); pcmcia_ide_txInterrupts++; /* Tx int has occurred */ - + if (pcmcia_ide_hdl_task != 0) { rtems_event_send(pcmcia_ide_hdl_task,PCMCIA_IDE_INTERRUPT_EVENT); } @@ -279,7 +279,7 @@ void mpc5200_pcmciaide_dma_init(int minor) rxParam.NumBD = PCMCIA_IDE_DMA_RD_BD_CNT; rxParam.Size.MaxBuf = PCMCIA_IDE_RD_SECTOR_SIZE; rxParam.Initiator = INITIATOR_ALWAYS; - rxParam.StartAddrSrc = + rxParam.StartAddrSrc = (uint32)mpc5200_ata_drive_regs[IDE_REGISTER_DATA_WORD]; rxParam.IncrSrc = 0; rxParam.SzSrc = sizeof(uint16_t); @@ -302,7 +302,7 @@ void mpc5200_pcmciaide_dma_init(int minor) (uint32)mpc5200_ata_drive_regs[IDE_REGISTER_DATA_WORD]; txParam.IncrDst = 0; txParam.SzDst = sizeof(uint16_t); - + pcmcia_ide_txTaskId = TaskSetup( TASK_GEN_DP_BD_1, &txParam ); /* * FIXME: Init BD rings @@ -313,21 +313,21 @@ void mpc5200_pcmciaide_dma_init(int minor) */ /* * connect interrupt handlers - */ + */ bestcomm_glue_irq_install(TASK_GEN_DP_BD_1,pcmcia_ide_xmit_dmairq_hdl,NULL); bestcomm_glue_irq_install(TASK_GEN_DP_BD_0,pcmcia_ide_recv_dmairq_hdl,NULL); } void mpc5200_pcmciaide_dma_blockop(bool is_write, - int minor, - uint16_t block_size, + int minor, + uint16_t block_size, rtems_blkdev_sg_buffer *bufs, - uint32_t *cbuf, + uint32_t *cbuf, uint32_t *pos) { /* - * Nameing: + * Nameing: * - a block is one unit of data on disk (multiple sectors) * - a buffer is a contignuous chunk of data in memory * a block on disk may be filled with data from several buffers @@ -360,16 +360,16 @@ void mpc5200_pcmciaide_dma_blockop(bool is_write, */ while ((rc == RTEMS_SUCCESSFUL) && (bufs_from_dma < bufs_total)) { - - while ((rc == RTEMS_SUCCESSFUL) && - (bufs_to_dma < bufs_total) && + + while ((rc == RTEMS_SUCCESSFUL) && + (bufs_to_dma < bufs_total) && (bds_free > 0)) { /* * fill in BD, set interrupt if needed */ SDMA_CLEAR_IEVENT(&mpc5200.IntPend,(is_write ? TASK_GEN_DP_BD_1 - : TASK_GEN_DP_BD_0)); + : TASK_GEN_DP_BD_0)); if (is_write) { TaskBDAssign(pcmcia_ide_txTaskId , (void *)bufs[bufs_to_dma].buffer, @@ -394,7 +394,7 @@ void mpc5200_pcmciaide_dma_blockop(bool is_write, bds_free --; } if (is_write) { - TaskStart( pcmcia_ide_txTaskId, TASK_AUTOSTART_DISABLE, + TaskStart( pcmcia_ide_txTaskId, TASK_AUTOSTART_DISABLE, pcmcia_ide_txTaskId, TASK_INTERRUPT_DISABLE ); } else { @@ -407,12 +407,12 @@ void mpc5200_pcmciaide_dma_blockop(bool is_write, * enable interrupts, wait for interrupt event */ rtems_task_ident(RTEMS_SELF,0,(rtems_id *)&pcmcia_ide_hdl_task); - bestcomm_glue_irq_enable((is_write - ? TASK_GEN_DP_BD_1 + bestcomm_glue_irq_enable((is_write + ? TASK_GEN_DP_BD_1 : TASK_GEN_DP_BD_0)); - rtems_event_receive(PCMCIA_IDE_INTERRUPT_EVENT, - RTEMS_WAIT | RTEMS_EVENT_ANY, + rtems_event_receive(PCMCIA_IDE_INTERRUPT_EVENT, + RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &events); pcmcia_ide_hdl_task = 0; @@ -429,13 +429,13 @@ void mpc5200_pcmciaide_dma_blockop(bool is_write, } do { - nxt_bd_idx = TaskBDRelease(is_write - ? pcmcia_ide_txTaskId + nxt_bd_idx = TaskBDRelease(is_write + ? pcmcia_ide_txTaskId : pcmcia_ide_rxTaskId); if ((nxt_bd_idx != TASK_ERR_BD_RING_EMPTY) && (nxt_bd_idx != TASK_ERR_BD_BUSY)) { - (*cbuf)++; - (*pos) += bufs[bufs_from_dma].length; + (*cbuf)++; + (*pos) += bufs[bufs_from_dma].length; bufs_from_dma++; } } while ((nxt_bd_idx != TASK_ERR_BD_RING_EMPTY) && @@ -455,7 +455,7 @@ void mpc5200_pcmciaide_read_block(int minor, uint32_t block_size, rtems_blkdev_s uint16_t *lbuf = (uint16_t*)((uint8_t*)(bufs[(*cbuf)].buffer)+(*pos)); uint32_t llength = bufs[(*cbuf)].length; bool use_dma; - + #if IDE_USE_STATISTICS mpc5200_pcmciaide_read_block_call_cnt++; #endif @@ -477,7 +477,7 @@ void mpc5200_pcmciaide_read_block(int minor, uint32_t block_size, rtems_blkdev_s * type of transfer mode */ while ((GET_UP_BYTE_OF_MPC5200_ATA_DRIVE_REG((volatile uint32_t) - (mpc5200.ata_dctr_dasr)) & + (mpc5200.ata_dctr_dasr)) & IDE_REGISTER_STATUS_DRQ) == 0); /* * translate (part of) buffer list into DMA BDs @@ -495,14 +495,14 @@ void mpc5200_pcmciaide_read_block(int minor, uint32_t block_size, rtems_blkdev_s *lbuf++ = GET_UP_WORD_OF_MPC5200_ATA_DRIVE_REG(*(volatile uint32_t *)(ata_reg)); /* only 16 bit data port */ cnt += 2; (*pos) += 2; - + if((*pos) == llength) { - + (*pos) = 0; (*cbuf)++; lbuf = bufs[(*cbuf)].buffer; llength = bufs[(*cbuf)].length; - + } } #else @@ -512,12 +512,12 @@ void mpc5200_pcmciaide_read_block(int minor, uint32_t block_size, rtems_blkdev_s *lbuf++ = *(volatile uint16_t *)(ata_reg); /* only 16 bit data port */ cnt += 2; (*pos) += 2; - + if((*pos) == llength) { (*pos) = 0; (*cbuf)++; lbuf = bufs[(*cbuf)].buffer; - llength = bufs[(*cbuf)].length; + llength = bufs[(*cbuf)].length; } } #endif @@ -525,12 +525,12 @@ void mpc5200_pcmciaide_read_block(int minor, uint32_t block_size, rtems_blkdev_s *lbuf++ = 0; /* fill buffer with dummy data */ cnt += 2; (*pos) += 2; - + if((*pos) == llength) { (*pos) = 0; (*cbuf)++; lbuf = bufs[(*cbuf)].buffer; - llength = bufs[(*cbuf)].length; + llength = bufs[(*cbuf)].length; } } } @@ -570,7 +570,7 @@ void mpc5200_pcmciaide_write_block(int minor, uint32_t block_size, * type of transfer mode */ while ((GET_UP_BYTE_OF_MPC5200_ATA_DRIVE_REG((volatile uint32_t) - (mpc5200.ata_dctr_dasr)) & + (mpc5200.ata_dctr_dasr)) & IDE_REGISTER_STATUS_DRQ) == 0); /* * translate (part of) buffer list into DMA BDs @@ -595,28 +595,28 @@ void mpc5200_pcmciaide_write_block(int minor, uint32_t block_size, loop_max = (block_size - cnt); } for (loop_cnt = loop_max/2;loop_cnt > 0;loop_cnt--) { - *(volatile uint32_t *)(ata_reg) = + *(volatile uint32_t *)(ata_reg) = SET_UP_WORD_OF_MPC5200_ATA_DRIVE_REG(*lbuf++); /* only 16 bit data port */ } cnt += loop_max; (*pos) += loop_max; - + if((*pos) == llength) { - + (*pos) = 0; (*cbuf)++; lbuf = bufs[(*cbuf)].buffer; - llength = bufs[(*cbuf)].length; + llength = bufs[(*cbuf)].length; } } #else - while((GET_UP_BYTE_OF_MPC5200_ATA_DRIVE_REG((volatile uint32_t)(mpc5200.ata_dctr_dasr)) - & IDE_REGISTER_STATUS_DRQ) + while((GET_UP_BYTE_OF_MPC5200_ATA_DRIVE_REG((volatile uint32_t)(mpc5200.ata_dctr_dasr)) + & IDE_REGISTER_STATUS_DRQ) && (cnt < block_size)) { *(volatile uint16_t *)(ata_reg) = *lbuf++; /* only 16 bit data port */ cnt += 2; (*pos) += 2; - + if((*pos) == llength) { (*pos) = 0; (*cbuf)++; @@ -657,7 +657,7 @@ void mpc5200_pcmciaide_initialize(int minor) #if IDE_USE_DMA mpc5200_pcmciaide_dma_init(minor); -#endif +#endif } |