libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.

Defined Constants and Types for the Clock Recovery System More...

Collaboration diagram for CRS Defines:

Macros

#define CRS   CRS_BASE
 
#define CRS_CR   MMIO32(CRS_BASE + 0x00)
 
#define CRS_CFGR   MMIO32(CRS_BASE + 0x04)
 
#define CRS_ISR   MMIO32(CRS_BASE + 0x08)
 
#define CRS_ICR   MMIO32(CRS_BASE + 0x0c)
 
#define CRS_CR_TRIM_SHIFT   8
 
#define CRS_CR_TRIM   (0x3F << CRS_CR_TRIM_SHIFT)
 
#define CRS_CR_SWSYNC   (1 << 7)
 
#define CRS_CR_AUTOTRIMEN   (1 << 6)
 
#define CRS_CR_CEN   (1 << 5)
 
#define CRS_CR_ESYNCIE   (1 << 3)
 
#define CRS_CR_ERRIE   (1 << 2)
 
#define CRS_CR_SYNCWARNIE   (1 << 1)
 
#define CRS_CR_SYNCOKIE   (1 << 0)
 
#define CRS_CFGR_SYNCPOL   (1 << 31)
 
#define CRS_CFGR_SYNCSRC_SHIFT   28
 
#define CRS_CFGR_SYNCSRC   (3 << CRS_CFGR_SYNCSRC_SHIFT)
 
#define CRS_CFGR_SYNCSRC_GPIO   (0 << CRS_CFGR_SYNCSRC_SHIFT)
 
#define CRS_CFGR_SYNCSRC_LSE   (1 << CRS_CFGR_SYNCSRC_SHIFT)
 
#define CRS_CFGR_SYNCSRC_USB_SOF   (2 << CRS_CFGR_SYNCSRC_SHIFT)
 
#define CRS_CFGR_SYNCDIV_SHIFT   24
 
#define CRS_CFGR_SYNCDIV   (7 << CRS_CFGR_SYNCDIV_SHIFT)
 
#define CRS_CFGR_SYNCDIV_NODIV   (0 << CRS_CFGR_SYNCDIV_SHIFT)
 
#define CRS_CFGR_SYNCDIV_DIV2   (1 << CRS_CFGR_SYNCDIV_SHIFT)
 
#define CRS_CFGR_SYNCDIV_DIV4   (2 << CRS_CFGR_SYNCDIV_SHIFT)
 
#define CRS_CFGR_SYNCDIV_DIV8   (3 << CRS_CFGR_SYNCDIV_SHIFT)
 
#define CRS_CFGR_SYNCDIV_DIV16   (4 << CRS_CFGR_SYNCDIV_SHIFT)
 
#define CRS_CFGR_SYNCDIV_DIV32   (5 << CRS_CFGR_SYNCDIV_SHIFT)
 
#define CRS_CFGR_SYNCDIV_DIV64   (6 << CRS_CFGR_SYNCDIV_SHIFT)
 
#define CRS_CFGR_SYNCDIV_DIV128   (7 << CRS_CFGR_SYNCDIV_SHIFT)
 
#define CRS_CFGR_FELIM_SHIFT   16
 
#define CRS_CFGR_FELIM   (0xFF << CRS_CFGR_FELIM_SHIFT)
 
#define CRS_CFGR_FELIM_VAL(x)   ((x) << CRS_CFGR_FELIM_SHIFT)
 
#define CRS_CFGR_RELOAD_SHIFT   0
 
#define CRS_CFGR_RELOAD   (0xFFFF << CRS_CFGR_RELOAD_SHIFT)
 
#define CRS_CFGR_RELOAD_VAL(x)   ((x) << CRS_CFGR_RELOAD_SHIFT)
 
#define CRS_ISR_FECAP_SHIFT   16
 
#define CRS_ISR_FECAP   (0xFFFF << CRS_ISR_FECAP_SHIFT)
 
#define CRS_ISR_FEDIR   (1 << 15)
 
#define CRS_ISR_TRIMOVF   (1 << 10)
 
#define CRS_ISR_SYNCMISS   (1 << 9)
 
#define CRS_ISR_SYNCERR   (1 << 8)
 
#define CRS_ISR_ESYNCF   (1 << 3)
 
#define CRS_ISR_ERRF   (1 << 2)
 
#define CRS_ISR_SYNCWARNF   (1 << 1)
 
#define CRS_ISR_SYNCOOKF   (1 << 0)
 
#define CRS_ICR_ESYNCC   (1 << 3)
 
#define CRS_ICR_ERRC   (1 << 2)
 
#define CRS_ICR_SYNCWARNC   (1 << 1)
 
#define CRS_ICR_SYNCOKC   (1 << 0)
 

Functions

void crs_autotrim_usb_enable (void)
 This function enables automatic trimming of internal RC oscillator by USB SOF frames. More...
 

Detailed Description

Defined Constants and Types for the Clock Recovery System

LGPL License Terms libopencm3 License

