os/linux-2.6-tag--devboard-R2_10-4/arch/cris/arch-v32/drivers/elphel/fpgaclocks353.c File Reference

#include <linux/autoconf.h>
#include <linux/module.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/ioport.h>
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <linux/string.h>
#include <linux/init.h>
#include <asm/arch/hwregs/reg_map.h>
#include <asm/arch/hwregs/reg_rdwr.h>
#include <asm/arch/hwregs/gio_defs.h>
#include <asm/arch/hwregs/intr_vect_defs.h>
#include <asm/arch/hwregs/pinmux_defs.h>
#include <asm/io.h>
#include <asm/system.h>
#include <asm/irq.h>
#include <asm/delay.h>
#include <asm/uaccess.h>
#include <asm/elphel/driver_numbers.h>
#include <asm/elphel/fpgaconfa.h>
#include <asm/elphel/fpgaclocks.h>
#include "fpgactrl.h"

Include dependency graph for fpgaclocks353.c:

Go to the source code of this file.

Data Structures

struct  t_pll_params

Defines

#define D(x)
#define D1(x)
#define D2(x)
#define D3(x)
#define D5(x)
#define FPGA_CLOCK_DRIVER_NAME   "Elphel (R) model 353 system clocks (PLL frequency synth.) driver"
#define FPGA_CLOCK_MAXMINOR   10
#define XCLOCK_LOW_TIME   8
#define XCLOCK_HIGH_TIME   8
#define XSTART_CONDITION_HOLD_TIME   8
#define XSTOP_CONDITION_HOLD_TIME   8
#define XENABLE_OUTPUT   0x01
#define XENABLE_INPUT   0x00
#define XI2C_CLOCK_HIGH   1
#define XI2C_CLOCK_LOW   0
#define XI2C_DATA_HIGH   1
#define XI2C_DATA_LOW   0
#define xi2c_delay(usecs)   udelay(usecs)
#define CY223933_SA   0xd2
#define CY22393_SCALE   100
#define CY22393_PLLMIN   (100000000/CY22393_SCALE)
#define CY22393_PLLMAX   (400000000/CY22393_SCALE)
#define CY22393_XTAL   ( 12000000/CY22393_SCALE)
#define CY22393_OUTMAX   (166000000/CY22393_SCALE)
#define CY22393_PMIN   16
#define CY22393_PMAX   1600

Functions

int xi2c_diagnose (void)
int xi2c_start (void)
void xi2c_stop (void)
void xi2c_nostop (void)
int xi2c_outbyte (unsigned char d)
unsigned char xi2c_inbyte (void)
void xi2c_sendack (void)
int fi2c_writeData (unsigned char theSlave, unsigned char *theData, int size, int nostop)
int fi2c_readData (unsigned char theSlave, unsigned char *theData, int size)
int fi2c_ioctl (struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
int calc_pll_params (unsigned int f, t_pll_params *pars)
int setCYField (int addr, int mask, int value)
int setClockFreq (int nclock, int freq)
static int fpga_clock_open (struct inode *inode, struct file *filp)
static int fpga_clock_release (struct inode *inode, struct file *filp)
static int fpga_clock_ioctl (struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
static int __init fpga_clock_init (void)
void xi2c_disable (void)
void xi2c_scl (int x)
void xi2c_sda (int x)
int xi2c_getbit (void)
int xi2c_getscl (void)
void initPortB (void)
int getClockFreq (int nclock)
 module_init (fpga_clock_init)
 MODULE_LICENSE ("GPL")
 MODULE_AUTHOR ("Andrey Filippov <andrey@elphel.com>.")
 MODULE_DESCRIPTION (FPGA_CLOCK_DRIVER_NAME)

Variables

static int clock_frequency [4]
static const char fpga_clock_name [] = "fpga_clock_control"
static int minors [FPGA_CLOCK_MAXMINOR+1]
static struct file_operations fpga_clock_fops


Define Documentation

#define CY223933_SA   0xd2

Definition at line 191 of file fpgaclocks353.c.

#define CY22393_OUTMAX   (166000000/CY22393_SCALE)

Definition at line 197 of file fpgaclocks353.c.

#define CY22393_PLLMAX   (400000000/CY22393_SCALE)

Definition at line 195 of file fpgaclocks353.c.

#define CY22393_PLLMIN   (100000000/CY22393_SCALE)

Definition at line 194 of file fpgaclocks353.c.

#define CY22393_PMAX   1600

Definition at line 199 of file fpgaclocks353.c.

#define CY22393_PMIN   16

Definition at line 198 of file fpgaclocks353.c.

#define CY22393_SCALE   100

Definition at line 193 of file fpgaclocks353.c.

#define CY22393_XTAL   ( 12000000/CY22393_SCALE)

Definition at line 196 of file fpgaclocks353.c.

#define D ( x   ) 

*************************************************************************** ! FILE NAME : fpgaclocks353.c ! provides control of the FPGA clocks based on 3-pll generator ! Direct r/w of the CY22393 over the I2C interface (connected to PB.16 and PB.17 of the CPU) ! supports 3 PLLs connected to 3 outputs (clk0, clk1 and clk2) ! clk3 can be only turned on to Xtal frequency (12MHz) or off ! Input parameter specifies frequency in Hz, internally data is rounded to 100Hz ! ! ! Copyright (C) 2002-2006 Elphel, Inc. ! -----------------------------------------------------------------------------** ! ! This program is free software: you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation, either version 3 of the License, or ! (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program. If not, see <http://www.gnu.org/licenses/>. ! -----------------------------------------------------------------------------** !

Log
fpgaclocks353.c,v
! Revision 1.1.1.1 2008/11/27 20:04:00 elphel ! ! ! Revision 1.3 2008/09/22 22:55:48 elphel ! snapshot ! ! Revision 1.2 2008/09/20 00:29:49 elphel ! moved driver major/minor numbers to a single file - include/asm-cris/elphel/driver_numbers.h ! ! Revision 1.1.1.1 2007/08/17 10:23:18 elphel ! This is a fresh tree based on elphel353-2.10 ! ! Revision 1.7 2007/08/17 10:23:18 spectr_rain ! switch to GPL3 license ! ! Revision 1.6 2007/07/20 10:17:45 spectr_rain ! *** empty log message *** ! ! Revision 1.2 2007/06/28 02:23:49 elphel ! removed initilaization to some frequencies during Linux booting (they are programmed in other places) ! ! Revision 1.1.1.1 2007/02/23 10:11:48 elphel ! initial import into CVS ! ! Revision 1.2 2005/05/10 21:08:49 elphel ! *** empty log message *** !

Definition at line 100 of file fpgaclocks353.c.

#define D1 ( x   ) 

Definition at line 103 of file fpgaclocks353.c.

#define D2 ( x   ) 

Definition at line 106 of file fpgaclocks353.c.

#define D3 ( x   ) 

Definition at line 109 of file fpgaclocks353.c.

#define D5 ( x   ) 

Definition at line 116 of file fpgaclocks353.c.

#define FPGA_CLOCK_DRIVER_NAME   "Elphel (R) model 353 system clocks (PLL frequency synth.) driver"

Definition at line 120 of file fpgaclocks353.c.

#define FPGA_CLOCK_MAXMINOR   10

Definition at line 121 of file fpgaclocks353.c.

#define XCLOCK_HIGH_TIME   8

Definition at line 128 of file fpgaclocks353.c.

#define XCLOCK_LOW_TIME   8

Definition at line 127 of file fpgaclocks353.c.

#define XENABLE_INPUT   0x00

Definition at line 132 of file fpgaclocks353.c.

#define XENABLE_OUTPUT   0x01

Definition at line 131 of file fpgaclocks353.c.

#define XI2C_CLOCK_HIGH   1

Definition at line 133 of file fpgaclocks353.c.

#define XI2C_CLOCK_LOW   0

Definition at line 134 of file fpgaclocks353.c.

#define XI2C_DATA_HIGH   1

Definition at line 135 of file fpgaclocks353.c.

#define XI2C_DATA_LOW   0

Definition at line 136 of file fpgaclocks353.c.

#define xi2c_delay ( usecs   )     udelay(usecs)

Definition at line 143 of file fpgaclocks353.c.

#define XSTART_CONDITION_HOLD_TIME   8

Definition at line 129 of file fpgaclocks353.c.

#define XSTOP_CONDITION_HOLD_TIME   8

Definition at line 130 of file fpgaclocks353.c.


Function Documentation

int calc_pll_params ( unsigned int  f,
t_pll_params pars 
)

int fi2c_ioctl ( struct inode *  inode,
struct file *  file,
unsigned int  cmd,
unsigned long  arg 
)

Definition at line 334 of file fpgaconfi2c.c.

int fi2c_readData ( unsigned char  theSlave,
unsigned char *  theData,
int  size 
)

Definition at line 312 of file fpgaconfi2c.c.

int fi2c_writeData ( unsigned char  theSlave,
unsigned char *  theData,
int  size,
int  nostop 
)

static int __init fpga_clock_init ( void   )  [static]

Definition at line 926 of file fpgaclocks353.c.

References FPGA_CLOCK_DRIVER_NAME, fpga_clock_fops, FPGA_CLOCK_MAJOR, FPGA_CLOCK_MAXMINOR, fpga_clock_name, fpga_state, initPortB(), KERN_ERR, minors, and printk.

static int fpga_clock_ioctl ( struct inode *  inode,
struct file *  filp,
unsigned int  cmd,
unsigned long  arg 
) [static]

Definition at line 899 of file fpgaclocks353.c.

References D, D5, fi2c_ioctl(), FPGA_CLOCK_IOCTYPE, FPGA_CLOCK_IOCTYPE_RD, FPGA_CLOCK_MINOR_CLOCKS, FPGA_CLOCK_MINOR_I2C, getClockFreq(), printk, and setClockFreq().

static int fpga_clock_open ( struct inode *  inode,
struct file *  filp 
) [static]

Definition at line 873 of file fpgaclocks353.c.

References D, FPGA_CLOCK_MINOR_CLOCKS, FPGA_CLOCK_MINOR_I2C, minors, and printk.

static int fpga_clock_release ( struct inode *  inode,
struct file *  filp 
) [static]

Definition at line 892 of file fpgaclocks353.c.

References D, minors, and printk.

int getClockFreq ( int  nclock  ) 

Definition at line 777 of file fpgaclocks353.c.

References clock_frequency.

void initPortB ( void   ) 

Definition at line 422 of file fpgaclocks353.c.

References xi2c_disable.

MODULE_AUTHOR ( "Andrey Filippov <andrey@elphel.com>."   ) 

MODULE_DESCRIPTION ( FPGA_CLOCK_DRIVER_NAME   ) 

module_init ( fpga_clock_init   ) 

MODULE_LICENSE ( "GPL"   ) 

int setClockFreq ( int  nclock,
int  freq 
)

Definition at line 400 of file fpgaconfi2c.c.

int setCYField ( int  addr,
int  mask,
int  value 
)

int xi2c_diagnose ( void   ) 

void xi2c_disable ( void   )  [inline]

Definition at line 361 of file fpgaclocks353.c.

References D2, and printk.

int xi2c_getbit ( void   )  [inline]

Definition at line 403 of file fpgaclocks353.c.

References D2, data, and printk.

int xi2c_getscl ( void   )  [inline]

Definition at line 407 of file fpgaclocks353.c.

References D2, data, and printk.

unsigned char xi2c_inbyte ( void   ) 

void xi2c_nostop ( void   ) 

int xi2c_outbyte ( unsigned char  d  ) 

void xi2c_scl ( int  x  )  [inline]

Definition at line 372 of file fpgaclocks353.c.

References D2, and printk.

void xi2c_sda ( int  x  )  [inline]

Definition at line 380 of file fpgaclocks353.c.

References D2, and printk.

void xi2c_sendack ( void   ) 

int xi2c_start ( void   ) 

void xi2c_stop ( void   ) 


Variable Documentation

int clock_frequency[4] [static]

Definition at line 145 of file fpgaclocks353.c.

struct file_operations fpga_clock_fops [static]

Initial value:

 {
  owner:    THIS_MODULE,
  open:     fpga_clock_open,
  release:  fpga_clock_release,
  ioctl:    fpga_clock_ioctl,
}

Definition at line 180 of file fpgaclocks353.c.

const char fpga_clock_name[] = "fpga_clock_control" [static]

Definition at line 172 of file fpgaclocks353.c.

int minors[FPGA_CLOCK_MAXMINOR+1] [static]

Definition at line 173 of file fpgaclocks353.c.


Generated on Fri Nov 28 00:07:53 2008 for elphel by  doxygen 1.5.1