mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 15:58:59 +08:00
Tiva SPI: Cosmetic improvements
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/************************************************************************************
|
/************************************************************************************
|
||||||
* arch/arm/src/tiva/tiva_i2c.c
|
* arch/arm/src/tiva/tiva_i2c.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||||
*
|
*
|
||||||
* The basic structure of this driver derives in spirit (if nothing more) from the
|
* The basic structure of this driver derives in spirit (if nothing more) from the
|
||||||
@@ -2233,60 +2233,70 @@ struct i2c_dev_s *up_i2cinitialize(int port)
|
|||||||
config = &tiva_i2c0_config;
|
config = &tiva_i2c0_config;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_TIVA_I2C1
|
#ifdef CONFIG_TIVA_I2C1
|
||||||
case 1:
|
case 1:
|
||||||
priv = &tiva_i2c1_priv;
|
priv = &tiva_i2c1_priv;
|
||||||
config = &tiva_i2c1_config;
|
config = &tiva_i2c1_config;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_TIVA_I2C2
|
#ifdef CONFIG_TIVA_I2C2
|
||||||
case 2:
|
case 2:
|
||||||
priv = &tiva_i2c2_priv;
|
priv = &tiva_i2c2_priv;
|
||||||
config = &tiva_i2c2_config;
|
config = &tiva_i2c2_config;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_TIVA_I2C3
|
#ifdef CONFIG_TIVA_I2C3
|
||||||
case 3:
|
case 3:
|
||||||
priv = &tiva_i2c3_priv;
|
priv = &tiva_i2c3_priv;
|
||||||
config = &tiva_i2c3_config;
|
config = &tiva_i2c3_config;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_TIVA_I2C4
|
#ifdef CONFIG_TIVA_I2C4
|
||||||
case 4:
|
case 4:
|
||||||
priv = &tiva_i2c4_priv;
|
priv = &tiva_i2c4_priv;
|
||||||
config = &tiva_i2c4_config;
|
config = &tiva_i2c4_config;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_TIVA_I2C5
|
#ifdef CONFIG_TIVA_I2C5
|
||||||
case 5:
|
case 5:
|
||||||
priv = &tiva_i2c5_priv;
|
priv = &tiva_i2c5_priv;
|
||||||
config = &tiva_i2c5_config;
|
config = &tiva_i2c5_config;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_TIVA_I2C6
|
#ifdef CONFIG_TIVA_I2C6
|
||||||
case 6:
|
case 6:
|
||||||
priv = &tiva_i2c6_priv;
|
priv = &tiva_i2c6_priv;
|
||||||
config = &tiva_i2c6_config;
|
config = &tiva_i2c6_config;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_TIVA_I2C7
|
#ifdef CONFIG_TIVA_I2C7
|
||||||
case 7:
|
case 7:
|
||||||
priv = &tiva_i2c7_priv;
|
priv = &tiva_i2c7_priv;
|
||||||
config = &tiva_i2c7_config;
|
config = &tiva_i2c7_config;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_TIVA_I2C8
|
#ifdef CONFIG_TIVA_I2C8
|
||||||
case 8:
|
case 8:
|
||||||
priv = &tiva_i2c8_priv;
|
priv = &tiva_i2c8_priv;
|
||||||
config = &tiva_i2c8_config;
|
config = &tiva_i2c8_config;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CONFIG_TIVA_I2C9
|
#ifdef CONFIG_TIVA_I2C9
|
||||||
case 9:
|
case 9:
|
||||||
priv = &tiva_i2c9_priv;
|
priv = &tiva_i2c9_priv;
|
||||||
config = &tiva_i2c9_config;
|
config = &tiva_i2c9_config;
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
i2cdbg("I2C%d: ERROR: Not supported\n", port);
|
i2cdbg("I2C%d: ERROR: Not supported\n", port);
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -2294,8 +2304,10 @@ struct i2c_dev_s *up_i2cinitialize(int port)
|
|||||||
|
|
||||||
/* Allocate instance */
|
/* Allocate instance */
|
||||||
|
|
||||||
if (!(inst = kmm_malloc(sizeof(struct tiva_i2c_inst_s))))
|
inst = kmm_malloc(sizeof(struct tiva_i2c_inst_s));
|
||||||
|
if (!inst)
|
||||||
{
|
{
|
||||||
|
i2cdbg("I2C%d: ERROR: Failed to allocate device instance\n", port);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user