| 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 processing. This file |
|---|
| 13 | ** contains the functions to create the thread for |
|---|
| 14 | ** SI flow mornitoring and managing, as well as the |
|---|
| 15 | ** functional entry point for processing SI tables. |
|---|
| 16 | ** |
|---|
| 17 | ** Created: 03/08/2001 |
|---|
| 18 | ** |
|---|
| 19 | ** REVISION: |
|---|
| 20 | ** |
|---|
| 21 | ** $Log: $ |
|---|
| 22 | ** |
|---|
| 23 | ** |
|---|
| 24 | ****************************************************************/ |
|---|
| 25 | |
|---|
| 26 | #include "si.h" |
|---|
| 27 | #include "si_os.h" |
|---|
| 28 | #include "si_dbg.h" |
|---|
| 29 | #include "si_util.h" |
|---|
| 30 | #include "si_list.h" |
|---|
| 31 | #include "si_aeit.h" |
|---|
| 32 | #include "si_aett.h" |
|---|
| 33 | #include "si_mgt.h" |
|---|
| 34 | #include "si_vct.h" |
|---|
| 35 | #include "si_lvct.h" |
|---|
| 36 | #include "si_nit.h" |
|---|
| 37 | #include "si_rrt.h" |
|---|
| 38 | #include "si_svct.h" |
|---|
| 39 | #include "si_ntt.h" |
|---|
| 40 | #include "si_ea.h" |
|---|
| 41 | |
|---|
| 42 | #include "pod.h" |
|---|
| 43 | #include "pod_os.h" |
|---|
| 44 | #include "pod_list.h" |
|---|
| 45 | #include "pod_ext_chan.h" |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | //pthread_t si_mon; |
|---|
| 49 | POD_THREAD_INFO si_mon; |
|---|
| 50 | |
|---|
| 51 | static int SI_MGR_Thread(void); |
|---|
| 52 | |
|---|
| 53 | |
|---|
| 54 | /* Init all the SI elements. */ |
|---|
| 55 | void SI_Init(void) |
|---|
| 56 | { |
|---|
| 57 | #ifdef SI_DEBUG |
|---|
| 58 | SI_Dbg_Set_Debug_Level(E_SI_DBG_MSG); |
|---|
| 59 | #else |
|---|
| 60 | SI_Dbg_Set_Debug_Level(E_SI_WRN_MSG); |
|---|
| 61 | #endif |
|---|
| 62 | |
|---|
| 63 | SI_LVCT_Init(); |
|---|
| 64 | SI_MGT_Init(); |
|---|
| 65 | SI_NIT_Init(); |
|---|
| 66 | SI_NTT_Init(); |
|---|
| 67 | SI_RRT_Init(); |
|---|
| 68 | SI_STT_Init(); |
|---|
| 69 | SI_SVCT_Init(); |
|---|
| 70 | SI_EA_Init(); |
|---|
| 71 | |
|---|
| 72 | } |
|---|
| 73 | |
|---|
| 74 | /* create SI flow managing thread. */ |
|---|
| 75 | void SI_Create(void) |
|---|
| 76 | { |
|---|
| 77 | /* create flow manager thread. */ |
|---|
| 78 | //pthread_create(&si_mon, NULL, (void*)SI_MGR_Thread, (void *)0); |
|---|
| 79 | POD_Create_Thread( &(si_mon), (void*)SI_MGR_Thread, (void *)0); |
|---|
| 80 | POD_Detach_Thread(&(si_mon)); |
|---|
| 81 | } |
|---|
| 82 | |
|---|
| 83 | |
|---|
| 84 | /* SI flow manager thread. */ |
|---|
| 85 | static int SI_MGR_Thread(void) |
|---|
| 86 | { |
|---|
| 87 | //pthread_exit(0); |
|---|
| 88 | POD_thread_exit; |
|---|
| 89 | } |
|---|
| 90 | |
|---|
| 91 | |
|---|
| 92 | /* SI data processing entry point. */ |
|---|
| 93 | void SI_Process_Data(unsigned char *data, unsigned long len, unsigned char *free_data) |
|---|
| 94 | { |
|---|
| 95 | unsigned char *ptr = data; |
|---|
| 96 | unsigned short section_len; |
|---|
| 97 | |
|---|
| 98 | SI_DBG_PRINT(E_SI_DBG_MSG,("SI Process: data len %x\n", len)); |
|---|
| 99 | while (((unsigned long)(ptr - data)) < len) |
|---|
| 100 | { |
|---|
| 101 | SI_DBG_PRINT(E_SI_DBG_MSG,("SI Process: table id %x\n", *ptr)); |
|---|
| 102 | |
|---|
| 103 | switch (*ptr) |
|---|
| 104 | { |
|---|
| 105 | case SI_NIT_TABLE_ID: |
|---|
| 106 | SI_NIT_parse(ptr); |
|---|
| 107 | break; |
|---|
| 108 | |
|---|
| 109 | case SI_NTT_TABLE_ID: |
|---|
| 110 | SI_NTT_parse(ptr); |
|---|
| 111 | break; |
|---|
| 112 | |
|---|
| 113 | case SI_SVCT_TABLE_ID: |
|---|
| 114 | SI_SVCT_parse(ptr); |
|---|
| 115 | break; |
|---|
| 116 | |
|---|
| 117 | case SI_STT_TABLE_ID: |
|---|
| 118 | SI_STT_parse(ptr); |
|---|
| 119 | break; |
|---|
| 120 | |
|---|
| 121 | case SI_MGT_TABLE_ID: |
|---|
| 122 | SI_MGT_parse(ptr); |
|---|
| 123 | break; |
|---|
| 124 | |
|---|
| 125 | case SI_LVCT_TABLE_ID: |
|---|
| 126 | SI_LVCT_Parse(ptr); |
|---|
| 127 | break; |
|---|
| 128 | |
|---|
| 129 | case SI_RRT_TABLE_ID: |
|---|
| 130 | SI_RRT_parse(ptr); |
|---|
| 131 | break; |
|---|
| 132 | |
|---|
| 133 | case SI_AEIT_TABLE_ID: |
|---|
| 134 | SI_AEIT_Parse(ptr); |
|---|
| 135 | break; |
|---|
| 136 | |
|---|
| 137 | case SI_AETT_TABLE_ID: |
|---|
| 138 | SI_AETT_Parse(ptr); |
|---|
| 139 | break; |
|---|
| 140 | |
|---|
| 141 | case SI_EA_TABLE_ID: |
|---|
| 142 | SI_EA_Parse(ptr); |
|---|
| 143 | break; |
|---|
| 144 | |
|---|
| 145 | default: |
|---|
| 146 | break; |
|---|
| 147 | } |
|---|
| 148 | |
|---|
| 149 | ptr++; |
|---|
| 150 | section_len = ((((unsigned short)*ptr++)<<8)&0x0f00); |
|---|
| 151 | section_len |= (((unsigned short)*ptr++)&0x00ff); |
|---|
| 152 | |
|---|
| 153 | SI_DBG_PRINT(E_SI_DBG_MSG,("SI Process: section len %x\n", section_len)); |
|---|
| 154 | ptr += section_len; |
|---|
| 155 | } |
|---|
| 156 | |
|---|
| 157 | if (((unsigned long)(ptr - data)) != len) |
|---|
| 158 | { |
|---|
| 159 | SI_DBG_PRINT(E_SI_ERR_MSG,("Ext SI Process: data length error!!!\n")); |
|---|
| 160 | } |
|---|
| 161 | |
|---|
| 162 | SI_free(free_data); |
|---|
| 163 | } |
|---|
| 164 | |
|---|