AM243x Motor Control SDK  09.01.00
APIs for HDSL Encoder

Introduction

Here is the list of APIs used for HDSL Encoder communication protocol

Data Structures

struct  HDSL_Interface
 
struct  HDSL_Config
 
struct  HDSL_CopyTable
 

Functions

void hdsl_enable_load_share_mode (void *pruCfg, uint32_t pruSlice)
 enable load share mode for multi-channel HDSL More...
 
HDSL_Handle HDSL_open (PRUICSS_Handle icssgHandle, uint32_t icssCore, uint8_t pruMode)
 Open HDSL handle for the specified core (interrupt mapping should already be completed) More...
 
void HDSL_iep_init (HDSL_Handle hdslHandle)
 Initialize IEP and Use OCP as IEP CLK src. More...
 
int HDSL_enable_sync_signal (uint8_t ES, uint32_t period)
 Enable IEP
*Enable SYNC0 and program pulse width
Enable cyclic mod
Program CMP1
TSR configuration
More...
 
uint64_t HDSL_get_pos (HDSL_Handle hdslHandle, int position_id)
 Calculate fast position,safe position1,safe position2. More...
 
uint8_t HDSL_get_qm (HDSL_Handle hdslHandle)
 Getting quality monitoring value. More...
 
uint16_t HDSL_get_events (HDSL_Handle hdslHandle)
 Taking values of High bytes event (EVENT_H) and Low bytes event(EVENT_L) More...
 
uint8_t HDSL_get_safe_events (HDSL_Handle hdslHandle)
 Taking values of Safe Event (EVENT_S) register. More...
 
uint16_t HDSL_get_online_status_d (HDSL_Handle hdslHandle)
 Taking values of Online Status D (ONLINE_STATUS_D) register. More...
 
uint16_t HDSL_get_online_status_1 (HDSL_Handle hdslHandle)
 Taking values of Online Status D (ONLINE_STATUS_D) register. More...
 
uint16_t HDSL_get_online_status_2 (HDSL_Handle hdslHandle)
 Taking values of Online Status D (ONLINE_STATUS_D) register. More...
 
uint8_t HDSL_get_sum (HDSL_Handle hdslHandle)
 Getting Summarized slave status. More...
 
uint8_t HDSL_get_acc_err_cnt (HDSL_Handle hdslHandle)
 Acceleration error counter. More...
 
uint8_t HDSL_get_rssi (HDSL_Handle hdslHandle)
 Read RSSI value. More...
 
int32_t HDSL_write_pc_short_msg (HDSL_Handle hdslHandle, uint8_t addr, uint8_t data, uint64_t timeout)
 Trigger a short message write operation using parameters channel. More...
 
int32_t HDSL_read_pc_short_msg (HDSL_Handle hdslHandle, uint8_t addr, uint8_t *data, uint64_t timeout)
 Trigger a short message read operation using parameters channel. More...
 
int32_t HDSL_write_pc_long_msg (HDSL_Handle hdslHandle, uint16_t addr, uint8_t offsetEnable, uint8_t addrType, uint8_t length, uint16_t offset, uint64_t timeout)
 Trigger a long message write operation using parameters channel. Call HDSL_write_pc_buffer before this to write the data to be sent using long message. More...
 
int32_t HDSL_read_pc_long_msg (HDSL_Handle hdslHandle, uint16_t addr, uint8_t offsetEnable, uint8_t addrType, uint8_t length, uint16_t offset, uint64_t timeout)
 Trigger a long message read operation using parameters channel If this API returns SystemP_SUCCESS, call HDSL_read_pc_buffer after this to read the data received using long message. More...
 
void HDSL_write_pc_buffer (HDSL_Handle hdslHandle, uint8_t buff_off, uint8_t data)
 Write Parameters channel buffer for different bytes(bytes 0-7) More...
 
