Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions | Variables
crystalhd_misc.c File Reference
#include "crystalhd.h"
#include <linux/slab.h>

Go to the source code of this file.

Functions

uint32_t bc_dec_reg_rd (struct crystalhd_adp *adp, uint32_t reg_off)
 
void bc_dec_reg_wr (struct crystalhd_adp *adp, uint32_t reg_off, uint32_t val)
 
uint32_t crystalhd_reg_rd (struct crystalhd_adp *adp, uint32_t reg_off)
 
void crystalhd_reg_wr (struct crystalhd_adp *adp, uint32_t reg_off, uint32_t val)
 
enum BC_STATUS crystalhd_mem_rd (struct crystalhd_adp *adp, uint32_t start_off, uint32_t dw_cnt, uint32_t *rd_buff)
 
enum BC_STATUS crystalhd_mem_wr (struct crystalhd_adp *adp, uint32_t start_off, uint32_t dw_cnt, uint32_t *wr_buff)
 
enum BC_STATUS crystalhd_pci_cfg_rd (struct crystalhd_adp *adp, uint32_t off, uint32_t len, uint32_t *val)
 
enum BC_STATUS crystalhd_pci_cfg_wr (struct crystalhd_adp *adp, uint32_t off, uint32_t len, uint32_t val)
 
voidbc_kern_dma_alloc (struct crystalhd_adp *adp, uint32_t sz, dma_addr_t *phy_addr)
 
void bc_kern_dma_free (struct crystalhd_adp *adp, uint32_t sz, void *ka, dma_addr_t phy_addr)
 
enum BC_STATUS crystalhd_create_dioq (struct crystalhd_adp *adp, struct crystalhd_dioq **dioq_hnd, crystalhd_data_free_cb cb, void *cbctx)
 
void crystalhd_delete_dioq (struct crystalhd_adp *adp, struct crystalhd_dioq *dioq)
 
enum BC_STATUS crystalhd_dioq_add (struct crystalhd_dioq *ioq, void *data, bool wake, uint32_t tag)
 
voidcrystalhd_dioq_fetch (struct crystalhd_dioq *ioq)
 
voidcrystalhd_dioq_find_and_fetch (struct crystalhd_dioq *ioq, uint32_t tag)
 
voidcrystalhd_dioq_fetch_wait (struct crystalhd_dioq *ioq, uint32_t to_secs, uint32_t *sig_pend)
 
enum BC_STATUS crystalhd_map_dio (struct crystalhd_adp *adp, void *ubuff, uint32_t ubuff_sz, uint32_t uv_offset, bool en_422mode, bool dir_tx, struct crystalhd_dio_req **dio_hnd)
 
enum BC_STATUS crystalhd_unmap_dio (struct crystalhd_adp *adp, struct crystalhd_dio_req *dio)
 
int crystalhd_create_dio_pool (struct crystalhd_adp *adp, uint32_t max_pages)
 
void crystalhd_destroy_dio_pool (struct crystalhd_adp *adp)
 
int __devinit crystalhd_create_elem_pool (struct crystalhd_adp *adp, uint32_t pool_size)
 
void crystalhd_delete_elem_pool (struct crystalhd_adp *adp)
 
void crystalhd_show_buffer (uint32_t off, uint8_t *buff, uint32_t dwcount)
 

Variables

uint32_t g_linklog_level
 

Function Documentation

uint32_t bc_dec_reg_rd ( struct crystalhd_adp adp,
uint32_t  reg_off 
)

bc_dec_reg_rd - Read 7412's device register. : Adapter instance : Register offset.

Return: 32bit value read

7412's device register read routine. This interface use 7412's device access range mapped from BAR-2 (4M) of PCIe configuration space.

Definition at line 142 of file crystalhd_misc.c.

void bc_dec_reg_wr ( struct crystalhd_adp adp,
uint32_t  reg_off,
uint32_t  val 
)

bc_dec_reg_wr - Write 7412's device register : Adapter instance : Register offset. : Dword value to be written.

Return: none.

7412's device register write routine. This interface use 7412's device access range mapped from BAR-2 (4M) of PCIe configuration space.

Definition at line 165 of file crystalhd_misc.c.

