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 "edt_ocm.h"
#include "edt_ocx.h"
#include "edt_oc192.h"

Go to the source code of this file.

Functions

int edt_msdv_load_default_mezzanine (EdtDev *edt_p, EdtOCConfig *cfg)
int edt_msdv_lock_clocks (EdtDev *edt_p, int timeout)
int edt_net10g_channel_lock_frontend (EdtDev *edt_p, EdtOCConfig *cfg)
int edt_net10g_channel_setup (EdtDev *edt_p, EdtOCConfig *cfg)
int edt_net10g_has_mezz_bitfile (EdtDev *edt_p, const char *bitfile_name)
int edt_net10g_load_default_mezzanine (EdtDev *edt_p, EdtOCConfig *cfg)
char * edt_net10g_mezz_filename (EdtDev *edt_p, EdtOCConfig *cfg)
int edt_oc192_channel_lock_frontend (EdtDev *edt_p, EdtOCConfig *cfg)
int edt_oc192_channel_setup (EdtDev *edt_p, EdtOCConfig *cfg)
int edt_oc192_check_rate (EdtDev *edt_p, EdtOCConfig *cfg, EdtLineRate rate)
int edt_oc192_clear_demux (EdtDev *edt_p)
int edt_oc192_demux_chan_enable (EdtDev *edt_p, int channel, int enable)
int edt_oc192_demux_get (EdtDev *edt_p, EdtLineRate line_rate, u_char *onoff)
int edt_oc192_demux_get_chan_enabled (EdtDev *edt_p, int channel)
int edt_oc192_demux_set (EdtDev *edt_p, EdtLineRate line_rate, u_char *onoff)
int edt_oc192_enable_laser (EdtDev *edt_p, EdtOCConfig *cfg)
double edt_oc192_get_measured_frequency (EdtDev *edt_p, int clock)
int edt_oc192_get_overrun (EdtDev *edt_p)
EdtLineRate edt_oc192_get_rate (EdtDev *edt_p, EdtOCConfig *in_cfg)
int edt_oc192_get_underrun (EdtDev *edt_p)
int edt_oc192_has_mezz_bitfile (EdtDev *edt_p, const char *bitfile_name)
int edt_oc192_laser_on (EdtDev *edt_p, EdtOCConfig *cfg)
int edt_oc192_load_default_mezzanine (EdtDev *edt_p, EdtOCConfig *cfg)
int edt_oc192_lock_clocks (EdtDev *edt_p, int timeout)
void edt_oc192_mdio_dump (EdtDev *edt_p)
void edt_oc192_mdio_init (EdtDev *edt_p)
void edt_oc192_mdio_loopback (EdtDev *edt_p, int on)
unsigned char edt_oc192_mdio_read (EdtDev *edt_p, unsigned char address)
void edt_oc192_mdio_set_clock (EdtDev *edt_p)
void edt_oc192_mdio_set_prbs23 (EdtDev *edt_p, int on)
void edt_oc192_mdio_set_prbs31 (EdtDev *edt_p, int on)
void edt_oc192_mdio_set_swap (EdtDev *edt_p, int on)
void edt_oc192_mdio_standard (EdtDev *edt_p)
void edt_oc192_mdio_write (EdtDev *edt_p, unsigned char address, unsigned char value)
char * edt_oc192_mezz_filename (EdtDev *edt_p, EdtOCConfig *cfg)
char * edt_oc192_mezz_filename_gs (EdtDev *edt_p, EdtOCConfig *cfg)
void edt_oc192_reset_liu (EdtDev *edt_p)
int edt_oc192_set_clock_select (EdtDev *edt_p, EdtLineRate line_rate)
void edt_oc192_set_framer (EdtDev *edt_p, int flags)
int edt_oc192_set_liu (EdtDev *edt_p, int mode)
void edt_oc192_set_merged_mezz (EdtDev *edt_p, int state)
int edt_oc192_set_tagging (EdtDev *edt_p, int state, int tagid)
int edt_oc192_speed_capable (int channel, EdtLineRate line_rate)
int edt_oc192_wait_for_frame (EdtDev *edt_p, int timeout)
int edt_ocm_channel_lock_frontend (EdtDev *edt_p, EdtOCConfig *cfg)
int edt_ocm_channel_setup (EdtDev *edt_p, EdtOCConfig *cfg)
int edt_ocm_check_channel_lock_frontend (EdtDev *edt_p, EdtOCConfig *cfg)
int edt_ocm_check_rate (EdtDev *edt_p, EdtOCConfig *cfg, EdtLineRate rate)
int edt_ocm_demux_chan_enable (EdtDev *edt_p, int channel, int enable)
int edt_ocm_demux_get (EdtDev *edt_p, EdtLineRate line_rate, u_char *onoff)
int edt_ocm_demux_get_chan_enabled (EdtDev *edt_p, int channel)
int edt_ocm_demux_set (EdtDev *edt_p, EdtLineRate line_rate, u_char *onoff)
int edt_ocm_has_mezz_bitfile (EdtDev *edt_p, const char *bitfile_name)
int edt_ocm_load_default_mezzanine (EdtDev *edt_p, EdtOCConfig *cfg)
int edt_ocm_lock_clocks (EdtDev *edt_p, int timeout)
const char * edt_ocm_mezz_filename (EdtDev *edt_p, EdtOCConfig *cfg)
int edt_ocm_set_clock_select (EdtDev *edt_p, EdtLineRate line_rate)
int edt_ocm_speed_capable (int channel, EdtLineRate line_rate)
int edt_ocm_wait_for_frame (EdtDev *edt_p, int timeout)
int edt_ocx_adjust_phase (EdtDev *edt_p, int value)
int edt_ocx_base_init (EdtDev *edt_p, EdtOCConfig *cfg)
int edt_ocx_channel_lock_frontend (EdtDev *edt_p, EdtOCConfig *cfg)
int edt_ocx_channel_set_rate (EdtDev *edt_p, EdtOCConfig *cfg)
int edt_ocx_channel_setup (EdtDev *edt_p, EdtOCConfig *cfg)
int edt_ocx_channel_signal_detect (EdtDev *edt_p, int timeout)
 checks SIG_DET bit
