Nut/OS  5.0.5
API Reference
lpc_i2c.h
Go to the documentation of this file.
00001 #ifndef _ARCH_CM3_NXP_MACH_LPC_I2C_H_
00002 #define _ARCH_CM3_NXP_MACH_LPC_I2C_H_
00003 
00004 /*
00005  * Copyright 2012 by egnite GmbH
00006  *
00007  * All rights reserved.
00008  *
00009  * Redistribution and use in source and binary forms, with or without
00010  * modification, are permitted provided that the following conditions
00011  * are met:
00012  *
00013  * 1. Redistributions of source code must retain the above copyright
00014  *    notice, this list of conditions and the following disclaimer.
00015  * 2. Redistributions in binary form must reproduce the above copyright
00016  *    notice, this list of conditions and the following disclaimer in the
00017  *    documentation and/or other materials provided with the distribution.
00018  * 3. Neither the name of the copyright holders nor the names of
00019  *    contributors may be used to endorse or promote products derived
00020  *    from this software without specific prior written permission.
00021  *
00022  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00023  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00024  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00025  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00026  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00027  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00028  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
00029  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
00030  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00031  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
00032  * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00033  * SUCH DAMAGE.
00034  *
00035  * For additional information see http://www.ethernut.de/
00036  */
00037 
00051 
00054 #define I2C_CONSET_OFF  0x0000
00055 #define I2C0CONSET      (LPC_I2C0_BASE + I2C_CONSET_OFF)
00056 #define I2C1CONSET      (LPC_I2C1_BASE + I2C_CONSET_OFF)
00057 
00058 #define I2C_CONSET_AA   _BV(2)
00059 #define I2C_CONSET_SI   _BV(3)
00060 #define I2C_CONSET_STO  _BV(4)
00061 #define I2C_CONSET_STA  _BV(5)
00062 #define I2C_CONSET_I2EN _BV(6)
00063 
00067 #define I2C_CONCLR_OFF  0x0018
00068 #define I2C0CONCLR      (LPC_I2C0_BASE + I2C_CONCLR_OFF)
00069 #define I2C1CONCLR      (LPC_I2C1_BASE + I2C_CONCLR_OFF)
00070 
00071 #define I2C_CONCLR_AAC   _BV(2)
00072 #define I2C_CONCLR_SIC   _BV(3)
00073 #define I2C_CONCLR_STAC  _BV(5)
00074 #define I2C_CONCLR_I2ENC _BV(6)
00075 
00079 #define I2C_STAT_OFF    0x0004
00080 #define I2C0STAT        (LPC_I2C0_BASE + I2C_STAT_OFF)
00081 #define I2C1STAT        (LPC_I2C1_BASE + I2C_STAT_OFF)
00082 
00086 #define I2C_DAT_OFF     0x0008
00087 #define I2C0DAT         (LPC_I2C0_BASE + I2C_DAT_OFF)
00088 #define I2C1DAT         (LPC_I2C1_BASE + I2C_DAT_OFF)
00089 
00093 #define I2C_ADR0_OFF    0x000C
00094 #define I2C_ADR1_OFF    0x0020
00095 #define I2C_ADR2_OFF    0x0024
00096 #define I2C_ADR3_OFF    0x0028
00097 #define I2C0ADR0        (LPC_I2C0_BASE + I2C_ADR0_OFF)
00098 #define I2C0ADR1        (LPC_I2C0_BASE + I2C_ADR1_OFF)
00099 #define I2C0ADR2        (LPC_I2C0_BASE + I2C_ADR2_OFF)
00100 #define I2C0ADR3        (LPC_I2C0_BASE + I2C_ADR3_OFF)
00101 #define I2C1ADR0        (LPC_I2C1_BASE + I2C_ADR0_OFF)
00102 #define I2C1ADR1        (LPC_I2C1_BASE + I2C_ADR1_OFF)
00103 #define I2C1ADR2        (LPC_I2C1_BASE + I2C_ADR2_OFF)
00104 #define I2C1ADR3        (LPC_I2C1_BASE + I2C_ADR3_OFF)
00105 
00106 #define I2C_ADR_GC      _BV(0)
00107 
00111 #define I2C_MASK0_OFF   0x0030
00112 #define I2C_MASK1_OFF   0x0034
00113 #define I2C_MASK2_OFF   0x0038
00114 #define I2C_MASK3_OFF   0x003C
00115 #define I2C0MASK0       (LPC_I2C0_BASE + I2C_MASK0_OFF)
00116 #define I2C0MASK1       (LPC_I2C0_BASE + I2C_MASK1_OFF)
00117 #define I2C0MASK2       (LPC_I2C0_BASE + I2C_MASK2_OFF)
00118 #define I2C0MASK3       (LPC_I2C0_BASE + I2C_MASK3_OFF)
00119 #define I2C1MASK0       (LPC_I2C1_BASE + I2C_MASK0_OFF)
00120 #define I2C1MASK1       (LPC_I2C1_BASE + I2C_MASK1_OFF)
00121 #define I2C1MASK2       (LPC_I2C1_BASE + I2C_MASK2_OFF)
00122 #define I2C1MASK3       (LPC_I2C1_BASE + I2C_MASK3_OFF)
00123 
00127 #define I2C_SCLL_OFF    0x0014
00128 #define I2C0SCLL        (LPC_I2C0_BASE + I2C_SCLL_OFF)
00129 #define I2C1SCLL        (LPC_I2C1_BASE + I2C_SCLL_OFF)
00130 #define I2C_SCLH_OFF    0x0010
00131 #define I2C0SCLH        (LPC_I2C0_BASE + I2C_SCLH_OFF)
00132 #define I2C1SCLH        (LPC_I2C1_BASE + I2C_SCLH_OFF)
00133 
00137 #define I2C_MMCTRL_OFF  0x001C
00138 #define I2C0MMCTRL      (LPC_I2C0_BASE + I2C_MMCTRL_OFF)
00139 #define I2C1MMCTRL      (LPC_I2C1_BASE + I2C_MMCTRL_OFF)
00140 
00141 #define I2C_MMCTRL_MM_ENA       _BV(0)
00142 #define I2C_MMCTRL_ENA_SCL      _BV(1)
00143 #define I2C_MMCTRL_MATCH_ALL    _BV(2)
00144 
00148 #define I2C_DATA_BUFFER_OFF 0x002C
00149 #define I2C0DATA_BUFFER (LPC_I2C0_BASE + I2C_DATA_BUFFER_OFF)
00150 #define I2C1DATA_BUFFER (LPC_I2C1_BASE + I2C_DATA_BUFFER_OFF)
00151 
00154 #endif