uint8_t HDSL_read_pc_buffer (HDSL_Handle hdslHandle, uint8_t buff_off)
 Returns Parameters channel buffer for different bytes(bytes 0-7) More...
 
uint8_t HDSL_get_sync_ctrl (HDSL_Handle hdslHandle)
 Returns Synchronization control value. More...
 
void HDSL_set_sync_ctrl (HDSL_Handle hdslHandle, uint8_t val)
 Writes Synchronization control value. More...
 
uint8_t HDSL_get_master_qm (HDSL_Handle hdslHandle)
 Returns Quality monitoring value. More...
 
uint8_t HDSL_get_edges (HDSL_Handle hdslHandle)
 Returns Cable bit sampling time control. More...
 
uint8_t HDSL_get_delay (HDSL_Handle hdslHandle)
 Returns Run time delay of system cable and signal strength. More...
 
uint8_t HDSL_get_enc_id (HDSL_Handle hdslHandle, int byte)
 Read encoder id bytes(byte no. 0-2) More...
 
void HDSL_generate_memory_image (HDSL_Handle hdslHandle)
 Generates memory image. More...
 
void * HDSL_get_src_loc (HDSL_Handle hdslHandle)
 Get memory location for HDSL interface struct. More...
 
uint32_t HDSL_get_length (HDSL_Handle hdslHandle)
 Get size of memory used by HDSL interface struct. More...
 
int32_t HDSL_config_copy_table (HDSL_Handle hdslHandle, HDSL_CopyTable *copyTable)
 Configure the copy table entries for two overlayed firmware parts for channel 2. More...
 
int32_t HDSL_config_channel_mask (HDSL_Handle hdslHandle, uint8_t channelMask)
 Configure the channel mask. More...
 

Typedefs

typedef struct HDSL_Config_s * HDSL_Handle
 

Enumerations

enum  {
  linear, rotary, MENU_SAFE_POSITION, MENU_QUALITY_MONITORING,
  MENU_EVENTS, MENU_SUMMARY, MENU_ACC_ERR_CNT, MENU_RSSI,
  MENU_PC_SHORT_MSG_WRITE, MENU_PC_SHORT_MSG_READ, MENU_DIRECT_READ_RID0_LENGTH4, MENU_DIRECT_READ_RID81_LENGTH8,
  MENU_DIRECT_READ_RID81_LENGTH2, MENU_INDIRECT_WRITE_RID0_LENGTH8_OFFSET0, MENU_INDIRECT_WRITE_RID0_LENGTH8, MENU_HDSL_REG_INTO_MEMORY,
  MENU_LIMIT, MENU_INVALID
}
 

Macros

#define HDSL_MAX_CHANNELS   (3U)
 
#define CHANNEL_0_ENABLED   (1<<0)
 
#define CHANNEL_1_ENABLED   (1<<1)
 
#define CHANNEL_2_ENABLED   (1<<2)
 
#define MAX_WAIT   20000
 
#define HDSL_ICSSG0_INST   0U
 
#define HDSL_ICSSG1_INST   1U
 
#define HWREG(x)    (*((volatile uint32_t *)(x)))
 
#define HWREGB(x)    (*((volatile uint8_t *)(x)))
 
#define HWREGH(x)    (*((volatile uint16_t *)(x)))
 
#define SYNCEVENT_INTRTR_IN_27   27
 
#define SYNCEVT_RTR_SYNC28_EVT   0x64
 
#define SYNCEVT_RTR_SYNC29_EVT   0x68
 
#define SYNCEVT_RTR_SYNC30_EVT   0x6C
 
#define SYNCEVT_RTR_SYNC31_EVT   0x70
 
#define SYNCEVT_RTR_SYNC10_EVT   0x2C
 

HDSL Long Message Addressing Types

#define HDSL_LONG_MSG_ADDR_DIRECT   (0U)
 Direct addressing of long messages. More...
 
#define HDSL_LONG_MSG_ADDR_INDIRECT   (1U)
 Indirect addressing of long messages. More...
 