int edt_ocx_channel_start (EdtDev *edt_p)
int edt_ocx_channel_start_cfg (EdtDev *edt_p, EdtOCConfig *cfg, int n)
int edt_ocx_check_interface (EdtDev *edt_p, char *target_file, int force_load)
int edt_ocx_check_mezz_bitfile (EdtDev *edt_p, EdtOCConfig *cfg)
int edt_ocx_clear_demux (EdtOcxDemux *demux)
int edt_ocx_configure (EdtDev *edt_p, EdtOCConfig *cfg)
char * edt_ocx_default_bitfile (int mezz_id)
int edt_ocx_demux_chan_enable (EdtDev *edt_p, int channel, u_char enable)
int edt_ocx_demux_get (EdtDev *edt_p, EdtLineRate line_rate, u_char *onoff)
int edt_ocx_demux_get_chan_enabled (EdtDev *edt_p, int channel)
int edt_ocx_demux_nbits (EdtLineRate line_rate)
int edt_ocx_demux_print (EdtOcxDemux *demux)
int edt_ocx_demux_reset (EdtDev *edt_p, EdtLineRate line_rate)
int edt_ocx_demux_set (EdtDev *edt_p, EdtLineRate line_rate, u_char *onoff)
void edt_ocx_enable_framing_errors (EdtDev *edt_p, int state)
double edt_ocx_get_data_rate (EdtLineRate rate)
int edt_ocx_get_framing_errors (EdtDev *edt_p, EdtOCXFrameErrors *err_p)
int edt_ocx_has_mezz_bitfile (EdtDev *edt_p, const char *bitfile_name)
int edt_ocx_is_demuxable (EdtLineRate line_rate)
int edt_ocx_load_default_mezzanine (EdtDev *edt_p, EdtOCConfig *cfg)
int edt_ocx_lock_channel_clock (EdtDev *edt_p, int channel, int timeout)
int edt_ocx_lock_clocks (EdtDev *edt_p, int timeout)
int edt_ocx_lock_local_clock (EdtDev *edt_p, int timeout)
const char * edt_ocx_mezz_filename (EdtDev *edt_p, EdtOCConfig *cfg)
int edt_ocx_parse_demux (EdtOcxDemux *demux, const char *word, char *errorstr)
int edt_ocx_post_start (EdtDev *edt_p, EdtOCConfig *cfg)
int edt_ocx_prepare_for_dma (EdtDev *edt_p, EdtOCConfig *cfg)
int edt_ocx_print_auto_phase (EdtDev *edt_p)
char * edt_ocx_print_byte_array (u_char *pvec, EdtLineRate rate, char *buf)
const char * edt_ocx_rate_name (EdtLineRate line_rate)
int edt_ocx_read_frequency (EdtDev *edt_p, EdtOCConfig *cfg)
void edt_ocx_reset_sys_en (EdtDev *edt_p, int channel)
int edt_ocx_rx_clk_phase (EdtDev *edt_p, int change)
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)
int edt_ocx_set_clock_select (EdtDev *edt_p, EdtLineRate line_rate)
void edt_ocx_set_lsbfirst (EdtDev *edt_p, int channel, int state)
int edt_ocx_speed_capable (EdtDev *edt_p, EdtLineRate line_rate)
int edt_ocx_wait_for_frame (EdtDev *edt_p, int timeout)


