BEST PCIe driver
 All Data Structures Files Functions Variables Macros Pages
BEST_direct_tetramm.c File Reference

Char driver for direct TetrAmm. More...

#include <linux/module.h>
#include <linux/cdev.h>
#include <linux/device.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
#include "BEST_PCIe.h"
#include "BEST_PCIe_internal.h"
#include "BEST_direct_tetramm.h"

Macros

#define debug_print(fmt, args...)   do { if (DEBUG_tetramm_PRINT) printk( KERN_DEBUG fmt, ##args); } while (0)
 
#define DIRECT_READ_DATA_OFFSET   0x10
 offset at which data start (first word enables latch)
 
#define DIRECT_WRITE_DATA_OFFSET   0x10
 offset at which data start (first word enables latch)
 
#define TETRAMM_ASCII_FMT   "%016llx"
 

Functions

int tetramm_char_open (struct inode *inode, struct file *file)
 Opens char device (stores dev struct in pirvate data) More...
 
ssize_t tetramm_char_read (struct file *file, char __user *buf, size_t count, loff_t *pos)
 Reads from char device. More...
 
long tetramm_char_ioctl (struct file *filp, unsigned int cmd, unsigned long arg)
 
int tetramm_dev_create (struct tetramm_dev_struct *dev, struct class *best_class)
 Creates new TetrAmm char device. More...
 
void tetramm_dev_remove (struct tetramm_dev_struct *dev, struct class *best_class)
 Removes TetrAmm char device. More...
 

Variables

static const struct file_operations dma_char_fops
 

Detailed Description

Char driver for direct TetrAmm.

Author
Jan Marjanovic (j.mar.nosp@m.jano.nosp@m.vic@c.nosp@m.aene.nosp@m.ls.co.nosp@m.m)
Date
July 2014

Function Documentation

int tetramm_char_open ( struct inode *  inode,
struct file *  file 
)

Opens char device (stores dev struct in pirvate data)

Parameters
inodeIndex node structure
fileFile structure
Returns
0 on success, negative number on fail
ssize_t tetramm_char_read ( struct file *  file,
char __user *  buf,
size_t  count,
loff_t *  pos 
)

Reads from char device.

Parameters
fileFile structure (path, ...)
bufBuffer to read to
countNumber of bytes to read
pos
Returns
Numbers of bytes successfully read
int tetramm_dev_create ( struct tetramm_dev_struct dev,
struct class *  best_class 
)

Creates new TetrAmm char device.

Parameters
devStructure with TetrAmm info
best_classClass which this device will be part of
void tetramm_dev_remove ( struct tetramm_dev_struct dev,
struct class *  best_class 
)

Removes TetrAmm char device.

Parameters
devStructure with TetrAmm info
best_classClass which this device will be part of

Variable Documentation

const struct file_operations dma_char_fops
static
Initial value:
= {
.owner = THIS_MODULE,
.unlocked_ioctl = tetramm_char_ioctl
}
int tetramm_char_open(struct inode *inode, struct file *file)
Opens char device (stores dev struct in pirvate data)
Definition: BEST_direct_tetramm.c:38
ssize_t tetramm_char_read(struct file *file, char __user *buf, size_t count, loff_t *pos)
Reads from char device.
Definition: BEST_direct_tetramm.c:62