00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __AFT_TDM_HP_H_
00018 #define __AFT_TDM_HP_H_
00019
00020 #define _GNU_SOURCE
00021 #include <stdio.h>
00022 #include <string.h>
00023 #include <stdarg.h>
00024 #include <stdlib.h>
00025 #include <sys/types.h>
00026 #include <sys/socket.h>
00027 #include <netinet/in.h>
00028 #include <arpa/inet.h>
00029 #include <netdb.h>
00030 #include <unistd.h>
00031 #include <fcntl.h>
00032 #include <sys/time.h>
00033 #include <poll.h>
00034 #include <signal.h>
00035 #include <pthread.h>
00036 #include <netinet/tcp.h>
00037 #include <assert.h>
00038 #include <sys/mman.h>
00039 #include <syslog.h>
00040
00041 #include <linux/wanpipe.h>
00042 #include <libsangoma.h>
00043 #include <libhpsangoma.h>
00044
00046 #define MAX_SPANS 16
00047 #define MAX_CHANS 31
00048
00050 #define USE_SYSLOG 1
00051
00053 #define MGD_STACK_SIZE 1024 * 240
00054
00055 void __log_printf(int level, FILE *fp, char *file, const char *func, int line, char *fmt, ...);
00056
00057 #define ysleep(usec) sched_yield() ; usleep(usec);
00058 #define log_printf(level, fp, fmt, ...) __log_printf(level, fp, __FILE__, __FUNCTION__, __LINE__, fmt, ##__VA_ARGS__)
00059
00063 enum {
00064 SYSTEM_RUNNING=1,
00065 };
00066
00071 typedef struct span_idx
00072 {
00074 int init;
00076 int span_no;
00078 pthread_t thread;
00080 sangoma_hptdm_span_t *span;
00081
00082
00083 } span_idx_t;
00084
00085
00090 typedef struct chan_idx
00091 {
00093 int init;
00095 int chan_no;
00097 int span_no;
00099 pthread_t thread;
00100
00102 sangoma_hptdm_chan_t *chan;
00103
00104
00105 } chan_idx_t;
00106
00107
00112 #define aft_test_flag(p,flag) ({ \
00113 (p & (flag)); \
00114 })
00115
00116 #define aft_set_flag(p,flag) do { \
00117 (p |= (flag)); \
00118 } while (0)
00119
00120 #define aft_clear_flag(p,flag) do { \
00121 (p &= ~(flag)); \
00122 } while (0)
00123
00124
00125 #endif
00126
00127