Changeset c918737e in rtems


Ignore:
Timestamp:
Oct 24, 2013, 2:26:59 PM (6 years ago)
Author:
Christian Mauderer <Christian.Mauderer@…>
Branches:
4.11, master
Children:
0255beaf
Parents:
bb3f349
git-author:
Christian Mauderer <Christian.Mauderer@…> (10/24/13 14:26:59)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/24/13 14:29:18)
Message:

bsp/stm32f4: Add a simple I2C-driver.

Location:
c/src/lib/libbsp/arm/stm32f4
Files:
4 added
6 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/arm/stm32f4/Makefile.am

    rbb3f349 rc918737e  
    5353include_bsp_HEADERS += include/stm32f4xxxx_gpio.h
    5454include_bsp_HEADERS += include/stm32f4xxxx_rcc.h
     55include_bsp_HEADERS += include/stm32_i2c.h
     56include_bsp_HEADERS += include/i2c.h
    5557include_bsp_HEADERS += include/stm32_usart.h
    5658include_bsp_HEADERS += include/io.h
     
    107109libbsp_a_SOURCES += console/usart.c
    108110
     111# I2C
     112libbsp_a_SOURCES += i2c/i2c.c
     113libbsp_a_SOURCES += i2c/i2c-config.c
     114
    109115# Clock
    110116libbsp_a_SOURCES += ../../shared/clockdrv_shell.h
  • c/src/lib/libbsp/arm/stm32f4/configure.ac

    rbb3f349 rc918737e  
    6464RTEMS_BSPOPTS_HELP([STM32F4_ENABLE_USART_6],[enable USART 6])
    6565
     66RTEMS_BSPOPTS_SET([STM32F4_ENABLE_I2C1],[stm32f1*],[1])
     67RTEMS_BSPOPTS_SET([STM32F4_ENABLE_I2C1],[*],[])
     68RTEMS_BSPOPTS_HELP([STM32F4_ENABLE_I2C1],[enable I2C 1])
     69
     70RTEMS_BSPOPTS_SET([STM32F4_ENABLE_I2C2],[*],[])
     71RTEMS_BSPOPTS_HELP([STM32F4_ENABLE_I2C2],[enable I2C 2])
     72
    6673RTEMS_BSP_CLEANUP_OPTIONS(0, 0)
    6774RTEMS_BSP_LINKCMDS
  • c/src/lib/libbsp/arm/stm32f4/include/io.h

    rbb3f349 rc918737e  
    347347#define STM32F4_PIN_UART5_RX        STM32F4_PIN_USART_RX(3,  2, STM32F4_GPIO_REMAP_DONT_CHANGE)
    348348
     349#define STM32F4_PIN_I2C(port, idx, remapvalue) \
     350  { \
     351    { \
     352      .pin_first = STM32F4_GPIO_PIN(port, idx), \
     353      .pin_last = STM32F4_GPIO_PIN(port, idx), \
     354      .mode = STM32F4_GPIO_MODE_OUTPUT_2MHz, \
     355      .cnf = STM32F4_GPIO_CNF_OUT_AF_OD, \
     356      .output = 0, \
     357      .remap = remapvalue \
     358    } \
     359  }
     360
     361#define STM32F4_PIN_I2C1_SCL_MAP0 STM32F4_PIN_I2C(1, 6, STM32F4_GPIO_REMAP_I2C1_0)
     362#define STM32F4_PIN_I2C1_SDA_MAP0 STM32F4_PIN_I2C(1, 7, STM32F4_GPIO_REMAP_I2C1_0)
     363#define STM32F4_PIN_I2C1_SCL_MAP1 STM32F4_PIN_I2C(1, 8, STM32F4_GPIO_REMAP_I2C1_1)
     364#define STM32F4_PIN_I2C1_SDA_MAP1 STM32F4_PIN_I2C(1, 9, STM32F4_GPIO_REMAP_I2C1_1)
     365
     366#define STM32F4_PIN_I2C2_SCL      STM32F4_PIN_I2C(1, 10, STM32F4_GPIO_REMAP_DONT_CHANGE)
     367#define STM32F4_PIN_I2C2_SDA      STM32F4_PIN_I2C(1, 11, STM32F4_GPIO_REMAP_DONT_CHANGE)
     368
    349369#endif /* STM32F4_FAMILY_F10XXX */
    350370
  • c/src/lib/libbsp/arm/stm32f4/include/stm32f4.h

    rbb3f349 rc918737e  
    2929#define STM32F4_RCC ((volatile stm32f4_rcc *) (STM32F4_BASE + 0x40023800))
    3030
     31#include <bsp/stm32_i2c.h>
     32#define STM32F4_I2C3 ((volatile stm32f4_i2c *) (STM32F4_BASE + 0x40005C00))
     33#define STM32F4_I2C2 ((volatile stm32f4_i2c *) (STM32F4_BASE + 0x40005800))
     34#define STM32F4_I2C1 ((volatile stm32f4_i2c *) (STM32F4_BASE + 0x40005400))
     35
    3136#include <bsp/stm32_usart.h>
    3237#define STM32F4_USART_1 ((volatile stm32f4_usart *) (STM32F4_BASE + 0x40011000))
     
    5156#define STM32F4_RCC ((volatile stm32f4_rcc *) (STM32F4_BASE + 0x40021000))
    5257
     58#include <bsp/stm32_i2c.h>
     59#define STM32F4_I2C2 ((volatile stm32f4_i2c *) (STM32F4_BASE + 0x40005800))
     60#define STM32F4_I2C1 ((volatile stm32f4_i2c *) (STM32F4_BASE + 0x40005400))
     61
    5362#include <bsp/stm32_usart.h>
    5463#define STM32F4_USART_1 ((volatile stm32f4_usart *) (STM32F4_BASE + 0x40013800))
  • c/src/lib/libbsp/arm/stm32f4/preinstall.am

    rbb3f349 rc918737e  
    126126PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/stm32f4xxxx_rcc.h
    127127
     128$(PROJECT_INCLUDE)/bsp/stm32_i2c.h: include/stm32_i2c.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
     129        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/stm32_i2c.h
     130PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/stm32_i2c.h
     131
     132$(PROJECT_INCLUDE)/bsp/i2c.h: include/i2c.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
     133        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/i2c.h
     134PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/i2c.h
     135
    128136$(PROJECT_INCLUDE)/bsp/stm32_usart.h: include/stm32_usart.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
    129137        $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/stm32_usart.h
  • c/src/lib/libbsp/arm/stm32f4/startup/start-config-io.c

    rbb3f349 rc918737e  
    4242    STM32F4_PIN_USART6_RX_PC7,
    4343  #endif
     44  #ifdef STM32F4_ENABLE_I2C1
     45    #error Not implemented.
     46  #endif
     47  #ifdef STM32F4_ENABLE_I2C2
     48    #error Not implemented.
     49  #endif
    4450#endif /* STM32F4_FAMILY_F4XXXX */
    4551#ifdef STM32F4_FAMILY_F10XXX
     
    6470    STM32F4_PIN_UART5_RX,
    6571  #endif
     72  #ifdef STM32F4_ENABLE_USART_6
     73    #error STM32F10XXX has no USART 6
     74  #endif
     75  #ifdef STM32F4_ENABLE_I2C1
     76    STM32F4_PIN_I2C1_SCL_MAP0,
     77    STM32F4_PIN_I2C1_SDA_MAP0,
     78  #endif
     79  #ifdef STM32F4_ENABLE_I2C2
     80    STM32F4_PIN_I2C2_SCL,
     81    STM32F4_PIN_I2C2_SDA,
     82  #endif
    6683#endif /* STM32F4_FAMILY_F10XXX */
    6784  STM32F4_GPIO_CONFIG_TERMINAL
Note: See TracChangeset for help on using the changeset viewer.