HDSL Long Message Addressing with/without offset

#define HDSL_LONG_MSG_ADDR_WITHOUT_OFFSET   (0U)
 Addressing of long messages without offset. More...
 
#define HDSL_LONG_MSG_ADDR_WITH_OFFSET   (1U)
 Addressing of long messages with offset. More...
 

HDSL Long Message Data Lengths

#define HDSL_LONG_MSG_LENGTH_0   (0U)
 No data bytes. More...
 
#define HDSL_LONG_MSG_LENGTH_2   (1U)
 2 data bytes More...
 
#define HDSL_LONG_MSG_LENGTH_4   (2U)
 4 data bytes More...
 
#define HDSL_LONG_MSG_LENGTH_8   (3U)
 8 data bytes More...
 

Macro Definition Documentation

◆ HDSL_MAX_CHANNELS

#define HDSL_MAX_CHANNELS   (3U)

◆ CHANNEL_0_ENABLED

#define CHANNEL_0_ENABLED   (1<<0)

◆ CHANNEL_1_ENABLED

#define CHANNEL_1_ENABLED   (1<<1)

◆ CHANNEL_2_ENABLED

#define CHANNEL_2_ENABLED   (1<<2)

◆ HDSL_LONG_MSG_ADDR_DIRECT

#define HDSL_LONG_MSG_ADDR_DIRECT   (0U)

Direct addressing of long messages.

◆ HDSL_LONG_MSG_ADDR_INDIRECT

#define HDSL_LONG_MSG_ADDR_INDIRECT   (1U)

Indirect addressing of long messages.

◆ HDSL_LONG_MSG_ADDR_WITHOUT_OFFSET

#define HDSL_LONG_MSG_ADDR_WITHOUT_OFFSET   (0U)

Addressing of long messages without offset.

◆ HDSL_LONG_MSG_ADDR_WITH_OFFSET

#define HDSL_LONG_MSG_ADDR_WITH_OFFSET   (1U)

Addressing of long messages with offset.

◆ HDSL_LONG_MSG_LENGTH_0

#define HDSL_LONG_MSG_LENGTH_0   (0U)

No data bytes.

◆ HDSL_LONG_MSG_LENGTH_2

#define HDSL_LONG_MSG_LENGTH_2   (1U)

2 data bytes

◆ HDSL_LONG_MSG_LENGTH_4

#define HDSL_LONG_MSG_LENGTH_4   (2U)

4 data bytes

◆ HDSL_LONG_MSG_LENGTH_8

#define HDSL_LONG_MSG_LENGTH_8   (3U)

8 data bytes

◆ MAX_WAIT

#define MAX_WAIT   20000

◆ HDSL_ICSSG0_INST

#define HDSL_ICSSG0_INST   0U

◆ HDSL_ICSSG1_INST

#define HDSL_ICSSG1_INST   1U

◆ HWREG

#define HWREG (   x)     (*((volatile uint32_t *)(x)))

◆ HWREGB

#define HWREGB (   x)     (*((volatile uint8_t *)(x)))

◆ HWREGH

#define HWREGH (   x)     (*((volatile uint16_t *)(x)))

◆ SYNCEVENT_INTRTR_IN_27

#define SYNCEVENT_INTRTR_IN_27   27

◆ SYNCEVT_RTR_SYNC28_EVT

#define SYNCEVT_RTR_SYNC28_EVT   0x64

◆ SYNCEVT_RTR_SYNC29_EVT

#define SYNCEVT_RTR_SYNC29_EVT   0x68

◆ SYNCEVT_RTR_SYNC30_EVT

#define SYNCEVT_RTR_SYNC30_EVT   0x6C

◆ SYNCEVT_RTR_SYNC31_EVT

#define SYNCEVT_RTR_SYNC31_EVT   0x70

◆ SYNCEVT_RTR_SYNC10_EVT

#define SYNCEVT_RTR_SYNC10_EVT   0x2C