void* bc_kern_dma_alloc ( struct crystalhd_adp adp,
uint32_t  sz,
dma_addr_t phy_addr 
)

bc_kern_dma_alloc - Allocate memory for Dma rings : Adapter instance : Size of the memory to allocate. : Physical address of the memory allocated. Typedef to system's dma_addr_t (u64)

Return: Pointer to allocated memory..

Wrapper to Linux kernel interface.

Definition at line 379 of file crystalhd_misc.c.

void bc_kern_dma_free ( struct crystalhd_adp adp,
uint32_t  sz,
void ka,
dma_addr_t  phy_addr 
)

bc_kern_dma_free - Release Dma ring memory. : Adapter instance : Size of the memory to allocate. : Kernel virtual address returned during _dio_alloc() : Physical address of the memory allocated. Typedef to system's dma_addr_t (u64)

Return: none.

Definition at line 407 of file crystalhd_misc.c.

int crystalhd_create_dio_pool ( struct crystalhd_adp adp,
uint32_t  max_pages 
)

crystalhd_create_dio_pool - Allocate mem pool for DIO management. : Adapter instance : Max pages for size calculation.

Return: system error.

This routine creates a memory pool to hold dio context for for HW Direct IO operation.

Definition at line 862 of file crystalhd_misc.c.

enum BC_STATUS crystalhd_create_dioq ( struct crystalhd_adp adp,
struct crystalhd_dioq **  dioq_hnd,
crystalhd_data_free_cb  cb,
void cbctx 
)

crystalhd_create_dioq - Create Generic DIO queue : Adapter instance : Handle to the dio queue created : Optional - Call back To free the element. : Context to pass to callback.

Return: status

Initialize Generic DIO queue to hold any data. Callback will be used to free elements while deleting the queue.

Definition at line 431 of file crystalhd_misc.c.

int __devinit crystalhd_create_elem_pool ( struct crystalhd_adp adp,
uint32_t  pool_size 
)

crystalhd_create_elem_pool - List element pool creation. : Adapter instance : Number of elements in the pool.

Return: 0 - success, <0 error

Create general purpose list element pool to hold pending, and active requests.

Definition at line 963 of file crystalhd_misc.c.

void crystalhd_delete_dioq ( struct crystalhd_adp adp,
struct crystalhd_dioq dioq 
)

crystalhd_delete_dioq - Delete Generic DIO queue : Adapter instance : DIOQ instance..

Return: None.

Release Generic DIO queue. This function will remove all the entries from the Queue and will release data by calling the call back provided during creation.

Definition at line 472 of file crystalhd_misc.c.

void crystalhd_delete_elem_pool ( struct crystalhd_adp adp)

crystalhd_delete_elem_pool - List element pool deletion. : Adapter instance

Return: none

Delete general purpose list element pool.

Definition at line 993 of file crystalhd_misc.c.

void crystalhd_destroy_dio_pool ( struct crystalhd_adp adp)

crystalhd_destroy_dio_pool - Release DIO mem pool. : Adapter instance

Return: none.

This routine releases dio memory pool during close.

Definition at line 923 of file crystalhd_misc.c.

enum BC_STATUS crystalhd_dioq_add ( struct crystalhd_dioq ioq,
void data,
bool  wake,
uint32_t  tag 
)

crystalhd_dioq_add - Add new DIO request element. : DIO queue instance : DIO request to be added. : True - Wake up suspended process. : Special tag to assign - For search and get.

Return: Status.

Insert new element to Q tail.

Definition at line 500 of file crystalhd_misc.c.

void* crystalhd_dioq_fetch ( struct crystalhd_dioq ioq)

crystalhd_dioq_fetch - Fetch element from head. : DIO queue instance

Return: data element from the head..

Remove an element from Queue.

Definition at line 542 of file crystalhd_misc.c.

void* crystalhd_dioq_fetch_wait ( struct crystalhd_dioq ioq,
uint32_t  to_secs,
uint32_t sig_pend 
)

crystalhd_dioq_fetch_wait - Fetch element from Head. : DIO queue instance : Wait timeout in seconds..

Return: element from the head..

Return element from head if Q is not empty. Wait for new element if Q is empty for Timeout seconds.

Definition at line 625 of file crystalhd_misc.c.

