How to link the CAMaLot stack to an application


Two libraries are provided in the package which should be linked with the application.

  • libci_{target}.a
  • libcamalothost_{target}.a

they are located in {target}/lib/directory.

For example for the arm_thumb target the libraries are libci_arm_thumb.a and libcamalothost_arm_thumb.a in arm_thumb/lib.

The GCC options to link the libraries are :

-L{target}/lib -lci_{target} -lcamalothost_{target}

Include directories

Add the two include directories to the include path. These directories are /CAMaLotLib /CAMaLotHost/public

The GCC option to add the include path are :

-ICAMaLotLib -ICAMaLotHost/public

Low level driver

If you are using RBL042 chip then use provided source code in RBL042Driver. Otherwise use sample_driver.c as a template for your own driver.

Add the source code for the low level driver to your application. The files are dvbci_driver.c, dvbci_specific.c and FPGA_SPI.c. The matching include files dvbci_driver.h, dvbci_specific.h and FPGA_SPI.h must be in the include path for compilation

Low level driver SPI code

Customize FPGA_SPI.c (see RBL042Driver/How_to_implement_FPGA_SPI_driver.txt)

Low level driver GPIO code

5) Customize dvbci_specific.c (see RBL042Driver/How_to_implement_dvbci_specific.txt)


Add a call to CALH_Init() in your main application. The parameter passed is an opaque void * pointer that will be passed by the stack to some function as pSysContext.

Call backs

Bind you callback function, for example binding application info callback

void MyReportAppInfo(int nSlot, unsigned char ucApplicationType,
unsigned short usApplication_Manufacturer, unsigned short usManufacturerCode,
const char *pcMenuString, unsigned char ucMenuStringLength)
// do app info processing here
void main(void)

CALH_fnReportAppInfo = MyReportAppInfo;



Callback function are called within the execution context of the stack. They should not be too long or blocking. If a blocking operation is required to process information in callback it must be offloaded to a different thread.

Register low level driver with stack

When using the RBL042 driver register the driver for the two slots

// init slot 0
CALH_StartHAL(0, &DVBCIHOST_Functions, &g_SlotContext[0]);
// init slot 1
CALH_StartHAL(1, &DVBCIHOST_Functions, &g_SlotContext[1]);

If using a custom driver register your own functions and the associated context

Tick function

Make sure the tick function is called for each slot. For the RBL042 driver this is done by calling DVBCIHOST_EventTick() every 100ms

Sorry, comments are closed for this post.