Date
5 Feb 2014

LGPL License Terms libopencm3 License

Macro Definition Documentation

◆ CRS

#define CRS   CRS_BASE

Definition at line 34 of file crs_common_all.h.

◆ CRS_CFGR

#define CRS_CFGR   MMIO32(CRS_BASE + 0x04)

Definition at line 41 of file crs_common_all.h.

◆ CRS_CFGR_FELIM

#define CRS_CFGR_FELIM   (0xFF << CRS_CFGR_FELIM_SHIFT)

Definition at line 84 of file crs_common_all.h.

◆ CRS_CFGR_FELIM_SHIFT

#define CRS_CFGR_FELIM_SHIFT   16

Definition at line 83 of file crs_common_all.h.

◆ CRS_CFGR_FELIM_VAL

#define CRS_CFGR_FELIM_VAL (   x)    ((x) << CRS_CFGR_FELIM_SHIFT)

Definition at line 85 of file crs_common_all.h.

◆ CRS_CFGR_RELOAD

#define CRS_CFGR_RELOAD   (0xFFFF << CRS_CFGR_RELOAD_SHIFT)

Definition at line 88 of file crs_common_all.h.

◆ CRS_CFGR_RELOAD_SHIFT

#define CRS_CFGR_RELOAD_SHIFT   0

Definition at line 87 of file crs_common_all.h.

◆ CRS_CFGR_RELOAD_VAL

#define CRS_CFGR_RELOAD_VAL (   x)    ((x) << CRS_CFGR_RELOAD_SHIFT)

Definition at line 89 of file crs_common_all.h.

◆ CRS_CFGR_SYNCDIV

#define CRS_CFGR_SYNCDIV   (7 << CRS_CFGR_SYNCDIV_SHIFT)

Definition at line 73 of file crs_common_all.h.

◆ CRS_CFGR_SYNCDIV_DIV128

#define CRS_CFGR_SYNCDIV_DIV128   (7 << CRS_CFGR_SYNCDIV_SHIFT)

Definition at line 81 of file crs_common_all.h.

◆ CRS_CFGR_SYNCDIV_DIV16

#define CRS_CFGR_SYNCDIV_DIV16   (4 << CRS_CFGR_SYNCDIV_SHIFT)

Definition at line 78 of file crs_common_all.h.

◆ CRS_CFGR_SYNCDIV_DIV2

#define CRS_CFGR_SYNCDIV_DIV2   (1 << CRS_CFGR_SYNCDIV_SHIFT)

Definition at line 75 of file crs_common_all.h.

◆ CRS_CFGR_SYNCDIV_DIV32

#define CRS_CFGR_SYNCDIV_DIV32   (5 << CRS_CFGR_SYNCDIV_SHIFT)

Definition at line 79 of file crs_common_all.h.

◆ CRS_CFGR_SYNCDIV_DIV4

#define CRS_CFGR_SYNCDIV_DIV4   (2 << CRS_CFGR_SYNCDIV_SHIFT)

Definition at line 76 of file crs_common_all.h.

◆ CRS_CFGR_SYNCDIV_DIV64

#define CRS_CFGR_SYNCDIV_DIV64   (6 << CRS_CFGR_SYNCDIV_SHIFT)

Definition at line 80 of file crs_common_all.h.

◆ CRS_CFGR_SYNCDIV_DIV8

#define CRS_CFGR_SYNCDIV_DIV8   (3 << CRS_CFGR_SYNCDIV_SHIFT)

Definition at line 77 of file crs_common_all.h.

◆ CRS_CFGR_SYNCDIV_NODIV

#define CRS_CFGR_SYNCDIV_NODIV   (0 << CRS_CFGR_SYNCDIV_SHIFT)

Definition at line 74 of file crs_common_all.h.

◆ CRS_CFGR_SYNCDIV_SHIFT

#define CRS_CFGR_SYNCDIV_SHIFT   24

Definition at line 72 of file crs_common_all.h.

◆ CRS_CFGR_SYNCPOL

#define CRS_CFGR_SYNCPOL   (1 << 31)

Definition at line 64 of file crs_common_all.h.

◆ CRS_CFGR_SYNCSRC

#define CRS_CFGR_SYNCSRC   (3 << CRS_CFGR_SYNCSRC_SHIFT)

Definition at line 67 of file crs_common_all.h.

◆ CRS_CFGR_SYNCSRC_GPIO

#define CRS_CFGR_SYNCSRC_GPIO   (0 << CRS_CFGR_SYNCSRC_SHIFT)

Definition at line 68 of file crs_common_all.h.

◆ CRS_CFGR_SYNCSRC_LSE

#define CRS_CFGR_SYNCSRC_LSE   (1 << CRS_CFGR_SYNCSRC_SHIFT)

Definition at line 69 of file crs_common_all.h.

◆ CRS_CFGR_SYNCSRC_SHIFT

#define CRS_CFGR_SYNCSRC_SHIFT   28

Definition at line 66 of file crs_common_all.h.

