HPM SDK
HPMicro Software Development Kit
PLB driver APIs

PLB driver APIs. More...

Data Structures

union  plb_type_a_truth_t
 PLB truth table configuration unit. More...
 

Macros

#define PLB_SLICE_MASK   (0xf)
 
#define PLB_SLICE_HIGH_BIT_MASK_SET(slice)   (PLB_SLICE_MASK << ((slice - plb_type_b_slice_8) << 2))
 
#define PLB_SLICE_HIGH_BIT_SHIFT(slice)   ((slice - plb_type_b_slice_8) << 2)
 
#define PLB_SLICE_LOW_BIT_MASK_SET(slice)   (PLB_SLICE_MASK << (slice << 2))
 
#define PLB_SLICE_LOW_BIT_SHIFT(slice)   (slice << 2)
 

Typedefs

typedef enum plb_chn plb_chn_t
 plb channels More...
 
typedef enum plb_type_a_lut_num plb_type_a_lut_num_t
 PLB look-up table unit. More...
 
typedef enum plb_type_b_lut_slice plb_type_b_lut_slice_t
 Index of slice. More...
 
typedef enum plb_type_b_slice_opt plb_type_b_slice_opt_t
 Configuration of slice. More...
 
typedef enum plb_type_b_cmp plb_type_b_cmp_t
 Comparator index. More...
 
typedef enum plb_type_b_cmp_mode plb_type_b_cmp_mode_t
 Comparator operation. More...
 

Enumerations

enum  plb_chn
 plb channels More...
 
enum  plb_type_a_lut_num
 PLB look-up table unit. More...
 
enum  plb_type_b_lut_slice {
  plb_type_b_slice_0 = 0 , plb_type_b_slice_1 = 1 , plb_type_b_slice_2 = 2 , plb_type_b_slice_3 = 3 ,
  plb_type_b_slice_4 = 4 , plb_type_b_slice_5 = 5 , plb_type_b_slice_6 = 6 , plb_type_b_slice_7 = 7 ,
  plb_type_b_slice_8 = 8 , plb_type_b_slice_9 = 9 , plb_type_b_slice_10 = 10 , plb_type_b_slice_11 = 11 ,
  plb_type_b_slice_12 = 12 , plb_type_b_slice_13 = 13 , plb_type_b_slice_14 = 14 , plb_type_b_slice_15 = 15
}
 Index of slice. More...
 
enum  plb_type_b_slice_opt {
  plb_slice_opt_keep = 0 , plb_slice_opt_get_cmp0_val = 1 , plb_slice_opt_get_cmp1_val = 2 , plb_slice_opt_get_cmp2_val = 3 ,
  plb_slice_opt_add_one = 4 , plb_slice_opt_add_two = 5 , plb_slice_opt_sub_one = 6 , plb_slice_opt_sub_two = 7 ,
  plb_slice_opt_shift_left = 4 << 8 , plb_slice_opt_shift_left_add_one = 5 << 8 , plb_slice_opt_shift_right = 6 << 8 , plb_slice_opt_shift_right_add_one = 7 << 8
}
 Configuration of slice. More...
 
enum  plb_type_b_cmp { plb_type_b_cmp0 = PLB_TYPE_B_CMP_0 , plb_type_b_cmp1 = PLB_TYPE_B_CMP_1 , plb_type_b_cmp2 = PLB_TYPE_B_CMP_2 , plb_type_b_cmp3 = PLB_TYPE_B_CMP_3 }
 Comparator index. More...
 
enum  plb_type_b_cmp_mode {
  plb_cmp_mode_out_zero = 0 , plb_cmp_mode_out_one = 1 , plb_cmp_mode_gt = 2 , plb_cmp_mode_lt = 3 ,
  plb_cmp_mode_eq = 4 , plb_cmp_mode_ne = 5 , plb_cmp_mode_ge = 6 , plb_cmp_mode_le = 7 ,
  plb_cmp_mode_and_mask = 10 , plb_cmp_mode_or_mask = 11 , plb_cmp_mode_xor_mask = 12 , plb_cmp_mode_nand_mask = 13 ,
  plb_cmp_mode_nor_mask = 14 , plb_cmp_mode_xnor_mask = 15
}
 Comparator operation. More...
 

