DVBCore  20.3.0
DVBCore Documentation
stbota.c
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2009 Ocean Blue Software Ltd
4  *
5  * This file is part of a DTVKit Software Component
6  * You are permitted to copy, modify or distribute this file subject to the terms
7  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
8  *
9  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
10  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
11  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * If you or your organisation is not a member of DTVKit then you have access
14  * to this source code outside of the terms of the licence agreement
15  * and you are expected to delete this and any associated files immediately.
16  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
17  *******************************************************************************/
25 /*#define OTA_DEBUG*/
26 
27 /*---includes for this file--------------------------------------------------*/
28 /* compiler library header files */
29 #include <stdio.h>
30 
31 /* third party header files */
32 
33 /* DVBCore header files */
34 #include <techtype.h>
35 #include <dbgfuncs.h>
36 
37 #include "stbhwc.h"
38 #include "stbhwos.h"
39 #include "stbhwupg.h"
40 
41 #include "stbdpc.h"
42 #include "stbheap.h"
43 #include "stberc.h"
44 #include "stbota.h"
45 //#include "stbver.h"
46 #include "stbsitab.h"
47 
48 #include "dsm_control.h"
49 #include "dsm_client.h"
50 
51 /*---constant definitions for this file--------------------------------------*/
52 
53 #ifdef OTA_DEBUG
54 #define OTA_DBG(X) STB_SPDebugWrite X
55 #else
56 #define OTA_DBG(X)
57 #endif
58 
59 #define OTA_NVM_TASK_STACK 1024
60 #define OTA_NVM_TASK_PRIORITY 6
61 #define DSMCC_TASK_PRIORITY 6
62 #define MAX_NVM_MSGS 30
63 
64 /*---local typedef structs for this file-------------------------------------*/
65 
66 typedef enum
67 {
68  MSG_INIT,
69  MSG_START,
70  MSG_SAVE,
71  MSG_STOP,
72  MSG_DONE,
73  MSG_ERROR,
74  MSG_ABORT,
75  MSG_QUIT
76 } E_MSG_TYPE;
77 
78 typedef struct s_nvm_msg
79 {
80  E_MSG_TYPE type;
81  U32BIT moduleRef;
82  U32BIT offset;
83  U32BIT size;
84  U8BIT *data;
85 } S_NVM_MSG;
86 
87 typedef struct s_upg_mod
88 {
89  U8BIT *name;
90  U8BIT mtyp;
91 } S_UPG_MOD;
92 
93 /*---local (static) variable declarations for this file----------------------*/
94 
95 static H_DsmControl dsmcc_control = NULL;
96 static H_DsmCarousel dsmcc_carousel = NULL;
97 static void *wait_sem = NULL;
98 static void *dsm_mutex = NULL;
99 static BOOLEAN continue_with_download = FALSE;
100 static void* ota_nvm_queue = NULL;
101 static U32BIT total_image_size;
102 static U32BIT saved_image_size;
103 static S_UPG_MOD ota_upg_mod;
104 static F_SSU_VERSION_CALLBACK ssu_version_cb = NULL;
105 
106 /*---local function prototypes for this file---------------------------------*/
107 static void* MemAlloc(U32BIT memSize);
108 static void MemFree(void* ptr);
109 static BOOLEAN ParseSsuSelectorBytes( U8BIT *selPtr, U8BIT selLen );
110 static void SsuStatusEvent( H_DsmCarousel carouselRef, E_UCLoadStatus status, U_StatusRef sr, U32BIT data );
111 static BOOLEAN SsuWanted( U32BIT grp_id, U32BIT grp_size, S_SsuModelVersion *smv );
112 static H_UsrRef SsuStartModule( E_ModuleType mtyp, U8BIT *name );
113 static BOOLEAN SsuWantModuleData( H_UsrRef usrRef, U32BIT moduleRef,
114  U32BIT offset, U32BIT size, U32BIT crc );
115 static void SsuSaveModuleData( H_UsrRef usrRef, U32BIT moduleRef, U32BIT offset, U32BIT size, U8BIT *data );
116 static H_DsmControl DsmccOpen(void);
117 static U32BIT GetOui(void);
118 static void NvmSaveTask(void *param);
119 
120 
121 /*---global function definitions---------------------------------------------*/
122 
133 BOOLEAN STB_OTAStartLoader(U8BIT path, U16BIT onet_id, U16BIT tran_id, U16BIT serv_id,
134  U16BIT download_pid, F_SSU_VERSION_CALLBACK version_cb)
135 {
136  BOOLEAN retval;
137 
138  FUNCTION_START(STB_OTAStartLoader);
139  ASSERT(path != INVALID_RES_ID)
140 
141  retval = TRUE;
142 
143  if (dsmcc_control == NULL)
144  {
145  retval = FALSE;
146 
147  dsmcc_control = DsmccOpen();
148  if (dsmcc_control != NULL)
149  {
150  if (wait_sem == NULL)
151  {
152  wait_sem = STB_OSCreateSemaphore();
153  }
154 
155  /* This semaphore is used to prevent the update process from continuing once the
156  * download has completed */
157  STB_OSSemaphoreWait(wait_sem);
158 
159  if (dsm_mutex == NULL)
160  {
161  dsm_mutex = STB_OSCreateMutex();
162  }
163 
164  if (ota_nvm_queue == NULL)
165  {
166  ota_nvm_queue = STB_OSCreateQueue(sizeof(S_NVM_MSG), MAX_NVM_MSGS);
167 
168  STB_OSCreateTask(NvmSaveTask, NULL, OTA_NVM_TASK_STACK, OTA_NVM_TASK_PRIORITY,
169  (U8BIT *)"OTA Nvm Task");
170  }
171 
172  retval = TRUE;
173  }
174  else
175  {
176  OTA_DBG(("%s: Failed to create a DSMCC controller to start the download", __FUNCTION__));
177  STB_ERSendEvent(FALSE, FALSE, EV_CLASS_OTA_SW_UPGRADE, EV_TYPE_OTA_SW_UPGRADE_ERROR, NULL, 0);
178  }
179  }
180 
181  if (retval)
182  {
183  total_image_size = 0;
184  saved_image_size = 0;
185  ssu_version_cb = version_cb;
186 
187  STB_OSMutexLock(dsm_mutex);
188 
189  DSMCC_SetTunedTransportInfo(dsmcc_control, onet_id, tran_id, STB_DPGetPathDemux(path));
190 
191  if (serv_id != DVB_INVALID_ID)
192  {
193  OTA_DBG(("%s: Start DSMCC on service ID %u", __FUNCTION__, serv_id));
194  retval = DSMCC_StartSsu(dsmcc_control, serv_id, GetOui());
195  }
196  else
197  {
198  OTA_DBG(("%s: Start DSMCC on PID %u", __FUNCTION__, download_pid));
199  retval = DSMCC_StartSsuWithPid(dsmcc_control, download_pid, GetOui());
200  }
201 
202  STB_OSMutexUnlock(dsm_mutex);
203 
204  if (!retval)
205  {
206  OTA_DBG(("%s: Failed to start DSMCC", __FUNCTION__));
207  STB_ERSendEvent(FALSE, FALSE, EV_CLASS_OTA_SW_UPGRADE, EV_TYPE_OTA_SW_UPGRADE_ERROR, NULL, 0);
208  }
209  }
210 
211  FUNCTION_FINISH(STB_OTAStartLoader);
212 
213  return(retval);
214 }
215 
221 {
222  FUNCTION_START(STB_OTAStopLoader);
223 
224  if (dsmcc_control != NULL)
225  {
226  /* Set the flag to prevent the download from continuing */
227  continue_with_download = FALSE;
228  STB_OSSemaphoreSignal(wait_sem);
229 
230  STB_OSMutexLock(dsm_mutex);
231 
232  if (dsmcc_control != NULL)
233  {
234  OTA_DBG(("%s: Stopping DSMCC", __FUNCTION__));
235  DSMCC_Stop(dsmcc_control, RST_MODE_FORCE);
236  DSMCC_Close(dsmcc_control);
237  dsmcc_control = NULL;
238  }
239 
240  STB_OSMutexUnlock(dsm_mutex);
241  }
242 
243  FUNCTION_FINISH(STB_OTAStopLoader);
244 }
245 
251 {
252  U32BIT percent;
253 #ifdef OTA_DEBUG
254  static U32BIT last_pc = 0xFFFFFFFF;
255 #endif
256 
257  FUNCTION_START(STB_OTAGetProgress);
258 
259  STB_OSMutexLock(dsm_mutex);
260 
261  if ((dsmcc_control == NULL) || (total_image_size == 0))
262  {
263  percent = 0;
264  }
265  else
266  {
267  /* U32BIT isn't always big enough to handle the calculation for percentage, so change to KB */
268  percent = ((saved_image_size / 1024) * 100) / (total_image_size / 1024);
269 #ifdef OTA_DEBUG
270  if (percent != last_pc)
271  {
272  last_pc = percent;
273  OTA_DBG(("%s: saved=%lu total=%lu percent=%lu", __FUNCTION__, saved_image_size,
274  total_image_size, percent));
275  }
276 #endif
277  }
278 
279  STB_OSMutexUnlock(dsm_mutex);
280 
281  FUNCTION_FINISH(STB_OTAGetProgress);
282 
283  return (U8BIT)percent;
284 }
285 
292 void STB_OTAContinueDownload(BOOLEAN status)
293 {
294  FUNCTION_START(STB_OTAContinueDownload);
295 
296  STB_OSMutexLock(dsm_mutex);
297 
298  if (dsmcc_control != NULL)
299  {
300  /* Set the flag indicating whether the download should continue and then allow it to proceed */
301  continue_with_download = status;
302 
303  STB_OSSemaphoreSignal(wait_sem);
304  }
305 
306  STB_OSMutexUnlock(dsm_mutex);
307 
308  FUNCTION_FINISH(STB_OTAContinueDownload);
309 }
310 
311 /*---local function definitions----------------------------------------------*/
312 
318 static void* MemAlloc(U32BIT memSize)
319 {
320  void *data;
321 
322  FUNCTION_START(MemAlloc);
323 
324  data = STB_AppGetMemory(memSize);
325 
326  FUNCTION_FINISH(MemAlloc);
327 
328  return data;
329 }
330 
335 static void MemFree(void* ptr)
336 {
337  FUNCTION_START(MemFree);
338 
339  STB_AppFreeMemory(ptr);
340 
341  FUNCTION_FINISH(MemFree);
342 }
343 
344 static BOOLEAN ParseSsuSelectorBytes( U8BIT *selPtr, U8BIT selLen )
345 {
346  FUNCTION_START(ParseSsuSelectorBytes);
347  USE_UNWANTED_PARAM(selPtr);
348  USE_UNWANTED_PARAM(selLen);
349  FUNCTION_FINISH(ParseSsuSelectorBytes);
350  return TRUE;
351 }
352 
364 static void SsuStatusEvent( H_DsmCarousel carouselRef, E_UCLoadStatus status, U_StatusRef sr, U32BIT data )
365 {
366  S_NVM_MSG msg;
367 
368  FUNCTION_START(SsuStatusEvent);
369  USE_UNWANTED_PARAM(sr);
370 
371  switch (status)
372  {
373  case SSU_NOT_AVAILABLE:
374  {
375  OTA_DBG(("%s: SSU_NOT_AVAILABLE", __FUNCTION__));
376  STB_ERSendEvent(FALSE, FALSE, EV_CLASS_OTA_SW_UPGRADE, EV_TYPE_OTA_SW_UPGRADE_NOTFOUND, NULL, 0);
377  dsmcc_carousel = carouselRef;
378  break;
379  }
380  case SSU_CRSL_READY:
381  {
382  OTA_DBG(("%s: SSU_CRSL_READY", __FUNCTION__));
383  dsmcc_carousel = carouselRef;
384  /* 'data' contains size of all module data */
385  STB_ERSendEvent(FALSE, FALSE, EV_CLASS_OTA_SW_UPGRADE, EV_TYPE_OTA_SW_UPGRADE_DOWNLOADING, NULL, 0);
386  total_image_size = data;
387  break;
388  }
389  case SSU_LOAD_STARTING:
390  {
391  OTA_DBG(("%s: SSU_LOAD_STARTING", __FUNCTION__));
392  msg.type = MSG_START;
393  /* 'data' contains size of data for this module type */
394  STB_OSWriteQueue(ota_nvm_queue, (void *)&msg, sizeof(S_NVM_MSG), TIMEOUT_NEVER);
395  break;
396  }
397  case SSU_LOAD_COMPLETE:
398  {
399  OTA_DBG(("%s: SSU_LOAD_COMPLETE", __FUNCTION__));
400  msg.type = MSG_STOP;
401  STB_OSWriteQueue(ota_nvm_queue, (void *)&msg, sizeof(S_NVM_MSG), TIMEOUT_NEVER);
402  break;
403  }
404  case SSU_LOAD_ABORTED:
405  {
406  OTA_DBG(("%s: SSU_LOAD_ABORTED", __FUNCTION__));
407  msg.type = MSG_ERROR;
408  STB_OSWriteQueue(ota_nvm_queue, (void *)&msg, sizeof(S_NVM_MSG), TIMEOUT_NEVER);
409  break;
410  }
411  case SSU_CRSL_DONE:
412  {
413  OTA_DBG(("%s: SSU_CRSL_DONE, saved_image_size=%lu, total_image_size=%lu", __FUNCTION__,
414  saved_image_size, total_image_size));
415  if (saved_image_size != total_image_size)
416  {
417  msg.type = MSG_ERROR;
418  }
419  else
420  {
421  msg.type = MSG_DONE;
422  }
423  STB_OSWriteQueue(ota_nvm_queue, (void *)&msg, sizeof(S_NVM_MSG), TIMEOUT_NEVER);
424  break;
425  }
426  case SSU_CRSL_ABORT:
427  {
428  OTA_DBG(("%s: SSU_CRSL_ABORT", __FUNCTION__));
429  STB_ERSendEvent(FALSE, FALSE, EV_CLASS_OTA_SW_UPGRADE, EV_TYPE_OTA_SW_UPGRADE_NOTFOUND, NULL, 0);
430  msg.type = MSG_ABORT;
431  saved_image_size = total_image_size;
432  STB_OSWriteQueue(ota_nvm_queue, (void *)&msg, sizeof(S_NVM_MSG), TIMEOUT_NEVER);
433  break;
434  }
435  case SSU_CRSL_UNLOAD:
436  {
437  OTA_DBG(("%s: SSU_CRSL_UNLOAD", __FUNCTION__));
438  break;
439  }
440  default:
441  {
442  OTA_DBG(("%s: Invalid status %d", __FUNCTION__, status));
443  break;
444  }
445  }
446 
447  FUNCTION_FINISH(SsuStatusEvent);
448 }
449 
458 static BOOLEAN SsuWanted( U32BIT grp_id, U32BIT grp_size, S_SsuModelVersion *smv )
459 {
460  BOOLEAN result = FALSE;
461  BOOLEAN valid_download = TRUE;
462 
463  FUNCTION_START(SsuWanted);
464 
465  if (ssu_version_cb != NULL)
466  {
467  /* Call provided callback to see if the update should proceed */
468  valid_download = (*ssu_version_cb)(grp_id, grp_size, smv->hw_model, smv->hw_version,
469  smv->sw_model, smv->sw_version);
470  }
471 
472  if (valid_download)
473  {
474  /* Update is available and its valid, so inform the app that an update has been found */
475  STB_ERSendEvent(FALSE, FALSE, EV_CLASS_OTA_SW_UPGRADE, EV_TYPE_OTA_SW_UPGRADE_FOUND, NULL, 0);
476 
477  /* The update can continue but may be up to the user, so block here until told to continue */
478  STB_OSSemaphoreWait(wait_sem);
479 
480  result = continue_with_download;
481  total_image_size = grp_size;
482  saved_image_size = 0;
483  OTA_DBG(("%s: continue=%u, total=%lu", __FUNCTION__, result, total_image_size));
484  }
485 
486  FUNCTION_FINISH(SsuWanted);
487 
488  return result;
489 }
490 
500 static H_UsrRef SsuStartModule( E_ModuleType mtyp, U8BIT *name )
501 {
502  H_UsrRef retval = NULL;
503 
504  FUNCTION_START(SsuStartModule);
505 
506  if (STB_UPGStart((U8BIT)mtyp, name ))
507  {
508  ota_upg_mod.mtyp = (U8BIT)mtyp;
509  ota_upg_mod.name = name;
510  retval = &ota_upg_mod;
511  }
512 #ifdef OTA_DEBUG
513  else
514  {
515  OTA_DBG(("STB_UPGStart failed"));
516  }
517 #endif
518 
519  FUNCTION_FINISH(SsuStartModule);
520 
521  return retval;
522 }
523 
536 static BOOLEAN SsuWantModuleData( H_UsrRef usrRef, U32BIT moduleRef,
537  U32BIT offset, U32BIT size, U32BIT crc )
538 {
539  FUNCTION_START(SsuWantModuleData);
540  USE_UNWANTED_PARAM(usrRef);
541  USE_UNWANTED_PARAM(moduleRef);
542  USE_UNWANTED_PARAM(offset);
543  USE_UNWANTED_PARAM(size);
544  USE_UNWANTED_PARAM(crc);
545 #ifdef TODO_CHECK_NVM
546  /* TODO: Check whether NVM has this module using */
547 #endif
548  FUNCTION_FINISH(SsuWantModuleData);
549  return TRUE;
550 }
551 
563 static void SsuSaveModuleData( H_UsrRef usrRef, U32BIT moduleRef, U32BIT offset, U32BIT size, U8BIT *data )
564 {
565  S_NVM_MSG msg;
566 
567  FUNCTION_START(SsuSaveModuleData);
568 
569  USE_UNWANTED_PARAM(usrRef);
570 
571  msg.type = MSG_SAVE;
572  msg.moduleRef = moduleRef;
573  msg.offset = offset;
574  msg.size = size;
575  msg.data = data;
576 
577  OTA_DBG(("%s: saved=%lu total=%lu", __FUNCTION__, saved_image_size, total_image_size));
578  STB_OSWriteQueue(ota_nvm_queue, (void *)&msg, sizeof(S_NVM_MSG), TIMEOUT_NEVER);
579 
580  saved_image_size += size;
581 
582  FUNCTION_FINISH(SsuSaveModuleData);
583 }
584 
585 static H_DsmControl DsmccOpen(void)
586 {
587  S_DsmccConfig config;
588 
589  FUNCTION_START(DsmccOpen);
590 
591  config.taskPriority = DSMCC_TASK_PRIORITY;
592  config.sectionBuffPoolSize = 180;
593  config.sectionBuffCacheSize = 16;
594  config.memAlloc = MemAlloc;
595  config.memFree = MemFree;
596  config.parsePmtInit = NULL;
597  config.parseDataBroadcastId = NULL;
598  config.parseSsuSelectorBytes = ParseSsuSelectorBytes;
599  config.parsePmtDone = NULL;
600  config.ssuFuncs.status = SsuStatusEvent;
601  config.ssuFuncs.wanted = SsuWanted;
602  config.ssuFuncs.startModule = SsuStartModule;
603  config.ssuFuncs.wantModuleData = SsuWantModuleData;
604  config.ssuFuncs.saveModuleData = SsuSaveModuleData;
605  config.notifyAitInfo = NULL;
606  config.controlFlags = GET_PMT_DIRECT_FROM_HW_FLAG;
607 
608  FUNCTION_FINISH(DsmccOpen);
609 
610  return DSMCC_Open( &config );
611 }
612 
613 static U32BIT GetOui(void)
614 {
615  U32BIT oui;
616  U8BIT *oui_str = STB_HWGetOUI();
617 
618  FUNCTION_START(GetOui);
619 
620  if ((oui_str = STB_HWGetOUI()) != NULL)
621  {
622  oui = *oui_str++;
623  oui = (oui << 8) | *oui_str++;
624  oui = (oui << 8) | *oui_str;
625  }
626  else
627  {
628  oui = 0;
629  }
630 
631  FUNCTION_FINISH(GetOui);
632 
633  return oui;
634 }
635 
636 static void NvmSaveTask(void *param)
637 {
638  S_NVM_MSG msg;
639 
640  FUNCTION_START(NvmSaveTask);
641  USE_UNWANTED_PARAM(param);
642 
643  msg.type = MSG_INIT;
644 
645  while (msg.type != MSG_QUIT)
646  {
647  if (STB_OSReadQueue(ota_nvm_queue, (void *)&msg, sizeof(S_NVM_MSG), TIMEOUT_NEVER))
648  {
649  switch (msg.type)
650  {
651  case MSG_START:
652  {
653  break;
654  }
655  case MSG_SAVE:
656  {
657  /* save data */
658  OTA_DBG(("%s: SAVING moduleRef=%x offset=%d size=%d", __FUNCTION__, msg.moduleRef,
659  msg.offset, msg.size));
660  if (!STB_UPGWrite(ota_upg_mod.mtyp, msg.offset, msg.size, msg.data))
661  {
662  OTA_DBG(("%s: Failed to write OTA at offset %d bytes=%d", __FUNCTION__,
663  msg.offset, msg.size));
664  //TODO: do something - re-try?
665  }
666  else
667  {
668  STB_OSMutexLock(dsm_mutex);
669  if (dsmcc_control != NULL)
670  {
671  DSMCC_SsuUnloadModule(dsmcc_control, dsmcc_carousel, msg.moduleRef);
672  }
673  STB_OSMutexUnlock(dsm_mutex);
674  }
675  break;
676  }
677  case MSG_STOP:
678  {
679  STB_UPGFinish( ota_upg_mod.mtyp, TRUE );
680  STB_ERSendEvent(FALSE, FALSE, EV_CLASS_OTA_SW_UPGRADE, EV_TYPE_OTA_SW_UPGRADE_COMPLETED, NULL, 0);
681  break;
682  }
683  case MSG_ERROR:
684  {
685  STB_UPGFinish( ota_upg_mod.mtyp, FALSE );
686  STB_ERSendEvent(FALSE, FALSE, EV_CLASS_OTA_SW_UPGRADE, EV_TYPE_OTA_SW_UPGRADE_ERROR, NULL, 0);
687  break;
688  }
689  case MSG_DONE:
690  {
691  STB_OSMutexLock(dsm_mutex);
692  if (dsmcc_control != NULL)
693  {
694  DSMCC_Stop(dsmcc_control,RST_MODE_FORCE);
695  }
696  STB_OSMutexUnlock(dsm_mutex);
697  break;
698  }
699  case MSG_QUIT:
700  default:
701  {
702  STB_OSMutexLock(dsm_mutex);
703  if (dsmcc_control != NULL)
704  {
705  DSMCC_Stop(dsmcc_control,RST_MODE_FORCE);
706  }
707  STB_OSMutexUnlock(dsm_mutex);
708  break;
709  }
710  }
711  }
712  }
713 
714  FUNCTION_FINISH(NvmSaveTask);
715 }
716 
717 /****************************************************************************
718 ** End of file
719 *****************************************************************************/
720 
721 
BOOLEAN STB_OTAStartLoader(U8BIT path, U16BIT onet_id, U16BIT tran_id, U16BIT serv_id, U16BIT download_pid, F_SSU_VERSION_CALLBACK version_cb)
Starts the over-the-air download process.
Definition: stbota.c:133
API interfacing the midware with Intellibyte loader library.
Function prototypes for HW control.
U8BIT * STB_HWGetOUI(void)
Returns the number of smart card slots on the platorm.
Header file - macros and function prototypes for public use.
void * STB_OSCreateSemaphore(void)
Create a Semaphore.
void * STB_AppGetMemory(U32BIT bytes)
Attempts to allocate memory from the application heap.
Definition: stbheap.c:651
BOOLEAN STB_UPGFinish(U8BIT image_type, BOOLEAN upgrade_successful)
Finalises the upgrade performing all the required actions needed when all the upgrade data have been ...
void STB_OSSemaphoreSignal(void *semaphore)
Signal a Semaphore to Release it by decrementing its counter.
U8BIT STB_OTAGetProgress(void)
Returns the SSU download progress as a percentage.
Definition: stbota.c:250
void STB_OSMutexUnlock(void *mutex)
Unlock a mutex (a.k.a. &#39;leave&#39;, &#39;signal&#39; or &#39;release&#39;)
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.
Definition: stberc.c:571
Debug functions header file.
Header file - macros and function prototypes for public use.
void STB_OSMutexLock(void *mutex)
Lock a mutex (a.k.a. &#39;enter&#39;, &#39;wait&#39; or &#39;get&#39;).
void STB_OTAStopLoader(void)
Stops the download, if still in progress, but should also be called when the update process has compl...
Definition: stbota.c:220
Header file - Function prototypes for Event Reporting.
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_AppFreeMemory(void *addr)
Releases previously allocated application heap memory.
Definition: stbheap.c:781
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...
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.
BOOLEAN STB_OSReadQueue(void *queue, void *msg, U16BIT msg_size, U16BIT timeout)
Read a message from a queue.
BOOLEAN STB_UPGStart(U8BIT image_type, U8BIT *filename)
Specifies the file path that STB_UPWrite would write to and STB_UPGRead would read from when performi...
void STB_OTAContinueDownload(BOOLEAN status)
This function should be called to unblock the download process. This can be used to in the case where...
Definition: stbota.c:292
BOOLEAN STB_UPGWrite(U8BIT image_type, U32BIT offset, U32BIT size, U8BIT *buffer)
Writes size bytes to the upgrade storage area specified by image_type.
U8BIT STB_DPGetPathDemux(U8BIT path)
Returns the demux path ID acquired by the given decode path.
Definition: stbdpc.c:1711
Functions for writing upgrade modules to non volatile memory.