PSOC E8XXGP Device Support Library

| PSOC E8XXGP Device Support Library

Data Structures | Typedefs
Structures
NNLITE HW Accelerator KERNEL LIB

## General Description

## Data Structures
struct | cy_nn_conv_params_t
| Convolution parameter structure. More...
struct | cy_nn_fc_params_t
| FC parameter structure. More...
struct | cy_nn_pool_params_t
| Average pool parameter structure. More...
struct | cy_nn_scaling_t
| Pointwise operation parameter structure. More...
struct | cy_nn_pwise_binary_params_t
| Pointwise binary operation parameter structure. More...
struct | cy_nn_pwise_unary_params_t
| Pointwise unary operation parameter structure. More...
struct | cy_nn_layernorm_params_t
| Layer Normmalization operation parameter structure. More...
struct | cy_nn_dims_t
| dimension structure for input, output & filter dimension array of tensor, ordering of dimension should be same as TF model file, e.g. More...
struct | cy_nn_act_intrpl_param_t
| activation parameter structure More...
struct | cy_nnlite_dma_queue_config_t
| nnlite dma descriptor queue structure, use to maintain DMA channel info and DMA Queue Descriptor pointers More...
struct | cy_kernel_config_t
| nnlite kernel config structure, to be filled passed in kernel Init function to setup function pointers More...

## Typedefs
typedef void(* | Cy_NNLite_CompletionCallback) (void *cbArg, cy_en_nnlite_status_t status)
| typedef for callback function, called from interrupt handler, to signal completion of layer, as called from interrupt handler callback function should not call any blocking function and should have minimum code required for completion signal More...
typedef uint32_t(* | Cy_NNLite_MutexCreate) (void *ptr)
| typedef for Mutex create function
typedef uint32_t(* | Cy_NNLite_MutexDelete) (void *ptr)
| typedef for Mutex delete function
typedef uint32_t(* | Cy_NNLite_MutexLock) (void *ptr)
| typedef for mutex lock function
typedef uint32_t(* | Cy_NNLite_MutexUnlock) (void *ptr)
| typedef for mutex unlock function
typedef uint32_t(* | Cy_NNLite_SemCreate) (void *ptr)
| typedef for sem create function
typedef uint32_t(* | Cy_NNLite_SemDelete) (void *ptr)
| typedef for sem delete function
typedef uint32_t(* | Cy_NNLite_SemWait) (void *ptr)
| typedef for sem wait function
typedef uint32_t(* | Cy_NNLite_SemGive) (void *ptr)
| typedef for sem give function
typedef void(* | Cy_NNLite_LpmLock) (void)
| typedef for LPM lock function
typedef void(* | Cy_NNLite_LpmUnlock) (void)
| typedef for LPM unlock function
typedef void(* | Cy_NNLite_ProfileStart) (void *ptr)
| typedef for profile start function, called at start of API
typedef void(* | Cy_NNLite_ProfileGetCount) (void *ptr, uint32_t profilePoint)
| typedef for profile get count at intermediate profile point
typedef void(* | Cy_NNLite_ProfileStop) (void *ptr)
| typedef for profile end function called at end of API

## Data Structure Documentation

## ◆ cy_nn_conv_params_t

struct cy_nn_conv_params_t

Data Fields
int16_t | padValue | padding value for activation
uint8_t | padWidth | padding width - padded columns before data start
uint8_t | padHeight | padding height - padded rows before data start
uint8_t | strideCol | stride column
uint8_t | strideRow | stride Row
int32_t | inputOffset | activation value offset
int32_t | outputOffset | output offset value
int32_t | filterOffset | filter offset value
const float * | outScalingFactor | per axis output scaling factor
cy_nnlite_clipping_t | outClipping | output value clipping
cy_en_nnlite_activation_size_t | act_size | Selection activation data-path width.
bool | sparseWeights | Packed Sparse weights.
int8_t * | scratchBuf | scratch buffer for convolution layer, will be used\ DMA descriptors in DMA mode

## ◆ cy_nn_fc_params_t

struct cy_nn_fc_params_t

Data Fields
int32_t | inputOffset | activation value offset
int32_t | outputOffset | output offset vaLUE
int32_t | filterOffset | Filter offset value.
float | outScalingFactor | output scaling factor
cy_nnlite_clipping_t | outClipping | output value clipping
cy_en_nnlite_activation_size_t | inputSize | Input data precision.
cy_en_nnlite_output_size_t | outputSize | Output precision
bool | sparseWeights | Packed Sparse weights.
int8_t * | scratchBuf | scratch buffer for fc layer, will be used for for\ DMA descriptors and MEMIO configuration in DMA mode

## ◆ cy_nn_pool_params_t

struct cy_nn_pool_params_t

Data Fields
uint8_t | strideCol | stride column
uint8_t | strideRow | stride row
cy_nnlite_clipping_t | outClipping | output value clipping
cy_en_nnlite_activation_size_t | act_size | Selection activation data-path width.
int8_t * | scratchBuf | DMA descriptors and MEMIO configuration in DMA mode.

## ◆ cy_nn_scaling_t

struct cy_nn_scaling_t

Data Fields
float | pre_mac_scale | Scale factor to apply to (one) MAC input.
float | pre_act_scale | Scale factor to apply prior to activation function (if any)
cy_en_nnlite_input_rescaling_t | pre_mac_scaling_mode | Mode for MAC input scaling (off, weights, activations)
cy_en_nnlite_output_rescaling_t | pre_act_scaling_mode | Mode for pre-activation scaling (off, per-tensor, per-channels)
float | post_act_scale | Scaling to apply to activation output ("output rescaling factor")
int8_t * | scratchBuf | DMA descriptors and MEMIO configuration in DMA mode.