Typedef Documentation

◆ HDSL_Handle

typedef struct HDSL_Config_s* HDSL_Handle

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
linear 
rotary 
MENU_SAFE_POSITION 
MENU_QUALITY_MONITORING 
MENU_EVENTS 
MENU_SUMMARY 
MENU_ACC_ERR_CNT 
MENU_RSSI 
MENU_PC_SHORT_MSG_WRITE 
MENU_PC_SHORT_MSG_READ 
MENU_DIRECT_READ_RID0_LENGTH4 
MENU_DIRECT_READ_RID81_LENGTH8 
MENU_DIRECT_READ_RID81_LENGTH2 
MENU_INDIRECT_WRITE_RID0_LENGTH8_OFFSET0 
MENU_INDIRECT_WRITE_RID0_LENGTH8 
MENU_HDSL_REG_INTO_MEMORY 
MENU_LIMIT 
MENU_INVALID 

Function Documentation

◆ hdsl_enable_load_share_mode()

void hdsl_enable_load_share_mode ( void *  pruCfg,
uint32_t  pruSlice 
)

enable load share mode for multi-channel HDSL

Parameters
[in]pruCfgCfg base register address
[in]pruSlicePRU slice, 1 for PRU1 and 0 for PRU0

◆ HDSL_open()

HDSL_Handle HDSL_open ( PRUICSS_Handle  icssgHandle,
uint32_t  icssCore,
uint8_t  pruMode 
)

Open HDSL handle for the specified core (interrupt mapping should already be completed)

Parameters
[in]icssgHandlePRUICSS_Handle for the ICSS instance
[in]icssCoreCore to map in ICSSG instance
[in]pruMode0 for load share mode disabled, 1 for load share mode enabled
Return values
HDSL_Handle

◆ HDSL_iep_init()

void HDSL_iep_init ( HDSL_Handle  hdslHandle)

Initialize IEP and Use OCP as IEP CLK src.

Parameters
[in]hdslHandle

◆ HDSL_enable_sync_signal()

int HDSL_enable_sync_signal ( uint8_t  ES,
uint32_t  period 
)

Enable IEP
*Enable SYNC0 and program pulse width
Enable cyclic mod
Program CMP1
TSR configuration

Parameters
[in]ES
[in]period
Return values
1for successful enable sync signal

◆ HDSL_get_pos()

uint64_t HDSL_get_pos ( HDSL_Handle  hdslHandle,
int  position_id 
)

Calculate fast position,safe position1,safe position2.

Parameters
[in]hdslHandle
[in]position_id
Return values
positionvalue in integer for successful position return, -1 for error in position return

◆ HDSL_get_qm()

uint8_t HDSL_get_qm ( HDSL_Handle  hdslHandle)

Getting quality monitoring value.

Parameters
[in]hdslHandle
Return values
8bit integer QM value

◆ HDSL_get_events()

uint16_t HDSL_get_events ( HDSL_Handle  hdslHandle)

Taking values of High bytes event (EVENT_H) and Low bytes event(EVENT_L)

Parameters
[in]hdslHandle
Return values
16bit integer concatenated values of both EVENT_H,EVENT_L

◆ HDSL_get_safe_events()

uint8_t HDSL_get_safe_events ( HDSL_Handle  hdslHandle)

Taking values of Safe Event (EVENT_S) register.

Parameters
[in]hdslHandle
Return values
8bit integer values of EVENT_S

◆ HDSL_get_online_status_d()

uint16_t HDSL_get_online_status_d ( HDSL_Handle  hdslHandle)

Taking values of Online Status D (ONLINE_STATUS_D) register.

Parameters
[in]hdslHandle
Return values
16bit integer value of ONLINE_STATUS_D

◆ HDSL_get_online_status_1()

uint16_t HDSL_get_online_status_1 ( HDSL_Handle  hdslHandle)

Taking values of Online Status D (ONLINE_STATUS_D) register.

