source: svn/trunk/newcon3bcm2_21bu/BSEAV/lib/scte65/si_test.c @ 7

Last change on this file since 7 was 2, checked in by jglee, 11 years ago

first commit

  • Property svn:executable set to *
File size: 15.4 KB
Line 
1/***************************************************************
2**
3** Broadcom Corp. Confidential
4** Copyright 2003-2008 Broadcom Corp. All Rights Reserved.
5**
6** THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED
7** SOFTWARE LICENSE AGREEMENT BETWEEN THE USER AND BROADCOM.
8** YOU HAVE NO RIGHT TO USE OR EXPLOIT THIS MATERIAL EXCEPT
9** SUBJECT TO THE TERMS OF SUCH AN AGREEMENT.
10**
11** File:                si_main.c
12** Description: The main entry point of SI test menu. Using it
13**                              we can querry all the SI tables and data we received
14**                              so far.
15**
16** Created: 03/08/2001
17**
18** REVISION:
19**
20** $Log: $
21**
22**
23****************************************************************/
24
25#include "si.h"
26#include "si_os.h"
27#include "si_dbg.h"
28#include "si_util.h"
29#include "si_list.h"
30#include "si_aeit.h"
31#include "si_aett.h"
32#include "si_mgt.h"
33#include "si_vct.h"
34#include "si_lvct.h"
35#include "si_nit.h"
36#include "si_nit_cds.h"
37#include "si_nit_mms.h"
38#include "si_rrt.h"
39#include "si_svct.h"
40#include "si_svct_vcm.h"
41#include "si_ntt.h"
42#include "si_ntt_sns.h"
43
44
45extern int GetInputString(char *s);
46extern int GetInputChar(void);
47
48
49
50void SI_Test_Main(void)
51{
52        char cmd[256];
53        unsigned long end_loop = 0;
54        int err;
55
56
57        while (!end_loop)
58        {
59                printf("SI test menu:\n");
60                printf("1 : Show All SVCT-VCM's we have got.\n");
61                printf("2 : Show All NIT-CDS's we have got.\n");
62                printf("3 : Show All NIT-MMS's we have got.\n");
63                printf("4 : Show All NTT-SNS's we have got.\n");
64                printf("5 : Show All LVCT's we have got.\n");
65                printf("6 : Show All RRT's we have got.\n");
66                printf("7 : Show All AEIT's we have got.\n");
67                printf("8 : Show All AETT's we have got.\n");
68                printf("0 : Quit this menu.\n");
69               
70                printf("\nEnter Option:");
71                cmd[0] = GetInputChar();
72                printf("\n");
73
74                switch (cmd[0])
75                {
76                        case '1':
77                        {
78                                extern unsigned char SVCT_VCM_version_number;
79                                extern unsigned long SVCT_VCM_section_mask[8];
80                                extern struct svct_vcm_channel_list SVCT_VCM_channels;
81                                extern SI_mutex m_svct_vcm;
82                                SI_SVCT_VCM_CHANNEL *channel;
83                                extern unsigned long NIT_CDS_Freq_KHZ_Table[NIT_CDS_MAX_NUM_OF_CARRIRE_INDEX];
84                                extern NIT_MMS_RECORD NIT_MMS_Table[NIT_MMS_MAX_TABLE_SIZE]; 
85
86                                SI_mutex_lock(m_svct_vcm);
87                               
88                                channel = SI_LST_D_FIRST(&SVCT_VCM_channels);
89
90                                if (SVCT_VCM_version_number != 0xff)
91                                {
92                                        int i;
93                                       
94                                        printf("SVCT_VCM version 0x%x\n", SVCT_VCM_version_number);
95                                        printf("SVCT_VCM_section mask :\n");
96                                        for (i=0; i<8; i++)
97                                                printf("0x%08x, ", SVCT_VCM_section_mask[i]);
98                                        printf("\n");
99                                }
100
101                                while (channel)
102                                {
103                                        if (channel->vcn_mode == ONE_PART)
104                                                printf("Channel %d: ", channel->channum1);
105                                        else
106                                                printf("Channel %d-%d: ", channel->channum1, channel->channum2);
107
108                                        printf("Channel Frequency %d KHz, appflag 0x%x, xport type 0x%x, channel type(0:MPEG2, 1:NONMPEG2) 0x%x, source id 0x%x\n",
109                                                        NIT_CDS_Freq_KHZ_Table[channel->CDS_reference],
110                                                        channel->appflag,channel->transport_type,channel->channel_type,
111                                                        channel->source_ID);
112
113                                        if (channel->transport_type == MPEG2_XPORT)
114                                        {
115                                                printf("     MPEG channel :Prog num 0x%x, mms ref %d.\n", 
116                                                                channel->ChanPropUnion.mpeg_prop.prog_num, 
117                                                                channel->ChanPropUnion.mpeg_prop.MMS_reference);
118                                                printf("     MMS Info: xmit sys(2:ANNEXB, 4:ATSC) 0x%x, inner code 0x%x, modulation format(8:QAM64, 0x10:QAM256) 0x%x, symb rate %d symb/s.\n", 
119                                                                NIT_MMS_Table[channel->ChanPropUnion.mpeg_prop.MMS_reference].transmission_system,
120                                                                NIT_MMS_Table[channel->ChanPropUnion.mpeg_prop.MMS_reference].inner_coding_mode,
121                                                                NIT_MMS_Table[channel->ChanPropUnion.mpeg_prop.MMS_reference].modulation_format,
122                                                                NIT_MMS_Table[channel->ChanPropUnion.mpeg_prop.MMS_reference].symbol_rate);
123                                        }
124                                        else
125                                        {
126                                                printf("     Analog channel :standard(0-NTSC) 0x%x, scramble 0x%x.\n", 
127                                                                channel->ChanPropUnion.nonmpeg_prop.video_standard, 
128                                                                channel->ChanPropUnion.nonmpeg_prop.scrambled);
129                                        }
130
131                                        if (channel->more_prop)
132                                                printf("     Additional Info (from descriptors: tsid 0x%x, serv_type 0x%x, chanbits 0x%x\n",
133                                                                channel->tsid, channel->serv_type, channel->chanbits);
134
135                                        channel = SI_LST_D_NEXT(channel, chan_link);
136                                }
137                                SI_mutex_unlock(m_svct_vcm);
138                        }
139                        break;
140
141                        case '2':
142                        {
143                                extern unsigned char NIT_CDS_Version_Number;
144                                int i;
145                                extern unsigned long NIT_CDS_Section_Mask[8];
146                                extern unsigned long NIT_CDS_Freq_KHZ_Table[NIT_CDS_MAX_NUM_OF_CARRIRE_INDEX];
147
148
149                                if (NIT_CDS_Version_Number != 0xff)
150                                {                                       
151                                        printf("NIT_CDS version 0x%x\n", NIT_CDS_Version_Number);
152                                        printf("NIT_CDS_section mask :\n");
153                                        for (i=0; i<8; i++)
154                                                printf("0x%08x, ", NIT_CDS_Section_Mask[i]);
155                                        printf("\n");
156                                }
157
158                                printf("NIT CDS table:\n");
159                                for (i=0; i<NIT_CDS_MAX_NUM_OF_CARRIRE_INDEX; i++)
160                                {
161                                        if (NIT_CDS_Freq_KHZ_Table[i] != 0)
162                                                printf("Index %d, Frequency %d kHz.\n", i, NIT_CDS_Freq_KHZ_Table[i]);
163                                }
164
165                        }
166                        break;
167
168                        case '3':
169                        {
170                                extern unsigned char NIT_MMS_Version_Number;
171                                int i;
172                                extern unsigned long NIT_MMS_Section_Mask[8];
173                                extern NIT_MMS_RECORD NIT_MMS_Table[NIT_MMS_MAX_TABLE_SIZE]; 
174
175
176                                if (NIT_MMS_Version_Number != 0xff)
177                                {                                       
178                                        printf("NIT_MMS version 0x%x\n", NIT_MMS_Version_Number);
179                                        printf("NIT_MMS_section mask :\n");
180                                        for (i=0; i<8; i++)
181                                                printf("0x%08x, ", NIT_MMS_Section_Mask[i]);
182                                        printf("\n");
183                                }
184
185                                printf("NIT MMS table:\n");
186                                for (i=0; i<NIT_MMS_MAX_TABLE_SIZE; i++)
187                                {
188                                        if (NIT_MMS_Table[i].symbol_rate != 0)
189                                                printf("Index %d, xmit sys(2:ANNEXB, 4:ATSC) 0x%x, inner code 0x%x, modulation format(8:QAM64, 0x10:QAM256) 0x%x, symb rate %d symb/s.\n", 
190                                                                i,NIT_MMS_Table[i].transmission_system,
191                                                                NIT_MMS_Table[i].inner_coding_mode,
192                                                                NIT_MMS_Table[i].modulation_format,
193                                                                NIT_MMS_Table[i].symbol_rate);
194                                }
195
196                        }
197                        break;
198
199                        case '4':
200                        {
201                                extern unsigned char NTT_SNS_version_number;
202                                extern unsigned long NTT_SNS_section_mask[8];
203                                extern struct NTT_SNS_List_Struct NTT_SNS_List;
204                                SI_NTT_SNS_LINK * sns = SI_LST_D_FIRST(&NTT_SNS_List);
205                                int i;
206
207                                if (NTT_SNS_version_number != 0xff)
208                                {                                       
209                                        printf("NIT_SNS version 0x%x\n", NTT_SNS_version_number);
210                                        printf("NIT_SNS_section mask :\n");
211                                        for (i=0; i<8; i++)
212                                                printf("0x%08x, ", NTT_SNS_section_mask[i]);
213                                        printf("\n");
214                                }
215
216                                while (sns)
217                                {
218                                        printf("NTT SNS appflag 0x%x, source id 0x%x :\n", sns->appflag, sns->source_ID);
219                                        for (i=0; i<sns->name_len; i++)
220                                        {
221                                                if (i > 1)
222                                                        printf("%c", (char)sns->source_name[i]);               
223                                        }
224                                        printf("\n");
225
226                                        sns = SI_LST_D_NEXT(sns, sns_link);
227                                }
228                        }
229                        break;
230
231                        case '5':
232                        {
233                                extern struct lvct_channel_list LVCT_channels;
234                                extern unsigned char LVCT_version_number;
235                                extern unsigned long LVCT_section_mask[8];
236                                extern SI_mutex m_lvct;
237                                SI_LVCT_CHANNEL * channel;
238                                int i;
239
240                                SI_mutex_lock(m_lvct);
241
242                                channel = SI_LST_D_FIRST(&LVCT_channels);
243                               
244                                if (LVCT_version_number != 0xff)
245                                {                                       
246                                        printf("LVCT version 0x%x\n", LVCT_version_number);
247                                        printf("LVCT_section mask :\n");
248                                        for (i=0; i<8; i++)
249                                                printf("0x%08x, ", LVCT_section_mask[i]);
250                                        printf("\n");
251                                }
252
253                                while (channel)
254                                {
255                                        if (channel->vcn_mode == ONE_PART)
256                                                printf("Channel %d: ", channel->channum1);
257                                        else
258                                                printf("Channel %d-%d: ", channel->channum1, channel->channum2);
259
260                                        for (i=0; i<LVCT_SHORT_NAME_LENGTH; i++)
261                                                printf("%c", (channel->short_name[i]&0xff));
262
263                                        if (channel->ext_name_len)
264                                        {
265                                                printf("  ext name: ");
266                                                for (i=0; i<channel->ext_name_len; i++)
267                                                        if (i>7)
268                                                                printf("%c", channel->ext_name[i]);
269                                        }
270                                        printf("\n");
271
272                                        printf("     modulation mode(1:Analog, 2:QAM64-ANNEXB, 3:QAM256-ANNEXB, 4:ATSC-8VSB, 5:ATSC-16VSB) 0x%x\n",
273                                                        channel->mod_mode);
274                                        printf("     carrier freq %d hz, tsid 0x%x, program number0x%x, service type(1:analog, 2:ATSC digital, 3:ATSC audio) 0x%x, src id 0x%x, chanbits 0x%x\n", 
275                                                        channel->carrier_freq,channel->tsid,
276                                                        channel->program_num,channel->serv_type,channel->source_ID,
277                                                        channel->chanbits);
278
279                                        if (channel->num_of_ts_serv)
280                                        {
281                                                printf("TS serv : ");
282                                                for (i=0; i<channel->num_of_ts_serv; i++)
283                                                {
284                                                        if (channel->time_shifted[i].vcn_mode == ONE_PART)
285                                                                printf("Channel %d, ", channel->time_shifted[i].channum1);
286                                                        else
287                                                                printf("Channel %d-%d, ", channel->time_shifted[i].channum1,
288                                                                                channel->time_shifted[i].channum2);
289
290                                                        printf("time shift %d sec\n", channel->time_shifted[i].time_shift);
291                                                }
292                                        }
293
294                                        channel = SI_LST_D_NEXT(channel, chan_link);
295                                }
296                                SI_mutex_unlock(m_lvct);
297                        }
298                        break;
299
300                        case '6':
301                        {
302                                extern struct rrt_region_list RRT_Regions;
303                                extern SI_mutex m_rrt;
304                                SI_RRT_REGION * rrt_region;
305                                int i, j, k;
306
307                                SI_mutex_lock(m_rrt);
308                                rrt_region = SI_LST_D_FIRST(&RRT_Regions);
309                                while (rrt_region)
310                                {
311                                        printf("region 0x%x, region name :");
312                                        for (i=0; i<rrt_region->rating_region_name_length; i++)
313                                                if (i>7)
314                                                        printf("%c", (char)rrt_region->rating_region_name_text[i]);
315                                        printf("  version 0x%x, dimensions 0x%x\n", rrt_region->version_number,
316                                                        rrt_region->dimensions_defined);
317
318                                        for (i=0; i<rrt_region->dimensions_defined; i++)
319                                        {
320                                                printf("RRT dimension name: ");
321                                                for (k=0; k<rrt_region->rrt_dimensions[i].dimension_name_length; k++)
322                                                        if (k>7)
323                                                                ("%c", (char)rrt_region->rrt_dimensions[i].dimension_name_text[k]);
324                                                printf("grad scale 0x%x\n", rrt_region->rrt_dimensions[i].graduated_scale);
325
326                                                for (j=0; j<rrt_region->rrt_dimensions[i].values_defined; j++)
327                                                {
328                                                        for (k=0; k<rrt_region->rrt_dimensions[i].rrt_values[j].abbrev_rating_value_length; k++)
329                                                                if (k>7)
330                                                                        printf("%c", (char)rrt_region->rrt_dimensions[i].rrt_values[j].abbrev_rating_value_text[k]);
331                                                        printf(",   ");
332                                                        for (k=0; k<rrt_region->rrt_dimensions[i].rrt_values[j].rating_value_length; k++)
333                                                                if (k>7)
334                                                                        printf("%c", (char)rrt_region->rrt_dimensions[i].rrt_values[j].rating_value_text[k]);
335                                                        printf("\n");
336                                                }
337                                        }
338
339                                        rrt_region = SI_LST_D_NEXT(rrt_region, rrt_link);
340                                }
341                                SI_mutex_unlock(m_rrt);
342                        }
343                        break;
344
345                        case '7':
346                        {
347                                extern struct aeit_slot_list head_aeit_slot, current_aeit0_slot;
348                                extern unsigned short past_aeit_n;
349                                extern unsigned short mgt_aeit_n;
350                                extern SI_mutex m_aeit;
351                                SI_AEIT_SOURCE  *source;
352                                SI_AEIT_EVENT  *event;
353                                SI_AEIT_SLOT * slot;
354                                int i, j;
355
356                                printf("Past AEIT slots %d:\n", past_aeit_n);
357
358                                SI_mutex_lock(m_aeit);
359                                slot = SI_LST_D_FIRST(&head_aeit_slot);
360                                for (i=0; ((i<past_aeit_n) && slot); i++)
361                                {
362                                        printf("Past AEIT slot %d, tag 0x%x, pid 0x%x, MGT ver 0x%x, ver 0x%x\n",
363                                                        i, slot->MGT_tag, slot->pid, slot->MGT_version_number,
364                                                        slot->version_number);
365                                        printf("section mask: ");
366                                        for (j=0; j<8; j++)
367                                                printf("0x%08x,", slot->section_mask[j]);
368                                        printf("\n");
369
370                                        source = SI_LST_D_FIRST(&(slot->aeit_source));
371                                        while (source)
372                                        {
373                                                printf("   source_id : 0x%x event list:\n", source->source_ID);
374                                                event = SI_LST_D_FIRST(&(source->aeit_event));
375                                                while(event)
376                                                {
377                                                        printf("      id 0x%x, start 0x%x sec, dur 0x%x sec, title: ",
378                                                                        event->event_ID, event->start_time, event->duration);
379                                                        for (j=0; j<event->title_length; j++)
380                                                                if (j>7)
381                                                                        printf("%c", event->title_text[j]);
382                                                        printf("\n");
383
384                                                        event = SI_LST_D_NEXT(event, event_link);
385                                                }
386                                                source = SI_LST_D_NEXT(source, source_link);
387                                        }
388                                        slot = SI_LST_D_NEXT(slot, slot_link);
389                                }
390
391                                if (i!=past_aeit_n || slot!=SI_LST_D_FIRST(&current_aeit0_slot))
392                                {
393                                        printf("past AEIT count error!!!\n"); 
394                                }
395
396                                printf("current AEIT slots:\n");
397                                slot = SI_LST_D_FIRST(&current_aeit0_slot);
398                                for (i=0; ((i<mgt_aeit_n) && slot); i++)
399                                {
400                                        printf("AEIT %d, tag 0x%x, pid 0x%x, MGT ver 0x%x, ver 0x%x\n",
401                                                        i, slot->MGT_tag, slot->pid, slot->MGT_version_number,
402                                                        slot->version_number);
403                                        printf("section mask: ");
404                                        for (j=0; j<8; j++)
405                                                printf("0x%08x,", slot->section_mask[j]);
406                                        printf("\n");
407
408                                        source = SI_LST_D_FIRST(&(slot->aeit_source));
409                                        while (source)
410                                        {
411                                                printf("   source_id : 0x%x event list:\n", source->source_ID);
412                                                event = SI_LST_D_FIRST(&(source->aeit_event));
413                                                while(event)
414                                                {
415                                                        printf("      id 0x%x, start 0x%x sec, dur 0x%x sec, title: ",
416                                                                        event->event_ID, event->start_time, event->duration);
417                                                        for (j=0; j<event->title_length; j++)
418                                                                if (j>7)
419                                                                        printf("%c", event->title_text[j]);
420                                                        printf("\n");
421
422                                                        event = SI_LST_D_NEXT(event, event_link);
423                                                }
424                                                source = SI_LST_D_NEXT(source, source_link);
425                                        }
426                                        slot = SI_LST_D_NEXT(slot, slot_link);
427                                }
428
429                                if (i!=mgt_aeit_n || slot)
430                                {
431                                        printf("curr AEIT count error!!!\n"); 
432                                }
433                                SI_mutex_unlock(m_aeit);
434                        }
435                        break;
436
437                        case '8':
438                        {
439                                extern struct aett_slot_list head_aett_slot, current_aett0_slot;
440                                extern unsigned short past_aett_n;
441                                extern unsigned short mgt_aett_n;
442                                extern SI_mutex m_aett;
443                                SI_AETT_SLOT * slot;
444                                SI_AETT_SOURCE * source;
445                                SI_AETT_TEXT * text;
446                                int i, j;
447
448                                printf("Past AETT slots %d:\n", past_aett_n);
449
450                                SI_mutex_lock(m_aett);
451                                slot = SI_LST_D_FIRST(&head_aett_slot);
452                                for (i=0; ((i<past_aett_n) && slot); i++)
453                                {
454                                        printf("Past AETT slot %d, tag 0x%x, pid 0x%x, MGT ver 0x%x, ver 0x%x\n",
455                                                        i, slot->MGT_tag, slot->pid, slot->MGT_version_number,
456                                                        slot->version_number);
457                                        printf("section mask: ");
458                                        for (j=0; j<8; j++)
459                                                printf("0x%08x,", slot->section_mask[j]);
460                                        printf("\n");
461
462                                        source = SI_LST_D_FIRST(&(slot->aett_source));
463                                        while (source)
464                                        {
465                                                printf("   source_id : 0x%x text list:\n", source->source_ID);
466                                                text = SI_LST_D_FIRST(&(source->aett_text));
467                                                while(text)
468                                                {
469                                                        printf("      id 0x%x,  text: ",text->event_ID);
470                                                        for (j=0; j<text->extended_text_length; j++)
471                                                                if (j>7)
472                                                                        printf("%c", text->extended_text_message[j]);
473                                                        printf("\n");
474
475                                                        text = SI_LST_D_NEXT(text, text_link);
476                                                }
477                                                source = SI_LST_D_NEXT(source, source_link);
478                                        }
479                                        slot = SI_LST_D_NEXT(slot, slot_link);
480                                }
481
482                                if (i!=past_aett_n || slot!=SI_LST_D_FIRST(&current_aett0_slot))
483                                {
484                                        printf("past AETT count error!!!\n"); 
485                                }
486
487                                printf("current AETT slots:\n");
488                                slot = SI_LST_D_FIRST(&current_aett0_slot);
489                                for (i=0; ((i<mgt_aett_n) && slot); i++)
490                                {
491                                        printf("AETT %d, tag 0x%x, pid 0x%x, MGT ver 0x%x, ver 0x%x\n",
492                                                        i, slot->MGT_tag, slot->pid, slot->MGT_version_number,
493                                                        slot->version_number);
494                                        printf("section mask: ");
495                                        for (j=0; j<8; j++)
496                                                printf("0x%08x,", slot->section_mask[j]);
497                                        printf("\n");
498
499                                        source = SI_LST_D_FIRST(&(slot->aett_source));
500                                        while (source)
501                                        {
502                                                printf("   source_id : 0x%x text list:\n", source->source_ID);
503                                                text = SI_LST_D_FIRST(&(source->aett_text));
504                                                while(text)
505                                                {
506                                                        printf("      id 0x%x,  text: ",text->event_ID);
507                                                        for (j=0; j<text->extended_text_length; j++)
508                                                                if (j>7)
509                                                                        printf("%c", text->extended_text_message[j]);
510                                                        printf("\n");
511
512                                                        text = SI_LST_D_NEXT(text, text_link);
513                                                }
514                                                source = SI_LST_D_NEXT(source, source_link);
515                                        }
516                                        slot = SI_LST_D_NEXT(slot, slot_link);
517                                }
518
519                                if (i!=mgt_aett_n || slot)
520                                {
521                                        printf("curr AETT count error!!!\n"); 
522                                }
523
524                                SI_mutex_unlock(m_aett);
525                        }
526                        break;
527                       
528                        case '0':
529                                end_loop = 1;
530                        break;
531
532                        default:
533                        break;
534                }
535        }
536}
537
Note: See TracBrowser for help on using the repository browser.