## ◆ cy_nn_pwise_binary_params_t

struct cy_nn_pwise_binary_params_t

Data Fields
int32_t | lhsOffset | Zero-point for lhs values.
int32_t | rhsOffset | Zero-point for rhs values.
int32_t | outputOffset | Zero-point to use for output.
cy_nnlite_clipping_t | outClipping | output value clipping
cy_en_nnlite_activation_size_t | inputSize | Input data precision.
cy_en_nnlite_output_size_t | outputSize | Output precision
cy_nn_scaling_t | scaling | Pointwise operation parameter.
int8_t * | scratchBuf | DMA descriptors and MEMIO configuration in DMA mode.

## ◆ cy_nn_pwise_unary_params_t

struct cy_nn_pwise_unary_params_t

Data Fields
float | inScale | Pre-scaling to apply to lhs before op (must be 1.0 if rhsScale != 1.0)
int32_t | inOffset | Zero-point for lhs values.
float | outScale | Scale factor to apply to results of op values ()
int32_t | outOffset | Zero-point to use for output.
cy_nnlite_clipping_t | outClipping | output value clipping
cy_en_nnlite_activation_size_t | inputSize | Input data precision.
cy_en_nnlite_output_size_t | outputSize | Output precision
int8_t * | scratchBuf | DMA descriptors and MEMIO configuration in DMA mode.

## ◆ cy_nn_layernorm_params_t

struct cy_nn_layernorm_params_t

Data Fields
float | inScale | Pre-scaling to apply to input before op.
int32_t | inOffset | Zero-point for input values.
float | outScale | Scale factor to apply to results of op values.
int32_t | outOffset | Zero-point to use for output.
float | epsilon | Constant value, used for numeric stability.
cy_nnlite_clipping_t | outClipping | output value clipping
cy_en_nnlite_activation_size_t | inputSize | Input data precision.
cy_en_nnlite_output_size_t | outputSize | Output precision
int8_t * | scratchBuf | Scratch buffer for intermediate tensors

## ◆ cy_nn_dims_t

struct cy_nn_dims_t

Data Fields
uint32_t | dims[4] | dimension array of tensor

## ◆ cy_nn_act_intrpl_param_t

struct cy_nn_act_intrpl_param_t

Data Fields
float | segment[2] | Interpolation values index 0: x >= 0, index 0 1: x < 0.

## ◆ cy_nnlite_dma_queue_config_t

struct cy_nnlite_dma_queue_config_t

Data Fields
cy_stc_dma_channel_config_t | channelConfig | DMA channel config.
cy_stc_dma_descriptor_config_t * | currCfgDesc | DMA Queue config descriptor current pointer.
cy_stc_dma_descriptor_t * | currDesc | DMA Queue descriptor current pointer.
cy_nnlite_current_dma_desc_type_t | currDescType | DMA descriptor MEMIO or Transpose type.
cy_stc_dma_descriptor_t * | headDesc | DMA Queue descriptor head pointer.
uint32_t | dmaQDepth | DMA Queue depth.
cy_nnlite_dma_queue_state_t | dmaQState | DMA Q state.

## ◆ cy_kernel_config_t

struct cy_kernel_config_t

Data Fields
Cy_NNLite_CompletionCallback | completionCbFunc | Kernel completion called back function, to filled by upper layer, should not have/call blocking implementation.
void * | cbArg | argument with which callback function will be called
void * | nnliteMutex | Mutex to be allocated in RTOS environment.
void * | nnliteSem | Semaphore to be allocated in RTOS environment.
Cy_NNLite_MutexCreate | mutexCreateFunc | Mutex Create function pointer.
Cy_NNLite_MutexDelete | mutexDeleteFunc | Mutex Delete function pointer.
Cy_NNLite_MutexLock | mutexLockFunc | Mutex Lock function pointer.
Cy_NNLite_MutexUnlock | mutexUnlockFunc | Mutex Unlock function pointer.
Cy_NNLite_SemCreate | SemCreateFunc | Sem Create function pointer.
Cy_NNLite_SemDelete | SemDeleteFunc | Sem Delete function pointer.
Cy_NNLite_SemWait | SemWaitFunc | Sem wait function pointer.
Cy_NNLite_SemGive | SemGiveFunc | Sem give function pointer.
Cy_NNLite_LpmLock | LpmLockFunc | LPM lock function pointer.
Cy_NNLite_LpmUnlock | LpmUnlockFunc | LPM unlock function pointer.
Cy_NNLite_ProfileStart | profStart | profiler start
Cy_NNLite_ProfileGetCount | profGetCount | get count intermediate profile points
Cy_NNLite_ProfileStop | profStop | profiler end
void * | profArg | argument with which profiler callback functions will be called
uint32_t | intrPriority | NNLite and DMA Channel interrupt Priority.

## Typedef Documentation

## ◆ Cy_NNLite_CompletionCallback

typedef void(* Cy_NNLite_CompletionCallback) (void *cbArg, cy_en_nnlite_status_t status)

typedef for callback function, called from interrupt handler, to signal completion of layer, as called from interrupt handler callback function should not call any blocking function and should have minimum code required for completion signal

Parameters

  [in] | cbArg | argument with which callback function will be called
  [in] | status | status of operation