FreeCalypso > hg > tcs211-fcmodem
comparison chipsetsw/layer1/gtt_include/l1gtt_baudot_functions.h @ 0:509db1a7b7b8
initial import: leo2moko-r1
author | Space Falcon <falcon@ivan.Harhan.ORG> |
---|---|
date | Mon, 01 Jun 2015 03:24:05 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:509db1a7b7b8 |
---|---|
1 /*****************************************************************************/ | |
2 /* */ | |
3 /* ========================================================================= */ | |
4 /* */ | |
5 /* Copyright (c) 2002 */ | |
6 /* Matsushita Communication Industrial, MMCD USA */ | |
7 /* */ | |
8 /* ========================================================================= */ | |
9 /* */ | |
10 /* File Name: */ | |
11 /* l1gtt_baudot_functions.h */ | |
12 /* */ | |
13 /* Purpose: */ | |
14 /* This is the header file for "l1gtt_baudot_functions.c". */ | |
15 /* */ | |
16 /* */ | |
17 /* Warnings: */ | |
18 /* */ | |
19 /* */ | |
20 /*****************************************************************************/ | |
21 | |
22 /*** Maintenance *********************************************************/ | |
23 /* */ | |
24 /* */ | |
25 /* 02/11/2002 initial version created Laura Ning */ | |
26 /* */ | |
27 /*************************************************************************/ | |
28 #ifndef _BAUDOT_DECODE_H_ | |
29 #define BAUDOT_DECODE_H | |
30 | |
31 #include "ctm_typedefs.h" | |
32 | |
33 /* | |
34 ******************************************************************************* | |
35 * DEFINITIONS | |
36 ******************************************************************************* | |
37 */ | |
38 | |
39 /* definitions (might be of global interest) */ | |
40 #define BAUDOT_NUM_INFO_BITS 5 /* number of info bits per TTY character */ | |
41 #define BAUDOT_SHIFT_FIGURES 27 /* code of shift to figures symbol */ | |
42 #define BAUDOT_SHIFT_LETTERS 31 /* code of shift to letters symbol */ | |
43 | |
44 #define BAUDOT_LOGICAL_1 1 | |
45 #define BAUDOT_LOGICAL_0 -1 | |
46 #define BAUDOT_NON_TTY 0 | |
47 #define BAUDOT_START_BIT -1 | |
48 #define BAUDOT_STOP_BIT 1 | |
49 | |
50 #define BAUDOT_STOP_OUTPUT 2 /* STOP bit as the output of baudot_encode() to DSP */ | |
51 | |
52 /* definations (be only of local interest) */ | |
53 | |
54 #define START_OF_STOP_BIT 26 | |
55 | |
56 #define DETECT_WINDOW_WIDTH 4 /* A sliding window is used to detect start,stop and data bits */ | |
57 #define BAUDOT_SAMPLE_DURATION 3 /* The duration to meet to determine a valid baudot bit */ | |
58 | |
59 /* A temporary assumption of the input buffer size, to be */ | |
60 /* replaced later when TI has the actual buffer size defined */ | |
61 #define MAX_WORDS_OF_BUFFER1 40 /* Number of the 5ms-bits it can contain */ | |
62 #define TIME_INTERVAL_OF_BUFFER1 200 /* in the unit of ms */ | |
63 #define MAX_WORDS_ONE_TTYCODE 36 /* Number of 5ms-bits a TTY character has */ | |
64 | |
65 #define NUM_STOP_BITS_TX 2 /* number of stop bits per character */ | |
66 | |
67 /* ******************************************************************/ | |
68 /* Type definitions for variables that contain all states of the */ | |
69 /* Baudot decoder */ | |
70 /* ******************************************************************/ | |
71 | |
72 | |
73 typedef struct | |
74 { | |
75 WORD16 remainedSampleVec[MAX_WORDS_ONE_TTYCODE]; /* hold the samples for last unfinished detection */ | |
76 UWORD16 remainedSampleLen; /* length of the remaining samples for last unfinished detection */ | |
77 WORD16 ttyCode; | |
78 UWORD16 cntBitsActualChar; | |
79 UWORD16 samplesRemained; /* number of samples left from last detection */ | |
80 BOOL startBitDetected; | |
81 BOOL inFigureMode; | |
82 | |
83 } baudot_decode_state_t; | |
84 | |
85 /* ******************************************************************/ | |
86 /* Type definitions for variables that contain all states of the */ | |
87 /* Baudot encoder */ | |
88 /* ******************************************************************/ | |
89 typedef struct | |
90 { | |
91 WORD16 cntCharsSinceLastShift; | |
92 BOOL inFigureMode; | |
93 BOOL tailBitsGenerated; | |
94 // fifo_state_t fifo_state; | |
95 } baudot_encode_state_t; | |
96 | |
97 /****************************************************************************/ | |
98 /* convertChar2ttyCode() */ | |
99 /* ********************* */ | |
100 /* Conversion from character into tty code */ | |
101 /* */ | |
102 /* input variables: */ | |
103 /* - inChar charcater that shall be converted */ | |
104 /* */ | |
105 /* return value: baudot code of the input character */ | |
106 /* or -1 in case that inChar is not valid (e.g. inChar=='\0')*/ | |
107 /* */ | |
108 /* Matthias Doerbecker, Ericsson Eurolab Deutschland (EED/N/RV), 2000/02/17 */ | |
109 /****************************************************************************/ | |
110 | |
111 WORD16 convertChar2ttyCode(char inChar); | |
112 | |
113 | |
114 | |
115 /****************************************************************************/ | |
116 /* convertTTYcode2char() */ | |
117 /* ********************* */ | |
118 /* Conversion from tty code into character */ | |
119 /* */ | |
120 /* input variables: */ | |
121 /* - ttyCode Baudot code (must be within the range 0...63) */ | |
122 /* or -1 if there is nothing to convert */ | |
123 /* */ | |
124 /* return value: character (or '\0' if ttyCode is not valid) */ | |
125 /* */ | |
126 /* Matthias Doerbecker, Ericsson Eurolab Deutschland (EED/N/RV), 2000/02/17 */ | |
127 /****************************************************************************/ | |
128 | |
129 char convertTTYcode2char(WORD16 ttyCode); | |
130 | |
131 /* prototype declarations */ | |
132 void init_baudot_decode(baudot_decode_state_t* state); | |
133 | |
134 void init_baudot_encode(baudot_encode_state_t* state); | |
135 | |
136 void reset_baudot_decode(baudot_decode_state_t* state); | |
137 | |
138 void baudot_decode(WORD16* sampleVec, WORD16 numSamples, | |
139 fifo_state_t* ptrOutFifoState, | |
140 baudot_decode_state_t* state); | |
141 void baudot_encode(WORD16 inputTTYcode, | |
142 fifo_state_t* ptrOutFifoState, | |
143 baudot_encode_state_t* state); | |
144 | |
145 #endif |