void* crystalhd_dioq_find_and_fetch ( struct crystalhd_dioq ioq,
uint32_t  tag 
)

crystalhd_dioq_find_and_fetch - Search the tag and Fetch element : DIO queue instance : Tag to search for.

Return: element from the head..

Search TAG and remove the element.

Definition at line 580 of file crystalhd_misc.c.

enum BC_STATUS crystalhd_map_dio ( struct crystalhd_adp adp,
void ubuff,
uint32_t  ubuff_sz,
uint32_t  uv_offset,
bool  en_422mode,
bool  dir_tx,
struct crystalhd_dio_req **  dio_hnd 
)

crystalhd_map_dio - Map user address for DMA : Adapter instance : User buffer to map. : User buffer size. : UV buffer offset. : TRUE:422 FALSE:420 Capture mode. : TRUE for Tx (To device from host) : Handle to mapped DIO request.

Return: Status.

This routine maps user address and lock pages for DMA.

Definition at line 675 of file crystalhd_misc.c.

enum BC_STATUS crystalhd_mem_rd ( struct crystalhd_adp adp,
uint32_t  start_off,
uint32_t  dw_cnt,
uint32_t rd_buff 
)

crystalhd_mem_rd - Read data from 7412's DRAM area. : Adapter instance : Start offset. : Count in dwords. : Buffer to copy the data from dram.

Return: Status.

7412's Dram read routine.

Definition at line 232 of file crystalhd_misc.c.

enum BC_STATUS crystalhd_mem_wr ( struct crystalhd_adp adp,
uint32_t  start_off,
uint32_t  dw_cnt,
uint32_t wr_buff 
)

crystalhd_mem_wr - Write data to 7412's DRAM area. : Adapter instance : Start offset. : Count in dwords. : Data Buffer to be written.

Return: Status.

7412's Dram write routine.

Definition at line 260 of file crystalhd_misc.c.

enum BC_STATUS crystalhd_pci_cfg_rd ( struct crystalhd_adp adp,
uint32_t  off,
uint32_t  len,
uint32_t val 
)

crystalhd_pci_cfg_rd - PCIe config read : Adapter instance : PCI config space offset. : Size – Byte, Word & dword. : Value read

Return: Status.

Get value from Link's PCIe config space.

Definition at line 288 of file crystalhd_misc.c.

enum BC_STATUS crystalhd_pci_cfg_wr ( struct crystalhd_adp adp,
uint32_t  off,
uint32_t  len,
uint32_t  val 
)

crystalhd_pci_cfg_wr - PCIe config write : Adapter instance : PCI config space offset. : Size – Byte, Word & dword. : Value to be written

Return: Status.

Set value to Link's PCIe config space.

Definition at line 333 of file crystalhd_misc.c.

uint32_t crystalhd_reg_rd ( struct crystalhd_adp adp,
uint32_t  reg_off 
)

crystalhd_reg_rd - Read Link's device register. : Adapter instance : Register offset.

Return: 32bit value read

Link device register read routine. This interface use Link's device access range mapped from BAR-1 (64K) of PCIe configuration space.

Definition at line 188 of file crystalhd_misc.c.

void crystalhd_reg_wr ( struct crystalhd_adp adp,
uint32_t  reg_off,
uint32_t  val 
)

crystalhd_reg_wr - Write Link's device register : Adapter instance : Register offset. : Dword value to be written.

Return: none.

Link device register write routine. This interface use Link's device access range mapped from BAR-1 (64K) of PCIe configuration space.

Definition at line 211 of file crystalhd_misc.c.

void crystalhd_show_buffer ( uint32_t  off,
uint8_t buff,
uint32_t  dwcount 
)

Definition at line 1013 of file crystalhd_misc.c.

enum BC_STATUS crystalhd_unmap_dio ( struct crystalhd_adp adp,
struct crystalhd_dio_req dio 
)

crystalhd_unmap_sgl - Release mapped resources : Adapter instance : DIO request instance

Return: Status.

This routine is to unmap the user buffer pages.

Definition at line 822 of file crystalhd_misc.c.

Variable Documentation

uint32_t g_linklog_level

Definition at line 31 of file crystalhd_misc.c.