[Armadeus-commitlog] armadeus branch, master, updated. armadeus-5.3-291-g9d1495d
Brought to you by:
sszy
|
From: Julien B a. A. <ar...@us...> - 2014-06-17 08:30:53
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "armadeus".
The branch, master has been updated
via 9d1495d3ac1526e85bd2779dec7e35c0f80b69e9 (commit)
from 8bacd195869d02d4a09c6612fb6b735878b28e6a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 9d1495d3ac1526e85bd2779dec7e35c0f80b69e9
Author: Julien Boibessot <jul...@ar...>
Date: Tue Jun 17 10:30:31 2014 +0200
[AS_DEVICES] Fixes some compilation warnings and do some beautifying while we are at it
-----------------------------------------------------------------------
Summary of changes:
target/packages/as_devices/c/Makefile | 8 +++++---
target/packages/as_devices/c/as_93lcxx.c | 27 ++++++++++-----------------
target/packages/as_devices/c/as_helpers.c | 8 +++++---
target/packages/as_devices/test_c.h | 27 ++++++++++-----------------
4 files changed, 30 insertions(+), 40 deletions(-)
diff --git a/target/packages/as_devices/c/Makefile b/target/packages/as_devices/c/Makefile
index 53ba79a..8ea7426 100644
--- a/target/packages/as_devices/c/Makefile
+++ b/target/packages/as_devices/c/Makefile
@@ -37,14 +37,16 @@ ARCHIVE_CMD=ar
ARCHIVE_OPTS=-cvq
$(LIBNAME): $(OBJ)
- $(CC) -shared -Wl,-soname,$(SONAME) -o $(SONAME) $(OBJ)
- ln -sf $(SONAME) $(LIBNAME)
+ @$(CC) -shared -Wl,-soname,$(SONAME) -o $(SONAME) $(OBJ)
+ @ln -sf $(SONAME) $(LIBNAME)
+ @echo " LNK $@"
$(STAT_LIB): $(OBJ)
$(ARCHIVE_CMD) $(ARCHIVE_OPTS) $(STAT_LIB) $(OBJ)
%.o: %.c
- $(CC) -fPIC -o $@ -c $< $(CFLAGS)
+ @$(CC) -fPIC -o $@ -c $< $(CFLAGS)
+ @echo " CC $@"
clean:
rm -f $(OBJ) $(BINARY) $(LIBNAME) $(SONAME)
diff --git a/target/packages/as_devices/c/as_93lcxx.c b/target/packages/as_devices/c/as_93lcxx.c
index 3f463ce..a1d17b9 100644
--- a/target/packages/as_devices/c/as_93lcxx.c
+++ b/target/packages/as_devices/c/as_93lcxx.c
@@ -14,7 +14,8 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
- * Copyright (C) 2009 Fabien Marteau <fab...@ar...>
+ * Author: Fabien Marteau <fab...@ar...>
+ * Copyright (C) 2009-2014 The Armadeus Project & Armadeus Systems
*
*/
@@ -99,8 +100,7 @@ struct as_93lcxx_device * as_93lcxx_open(unsigned char *aSpidev_filename,
return NULL;
dev = (struct as_93lcxx_device *)malloc(sizeof(struct as_93lcxx_device));
- if (dev == NULL)
- {
+ if (dev == NULL) {
ERROR("Can't allocate memory for eeprom structure device\n");
return NULL;
}
@@ -131,8 +131,7 @@ int32_t as_93lcxx_read(struct as_93lcxx_device *aDev, uint16_t aAddress)
data_out = as_spi_msg(aDev->fd, msg,
3 + add_length + aDev->word_size,
aDev->speed);
- if (data_out < 0)
- {
+ if (data_out < 0) {
ERROR("Error on forging spi message\n");
return -1;
}
@@ -159,7 +158,7 @@ int32_t as_93lcxx_ewen(struct as_93lcxx_device *aDev)
ret = as_spi_msg(aDev->fd, msg,
3 + add_length,
aDev->speed);
- {
+ if (ret < 0) {
ERROR("Error on forging spi message\n");
return -1;
}
@@ -184,8 +183,7 @@ int32_t as_93lcxx_erase(struct as_93lcxx_device *aDev, uint16_t aAddress)
ret = as_spi_msg(aDev->fd, msg,
3 + add_length + aDev->word_size,
aDev->speed);
- if (ret < 0)
- {
+ if (ret < 0) {
ERROR("Error on forging spi message\n");
return -1;
}
@@ -213,8 +211,7 @@ int32_t as_93lcxx_erase_all(struct as_93lcxx_device *aDev)
ret = as_spi_msg(aDev->fd, msg,
3 + add_length,
aDev->speed);
- if (ret < 0)
- {
+ if (ret < 0) {
ERROR("Error on forging spi message\n");
return -1;
}
@@ -246,8 +243,7 @@ int32_t as_93lcxx_write(struct as_93lcxx_device *aDev,
ret = as_spi_msg(aDev->fd, msg,
3 + add_length + aDev->word_size,
aDev->speed);
- if (ret < 0)
- {
+ if (ret < 0) {
ERROR("Error on forging spi message\n");
return -1;
}
@@ -278,8 +274,7 @@ int32_t as_93lcxx_write_all(struct as_93lcxx_device *aDev,
ret = as_spi_msg(aDev->fd, msg,
3 + add_length + aDev->word_size,
aDev->speed);
- if (ret < 0)
- {
+ if (ret < 0) {
ERROR("Error on forging spi message\n");
return -1;
}
@@ -306,8 +301,7 @@ int32_t as_93lcxx_ewds(struct as_93lcxx_device *aDev)
ret = as_spi_msg(aDev->fd, msg,
3 + add_length,
aDev->speed);
- if (ret < 0)
- {
+ if (ret < 0) {
ERROR("Error on forging spi message\n");
return -1;
}
@@ -323,4 +317,3 @@ void as_93lcxx_close(struct as_93lcxx_device *aDev)
free(aDev);
}
-
diff --git a/target/packages/as_devices/c/as_helpers.c b/target/packages/as_devices/c/as_helpers.c
index 9ae0b9e..068a64a 100644
--- a/target/packages/as_devices/c/as_helpers.c
+++ b/target/packages/as_devices/c/as_helpers.c
@@ -105,7 +105,8 @@ int as_read_int(int fd, int *value_res)
int value;
ret = as_read_buffer(fd, buf, SIZEOFBUFF);
- if (ret < 0) return ret;
+ if (ret < 0)
+ return ret;
buf[ret-1] = '\0';
value = strtol(buf, NULL, 10);
*value_res = value;
@@ -117,13 +118,12 @@ int as_helpers_get_platform(void)
{
FILE *plat_file;
char name[8];
- int ret;
plat_file = fopen("/etc/machine", "r");
if (!plat_file)
return APF_UNKNOWN;
- ret = fscanf(plat_file, "%s", name);
+ fscanf(plat_file, "%s", name);
fclose(plat_file);
if (!strcmp(name, "APF9328"))
@@ -139,8 +139,10 @@ int as_helpers_get_platform(void)
char *as_helpers_get_root()
{
char * root;
+
root = getenv("AS_DEVICES_ROOT");
if (root)
return root;
+
return "";
}
diff --git a/target/packages/as_devices/test_c.h b/target/packages/as_devices/test_c.h
index fb41a04..20ac106 100644
--- a/target/packages/as_devices/test_c.h
+++ b/target/packages/as_devices/test_c.h
@@ -437,10 +437,8 @@ void test_gpio()
struct as_gpio_device *gpio_dev;
int32_t ret;
int32_t value;
- int pin_num = 173; /* default F13 */
- int port_direction = 0;
- int port_value = 1;
- int platform;
+ int pin_num = 173; /* default: PF13 */
+ int pin_value = 1, platform;
platform = as_helpers_get_platform();
switch (platform) {
@@ -456,21 +454,19 @@ void test_gpio()
default:
break;
}
+
gpio_dev = as_gpio_open(pin_num);
- if (gpio_dev == NULL)
- {
+ if (gpio_dev == NULL) {
printf("Error can't open gpio %d\nHave you got gpiolib ?\n", pin_num);
pressEnterToContinue();
return ;
}
- ret = as_gpio_get_pin_value(gpio_dev);
- if (ret < 0)
- {
+
+ pin_value = as_gpio_get_pin_value(gpio_dev);
+ if (pin_value < 0) {
printf("Error, can't get pin value\n");
return;
}
- port_value = ret;
-
while(buffer[0] != 'q')
{
@@ -513,7 +509,6 @@ void test_gpio()
pressEnterToContinue();
break;
}
- port_direction = value;
printf("Ok direction changed\n");
pressEnterToContinue();
break;
@@ -530,15 +525,13 @@ void test_gpio()
pressEnterToContinue();
break;
case '4' : printf("Get value \n");
- ret = as_gpio_get_pin_value(gpio_dev);
- if (ret < 0)
- {
+ pin_value = as_gpio_get_pin_value(gpio_dev);
+ if (pin_value < 0) {
printf("Error, can't get pin value\n");
pressEnterToContinue();
break;
}
- printf("Value is %d\n", ret);
- port_value = ret;
+ printf("Value is %d\n", pin_value);
pressEnterToContinue();
break;
case '5':
hooks/post-receive
--
armadeus
|