Functions

static void plb_type_a_set_lut (PLB_Type *plb, plb_chn_t chn, plb_type_a_lut_num_t lut_num, plb_type_a_truth_t *truth)
 Configuring the truth table for lookup tables. More...
 
static void plb_type_a_inject_by_sw (PLB_Type *plb, plb_chn_t chn, uint8_t inject_val)
 The software injects a cycle value into the TYPE A channel. More...
 
static void plb_type_b_set_cmp_val (PLB_Type *plb, plb_chn_t chn, plb_type_b_cmp_t cmp_index, uint32_t val)
 Configure the value of the CMP. More...
 
static void plb_type_b_set_cmp_mode (PLB_Type *plb, plb_chn_t chn, plb_type_b_cmp_t cmp_index, plb_type_b_cmp_mode_t cmp_mode)
 Setting the mode of the CMP. More...
 
static void plb_type_b_inject_by_sw (PLB_Type *plb, plb_chn_t chn, uint32_t val)
 Software injection values. More...
 
static uint32_t plb_type_b_get_counter (PLB_Type *plb, plb_chn_t chn)
 Get the counter value for PLB Type B. More...
 
void plb_type_b_set_lut (PLB_Type *plb, plb_chn_t chn, plb_type_b_lut_slice_t slice, plb_type_b_slice_opt_t opt)
 Configuring the PLB type_b's lookup table. More...
 
void plb_type_b_set_lut_range_mask (PLB_Type *plb, plb_chn_t chn, uint16_t mask, plb_type_b_slice_opt_t opt)
 Batch set plb lut b type data, the unit corresponding to the bit marked with a mask of 1 is configured. More...
 
void plb_type_b_set_all_slice (PLB_Type *plb, plb_chn_t chn, plb_type_b_slice_opt_t opt)
 Configure all lut to the same configuration. More...
 

Detailed Description

PLB driver APIs.

Macro Definition Documentation

◆ PLB_SLICE_HIGH_BIT_MASK_SET

#define PLB_SLICE_HIGH_BIT_MASK_SET (   slice)    (PLB_SLICE_MASK << ((slice - plb_type_b_slice_8) << 2))

◆ PLB_SLICE_HIGH_BIT_SHIFT

#define PLB_SLICE_HIGH_BIT_SHIFT (   slice)    ((slice - plb_type_b_slice_8) << 2)

◆ PLB_SLICE_LOW_BIT_MASK_SET

#define PLB_SLICE_LOW_BIT_MASK_SET (   slice)    (PLB_SLICE_MASK << (slice << 2))

◆ PLB_SLICE_LOW_BIT_SHIFT

#define PLB_SLICE_LOW_BIT_SHIFT (   slice)    (slice << 2)

◆ PLB_SLICE_MASK

#define PLB_SLICE_MASK   (0xf)

Typedef Documentation

◆ plb_chn_t

typedef enum plb_chn plb_chn_t

#include <drivers/inc/hpm_plb_drv.h>

plb channels

◆ plb_type_a_lut_num_t

#include <drivers/inc/hpm_plb_drv.h>

PLB look-up table unit.

◆ plb_type_b_cmp_mode_t

#include <drivers/inc/hpm_plb_drv.h>

Comparator operation.

◆ plb_type_b_cmp_t

#include <drivers/inc/hpm_plb_drv.h>

Comparator index.

◆ plb_type_b_lut_slice_t

◆ plb_type_b_slice_opt_t

#include <drivers/inc/hpm_plb_drv.h>

Configuration of slice.

Enumeration Type Documentation

◆ plb_chn

enum plb_chn

#include <drivers/inc/hpm_plb_drv.h>

plb channels

◆ plb_type_a_lut_num

