lib_ocm.c File Reference


Detailed Description

File containing definitions for OCM/OC192 library.

Definition in file lib_ocm.c.

#include "edtinc.h"
#include "edt_bitload.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include "edt_ocm.h"

Go to the source code of this file.

Defines

#define __USE_GNU
#define HANDLE   int

Functions

int edt_msdv_load_default_mezzanine (EdtDev *edt_p, char *mezz_0)
 
Parameters:
edt_p pointer to device structure

int edt_msdv_lock_clocks (EdtDev *edt_p, int timeout)
 
Parameters:
edt_p pointer to device structure

int edt_net10g_channel_lock_frontend (EdtDev *edt_p, EdtOCConfig *cfg)
 
Parameters:
edt_p pointer to device structure

int edt_net10g_channel_setup (EdtDev *edt_p, EdtOCConfig *cfg)
 
Parameters:
edt_p pointer to device structure

int edt_net10g_has_mezz_bitfile (EdtDev *edt_p, char *bitfile_name)
 
Parameters:
edt_p pointer to device structure

int edt_net10g_load_default_mezzanine (EdtDev *edt_p, char *mezz_0, char *mezz_1)
 
Parameters:
edt_p pointer to device structure

char * edt_net10g_mezz_filename (EdtDev *edt_p, EdtLineRate line_rate)
 
Parameters:
edt_p pointer to device structure

int edt_oc192_channel_lock_frontend (EdtDev *edt_p, EdtOCConfig *cfg)
 
Parameters:
edt_p pointer to device structure

int edt_oc192_channel_setup (EdtDev *edt_p, EdtOCConfig *cfg)
 
Parameters:
edt_p pointer to device structure

int edt_oc192_clear_demux (EdtDev *edt_p)
 
Parameters:
edt_p pointer to device structure

int edt_oc192_demux_chan_enable (EdtDev *edt_p, int channel, int enable)
 
Parameters:
edt_p pointer to device structure

int edt_oc192_demux_get (EdtDev *edt_p, EdtLineRate line_rate, u_char *onoff)
 
Parameters:
edt_p pointer to device structure

int edt_oc192_demux_get_chan_enabled (EdtDev *edt_p, int channel)
 
Parameters:
edt_p pointer to device structure

int edt_oc192_demux_set (EdtDev *edt_p, EdtLineRate line_rate, u_char *onoff)
 
Parameters:
edt_p pointer to device structure

int edt_oc192_has_mezz_bitfile (EdtDev *edt_p, char *bitfile_name)
 
Parameters:
edt_p pointer to device structure

int edt_oc192_load_default_mezzanine (EdtDev *edt_p, EdtLineRate line_rate, char *mezz_0, char *mezz_1)
 
Parameters:
edt_p pointer to device structure

int edt_oc192_lock_clocks (EdtDev *edt_p, int timeout)
 
Parameters:
edt_p pointer to device structure

void edt_oc192_mdio_dump (EdtDev *edt_p)
 
Parameters:
edt_p 

void edt_oc192_mdio_init (EdtDev *edt_p)
 
Parameters:
edt_p 

void edt_oc192_mdio_loopback (EdtDev *edt_p, int on)
 
Parameters:
edt_p 

unsigned char edt_oc192_mdio_read (EdtDev *edt_p, unsigned char address)
 
Parameters:
edt_p pointer to device structure

void edt_oc192_mdio_set_clock (EdtDev *edt_p)
 
Parameters:
edt_p 

void edt_oc192_mdio_set_prbs23 (EdtDev *edt_p, int on)
 
Parameters:
edt_p 

void edt_oc192_mdio_set_prbs31 (EdtDev *edt_p, int on)
 
Parameters:
edt_p 

void edt_oc192_mdio_set_swap (EdtDev *edt_p, int on)
 
Parameters:
edt_p 

void edt_oc192_mdio_standard (EdtDev *edt_p)
 
Parameters:
edt_p 

void edt_oc192_mdio_write (EdtDev *edt_p, unsigned char address, unsigned char value)
 
Parameters:
edt_p 

char * edt_oc192_mezz_filename (EdtDev *edt_p, EdtLineRate line_rate)
 
Parameters:
edt_p pointer to device structure

void edt_oc192_reset_liu (EdtDev *edt_p)
 
