source: rtems/c/src/lib/libbsp/powerpc/mpc55xxevb/i2c/i2c_init.c @ dbb3211a

4.115
Last change on this file since dbb3211a was dbb3211a, checked in by Sebastian Huber <sebastian.huber@…>, on 12/22/10 at 14:21:03

2010-12-22 Sebastian Huber <sebastian.huber@…>

  • configure.ac: Added I2C options. Fixed eMIOS prescaler. Use standard linker command file support.
  • include/bsp.h: Declare I2C initialization function.
  • i2c/i2c_init.c: Implementation.
  • make/custom/gwlcfm.cfg, make/custom/mpc5566evb.cfg, make/custom/mpc55xx.inc: Use standard linker command file support.
  • startup/bspstart.c: More board specific settings.
  • Makefile.am, preinstall.am: Reflect changes above.
  • Property mode set to 100644
File size: 2.3 KB
Line 
1/*===============================================================*\
2| Project: RTEMS support for GWLCFM                               |
3+-----------------------------------------------------------------+
4|                    Copyright (c) 2010                           |
5|                    Embedded Brains GmbH                         |
6|                    Obere Lagerstr. 30                           |
7|                    D-82178 Puchheim                             |
8|                    Germany                                      |
9|                    rtems@embedded-brains.de                     |
10+-----------------------------------------------------------------+
11| The license and distribution terms for this file may be         |
12| found in the file LICENSE in this distribution or at            |
13|                                                                 |
14| http://www.rtems.com/license/LICENSE.                           |
15|                                                                 |
16+-----------------------------------------------------------------+
17| this file contains the low level MPC5516 I2C driver parameters  |
18\*===============================================================*/
19
20#include <libchip/i2c-2b-eeprom.h>
21
22#include <bsp.h>
23#include <bsp/irq.h>
24#include <bsp/mpc83xx_i2cdrv.h>
25
26#ifdef MPC55XX_IRQ_I2C
27  static mpc83xx_i2c_desc_t mpc55xx_i2c_bus = {
28    .bus_desc = {
29      .ops = &mpc83xx_i2c_ops,
30      .size = sizeof(mpc55xx_i2c_bus),
31    },
32    .softc = {
33      .reg_ptr = (m83xxI2CRegisters_t *) 0xfff88000,
34      .initialized = FALSE,
35      .irq_number = MPC55XX_IRQ_I2C,
36      .base_frq = 0
37    }
38  };
39
40  rtems_status_code bsp_register_i2c(void)
41  {
42    int rv = 0;
43    int busno = 0;
44 
45    rtems_libi2c_initialize ();
46 
47    mpc55xx_i2c_bus.softc.base_frq = bsp_clock_speed;
48    busno = rtems_libi2c_register_bus(
49      "/dev/i2c1",
50      &mpc55xx_i2c_bus.bus_desc
51    );
52    if (busno < 0) {
53      return RTEMS_IO_ERROR;
54    }
55
56    #ifdef RTEMS_BSP_I2C_EEPROM_DEVICE_NAME
57      rv = rtems_libi2c_register_drv(
58        RTEMS_BSP_I2C_EEPROM_DEVICE_NAME,
59        i2c_2b_eeprom_driver_descriptor,
60        busno,
61        0x51
62      );
63      if (rv < 0) {
64        return RTEMS_IO_ERROR;
65      }
66    #endif
67 
68    return RTEMS_SUCCESSFUL;
69  }
70#endif
Note: See TracBrowser for help on using the repository browser.