Function Documentation

int edt_msdv_load_default_mezzanine ( EdtDev edt_p,
EdtOCConfig *  cfg 
)

Parameters:
edt_p pointer to device structure
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 269 of file lib_ocm.c.

int edt_msdv_lock_clocks ( EdtDev edt_p,
int  timeout 
)

Parameters:
edt_p pointer to device structure
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 1703 of file lib_ocm.c.

int edt_net10g_channel_lock_frontend ( EdtDev edt_p,
EdtOCConfig *  cfg 
)

Parameters:
edt_p pointer to device structure
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 2388 of file lib_ocm.c.

int edt_net10g_channel_setup ( EdtDev edt_p,
EdtOCConfig *  cfg 
)

Parameters:
edt_p pointer to device structure
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 2588 of file lib_ocm.c.

int edt_net10g_has_mezz_bitfile ( EdtDev edt_p,
const char *  bitfile_name 
)

Parameters:
edt_p pointer to device structure
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 2046 of file lib_ocm.c.

int edt_net10g_load_default_mezzanine ( EdtDev edt_p,
EdtOCConfig *  cfg 
)

Parameters:
edt_p pointer to device structure
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 300 of file lib_ocm.c.

char* edt_net10g_mezz_filename ( EdtDev edt_p,
EdtOCConfig *  cfg 
)

Parameters:
edt_p pointer to device structure
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 1896 of file lib_ocm.c.

int edt_oc192_channel_lock_frontend ( EdtDev edt_p,
EdtOCConfig *  cfg 
)

Parameters:
edt_p pointer to device structure
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 2272 of file lib_ocm.c.

int edt_oc192_channel_setup ( EdtDev edt_p,
EdtOCConfig *  cfg 
)

Parameters:
edt_p pointer to device structure
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 2511 of file lib_ocm.c.

int edt_oc192_clear_demux ( EdtDev edt_p  ) 

Parameters:
edt_p pointer to device structure
Returns:
0 on success
Clears OC192 demux registers

Definition at line 2202 of file lib_ocm.c.

int edt_oc192_demux_chan_enable ( EdtDev edt_p,
int  channel,
int  enable 
)

Parameters:
edt_p pointer to device structure
channel which channel to enable/disable
enable A value of 0 or 1 to indicate whether to enable this column in the input. 0 means off, 1 means enabled (this is the inverse of the actual bit state).
Returns:
0 on success, -1 on parameter error
Sets a bit in the demux registers to enable/disable a particular column in the input.

Definition at line 3956 of file lib_ocm.c.

int edt_oc192_demux_get ( EdtDev edt_p,
EdtLineRate  line_rate,
u_char *  onoff 
)

Parameters:
edt_p pointer to device structure
line_rate Line Rate constant - must be OC192_RATE or STM64_RATE
onoff An array of 0 or 1 to indicate whether column is active. (In the register the bits are actually the inverse of this.) The length of the array should be 192 for OC192
Returns:
0 on success, -1 on parameter error
Gets the bits in the demux registers to enable/disable a particular column in the input.

Definition at line 3913 of file lib_ocm.c.

int edt_oc192_demux_get_chan_enabled ( EdtDev edt_p,
int  channel 
)

Parameters:
edt_p pointer to device structure
channel which channel to return the enabled status
Returns:
0 if not enabled, 1 if enabled
Gets the bit in the demux registers that indicate whether a particular column in the input is enabled.

Definition at line 3997 of file lib_ocm.c.

