![]() |
MCCI Trusted Bootloader
Simple trusted bootloader and tools for small embedded systems
|
#include "mcci_bootloader_device_i2c_bus_stm32l0.h"#include "mcci_bootloader.h"#include "mcci_bootloader_platform.h"#include "mcci_bootloader_device_i2c_device_stm32l0.h"#include "mcci_bootloader_device_internal.h"#include "mcci_stm32l0xx.h"#include "mcci_arm_cm0plus.h"#include <string.h>Go to the source code of this file.
Macros | |
| #define | MCCI_BOOTLOADER_STM32L0_I2C_TIME_OUT_MS 100 |
Functions | |
| static McciBootloaderDeviceI2cResult_t | i2cBusAddDevice (McciBootloaderDeviceI2cBus_t *pBusAbstract, McciBootloaderDeviceI2cDevice_t *pDeviceAbstract, size_t sizeDevice, McciBootloaderDeviceI2cAddress_t i2cAddress, McciBootloaderDeviceI2cSpeed_t i2cSpeed) |
| static bool | i2cBusBegin (McciBootloaderDevice_t *pDevice) |
| static bool | i2cBusEnd (McciBootloaderDevice_t *pDevice) |
| static McciBootloaderDeviceI2cResult_t | i2cBusRead (McciBootloaderDeviceI2cBus_t *pBus, McciBootloaderDeviceI2cDevice_t *pDevice, uint8_t *pBuffer, size_t nBuffer, size_t *pnActual) |
| static McciBootloaderDeviceI2cResult_t | i2cBusWrite (McciBootloaderDeviceI2cBus_t *pBus, McciBootloaderDeviceI2cDevice_t *pDevice, const uint8_t *pBuffer, size_t nBuffer, size_t *pnActual) |
| static McciBootloaderDeviceI2cResult_t | i2cDeviceRead (McciBootloaderDeviceI2cDevice_t *pI2cDevice, uint8_t *pBuffer, size_t nBuffer, size_t *pnActual) |
| static McciBootloaderDeviceI2cResult_t | i2cDeviceWrite (McciBootloaderDeviceI2cDevice_t *pI2cDevice, const uint8_t *pBuffer, size_t nBuffer, size_t *pnActual) |
| McciBootloaderDeviceI2cBus_t * | McciBootloader_Stm32L0Interface_initI2cBus (void *pRamForBus, size_t sizeForBus, const McciBootloaderDeviceI2cBusStm32l0_Config_t *pConfig, uint32_t timingr100k, uint32_t timingr400k, uint32_t timingr1M) |
| Initialize an I2C bus controller driver on an STM32L0. | |
| static McciBootloaderDeviceI2cResult_t | status_getResult (McciBootloaderI2cBusStm32l0_Status_t status) |
Variables | |
| const McciBootloaderDeviceI2cBusStm32l0_Config_t | gk_McciBootloaderDeviceI2cBusStm32l0_Config_I2c1 |
| global config for I2C1. Linker discards this if not used. | |
| const McciBootloaderDeviceI2cBusStm32l0_Config_t | gk_McciBootloaderDeviceI2cBusStm32l0_Config_I2c2 |
| global config for I2C2. Linker discards this if not used. | |
| const McciBootloaderDeviceI2cBusStm32l0_Config_t | gk_McciBootloaderDeviceI2cBusStm32l0_Config_I2c3 |
| global config for I2C3. Linker discards this if not used. | |
| static const McciBootloaderDeviceMethods_t | i2cBus_deviceMethods |
| static const McciBootloaderDeviceI2cBusMethods_t | i2cBus_i2cBusMethods |
| static McciBootloaderDeviceI2cBus_AddDeviceFn_t | i2cBusAddDevice |
| static McciBootloaderDevice_BeginFn_t | i2cBusBegin |
| static McciBootloaderDevice_EndFn_t | i2cBusEnd |
| static McciBootloaderDeviceI2cBus_ReadFn_t | i2cBusRead |
| static McciBootloaderDeviceI2cBus_WriteFn_t | i2cBusWrite |
| static const McciBootloaderDeviceMethods_t | i2cDevice_deviceMethods |
| I2C device node methods. | |
| static const McciBootloaderDeviceI2cDeviceMethods_t | i2cDevice_i2cDeviceMethods |
| I2C device accessor methods. | |
| static McciBootloaderDeviceI2cDevice_ReadFn_t | i2cDeviceRead |
| static McciBootloaderDeviceI2cDevice_WriteFn_t | i2cDeviceWrite |
| #define MCCI_BOOTLOADER_STM32L0_I2C_TIME_OUT_MS 100 |
Definition at line 40 of file mccibootloader_stm32l0_i2c_bus.c.
Definition at line 43 of file mccibootloader_stm32l0_i2c_bus.c.
|
static |
|
static |
Definition at line 270 of file mccibootloader_stm32l0_i2c_bus.c.
References MCCI_STM32L0_I2C_TIMINGR, MCCI_STM32L0_REG_RCC_APB1ENR, MCCI_STM32L0_REG_RCC_APB1RSTR, MCCI_STM32L0_REG_RCC_CCIPR, McciArm_putReg(), McciArm_putRegClear(), McciArm_putRegMasked(), McciArm_putRegOr(), and McciBootloaderDevice_getI2cBusStm32l0().
|
static |
Definition at line 341 of file mccibootloader_stm32l0_i2c_bus.c.
References MCCI_STM32L0_REG_RCC_APB1ENR, MCCI_STM32L0_REG_RCC_APB1RSTR, McciArm_putRegClear(), McciArm_putRegOr(), and McciBootloaderDevice_getI2cBusStm32l0().
|
static |
Definition at line 370 of file mccibootloader_stm32l0_i2c_bus.c.
References MCCI_BOOTLOADER_FIELD_SET_VALUE, MCCI_BOOTLOADER_STM32L0_I2C_TIME_OUT_MS, MCCI_STM32L0_I2C_CR1, MCCI_STM32L0_I2C_CR1_PE, MCCI_STM32L0_I2C_CR2, MCCI_STM32L0_I2C_CR2_AUTOEND, MCCI_STM32L0_I2C_CR2_NBYTES, MCCI_STM32L0_I2C_CR2_RD_WRN, MCCI_STM32L0_I2C_CR2_SADD, MCCI_STM32L0_I2C_CR2_START, MCCI_STM32L0_I2C_ISR, MCCI_STM32L0_I2C_ISR_ARLO, MCCI_STM32L0_I2C_ISR_BERR, MCCI_STM32L0_I2C_ISR_NACKF, MCCI_STM32L0_I2C_ISR_RXNE, MCCI_STM32L0_I2C_ISR_STOPF, MCCI_STM32L0_I2C_RXDR, MCCI_STM32L0_I2C_TIMINGR, McciArm_getReg(), McciArm_putReg(), McciArm_putRegClear(), McciBootloaderDeviceI2cBus_getI2cBusStm32l0(), McciBootloaderI2cBusStm32l0_Status_ArbitrationLost, McciBootloaderI2cBusStm32l0_Status_BusError, McciBootloaderI2cBusStm32l0_Status_Busy, McciBootloaderI2cBusStm32l0_Status_Done, McciBootloaderI2cBusStm32l0_Status_NackError, McciBootloaderI2cBusStm32l0_Status_Timeout, McciBootloaderPlatform_getMilliseconds(), and status_getResult().
|
static |
Definition at line 496 of file mccibootloader_stm32l0_i2c_bus.c.
References MCCI_BOOTLOADER_FIELD_SET_VALUE, MCCI_BOOTLOADER_STM32L0_I2C_TIME_OUT_MS, MCCI_STM32L0_I2C_CR1, MCCI_STM32L0_I2C_CR1_PE, MCCI_STM32L0_I2C_CR2, MCCI_STM32L0_I2C_CR2_AUTOEND, MCCI_STM32L0_I2C_CR2_NBYTES, MCCI_STM32L0_I2C_CR2_SADD, MCCI_STM32L0_I2C_CR2_START, MCCI_STM32L0_I2C_ISR, MCCI_STM32L0_I2C_ISR_ARLO, MCCI_STM32L0_I2C_ISR_BERR, MCCI_STM32L0_I2C_ISR_BUSY, MCCI_STM32L0_I2C_ISR_NACKF, MCCI_STM32L0_I2C_ISR_STOPF, MCCI_STM32L0_I2C_ISR_TXE, MCCI_STM32L0_I2C_TIMINGR, MCCI_STM32L0_I2C_TXDR, McciArm_getReg(), McciArm_putReg(), McciArm_putRegClear(), McciBootloaderDeviceI2cBus_getI2cBusStm32l0(), McciBootloaderI2cBusStm32l0_Status_ArbitrationLost, McciBootloaderI2cBusStm32l0_Status_BusError, McciBootloaderI2cBusStm32l0_Status_Busy, McciBootloaderI2cBusStm32l0_Status_Done, McciBootloaderI2cBusStm32l0_Status_NackError, McciBootloaderI2cBusStm32l0_Status_Timeout, McciBootloaderPlatform_getMilliseconds(), and status_getResult().
|
static |
Definition at line 785 of file mccibootloader_stm32l0_i2c_bus.c.
|
static |
Definition at line 802 of file mccibootloader_stm32l0_i2c_bus.c.
| McciBootloaderDeviceI2cBus_t * McciBootloader_Stm32L0Interface_initI2cBus | ( | void * | pRamForBus, |
| size_t | sizeForBus, | ||
| const McciBootloaderDeviceI2cBusStm32l0_Config_t * | pConfig, | ||
| uint32_t | timingr100k, | ||
| uint32_t | timingr400k, | ||
| uint32_t | timingr1M | ||
| ) |
Initialize an I2C bus controller driver on an STM32L0.
| pRamForBus | Pointer to a block of RAM to be used for the driver instance data |
| sizeForBus | Size of the block of RAM. The driver checks this against the required size (must be >= sizeof(McciBootloaderDeviceI2cBusStm32l0_t)) |
| pConfig | Configuration of the I2C block; selects the controller, etc. |
| timingr100k | Value to use in timing register for 100kHz I2C operations |
| timingr400k | Value to use in timing register for 400kHz I2C operations, or MCCI_BOOTLOADER_STM32L0_I2C_TIMINGR_NOT_SUPPORTED |
| timingr1M | Value to use in timing register for 1MHz I2C operations, or MCCI_BOOTLOADER_STM32L0_I2C_TIMINGR_NOT_SUPPORTED |
For simplicity, the details of the pin mapping for the I2C I/O pins is left to the caller to control. Please set up the pins prior to using the bus.
This funcion does an implicit device begin on the initialized bus.
Definition at line 196 of file mccibootloader_stm32l0_i2c_bus.c.
References i2cBus_deviceMethods, i2cBus_i2cBusMethods, MCCI_BOOTLOADER_STM32L0_I2C_TIMINGR_NOT_SUPPORTED, McciBootloaderError_I2cBegin, McciBootloaderError_InternalConsistency, and McciBootloaderPlatform_fail().
Referenced by McciBootloaderBoard_Catena5230_systemInit().
|
static |
Definition at line 677 of file mccibootloader_stm32l0_i2c_bus.c.
References MCCIADK_C_ASSERT(), McciBootloaderI2cBusStm32l0_Status__MAX, McciBootloaderI2cBusStm32l0_Status_ArbitrationLost, McciBootloaderI2cBusStm32l0_Status_BusError, McciBootloaderI2cBusStm32l0_Status_Busy, McciBootloaderI2cBusStm32l0_Status_Done, McciBootloaderI2cBusStm32l0_Status_NackError, McciBootloaderI2cBusStm32l0_Status_NotBusy, McciBootloaderI2cBusStm32l0_Status_Stopped, and McciBootloaderI2cBusStm32l0_Status_Timeout.
Referenced by i2cBusRead(), and i2cBusWrite().
| const McciBootloaderDeviceI2cBusStm32l0_Config_t gk_McciBootloaderDeviceI2cBusStm32l0_Config_I2c1 |
global config for I2C1. Linker discards this if not used.
Definition at line 91 of file mccibootloader_stm32l0_i2c_bus.c.
| const McciBootloaderDeviceI2cBusStm32l0_Config_t gk_McciBootloaderDeviceI2cBusStm32l0_Config_I2c2 |
global config for I2C2. Linker discards this if not used.
Definition at line 104 of file mccibootloader_stm32l0_i2c_bus.c.
Referenced by McciBootloaderBoard_Catena5230_systemInit().
| const McciBootloaderDeviceI2cBusStm32l0_Config_t gk_McciBootloaderDeviceI2cBusStm32l0_Config_I2c3 |
global config for I2C3. Linker discards this if not used.
Definition at line 117 of file mccibootloader_stm32l0_i2c_bus.c.
|
static |
Definition at line 77 of file mccibootloader_stm32l0_i2c_bus.c.
Referenced by McciBootloader_Stm32L0Interface_initI2cBus().
|
static |
Definition at line 83 of file mccibootloader_stm32l0_i2c_bus.c.
Referenced by McciBootloader_Stm32L0Interface_initI2cBus().
|
static |
Definition at line 58 of file mccibootloader_stm32l0_i2c_bus.c.
|
static |
Definition at line 56 of file mccibootloader_stm32l0_i2c_bus.c.
|
static |
Definition at line 57 of file mccibootloader_stm32l0_i2c_bus.c.
|
static |
Definition at line 59 of file mccibootloader_stm32l0_i2c_bus.c.
|
static |
Definition at line 60 of file mccibootloader_stm32l0_i2c_bus.c.
|
static |
I2C device node methods.
I2C device nodes are the equivalent of Windows PDOs; they are drivers, but they exist to export device-specific functionality from the parent bus driver to the function driver that uses the specific I2C device. Thus, we can null out the method functions as the framework behavior is sufficient.
Definition at line 137 of file mccibootloader_stm32l0_i2c_bus.c.
Referenced by i2cBusAddDevice().
|
static |
I2C device accessor methods.
Definition at line 144 of file mccibootloader_stm32l0_i2c_bus.c.
Referenced by i2cBusAddDevice().
|
static |
Definition at line 62 of file mccibootloader_stm32l0_i2c_bus.c.
|
static |
Definition at line 63 of file mccibootloader_stm32l0_i2c_bus.c.