Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
SAM Configurable Custom Logic (CCL) Driver

This driver for Atmel® | SMART ARM®-based microcontrollers provides an interface for the configuration and management of the device's Configurable Custom Logic functionality.

The following peripheral is used by this module:

The following devices can use this module:

The outline of this documentation is as follows:

Prerequisites

There are no prerequisites for this module.

Module Overview

This driver provides an interface for the Configurable Custom Logic functions on the device.

The Configurable Custom Logic (CCL) contains programmable logic which can be connected to the device pins, events, or internal peripherals.

Each LUT consists of three inputs, a truth table and optional synchronizer, filter and edge detector. Each LUT can generate an output as a user programmable logic expression with three inputs.

The output can be combinatorially generated from the inputs, or filtered to remove spike. An optional sequential module can be enabled. The inputs of sequential module are individually controlled by two independent, adjacent LUT(LUT0/LUT1, LUT2/LUT3 etc.) outputs, enabling complex waveform generation.

Special Considerations

There are no special considerations for this module.

Extra Information

For extra information, see Extra Information for CCL Driver. This includes:

Examples

For a list of examples related to this driver, see Examples for CCL Driver.

API Overview

Data Structures

struct  ccl_config
 CCL module configuration structure. More...
 
struct  ccl_lut_config
 CCL LUT 0 to 3 configuration structure. More...
 

Enumerations

enum  ccl_lut_filter_sel {
  CCL_LUT_FILTER_DISABLE = CCL_LUTCTRL_FILTSEL_DISABLE,
  CCL_LUT_FILTER_SYNC = CCL_LUTCTRL_FILTSEL_SYNCH,
  CCL_LUT_FILTER_ENABLE = CCL_LUTCTRL_FILTSEL_FILTER
}
 Select the LUT output filter options enum. More...
 
enum  ccl_lut_id {
  CCL_LUT_0 = 0,
  CCL_LUT_1 = 1,
  CCL_LUT_2 = 2,
  CCL_LUT_3 = 3
}
 CCL LUT(look up table) ID number enum. More...
 
enum  ccl_lut_input_src_sel {
  CCL_LUT_INPUT_SRC_MASK = 0,
  CCL_LUT_INPUT_SRC_FEEDBACK = 1,
  CCL_LUT_INPUT_SRC_LINK = 2,
  CCL_LUT_INPUT_SRC_EVENT = 3,
  CCL_LUT_INPUT_SRC_IO = 4,
  CCL_LUT_INPUT_SRC_AC = 5,
  CCL_LUT_INPUT_SRC_TC = 6,
  CCL_LUT_INPUT_SRC_ALTTC = 7,
  CCL_LUT_INPUT_SRC_TCC = 8,
  CCL_LUT_INPUT_SRC_SERCOM = 9
}
 LUT Input source selection configuration enum. More...
 
enum  ccl_seq_id {
  CCL_SEQ_0 = 0,
  CCL_SEQ_1 = 1
}
 CCL sequential module ID number enum. More...
 
enum  ccl_seq_selection {
  CCL_SEQ_DISABLED = CCL_SEQCTRL_SEQSEL_DISABLE,
  CCL_SEQ_D_FLIP_FLOP = CCL_SEQCTRL_SEQSEL_DFF,
  CCL_SEQ_JK_FLIP_FLOP = CCL_SEQCTRL_SEQSEL_JK,
  CCL_SEQ_D_LATCH = CCL_SEQCTRL_SEQSEL_LATCH,
  CCL_SEQ_RS_LATCH = CCL_SEQCTRL_SEQSEL_RS
}
 Sequential selection enum. More...
 

Initialize and Reset CCL Module

void ccl_init (struct ccl_config *const config)
 Initializes CCL module. More...
 
static void ccl_get_config_defaults (struct ccl_config *const config)
 Initializes all members of a CCL configuration structure to safe defaults. More...
 
static void ccl_module_reset (void)
 Resets CCL module. More...
 

Enable and Disable CCL Module

static void ccl_module_enable (void)
 Enables CCL module. More...
 
static void ccl_module_disable (void)
 Disables CCL module. More...
 

Configure LUT

enum status_code ccl_seq_config (const enum ccl_seq_id number, const enum ccl_seq_selection seq_selection)
 Writes sequential selection to the hardware module. More...
 
void ccl_lut_get_config_defaults (struct ccl_lut_config *const config)
 Initializes all members of LUT configuration structure to safe defaults. More...
 
enum status_code ccl_lut_set_config (const enum ccl_lut_id number, struct ccl_lut_config *const config)
 Writes LUT configuration to the hardware module. More...
 

Enable and Disable LUT

void ccl_lut_enable (const enum ccl_lut_id number)
 Enables an LUT that was previously configured. More...
 
void ccl_lut_disable (const enum ccl_lut_id number)
 Disables an LUT that was previously enabled. More...
 

Select the LUT output filter options enum.

Enum for the LUT output filter options.

Enumerator
CCL_LUT_FILTER_DISABLE 

Filter disabled.

CCL_LUT_FILTER_SYNC 

Synchronizer enabled.

CCL_LUT_FILTER_ENABLE 

Filter enabled.

enum ccl_lut_id

CCL LUT(look up table) ID number enum.

Enumerator
CCL_LUT_0 

CCL LUT 0.

CCL_LUT_1 

CCL LUT 1.

CCL_LUT_2 