int edt_oc192_demux_set ( EdtDev edt_p,
EdtLineRate  line_rate,
u_char *  onoff 
)

Parameters:
edt_p pointer to device structure
line_rate Line Rate constant
onoff An array of 0 or 1 to indicate whether column is active. (In the register the bits are actually the inverse of this.) The length of the array shouldhe length of the array should be 192 for OC192.
Returns:
0 on success, -1 on framing timeout
Sets the bits in the demux registers to enable/disable a particular column in the input.

Definition at line 3869 of file lib_ocm.c.

int edt_oc192_has_mezz_bitfile ( EdtDev edt_p,
const char *  bitfile_name 
)

Parameters:
edt_p pointer to device structure
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 2019 of file lib_ocm.c.

int edt_oc192_load_default_mezzanine ( EdtDev edt_p,
EdtOCConfig *  cfg 
)

Parameters:
edt_p pointer to device structure
line_rate rate constant for the channel. If 0 use default OC192_RATE
mezz_0 Optional alternate mezzanine bitfile name. Defaults to OC192
mezz_1 Ignored
Returns:
0 on success
Loads OC192 unless overriden by parameters. Equivalent to the command line "otuload"

Definition at line 1928 of file lib_ocm.c.

int edt_oc192_lock_clocks ( EdtDev edt_p,
int  timeout 
)

Parameters:
edt_p pointer to device structure
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 1425 of file lib_ocm.c.

void edt_oc192_mdio_dump ( EdtDev edt_p  ) 

Parameters:
edt_p 

Definition at line 1198 of file lib_ocm.c.

void edt_oc192_mdio_init ( EdtDev edt_p  ) 

Parameters:
edt_p 

Definition at line 1119 of file lib_ocm.c.

void edt_oc192_mdio_loopback ( EdtDev edt_p,
int  on 
)

Parameters:
edt_p 
on 

Definition at line 1219 of file lib_ocm.c.

unsigned char edt_oc192_mdio_read ( EdtDev edt_p,
unsigned char  address 
)

Parameters:
edt_p pointer to device structure
address 
Returns:
byte read
read a byte at address from the LIU

Definition at line 1029 of file lib_ocm.c.

void edt_oc192_mdio_set_clock ( EdtDev edt_p  ) 

Parameters:
edt_p 

Definition at line 1165 of file lib_ocm.c.

void edt_oc192_mdio_set_prbs23 ( EdtDev edt_p,
int  on 
)

Parameters:
edt_p 
on 

Definition at line 1237 of file lib_ocm.c.

void edt_oc192_mdio_set_prbs31 ( EdtDev edt_p,
int  on 
)

Parameters:
edt_p 
on 

Definition at line 1257 of file lib_ocm.c.

void edt_oc192_mdio_set_swap ( EdtDev edt_p,
int  on 
)

Parameters:
edt_p 
on 

Definition at line 1181 of file lib_ocm.c.

void edt_oc192_mdio_standard ( EdtDev edt_p  ) 

Parameters:
edt_p 

Definition at line 1275 of file lib_ocm.c.

void edt_oc192_mdio_write ( EdtDev edt_p,
unsigned char  address,
unsigned char  value 
)

Parameters:
edt_p 
address 
value 

Definition at line 1081 of file lib_ocm.c.

char* edt_oc192_mezz_filename_gs ( EdtDev edt_p,
EdtOCConfig *  cfg 
)

Parameters:
edt_p pointer to device structure
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 1735 of file lib_ocm.c.

void edt_oc192_reset_liu ( EdtDev edt_p  ) 

Parameters:
edt_p 

Definition at line 1144 of file lib_ocm.c.

int edt_oc192_set_clock_select ( EdtDev edt_p,
EdtLineRate  line_rate 
)

Parameters:
edt_p pointer to device structure
line_rate rate constant
Returns:
0 on success
This calls edt_ocm_set_clock_select for channel 0 For OC192 it enables the PLL.

Definition at line 2074 of file lib_ocm.c.

void edt_oc192_set_framer ( EdtDev edt_p,
int  flags 
)

Parameters:
edt_p pointer to device structure
flags Turns on or off framer and descramble based on flags

Definition at line 2231 of file lib_ocm.c.

int edt_oc192_set_liu ( EdtDev edt_p,
int  mode 
)

Parameters:
edt_p 
mode OC192 mode constant
Returns:
0 on success, -1 on incorrect mode
Sets the liu to the mode