Parameters:
edt_p 

int edt_oc192_set_clock_select (EdtDev *edt_p, EdtLineRate line_rate)
 
Parameters:
edt_p pointer to device structure

void edt_oc192_set_framer (EdtDev *edt_p, int flags)
 
Parameters:
edt_p pointer to device structure

int edt_oc192_set_liu (EdtDev *edt_p, int mode)
 
Parameters:
edt_p 

int edt_oc192_set_tagging (EdtDev *edt_p, int state, int tagid)
 
Parameters:
edt_p pointer to device structure

int edt_oc192_speed_capable (EdtDev *edt_p, EdtLineRate line_rate)
 
Parameters:
edt_p pointer to device structure

int edt_oc192_wait_for_frame (EdtDev *edt_p, int timeout)
 
Parameters:
edt_p pointer to device structure

int edt_ocm_channel_lock_frontend (EdtDev *edt_p, EdtOCConfig *cfg)
 
Parameters:
edt_p 

int edt_ocm_channel_setup (EdtDev *edt_p, EdtOCConfig *cfg)
 
Parameters:
edt_p pointer to device structure

int edt_ocm_demux_chan_enable (EdtDev *edt_p, int channel, int enable)
 
Parameters:
edt_p pointer to device structure

int edt_ocm_demux_get (EdtDev *edt_p, EdtLineRate line_rate, u_char *onoff)
 
Parameters:
edt_p pointer to device structure

int edt_ocm_demux_get_chan_enabled (EdtDev *edt_p, int channel)
 
Parameters:
edt_p pointer to device structure

int edt_ocm_demux_set (EdtDev *edt_p, EdtLineRate line_rate, u_char *onoff)
 
Parameters:
edt_p pointer to device structure

int edt_ocm_has_mezz_bitfile (EdtDev *edt_p, char *bitfile_name)
 
Parameters:
edt_p pointer to device structure

int edt_ocm_load_default_mezzanine (EdtDev *edt_p, EdtLineRate line_rate, char *mezz_0, char *mezz_1)
 
Parameters:
edt_p pointer to device structure

int edt_ocm_lock_clocks (EdtDev *edt_p, int timeout)
 
Parameters:
edt_p pointer to device structure

char * edt_ocm_mezz_filename (EdtDev *edt_p, EdtLineRate line_rate)
 
Parameters:
edt_p pointer to device structure

int edt_ocm_set_clock_select (EdtDev *edt_p, EdtLineRate line_rate)
 
Parameters:
edt_p pointer to device structure

int edt_ocm_speed_capable (EdtDev *edt_p, EdtLineRate line_rate)
 
Parameters:
edt_p pointer to device structure

int edt_ocm_wait_for_frame (EdtDev *edt_p, int timeout)
 
Parameters:
edt_p pointer to device structure

int edt_ocx_base_init (EdtDev *edt_p, EdtOCConfig *cfg)
 
Parameters:
edt_p pointer to device structure

int edt_ocx_channel_lock_frontend (EdtDev *edt_p, EdtOCConfig *cfg)
 
Parameters:
edt_p pointer to device structure

int edt_ocx_channel_set_rate (EdtDev *edt_p, EdtOCConfig *cfg)
 
Parameters:
edt_p pointer to device structure

int edt_ocx_channel_setup (EdtDev *edt_p, EdtOCConfig *cfg)
 
Parameters:
edt_p pointer to device structure

int edt_ocx_channel_signal_detect (EdtDev *edt_p)
 checks SIG_DET bit
int edt_ocx_channel_start (EdtDev *edt_p)
 
Parameters:
edt_p pointer to device structure

int edt_ocx_check_interface (EdtDev *edt_p, char *target_file, int force_load)
 
Parameters:
edt_p pointer to device structure

int edt_ocx_check_mezz_bitfile (EdtDev *edt_p, EdtOCConfig *cfg)
 
Parameters:
edt_p pointer to device structure

int edt_ocx_configure (EdtDev *edt_p, EdtOCConfig *cfg)
 
Parameters:
edt_p pointer to device structure

char * edt_ocx_default_bitfile (int mezz_id)
 
Parameters:
mezz.id Either MEZZ_OCM or MEZZ_OC192 (filled in by edt_get_board_description)

