Definition in file lib_sdh.c.
#include "edtinc.h"
#include "edt_ocx.h"
#include "lib_sdh.h"
#include "initpcd.h"
Go to the source code of this file.
Functions | |
u_char | edt_indirect_reg_read (EdtDev *edt_p, u_int addr) |
void | edt_indirect_reg_write (EdtDev *edt_p, u_int addr, u_char val) |
int | edt_sdh_board_set_clock_to_system_time (edt_sdh_t *sdh_p) |
Set the SDH board internal clock to system time. | |
edt_sdh_t * | edt_sdh_board_setup (int unitNo, int configure_board) |
Initialize the SDH demux board. | |
int | edt_sdh_channel_disable (edt_sdh_t *sdh_p, int channel) |
Clear the STM1 demux channel enable bit. | |
int | edt_sdh_channel_enable (edt_sdh_t *sdh_p, int channel) |
Set the STM1 demux channel enable bit. | |
u_char * | edt_sdh_e1_buf (edt_sdh_t *sdh_p, void *e1buf_p) |
u_int | edt_sdh_e1_buf_e1_number (edt_sdh_t *sdh_p, void *e1buf_p) |
u_int | edt_sdh_e1_buf_e1_tag (edt_sdh_t *sdh_p, void *e1buf_p) |
u_int | edt_sdh_e1_buf_frame_lock (edt_sdh_t *sdh_p, void *e1buf_p) |
u_int | edt_sdh_e1_buf_length (edt_sdh_t *sdh_p, void *e1buf_p) |
u_int | edt_sdh_e1_buf_odd_frame (edt_sdh_t *sdh_p, void *e1buf_p) |
u_int | edt_sdh_e1_buf_time_fsecs (edt_sdh_t *sdh_p, void *e1buf_p) |
u_int | edt_sdh_e1_buf_time_secs (edt_sdh_t *sdh_p, void *e1buf_p) |
u_int | edt_sdh_e1_buf_vc12_buf (edt_sdh_t *sdh_p, void *e1buf_p) |
int | edt_sdh_loss_of_light (edt_sdh_t *sdh_p) |
Return nonzero when there is a loss of light condition on the interface. | |
int | edt_sdh_loss_of_light_input_0 (edt_sdh_t *sdh_p) |
int | edt_sdh_loss_of_light_input_1 (edt_sdh_t *sdh_p) |
u_char | edt_sdh_reg_read_E1_frame_status (edt_sdh_t *sdh_p, int channel, u_char *result) |
Read the selected STM1 E1 Frame Status Register values into an array of 64 unsigned chars. | |
int | edt_sdh_reg_read_E2_frame_status (edt_sdh_t *sdh_p, int channel, u_char *result) |
Read the selected STM1 E2 Frame Status Register values into an array of 16 unsigned chars. | |
int | edt_sdh_reg_read_E3_frame_status (edt_sdh_t *sdh_p, int channel, u_char *result) |
Read the selected STM1 E3 Frame Status Register values into an array of 4 unsigned chars. | |
int | edt_sdh_reg_read_E4_frame_status (edt_sdh_t *sdh_p, u_char *result) |
Read 16 STM1 E4 Status Register values into an array of unsigned chars. | |
int | edt_sdh_reg_read_stm1_status (edt_sdh_t *sdh_p, u_char *result) |
Read 16 STM1 Status Register values into an array of unsigned chars. | |
int | edt_sdh_reg_read_tu3vc3_path_overhead (edt_sdh_t *sdh_p, int channel, u_char *result) |
Read the values of the TU3 VC3 Path Overhead (POH) Registers for an STM1. | |
int | edt_sdh_reg_read_vc12_path_overhead (edt_sdh_t *sdh_p, int channel, u_char *result) |
Read the values of the VC12 Path Overhead (POH) Registers for an STM1. | |
int | edt_sdh_reg_read_vc3_b3_error_count (edt_sdh_t *sdh_p, int channel, u_short *result) |
Read the values of the VC3 (via TU3) B3 Error Count Registers for an STM1 into an array of 3 unsigned shorts. | |
int | edt_sdh_reg_read_vc3_signal_label (edt_sdh_t *sdh_p, int channel, u_char *result) |
Reads the values of the VC3 Signal Lable Registers for an STM1 into an array of 3 unsigned chars. | |
u_char | edt_sdh_reg_read_vc4vc3_b3_error_count (edt_sdh_t *sdh_p, int channel, u_short *result) |
Read the values of the VC4/3 B3 Error Count Registers for an STM1 into an array of unsigned shorts. | |
u_char | edt_sdh_reg_read_vc4vc3_MF_indicator (edt_sdh_t *sdh_p, int channel, u_char *result) |
Read the value(s) of the VC4/3 Multiframe (MF) Indicator Registers for an STM1. | |
u_char | edt_sdh_reg_read_vc4vc3_path_overhead (edt_sdh_t *sdh_p, int channel, u_char *result) |
Read the values of the VC4/3 Path Overhead (POH) Registers for an STM1. | |
int | edt_sdh_reg_set_E1_frame_disable (edt_sdh_t *sdh_p, int channel, int disable) |
Set the E1 disable registers for a specified STM1. | |
int | edt_sdh_reg_set_E4_frame_disable (edt_sdh_t *sdh_p, int channel, int disable) |
Set the E4 disable register for a specified STM1. | |
int | edt_sdh_release_board (edt_sdh_t *sdh_p) |
Release the SDH demux board. | |
int | edt_sdh_set_ring_buffer_size_number (edt_sdh_t *sdh_p, int bufsize, int numbufs) |
Set ring buffer size and number for an open sdh_p. | |
int | edt_sdh_start_stm1_to_e1_channel (edt_sdh_t *sdh_p, int stm1, int channel, int callbackControl, int(*e1_callback)(void *e1buf, void *auxArg), void *callbackArg, int loops) |
Create an e1 packet processing data stream corresponding to a single STM1 input. | |
int | edt_sdh_start_stm1_to_e1_channel_timeout (edt_sdh_t *sdh_p, int stm1, int channel, int callbackControl, int(*e1_callback)(void *e1buf, void *auxArg), void *callbackArg, int loops, int(*timeout_callback)(edt_sdh_t *sdh_p, int channel), int timeout, int timeout_ok) |
Create an e1 packet processing data stream corresponding to a single STM1 input with timeouts enabled, qualified, and a timeout callback issued upon timeout. | |
int | edt_sdh_stm_is_framed (edt_sdh_t *sdh_p) |
Return nonzero when the STM input signal is framed. | |
int | edt_sdh_stm_is_framed_input_0 (edt_sdh_t *sdh_p) |
int | edt_sdh_stm_is_framed_input_1 (edt_sdh_t *sdh_p) |
int | edt_sdh_stop_stm1_to_e1_channel (edt_sdh_t *sdh_p, int stm1) |
Cause a previously created e1 packet processing data stream to halt operation and return. |
int edt_sdh_board_set_clock_to_system_time | ( | edt_sdh_t * | sdh_p | ) |
Set the SDH board internal clock to system time.
sdh_p | containing a handle returned from edt_sdh_board_setup(). |
edt_sdh_t* edt_sdh_board_setup | ( | int | unitNo, | |
int | configure_board | |||
) |
Initialize the SDH demux board.
unitNo | containing the EDTpcd board unit number. | |
configure_board | containing one of: |
as defined in lib_sdh.h.
Then edt_sdh_board_setup allocates and returns a handle for use with other lib_sdh API functions.
int edt_sdh_channel_disable | ( | edt_sdh_t * | sdh_p, | |
int | channel | |||
) |
Clear the STM1 demux channel enable bit.
sdh_p | containing a handle returned from edt_sdh_board_setup(). | |
channel | containing the demux channel (0-15) of interest. |
int edt_sdh_channel_enable | ( | edt_sdh_t * | sdh_p, | |
int | channel | |||
) |
Set the STM1 demux channel enable bit.
sdh_p | containing a handle returned from edt_sdh_board_setup(). | |
channel | containing the demux channel (0-15) of interest. |
int edt_sdh_loss_of_light | ( | edt_sdh_t * | sdh_p | ) |
Return nonzero when there is a loss of light condition on the interface.
sdh_p | containing a handle returned from edt_sdh_board_setup(). |
u_char edt_sdh_reg_read_E1_frame_status | ( | edt_sdh_t * | sdh_p, | |
int | channel, | |||
u_char * | result | |||
) |
Read the selected STM1 E1 Frame Status Register values into an array of 64 unsigned chars.
sdh_p | containing a handle returned from edt_sdh_board_setup(). | |
channel | containing the demux channel (0-15) of interest. | |
result | containing a pointer to an array of 64 unsigned chars. |
int edt_sdh_reg_read_E2_frame_status | ( | edt_sdh_t * | sdh_p, | |
int | channel, | |||
u_char * | result | |||
) |
Read the selected STM1 E2 Frame Status Register values into an array of 16 unsigned chars.
sdh_p | containing a handle returned from edt_sdh_board_setup(). | |
channel | containing the demux channel (0-15) of interest. | |
result | containing a pointer to an array of 16 unsigned chars. |
int edt_sdh_reg_read_E3_frame_status | ( | edt_sdh_t * | sdh_p, | |
int | channel, | |||
u_char * | result | |||
) |
Read the selected STM1 E3 Frame Status Register values into an array of 4 unsigned chars.
sdh_p | containing a handle returned from edt_sdh_board_setup(). | |
channel | containing the demux channel (0-15) of interest. | |
result | containing a pointer to an array of 4 unsigned chars. |
int edt_sdh_reg_read_E4_frame_status | ( | edt_sdh_t * | sdh_p, | |
u_char * | result | |||
) |
Read 16 STM1 E4 Status Register values into an array of unsigned chars.
sdh_p | containing a handle returned from edt_sdh_board_setup(). | |
result | containing a pointer to an array of 16 unsigned chars. |
int edt_sdh_reg_read_stm1_status | ( | edt_sdh_t * | sdh_p, | |
u_char * | result | |||
) |
Read 16 STM1 Status Register values into an array of unsigned chars.
sdh_p | containing a handle returned from edt_sdh_board_setup(). | |
result | containing a pointer to an array of 16 unsigned chars. |
int edt_sdh_reg_read_tu3vc3_path_overhead | ( | edt_sdh_t * | sdh_p, | |
int | channel, | |||
u_char * | result | |||
) |
Read the values of the TU3 VC3 Path Overhead (POH) Registers for an STM1.
sdh_p | containing a handle returned from edt_sdh_board_setup(). | |
channel | containing the demux channel (0-15) of interest. | |
result | containing a pointer to an array of 27 unsigned chars. |
int edt_sdh_reg_read_vc12_path_overhead | ( | edt_sdh_t * | sdh_p, | |
int | channel, | |||
u_char * | result | |||
) |
Read the values of the VC12 Path Overhead (POH) Registers for an STM1.
sdh_p | containing a handle returned from edt_sdh_board_setup(). | |
channel | containing the demux channel (0-15) of interest. | |
result | containing a pointer to an array of 252 unsigned chars. |
int edt_sdh_reg_read_vc3_b3_error_count | ( | edt_sdh_t * | sdh_p, | |
int | channel, | |||
u_short * | result | |||
) |
Read the values of the VC3 (via TU3) B3 Error Count Registers for an STM1 into an array of 3 unsigned shorts.
sdh_p | containing a handle returned from edt_sdh_board_setup(). | |
channel | containing the demux channel (0-15) of interest. | |
result | containing a pointer to an array of 3 unsigned shorts. |
int edt_sdh_reg_read_vc3_signal_label | ( | edt_sdh_t * | sdh_p, | |
int | channel, | |||
u_char * | result | |||
) |
Reads the values of the VC3 Signal Lable Registers for an STM1 into an array of 3 unsigned chars.
sdh_p | containing a handle returned from edt_sdh_board_setup(). | |
channel | containing the demux channel (0-15) of interest. | |
result | containing a pointer to an array of 3 unsigned chars. |
u_char edt_sdh_reg_read_vc4vc3_b3_error_count | ( | edt_sdh_t * | sdh_p, | |
int | channel, | |||
u_short * | result | |||
) |
Read the values of the VC4/3 B3 Error Count Registers for an STM1 into an array of unsigned shorts.
sdh_p | containing a handle returned from edt_sdh_board_setup(). | |
channel | containing the demux channel (0-15) of interest. | |
result | containing a pointer to an array of 3 unsigned shorts. |
u_char edt_sdh_reg_read_vc4vc3_MF_indicator | ( | edt_sdh_t * | sdh_p, | |
int | channel, | |||
u_char * | result | |||
) |
Read the value(s) of the VC4/3 Multiframe (MF) Indicator Registers for an STM1.
sdh_p | containing a handle returned from edt_sdh_board_setup(). | |
channel | containing the demux channel (0-15) of interest. | |
result | containing a pointer to an array of 3 unsigned chars. |
u_char edt_sdh_reg_read_vc4vc3_path_overhead | ( | edt_sdh_t * | sdh_p, | |
int | channel, | |||
u_char * | result | |||
) |
Read the values of the VC4/3 Path Overhead (POH) Registers for an STM1.
sdh_p | containing a handle returned from edt_sdh_board_setup(). | |
channel | containing the demux channel (0-15) of interest. | |
result | containing a pointer to an array of 27 unsigned chars. |
int edt_sdh_reg_set_E1_frame_disable | ( | edt_sdh_t * | sdh_p, | |
int | channel, | |||
int | disable | |||
) |
Set the E1 disable registers for a specified STM1.
sdh_p | containing a handle returned from edt_sdh_board_setup(). | |
channel | containing the demux channel (0-15) of interest. | |
disable | containing a zero or nonzero value to clear or set the E1 Frame Disable Register. |
int edt_sdh_reg_set_E4_frame_disable | ( | edt_sdh_t * | sdh_p, | |
int | channel, | |||
int | disable | |||
) |
Set the E4 disable register for a specified STM1.
sdh_p | containing a handle returned from edt_sdh_board_setup(). | |
channel | containing the demux channel (0-15) of interest. | |
disable | containing a zero or nonzero value to clear or set the E4 Frame Disable Register. |
int edt_sdh_release_board | ( | edt_sdh_t * | sdh_p | ) |
Release the SDH demux board.
sdh_p | containing an edt_sdh_t* handle returned by edt_sdh_board_setup(). |
int edt_sdh_set_ring_buffer_size_number | ( | edt_sdh_t * | sdh_p, | |
int | bufsize, | |||
int | numbufs | |||
) |
Set ring buffer size and number for an open sdh_p.
sdh_p | containing an edt_sdh_t* handle returned by edt_sdh_board_setup(). |
int edt_sdh_start_stm1_to_e1_channel | ( | edt_sdh_t * | sdh_p, | |
int | stm1, | |||
int | channel, | |||
int | callbackControl, | |||
int(*)(void *e1buf, void *auxArg) | e1_callback, | |||
void * | callbackArg, | |||
int | loops | |||
) |
Create an e1 packet processing data stream corresponding to a single STM1 input.
sdh_p | containing a handle returned from edt_sdh_board_setup(). | |
stm1 | single STM1 input number to assocate with the following DMA channel. | |
channel | containing a DMA channel number corresponding to a single STM1 input demuxed e1 data packets. | |
callbackControl | containing either CALLBACK_PER_E1_FRAME or CALLBACK_PER_RING_BUFFER. | |
e1_callback | containing a pointer to a function which will be called for each demuxed e1 data packet. | |
callbackArg | containing a pointer to data to be passed to the e1_callback funciton. | |
loops | containing an integer specifying the number of buffers to process with 0 meaning unlimited. |
Callbacks will occur on a per-e1 frame or on a per-completed ring buffer basis, depending on the value of the callbackControl parameter. It is then up to the callback function to complete processing of the data in a timely fashion so that DMA does not circle around the ring buffer and overwrite the buffer data while it is being processed.
Ring buffers are numbered and sized as follows: 4 buffers each of size 40 * 32 * 1024 (about 1.3 Mbytes). Each ring buffer will contain 32768 E1 packets each of 40 bytes (8 bytes of timestamp and status and 32 bytes of E1 data). Since each of the 16 DMA channels will be running at about 25 Mbytes/sec, this is the recommended size and number of ring buffers. Larger or more buffers could cause the system to experience unnecessary memory subsystem activity or thrashing.
int edt_sdh_start_stm1_to_e1_channel_timeout | ( | edt_sdh_t * | sdh_p, | |
int | stm1, | |||
int | channel, | |||
int | callbackControl, | |||
int(*)(void *e1buf, void *auxArg) | e1_callback, | |||
void * | callbackArg, | |||
int | loops, | |||
int(*)(edt_sdh_t *sdh_p, int channel) | timeout_callback, | |||
int | timeout, | |||
int | timeout_ok | |||
) |
Create an e1 packet processing data stream corresponding to a single STM1 input with timeouts enabled, qualified, and a timeout callback issued upon timeout.
sdh_p | containing a handle returned from edt_sdh_board_setup(). | |
stm1 | single STM1 input number to assocate with the following DMA channel. | |
channel | containing a DMA channel number corresponding to a single STM1 input demuxed e1 data packets. | |
callbackControl | containing either CALLBACK_PER_E1_FRAME or CALLBACK_PER_RING_BUFFER. | |
e1_callback | containing a pointer to a function which will be called for each demuxed e1 data packet. | |
callbackArg | containing a pointer to data to be passed to the e1_callback funciton. | |
loops | containing an integer specifying the number of buffers to process with 0 meaning unlimited. | |
timeout_callback | containing a function pointer to be called upon a ring buffer timeout. | |
timeout | containing an integer specifying the number of miliseconds to wait before DMA is timed out with 0 meaning no timeout. | |
timeout_ok | containing an integer containing 0 to cause a timeout to abort DMA and stop the ring buffer, or 1 to simply notify of the timeout. |
Callbacks will occur on a per-e1 frame or on a per-completed ring buffer basis, depending on the value of the callbackControl parameter. It is then up to the callback function to complete processing of the data in a timely fashion so that DMA does not circle around the ring buffer and overwrite the buffer data while it is being processed.
Ring buffers are numbered and sized as follows: 4 buffers each of size 40 * 32 * 1024 (about 1.3 Mbytes). Each ring buffer will contain 32768 E1 packets each of 40 bytes (8 bytes of timestamp and status and 32 bytes of E1 data). Since each of the 16 DMA channels will be running at about 25 Mbytes/sec, this is the recommended size and number of ring buffers. Larger or more buffers could cause the system to experience unnecessary memory subsystem activity or thrashing.
int edt_sdh_stm_is_framed | ( | edt_sdh_t * | sdh_p | ) |
Return nonzero when the STM input signal is framed.
sdh_p | containing a handle returned from edt_open() or edt_open_channel(). |
int edt_sdh_stop_stm1_to_e1_channel | ( | edt_sdh_t * | sdh_p, | |
int | stm1 | |||
) |
Cause a previously created e1 packet processing data stream to halt operation and return.
sdh_p | containing a handle returned from edt_sdh_board_setup(). | |
stm1 | containing a DMA channel number corresponding to a single STM1 input demuxed e1 data packets. |