◆ CRS_CFGR_SYNCSRC_USB_SOF

#define CRS_CFGR_SYNCSRC_USB_SOF   (2 << CRS_CFGR_SYNCSRC_SHIFT)

Definition at line 70 of file crs_common_all.h.

◆ CRS_CR

#define CRS_CR   MMIO32(CRS_BASE + 0x00)

Definition at line 40 of file crs_common_all.h.

◆ CRS_CR_AUTOTRIMEN

#define CRS_CR_AUTOTRIMEN   (1 << 6)

Definition at line 55 of file crs_common_all.h.

◆ CRS_CR_CEN

#define CRS_CR_CEN   (1 << 5)

Definition at line 56 of file crs_common_all.h.

◆ CRS_CR_ERRIE

#define CRS_CR_ERRIE   (1 << 2)

Definition at line 58 of file crs_common_all.h.

◆ CRS_CR_ESYNCIE

#define CRS_CR_ESYNCIE   (1 << 3)

Definition at line 57 of file crs_common_all.h.

◆ CRS_CR_SWSYNC

#define CRS_CR_SWSYNC   (1 << 7)

Definition at line 54 of file crs_common_all.h.

◆ CRS_CR_SYNCOKIE

#define CRS_CR_SYNCOKIE   (1 << 0)

Definition at line 60 of file crs_common_all.h.

◆ CRS_CR_SYNCWARNIE

#define CRS_CR_SYNCWARNIE   (1 << 1)

Definition at line 59 of file crs_common_all.h.

◆ CRS_CR_TRIM

#define CRS_CR_TRIM   (0x3F << CRS_CR_TRIM_SHIFT)

Definition at line 52 of file crs_common_all.h.

◆ CRS_CR_TRIM_SHIFT

#define CRS_CR_TRIM_SHIFT   8

Definition at line 51 of file crs_common_all.h.

◆ CRS_ICR

#define CRS_ICR   MMIO32(CRS_BASE + 0x0c)

Definition at line 43 of file crs_common_all.h.

◆ CRS_ICR_ERRC

#define CRS_ICR_ERRC   (1 << 2)

Definition at line 108 of file crs_common_all.h.

◆ CRS_ICR_ESYNCC

#define CRS_ICR_ESYNCC   (1 << 3)

Definition at line 107 of file crs_common_all.h.

◆ CRS_ICR_SYNCOKC

#define CRS_ICR_SYNCOKC   (1 << 0)

Definition at line 110 of file crs_common_all.h.

◆ CRS_ICR_SYNCWARNC

#define CRS_ICR_SYNCWARNC   (1 << 1)

Definition at line 109 of file crs_common_all.h.

◆ CRS_ISR

#define CRS_ISR   MMIO32(CRS_BASE + 0x08)

Definition at line 42 of file crs_common_all.h.

◆ CRS_ISR_ERRF

#define CRS_ISR_ERRF   (1 << 2)

Definition at line 101 of file crs_common_all.h.

◆ CRS_ISR_ESYNCF

#define CRS_ISR_ESYNCF   (1 << 3)

Definition at line 100 of file crs_common_all.h.

◆ CRS_ISR_FECAP

#define CRS_ISR_FECAP   (0xFFFF << CRS_ISR_FECAP_SHIFT)

Definition at line 94 of file crs_common_all.h.

◆ CRS_ISR_FECAP_SHIFT

#define CRS_ISR_FECAP_SHIFT   16

Definition at line 93 of file crs_common_all.h.

◆ CRS_ISR_FEDIR

#define CRS_ISR_FEDIR   (1 << 15)

Definition at line 96 of file crs_common_all.h.

◆ CRS_ISR_SYNCERR

#define CRS_ISR_SYNCERR   (1 << 8)

Definition at line 99 of file crs_common_all.h.

◆ CRS_ISR_SYNCMISS

#define CRS_ISR_SYNCMISS   (1 << 9)

Definition at line 98 of file crs_common_all.h.

◆ CRS_ISR_SYNCOOKF

#define CRS_ISR_SYNCOOKF   (1 << 0)

Definition at line 103 of file crs_common_all.h.

◆ CRS_ISR_SYNCWARNF

#define CRS_ISR_SYNCWARNF   (1 << 1)

Definition at line 102 of file crs_common_all.h.

◆ CRS_ISR_TRIMOVF

#define CRS_ISR_TRIMOVF   (1 << 10)

Definition at line 97 of file crs_common_all.h.

Function Documentation

◆ crs_autotrim_usb_enable()

void crs_autotrim_usb_enable ( void  )

This function enables automatic trimming of internal RC oscillator by USB SOF frames.

Definition at line 39 of file crs_common_all.c.

References CRS_CFGR, CRS_CFGR_SYNCSRC_USB_SOF, CRS_CR, CRS_CR_AUTOTRIMEN, CRS_CR_CEN, RCC_CRS, and rcc_periph_clock_enable().

Here is the call graph for this function: