2 * @file cdcmPciDmaLynx.c
4 * @brief CDCM PCI DMA implementation for LynxOS
6 * @author Copyright (C) 2009 CERN CO/HT Emilio G. Cota
7 * <emilio.garcia.cota@cern.ch>
9 * @section license_sec License
10 * Released under the GPL v2. (and only v2, not any later version)
14 #include "cdcmPciDma.h"
17 cdcm_dma_t
cdcm_pci_map(void *handle
, void *addr
, size_t size
, int write
)
20 ptr
= (unsigned long)addr
;
22 ptr
= (unsigned long)get_phys((kaddr_t
)addr
);
23 return (cdcm_dma_t
)(ptr
- PHYSBASE
);
26 void cdcm_pci_unmap(void *handle
, cdcm_dma_t dma_addr
, int size
, int write
)
31 int cdcm_pci_mmchain_lock(void *handle
, struct cdcm_dmabuf
*dma
, int write
,
32 int pid
, void *buf
, unsigned long size
,
37 dma
->user_buf
= (char *)buf
;
39 err
= mem_lock(pid
, dma
->user_buf
, dma
->size
);
40 if (err
< 0) return SYSERR
;
41 err
= mmchain(out
, dma
->user_buf
, dma
->size
);
42 for (i
=0; i
< err
; i
++) {
43 /* get_phys here would be redundant */
44 out
[i
].address
-= PHYSBASE
;
49 int cdcm_pci_mem_unlock(void *handle
, struct cdcm_dmabuf
*dma
, int pid
,
52 return mem_unlock(pid
, dma
->user_buf
, dma
->size
, dirty
);