/*************************************************************************** * Copyright (c) 2003-2006, Broadcom Corporation * All Rights Reserved * Confidential Property of Broadcom Corporation * * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. * * $brcm_Workfile: $ * $brcm_Revision: $ * $brcm_Date: $ * * Module Description: * * Revision History: * * $brcm_Log: $ * ***************************************************************************/ #ifndef CH_MAP_H__ #define CH_MAP_H__ #include "bapp_task.h" #define MAX_FREQ_MAP 0xFF #define MAX_VCH_LEN 16 #define MAX_VCH 512 #define MAX_AUDIO_PIDS 4 /* * Entry in modulation table built from MMS records in NIT */ typedef struct mms_t { unsigned char idx; /* Frequency Index */ unsigned char code_rate; /* Inner Coding Rate */ unsigned char modulation; /* Modulation Format */ unsigned int symbol_rate; /* Symbol rate */ }mms_t; /* * MMS table built from MMS records in NIT */ typedef struct mms_map_t { unsigned char num_mms; /* Number of mms structures in table */ mms_t mms[MAX_FREQ_MAP]; }mms_map_t; /* * Entry in frequency table built from CDS records in NIT */ typedef struct freq_t { unsigned char idx; /* Frequency Index */ unsigned int freq_khz; /* Frequency in KHz */ }freq_t; /* * Frequency table built from CDS records in NIT */ typedef struct freq_map_t { unsigned char num_freq; /* Number of frequencies in table */ freq_t freq[MAX_FREQ_MAP]; }freq_map_t; /* * Source text entry build from NTT */ typedef struct st_t { unsigned short source_id; /* Source ID identifying program source */ unsigned char name[MAX_VCH_LEN + 1];/* NULL terminated source name */ }st_t; /* * Frequency table built from CDS records in NIT */ typedef struct st_map_t { unsigned short num_st; /* Number of source text entries in table */ st_t st[MAX_VCH]; }st_map_t; /* * Entry in virtual channel table built from VCM records in SVCT */ typedef struct vch_t { unsigned short ch_num; /* Virtual channel number */ unsigned short source_id; /* Source ID identifying program source */ unsigned short program_num; /* program number in PMT */ unsigned char freq_idx; /* frequency index in frequency */ unsigned char mms_idx; /* mms index */ unsigned char vchflags; /* non-zero indicates hidden channel */ unsigned char num_audio; unsigned char cur_audio; unsigned short pcr_pid; unsigned short scte127_pid; unsigned short video_pid; unsigned char video_type; unsigned short ca_pid; unsigned short audio_pid[MAX_AUDIO_PIDS]; unsigned char audio_type[MAX_AUDIO_PIDS]; char audio_lang[MAX_AUDIO_PIDS][3]; }vch_t; /* * virtual channel table built from VCM records in SVCT */ typedef struct vch_map_t { unsigned short num_vch; /* Number of virtual channels in table */ vch_t vch[MAX_VCH]; /* table of virtual channels */ }vch_map_t; /* * Structure for managing and maintaining the frequency and channel maps */ typedef struct ch_map_t { bapp_task_mutex_t p_mutex; unsigned short cur_ch; /* current channel */ mms_map_t mms_map; /* MMS map structure */ freq_map_t freq_map; /* frequency map structure */ st_map_t st_map; /* source text map structure */ vch_map_t vch_map; /* virtual channel map */ }ch_map_t; #ifdef __cplusplus extern "C" { #endif /* Summary: Initialize channel map mgmt internals (structure may already be initialized). */ void ch_map_init(ch_map_t *p_ch_map,bapp_task_mutex_t handle); /* Summary: reset channel map mgmt internals. */ void ch_map_reset(ch_map_t *p_ch_map); /* Summary: copy channel map. */ void ch_map_copy(ch_map_t *p_ch_map_to,ch_map_t *p_ch_map_from,unsigned int flags); /* Summary: compare channel map settings. */ unsigned int ch_map_cmp(ch_map_t *p_ch_map_to,ch_map_t *p_ch_map_from); int ch_map_cmp_st(st_map_t *p_map_to, st_map_t *p_map_from); int ch_map_cmp_vch(vch_map_t *p_map_to, vch_map_t *p_map_from); int ch_map_cmp_freq(freq_map_t *p_freq_map_to, freq_map_t *p_freq_map_from); int ch_map_cmp_mms(mms_map_t *p_mms_map_to, mms_map_t *p_mms_map_from); /* Summary: Add a frequency entry. */ void ch_map_add_freq(ch_map_t *p_ch_map, freq_t *p_freq); /* Summary: Add an mms entry. */ void ch_map_add_mms(ch_map_t *p_ch_map, mms_t *p_mms); /* Summary: Find the matching freqency info for the given the vch reference. */ bool ch_map_find_freq(ch_map_t *p_ch_map, vch_t *p_vch, freq_t *p_freq); /* Summary: Add a virtual channel entry. */ void ch_map_add_vch(ch_map_t *p_ch_map, vch_t *p_vch); /* Summary: Add a source text entry. */ void ch_map_add_st(ch_map_t *p_ch_map, st_t *p_st); /* Summary: Get number of map entries. */ void ch_map_get_counts(ch_map_t *p_ch_map, unsigned short *num_vch, unsigned short *num_st, unsigned char *num_freq ); /* Summary: Get number of vch entries. */ void ch_map_get_vch_num(ch_map_t *p_ch_map, unsigned short *num_vch ); /* Summary: Get mms for frequency idx. */ bool ch_map_get_mms(ch_map_t *p_ch_map, unsigned char mms_idx, mms_t *p_mms ); /* Summary: Get current channel information. */ bool ch_map_get_current(ch_map_t *p_ch_map, vch_t *p_vch, st_t *p_st, freq_t *p_freq); /* Summary: Get next channel information. */ bool ch_map_set_next(ch_map_t *p_ch_map); /* Summary: Get prev channel information. */ bool ch_map_set_prev(ch_map_t *p_ch_map); /* Summary: Return true if the channel is not a hidden channel. */ bool ch_map_is_channel_visible(ch_map_t *p_ch_map, unsigned short ch_num); /* Summary: Get channel information by number. */ bool ch_map_set_ch(ch_map_t *p_ch_map, unsigned short ch_num); /* Summary: Set current channel given source ID. */ bool ch_map_set(ch_map_t *p_ch_map,unsigned short source_id); /* Summary: Update the channel current channel info. */ bool ch_map_vch_update(ch_map_t *p_ch_map, vch_t *p_vch); /* Summary: try to find a source ID from the frequency vector and program number (for EAS major/minor ch#). */ bool ch_map_find_soure_id(ch_map_t *p_ch_map, unsigned char freq_vec, unsigned short prog_num, unsigned short *p_source_id ); /* Summary: Output details to console. */ void ch_output(ch_map_t *p_ch_map); #ifdef __cplusplus } #endif #endif /* CH_MAP_H__ */