Parameters
[in]hdslHandle
Return values
16bit integer value of ONLINE_STATUS_D

◆ HDSL_get_online_status_2()

uint16_t HDSL_get_online_status_2 ( HDSL_Handle  hdslHandle)

Taking values of Online Status D (ONLINE_STATUS_D) register.

Parameters
[in]hdslHandle
Return values
16bit integer value of ONLINE_STATUS_D

◆ HDSL_get_sum()

uint8_t HDSL_get_sum ( HDSL_Handle  hdslHandle)

Getting Summarized slave status.

Parameters
[in]hdslHandle
Return values
8bit integer value of summarized status

◆ HDSL_get_acc_err_cnt()

uint8_t HDSL_get_acc_err_cnt ( HDSL_Handle  hdslHandle)

Acceleration error counter.

Parameters
[in]hdslHandle
Return values
8bit integer value of acceleration error counter

◆ HDSL_get_rssi()

uint8_t HDSL_get_rssi ( HDSL_Handle  hdslHandle)

Read RSSI value.

Parameters
[in]hdslHandle
Return values
8bit RSSI integer value

◆ HDSL_write_pc_short_msg()

int32_t HDSL_write_pc_short_msg ( HDSL_Handle  hdslHandle,
uint8_t  addr,
uint8_t  data,
uint64_t  timeout 
)

Trigger a short message write operation using parameters channel.

Parameters
[in]hdslHandle
[in]addrAddress
[in]dataData
[in]timeoutTimeout in microseconds
Returns
SystemP_SUCCESS in case of success, SystemP_TIMEOUT in case of timeout

◆ HDSL_read_pc_short_msg()

int32_t HDSL_read_pc_short_msg ( HDSL_Handle  hdslHandle,
uint8_t  addr,
uint8_t *  data,
uint64_t  timeout 
)

Trigger a short message read operation using parameters channel.

Parameters
[in]hdslHandle
[in]addrAddress
[in]dataPointer to data buffer where read data will be stored
[in]timeoutTimeout in microseconds
Returns
SystemP_SUCCESS in case of success, SystemP_TIMEOUT in case of timeout

◆ HDSL_write_pc_long_msg()

int32_t HDSL_write_pc_long_msg ( HDSL_Handle  hdslHandle,
uint16_t  addr,
uint8_t  offsetEnable,
uint8_t  addrType,
uint8_t  length,
uint16_t  offset,
uint64_t  timeout 
)

Trigger a long message write operation using parameters channel. Call HDSL_write_pc_buffer before this to write the data to be sent using long message.

Parameters
[in]hdslHandle
[in]addr10 bit address for long message
[in]offsetEnableAddressing with offset enable/disable from HDSL_LongMessageAddrOffsetModes
[in]addrTypeAddressing Type from HDSL_LongMessageAddrTypes
[in]lengthLength from HDSL_LongMessageLengths
[in]offset15 bit address offset for long message (if offset is enabled in offsetEnable parameter)
[in]timeoutTimeout in microseconds
Returns
SystemP_SUCCESS in case of success, SystemP_FAILURE in case of error, SystemP_TIMEOUT in case of timeout

◆ HDSL_read_pc_long_msg()

int32_t HDSL_read_pc_long_msg ( HDSL_Handle  hdslHandle,
uint16_t  addr,
uint8_t  offsetEnable,
uint8_t  addrType,
uint8_t  length,
uint16_t  offset,
uint64_t  timeout 
)

Trigger a long message read operation using parameters channel If this API returns SystemP_SUCCESS, call HDSL_read_pc_buffer after this to read the data received using long message.

Parameters
[in]hdslHandle
[in]addr10 bit address for long message
[in]offsetEnableAddressing with offset enable/disable from HDSL_LongMessageAddrOffsetModes
[in]addrTypeAddressing Type from HDSL_LongMessageAddrTypes
[in]lengthLength from HDSL_LongMessageLengths
[in]offset15 bit address offset for long message
[in]timeoutTimeout in microseconds
Returns
SystemP_SUCCESS in case of success, SystemP_FAILURE in case of error, SystemP_TIMEOUT in case of timeout

