diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2015-02-17 12:45:47 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2015-02-17 12:45:47 -0600 |
commit | 688dc079a8d721a3493890b67f063dae0fae3703 (patch) | |
tree | 5e512ce57f675a528d1e1e1f2c2e5dd18258fb71 /nuttx/arch/arm/src/tiva/tiva_i2c.c | |
parent | b9db9fd1bfd726b45c59040e99312204517bdc8e (diff) | |
download | px4-nuttx-688dc079a8d721a3493890b67f063dae0fae3703.tar.gz px4-nuttx-688dc079a8d721a3493890b67f063dae0fae3703.tar.bz2 px4-nuttx-688dc079a8d721a3493890b67f063dae0fae3703.zip |
Tiva SPI: Cosmetic improvements
Diffstat (limited to 'nuttx/arch/arm/src/tiva/tiva_i2c.c')
-rw-r--r-- | nuttx/arch/arm/src/tiva/tiva_i2c.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/nuttx/arch/arm/src/tiva/tiva_i2c.c b/nuttx/arch/arm/src/tiva/tiva_i2c.c index f6a3136b7..fa6f05eb1 100644 --- a/nuttx/arch/arm/src/tiva/tiva_i2c.c +++ b/nuttx/arch/arm/src/tiva/tiva_i2c.c @@ -1,7 +1,7 @@ /************************************************************************************ * 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> * * 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; break; #endif + #ifdef CONFIG_TIVA_I2C1 case 1: priv = &tiva_i2c1_priv; config = &tiva_i2c1_config; break; #endif + #ifdef CONFIG_TIVA_I2C2 case 2: priv = &tiva_i2c2_priv; config = &tiva_i2c2_config; break; #endif + #ifdef CONFIG_TIVA_I2C3 case 3: priv = &tiva_i2c3_priv; config = &tiva_i2c3_config; break; #endif + #ifdef CONFIG_TIVA_I2C4 case 4: priv = &tiva_i2c4_priv; config = &tiva_i2c4_config; break; #endif + #ifdef CONFIG_TIVA_I2C5 case 5: priv = &tiva_i2c5_priv; config = &tiva_i2c5_config; break; #endif + #ifdef CONFIG_TIVA_I2C6 case 6: priv = &tiva_i2c6_priv; config = &tiva_i2c6_config; break; #endif + #ifdef CONFIG_TIVA_I2C7 case 7: priv = &tiva_i2c7_priv; config = &tiva_i2c7_config; break; #endif + #ifdef CONFIG_TIVA_I2C8 case 8: priv = &tiva_i2c8_priv; config = &tiva_i2c8_config; break; #endif + #ifdef CONFIG_TIVA_I2C9 case 9: priv = &tiva_i2c9_priv; config = &tiva_i2c9_config; break; #endif + default: i2cdbg("I2C%d: ERROR: Not supported\n", port); return NULL; @@ -2294,8 +2304,10 @@ struct i2c_dev_s *up_i2cinitialize(int port) /* 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; } |