CCL LUT 2.

CCL_LUT_3 

CCL LUT 3.

LUT Input source selection configuration enum.

Enum for the LUT Input source selection.

Enumerator
CCL_LUT_INPUT_SRC_MASK 

Masked input.

CCL_LUT_INPUT_SRC_FEEDBACK 

Feedback input source.

CCL_LUT_INPUT_SRC_LINK 

Linked LUT input source.

CCL_LUT_INPUT_SRC_EVENT 

Event input source.

CCL_LUT_INPUT_SRC_IO 

I/O pin input source.

CCL_LUT_INPUT_SRC_AC 

AC input source.

CCL_LUT_INPUT_SRC_TC 

TC input source.

CCL_LUT_INPUT_SRC_ALTTC 

Alternative TC input source.

CCL_LUT_INPUT_SRC_TCC 

TCC input source.

CCL_LUT_INPUT_SRC_SERCOM 

SERCOM input source.

enum ccl_seq_id

CCL sequential module ID number enum.

Enumerator
CCL_SEQ_0 

CCL SEQ 0.

CCL_SEQ_1 

CCL SEQ 1.

Sequential selection enum.

Enum for the sequential selection configuration.

Enumerator
CCL_SEQ_DISABLED 

Sequential logic is disabled.

CCL_SEQ_D_FLIP_FLOP 

D flip flop.

CCL_SEQ_JK_FLIP_FLOP 

JK flip flop.

CCL_SEQ_D_LATCH 

D latch.

CCL_SEQ_RS_LATCH 

RS latch.

static void ccl_get_config_defaults ( struct ccl_config *const  config)
inlinestatic

Initializes all members of a CCL configuration structure to safe defaults.

Initializes all members of a given Configurable Custom Logic configuration structure to safe and known default values. This function should be called on all new instances of these configuration structures before being modified by the user application.

The default configuration is as follows:

  • GCLK_CLL will be stopped in standby sleep mode
  • Generator 0 is the default GCLK generator
Parameters
[out]configConfiguration structure to initialize to default values

References Assert, ccl_config::clock_source, GCLK_GENERATOR_0, and ccl_config::run_in_standby.

void ccl_init ( struct ccl_config *const  config)
void ccl_lut_disable ( const enum ccl_lut_id  number)

Disables an LUT that was previously enabled.

Disables an LUT that was previously enabled via a call to ccl_lut_enable().

Parameters
[in]numberLUT number to enable
void ccl_lut_enable ( const enum ccl_lut_id  number)

Enables an LUT that was previously configured.

Enables an LUT that was previously configured via a call to ccl_lut_set_config function.

Parameters
[in]numberLUT number to enable
void ccl_lut_get_config_defaults ( struct ccl_lut_config *const  config)

Initializes all members of LUT configuration structure to safe defaults.

Initializes all members of LUT configuration structure to safe defaults. This function should be called on all new instances of these configuration structures before being modified by the user application.

The default configuration is as follows:

  • Truth table value is 0x00
  • LUT event output is disabled
  • LUT incoming event is disabled
  • LUT incoming event is not inverted
  • The input IN[2:0] source is masked
  • The edge detector is disabled
  • The LUT output filter is disabled
Parameters
[out]configLUT configuration structure to initialize to default values

References Assert, CCL_LUT_FILTER_DISABLE, CCL_LUT_INPUT_SRC_MASK, ccl_lut_config::edge_selection_enable, ccl_lut_config::event_input_enable, ccl_lut_config::event_input_inverted_enable, ccl_lut_config::event_output_enable, ccl_lut_config::filter_sel, ccl_lut_config::input0_src_sel, ccl_lut_config::input1_src_sel, ccl_lut_config::input2_src_sel, and ccl_lut_config::truth_table_value.

enum status_code ccl_lut_set_config ( const enum ccl_lut_id  number,
struct ccl_lut_config *const  config 
)

Writes LUT configuration to the hardware module.

Writes a given LUT configuration to the hardware module.

Note
This function can only be used when the CCL module is disabled.
Parameters
[in]configPointer to the LUT configuration struct
[in]numberLUT number to config

References Assert, ccl_lut_config::edge_selection_enable, ccl_lut_config::event_input_enable, ccl_lut_config::event_input_inverted_enable, ccl_lut_config::event_output_enable, ccl_lut_config::filter_sel, ccl_lut_config::input0_src_sel, ccl_lut_config::input1_src_sel, ccl_lut_config::input2_src_sel, STATUS_BUSY, STATUS_OK, and ccl_lut_config::truth_table_value.

static void ccl_module_disable ( void  )
inlinestatic

Disables CCL module.

Disables the peripheral.

static void ccl_module_enable ( void  )
inlinestatic

Enables CCL module.

Enable the peripheral.

static void ccl_module_reset ( void  )
inlinestatic

Resets CCL module.

Resets all registers in the MODULE to their initial state, and the CCL will be disabled.

Referenced by ccl_init().

enum status_code ccl_seq_config ( const enum ccl_seq_id  number,
const enum ccl_seq_selection  seq_selection 
)

Writes sequential selection to the hardware module.

Writes a given sequential selection configuration to the hardware module.

Note
This function can only be used when the CCL module is disabled.
Parameters
[in]seq_selectionEnum for the sequential selection configuration
[in]numberSEQ unit number to config

References STATUS_BUSY, and STATUS_OK.