Paparazzi UAS  v4.0.4_stable-3-gf39211a
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
i2c_arch.rewritten.c File Reference
#include "mcu_periph/i2c.h"
#include <stm32/rcc.h>
#include <stm32/gpio.h>
#include <stm32/flash.h>
#include <stm32/misc.h>
+ Include dependency graph for i2c_arch.rewritten.c:

Go to the source code of this file.

Macros

#define I2C_SR1_BIT_SB   (1<<0)
 
#define I2C_SR1_BIT_ADDR   (1<<1)
 
#define I2C_SR1_BIT_BTF   (1<<2)
 
#define I2C_SR1_BIT_RXNE   (1<<6)
 
#define I2C_SR1_BIT_TXE   (1<<7)
 
#define I2C_SR1_BIT_ERR_BUS   (1<<8)
 
#define I2C_SR1_BIT_ERR_ARLO   (1<<9)
 
#define I2C_SR1_BIT_ERR_AF   (1<<10)
 
#define I2C_SR1_BIT_ERR_OVR   (1<<11)
 
#define I2C_SR1_BITS_ERR   ((1<<8)|(1<<9)|(1<<10)|(1<<11)|(1<<12)|(1<<14)|(1<<15))
 
#define I2C_SR2_BIT_TRA   (1<<2)
 
#define I2C_SR2_BIT_BUSY   (1<<1)
 
#define I2C_SR2_BIT_MSL   (1<<0)
 
#define I2C_CR1_BIT_PE   (1<<0)
 
#define I2C_CR1_BIT_START   (1<<8)
 
#define I2C_CR1_BIT_STOP   (1<<9)
 
#define I2C_CR1_BIT_ACK   (1<<10)
 
#define I2C_CR1_BIT_POS   (1<<11)
 
#define I2C_CR1_BIT_SWRST   (1<<15)
 
#define I2C_CR2_BIT_ITERREN   (1<<8)
 
#define I2C_CR2_BIT_ITEVTEN   (1<<9)
 
#define I2C_CR2_BIT_ITBUFEN   (1<<10)
 
#define BIT_X_IS_SET_IN_REG(X, REG)   (((REG) & (X)) == (X))
 
#define __I2C_REG_CRITICAL_ZONE_START   __disable_irq();
 
#define __I2C_REG_CRITICAL_ZONE_STOP   __enable_irq();
 

Enumerations

enum  STMI2CSubTransactionStatus {
  STMI2C_SubTra_Busy, STMI2C_SubTra_Ready_StopRequested, STMI2C_SubTra_Ready, STMI2C_SubTra_Error,
  STMI2C_SubTra_Busy, STMI2C_SubTra_Ready_StopRequested, STMI2C_SubTra_Ready, STMI2C_SubTra_Busy,
  STMI2C_SubTra_Ready_StopRequested, STMI2C_SubTra_Ready, STMI2C_SubTra_Busy, STMI2C_SubTra_Ready_StopRequested,
  STMI2C_SubTra_Ready, STMI2C_SubTra_Error
}
 

Functions

static void PPRZ_I2C_SEND_STOP (I2C_TypeDef *regs)
 
static void PPRZ_I2C_SEND_START (struct i2c_periph *periph)
 
static enum
STMI2CSubTransactionStatus 
stmi2c_send (I2C_TypeDef *regs, struct i2c_periph *periph, struct i2c_transaction *trans)
 
static enum
STMI2CSubTransactionStatus 
stmi2c_read1 (I2C_TypeDef *regs, struct i2c_periph *periph, struct i2c_transaction *trans)
 
static enum
STMI2CSubTransactionStatus 
stmi2c_read2 (I2C_TypeDef *regs, struct i2c_periph *periph, struct i2c_transaction *trans)
 
static enum
STMI2CSubTransactionStatus 
stmi2c_readmany (I2C_TypeDef *regs, struct i2c_periph *periph, struct i2c_transaction *trans)
 
static void i2c_error (struct i2c_periph *periph)
 
static void stmi2c_clear_pending_interrupts (I2C_TypeDef *regs)
 
static void i2c_irq (struct i2c_periph *periph)
 
void i2c_setbitrate (struct i2c_periph *periph, int bitrate)
 
void i2c_event (void)
 
bool_t i2c_submit (struct i2c_periph *periph, struct i2c_transaction *t)
 
bool_t i2c_idle (struct i2c_periph *periph)
 

Macro Definition Documentation

#define __I2C_REG_CRITICAL_ZONE_START   __disable_irq();

Definition at line 140 of file i2c_arch.rewritten.c.

Referenced by stmi2c_read1(), stmi2c_read2(), and stmi2c_readmany().

#define __I2C_REG_CRITICAL_ZONE_STOP   __enable_irq();

Definition at line 141 of file i2c_arch.rewritten.c.

Referenced by stmi2c_read1(), stmi2c_read2(), and stmi2c_readmany().

#define BIT_X_IS_SET_IN_REG (   X,
  REG 
)    (((REG) & (X)) == (X))
#define I2C_CR1_BIT_ACK   (1<<10)

Definition at line 123 of file i2c_arch.rewritten.c.

Referenced by stmi2c_read1(), stmi2c_read2(), and stmi2c_readmany().

#define I2C_CR1_BIT_PE   (1<<0)

Definition at line 120 of file i2c_arch.rewritten.c.

Referenced by i2c_setbitrate(), and PPRZ_I2C_SEND_START().

#define I2C_CR1_BIT_POS   (1<<11)

Definition at line 124 of file i2c_arch.rewritten.c.

