Browse Source

stm32: usart-v2: pull up remaining f3/f0 defns

Final chunk of register definitions to be pulled up.

Now the "target" files are _only_ defining the list of u(s)arts
available, and any _specific_ functions for that target.
pull/837/head
Karl Palsson 7 years ago
parent
commit
a23d65e7dd
  1. 29
      include/libopencm3/stm32/common/usart_common_v2.h
  2. 27
      include/libopencm3/stm32/f0/usart.h
  3. 29
      include/libopencm3/stm32/f3/usart.h

29
include/libopencm3/stm32/common/usart_common_v2.h

@ -231,9 +231,15 @@
/** RTOIE: Receiver timeout interrupt enable */
#define USART_CR1_RTOIE (1 << 26)
/* DEAT[4:0]: Driver Enable assertion time */
#define USART_CR1_DEAT_SHIFT 21
#define USART_CR1_DEAT (0x1F << USART_CR1_DEAT_SHIFT)
/** DEAT[4:0]: Driver Enable assertion time */
#define USART_CR1_DEAT_VAL(x) ((x) << USART_CR1_DEAT_SHIFT)
/* DEDT[4:0]: Driver Enable deassertion time */
#define USART_CR1_DEDT_SHIFT 16
#define USART_CR1_DEDT (0x1F << USART_CR1_DEDT_SHIFT)
/** DEDT[4:0]: Driver Enable deassertion time */
#define USART_CR1_DEDT_VAL(x) ((x) << USART_CR1_DEDT_SHIFT)
/** OVER8: Oversampling mode */
#define USART_CR1_OVER8 (1 << 15)
@ -368,6 +374,12 @@
#define USART_CR3_WUS_START_BIT (0x2 << 20)
#define USART_CR3_WUS_RXNE (0x3 << 20)
#define USART_CR3_SCARCNT_SHIFT 17
#define USART_CR3_SCARCNT_MASK 0x7
/** SCARCNT[2:0]: Smartcard auto retry count */
#define USART_CR3_SCARCNT_DISABLE (0 << USART_CR3_SCARCNT_SHIFT)
#define USART_CR3_SCARCNT_VAL(x) ((x) << USART_CR3_SCARCNT_SHIFT)
/** DEP: Driver enable polarity selection */
#define USART_CR3_DEP (1 << 15)
@ -418,6 +430,19 @@
/**@}*/
/** @defgroup usart_gtpr_values USART_GTPR Values
* @ingroup usart_defines
* @{
*/
#define USART_GTPR_GT_SHIFT 8
#define USART_GTPR_GT (0xFF << USART_GTPR_GT_SHIFT)
#define USART_GTPR_GT_VAL(x) ((x) << USART_GTPR_GT_SHIFT)
#define USART_GTPR_PSC_SHIFT 0
#define USART_GTPR_PSC (0xFF << USART_GTPR_PSC_SHIFT)
#define USART_GTPR_PSC_VAL(x) ((x) << USART_GTPR_PSC_SHIFT)
/**@}*/
/* ------------------------------------------------------ */
/** @defgroup usart_rtor_values USART_RTOR Values
* @ingroup usart_defines

27
include/libopencm3/stm32/f0/usart.h

@ -47,33 +47,6 @@
/* Register values */
/*****************************************************************************/
/* USART_CR1 Values ---------------------------------------------------------*/
#define USART_CR1_DEAT_SHIFT 21
#define USART_CR1_DEAT (0x1F << USART_CR1_DEAT_SHIFT)
#define USART_CR1_DEAT_VAL(x) ((x) << USART_CR1_DEAT_SHIFT)
#define USART_CR1_DEDT_SHIFT 16
#define USART_CR1_DEDT (0x1F << USART_CR1_DEDT_SHIFT)
#define USART_CR1_DEDT_VAL(x) ((x) << USART_CR1_DEDT_SHIFT)
/* USART_CR3 Values ---------------------------------------------------------*/
#define USART_CR3_SCARCNT_SHIFT 17
#define USART_CR3_SCARCNT (7 << USART_CR3_SCARCNT_SHIFT)
#define USART_CR3_SCARCNT_DISABLE (0 << USART_CR3_SCARCNT_SHIFT)
#define USART_CR3_SCARCNT_VAL(x) ((x) << USART_CR3_SCARCNT_SHIFT)
/* USART_GTPR Values --------------------------------------------------------*/
#define USART_GTPR_GT_SHIFT 8
#define USART_GTPR_GT (0xFF << USART_GTPR_GT_SHIFT)
#define USART_GTPR_GT_VAL(x) ((x) << USART_GTPR_GT_SHIFT)
#define USART_GTPR_PSC_SHIFT 0
#define USART_GTPR_PSC (0xFF << USART_GTPR_PSC_SHIFT)
#define USART_GTPR_PSC_VAL(x) ((x) << USART_GTPR_PSC_SHIFT)
/*****************************************************************************/
/* API Functions */
/*****************************************************************************/

29
include/libopencm3/stm32/f3/usart.h

@ -47,34 +47,9 @@
#define UART5 UART5_BASE
/**@}*/
BEGIN_DECLS
/* --- USART_CR3 values ---------------------------------------------------- */
/* SCARCNT[2:0]: Smartcard auto-retry count */
#define USART_CR3_SCARCNT_OFF (0x0 << 17)
/* 0x1 to 0x7: number of automatic retransmission attempts */
/* --- USART_BRR values ---------------------------------------------------- */
/* DIV_Mantissa[11:0]: mantissa of USARTDIV */
#define USART_BRR_DIV_MANTISSA_MASK (0xFFF << 4)
/* DIV_Fraction[3:0]: fraction of USARTDIV */
#define USART_BRR_DIV_FRACTION_MASK 0xF
/* --- USART_GTPR values --------------------------------------------------- */
/* GT[7:0]: Guard time value */
/* Note: N/A on UART4 & UART5 */
#define USART_GTPR_GT_MASK (0xFF << 8)
/* PSC[7:0]: Prescaler value */
/* Note: N/A on UART4/5 */
#define USART_GTPR_PSC_MASK 0xFF
END_DECLS
#endif

Loading…
Cancel
Save