nckernel  0.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
dma.c File Reference
#include <sys/types.h>
#include <sys/io.h>
#include <stdio.h>
#include <stddef.h>
#include <dma.h>
#include <interrupt.h>
#include <list.h>
Include dependency graph for dma.c:

Go to the source code of this file.

Macros

#define DMA_CTRL_FROM_CH(ch)   (((ch) >> 2) ? DMA_16BIT : DMA_8BIT)
 
#define DMA_DISABLE(ch)
 Disable selected DMA channel (ch) More...
 
#define DMA_ENABLE(ch)
 Enable selected DMA channel (ch) More...
 
#define DMA_RESET_PTR(ch)
 Reset type pointer of DMAC. More...
 
#define DMA_SET_ADDRESS(ch, addr)
 
#define DMA_SET_MODE(ch, mode)
 Update DMA mode, ch >> 2 ==> 0 : 8 Bits, 1 : 16 Bits. More...
 
#define DMA_SET_PAGE(ch, addr)
 Address(32 Bits) can be devided into a page(64KB unit) and its offset. Update the buffer information to trnasfer data via the DMA. More...
 
#define DMA_SET_TX_SIZE(ch, cnt)
 

of bytes to be transfered

More...
 

Functions

struct dma_ctrl_port_entry_tdma_get_ctrl_port (int type)
 type 에 해당하는 DMA 제어 포트 정보를 가져온다. More...
 
struct dma_port_entry_tdma_get_port (int channel)
 channel 에 해당하는 port 를 가져온다. More...
 
void dma_init (int ch, int mode, unsigned long address, int count)
 DMA Controller 를 초기화 한다. More...
 
int dma_is_done (int ch)
 DMA 가 종료 되었는지 확인한다. More...
 

Macro Definition Documentation

#define DMA_CTRL_FROM_CH (   ch)    (((ch) >> 2) ? DMA_16BIT : DMA_8BIT)

Definition at line 61 of file dma.c.

Referenced by dma_is_done().

#define DMA_DISABLE (   ch)
Value:
do { \
outb(dma_ctrl[(ch)>>2].single_mask, DMA_MASK_DISABLE_CH|(ch)); \
} while (0)

Disable selected DMA channel (ch)

Definition at line 14 of file dma.c.

Referenced by dma_init().

#define DMA_ENABLE (   ch)
Value:
do { \
outb(dma_ctrl[(ch)>>2].single_mask, (ch)); \
} while (0)

Enable selected DMA channel (ch)

Definition at line 21 of file dma.c.

Referenced by dma_init().

#define DMA_RESET_PTR (   ch)
Value:
do { \
outb(dma_ctrl[(ch) >> 2].byte_ptr, 0x00); \
} while (0)

Reset type pointer of DMAC.

Definition at line 28 of file dma.c.

Referenced by dma_init().

#define DMA_SET_ADDRESS (   ch,
  addr 
)
Value:
do { \
outb(dma_port[ch].address, ((addr) & 0x000000FF)); \
outb(dma_port[ch].address, ((addr) & 0x0000FF00) >> 8); \
} while (0)

Definition at line 41 of file dma.c.

Referenced by dma_init().

#define DMA_SET_MODE (   ch,
  mode 
)
Value:
do { \
outb(dma_ctrl[(ch)>>2].write_mode, (mode) | (ch)); \
} while (0)

Update DMA mode, ch >> 2 ==> 0 : 8 Bits, 1 : 16 Bits.

Definition at line 49 of file dma.c.

Referenced by dma_init().

#define DMA_SET_PAGE (   ch,
  addr 
)
Value:
do { \
outb(dma_port[ch].page, (((addr) & 0x00FF0000) >> 16)); \
} while (0)

Address(32 Bits) can be devided into a page(64KB unit) and its offset. Update the buffer information to trnasfer data via the DMA.

Definition at line 37 of file dma.c.

Referenced by dma_init().

#define DMA_SET_TX_SIZE (   ch,
  cnt 
)
Value:
do { \
outb(dma_port[ch].count, ((unsigned short)(cnt) & 0x00FF)); \
outb(dma_port[ch].count, ((unsigned short)(cnt) & 0xFF00) >> 8); \
} while (0)

of bytes to be transfered

Definition at line 56 of file dma.c.

Referenced by dma_init().