dsp edma 拷贝和A8 DMA拷贝

1)dsp调用这两个函数:

void DM81XX_EDMA3_setParams(int chId, int dmaQueue, unsigned int srcAddr,
                            unsigned int dstAddr, unsigned short edmaWidth,
                            unsigned short edmaHeight, short srcLineOffset,
                            short dstLineOffset)

void DM81XX_EDMA3_triggerTransfer(int chId)

 

进行edma数据的copy;

 

dma拷贝内容如下:

 

dma拷贝:

int OSA_dmaCopyFillRun(OSA_DmaChHndl *hndl, void *pPrm, int count, int copyFillType)
{
  DMA_CopyFillPrm prm;
  Uint32 cmd;
  int status;

  if(hndl->chId < 0)
    return OSA_EFAIL;
  
  prm.chId = hndl->chId;
  prm.count = count;
  prm.copyFillType = copyFillType;
  prm.prm = pPrm;

  cmd = DMA_IOCTL_CMD_MAKE(prm.copyFillType);
  status = ioctl(gOSA_dmaCtrl.fd, cmd, &prm);
  
  return status;
}


 

int OSA_dmaCopy1D(OSA_DmaChHndl *hndl, OSA_DmaCopy1D *prm, int count )
{
  return OSA_dmaCopyFillRun(hndl, prm, count, DMA_CMD_COPY_1D);
}


 

int OSA_dmaInit()
{
  char deviceName[20];
     
  if(!gOSA_dmaCtrl.isInitDone) {

    sprintf(deviceName, "/dev/%s", DMA_DRV_NAME);

    gOSA_dmaCtrl.fd = open(deviceName, O_RDWR);
    if(gOSA_dmaCtrl.fd<0)
      return OSA_EFAIL;
    
    gOSA_dmaCtrl.isInitDone = TRUE;
  }
  
  return OSA_SOK;
}


 

int OSA_dmaOpen(OSA_DmaChHndl *hndl, int dmaMode, int maxTransfers)
{
  DMA_OpenClosePrm prm;
  Uint32 cmd;
  int status;
    
  prm.chId = -1;
  prm.mode = dmaMode;
  prm.maxTransfers = maxTransfers;
  
  cmd = DMA_IOCTL_CMD_MAKE(DMA_CMD_CH_OPEN);
  status = ioctl(gOSA_dmaCtrl.fd, cmd, &prm);
  
  if(status==0)
    hndl->chId = prm.chId;
  else  
    hndl->chId = -1;
  
  return status;
}

调用:

        OSA_DmaCopy1D copy1D;

        copy1D.srcPhysAddr = (unsigned long)srcAddr;
        copy1D.dstPhysAddr = (unsigned long)dstAddr;

        copy1D.size   = sizeToCopy;
        OSA_dmaCopy1D(&dmaHndl, &copy1D, 1);


你可能感兴趣的:(dsp edma 拷贝和A8 DMA拷贝)