iLLD_TC27xC  1.0
How to use the HSSL Interface driver?
Collaboration diagram for How to use the HSSL Interface driver?:

The HSSL interface driver provides a default HSSL/HSCT configuration for point to point communication at two transfer speeds, 5MBaud (low speed) and 320MBaud (high speed). It also supports streaming transfers of data a memory block at both low and high speeds.

In the following sections it will be described, how to integrate the driver into the application framework.

Preparation

Include Files

Include following header file into your C code:

Variables

Declare the HSSL handle and channel array as global variables in your C code:

// used globally
static fxHssl_Hssl hssl;
IfxHssl_Hssl_Channel hsslChannel[4];
__attribute__ ((aligned(256))) uint32 txData[80]; // needs to be declared globally in case of streaming transfers

Module Initialisation

The module initialisation can be done as follows:

// create module config
IfxHssl_Hssl_initModuleConfig(&hsslConfig, &MODULE_HSSL, &MODULE_HSCT);
// select the interface mode (in case of slave)
// select the high speed mode if required
hsslConfig.highSpeedMode = TRUE;
// initialize module
//IfxHssl_Hssl hssl; // defined globally
IfxHssl_Hssl_initModule(&hssl, &hsslConfig);

Channel Initialisation

The Channel initialisation can be done as follows:

// create HSSL channel config
IfxHssl_Hssl_ChannelConfig hsslChannelConfig;
IfxHssl_Hssl_initChannelConfig(&hsslChannelConfig, &hssl);
// initialize the channels
// IfxHssl_Hssl_Channel hsslChannel[4]; // defined globally
for(int i=0; i<4; ++i)
{
hsslChannelConfig.channelId = (IfxHssl_ChannelId)i;
IfxHssl_Hssl_initChannel(&hsslChannel[i], &hsslChannelConfig);
}

The HSSL is ready for use now!

Data Transfers

Simple Transfers

The HSSL driver provides simple to use data transfer functions,

It supports direct writing of 8/16/32 bit data from the initiator into a target's register, as well as reading a value from the target

// write some data to remote location:
IfxHssl_Hssl_write(&hsslChannel[0], 0x70000000, 0x12345678, IfxHssl_DataLength_32bit);
// wait for the acknowledgement
{
{
break;
}
}

A simple to use receive function is available as well.

// read some data from remote location:
IfxHssl_Hssl_read(&hsslChannel[0], 0x70000000, IfxHssl_DataLength_32bit);
// wait for the acknowledgement
{
{
break;
}
}
// read data from the register
uint32 dataL = IfxHssl_Hssl_getReadData(&hsslChannel[0]);

Streaming Transfers

HSSL driver also supports streaming transfers of data as a memory block at both low and high speeds.

Preparing the target for streaming with the desired memory location where the data needs to be transfered

// choose a channel other than channel2 for register access //
// prepare streaming of single memory block //
IfxHssl_Hssl_prepareStream(&hsslChannel[0], 0x70000000, 10);

Stream the memory block

Usage Example:

// __attribute__ ((aligned(256))) uint32 txData[80]; // expected to be declared globally
// for single block streaming transfer //
// change the txData address to global address before passing it the API
// IfxHssl_Hssl_writeStream(&hssl, (uint32 *)IFXCPU_GLB_ADDR_DSPR(IfxCpu_getCoreId(), (uint32)txData), 10);
IfxHssl_Hssl_writeStream(&hssl, txData, 10);
// wait until the streaming is finished
{}