source: svn/newcon3bcm2_21bu/BSEAV/lib/si/a56/vcm/si_vcm_vct.c

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 19.3 KB
Line 
1/***************************************************************
2**
3** Broadcom Corp. Confidential
4** Copyright 2003-2012 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_vcm_vct.c
12** Description: function that parses the VCM VCT table sections and
13**                              keeps track of all the virtual channel link lists.
14**
15** Created: 03/08/2001
16**                      02/02/2012 modified for A56 support
17**
18** REVISION:
19**
20** $Log: $
21**
22**
23****************************************************************/
24#include "si.h"
25#include "si_os.h"
26#include "si_dbg.h"
27#include "si_util.h"
28#include "si_list.h"
29#include "si_descriptors.h"
30#include "si_vct.h"
31#include "si_stt.h"                     /* needs one of the function to comparing time */
32
33#include "si_vcm.h"
34#include "si_vcm_vct.h"
35
36/* local function prototypes. */
37#ifdef MANAGE_VCM
38static SI_VCM_VCT_CHANNEL * SI_VCM_VCT_Create_Channel (void);
39static SI_RET_CODE SI_VCM_VCT_Ins_Channel(SI_VCM_VCT_CHANNEL *new_channel);
40static unsigned char SI_VCM_VCT_Compare_channel(SI_VCM_VCT_CHANNEL *chan1, SI_VCM_VCT_CHANNEL *chan2);
41#endif
42static SI_RET_CODE SI_VCM_VCT_Free_Channel(SI_VCM_VCT_CHANNEL *channel);
43
44
45struct vcm_vct_channel_list VCM_VCT_channels, VCM_VCT_2_channels;
46unsigned long Total_VCM_VCT_Channels;
47SI_mutex m_vcm_vct;
48static SI_VCM_VCT_Callback_t *s_vcm_vct_cb = NULL;
49void SI_VCM_VCT_Init(SI_VCM_VCT_Callback_t *cb)
50{
51        s_vcm_vct_cb = cb;
52        SI_LST_D_INIT(&VCM_VCT_channels);
53        Total_VCM_VCT_Channels = 0;
54        SI_mutex_init(m_vcm_vct);
55}
56
57#ifdef MANAGE_VCM
58/*********************************************************************
59 Function : SI_VCM_VCT_Create_Channel
60 Description : Function to allocate the space for an VCT channel.
61 Input : none.
62 Output : pointer to the VCT channel structure allocated. Will
63                        return NULL if out of memory.
64q
65**********************************************************************/
66static SI_VCM_VCT_CHANNEL * SI_VCM_VCT_Create_Channel (void)
67{
68        SI_VCM_VCT_CHANNEL * channel;
69
70        channel = (SI_VCM_VCT_CHANNEL *)SI_alloc(sizeof(SI_VCM_VCT_CHANNEL));
71        if (channel == NULL)
72        {
73                SI_DBG_PRINT(E_SI_ERR_MSG,("Failed to allocate an VCT channel!!!\n"));
74                return NULL;
75        }
76
77   SI_memset(channel, 0, sizeof (SI_VCM_VCT_CHANNEL));
78
79        SI_LST_D_INIT_ENTRY(&(channel->chan_link));
80        channel->more_prop = 0;
81
82        return channel;
83}
84
85/*********************************************************************
86 Function : SI_VCM_VCT_Compare_Channel
87 Description : Function to compare an VCM VCT channel to another to see
88                                if the virtual channel numbers are equal, greater or less.
89 Input : SI_VCM_VCT_CHANNEL *chan1.     pointer to one VCM VCT channel struct
90                 SI_VCM_VCT_CHANNEL *chan2.     pointer to second VCM VCT channel struct
91 Output : 0 if the chan1 number is smaller, 1 if equal, 2 if chan1 is
92                        greater.
93**********************************************************************/
94static unsigned char SI_VCM_VCT_Compare_channel(SI_VCM_VCT_CHANNEL *chan1, SI_VCM_VCT_CHANNEL *chan2)
95{
96        if (chan1->vcn_mode != chan2->vcn_mode){
97                if (chan1->vcn_mode == ONE_PART)
98                        return 0;
99                else
100                        return 2;
101    }
102        /* both channels are one or two part. */
103        if (chan1->vcn_mode == ONE_PART)
104        {
105                if (chan1->channum1 == chan2->channum1)
106                        return 1;
107                else if (chan1->channum1 > chan2->channum1)
108                        return 2;
109        }
110        else
111        {
112                if (chan1->channum1 == chan2->channum1)
113                {
114                        if (chan1->channum2 == chan2->channum2)
115                                return 1;
116                        else if (chan1->channum2 > chan2->channum2)
117                                return 2;
118
119                }
120                else if (chan1->channum1 > chan2->channum1)
121                        return 2;
122        }
123
124        return 0;
125}
126#endif
127
128
129/*********************************************************************
130 Function : SI_VCM_VCT_Free_Channel
131 Description : Function to free an VCM VCT channel from the VCM VCT
132                                channel list. the channel structure will be freed but
133                                not removed from the channel list. WE ASSUME THAT WHEN
134                                CALLING THIS FUNCTION, THE CHANNEL HAS NOT BEEN ADDED
135                                TO THE LIST YET!!!
136 Input : SI_VCM_VCT_CHANNEL *channel.   pointer to  VCM VCT channel
137                        structure to be freed.
138 Output : SI_RET_CODE.
139**********************************************************************/
140static SI_RET_CODE SI_VCM_VCT_Free_Channel(SI_VCM_VCT_CHANNEL *channel)
141{
142        if (channel)
143                SI_free(channel);
144
145        return SI_SUCCESS;
146}
147
148
149/*********************************************************************
150 Function : SI_VCM_VCT_Free_List
151 Description : Function to free the whole VCM VCT channel list.
152 Input : None.
153 Output : SI_RET_CODE.
154**********************************************************************/
155SI_RET_CODE SI_VCM_VCT_Free_List(void)
156{
157        SI_VCM_VCT_CHANNEL *channel;
158
159        SI_mutex_lock(m_vcm_vct);
160        while ((channel = SI_LST_D_FIRST(&VCM_VCT_channels)))
161        {
162                SI_LST_D_REMOVE_HEAD(&VCM_VCT_channels, chan_link);
163                SI_VCM_VCT_Free_Channel(channel);
164                Total_VCM_VCT_Channels--;
165        }
166
167        /* just in case. */
168        Total_VCM_VCT_Channels = 0;
169
170        SI_mutex_unlock(m_vcm_vct);
171
172        return SI_SUCCESS;
173}
174
175#ifdef MANAGE_VCM
176/*********************************************************************
177 Function : SI_VCM_VCT_Ins_Channel
178 Description : Function to insert an VCM VCT channel into the VCM VCT
179                                channel list. The order is that two part numbers
180                                are after the one part numbers and within each part
181                                the channels are sorted in incrementing order.
182 Input : SI_VCM_VCT_CHANNEL *new_channel.       pointer to new VCM VCT channel
183                        structure to be inserted.
184 Output : SI_RET_CODE.
185**********************************************************************/
186static SI_RET_CODE SI_VCM_VCT_Ins_Channel(SI_VCM_VCT_CHANNEL *new_channel)
187{
188        SI_VCM_VCT_CHANNEL * channel;
189        unsigned char comp;
190
191        SI_mutex_lock(m_vcm_vct);
192
193        channel = SI_LST_D_FIRST(&VCM_VCT_channels);
194        /* if the list is empty, just put the new channel in. */
195        if (channel == NULL)
196        {
197                SI_LST_D_INSERT_HEAD(&VCM_VCT_channels, new_channel, chan_link);
198                Total_VCM_VCT_Channels++;
199                SI_mutex_unlock(m_vcm_vct);
200                return SI_SUCCESS;
201        }
202
203        /* search for the the place to insert. */
204        while ((comp = SI_VCM_VCT_Compare_channel(new_channel, channel)) == 2 && SI_LST_D_NEXT(channel, chan_link))
205                channel = SI_LST_D_NEXT(channel, chan_link);
206
207        if (comp == 2)
208        {
209                /* we got to the end of list. insert after current element. */
210                SI_LST_D_INSERT_AFTER(channel, new_channel, chan_link);
211                Total_VCM_VCT_Channels++;
212        }
213        else if (comp == 0)
214        {
215                /* insert before the current element. */
216                SI_LST_D_INSERT_BEFORE(&VCM_VCT_channels, channel, new_channel, chan_link);
217                Total_VCM_VCT_Channels++;
218        }
219        else
220        {
221                /* equal! It should only happen when we do not have the revision descriptor,
222                        simply keep the old one and free the new one. */
223                SI_VCM_VCT_Free_Channel(new_channel);
224        }
225
226        SI_mutex_unlock(m_vcm_vct);
227
228        return SI_SUCCESS;
229}
230#endif
231
232/*********************************************************************
233 Function : SI_VCM_VCT_Pointer
234 Description : Function to point past newly received VCM VCT table
235                                section in order to get to table descriptors.
236 Input : unsigned char *table : newly received VCM VCT table data.
237 Output : unsigned char * points to the start of table descriptors.
238**********************************************************************/
239unsigned char * SI_VCM_VCT_Pointer (unsigned char *table)
240{
241        unsigned char included;
242        unsigned char num_vc_rec;
243        unsigned long desc_tag, desc_cnt, len, i, j;
244        unsigned char *current;
245
246        /* get descriptors_included bit. */
247        included = SI_Construct_Data(table,
248                VCM_VCT_INCLUDED_BYTE_INDX,
249                VCM_VCT_INCLUDED_BYTE_NUM,
250                VCM_VCT_INCLUDED_SHIFT,
251                VCM_VCT_INCLUDED_MASK);
252
253        /* get number of VC records. */
254        num_vc_rec = SI_Construct_Data(table,
255                VCM_VCT_NUM_VC_REC_BYTE_INDX,
256                VCM_VCT_NUM_VC_REC_BYTE_NUM,
257                VCM_VCT_NUM_VC_REC_SHIFT,
258                VCM_VCT_NUM_VC_REC_MASK);
259        SI_DBG_PRINT(E_SI_DBG_MSG,("vcm ptr : num of vcm %x, included %x\n", num_vc_rec, included));
260
261        current = table + VCM_VCT_NUM_VC_REC_BYTE_INDX + VCM_VCT_NUM_VC_REC_BYTE_NUM;
262
263        /* go through all the VCT records. */
264        for (i=0; i<num_vc_rec; i++)
265        {
266                current += VCM_VCT_MMT_REF_BYTE_INDX+VCM_VCT_MMT_REF_BYTE_NUM;
267                if (included & VCM_VCT_FREQ_SPEC_INCLUDED) {
268                        current += VCM_VCT_CARRIER_FREQ_BYTE_INDX+VCM_VCT_CARRIER_FREQ_BYTE_NUM;
269                }
270                if (included & VCM_VCT_SYMBOL_RATE_INCLUDED) {
271                        current += VCM_VCT_SYMBOL_RATE_BYTE_INDX+VCM_VCT_SYMBOL_RATE_BYTE_NUM;
272                }
273                if (included & VCM_VCT_DESCRIPTORS_INCLUDED)
274                {
275                        /* get descriptors count. */
276                        desc_cnt = SI_Construct_Data(current,
277                                VCM_VCT_DESC_CNT_BYTE_INDX,
278                                VCM_VCT_DESC_CNT_BYTE_NUM,
279                                VCM_VCT_DESC_CNT_SHIFT,
280                                VCM_VCT_DESC_CNT_MASK);
281                        /* current -> first descriptor. */
282                        current += VCM_VCT_DESC_CNT_BYTE_INDX+VCM_VCT_DESC_CNT_BYTE_NUM;
283
284                        /* go through all descriptors. */
285                        for (j=0; j<desc_cnt; j++)
286                        {
287                                desc_tag = *(current++);
288                                len = *(current++);
289                                /* update current pointer. */
290                                current += len;
291                        }
292                }
293        }
294
295        return current;
296}
297
298/*********************************************************************
299 Function : SI_VCM_VCT_Parse
300 Description : Function to parse a newly received VCM VCT table section and
301                                put it into the VCM VCT channel link list
302 Input : unsigned char *table : newly received VCM VCT table data.
303 Output : SI_RET_CODE.
304**********************************************************************/
305static SI_VCM_VCT_CHANNEL s_channel;
306extern unsigned short g_vct_id;
307SI_RET_CODE SI_VCM_VCT_Parse (unsigned char *table)
308{
309        unsigned long temp, i, j;
310        unsigned char included;
311        unsigned char num_vc_rec;
312        unsigned long desc_tag, desc_cnt, len;
313        unsigned char *current;
314        bool has_registration, invalid = false;
315        int offset = 0;
316
317#ifdef MANAGE_VCM
318        SI_VCM_VCT_CHANNEL * channel;
319#else
320        SI_VCM_VCT_CHANNEL * channel = &s_channel;
321#endif
322        /*SI_RET_CODE result;*/
323
324        SI_DBG_PRINT(E_SI_DBG_MSG,("VCM VCT Table received.\n"));
325
326        /* get descriptors_included bit. */
327        included = SI_Construct_Data(table,
328                VCM_VCT_INCLUDED_BYTE_INDX,
329                VCM_VCT_INCLUDED_BYTE_NUM,
330                VCM_VCT_INCLUDED_SHIFT,
331                VCM_VCT_INCLUDED_MASK);
332
333        /* check the activation time. */
334        temp = SI_Construct_Data(table,
335                VCM_VCT_ACTIVE_TIME_BYTE_INDX,
336                VCM_VCT_ACTIVE_TIME_BYTE_NUM,
337                VCM_VCT_ACTIVE_TIME_SHIFT,
338                VCM_VCT_ACTIVE_TIME_MASK);
339
340        /* zero is considered as immediate action*/
341        if (temp != 0 && temp > SI_STT_Get_GPS_UTC_Offset()) {
342                temp = SI_STT_Conv_To_UTC_Time(temp);
343                if ( temp!=0 && temp > SI_STT_Get_Sys_Time())
344                {
345                        SI_DBG_PRINT(E_SI_DBG_MSG,("VCM VCT table activation time in the future! Discarding now\n"));
346                        return SI_SUCCESS;
347                }
348        }
349
350        /* get number of VC records. */
351        num_vc_rec = SI_Construct_Data(table,
352                VCM_VCT_NUM_VC_REC_BYTE_INDX,
353                VCM_VCT_NUM_VC_REC_BYTE_NUM,
354                VCM_VCT_NUM_VC_REC_SHIFT,
355                VCM_VCT_NUM_VC_REC_MASK);
356        SI_DBG_PRINT(E_SI_DBG_MSG,("VCM VCT num of VCM's %x.\n", num_vc_rec));
357
358        /* current pointer move to the start of virtual channel */
359        current = table + VCM_VCT_NUM_VC_REC_BYTE_INDX + VCM_VCT_NUM_VC_REC_BYTE_NUM;
360        has_registration = false;
361
362        /* go through all the virtual channel records. */
363        for (i=0; i<num_vc_rec; i++)
364        {
365                /* assume it is valid first */
366                invalid = false;
367#ifdef MANAGE_VCM
368                /* create the channel struct. */
369                if ((channel = SI_VCM_VCT_Create_Channel()) == NULL)
370                {
371                        SI_DBG_PRINT(E_SI_ERR_MSG,("VCM VCT cannot create channel structure!!!\n"));
372                        return SI_NO_MEMORY;
373                }
374#else
375                SI_memset(channel, 0, sizeof (SI_VCM_VCT_CHANNEL));
376#endif
377                //has_registration = false;
378                channel->vct_id = g_vct_id;
379                channel->appflag = SI_Construct_Data(current,
380                        VCM_VCT_APP_VIRT_CHAN_BYTE_INDX,
381                        VCM_VCT_APP_VIRT_CHAN_BYTE_NUM,
382                        VCM_VCT_APP_VIRT_CHAN_SHIFT,
383                        VCM_VCT_APP_VIRT_CHAN_MASK);
384                if (channel->appflag)
385                        SI_DBG_PRINT(E_SI_WRN_MSG,("VCM VCT received app entry point!!!\n"));
386
387                /* assuming it one part channel number until we got two part descriptors. */
388                channel->vcn_mode = ONE_PART;
389                /* virtual channel number */
390                channel->channum1 = SI_Construct_Data(current,
391                        VCM_VCT_VC_NUM_BYTE_INDX,
392                        VCM_VCT_VC_NUM_BYTE_NUM,
393                        VCM_VCT_VC_NUM_SHIFT,
394                        VCM_VCT_VC_NUM_MASK);
395                channel->path_select = SI_Construct_Data(current,
396                        VCM_VCT_PATH_SEL_BYTE_INDX,
397                        VCM_VCT_PATH_SEL_BYTE_NUM,
398                        VCM_VCT_PATH_SEL_SHIFT,
399                        VCM_VCT_PATH_SEL_MASK);
400                channel->transport_type = SI_Construct_Data(current,
401                        VCM_VCT_XPORT_TYPE_BYTE_INDX,
402                        VCM_VCT_XPORT_TYPE_BYTE_NUM,
403                        VCM_VCT_XPORT_TYPE_SHIFT,
404                        VCM_VCT_XPORT_TYPE_MASK);
405                channel->channel_type = SI_Construct_Data(current,
406                        VCM_VCT_CHAN_TYPE_BYTE_INDX,
407                        VCM_VCT_CHAN_TYPE_BYTE_NUM,
408                        VCM_VCT_CHAN_TYPE_SHIFT,
409                        VCM_VCT_CHAN_TYPE_MASK);
410                if (channel->channel_type >= CHANNEL_TYPE_NVOD_ACCESS) {
411                        SI_DBG_PRINT(E_SI_WRN_WRN,("VCM VCT unsupported channel type %d\n", channel->channel_type));
412                        invalid = true;
413                }       
414                /* MPEG2 type of transport */
415                channel->CDT_reference = SI_Construct_Data(current,
416                        VCM_VCT_CDT_REF_BYTE_INDX,
417                        VCM_VCT_CDT_REF_BYTE_NUM,
418                        VCM_VCT_CDT_REF_SHIFT,
419                        VCM_VCT_CDT_REF_MASK);
420                channel->source_ID = SI_Construct_Data(current,
421                        VCM_VCT_SOURCE_ID_BYTE_INDX,
422                        VCM_VCT_SOURCE_ID_BYTE_NUM,
423                        VCM_VCT_SOURCE_ID_SHIFT,
424                        VCM_VCT_SOURCE_ID_MASK);
425                SI_DBG_PRINT(E_SI_DBG_MSG,("VCM VCT appflag %x, channel %x, xport type %x, channel type %x, source id %x, cds ref %x.\n", channel->appflag,channel->channum1,channel->transport_type,channel->channel_type,channel->source_ID,channel->CDT_reference));
426
427                if (channel->transport_type == MPEG2_XPORT)
428                {
429                        /* mpeg digital channel. */
430                        channel->ChanPropUnion.mpeg_prop.prog_num = SI_Construct_Data(current,
431                                VCM_VCT_PROG_NUM_BYTE_INDX,
432                                VCM_VCT_PROG_NUM_BYTE_NUM,
433                                VCM_VCT_PROG_NUM_SHIFT,
434                                VCM_VCT_PROG_NUM_MASK);
435                        channel->ChanPropUnion.mpeg_prop.MMT_reference = SI_Construct_Data(current,
436                                VCM_VCT_MMT_REF_BYTE_INDX,
437                                VCM_VCT_MMT_REF_BYTE_NUM,
438                                VCM_VCT_MMT_REF_SHIFT,
439                                VCM_VCT_MMT_REF_MASK);
440                        SI_DBG_PRINT(E_SI_DBG_MSG,("VCM VCT MPEG channel: Prog num %x, mms ref %x.\n", channel->ChanPropUnion.mpeg_prop.prog_num, channel->ChanPropUnion.mpeg_prop.MMT_reference));
441                }
442                else
443                {
444                        /* for DTA, we shouldn't support analog channel */
445                        /* analog channel. */
446                        channel->ChanPropUnion.nonmpeg_prop.scrambled = SI_Construct_Data(current,
447                                VCM_VCT_SCRAMBLED_BYTE_INDX,
448                                VCM_VCT_SCRAMBLED_BYTE_NUM,
449                                VCM_VCT_SCRAMBLED_SHIFT,
450                                VCM_VCT_SCRAMBLED_MASK);
451                        channel->ChanPropUnion.nonmpeg_prop.video_standard = SI_Construct_Data(current,
452                                VCM_VCT_VIDEO_STANDARD_BYTE_INDX,
453                                VCM_VCT_VIDEO_STANDARD_BYTE_NUM,
454                                VCM_VCT_VIDEO_STANDARD_SHIFT,
455                                VCM_VCT_VIDEO_STANDARD_MASK);
456                        SI_DBG_PRINT(E_SI_DBG_MSG,("VCM VCT ANALOG channel: standard %x, scramble %x.\n", channel->ChanPropUnion.nonmpeg_prop.video_standard, channel->ChanPropUnion.nonmpeg_prop.scrambled));
457                }
458                /* reset offset before checking variabl offset */
459                offset = 0;
460                if (included & VCM_VCT_FREQ_SPEC_INCLUDED) {
461                        channel->frequency_unit = SI_Construct_Data(current,
462                                VCM_VCT_FREQ_UNIT_BYTE_INDX,
463                                VCM_VCT_FREQ_UNIT_BYTE_NUM,
464                                VCM_VCT_FREQ_UNIT_SHIFT,
465                                VCM_VCT_FREQ_UNIT_MASK);
466                        channel->frequency_unit = SI_Construct_Data(current,
467                                VCM_VCT_CARRIER_FREQ_BYTE_INDX,
468                                VCM_VCT_CARRIER_FREQ_BYTE_NUM,
469                                VCM_VCT_CARRIER_FREQ_SHIFT,
470                                VCM_VCT_CARRIER_FREQ_MASK);
471                        offset += VCM_VCT_CARRIER_FREQ_BYTE_INDX+VCM_VCT_CARRIER_FREQ_BYTE_NUM;
472                }
473                if (included & VCM_VCT_SYMBOL_RATE_INCLUDED) {
474                        channel->symbol_rate = SI_Construct_Data(current + offset,
475                                VCM_VCT_SYMBOL_RATE_BYTE_INDX,
476                                VCM_VCT_SYMBOL_RATE_BYTE_NUM,
477                                VCM_VCT_SYMBOL_RATE_SHIFT,
478                                VCM_VCT_SYMBOL_RATE_MASK);
479                        offset += VCM_VCT_SYMBOL_RATE_BYTE_INDX+VCM_VCT_SYMBOL_RATE_BYTE_NUM;
480                }
481                if (included & VCM_VCT_DESCRIPTORS_INCLUDED)
482                {
483                        /* get descriptors count. */
484                        desc_cnt = SI_Construct_Data(current + offset,
485                                VCM_VCT_DESC_CNT_BYTE_INDX,
486                                VCM_VCT_DESC_CNT_BYTE_NUM,
487                                VCM_VCT_DESC_CNT_SHIFT,
488                                VCM_VCT_DESC_CNT_MASK);
489                        /* current -> first descriptor. */
490                        current += VCM_VCT_DESC_CNT_BYTE_INDX+VCM_VCT_DESC_CNT_BYTE_NUM + offset;
491
492                        /* go through all descriptors. */
493                        for (j=0; j<desc_cnt; j++)
494                        {
495                                desc_tag = *(current++);
496                                len = *(current++);
497                                switch(desc_tag)
498                                {
499                                        case SI_DESC_TWO_PART_CHANNEL_NO:
500                                                SI_DBG_PRINT(E_SI_DBG_MSG,("VCM VCT two part descriptor.\n"));
501
502                                                channel->vcn_mode = TWO_PART;
503                                                channel->channum1 = SI_Construct_Data(current,
504                                                        DESC_TPCND_MAJOR_NUMBER_BYTE_INDEX,
505                                                        DESC_TPCND_MAJOR_NUMBER_BYTE_NUM,
506                                                        DESC_TPCND_MAJOR_NUMBER_SHIFT,
507                                                        DESC_TPCND_MAJOR_NUMBER_MASK);
508                                                channel->channum2 = SI_Construct_Data(current,
509                                                        DESC_TPCND_MINOR_NUMBER_BYTE_INDEX,
510                                                        DESC_TPCND_MINOR_NUMBER_BYTE_NUM,
511                                                        DESC_TPCND_MINOR_NUMBER_SHIFT,
512                                                        DESC_TPCND_MINOR_NUMBER_MASK);
513                                        break;
514
515                                        case SI_DESC_CHANNEL_PROPERTIES:
516                                                SI_DBG_PRINT(E_SI_DBG_MSG,("VCM VCT Channel properties descriptor.\n"));
517
518                                                channel->more_prop = 1;
519                                                channel->tsid = SI_Construct_Data(current,
520                                                        DESC_CPD_CHANNEL_TSID_BYTE_INDEX,
521                                                        DESC_CPD_CHANNEL_TSID_BYTE_NUM,
522                                                        DESC_CPD_CHANNEL_TSID_SHIFT,
523                                                        DESC_CPD_CHANNEL_TSID_MASK);
524                                                channel->serv_type = SI_Construct_Data(current,
525                                                        DESC_CPD_SERVICE_TYPE_BYTE_INDEX,
526                                                        DESC_CPD_SERVICE_TYPE_BYTE_NUM,
527                                                        DESC_CPD_SERVICE_TYPE_SHIFT,
528                                                        DESC_CPD_SERVICE_TYPE_MASK);
529                                                channel->chanbits = SI_Construct_Data(current,
530                                                        DESC_CPD_CHANNEL_BITS_BYTE_INDEX,
531                                                        DESC_CPD_CHANNEL_BITS_BYTE_NUM,
532                                                        DESC_CPD_CHANNEL_BITS_SHIFT,
533                                                        DESC_CPD_CHANNEL_BITS_MASK);
534                                        break;
535                                        case SI_DESC_REGISTRATION:
536                                        {
537                                                unsigned int format_id = SI_Construct_Data(current,
538                                                        DESC_REGISTRATION_BYTE_INDEX,
539                                                        DESC_REGISTRATION_BYTE_NUM,
540                                                        DESC_REGISTRATION_BYTE_SHIFT,
541                                                        DESC_REGISTRATION_BYTE_MASK);
542                                                if (format_id == DTA_REGISTRATION_FORMAT_ID) {
543                                                        has_registration = true;
544                                                }
545                                                else {
546                                                        has_registration = false;
547                                                }
548                                                break;
549                                        }       
550                                        /*case SI_DESC_USER_PRIVATE:*/
551                                        case SI_DESC_SERVICE_INFORMATION:
552                                        {
553                                                unsigned char revision;
554                                                unsigned char video_content;
555                                                if (has_registration == true) {
556                                                        revision = SI_Construct_Data(current, 
557                                                                DESC_SID_REVISION_BYTE_INDEX, 
558                                                                DESC_SID_REVISION_BYTE_NUM,
559                                                                DESC_SID_REVISION_BYTE_SHIFT,
560                                                                DESC_SID_REVISION_BYTE_MASK);
561                                                        if (revision == 0x01) {
562                                                                video_content = SI_Construct_Data(current,
563                                                                        DESC_SID_VIDEO_CONTENT_BYTE_INDEX,
564                                                                        DESC_SID_VIDEO_CONTENT_BYTE_NUM,
565                                                                        DESC_SID_VIDEO_CONTENT_SHIFT,
566                                                                        DESC_SID_VIDEO_CONTENT_MASK);
567                                                                channel->hd_flag = (video_content & 0x01);
568                                                                channel->threed_flag = (video_content>>1) & 0x01;
569                                                                channel->mpeg4_flag = (video_content>>2) & 0x01;
570                                                                channel->sdv_flag = SI_Construct_Data(current,
571                                                                        DESC_SID_VIDEO_DELIVERY_BYTE_INDEX,
572                                                                        DESC_SID_VIDEO_DELIVERY_BYTE_NUM,
573                                                                        DESC_SID_VIDEO_DELIVERY_SHIFT,
574                                                                        DESC_SID_VIDEO_DELIVERY_MASK);
575                                                        }
576                                                        SI_DBG_PRINT(E_SI_DBG_MSG,("VCM VCT service information descriptor."));
577                                                }
578                                                else {
579                                                        SI_DBG_PRINT(E_SI_DBG_MSG,("Get Service information desc but registration is not received yet. Discard"));
580                                                }
581                                        }
582                                        break;
583                                        default:
584                                                SI_DBG_PRINT(E_SI_WRN_MSG,("VCM VCT table descriptor %x received! Ignoring!\n", desc_tag));
585                                        break;
586                                }
587
588                                /* update current pointer. */
589                                current += len;
590                        }
591                }
592                else
593                {
594                        SI_DBG_PRINT(E_SI_DBG_MSG,("VCM VCT NO descriptors.\n"));
595
596                        /* simply update the current pointer. */
597                        current += VCM_VCT_MMT_REF_BYTE_INDX+VCM_VCT_MMT_REF_BYTE_NUM;
598                }
599#ifdef MANAGE_VCM
600                /* insert the channel */
601                SI_VCM_VCT_Ins_Channel(channel);
602#else
603                if (s_vcm_vct_cb && s_vcm_vct_cb->cb && !invalid)
604                        s_vcm_vct_cb->cb(channel,s_vcm_vct_cb->data);
605#endif
606        }
607
608        return SI_SUCCESS;
609}
610
Note: See TracBrowser for help on using the repository browser.