コード例 #1
0
ファイル: floppy.c プロジェクト: binsys/doc-linux
static void setup_DMA(void)
{
	unsigned long addr,count;
	unsigned char dma_code;

	dma_code = DMA_WRITE;
	if (command == FD_READ)
		dma_code = DMA_READ;
	if (command == FD_FORMAT) {
		addr = (long) tmp_floppy_area;
		count = floppy->sect*4;
	} else {
		addr = (long) CURRENT->buffer;
		count = 1024;
	}
	if (read_track) {
/* mark buffer-track bad, in case all this fails.. */
		buffer_drive = buffer_track = -1;
		count = floppy->sect*2*512;
		addr = (long) floppy_track_buffer;
	} else if (addr >= LAST_DMA_ADDR) {
		addr = (long) tmp_floppy_area;
		if (command == FD_WRITE)
			copy_buffer(CURRENT->buffer,tmp_floppy_area);
	}
	cli();
#ifndef HHB_SYSMACROS
/* mask DMA 2 */
	outb_p(4|2,10);
/* output command byte. I don't know why, but everyone (minix, */
/* sanches & canton) output this twice, first to 12 then to 11 */
	outb_p(dma_code,12);
	outb_p(dma_code,11);
/* 8 low bits of addr */
	outb_p(addr,4);
	addr >>= 8;
/* bits 8-15 of addr */
	outb_p(addr,4);
	addr >>= 8;
/* bits 16-19 of addr */
	outb_p(addr,0x81);
/* low 8 bits of count-1 */
	count--;
	outb_p(count,5);
	count >>= 8;
/* high 8 bits of count-1 */
	outb_p(count,5);
/* activate DMA 2 */
	outb_p(0|2,10);
#else			/* just to show off my macros -- hhb */
	DISABLE_DMA(DMA2);
	CLEAR_DMA_FF(DMA2);
	SET_DMA_MODE(DMA2, (command == FD_READ)? DMA_MODE_READ : DMA_MODE_WRITE);
	SET_DMA_ADDR(DMA2, addr);
	SET_DMA_COUNT(DMA2, count);
	ENABLE_DMA(DMA2);
#endif
	sti();
}
コード例 #2
0
ファイル: uartRx.c プロジェクト: k-langer/EECE4534_Zhone
/** 
 * Configures the DMA rx with the buffer and the buffer length to 
 * receive
 * Parameters:
 * @param pchunk  pointer to receive chunk
 *
 * @return void
 */
void uartRx_dmaConfig(char* cPtr, unsigned short len)
{
	DISABLE_DMA(*pDMA10_CONFIG);
	*pDMA10_START_ADDR   = cPtr;
	*pDMA10_X_COUNT      = len;
	*pDMA10_X_MODIFY     = 1;
	*pUART1_IER         |= 0x1;
	ENABLE_DMA(*pDMA10_CONFIG);
}
コード例 #3
0
ファイル: uartRx.c プロジェクト: k-langer/EECE4534_Zhone
void uartRx_dmaStop(void) {
    //*pSIC_IMASK = 0x00000000;
	// stop DMA it might otherwise bombard us with interrupts
    DISABLE_DMA(*pDMA10_CONFIG);

    // turn off the TX ISR as we do not use the DMA anymore
    *pUART1_IER &= ~ERBFI;

    //*pSIC_IMASK = 0xffffffff;
    return;
}
コード例 #4
0
ファイル: audioTx.c プロジェクト: tLiMiT/TinCan-XBee-Phone
/** 
 * Configures the DMA tx with the buffer and the buffer length to 
 * transfer
 * Parameters:
 * @param pchunk  pointer to tx chunk
 * @return void
 */
void audioTx_dmaConfig(chunk_t *pchunk)
{
	/* 1. Disable DMA 4*/
	DISABLE_DMA(*pDMA4_CONFIG);

	/* 2. Configure start address */
	*pDMA4_START_ADDR = &pchunk->u16_buff[0];

	/* 3. set X count */
	*pDMA4_X_COUNT = pchunk->len/2;//*pDMA4_X_COUNT = 2;//pchunk->bytesUsed/2;
	//*pDMA4_Y_COUNT = pchunk->len/2; // 16 bit data so we change the stride and count
   
	/* 4. set X modify */
	*pDMA4_X_MODIFY = 2; //*pDMA4_X_MODIFY = 0;
	//*pDMA4_Y_MODIFY = 2;
   
	/* 5. Re-enable DMA */
	ENABLE_DMA(*pDMA4_CONFIG);

}