int edt_ocx_demux_chan_enable (EdtDev *edt_p, int channel, u_char enable)
 
Parameters:
edt_p pointer to device structure

int edt_ocx_demux_get (EdtDev *edt_p, EdtLineRate line_rate, u_char *onoff)
 
Parameters:
edt_p pointer to device structure

int edt_ocx_demux_get_chan_enabled (EdtDev *edt_p, int channel)
 
Parameters:
edt_p pointer to device structure

int edt_ocx_demux_set (EdtDev *edt_p, EdtLineRate line_rate, u_char *onoff)
 
Parameters:
edt_p pointer to device structure

void edt_ocx_enable_framing_errors (EdtDev *edt_p, int state)
 
Parameters:
edt_p pointer to device structure

int edt_ocx_get_framing_errors (EdtDev *edt_p, EdtOCXFrameErrors *err_p)
 
Parameters:
edt_p pointer to device structure

int edt_ocx_has_mezz_bitfile (EdtDev *edt_p, char *bitfile_name)
 
Parameters:
edt_p pointer to device structure

int edt_ocx_load_default_mezzanine (EdtDev *edt_p, EdtLineRate line_rate, char *mezz_0, char *mezz_1)
 
Parameters:
edt_p pointer to device structure

int edt_ocx_lock_channel_clock (EdtDev *edt_p, int channel, int timeout)
 
Parameters:
edt_p pointer to device structure

int edt_ocx_lock_clocks (EdtDev *edt_p, int timeout)
 
Parameters:
edt_p pointer to device structure

int edt_ocx_lock_local_clock (EdtDev *edt_p, int timeout)
 
Parameters:
edt_p pointer to device structure

char * edt_ocx_mezz_filename (EdtDev *edt_p, EdtLineRate line_rate)
 
Parameters:
edt_p pointer to device structure

void edt_ocx_reset_sys_en (EdtDev *edt_p, int channel)
 
Parameters:
edt_p pointer to device structure

void edt_ocx_set_channel_direction (EdtDev *edt_p, int channel, int do_write)
void edt_ocx_set_channel_enable (EdtDev *edt_p, int channel, int state)
 
Parameters:
edt_p pointer to device structure

int edt_ocx_set_clock_select (EdtDev *edt_p, EdtLineRate line_rate)
 
Parameters:
edt_p pointer to device structure

void edt_ocx_set_lsbfirst (EdtDev *edt_p, int channel, int state)
 
Parameters:
edt_p pointer to device structure

int edt_ocx_speed_capable (EdtDev *edt_p, EdtLineRate line_rate)
 
Parameters:
edt_p pointer to device structure

int edt_ocx_wait_for_frame (EdtDev *edt_p, int timeout)
 
Parameters:
edt_p pointer to device structure

int edt_reg_set_bitmask (EdtDev *edt_p, u_int reg, u_int mask, int state)
int edt_wait_register_bits_high (EdtDev *edt_p, u_int reg, u_int mask, int timeout)
int edt_wait_register_bits_low (EdtDev *edt_p, u_int reg, u_int mask, int timeout)


Function Documentation

int edt_msdv_load_default_mezzanine ( EdtDev edt_p,
char *  mezz_0 
)

Parameters:
edt_p pointer to device structure

Parameters:
mezz_0 Optional alternate mezzanine bitfile name. Defaults to OC192
Returns:
0 on success
Loads MSDV unless overriden by parameters. Equivalent to the command line "msdvload"

Definition at line 339 of file lib_ocm.c.

int edt_msdv_lock_clocks ( EdtDev edt_p,
int  timeout 
)

Parameters:
edt_p pointer to device structure

Parameters:
timeout timeout in ms to wait for the clocks to synch up
Returns:
0 on success, -1 on failure
Locks both 100 Mhz reference clocks on the OC192 board

Definition at line 1377 of file lib_ocm.c.

int edt_net10g_channel_lock_frontend ( EdtDev edt_p,
EdtOCConfig cfg 
)

Parameters:
edt_p pointer to device structure

Parameters:
cfg Configuration parameters
Returns:
0 on success, -1 on failure
edt_oc192_channel_setup Initializes the framing parameters, memory, etc. If framing is enabled, the framer is active after this function, so the framing error registers can be read. (Not currently functional 2/20/07)

Called by edt_ocx_channel_setup