Referenced by stmi2c_read1(), stmi2c_read2(), and stmi2c_readmany().

#define I2C_CR1_BIT_START   (1<<8)

Definition at line 121 of file i2c_arch.rewritten.c.

Referenced by i2c_irq(), and PPRZ_I2C_SEND_START().

#define I2C_CR1_BIT_STOP   (1<<9)

Definition at line 122 of file i2c_arch.rewritten.c.

Referenced by PPRZ_I2C_SEND_STOP().

#define I2C_CR1_BIT_SWRST   (1<<15)

Definition at line 125 of file i2c_arch.rewritten.c.

#define I2C_CR2_BIT_ITBUFEN   (1<<10)
#define I2C_CR2_BIT_ITERREN   (1<<8)

Definition at line 129 of file i2c_arch.rewritten.c.

Referenced by PPRZ_I2C_SEND_START().

#define I2C_CR2_BIT_ITEVTEN   (1<<9)

Definition at line 130 of file i2c_arch.rewritten.c.

Referenced by PPRZ_I2C_SEND_START().

#define I2C_SR1_BIT_ADDR   (1<<1)
#define I2C_SR1_BIT_BTF   (1<<2)
#define I2C_SR1_BIT_ERR_AF   (1<<10)

Definition at line 107 of file i2c_arch.rewritten.c.

#define I2C_SR1_BIT_ERR_ARLO   (1<<9)

Definition at line 106 of file i2c_arch.rewritten.c.

#define I2C_SR1_BIT_ERR_BUS   (1<<8)

Definition at line 105 of file i2c_arch.rewritten.c.

#define I2C_SR1_BIT_ERR_OVR   (1<<11)

Definition at line 108 of file i2c_arch.rewritten.c.

#define I2C_SR1_BIT_RXNE   (1<<6)

Definition at line 102 of file i2c_arch.rewritten.c.

Referenced by stmi2c_read1(), and stmi2c_readmany().

#define I2C_SR1_BIT_SB   (1<<0)
#define I2C_SR1_BIT_TXE   (1<<7)

Definition at line 103 of file i2c_arch.rewritten.c.

Referenced by stmi2c_send().

#define I2C_SR1_BITS_ERR   ((1<<8)|(1<<9)|(1<<10)|(1<<11)|(1<<12)|(1<<14)|(1<<15))

Definition at line 110 of file i2c_arch.rewritten.c.

Referenced by i2c_irq().

#define I2C_SR2_BIT_BUSY   (1<<1)

Definition at line 115 of file i2c_arch.rewritten.c.

Referenced by i2c_idle().

#define I2C_SR2_BIT_MSL   (1<<0)

Definition at line 116 of file i2c_arch.rewritten.c.

#define I2C_SR2_BIT_TRA   (1<<2)

Definition at line 114 of file i2c_arch.rewritten.c.

Enumeration Type Documentation

Enumerator
STMI2C_SubTra_Busy 
STMI2C_SubTra_Ready_StopRequested 
STMI2C_SubTra_Ready 
STMI2C_SubTra_Error 
STMI2C_SubTra_Busy 
STMI2C_SubTra_Ready_StopRequested 
STMI2C_SubTra_Ready 
STMI2C_SubTra_Busy 
STMI2C_SubTra_Ready_StopRequested 
STMI2C_SubTra_Ready 
STMI2C_SubTra_Busy 
STMI2C_SubTra_Ready_StopRequested 
STMI2C_SubTra_Ready 
STMI2C_SubTra_Error 

Definition at line 323 of file i2c_arch.rewritten.c.

Function Documentation

static void i2c_error ( struct i2c_periph periph)
inlinestatic
void i2c_event ( void  )

Definition at line 1311 of file i2c_arch.rewritten.c.

References I2CIdle, I2CStartRequested, LED1_OFF(), LED1_ON(), LED2_OFF(), and LED2_ON().

+ Here is the call graph for this function:

bool_t i2c_idle ( struct i2c_periph periph)

Definition at line 1429 of file i2c_arch.rewritten.c.

References BIT_X_IS_SET_IN_REG, FALSE, I2C_DEBUG_LED, I2C_SR2_BIT_BUSY, I2CIdle, i2c_periph::reg_addr, i2c_periph::status, and TRUE.

Referenced by i2c_setbitrate().

+ Here is the caller graph for this function:

void i2c_setbitrate ( struct i2c_periph periph,
int  bitrate 
)

Definition at line 1216 of file i2c_arch.rewritten.c.

References I2C_CR1_BIT_PE, i2c_idle(), LED1_OFF(), LED1_ON(), LED2_OFF(), LED2_ON(), and i2c_periph::reg_addr.

+ Here is the call graph for this function:

static void PPRZ_I2C_SEND_START ( struct i2c_periph periph)
inlinestatic
static void PPRZ_I2C_SEND_STOP ( I2C_TypeDef *  regs)
inlinestatic

Definition at line 268 of file i2c_arch.rewritten.c.

References I2C_CR1_BIT_STOP, LED1_OFF(), LED1_ON(), LED2_OFF(), and LED2_ON().

Referenced by i2c_irq(), stmi2c_read1(), stmi2c_read2(), and stmi2c_readmany().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void stmi2c_clear_pending_interrupts ( I2C_TypeDef *  regs)
inlinestatic

Definition at line 713 of file i2c_arch.rewritten.c.

References __attribute__(), BIT_X_IS_SET_IN_REG, I2C_CR2_BIT_ITBUFEN, I2C_SR1_BIT_ADDR, I2C_SR1_BIT_BTF, and I2C_SR1_BIT_SB.

Referenced by i2c_irq().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: