Freescale Semiconductor Inc.
Main Page | Data Structures | File List | Data Fields | Globals

etpu_knock.h File Reference


Detailed Description

This file contains useful macros and prototypes for KNOCK API.

Author:
Milan Brejl [r54529]
Version:
1.0
Date:
17-Mar-2014

Definition in file etpu_knock.h.

#include "etpu_util.h"
#include "etpu_knock_auto.h"

Go to the source code of this file.

Functions

uint32_t fs_etpu_knock_init (struct knock_instance_t *p_knock_instance, struct knock_config_t *p_knock_config)
 This function initializes eTPU channels to run KNOCK function.
uint32_t fs_etpu_knock_config (struct knock_instance_t *p_knock_instance, struct knock_config_t *p_knock_config)
 This function changes the KNOCK configuration.


Function Documentation

uint32_t fs_etpu_knock_config struct knock_instance_t p_knock_instance,
struct knock_config_t p_knock_config
 

This function changes the KNOCK configuration.

Note:
The following actions are performed in order:
  1. Write FM bit.
  2. Write configuration parameter values to eTPU DATA RAM
Warning:
The new knock window configuration (array of windows) must fit into the eTPU DATA RAM already allocated. It means the windows_count can only be lower or the same as the value provided on initialization.
Parameters:
*p_knock_instance - This is a pointer to the instance structure knock_instance_t.
*p_knock_config - This is a pointer to the structure of configuration parameters knock_config_t.
Returns:
Error codes that can be returned are:
  • FS_ETPU_ERROR_NONE - No error

Definition at line 200 of file etpu_knock.c.

References knock_window_config_t::angle_start, knock_window_config_t::angle_width, knock_instance_t::chan_num, knock_instance_t::cpba, knock_instance_t::cpba_windows, FS_ETPU_KNOCK_OFFSET_IRQ_DMA_OPTIONS, FS_ETPU_KNOCK_OFFSET_TRIGGER_PERIOD, FS_ETPU_KNOCK_OFFSET_WINDOW_COUNT, FS_ETPU_KNOCK_WINDOW_OFFSET_START, FS_ETPU_KNOCK_WINDOW_OFFSET_WIDTH, FS_ETPU_KNOCK_WINDOW_STRUCT_SIZE, knock_config_t::irq_dma_options, knock_config_t::mode, knock_config_t::p_knock_window_config, knock_config_t::trigger_period, and knock_config_t::window_count.

uint32_t fs_etpu_knock_init struct knock_instance_t p_knock_instance,
struct knock_config_t p_knock_config
 

This function initializes eTPU channels to run KNOCK function.

Note:
The following actions are performed in order:
  1. Use user-defined CPBA or allocate new eTPU DATA RAM
  2. Write chan config registers and FM bits
  3. Write channel parameters
  4. Write HSR
  5. Set channel priority
Parameters:
*p_knock_instance - This is a pointer to the instance structure knock_instance_t.
*p_knock_config - This is a pointer to the structure of configuration parameters knock_config_t.
Returns:
Error codes that can be returned are:
  • FS_ETPU_ERROR_MALLOC - eTPU DATA RAM memory allocation error
  • FS_ETPU_ERROR_NONE - No error
Warning:
This function does not configure the pins, only the eTPU channels.

Definition at line 89 of file etpu_knock.c.

References knock_window_config_t::angle_start, knock_window_config_t::angle_width, knock_instance_t::chan_num, knock_instance_t::cpba, knock_instance_t::cpba_windows, fs_etpu_data_ram_start, FS_ETPU_KNOCK_FUNCTION_NUMBER, FS_ETPU_KNOCK_HSR_INIT, FS_ETPU_KNOCK_NUM_PARMS, FS_ETPU_KNOCK_OFFSET_IRQ_DMA_OPTIONS, FS_ETPU_KNOCK_OFFSET_P_WINDOW, FS_ETPU_KNOCK_OFFSET_P_WINDOW_FIRST, FS_ETPU_KNOCK_OFFSET_TCR2_WINDOW_END, FS_ETPU_KNOCK_OFFSET_TCR2_WINDOW_START, FS_ETPU_KNOCK_OFFSET_TDC_ANGLE, FS_ETPU_KNOCK_OFFSET_TDC_ANGLE_ACTUAL, FS_ETPU_KNOCK_OFFSET_TRIGGER_PERIOD, FS_ETPU_KNOCK_OFFSET_WINDOW_COUNT, FS_ETPU_KNOCK_OFFSET_WINDOW_COUNTER, FS_ETPU_KNOCK_TABLE_SELECT, FS_ETPU_KNOCK_WINDOW_OFFSET_START, FS_ETPU_KNOCK_WINDOW_OFFSET_WIDTH, FS_ETPU_KNOCK_WINDOW_STRUCT_SIZE, knock_config_t::irq_dma_options, knock_config_t::mode, knock_config_t::p_knock_window_config, knock_instance_t::polarity, knock_instance_t::priority, knock_instance_t::tdc_angle, knock_config_t::trigger_period, and knock_config_t::window_count.