Definition at line 1819 of file lib_ocm.c.

int edt_net10g_channel_setup ( EdtDev edt_p,
EdtOCConfig cfg 
)

Parameters:
edt_p pointer to device structure

Parameters:
cfg Configuration parameters
Returns:
0 on success
edt_oc192_channel_setup Initializes the framing parameters, memory, etc. If framing is enabled, the framer is active after this function, so the framing error registers can be read. (Not currently functional 2/20/07)

Called by edt_ocx_channel_setup

Definition at line 1944 of file lib_ocm.c.

int edt_net10g_has_mezz_bitfile ( EdtDev edt_p,
char *  bitfile_name 
)

Parameters:
edt_p pointer to device structure

Parameters:
bitfile_name Desired bitfile name
Returns:
0 if the bitfile matches current one, non-zero otherwise
Compares bitfile_name to the currently loaded bitfile

Definition at line 1606 of file lib_ocm.c.

int edt_net10g_load_default_mezzanine ( EdtDev edt_p,
char *  mezz_0,
char *  mezz_1 
)

Parameters:
edt_p pointer to device structure

Parameters:
mezz_0 Optional alternate mezzanine bitfile name. Defaults to OC192
Returns:
0 on success
Loads MSDV unless overriden by parameters. Equivalent to the command line "msdvload"

Definition at line 370 of file lib_ocm.c.

char* edt_net10g_mezz_filename ( EdtDev edt_p,
EdtLineRate  line_rate 
)

Parameters:
edt_p pointer to device structure

Parameters:
line_rate rate constant
Returns:
OC192 mezzanine file name for a line rate, NULL if not a valid rate constant
Called by edt_ocx_mezz_filename.

Definition at line 1462 of file lib_ocm.c.

int edt_oc192_channel_lock_frontend ( EdtDev edt_p,
EdtOCConfig cfg 
)

Parameters:
edt_p pointer to device structure

Parameters:
cfg Configuration parameters
Returns:
0 on success, -1 on failure
edt_oc192_channel_setup Initializes the framing parameters, memory, etc. If framing is enabled, the framer is active after this function, so the framing error registers can be read. (Not currently functional 2/20/07)

Called by edt_ocx_channel_setup

Definition at line 1748 of file lib_ocm.c.

int edt_oc192_channel_setup ( EdtDev edt_p,
EdtOCConfig cfg 
)

Parameters:
edt_p pointer to device structure

Parameters:
cfg Configuration parameters
Returns:
0 on success
edt_oc192_channel_setup Initializes the framing parameters, memory, etc. If framing is enabled, the framer is active after this function, so the framing error registers can be read. (Not currently functional 2/20/07)

Called by edt_ocx_channel_setup

Definition at line 1889 of file lib_ocm.c.

void edt_oc192_mdio_set_swap ( EdtDev edt_p,
int  on 
)

Parameters:
edt_p 

Parameters:
on 

Definition at line 1115 of file lib_ocm.c.

int edt_ocm_channel_lock_frontend ( EdtDev edt_p,
EdtOCConfig cfg 
)

Parameters:
edt_p 

Parameters:
cfg Configuration parameters
Returns:
0 on success, -1 if timed out
Sets up OCM LIU and locks to the input signal. Enables SLK_EN on channel, then checks SIG_DET and LOL bits. Turns on Xilinx PLL with PLL_EN, then checks RX_LOCK.

Definition at line 712 of file lib_ocm.c.

int edt_ocm_channel_setup ( EdtDev edt_p,
EdtOCConfig cfg 
)

Parameters:
edt_p pointer to device structure

Parameters:
cfg Configuration parameters
Returns:
0 on success
Initializes the framing parameters, memory, etc. If framing is enabled, the framer is active after this function, so the framing error registers can be read.

Called by edt_ocx_channel_setup

Definition at line 809 of file lib_ocm.c.

int edt_ocx_channel_lock_frontend ( EdtDev edt_p,
EdtOCConfig cfg 
)

Parameters:
edt_p pointer to device structure

Parameters:
cfg Configuration parameters
Returns:
0 on success, -1 on failure
Synch the LIU Plls. OCM checks for SIG_DET.

Definition at line 2800 of file lib_ocm.c.


Generated on Mon May 12 16:39:01 2008 by  doxygen 1.5.1