Definition at line 1320 of file lib_ocm.c.

int edt_oc192_set_tagging ( EdtDev edt_p,
int  state,
int  tagid 
)

Parameters:
edt_p pointer to device structure
state turn on or off
tagid # between 0 and 3 to set which piece of STM64 stream to capture
Returns:
0 when on success.
edt_oc192_wait_for_frame Checks the framing lock bit, will fail with timeout if timeout is non-zero.

Definition at line 2679 of file lib_ocm.c.

int edt_oc192_speed_capable ( int  channel,
EdtLineRate  line_rate 
)

Parameters:
edt_p pointer to device structure
line_rate Desired rate constant for the channel
Returns:
0 if capable of deignated rate, -1 if not
Returns whether this channel is capable of this line rate

Definition at line 1964 of file lib_ocm.c.

int edt_oc192_wait_for_frame ( EdtDev edt_p,
int  timeout 
)

Parameters:
edt_p pointer to device structure
timeout timeout value in ms
Returns:
0 when in frame, -1 if timed out.
edt_oc192_wait_for_frame Checks the framing lock bit, will fail with timeout if timeout is non-zero.

Definition at line 2639 of file lib_ocm.c.

int edt_ocm_channel_lock_frontend ( EdtDev edt_p,
EdtOCConfig *  cfg 
)

Parameters:
edt_p 
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 643 of file lib_ocm.c.

int edt_ocm_channel_setup ( EdtDev edt_p,
EdtOCConfig *  cfg 
)

Parameters:
edt_p pointer to device structure
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 866 of file lib_ocm.c.

int edt_ocm_check_channel_lock_frontend ( EdtDev edt_p,
EdtOCConfig *  cfg 
)

Parameters:
edt_p 
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 757 of file lib_ocm.c.

int edt_ocm_demux_chan_enable ( EdtDev edt_p,
int  channel,
int  enable 
)

Parameters:
edt_p pointer to device structure
channel which channel to enable/disable
enable A value of 0 or 1 to indicate whether to enable this column in the input. 0 means off, 1 means enabled (this is the inverse of the actual bit state).
Sets a bit in the demux registers to enable/disable a particular column in the input.

Definition at line 4175 of file lib_ocm.c.

int edt_ocm_demux_get ( EdtDev edt_p,
EdtLineRate  line_rate,
u_char *  onoff 
)

Parameters:
edt_p pointer to device structure
line_rate Line Rate constant - Currently must OC48_RATE or STM16_RATE
onoff An array of 0 or 1 to indicate whether column is active. (In the register the bits are actually the inverse of this.) The length of the array should be the equivalent OC number - 3 for OC3, 12 for OC12, etc.
Returns:
0 on success, -1 on parameter error
Gets the bits in the demux registers that enable/disable a particular column in the input.

Definition at line 4110 of file lib_ocm.c.

int edt_ocm_demux_get_chan_enabled ( EdtDev edt_p,
int  channel 
)

Parameters:
edt_p pointer to device structure
channel which channel to return the enabled status
Returns:
0 if not enabled, 1 if enabled
Gets the bit in the demux registers that indicate whether a particular column in the input is enabled.

Definition at line 4226 of file lib_ocm.c.

int edt_ocm_demux_set ( EdtDev edt_p,
EdtLineRate  line_rate,
u_char *  onoff 
)

Parameters:
edt_p pointer to device structure
line_rate Line Rate constant
onoff An array of 0 or 1 to indicate whether column is active. (In the register the bits are actually the inverse of this.) The length of the array should correspond to the OC line rate - 12 for OC12, 48 for OC48, etc. (STM rates should be multiplied by 3).
Returns:
0 on success, -1 on framing timeout
Sets the bits in the demux registers to enable/disable a particular column in the input.

Definition at line 4037 of file lib_ocm.c.

int edt_ocm_has_mezz_bitfile ( EdtDev edt_p,
const char *  bitfile_name 
)

Parameters:
edt_p pointer to device structure
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 521 of file lib_ocm.c.

int edt_ocm_load_default_mezzanine ( EdtDev edt_p,
EdtOCConfig *  cfg 
)

