68 #ifdef STB_SI_PRINT_REQUIRED 69 #define STB_SI_PRINT(x) DEBUG_PRINTX_CONDITIONAL(DEBUG_STB_SI) x 72 #define STB_SI_PRINT(x) STB_SPDebugWrite x 74 #define STB_SI_PRINT(x) 78 #define STB_SI_ERROR(x) 80 #define MAX_ENTRIES_FILT_TASK_QUEUE 100 81 #define MAX_ENTRIES_CNTRL_TASK_QUEUE 50 82 #define MAX_ENTRIES_LOW_PRI_TASK_QUEUE 100 84 #define FILT_TASK_PRIORITY 13 // 1 higher than UI 85 #define CNTRL_TASK_PRIORITY 11 // 1 lower than UI 86 #define LOW_PRI_TASK_PRIORITY 10 // 1 lower than cntrl task 88 #define FILT_TASK_STACK_SIZE 4096 89 #define CNTRL_TASK_STACK_SIZE 4096 90 #define LOW_PRI_TASK_STACK_SIZE 4096 94 #define SECT_FILTER_MASK_SIZE 8 95 #define NUM_SECT_RECEIVED_BYTES (256 / 8) 97 #define NUM_PMT_OBSERVERS 4 111 U16BIT num_sect_reqd;
112 U16BIT num_sect_received;
113 U8BIT sect_received[NUM_SECT_RECEIVED_BYTES];
114 U8BIT ev_sched_sect_reqd[NUM_SECT_RECEIVED_BYTES];
120 BOOLEAN ev_sched_segment_notified[NUM_SECT_RECEIVED_BYTES];
121 enum {VALID, DELETED} state;
129 BOOLEAN low_priority;
131 E_SI_TABLE_FORMAT_TYPE table_format;
132 E_SI_REQUEST_TYPE req_type;
138 U8BIT match_array[SECT_FILTER_MASK_SIZE];
139 U8BIT mask_array[SECT_FILTER_MASK_SIZE];
143 U16BIT num_tables_reqd;
144 U16BIT num_tables_received;
147 #ifdef DEBUG_FILTER_PERFORMANCE 156 enum {SI_EVENT, TABLE_READY, SECTION_RECEIVED, SEGMENT_READY} type;
166 static void *cntrl_task_ptr;
167 static void *low_pri_task_ptr;
168 static void *filt_task_ptr;
170 static void *cntrl_task_msg_queue;
171 static void *low_pri_task_msg_queue;
172 static void *filt_task_msg_queue;
174 static void *table_mutex;
175 static void *section_sema;
176 static void *filter_mutex;
179 static U8BIT num_paths;
180 static E_STB_SI_STATUS *si_status;
181 static BOOLEAN cntrl_task_stop_pending;
182 static BOOLEAN low_pri_task_stop_pending;
188 static void (*app_si_interface_ptr)(U8BIT, E_APP_SI_EVENT_TYPE);
191 static F_PmtObserver pmt_observers[NUM_PMT_OBSERVERS] = {0, 0, 0, 0};
196 static void SiControlTask(
void *notused);
197 static void SiFilterTask(
void *notused);
198 static void SiLowPriTableTask(
void *notused);
200 static FILTER_STATUS* GetFilter(U8BIT path, U16BIT pid, U8BIT tid_match, U8BIT tid_mask,
201 E_SI_TABLE_FORMAT_TYPE format, U16BIT expected_tables,
202 U16BIT xtid_match, U16BIT xtid_mask, E_SI_REQUEST_TYPE req_type,
203 U16BIT buff_size, BOOLEAN crc, BOOLEAN low_priority,
207 static void ModifyFilter(
FILTER_STATUS *filter_ptr, U8BIT tid_match, U8BIT tid_mask,
208 U16BIT xtid_match, U16BIT xtid_mask, U16BIT expected_tables);
212 static void HandleSiInterrupt(U8BIT path, U16BIT bytes, U16BIT pfid);
214 static void ActionTableReadyEvent(
FILTER_STATUS *filter_ptr, BOOLEAN *stop_flag_ptr);
218 U32BIT sect_num, BOOLEAN *stop_flag_ptr);
221 U8BIT ver, U16BIT num_sect);
222 static void ResetTableListEntry(
TABLE_LIST_ENTRY *table_entry, U8BIT ver, U16BIT last_sect);
227 U8BIT *data_ptr, BOOLEAN add_to_table, BOOLEAN add_to_segment_list);
249 static void SiControlTask(
void *notused)
255 FUNCTION_START(SiControlTask);
258 USE_UNWANTED_PARAM(notused);
264 if (msg_ready == TRUE)
266 if ((cntrl_task_stop_pending == TRUE) &&
267 ((msg.type != SI_EVENT) || (msg.numval != SI_EVENT_STOP)))
270 STB_SI_PRINT((
"SICtask - s.e.p. ignore"));
274 if (msg.type == SI_EVENT)
281 STB_SI_PRINT((
"SITask(%d) stop", msg.path));
282 if (app_si_interface_ptr != NULL)
284 (app_si_interface_ptr)(msg.path, STOP_SI);
286 si_status[msg.path] = SI_STOPPED;
287 cntrl_task_stop_pending = FALSE;
290 STB_SI_PRINT((
"SITask(%d) wait for low priority stop", msg.path));
291 while (low_pri_task_stop_pending == TRUE)
295 STB_SI_PRINT((
"SITask(%d) finished waiting for low priority stop", msg.path));
299 case SI_EVENT_SEARCH:
301 STB_SI_PRINT((
"SITask(%d) starting search - %dMHz",
303 if (app_si_interface_ptr != NULL)
305 (app_si_interface_ptr)(msg.path, START_SI_SEARCHING);
307 si_status[msg.path] = SI_SEARCHING;
311 case SI_EVENT_UPDATE:
313 STB_SI_PRINT((
"SITask(%d) starting update - %dMHz",
315 if (app_si_interface_ptr != NULL)
317 (app_si_interface_ptr)(msg.path, START_SI_UPDATING_NEW_TRANSPORT);
319 si_status[msg.path] = SI_UPDATING;
323 case SI_EVENT_SERVICE_CHANGE:
325 STB_SI_PRINT((
"SITask(%d) channel change", msg.path));
326 if (app_si_interface_ptr != NULL)
328 (app_si_interface_ptr)(msg.path, START_SI_UPDATING_SAME_TRANSPORT);
334 else if (msg.type == TABLE_READY)
337 filter_ptr = msg.flt_ptr;
338 #ifdef DEBUG_SI_FILTER 339 STB_SI_PRINT((
"SITask(%d) table ready filter %p", msg.path, filter_ptr));
341 ActionTableReadyEvent(filter_ptr, &cntrl_task_stop_pending);
343 else if (msg.type == SECTION_RECEIVED)
346 filter_ptr = msg.flt_ptr;
347 #ifdef DEBUG_SI_FILTER 348 STB_SI_PRINT((
"SITask(%d) section received filter %p", msg.path, filter_ptr));
350 ActionSectionReceivedEvent(filter_ptr, msg.tbl_entry,
351 msg.sec_rec, &cntrl_task_stop_pending);
353 else if (msg.type == SEGMENT_READY)
356 filter_ptr = msg.flt_ptr;
357 #ifdef DEBUG_SI_FILTER 358 STB_SI_PRINT((
"SITask(%d) segment ready filter %p", msg.path, filter_ptr));
360 ActionSegmentReadyEvent(filter_ptr, msg.tbl_entry, msg.numval,
361 &cntrl_task_stop_pending);
368 if (app_si_interface_ptr != NULL)
370 (app_si_interface_ptr)(INVALID_RES_ID, SI_TIMEOUT);
375 FUNCTION_FINISH(SiControlTask);
389 static void SiLowPriTableTask(
void *notused)
395 FUNCTION_START(SiLowPriTableTask);
398 USE_UNWANTED_PARAM(notused);
404 if (msg_ready == TRUE)
406 if ((low_pri_task_stop_pending == TRUE) &&
407 ((msg.type != SI_EVENT) || (msg.numval != SI_EVENT_STOP)))
410 STB_SI_PRINT((
"SI Low Pri task - s.e.p. ignore"));
414 if ((msg.type == SI_EVENT) && (msg.numval == SI_EVENT_STOP))
416 STB_SI_PRINT((
"SI low pri task(%d) stop", msg.path));
417 low_pri_task_stop_pending = FALSE;
419 else if (msg.type == TABLE_READY)
422 filter_ptr = msg.flt_ptr;
423 #ifdef DEBUG_SI_FILTER 424 STB_SI_PRINT((
"SI low priority(%d) table ready filter %p", msg.path, filter_ptr));
426 ActionTableReadyEvent(filter_ptr, &low_pri_task_stop_pending);
428 else if (msg.type == SECTION_RECEIVED)
431 filter_ptr = msg.flt_ptr;
432 #ifdef DEBUG_SI_FILTER 433 STB_SI_PRINT((
"SI low priority(%d) section received filter %p", msg.path, filter_ptr));
435 ActionSectionReceivedEvent(filter_ptr, msg.tbl_entry,
436 msg.sec_rec, &low_pri_task_stop_pending);
438 else if (msg.type == SEGMENT_READY)
441 filter_ptr = msg.flt_ptr;
442 #ifdef DEBUG_SI_FILTER 443 STB_SI_PRINT((
"SI low priority(%d) segment ready filter %p", msg.path, filter_ptr));
445 ActionSegmentReadyEvent(filter_ptr, msg.tbl_entry, msg.numval,
446 &low_pri_task_stop_pending);
452 FUNCTION_FINISH(SiLowPriTableTask);
464 U32BIT sect_num, BOOLEAN *stop_flag_ptr)
466 static U8BIT actn_tbl_rdy_evt_cnt = 0;
469 BOOLEAN filter_changed;
474 FUNCTION_START(ActionSegmentReadyEvent);
478 filter_ok = ValidateFilterPtr(filter_ptr);
479 if (filter_ok == TRUE)
481 save_atre = actn_tbl_rdy_evt_cnt++;
483 filter_ptr->traversing = TRUE;
484 filter_changed = FALSE;
488 if ((table_entry != NULL) && (*stop_flag_ptr == FALSE))
490 table_entry->atre_count = save_atre;
494 if (table_rec != NULL)
497 table_rec->path = filter_ptr->path;
498 table_rec->tid = table_entry->tid;
499 table_rec->xtid = table_entry->xtid;
500 table_rec->pid = filter_ptr->pid;
501 table_rec->version = table_entry->version;
502 table_rec->num_sect = table_entry->num_sect_received;
505 segment_num = sect_num / 8;
507 table_rec->section_list = table_entry->segment_list[segment_num];
508 table_entry->segment_list[segment_num] = NULL;
513 #ifdef DEBUG_TABLE_REQUESTS 514 STB_SI_PRINT((
"report table - rec %p", table_rec));
516 saved_id = filter_ptr->id;
518 (filter_ptr->return_fn)(filter_ptr, filter_ptr->return_param, table_rec);
524 filter_ok = ValidateFilterPtr(filter_ptr);
525 if (filter_ok == FALSE)
527 filter_changed = TRUE;
548 if (filter_ptr->id != saved_id)
550 filter_changed = TRUE;
554 table_entry->complete = FALSE;
560 if (filter_changed == FALSE)
562 filter_ptr->traversing = FALSE;
563 ProcessTableEntries(filter_ptr);
571 FUNCTION_FINISH(ActionSegmentReadyEvent);
587 static void ActionTableReadyEvent(
FILTER_STATUS *filter_ptr, BOOLEAN *stop_flag_ptr)
589 static U8BIT actn_tbl_rdy_evt_cnt = 0;
593 BOOLEAN filter_changed;
597 FUNCTION_START(ActionTableReadyEvent);
601 filter_ok = ValidateFilterPtr(filter_ptr);
602 if (filter_ok == TRUE)
604 save_atre = actn_tbl_rdy_evt_cnt++;
606 filter_ptr->traversing = TRUE;
607 filter_changed = FALSE;
612 table_entry = filter_ptr->table_list;
613 while ((table_entry != NULL) && (table_entry->state != VALID))
615 table_entry = table_entry->next;
618 while ((table_entry != NULL) && (*stop_flag_ptr == FALSE))
620 table_entry->atre_count = save_atre;
621 if (table_entry->complete == TRUE)
625 if (table_rec != NULL)
628 table_rec->path = filter_ptr->path;
629 table_rec->tid = table_entry->tid;
630 table_rec->xtid = table_entry->xtid;
631 table_rec->pid = filter_ptr->pid;
632 table_rec->version = table_entry->version;
633 table_rec->num_sect = table_entry->num_sect_received;
637 table_rec->section_list = table_entry->section_list;
638 table_entry->section_list = NULL;
643 #ifdef DEBUG_TABLE_REQUESTS 644 STB_SI_PRINT((
"report table - rec %p", table_rec));
646 saved_id = filter_ptr->id;
648 (filter_ptr->return_fn)(filter_ptr, filter_ptr->return_param, table_rec);
654 filter_ok = ValidateFilterPtr(filter_ptr);
655 if (filter_ok == FALSE)
657 filter_changed = TRUE;
679 if (filter_ptr->id != saved_id)
681 filter_changed = TRUE;
686 table_entry->complete = FALSE;
692 table_entry = filter_ptr->table_list;
693 while ((table_entry != NULL) &&
694 ((table_entry->state != VALID) || (table_entry->atre_count == save_atre)))
696 table_entry = table_entry->next;
700 if (filter_changed == FALSE)
702 filter_ptr->traversing = FALSE;
703 ProcessTableEntries(filter_ptr);
711 FUNCTION_FINISH(ActionTableReadyEvent);
732 BOOLEAN filter_changed;
735 FUNCTION_START(ActionSectionReceivedEvent);
739 filter_ok = ValidateFilterPtr(filter_ptr);
740 if (filter_ok == TRUE)
743 filter_ptr->traversing = TRUE;
744 filter_changed = FALSE;
746 if ((table_entry != NULL) && (*stop_flag_ptr == FALSE))
750 if (table_rec != NULL)
753 table_rec->path = filter_ptr->path;
754 table_rec->tid = table_entry->tid;
755 table_rec->xtid = table_entry->xtid;
756 table_rec->pid = filter_ptr->pid;
757 table_rec->version = table_entry->version;
758 table_rec->num_sect = 1;
759 table_rec->section_list = section_rec;
763 #ifdef DEBUG_TABLE_REQUESTS 764 STB_SI_PRINT((
"report table - rec %p", table_rec));
766 saved_id = filter_ptr->id;
767 (filter_ptr->return_fn)(filter_ptr, filter_ptr->return_param, table_rec);
773 filter_ok = ValidateFilterPtr(filter_ptr);
774 if (filter_ok == FALSE)
776 filter_changed = TRUE;
797 if (filter_ptr->id != saved_id)
799 filter_changed = TRUE;
803 table_entry->complete = FALSE;
809 if (filter_changed == FALSE)
811 filter_ptr->traversing = FALSE;
812 ProcessTableEntries(filter_ptr);
818 FUNCTION_FINISH(ActionSectionReceivedEvent);
832 static void SiFilterTask(
void *notused)
850 BOOLEAN all_sect_recvd;
854 FUNCTION_START(SiFilterTask);
857 USE_UNWANTED_PARAM(notused);
864 if (msg_ready == TRUE)
868 filter_ok = ValidateFilterPtr(filter_ptr);
869 if (filter_ok == FALSE)
871 #ifdef DEBUG_SI_FILTER 872 STB_SI_PRINT((
"ActionSectRxed: filter %p - invalid filter", filter_ptr));
881 data_ptr = filter_ptr->data_start;
882 while ((data_ptr < filter_ptr->data_end) && (finished == FALSE))
887 sect_len = (((data_ptr[1] & 0x0f) << 8) | data_ptr[2]) + 3;
890 if (filter_ptr->table_format == MULTI_SECT)
893 if ((data_ptr[5] & 0x01) == 0)
897 #ifdef DEBUG_SI_FILTER_INT 898 STB_SI_PRINT((
"SiFilterTask: Section isn't for a current table"));
904 xtid = (data_ptr[3] << 8) | data_ptr[4];
905 version = (data_ptr[5] >> 1) & 0x1f;
910 table_entry = FindTableListEntry(filter_ptr, tid, xtid);
911 if (table_entry != NULL)
913 if ((filter_ptr->req_type == ONE_SHOT_REQUEST) && (table_entry->complete == TRUE))
919 #ifdef DEBUG_SI_FILTER_INT 920 STB_SI_PRINT((
"SiFilterTask: Section is for an already complete table"));
925 if (table_entry->version == version)
927 if (((table_entry->sect_received[sect >> 3] >> (sect & 0x07)) & 0x01) != 0)
931 #ifdef DEBUG_SI_FILTER_INT 932 STB_SI_PRINT((
"SiFilterTask: Section has already been received"));
943 if (use_data == TRUE)
945 #ifdef DEBUG_SI_FILTER 946 STB_SI_PRINT((
"ActionSectRxed: filter %p dptr %p (data %p to %p)", filter_ptr,
947 data_ptr, filter_ptr->data_start, filter_ptr->data_end));
949 if (filter_ptr->table_format == SINGLE_SECT)
955 #ifdef DEBUG_SI_FILTER 956 STB_SI_PRINT((
"single-sect format: len %d tab 0x%02x", sect_len, tid));
963 xtid = (data_ptr[3] << 8) | data_ptr[4];
964 version = (data_ptr[5] >> 1) & 0x1f;
966 last_sect = data_ptr[7];
968 #ifdef DEBUG_SI_FILTER 969 STB_SI_PRINT((
"multi-sect format: len %d tab 0x%02x/0x%04x ver %d sect %d",
970 sect_len, tid, xtid, version, sect));
978 table_entry = FindTableListEntry(filter_ptr, tid, xtid);
979 if (table_entry == NULL)
981 table_entry = AddTableListEntry(filter_ptr, tid, xtid, version, last_sect);
982 if (table_entry != NULL)
990 filter_ptr->last_rxed_table = table_entry;
993 if (table_entry->complete == FALSE)
995 if (filter_ptr->table_format == SINGLE_SECT)
1003 if (table_entry->version != version)
1005 #ifdef DEBUG_SI_FILTER 1006 STB_SI_PRINT((
"Free existing table for new version"));
1009 ResetTableListEntry(table_entry, version, last_sect);
1015 if (((table_entry->sect_received[sect >> 3] >> (sect & 0x07)) & 0x01) == 0)
1027 if (sect_reqd == TRUE)
1029 all_sect_recvd = FALSE;
1031 #ifndef EIT_REPORT_SEGMENTS 1033 if ((0x50 <= tid) && (tid <= 0x6f))
1036 section_rec = AddSectionRecord(table_entry, sect, sect_len, data_ptr, FALSE, FALSE);
1037 if (section_rec != NULL)
1039 msg.path = filter_ptr->path;
1040 msg.type = SECTION_RECEIVED;
1041 msg.flt_ptr = filter_ptr;
1042 msg.tbl_entry = table_entry;
1043 msg.sec_rec = section_rec;
1044 if (filter_ptr->low_priority == TRUE)
1051 table_entry->sect_received[sect >> 3] &= ~(1 << (sect & 0x07));
1068 if ((0x50 <= tid) && (tid <= 0x6f))
1071 section_rec = AddSectionRecord(table_entry, sect, sect_len, data_ptr, TRUE, TRUE);
1072 if (section_rec != NULL)
1075 for (i = 0; i < NUM_SECT_RECEIVED_BYTES; i++)
1077 if (!table_entry->ev_sched_segment_notified[i] &&
1078 (table_entry->ev_sched_sect_reqd[i] == table_entry->sect_received[i]))
1082 msg.path = filter_ptr->path;
1083 msg.type = SEGMENT_READY;
1084 msg.flt_ptr = filter_ptr;
1085 msg.tbl_entry = table_entry;
1087 if (filter_ptr->low_priority)
1092 table_entry->ev_sched_segment_notified[i] = TRUE;
1100 table_entry->ev_sched_segment_notified[i] = TRUE;
1109 section_rec = AddSectionRecord(table_entry, sect, sect_len, data_ptr, TRUE, FALSE);
1110 if (section_rec != NULL)
1113 all_sect_recvd = (table_entry->num_sect_received >= table_entry->num_sect_reqd);
1119 if (all_sect_recvd == TRUE)
1122 #ifdef DEBUG_SI_FILTER 1123 STB_SI_PRINT((
"Table complete"));
1125 #ifdef DEBUG_FILTER_PERFORMANCE 1126 STB_SI_PRINT((
"SI filter %p table complete @ %dms", filter_ptr,
STB_OSGetClockDiff(filter_ptr->start_time)));
1128 table_entry->complete = TRUE;
1130 if (table_entry->new_table == TRUE)
1132 filter_ptr->num_tables_received++;
1133 table_entry->new_table = FALSE;
1137 if (filter_ptr->req_type == ONE_SHOT_REQUEST)
1140 if (filter_ptr->num_tables_received >= filter_ptr->num_tables_reqd)
1142 StopFilter(filter_ptr);
1151 data_ptr += sect_len;
1155 filter_ptr->data_end = filter_ptr->data_start;
1160 msg.path = filter_ptr->path;
1161 msg.type = TABLE_READY;
1162 msg.flt_ptr = filter_ptr;
1163 if (filter_ptr->low_priority == TRUE)
1178 FUNCTION_FINISH(SiFilterTask);
1198 static void HandleSiInterrupt(U8BIT demux_path, U16BIT nbytes, U16BIT pfid)
1210 filter_ptr = filter_list;
1211 while (filter_ptr != NULL)
1213 if ((filter_ptr->pfid == pfid) &&
1218 filter_ptr = filter_ptr->next;
1221 if (filter_ptr == NULL)
1224 STB_SI_ERROR((
"HandleSiInterrupt(%u): Failed to find filter, pfid=%d!", demux_path, pfid));
1225 #ifdef DEBUG_SI_FILTER_INT 1226 STB_SI_PRINT((
"Int - filt? skip"));
1233 #ifdef DEBUG_SI_FILTER_INT 1234 STB_SI_PRINT((
"Int - filt %p", filter_ptr));
1241 free_len = filter_ptr->buff_len - (filter_ptr->data_end - filter_ptr->data_start);
1242 if (nbytes > free_len)
1245 #ifdef DEBUG_SI_FILTER_INT 1246 STB_SI_PRINT((
"Int - no room skip"));
1253 data_ptr = filter_ptr->data_end;
1257 if (demux_num != INVALID_RES_ID)
1260 if (sect_valid == FALSE)
1262 #ifdef DEBUG_SI_FILTER_INT 1263 STB_SI_PRINT((
"Int - sect err"));
1269 sect_len = (((data_ptr[1] & 0x0f) << 8) | data_ptr[2]) + 3;
1272 filter_ptr->data_end += sect_len;
1278 filter_ptr->data_end -= sect_len;
1279 #ifdef DEBUG_SI_FILTER_INT 1280 STB_SI_PRINT((
"HandleSiInterrupt: Failed to write to the queue!"));
1315 static FILTER_STATUS* GetFilter(U8BIT path, U16BIT pid, U8BIT tid_match, U8BIT tid_mask,
1316 E_SI_TABLE_FORMAT_TYPE format, U16BIT expected_tables,
1317 U16BIT xtid_match, U16BIT xtid_mask, E_SI_REQUEST_TYPE req_type,
1318 U16BIT buff_size, BOOLEAN crc, BOOLEAN low_priority,
1329 FUNCTION_START(GetFilter);
1335 if (demux_num == INVALID_RES_ID)
1343 if (filter_ptr != NULL)
1346 match_ptr = filter_ptr->match_array;
1347 mask_ptr = filter_ptr->mask_array;
1348 memset(match_ptr, 0, SECT_FILTER_MASK_SIZE);
1349 memset(mask_ptr, 0, SECT_FILTER_MASK_SIZE);
1350 match_ptr[0] = tid_match;
1351 mask_ptr[0] = tid_mask;
1353 if (format == MULTI_SECT)
1356 match_ptr[3] = 0x01;
1360 match_ptr[1] = (U8BIT)(xtid_match >> 8);
1361 match_ptr[2] = (U8BIT)(xtid_match & 0x00ff);
1362 mask_ptr[1] = (U8BIT)(xtid_mask >> 8);
1363 mask_ptr[2] = (U8BIT)(xtid_mask & 0x00ff);
1368 if (pfid != STB_DMX_PID_FILTER_INVALID)
1371 if (mfid == STB_DMX_SECT_FILTER_INVALID)
1378 filter_ptr->next = NULL;
1379 filter_ptr->path = path;
1380 filter_ptr->table_format = format;
1381 filter_ptr->req_type = req_type;
1382 filter_ptr->return_fn = ret_fn;
1383 filter_ptr->return_param = ret_param;
1384 filter_ptr->pid = pid;
1385 filter_ptr->pfid = pfid;
1386 filter_ptr->mfid = mfid;
1387 filter_ptr->buff_len = buff_size;
1388 filter_ptr->data_start = ((U8BIT *)filter_ptr) +
sizeof(
FILTER_STATUS);
1389 filter_ptr->data_end = filter_ptr->data_start;
1390 filter_ptr->num_tables_reqd = expected_tables;
1391 filter_ptr->num_tables_received = 0;
1392 filter_ptr->table_list = NULL;
1393 filter_ptr->last_rxed_table = NULL;
1394 filter_ptr->low_priority = low_priority;
1395 filter_ptr->traversing = FALSE;
1397 filter_ptr->crc = crc;
1402 filter_ptr->next = filter_list;
1403 filter_list = filter_ptr;
1408 #ifdef DEBUG_SI_FILTER 1409 STB_SI_PRINT((
"GetFilter: filter %p", filter_ptr));
1416 if (success == FALSE)
1418 if (filter_ptr != NULL)
1423 #ifdef DEBUG_SI_FILTER_FAILURES 1424 STB_SI_PRINT((
"GetFilter: FAILED"));
1428 FUNCTION_FINISH(GetFilter);
1448 static void ModifyFilter(
FILTER_STATUS *filter_ptr, U8BIT tid_match, U8BIT tid_mask,
1449 U16BIT xtid_match, U16BIT xtid_mask, U16BIT expected_tables)
1454 FUNCTION_START(ModifyFilter);
1456 #ifdef DEBUG_SI_FILTER 1457 STB_SI_PRINT((
"ModifyFilter: filter %p", filter_ptr));
1460 filter_ptr->data_start = ((U8BIT *)filter_ptr) +
sizeof(
FILTER_STATUS);
1461 filter_ptr->data_end = filter_ptr->data_start;
1462 filter_ptr->num_tables_reqd = expected_tables;
1463 filter_ptr->num_tables_received = 0;
1466 match_ptr = filter_ptr->match_array;
1467 mask_ptr = filter_ptr->mask_array;
1468 memset(match_ptr, 0, SECT_FILTER_MASK_SIZE);
1469 memset(mask_ptr, 0, SECT_FILTER_MASK_SIZE);
1470 match_ptr[0] = tid_match;
1471 mask_ptr[0] = tid_mask;
1473 if (filter_ptr->table_format == MULTI_SECT)
1476 match_ptr[3] = 0x01;
1480 match_ptr[1] = (U8BIT)(xtid_match >> 8);
1481 match_ptr[2] = (U8BIT)(xtid_match & 0x00ff);
1482 mask_ptr[1] = (U8BIT)(xtid_mask >> 8);
1483 mask_ptr[2] = (U8BIT)(xtid_mask & 0x00ff);
1487 mask_ptr, 0, filter_ptr->crc);
1489 FUNCTION_FINISH(ModifyFilter);
1505 FUNCTION_START(StartFilter);
1507 #ifdef DEBUG_SI_FILTER 1508 STB_SI_PRINT((
"StartFilter: %p", filter_ptr));
1512 filter_ptr->data_end = filter_ptr->data_start;
1517 #ifdef DEBUG_FILTER_PERFORMANCE 1524 FUNCTION_FINISH(StartFilter);
1542 FUNCTION_START(StopFilter);
1544 #ifdef DEBUG_SI_FILTER 1545 STB_SI_PRINT((
"StopFilter: %p", filter_ptr));
1550 if (demux != INVALID_RES_ID)
1555 FUNCTION_FINISH(StopFilter);
1575 FUNCTION_START(ReleaseFilter);
1578 temp_ptr = filter_list;
1579 prev_ptr = &filter_list;
1580 while (temp_ptr != NULL)
1582 if (temp_ptr == filter_ptr)
1584 #ifdef DEBUG_SI_FILTER 1585 STB_SI_PRINT((
"ReleaseFilter: %p", filter_ptr));
1589 *prev_ptr = filter_ptr->next;
1593 if (demux_num != INVALID_RES_ID)
1600 FreeTableList(filter_ptr);
1601 ProcessTableEntries(filter_ptr);
1607 prev_ptr = &temp_ptr->next;
1608 temp_ptr = temp_ptr->next;
1611 FUNCTION_FINISH(ReleaseFilter);
1630 FUNCTION_START(ValidateFilterPtr);
1635 temp_ptr = filter_list;
1636 while (temp_ptr != NULL)
1638 if (temp_ptr == filter_ptr)
1643 temp_ptr = temp_ptr->next;
1646 FUNCTION_FINISH(ValidateFilterPtr);
1669 U8BIT last_sect_byte;
1671 FUNCTION_START(AddTableListEntry);
1673 ASSERT(filter_ptr != NULL);
1676 if (table_entry != NULL)
1678 #ifdef DEBUG_SI_FILTER 1679 STB_SI_PRINT((
"AddTableRec: tab 0x%02x/0x%04x v%d %d sections ", tid, xtid, ver, (last_sect + 1)));
1683 table_entry->new_table = TRUE;
1684 table_entry->tid = tid;
1685 table_entry->xtid = xtid;
1686 table_entry->version = ver;
1687 table_entry->num_sect_reqd = last_sect + 1;
1688 table_entry->state = VALID;
1691 if ((0x50 <= tid) && (tid <= 0x6f))
1693 last_sect_byte = last_sect >> 3;
1694 for (i = 0; i <= last_sect_byte; i++)
1696 table_entry->ev_sched_sect_reqd[i] = 0xff;
1697 table_entry->ev_sched_segment_notified[i] = FALSE;
1703 if (filter_ptr->last_rxed_table == NULL)
1706 table_entry->next = filter_ptr->table_list;
1707 filter_ptr->table_list = table_entry;
1712 table_entry->next = filter_ptr->last_rxed_table->next;
1713 filter_ptr->last_rxed_table->next = table_entry;
1717 filter_ptr->last_rxed_table = table_entry;
1719 #ifdef DEBUG_SI_FILTER_FAILURES 1722 STB_SI_PRINT((
"AddTableRec: FAILED"));
1726 FUNCTION_FINISH(AddTableListEntry);
1727 return(table_entry);
1744 static void ResetTableListEntry(
TABLE_LIST_ENTRY *table_entry, U8BIT ver, U16BIT last_sect)
1747 U8BIT last_sect_byte;
1749 FUNCTION_START(ResetTableListEntry);
1751 ASSERT(table_entry != NULL);
1753 FreeSectionList(table_entry);
1755 table_entry->version = ver;
1756 table_entry->num_sect_reqd = last_sect + 1;
1757 table_entry->num_sect_received = 0;
1758 memset(table_entry->sect_received, 0, NUM_SECT_RECEIVED_BYTES);
1759 memset(table_entry->ev_sched_sect_reqd, 0, NUM_SECT_RECEIVED_BYTES);
1761 if ((0x50 <= table_entry->tid) && (table_entry->tid <= 0x6f))
1763 last_sect_byte = last_sect >> 3;
1764 for (i = 0; i <= last_sect_byte; i++)
1766 table_entry->ev_sched_sect_reqd[i] = 0xff;
1767 table_entry->ev_sched_segment_notified[i] = FALSE;
1771 FUNCTION_FINISH(ResetTableListEntry);
1797 table_entry = filter_ptr->last_rxed_table;
1798 if (table_entry == NULL)
1801 table_entry = filter_ptr->table_list;
1803 first_entry = table_entry;
1806 while (table_entry != NULL)
1808 if ((table_entry->tid == tid) && (table_entry->xtid == xtid))
1810 if (table_entry->state == VALID)
1818 table_entry = table_entry->next;
1819 if (table_entry == NULL)
1821 table_entry = filter_ptr->table_list;
1823 if (table_entry == first_entry)
1831 return(table_entry);
1850 FUNCTION_START(FreeTableList);
1852 ASSERT(filter_ptr != NULL);
1856 table_entry = filter_ptr->table_list;
1857 if (filter_ptr->traversing)
1860 while (table_entry != NULL)
1862 next_entry = table_entry->next;
1863 FreeSectionList(table_entry);
1864 table_entry->state = DELETED;
1865 table_entry = next_entry;
1871 while (table_entry != NULL)
1873 next_entry = table_entry->next;
1874 FreeSectionList(table_entry);
1876 table_entry = next_entry;
1878 filter_ptr->table_list = NULL;
1879 filter_ptr->last_rxed_table = NULL;
1884 FUNCTION_FINISH(FreeTableList);
1905 FUNCTION_START(ProcessTableEntries);
1907 ASSERT(filter_ptr != NULL);
1911 table_entry_mod = &filter_ptr->table_list;
1912 while (*table_entry_mod != NULL)
1914 if ((*table_entry_mod)->state == DELETED)
1916 table_entry = *table_entry_mod;
1917 *table_entry_mod = table_entry->next;
1918 if (filter_ptr->last_rxed_table == table_entry)
1920 filter_ptr->last_rxed_table = table_entry->next;
1926 table_entry_mod = &((*table_entry_mod)->next);
1932 FUNCTION_FINISH(ProcessTableEntries);
1951 U8BIT *data_ptr, BOOLEAN add_to_table, BOOLEAN add_to_segment_list)
1956 U8BIT segment_last_sect;
1958 FUNCTION_START(AddSectionRecord);
1961 if (section_rec != NULL)
1963 section_rec->sect_num = sect_num;
1964 section_rec->data_len = data_len;
1965 section_rec->next = NULL;
1966 memcpy(§ion_rec->data_start, data_ptr, data_len);
1974 if (add_to_segment_list)
1976 next_sect_rec = table_entry->segment_list[sect_num >> 3];
1977 prev_rec_next_ptr = &(table_entry->segment_list[sect_num >> 3]);
1981 next_sect_rec = table_entry->section_list;
1982 prev_rec_next_ptr = &(table_entry->section_list);
1985 while (next_sect_rec != NULL)
1987 if (sect_num < next_sect_rec->sect_num)
1991 prev_rec_next_ptr = &(next_sect_rec->next);
1992 next_sect_rec = next_sect_rec->next;
1996 section_rec->next = next_sect_rec;
1997 *prev_rec_next_ptr = section_rec;
2001 table_entry->sect_received[sect_num >> 3] |= (0x01 << (sect_num & 0x07));
2002 table_entry->num_sect_received++;
2008 if ((0x50 <= table_entry->tid) && (table_entry->tid <= 0x6f))
2012 segment_last_sect = data_ptr[12];
2013 table_entry->ev_sched_sect_reqd[sect_num >> 3] = ~(0xff << ((segment_last_sect & 0x07) + 1));
2016 #ifdef DEBUG_SI_FILTER 2017 STB_SI_PRINT((
"AddSectionRec: sect %d [of %d]", sect_num, table_entry->num_sect_reqd));
2020 #ifdef DEBUG_SI_FILTER_FAILURES 2023 STB_SI_PRINT((
"AddSectionRec: FAILED"));
2026 FUNCTION_FINISH(AddSectionRecord);
2027 return(section_rec);
2047 FUNCTION_START(FreeSectionList);
2049 ASSERT(table_entry != NULL);
2053 section_rec = table_entry->section_list;
2054 while (section_rec != NULL)
2056 next_rec = section_rec->next;
2058 section_rec = next_rec;
2060 table_entry->section_list = NULL;
2062 for (i = 0; i < NUM_SECT_RECEIVED_BYTES; i++)
2064 section_rec = table_entry->segment_list[i];
2065 while (section_rec != NULL)
2067 next_rec = section_rec->next;
2069 section_rec = next_rec;
2071 table_entry->segment_list[i] = NULL;
2076 FUNCTION_FINISH(FreeSectionList);
2099 STB_SI_PRINT((
"STB_SITerrInitialise (paths = %d)", num_paths));
2102 si_status =
STB_GetMemory(
sizeof(E_STB_SI_STATUS) * num_paths);
2103 ASSERT(si_status != NULL);
2111 filt_task_ptr =
STB_OSCreateTask(SiFilterTask, NULL, FILT_TASK_STACK_SIZE, FILT_TASK_PRIORITY, (U8BIT *)
"SiFilt");
2112 cntrl_task_ptr =
STB_OSCreateTask(SiControlTask, NULL, CNTRL_TASK_STACK_SIZE, CNTRL_TASK_PRIORITY, (U8BIT *)
"SiCntrl");
2113 low_pri_task_ptr =
STB_OSCreateTask(SiLowPriTableTask, NULL, LOW_PRI_TASK_STACK_SIZE, LOW_PRI_TASK_PRIORITY, (U8BIT *)
"SiLowPri");
2121 for (i = 0; i < num_paths; i++)
2123 si_status[i] = SI_STOPPED;
2147 msg.type = SI_EVENT;
2148 msg.numval = events;
2150 if (events == SI_EVENT_STOP)
2154 low_pri_task_stop_pending = TRUE;
2155 cntrl_task_stop_pending = TRUE;
2177 E_STB_SI_STATUS ret_val;
2181 ASSERT(path < num_paths);
2182 ret_val = si_status[path];
2204 for (index = 0; index != NUM_PMT_OBSERVERS; index++)
2206 if (pmt_observers[index] == func_ptr)
2211 if (index == NUM_PMT_OBSERVERS)
2213 for (index = 0; index != NUM_PMT_OBSERVERS; index++)
2215 if (pmt_observers[index] == NULL)
2217 pmt_observers[index] = func_ptr;
2243 for (index = 0; index != NUM_PMT_OBSERVERS; index++)
2245 if (pmt_observers[index] == func_ptr)
2247 pmt_observers[index] = NULL;
2261 F_AppSiEventHandler old_func;
2265 old_func = app_si_interface_ptr;
2266 app_si_interface_ptr = func_ptr;
2298 E_SI_TABLE_FORMAT_TYPE format, U16BIT expected_tables,
2299 U16BIT xtid_match, U16BIT xtid_mask, E_SI_REQUEST_TYPE req_type,
2300 U16BIT buff_size, BOOLEAN crc, BOOLEAN low_priority,
2301 void (*callback)(
void *, U32BIT,
SI_TABLE_RECORD *), U32BIT ret_param)
2307 #ifdef DEBUG_TABLE_REQUESTS 2308 STB_SI_PRINT((
"STB_SIRequestTable - path %d, pid 0x%04x, tid 0x%02x[0x%02x], format %d",
2309 path, pid, tid_match, tid_mask, format));
2310 STB_SI_PRINT((
" xtid 0x%04x[0x%04x], exp %d, rtype %d, buff %d, crc %d, lp %d",
2311 xtid_match, xtid_mask, expected_tables, req_type, buff_size, crc, low_priority));
2314 filter_ptr = GetFilter(path, pid, tid_match, tid_mask, format, expected_tables, xtid_match,
2315 xtid_mask, req_type, buff_size, crc, low_priority, callback, ret_param);
2316 if (filter_ptr != NULL)
2318 StartFilter(filter_ptr);
2322 return((
void *)filter_ptr);
2343 #ifdef DEBUG_TABLE_REQUESTS 2344 STB_SI_PRINT((
"STB_SICancelTableRequest - filter %p", filter_handle));
2350 filter_ok = ValidateFilterPtr(filter_ptr);
2351 if (filter_ok == TRUE)
2353 StopFilter(filter_ptr);
2354 ReleaseFilter(filter_ptr);
2379 U16BIT xtid_match, U16BIT xtid_mask, U16BIT expected_tables)
2386 #ifdef DEBUG_TABLE_REQUESTS 2387 STB_SI_PRINT((
"STB_SIModifyTableRequest - filter %p", filter_handle));
2393 filter_ok = ValidateFilterPtr(filter_ptr);
2394 if (filter_ok == TRUE)
2396 StopFilter(filter_ptr);
2397 FreeTableList(filter_ptr);
2398 ModifyFilter(filter_ptr, tid_match, tid_mask, xtid_match, xtid_mask, expected_tables);
2399 StartFilter(filter_ptr);
2426 #ifdef DEBUG_TABLE_REQUESTS 2427 STB_SI_PRINT((
"STB_SIRestartTableRequest - filter %p", filter_handle));
2433 filter_ok = ValidateFilterPtr(filter_ptr);
2434 if (filter_ok == TRUE)
2436 StopFilter(filter_ptr);
2437 FreeTableList(filter_ptr);
2440 filter_ptr->data_start = ((U8BIT *)filter_ptr) +
sizeof(
FILTER_STATUS);
2441 filter_ptr->data_end = filter_ptr->data_start;
2442 filter_ptr->num_tables_received = 0;
2444 StartFilter(filter_ptr);
2470 ASSERT(table_rec != NULL);
2472 #ifdef DEBUG_TABLE_REQUESTS 2473 STB_SI_PRINT((
"STB_SIReleaseTableRecord - table_rec %p", table_rec));
2476 if (table_rec != NULL)
2481 section_rec = table_rec->section_list;
2482 while (section_rec != NULL)
2484 next_rec = section_rec->next;
2486 section_rec = next_rec;
2513 si_status[path] = SI_STOPPED;
2517 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_SEARCH, EV_TYPE_SUCCESS, event_data, data_size);
2521 STB_ERSendEvent(FALSE, FALSE, EV_CLASS_SEARCH, EV_TYPE_FAIL, event_data, data_size);
2524 STB_SI_PRINT((
"SITask(%d) finished search", path));
2543 BOOLEAN new_pmt_version)
2551 if (table_rec != NULL)
2553 #ifdef DEBUG_PMT_REPORTING 2554 STB_SI_PRINT((
"STB_SIReportCurrentPmt: serv_id 0x%04x new_serv %d", table_rec->xtid, new_serv));
2558 sect_rec = table_rec->section_list;
2560 if (sect_rec != NULL)
2563 for (index = 0; index != NUM_PMT_OBSERVERS; index++)
2565 if (pmt_observers[index] != 0)
2567 (pmt_observers[index])(service_id, &(sect_rec->data_start));
2571 if (new_serv || new_pmt_version)
2576 STB_CAReportPMT(ca_handle, &(sect_rec->data_start), sect_rec->data_len);
2583 #ifdef DEBUG_PMT_REPORTING 2584 STB_SI_PRINT((
"STB_SIReportCurrentPmt: NULL table_rec"));
2587 for (index = 0; index != NUM_PMT_OBSERVERS; index++)
2589 if (pmt_observers[index] != 0)
2591 (pmt_observers[index])(service_id, NULL);
2614 if (table_rec != NULL)
2616 #ifdef DEBUG_CAT_REPORTING 2617 STB_SI_PRINT((
"STB_SIReportCat: version %d num_sects %d", table_rec->version, table_rec->num_sect));
2623 sect_rec = table_rec->section_list;
2624 for (i = 0; ((i < table_rec->num_sect) && (sect_rec != NULL)); i++)
2626 STB_CAReportCAT(ca_handle, &(sect_rec->data_start), sect_rec->data_len);
2627 sect_rec = sect_rec->next;
2635 #ifdef DEBUG_CAT_REPORTING 2636 STB_SI_PRINT((
"STB_SIReportCat: NULL table_rec"));
2661 if (table_rec != NULL)
2666 sect_rec = table_rec->section_list;
2667 for (i = 0; ((i < table_rec->num_sect) && (sect_rec != NULL)); i++)
2669 STB_CAReportBAT(ca_handle, &(sect_rec->data_start), sect_rec->data_len);
2670 sect_rec = sect_rec->next;
2698 if (table_rec != NULL)
2703 sect_rec = table_rec->section_list;
2704 for (i = 0; ((i < table_rec->num_sect) && (sect_rec != NULL)); i++)
2706 STB_CAReportNIT(ca_handle, &(sect_rec->data_start), sect_rec->data_len);
2707 sect_rec = sect_rec->next;
void STB_SIRestartTableRequest(void *filter_handle)
restarts the section filtering on an existing filter without changing and pid or match/mask filter se...
BOOLEAN STB_SIReportNit(SI_TABLE_RECORD *table_rec)
Reports the NIT has been received so it can be passed on to other modules.
BOOLEAN STB_SIReportBat(SI_TABLE_RECORD *table_rec)
Reports the BAT has been received so it can be passed on to other modules.
void * STB_GetMemory(U32BIT bytes)
Attempts to allocate memory from the heap.
void STB_DMXStopPIDFilter(U8BIT path, U16BIT pfilt_id)
Stop Specified PID Filter Collecting Data.
void STB_CAReportBAT(U32BIT handle, U8BIT *bat_data, U16BIT data_len)
When there's an update to the BAT, the updated BAT will be reported to the CA system using this funct...
void STB_DMXSetupSectFilter(U8BIT path, U16BIT sfilt_id, U8BIT *match_ptr, U8BIT *mask_ptr, U8BIT not_equal_byte_index, BOOLEAN crc)
Configures a match and mask for a specified section filter.
U32BIT STB_OSGetClockDiff(U32BIT timestamp)
Get Difference between Given Time and Current Time.
Header file - macros and function prototypes for public use.
void * STB_OSCreateSemaphore(void)
Create a Semaphore.
void STB_DMXStartPIDFilter(U8BIT path, U16BIT pfilt_id)
Start Specified PID Filter Collecting Data.
BOOLEAN STB_DMXCopyPIDFilterSect(U8BIT path, U8BIT *buffer, U16BIT size, U16BIT pfilt_id)
Copies a filtered section to caller's buffer.
void STB_CAReportCAT(U32BIT handle, U8BIT *cat_data, U16BIT data_len)
When there's an update to the CAT for a service, the updated CAT will be reported to the CA system us...
void STB_SITerrSendEvent(U8BIT path, U32BIT events)
Sends an event to STB layer SI Terrestrial engine.
void STB_CAReportNIT(U32BIT handle, U8BIT *nit_data, U16BIT data_len)
When there's an update to the NIT, the updated NIT will be reported to the CA system using this funct...
void STB_OSSemaphoreSignal(void *semaphore)
Signal a Semaphore to Release it by decrementing its counter.
void STB_OSMutexUnlock(void *mutex)
Unlock a mutex (a.k.a. 'leave', 'signal' or 'release')
void STB_OSSemaphoreWait(void *semaphore)
Wait on Semaphore Indefinity or Until Released.
void STB_ERSendEvent(BOOLEAN latched, BOOLEAN repeat, U16BIT path_class, U16BIT type, void *data, U32BIT data_size)
Sends an event to event reporting control module.
void STB_SICancelTableRequest(void *filter_handle)
Stops filtering for SI table.
U8BIT STB_DPGetNumPaths(void)
Returns the maximum number of decode paths.
void STB_SITerrInitialise(void)
Initialises STB layer SI engine - terrestrial version.
void STB_FreeMemory(void *addr)
Releases previously allocated heap memory.
E_STB_SI_STATUS STB_SITerrGetStatus(U8BIT path)
Reads the SI status.
Debug functions header file.
void STB_SISearchComplete(U8BIT path, BOOLEAN success, void *event_data, U32BIT data_size)
Indicates SI search is complete.
void STB_SIModifyTableRequest(void *filter_handle, U8BIT tid_match, U8BIT tid_mask, U16BIT xtid_match, U16BIT xtid_mask, U16BIT expected_tables)
modifies the section filtering on an existing filter
Header file - Function prototypes for linked lists.
void STB_SIReportCurrentPmt(U16BIT service_id, SI_TABLE_RECORD *table_rec, BOOLEAN new_serv, BOOLEAN new_pmt_version)
Reports current pmt has arrived so that it can be passed on to interested parties.
BOOLEAN STB_SIReportCat(SI_TABLE_RECORD *table_rec)
Reports the CAT has been received so it can be passed on to other modules.
void STB_OSMutexLock(void *mutex)
Lock a mutex (a.k.a. 'enter', 'wait' or 'get').
U32BIT STB_DPGetFrequency(U8BIT path)
Reads the frequency value from decode path store.
void STB_SIRegisterPmtObserver(F_PmtObserver func_ptr)
Registers a function to be called when the PMT changes.
Header file - Function prototypes for Event Reporting.
void STB_DMXSkipPIDFilterSect(U8BIT path, U16BIT pfilt_id)
Skips (discards) a section in the PID filter buffer.
Glue layer between DVB and conditional access systems.
BOOLEAN STB_OSWriteQueue(void *queue, void *msg, U16BIT msg_size, U16BIT timeout)
Write a message to the queue.
Header file - Function prototypes for operating system.
System Wide Global Technical Data Type Definitions.
void STB_SIReleaseTableRecord(SI_TABLE_RECORD *table_rec)
Frees the memory used in a table record passed to the application.
BOOLEAN STB_DPGetPathCADescrambler(U8BIT path, U32BIT *handle)
Get the handle of the CA descrambler associated with the given path.
void STB_SIUnregisterPmtObserver(F_PmtObserver func_ptr)
Registers a function to be called when the PMT changes.
void * STB_OSCreateTask(void(*function)(void *), void *param, U32BIT stack, U8BIT priority, U8BIT *name)
Create a New Task to the calling process. Upon success, the created task runs on its own stack...
Header file - macros and function prototypes for public use.
U16BIT STB_DMXGrabSectFilter(U8BIT path, U16BIT pfilt_id)
Allocated a new section filter on the specified PID filter.
void STB_DMXReleaseSectFilter(U8BIT path, U16BIT sfilt_id)
Releases a previously allocated section filter.
void * STB_OSCreateQueue(U16BIT msg_size, U16BIT msg_max)
Create Queue of given number of messages and size of message.
Header file - Function prototypes for heap memory.
void * STB_OSCreateMutex(void)
Create a mutex.
Header file - Function prototypes for operating system.
BOOLEAN STB_OSReadQueue(void *queue, void *msg, U16BIT msg_size, U16BIT timeout)
Read a message from a queue.
void * STB_SIRequestTable(U8BIT path, U16BIT pid, U8BIT tid_match, U8BIT tid_mask, E_SI_TABLE_FORMAT_TYPE format, U16BIT expected_tables, U16BIT xtid_match, U16BIT xtid_mask, E_SI_REQUEST_TYPE req_type, U16BIT buff_size, BOOLEAN crc, BOOLEAN low_priority, void(*callback)(void *, U32BIT, SI_TABLE_RECORD *), U32BIT ret_param)
Sets up filter for SI table.
void STB_OSTaskDelay(U16BIT timeout)
Delay Task for Specifed Time Period.
Header file - Function prototypes for Demux control.
U32BIT STB_OSGetClockMilliseconds(void)
Get Current Computer Clock Time.
F_AppSiEventHandler STB_SIRegisterAppSiEventHandler(void(*func_ptr)(U8BIT, E_APP_SI_EVENT_TYPE))
Registers a function to be called to handle SI events.
U8BIT STB_DPGetPathDemux(U8BIT path)
Returns the demux path ID acquired by the given decode path.
void STB_CAReportPMT(U32BIT handle, U8BIT *pmt_data, U16BIT data_len)
When there's an update to the PMT for a service, the updated PMT will be reported to the CA system us...
U16BIT STB_DMXGrabPIDFilter(U8BIT path, U16BIT pid, FILTER_CALLBACK func)
Get a New PID Filter & Setup Associated Buffer and Callback Function Address.
void STB_DMXReleasePIDFilter(U8BIT path, U16BIT pfilt_id)
Releases a previously allocated PID filter.
Header file - macros and function prototypes for public use.