lib_sdh.h

00001 /* #pragma ident "@(#)lib_sdh.h 1.5 08/05/11 EDT" */
00002 
00003 #ifndef INCLUDE_lib_sdh_h
00004 #define INCLUDE_lib_sdh_h
00005 
00006 #ifdef __cplusplus
00007 extern "C" {
00008 #endif
00009 
00010 #include "edtinc.h"
00011          /*#include "initpcd.h"*/
00012 #include "ss_time_lib.h"
00013 #ifdef _NT_
00014 #include <direct.h>
00015 #define getcwd _getcwd
00016 #else
00017 #include <unistd.h>
00018 #endif
00019 
00020 #define CALLBACK_PER_E1_FRAME    0
00021 #define CALLBACK_PER_RING_BUFFER 1
00022 
00023 #define ATTACH_TO_CURRENT       0
00024 #define CONFIGURE_STM1_RATE     1
00025 #define CONFIGURE_STM4_RATE     4
00026 #define CONFIGURE_STM16_RATE    16
00027 #define CONFIGURE_STM64_RATE    64
00028 
00029 #ifndef PATH_MAX
00030 #define PATH_MAX 512
00031 #endif
00032 
00033 
00034 typedef struct {
00035     int unitNo;
00036     int e1buf_version;
00037     int dma_channel_count_per_board;
00038     int e1_count_per_dma_channel;
00039     int loss_of_light;
00040     int m_numRingBufs;
00041     int m_ringBufSize;
00042     int current_stm1;
00043     int current_channel;
00044     EdtDev *edt_p;
00045     struct {
00046         int active;
00047         EdtDev *edt_p;
00048     } stm1[32];
00049 } edt_sdh_t;
00050 
00051 typedef struct edt_sdh_e1_buf {
00052     struct {
00053 
00054         u_int time_secs    : 32;
00055 
00056         u_int e1_number    : 7;
00057         u_int odd_frame    : 1;
00058         u_int frame_lock   : 1;
00059         u_int pad          : 3;
00060         u_int time_fsecs   : 20;
00061 
00062     } e1_status;
00063 
00064     u_char e1_buf[32];
00065 
00066 } edt_sdh_e1_buf_t;
00067 
00068 
00069 typedef struct edt_sdh_e1_buf_v2 {
00070     struct {
00071 
00072         u_int time_secs    : 32;
00073         u_int time_fsecs   : 32;
00074         u_int length       : 16;
00075 
00076         u_int e1_number    : 6;
00077         u_int reserved1    : 1;
00078         u_int odd_frame    : 1;
00079         u_int frame_lock   : 1;
00080         u_int e1_tag       : 3;
00081         u_int vc12_buf     : 1;
00082         u_int reserved2    : 2;
00083         u_int raw_stm1     : 1;
00084 
00085     } e1_status;
00086 
00087     u_char e1_buf[36];
00088 
00089 } edt_sdh_e1_buf_v2_t;
00090 
00091 // e1 buf access routines which select v1 vs. v2 e1 data formats
00092 EDTAPI u_int edt_sdh_e1_buf_time_secs(edt_sdh_t *sdh_p, void *e1buf_p);
00093 EDTAPI u_int edt_sdh_e1_buf_time_fsecs(edt_sdh_t *sdh_p, void *e1buf_p);
00094 EDTAPI u_int edt_sdh_e1_buf_length(edt_sdh_t *sdh_p, void *e1buf_p);
00095 EDTAPI u_int edt_sdh_e1_buf_e1_number(edt_sdh_t *sdh_p, void *e1buf_p);
00096 EDTAPI u_int edt_sdh_e1_buf_odd_frame(edt_sdh_t *sdh_p, void *e1buf_p);
00097 EDTAPI u_int edt_sdh_e1_buf_frame_lock(edt_sdh_t *sdh_p, void *e1buf_p);
00098 EDTAPI u_int edt_sdh_e1_buf_e1_tag(edt_sdh_t *sdh_p, void *e1buf_p);
00099 EDTAPI u_int edt_sdh_e1_buf_vc12_buf(edt_sdh_t *sdh_p, void *e1buf_p);
00100 EDTAPI u_char *edt_sdh_e1_buf(edt_sdh_t *sdh_p, void *e1buf_p);
00101 
00102 
00103 /* SDH Demux DMA data path convenience routines */
00104 
00105 EDTAPI edt_sdh_t * edt_sdh_board_setup(int unitNo, int configure_board);
00106 
00107 EDTAPI int edt_sdh_release_board(edt_sdh_t *sdh_p);
00108 
00109 EDTAPI int edt_sdh_set_ring_buffer_size_number(edt_sdh_t *sdh_p, int bufsize, int numbufs);
00110 
00111 EDTAPI int edt_sdh_channel_disable(edt_sdh_t *sdh_p, int stm1num);
00112 
00113 EDTAPI int edt_sdh_channel_enable(edt_sdh_t *sdh_p, int stm1num);
00114 
00115 EDTAPI int edt_sdh_board_set_clock_to_system_time(edt_sdh_t *sdh_p);
00116 
00117 
00118 EDTAPI 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);
00119 
00120 EDTAPI 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 stm1), int timeout, int timeout_ok);
00121 
00122 
00123 EDTAPI int edt_sdh_stop_stm1_to_e1_channel(edt_sdh_t *sdh_p, int stm1);
00124 
00125 
00126 /* SDH Demux register access convenience routines */
00127 
00128 EDTAPI u_char edt_indirect_reg_read(EdtDev *edt_p, u_int addr);
00129 
00130 EDTAPI void edt_indirect_reg_write(EdtDev *edt_p, u_int addr, u_char val);
00131 
00132 EDTAPI int edt_sdh_loss_of_light(edt_sdh_t *sdh_p);
00133 EDTAPI int edt_sdh_loss_of_light_input_0(edt_sdh_t *sdh_p);
00134 EDTAPI int edt_sdh_loss_of_light_input_1(edt_sdh_t *sdh_p);
00135 
00136 EDTAPI int edt_sdh_stm_is_framed(edt_sdh_t *sdh_p);
00137 EDTAPI int edt_sdh_stm_is_framed_input_0(edt_sdh_t *sdh_p);
00138 EDTAPI int edt_sdh_stm_is_framed_input_1(edt_sdh_t *sdh_p);
00139 
00140 EDTAPI int edt_sdh_reg_read_stm1_status(edt_sdh_t *sdh_p, u_char *result);
00141 
00142 EDTAPI u_char edt_sdh_reg_read_vc4vc3_b3_error_count(edt_sdh_t *sdh_p, int stm1, u_short *result);
00143 
00144 EDTAPI u_char edt_sdh_reg_read_vc4vc3_MF_indicator(edt_sdh_t *sdh_p, int stm1, u_char *result);
00145 
00146 EDTAPI int edt_sdh_reg_read_E4_frame_status(edt_sdh_t *sdh_p, u_char *result);
00147 
00148 EDTAPI int edt_sdh_reg_set_E4_frame_disable(edt_sdh_t *sdh_p, int stm1, int disable);
00149 
00150 EDTAPI int edt_sdh_reg_read_E3_frame_status(edt_sdh_t *sdh_p, int stm1, u_char *result);
00151 
00152 EDTAPI int edt_sdh_reg_read_E2_frame_status(edt_sdh_t *sdh_p, int stm1, u_char *result);
00153 
00154 EDTAPI u_char edt_sdh_reg_read_E1_frame_status(edt_sdh_t *sdh_p, int stm1, u_char *result);
00155 
00156 EDTAPI int edt_sdh_reg_set_E1_frame_disable(edt_sdh_t *sdh_p, int stm1, int disable);
00157 
00158 EDTAPI int edt_sdh_reg_read_vc3_b3_error_count(edt_sdh_t *sdh_p, int stm1, u_short *result);
00159 
00160 EDTAPI int edt_sdh_reg_read_vc3_signal_label(edt_sdh_t *sdh_p, int stm1, u_char *result);
00161 
00162 EDTAPI u_char edt_sdh_reg_read_vc4vc3_path_overhead(edt_sdh_t *sdh_p, int stm1, u_char *result);
00163 
00164 EDTAPI int edt_sdh_reg_read_tu3vc3_path_overhead(edt_sdh_t *sdh_p, int stm1, u_char *result);
00165 
00166 EDTAPI int edt_sdh_reg_read_vc12_path_overhead(edt_sdh_t *sdh_p, int stm1, u_char *result);
00167 
00168 #ifdef __cplusplus
00169 }
00170 #endif
00171 
00172 #endif /* INCLUDE_lib_sdh_h */

Generated on 19 Jun 2015 by  doxygen 1.4.7