AFHBA404
AFHBA404 connects ACQ2106 to PCI-Express
Classes | Macros | Enumerations | Functions
afhba_stream_drv.h File Reference
#include "rtm-t_ioctl.h"

Go to the source code of this file.

Classes

struct  AFHBA_STREAM_DEV
 
struct  AFHBA_STREAM_DEV::BOTTLING_PLANT
 
struct  AFHBA_STREAM_DEV::JOB
 
struct  AFHBA_STREAM_DEV::WORK
 
struct  AO_BURST_DEV
 

Macros

#define NBUFFERS   66
 
#define NBUFFERS_FIFO   NBUFFERS
 
#define NBUFFERS_MASK   127
 
#define BUFFER_LEN   0x100000
 
#define NSTATES   4
 
#define N_DRV_STATES   3
 
#define AFDMAC_PAGE   0x400 /* 1K pages */
 
#define AFDMAC_LL_PAGE   64 /* page length in LL */
 
#define AFDMAC_DESC_ADDR_MASK   0xfffffc00 /* base address */
 
#define AFDMAC_DESC_WRITE   0x00000200 /* Write BIT */
 
#define AFDMAC_DESC_EOT   0x00000100 /* End Of Transfer interrupt */
 
#define AFDMAC_DESC_LEN_MASK   0x000000f0 /* length (pages) */
 
#define AFDMAC_DESC_LEN_SHL   4
 
#define AFDMAC_DESC_ID_MASK   0x0000000f /* ID 0..15 */
 
#define AFDMAC_DESC_ID   0x0000000f /* ID 0..15 */
 
#define AFDMAC_DESCR(pa, pages, id)
 
#define MSI_DMA   0
 
#define MSI_UART   0
 
#define DEV_DBG   dev_dbg
 
#define bp_empties   bp[BS_EMPTY]
 
#define bp_filling   bp[BS_FILLING]
 
#define bp_full   bp[BS_FULL]
 
#define WORK_REQUEST   0
 
#define AO_BURST_DEV(sdev)   ((struct AO_BURST_DEV*)sdev->user)
 
#define MIRROR(adev, ix)   (adev->stream_dev->dma_regs[ix])
 
#define PCI_REG_WRITE(adev, regoff, value)   _afs_write_pcireg(adev, regoff, value)
 
#define PCI_REG_READ(adev, regoff)   _afs_read_pcireg(adev, regoff)
 
#define DMA_CTRL_WR(adev, value)   _afs_write_dmareg(adev, DMA_CTRL, MIRROR(adev, DMA_CTRL) = value)
 
#define DMA_CTRL_RD(adev)   (MIRROR(adev, DMA_CTRL) = _afs_read_dmareg(adev, DMA_CTRL))
 
#define DMA_CTRL_CLR(adev, bits)
 
#define DMA_CTRL_SET(adev, bits)
 
#define DMA_TEST_WR(adev, value)   _afs_write_dmareg(adev, DMA_TEST, MIRROR(adev, DMA_TEST) = (value))
 
#define DMA_TEST_RD(adev)   (MIRROR(adev, DMA_TEST) = _afs_read_dmareg(adev, DMA_TEST))
 
#define afs_dma_reset(adev, dma_sel)
 
#define afs_start_dma(adev, dma_sel)
 
#define afs_stop_dma(adev, dma_sel)
 
#define DMA_DATA_FIFSTA_RD(adev)   _afs_read_dmareg(adev, DMA_DATA_FIFSTA)
 
#define DMA_DESC_FIFSTA_RD(adev)   _afs_read_dmareg(adev, DMA_DESC_FIFSTA)
 
#define DMA_PUSH_DESC_STA_RD(adev)   _afs_read_dmareg(adev, DMA_PUSH_DESC_STA)
 
#define DMA_PULL_DESC_STA_RD(adev)   _afs_read_dmareg(adev, DMA_PULL_DESC_STA)
 
#define EMPTY1   0xee11ee11
 
#define EMPTY2   0x22ee22ee
 
#define RTDMAC_DATA_FIFO_CNT   0x1000
 
#define RTDMAC_DESC_FIFO_CNT   0x1000
 
#define HB_ENTRY(plist)   list_entry(plist, struct HostBuffer, list)
 

Enumerations

enum  { PS_OFF, PS_PLEASE_STOP, PS_STOP_DONE }
 

Functions

void _afs_write_pcireg (struct AFHBA_DEV *adev, int regoff, u32 value)
 
u32 _afs_read_pcireg (struct AFHBA_DEV *adev, int regoff)
 
