[Armadeus-commitlog] armadeus branch, master, updated. release-3.2-374-g9af999f
Brought to you by:
sszy
|
From: Fabien M <fa...@us...> - 2010-05-31 15:41:44
|
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 9af999f6d5181755b933f91ebe4a147c47e7fefe (commit)
via 81f68c48763a7e9a60454dc2b7110395775b6e72 (commit)
from a42affdc88b3abc4c5cf4d2ca524b590e9a8dd31 (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 9af999f6d5181755b933f91ebe4a147c47e7fefe
Merge: 81f68c48763a7e9a60454dc2b7110395775b6e72 a42affdc88b3abc4c5cf4d2ca524b590e9a8dd31
Author: Fabien Marteau <fab...@ar...>
Date: Mon May 31 17:41:28 2010 +0200
Merge branch 'master' of git://armadeus.git.sourceforge.net/gitroot/armadeus/armadeus
commit 81f68c48763a7e9a60454dc2b7110395775b6e72
Author: Fabien Marteau <fab...@ar...>
Date: Mon May 31 17:38:46 2010 +0200
[as_devices] GPIO IRQ tested
-----------------------------------------------------------------------
Summary of changes:
target/packages/as_devices/c/as_gpio.c | 24 +++----
target/packages/as_devices/test_c.h | 110 ++++++++++++++++++++++++++++----
2 files changed, 106 insertions(+), 28 deletions(-)
diff --git a/target/packages/as_devices/c/as_gpio.c b/target/packages/as_devices/c/as_gpio.c
index 938529e..4a4ef3d 100644
--- a/target/packages/as_devices/c/as_gpio.c
+++ b/target/packages/as_devices/c/as_gpio.c
@@ -196,7 +196,6 @@ int32_t as_gpio_get_pin_value(struct as_gpio_device *aDev,
int32_t as_gpio_blocking_get_pin_value(struct as_gpio_device *aDev,
int aPinNum)
{
- /* TODO */
int ret;
char value;
@@ -308,7 +307,6 @@ int32_t as_gpio_set_irq_mode(struct as_gpio_device *aDev,
int aMode)
{
int ret=0;
- int i;
int portval;
char buffer[BUFF_SIZE];
@@ -320,9 +318,15 @@ int32_t as_gpio_set_irq_mode(struct as_gpio_device *aDev,
if (aPinNum >= PORT_SIZE)
return -1;
- if (aPinNum < PORT_SIZE/2)
+ /* close fpin file */
+ if (aDev->fpin[aPinNum] != -1)
{
+ close(aDev->fpin[aPinNum]);
+ aDev->fpin[aPinNum] = -1;
+ }
+ if (aPinNum < PORT_SIZE/2)
+ {
ret = ioctl(aDev->fdev, GPIORDIRQMODE_L, &portval);
if (ret < 0) {
return ret;
@@ -336,7 +340,7 @@ int32_t as_gpio_set_irq_mode(struct as_gpio_device *aDev,
return ret;
}
- } else {
+} else {
ret = ioctl(aDev->fdev, GPIORDIRQMODE_H, &portval);
if (ret < 0) {
@@ -352,15 +356,6 @@ int32_t as_gpio_set_irq_mode(struct as_gpio_device *aDev,
}
}
-
-
- /* close fpin file */
- if ((aMode == GPIO_IRQ_MODE_NOINT) && (aDev->fpin[aPinNum] != -1))
- {
- close(aDev->fpin[aPinNum]);
- aDev->fpin[aPinNum] = -1;
- }
-
/* open fpin file */
if ((aMode != GPIO_IRQ_MODE_NOINT) && (aDev->fpin[aPinNum] == -1))
{
@@ -372,11 +367,10 @@ int32_t as_gpio_set_irq_mode(struct as_gpio_device *aDev,
ret = open(buffer, O_RDONLY);
if (ret < 0)
return ret;
-
aDev->fpin[aPinNum] = ret;
}
- aDev->irq_mode[i] = aMode;
+ aDev->irq_mode[aPinNum] = aMode;
return 0;
}
diff --git a/target/packages/as_devices/test_c.h b/target/packages/as_devices/test_c.h
index fe9c040..de489d3 100644
--- a/target/packages/as_devices/test_c.h
+++ b/target/packages/as_devices/test_c.h
@@ -434,9 +434,10 @@ void test_gpio()
char c_value;
int32_t value;
char port_letter = 'F';
- int port_num = 14;
+ int pin_num = 14;
int port_direction = 0;
int port_value = 1;
+ int pullup=1;
gpio_dev = as_gpio_open(port_letter);
if (gpio_dev == NULL)
@@ -446,7 +447,7 @@ void test_gpio()
return ;
}
ret = as_gpio_get_pin_value(gpio_dev,
- port_num);
+ pin_num);
if (ret < 0)
{
printf("Error, can't get pin value\n");
@@ -459,14 +460,19 @@ void test_gpio()
{
system("clear");
printf("**************************\n");
- printf(" Testing GPIO P%c%d \n", port_letter, port_num);
+ printf(" Testing GPIO P%c%d \n", port_letter, pin_num);
printf("**************************\n");
printf("Choose ('q' to quit):\n");
printf(" 1) Change port letter (%c)\n", port_letter);
- printf(" 2) Change port num (%d)\n", port_num);
+ printf(" 2) Change port num (%d)\n", pin_num);
printf(" 3) Change direction (%d)\n", port_direction);
printf(" 4) Change value (%d)\n", port_value);
printf(" 5) Read pin value\n");
+ printf(" 6) Change Pull-Up (%d)\n", pullup);
+ printf(" 7) Read Pull-Up\n");
+ printf(" 8) Set irq mode\n");
+ printf(" 9) get irq mode\n");
+ printf(" a) blocking read\n");
printf("> ");
scanf("%s",buffer);
@@ -482,7 +488,7 @@ void test_gpio()
{
printf("Error, can't close Port%c\n", port_letter);
pressEnterToContinue();
- return ;
+ break;
}
}
gpio_dev = as_gpio_open(buffer[0]);
@@ -490,7 +496,7 @@ void test_gpio()
{
printf("Error, can't open Port%c\n", c_value);
pressEnterToContinue();
- return;
+ break;
}
port_letter = buffer[0];
printf("Ok Port %c is set\n", port_letter);
@@ -501,19 +507,19 @@ void test_gpio()
if ((value < 0) || (value > 31))
printf("Error, wrong value\n");
else
- port_num = value;
+ pin_num = value;
pressEnterToContinue();
break;
case '3' : printf("Give direction (0:in, 1:out) : ");
scanf("%d", &value);
ret = as_gpio_set_pin_direction(gpio_dev,
- port_num,
+ pin_num,
value);
if(ret < 0)
{
printf("Error, can't change direction\n");
pressEnterToContinue();
- return ;
+ break;
}
port_direction = value;
printf("Ok direction changed\n");
@@ -522,13 +528,13 @@ void test_gpio()
case '4' : printf("Give value : ");
scanf("%d", &value);
ret = as_gpio_set_pin_value(gpio_dev,
- port_num,
+ pin_num,
value);
if(ret < 0)
{
printf("Error, can't change pin value\n");
pressEnterToContinue();
- return;
+ break;
}
port_value = value;
printf("Ok value changed\n");
@@ -536,17 +542,95 @@ void test_gpio()
break;
case '5' : printf("Get value \n");
ret = as_gpio_get_pin_value(gpio_dev,
- port_num);
+ pin_num);
if (ret < 0)
{
printf("Error, can't get pin value\n");
pressEnterToContinue();
- return;
+ break;
}
printf("Value is %d\n",ret);
port_value = ret;
pressEnterToContinue();
break;
+ case '6' : printf("Give value : ");
+ scanf("%d", &value);
+ ret = as_gpio_set_pullup_value(gpio_dev,
+ pin_num,
+ value);
+ if(ret < 0)
+ {
+ printf("Error, can't change pull up value\n");
+ pressEnterToContinue();
+ break;
+ }
+ pullup = value;
+ printf("Ok value changed\n");
+ pressEnterToContinue();
+ break;
+ case '7' : printf("Get value \n");
+ ret = as_gpio_get_pullup_value(gpio_dev,
+ pin_num);
+ if (ret < 0)
+ {
+ printf("Error, can't get pull up value\n");
+ pressEnterToContinue();
+ break;
+ }
+ printf("Value is %d\n",ret);
+ pullup = ret;
+ pressEnterToContinue();
+ break;
+ case '8' : printf("1) GPIO_IRQ_MODE_NOINT \n");
+ printf("2) GPIO_IRQ_MODE_RISING \n");
+ printf("3) GPIO_IRQ_MODE_FALLING\n");
+ printf("4) GPIO_IRQ_MODE_BOTH \n");
+ printf("Give value : ");
+ scanf("%d", &value);
+ if (value == 1)value = GPIO_IRQ_MODE_NOINT ;
+ if (value == 2)value = GPIO_IRQ_MODE_RISING ;
+ if (value == 3)value = GPIO_IRQ_MODE_FALLING;
+ if (value == 4)value = GPIO_IRQ_MODE_BOTH ;
+ ret = as_gpio_set_irq_mode(gpio_dev,
+ pin_num,
+ value);
+ if(ret < 0)
+ {
+ printf("Error, can't change irq value\n");
+ pressEnterToContinue();
+ break;
+ }
+ printf("Ok value changed\n");
+ pressEnterToContinue();
+ break;
+ case '9' : printf("Get value \n");
+ ret = as_gpio_get_irq_mode(gpio_dev, pin_num);
+ if (ret < 0)
+ {
+ printf("Error, can't get pull up value\n");
+ pressEnterToContinue();
+ break;
+ }
+ if (ret==GPIO_IRQ_MODE_NOINT )printf("GPIO_IRQ_MODE_NOINT \n");
+ if (ret==GPIO_IRQ_MODE_RISING )printf("GPIO_IRQ_MODE_RISING \n");
+ if (ret==GPIO_IRQ_MODE_FALLING)printf("GPIO_IRQ_MODE_FALLING\n");
+ if (ret==GPIO_IRQ_MODE_BOTH )printf("GPIO_IRQ_MODE_BOTH \n");
+ pressEnterToContinue();
+ break;
+ case 'a' : printf("Blocking read \n");
+ ret = as_gpio_blocking_get_pin_value(gpio_dev, pin_num);
+ if (ret < 0)
+ {
+ printf("Error, can't read value\n");
+ pressEnterToContinue();
+ break;
+ }
+ printf("Value read %d\n",ret);
+ pressEnterToContinue();
+ break;
+
+
+
default : break;
}
hooks/post-receive
--
armadeus
|