summaryrefslogtreecommitdiff
path: root/ecos/packages/hal/cortexm/lm3s/ek_lm3s811
diff options
context:
space:
mode:
Diffstat (limited to 'ecos/packages/hal/cortexm/lm3s/ek_lm3s811')
-rw-r--r--ecos/packages/hal/cortexm/lm3s/ek_lm3s811/current/ChangeLog39
-rw-r--r--ecos/packages/hal/cortexm/lm3s/ek_lm3s811/current/cdl/hal_cortexm_ek_lm3s811.cdl78
-rw-r--r--ecos/packages/hal/cortexm/lm3s/ek_lm3s811/current/doc/ek_lm3s811.sgml140
-rw-r--r--ecos/packages/hal/cortexm/lm3s/ek_lm3s811/current/src/ek_lm3s811_misc.c163
-rw-r--r--ecos/packages/hal/cortexm/lm3s/ek_lm3s811/current/src/platform_i2c.c178
5 files changed, 598 insertions, 0 deletions
diff --git a/ecos/packages/hal/cortexm/lm3s/ek_lm3s811/current/ChangeLog b/ecos/packages/hal/cortexm/lm3s/ek_lm3s811/current/ChangeLog
new file mode 100644
index 0000000..738b455
--- /dev/null
+++ b/ecos/packages/hal/cortexm/lm3s/ek_lm3s811/current/ChangeLog
@@ -0,0 +1,39 @@
+2011-02-09 John Dallaway <john@dallaway.org.uk>
+
+ * doc/ek_lm3s811.sgml: Eliminate underscores in SGML ID strings. They
+ cause problems for some installations of openjade.
+
+ * cdl/hal_cortexm_ek_lm3s811.cdl: Fix documentation filename to match
+ the above change.
+
+2011-01-18 Christophe Coutand <ccoutand@stmi.com>
+
+ * cdl/hal_cortexm_ek_lm3s811.cdl:
+ * doc/ek_lm3s811.sgml:
+ * src/ek_lm3s811_misc.c:
+ * src/platform_i2c.c:
+ New package -- Stellaris Cortex-M3 EK-LM3S811 platform HAL.
+
+//===========================================================================
+// ####GPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 or (at your option) any
+// later version.
+//
+// This program is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the
+// Free Software Foundation, Inc., 51 Franklin Street,
+// Fifth Floor, Boston, MA 02110-1301, USA.
+// -------------------------------------------
+// ####GPLCOPYRIGHTEND####
+//===========================================================================
diff --git a/ecos/packages/hal/cortexm/lm3s/ek_lm3s811/current/cdl/hal_cortexm_ek_lm3s811.cdl b/ecos/packages/hal/cortexm/lm3s/ek_lm3s811/current/cdl/hal_cortexm_ek_lm3s811.cdl
new file mode 100644
index 0000000..ee64fb1
--- /dev/null
+++ b/ecos/packages/hal/cortexm/lm3s/ek_lm3s811/current/cdl/hal_cortexm_ek_lm3s811.cdl
@@ -0,0 +1,78 @@
+# ====================================================================
+##
+## hal_cortexm_ek_lm3s811.cdl
+##
+## Stellaris Cortex-M3 EK-LM3S811 board platform HAL
+##
+# ====================================================================
+## ####ECOSGPLCOPYRIGHTBEGIN####
+## -------------------------------------------
+## This file is part of eCos, the Embedded Configurable Operating System.
+## Copyright (C) 2011 Free Software Foundation, Inc.
+##
+## eCos is free software; you can redistribute it and/or modify it under
+## the terms of the GNU General Public License as published by the Free
+## Software Foundation; either version 2 or (at your option) any later
+## version.
+##
+## eCos is distributed in the hope that it will be useful, but WITHOUT
+## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+## for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with eCos; if not, write to the Free Software Foundation, Inc.,
+## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+##
+## As a special exception, if other files instantiate templates or use
+## macros or inline functions from this file, or you compile this file
+## and link it with other works to produce a work based on this file,
+## this file does not by itself cause the resulting work to be covered by
+## the GNU General Public License. However the source code for this file
+## must still be made available in accordance with section (3) of the GNU
+## General Public License v2.
+##
+## This exception does not invalidate any other reasons why a work based
+## on this file might be covered by the GNU General Public License.
+## -------------------------------------------
+## ####ECOSGPLCOPYRIGHTEND####
+# ====================================================================
+######DESCRIPTIONBEGIN####
+#
+# Author(s): ccoutand
+# Contributors:
+# Date: 2011-01-18
+#
+#####DESCRIPTIONEND####
+#
+# ====================================================================
+
+cdl_package CYGPKG_HAL_CORTEXM_EK_LM3S811 {
+ display "Stellaris EK-LM3S811 Development Board HAL"
+ doc ref/hal-cortexm-lm3s-ek-lm3s811.html
+ parent CYGPKG_HAL_CORTEXM_LM3S8XX
+ define_header hal_cortexm_ek_lm3s811.h
+ include_dir cyg/hal
+ hardware
+
+ description "
+ The EK-LM3S811 HAL package provides the support needed to run
+ eCos on the Stellaris EK-LM3S811 EVAL board."
+
+ compile ek_lm3s811_misc.c platform_i2c.c
+
+ requires { CYGHWR_HAL_CORTEXM_LM3S == "LM3S8XX" }
+ requires { CYGHWR_HAL_CORTEXM_LM3S8XX == "LM3S811" }
+ requires { CYGNUM_HAL_CORTEXM_LM3S8XX_XTAL_FREQ == 6000000 }
+ requires { CYGHWR_HAL_CORTEXM_LM3S8XX_CLOCK_EXT == 1 }
+
+ define_proc {
+ puts $::cdl_system_header "#define CYGBLD_HAL_PLATFORM_H <pkgconf/hal_cortexm_ek_lm3s811.h>"
+ puts $::cdl_header "#include <pkgconf/hal_cortexm_lm3s8xx.h>"
+ puts $::cdl_header "#define HAL_PLATFORM_CPU \"Cortex-M3 - LM3S811\""
+ puts $::cdl_header "#define HAL_PLATFORM_BOARD \"Stellaris EK-LM3S811\""
+ puts $::cdl_header "#define HAL_PLATFORM_EXTRA \"\""
+ }
+}
+
+# EOF hal_cortexm_ek_lm3s811.cdl
diff --git a/ecos/packages/hal/cortexm/lm3s/ek_lm3s811/current/doc/ek_lm3s811.sgml b/ecos/packages/hal/cortexm/lm3s/ek_lm3s811/current/doc/ek_lm3s811.sgml
new file mode 100644
index 0000000..f358d73
--- /dev/null
+++ b/ecos/packages/hal/cortexm/lm3s/ek_lm3s811/current/doc/ek_lm3s811.sgml
@@ -0,0 +1,140 @@
+<!-- DOCTYPE part PUBLIC "-//OASIS//DTD DocBook V3.1//EN" -->
+
+<!-- {{{ Banner -->
+
+<!-- =============================================================== -->
+<!-- -->
+<!-- ek_lm3s811.sgml -->
+<!-- -->
+<!-- ek_lm3s811 board documentation. -->
+<!-- -->
+<!-- =============================================================== -->
+<!-- ####ECOSDOCCOPYRIGHTBEGIN#### -->
+<!-- =============================================================== -->
+<!-- Copyright (C) 2011 Free Software Foundation, Inc. -->
+<!-- This material may be distributed only subject to the terms -->
+<!-- and conditions set forth in the Open Publication License, v1.0 -->
+<!-- or later (the latest version is presently available at -->
+<!-- http://www.opencontent.org/openpub/) -->
+<!-- Distribution of the work or derivative of the work in any -->
+<!-- standard (paper) book form is prohibited unless prior -->
+<!-- permission obtained from the copyright holder -->
+<!-- =============================================================== -->
+<!-- ####ECOSDOCCOPYRIGHTEND#### -->
+<!-- =============================================================== -->
+<!-- #####DESCRIPTIONBEGIN#### -->
+<!-- -->
+<!-- Author(s): ccoutand -->
+<!-- Contact(s): ccoutand -->
+<!-- Date: 2011/01/18 -->
+<!-- Version: 0.01 -->
+<!-- -->
+<!-- ####DESCRIPTIONEND#### -->
+<!-- =============================================================== -->
+
+<!-- }}} -->
+
+<part id="hal-cortexm-lm3s-ek-lm3s811"><title>Stellaris EKK-LM3S811 Board Support</title>
+
+<refentry id="lm3s-ek-lm3s811">
+ <refmeta>
+ <refentrytitle>Overview</refentrytitle>
+ </refmeta>
+ <refnamediv>
+ <refname>eCos Support for the Stellaris EKK-LM3S811 Board</refname>
+ <refpurpose>Overview</refpurpose>
+ </refnamediv>
+
+ <refsect1 id="lm3s-ek-lm3s811-description"><title>Description</title>
+ <para>
+The Stellaris EKK-LM3S811 evaluation kit uses the Stellaris LM3S811 microcontroller from the
+800 Series. The LM3S811 is an ARM cortex-M3 based microcontroller with 64KB of FLASH
+and 8KB of SRAM. The device has various peripherals such as UART, I2C, ADC or Analog
+Comparator. The kit features an OLED graphical display and UART0 is accessible via the
+on-board USB to UART converter.
+ </para>
+ <para>
+Due to extreme limited RAM ressources (8KB SRAM only), the eCos port targets standalone ROM
+application using the eCos kernel in single user thread environment. The cortex-M architecture HAL
+requires a seperate stack to handle interrupts, thus the minimum kernel enable application requires 3
+stacks. The interrupt stack, the Idle thread stack and the user stack. All stacks are set to the architecture
+minimum allowed size of CYGNUM_HAL_STACK_SIZE_MINIMUM ( 1360 bytes ).
+ </para>
+ </refsect1>
+
+ <refsect1 id="lm3s-ek-lm3s811-config"><title>Configuration</title>
+ <para>
+The minimum board configuration includes the Microcontroller HAL alongs with the ADC and I2C device
+drivers.
+ </para>
+ <variablelist>
+ <varlistentry>
+ <term><varname>LM3S811 Microcontroller</varname></term>
+ <listitem>
+ <para>
+CYGPKG_HAL_CORTEXM_LM3S8XX - The microcontroller configuration
+requirements are minimal. With the default setup, the microcontroller runs from the
+external clock source, a crystal of 6MHz. The chip internal PLL generates a fix
+200MHz clock that is divided down to the default system clock frequency of 50MHz.
+In this scenario, the device uses full processing power. The system clock divider
+allows down scaling of the system clock frequency to reduce the overall power
+consumption of the device. The microcontroller also offers the option to run from an
+internal oscillator. This option has 2 modes, 3MHz or 12MHz. When selecting the
+internal oscillator, the PLL is bypassed. The system clock frequency becomes at
+best 12MHz if no further clock division is applied.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><varname>I2C Interface</varname></term>
+ <listitem><para>
+CYGPKG_DEVS_I2C_CORTEXM_LM3S - The microcontroller uses the I2C bus
+to communicate with the SD1300 controller of the OLED 96 x 16 display. The SD1300
+controller eCos driver is not currently available.
+The I2C is default set to use the low frequency mode ( 100KHz bus clock ). The high
+frequency mode ( 400 KHz ) is available by changing CYGNUM_HAL_CORTEXM_LM3S_I2C_CLK_SPEED.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><varname>ADC Interface</varname></term>
+ <listitem><para>
+CYGPKG_DEVS_ADC_CORTEXM_LM3S - The LM3S811 includes 4 ADC channels including an
+optional internal temperature probe. There are many ways to use the on-chip ADC.
+The current eCos driver uses a single sequencer (sequencer 0) to schedule sampling of all
+channels. This practically means that all channels are sampled from the same trigger, a periodic timer
+interrupt in the current driver. The timer to use
+is selected from CYGNUM_DEVS_ADC_CORTEXM_LM3S_ADC0_SELECT_TIMER, with timer 0 as
+default value. The timer is used in 32 bits periodic mode, therefore cannot be re-used
+for any other user purpose. While the ADC has the possibility to trigger sampling on external
+IO events, the driver does not offer that flexibility. Finally, the driver only allows measurement of
+single-ended IOs.
+ </para></listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect1>
+
+ <refsect1 id="lm3s-ek-lm3s811-rebuild"><title>Build ROM type applications</title>
+ <para>
+The steps needed to build the HAL library for the EKK-LM3S811 board are:
+ </para>
+ <screen>
+$ mkdir ek_lm3s811
+$ cd ek_lm3s811
+$ ecosconfig new ek-lm3s811 minimal
+$ ecosconfig import $ECOS_REPOSITORY/hal/cortexm/lm3s/ek_lm3s811/current/misc/default_ROM.ecm
+$ ecosconfig resolve
+$ ecosconfig tree
+$ make
+ </screen>
+ <para>
+At the end of the build the <filename
+class="directory">install/lib</filename> subdirectory should contain the library and linker script and the <filename
+class="directory">install/include</filename> subdirectory the necessary includes to compile the application.
+ </para>
+ </refsect1>
+
+
+</refentry>
+
+</part>
diff --git a/ecos/packages/hal/cortexm/lm3s/ek_lm3s811/current/src/ek_lm3s811_misc.c b/ecos/packages/hal/cortexm/lm3s/ek_lm3s811/current/src/ek_lm3s811_misc.c
new file mode 100644
index 0000000..e77ef6c
--- /dev/null
+++ b/ecos/packages/hal/cortexm/lm3s/ek_lm3s811/current/src/ek_lm3s811_misc.c
@@ -0,0 +1,163 @@
+//==========================================================================
+//
+// ek_lm3s811_misc.c
+//
+// Cortex-M3 Stellaris EK-LM3S811 HAL functions
+//
+//==========================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2008, 2011 Free Software Foundation, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later
+// version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): Original for STM3210E EVAL: nickg
+// Updated for EK-LM3S811: ccoutand
+// Date: 2011-01-18
+// Description:
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+#include <pkgconf/hal.h>
+
+#include <cyg/infra/diag.h>
+#include <cyg/infra/cyg_type.h>
+#include <cyg/infra/cyg_trac.h> // tracing macros
+#include <cyg/infra/cyg_ass.h> // assertion macros
+
+#include <cyg/hal/hal_arch.h>
+#include <cyg/hal/hal_intr.h>
+
+
+// On-board status LED
+#define CYGHWR_HAL_EK_LM3S811_STATUS_LED \
+ CYGHWR_HAL_LM3S_GPIO( C, 5, OUT, 4_MA, PULLUP, DISABLE )
+
+// OLED regulator control
+#define CYGHWR_HAL_EK_LM3S811_OLED_PWD \
+ CYGHWR_HAL_LM3S_GPIO( D, 7, OUT, NONE, NONE, DISABLE )
+
+
+//==========================================================================
+// Drive OLED power ON/OFF IO
+
+__externC void
+hal_ek_lm3s811_oled_pwd( bool pwd )
+{
+ cyg_uint32 oled_pwd_io = CYGHWR_HAL_EK_LM3S811_OLED_PWD;
+
+ // Power ON regulator
+ if ( pwd == true )
+ CYGHWR_HAL_LM3S_GPIO_OUT( oled_pwd_io, 1 );
+ else
+ CYGHWR_HAL_LM3S_GPIO_OUT( oled_pwd_io, 0 );
+}
+
+
+//==========================================================================
+// Setup platform
+
+__externC void
+hal_platform_init( void )
+{
+ cyg_uint32 led_io = CYGHWR_HAL_EK_LM3S811_STATUS_LED;
+ cyg_uint32 oled_pwd_io = CYGHWR_HAL_EK_LM3S811_OLED_PWD;
+
+ // OLED power switch IO is on port D and user LED on port C
+ CYGHWR_HAL_LM3S_PERIPH_SET( CYGHWR_HAL_LM3S_P_GPIOC, 1 );
+ CYGHWR_HAL_LM3S_PERIPH_SET( CYGHWR_HAL_LM3S_P_GPIOD, 1 );
+ CYGHWR_HAL_LM3S_PERIPH_SET( CYGHWR_HAL_LM3S_P_I2C0, 0 );
+
+ // Status LED -> ON
+ CYGHWR_HAL_LM3S_GPIO_SET( led_io );
+ CYGHWR_HAL_LM3S_GPIO_OUT( led_io, 1 );
+
+ // Shutdown power regulator
+ CYGHWR_HAL_LM3S_GPIO_SET( oled_pwd_io );
+
+ hal_ek_lm3s811_oled_pwd( false );
+}
+
+
+//==========================================================================
+
+#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
+
+#include CYGHWR_MEMORY_LAYOUT_H
+
+//--------------------------------------------------------------------------
+// Accesses to areas not backed by real devices or memory can cause
+// the CPU to hang.
+//
+// The following table defines the memory areas that GDB is allowed to
+// touch. All others are disallowed.
+// This table needs to be kept up to date with the set of memory areas
+// that are available on the board.
+
+static struct {
+ CYG_ADDRESS start; // Region start address
+ CYG_ADDRESS end; // End address (last byte)
+} hal_data_access[] = {
+#ifdef CYGMEM_REGION_sram // On-chip SRAM
+ {
+ CYGMEM_REGION_sram, CYGMEM_REGION_sram + CYGMEM_REGION_sram_SIZE - 1},
+#endif
+#ifdef CYGMEM_REGION_flash // On-chip flash
+ {
+ CYGMEM_REGION_flash,
+ CYGMEM_REGION_flash + CYGMEM_REGION_flash_SIZE - 1},
+#endif
+ {
+ 0xE0000000, 0x00000000 - 1}, // Cortex-M peripherals
+ {
+ 0x40000000, 0x50000000 - 1}, // Stellaris peripherals
+};
+
+__externC int
+cyg_hal_stub_permit_data_access( CYG_ADDRESS addr, cyg_uint32 count )
+{
+ int i;
+ for( i = 0; i < sizeof( hal_data_access ) / sizeof( hal_data_access[0] );
+ i++ ) {
+ if( ( addr >= hal_data_access[i].start )
+ && ( addr + count ) <= hal_data_access[i].end )
+ return true;
+ }
+ return false;
+}
+
+#endif // CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
+
+
+//==========================================================================
+// EOF ek_lm3s811_misc.c
diff --git a/ecos/packages/hal/cortexm/lm3s/ek_lm3s811/current/src/platform_i2c.c b/ecos/packages/hal/cortexm/lm3s/ek_lm3s811/current/src/platform_i2c.c
new file mode 100644
index 0000000..0889f36
--- /dev/null
+++ b/ecos/packages/hal/cortexm/lm3s/ek_lm3s811/current/src/platform_i2c.c
@@ -0,0 +1,178 @@
+//==========================================================================
+//
+// platform_i2c.c
+//
+// Optional I2C support for Cortex-M3 Stellaris EK-LM3S811
+//
+//==========================================================================
+// ####ECOSGPLCOPYRIGHTBEGIN####
+// -------------------------------------------
+// This file is part of eCos, the Embedded Configurable Operating System.
+// Copyright (C) 2011 Free Software Foundation, Inc.
+//
+// eCos is free software; you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 or (at your option) any later
+// version.
+//
+// eCos is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+// for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with eCos; if not, write to the Free Software Foundation, Inc.,
+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+//
+// As a special exception, if other files instantiate templates or use
+// macros or inline functions from this file, or you compile this file
+// and link it with other works to produce a work based on this file,
+// this file does not by itself cause the resulting work to be covered by
+// the GNU General Public License. However the source code for this file
+// must still be made available in accordance with section (3) of the GNU
+// General Public License v2.
+//
+// This exception does not invalidate any other reasons why a work based
+// on this file might be covered by the GNU General Public License.
+// -------------------------------------------
+// ####ECOSGPLCOPYRIGHTEND####
+//==========================================================================
+//#####DESCRIPTIONBEGIN####
+//
+// Author(s): ccoutand
+// Contributors:
+// Date: 2011-01-18
+// Purpose:
+// Description:
+//
+//####DESCRIPTIONEND####
+//
+//==========================================================================
+
+
+//=============================================================================
+// INCLUDES
+//=============================================================================
+#include <pkgconf/system.h>
+#include <cyg/infra/cyg_type.h>
+#include <cyg/hal/hal_io.h>
+#include <cyg/infra/cyg_ass.h>
+#include <cyg/hal/hal_endian.h>
+#include <cyg/hal/hal_intr.h>
+
+#ifdef CYGPKG_DEVS_I2C_CORTEXM_LM3S
+
+#include <cyg/io/i2c.h>
+#include <cyg/io/i2c_lm3s.h>
+
+//=============================================================================
+// Setup I2C bus 0
+//
+static void
+lm3s8xx_i2c0_init( struct cyg_i2c_bus *bus )
+{
+ cyg_uint32 scl_io = CYGHWR_HAL_LM3S_I2C_SCL;
+ cyg_uint32 sda_io = CYGHWR_HAL_LM3S_I2C_SDA;
+
+ //
+ // We only need to setup the pins here and
+ // leave the I2C driver to take care of the rest.
+ //
+ CYGHWR_HAL_LM3S_PERIPH_SET( CYGHWR_HAL_LM3S_P_GPIOB, 1 );
+ CYGHWR_HAL_LM3S_GPIO_SET( scl_io );
+ CYGHWR_HAL_LM3S_GPIO_SET( sda_io );
+ lm3s_i2c_init( bus );
+}
+
+
+//-----------------------------------------------------------------------------
+// I2C bus 0
+//
+CYG_LM3S_I2C_BUS(hal_lm3s8xx_i2c0_bus,
+ &lm3s8xx_i2c0_init,
+ CYGHWR_HAL_LM3S_I2C_M0,
+ CYGHWR_HAL_LM3S_P_I2C0,
+ CYGNUM_HAL_INTERRUPT_I2C,
+ 0x60,
+ 10);
+
+
+//-----------------------------------------------------------------------------
+// OLED
+//
+CYG_I2C_DEVICE(i2c_lm3s8xx_oled,
+ &hal_lm3s8xx_i2c0_bus,
+ 0x3d,
+ 0,
+ CYG_I2C_DEFAULT_DELAY);
+
+
+#define DELAY 1
+
+// Wrapper to TI OLED driver
+
+externC cyg_uint32
+lm3s8xx_oled_write_first( cyg_uint8 byte )
+{
+ cyg_uint32 result;
+
+ cyg_i2c_transaction_begin( &i2c_lm3s8xx_oled );
+
+ result = cyg_i2c_transaction_tx( &i2c_lm3s8xx_oled,
+ true, ( cyg_uint8 * )&byte, 1, false );
+
+#ifdef CYGPKG_KERNEL
+ cyg_thread_delay( DELAY );
+#endif
+
+ return result;
+}
+
+externC cyg_uint32
+lm3s8xx_oled_write_byte( cyg_uint8 byte )
+{
+ cyg_uint32 result;
+
+ result = cyg_i2c_transaction_tx( &i2c_lm3s8xx_oled,
+ false, ( cyg_uint8 * )&byte, 1, false );
+
+#ifdef CYGPKG_KERNEL
+ cyg_thread_delay( DELAY );
+#endif
+
+ return result;
+}
+
+
+externC cyg_uint32
+lm3s8xx_oled_write_array( const cyg_uint8 *array, cyg_uint32 count )
+{
+ cyg_uint32 result;
+
+ result = cyg_i2c_transaction_tx( &i2c_lm3s8xx_oled,
+ false, array, count, false );
+
+ return result;
+}
+
+
+externC cyg_uint32
+lm3s8xx_oled_write_final( cyg_uint8 byte )
+{
+ cyg_uint32 result;
+
+ result = cyg_i2c_transaction_tx( &i2c_lm3s8xx_oled,
+ false, ( cyg_uint8 * )&byte, 1, true );
+#ifdef CYGPKG_KERNEL
+ cyg_thread_delay( DELAY );
+#endif
+
+ cyg_i2c_transaction_end( &i2c_lm3s8xx_oled );
+
+ return result;
+}
+
+#endif // #ifdef CYGPKG_DEVS_I2C_CORTEXM_LM3S
+
+//-----------------------------------------------------------------------------
+// EOF platform_i2c.c