int afs_comms_ready (struct AFHBA_DEV *adev)
 
void _afs_write_dmareg (struct AFHBA_DEV *adev, int regoff, u32 value)
 
u32 _afs_read_dmareg (struct AFHBA_DEV *adev, int regoff)
 
void _afs_write_comreg (struct AFHBA_DEV *adev, int regoff, u32 value)
 
void __afs_dma_reset (struct AFHBA_DEV *adev, u32 dma_sel)
 
void __afs_start_dma (struct AFHBA_DEV *adev, u32 dma_sel)
 
void __afs_stop_dma (struct AFHBA_DEV *adev, u32 dma_sel)
 
int afs_init_procfs (struct AFHBA_DEV *adev)
 
int afs_reset_buffers (struct AFHBA_DEV *adev)
 
int afs_comms_init (struct AFHBA_DEV *adev)
 

Macro Definition Documentation

◆ AFDMAC_DESC_ADDR_MASK

#define AFDMAC_DESC_ADDR_MASK   0xfffffc00 /* base address */

Definition at line 30 of file afhba_stream_drv.h.

◆ AFDMAC_DESC_EOT

#define AFDMAC_DESC_EOT   0x00000100 /* End Of Transfer interrupt */

Definition at line 33 of file afhba_stream_drv.h.

◆ AFDMAC_DESC_ID

#define AFDMAC_DESC_ID   0x0000000f /* ID 0..15 */

Definition at line 39 of file afhba_stream_drv.h.

◆ AFDMAC_DESC_ID_MASK

#define AFDMAC_DESC_ID_MASK   0x0000000f /* ID 0..15 */

Definition at line 38 of file afhba_stream_drv.h.

◆ AFDMAC_DESC_LEN_MASK

#define AFDMAC_DESC_LEN_MASK   0x000000f0 /* length (pages) */

Definition at line 35 of file afhba_stream_drv.h.

◆ AFDMAC_DESC_LEN_SHL

#define AFDMAC_DESC_LEN_SHL   4

Definition at line 36 of file afhba_stream_drv.h.

◆ AFDMAC_DESC_WRITE

#define AFDMAC_DESC_WRITE   0x00000200 /* Write BIT */

Definition at line 32 of file afhba_stream_drv.h.

◆ AFDMAC_DESCR

#define AFDMAC_DESCR (   pa,
  pages,
  id 
)
Value:
(id))

Definition at line 41 of file afhba_stream_drv.h.

◆ AFDMAC_LL_PAGE

#define AFDMAC_LL_PAGE   64 /* page length in LL */

Definition at line 28 of file afhba_stream_drv.h.

◆ AFDMAC_PAGE

#define AFDMAC_PAGE   0x400 /* 1K pages */

Definition at line 27 of file afhba_stream_drv.h.

◆ afs_dma_reset

#define afs_dma_reset (   adev,
  dma_sel 
)
Value:
do { \
DEV_DBG(pdev(adev), "afs_dma_reset, called from %s %d", __FILE__, __LINE__); \
__afs_dma_reset(adev, dma_sel); \
} while(0)

Definition at line 220 of file afhba_stream_drv.h.

◆ afs_start_dma

#define afs_start_dma (   adev,
  dma_sel 
)
Value:
do { \
DEV_DBG(pdev(adev), "afs_start_dma, called from %s %d", __FILE__, __LINE__); \
__afs_start_dma(adev, dma_sel); \
} while(0)

Definition at line 227 of file afhba_stream_drv.h.

◆ afs_stop_dma

#define afs_stop_dma (   adev,
  dma_sel 
)
Value:
do { \
DEV_DBG(pdev(adev), "afs_stop_dma, called from %s %d", __FILE__, __LINE__); \
__afs_stop_dma(adev, dma_sel); \
} while(0)

Definition at line 234 of file afhba_stream_drv.h.

◆ AO_BURST_DEV

#define AO_BURST_DEV (   sdev)    ((struct AO_BURST_DEV*)sdev->user)

Definition at line 161 of file afhba_stream_drv.h.

◆ bp_empties

#define bp_empties   bp[BS_EMPTY]

Definition at line 77 of file afhba_stream_drv.h.

◆ bp_filling

#define bp_filling   bp[BS_FILLING]

Definition at line 78 of file afhba_stream_drv.h.

◆ bp_full

#define bp_full   bp[BS_FULL]

Definition at line 79 of file afhba_stream_drv.h.

◆ BUFFER_LEN

#define BUFFER_LEN   0x100000

Definition at line 21 of file afhba_stream_drv.h.

◆ DEV_DBG

#define DEV_DBG   dev_dbg

Definition at line 62 of file afhba_stream_drv.h.

◆ DMA_CTRL_CLR

#define DMA_CTRL_CLR (   adev,
  bits 
)
Value:
do { \
u32 ctrl = DMA_CTRL_RD(adev); \
_afs_write_dmareg(adev, DMA_CTRL, MIRROR(adev, DMA_CTRL) &= ~(bits)); \
ctrl = DMA_CTRL_RD(adev); \
if ((ctrl&bits) != 0){ \
dev_err(pdev(adev), \
"DMA_CTRL_CLR sfp:%c wanted to clear:%08x but got %08x", \
adev->sfp+'A', bits, ctrl); \
} \
} while(0)

Definition at line 186 of file afhba_stream_drv.h.

◆ DMA_CTRL_RD

#define DMA_CTRL_RD (   adev)    (MIRROR(adev, DMA_CTRL) = _afs_read_dmareg(adev, DMA_CTRL))

Definition at line 183 of file afhba_stream_drv.h.

◆ DMA_CTRL_SET

#define DMA_CTRL_SET (   adev,
  bits 
)
Value:
do { \
u32 ctrl = DMA_CTRL_RD(adev); \
_afs_write_dmareg(adev, DMA_CTRL, MIRROR(adev, DMA_CTRL) |= (bits)); \
ctrl = DMA_CTRL_RD(adev); \
if ((ctrl&bits) == 0){ \
dev_err(pdev(adev), \
"DMA_CTRL_SET sfp:%c wanted to set:%08x but got %08x", \
adev->sfp+'A', bits, ctrl); \
} \
} while(0)

Definition at line 197 of file afhba_stream_drv.h.

◆ DMA_CTRL_WR

#define DMA_CTRL_WR (   adev,
  value 
)    _afs_write_dmareg(adev, DMA_CTRL, MIRROR(adev, DMA_CTRL) = value)

Definition at line 179 of file afhba_stream_drv.h.

◆ DMA_DATA_FIFSTA_RD

#define DMA_DATA_FIFSTA_RD (   adev)    _afs_read_dmareg(adev, DMA_DATA_FIFSTA)

Definition at line 239 of file afhba_stream_drv.h.

◆ DMA_DESC_FIFSTA_RD

#define DMA_DESC_FIFSTA_RD (   adev)    _afs_read_dmareg(adev, DMA_DESC_FIFSTA)

Definition at line 240 of file afhba_stream_drv.h.

◆ DMA_PULL_DESC_STA_RD

#define DMA_PULL_DESC_STA_RD (   adev)    _afs_read_dmareg(adev, DMA_PULL_DESC_STA)

Definition at line 242 of file afhba_stream_drv.h.

◆ DMA_PUSH_DESC_STA_RD

#define DMA_PUSH_DESC_STA_RD (   adev)    _afs_read_dmareg(adev, DMA_PUSH_DESC_STA)

Definition at line 241 of file afhba_stream_drv.h.

◆ DMA_TEST_RD

#define DMA_TEST_RD (   adev)    (MIRROR(adev, DMA_TEST) = _afs_read_dmareg(adev, DMA_TEST))

Definition at line 212 of file afhba_stream_drv.h.

◆ DMA_TEST_WR

#define DMA_TEST_WR (   adev,
  value 
)    _afs_write_dmareg(adev, DMA_TEST, MIRROR(adev, DMA_TEST) = (value))

Definition at line 209 of file afhba_stream_drv.h.

◆ EMPTY1

#define EMPTY1   0xee11ee11

Definition at line 245 of file afhba_stream_drv.h.

◆ EMPTY2

#define EMPTY2   0x22ee22ee

Definition at line 246 of file afhba_stream_drv.h.

◆ HB_ENTRY

#define HB_ENTRY (   plist)    list_entry(plist, struct HostBuffer, list)

Definition at line 251 of file afhba_stream_drv.h.

◆ MIRROR

#define MIRROR (   adev,
  ix 
)    (adev->stream_dev->dma_regs[ix])

Definition at line 163 of file afhba_stream_drv.h.

◆ MSI_DMA

#define MSI_DMA   0

Definition at line 47 of file afhba_stream_drv.h.

◆ MSI_UART

#define MSI_UART   0

Definition at line 51 of file afhba_stream_drv.h.

◆ N_DRV_STATES

#define N_DRV_STATES   3

Definition at line 25 of file afhba_stream_drv.h.

◆ NBUFFERS

#define NBUFFERS   66

