Microchip® Advanced Software Framework

iisc.h File Reference

IIS driver for SAM.

This file defines a useful set of functions for the IIS on SAM devices.

Copyright (c) 2013-2018 Microchip Technology Inc. and its subsidiaries.

#include "compiler.h"
#include "status_codes.h"

Data Structures

struct  iis_config
 Configuration setting structure. More...
 
struct  iis_dev_inst
 

Macros

#define IIS_RETRY_VALUE   10000
 

Typedefs

typedef void(* iis_callback_t )(void)
 
typedef enum iis_interrupt_source iis_interrupt_source_t
 IIS interrupt source. More...
 

Enumerations

enum  iis_data_format {
  IIS_DATE_32BIT = 0,
  IIS_DATE_24BIT,
  IIS_DATE_20BIT,
  IIS_DATE_18BIT,
  IIS_DATE_16BIT,
  IIS_DATE_16BIT_COMPACT,
  IIS_DATE_8BIT,
  IIS_DATE_8BIT_COMPACT
}
 Data format. More...
 
enum  iis_dma_channel {
  IIS_ONE_DMA_CHANNEL_FOR_BOTH_CHANNELS = 0,
  IIS_ONE_DMA_CHANNEL_FOR_ONE_CHANNEL
}
 DMA channel usage for IIS transfer. More...
 
enum  iis_fs_rate {
  IIS_FS_RATE_16 = 0,
  IIS_FS_RATE_32 = 1,
  IIS_FS_RATE_48 = 2,
  IIS_FS_RATE_64 = 3,
  IIS_FS_RATE_96 = 5,
  IIS_FS_RATE_128 = 7,
  IIS_FS_RATE_192 = 11,
  IIS_FS_RATE_256 = 15,
  IIS_FS_RATE_384 = 23,
  IIS_FS_RATE_512 = 31,
  IIS_FS_RATE_768 = 47,
  IIS_FS_RATE_1024 = 63
}
 Supported Master Clock to Sample Frequency (fs) Ratio. More...
 
enum  iis_interrupt_source {
  IIS_INTERRUPT_RXRDY = 0,
  IIS_INTERRUPT_RXOR,
  IIS_INTERRUPT_TXRDY,
  IIS_INTERRUPT_TXUR,
  _IIS_INTERRUPT_SOURCE_NUM
}
 IIS interrupt source. More...
 
enum  iis_number_of_channels {
  IIS_CHANNEL_MONO = 0,
  IIS_CHANNEL_STEREO
}
 Supported number of channels. More...
 
enum  iis_slot_length {
  IIS_SLOT_LENGTH_8BIT = 8,
  IIS_SLOT_LENGTH_16BIT = 16,
  IIS_SLOT_LENGTH_24BIT = 24,
  IIS_SLOT_LENGTH_32BIT = 32
}
 Slot length. More...
 

Functions

void iis_clear_status (struct iis_dev_inst *const dev_inst, iis_interrupt_source_t source)
 Clear the IIS status value. More...
 
void iis_disable (struct iis_dev_inst *const dev_inst)
 Disable the IIS module. More...
 
static void iis_disable_clocks (struct iis_dev_inst *dev_inst)
 Disable the clocks for the IIS module. More...
 
void iis_disable_interrupt (struct iis_dev_inst *const dev_inst, iis_interrupt_source_t source)
 Disable the specified interrput sources. More...
 
static void iis_disable_reception (struct iis_dev_inst *dev_inst)
 Disable the IIS module in reception. More...
 
static void iis_disable_transmission (struct iis_dev_inst *dev_inst)
 Disable the IIS module in transmission. More...
 
void iis_enable (struct iis_dev_inst *const dev_inst)
 Enable the IIS module. More...
 
static void iis_enable_clocks (struct iis_dev_inst *dev_inst)
 Enable the clocks for the IIS module. More...
 
void iis_enable_interrupt (struct iis_dev_inst *const dev_inst, iis_interrupt_source_t source)
 Enable the specified interrput sources. More...
 
static void iis_enable_reception (struct iis_dev_inst *dev_inst)
 Enable the IIS module in reception. More...
 
static void iis_enable_transmission (struct iis_dev_inst *dev_inst)
 Enable the IIS module in transmission. More...
 
static void iis_get_config_defaults (struct iis_config *const cfg)
 Get the default IIS module configuration: Data format: 32 bits Slot length: 32 bits Sample frequecny ratio: 1024 Tx channel: Stereo Rx channel: Stereo DMA for Tx: 1 DMA channel for 1 IIS Tx channel DMA for Rx: 1 DMA channel for 1 IIS Rx channel Loopback: No Master: Yes. More...
 
static uint32_t iis_get_interrupt_mask (struct iis_dev_inst *const dev_inst)
 Get the IIS interrupts mask value. More...
 
static uint32_t iis_get_status (struct iis_dev_inst *dev_inst)
 Get the IIS status value. More...
 
enum status_code iis_init (struct iis_dev_inst *const dev_inst, Iisc *iisc, struct iis_config *const cfg)
 Initialize and configure the IIS module. More...
 
enum status_code iis_read (struct iis_dev_inst *dev_inst, uint32_t *data)
 Read a single message of data. More...
 
static void iis_reset (struct iis_dev_inst *dev_inst)
 Resets the IIS module. More...
 
void iis_set_callback (struct iis_dev_inst *const dev_inst, iis_interrupt_source_t source, iis_callback_t callback, uint8_t irq_level)
 Set callback for IIS. More...
 
enum status_code iis_write (struct iis_dev_inst *dev_inst, uint32_t data)
 Write a single message of data. More...