FreeCalypso > hg > ice1-trau-tester
comparison ater/activate.c @ 49:40f781efdbe1
ater: beginning of D144 mode
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 24 Sep 2024 05:59:28 +0000 |
parents | 13fffc41f989 |
children |
comparison
equal
deleted
inserted
replaced
48:3cc26391d24d | 49:40f781efdbe1 |
---|---|
64 } | 64 } |
65 | 65 |
66 /* good to proceed now */ | 66 /* good to proceed now */ |
67 at->is_active = true; | 67 at->is_active = true; |
68 at->is_data = false; | 68 at->is_data = false; |
69 at->is_data_144 = false; | |
69 at->is_efr = is_efr; | 70 at->is_efr = is_efr; |
70 init_trau_ul_frame(nr); | 71 init_trau_ul_frame(nr); |
71 at->ul_frame.c_bits[16] = dtxd; | 72 at->ul_frame.c_bits[16] = dtxd; |
72 trau_frame_from_record(init_frame, is_efr, &at->ul_frame); | 73 trau_frame_from_record(init_frame, is_efr, &at->ul_frame); |
73 free(init_frame); | 74 free(init_frame); |
74 } | 75 } |
75 | 76 |
76 void cmd_activate_csd(int argc, char **argv) | 77 void cmd_activate_csd(int argc, char **argv) |
77 { | 78 { |
78 int nr; | 79 int nr; |
79 bool ir_16k, is_hr; | 80 bool ir_16k, is_144, is_hr; |
80 struct ater_subslot *at; | 81 struct ater_subslot *at; |
81 | 82 |
82 if (argc < 3 || argc > 4) { | 83 if (argc < 3 || argc > 4) { |
83 usage: fprintf(stderr, "usage: %s 0|1|2|3 8|16 [hr]\n", argv[0]); | 84 usage: fprintf(stderr, "usage: %s 0|1|2|3 8|16|14.4 [hr]\n", argv[0]); |
84 return; | 85 return; |
85 } | 86 } |
86 if (argv[1][0] < '0' || argv[1][0] > '3' || argv[1][1]) | 87 if (argv[1][0] < '0' || argv[1][0] > '3' || argv[1][1]) |
87 goto usage; | 88 goto usage; |
88 nr = argv[1][0] - '0'; | 89 nr = argv[1][0] - '0'; |
89 if (!strcmp(argv[2], "8")) | 90 if (!strcmp(argv[2], "8")) { |
91 is_144 = false; | |
90 ir_16k = false; | 92 ir_16k = false; |
91 else if (!strcmp(argv[2], "16")) | 93 } else if (!strcmp(argv[2], "16")) { |
94 is_144 = false; | |
92 ir_16k = true; | 95 ir_16k = true; |
93 else | 96 } else if (!strcmp(argv[2], "14.4")) { |
97 is_144 = true; | |
98 ir_16k = true; | |
99 } else | |
94 goto usage; | 100 goto usage; |
95 if (argv[3]) { | 101 if (argv[3]) { |
96 if (strcmp(argv[3], "hr")) | 102 if (strcmp(argv[3], "hr")) |
97 goto usage; | 103 goto usage; |
98 is_hr = true; | 104 is_hr = true; |
99 } else | 105 } else |
100 is_hr = false; | 106 is_hr = false; |
107 if (is_hr && (is_144 || ir_16k)) { | |
108 fprintf(stderr, "error: HR above 8 kbit/s is impossible\n"); | |
109 return; | |
110 } | |
101 | 111 |
102 at = &subslots[nr]; | 112 at = &subslots[nr]; |
103 if (at->is_active) { | 113 if (at->is_active) { |
104 fprintf(stderr, "error: subslot %d is already active\n", nr); | 114 fprintf(stderr, "error: subslot %d is already active\n", nr); |
105 return; | 115 return; |
106 } | 116 } |
107 | 117 |
108 /* good to proceed now */ | 118 /* good to proceed now */ |
109 at->is_active = true; | 119 at->is_active = true; |
110 at->is_data = true; | 120 at->is_data = true; |
121 at->is_data_144 = is_144; | |
111 at->is_hr_data = is_hr; | 122 at->is_hr_data = is_hr; |
123 at->d144_edata = false; | |
112 init_trau_ul_frame_csd(nr, ir_16k); | 124 init_trau_ul_frame_csd(nr, ir_16k); |
113 } | 125 } |
114 | 126 |
115 void cmd_deact(int argc, char **argv) | 127 void cmd_deact(int argc, char **argv) |
116 { | 128 { |