Definition at line 15 of file afhba_stream_drv.h.

◆ NBUFFERS_FIFO

#define NBUFFERS_FIFO   NBUFFERS

Definition at line 17 of file afhba_stream_drv.h.

◆ NBUFFERS_MASK

#define NBUFFERS_MASK   127

Definition at line 19 of file afhba_stream_drv.h.

◆ NSTATES

#define NSTATES   4

Definition at line 24 of file afhba_stream_drv.h.

◆ PCI_REG_READ

#define PCI_REG_READ (   adev,
  regoff 
)    _afs_read_pcireg(adev, regoff)

Definition at line 173 of file afhba_stream_drv.h.

◆ PCI_REG_WRITE

#define PCI_REG_WRITE (   adev,
  regoff,
  value 
)    _afs_write_pcireg(adev, regoff, value)

Definition at line 170 of file afhba_stream_drv.h.

◆ RTDMAC_DATA_FIFO_CNT

#define RTDMAC_DATA_FIFO_CNT   0x1000

Definition at line 248 of file afhba_stream_drv.h.

◆ RTDMAC_DESC_FIFO_CNT

#define RTDMAC_DESC_FIFO_CNT   0x1000

Definition at line 249 of file afhba_stream_drv.h.

◆ WORK_REQUEST

#define WORK_REQUEST   0

Definition at line 125 of file afhba_stream_drv.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
PS_OFF 
PS_PLEASE_STOP 
PS_STOP_DONE 

Definition at line 53 of file afhba_stream_drv.h.

Function Documentation

◆ __afs_dma_reset()

void __afs_dma_reset ( struct AFHBA_DEV adev,
u32  dma_sel 
)

Definition at line 555 of file afhba_stream_drv.c.

◆ __afs_start_dma()

void __afs_start_dma ( struct AFHBA_DEV adev,
u32  dma_sel 
)

Definition at line 570 of file afhba_stream_drv.c.

◆ __afs_stop_dma()

void __afs_stop_dma ( struct AFHBA_DEV adev,
u32  dma_sel 
)

Definition at line 563 of file afhba_stream_drv.c.

◆ _afs_read_dmareg()

u32 _afs_read_dmareg ( struct AFHBA_DEV adev,
int  regoff 
)

Definition at line 313 of file afhba_stream_drv.c.

◆ _afs_read_pcireg()

u32 _afs_read_pcireg ( struct AFHBA_DEV adev,
int  regoff 
)

Definition at line 332 of file afhba_stream_drv.c.

◆ _afs_write_comreg()

void _afs_write_comreg ( struct AFHBA_DEV adev,
int  regoff,
u32  value 
)

Definition at line 296 of file afhba_stream_drv.c.

◆ _afs_write_dmareg()

void _afs_write_dmareg ( struct AFHBA_DEV adev,
int  regoff,
u32  value 
)

Definition at line 304 of file afhba_stream_drv.c.

◆ _afs_write_pcireg()

void _afs_write_pcireg ( struct AFHBA_DEV adev,
int  regoff,
u32  value 
)

Definition at line 322 of file afhba_stream_drv.c.

◆ afs_comms_init()

int afs_comms_init ( struct AFHBA_DEV adev)

Definition at line 749 of file afhba_stream_drv.c.

◆ afs_comms_ready()

int afs_comms_ready ( struct AFHBA_DEV adev)

Definition at line 773 of file afhba_stream_drv.c.

◆ afs_init_procfs()

int afs_init_procfs ( struct AFHBA_DEV adev)

Definition at line 296 of file afs_procfs.c.

◆ afs_reset_buffers()

int afs_reset_buffers ( struct AFHBA_DEV adev)

Definition at line 1390 of file afhba_stream_drv.c.

AFDMAC_DESC_ADDR_MASK
#define AFDMAC_DESC_ADDR_MASK
Definition: afhba_stream_drv.h:29
pdev
#define pdev(adev)
Definition: acq-fiber-hba.h:176
MIRROR
#define MIRROR(adev, ix)
Definition: afhba_stream_drv.h:162
AFDMAC_DESC_LEN_MASK
#define AFDMAC_DESC_LEN_MASK
Definition: afhba_stream_drv.h:34
AFDMAC_DESC_LEN_SHL
#define AFDMAC_DESC_LEN_SHL
Definition: afhba_stream_drv.h:35
DMA_CTRL
#define DMA_CTRL(DIR, SHL)
Definition: afhba_sysfs.c:115
DMA_CTRL_RD
#define DMA_CTRL_RD(adev)
Definition: afhba_stream_drv.h:182