SAM3/4: Add a TWI driver for the SAM4CM. From Max Neklyudov.

This commit is contained in:
Max Neklyudov 2015-06-22 09:32:15 -06:00 committed by Gregory Nutt
parent 633a2b3be2
commit 0920de059a
4 changed files with 1434 additions and 0 deletions

View File

@ -552,31 +552,56 @@ config SAM34_TRNG
default n
depends on ARCH_CHIP_SAM3X || ARCH_CHIP_SAM3A || ARCH_CHIP_SAM4L
config SAM34_TWI
bool
default n
config SAM34_TWIM
bool
default n
config SAM34_TWIS
bool
default n
config SAM34_TWIM0
bool "Two-wire Master Interface 0 (TWIM0)"
default n
select SAM34_TWI
select SAM34_TWIM
config SAM34_TWIS0
bool "Two-wire Slave Interface 0 (TWIS0)"
default n
select SAM34_TWI
select SAM34_TWIS
config SAM34_TWIM1
bool "Two-wire Master Interface 1 (TWIM1)"
default n
select SAM34_TWI
select SAM34_TWIM
config SAM34_TWIS1
bool "Two-wire Slave Interface 1 (TWIS1)"
default n
select SAM34_TWI
select SAM34_TWIS
config SAM34_TWIM2
bool "Two-wire Master Interface 2 (TWIM2)"
default n
depends on ARCH_CHIP_SAM4L
select SAM34_TWI
select SAM34_TWIM
config SAM34_TWIM3
bool "Two-wire Master Interface 3 (TWIM3)"
default n
depends on ARCH_CHIP_SAM4L
select SAM34_TWI
select SAM34_TWIM
config SAM34_UART0
bool "UART 0"

View File

@ -166,6 +166,10 @@ CHIP_CSRCS += sam_spi.c
endif
endif
ifeq ($(CONFIG_SAM34_TWIM),y)
CHIP_CSRCS += sam_twi.c
endif
ifeq ($(CONFIG_SAM34_AES),y)
CHIP_CSRCS += sam_aes.c
endif

1342
arch/arm/src/sam34/sam_twi.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,63 @@
/************************************************************************************
* arch/arm/src/sam34/sam_twi.h
*
* Copyright (C) 2013 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
#ifndef __ARCH_ARM_SRC_SAM34_SAM_TWI_H
#define __ARCH_ARM_SRC_SAM34_SAM_TWI_H
/************************************************************************************
* Included Files
************************************************************************************/
#include <nuttx/config.h>
#include <nuttx/i2c.h>
#include "chip/sam_twi.h"
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
/************************************************************************************
* Public Types
************************************************************************************/
/************************************************************************************
* Public Data
************************************************************************************/
/************************************************************************************
* Public Functions
************************************************************************************/
#endif /* __ARCH_ARM_SRC_SAM34_SAM_TWI_H */