#include <drivers/inc/hpm_plb_drv.h>

PLB look-up table unit.

◆ plb_type_b_cmp

#include <drivers/inc/hpm_plb_drv.h>

Comparator index.

Enumerator
plb_type_b_cmp0 
plb_type_b_cmp1 
plb_type_b_cmp2 
plb_type_b_cmp3 

◆ plb_type_b_cmp_mode

#include <drivers/inc/hpm_plb_drv.h>

Comparator operation.

Enumerator
plb_cmp_mode_out_zero 

output zero

plb_cmp_mode_out_one 

output one

plb_cmp_mode_gt 

Data unit greater than cmp output one, otherwise output zero

plb_cmp_mode_lt 

Data unit less than cmp output one, otherwise output zero

plb_cmp_mode_eq 

Data unit equal to cmp output one, otherwise output zero

plb_cmp_mode_ne 

Data unit not equal to cmp output one, otherwise output zero

plb_cmp_mode_ge 

Data unit greater than or equal to cmp output one, otherwise output zero

plb_cmp_mode_le 

Data unit less than or equal to cmp output one, otherwise output zero

plb_cmp_mode_and_mask 

The data cell corresponding to the bit set to one by cmp is and

plb_cmp_mode_or_mask 

The data cell corresponding to the bit set to one by cmp is or

plb_cmp_mode_xor_mask 

The data cell corresponding to the bit set to one by cmp is xor

plb_cmp_mode_nand_mask 

The data cell corresponding to the bit set to one by cmp is nand

plb_cmp_mode_nor_mask 

The data cell corresponding to the bit set to one by cmp is nor

plb_cmp_mode_xnor_mask 

The data cell corresponding to the bit set to one by cmp is xnor

◆ plb_type_b_lut_slice

#include <drivers/inc/hpm_plb_drv.h>

Index of slice.

Enumerator
plb_type_b_slice_0 
plb_type_b_slice_1 
plb_type_b_slice_2 
plb_type_b_slice_3 
plb_type_b_slice_4 
plb_type_b_slice_5 
plb_type_b_slice_6 
plb_type_b_slice_7 
plb_type_b_slice_8 
plb_type_b_slice_9 
plb_type_b_slice_10 
plb_type_b_slice_11 
plb_type_b_slice_12 
plb_type_b_slice_13 
plb_type_b_slice_14 
plb_type_b_slice_15 

◆ plb_type_b_slice_opt

#include <drivers/inc/hpm_plb_drv.h>

Configuration of slice.

Enumerator
plb_slice_opt_keep 

The data unit keeps the value of the previous cycle

plb_slice_opt_get_cmp0_val 

The data unit will take the value of the cmp0 register as the value for the next cycle

plb_slice_opt_get_cmp1_val 

The data unit will take the value of the cmp1 register as the value for the next cycle

plb_slice_opt_get_cmp2_val 

The data unit will take the value of the cmp2 register as the value for the next cycle

plb_slice_opt_add_one 

The next cycle value of the data cell is the current value plus 1

plb_slice_opt_add_two 

The next cycle value of the data cell is the current value plus 2

plb_slice_opt_sub_one 

The next cycle value of the data cell is the current value minus 1

plb_slice_opt_sub_two 

The next cycle value of the data cell is the current value minus 2

plb_slice_opt_shift_left 

The value of the next cycle of the data cell is shifted one place to the left of the current value

plb_slice_opt_shift_left_add_one 

The next cycle value of the data cell is the current value shifted one place to the left, with the lower bit complemented by one

plb_slice_opt_shift_right 

The value of the next cycle of the data cell is shifted one place to the right of the current value

plb_slice_opt_shift_right_add_one 

The next cycle value of the data cell is the current value shifted one place to the right, with the lower bit complemented by one

Function Documentation

◆ plb_type_a_inject_by_sw()

static void plb_type_a_inject_by_sw ( PLB_Type plb,
plb_chn_t  chn,
uint8_t  inject_val 
)
inlinestatic

