libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
spi_common_v1_frf.c
Go to the documentation of this file.
1/** @addtogroup spi_file SPI peripheral API
2 * @ingroup peripheral_apis
3
4@author @htmlonly © @endhtmlonly 2009
5Uwe Hermann <uwe@hermann-uwe.de>
6@author @htmlonly &copy; @endhtmlonly 2012
7Ken Sarkies <ksarkies@internode.on.net>
8@author @htmlonly &copy; @endhtmlonly 2018
9Guillaume Revaillot <revaillot@archos.com>
10
11*/
12
13/*
14 * This file is part of the libopencm3 project.
15 *
16 * Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
17 *
18 * This library is free software: you can redistribute it and/or modify
19 * it under the terms of the GNU Lesser General Public License as published by
20 * the Free Software Foundation, either version 3 of the License, or
21 * (at your option) any later version.
22 *
23 * This library is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU Lesser General Public License for more details.
27 *
28 * You should have received a copy of the GNU Lesser General Public License
29 * along with this library. If not, see <http://www.gnu.org/licenses/>.
30 */
31
33
34/**@{*/
35
36/*---------------------------------------------------------------------------*/
37/** @brief SPI Set Frame Format to TI
38
39@param[in] spi Unsigned int32. SPI peripheral identifier @ref spi_reg_base.
40*/
41
42void spi_set_frf_ti(uint32_t spi)
43{
44 SPI_CR2(spi) |= SPI_CR2_FRF;
45}
46
47/*---------------------------------------------------------------------------*/
48/** @brief SPI Set Frame Format to Motorola
49
50@param[in] spi Unsigned int32. SPI peripheral identifier @ref spi_reg_base.
51*/
52
53void spi_set_frf_motorola(uint32_t spi)
54{
55 SPI_CR2(spi) &= ~SPI_CR2_FRF;
56}
57
58#define SPI_CR2_FRF (1 << 4)
59#define SPI_CR2_FRF_MOTOROLA_MODE (0 << 4)
60#define SPI_CR2_FRF_TI_MODE (1 << 4)
61
62/* --- SPI_SR values ------------------------------------------------------- */
63
64/* FRE / TIFRFE: TI frame format error */
65#define SPI_SR_TIFRFE (1 << 8) //F2
66#define SPI_SR_FRE (1 << 8) //others
67
68/**@}*/
#define SPI_CR2(spi_base)
#define SPI_CR2_FRF
void spi_set_frf_ti(uint32_t spi)
SPI Set Frame Format to TI.
void spi_set_frf_motorola(uint32_t spi)
SPI Set Frame Format to Motorola.