Parameters:
edt_p pointer to device structure
line_rate rate constant for the channel. If 0 use default
mezz_0 Optional alternate mezzanine bitfile names
mezz_1 Defaults to ocm48 and ocm12
Returns:
0 on success
edt_ocm_load_default_mezzanine Loads ocm48 in ch 0, ocm12 in ch 1 unless overriden by parameters. Equivalent to the command line "ocmload"

Definition at line 424 of file lib_ocm.c.

int edt_ocm_lock_clocks ( EdtDev edt_p,
int  timeout 
)

Parameters:
edt_p pointer to device structure
timeout in ms to wait for the clocks to synch up
Returns:
0 on success, -1 on failure
Locks all three 100 Mhz reference clocks on the OCM board

Definition at line 346 of file lib_ocm.c.

const char* edt_ocm_mezz_filename ( EdtDev edt_p,
EdtOCConfig *  cfg 
)

Parameters:
edt_p pointer to device structure
line_rate Rate constant
Returns:
OCM mezzanine file name for a line rate, NULL if not a valid rate constant
Called by edt_ocx_mezz_filename.

Definition at line 375 of file lib_ocm.c.

int edt_ocm_set_clock_select ( EdtDev edt_p,
EdtLineRate  line_rate 
)

Parameters:
edt_p pointer to device structure
line_rate Rate constant
Returns:
0 on success
Select the correct clock source for the line rate.

Definition at line 561 of file lib_ocm.c.

int edt_ocm_speed_capable ( int  channel,
EdtLineRate  line_rate 
)

Parameters:
edt_p pointer to device structure
line_rate Desired rate constant for the channel
Returns:
0 if capable of designated rate, -1 if not
Returns whether this channel is capable of this line rate

Definition at line 474 of file lib_ocm.c.

int edt_ocm_wait_for_frame ( EdtDev edt_p,
int  timeout 
)

Parameters:
edt_p pointer to device structure
timeout timeout value in ms
Returns:
0 on success, -1 on timeout

Definition at line 958 of file lib_ocm.c.

int edt_ocx_base_init ( EdtDev edt_p,
EdtOCConfig *  cfg 
)

Parameters:
edt_p pointer to device structure
cfg uses flags and intfc Flags referred to : EDT_OCX_SKIP_LOAD won't load bitfile even if incorrect EDT_OCX_SWAP turns on BYTE_SWAP/SHORT_SWAP
Returns:
0 on success, -1 on failure
Loads the correct interface bitfile and default mezzanine bitfiles. Clears channel enables and locks the SYS_LOCK and LOCAL_SYS_LOCK plls.

Definition at line 2957 of file lib_ocm.c.

int edt_ocx_channel_lock_frontend ( EdtDev edt_p,
EdtOCConfig *  cfg 
)

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

Definition at line 3499 of file lib_ocm.c.

int edt_ocx_channel_set_rate ( EdtDev edt_p,
EdtOCConfig *  cfg 
)

Parameters:
edt_p pointer to device structure
cfg Configuration parameters
Returns:
0 on success 1 on failure
Sets the channel to the speed defined by cfg->line_rate

Definition at line 3420 of file lib_ocm.c.

int edt_ocx_channel_setup ( EdtDev edt_p,
EdtOCConfig *  cfg 
)

Parameters:
edt_p pointer to device structure
cfg Configuration parameters
Returns:
0 on success, -1 on failure

Definition at line 3539 of file lib_ocm.c.

int edt_ocx_channel_signal_detect ( EdtDev edt_p,
int  timeout 
)

checks SIG_DET bit

Parameters:
edt_p pointer to device structure
Returns:
1 if SIG_DET bit is set, 0 otherwise
Simple function which returns the state of the SIG_DET bit.

Note - as of 2/28/07, this bit isn't available on OC192 channel 0 yet, so it always returns 1;

Definition at line 3349 of file lib_ocm.c.

int edt_ocx_channel_start ( EdtDev edt_p  ) 

Parameters:
edt_p pointer to device structure
Returns:
0 on success, -1 on framing timeout
Starts the dma by calling edt_start_buffers, then turning on the channel enable bit.

Definition at line 3759 of file lib_ocm.c.

int edt_ocx_check_interface ( EdtDev edt_p,
char *  target_file,
int  force_load 
)

Parameters:
edt_p pointer to device structure
target_file file name of bitfile desired
force_load Allow loading the correct bitfile in place of current one.
Returns:
0 if correct bitfile loaded, -1 otherwise.
Check the UI interface bitfile, load with target_file if necessary.

Definition at line 2809 of file lib_ocm.c.

int edt_ocx_check_mezz_bitfile ( EdtDev edt_p,
EdtOCConfig *  cfg 
)

Parameters:
edt_p pointer to device structure
cfg Configuration parameters
Returns:
0 on success, -1 on failure
Makes sure the correct mezzanine bitfile is loaded.

Definition at line 3180 of file lib_ocm.c.

int edt_ocx_configure ( EdtDev edt_p,
EdtOCConfig *  cfg 
)

Parameters:
edt_p pointer to device structure
cfg EdtOCConfig configuration parameters
Returns:
0 on success, -1 on failure
Calls initialization routines necessary up to edt_ocx_channel_lock_frontend(). Passes the cfg structure to these functions in sequence:

  1. edt_ocx_base_init() is called if cfg->flags has the EDT_OCX_FULL_INIT bit set. Otherwise, edt_get_board_description() is called to make sure we've characterized the board.
  2. edt_ocx_channel_set_rate()
  3. edt_ocx_channel_setup()
  4. edt_ocx_channel_lock_frontend()

On completion and a return value of 0, the board is ready to start DMA on this channel.

Definition at line 3585 of file lib_ocm.c.

char* edt_ocx_default_bitfile ( int  mezz_id  ) 

Parameters:
mezz.id Either MEZZ_OCM or MEZZ_OC192 (filled in by edt_get_board_description)
Returns:
standard base board interface file name

Definition at line 2767 of file lib_ocm.c.

int edt_ocx_demux_chan_enable ( EdtDev edt_p,
int  channel,
u_char  enable 
)

Parameters:
edt_p pointer to device structure
channel which channel to enable/disable
enable A value of 0 or 1 to indicate whether to enable this column in the input. 0 means off, 1 means enabled (this is the inverse of the actual bit state).
Sets a bit in the demux registers to enable/disable a particular column in the input.

Definition at line 4333 of file lib_ocm.c.

int edt_ocx_demux_get ( EdtDev edt_p,
EdtLineRate  line_rate,
u_char *  onoff 
)

Parameters:
edt_p pointer to device structure
line_rate Line Rate constant - This parameter determines the length of the onoff array. (Currently must OC48_RATE or STM16_RATE for the OCM board.)
onoff An array of 0 or 1 to indicate whether column is active. (In the register the bits are actually the inverse of this.) The length of the array should be the equivalent OC number - 3 for OC3, 12 for OC12, etc.
Returns:
0 on success, -1 on parameter error
Gets the bits in the demux registers that enable/disable a particular column in the input.

Definition at line 4304 of file lib_ocm.c.

int edt_ocx_demux_get_chan_enabled ( EdtDev edt_p,
int  channel 
)

Parameters:
edt_p pointer to device structure
channel which channel to return the enabled status
Returns:
0 if not enabled, 1 if enabled
Gets the bit in the demux registers that indicate whether a particular column in the input is enabled.

Definition at line 4362 of file lib_ocm.c.

int edt_ocx_demux_set ( EdtDev edt_p,
EdtLineRate  line_rate,
u_char *  onoff 
)

Parameters:
edt_p pointer to device structure
line_rate Line Rate constant -this is used to determine the length of the array.
onoff An array of bytes set to 0 or 1 to indicate whether column is active. (In the register the bits are actually the inverse of this.) The length of the array should correspond to the OC line rate - 12 for OC12, 48 for OC48, etc. (STM rates should be multiplied by 3).
Returns:
0 on success, -1 on framing timeout
Sets the bits in the demux registers to enable/disable a particular column in the input.

Definition at line 4269 of file lib_ocm.c.

void edt_ocx_enable_framing_errors ( EdtDev edt_p,
int  state 
)

Parameters:
edt_p pointer to device structure
state Sets the error count enable bit to state (on/off).

Definition at line 120 of file lib_ocm.c.

int edt_ocx_get_framing_errors ( EdtDev edt_p,
EdtOCXFrameErrors *  err_p 
)

Parameters:
edt_p pointer to device structure
err_p 
Returns:
0 on success
Fills in the error structure in err_p. Call this rather than checking individual registers because it will latch the values correctly using the OCM_ERROR_COUNT_HOLD bit.

Definition at line 150 of file lib_ocm.c.

int edt_ocx_has_mezz_bitfile ( EdtDev edt_p,
const char *  bitfile_name 
)

Parameters:
edt_p pointer to device structure
bitfile_name 
Returns:
0 on success, -1 on failure
Checks the loaded bitfile against bitfile_name, returns true or false.

Definition at line 3108 of file lib_ocm.c.

int edt_ocx_load_default_mezzanine ( EdtDev edt_p,
EdtOCConfig *  cfg 
)

Parameters:
edt_p pointer to device structure
line_rate rate constant for the channel. If 0 use default
mezz_0 Optional alternate mezzanine bitfile name
mezz_1 Optional alternate mezzanine bitfile name
Returns:
0 on success
Loads defaults in ch 0, (and ch 1 for OCM), unless overriden by parameters. Equivalent to the command line "ocmload" for OCM and "otuload" for OC192

Returns:
0 on success, -1 if load fails or not correct board type

Definition at line 2920 of file lib_ocm.c.

int edt_ocx_lock_channel_clock ( EdtDev edt_p,
int  channel,
int  timeout 
)

Parameters:
edt_p pointer to device structure
channel Which DMA channel
timeout in ms
Returns:
0 on success,
This waits until the SYS_LOCK bit is set for channel. If timeout is non-zero it returns -1 if the bit isn't set within timeout ms.

Definition at line 233 of file lib_ocm.c.

int edt_ocx_lock_clocks ( EdtDev edt_p,
int  timeout 
)

Parameters:
edt_p pointer to device structure
timeout timeout in ms
Returns:
0 on success, -1 on timeout
Calls appropriate function to lock pll clocks between main board and mezzanine

Definition at line 2879 of file lib_ocm.c.

int edt_ocx_lock_local_clock ( EdtDev edt_p,
int  timeout 
)

Parameters:
edt_p pointer to device structure
timeout 
Returns:
0 on success, -1 on failure
This waits until the LOCAL_SYS_LOCK bit is set. If timeout is non-zero it returns -1 if the bit isn't set within timeout ms.

Definition at line 200 of file lib_ocm.c.

const char* edt_ocx_mezz_filename ( EdtDev edt_p,
EdtOCConfig *  cfg 
)

Parameters:
edt_p pointer to device structure
line_rate Rate constant
Returns:
correct bitfile name for a line rate and board type

Definition at line 3149 of file lib_ocm.c.

void edt_ocx_reset_sys_en ( EdtDev edt_p,
int  channel 
)

Parameters:
edt_p pointer to device structure
channel DMA channel
Toggles the state of the SYS_EN bit for channel.

Definition at line 3394 of file lib_ocm.c.

void edt_ocx_set_channel_enable ( EdtDev edt_p,
int  channel,
int  state 
)

Parameters:
edt_p pointer to device structure
channel DMA channel
state Sets the channel enable bit to state channel may not be the one in edt_p->channel_no, so multiple channels can be initialized using a single edt_p

Definition at line 3290 of file lib_ocm.c.

int edt_ocx_set_clock_select ( EdtDev edt_p,
EdtLineRate  line_rate 
)

Parameters:
edt_p pointer to device structure
line_rate Rate constant
Returns:
Calls the correct clock select for the mezzanine board type.

Definition at line 3260 of file lib_ocm.c.

void edt_ocx_set_lsbfirst ( EdtDev edt_p,
int  channel,
int  state 
)

Parameters:
edt_p pointer to device structure
channel 
state Sets the lsbfirst bit to state. channel may not be the one in edt_p->channel_no, so multiple channels can be initialized using a single edt_p

Definition at line 3324 of file lib_ocm.c.

int edt_ocx_speed_capable ( EdtDev edt_p,
EdtLineRate  line_rate 
)

Parameters:
edt_p pointer to device structure
line_rate Rate constant
Returns:
0 if capable of designated rate, -1 if not
Returns whether this channel is capable of this line rate. Selects based on edt_p->mezz.id.

Definition at line 3069 of file lib_ocm.c.

int edt_ocx_wait_for_frame ( EdtDev edt_p,
int  timeout 
)

Parameters:
edt_p pointer to device structure
timeout 
Returns:
0 on success, -1 on timeout
Calls the correct wait_for_frame function for OCM or OC192, returning once the channel is framed correctly.

Definition at line 3663 of file lib_ocm.c.


Generated on 19 Jun 2015 by  doxygen 1.4.7