◆ HDSL_write_pc_buffer()

void HDSL_write_pc_buffer ( HDSL_Handle  hdslHandle,
uint8_t  buff_off,
uint8_t  data 
)

Write Parameters channel buffer for different bytes(bytes 0-7)

Parameters
[in]hdslHandle
[in]buff_off
[in]data

◆ HDSL_read_pc_buffer()

uint8_t HDSL_read_pc_buffer ( HDSL_Handle  hdslHandle,
uint8_t  buff_off 
)

Returns Parameters channel buffer for different bytes(bytes 0-7)

Parameters
[in]hdslHandle
[in]buff_off
Return values
8bit integer value of PC_BUFFER from hdsl interface

◆ HDSL_get_sync_ctrl()

uint8_t HDSL_get_sync_ctrl ( HDSL_Handle  hdslHandle)

Returns Synchronization control value.

Parameters
[in]hdslHandle
Return values
8bit integer value of SYNC_CTRL from hdsl interface

◆ HDSL_set_sync_ctrl()

void HDSL_set_sync_ctrl ( HDSL_Handle  hdslHandle,
uint8_t  val 
)

Writes Synchronization control value.

Parameters
[in]hdslHandle
[in]val

◆ HDSL_get_master_qm()

uint8_t HDSL_get_master_qm ( HDSL_Handle  hdslHandle)

Returns Quality monitoring value.

Parameters
[in]hdslHandle
Return values
8bit integer value of MASTER_QM from hdsl interface

◆ HDSL_get_edges()

uint8_t HDSL_get_edges ( HDSL_Handle  hdslHandle)

Returns Cable bit sampling time control.

Parameters
[in]hdslHandle
Return values
8bit integer value of EDGES from hdsl interface

◆ HDSL_get_delay()

uint8_t HDSL_get_delay ( HDSL_Handle  hdslHandle)

Returns Run time delay of system cable and signal strength.

Parameters
[in]hdslHandle
Return values
8bit integer value of DELAY from hdsl interface

◆ HDSL_get_enc_id()

uint8_t HDSL_get_enc_id ( HDSL_Handle  hdslHandle,
int  byte 
)

Read encoder id bytes(byte no. 0-2)

Parameters
[in]hdslHandle
[in]byte
Return values
8bit encoder bytes data from hdsl interface

◆ HDSL_generate_memory_image()

void HDSL_generate_memory_image ( HDSL_Handle  hdslHandle)

Generates memory image.

Parameters
[in]hdslHandle

◆ HDSL_get_src_loc()

void* HDSL_get_src_loc ( HDSL_Handle  hdslHandle)

Get memory location for HDSL interface struct.

Parameters
[in]hdslHandle
Return values
Pointercontaining base memeory address

◆ HDSL_get_length()

uint32_t HDSL_get_length ( HDSL_Handle  hdslHandle)

Get size of memory used by HDSL interface struct.

Parameters
[in]hdslHandle
Return values
Sizeof the struct

◆ HDSL_config_copy_table()

int32_t HDSL_config_copy_table ( HDSL_Handle  hdslHandle,
HDSL_CopyTable copyTable 
)

Configure the copy table entries for two overlayed firmware parts for channel 2.

Parameters
[in]hdslHandle
[in]copyTable
Returns
SystemP_SUCCESS in case of success, SystemP_FAILURE in case of error

◆ HDSL_config_channel_mask()

int32_t HDSL_config_channel_mask ( HDSL_Handle  hdslHandle,
uint8_t  channelMask 
)

Configure the channel mask.

Parameters
[in]hdslHandle
[in]channelMask
Returns
SystemP_SUCCESS in case of success, SystemP_FAILURE in case of error