#include <drivers/inc/hpm_plb_drv.h>

The software injects a cycle value into the TYPE A channel.

Parameters
plbPLB_Type plb base
chnplb_chn_t
inject_valInjected values

◆ plb_type_a_set_lut()

static void plb_type_a_set_lut ( PLB_Type plb,
plb_chn_t  chn,
plb_type_a_lut_num_t  lut_num,
plb_type_a_truth_t truth 
)
inlinestatic

#include <drivers/inc/hpm_plb_drv.h>

Configuring the truth table for lookup tables.

Parameters
plbPLB_Type plb base
chnplb_chn_t
lut_numplb_type_a_lut_num_t
truthplb_type_a_truth_t

◆ plb_type_b_get_counter()

static uint32_t plb_type_b_get_counter ( PLB_Type plb,
plb_chn_t  chn 
)
inlinestatic

#include <drivers/inc/hpm_plb_drv.h>

Get the counter value for PLB Type B.

Retrieve the value of the SW_INJECT field for the specified channel from the given PLB Type B structure.

Parameters
plbPointer to the PLB Type B structure
chnChannel number
Returns
The value of the SW_INJECT field for the corresponding channel

◆ plb_type_b_inject_by_sw()

static void plb_type_b_inject_by_sw ( PLB_Type plb,
plb_chn_t  chn,
uint32_t  val 
)
inlinestatic

#include <drivers/inc/hpm_plb_drv.h>

Software injection values.

Parameters
plbPLB_Type plb base
chnplb_chn_t
valvalue

◆ plb_type_b_set_all_slice()

void plb_type_b_set_all_slice ( PLB_Type plb,
plb_chn_t  chn,
plb_type_b_slice_opt_t  opt 
)

#include <drivers/inc/hpm_plb_drv.h>

Configure all lut to the same configuration.

Parameters
plbPLB_Type plb base
chnplb_chn_t
optplb_type_b_slice_opt_t

◆ plb_type_b_set_cmp_mode()

static void plb_type_b_set_cmp_mode ( PLB_Type plb,
plb_chn_t  chn,
plb_type_b_cmp_t  cmp_index,
plb_type_b_cmp_mode_t  cmp_mode 
)
inlinestatic

#include <drivers/inc/hpm_plb_drv.h>

Setting the mode of the CMP.

Parameters
plbPLB_Type plb base
chnplb_chn_t
cmp_indexplb_type_b_cmp_t
cmp_modeplb_type_b_cmp_mode_t

◆ plb_type_b_set_cmp_val()

static void plb_type_b_set_cmp_val ( PLB_Type plb,
plb_chn_t  chn,
plb_type_b_cmp_t  cmp_index,
uint32_t  val 
)
inlinestatic

#include <drivers/inc/hpm_plb_drv.h>

Configure the value of the CMP.

Parameters
plbPLB_Type plb base
chnplb_chn_t
cmp_indexplb_type_b_cmp_t
valCMP value

◆ plb_type_b_set_lut()

void plb_type_b_set_lut ( PLB_Type plb,
plb_chn_t  chn,
plb_type_b_lut_slice_t  slice,
plb_type_b_slice_opt_t  opt 
)

#include <drivers/inc/hpm_plb_drv.h>

Configuring the PLB type_b's lookup table.

Parameters
plbPLB_Type plb base
chnplb_chn_t
sliceplb_type_b_lut_slice_t
optplb_type_b_slice_opt_t

◆ plb_type_b_set_lut_range_mask()

void plb_type_b_set_lut_range_mask ( PLB_Type plb,
plb_chn_t  chn,
uint16_t  mask,
plb_type_b_slice_opt_t  opt 
)

#include <drivers/inc/hpm_plb_drv.h>

Batch set plb lut b type data, the unit corresponding to the bit marked with a mask of 1 is configured.

Parameters
plbPLB_Type plb base
chnplb_chn_t
maskbit16
optplb_type_b_slice_opt_t