armadeus-commitlog Mailing List for armadeus (Page 115)
Brought to you by:
sszy
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(43) |
Feb
(8) |
Mar
(7) |
Apr
(8) |
May
(14) |
Jun
(6) |
Jul
(4) |
Aug
(17) |
Sep
(18) |
Oct
(19) |
Nov
(52) |
Dec
(30) |
| 2008 |
Jan
(6) |
Feb
(6) |
Mar
(15) |
Apr
(22) |
May
(13) |
Jun
(11) |
Jul
(41) |
Aug
(10) |
Sep
(14) |
Oct
(21) |
Nov
(4) |
Dec
(66) |
| 2009 |
Jan
(67) |
Feb
(57) |
Mar
(90) |
Apr
(54) |
May
(64) |
Jun
(76) |
Jul
(14) |
Aug
(18) |
Sep
(18) |
Oct
(20) |
Nov
(15) |
Dec
(36) |
| 2010 |
Jan
(28) |
Feb
(25) |
Mar
(32) |
Apr
(23) |
May
(22) |
Jun
(62) |
Jul
(36) |
Aug
(16) |
Sep
(12) |
Oct
(20) |
Nov
(44) |
Dec
(25) |
| 2011 |
Jan
(36) |
Feb
(49) |
Mar
(28) |
Apr
(38) |
May
(26) |
Jun
(52) |
Jul
(33) |
Aug
(32) |
Sep
(19) |
Oct
(26) |
Nov
(13) |
Dec
(32) |
| 2012 |
Jan
(38) |
Feb
(34) |
Mar
(91) |
Apr
(35) |
May
(31) |
Jun
(72) |
Jul
(23) |
Aug
(13) |
Sep
(33) |
Oct
(47) |
Nov
(18) |
Dec
(22) |
| 2013 |
Jan
(31) |
Feb
(22) |
Mar
(26) |
Apr
(11) |
May
(38) |
Jun
(15) |
Jul
(37) |
Aug
(68) |
Sep
(34) |
Oct
(11) |
Nov
(26) |
Dec
(31) |
| 2014 |
Jan
(60) |
Feb
(55) |
Mar
(21) |
Apr
(31) |
May
(17) |
Jun
(35) |
Jul
(24) |
Aug
(17) |
Sep
(11) |
Oct
(23) |
Nov
(10) |
Dec
(23) |
| 2015 |
Jan
(15) |
Feb
(34) |
Mar
(46) |
Apr
(23) |
May
(12) |
Jun
(14) |
Jul
(18) |
Aug
(22) |
Sep
(6) |
Oct
(2) |
Nov
(1) |
Dec
(6) |
| 2016 |
Jan
(5) |
Feb
(7) |
Mar
(10) |
Apr
(10) |
May
(17) |
Jun
(6) |
Jul
(4) |
Aug
(6) |
Sep
(22) |
Oct
(8) |
Nov
(9) |
Dec
(5) |
| 2017 |
Jan
(11) |
Feb
(12) |
Mar
(27) |
Apr
(9) |
May
(1) |
Jun
(5) |
Jul
(11) |
Aug
(10) |
Sep
(6) |
Oct
(10) |
Nov
(4) |
Dec
(6) |
| 2018 |
Jan
(6) |
Feb
(13) |
Mar
(9) |
Apr
(7) |
May
(10) |
Jun
(9) |
Jul
(21) |
Aug
(13) |
Sep
(10) |
Oct
(4) |
Nov
(6) |
Dec
(1) |
| 2019 |
Jan
(6) |
Feb
(2) |
Mar
(5) |
Apr
(6) |
May
(19) |
Jun
(14) |
Jul
(18) |
Aug
(3) |
Sep
(5) |
Oct
(7) |
Nov
(8) |
Dec
(4) |
| 2020 |
Jan
(10) |
Feb
(3) |
Mar
(9) |
Apr
(7) |
May
(2) |
Jun
(18) |
Jul
(3) |
Aug
|
Sep
|
Oct
(7) |
Nov
|
Dec
(1) |
| 2021 |
Jan
(9) |
Feb
(6) |
Mar
(4) |
Apr
(11) |
May
(7) |
Jun
(5) |
Jul
(2) |
Aug
(4) |
Sep
(10) |
Oct
(9) |
Nov
(5) |
Dec
|
| 2022 |
Jan
(2) |
Feb
(12) |
Mar
(3) |
Apr
(5) |
May
(1) |
Jun
(3) |
Jul
(2) |
Aug
(1) |
Sep
(4) |
Oct
(4) |
Nov
(1) |
Dec
(3) |
| 2023 |
Jan
(5) |
Feb
(3) |
Mar
(3) |
Apr
(2) |
May
(1) |
Jun
(3) |
Jul
(3) |
Aug
(2) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
(4) |
| 2024 |
Jan
(2) |
Feb
(3) |
Mar
(8) |
Apr
(4) |
May
(1) |
Jun
(13) |
Jul
(7) |
Aug
(1) |
Sep
(6) |
Oct
(5) |
Nov
(11) |
Dec
(7) |
| 2025 |
Jan
(3) |
Feb
(1) |
Mar
(6) |
Apr
(4) |
May
(4) |
Jun
(1) |
Jul
(1) |
Aug
(7) |
Sep
(4) |
Oct
(4) |
Nov
(4) |
Dec
(1) |
| 2026 |
Jan
(3) |
Feb
(7) |
Mar
(3) |
Apr
(1) |
May
(6) |
Jun
(3) |
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Julien B a. A. <ar...@us...> - 2009-12-03 17:47:16
|
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 46244b562c4cfaf4810117db549962b2ff7ea749 (commit)
via 5b1ca71d174f17ac8dbd00e59397db9e2b0d399c (commit)
via 2c7773fd50cf9f7785972c7ee05645b3511a6864 (commit)
via 39b3849ecbd1c466897a8d577eef0ce5d8fe6a5c (commit)
from 88bc49fe0f3651040c5fe87b663db3aee8c95aca (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 46244b562c4cfaf4810117db549962b2ff7ea749
Author: Julien Boibessot <jul...@ar...>
Date: Thu Dec 3 18:46:42 2009 +0100
[GIT] Ignore modified .so in target/packages/....
commit 5b1ca71d174f17ac8dbd00e59397db9e2b0d399c
Author: Julien Boibessot <jul...@ar...>
Date: Thu Dec 3 18:45:52 2009 +0100
[OTHERS] Minor changes to AsDevice lib
commit 2c7773fd50cf9f7785972c7ee05645b3511a6864
Merge: 39b3849ecbd1c466897a8d577eef0ce5d8fe6a5c 88bc49fe0f3651040c5fe87b663db3aee8c95aca
Author: Julien Boibessot <jul...@ar...>
Date: Thu Dec 3 18:02:30 2009 +0100
Merge branch 'master' of ssh://artemys@armadeus.git.sourceforge.net/gitroot/armadeus/armadeus
commit 39b3849ecbd1c466897a8d577eef0ce5d8fe6a5c
Author: Julien Boibessot <jul...@ar...>
Date: Thu Dec 3 14:32:45 2009 +0100
[BUILDROOT] Improve GPM installation
-----------------------------------------------------------------------
Summary of changes:
patches/buildroot/085-adds_gpm_package.patch | 68 +++++++++++++++++++++-----
target/packages/.gitignore | 1 +
target/packages/as_devices/c/Makefile | 2 +-
target/packages/as_devices/c/as_93lcxx.c | 36 ++++++++------
target/packages/as_devices/c/as_93lcxx.h | 4 +-
target/packages/as_devices/c/as_spi.c | 40 +++++++++------
6 files changed, 104 insertions(+), 47 deletions(-)
diff --git a/patches/buildroot/085-adds_gpm_package.patch b/patches/buildroot/085-adds_gpm_package.patch
index 62c4695..c81f81a 100644
--- a/patches/buildroot/085-adds_gpm_package.patch
+++ b/patches/buildroot/085-adds_gpm_package.patch
@@ -1,7 +1,11 @@
+Add GPM (General Purpose Mouse server) to Buildroot.
+
+Signed-off-by: Julien Boibessot <jul...@ar...>
+
Index: buildroot/package/gpm/Config.in
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ buildroot/package/gpm/Config.in 2009-09-25 14:03:49.000000000 +0200
++++ buildroot/package/gpm/Config.in 2009-12-03 12:15:44.000000000 +0100
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_GPM
+ bool "gpm mouse server"
@@ -9,12 +13,12 @@ Index: buildroot/package/gpm/Config.in
+ gpm means general purpose mouse and is the mouse support for Linux
+ in the console.
+
-+ http://unix.schottelius.org/gpm/
++ http://www.nico.schottelius.org/software/gpm/
Index: buildroot/package/gpm/gpm.mk
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ buildroot/package/gpm/gpm.mk 2009-09-25 14:03:49.000000000 +0200
-@@ -0,0 +1,11 @@
++++ buildroot/package/gpm/gpm.mk 2009-12-03 11:58:49.000000000 +0100
+@@ -0,0 +1,18 @@
+#############################################################
+#
+# General Purpose Mouse server for Linux console.
@@ -24,17 +28,22 @@ Index: buildroot/package/gpm/gpm.mk
+GPM_VERSION:=1.20.6
+GPM_SOURCE:=gpm-$(GPM_VERSION).tar.bz2
+GPM_SITE:=http://unix.schottelius.org/gpm/archives/
++GPM_INSTALL_STAGING:=YES
++GPM_INSTALL_TARGET:=YES
+
+$(eval $(call AUTOTARGETS,package,gpm))
++
++$(GPM_HOOK_POST_INSTALL): $(GPM_TARGET_INSTALL_TARGET)
++ $(STRIPCMD) $(STRIP_STRIP_ALL) $(TARGET_DIR)/usr/sbin/gpm
++ touch $@
++
Index: buildroot/package/gpm/gpm-1.20.6-removes_obsolete_functions.patch
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ buildroot/package/gpm/gpm-1.20.6-removes_obsolete_functions.patch 2009-09-25 14:03:49.000000000 +0200
-@@ -0,0 +1,79 @@
-+
-+Removes all "obsolete" functions (at least to compile for uClibc).
++++ buildroot/package/gpm/gpm-1.20.6-removes_obsolete_functions.patch 2009-12-03 11:33:41.000000000 +0100
+@@ -0,0 +1,77 @@
+
-+Signed-off-by: Julien Boibessot <jul...@ar...>
++Replaces all "obsolete" functions (at least to compile for uClibc).
+
+diff -urN gpm-1.20.6/src/daemon/old_main.c gpm-1.20.6.mod/src/daemon/old_main.c
+--- gpm-1.20.6/src/daemon/old_main.c 2009-02-09 10:58:53.000000000 +0100
@@ -112,9 +121,9 @@ Index: buildroot/package/gpm/gpm-1.20.6-removes_obsolete_functions.patch
+ gpm_report (GPM_PR_WARN,"Flag value (%s) for parameter %s is invalid",
Index: buildroot/package/Config.in
===================================================================
---- buildroot.orig/package/Config.in 2009-09-25 14:05:19.000000000 +0200
-+++ buildroot/package/Config.in 2009-09-25 14:06:07.000000000 +0200
-@@ -267,6 +267,7 @@
+--- buildroot.orig/package/Config.in 2009-12-03 11:19:50.000000000 +0100
++++ buildroot/package/Config.in 2009-12-03 11:22:53.000000000 +0100
+@@ -259,6 +259,7 @@
source "package/fpgaregs/Config.in"
source "package/fuse/Config.in"
source "package/gadgetfs-test/Config.in"
@@ -122,3 +131,38 @@ Index: buildroot/package/Config.in
source "package/hal/Config.in"
if !BR2_PACKAGE_BUSYBOX_HIDE_OTHERS
source "package/hdparm/Config.in"
+Index: buildroot/package/gpm/gpm-1.20.6-removes_strip_from_install.patch
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ buildroot/package/gpm/gpm-1.20.6-removes_strip_from_install.patch 2009-12-03 11:33:54.000000000 +0100
+@@ -0,0 +1,30 @@
++GPM asks "install" to strip the executables while installing it.
++This doesn't seems cross-compiling friendly, so remove the option (-s) and let
++the strip be done elsewhere.
++
++Index: gpm-1.20.6/Makefile.include.in
++===================================================================
++--- gpm-1.20.6.orig/Makefile.include.in 2009-12-03 11:25:30.000000000 +0100
+++++ gpm-1.20.6/Makefile.include.in 2009-12-03 11:26:32.000000000 +0100
++@@ -54,7 +54,7 @@
++ DVIPS = @DVIPS@
++ MAKEINFO = @MAKEINFO@
++ TEXI2HTML = texi2html
++-STRIP = -s
+++STRIP =
++
++ AR = ar
++ ETAGS = etags
++Index: gpm-1.20.6/src/Makefile.in
++===================================================================
++--- gpm-1.20.6.orig/src/Makefile.in 2009-12-03 11:26:01.000000000 +0100
+++++ gpm-1.20.6/src/Makefile.in 2009-12-03 11:26:42.000000000 +0100
++@@ -48,7 +48,7 @@
++
++ DEFS = @DEFS@
++
++-STRIP = -s
+++STRIP =
++
++ ### BUILD PROCESS
++
diff --git a/target/packages/.gitignore b/target/packages/.gitignore
index 5761abc..bae14b5 100644
--- a/target/packages/.gitignore
+++ b/target/packages/.gitignore
@@ -1 +1,2 @@
*.o
+*.so*
diff --git a/target/packages/as_devices/c/Makefile b/target/packages/as_devices/c/Makefile
index b78f67c..e2fcea2 100644
--- a/target/packages/as_devices/c/Makefile
+++ b/target/packages/as_devices/c/Makefile
@@ -22,7 +22,7 @@ ARCHIVE_OPTS=-cvq
${LIBNAME}: ${OBJ}
${CC} -shared -Wl,-soname,${SONAME} -o ${SONAME} ${OBJ} -lc
- ln -s ${SONAME} ${LIBNAME}
+ ln -sf ${SONAME} ${LIBNAME}
${STAT_LIB}: ${OBJ}
${ARCHIVE_CMD} ${ARCHIVE_OPTS} ${STAT_LIB} ${OBJ}
diff --git a/target/packages/as_devices/c/as_93lcxx.c b/target/packages/as_devices/c/as_93lcxx.c
index a3f613b..5f48a1a 100644
--- a/target/packages/as_devices/c/as_93lcxx.c
+++ b/target/packages/as_devices/c/as_93lcxx.c
@@ -18,12 +18,13 @@
*
*/
-#include "as_93lcxx.h"
-#include "as_spi.h"
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
+#include "as_93lcxx.h"
+#include "as_spi.h"
+
/* define start bits + opcode */
#define READ (6)
#define EWEN (4)
@@ -43,12 +44,12 @@
#define TEC (6*MS)
#define TWL (15*MS)
-/** @brief Private functions to ease making spi instructions
- */
-uint8_t address_len(uint8_t aType, uint8_t aWord_size)
+/** @brief private function to ease making spi instructions
+ */
+static uint8_t address_len(uint8_t aType, uint8_t aWord_size)
{
- switch(aType)
+ switch (aType)
{
case 46:
if (aWord_size == 16)
@@ -66,6 +67,7 @@ uint8_t address_len(uint8_t aType, uint8_t aWord_size)
}
}
+
struct as_93lcxx_device * as_93lcxx_open(unsigned char *aSpidev_filename,
uint8_t aType,
uint32_t aSpeed,
@@ -76,13 +78,15 @@ struct as_93lcxx_device * as_93lcxx_open(unsigned char *aSpidev_filename,
/* open spidev bus */
fd = as_spi_open(aSpidev_filename);
- if (fd < 0)
+ if (fd < 0) {
+ perror("Can't open spi device");
return NULL;
+ }
/* verify datas */
if (!( (aType == 46) || (aType == 56) || (aType == 66)))
return NULL;
- if ( (aWord_size < 1) || (aWord_size > 16))
+ if ((aWord_size < 1) || (aWord_size > 16))
return NULL;
dev = (struct as_93lcxx_device *)malloc(sizeof(struct as_93lcxx_device));
@@ -110,7 +114,7 @@ int32_t as_93lcxx_read(struct as_93lcxx_device *aDev, uint16_t aAddress)
uint32_t data_out,msg=0;
int add_length;
- add_length = address_len(aDev->type,aDev->word_size);
+ add_length = address_len(aDev->type, aDev->word_size);
/* forge message */
msg = ((READ << (add_length+ (aDev->word_size)))
@@ -131,7 +135,7 @@ int32_t as_93lcxx_ewen(struct as_93lcxx_device *aDev)
uint32_t msg=0;
int add_length;
- add_length = address_len(aDev->type,aDev->word_size);
+ add_length = address_len(aDev->type, aDev->word_size);
/* forge message */
msg = ((EWEN << add_length)
@@ -149,7 +153,7 @@ int32_t as_93lcxx_erase(struct as_93lcxx_device *aDev, uint16_t aAddress)
uint32_t msg=0;
int add_length;
- add_length = address_len(aDev->type,aDev->word_size);
+ add_length = address_len(aDev->type, aDev->word_size);
/* forge message */
msg = ((ERASE << (add_length + aDev->word_size))
@@ -169,7 +173,7 @@ int32_t as_93lcxx_erase_all(struct as_93lcxx_device *aDev)
uint32_t msg=0;
int add_length;
- add_length = address_len(aDev->type,aDev->word_size);
+ add_length = address_len(aDev->type, aDev->word_size);
/* forge message */
msg = ((ERAL << add_length)
@@ -193,7 +197,7 @@ int32_t as_93lcxx_write(struct as_93lcxx_device *aDev,
uint32_t msg=0;
int add_length;
- add_length = address_len(aDev->type,aDev->word_size);
+ add_length = address_len(aDev->type, aDev->word_size);
/* forge message */
msg = ((WRITE << (add_length+ (aDev->word_size)))
@@ -217,7 +221,7 @@ int32_t as_93lcxx_write_all(struct as_93lcxx_device *aDev,
uint32_t msg=0;
int add_length;
- add_length = address_len(aDev->type,aDev->word_size);
+ add_length = address_len(aDev->type, aDev->word_size);
/* forge message */
msg = ((WRAL << (add_length+ (aDev->word_size)))
@@ -240,7 +244,7 @@ int32_t as_93lcxx_ewds(struct as_93lcxx_device *aDev)
uint32_t msg=0;
int add_length;
- add_length = address_len(aDev->type,aDev->word_size);
+ add_length = address_len(aDev->type, aDev->word_size);
/* forge message */
msg = ((EWDS << add_length)
@@ -250,7 +254,7 @@ int32_t as_93lcxx_ewds(struct as_93lcxx_device *aDev)
as_spi_msg(aDev->fd, msg,
3 + add_length,
aDev->speed);
+
return 0;
}
-
diff --git a/target/packages/as_devices/c/as_93lcxx.h b/target/packages/as_devices/c/as_93lcxx.h
index d9d72e4..4e43523 100644
--- a/target/packages/as_devices/c/as_93lcxx.h
+++ b/target/packages/as_devices/c/as_93lcxx.h
@@ -138,6 +138,6 @@ int32_t as_93lcxx_ewds(struct as_93lcxx_device *aDev);
#ifdef __cplusplus
}
-#endif // __cplusplus
+#endif /* __cplusplus */
-#endif // AS_93LCXX_H_
+#endif /* AS_93LCXX_H_ */
diff --git a/target/packages/as_devices/c/as_spi.c b/target/packages/as_devices/c/as_spi.c
index bed8bc2..966e0f9 100644
--- a/target/packages/as_devices/c/as_spi.c
+++ b/target/packages/as_devices/c/as_spi.c
@@ -18,7 +18,6 @@
*
*/
-#include "as_spi.h"
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
@@ -32,15 +31,19 @@
#include <linux/types.h>
#include <linux/spi/spidev.h>
+#include "as_spi.h"
+
int as_spi_open(const unsigned char *spidev_name)
{
int fd;
+
fd = open((char *)spidev_name, O_RDWR);
if (fd < 0) {
perror("open");
return -1;
}
+
return fd;
}
@@ -76,6 +79,7 @@ int as_spi_get_mode(int fd)
perror("SPI rd_mode");
return -1;
}
+
return mode;
}
@@ -94,20 +98,24 @@ int as_spi_get_lsb(int fd)
int as_spi_get_bits_per_word(int fd)
{
uint8_t bits;
+
if (ioctl(fd, SPI_IOC_RD_BITS_PER_WORD, &bits) < 0) {
perror("SPI bits_per_word");
- return-1;
+ return -1;
}
+
return bits;
}
int as_spi_get_speed(int fd)
{
uint8_t speed;
+
if (ioctl(fd, SPI_IOC_RD_MAX_SPEED_HZ, &speed) < 0) {
perror("SPI max_speed_hz");
return -1;
}
+
return speed;
}
@@ -119,7 +127,7 @@ uint32_t as_spi_msg(int aFd,
uint32_t msg;
int len;
- struct spi_ioc_transfer xfer[1];
+ struct spi_ioc_transfer xfer[1];
unsigned char buf[32];
unsigned char buf_read[32];
@@ -129,24 +137,26 @@ uint32_t as_spi_msg(int aFd,
msg = aMsg;
len = aLen;
- msg = msg<<1;/* XXX Last bit is always read at 0 */
- len = len+1; /* XXX */
+ msg = msg << 1;/* XXX Last bit is always read at 0 */
+ len = len + 1; /* XXX */
- memset(xfer, 0, sizeof xfer);
- memset(buf, 0, sizeof buf);
- memset(buf_read, 0, sizeof buf_read);
+ memset(xfer, 0, sizeof(xfer));
+ memset(buf, 0, sizeof(buf));
+ memset(buf_read, 0, sizeof(buf_read));
- if (len >= sizeof buf)
- len = (sizeof buf)-1;
- for (i = len;i > 0;i--)
+ if (len >= sizeof(buf)) {
+ len = sizeof(buf) - 1;
+ }
+
+ for (i=len; i>0; i--)
{
buf[i-1] = msg & 0x01;
msg = msg >> 1;
}
- xfer[0].tx_buf = buf;
+ xfer[0].tx_buf = (uint32_t)buf;
xfer[0].len = len;
- xfer[0].rx_buf = buf_read;
+ xfer[0].rx_buf = (uint32_t)buf_read;
xfer[0].speed_hz = aSpeed;
xfer[0].bits_per_word = 1;
@@ -157,7 +167,7 @@ uint32_t as_spi_msg(int aFd,
}
msg = msg | buf_read[0];
- for (i = 1;i < len;i++)
+ for (i=1; i<len; i++)
{
msg = msg << 1;
msg = msg | buf_read[i];
@@ -171,5 +181,3 @@ void as_spi_close(int fd)
return;
}
-
-
hooks/post-receive
--
armadeus
|
|
From: Fabien M <fa...@us...> - 2009-12-03 13:47:35
|
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 88bc49fe0f3651040c5fe87b663db3aee8c95aca (commit)
from f0050bf404134ca1744e0d644e1e70dcc59f17bb (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 88bc49fe0f3651040c5fe87b663db3aee8c95aca
Author: Fabien Marteau <fab...@ar...>
Date: Thu Dec 3 14:47:08 2009 +0100
[OTHER] spaces in AsDevices package
-----------------------------------------------------------------------
Summary of changes:
target/packages/as_devices/c/as_93lcxx.c | 140 +++++++++++++++---------------
target/packages/as_devices/c/as_93lcxx.h | 38 ++++----
target/packages/as_devices/c/as_spi.c | 70 ++++++++--------
target/packages/as_devices/c/as_spi.h | 32 ++++----
4 files changed, 140 insertions(+), 140 deletions(-)
diff --git a/target/packages/as_devices/c/as_93lcxx.c b/target/packages/as_devices/c/as_93lcxx.c
index 0e8d8d4..a3f613b 100644
--- a/target/packages/as_devices/c/as_93lcxx.c
+++ b/target/packages/as_devices/c/as_93lcxx.c
@@ -46,18 +46,18 @@
/** @brief Private functions to ease making spi instructions
*/
-uint8_t address_len (uint8_t aType, uint8_t aWord_size )
+uint8_t address_len(uint8_t aType, uint8_t aWord_size)
{
- switch (aType )
+ switch(aType)
{
case 46:
- if (aWord_size == 16 )
+ if (aWord_size == 16)
return 6;
else
return 7;
case 56:
case 66:
- if (aWord_size == 16 )
+ if (aWord_size == 16)
return 8;
else
return 9;
@@ -66,27 +66,27 @@ uint8_t address_len (uint8_t aType, uint8_t aWord_size )
}
}
-struct as_93lcxx_device * as_93lcxx_open (unsigned char *aSpidev_filename,
+struct as_93lcxx_device * as_93lcxx_open(unsigned char *aSpidev_filename,
uint8_t aType,
uint32_t aSpeed,
- uint8_t aWord_size )
+ uint8_t aWord_size)
{
int fd=-1;
struct as_93lcxx_device *dev;
/* open spidev bus */
- fd = as_spi_open (aSpidev_filename );
- if (fd < 0 )
+ fd = as_spi_open(aSpidev_filename);
+ if (fd < 0)
return NULL;
/* verify datas */
- if (! ( (aType == 46 ) || (aType == 56 ) || (aType == 66 ) ) )
+ if (!( (aType == 46) || (aType == 56) || (aType == 66)))
return NULL;
- if ( (aWord_size < 1 ) || (aWord_size > 16 ) )
+ if ( (aWord_size < 1) || (aWord_size > 16))
return NULL;
- dev = (struct as_93lcxx_device * )malloc (sizeof (struct as_93lcxx_device ) );
- if (dev == NULL )
+ dev = (struct as_93lcxx_device *)malloc(sizeof(struct as_93lcxx_device));
+ if (dev == NULL)
return NULL;
/* fill in spidev structure */
@@ -99,157 +99,157 @@ struct as_93lcxx_device * as_93lcxx_open (unsigned char *aSpidev_filename,
return dev;
}
-void as_93lcxx_close (struct as_93lcxx_device *aDev )
+void as_93lcxx_close(struct as_93lcxx_device *aDev)
{
- as_spi_close (aDev->fd );
- free (aDev );
+ as_spi_close(aDev->fd);
+ free(aDev);
}
-int32_t as_93lcxx_read (struct as_93lcxx_device *aDev, uint16_t aAddress )
+int32_t as_93lcxx_read(struct as_93lcxx_device *aDev, uint16_t aAddress)
{
uint32_t data_out,msg=0;
int add_length;
- add_length = address_len (aDev->type,aDev->word_size );
+ add_length = address_len(aDev->type,aDev->word_size);
/* forge message */
- msg = ( (READ << (add_length+ (aDev->word_size ) ) )
- | (aAddress << (aDev->word_size ) ) );
+ msg = ((READ << (add_length+ (aDev->word_size)))
+ | (aAddress << (aDev->word_size)));
- data_out = as_spi_msg (aDev->fd, msg,
+ data_out = as_spi_msg(aDev->fd, msg,
3 + add_length + aDev->word_size,
- aDev->speed );
+ aDev->speed);
- if (aDev->word_size == 8 )
+ if (aDev->word_size == 8)
return data_out & 0xff;
else
return data_out & 0xffff;
}
-int32_t as_93lcxx_ewen (struct as_93lcxx_device *aDev )
+int32_t as_93lcxx_ewen(struct as_93lcxx_device *aDev)
{
uint32_t msg=0;
int add_length;
- add_length = address_len (aDev->type,aDev->word_size );
+ add_length = address_len(aDev->type,aDev->word_size);
/* forge message */
- msg = ( (EWEN << add_length )
- | (EWEN_ADDR << (add_length-2 ) )
- );
+ msg = ((EWEN << add_length)
+ |(EWEN_ADDR << (add_length-2))
+ );
- as_spi_msg (aDev->fd, msg,
+ as_spi_msg(aDev->fd, msg,
3 + add_length,
- aDev->speed );
+ aDev->speed);
return 0;
}
-int32_t as_93lcxx_erase (struct as_93lcxx_device *aDev, uint16_t aAddress )
+int32_t as_93lcxx_erase(struct as_93lcxx_device *aDev, uint16_t aAddress)
{
uint32_t msg=0;
int add_length;
- add_length = address_len (aDev->type,aDev->word_size );
+ add_length = address_len(aDev->type,aDev->word_size);
/* forge message */
- msg = ( (ERASE << (add_length + aDev->word_size ) )
- | (aAddress << (aDev->word_size ) ) );
+ msg = ((ERASE << (add_length + aDev->word_size))
+ | (aAddress << (aDev->word_size)));
- as_spi_msg (aDev->fd, msg,
+ as_spi_msg(aDev->fd, msg,
3 + add_length + aDev->word_size,
- aDev->speed );
+ aDev->speed);
- usleep (TWC );
+ usleep(TWC);
return 0;
}
-int32_t as_93lcxx_erase_all (struct as_93lcxx_device *aDev )
+int32_t as_93lcxx_erase_all(struct as_93lcxx_device *aDev)
{
uint32_t msg=0;
int add_length;
- add_length = address_len (aDev->type,aDev->word_size );
+ add_length = address_len(aDev->type,aDev->word_size);
/* forge message */
- msg = ( (ERAL << add_length )
- | (ERAL_ADDR << (add_length-2 ) )
- );
+ msg = ((ERAL << add_length)
+ |(ERAL_ADDR << (add_length-2))
+ );
- as_spi_msg (aDev->fd, msg,
+ as_spi_msg(aDev->fd, msg,
3 + add_length,
- aDev->speed );
+ aDev->speed);
/* wait for end of erase all */
- usleep (TEC );
+ usleep(TEC);
return 0;
}
-int32_t as_93lcxx_write (struct as_93lcxx_device *aDev,
- uint16_t aAddress,
- uint16_t aValue )
+int32_t as_93lcxx_write(struct as_93lcxx_device *aDev,
+ uint16_t aAddress,
+ uint16_t aValue)
{
uint32_t msg=0;
int add_length;
- add_length = address_len (aDev->type,aDev->word_size );
+ add_length = address_len(aDev->type,aDev->word_size);
/* forge message */
- msg = ( (WRITE << (add_length+ (aDev->word_size ) ) )
- | (aAddress << (aDev->word_size ) )
+ msg = ((WRITE << (add_length+ (aDev->word_size)))
+ | (aAddress << (aDev->word_size))
| aValue
- );
+ );
- as_spi_msg (aDev->fd, msg,
+ as_spi_msg(aDev->fd, msg,
3 + add_length + aDev->word_size,
- aDev->speed );
+ aDev->speed);
/* Wait for end of writing */
- usleep (TWC );
+ usleep(TWC);
return 0;
}
-int32_t as_93lcxx_write_all (struct as_93lcxx_device *aDev,
- uint16_t aValue )
+int32_t as_93lcxx_write_all(struct as_93lcxx_device *aDev,
+ uint16_t aValue)
{
uint32_t msg=0;
int add_length;
- add_length = address_len (aDev->type,aDev->word_size );
+ add_length = address_len(aDev->type,aDev->word_size);
/* forge message */
- msg = ( (WRAL << (add_length+ (aDev->word_size ) ) )
- | (WRAL_ADDR << ( (aDev->word_size ) + (add_length-2 ) ) )
+ msg = ((WRAL << (add_length+ (aDev->word_size)))
+ |(WRAL_ADDR << ((aDev->word_size) + (add_length-2)))
|aValue
- );
+ );
- as_spi_msg (aDev->fd, msg,
+ as_spi_msg(aDev->fd, msg,
3 + add_length + aDev->word_size,
- aDev->speed );
+ aDev->speed);
/* Wait for end of write all */
- usleep (TWL );
+ usleep(TWL);
return 0;
}
-int32_t as_93lcxx_ewds (struct as_93lcxx_device *aDev )
+int32_t as_93lcxx_ewds(struct as_93lcxx_device *aDev)
{
uint32_t msg=0;
int add_length;
- add_length = address_len (aDev->type,aDev->word_size );
+ add_length = address_len(aDev->type,aDev->word_size);
/* forge message */
- msg = ( (EWDS << add_length )
- | (EWDS_ADDR << (add_length-2 ) )
- );
+ msg = ((EWDS << add_length)
+ |(EWDS_ADDR << (add_length-2))
+ );
- as_spi_msg (aDev->fd, msg,
+ as_spi_msg(aDev->fd, msg,
3 + add_length,
- aDev->speed );
+ aDev->speed);
return 0;
}
diff --git a/target/packages/as_devices/c/as_93lcxx.h b/target/packages/as_devices/c/as_93lcxx.h
index 7d34559..d9d72e4 100644
--- a/target/packages/as_devices/c/as_93lcxx.h
+++ b/target/packages/as_devices/c/as_93lcxx.h
@@ -2,7 +2,7 @@
* This software is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of the
- * License, or (at your option ) any later version.
+ * License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -14,7 +14,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
- * Copyright (C ) 2009 Fabien Marteau <fab...@ar...>
+ * Copyright (C) 2009 Fabien Marteau <fab...@ar...>
*
*/
@@ -24,7 +24,7 @@
/** @file
- * @brief Provide standard commands to drive 93LCxx eeprom (from microchip )
+ * @brief Provide standard commands to drive 93LCxx eeprom (from microchip)
*
*
*/
@@ -42,7 +42,7 @@ extern "C" {
*/
struct as_93lcxx_device {
unsigned char *spidev_filename; /**< filename of the spidev /dev file */
- uint8_t type; /**< type of the eeprom : 46, 56 or 66 (see DS ) */
+ uint8_t type; /**< type of the eeprom : 46, 56 or 66 (see DS) */
uint32_t speed; /**< SCLK speed, in Hz */
uint8_t word_size; /**< word size for transaction, 8 or 16 */
int fd; /**< File handler for spidev bus */
@@ -57,17 +57,17 @@ struct as_93lcxx_device {
*
* @return as_93lcxx_device struct pointer on success, NULL on error
*/
-struct as_93lcxx_device * as_93lcxx_open (unsigned char *aSpidev_filename,
+struct as_93lcxx_device * as_93lcxx_open(unsigned char *aSpidev_filename,
uint8_t aType,
uint32_t aSpeed,
- uint8_t aWord_size );
+ uint8_t aWord_size);
/** @brief close the device
*
* @param spidev_filename path to spidev
*
*/
-void as_93lcxx_close (struct as_93lcxx_device *aDev );
+void as_93lcxx_close(struct as_93lcxx_device *aDev);
/** @brief read a value in address given
*
@@ -76,8 +76,8 @@ void as_93lcxx_close (struct as_93lcxx_device *aDev );
*
* @return positive register value on success, negative value on error.
*/
-int32_t as_93lcxx_read (struct as_93lcxx_device *aDev,
- uint16_t aAddress );
+int32_t as_93lcxx_read(struct as_93lcxx_device *aDev,
+ uint16_t aAddress);
/** @brief enable write on eeprom
*
@@ -85,7 +85,7 @@ int32_t as_93lcxx_read (struct as_93lcxx_device *aDev,
*
* @return positive value on success, negative value on error
*/
-int32_t as_93lcxx_ewen (struct as_93lcxx_device *aDev );
+int32_t as_93lcxx_ewen(struct as_93lcxx_device *aDev);
/** @brief Force all data bits of the specified iaddress to 1
*
@@ -94,8 +94,8 @@ int32_t as_93lcxx_ewen (struct as_93lcxx_device *aDev );
*
* @return positive register value on success, negative value on error.
*/
-int32_t as_93lcxx_erase (struct as_93lcxx_device *aDev,
- uint16_t aAddress );
+int32_t as_93lcxx_erase(struct as_93lcxx_device *aDev,
+ uint16_t aAddress);
/** @brief Force all bits in eeprom to 1
*
@@ -103,7 +103,7 @@ int32_t as_93lcxx_erase (struct as_93lcxx_device *aDev,
*
* @return positive register value on success, negative value on error.
*/
-int32_t as_93lcxx_erase_all (struct as_93lcxx_device *aDev );
+int32_t as_93lcxx_erase_all(struct as_93lcxx_device *aDev);
/** @brief write a value in given address
*
@@ -113,9 +113,9 @@ int32_t as_93lcxx_erase_all (struct as_93lcxx_device *aDev );
*
* @return positive register value on success, negative value on error.
*/
-int32_t as_93lcxx_write (struct as_93lcxx_device *aDev,
- uint16_t aAddress,
- uint16_t aValue );
+int32_t as_93lcxx_write(struct as_93lcxx_device *aDev,
+ uint16_t aAddress,
+ uint16_t aValue);
/** @brief write the entire memory array with value given
*
@@ -124,8 +124,8 @@ int32_t as_93lcxx_write (struct as_93lcxx_device *aDev,
*
* @return positive register value on success, negative value on error.
*/
-int32_t as_93lcxx_write_all (struct as_93lcxx_device *aDev,
- uint16_t aValue );
+int32_t as_93lcxx_write_all(struct as_93lcxx_device *aDev,
+ uint16_t aValue);
/** @brief disable write on eeprom
*
@@ -133,7 +133,7 @@ int32_t as_93lcxx_write_all (struct as_93lcxx_device *aDev,
*
* @return positive value on success, negative value on error
*/
-int32_t as_93lcxx_ewds (struct as_93lcxx_device *aDev );
+int32_t as_93lcxx_ewds(struct as_93lcxx_device *aDev);
#ifdef __cplusplus
diff --git a/target/packages/as_devices/c/as_spi.c b/target/packages/as_devices/c/as_spi.c
index 4edd13d..bed8bc2 100644
--- a/target/packages/as_devices/c/as_spi.c
+++ b/target/packages/as_devices/c/as_spi.c
@@ -2,7 +2,7 @@
* This software is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of the
- * License, or (at your option) any later version.
+ * License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -14,7 +14,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
- * Copyright (C) 2009 Fabien Marteau <fab...@ar...>
+ * Copyright (C) 2009 Fabien Marteau <fab...@ar...>
*
*/
@@ -33,85 +33,85 @@
#include <linux/spi/spidev.h>
-int as_spi_open (const unsigned char *spidev_name)
+int as_spi_open(const unsigned char *spidev_name)
{
int fd;
- fd = open ( (char *)spidev_name, O_RDWR);
- if (fd < 0) {
- perror ("open");
+ fd = open((char *)spidev_name, O_RDWR);
+ if (fd < 0) {
+ perror("open");
return -1;
}
return fd;
}
-int as_spi_set_mode (int fd, uint8_t mode)
+int as_spi_set_mode(int fd, uint8_t mode)
{
/* TODO */
return -1;
}
-int as_spi_set_lsb (int fd, uint8_t lsb)
+int as_spi_set_lsb(int fd, uint8_t lsb)
{
/* TODO */
return -1;
}
-int as_spi_set_bits_per_word (int fd, uint8_t bits)
+int as_spi_set_bits_per_word(int fd, uint8_t bits)
{
/* TODO */
return -1;
}
-int as_spi_set_speed (int fd)
+int as_spi_set_speed(int fd)
{
/* TODO */
return -1;
}
-int as_spi_get_mode (int fd)
+int as_spi_get_mode(int fd)
{
uint8_t mode;
- if (ioctl (fd, SPI_IOC_RD_MODE, &mode) < 0) {
- perror ("SPI rd_mode");
+ if (ioctl(fd, SPI_IOC_RD_MODE, &mode) < 0) {
+ perror("SPI rd_mode");
return -1;
}
return mode;
}
-int as_spi_get_lsb (int fd)
+int as_spi_get_lsb(int fd)
{
uint8_t lsb;
- if (ioctl (fd, SPI_IOC_RD_LSB_FIRST, &lsb) < 0) {
- perror ("SPI rd_lsb_fist");
+ if (ioctl(fd, SPI_IOC_RD_LSB_FIRST, &lsb) < 0) {
+ perror("SPI rd_lsb_fist");
return -1;
}
return lsb;
}
-int as_spi_get_bits_per_word (int fd)
+int as_spi_get_bits_per_word(int fd)
{
uint8_t bits;
- if (ioctl (fd, SPI_IOC_RD_BITS_PER_WORD, &bits) < 0) {
- perror ("SPI bits_per_word");
+ if (ioctl(fd, SPI_IOC_RD_BITS_PER_WORD, &bits) < 0) {
+ perror("SPI bits_per_word");
return-1;
}
return bits;
}
-int as_spi_get_speed (int fd)
+int as_spi_get_speed(int fd)
{
uint8_t speed;
- if (ioctl (fd, SPI_IOC_RD_MAX_SPEED_HZ, &speed) < 0) {
- perror ("SPI max_speed_hz");
+ if (ioctl(fd, SPI_IOC_RD_MAX_SPEED_HZ, &speed) < 0) {
+ perror("SPI max_speed_hz");
return -1;
}
return speed;
}
-uint32_t as_spi_msg (int aFd,
+uint32_t as_spi_msg(int aFd,
uint32_t aMsg,
size_t aLen,
uint32_t aSpeed)
@@ -132,13 +132,13 @@ uint32_t as_spi_msg (int aFd,
msg = msg<<1;/* XXX Last bit is always read at 0 */
len = len+1; /* XXX */
- memset (xfer, 0, sizeof xfer);
- memset (buf, 0, sizeof buf);
- memset (buf_read, 0, sizeof buf_read);
+ memset(xfer, 0, sizeof xfer);
+ memset(buf, 0, sizeof buf);
+ memset(buf_read, 0, sizeof buf_read);
- if (len >= sizeof buf)
- len = (sizeof buf)-1;
- for (i = len;i > 0;i--)
+ if (len >= sizeof buf)
+ len = (sizeof buf)-1;
+ for (i = len;i > 0;i--)
{
buf[i-1] = msg & 0x01;
msg = msg >> 1;
@@ -150,14 +150,14 @@ uint32_t as_spi_msg (int aFd,
xfer[0].speed_hz = aSpeed;
xfer[0].bits_per_word = 1;
- status = ioctl (aFd, SPI_IOC_MESSAGE (1), xfer);
- if (status < 0) {
- perror ("SPI_IOC_MESSAGE");
+ status = ioctl(aFd, SPI_IOC_MESSAGE(1), xfer);
+ if (status < 0) {
+ perror("SPI_IOC_MESSAGE");
return 0;
}
msg = msg | buf_read[0];
- for (i = 1;i < len;i++)
+ for (i = 1;i < len;i++)
{
msg = msg << 1;
msg = msg | buf_read[i];
@@ -165,9 +165,9 @@ uint32_t as_spi_msg (int aFd,
return msg;
}
-void as_spi_close (int fd)
+void as_spi_close(int fd)
{
- close (fd);
+ close(fd);
return;
}
diff --git a/target/packages/as_devices/c/as_spi.h b/target/packages/as_devices/c/as_spi.h
index c49fb26..78b9365 100644
--- a/target/packages/as_devices/c/as_spi.h
+++ b/target/packages/as_devices/c/as_spi.h
@@ -2,7 +2,7 @@
* This software is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of the
- * License, or (at your option) any later version.
+ * License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -14,7 +14,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
- * Copyright (C) 2009 Fabien Marteau <fab...@ar...>
+ * Copyright (C) 2009 Fabien Marteau <fab...@ar...>
*
*/
@@ -38,7 +38,7 @@ extern "C" {
*
* @return the file descriptor of the opened device, -1Â on error
*/
-int as_spi_open (const unsigned char *spidev_name);
+int as_spi_open(const unsigned char *spidev_name);
/** @brief Set spi bus mode
*
@@ -48,7 +48,7 @@ int as_spi_open (const unsigned char *spidev_name);
* @return mode if positive value, negative value on error
*
*/
-int as_spi_set_mode (int fd, uint8_t mode);
+int as_spi_set_mode(int fd, uint8_t mode);
/** @brief Set bits order
*
@@ -57,7 +57,7 @@ int as_spi_set_mode (int fd, uint8_t mode);
*
* @return lsb first if positive, msb first if 0, negative value on error
*/
-int as_spi_set_lsb (int fd, uint8_t lsb);
+int as_spi_set_lsb(int fd, uint8_t lsb);
/** @brief Set bits per word
*
@@ -66,7 +66,7 @@ int as_spi_set_lsb (int fd, uint8_t lsb);
*
* @return bit per word if positive value, negative value on error
*/
-int as_spi_set_bits_per_word (int fd, uint8_t bits);
+int as_spi_set_bits_per_word(int fd, uint8_t bits);
/** @brief Get spi bus mode
*
@@ -75,7 +75,7 @@ int as_spi_set_bits_per_word (int fd, uint8_t bits);
* @return mode if positive value, negative value on error
*
*/
-int as_spi_get_mode (int fd);
+int as_spi_get_mode(int fd);
/** @brief Get bits order
*
@@ -83,7 +83,7 @@ int as_spi_get_mode (int fd);
*
* @return lsb first if positive, msb first if 0, negative value on error
*/
-int as_spi_get_lsb (int fd);
+int as_spi_get_lsb(int fd);
/** @brief Get clock bus speed
*
@@ -91,7 +91,7 @@ int as_spi_get_lsb (int fd);
*
* @return speed in Hz, negative value on error
*/
-int as_spi_get_speed (int fd);
+int as_spi_get_speed(int fd);
/** @brief Get bits per word
@@ -100,9 +100,9 @@ int as_spi_get_speed (int fd);
*
* @return bit per word if positive value, negative value on error
*/
-int as_spi_get_bits_per_word (int fd);
+int as_spi_get_bits_per_word(int fd);
-/** @brief Forge arbitrary length message (31bits max) and send it
+/** @brief Forge arbitrary length message (31bits max) and send it
*
* @param fd spidev file handler
* @param msg right adjusted message
@@ -111,15 +111,15 @@ int as_spi_get_bits_per_word (int fd);
*
* @return message read
*/
-uint32_t as_spi_msg (int fd,
- uint32_t msg,
- size_t len,
- uint32_t speed);
+uint32_t as_spi_msg(int fd,
+ uint32_t msg,
+ size_t len,
+ uint32_t speed);
/** @brief Close a SPI bus.
*
*/
-void as_spi_close (int fd);
+void as_spi_close(int fd);
#ifdef __cplusplus
hooks/post-receive
--
armadeus
|
|
From: Fabien M <fa...@us...> - 2009-12-03 13:10:46
|
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 f0050bf404134ca1744e0d644e1e70dcc59f17bb (commit)
from 758def4102f4238f49fec50ae2fe551842181497 (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 f0050bf404134ca1744e0d644e1e70dcc59f17bb
Author: Fabien Marteau <fab...@ar...>
Date: Thu Dec 3 14:10:20 2009 +0100
[OTHER] Changing spaces
-----------------------------------------------------------------------
Summary of changes:
target/packages/as_devices/c/as_93lcxx.c | 114 +++++++++++++++---------------
target/packages/as_devices/c/as_93lcxx.h | 26 ++++----
target/packages/as_devices/c/as_spi.c | 72 +++++++++---------
target/packages/as_devices/c/as_spi.h | 32 ++++----
4 files changed, 122 insertions(+), 122 deletions(-)
diff --git a/target/packages/as_devices/c/as_93lcxx.c b/target/packages/as_devices/c/as_93lcxx.c
index 527906d..0e8d8d4 100644
--- a/target/packages/as_devices/c/as_93lcxx.c
+++ b/target/packages/as_devices/c/as_93lcxx.c
@@ -46,18 +46,18 @@
/** @brief Private functions to ease making spi instructions
*/
-uint8_t address_len( uint8_t aType, uint8_t aWord_size )
+uint8_t address_len (uint8_t aType, uint8_t aWord_size )
{
- switch( aType )
+ switch (aType )
{
case 46:
- if( aWord_size == 16 )
+ if (aWord_size == 16 )
return 6;
else
return 7;
case 56:
case 66:
- if( aWord_size == 16 )
+ if (aWord_size == 16 )
return 8;
else
return 9;
@@ -66,7 +66,7 @@ uint8_t address_len( uint8_t aType, uint8_t aWord_size )
}
}
-struct as_93lcxx_device * as_93lcxx_open( unsigned char *aSpidev_filename,
+struct as_93lcxx_device * as_93lcxx_open (unsigned char *aSpidev_filename,
uint8_t aType,
uint32_t aSpeed,
uint8_t aWord_size )
@@ -75,18 +75,18 @@ struct as_93lcxx_device * as_93lcxx_open( unsigned char *aSpidev_filename,
struct as_93lcxx_device *dev;
/* open spidev bus */
- fd = as_spi_open( aSpidev_filename );
- if( fd < 0 )
+ fd = as_spi_open (aSpidev_filename );
+ if (fd < 0 )
return NULL;
/* verify datas */
- if( !( ( aType == 46 ) || ( aType == 56 ) || ( aType == 66 ) ) )
+ if (! ( (aType == 46 ) || (aType == 56 ) || (aType == 66 ) ) )
return NULL;
- if( ( aWord_size < 1 ) || ( aWord_size > 16 ) )
+ if ( (aWord_size < 1 ) || (aWord_size > 16 ) )
return NULL;
- dev = ( struct as_93lcxx_device * )malloc( sizeof( struct as_93lcxx_device ) );
- if( dev == NULL )
+ dev = (struct as_93lcxx_device * )malloc (sizeof (struct as_93lcxx_device ) );
+ if (dev == NULL )
return NULL;
/* fill in spidev structure */
@@ -99,155 +99,155 @@ struct as_93lcxx_device * as_93lcxx_open( unsigned char *aSpidev_filename,
return dev;
}
-void as_93lcxx_close( struct as_93lcxx_device *aDev )
+void as_93lcxx_close (struct as_93lcxx_device *aDev )
{
- as_spi_close( aDev->fd );
- free( aDev );
+ as_spi_close (aDev->fd );
+ free (aDev );
}
-int32_t as_93lcxx_read( struct as_93lcxx_device *aDev, uint16_t aAddress )
+int32_t as_93lcxx_read (struct as_93lcxx_device *aDev, uint16_t aAddress )
{
uint32_t data_out,msg=0;
int add_length;
- add_length = address_len( aDev->type,aDev->word_size );
+ add_length = address_len (aDev->type,aDev->word_size );
/* forge message */
- msg = ( ( READ << ( add_length+ ( aDev->word_size ) ) )
- | ( aAddress << ( aDev->word_size ) ) );
+ msg = ( (READ << (add_length+ (aDev->word_size ) ) )
+ | (aAddress << (aDev->word_size ) ) );
- data_out = as_spi_msg( aDev->fd, msg,
+ data_out = as_spi_msg (aDev->fd, msg,
3 + add_length + aDev->word_size,
aDev->speed );
- if( aDev->word_size == 8 )
+ if (aDev->word_size == 8 )
return data_out & 0xff;
else
return data_out & 0xffff;
}
-int32_t as_93lcxx_ewen( struct as_93lcxx_device *aDev )
+int32_t as_93lcxx_ewen (struct as_93lcxx_device *aDev )
{
uint32_t msg=0;
int add_length;
- add_length = address_len( aDev->type,aDev->word_size );
+ add_length = address_len (aDev->type,aDev->word_size );
/* forge message */
- msg = ( ( EWEN << add_length )
- |( EWEN_ADDR << ( add_length-2 ) )
+ msg = ( (EWEN << add_length )
+ | (EWEN_ADDR << (add_length-2 ) )
);
- as_spi_msg( aDev->fd, msg,
+ as_spi_msg (aDev->fd, msg,
3 + add_length,
aDev->speed );
return 0;
}
-int32_t as_93lcxx_erase( struct as_93lcxx_device *aDev, uint16_t aAddress )
+int32_t as_93lcxx_erase (struct as_93lcxx_device *aDev, uint16_t aAddress )
{
uint32_t msg=0;
int add_length;
- add_length = address_len( aDev->type,aDev->word_size );
+ add_length = address_len (aDev->type,aDev->word_size );
/* forge message */
- msg = ( ( ERASE << ( add_length + aDev->word_size ) )
- | ( aAddress << ( aDev->word_size ) ) );
+ msg = ( (ERASE << (add_length + aDev->word_size ) )
+ | (aAddress << (aDev->word_size ) ) );
- as_spi_msg( aDev->fd, msg,
+ as_spi_msg (aDev->fd, msg,
3 + add_length + aDev->word_size,
aDev->speed );
- usleep( TWC );
+ usleep (TWC );
return 0;
}
-int32_t as_93lcxx_erase_all( struct as_93lcxx_device *aDev )
+int32_t as_93lcxx_erase_all (struct as_93lcxx_device *aDev )
{
uint32_t msg=0;
int add_length;
- add_length = address_len( aDev->type,aDev->word_size );
+ add_length = address_len (aDev->type,aDev->word_size );
/* forge message */
- msg = ( ( ERAL << add_length )
- |( ERAL_ADDR << ( add_length-2 ) )
+ msg = ( (ERAL << add_length )
+ | (ERAL_ADDR << (add_length-2 ) )
);
- as_spi_msg( aDev->fd, msg,
+ as_spi_msg (aDev->fd, msg,
3 + add_length,
aDev->speed );
/* wait for end of erase all */
- usleep( TEC );
+ usleep (TEC );
return 0;
}
-int32_t as_93lcxx_write( struct as_93lcxx_device *aDev,
- uint16_t aAddress,
- uint16_t aValue )
+int32_t as_93lcxx_write (struct as_93lcxx_device *aDev,
+ uint16_t aAddress,
+ uint16_t aValue )
{
uint32_t msg=0;
int add_length;
- add_length = address_len( aDev->type,aDev->word_size );
+ add_length = address_len (aDev->type,aDev->word_size );
/* forge message */
- msg = ( ( WRITE << ( add_length+ ( aDev->word_size ) ) )
- | ( aAddress << ( aDev->word_size ) )
+ msg = ( (WRITE << (add_length+ (aDev->word_size ) ) )
+ | (aAddress << (aDev->word_size ) )
| aValue
);
- as_spi_msg( aDev->fd, msg,
+ as_spi_msg (aDev->fd, msg,
3 + add_length + aDev->word_size,
aDev->speed );
/* Wait for end of writing */
- usleep( TWC );
+ usleep (TWC );
return 0;
}
-int32_t as_93lcxx_write_all( struct as_93lcxx_device *aDev,
- uint16_t aValue )
+int32_t as_93lcxx_write_all (struct as_93lcxx_device *aDev,
+ uint16_t aValue )
{
uint32_t msg=0;
int add_length;
- add_length = address_len( aDev->type,aDev->word_size );
+ add_length = address_len (aDev->type,aDev->word_size );
/* forge message */
- msg = ( ( WRAL << ( add_length+ ( aDev->word_size ) ) )
- |( WRAL_ADDR << ( ( aDev->word_size ) + ( add_length-2 ) ) )
+ msg = ( (WRAL << (add_length+ (aDev->word_size ) ) )
+ | (WRAL_ADDR << ( (aDev->word_size ) + (add_length-2 ) ) )
|aValue
);
- as_spi_msg( aDev->fd, msg,
+ as_spi_msg (aDev->fd, msg,
3 + add_length + aDev->word_size,
aDev->speed );
/* Wait for end of write all */
- usleep( TWL );
+ usleep (TWL );
return 0;
}
-int32_t as_93lcxx_ewds( struct as_93lcxx_device *aDev )
+int32_t as_93lcxx_ewds (struct as_93lcxx_device *aDev )
{
uint32_t msg=0;
int add_length;
- add_length = address_len( aDev->type,aDev->word_size );
+ add_length = address_len (aDev->type,aDev->word_size );
/* forge message */
- msg = ( ( EWDS << add_length )
- |( EWDS_ADDR << ( add_length-2 ) )
+ msg = ( (EWDS << add_length )
+ | (EWDS_ADDR << (add_length-2 ) )
);
- as_spi_msg( aDev->fd, msg,
+ as_spi_msg (aDev->fd, msg,
3 + add_length,
aDev->speed );
return 0;
diff --git a/target/packages/as_devices/c/as_93lcxx.h b/target/packages/as_devices/c/as_93lcxx.h
index b9acfd2..7d34559 100644
--- a/target/packages/as_devices/c/as_93lcxx.h
+++ b/target/packages/as_devices/c/as_93lcxx.h
@@ -2,7 +2,7 @@
* This software is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of the
- * License, or ( at your option ) any later version.
+ * License, or (at your option ) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -14,7 +14,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
- * Copyright ( C ) 2009 Fabien Marteau <fab...@ar...>
+ * Copyright (C ) 2009 Fabien Marteau <fab...@ar...>
*
*/
@@ -24,7 +24,7 @@
/** @file
- * @brief Provide standard commands to drive 93LCxx eeprom ( from microchip )
+ * @brief Provide standard commands to drive 93LCxx eeprom (from microchip )
*
*
*/
@@ -42,7 +42,7 @@ extern "C" {
*/
struct as_93lcxx_device {
unsigned char *spidev_filename; /**< filename of the spidev /dev file */
- uint8_t type; /**< type of the eeprom : 46, 56 or 66 ( see DS ) */
+ uint8_t type; /**< type of the eeprom : 46, 56 or 66 (see DS ) */
uint32_t speed; /**< SCLK speed, in Hz */
uint8_t word_size; /**< word size for transaction, 8 or 16 */
int fd; /**< File handler for spidev bus */
@@ -57,7 +57,7 @@ struct as_93lcxx_device {
*
* @return as_93lcxx_device struct pointer on success, NULL on error
*/
-struct as_93lcxx_device * as_93lcxx_open( unsigned char *aSpidev_filename,
+struct as_93lcxx_device * as_93lcxx_open (unsigned char *aSpidev_filename,
uint8_t aType,
uint32_t aSpeed,
uint8_t aWord_size );
@@ -67,7 +67,7 @@ struct as_93lcxx_device * as_93lcxx_open( unsigned char *aSpidev_filename,
* @param spidev_filename path to spidev
*
*/
-void as_93lcxx_close( struct as_93lcxx_device *aDev );
+void as_93lcxx_close (struct as_93lcxx_device *aDev );
/** @brief read a value in address given
*
@@ -76,7 +76,7 @@ void as_93lcxx_close( struct as_93lcxx_device *aDev );
*
* @return positive register value on success, negative value on error.
*/
-int32_t as_93lcxx_read( struct as_93lcxx_device *aDev,
+int32_t as_93lcxx_read (struct as_93lcxx_device *aDev,
uint16_t aAddress );
/** @brief enable write on eeprom
@@ -85,7 +85,7 @@ int32_t as_93lcxx_read( struct as_93lcxx_device *aDev,
*
* @return positive value on success, negative value on error
*/
-int32_t as_93lcxx_ewen( struct as_93lcxx_device *aDev );
+int32_t as_93lcxx_ewen (struct as_93lcxx_device *aDev );
/** @brief Force all data bits of the specified iaddress to 1
*
@@ -94,7 +94,7 @@ int32_t as_93lcxx_ewen( struct as_93lcxx_device *aDev );
*
* @return positive register value on success, negative value on error.
*/
-int32_t as_93lcxx_erase( struct as_93lcxx_device *aDev,
+int32_t as_93lcxx_erase (struct as_93lcxx_device *aDev,
uint16_t aAddress );
/** @brief Force all bits in eeprom to 1
@@ -103,7 +103,7 @@ int32_t as_93lcxx_erase( struct as_93lcxx_device *aDev,
*
* @return positive register value on success, negative value on error.
*/
-int32_t as_93lcxx_erase_all( struct as_93lcxx_device *aDev );
+int32_t as_93lcxx_erase_all (struct as_93lcxx_device *aDev );
/** @brief write a value in given address
*
@@ -113,7 +113,7 @@ int32_t as_93lcxx_erase_all( struct as_93lcxx_device *aDev );
*
* @return positive register value on success, negative value on error.
*/
-int32_t as_93lcxx_write( struct as_93lcxx_device *aDev,
+int32_t as_93lcxx_write (struct as_93lcxx_device *aDev,
uint16_t aAddress,
uint16_t aValue );
@@ -124,7 +124,7 @@ int32_t as_93lcxx_write( struct as_93lcxx_device *aDev,
*
* @return positive register value on success, negative value on error.
*/
-int32_t as_93lcxx_write_all( struct as_93lcxx_device *aDev,
+int32_t as_93lcxx_write_all (struct as_93lcxx_device *aDev,
uint16_t aValue );
/** @brief disable write on eeprom
@@ -133,7 +133,7 @@ int32_t as_93lcxx_write_all( struct as_93lcxx_device *aDev,
*
* @return positive value on success, negative value on error
*/
-int32_t as_93lcxx_ewds( struct as_93lcxx_device *aDev );
+int32_t as_93lcxx_ewds (struct as_93lcxx_device *aDev );
#ifdef __cplusplus
diff --git a/target/packages/as_devices/c/as_spi.c b/target/packages/as_devices/c/as_spi.c
index f4cd29b..4edd13d 100644
--- a/target/packages/as_devices/c/as_spi.c
+++ b/target/packages/as_devices/c/as_spi.c
@@ -2,7 +2,7 @@
* This software is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of the
- * License, or ( at your option ) any later version.
+ * License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -14,7 +14,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
- * Copyright ( C ) 2009 Fabien Marteau <fab...@ar...>
+ * Copyright (C) 2009 Fabien Marteau <fab...@ar...>
*
*/
@@ -33,88 +33,88 @@
#include <linux/spi/spidev.h>
-int as_spi_open( const unsigned char *spidev_name )
+int as_spi_open (const unsigned char *spidev_name)
{
int fd;
- fd = open( ( char * )spidev_name, O_RDWR );
- if ( fd < 0 ) {
- perror( "open" );
+ fd = open ( (char *)spidev_name, O_RDWR);
+ if (fd < 0) {
+ perror ("open");
return -1;
}
return fd;
}
-int as_spi_set_mode( int fd, uint8_t mode )
+int as_spi_set_mode (int fd, uint8_t mode)
{
/* TODO */
return -1;
}
-int as_spi_set_lsb( int fd, uint8_t lsb )
+int as_spi_set_lsb (int fd, uint8_t lsb)
{
/* TODO */
return -1;
}
-int as_spi_set_bits_per_word( int fd, uint8_t bits )
+int as_spi_set_bits_per_word (int fd, uint8_t bits)
{
/* TODO */
return -1;
}
-int as_spi_set_speed( int fd )
+int as_spi_set_speed (int fd)
{
/* TODO */
return -1;
}
-int as_spi_get_mode( int fd )
+int as_spi_get_mode (int fd)
{
uint8_t mode;
- if ( ioctl( fd, SPI_IOC_RD_MODE, &mode ) < 0 ) {
- perror( "SPI rd_mode" );
+ if (ioctl (fd, SPI_IOC_RD_MODE, &mode) < 0) {
+ perror ("SPI rd_mode");
return -1;
}
return mode;
}
-int as_spi_get_lsb( int fd )
+int as_spi_get_lsb (int fd)
{
uint8_t lsb;
- if ( ioctl( fd, SPI_IOC_RD_LSB_FIRST, &lsb ) < 0 ) {
- perror( "SPI rd_lsb_fist" );
+ if (ioctl (fd, SPI_IOC_RD_LSB_FIRST, &lsb) < 0) {
+ perror ("SPI rd_lsb_fist");
return -1;
}
return lsb;
}
-int as_spi_get_bits_per_word( int fd )
+int as_spi_get_bits_per_word (int fd)
{
uint8_t bits;
- if ( ioctl( fd, SPI_IOC_RD_BITS_PER_WORD, &bits ) < 0 ) {
- perror( "SPI bits_per_word" );
+ if (ioctl (fd, SPI_IOC_RD_BITS_PER_WORD, &bits) < 0) {
+ perror ("SPI bits_per_word");
return-1;
}
return bits;
}
-int as_spi_get_speed( int fd )
+int as_spi_get_speed (int fd)
{
uint8_t speed;
- if ( ioctl( fd, SPI_IOC_RD_MAX_SPEED_HZ, &speed ) < 0 ) {
- perror( "SPI max_speed_hz" );
+ if (ioctl (fd, SPI_IOC_RD_MAX_SPEED_HZ, &speed) < 0) {
+ perror ("SPI max_speed_hz");
return -1;
}
return speed;
}
-uint32_t as_spi_msg( int aFd,
+uint32_t as_spi_msg (int aFd,
uint32_t aMsg,
size_t aLen,
- uint32_t aSpeed )
+ uint32_t aSpeed)
{
uint32_t msg;
int len;
@@ -132,13 +132,13 @@ uint32_t as_spi_msg( int aFd,
msg = msg<<1;/* XXX Last bit is always read at 0 */
len = len+1; /* XXX */
- memset( xfer, 0, sizeof xfer );
- memset( buf, 0, sizeof buf );
- memset( buf_read, 0, sizeof buf_read );
+ memset (xfer, 0, sizeof xfer);
+ memset (buf, 0, sizeof buf);
+ memset (buf_read, 0, sizeof buf_read);
- if ( len >= sizeof buf )
- len = (sizeof buf)-1;
- for ( i = len;i > 0;i-- )
+ if (len >= sizeof buf)
+ len = (sizeof buf)-1;
+ for (i = len;i > 0;i--)
{
buf[i-1] = msg & 0x01;
msg = msg >> 1;
@@ -150,14 +150,14 @@ uint32_t as_spi_msg( int aFd,
xfer[0].speed_hz = aSpeed;
xfer[0].bits_per_word = 1;
- status = ioctl( aFd, SPI_IOC_MESSAGE( 1 ), xfer );
- if ( status < 0 ) {
- perror( "SPI_IOC_MESSAGE" );
+ status = ioctl (aFd, SPI_IOC_MESSAGE (1), xfer);
+ if (status < 0) {
+ perror ("SPI_IOC_MESSAGE");
return 0;
}
msg = msg | buf_read[0];
- for ( i = 1;i < len;i++ )
+ for (i = 1;i < len;i++)
{
msg = msg << 1;
msg = msg | buf_read[i];
@@ -165,9 +165,9 @@ uint32_t as_spi_msg( int aFd,
return msg;
}
-void as_spi_close( int fd )
+void as_spi_close (int fd)
{
- close( fd );
+ close (fd);
return;
}
diff --git a/target/packages/as_devices/c/as_spi.h b/target/packages/as_devices/c/as_spi.h
index 78b9365..c49fb26 100644
--- a/target/packages/as_devices/c/as_spi.h
+++ b/target/packages/as_devices/c/as_spi.h
@@ -2,7 +2,7 @@
* This software is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of the
- * License, or (at your option) any later version.
+ * License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -14,7 +14,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
- * Copyright (C) 2009 Fabien Marteau <fab...@ar...>
+ * Copyright (C) 2009 Fabien Marteau <fab...@ar...>
*
*/
@@ -38,7 +38,7 @@ extern "C" {
*
* @return the file descriptor of the opened device, -1Â on error
*/
-int as_spi_open(const unsigned char *spidev_name);
+int as_spi_open (const unsigned char *spidev_name);
/** @brief Set spi bus mode
*
@@ -48,7 +48,7 @@ int as_spi_open(const unsigned char *spidev_name);
* @return mode if positive value, negative value on error
*
*/
-int as_spi_set_mode(int fd, uint8_t mode);
+int as_spi_set_mode (int fd, uint8_t mode);
/** @brief Set bits order
*
@@ -57,7 +57,7 @@ int as_spi_set_mode(int fd, uint8_t mode);
*
* @return lsb first if positive, msb first if 0, negative value on error
*/
-int as_spi_set_lsb(int fd, uint8_t lsb);
+int as_spi_set_lsb (int fd, uint8_t lsb);
/** @brief Set bits per word
*
@@ -66,7 +66,7 @@ int as_spi_set_lsb(int fd, uint8_t lsb);
*
* @return bit per word if positive value, negative value on error
*/
-int as_spi_set_bits_per_word(int fd, uint8_t bits);
+int as_spi_set_bits_per_word (int fd, uint8_t bits);
/** @brief Get spi bus mode
*
@@ -75,7 +75,7 @@ int as_spi_set_bits_per_word(int fd, uint8_t bits);
* @return mode if positive value, negative value on error
*
*/
-int as_spi_get_mode(int fd);
+int as_spi_get_mode (int fd);
/** @brief Get bits order
*
@@ -83,7 +83,7 @@ int as_spi_get_mode(int fd);
*
* @return lsb first if positive, msb first if 0, negative value on error
*/
-int as_spi_get_lsb(int fd);
+int as_spi_get_lsb (int fd);
/** @brief Get clock bus speed
*
@@ -91,7 +91,7 @@ int as_spi_get_lsb(int fd);
*
* @return speed in Hz, negative value on error
*/
-int as_spi_get_speed(int fd);
+int as_spi_get_speed (int fd);
/** @brief Get bits per word
@@ -100,9 +100,9 @@ int as_spi_get_speed(int fd);
*
* @return bit per word if positive value, negative value on error
*/
-int as_spi_get_bits_per_word(int fd);
+int as_spi_get_bits_per_word (int fd);
-/** @brief Forge arbitrary length message (31bits max) and send it
+/** @brief Forge arbitrary length message (31bits max) and send it
*
* @param fd spidev file handler
* @param msg right adjusted message
@@ -111,15 +111,15 @@ int as_spi_get_bits_per_word(int fd);
*
* @return message read
*/
-uint32_t as_spi_msg(int fd,
- uint32_t msg,
- size_t len,
- uint32_t speed);
+uint32_t as_spi_msg (int fd,
+ uint32_t msg,
+ size_t len,
+ uint32_t speed);
/** @brief Close a SPI bus.
*
*/
-void as_spi_close(int fd);
+void as_spi_close (int fd);
#ifdef __cplusplus
hooks/post-receive
--
armadeus
|
|
From: Fabien M <fa...@us...> - 2009-12-03 10:38: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 758def4102f4238f49fec50ae2fe551842181497 (commit)
via 5da53af9b6f8b7c5aa477124d136263a78798975 (commit)
from d88d22cdfdb533245d908290e7b67f68ec8cfe76 (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 758def4102f4238f49fec50ae2fe551842181497
Merge: 5da53af9b6f8b7c5aa477124d136263a78798975 d88d22cdfdb533245d908290e7b67f68ec8cfe76
Author: Fabien Marteau <fab...@ar...>
Date: Thu Dec 3 11:38:21 2009 +0100
Merge branch 'master' of ssh://fabm@armadeus.git.sourceforge.net/gitroot/armadeus/armadeus
commit 5da53af9b6f8b7c5aa477124d136263a78798975
Author: Fabien Marteau <fab...@ar...>
Date: Thu Dec 3 11:37:12 2009 +0100
[OTHERS] fix as_93lcxx lib bugs and clean indentation
-----------------------------------------------------------------------
Summary of changes:
target/packages/as_devices/c/as_93lcxx.c | 160 ++++++++++++++++--------------
target/packages/as_devices/c/as_93lcxx.h | 40 ++++----
target/packages/as_devices/c/as_spi.c | 99 ++++++++++---------
target/packages/as_devices/c/as_spi.h | 2 +-
4 files changed, 159 insertions(+), 142 deletions(-)
diff --git a/target/packages/as_devices/c/as_93lcxx.c b/target/packages/as_devices/c/as_93lcxx.c
index d0d36c6..527906d 100644
--- a/target/packages/as_devices/c/as_93lcxx.c
+++ b/target/packages/as_devices/c/as_93lcxx.c
@@ -22,13 +22,14 @@
#include "as_spi.h"
#include <stdlib.h>
#include <stdio.h>
+#include <unistd.h>
/* define start bits + opcode */
#define READ (6)
#define EWEN (4)
#define EWEN_ADDR (3)
#define ERASE (7)
-#define ERAL (6)
+#define ERAL (4)
#define ERAL_ADDR (2)
#define WRITE (5)
#define WRAL (4)
@@ -36,21 +37,27 @@
#define EWDS (4)
#define EWDS_ADDR (0)
+/* Define timings */
+#define MS (1000)
+#define TWC (6*MS)
+#define TEC (6*MS)
+#define TWL (15*MS)
+
/** @brief Private functions to ease making spi instructions
*/
-uint8_t address_len(uint8_t aType, uint8_t aWord_size)
+uint8_t address_len( uint8_t aType, uint8_t aWord_size )
{
- switch(aType)
+ switch( aType )
{
case 46:
- if( aWord_size == 16)
+ if( aWord_size == 16 )
return 6;
else
return 7;
case 56:
case 66:
- if( aWord_size == 16)
+ if( aWord_size == 16 )
return 8;
else
return 9;
@@ -59,27 +66,27 @@ uint8_t address_len(uint8_t aType, uint8_t aWord_size)
}
}
-struct as_93lcxx_device * as_93lcxx_open(unsigned char *aSpidev_filename,
- uint8_t aType,
- uint32_t aSpeed,
- uint8_t aWord_size)
+struct as_93lcxx_device * as_93lcxx_open( unsigned char *aSpidev_filename,
+ uint8_t aType,
+ uint32_t aSpeed,
+ uint8_t aWord_size )
{
int fd=-1;
struct as_93lcxx_device *dev;
/* open spidev bus */
- fd = as_spi_open(aSpidev_filename);
- if(fd < 0)
+ fd = as_spi_open( aSpidev_filename );
+ if( fd < 0 )
return NULL;
/* verify datas */
- if(!( (aType == 46) || (aType == 56) || (aType == 66)))
+ if( !( ( aType == 46 ) || ( aType == 56 ) || ( aType == 66 ) ) )
return NULL;
- if( (aWord_size < 1) || (aWord_size > 16))
+ if( ( aWord_size < 1 ) || ( aWord_size > 16 ) )
return NULL;
- dev = (struct as_93lcxx_device *)malloc(sizeof(struct as_93lcxx_device));
- if(dev == NULL)
+ dev = ( struct as_93lcxx_device * )malloc( sizeof( struct as_93lcxx_device ) );
+ if( dev == NULL )
return NULL;
/* fill in spidev structure */
@@ -92,154 +99,157 @@ struct as_93lcxx_device * as_93lcxx_open(unsigned char *aSpidev_filename,
return dev;
}
-void as_93lcxx_close(struct as_93lcxx_device *aDev)
+void as_93lcxx_close( struct as_93lcxx_device *aDev )
{
- as_spi_close(aDev->fd);
- free(aDev);
+ as_spi_close( aDev->fd );
+ free( aDev );
}
-int32_t as_93lcxx_read(struct as_93lcxx_device *aDev, uint16_t aAddress)
+int32_t as_93lcxx_read( struct as_93lcxx_device *aDev, uint16_t aAddress )
{
uint32_t data_out,msg=0;
int add_length;
- add_length = address_len(aDev->type,aDev->word_size);
+ add_length = address_len( aDev->type,aDev->word_size );
/* forge message */
- msg = ((READ << (add_length+ (aDev->word_size)))
- | (aAddress << (aDev->word_size)));
+ msg = ( ( READ << ( add_length+ ( aDev->word_size ) ) )
+ | ( aAddress << ( aDev->word_size ) ) );
- data_out = as_spi_msg(aDev->fd, msg,
+ data_out = as_spi_msg( aDev->fd, msg,
3 + add_length + aDev->word_size,
- aDev->speed);
+ aDev->speed );
- if( aDev->word_size == 8)
+ if( aDev->word_size == 8 )
return data_out & 0xff;
else
return data_out & 0xffff;
}
-int32_t as_93lcxx_ewen(struct as_93lcxx_device *aDev)
+int32_t as_93lcxx_ewen( struct as_93lcxx_device *aDev )
{
uint32_t msg=0;
int add_length;
- add_length = address_len(aDev->type,aDev->word_size);
+ add_length = address_len( aDev->type,aDev->word_size );
/* forge message */
- msg = ((EWEN << add_length)
- |(EWEN_ADDR << (add_length-2))
- );
+ msg = ( ( EWEN << add_length )
+ |( EWEN_ADDR << ( add_length-2 ) )
+ );
- as_spi_msg(aDev->fd, msg,
+ as_spi_msg( aDev->fd, msg,
3 + add_length,
- aDev->speed);
+ aDev->speed );
return 0;
}
-int32_t as_93lcxx_erase(struct as_93lcxx_device *aDev, uint16_t aAddress)
+int32_t as_93lcxx_erase( struct as_93lcxx_device *aDev, uint16_t aAddress )
{
uint32_t msg=0;
int add_length;
- add_length = address_len(aDev->type,aDev->word_size);
+ add_length = address_len( aDev->type,aDev->word_size );
/* forge message */
- msg = ((ERASE << (add_length + aDev->word_size ))
- | (aAddress << (aDev->word_size)));
+ msg = ( ( ERASE << ( add_length + aDev->word_size ) )
+ | ( aAddress << ( aDev->word_size ) ) );
- as_spi_msg(aDev->fd, msg,
+ as_spi_msg( aDev->fd, msg,
3 + add_length + aDev->word_size,
- aDev->speed);
- return 0;
+ aDev->speed );
+ usleep( TWC );
+
+ return 0;
}
-int32_t as_93lcxx_erase_all(struct as_93lcxx_device *aDev)
+int32_t as_93lcxx_erase_all( struct as_93lcxx_device *aDev )
{
uint32_t msg=0;
int add_length;
- add_length = address_len(aDev->type,aDev->word_size);
+ add_length = address_len( aDev->type,aDev->word_size );
/* forge message */
- msg = ((ERAL << add_length)
- |(ERAL_ADDR << (add_length-2))
- );
+ msg = ( ( ERAL << add_length )
+ |( ERAL_ADDR << ( add_length-2 ) )
+ );
- as_spi_msg(aDev->fd, msg,
- 3 + add_length + aDev->word_size,
- aDev->speed);
+ as_spi_msg( aDev->fd, msg,
+ 3 + add_length,
+ aDev->speed );
- /* TODO: wait for RDY/BSY_n */
+ /* wait for end of erase all */
+ usleep( TEC );
return 0;
-
-
}
-int32_t as_93lcxx_write(struct as_93lcxx_device *aDev,
+int32_t as_93lcxx_write( struct as_93lcxx_device *aDev,
uint16_t aAddress,
- uint16_t aValue)
+ uint16_t aValue )
{
uint32_t msg=0;
int add_length;
- add_length = address_len(aDev->type,aDev->word_size);
+ add_length = address_len( aDev->type,aDev->word_size );
/* forge message */
- msg = ((WRITE << (add_length+ (aDev->word_size)))
- | (aAddress << (aDev->word_size))
+ msg = ( ( WRITE << ( add_length+ ( aDev->word_size ) ) )
+ | ( aAddress << ( aDev->word_size ) )
| aValue
- );
+ );
- as_spi_msg(aDev->fd, msg,
+ as_spi_msg( aDev->fd, msg,
3 + add_length + aDev->word_size,
- aDev->speed);
+ aDev->speed );
- /* TODO: mait for RDY/BSY_n */
+ /* Wait for end of writing */
+ usleep( TWC );
return 0;
}
-int32_t as_93lcxx_write_all(struct as_93lcxx_device *aDev,
- uint16_t aValue)
+int32_t as_93lcxx_write_all( struct as_93lcxx_device *aDev,
+ uint16_t aValue )
{
uint32_t msg=0;
int add_length;
- add_length = address_len(aDev->type,aDev->word_size);
+ add_length = address_len( aDev->type,aDev->word_size );
/* forge message */
- msg = ((WRAL << (add_length+ (aDev->word_size)))
- |(WRAL_ADDR << ((aDev->word_size) + (add_length-2)))
+ msg = ( ( WRAL << ( add_length+ ( aDev->word_size ) ) )
+ |( WRAL_ADDR << ( ( aDev->word_size ) + ( add_length-2 ) ) )
|aValue
- );
+ );
- as_spi_msg(aDev->fd, msg,
+ as_spi_msg( aDev->fd, msg,
3 + add_length + aDev->word_size,
- aDev->speed);
+ aDev->speed );
- /* TODO: wait for RDY/BSY_n */
+ /* Wait for end of write all */
+ usleep( TWL );
return 0;
}
-int32_t as_93lcxx_ewds(struct as_93lcxx_device *aDev)
+int32_t as_93lcxx_ewds( struct as_93lcxx_device *aDev )
{
uint32_t msg=0;
int add_length;
- add_length = address_len(aDev->type,aDev->word_size);
+ add_length = address_len( aDev->type,aDev->word_size );
/* forge message */
- msg = ((EWDS << add_length)
- |(EWDS_ADDR << (add_length-2))
- );
+ msg = ( ( EWDS << add_length )
+ |( EWDS_ADDR << ( add_length-2 ) )
+ );
- as_spi_msg(aDev->fd, msg,
+ as_spi_msg( aDev->fd, msg,
3 + add_length,
- aDev->speed);
+ aDev->speed );
return 0;
}
diff --git a/target/packages/as_devices/c/as_93lcxx.h b/target/packages/as_devices/c/as_93lcxx.h
index 06ebd7c..b9acfd2 100644
--- a/target/packages/as_devices/c/as_93lcxx.h
+++ b/target/packages/as_devices/c/as_93lcxx.h
@@ -2,7 +2,7 @@
* This software is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of the
- * License, or (at your option) any later version.
+ * License, or ( at your option ) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -14,7 +14,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
- * Copyright (C) 2009 Fabien Marteau <fab...@ar...>
+ * Copyright ( C ) 2009 Fabien Marteau <fab...@ar...>
*
*/
@@ -24,7 +24,7 @@
/** @file
- * @brief Provide standard commands to drive 93LCxx eeprom (from microchip)
+ * @brief Provide standard commands to drive 93LCxx eeprom ( from microchip )
*
*
*/
@@ -42,7 +42,7 @@ extern "C" {
*/
struct as_93lcxx_device {
unsigned char *spidev_filename; /**< filename of the spidev /dev file */
- uint8_t type; /**< type of the eeprom : 46, 56 or 66 (see DS) */
+ uint8_t type; /**< type of the eeprom : 46, 56 or 66 ( see DS ) */
uint32_t speed; /**< SCLK speed, in Hz */
uint8_t word_size; /**< word size for transaction, 8 or 16 */
int fd; /**< File handler for spidev bus */
@@ -57,17 +57,17 @@ struct as_93lcxx_device {
*
* @return as_93lcxx_device struct pointer on success, NULL on error
*/
-struct as_93lcxx_device * as_93lcxx_open(unsigned char *aSpidev_filename,
- uint8_t aType,
- uint32_t aSpeed,
- uint8_t aWord_size);
+struct as_93lcxx_device * as_93lcxx_open( unsigned char *aSpidev_filename,
+ uint8_t aType,
+ uint32_t aSpeed,
+ uint8_t aWord_size );
/** @brief close the device
*
* @param spidev_filename path to spidev
*
*/
-void as_93lcxx_close(struct as_93lcxx_device *aDev);
+void as_93lcxx_close( struct as_93lcxx_device *aDev );
/** @brief read a value in address given
*
@@ -76,7 +76,8 @@ void as_93lcxx_close(struct as_93lcxx_device *aDev);
*
* @return positive register value on success, negative value on error.
*/
-int32_t as_93lcxx_read(struct as_93lcxx_device *aDev, uint16_t aAddress);
+int32_t as_93lcxx_read( struct as_93lcxx_device *aDev,
+ uint16_t aAddress );
/** @brief enable write on eeprom
*
@@ -84,7 +85,7 @@ int32_t as_93lcxx_read(struct as_93lcxx_device *aDev, uint16_t aAddress);
*
* @return positive value on success, negative value on error
*/
-int32_t as_93lcxx_ewen(struct as_93lcxx_device *aDev);
+int32_t as_93lcxx_ewen( struct as_93lcxx_device *aDev );
/** @brief Force all data bits of the specified iaddress to 1
*
@@ -93,7 +94,8 @@ int32_t as_93lcxx_ewen(struct as_93lcxx_device *aDev);
*
* @return positive register value on success, negative value on error.
*/
-int32_t as_93lcxx_erase(struct as_93lcxx_device *aDev, uint16_t aAddress);
+int32_t as_93lcxx_erase( struct as_93lcxx_device *aDev,
+ uint16_t aAddress );
/** @brief Force all bits in eeprom to 1
*
@@ -101,7 +103,7 @@ int32_t as_93lcxx_erase(struct as_93lcxx_device *aDev, uint16_t aAddress);
*
* @return positive register value on success, negative value on error.
*/
-int32_t as_93lcxx_erase_all(struct as_93lcxx_device *aDev);
+int32_t as_93lcxx_erase_all( struct as_93lcxx_device *aDev );
/** @brief write a value in given address
*
@@ -111,9 +113,9 @@ int32_t as_93lcxx_erase_all(struct as_93lcxx_device *aDev);
*
* @return positive register value on success, negative value on error.
*/
-int32_t as_93lcxx_write(struct as_93lcxx_device *aDev,
- uint16_t aAddress,
- uint16_t aValue);
+int32_t as_93lcxx_write( struct as_93lcxx_device *aDev,
+ uint16_t aAddress,
+ uint16_t aValue );
/** @brief write the entire memory array with value given
*
@@ -122,8 +124,8 @@ int32_t as_93lcxx_write(struct as_93lcxx_device *aDev,
*
* @return positive register value on success, negative value on error.
*/
-int32_t as_93lcxx_write_all(struct as_93lcxx_device *aDev,
- uint16_t aValue);
+int32_t as_93lcxx_write_all( struct as_93lcxx_device *aDev,
+ uint16_t aValue );
/** @brief disable write on eeprom
*
@@ -131,7 +133,7 @@ int32_t as_93lcxx_write_all(struct as_93lcxx_device *aDev,
*
* @return positive value on success, negative value on error
*/
-int32_t as_93lcxx_ewds(struct as_93lcxx_device *aDev);
+int32_t as_93lcxx_ewds( struct as_93lcxx_device *aDev );
#ifdef __cplusplus
diff --git a/target/packages/as_devices/c/as_spi.c b/target/packages/as_devices/c/as_spi.c
index bc70b8c..f4cd29b 100644
--- a/target/packages/as_devices/c/as_spi.c
+++ b/target/packages/as_devices/c/as_spi.c
@@ -2,7 +2,7 @@
* This software is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of the
- * License, or (at your option) any later version.
+ * License, or ( at your option ) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -14,7 +14,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
- * Copyright (C) 2009 Fabien Marteau <fab...@ar...>
+ * Copyright ( C ) 2009 Fabien Marteau <fab...@ar...>
*
*/
@@ -33,136 +33,141 @@
#include <linux/spi/spidev.h>
-int as_spi_open(const unsigned char *spidev_name)
+int as_spi_open( const unsigned char *spidev_name )
{
int fd;
- fd = open((char *)spidev_name, O_RDWR);
- if (fd < 0) {
- perror("open");
+ fd = open( ( char * )spidev_name, O_RDWR );
+ if ( fd < 0 ) {
+ perror( "open" );
return -1;
}
return fd;
}
-int as_spi_set_mode(int fd, uint8_t mode)
+int as_spi_set_mode( int fd, uint8_t mode )
{
/* TODO */
return -1;
}
-int as_spi_set_lsb(int fd, uint8_t lsb)
+int as_spi_set_lsb( int fd, uint8_t lsb )
{
/* TODO */
return -1;
}
-int as_spi_set_bits_per_word(int fd, uint8_t bits)
+int as_spi_set_bits_per_word( int fd, uint8_t bits )
{
/* TODO */
return -1;
}
-int as_spi_set_speed(int fd)
+int as_spi_set_speed( int fd )
{
/* TODO */
return -1;
}
-int as_spi_get_mode(int fd)
+int as_spi_get_mode( int fd )
{
uint8_t mode;
- if (ioctl(fd, SPI_IOC_RD_MODE, &mode) < 0) {
- perror("SPI rd_mode");
+ if ( ioctl( fd, SPI_IOC_RD_MODE, &mode ) < 0 ) {
+ perror( "SPI rd_mode" );
return -1;
}
return mode;
}
-int as_spi_get_lsb(int fd)
+int as_spi_get_lsb( int fd )
{
uint8_t lsb;
- if (ioctl(fd, SPI_IOC_RD_LSB_FIRST, &lsb) < 0) {
- perror("SPI rd_lsb_fist");
+ if ( ioctl( fd, SPI_IOC_RD_LSB_FIRST, &lsb ) < 0 ) {
+ perror( "SPI rd_lsb_fist" );
return -1;
}
return lsb;
}
-int as_spi_get_bits_per_word(int fd)
+int as_spi_get_bits_per_word( int fd )
{
uint8_t bits;
- if (ioctl(fd, SPI_IOC_RD_BITS_PER_WORD, &bits) < 0) {
- perror("SPI bits_per_word");
+ if ( ioctl( fd, SPI_IOC_RD_BITS_PER_WORD, &bits ) < 0 ) {
+ perror( "SPI bits_per_word" );
return-1;
}
return bits;
}
-int as_spi_get_speed(int fd)
+int as_spi_get_speed( int fd )
{
uint8_t speed;
- if (ioctl(fd, SPI_IOC_RD_MAX_SPEED_HZ, &speed) < 0) {
- perror("SPI max_speed_hz");
+ if ( ioctl( fd, SPI_IOC_RD_MAX_SPEED_HZ, &speed ) < 0 ) {
+ perror( "SPI max_speed_hz" );
return -1;
}
return speed;
}
-uint32_t as_spi_msg(int aFd,
+uint32_t as_spi_msg( int aFd,
uint32_t aMsg,
size_t aLen,
- uint32_t aSpeed)
+ uint32_t aSpeed )
{
uint32_t msg;
int len;
- struct spi_ioc_transfer xfer[1];
- unsigned char buf[32];
- unsigned char buf_read[32];
+ struct spi_ioc_transfer xfer[1];
+ unsigned char buf[32];
+ unsigned char buf_read[32];
- int status;
+ int status;
int i;
msg = aMsg;
len = aLen;
- memset(xfer, 0, sizeof xfer);
- memset(buf, 0, sizeof buf);
- memset(buf_read, 0, sizeof buf_read);
+ msg = msg<<1;/* XXX Last bit is always read at 0 */
+ len = len+1; /* XXX */
- if (len > sizeof buf)
- len = sizeof buf;
- for (i = len;i > 0;i--)
+ memset( xfer, 0, sizeof xfer );
+ memset( buf, 0, sizeof buf );
+ memset( buf_read, 0, sizeof buf_read );
+
+ if ( len >= sizeof buf )
+ len = (sizeof buf)-1;
+ for ( i = len;i > 0;i-- )
{
buf[i-1] = msg & 0x01;
msg = msg >> 1;
}
- xfer[0].tx_buf = (__u64) buf;
- xfer[0].len = len;
- xfer[0].rx_buf = (__u64) buf_read;
+ xfer[0].tx_buf = buf;
+ xfer[0].len = len;
+ xfer[0].rx_buf = buf_read;
xfer[0].speed_hz = aSpeed;
xfer[0].bits_per_word = 1;
- status = ioctl(aFd, SPI_IOC_MESSAGE(1), xfer);
- if (status < 0) {
- perror("SPI_IOC_MESSAGE");
- return 0;
- }
- for (i = 0;i < len;i++)
+ status = ioctl( aFd, SPI_IOC_MESSAGE( 1 ), xfer );
+ if ( status < 0 ) {
+ perror( "SPI_IOC_MESSAGE" );
+ return 0;
+ }
+
+ msg = msg | buf_read[0];
+ for ( i = 1;i < len;i++ )
{
- msg = msg | buf_read[i];
msg = msg << 1;
+ msg = msg | buf_read[i];
}
- return msg;
+ return msg;
}
-void as_spi_close(int fd)
+void as_spi_close( int fd )
{
- close(fd);
+ close( fd );
return;
}
diff --git a/target/packages/as_devices/c/as_spi.h b/target/packages/as_devices/c/as_spi.h
index bde5890..78b9365 100644
--- a/target/packages/as_devices/c/as_spi.h
+++ b/target/packages/as_devices/c/as_spi.h
@@ -102,7 +102,7 @@ int as_spi_get_speed(int fd);
*/
int as_spi_get_bits_per_word(int fd);
-/** @brief Forge arbitrary length message (32bits max) and send it
+/** @brief Forge arbitrary length message (31bits max) and send it
*
* @param fd spidev file handler
* @param msg right adjusted message
hooks/post-receive
--
armadeus
|
|
From: Julien B a. A. <ar...@us...> - 2009-12-01 22:30:56
|
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 annotated tag, release-3.2 has been created
at 93500bd53c200923449b8ad49d78bdcfe9793f25 (tag)
tagging d88d22cdfdb533245d908290e7b67f68ec8cfe76 (commit)
replaces latestrelease
tagged by Julien Boibessot
on Tue Dec 1 23:16:23 2009 +0100
- Log -----------------------------------------------------------------
Armadeus Project release 3.2 (December 2009)
Eric Jarrige (2):
[BUILDROOT] install using cp instead of install for zlib libraries
Merge branch 'master' of ssh://jorasse@armadeus.git.sourceforge.net/gitroot/armadeus/armadeus
Fabien Marteau (23):
[LINUX][DRIVER][MAX1027] Scheduling bug corrected (to be reviewed)
/*
Merge branch 'master' of ssh://fabm@armadeus.git.sourceforge.net/gitroot/armadeus
[as_devices] as_apf27_pwm ok for c library, in dev for C++ wrapper
[as_device] Wrapper C++ validated for pwm (bis)
[as_devices] Little comment
[as_devices] Python wrapper added for pwm
[AsDevices] python wrapper done for pwm
[as_devices] begin buildroot integration of library
[BUILDROOT] adding makefile for AsDevices library
[as_devices] adding C libs for i2c (compile but not tested)
[as_devices] changing multiton
[as_devices] pwm and i2c C++ wrapper compiling ok
[as_devices] gpio C++ wrapper compiling
[as_devices] AD5258 in progress
Merge branch 'master' of ssh://fabm@armadeus.git.sourceforge.net/gitroot/armadeus/armadeus
[BUILDROOT] Adding as_devices in .config file
[as_devices] python module in LGPL
[as_devices] Adding API for as_93lcxx memory functions
[as_devices] Adding spidev API
[as_devices] as_93lcxx lib compile, not tested
[as_devices] first version of as_spi compile
[as_devices] segfault fix on as_93lcxx_close()
Julien Boibessot (129):
[LINUX] Activates Bluetooth support in 2.6.29 default configs for APF27
[BUILDROOT] Add preliminary work to build bluez
[BUILDROOT] Add preliminary work to build bluez
[DEMOS] xenomai examples: cleanup + indent checking + allows non RT kernel examples to be compiled for APF27
[BUILDROOT] Adds Boa to APF9328 test config + moves Linux/uClibc/busybox respective BR2_xx variables to according places in config file
[BUILDROOT] Updates bluez (non)selection due to automatic package detection...
[LINUX] Updates APF9328 default Linux configs according to new LCD support
[BUILD] Makes quilt script use git + some refinements
[LINUX] On APF9328 makes it possible to have UART without RTS/CTS support + configure console port accordingly
[LINUX] On APF9328 configure console port without RTS/CTS
Merge branch 'master' of ssh://artemys@armadeus.git.sourceforge.net/gitroot/armadeus
[LINUX] Updates APF27 default Linux configs according to new LCD support
Applies Linux coding rules
[TEST] Put serial port in raw mode during test
[LINUX] Makes ioctls work again in gpio driver
[TARGET] Add a directory (target/scripts/) to store useful system scripts that are not in the default rootfs skeleton
[BUILD] Preliminary work before buildroot patches moving
[BUILD] Renames Buildroot patches and moves them to patches/buildroot/
[BUILD] Renames Buildroot patches and moves them to patches/buildroot/ (Part2)
[LINUX] ISP1761: Gives correct init value to HW_MODE_REG register
[LINUX] APF9328: separates module (APF9328) and baseboards (DevFull/Light or others) hardware declaration/init parts
[LINUX] Converts a message into debug in GPIO driver
[LINUX] Makes LQ057 LCD works on APF27 (Freescale framebuffer)
[BUILDROOT] Add Quake package (patch)
[LINUX] gpio: correct deadlock bug + add an IOCTL for setting port Mode
[DEMOS] Adds a small C program to show how to use IOCTL with GPIO driver
[BUILD] Add target to get BR patched sources only: buildroot-patched-sources + simplify buildauto
Remove uneeded blank lines
correct error in a previous commit
[BUILDROOT] BR2_TARGET_U_BOOT_CONFIG_BOARD was not correctly set
[ROOTFS] Add /etc/mtab (symlink to /proc/mounts)
[LINUX] Adds new timing trick to improve i.MXL SDHC controller robustness
[TOOLS] Improve verbosity of quiltifying script
[LINUX] Separates APF27 and APF27Dev hardware declaration parts
[GIT] Add some .gitignore files
[BUILDROOT] Updates Linux 2.6.29 APF27 default configs
[LINUX] Removes bad comment in apf27.c
[LINUX] Add Optrex T51638D084 TFT support (APF27 & Freescale framebuffer)
[BUILDROOT] Updates APF27 default Linux configs (for Optrex TFT)
Merge branch 'master' of ssh://artemys@armadeus.git.sourceforge.net/gitroot/armadeus/armadeus
[LINUX] Don't initialize i.MX27 FEC GPIOs if not configured
[LINUX] Correct small bug in gpio ioctl handling on APF27 (thanks Luca)
[LINUX] Improves Mode setting in GPIO driver
[BUILDROOT] Uses Buildroot generated ubinize, not host installed one
[TEST] Simplify GPIO test
[LINUX] Separates module and baseboard power management parts
[LINUX] USE_APF27DEV_IMX_LED_FOR_PM & USE_APF27DEV_IMX_SWITCH_FOR_PM options are only availableon the APF27DEV
Merge branch 'master' of ssh://artemys@armadeus.git.sourceforge.net/gitroot/armadeus/armadeus
[BUILDROOT] Removes empty patches
[BUILDROOT] Re-integrates Quake package as a patch
[GIT] Adds top .gitignore file
[LINUX] Updates minors creation for APF27 in loadgpio.sh
[BUILDROOT] Adds Pygame package
[TOOLS] Corrects typos + windows format in boot recover tool
[BUILDROOT] Corrects bad installation of python files
[LINUX] Corrects bug in microSD removal detection
[LINUX] Removes (very) old kernel patches as they are no more supported (2.6.12, 2.6.17, 2.6.18.1)
[BUILDROOT] Bump default Armadeus Linux version from 2.6.29.4 to 2.6.29.6
[BUILD] Makes separate targets for buildroot sources loading, unpacking & patching
[TOOLS] Now quiltify tool can handle buildroot
[TOOLS] Remove no more needed/obsolete Linux patch management tool
[BUILDROOT] removes 2.6.18 from possible kernels selection
[LINUX] (Re)activates mouse/keyboard/joystick support for apf27 on 2.6.29. Hum... strange that it gone away...
[BUILDROOT] Move GPM into a patch that can be sent to buildroot team (when it will work ;-))
[TEST] Updates apf9328_test Linux config
[BUILD] Updates some .gitignore files
[BUILDROOT] Add patch to have Tslib working with Pygame
[DEMOS] Updates music player doc
[DEMOS] Cleanup fractal demo (now indentation has to be checked git status)
[DEMOS] Cleanup fractal demo (part 2)
[BUILDROOT] Bump proftp version 1.3.1 -> 1.3.2
Merge branch 'master' of ssh://artemys@armadeus.git.sourceforge.net/gitroot/armadeus/armadeus
Corrects commit 3092b276fa439a8345bf24819fec5e540ebff3ce (Hitachi LCD)
updates patches/buildroot/cleanup_buildroot.sh
[LINUX] Removes compilation warning in apf9328 when max1027 is not selected
[BUILD] Improve some .gitignore
[TOOLS] Don't try to quiltify if current view doesn't compile
[LINUX] Moves LCD config/handling outside of apf27.c
[BUILD] Improves .gitignore
[LINUX] Reorganizes LCDs for APF27 and add a custom hackable LCD entry
Merge branch 'master' of ssh://artemys@armadeus.git.sourceforge.net/gitroot/armadeus/armadeus
[LINUX] Enhances APF27 Custom LCD source code presentation
[BUILDROOT] Updates APF27 default Linux configs
[BUILROOT] Revert commit d6300def6c2f271ef4140da342604cb88be0dc30 + add default as_devices option in APF27 Buildroot config files
[BUILDROOT] Allows nano to be selectable again
[BUILDROOT] Update APF9328 default configs
[BUILDROOT] Lets socketcan-clean target work
[BUILDROOT] Makes libjpeg download works again
[AS_DEVICES] Indentation + bad comments
[BUILDROOT] Use 2.6.29 kernel headers by default
Indentation...
[TEST] Improves testbutton & gpio test
[TOOLS] Cleanup setDAC
[TOOLS] ad9889ctrl: Cleanup + indentation
[TOOLS] Simplify setDAC tool sources
Add some .gitignore files
[DEBUG] imxssi doesn't require libpow to compile
Merge branch 'master' of ssh://artemys@armadeus.git.sourceforge.net/gitroot/armadeus/armadeus
Indentation
[DEMOS] Updates input_test Makefile
Indentation
[LINUX] Continue to better separate apf27.c and apf27-dev.c platform files
[LINUX] Sometimes TSC210x may need a reset before asking revision number
[BUILDROOT] ldd wasn't installed anymore in rootfs, correct that (Buildroot upstream patch)
Merge branch 'master' of ssh://artemys@armadeus.git.sourceforge.net/gitroot/armadeus/armadeus
Merge branch 'master' of ssh://artemys@armadeus.git.sourceforge.net/gitroot/armadeus/armadeus
Indentation + ^M at the end of lines: please don't use wordpad as text editor ! ;-) (only vim users can understand my pain)
[LINUX] Makes /sys/ (slow) mode of the max1027 more reliable + addstatistics entry
Merge branch 'master' of ssh://artemys@armadeus.git.sourceforge.net/gitroot/armadeus/armadeus
[DEMOS] Add preliminary work for a graphical (kind of) oscilloscope using AsDevices library
[LINUX] AD9889: makes it possible to rmmod the driver when no chip was detected. Check indentation while we are at it...
Merge branch 'master' of ssh://artemys@armadeus.git.sourceforge.net/gitroot/armadeus/armadeus
Indentation...
Indentation...
[TEST] Cleanup and factorize test_fpga
[LINUX] Cleanup some wishbone_example Makefiles
[LINUX] Cleanup fpgaloader, check indentation while we are at it...
Updates Changelog and corresponding script
Comments
[TEST] Add new package tests
[BUILDROOT] Updates the way armadeus testsuite is installed
[TEST] Updates some packages tests for 3.2
[TEST] Update Linux drivers test for 3.2
[TEST] Updates test_release for 3.2
[BUILDROOT] Add tcpdump in apf27_test default config
[BUILDROOT] Add tcpdump in apf27_test default config
[TEST] One last test (for fun ;-))
Finish to update ChangeLog for 3.2
Finish to update ChangeLog for 3.2
artemys (1):
[BUILD] Now all subfields in Changelog would be indented the same...
gwenhael (1):
[BUILDROOT] xenomai: Makefile cleaned, xenomai version upgraded, and apf27 support added
jorasse (16):
[armadeus] minor typo change to test post commit hook.
Another test of git commit hook
Yet another test
[BUILDROOT] make ubifs patch apply after update of git local view
update mtd-utils to support mkfs.ubifs and ubinize
update mtd-utils to support mkfs.ubifs and ubinize
define mtd-utils default configuration
changed quake patch to regular GIT files
Merge branch 'master' of ssh://jorasse@armadeus.git.sourceforge.net/gitroot/armadeus/armadeus
[BUILDROOT] made ubinize generic at least for apf boards
[BUILDROOT] use common JFFS2 and UBIFS mtd_utils. make UBIFS generic
[BUILDROOT] NOR flash does not support UBIFS sub-pages
[BUILDROOT] update apf9328 default configuration
[UBOOT] update apf9328 default configuration
[UBOOT] cleanup apf27 config file
[BUILDROOT] cleanup: makes ubifs patches generic
nicolas colombain (9):
add LW700AT9003
[LINUX] add GPS/GSM uart declaration to apf27.c
[BUILDROOT] launch ubinize tool if ubifs selected
[BUILDROOT] add ubinize script for apf27 in case of ubifs file system
[TOOLS] fix tickets 43 and 64 concerning ubootrecover bugs
LINUX: add hitachi TX12D17VM1BDP TFT
add LW700A fix
[LINUX]fix vertical alignment bug
[LINUX] fix ad9889 video output format bug
thom25 (1):
add LW700AT9003
-----------------------------------------------------------------------
hooks/post-receive
--
armadeus
|
|
From: Julien B a. A. <ar...@us...> - 2009-12-01 22:19:45
|
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 d88d22cdfdb533245d908290e7b67f68ec8cfe76 (commit)
from 0c69aebfc0de0792bd488ed24b935a4063f73c01 (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 d88d22cdfdb533245d908290e7b67f68ec8cfe76
Author: Julien Boibessot <jul...@ar...>
Date: Tue Dec 1 23:15:09 2009 +0100
Finish to update ChangeLog for 3.2
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b6b2cb0..3b00243 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,10 @@ Changes since last release
Changes in release 3.2 (December 1rst 2009)
+* Wiki dump available here: http://www.armadeus.com/assos_downloads/wiki/
+
+* Corrected Tickets: #71, #16, #43, #57, #64, #69, #73
+
* Buildroot:
Main changes: Bug correction, begin of AsDevices lib, UBIFS for APF27, pygame & quake packages
Xenomai for APF27
hooks/post-receive
--
armadeus
|
|
From: Julien B a. A. <ar...@us...> - 2009-12-01 21:58:37
|
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 0c69aebfc0de0792bd488ed24b935a4063f73c01 (commit)
from e83adf8eac11f5f36c46d2734cc1f522973595f5 (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 0c69aebfc0de0792bd488ed24b935a4063f73c01
Author: Julien Boibessot <jul...@ar...>
Date: Tue Dec 1 22:55:34 2009 +0100
Finish to update ChangeLog for 3.2
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c12378e..b6b2cb0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,9 +8,13 @@ Changes since last release
----
-Changes in release 3.2 (November 30th 2009)
+Changes in release 3.2 (December 1rst 2009)
* Buildroot:
+ Main changes: Bug correction, begin of AsDevices lib, UBIFS for APF27, pygame & quake packages
+ Xenomai for APF27
+ List of all changes:
+ - Add tcpdump in apf27_test default config
- install using cp instead of install for zlib libraries
- ldd wasn't installed anymore in rootfs, correct that (Buildroot upstream patch)
- Use 2.6.29 kernel headers by default
@@ -22,7 +26,6 @@ Changes in release 3.2 (November 30th 2009)
- Updates APF27 default Linux configs
- adding makefile for AsDevices library
- cleanup: makes ubifs patches generic
- - update apf9328 default configuration
- NOR flash does not support UBIFS sub-pages
- use common JFFS2 and UBIFS mtd_utils. make UBIFS generic
- Bump proftp version 1.3.1 -> 1.3.2
@@ -50,6 +53,8 @@ Changes in release 3.2 (November 30th 2009)
- Revert commit d6300def6c2f271ef4140da342604cb88be0dc30 + add default as_devices option in APF27 Buildroot config files
- update mtd-utils to support mkfs.ubifs and ubinize
* Linux:
+ Main changes: Bugs correction, LCD reorg + new one added, APF27 reorg
+ List of all changes:
- Cleanup fpgaloader, check indentation while we are at it...
- Cleanup some wishbone_example Makefiles
- AD9889: makes it possible to rmmod the driver when no chip was detected. Check indentation while we are at it...
@@ -103,6 +108,10 @@ Changes in release 3.2 (November 30th 2009)
* Debug:
- imxssi doesn't require libpow to compile
* Test:
+ - Update Linux drivers test for 3.2
+ - Updates some packages tests for 3.2
+ - Updates the way armadeus testsuite is installed
+ - Add new package tests
- Cleanup and factorize test_fpga
- Improves testbutton & gpio test
- Updates apf9328_test Linux config
hooks/post-receive
--
armadeus
|
|
From: Julien B a. A. <ar...@us...> - 2009-12-01 15:07:07
|
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 e83adf8eac11f5f36c46d2734cc1f522973595f5 (commit)
via a68097322b8a6813d200f3ed6da1556288dbf694 (commit)
via 9f39d5efc7221613a8faeacb1f8fcacd738d10f9 (commit)
via a2ffca8e6155bfa43d17dfe44f18f87944b34677 (commit)
via c10f341165f307e58d326e60b00985feb032ead1 (commit)
via 0adb78b1bf1b96cfea84782393728911d000da5f (commit)
via cf8d659d1fa4b795b59a1640802b45b2e5374506 (commit)
via d9bb39fcb3ebba1cd17b13a9cc8021a5ac6460ab (commit)
via 1aa3e83d41abf8ebced3dc3bfcf2961ee7090568 (commit)
from 4f93754994b1a9e5919b2857c3c7f1882b146169 (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 e83adf8eac11f5f36c46d2734cc1f522973595f5
Author: Julien Boibessot <jul...@ar...>
Date: Tue Dec 1 15:59:30 2009 +0100
[TEST] One last test (for fun ;-))
commit a68097322b8a6813d200f3ed6da1556288dbf694
Author: Julien Boibessot <jul...@ar...>
Date: Tue Dec 1 15:46:07 2009 +0100
[BUILDROOT] Add tcpdump in apf27_test default config
commit 9f39d5efc7221613a8faeacb1f8fcacd738d10f9
Author: Julien Boibessot <jul...@ar...>
Date: Tue Dec 1 15:44:43 2009 +0100
[BUILDROOT] Add tcpdump in apf27_test default config
commit a2ffca8e6155bfa43d17dfe44f18f87944b34677
Author: Julien Boibessot <jul...@ar...>
Date: Tue Dec 1 15:42:52 2009 +0100
[TEST] Updates test_release for 3.2
commit c10f341165f307e58d326e60b00985feb032ead1
Author: Julien Boibessot <jul...@ar...>
Date: Tue Dec 1 14:10:20 2009 +0100
[TEST] Update Linux drivers test for 3.2
commit 0adb78b1bf1b96cfea84782393728911d000da5f
Author: Julien Boibessot <jul...@ar...>
Date: Tue Dec 1 13:54:01 2009 +0100
[TEST] Updates some packages tests for 3.2
commit cf8d659d1fa4b795b59a1640802b45b2e5374506
Author: Julien Boibessot <jul...@ar...>
Date: Tue Dec 1 13:49:27 2009 +0100
[BUILDROOT] Updates the way armadeus testsuite is installed
commit d9bb39fcb3ebba1cd17b13a9cc8021a5ac6460ab
Author: Julien Boibessot <jul...@ar...>
Date: Tue Dec 1 13:46:02 2009 +0100
[TEST] Add new package tests
commit 1aa3e83d41abf8ebced3dc3bfcf2961ee7090568
Author: Julien Boibessot <jul...@ar...>
Date: Mon Nov 30 14:46:49 2009 +0100
Comments
-----------------------------------------------------------------------
Summary of changes:
buildroot/local/apf27_test/apf27_test.config | 8 +-
.../package/armadeus-testsuite/armadeus-tests.mk | 4 +-
.../fpga/dev_tools/loader/apf27-fpga-loader.c | 4 +-
target/test/apf27devfull_adcdac_test.sh | 38 +++++---
.../test/data/images/armadeus_systems_480x272.png | Bin 0 -> 13244 bytes
target/test/dhcp.sh | 4 +
target/test/install.sh | 27 ++++++
target/test/mmc/mmc_perf.sh | 98 +++++++++++++-------
target/test/packages/test_boa.sh | 2 +-
.../packages/{test_imxregs.sh => test_links.sh} | 35 ++++----
target/test/packages/test_madplay.sh | 39 +++++---
target/test/packages/test_mplayer.sh | 47 ++++++----
.../packages/{test_imxregs.sh => test_nano.sh} | 39 ++++----
target/test/packages/test_prboom.sh | 48 ++++++++++
target/test/packages/test_python.sh | 4 +-
target/test/packages/test_sdl.sh | 10 +-
.../packages/{test_strace.sh => test_slideshow.sh} | 26 ++++--
.../packages/{test_strace.sh => test_tcpdump.sh} | 27 ++++--
target/test/test_dac.sh | 3 +-
target/test/test_ethernet.sh | 11 ++-
target/test/test_framebuffer.sh | 10 +-
target/test/test_gpio.sh | 9 +-
target/test/test_helpers.sh | 27 ++++++
target/test/test_release.sh | 54 +++++++++--
target/test/test_rs232.sh | 6 +-
target/test/test_rtc.sh | 2 +
target/test/test_sound.sh | 6 +-
target/test/test_usb_host.sh | 57 +++++++++---
target/test/test_watchdog.sh | 4 +-
29 files changed, 460 insertions(+), 189 deletions(-)
create mode 100644 target/test/data/images/armadeus_systems_480x272.png
create mode 100755 target/test/dhcp.sh
create mode 100755 target/test/install.sh
copy target/test/packages/{test_imxregs.sh => test_links.sh} (55%)
copy target/test/packages/{test_imxregs.sh => test_nano.sh} (52%)
create mode 100755 target/test/packages/test_prboom.sh
copy target/test/packages/{test_strace.sh => test_slideshow.sh} (58%)
copy target/test/packages/{test_strace.sh => test_tcpdump.sh} (57%)
diff --git a/buildroot/local/apf27_test/apf27_test.config b/buildroot/local/apf27_test/apf27_test.config
index 7174b09..9be20af 100644
--- a/buildroot/local/apf27_test/apf27_test.config
+++ b/buildroot/local/apf27_test/apf27_test.config
@@ -1,6 +1,6 @@
#
# Automatically generated make config: don't edit
-# Fri Oct 23 18:15:23 2009
+# Tue Dec 1 10:24:20 2009
#
BR2_HAVE_DOT_CONFIG=y
BR2_VERSION="0.10.0-svn"
@@ -417,7 +417,7 @@ BR2_PACKAGE_DROPBEAR=y
# BR2_PACKAGE_LIBCURL is not set
# BR2_PACKAGE_LIBEXOSIP2 is not set
# BR2_PACKAGE_LIBOSIP2 is not set
-# BR2_PACKAGE_LIBPCAP is not set
+BR2_PACKAGE_LIBPCAP=y
# BR2_PACKAGE_LIBUPNP is not set
BR2_PACKAGE_LINKS=y
# BR2_PACKAGE_LRZSZ is not set
@@ -466,7 +466,8 @@ BR2_PACKAGE_PORTMAP=y
BR2_PACKAGE_SOCKETCAN=y
BR2_PACKAGE_SOCKETCAN_TEST=y
# BR2_PACKAGE_STUNNEL is not set
-# BR2_PACKAGE_TCPDUMP is not set
+BR2_PACKAGE_TCPDUMP=y
+# BR2_PACKAGE_TCPDUMP_SMB is not set
# BR2_PACKAGE_DHCPDUMP is not set
# BR2_PACKAGE_TFTPD is not set
# BR2_PACKAGE_TN5250 is not set
@@ -627,6 +628,7 @@ BR2_PACKAGE_JPEG=y
BR2_PACKAGE_LIBPNG=y
BR2_PACKAGE_LIBUNGIF=y
# BR2_PACKAGE_PIXMAN is not set
+# BR2_PACKAGE_PYGAME is not set
BR2_PACKAGE_SDL=y
#
diff --git a/buildroot/package/armadeus-testsuite/armadeus-tests.mk b/buildroot/package/armadeus-testsuite/armadeus-tests.mk
index 0ddb3f9..4f2c3d1 100644
--- a/buildroot/package/armadeus-testsuite/armadeus-tests.mk
+++ b/buildroot/package/armadeus-testsuite/armadeus-tests.mk
@@ -19,9 +19,7 @@ $(ARMADEUS-TESTSUITE_DIR)/.unpacked:
touch $@
$(ARMADEUS-TESTSUITE_TARGET_BINARY): $(ARMADEUS-TESTSUITE_DIR)/.unpacked
- mkdir -p $(ARMADEUS-TESTSUITE_TARGET_DIR)
- find $(ARMADEUS-TESTSUITE_DIR) -name "*.sh" -exec install -D {} $(ARMADEUS-TESTSUITE_TARGET_DIR) \;
- cp -r $(ARMADEUS-TESTSUITE_DIR)/data $(ARMADEUS-TESTSUITE_TARGET_DIR)/
+ $(ARMADEUS-TESTSUITE_SOURCE)/install.sh $(ARMADEUS-TESTSUITE_TARGET_DIR)
make -C $(ARMADEUS-TESTSUITE_WISHBONE_BUTTON_DIR) test
install -D $(ARMADEUS-TESTSUITE_WISHBONE_BUTTON_DIR)/testbutton $(ARMADEUS-TESTSUITE_TARGET_DIR)
touch $@
diff --git a/target/linux/modules/fpga/dev_tools/loader/apf27-fpga-loader.c b/target/linux/modules/fpga/dev_tools/loader/apf27-fpga-loader.c
index 41d31c6..6e8e2e6 100644
--- a/target/linux/modules/fpga/dev_tools/loader/apf27-fpga-loader.c
+++ b/target/linux/modules/fpga/dev_tools/loader/apf27-fpga-loader.c
@@ -184,9 +184,7 @@ int apf27_fpga_abort(void)
return 1;
}
-/* Note that these are pointers to code that is in Flash. They will be
- * relocated at runtime.
- * Spartan2 code is used to download our Spartan 3 :) code is compatible.
+/* Spartan2 code is used to download our Spartan 3: code is compatible.
* Just take care about the file size
*/
Xilinx_Spartan3_Slave_Parallel_fns fpga_fns = {
diff --git a/target/test/apf27devfull_adcdac_test.sh b/target/test/apf27devfull_adcdac_test.sh
index b92e1a0..e8e2fd1 100644
--- a/target/test/apf27devfull_adcdac_test.sh
+++ b/target/test/apf27devfull_adcdac_test.sh
@@ -21,57 +21,69 @@ test_ADCDAC()
show_test_banner "ADC DAC"
modprobe max1027
+ echo "You will need a special hardware to run this test"
+
setDAC A 614
setDAC B 820
- if [ "$?" == 0 ]; then
- let set=0x62; echo $set > /sys/bus/spi/devices/spi0.0/setup
- sleep 1
- let conv=0xb0; echo $conv > /sys/bus/spi/devices/spi0.0/conversion
- sleep 1
- result=`cat /sys/bus/spi/devices/spi0.0/in0_input`
+ if [ "$?" != 0 ]; then
+ exit_failed
+ fi
+
+ let set=0x62; echo $set > /sys/bus/spi/devices/spi0.0/setup
+ sleep 1
+ let conv=0xb0; echo $conv > /sys/bus/spi/devices/spi0.0/conversion
+ sleep 1
+
+ result=`cat /sys/bus/spi/devices/spi0.0/in0_input`
if [ "$result" -gt 1080 ] && [ "$result" -lt 1320 ]; then
echo "AIN0: ok"
else
echo "AIN0: $result"
fi
- result=`cat /sys/bus/spi/devices/spi0.0/in1_input`
+
+ result=`cat /sys/bus/spi/devices/spi0.0/in1_input`
if [ "$result" -gt 650 ] && [ "$result" -lt 790 ]; then
echo "AIN1: ok"
else
echo "AIN1: $result"
fi
- result=`cat /sys/bus/spi/devices/spi0.0/in2_input`
+
+ result=`cat /sys/bus/spi/devices/spi0.0/in2_input`
if [ "$result" -gt 1300 ] && [ "$result" -lt 1580 ]; then
echo "AIN2: ok"
else
echo "AIN2: $result"
fi
- result=`cat /sys/bus/spi/devices/spi0.0/in3_input`
+
+ result=`cat /sys/bus/spi/devices/spi0.0/in3_input`
if [ "$result" -gt 860 ] && [ "$result" -lt 1060 ]; then
echo "AIN3: ok"
else
echo "AIN3: $result"
fi
- result=`cat /sys/bus/spi/devices/spi0.0/in4_input`
+
+ result=`cat /sys/bus/spi/devices/spi0.0/in4_input`
if [ "$result" -gt 1080 ] && [ "$result" -lt 1320 ]; then
echo "AIN4: ok"
else
echo "AIN4: $result"
fi
- result=`cat /sys/bus/spi/devices/spi0.0/in5_input`
+
+ result=`cat /sys/bus/spi/devices/spi0.0/in5_input`
if [ "$result" -gt 1730 ] && [ "$result" -lt 2110 ]; then
echo "AIN5: ok"
else
echo "AIN5: $result"
fi
- result=`cat /sys/bus/spi/devices/spi0.0/in6_input`
+
+ result=`cat /sys/bus/spi/devices/spi0.0/in6_input`
if [ "$result" -gt 1080 ] && [ "$result" -lt 1320 ]; then
echo "AIN6: ok"
else
echo "AIN6: $result"
fi
- fi
}
test_ADCDAC
+
diff --git a/target/test/data/images/armadeus_systems_480x272.png b/target/test/data/images/armadeus_systems_480x272.png
new file mode 100644
index 0000000..f3da339
Binary files /dev/null and b/target/test/data/images/armadeus_systems_480x272.png differ
diff --git a/target/test/dhcp.sh b/target/test/dhcp.sh
new file mode 100755
index 0000000..83f2a07
--- /dev/null
+++ b/target/test/dhcp.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+udhcpc -q -i eth0 --now
+
diff --git a/target/test/install.sh b/target/test/install.sh
new file mode 100755
index 0000000..562aa57
--- /dev/null
+++ b/target/test/install.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+if [ "$1" == "" ]; then
+ echo "Please provides the directory where to install the Test Suite"
+ echo "$0 dest_dir"
+ exit 1
+fi
+
+THIS_DIR=`dirname $0`
+TESTSUITE_TARGET_DIR="$1"
+echo "Installing Test Suite in $TESTSUITE_TARGET_DIR (from $THIS_DIR)"
+
+mkdir -p $TESTSUITE_TARGET_DIR
+mkdir -p $TESTSUITE_TARGET_DIR/packages
+mkdir -p $TESTSUITE_TARGET_DIR/data/fpga
+mkdir -p $TESTSUITE_TARGET_DIR/data/images
+#
+install $THIS_DIR/test_*.sh $TESTSUITE_TARGET_DIR/
+install $THIS_DIR/dhcp.sh $TESTSUITE_TARGET_DIR/
+install $THIS_DIR/mmc/*.sh $TESTSUITE_TARGET_DIR/
+# find $(ARMADEUS-TESTSUITE_DIR) -name "*.sh" -exec install -D {} $(ARMADEUS-TESTSUITE_TARGET_DIR) \;
+cp -d $THIS_DIR/packages/*.sh $TESTSUITE_TARGET_DIR/packages
+#
+cp $THIS_DIR/data/fpga/* $TESTSUITE_TARGET_DIR/data/fpga/
+cp $THIS_DIR/data/images/* $TESTSUITE_TARGET_DIR/data/images/
+
+exit 0
diff --git a/target/test/mmc/mmc_perf.sh b/target/test/mmc/mmc_perf.sh
index fdf06a0..fc1cc38 100755
--- a/target/test/mmc/mmc_perf.sh
+++ b/target/test/mmc/mmc_perf.sh
@@ -20,12 +20,14 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
+source ./test_helpers.sh
+
# Script parameters
MMC_MOUNT_DIR="/media/mmc"
MMC_DEVICE="/dev/mmcblk0p1"
TEMP_DIR="/tmp/perf_mmc/"
TEMP_FILE="/tmp/data.bin"
-TEMP_FILE_SIZE=4096 # kbytes
+TEMP_FILE_SIZE=16384 # kbytes
WRITE_BENCH="/tmp/test_mmc.sh"
WTIME=0
@@ -34,9 +36,9 @@ RTIME=0
debug()
{
- if [ "$DEBUG" == "True" ]; then
- echo $1
- fi
+ if [ "$DEBUG" == "True" ]; then
+ echo $1
+ fi
}
get_time_in_ms_from_file()
@@ -62,12 +64,10 @@ get_time_in_ms_from_file()
test_speed()
{
- # Create temp bench file
- echo "Creating temp bench file"
- if [ ! -f "$TEMP_FILE" ]; then
- dd if=/dev/urandom of=/tmp/data.bin bs=1024 count=$TEMP_FILE_SIZE
- fi
- # Create bench script
+ # Create temp bench file
+ create_random_file $TEMP_FILE $TEMP_FILE_SIZE
+
+ # Create write bench script
echo "mv $TEMP_FILE $MMC_MOUNT_DIR" > $WRITE_BENCH
echo "sync" >> $WRITE_BENCH
echo "exit 0" >> $WRITE_BENCH
@@ -85,46 +85,79 @@ test_speed()
WTOTIME=$WTIME
else
WTOTIME=`expr $WTIME + $WTOTIME`
- WTOTIME=`expr $WTOTIME / 2`
fi
- debug "Mean write time: $WTOTIME ms"
+ debug "Total write time: $WTOTIME ms"
# Update reading mean time
get_time_in_ms_from_file /tmp/readtime
if [ $it == "1" ]; then
RTOTIME=$RTIME
else
RTOTIME=`expr $RTIME + $RTOTIME`
- RTOTIME=`expr $RTOTIME / 2`
fi
- debug "Mean reading time: $RTOTIME ms"
+ debug "Total read time: $RTOTIME ms"
done
- WSPEED=`expr $TEMP_FILE_SIZE \* 1000 / $WTOTIME`
- RSPEED=`expr $TEMP_FILE_SIZE \* 1000 / $RTOTIME`
- echo "--- Test result (mean values): read -> $RSPEED kBytes/sec write -> $WSPEED kBytes/sec"
+
+ WTOTIME=`expr $WTOTIME / $it`
+ RTOTIME=`expr $RTOTIME / $it`
+ WSPEED=`expr $TEMP_FILE_SIZE \* 1000 / $WTOTIME`
+ RSPEED=`expr $TEMP_FILE_SIZE \* 1000 / $RTOTIME`
+ echo "--- Test result (mean values): read -> $RSPEED kBytes/sec write -> $WSPEED kBytes/sec"
}
-# Check some prerequisites
+usage()
+{
+ echo -e "\n Usage: $0 <speed|integrity> [device]\n"
+ echo "device: default to $MMC_DEVICE"
+ exit 1
+}
+
+#
+# Main
+#
+
+# Check some pre-requisites
if [ ! -d $MMC_MOUNT_DIR ]; then
- echo "Check that $MMC_MOUNT_DIR directory is existing"
- exit 1
+ echo "Check that $MMC_MOUNT_DIR directory is existing"
+ exit 1
fi
-IS_MOUNTED=`mount | grep -c $MMC_MOUNT_DIR`
-if [ "$IS_MOUNTED" != "1" ]; then
- echo "Check that your MMC is mounted on $MMC_MOUNT_DIR"
- exit 1
+# Process parameters
+if [ "$#" == 0 ]; then
+ usage
+elif [ "$1" != "speed" ] && [ "$1" != "integrity" ]; then
+ usage
fi
-# Process parameters
-if [ $# == 0 ]; then
- echo -e "\n Usage: $0 [speed|integrity] \n"
- exit 1
+if [ "$2" != "" ]; then
+ MMC_DEVICE="$2"
+fi
+
+if [ ! -b $MMC_DEVICE ]; then
+ echo -n "Please insert your MMC/SD/microSD/USB key"
+ it=0
+ while [ ! -b $MMC_DEVICE ] && [ $it -le 20 ]; do
+ it=$((it+1))
+ sleep 2
+ echo -n "."
+ done
+fi
+
+# If not mounted, mount it:
+IS_MOUNTED=`mount | grep -c $MMC_MOUNT_DIR`
+if [ "$IS_MOUNTED" != "1" ]; then
+ mount $MMC_DEVICE $MMC_MOUNT_DIR
+ if [ "$?" != 0 ]; then
+ echo "Failed to mount device $MMC_DEVICE"
+ exit 1
+ fi
fi
+# Here we go:
if [ "$1" == "speed" ]; then
- test_speed
- exit 0
+ test_speed
+ exit 0
fi
+# or integrity test:
SIZE=`df -hm | grep /media/mmc | awk '{$1=$1;print}' | cut -d " " -f 4`
@@ -141,7 +174,7 @@ md5sum $FILE > $MD5
while [ $it -le $SIZE ]; do
FILEMMC=$MMC_MOUNT_DIR/test_$it.rnd
# MD5=$TEMP_DIR/test_$it.rnd.md5
- echo -en "\r Creating: $FILEMMC"
+ echo -en "\r Copying: $FILEMMC"
it=$((it+1))
cp $FILE $FILEMMC
sync
@@ -166,7 +199,8 @@ for file in $FILES; do
done
echo
date
-echo "MMC perf test successful !"
+echo "Integrity test successful !"
+
rm -rf $TEMP_DIR
rm $MMC_MOUNT_DIR/*.rnd
diff --git a/target/test/packages/test_boa.sh b/target/test/packages/test_boa.sh
index ba1902f..4f8cd80 100755
--- a/target/test/packages/test_boa.sh
+++ b/target/test/packages/test_boa.sh
@@ -61,7 +61,7 @@ test_boa()
echo "Now you can access to http://"$IP"/index.html from your web browser"
sleep 8
if [ "$?" == 0 ]; then
- ask_user "Did you manage to show the web page ? If OK say y"
+ ask_user "Did you manage to show the web page ? (y/N)"
if [ "$response" == "y" ]; then
echo_test_ok
test_cleanup
diff --git a/target/test/packages/test_imxregs.sh b/target/test/packages/test_links.sh
similarity index 55%
copy from target/test/packages/test_imxregs.sh
copy to target/test/packages/test_links.sh
index b60cf34..9483997 100755
--- a/target/test/packages/test_imxregs.sh
+++ b/target/test/packages/test_links.sh
@@ -14,35 +14,34 @@
source ./test_helpers.sh
source ./test_env.sh
-#DEBUG=True
-EXEC_NAME="imxregs"
+EXEC_NAME="links"
+WEB_SITE="www.armadeus.org"
-test_imxregs()
+test_links()
{
- show_test_banner "imxregs"
+ show_test_banner "links (textual Web Browser)"
+
is_package_installed $EXEC_NAME
- APF=`cat /etc/machine`
- echo -n "Running on an "
- if [ "$APF" == "APF27" ]; then
- ID_REG="CID"
- ID_VAL="0x2882101d"
- else
- ID_REG="SIDR"
- ID_VAL="0x00d4c01d"
+ if [ "$?" != 0 ]; then
+ exit_failed
fi
- echo "$APF"
- $EXEC_NAME $ID_REG
+
+ ask_user "After having press ENTER, the Armadeus Project website will be opened in textual mode.\n Then, to quit press ESC and File->Exit"
+
+ # Launch it
+ $EXEC_NAME $WEB_SITE
+
if [ "$?" == 0 ]; then
- CHIP_ID=`$EXEC_NAME $ID_REG | grep $ID_REG | sed 's/^.*0x/0x/' | cut -d " " -f 1`
- echo "Chip ID: $CHIP_ID"
- if [ "$CHIP_ID" == $ID_VAL ]; then
+ ask_user "Was website displayed ? (y/N)"
+ if [ "$response" == "y" ] || [ "$response" == "yes" ]; then
echo_test_ok
exit 0
fi
fi
+
exit_failed
}
-test_imxregs
+test_links
diff --git a/target/test/packages/test_madplay.sh b/target/test/packages/test_madplay.sh
index 0b7eac0..e8c1c00 100755
--- a/target/test/packages/test_madplay.sh
+++ b/target/test/packages/test_madplay.sh
@@ -14,8 +14,11 @@
source ./test_helpers.sh
source ./test_env.sh
+# Validates: madplay
+# Requires: ALSA & Internet access
#DEBUG=True
EXEC_NAME="madplay"
+FILE_WEB_ADDRESS="http://www.armadeus.com//assos_downloads/misc/mozart.mp3"
MUSIC_FILE_NAME="$TEMP_DIR/mozart.mp3"
test_madplay()
@@ -24,25 +27,33 @@ test_madplay()
is_package_installed $EXEC_NAME
- if [ "$?" == 0 ]; then
+ if [ "$?" != 0 ]; then
+ exit_failed
+ fi
+
+ if [ ! -f "$MUSIC_FILE_NAME" ]; then
# Get music
echo "Downloading file from Internet"
# Suppose that network was correctly set before
- wget http://dl.free.fr/orrXngocU -O $MUSIC_FILE_NAME
- # Launch it
- $EXEC_NAME $MUSIC_FILE_NAME &
- PID=$!
- if [ "$?" == 0 ]; then
- sleep 10
- ask_user "Was music correctly played ? If OK say y"
- if [ "$response" == "y" ]; then
- echo_test_ok
- exit 0
- fi
- kill $PID
+ wget $FILE_WEB_ADDRESS -O $MUSIC_FILE_NAME
+ if [ "$?" != 0 ]; then
+ exit_failed
+ fi
+ fi
+
+ # Launch it
+ $EXEC_NAME $MUSIC_FILE_NAME &
+ PID=$!
+ if [ "$?" == 0 ]; then
+ sleep 10
+ ask_user "Was music correctly played ? (y/N)"
+ if [ "$response" == "y" ] || [ "$response" == "yes" ]; then
+ echo_test_ok
+ exit 0
fi
+ kill $PID
fi
- rm -f "$MUSIC_FILE_NAME"
+
exit_failed
}
diff --git a/target/test/packages/test_mplayer.sh b/target/test/packages/test_mplayer.sh
index e51541c..5ca110a 100755
--- a/target/test/packages/test_mplayer.sh
+++ b/target/test/packages/test_mplayer.sh
@@ -14,8 +14,11 @@
source ./test_helpers.sh
source ./test_env.sh
+# Requires: Framebuffer & Internet access
+# Validates: mplayer
#DEBUG=True
EXEC_NAME="mplayer"
+FILE_WEB_ADDRESS="http://www.armadeus.com//assos_downloads/misc/apf27.mpg"
VIDEO_FILE_NAME="$TEMP_DIR/apf27.mpg"
test_mplayer()
@@ -24,27 +27,37 @@ test_mplayer()
is_package_installed $EXEC_NAME
- if [ "$?" == 0 ]; then
- wake_up_lcd
- # Stop blinking cursor
- echo 0 > /sys/class/graphics/fbcon/cursor_blink
- # Get video
+ if [ "$?" != 0 ]; then
+ exit_failed
+ fi
+
+ wake_up_lcd
+ # Stop blinking cursor
+ echo 0 > /sys/class/graphics/fbcon/cursor_blink
+
+ if [ ! -f $VIDEO_FILE_NAME ]; then
+ # Get video (suppose that network was correctly set before)
echo "Downloading file from Internet"
- # Suppose that network was correctly set before
- wget http://dl.free.fr/oBjrVd6n8 -O $VIDEO_FILE_NAME
- # Launch it
- $EXEC_NAME -nosound -fs $VIDEO_FILE_NAME
- if [ "$?" == 0 ]; then
- ask_user "Was video correctly displayed ? If OK say y"
- if [ "$response" == "y" ]; then
- echo_test_ok
- exit 0
- fi
- fi
+ wget $FILE_WEB_ADDRESS -O $VIDEO_FILE_NAME
+ if [ "$?" != 0 ]; then
+ exit_failed
+ fi
fi
+
+ # Launch it
+ $EXEC_NAME -vo fbdev -nosound -fs $VIDEO_FILE_NAME
+ RES=$?
# Make cursor blink again
echo 1 > /sys/class/graphics/fbcon/cursor_blink
- rm -f "$VIDEO_FILE_NAME"
+
+ if [ "$RES" == 0 ]; then
+ ask_user "Was video correctly displayed ? (y/N)"
+ if [ "$response" == "y" ] || [ "$response" == "yes" ]; then
+ echo_test_ok
+ exit 0
+ fi
+ fi
+
exit_failed
}
diff --git a/target/test/packages/test_imxregs.sh b/target/test/packages/test_nano.sh
similarity index 52%
copy from target/test/packages/test_imxregs.sh
copy to target/test/packages/test_nano.sh
index b60cf34..b667277 100755
--- a/target/test/packages/test_imxregs.sh
+++ b/target/test/packages/test_nano.sh
@@ -14,35 +14,38 @@
source ./test_helpers.sh
source ./test_env.sh
-#DEBUG=True
-EXEC_NAME="imxregs"
+# Validates: nano and ncurses
+EXEC_NAME="nano"
+TEST_FILE=/tmp/nano.txt
-test_imxregs()
+test_nano()
{
- show_test_banner "imxregs"
+ show_test_banner "nano (Text Editor)"
+
is_package_installed $EXEC_NAME
- APF=`cat /etc/machine`
- echo -n "Running on an "
- if [ "$APF" == "APF27" ]; then
- ID_REG="CID"
- ID_VAL="0x2882101d"
- else
- ID_REG="SIDR"
- ID_VAL="0x00d4c01d"
+ if [ "$?" != 0 ]; then
+ exit_failed
fi
- echo "$APF"
- $EXEC_NAME $ID_REG
+
+ ask_user "After having press ENTER, nano will be launched.\n Write a small text in it, then press Ctrl+O to save and Ctrl+X to quit"
+
+ # Launch it
+ $EXEC_NAME $TEST_FILE
+
if [ "$?" == 0 ]; then
- CHIP_ID=`$EXEC_NAME $ID_REG | grep $ID_REG | sed 's/^.*0x/0x/' | cut -d " " -f 1`
- echo "Chip ID: $CHIP_ID"
- if [ "$CHIP_ID" == $ID_VAL ]; then
+ clear
+ cat $TEST_FILE
+ echo
+ ask_user "Is it the text you typed ? (y/N)"
+ if [ "$response" == "y" ] || [ "$response" == "yes" ]; then
echo_test_ok
exit 0
fi
fi
+
exit_failed
}
-test_imxregs
+test_nano
diff --git a/target/test/packages/test_prboom.sh b/target/test/packages/test_prboom.sh
new file mode 100755
index 0000000..5e5f75b
--- /dev/null
+++ b/target/test/packages/test_prboom.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+#
+# Script to test a Buildroot package for Armadeus Software release
+#
+# Copyright (C) 2008 The Armadeus Project
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+
+source ./test_helpers.sh
+source ./test_env.sh
+
+# Validates: prboom & SDL_net & SDL_mixer
+# Requires: SDL & ALSA OSS emulation
+EXEC_NAME="/usr/games/prboom"
+EXEC_OPTIONS="-width 320 -height 240 &"
+
+test_prboom()
+{
+ show_test_banner "PrBoom (SDL port of Doom)"
+
+ is_package_installed $EXEC_NAME
+
+ if [ "$?" != 0 ]; then
+ exit_failed
+ fi
+
+ # Launch it
+ ask_user "After having press ENTER, PrBoom will be launched. Press Ctrl+C at any time to stop."
+ modprobe snd-pcm-oss
+ modprobe snd-mixer-oss
+ $EXEC_NAME $EXEC_OPTIONS
+
+ ask_user "Did you have good time ;-) ? (y/N)"
+ if [ "$response" == "y" ] || [ "$response" == "yes" ]; then
+ echo_test_ok
+ exit 0
+ fi
+
+ exit_failed
+}
+
+test_prboom
+
diff --git a/target/test/packages/test_python.sh b/target/test/packages/test_python.sh
index 067fc00..e30cbb5 100755
--- a/target/test/packages/test_python.sh
+++ b/target/test/packages/test_python.sh
@@ -23,8 +23,8 @@ generate_test_file()
cat << EOF > $PYTHON_FILE
import sys
- print "If you read this then Python is running"
- sys.exit(0)
+print "If you read this then Python is running"
+sys.exit(0)
EOF
}
diff --git a/target/test/packages/test_sdl.sh b/target/test/packages/test_sdl.sh
index 365a96d..9828c50 100755
--- a/target/test/packages/test_sdl.sh
+++ b/target/test/packages/test_sdl.sh
@@ -30,19 +30,19 @@ test_sdlwater()
if [ "$?" == 0 ]; then
wake_up_lcd
- # Launch it
+ # Launch it (needs touchscreen driver to be launched before)
export SDL_MOUSEDRV=TSLIB
export SDL_MOUSEDEV=$TSLIB_TSDEVICE
$EXEC_NAME /usr/share/images/water320.bmp 1>/dev/null &
- echo "Touch the LCD screen please"
+ echo "Please touch the LCD screen"
sleep 5
- ask_user "Did you manage to draw water circles ? If OK say y"
- if [ "$response" == "y" ]; then
+ ask_user "Did you manage to draw water circles ? (y/N)"
+ if [ "$response" == "y" ] || [ "$response" == "yes" ]; then
echo_test_ok
test_cleanup
exit 0
fi
- test_cleanup
+ test_cleanup
fi
exit_failed
diff --git a/target/test/packages/test_strace.sh b/target/test/packages/test_slideshow.sh
similarity index 58%
copy from target/test/packages/test_strace.sh
copy to target/test/packages/test_slideshow.sh
index 1137303..710a7c0 100755
--- a/target/test/packages/test_strace.sh
+++ b/target/test/packages/test_slideshow.sh
@@ -14,26 +14,34 @@
source ./test_helpers.sh
source ./test_env.sh
-#DEBUG=True
-EXEC_NAME="strace"
+# Requires: test_sdl.sh
+# Validates: libpng & slideshow
+EXEC_NAME="slideshow"
+TEST_FILE="../data/images/"
-
-test_strace()
+test_slideshow()
{
- show_test_banner "strace"
+ show_test_banner "slideshow"
is_package_installed $EXEC_NAME
+ if [ "$?" != 0 ]; then
+ exit_failed
+ fi
+
+ # Launch it
+ $EXEC_NAME -width 480 -height 272 -name $TEST_DIR
+
if [ "$?" == 0 ]; then
- # Launch it
- $EXEC_NAME echo "HELLO !!"
- if [ "$?" == 0 ]; then
+ ask_user "Did you see an image ? (y/N)"
+ if [ "$response" == "y" ] || [ "$response" == "yes" ]; then
echo_test_ok
exit 0
fi
fi
+
exit_failed
}
-test_strace
+test_slideshow
diff --git a/target/test/packages/test_strace.sh b/target/test/packages/test_tcpdump.sh
similarity index 57%
copy from target/test/packages/test_strace.sh
copy to target/test/packages/test_tcpdump.sh
index 1137303..37a80c7 100755
--- a/target/test/packages/test_strace.sh
+++ b/target/test/packages/test_tcpdump.sh
@@ -14,26 +14,35 @@
source ./test_helpers.sh
source ./test_env.sh
-#DEBUG=True
-EXEC_NAME="strace"
+# Validates: tcpdump & libpcap
+EXEC_NAME="tcpdump"
+EXEC_OPTIONS="-i eth0 -x -v -c 3"
-
-test_strace()
+test_tcpdump()
{
- show_test_banner "strace"
+ show_test_banner "tcpdump"
is_package_installed $EXEC_NAME
+ if [ "$?" != 0 ]; then
+ exit_failed
+ fi
+
+ ask_user "After having press ENTER, tcpdump will be launched."
+
+ # Launch it
+ $EXEC_NAME $EXEC_OPTIONS
+
if [ "$?" == 0 ]; then
- # Launch it
- $EXEC_NAME echo "HELLO !!"
- if [ "$?" == 0 ]; then
+ ask_user "Did you see the packets dump ? (y/N)"
+ if [ "$response" == "y" ] || [ "$response" == "yes" ]; then
echo_test_ok
exit 0
fi
fi
+
exit_failed
}
-test_strace
+test_tcpdump
diff --git a/target/test/test_dac.sh b/target/test/test_dac.sh
index d7c12e5..fac0370 100755
--- a/target/test/test_dac.sh
+++ b/target/test/test_dac.sh
@@ -19,7 +19,7 @@ test_DAC()
{
show_test_banner "DAC"
- echo "This test is more probant with vumeters"
+ ask_user "This test is more probant with vumeters. Press ENTER."
setDAC AB 500
if [ "$?" == 0 ]; then
@@ -32,3 +32,4 @@ test_DAC()
}
test_DAC
+
diff --git a/target/test/test_ethernet.sh b/target/test/test_ethernet.sh
index a2d69e6..76d65cb 100755
--- a/target/test/test_ethernet.sh
+++ b/target/test/test_ethernet.sh
@@ -19,19 +19,26 @@ WTIME=0
RTIME=0
#DEBUG=True
+signal_handler()
+{
+ echo "Signal trapped !"
+ rm -f $TEMP_FILE
+ exit 1
+}
+
# $1 = nb of test iterations
test_ethernet()
{
show_test_banner "Ethernet"
+ trap signal_handler INT
+
# Check if interface is up
ifconfig eth0
if [ "$?" != 0 ]; then
echo "No Ethernet interface found"
exit_failed
fi
- # To autoconfigure Internet access
- udhcpc -q -i eth0
# Check if Host is alive
ping -c 5 -W 2 $SERVER_IP
diff --git a/target/test/test_framebuffer.sh b/target/test/test_framebuffer.sh
index 78d8b81..f0a131c 100755
--- a/target/test/test_framebuffer.sh
+++ b/target/test/test_framebuffer.sh
@@ -31,11 +31,11 @@ test_framebuffer()
echo 1 > /sys/class/graphics/fbcon/cursor_blink
# Ask user for feedbacks
if [ "$RES" == 0 ]; then
- ask_user "Did all the tests show fine ? If OK say y"
- if [ "$response" == "y" ]; then
- echo_test_ok
- exit 0
- fi
+ ask_user "Did all the tests show fine ? (y/N)"
+ if [ "$response" == "y" ] || [ "$response" == "yes" ]; then
+ echo_test_ok
+ exit 0
+ fi
fi
exit_failed
}
diff --git a/target/test/test_gpio.sh b/target/test/test_gpio.sh
index 9fd12cb..9156ed3 100755
--- a/target/test/test_gpio.sh
+++ b/target/test/test_gpio.sh
@@ -80,7 +80,7 @@ check_button_apf27()
setbit /proc/driver/gpio/portFdir 13 0
setbit /proc/driver/gpio/portFirq 13 1
echo "Press 2 times on S1 button"
- /usr/bin/testbutton /dev/gpio/PF13 3
+ /usr/bin/testsuite/testbutton /dev/gpio/PF13 3
if [ "$?" != 0 ]; then
exit_failed
fi
@@ -88,7 +88,7 @@ check_button_apf27()
check_button_apf9328()
{
- # TBDL
+ echo "TBDL"
}
@@ -102,10 +102,11 @@ test_led_gpio()
exit_failed
fi
+ ask_user "I will now blink a LED on your board. Press ENTER to continue"
execute_for_target blink_led_apf9328 blink_led_apf27
- ask_user "Did you see "$LED_NAME" LED blinking ? (y/n)"
- if [ "$response" != "y" ]; then
+ ask_user "Did you see "$LED_NAME" LED blinking ? (y/N)"
+ if [ "$response" != "y" ] && [ "$response" != "yes" ]; then
exit_failed
fi
diff --git a/target/test/test_helpers.sh b/target/test/test_helpers.sh
index c5133e5..8d5e8bd 100644
--- a/target/test/test_helpers.sh
+++ b/target/test/test_helpers.sh
@@ -108,3 +108,30 @@ execute_for_target()
$2
fi
}
+
+# $1: name of the file in $TEMP_DIR
+# $2: size of the file
+create_random_file()
+{
+ if [ "$1" == "" ] || [ "$2" == "" ]; then
+ echo "create_random_file(): missing parameter"
+ return 1
+ fi
+ RANDOM_FILE="$1"
+ FILE_SIZE="$2"
+ # Create temp bench file
+ echo -e "\nCreating a temporary bench file ($TEMP_FILE) of $TEMP_FILE_SIZE KBytes"
+ if [ ! -f "$RANDOM_FILE" ]; then
+ dd if=/dev/urandom of=$RANDOM_FILE bs=1024 count=$FILE_SIZE 2>/dev/null & pid=$!
+ # Show a kind of progress bar
+ echo -en "[ ]\r["
+ while [ $? == 0 ]; do
+ echo -n "."
+ sleep 1
+ kill -USR1 $pid 2>/dev/null
+ done
+ echo
+ fi
+ echo " -> done"
+}
+
diff --git a/target/test/test_release.sh b/target/test/test_release.sh
index 75cd8c9..558af20 100755
--- a/target/test/test_release.sh
+++ b/target/test/test_release.sh
@@ -20,28 +20,62 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
-source ./test_env.sh
+THIS_DIR=`dirname $0`
+source $THIS_DIR/test_env.sh
+source $THIS_DIR/test_helpers.sh
mkdir -p $TEMP_DIR
date
-./test_ethernet.sh
+show_test_banner "All supported drivers/packages"
+echo "Your test environments variables are:"
+echo " - temporary directory: $TEMP_DIR"
+echo " - Host IP: $SERVER_IP"
+ask_user "Please confirm that these variables are correct (y/N)"
+if [ "$response" != "y" ] && [ "$response" != "yes" ]; then
+ echo "Please update $THIS_DIR/test_env.sh"
+ exit 1
+fi
+
+# Here we go ! (First start with Linux)
+$THIS_DIR/test_ethernet.sh
+echo
+$THIS_DIR/test_usb_host.sh
+echo
+$THIS_DIR/test_rs232.sh
+echo
+$THIS_DIR/test_usb_device.sh
echo
-./test_usb_host.sh
+$THIS_DIR/test_backlight.sh
echo
-./test_rs232.sh 1
+$THIS_DIR/test_framebuffer.sh
echo
-./test_usb_device.sh
+$THIS_DIR/test_touchscreen.sh
echo
-./test_backlight.sh
+$THIS_DIR/test_dac.sh
echo
-./test_touchscreen.sh
+$THIS_DIR/test_adc.sh
echo
-./test_dac.sh
+$THIS_DIR/test_sound.sh
echo
-./test_imxregs.sh
+$THIS_DIR/test_fpga.sh
echo
-./test_sound.sh
+$THIS_DIR/test_gpio.sh
echo
+$THIS_DIR/mmc_perf.sh speed
+# Following tests needs Internet access:
+ask_user "I will now try to configure Internet access. Press ENTER when ready"
+$THIS_DIR/dhcp.sh
+echo
+$THIS_DIR/test_rtc.sh
+
+# Then check packages:
+PACKAGES_TESTS=`ls $THIS_DIR/packages/*.sh`
+for package_test in $PACKAGES_TESTS; do
+ if [ -x $package_test ] && [ ! -L $package_test ]; then
+ $package_test
+ fi
+done
exit 0
+
diff --git a/target/test/test_rs232.sh b/target/test/test_rs232.sh
index 79a7f7b..84e887b 100755
--- a/target/test/test_rs232.sh
+++ b/target/test/test_rs232.sh
@@ -71,11 +71,13 @@ echo_apf27_ports()
echo " Available one: [ 2 ]"
}
+PORT="$1"
if [ "$1" == "" ]; then
echo "Please give the port number to test !"
execute_for_target echo_apf9328_ports echo_apf27_ports
- exit 1
+ read PORT
+ [ "$PORT" == "" ] && exit_failed
fi
-test_serial_port $1
+test_serial_port $PORT
diff --git a/target/test/test_rtc.sh b/target/test/test_rtc.sh
index b45e272..ddda363 100755
--- a/target/test/test_rtc.sh
+++ b/target/test/test_rtc.sh
@@ -33,6 +33,7 @@ test_rtc()
{
show_test_banner "RTC"
+ echo "Trying to get current time with NTP"
ntpdate 217.147.208.1
date
if [ "$?" == 0 ]; then
@@ -46,6 +47,7 @@ test_rtc()
AFTER=`convert_in_secs $DATE`
DIFF=$(($AFTER - $BEFORE - $TEST_DURATION))
+ date
if [ "$DIFF" -gt "$TOLERANCE" ]; then
echo "$AFTER $BEFORE ($DIFF)"
exit_failed
diff --git a/target/test/test_sound.sh b/target/test/test_sound.sh
index 09bc6ef..7fdf7d5 100755
--- a/target/test/test_sound.sh
+++ b/target/test/test_sound.sh
@@ -31,13 +31,15 @@ test_sound()
exit_failed
fi
+ ask_user "Please connect a earphone to the Audio Out connector (up on APF27). Then press ENTER."
aplay /usr/share/sounds/alsa/Side_Left.wav
if [ "$?" == 0 ]; then
- ask_user "Did you hear something ? (y/n)"
- if [ "$response" == "y" ]; then
+ ask_user "Did you hear something ? (y/N)"
+ if [ "$response" == "y" ] || [ "$response" == "yes" ]; then
echo_test_ok
fi
fi
}
test_sound
+
diff --git a/target/test/test_usb_host.sh b/target/test/test_usb_host.sh
index d5cd9fe..7618623 100755
--- a/target/test/test_usb_host.sh
+++ b/target/test/test_usb_host.sh
@@ -25,6 +25,39 @@ load_usb_host_driver_apf9328()
fi
}
+wait_key_insertion()
+{
+ echo "Please insert a USB key in $1 USB Host connector (nothing will be erased)"
+ it=0
+ while [ ! -b /dev/sda1 ] && [ $it -le 20 ]; do
+ it=$((it+1))
+ sleep 2
+ echo -n "."
+ done
+}
+
+wait_key_removal()
+{
+ echo "Please remove your USB key"
+ it=0
+ while [ -b /dev/sda1 ] && [ $it -le 20 ]; do
+ it=$((it+1))
+ sleep 2
+ echo -n "."
+ done
+ [ ! -b /dev/sda1 ] && echo "USB key removed"
+}
+
+check_usb_key()
+{
+ mount `ls /dev/sd*1` /mnt/mmc && ls /mnt/mmc/
+ df -h
+ umount /mnt/mmc
+ if [ "$?" != 0 ]; then
+ exit_failed
+ fi
+}
+
test_usb_host()
{
show_test_banner "USB Host"
@@ -36,21 +69,17 @@ test_usb_host()
exit_failed
fi
- echo "Please insert a USB key (nothing will be erased)"
- it=0
- false
- while [ "$?" != 0 ] && [ $it -le 20 ]; do
- it=$((it+1))
- sleep 2
- dmesg | tail | grep "Attached SCSI removable disk"
- done
+ wait_key_insertion "upper"
+ check_usb_key
- mount `ls /dev/sd*1` /mnt/mmc && ls /mnt/mmc/
- if [ "$?" == 0 ]; then
- df -h
- echo_test_ok
- fi
- umount /mnt/mmc
+ wait_key_removal
+
+ wait_key_insertion "lower"
+ check_usb_key
+
+ wait_key_removal
+
+ echo_test_ok
}
test_usb_host
diff --git a/target/test/test_watchdog.sh b/target/test/test_watchdog.sh
index 3293aea..92f5c38 100755
--- a/target/test/test_watchdog.sh
+++ b/target/test/test_watchdog.sh
@@ -21,8 +21,8 @@ test_watchdog()
{
show_test_banner "Watchdog"
- ask_user "This test will reboot your board. Continue ? (y/n)"
- if [ "$response" != "y" ]; then
+ ask_user "This test will reboot your board. Continue ? (y/N)"
+ if [ "$response" != "y" ] && [ "$response" != "yes" ]; then
exit_failed
fi
hooks/post-receive
--
armadeus
|
|
From: Julien B a. A. <ar...@us...> - 2009-11-25 11:17:27
|
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 4f93754994b1a9e5919b2857c3c7f1882b146169 (commit)
from d510c4d20931dbf2867aff1cba7ec1686c1de6aa (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 4f93754994b1a9e5919b2857c3c7f1882b146169
Author: Julien Boibessot <jul...@ar...>
Date: Wed Nov 25 12:16:58 2009 +0100
Updates Changelog and corresponding script
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 146 ++++++++++++++++++++++++++++++++++++++++++++++++++++
release/changes.sh | 32 ++++++++----
2 files changed, 167 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 249e472..c12378e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,152 @@ Changes since last release
----
+Changes in release 3.2 (November 30th 2009)
+
+* Buildroot:
+ - install using cp instead of install for zlib libraries
+ - ldd wasn't installed anymore in rootfs, correct that (Buildroot upstream patch)
+ - Use 2.6.29 kernel headers by default
+ - Makes libjpeg download works again
+ - Lets socketcan-clean target work
+ - Update APF9328 default configs
+ - Allows nano to be selectable again
+ - Adding as_devices in .config file
+ - Updates APF27 default Linux configs
+ - adding makefile for AsDevices library
+ - cleanup: makes ubifs patches generic
+ - update apf9328 default configuration
+ - NOR flash does not support UBIFS sub-pages
+ - use common JFFS2 and UBIFS mtd_utils. make UBIFS generic
+ - Bump proftp version 1.3.1 -> 1.3.2
+ - Add patch to have Tslib working with Pygame
+ - Move GPM into a patch that can be sent to buildroot team (when it will work ;-))
+ - removes 2.6.18 from possible kernels selection
+ - Bump default Armadeus Linux version from 2.6.29.4 to 2.6.29.6
+ - Corrects bad installation of python files
+ - Adds Pygame package
+ - Re-integrates Quake package as a patch
+ - Removes empty patches
+ - made ubinize generic at least for apf boards
+ - Uses Buildroot generated ubinize, not host installed one
+ - Updates APF27 default Linux configs (for Optrex TFT)
+ - Updates Linux 2.6.29 APF27 default configs
+ - BR2_TARGET_U_BOOT_CONFIG_BOARD was not correctly set
+ - Add Quake package (patch)
+ - make ubifs patch apply after update of git local view
+ - add ubinize script for apf27 in case of ubifs file system
+ - launch ubinize tool if ubifs selected
+ - xenomai: Makefile cleaned, xenomai version upgraded, and apf27 support added
+ - Updates bluez (non)selection due to automatic package detection...
+ - Adds Boa to APF9328 test config + moves Linux/uClibc/busybox respective BR2_xx variables to according places in config file
+ - Add preliminary work to build bluez
+ - Revert commit d6300def6c2f271ef4140da342604cb88be0dc30 + add default as_devices option in APF27 Buildroot config files
+ - update mtd-utils to support mkfs.ubifs and ubinize
+* Linux:
+ - Cleanup fpgaloader, check indentation while we are at it...
+ - Cleanup some wishbone_example Makefiles
+ - AD9889: makes it possible to rmmod the driver when no chip was detected. Check indentation while we are at it...
+ - Makes /sys/ (slow) mode of the max1027 more reliable + addstatistics entry
+ - fix ad9889 video output format bug
+ - fix vertical alignment bug (T51638D084)
+ - Sometimes TSC210x may need a reset before asking revision number
+ - Continue to better separate apf27.c and apf27-dev.c platform files
+ - Enhances APF27 Custom LCD source code presentation
+ - Reorganizes LCDs for APF27 and add a custom hackable LCD entry
+ - Moves LCD config/handling outside of apf27.c
+ - Removes compilation warning in apf9328 when max1027 is not selected
+ - (Re)activates mouse/keyboard/joystick support for apf27 on 2.6.29. Hum... strange that it gone away...
+ - Removes (very) old kernel patches as they are no more supported (2.6.12, 2.6.17, 2.6.18.1)
+ - Corrects bug in microSD removal detection
+ - Updates minors creation for APF27 in loadgpio.sh
+ - USE_APF27DEV_IMX_LED_FOR_PM & USE_APF27DEV_IMX_SWITCH_FOR_PM options are only availableon the APF27DEV
+ - Separates module and baseboard power management parts
+ - Improves Mode setting in GPIO driver
+ - Correct small bug in gpio ioctl handling on APF27 (thanks Luca)
+ - Don't initialize i.MX27 FEC GPIOs if not configured
+ - Add Optrex T51638D084 TFT support (APF27 & Freescale framebuffer)
+ - Removes bad comment in apf27.c
+ - Separates APF27 and APF27Dev hardware declaration parts
+ - Adds new timing trick to improve i.MXL SDHC controller robustness
+ - gpio: correct deadlock bug + add an IOCTL for setting port Mode
+ - Makes LQ057 LCD works on APF27 (Freescale framebuffer)
+ - Converts a message into debug in GPIO driver
+ - APF9328: separates module (APF9328) and baseboards (DevFull/Light or others) hardware declaration/init parts
+ - ISP1761: Gives correct init value to HW_MODE_REG register
+ - Makes ioctls work again in gpio driver
+ - Updates APF27 default Linux configs according to new LCD support
+ - On APF9328 configure console port without RTS/CTS
+ - [MAX1027] Scheduling bug corrected (to be reviewed)
+ - On APF9328 makes it possible to have UART without RTS/CTS support + configure console port accordingly
+ - Updates APF9328 default Linux configs according to new LCD support
+ - add GPS/GSM uart declaration to apf27.c
+ - add hitachi TX12D17VM1BDP TFT
+ - add LW700AT9003
+* U-Boot:
+ - cleanup apf27 config file
+ - update apf9328 default configuration
+* Firmware:
+* Demos:
+ - Add preliminary work for a graphical (kind of) oscilloscope using AsDevices library
+ - Updates input_test Makefile
+ - Cleanup fractal demo
+ - Updates music player doc
+ - Adds a small C program to show how to use IOCTL with GPIO driver
+ - xenomai examples: cleanup + indent checking + allows non RT kernel examples to be compiled for APF27
+* Debug:
+ - imxssi doesn't require libpow to compile
+* Test:
+ - Cleanup and factorize test_fpga
+ - Improves testbutton & gpio test
+ - Updates apf9328_test Linux config
+ - Simplify GPIO test
+ - Put serial port in raw mode during test
+* Tools:
+ - Simplify setDAC tool sources
+ - ad9889ctrl: Cleanup + indentation
+ - Cleanup setDAC
+ - Don't try to quiltify if current view doesn't compile
+ - Remove no more needed/obsolete Linux patch management tool
+ - Now quiltify tool can handle buildroot
+ - Corrects typos + windows format in boot recover tool
+ - Improve verbosity of quiltifying script
+ - fix tickets 43 and 64 concerning ubootrecover bugs
+* Other:
+ - Indentation... ;-)
+ - [as_devices] segfault fix on as_93lcxx_close()
+ - [as_devices] first version of as_spi compile
+ - [as_devices] as_93lcxx lib compile, not tested
+ - [as_devices] Adding spidev API
+ - [as_devices] Adding API for as_93lcxx memory functions
+ - [as_devices] python module in LGPL
+ - [AS_DEVICES] Indentation + bad comments
+ - [as_devices] AD5258 in progress
+ - [as_devices] gpio C++ wrapper compiling
+ - [as_devices] pwm and i2c C++ wrapper compiling ok
+ - [as_devices] changing multiton
+ - [as_devices] adding C libs for i2c (compile but not tested)
+ - [BUILD] Improves .gitignore
+ - [as_devices] begin buildroot integration of library
+ - [BUILD] Improve some .gitignore
+ - [AsDevices] python wrapper done for pwm
+ - [as_devices] Python wrapper added for pwm
+ - [as_devices] Little comment
+ - [as_device] Wrapper C++ validated for pwm (bis)
+ - [as_devices] as_apf27_pwm ok for c library, in dev for C++ wrapper
+ - [BUILD] Updates some .gitignore files
+ - [BUILD] Makes separate targets for buildroot sources loading, unpacking & patching
+ - [GIT] Adds top .gitignore file
+ - [GIT] Add some .gitignore files
+ - [ROOTFS] Add /etc/mtab (symlink to /proc/mounts)
+ - [BUILD] Add target to get BR patched sources only: buildroot-patched-sources + simplify buildauto
+ - [BUILD] Renames Buildroot patches and moves them to patches/buildroot/ (Part2)
+ - [BUILD] Renames Buildroot patches and moves them to patches/buildroot/
+ - [BUILD] Preliminary work before buildroot patches moving
+ - [TARGET] Add a directory (target/scripts/) to store useful system scripts that are not in the default rootfs skeleton
+ - [BUILD] Makes quilt script use git + some refinements
+
+----
+
Changes in release 3.1 (June 29th 2009, 10:00 (UTC+0200) - SVN revisions 1098 to 1381)
* Buildroot:
diff --git a/release/changes.sh b/release/changes.sh
index c2a6c1e..f97715e 100755
--- a/release/changes.sh
+++ b/release/changes.sh
@@ -11,29 +11,32 @@ CHANGES_FIRMWARE=$TEMP_DIR/firmware.log
CHANGES_TEST=$TEMP_DIR/test.log
CHANGES_DEMOS=$TEMP_DIR/demos.log
CHANGES_DEBUG=$TEMP_DIR/debug.log
+CHANGES_TOOLS=$TEMP_DIR/tools.log
CHANGES_OTHER=$TEMP_DIR/other.log
+LATEST_RELEASE_DATE="Wed Jul 1"
usage()
{
echo
- echo "$0 rev1 rev2: generates ChangeLog file for commit between rev1 and rev2 (included)"
+ echo "$0: generates ChangeLog file for commit since latest release"
echo
}
-if [ "$#" != 2 ]; then
+if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
usage
exit 1
fi
+# get log
mkdir -p $TEMP_DIR
-echo "Generating ChangeLog for revisions between $1 and $2 in" `pwd`
-
+echo "Generating ChangeLog for commit since $LATEST_RELEASE_DATE in" `pwd`
if [ ! -f $SVN_LOG ]; then
- svn log -r $2:$1 > $SVN_LOG
+ git log --since="$LATEST_RELEASE_DATE" --no-color --pretty=oneline > $SVN_LOG
fi
-# remove unneeded lines:
-cat $SVN_LOG | grep -v -e "-\{5,\}" | grep -v -e "^r[0-9]\{2,\}" > $SVN_LOG_CLEAN
+
+# remove commit hash number:
+cat $SVN_LOG | cut -c 42- > $SVN_LOG_CLEAN
# separate sections:
cat $SVN_LOG_CLEAN | grep -i "\[LINUX\]" > $CHANGES_LINUX
@@ -50,13 +53,16 @@ cat $LOG_CLEAN_TMP.5 | grep -i "\[DEMOS\]" > $CHANGES_DEMOS
cat $LOG_CLEAN_TMP.5 | grep -iv "\[DEMOS\]" > $LOG_CLEAN_TMP.6
cat $LOG_CLEAN_TMP.6 | grep -i "\[DEBUG\]" > $CHANGES_DEBUG
cat $LOG_CLEAN_TMP.6 | grep -iv "\[DEBUG\]" > $LOG_CLEAN_TMP.7
+cat $LOG_CLEAN_TMP.7 | grep -i "\[TOOLS\]" > $CHANGES_TOOLS
+cat $LOG_CLEAN_TMP.7 | grep -iv "\[TOOLS\]" > $LOG_CLEAN_TMP.8
-cat $LOG_CLEAN_TMP.7 > $CHANGES_OTHER
-
-# compose changelog with sections without empty lines:
+cat $LOG_CLEAN_TMP.8 > $CHANGES_OTHER
+# compose Changelog:
echo
-echo "Changes in release XXX ("`date`" - SVN revisions $1 to $2"
+echo "----"
+echo
+echo "Changes in release XXX ("`date`")"
echo
echo "* Buildroot:"
cat $CHANGES_BUILDROOT | grep -v "^$" | sed 's/\[[Bb][Uu][Ii][Ll][Dd][Rr][Oo][Oo][Tt]\]/ -/g'
@@ -72,9 +78,13 @@ echo "* Debug:"
cat $CHANGES_DEBUG | grep -v "^$" | sed 's/\[DEBUG\]/ -/g'
echo "* Test:"
cat $CHANGES_TEST | grep -v "^$" | sed 's/\[[Tt][Ee][Ss][Tt]\]/ -/g'
+echo "* Tools:"
+cat $CHANGES_TOOLS | grep -v "^$" | sed 's/\[[Tt][Oo][Oo][Ll][Ss]\]/ -/g'
echo "* Other:"
cat $CHANGES_OTHER | grep -v "^$"
+echo
+# remove temp stuff
rm -rf $TEMP_DIR
exit 0
hooks/post-receive
--
armadeus
|
|
From: jorasse <jo...@us...> - 2009-11-25 09:59:50
|
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 d510c4d20931dbf2867aff1cba7ec1686c1de6aa (commit)
via a347e046c993fdc4df93b7dca31ba8cc5df22fda (commit)
from 4d73dbf067c315a28fab98e70bc4c88501fcc6d2 (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 d510c4d20931dbf2867aff1cba7ec1686c1de6aa
Merge: a347e046c993fdc4df93b7dca31ba8cc5df22fda 4d73dbf067c315a28fab98e70bc4c88501fcc6d2
Author: Eric Jarrige <jo...@ar...>
Date: Wed Nov 25 01:58:16 2009 -0800
Merge branch 'master' of ssh://jorasse@armadeus.git.sourceforge.net/gitroot/armadeus/armadeus
commit a347e046c993fdc4df93b7dca31ba8cc5df22fda
Author: Eric Jarrige <jo...@ar...>
Date: Tue Nov 24 00:25:09 2009 -0800
[BUILDROOT] install using cp instead of install for zlib libraries
-----------------------------------------------------------------------
Summary of changes:
patches/buildroot/092-zlib.patch | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
create mode 100644 patches/buildroot/092-zlib.patch
diff --git a/patches/buildroot/092-zlib.patch b/patches/buildroot/092-zlib.patch
new file mode 100644
index 0000000..df766cb
--- /dev/null
+++ b/patches/buildroot/092-zlib.patch
@@ -0,0 +1,18 @@
+install using cp instead of install for zlib libraries
+This patch won't be useful anymore after the upgrade to Buildroot 2009.11.
+
+Signed-off-by: Eric Jarrige <Jo...@ar...>
+
+Index: buildroot/package/zlib/zlib.mk
+===================================================================
+--- buildroot/package/zlib/zlib.mk.ori 2008-11-03 00:15:27.000000000 -0800
++++ buildroot/package/zlib/zlib.mk 2009-11-23 16:09:22.908866529 -0800
+@@ -40,7 +40,7 @@ $(STAGING_DIR)/usr/lib/libz.so: $(ZLIB_D
+ $(INSTALL) -D $(ZLIB_DIR)/libz.a $(STAGING_DIR)/usr/lib/libz.a
+ $(INSTALL) -D $(ZLIB_DIR)/zlib.h $(STAGING_DIR)/usr/include/zlib.h
+ $(INSTALL) $(ZLIB_DIR)/zconf.h $(STAGING_DIR)/usr/include/
+- $(INSTALL) $(ZLIB_DIR)/libz.so* $(STAGING_DIR)/usr/lib/
++ cp -dpf $(ZLIB_DIR)/libz.so* $(STAGING_DIR)/usr/lib/
+ touch -c $@
+
+ $(TARGET_DIR)/usr/lib/libz.so: $(STAGING_DIR)/usr/lib/libz.so
hooks/post-receive
--
armadeus
|
|
From: Julien B a. A. <ar...@us...> - 2009-11-25 09:57:19
|
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 4d73dbf067c315a28fab98e70bc4c88501fcc6d2 (commit)
via 648e2df5a2649129c513255b15eb653aba5fded2 (commit)
via c69d139ecfea0d0cd0ad03557aeb04d4388a0ad9 (commit)
via c957b401e6addf220eb5f285508b99ea3aea59c2 (commit)
via f5e13fc1e9fe2ee35f36130dec5b5f604d939819 (commit)
from 38af2b865f3026c40ac73cbfec56ae311ba1e9f6 (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 4d73dbf067c315a28fab98e70bc4c88501fcc6d2
Author: Julien Boibessot <jul...@ar...>
Date: Wed Nov 25 10:48:42 2009 +0100
[LINUX] Cleanup fpgaloader, check indentation while we are at it...
commit 648e2df5a2649129c513255b15eb653aba5fded2
Author: Julien Boibessot <jul...@ar...>
Date: Wed Nov 25 10:41:51 2009 +0100
[LINUX] Cleanup some wishbone_example Makefiles
commit c69d139ecfea0d0cd0ad03557aeb04d4388a0ad9
Author: Julien Boibessot <jul...@ar...>
Date: Wed Nov 25 10:40:07 2009 +0100
[TEST] Cleanup and factorize test_fpga
commit c957b401e6addf220eb5f285508b99ea3aea59c2
Author: Julien Boibessot <jul...@ar...>
Date: Wed Nov 25 09:31:31 2009 +0100
Indentation...
commit f5e13fc1e9fe2ee35f36130dec5b5f604d939819
Author: Julien Boibessot <jul...@ar...>
Date: Tue Nov 24 23:24:42 2009 +0100
Indentation...
-----------------------------------------------------------------------
Summary of changes:
.../modules/fpga/dev_tools/loader/fpga-loader.c | 47 ++--
.../fpga/dev_tools/loader/xilinx-fpga-loader.c | 130 ++++++-----
.../fpga/dev_tools/loader/xilinx-fpga-loader.h | 13 +-
.../linux/modules/fpga/wishbone_example/Makefile | 10 -
.../fpga/wishbone_example/wb_button/Makefile | 13 +-
.../fpga/wishbone_example/wb_button/button.c | 269 ++++++++++----------
.../fpga/wishbone_example/wb_button/button.h | 32 +--
.../fpga/wishbone_example/wb_button/gbutton.c | 237 +++++++++---------
target/test/test_fpga.sh | 57 ++---
target/test/test_helpers.sh | 7 +-
10 files changed, 402 insertions(+), 413 deletions(-)
diff --git a/target/linux/modules/fpga/dev_tools/loader/fpga-loader.c b/target/linux/modules/fpga/dev_tools/loader/fpga-loader.c
index 05b5d6b..bb98a47 100644
--- a/target/linux/modules/fpga/dev_tools/loader/fpga-loader.c
+++ b/target/linux/modules/fpga/dev_tools/loader/fpga-loader.c
@@ -20,7 +20,7 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-// #define DEBUG
+/* #define DEBUG */
#include <linux/version.h>
#include <linux/module.h>
@@ -44,7 +44,7 @@ struct fpga_desc *g_current_desc = NULL;
struct semaphore fpga_sema;
static unsigned char fpga_descriptor = 0; /* use default target_fpga_desc */
-module_param( fpga_descriptor, byte, 0 );
+module_param(fpga_descriptor, byte, 0);
#define FPGA_BUFFER_SIZE 4096
static unsigned char g_buffer[FPGA_BUFFER_SIZE];
@@ -60,18 +60,18 @@ static ssize_t armadeus_fpga_write(struct file *file, const char* pData, size_t
if (down_interruptible(&fpga_sema))
return -ERESTARTSYS;
- if( count > FPGA_BUFFER_SIZE ) {
+ if (count > FPGA_BUFFER_SIZE) {
count = FPGA_BUFFER_SIZE;
}
/* Get value to write from user space */
- ret = __copy_from_user( g_buffer, pData, count);
+ ret = __copy_from_user(g_buffer, pData, count);
if (ret != 0) {
ret = -EFAULT;
goto out;
}
- ret = fpga_load( g_current_desc, g_buffer, count );
+ ret = fpga_load(g_current_desc, g_buffer, count);
out:
/* Release exclusive access */
@@ -89,17 +89,20 @@ static int armadeus_fpga_open(struct inode *inode, struct file *file)
return -ERESTARTSYS;
/* Only one access at a time is permitted */
- if( g_nb_users > 0 )
- return -EBUSY;
+ if (g_nb_users > 0) {
+ ret = -EBUSY;
+ goto out;
+ }
- ret = fpga_init_load( g_current_desc );
- if(!ret) {
+ ret = fpga_init_load(g_current_desc);
+ if (!ret) {
printk("Starting FPGA download\n");
g_nb_users++;
}
- pr_debug("Opening /dev/fpga/loader%d file, %d %d\n", MINOR(inode->i_rdev), fpga_descriptor, ret);
+ pr_debug("Opening /dev/fpga/loader, %d %d\n", fpga_descriptor, ret);
+out:
/* Release exclusive access */
up(&fpga_sema);
@@ -108,12 +111,12 @@ static int armadeus_fpga_open(struct inode *inode, struct file *file)
static int armadeus_fpga_release(struct inode *inode, struct file *file)
{
- if( fpga_finish_load(g_current_desc) )
+ if (fpga_finish_load(g_current_desc))
printk("Failed to load FPGA !\n");
- pr_debug("Closing access to /dev/fpga/loader%d\n", MINOR(inode->i_rdev));
+ pr_debug("Closing access to /dev/fpgaloader\n");
- if( g_nb_users > 0 )
+ if (g_nb_users > 0)
g_nb_users--;
return 0;
@@ -121,7 +124,7 @@ static int armadeus_fpga_release(struct inode *inode, struct file *file)
/* PROC file */
-static int procfile_fpga_read( char *buffer, __attribute__ ((unused)) char **start, off_t offset, int buffer_length, int *eof, __attribute__ ((unused)) void* data)
+static int procfile_fpga_read(char *buffer, __attribute__ ((unused)) char **start, off_t offset, int buffer_length, int *eof, __attribute__ ((unused)) void* data)
{
int ret;
@@ -131,11 +134,11 @@ static int procfile_fpga_read( char *buffer, __attribute__ ((unused)) char **sta
library would continue to issue the read system call until the
the kernel replies that it has no more information, or until
its buffer is filled */
- if( offset > 0 ) {
+ if (offset > 0) {
/* we have finished to read, return 0 */
ret = 0;
} else {
- ret = fpga_get_infos( g_current_desc, buffer );
+ ret = fpga_get_infos(g_current_desc, buffer);
}
return ret;
@@ -177,7 +180,7 @@ int armadeus_fpga_ioctl( struct inode *inode, struct file *filp, unsigned int cm
return -EFAULT;
}*/
- switch(cmd)
+ switch (cmd)
{
default:
return -ENOTTY;
@@ -198,8 +201,8 @@ static int create_proc_entries( void )
proc_mkdir(FPGA_PROC_DIRNAME, NULL);
/* Create proc file */
- fpga_Proc_File = create_proc_entry( FPGA_PROC_FILENAME, S_IWUSR |S_IRUSR | S_IRGRP | S_IROTH, NULL );
- if( fpga_Proc_File == NULL ) {
+ fpga_Proc_File = create_proc_entry(FPGA_PROC_FILENAME, S_IWUSR |S_IRUSR | S_IRGRP | S_IROTH, NULL);
+ if (fpga_Proc_File == NULL) {
printk(DRIVER_NAME ": Could not register a" FPGA_PROC_FILENAME ". Terminating\n");
goto error;
} else {
@@ -269,7 +272,7 @@ static int armadeus_fpga_probe(struct platform_device *pdev)
__func__, __LINE__, fpgaloader_misc.minor);
result = create_proc_entries();
- if( result < 0 )
+ if (result < 0)
goto err_misc;
sema_init(&fpga_sema, 1);
@@ -277,6 +280,8 @@ static int armadeus_fpga_probe(struct platform_device *pdev)
/* initialize the current fpga descriptor with the one by default */
g_current_desc = platform_info;
+ printk(DRIVER_NAME " v" DRIVER_VERSION " ready\n");
+
return 0;
err_misc:
@@ -306,8 +311,6 @@ static struct platform_driver armadeus_fpga_driver = {
static int __init armadeus_fpga_init(void)
{
- printk(DRIVER_NAME " v" DRIVER_VERSION "\n");
-
return platform_driver_register(&armadeus_fpga_driver);
}
diff --git a/target/linux/modules/fpga/dev_tools/loader/xilinx-fpga-loader.c b/target/linux/modules/fpga/dev_tools/loader/xilinx-fpga-loader.c
index 09c380f..4897f88 100644
--- a/target/linux/modules/fpga/dev_tools/loader/xilinx-fpga-loader.c
+++ b/target/linux/modules/fpga/dev_tools/loader/xilinx-fpga-loader.c
@@ -67,7 +67,7 @@ static int xilinx_dump_descriptor_info( struct fpga_desc *desc, char* buffer )
* program the FPGA (serial mode).
* return 0 if success, >0 while programming, <0 if error detected
*/
-static size_t spartan_serial_load (struct fpga_desc *desc, const char* buf, size_t bsize)
+static size_t spartan_serial_load(struct fpga_desc *desc, const char* buf, size_t bsize)
{
Xilinx_Spartan_Slave_Serial_fns *fn = desc->iface_fns;
@@ -101,7 +101,7 @@ static size_t spartan_serial_load (struct fpga_desc *desc, const char* buf, size
} while (i > 0);
}
- if(bytecount%4096 == 0)
+ if (bytecount % 4096 == 0)
printk(".");
return bsize;
@@ -110,17 +110,17 @@ static size_t spartan_serial_load (struct fpga_desc *desc, const char* buf, size
}
/**
- * initialize the FPGA programming interface.
+ * initialize the FPGA programming interface (serial).
* return 0 if success, <0 if error detected
*/
-static int spartan_serial_init (struct fpga_desc *desc)
+static int spartan_serial_init(struct fpga_desc *desc)
{
Xilinx_Spartan_Slave_Serial_fns *fn = desc->iface_fns;
if (fn) {
unsigned long timestamp;
- if(*fn->pre){
- (*fn->pre)(); //Run the pre configuration function if there is one.
+ if (*fn->pre){
+ (*fn->pre)(); /* Run the pre configuration function if there is one. */
}
/* Establish the initial state */
@@ -186,10 +186,10 @@ static int spartan_serial_finish(struct fpga_desc *desc)
/**
- * initialize the FPGA programming interface.
+ * initialize the FPGA programming interface (parallel).
* return 0 if success, <0 if error detected
*/
-static int spartan_parallel_init (struct fpga_desc *desc)
+static int spartan_parallel_init(struct fpga_desc *desc)
{
int res = 0;
Xilinx_Spartan3_Slave_Parallel_fns *fn = desc->iface_fns;
@@ -244,7 +244,7 @@ static int spartan_parallel_init (struct fpga_desc *desc)
* program the FPGA (parallel mode).
* return 0 if success, >0 while programming, <0 if error detected
*/
-static size_t spartan_parallel_load (struct fpga_desc *desc, const char* buf, size_t bsize)
+static size_t spartan_parallel_load(struct fpga_desc *desc, const char* buf, size_t bsize)
{
unsigned long flags;
Xilinx_Spartan3_Slave_Parallel_fns *fn = desc->iface_fns;
@@ -285,7 +285,7 @@ static int spartan_parallel_finish(struct fpga_desc *desc)
(*fn->clk) (1); /* Assert the clock pin */
if (get_timer(timestamp) > CFG_FPGA_WAIT) {
- printk("** Timeout waiting for DONE to clear. %d \n", bytecount);
+ printk("** Timeout waiting for DONE to clear. %d bytes\n", bytecount);
(*fn->abort) (); /* abort the burn */
return -ETIMEDOUT;
}
@@ -296,10 +296,9 @@ static int spartan_parallel_finish(struct fpga_desc *desc)
(*fn->abort) (); /* abort the burn */
return -ETIMEDOUT;
}
-
(*fn->cs) (0); /* Deassert the chip select */
(*fn->wr) (0); /* Deassert the write pin */
- (*fn->post) (); /* post init */
+ (*fn->post) (); /* release resources */
}
return 0;
@@ -310,23 +309,31 @@ size_t fpga_load( struct fpga_desc *desc, const char *buf, size_t bsize )
{
int ret = 0;
- if( desc ) {
- switch( desc->family ) /* check family */
- {
- case Xilinx_Spartan:
+ if (desc) {
+ switch (desc->family) /* check family */
{
- switch( desc->iface ) /* check download hardware interface */
+ case Xilinx_Spartan:
{
- case slave_serial: ret = spartan_serial_load( desc, buf, bsize ); break;
- case slave_parallel: ret = spartan_parallel_load (desc, buf, bsize); break;
- default: PRINTF("interface not supported!\n"); ret = -ENOSYS; break;
+ switch (desc->iface) /* check download hardware interface */
+ {
+ case slave_serial:
+ ret = spartan_serial_load(desc, buf, bsize);
+ break;
+ case slave_parallel:
+ ret = spartan_parallel_load (desc, buf, bsize);
+ break;
+ default:
+ PRINTF("interface not supported!\n");
+ ret = -ENOSYS;
+ break;
+ }
}
- }
- break;
- default:
- PRINTF("family not supported!\n");
- ret = -ENOSYS;
- break;
+ break;
+
+ default:
+ PRINTF("family not supported!\n");
+ ret = -ENOSYS;
+ break;
}
}
else {
@@ -340,23 +347,30 @@ int fpga_init_load( struct fpga_desc *desc )
{
int ret = 0;
- if( desc ) {
- switch( desc->family )
- {
- case Xilinx_Spartan:
+ if (desc) {
+ switch (desc->family)
{
- switch( desc->iface ) /* check donwload hardware interface */
+ case Xilinx_Spartan:
{
- case slave_serial: ret = spartan_serial_init( desc ); break;
- case slave_parallel: ret = spartan_parallel_init( desc ); break;
- default: pr_debug("interface not supported!\n"); ret = -ENOSYS; break;
+ switch (desc->iface) /* check donwload hardware interface */
+ {
+ case slave_serial:
+ ret = spartan_serial_init( desc );
+ break;
+ case slave_parallel:
+ ret = spartan_parallel_init( desc );
+ break;
+ default:
+ pr_debug("interface not supported!\n");
+ ret = -ENOSYS;
+ break;
+ }
}
- }
- break;
- default:
- pr_debug("family not supported!\n");
- ret = -ENOSYS;
- break;
+ break;
+ default:
+ pr_debug("family not supported!\n");
+ ret = -ENOSYS;
+ break;
}
}
else {
@@ -366,33 +380,33 @@ int fpga_init_load( struct fpga_desc *desc )
return ret;
}
-int fpga_finish_load( struct fpga_desc *desc )
+int fpga_finish_load(struct fpga_desc *desc)
{
int ret = 0;
- if( desc ) {
- switch( desc->family )
+ if (desc) {
+ switch (desc->family)
{
case Xilinx_Spartan:
{
- switch( desc->iface ) /* check donwload hardware interface */
+ switch (desc->iface) /* check hardware download interface */
{
- case slave_serial:
- ret = spartan_serial_finish( desc );
- break;
- case slave_parallel:
- ret = spartan_parallel_finish( desc );
- break;
- default:
- pr_debug("interface not supported!\n");
- ret = -ENOSYS;
- break;
+ case slave_serial:
+ ret = spartan_serial_finish(desc);
+ break;
+ case slave_parallel:
+ ret = spartan_parallel_finish(desc);
+ break;
+ default:
+ pr_debug("interface not supported!\n");
+ ret = -ENOSYS;
+ break;
}
}
break;
- default:
- pr_debug("family not supported!\n");
- ret = -ENOSYS;
+ default:
+ pr_debug("family not supported!\n");
+ ret = -ENOSYS;
break;
}
} else {
@@ -407,7 +421,7 @@ int fpga_get_infos( struct fpga_desc *desc, char* buffer )
{
int len = 0;
- if( desc ) {
+ if (desc) {
len = xilinx_dump_descriptor_info( desc, buffer );
}
diff --git a/target/linux/modules/fpga/dev_tools/loader/xilinx-fpga-loader.h b/target/linux/modules/fpga/dev_tools/loader/xilinx-fpga-loader.h
index 5d88aa6..8666010 100644
--- a/target/linux/modules/fpga/dev_tools/loader/xilinx-fpga-loader.h
+++ b/target/linux/modules/fpga/dev_tools/loader/xilinx-fpga-loader.h
@@ -117,20 +117,21 @@ typedef struct {
* program the FPGA.
* return 0 if success, >0 while programming, <0 if error detected
*/
-size_t fpga_load( struct fpga_desc *desc, const char *buf, size_t bsize );
+size_t fpga_load(struct fpga_desc *desc, const char *buf, size_t bsize);
/**
* initialize the FPGA programming interface
* return 0 if success, <0 if error detected
*/
-int fpga_init_load( struct fpga_desc *desc );
+int fpga_init_load(struct fpga_desc *desc);
-/* terminate FGPA loading */
-int fpga_finish_load( struct fpga_desc *desc );
+/* terminate FPGA loading */
+int fpga_finish_load(struct fpga_desc *desc);
/**
- * get some infos about FPGA download, return the number of char placed in the buffer
+ * get some infos about FPGA download.
+ * return the number of char placed in the buffer
*/
-int fpga_get_infos( struct fpga_desc *desc, char* buffer);
+int fpga_get_infos(struct fpga_desc *desc, char* buffer);
#endif // __XILINX_FPGA_H__
diff --git a/target/linux/modules/fpga/wishbone_example/Makefile b/target/linux/modules/fpga/wishbone_example/Makefile
index 5a8c9be..e007089 100644
--- a/target/linux/modules/fpga/wishbone_example/Makefile
+++ b/target/linux/modules/fpga/wishbone_example/Makefile
@@ -24,15 +24,5 @@ install:
echo "Installing Armadeus drivers..."
$(MAKE) -C $(LINUX_DIR) SUBDIRS=$(PWD) INSTALL_MOD_PATH=$(TARGET_DIR) modules_install
-clean:
- rm -f *.*o \
- rm -f *.mod.c \
- rm -f *.cmd \
- rm -f *.o.d \
- rm -f *.order \
- rm -f .*.cmd \
- rm -rf .tmp_versions \
- rm -f Module.symvers
-
endif
diff --git a/target/linux/modules/fpga/wishbone_example/wb_button/Makefile b/target/linux/modules/fpga/wishbone_example/wb_button/Makefile
index ba40ab7..0328a81 100755
--- a/target/linux/modules/fpga/wishbone_example/wb_button/Makefile
+++ b/target/linux/modules/fpga/wishbone_example/wb_button/Makefile
@@ -8,7 +8,6 @@ obj-$(CONFIG_ARMADEUS_WISHBONE_EXAMPLE_BUTTON_DRIVER) += board_buttons.o gbutton
else
-
ARMADEUS_BASE_DIR=../../../../../..
include $(ARMADEUS_BASE_DIR)/Makefile.in
@@ -22,15 +21,9 @@ test:
$(ARMADEUS_TOOLCHAIN_PATH)/arm-linux-gcc testbutton.c -o testbutton
clean:
- rm -f *.*o \
- rm -f *.mod.c \
- rm -f *.cmd \
- rm -f *.o.d \
- rm -f *.order \
- rm -f .*.cmd \
- rm -rf .tmp_versions \
- rm -f Module.symvers \
- rm -f testbutton
+ $(MAKE) -C $(KDIR) SUBDIRS=$(PWD) clean
+ rm -f Module.markers \
+ rm -f modules.order
endif
diff --git a/target/linux/modules/fpga/wishbone_example/wb_button/button.c b/target/linux/modules/fpga/wishbone_example/wb_button/button.c
index bdeb936..f998516 100644
--- a/target/linux/modules/fpga/wishbone_example/wb_button/button.c
+++ b/target/linux/modules/fpga/wishbone_example/wb_button/button.c
@@ -27,40 +27,40 @@
static ssize_t button_fpga_read(void * addr, u16 *data, struct button_dev *dev)
{
- *data = ioread16(addr); /* read the button value */
+ *data = ioread16(addr); /* read the button value */
- return 2;
+ return 2;
}
static ssize_t button_fpga_write(void * addr, u16 *data, struct button_dev *dev)
{
- ssize_t retval;
+ ssize_t retval;
- iowrite16(*data, addr); /* write the button value */
- retval = 2;
+ iowrite16(*data, addr); /* write the button value */
+ retval = 2;
- return retval;
+ return retval;
}
/* irq management; awake read process */
static irqreturn_t fpga_interrupt(int irq, void *dev_id, struct pt_regs *reg)
{
- struct button_dev *ldev = dev_id;
- u16 data;
-
- button_fpga_read(ldev->fpga_virtual_base_address + FPGA_IRQ_PEND, &data, ldev);
- PDEBUG("Interrupt raised %x\n", data);
-
- if (data & WB_BUTTON_IRQ) {
- /* wake up reading process */
- if (ldev->reading)
- up(&ldev->sem);
- /* acknowledge irq_mngr */
- button_fpga_write(ldev->fpga_virtual_base_address + FPGA_IRQ_ACK, &data, ldev);
- return IRQ_HANDLED;
- } else {
- return IRQ_NONE;
- }
+ struct button_dev *ldev = dev_id;
+ u16 data;
+
+ button_fpga_read(ldev->fpga_virtual_base_address + FPGA_IRQ_PEND, &data, ldev);
+ PDEBUG("Interrupt raised %x\n", data);
+
+ if (data & WB_BUTTON_IRQ) {
+ /* wake up reading process */
+ if (ldev->reading)
+ up(&ldev->sem);
+ /* acknowledge irq_mngr */
+ button_fpga_write(ldev->fpga_virtual_base_address + FPGA_IRQ_ACK, &data, ldev);
+ return IRQ_HANDLED;
+ } else {
+ return IRQ_NONE;
+ }
}
/***********************************
@@ -68,53 +68,53 @@ static irqreturn_t fpga_interrupt(int irq, void *dev_id, struct pt_regs *reg)
* *********************************/
ssize_t button_read(struct file *fildes, char __user *buff, size_t count, loff_t *offp)
{
- struct button_dev *ldev = fildes->private_data;
- u16 data = 0;
- ssize_t retval = 0;
- DEFINE_WAIT(wait);
+ struct button_dev *ldev = fildes->private_data;
+ u16 data = 0;
+ ssize_t retval = 0;
+ DEFINE_WAIT(wait);
- ldev->reading = 1;
+ ldev->reading = 1;
- if (*offp + count >= 1) /* Only one word can be read */
- count = 1 - *offp;
+ if (*offp + count >= 1) /* Only one word can be read */
+ count = 1 - *offp;
- if ((retval=down_interruptible(&ldev->sem)) < 0)
- goto out;
+ if ((retval=down_interruptible(&ldev->sem)) < 0)
+ goto out;
- if ((retval = button_fpga_read(ldev->fpga_virtual_base_address + FPGA_BUTTON, &data, ldev)) < 0)
- goto out;
+ if ((retval = button_fpga_read(ldev->fpga_virtual_base_address + FPGA_BUTTON, &data, ldev)) < 0)
+ goto out;
- /* return data for user */
- if (copy_to_user(buff, &data, 2)) {
- printk(KERN_WARNING "read : copy to user data error\n");
- retval = -EFAULT;
- goto out;
- }
+ /* return data for user */
+ if (copy_to_user(buff, &data, 2)) {
+ printk(KERN_WARNING "read : copy to user data error\n");
+ retval = -EFAULT;
+ goto out;
+ }
- *offp = *offp + count;
- retval = 1;
+ *offp = *offp + count;
+ retval = 1;
out:
- PDEBUG("read : Return value %d\n", (int)retval);
- ldev->reading = 0;
+ PDEBUG("read : Return value %d\n", (int)retval);
+ ldev->reading = 0;
- return retval;
+ return retval;
}
int button_open(struct inode *inode, struct file *filp)
{
- /* Allocate and fill any data structure to be put in filp->private_data */
- filp->private_data = container_of(inode->i_cdev, struct button_dev, cdev);
- PDEBUG( "file opened\n");
+ /* Allocate and fill any data structure to be put in filp->private_data */
+ filp->private_data = container_of(inode->i_cdev, struct button_dev, cdev);
+ PDEBUG("file opened\n");
- return 0;
+ return 0;
}
int button_release(struct inode *inode, struct file *filp)
{
- PDEBUG( "released\n");
+ PDEBUG("released\n");
- return 0;
+ return 0;
}
/**********************************
@@ -122,107 +122,106 @@ int button_release(struct inode *inode, struct file *filp)
**********************************/
static int __init button_init(void)
{
- int result;
- int button_major, button_minor;
- u16 data;
- struct button_dev *sdev;
-
- button_major = 252;
- button_minor = 0;
-
- /* Allocate a private structure and reference it as driver's data */
- sdev = (struct button_dev *)kmalloc(sizeof(struct button_dev), GFP_KERNEL);
- if (sdev == NULL) {
- printk(KERN_WARNING "button: unable to allocate private structure\n");
- return -ENOMEM;
- }
-
- /* initiate mutex locked */
- sdev->reading = 0;
- init_MUTEX_LOCKED(&sdev->sem);
-
- /* Get the major and minor device numbers */
- PDEBUG("Get the major and minor device numbers\n");
- if (button_major) {
- devno = MKDEV(button_major, button_minor);
- result = register_chrdev_region(devno, N_DEV,BUTTON_NAME);
- } else {
- result = alloc_chrdev_region(&devno, button_minor, N_DEV, BUTTON_NAME);
- button_major = MAJOR(devno);
- }
- printk(KERN_INFO "button: MAJOR: %d MINOR: %d\n", MAJOR(devno), MINOR(devno));
- if (result < 0) {
- printk(KERN_WARNING "button: can't get major %d\n", button_major);
- }
-
- /* Init the cdev structure */
- PDEBUG("Init the cdev structure\n");
- cdev_init(&sdev->cdev, &button_fops);
- sdev->cdev.owner = THIS_MODULE;
-
- /* Add the device to the kernel, connecting cdev to major/minor number */
- PDEBUG("Add the device to the kernel, connecting cdev to major/minor number\n");
- result = cdev_add(&sdev->cdev, devno, 1);
- if (result < 0)
- printk(KERN_WARNING "button: can't add cdev\n");
-
- /* Requested I/O memory */
- sdev->fpga_virtual_base_address = (void*)IMX_CS1_VIRT;
-
- /* irq unmask */
- data = 1 | ioread16(sdev->fpga_virtual_base_address + FPGA_IRQ_MASK);
- if ((result=button_fpga_write(sdev->fpga_virtual_base_address + FPGA_IRQ_MASK, &data, sdev))<0)
- goto error;
-
- /* irq acknowledge */
- data = 1;
- if ((result=button_fpga_write(sdev->fpga_virtual_base_address + FPGA_IRQ_ACK, &data, sdev))<0)
- goto error;
-
- /* irq registering */
- printk(KERN_INFO "button: fpga irq shared gpioa 1\n");
- if (request_irq(IRQ_GPIOA(1), (irq_handler_t)fpga_interrupt, IRQF_SHARED,BUTTON_IRQ_NAME, sdev)<0) {
- printk(KERN_ERR "Can't request fpga irq\n");
- goto error;
- }
-
-
- /* OK module inserted ! */
- buttondev = sdev;
- printk(KERN_INFO "button module inserted\n");
- return 0;
+ int result;
+ int button_major, button_minor;
+ u16 data;
+ struct button_dev *sdev;
+
+ button_major = 252;
+ button_minor = 0;
+
+ /* Allocate a private structure and reference it as driver's data */
+ sdev = (struct button_dev *)kmalloc(sizeof(struct button_dev), GFP_KERNEL);
+ if (sdev == NULL) {
+ printk(KERN_WARNING "button: unable to allocate private structure\n");
+ return -ENOMEM;
+ }
+
+ /* initiate mutex locked */
+ sdev->reading = 0;
+ init_MUTEX_LOCKED(&sdev->sem);
+
+ /* Get the major and minor device numbers */
+ PDEBUG("Get the major and minor device numbers\n");
+ if (button_major) {
+ devno = MKDEV(button_major, button_minor);
+ result = register_chrdev_region(devno, N_DEV,BUTTON_NAME);
+ } else {
+ result = alloc_chrdev_region(&devno, button_minor, N_DEV, BUTTON_NAME);
+ button_major = MAJOR(devno);
+ }
+ printk(KERN_INFO "button: MAJOR: %d MINOR: %d\n", MAJOR(devno), MINOR(devno));
+ if (result < 0) {
+ printk(KERN_WARNING "button: can't get major %d\n", button_major);
+ }
+
+ /* Init the cdev structure */
+ PDEBUG("Init the cdev structure\n");
+ cdev_init(&sdev->cdev, &button_fops);
+ sdev->cdev.owner = THIS_MODULE;
+
+ /* Add the device to the kernel, connecting cdev to major/minor number */
+ PDEBUG("Add the device to the kernel, connecting cdev to major/minor number\n");
+ result = cdev_add(&sdev->cdev, devno, 1);
+ if (result < 0)
+ printk(KERN_WARNING "button: can't add cdev\n");
+
+ /* Requested I/O memory */
+ sdev->fpga_virtual_base_address = (void*)IMX_CS1_VIRT;
+
+ /* irq unmask */
+ data = 1 | ioread16(sdev->fpga_virtual_base_address + FPGA_IRQ_MASK);
+ if ((result=button_fpga_write(sdev->fpga_virtual_base_address + FPGA_IRQ_MASK, &data, sdev)) < 0)
+ goto error;
+
+ /* irq acknowledge */
+ data = 1;
+ if ((result=button_fpga_write(sdev->fpga_virtual_base_address + FPGA_IRQ_ACK, &data, sdev)) < 0)
+ goto error;
+
+ /* irq registering */
+ printk(KERN_INFO "button: fpga irq shared gpioa 1\n");
+ if (request_irq(IRQ_GPIOA(1), (irq_handler_t)fpga_interrupt, IRQF_SHARED,BUTTON_IRQ_NAME, sdev) < 0) {
+ printk(KERN_ERR "Can't request fpga irq\n");
+ goto error;
+ }
+
+ /* OK driver ready ! */
+ buttondev = sdev;
+ printk(KERN_INFO "button module loaded\n");
+ return 0;
error:
- printk(KERN_ERR "%s: not inserted\n", BUTTON_NAME);
- free_all();
+ printk(KERN_ERR "%s: not loaded\n", BUTTON_NAME);
+ free_all();
- return result;
+ return result;
}
static void __exit button_exit(void)
{
- free_all();
+ free_all();
}
static void free_all(void)
{
- struct button_dev *sdev = buttondev;
+ struct button_dev *sdev = buttondev;
- /* free irq*/
- free_irq(IRQ_GPIOA(1), sdev);
+ /* free irq*/
+ free_irq(IRQ_GPIOA(1), sdev);
- /* delete the cdev structure */
- cdev_del(&sdev->cdev);
+ /* delete the cdev structure */
+ cdev_del(&sdev->cdev);
- /* Free the allocated memory */
- kfree(sdev);
+ /* Free the allocated memory */
+ kfree(sdev);
- /* Release I/O memories */
- release_mem_region(FPGA_BASE_ADDR, FPGA_MEM_SIZE);
+ /* Release I/O memories */
+ release_mem_region(FPGA_BASE_ADDR, FPGA_MEM_SIZE);
- /* free major and minor number */
- unregister_chrdev_region(devno, N_DEV);
- printk(KERN_INFO "button module unloaded\n");
+ /* free major and minor number */
+ unregister_chrdev_region(devno, N_DEV);
+ printk(KERN_INFO "button module unloaded\n");
}
module_init(button_init);
diff --git a/target/linux/modules/fpga/wishbone_example/wb_button/button.h b/target/linux/modules/fpga/wishbone_example/wb_button/button.h
index 5676816..36e03f8 100644
--- a/target/linux/modules/fpga/wishbone_example/wb_button/button.h
+++ b/target/linux/modules/fpga/wishbone_example/wb_button/button.h
@@ -30,22 +30,14 @@
#include <linux/config.h>
#endif
-/* form module/drivers */
#include <linux/init.h>
#include <linux/module.h>
-
-/* for file operations */
+/* for file operations */
#include <linux/fs.h>
#include <linux/cdev.h>
-
-/* copy_to_user function */
-#include <asm/uaccess.h>
-
-/* request_mem_region */
-#include <linux/ioport.h>
-
-/* readw() writew() */
-#include <asm/io.h>
+#include <asm/uaccess.h> /* copy_to_user function */
+#include <linux/ioport.h> /* request_mem_region */
+#include <asm/io.h> /* readw() writew() */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
/* hardware addresses */
@@ -78,7 +70,7 @@
# define PDEBUG(fmt,args...) printk(stderr, fmt, ##args)
# endif
#else
-# define PDEBUG(fmt,args...) /* no debbuging message */
+# define PDEBUG(fmt,args...) /* no debugging message */
#endif
#define BUTTON_NUMBER 1
@@ -88,12 +80,12 @@
/* platform device */
struct plat_button_port{
- const char *name; /*instance name */
- int interrupt_number; /* interrupt_number */
- int num; /* instance number */
- void * membase; /* ioremap base address */
- int idnum; /* identity number */
- int idoffset; /* identity relative address */
- struct button_dev *sdev; /* struct for main device structure*/
+ const char *name; /*instance name */
+ int interrupt_number; /* interrupt_number */
+ int num; /* instance number */
+ void *membase; /* ioremap base address */
+ int idnum; /* identity number */
+ int idoffset; /* identity relative address */
+ struct button_dev *sdev;/* struct for main device structure*/
};
diff --git a/target/linux/modules/fpga/wishbone_example/wb_button/gbutton.c b/target/linux/modules/fpga/wishbone_example/wb_button/gbutton.c
index aadb94d..5ec1e8b 100644
--- a/target/linux/modules/fpga/wishbone_example/wb_button/gbutton.c
+++ b/target/linux/modules/fpga/wishbone_example/wb_button/gbutton.c
@@ -26,22 +26,13 @@
#include <linux/config.h>
#endif
-/* form module/drivers */
#include <linux/init.h>
#include <linux/module.h>
-
-/* for file operations */
-#include <linux/fs.h>
+#include <linux/fs.h> /* for file operations */
#include <linux/cdev.h>
-
-/* copy_to_user function */
-#include <asm/uaccess.h>
-
-/* request_mem_region */
-#include <linux/ioport.h>
-
-/* readw() writew() */
-#include <asm/io.h>
+#include <asm/uaccess.h> /* copy_to_user function */
+#include <linux/ioport.h> /* request_mem_region */
+#include <asm/io.h> /* readw() writew() */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,27)
/* hardware addresses */
@@ -50,7 +41,6 @@
# include <mach/hardware.h>
#endif
-
/* for platform device */
#include <linux/platform_device.h>
@@ -77,13 +67,13 @@
/********************************
* main device structure
* ******************************/
-struct button_dev{
- char *name; /* name of the instance */
- struct cdev cdev; /* char device structure */
- struct semaphore sem; /* mutex */
+struct button_dev {
+ char *name; /* name of the instance */
+ struct cdev cdev; /* char device structure */
+ struct semaphore sem; /* mutex */
void * membase; /* base address for instance */
- dev_t devno; /* to store Major and minor numbers */
- u8 read_in_wait; /* user is waiting for value to read */
+ dev_t devno; /* to store Major and minor numbers */
+ u8 read_in_wait; /* user is waiting for value to read */
};
/***********************************
@@ -92,61 +82,62 @@ struct button_dev{
ssize_t button_read(struct file *fildes, char __user *buff,
size_t count, loff_t *offp)
{
- struct button_dev *ldev = fildes->private_data;
- u16 data=0;
- ssize_t retval = 0;
+ struct button_dev *ldev = fildes->private_data;
+ u16 data=0;
+ ssize_t retval = 0;
- ldev->read_in_wait = 1;
+ ldev->read_in_wait = 1;
- if(*offp + count >= 1) /* Only one word can be read */
- count = 1 - *offp;
+ if (*offp + count >= 1) /* Only one word can be read */
+ count = 1 - *offp;
- if((retval=down_interruptible(&ldev->sem))<0)
- {
- goto out;
- }
+ if ((retval=down_interruptible(&ldev->sem)) < 0) {
+ goto out;
+ }
- data=ioread16(ldev->membase+BUTTON_REG_OFFSET);
- PDEBUG("Read %d at 0x%x\n",data,(unsigned int)ldev->membase+BUTTON_REG_OFFSET);
+ data=ioread16(ldev->membase+BUTTON_REG_OFFSET);
+ PDEBUG("Read %d at 0x%x\n",data,(unsigned int)ldev->membase+BUTTON_REG_OFFSET);
- /* return data for user */
- if(copy_to_user(buff,&data,2)){
- printk(KERN_WARNING "read : copy to user data error\n");
- retval = -EFAULT;
- goto out;
- }
+ /* return data for user */
+ if (copy_to_user(buff, &data, 2)) {
+ printk(KERN_WARNING "read : copy to user data error\n");
+ retval = -EFAULT;
+ goto out;
+ }
- *offp = *offp + count;
- retval = 1;
+ *offp = *offp + count;
+ retval = 1;
out:
- ldev->read_in_wait = 0;
- return retval;
+ ldev->read_in_wait = 0;
+ return retval;
}
-int button_open(struct inode *inode, struct file *filp){
- /* Allocate and fill any data structure to be put in filp->private_data */
- filp->private_data = container_of(inode->i_cdev,struct button_dev, cdev);
- return 0;
+int button_open(struct inode *inode, struct file *filp)
+{
+ /* Allocate and fill any data structure to be put in filp->private_data */
+ filp->private_data = container_of(inode->i_cdev,struct button_dev, cdev);
+
+ return 0;
}
int button_release(struct inode *inode, struct file *filp)
{
- struct button_dev *dev;
+ struct button_dev *dev;
- dev = container_of(inode->i_cdev,struct button_dev,cdev);
- filp->private_data=NULL;
+ dev = container_of(inode->i_cdev, struct button_dev, cdev);
+ filp->private_data=NULL;
- return 0;
+ return 0;
}
static struct file_operations button_fops = {
- .owner = THIS_MODULE,
- .read = button_read,
- .open = button_open,
- .release = button_release,
+ .owner = THIS_MODULE,
+ .read = button_read,
+ .open = button_open,
+ .release = button_release,
};
/**********************************
@@ -154,12 +145,15 @@ static struct file_operations button_fops = {
* awake read process
* ********************************/
-static irqreturn_t button_interrupt(int irq,void *dev_id){
- struct button_dev *ldev = dev_id;
- /* wake up reading process */
- if(ldev->read_in_wait)up(&ldev->sem);
- /* acknowledge irq_mngr */
- return IRQ_HANDLED;
+static irqreturn_t button_interrupt(int irq, void *dev_id)
+{
+ struct button_dev *ldev = dev_id;
+
+ /* wake up reading process */
+ if (ldev->read_in_wait)
+ up(&ldev->sem);
+
+ return IRQ_HANDLED;
}
/**********************************
@@ -169,19 +163,19 @@ static int button_probe(struct platform_device *pdev)
{
struct plat_button_port *dev = pdev->dev.platform_data;
- int result = 0; /* error return */
- int button_major,button_minor;
+ int result = 0; /* error return */
+ int button_major,button_minor;
u16 data;
struct button_dev *sdev;
PDEBUG("Button probing\n");
- PDEBUG("Register %s num %d\n",dev->name,dev->num);
+ PDEBUG("Register %s num %d\n",dev->name,dev->num);
/**************************/
/* check if ID is correct */
/**************************/
data = ioread16(dev->membase+BUTTON_ID_OFFSET);
- if(data != dev->idnum){
+ if (data != dev->idnum) {
result = -1;
printk(KERN_WARNING "For %s id:%d doesn't match "
"with id read %d,\n is device present ?\n",
@@ -193,7 +187,7 @@ static int button_probe(struct platform_device *pdev)
/* allocate memory for sdev structure */
/********************************************/
sdev = kmalloc(sizeof(struct button_dev),GFP_KERNEL);
- if(!sdev){
+ if (!sdev) {
result = -ENOMEM;
goto error_sdev_alloc;
}
@@ -214,11 +208,11 @@ static int button_probe(struct platform_device *pdev)
/* Get the major and minor device numbers */
/******************************************/
- button_major = 251;
- button_minor = dev->num;
+ button_major = 251;
+ button_minor = dev->num;
sdev->devno = MKDEV(button_major, button_minor);
- result = alloc_chrdev_region(&(sdev->devno),button_minor, 1,dev->name);
+ result = alloc_chrdev_region(&(sdev->devno), button_minor, 1,dev->name);
if (result < 0) {
printk(KERN_WARNING "%s: can't get major %d\n",
dev->name,button_major);
@@ -229,64 +223,64 @@ static int button_probe(struct platform_device *pdev)
MAJOR(sdev->devno),
MINOR(sdev->devno));
- /* initiate mutex locked */
- sdev->read_in_wait = 0;
- init_MUTEX_LOCKED(&sdev->sem);
+ /* initiate mutex locked */
+ sdev->read_in_wait = 0;
+ init_MUTEX_LOCKED(&sdev->sem);
/****************************/
- /* Init the cdev structure */
+ /* Init the cdev structure */
/****************************/
- PDEBUG("Init the cdev structure\n");
- cdev_init(&sdev->cdev,&button_fops);
- sdev->cdev.owner = THIS_MODULE;
- sdev->cdev.ops = &button_fops;
+ PDEBUG("Init the cdev structure\n");
+ cdev_init(&sdev->cdev,&button_fops);
+ sdev->cdev.owner = THIS_MODULE;
+ sdev->cdev.ops = &button_fops;
- PDEBUG("%s: Add the device to the kernel, "
+ PDEBUG("%s: Add the device to the kernel, "
"connecting cdev to major/minor number \n",dev->name);
- result = cdev_add(&sdev->cdev,sdev->devno,1);
- if(result < 0){
- printk(KERN_WARNING "%s: can't add cdev\n",dev->name);
- goto error_cdev_add;
- }
-
- /* irq registering */
- result = request_irq(dev->interrupt_number,
- button_interrupt,
- IRQF_SAMPLE_RANDOM,
- sdev->name,
- sdev);
- if(result < 0){
+ result = cdev_add(&sdev->cdev, sdev->devno, 1);
+ if (result < 0) {
+ printk(KERN_WARNING "%s: can't add cdev\n", dev->name);
+ goto error_cdev_add;
+ }
+
+ /* irq registering */
+ result = request_irq(dev->interrupt_number,
+ button_interrupt,
+ IRQF_SAMPLE_RANDOM,
+ sdev->name,
+ sdev);
+ if (result < 0) {
printk(KERN_ERR "Can't register irq %d\n",
dev->interrupt_number);
goto request_irq_error;
}
- printk(KERN_INFO "button: irq registered : %d\n",
- dev->interrupt_number);
+ printk(KERN_INFO "button: irq registered : %d\n",
+ dev->interrupt_number);
- /* OK module inserted ! */
- printk(KERN_INFO "%s insered\n",dev->name);
- return 0;
+ /* OK driver ready ! */
+ printk(KERN_INFO "%s loaded\n", dev->name);
+ return 0;
/*********************/
/* Errors management */
/*********************/
/* freeing irq */
- free_irq(dev->interrupt_number,sdev);
+ free_irq(dev->interrupt_number, sdev);
request_irq_error:
/* delete the cdev structure */
cdev_del(&sdev->cdev);
- PDEBUG("%s:cdev deleted\n",dev->name);
+ PDEBUG("%s:cdev deleted\n", dev->name);
error_cdev_add:
/* free major and minor number */
- unregister_chrdev_region(sdev->devno,1);
- printk(KERN_INFO "%s: Led deleted\n",dev->name);
+ unregister_chrdev_region(sdev->devno, 1);
+ printk(KERN_INFO "%s: Led deleted\n", dev->name);
error_devno:
error_name_copy:
kfree(sdev->name);
error_name_alloc:
kfree(sdev);
error_sdev_alloc:
- printk(KERN_ERR "%s: not inserted\n", dev->name);
+ printk(KERN_ERR "%s: not loaded\n", dev->name);
error_id:
return result;
}
@@ -295,16 +289,17 @@ static int __devexit button_remove(struct platform_device *pdev)
{
struct plat_button_port *dev = pdev->dev.platform_data;
struct button_dev *sdev = (*dev).sdev;
+
/* freeing irq */
- free_irq(dev->interrupt_number,sdev);
+ free_irq(dev->interrupt_number, sdev);
//request_irq_error:
/* delete the cdev structure */
cdev_del(&sdev->cdev);
PDEBUG("%s:cdev deleted\n",dev->name);
//error_cdev_add:
/* free major and minor number */
- unregister_chrdev_region(sdev->devno,1);
- printk(KERN_INFO "%s: Led deleted\n",dev->name);
+ unregister_chrdev_region(sdev->devno, 1);
+ printk(KERN_INFO "%s: Led deleted\n", dev->name);
//error_devno:
//error_name_copy:
kfree(sdev->name);
@@ -319,13 +314,13 @@ static int __devexit button_remove(struct platform_device *pdev)
static struct platform_driver plat_button_driver =
{
- .probe = button_probe,
- .remove = __devexit_p(button_remove),
- .driver =
- {
- .name = "button",
- .owner = THIS_MODULE,
- },
+ .probe = button_probe,
+ .remove = __devexit_p(button_remove),
+ .driver =
+ {
+ .name = "button",
+ .owner = THIS_MODULE,
+ },
};
/**********************************
@@ -333,20 +328,21 @@ static struct platform_driver plat_button_driver =
**********************************/
static int __init button_init(void)
{
- int ret;
-
- PDEBUG("Platform driver name %s",plat_button_driver.driver.name);
- ret = platform_driver_register(&plat_button_driver);
- if (ret) {
- printk(KERN_ERR "Platform driver register error\n");
- return ret;
- }
- return 0;
+ int ret;
+
+ PDEBUG("Platform driver name %s", plat_button_driver.driver.name);
+ ret = platform_driver_register(&plat_button_driver);
+ if (ret) {
+ printk(KERN_ERR "Platform driver register error\n");
+ return ret;
+ }
+
+ return 0;
}
static void __exit button_exit(void)
{
- platform_driver_unregister(&plat_button_driver);
+ platform_driver_unregister(&plat_button_driver);
}
module_init(button_init);
@@ -357,4 +353,3 @@ MODULE_AUTHOR("Fabien Marteau <fab...@ar...> "
"- ARMadeus Systems");
MODULE_DESCRIPTION("button device generic driver");
-
diff --git a/target/test/test_fpga.sh b/target/test/test_fpga.sh
index bf2bcaf..3a7dc1f 100755
--- a/target/test/test_fpga.sh
+++ b/target/test/test_fpga.sh
@@ -14,29 +14,31 @@
source ./test_helpers.sh
source ./test_env.sh
-FPGA_LOAD_DEV="/dev/fpgaloader"
-
load_led_apf9328()
{
- dd if=./data/fpga/blinking_led_apf9328_200k.bit of=$FPGA_LOAD_DEV
+ load_fpga ./data/fpga/blinking_led_apf9328_200k.bit
+ RES=$?
}
load_led_apf27()
{
- echo "I hope you have connected Pins 1 & 39 of J20 (power)"
- dd if=./data/fpga/blinking_led_apf27_200k.bit of=$FPGA_LOAD_DEV
+ ask_user "Please connect pins 1 & 39 of J20 connector (3,3V supply for FPGA bank)\nThen press enter"
+ load_fpga ./data/fpga/blinking_led_apf27_200k.bit
+ RES=$?
}
load_button_apf9328()
{
- dd if=./data/fpga/wishbone_example_apf9328_200k.bit of=$FPGA_LOAD_DEV
+ load_fpga ./data/fpga/wishbone_example_apf9328_200k.bit
+ RES=$?
}
load_button_apf27()
{
- echo "I hope you have connected Pins 1 & 39 of J20 (power)"
- dd if=./data/fpga/wishbone_example_apf27_200k.bit of=$FPGA_LOAD_DEV
+ echo "I hope you have connected pins 1 & 39 of J20"
+ load_fpga ./data/fpga/wishbone_example_apf27_200k.bit
+ RES=$?
}
@@ -44,25 +46,16 @@ test_fpga_load()
{
show_test_banner "FPGA loading"
- modprobe fpgaloader
- RES=$?
- sleep 1
- if [ "$RES" != 0 ] || [ ! -c "$FPGA_LOAD_DEV" ] ; then
- echo "Module failed to load"
- exit_failed
- fi
-
- cat /proc/driver/fpga/loader
-
execute_for_target load_led_apf9328 load_led_apf27
- if [ "$?" == 0 ]; then
- ask_user "Did you see the FPGA's LED blinking ? (y/n)"
+ if [ "$RES" == 0 ]; then
+ ask_user "Did you see the FPGA's LED blinking ? (y/N)"
if [ "$response" == "y" ]; then
echo_test_ok
+ else
+ echo_test_failed
fi
fi
- rm -f $TEST_BITFILE
}
test_fpga_it()
@@ -70,28 +63,32 @@ test_fpga_it()
show_test_banner "FPGA interrupts"
execute_for_target load_button_apf9328 load_button_apf27
- modprobe irq_ocore
- modprobe gbutton
- modprobe board_buttons
+ if [ "$RES" != 0 ]; then
+ exit_failed
+ fi
- if [ "$?" != 0 ] ; then
- echo "Some Modules failed to load"
+ modprobe irq_ocore && modprobe gbutton && modprobe board_buttons
+ DEVICE_NODE=`cat /proc/devices | grep BUTTON | cut -d " " -f 1`
+ if [ "$?" != 0 ] || [ "$DEVICE_NODE" == "" ]; then
+ echo "Some modules failed to load"
exit_failed
fi
- DEVICE_NODE=`cat /proc/devices | grep BUTTON | cut -d " " -f 1`
- mknod /dev/button0 c $DEVICE_NODE 0
+ if [ ! -c /dev/button0 ]; then
+ mknod /dev/button0 c $DEVICE_NODE 0
+ fi
/usr/bin/testsuite/testbutton /dev/button0 &
PID=$!
if [ "$?" == 0 ]; then
- ask_user "Please press FPGA button. Did you see something on the console ? (y/n)"
+ ask_user "Please press FPGA button. Did you see something on the console ? (y/N)"
if [ "$response" == "y" ]; then
echo_test_ok
+ else
+ echo_test_failed
fi
fi
kill $PID
- rm -f $TEST_BITFILE
}
test_fpga_load
diff --git a/target/test/test_helpers.sh b/target/test/test_helpers.sh
index 27e67e4..c5133e5 100644
--- a/target/test/test_helpers.sh
+++ b/target/test/test_helpers.sh
@@ -68,9 +68,14 @@ echo_test_ok()
echo "Test OK !"
}
-exit_failed()
+echo_test_failed()
{
echo "Test FAILED !"
+}
+
+exit_failed()
+{
+ echo_test_failed
exit 1
}
hooks/post-receive
--
armadeus
|
|
From: Julien B a. A. <ar...@us...> - 2009-11-23 15:18:22
|
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 38af2b865f3026c40ac73cbfec56ae311ba1e9f6 (commit)
via b09f67e90e2d441d77c3ab54f8afe7f12ea1cb0e (commit)
from 131f99b3279c9235a7ca7a6892c3390007946404 (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 38af2b865f3026c40ac73cbfec56ae311ba1e9f6
Merge: b09f67e90e2d441d77c3ab54f8afe7f12ea1cb0e 131f99b3279c9235a7ca7a6892c3390007946404
Author: Julien Boibessot <jul...@ar...>
Date: Mon Nov 23 16:17:53 2009 +0100
Merge branch 'master' of ssh://artemys@armadeus.git.sourceforge.net/gitroot/armadeus/armadeus
commit b09f67e90e2d441d77c3ab54f8afe7f12ea1cb0e
Author: Julien Boibessot <jul...@ar...>
Date: Mon Nov 23 16:15:20 2009 +0100
[LINUX] AD9889: makes it possible to rmmod the driver when no chip was detected. Check indentation while we are at it...
-----------------------------------------------------------------------
Summary of changes:
.../2.6.29/314-apf27-armadeus-ad9889.patch | 102 ++++++++++----------
1 files changed, 53 insertions(+), 49 deletions(-)
diff --git a/buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/314-apf27-armadeus-ad9889.patch b/buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/314-apf27-armadeus-ad9889.patch
index 48388e3..03f43f5 100644
--- a/buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/314-apf27-armadeus-ad9889.patch
+++ b/buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/314-apf27-armadeus-ad9889.patch
@@ -1,8 +1,8 @@
-Index: linux-2.6.29.4/drivers/media/video/ad9889.c
+Index: linux-2.6.29.6/drivers/media/video/ad9889.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.29.4/drivers/media/video/ad9889.c 2009-06-04 11:36:41.000000000 +0200
-@@ -0,0 +1,509 @@
++++ linux-2.6.29.6/drivers/media/video/ad9889.c 2009-11-23 16:00:24.000000000 +0100
+@@ -0,0 +1,513 @@
+/*
+ * ad9889 - Analog Devices AD9889 video encoder driver
+ *
@@ -82,23 +82,24 @@ Index: linux-2.6.29.4/drivers/media/video/ad9889.c
+ return 0;
+ }
+ printk(KERN_ERR "I2C Write Problem\n");
++
+ return -1;
+}
+
-+
++#if 0
+static void dump(struct i2c_client *client)
+{
+ int j,i = 0;
-+ do
-+ {
-+ for (j=0; j<4; j++){
-+ printk("%x: %x\t\t",i, ad9889_read(client, i));
++ do {
++ for (j=0; j<4; j++) {
++ printk("%x: %x\t\t", i, ad9889_read(client, i));
+ i++;
+ }
+ printk("\n");
+ }
+ while( i<0xcf );
+}
++#endif
+
+static void ad9889_av_mute_on(struct i2c_client *client)
+{
@@ -146,7 +147,7 @@ Index: linux-2.6.29.4/drivers/media/video/ad9889.c
+ unsigned char rgb_rgb[24] = { 0x07, 0xff, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0x07, 0xff, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0x07, 0xff, 0, 0 };
-+ /* dvi */
++ /* DVI */
+ ad9889_write(client, 0xaf, 0x04);
+ /* write color map */
+ i2c_smbus_write_block_data(client, 0x17,24,rgb_rgb);
@@ -155,7 +156,7 @@ Index: linux-2.6.29.4/drivers/media/video/ad9889.c
+ /* disable CSC */
+ ad9889_write(client, 0x3b, 0x01);
+ /* check input mode */
-+ if( (ad9889_read(client, 0x3E)>>2) != 1)
++ if ((ad9889_read(client, 0x3E)>>2) != 1)
+ printk(KERN_ERR "input mode not supported, must be 640x480\n");
+ /* picture aspec ratio */
+ ad9889_write(client, 0x46, 0x04);
@@ -172,7 +173,7 @@ Index: linux-2.6.29.4/drivers/media/video/ad9889.c
+ /* EDID ram base address */
+ ad9889_write(client, 0x43, config->EDID_I2C_addr<<1);
+
-+ for( i=0; i<256/I2C_SMBUS_BLOCK_MAX; i++){
++ for (i=0; i<256/I2C_SMBUS_BLOCK_MAX; i++) {
+ data.block[0] = I2C_SMBUS_BLOCK_MAX;
+ status = i2c_smbus_xfer(ad9889->edid_ram->adapter, config->EDID_I2C_addr,
+ ad9889->edid_ram->flags,
@@ -189,7 +190,7 @@ Index: linux-2.6.29.4/drivers/media/video/ad9889.c
+{
+ unsigned char edid_dat[256];
+
-+ if( EDID_ram_read_data(client, edid_dat) < 0 )
++ if (EDID_ram_read_data(client, edid_dat) < 0)
+ printk(KERN_ERR "error when reading EDID\n");
+ else{
+/* int i;
@@ -197,7 +198,7 @@ Index: linux-2.6.29.4/drivers/media/video/ad9889.c
+ int aspect;
+ int freq; */
+ /* check if the display is able to do 640x480 @60Hz */
-+ if( !(edid_dat[35] & 0x20) )
++ if (!(edid_dat[35] & 0x20))
+ printk(KERN_ERR "connected display does not support 640x480 mode\n");
+/* printk("Standard monitor timings\n");
+ for(i=38; i<53; i+=2 ) {
@@ -214,7 +215,7 @@ Index: linux-2.6.29.4/drivers/media/video/ad9889.c
+{
+ struct ad9889_config *pdata = client->dev.platform_data;
+
-+ if (ad9889_read(client, 0x42)&0x40) {
++ if (ad9889_read(client, 0x42) & 0x40) {
+ /* wait until the cable is really inserted */
+ mdelay(500);
+ /* set chxPwrDwnI2C down */
@@ -243,16 +244,16 @@ Index: linux-2.6.29.4/drivers/media/video/ad9889.c
+
+ mutex_lock(&ad9889->lock_sync);
+
-+ while((interrupt_remain1&0xC4)|(interrupt_remain2&0xc0)){
++ while ((interrupt_remain1 & 0xC4) | (interrupt_remain2 & 0xc0)) {
+ interrupt_registers1 = ad9889_read(client, 0x96);
+ interrupt_registers2 = ad9889_read(client, 0x97);
+
+ /* check HPD then call hpd handler */
-+ if((interrupt_registers1 & HPD_INT) || ad9889->force_hpd ) {
++ if ((interrupt_registers1 & HPD_INT) || ad9889->force_hpd) {
+ handle_hpd_interrupt(client);
+ ad9889->edid_ready = 0;
+ ad9889->edid_block_map_offset = 0;
-+ if( ad9889->force_hpd ){
++ if (ad9889->force_hpd) {
+ ad9889->force_hpd = 0;
+ ad9889->edid_ready = 0;
+ ad9889_write(client,0x96, HPD_INT);
@@ -262,22 +263,22 @@ Index: linux-2.6.29.4/drivers/media/video/ad9889.c
+ }
+
+ /* check for EDID ready flag, then call EDID Handler */
-+ if((interrupt_registers1 & EDID_RDY_INT)) {
-+ if(!ad9889->edid_ready) {
++ if ((interrupt_registers1 & EDID_RDY_INT)) {
++ if (!ad9889->edid_ready) {
+ ad9889->next_segment = handle_edid_interrupt(client);
+ interrupt_code |= EDID_RDY_INT;
+ }
+ }
+
+ /* re-enable the interrupt before requesting additional EDID */
-+ ad9889_write(client,0x96, interrupt_registers1);
++ ad9889_write(client, 0x96, interrupt_registers1);
+ ad9889_write(client, 0x97, interrupt_registers2);
+
+ /* if final EDID interrupt was processed tell system that EDID is ready and
+ initiate audio video setup */
+
-+ if(interrupt_code&EDID_RDY_INT) {
-+ if(ad9889->next_segment==0) {
++ if (interrupt_code & EDID_RDY_INT) {
++ if (ad9889->next_segment == 0) {
+ ad9889_av_mute_on(client);
+ ad9889_init(client);
+ ad9889->edid_ready = 1;
@@ -285,12 +286,12 @@ Index: linux-2.6.29.4/drivers/media/video/ad9889.c
+ ad9889_av_mute_off(client);
+ }
+ else
-+ ad9889_write(client,0xc4, ad9889->edid_block_map_offset+ad9889->next_segment);
++ ad9889_write(client, 0xc4, ad9889->edid_block_map_offset+ad9889->next_segment);
+
-+ if(ad9889->next_segment==0x40)
++ if (ad9889->next_segment == 0x40)
+ ad9889->edid_block_map_offset=0x40;
+ }
-+ /*Check if additional interrupts occured during processing*/
++ /* Check if additional interrupts occured during processing */
+ interrupt_remain1 = ad9889_read(client, 0x96);
+ interrupt_remain2 = ad9889_read(client, 0x97);
+ }
@@ -305,7 +306,7 @@ Index: linux-2.6.29.4/drivers/media/video/ad9889.c
+ return IRQ_HANDLED;
+}
+
-+static int ad9889_proc_read_register( __attribute__ ((unused)) struct file *file, const char *buf, unsigned long count, void *data)
++static int ad9889_proc_read_register(__attribute__ ((unused)) struct file *file, const char *buf, unsigned long count, void *data)
+{
+ int len;
+ char given_param[16];
@@ -376,6 +377,7 @@ Index: linux-2.6.29.4/drivers/media/video/ad9889.c
+ struct ad9889_config *pdata = client->dev.platform_data;
+ struct ad9889_dev *ad9889;
+ int err = -EINVAL;
++ int res = 0;
+
+ /* Check if the adapter supports the needed features */
+ if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
@@ -392,13 +394,12 @@ Index: linux-2.6.29.4/drivers/media/video/ad9889.c
+ }
+
+ ad9889 = kzalloc(sizeof(struct ad9889_dev), GFP_KERNEL);
-+
+ if (ad9889 == NULL)
+ return -ENOMEM;
+
+ /* create proc files */
-+ proc_read = create_proc_entry( "driver/ad9889read", S_IWUSR | S_IRGRP | S_IROTH, NULL);
-+ proc_write = create_proc_entry( "driver/ad9889write", S_IWUSR | S_IRGRP | S_IROTH, NULL);
++ proc_read = create_proc_entry("driver/ad9889read", S_IWUSR | S_IRGRP | S_IROTH, NULL);
++ proc_write = create_proc_entry("driver/ad9889write", S_IWUSR | S_IRGRP | S_IROTH, NULL);
+ if ((proc_read == NULL) || (proc_write == NULL)) {
+ printk(KERN_ERR ": Could not register one /proc file. Terminating\n");
+ err = -ENOMEM;
@@ -417,20 +418,21 @@ Index: linux-2.6.29.4/drivers/media/video/ad9889.c
+ mutex_init(&ad9889->lock_sync);
+ mutex_lock(&ad9889->lock_sync);
+
-+ /* allocate GPIO / IRQ if necessary */
++ /* allocate GPIO / IRQ if needed */
+ if (pdata->init)
+ pdata->init();
+
-+ if (request_irq(client->irq, ad9889_handler, IRQF_DISABLED | IRQF_SHARED
++ if (request_irq(client->irq, ad9889_handler, IRQF_DISABLED | IRQF_SHARED
+ | IRQF_TRIGGER_FALLING, "ad9889", ad9889)) {
-+ printk(KERN_ERR "Could not allocate touchscreen IRQ (n %d)\n", client->irq);
++ printk(KERN_ERR "Could not allocate AD9889 IRQ (n %d)\n", client->irq);
+ err = -EINVAL;
+ goto err_irq;
-+ }
++ }
+
+ /* check whether the AD9889 is present */
-+ if (ad9889_read(client, 0xA5) != 0x04) {
-+ printk("ad9889 not found\n");
++ res = ad9889_read(client, 0xA5); /* better way ? -> tell us */
++ if (res != 0x04) {
++ printk("AD9889 not found ! (0x%02x)\n", (unsigned char)res);
+ err = -ENODEV;
+ goto err_presence;
+ }
@@ -441,7 +443,7 @@ Index: linux-2.6.29.4/drivers/media/video/ad9889.c
+ goto err_presence;
+ }
+
-+ printk("ad9889 detected at address 0x%x!\n", client->addr << 1);
++ printk("AD9889 detected at address 0x%x!\n", client->addr << 1);
+ /* reset */
+ ad9889_write(client, 0x41, 0X60);
+ mdelay(10);
@@ -459,19 +461,18 @@ Index: linux-2.6.29.4/drivers/media/video/ad9889.c
+ return 0;
+
+err_presence:
-+ kfree(ad9889);
+ free_irq(client->irq, ad9889);
-+
+err_irq:
+ flush_scheduled_work();
-+ kfree(i2c_get_clientdata(client));
++ /* kfree(i2c_get_clientdata(client)); ?? */
+ if (pdata->exit)
+ pdata->exit();
-+
++ remove_proc_entry("driver/ad9889read", NULL);
++ remove_proc_entry("driver/ad9889write", NULL);
+err_proc:
+ kfree(ad9889);
+
-+ return 0;
++ return err;
+}
+
+/* ----------------------------------------------------------------------- */
@@ -488,6 +489,9 @@ Index: linux-2.6.29.4/drivers/media/video/ad9889.c
+ if (pdata->exit)
+ pdata->exit();
+
++ remove_proc_entry("driver/ad9889read", NULL);
++ remove_proc_entry("driver/ad9889write", NULL);
++
+ i2c_unregister_device(ad9889->edid_ram);
+
+ kfree(i2c_get_clientdata(client));
@@ -512,10 +516,10 @@ Index: linux-2.6.29.4/drivers/media/video/ad9889.c
+ .remove = ad9889_remove,
+ .id_table = ad9889_id,
+};
-Index: linux-2.6.29.4/include/media/ad9889.h
+Index: linux-2.6.29.6/include/media/ad9889.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.29.4/include/media/ad9889.h 2009-06-04 11:30:50.000000000 +0200
++++ linux-2.6.29.6/include/media/ad9889.h 2009-11-23 15:55:20.000000000 +0100
@@ -0,0 +1,34 @@
+/*
+ * AD9889 driver
@@ -551,10 +555,10 @@ Index: linux-2.6.29.4/include/media/ad9889.h
+
+
+#endif /* __LINUX_VIDE0_AD9889_H */
-Index: linux-2.6.29.4/drivers/media/video/Makefile
+Index: linux-2.6.29.6/drivers/media/video/Makefile
===================================================================
---- linux-2.6.29.4.orig/drivers/media/video/Makefile 2009-06-04 11:30:49.000000000 +0200
-+++ linux-2.6.29.4/drivers/media/video/Makefile 2009-06-04 11:30:50.000000000 +0200
+--- linux-2.6.29.6.orig/drivers/media/video/Makefile 2009-11-23 15:54:46.000000000 +0100
++++ linux-2.6.29.6/drivers/media/video/Makefile 2009-11-23 16:00:36.000000000 +0100
@@ -50,6 +50,7 @@
obj-$(CONFIG_VIDEO_SAA7127) += saa7127.o
obj-$(CONFIG_VIDEO_SAA7185) += saa7185.o
@@ -563,10 +567,10 @@ Index: linux-2.6.29.4/drivers/media/video/Makefile
obj-$(CONFIG_VIDEO_ADV7170) += adv7170.o
obj-$(CONFIG_VIDEO_ADV7175) += adv7175.o
obj-$(CONFIG_VIDEO_VPX3220) += vpx3220.o
-Index: linux-2.6.29.4/drivers/media/video/Kconfig
+Index: linux-2.6.29.6/drivers/media/video/Kconfig
===================================================================
---- linux-2.6.29.4.orig/drivers/media/video/Kconfig 2009-06-04 11:30:49.000000000 +0200
-+++ linux-2.6.29.4/drivers/media/video/Kconfig 2009-06-04 11:30:50.000000000 +0200
+--- linux-2.6.29.6.orig/drivers/media/video/Kconfig 2009-11-23 15:54:46.000000000 +0100
++++ linux-2.6.29.6/drivers/media/video/Kconfig 2009-11-23 16:00:36.000000000 +0100
@@ -428,6 +428,16 @@
To compile this driver as a module, choose M here: the
module will be called saa7185.
hooks/post-receive
--
armadeus
|
|
From: Julien B a. A. <ar...@us...> - 2009-11-23 14:46:10
|
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 131f99b3279c9235a7ca7a6892c3390007946404 (commit)
from b6f655f9991fe3b1582d4b7dd04dafcf4e74ec62 (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 131f99b3279c9235a7ca7a6892c3390007946404
Author: Julien Boibessot <jul...@ar...>
Date: Mon Nov 23 15:45:41 2009 +0100
[DEMOS] Add preliminary work for a graphical (kind of) oscilloscope using AsDevices library
-----------------------------------------------------------------------
Summary of changes:
.../demos/{real_time/fractal => oscillo}/Makefile | 13 ++-
target/demos/oscillo/README | 5 +
target/demos/oscillo/lcd.c | 128 ++++++++++++++++++++
target/demos/oscillo/lcd.h | 15 +++
target/demos/oscillo/main.c | 78 ++++++++++++
5 files changed, 234 insertions(+), 5 deletions(-)
copy target/demos/{real_time/fractal => oscillo}/Makefile (69%)
create mode 100644 target/demos/oscillo/README
create mode 100644 target/demos/oscillo/lcd.c
create mode 100644 target/demos/oscillo/lcd.h
create mode 100644 target/demos/oscillo/main.c
diff --git a/target/demos/real_time/fractal/Makefile b/target/demos/oscillo/Makefile
similarity index 69%
copy from target/demos/real_time/fractal/Makefile
copy to target/demos/oscillo/Makefile
index e6c30d6..266fa0d 100644
--- a/target/demos/real_time/fractal/Makefile
+++ b/target/demos/oscillo/Makefile
@@ -1,13 +1,16 @@
CC=arm-linux-gcc
CFLAGS=-g -W -Wall
-LDFLAGS=
-EXEC=newton
+LDFLAGS=-lm
+INSTALL_DIR=/tftpboot
+
+
SRC= $(wildcard *.c)
OBJ= $(SRC:.c=.o)
+EXEC=oscillo
all: $(EXEC)
-newton: $(OBJ)
+$(EXEC): $(OBJ)
$(CC) -o $@ $^ $(LDFLAGS)
%.o: %.c
@@ -18,7 +21,7 @@ newton: $(OBJ)
clean:
rm -rf *.o
rm -f $(EXEC)
- rm -f *.c~ *.h~ Makefile~
+
install: all
- cp -f $(EXEC) /tftpboot/local/bin
+ cp -f $(EXEC) $(INSTALL_DIR)
diff --git a/target/demos/oscillo/README b/target/demos/oscillo/README
new file mode 100644
index 0000000..effc687
--- /dev/null
+++ b/target/demos/oscillo/README
@@ -0,0 +1,5 @@
+Under development !
+
+Will graphically show (raw framebuffer) APF's ADC (MAX1027) inputs by using
+AsDevices library.
+
diff --git a/target/demos/oscillo/lcd.c b/target/demos/oscillo/lcd.c
new file mode 100644
index 0000000..db1e0c7
--- /dev/null
+++ b/target/demos/oscillo/lcd.c
@@ -0,0 +1,128 @@
+/*
+ * Abstracts framebuffer access
+ *
+ * Copyright (C) 2009 <gwe...@ar...>
+ * Armadeus Project / Armadeus Systems
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+
+#include <errno.h>
+
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <ctype.h>
+
+#include <sys/ioctl.h>
+#include <sys/time.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <linux/fb.h>
+#include <sys/mman.h>
+
+#include "lcd.h"
+
+
+char *fbp = 0;
+struct fb_var_screeninfo vinfo;
+struct fb_fix_screeninfo finfo;
+long int screensize = 0;
+
+int init_lcd()
+{
+ int fbfd = 0;
+
+ /* Open the file for reading and writing */
+ fbfd = open("/dev/fb0", O_RDWR);
+ if (fbfd < 0) {
+ printf("Error: cannot open framebuffer device.\n");
+ return -1;
+ }
+ printf("The framebuffer device was opened successfully.\n");
+
+ /* Get fixed screen information */
+ if (ioctl(fbfd, FBIOGET_FSCREENINFO, &finfo)) {
+ printf("Error reading fixed information.\n");
+ return -1;
+ }
+
+ /* Get variable screen information */
+ if (ioctl(fbfd, FBIOGET_VSCREENINFO, &vinfo)) {
+ printf("Error reading variable information.\n");
+ return -1;
+ }
+
+ printf("%dx%d, %dbpp\n", vinfo.xres, vinfo.yres, vinfo.bits_per_pixel );
+
+ /* Figure out the size of the screen in bytes */
+ screensize = vinfo.xres * vinfo.yres * vinfo.bits_per_pixel / 8;
+
+ /* Map the device to memory */
+ fbp = (char *)mmap(0, screensize, PROT_READ | PROT_WRITE, MAP_SHARED,
+ fbfd, 0);
+ if ((int)fbp == -1) {
+ printf("Error: failed to map framebuffer device to memory.\n");
+ return -1;
+ }
+ printf("The framebuffer device was mapped to memory successfully.\n");
+
+ return fbfd;
+}
+
+void close_lcd(int fbfd)
+{
+ munmap(fbp, screensize);
+ close(fbfd);
+}
+
+
+void draw_pixel(unsigned int x, unsigned int y, struct color rgb)
+{
+ long int location = 0;
+
+ if ((x >= vinfo.xres) || (y >= vinfo.yres)) {
+ printf("%s: position (%d,%d) outside boundaries !\n", __func__, x, y);
+ if (x >= vinfo.xres)
+ x = vinfo.xres-1;
+ if (y >= vinfo.yres)
+ x = vinfo.yres-1;
+ }
+ location = (x+vinfo.xoffset) * (vinfo.bits_per_pixel/8) +
+ (y+vinfo.yoffset) * finfo.line_length;
+
+ unsigned short int t = ((rgb.r&0xf8)>>3)<<11 | ((rgb.g&0xfc)>>2) << 5 | ((rgb.b&0xf8)>>3);
+ *((unsigned short int*)(fbp + location)) = t;
+}
+
+void clear_vline(unsigned int x)
+{
+ unsigned int y = 0;
+ struct color black = {0,0,0};
+
+ for (y=0; y<vinfo.yres; y++) {
+ draw_pixel(x, y, black);
+ }
+}
+
diff --git a/target/demos/oscillo/lcd.h b/target/demos/oscillo/lcd.h
new file mode 100644
index 0000000..d2d2fbc
--- /dev/null
+++ b/target/demos/oscillo/lcd.h
@@ -0,0 +1,15 @@
+#ifndef LCD_H
+#define LCD_H
+
+struct color {
+ int r;
+ int g;
+ int b;
+};
+
+int init_lcd ();
+void close_lcd(int fbfd);
+void draw_pixel(unsigned int x, unsigned int y, struct color rgb);
+void clear_vline(unsigned int x);
+
+#endif /* LCD_H */
diff --git a/target/demos/oscillo/main.c b/target/demos/oscillo/main.c
new file mode 100644
index 0000000..452452d
--- /dev/null
+++ b/target/demos/oscillo/main.c
@@ -0,0 +1,78 @@
+/*
+ * (Kind of) Oscilloscope for the APF
+ *
+ * Copyright (C) 2009 <jul...@ar...>
+ * Armadeus Project / Armadeus Systems
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/wait.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <math.h> /* sin() */
+
+#include "lcd.h"
+
+
+int fbfd;
+
+static void cleanup(void)
+{
+ close_lcd(fbfd);
+}
+
+#define MAX_CHANNELS 8
+
+int main(void /*int argc, char **argv*/)
+{
+ /*int x[MAX_CHANNELS] = {0, 10, 20, 30, 40, 50, 60, 70};*/
+ int y[MAX_CHANNELS];
+ int time = 0, i;
+ int nb_channels;
+ double rad;
+ struct color colours[MAX_CHANNELS] = {{120,120,120},{0,150,150},{160,0,160},{170,170,0}};
+
+ atexit(cleanup);
+
+ fbfd = init_lcd();
+ if (fbfd < 0)
+ return EXIT_FAILURE;
+
+ nb_channels = 3;
+ while(1) {
+ time += 1;
+ if (time >= 479) {
+ time = 0;
+ }
+ for (i=0; i<nb_channels; i++) {
+ rad += 0.01745f;
+ y[i] = (unsigned int)(sin(rad)*100 + 136 + 5*i);
+ //printf("%d: %d %d\n", i, time, y[i]);
+ draw_pixel(time, y[i], colours[i]);
+ }
+ clear_vline(time+1);
+ usleep(50000);
+ }
+
+ return EXIT_SUCCESS;
+}
+
hooks/post-receive
--
armadeus
|
|
From: Julien B a. A. <ar...@us...> - 2009-11-23 14:25:10
|
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 b6f655f9991fe3b1582d4b7dd04dafcf4e74ec62 (commit)
via 59b7fceef1b34132bf42b09af9fede390e686514 (commit)
via 27c375d59173ecc067332159cab4e4172b079efe (commit)
from ea401419e5cff42bf2ee9243e4a63e2c8ce3aa9c (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 b6f655f9991fe3b1582d4b7dd04dafcf4e74ec62
Merge: 59b7fceef1b34132bf42b09af9fede390e686514 ea401419e5cff42bf2ee9243e4a63e2c8ce3aa9c
Author: Julien Boibessot <jul...@ar...>
Date: Mon Nov 23 15:24:07 2009 +0100
Merge branch 'master' of ssh://artemys@armadeus.git.sourceforge.net/gitroot/armadeus/armadeus
commit 59b7fceef1b34132bf42b09af9fede390e686514
Author: Julien Boibessot <jul...@ar...>
Date: Mon Nov 23 15:23:36 2009 +0100
[LINUX] Makes /sys/ (slow) mode of the max1027 more reliable + addstatistics entry
commit 27c375d59173ecc067332159cab4e4172b079efe
Author: Julien Boibessot <jul...@ar...>
Date: Fri Nov 20 11:31:22 2009 +0100
Indentation + ^M at the end of lines: please don't use wordpad as text editor ! ;-) (only vim users can understand my pain)
-----------------------------------------------------------------------
Summary of changes:
target/linux/modules/max1027/max1027.c | 277 +++++++++++++++++++++-----------
target/packages/ch7024ctrl/ch7024.c | 236 ++++++++++++++--------------
2 files changed, 299 insertions(+), 214 deletions(-)
diff --git a/target/linux/modules/max1027/max1027.c b/target/linux/modules/max1027/max1027.c
index bfdc9fb..28d2290 100644
--- a/target/linux/modules/max1027/max1027.c
+++ b/target/linux/modules/max1027/max1027.c
@@ -1,5 +1,5 @@
/*
- * Max1027 driver for kernel >= 2.6.23
+ * MAX1027 (ADC) driver for kernel >= 2.6.23
*
* Copyright (C) 2006-2008 Armadeus Project / Armadeus Systems
* Authors: Nicolas Colombain / Julien Boibessot
@@ -20,7 +20,7 @@
*
*/
-// #define DEBUG 1
+/*#define DEBUG 1*/
#include <linux/module.h>
#include <linux/moduleparam.h>
@@ -49,7 +49,7 @@
#define DRIVER_NAME "max1027"
-#define DRIVER_VERSION "0.5"
+#define DRIVER_VERSION "0.6"
/* Internal registers prefixes */
@@ -61,24 +61,22 @@
#define MAX1027_REG_BIPO 0x00
/* register specifics */
-
+#define MAX1027_REG_CONV_SCAN1 (1 << 2)
+#define MAX1027_REG_SETUP_CKSEL1 (1 << 5)
#define GET_SELECTED_CHANNEL(conv) ( (conv & 0x78) >> 3 )
-#define MAX1027_SETUP_DIFFSEL_MASK 0x03
-#define GET_NB_SCAN(avg) ( 4 * ((avg & 0x03)+1) )
-#define MAX1027_RESET_ALL (0x0|MAX1027_REG_RESET)
-#define MAX1027_RESET_FIFO (0x8|MAX1027_REG_RESET)
-#define MAX1027_UNI_UCH(x) ((x&0x0f)<<4)
-#define MAX1027_BIPO_BCH(x) ((x&0x0f)<<4)
-
-#define NB_CHANNELS 8
+#define MAX1027_SETUP_DIFFSEL_MASK 0x03
+#define GET_NB_SCAN(avg) ( 4 * ((avg & 0x03)+1) )
+#define MAX1027_RESET_ALL (0x0|MAX1027_REG_RESET)
+#define MAX1027_RESET_FIFO (0x8|MAX1027_REG_RESET)
+#define MAX1027_UNI_UCH(x) ((x&0x0f)<<4)
+#define MAX1027_BIPO_BCH(x) ((x&0x0f)<<4)
+
+#define NB_CHANNELS 8
#define MAX_RESULTS_PER_CHANNEL 16 /* NSCAN = 11 */
-#define MAX_NB_RESULTS (MAX_RESULTS_PER_CHANNEL+1) /* + temp */
+#define MAX_NB_RESULTS (MAX_RESULTS_PER_CHANNEL+1) /* + temp */
#define FIFO_SIZE 128
-//#undef pr_debug
-//#define pr_debug(fmt, ...) \
-// (printk(KERN_ERR pr_fmt(fmt), ##__VA_ARGS__))
/* Global variables */
struct max1027_operations *driver_ops;
@@ -120,6 +118,9 @@ struct max1027 {
int cnvst; /* conversion start pin */
struct tasklet_struct tasklet;
+
+ wait_queue_head_t conv_wq; /* stores waiters of end of conv */
+ int missed_eoc; /* stores all missed EOC interrupts */
};
#define CS_CHANGE(val) 0 /* <-- what is it for ??? */
@@ -128,7 +129,9 @@ static struct spi_device *current_spi;
struct spi_transfer transfer[MAX_NB_RESULTS];
struct spi_message message;
-u8 buffer[MAX_NB_RESULTS*2]; // each result is sent with 16 bits
+u8 buffer[MAX_NB_RESULTS*2]; /* each result is sent with 16 bits */
+
+static void max1027_start_conv(struct max1027*, struct adc_channel*);
static void fifo_flush(struct adc_channel* channel)
{
@@ -142,20 +145,20 @@ static u16 fifo_inuse(struct adc_channel* channel)
return channel->head - channel->tail;
}
-static void fifo_put(u16 c, struct adc_channel* channel)
+static void fifo_put(u16 c, struct adc_channel* channel)
{
if (fifo_inuse(channel) != FIFO_SIZE) {
channel->buffer[channel->head++%FIFO_SIZE] = c;
- if(channel->nb_data_required)
+ if (channel->nb_data_required)
channel->nb_data_required--;
- }
- else {
+ } else {
pr_debug("put fifo full %d\n", channel->id);
+ printk("put fifo full %d\n", channel->id);
}
if (channel->nb_data_required <= 0) {
- set_bit( DATA_AVAILABLE, &channel->status );
- wake_up_interruptible( &(channel->change_wq) );
+ set_bit(DATA_AVAILABLE, &channel->status);
+ wake_up_interruptible(&(channel->change_wq));
}
}
@@ -165,22 +168,36 @@ static u16 fifo_get(u16 * c, u16 count, struct adc_channel* channel)
channel->nb_data_required = 0;
j = fifo_inuse(channel);
- for (i = 0; i < min( j, (int)count); i++) {
+ for (i = 0; i < min(j, (int)count); i++) {
c[i] = channel->buffer[channel->tail++%FIFO_SIZE];
}
- channel->nb_data_required = min( count-i, FIFO_SIZE);
+ channel->nb_data_required = min(count-i, FIFO_SIZE);
return i;
}
+static void inline max1027_wait_end_of_conv(struct max1027 *max1027)
+{
+ int delay;
+
+ delay = wait_event_timeout(max1027->conv_wq, max1027->status==0, msecs_to_jiffies(20));
+ if (delay == 0) {
+ printk("T%lu ", max1027->status);
+ if (test_bit(CONVERSION_RUNNING, &max1027->status)) {
+ max1027->missed_eoc++;
+ clear_bit(CONVERSION_RUNNING, &max1027->status);
+ }
+ }
+
+ /*printk("delay %lu\n", delay);*/
+}
+
/* Must be used within mutex and outside of IRQ context !!! */
-static void max1027_send_cmd( struct spi_device *spi, u8 cmd )
+static void max1027_send_cmd(struct spi_device *spi, u8 cmd)
{
u8 buf = cmd;
struct max1027 *p_max1027 = dev_get_drvdata(&spi->dev);
- spi_write_then_read(spi, &buf, 1, NULL, 0);
-
/* !! order is important here !! ;-) */
if (cmd & MAX1027_REG_CONV) {
p_max1027->conv_reg = cmd;
@@ -191,20 +208,34 @@ static void max1027_send_cmd( struct spi_device *spi, u8 cmd )
else if (cmd & MAX1027_REG_AVG) {
p_max1027->avg_reg = cmd;
}
+
+ spi_write_then_read(spi, &buf, 1, NULL, 0);
}
-static void max1027_start_conv(struct max1027 *max1027)
-{
- /* if no convst pin */
- if (max1027->cnvst < 0) {
+static void max1027_start_conv(struct max1027 *max1027, struct adc_channel *channel)
+{
+ if (test_and_set_bit(CONVERSION_RUNNING, &max1027->status)) {
+ printk("conv already running\n");
+ return;
+ }
+
+ /* No conversion running: launch one */
+
+ if (channel)
+ clear_bit(DATA_AVAILABLE, &channel->status);
+ /* Conversion start depends on CNVST pin presence and clock mode */
+ if ((max1027->cnvst < 0) || (max1027->setup_reg & MAX1027_REG_SETUP_CKSEL1)) {
+ /* Use SPI triggered conv. */
max1027_send_cmd(current_spi, max1027->conv_reg);
} else {
- gpio_set_value(max1027->cnvst, 0);
+ /* Use CNVST triggered conv. */
+ gpio_set_value(max1027->cnvst, 0); /* Platform specific no ? */
udelay(1);
gpio_set_value(max1027->cnvst, 1);
}
}
+/* Called when SPI got results from MAX1027 */
static void max1027_process_results(struct max1027 *max1027)
{
u8 msb, lsb;
@@ -212,9 +243,7 @@ static void max1027_process_results(struct max1027 *max1027)
int i=0, values_to_read=0, start=0, nb_data_required=0;
unsigned int scan_mode, selected_channel;
- pr_debug("%s", __FUNCTION__);
-
-// mutex_lock(&max1027->update_lock); // XXX
+ pr_debug("%s: ", __FUNCTION__);
selected_channel = GET_SELECTED_CHANNEL(max1027->conv_reg);
if (selected_channel >= NB_CHANNELS)
@@ -240,12 +269,12 @@ static void max1027_process_results(struct max1027 *max1027)
start = 0;
/* temp */
if (max1027->conv_reg & MAX1027_CONV_TEMP) {
- start = 1;
msb = buffer[0] & 0x0f;
lsb = buffer[1];
value = ((msb << 8) | lsb);
max1027->temperature = (value * 1000) >> 3; /* 1 unit = 1/8 °C + save it in millidegree */
pr_debug("%d m°C ", max1027->temperature);
+ start = 1;
}
nb_data_required = 0;
for (i=start; i<values_to_read; i++) {
@@ -271,14 +300,16 @@ static void max1027_process_results(struct max1027 *max1027)
pr_debug("\n");
if (nb_data_required) {
- max1027_start_conv(max1027);
+ max1027_start_conv(max1027, max1027->channels[selected_channel]);
} else {
- max1027->status = 0;
+ clear_bit(CONVERSION_RUNNING, &max1027->status);
}
-// mutex_unlock(&max1027->update_lock); // XXX
+
+ /* Somebody's waiting for the "global" End Of Conversion ? */
+ wake_up(&(max1027->conv_wq));
}
-static void max1027_reads_async( struct spi_device *spi, int num_values )
+static void max1027_reads_async(struct spi_device *spi, int num_values)
{
int ret, i;
@@ -302,7 +333,7 @@ static void max1027_reads_async( struct spi_device *spi, int num_values )
}
/*
- * Handles read() done on /dev/gpioxx
+ * Handles read() done on /dev/...
*/
static ssize_t max1027_dev_read(struct file *file, char *buf, size_t count, loff_t *ppos)
{
@@ -317,10 +348,8 @@ static ssize_t max1027_dev_read(struct file *file, char *buf, size_t count, loff
pr_debug("- %s %d byte(s) on minor %d -> channel %d\n", __FUNCTION__, count, minor, channel->id);
if (fifo_inuse(channel) == 0) {
- if (! test_and_set_bit( CONVERSION_RUNNING,&max1027->status)) {
- clear_bit( DATA_AVAILABLE, &channel->status );
- max1027_start_conv(max1027);
- }
+ max1027_start_conv(max1027, channel);
+
if (file->f_flags & O_NONBLOCK)
return -EAGAIN;
@@ -343,15 +372,16 @@ out:
return ret;
}
-/* Tasklet to get results after EOC IRQ */
-static void read_conversion_results( unsigned long data )
+/* Tasklet to get results after EOC interrupt */
+static void read_conversion_results(unsigned long data)
{
struct spi_device *spi = (struct spi_device *)data;
struct max1027 *max1027 = dev_get_drvdata(&spi->dev);
int size = 0;
- /* Get conversion results from chip (depends on conversion mode) */
- switch( GET_SCAN_MODE(max1027->conv_reg) )
+ /* Calculate parameters to get conversion results from chip
+ (depends on conversion mode) */
+ switch (GET_SCAN_MODE(max1027->conv_reg))
{
case SCAN_MODE_00:
size = GET_SELECTED_CHANNEL(max1027->conv_reg) + 1;
@@ -375,6 +405,7 @@ static void read_conversion_results( unsigned long data )
break;
}
+ /* Get the results */
if (max1027->conv_reg & MAX1027_CONV_TEMP) {
max1027_reads_async(spi, size+1);
} else {
@@ -386,8 +417,9 @@ static void read_conversion_results( unsigned long data )
static irqreturn_t max1027_interrupt(int irq, void *dev_id)
{
struct max1027 *max1027 = dev_id;
- /* schedule task for reading results from chip outside of IRQ */
- tasklet_hi_schedule( &max1027->tasklet );
+
+ /* schedules task for reading conversion results outside of IRQ */
+ tasklet_hi_schedule(&max1027->tasklet);
return IRQ_HANDLED;
}
@@ -398,7 +430,7 @@ static void max1027_flush_all_channels(struct max1027 *p_max1027)
int i;
for (i=0; i < NB_CHANNELS; i++) {
- if( p_max1027->channels[i] != NULL )
+ if (p_max1027->channels[i] != NULL)
fifo_flush(p_max1027->channels[i]);
}
}
@@ -468,20 +500,42 @@ static struct file_operations max1027_fops = {
/* sysfs hook functions */
+/* Given value will be put in MAX1027 conversion register.
+ Writing to this register will start an acquisition/conversion if
+ clock mode 1x is configured in setup register.
+*/
static ssize_t max1027_set_conversion(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
struct spi_device *spi = to_spi_device(dev);
+ struct max1027 *max1027 = dev_get_drvdata(&spi->dev);
int val;
- struct max1027 *p_max1027 = dev_get_drvdata(&spi->dev);
-
- val = (simple_strtol(buf, NULL, 10)) & 0xff;
- pr_debug("%s: 0x%02x\n", __FUNCTION__, val);
- mutex_lock(&p_max1027->update_lock);
+ /* Only 1 conversion can be launched that way at a given time */
+ mutex_lock(&max1027->update_lock);
+
+ val = (simple_strtol(buf, NULL, 10)) & 0xff;
+ pr_debug("\n%s: 0x%02x\n", __FUNCTION__, val);
+ max1027_flush_all_channels(max1027);
+ /* Warn if a conversion is already launched and selected mode will
+ trigger a new one */
+ if ((max1027->setup_reg & MAX1027_REG_SETUP_CKSEL1)) {
+ if (test_and_set_bit(CONVERSION_RUNNING, &max1027->status)) {
+ /* Should not occur !! */
+ printk("%s: conv already running!\n", __func__);
+ }
+ }
+ /* Send value to chip */
max1027_send_cmd(spi, MAX1027_REG_CONV | val);
- max1027_flush_all_channels(p_max1027);
- mutex_unlock(&p_max1027->update_lock);
+
+ /* Wait until current convertion is finished if corresponding clock
+ mode is selected */
+ if ((max1027->setup_reg & MAX1027_REG_SETUP_CKSEL1)) {
+ max1027_wait_end_of_conv(max1027);
+ }
+ pr_debug("%s end\n", __FUNCTION__);
+
+ mutex_unlock(&max1027->update_lock);
return count;
}
@@ -490,36 +544,37 @@ static ssize_t max1027_get_conversion(struct device *dev, struct device_attribut
{
ssize_t ret_size = 0;
struct spi_device *spi = to_spi_device(dev);
- struct max1027 *p_max1027 = dev_get_drvdata(&spi->dev);
+ struct max1027 *max1027 = dev_get_drvdata(&spi->dev);
- ret_size = sprintf(buf,"0x%02x", p_max1027->conv_reg);
+ ret_size = sprintf(buf,"0x%02x", max1027->conv_reg);
return ret_size;
}
-// buf value <256 -> max1027 config register
-// buf value >=256 -> max1027 Unipolar or Bipolar mode registers
+/* buf value <256 -> accesss to "config" register
+ buf value >=256 -> "Unipolar" or "Bipolar" mode registers */
static ssize_t max1027_set_setup(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
struct spi_device *spi = to_spi_device(dev);
+ struct max1027 *max1027 = dev_get_drvdata(&spi->dev);
int val;
- struct max1027 *p_max1027 = dev_get_drvdata(&spi->dev);
val = simple_strtol(buf, NULL, 10);
pr_debug("%s: 0x%02x", __FUNCTION__, val);
- mutex_lock(&p_max1027->update_lock);
- max1027_send_cmd( spi, MAX1027_REG_SETUP | (val&0xff) );
+ mutex_lock(&max1027->update_lock);
+ max1027_send_cmd(spi, MAX1027_REG_SETUP | (val&0xff));
/* check whether we need to configure the uni or bipolar mode IOs or not */
- if( ((val&0xff) & MAX1027_SETUP_DIFFSEL_MASK) > MAX1027_SETUP_DIFFSEL(1) ) {
- max1027_send_cmd( spi, val>>8 );
+ if (((val&0xff) & MAX1027_SETUP_DIFFSEL_MASK) > MAX1027_SETUP_DIFFSEL(1)) {
+ max1027_send_cmd(spi, val>>8);
pr_debug("+ 0x%02x", val);
}
- max1027_flush_all_channels(p_max1027);
- mutex_unlock(&p_max1027->update_lock);
+ max1027_flush_all_channels(max1027);
+ mutex_unlock(&max1027->update_lock);
pr_debug("\n");
+
return count;
}
@@ -558,7 +613,7 @@ static ssize_t max1027_get_averaging(struct device *dev, struct device_attribute
struct spi_device *spi = to_spi_device(dev);
struct max1027 *p_max1027 = dev_get_drvdata(&spi->dev);
- ret_size = sprintf(buf,"0x%02x", p_max1027->avg_reg);
+ ret_size = sprintf(buf, "0x%02x", p_max1027->avg_reg);
return ret_size;
}
@@ -570,6 +625,33 @@ static DEVICE_ATTR(averaging, S_IWUSR | S_IRUGO, max1027_get_averaging, max1027
static DEVICE_ATTR(unipolar, S_IWUSR, NULL, max1027_unipolar);
static DEVICE_ATTR(bipolar, S_IWUSR, NULL, max1027_bipolar);*/
+/* For debug: */
+static ssize_t max1027_get_statistics(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ ssize_t ret_size = 0;
+ struct spi_device *spi = to_spi_device(dev);
+ struct max1027 *max1027 = dev_get_drvdata(&spi->dev);
+
+ ret_size = sprintf(buf, "%d", max1027->missed_eoc);
+
+ return ret_size;
+}
+
+static ssize_t max1027_set_statistics(struct device *dev,
+ struct device_attribute *attr, const char *buf, size_t count)
+{
+ struct spi_device *spi = to_spi_device(dev);
+ struct max1027 *max1027 = dev_get_drvdata(&spi->dev);
+
+ /* Whatever was given, clear statistics */
+ max1027->missed_eoc = 0;
+
+ return count;
+}
+
+static DEVICE_ATTR(statistics, S_IWUSR | S_IRUGO, max1027_get_statistics, max1027_set_statistics);
+
+/* For channel values: */
#define show_in(offset) \
static ssize_t show_in##offset##_input(struct device *dev, \
struct device_attribute *attr, char *buf) \
@@ -577,9 +659,9 @@ static ssize_t show_in##offset##_input(struct device *dev, \
int result; \
ssize_t size; \
struct spi_device *spi = to_spi_device(dev); \
- struct max1027 *p_max1027 = dev_get_drvdata(&spi->dev); \
- \
- result = p_max1027->ain[offset]; \
+ struct max1027 *max1027 = dev_get_drvdata(&spi->dev); \
+\
+ result = max1027->ain[offset]; \
size = sprintf(buf, "%d\n", (result*2500)>>10); /* millivolt with 2.5V ref */ \
\
return size; \
@@ -603,17 +685,17 @@ static DEVICE_ATTR(in5_input, S_IRUGO, show_in5_input, NULL);
static DEVICE_ATTR(in6_input, S_IRUGO, show_in6_input, NULL);
static DEVICE_ATTR(in7_input, S_IRUGO, show_in7_input, NULL);
-
+/* On chip temperature: */
static ssize_t max1027_get_temperature(struct device *dev,
struct device_attribute *attr, char *buf)
{
int result;
ssize_t size;
struct spi_device *spi = to_spi_device(dev);
- struct max1027 *p_max1027 = dev_get_drvdata(&spi->dev);
+ struct max1027 *max1027 = dev_get_drvdata(&spi->dev);
- result = p_max1027->temperature;
- size = sprintf(buf, "%d\n", result );
+ result = max1027->temperature;
+ size = sprintf(buf, "%d\n", result);
return size;
}
@@ -648,6 +730,11 @@ static int max1027_create_sys_entries(struct spi_device *spi)
goto end;
}
+ if ((status = device_create_file(&spi->dev, &dev_attr_statistics))) {
+ printk(KERN_WARNING SYSFS_ERROR_STRING " missed EOC accessor\n");
+ goto end;
+ }
+
if ((status = device_create_file(&spi->dev, &dev_attr_temp1_input))){
printk(KERN_WARNING SYSFS_ERROR_STRING " temp1\n");
goto end;
@@ -671,6 +758,7 @@ static void max1027_remove_sys_entries(struct spi_device *spi)
device_remove_file(&spi->dev, &dev_attr_conversion);
device_remove_file(&spi->dev, &dev_attr_setup);
device_remove_file(&spi->dev, &dev_attr_averaging);
+ device_remove_file(&spi->dev, &dev_attr_statistics);
device_remove_file(&spi->dev, &dev_attr_temp1_input);
device_remove_file(&spi->dev, &dev_attr_in0_input);
device_remove_file(&spi->dev, &dev_attr_in1_input);
@@ -713,8 +801,6 @@ static int __devinit max1027_probe(struct spi_device *spi)
if (max1027_major == 0)
max1027_major = result; /* dynamic Major allocation */
- //init_waitqueue_head(&max1027->conversion_wq);
-
/* Setup any GPIO active */
result = platform_info->init(spi);
if (result) {
@@ -743,26 +829,28 @@ static int __devinit max1027_probe(struct spi_device *spi)
if (result)
goto err_sys;
- tasklet_init( &max1027->tasklet, read_conversion_results, (unsigned long)spi);
+ tasklet_init(&max1027->tasklet, read_conversion_results, (unsigned long)spi);
max1027->status = 0;
+ init_waitqueue_head(&max1027->conv_wq);
/* setup spi_device */
spi->bits_per_word = 8;
spi_setup(spi);
/* configure the MAX */
- max1027_send_cmd( spi, MAX1027_RESET_ALL );
- max1027_send_cmd( spi, platform_info->setup | MAX1027_REG_SETUP );
- max1027_send_cmd( spi, platform_info->avg | MAX1027_REG_AVG );
- max1027->conv_reg = (u8)(platform_info->conv|MAX1027_REG_CONV);
-
- set_irq_type( spi->irq, IRQF_TRIGGER_FALLING );
- /* Request interrupt for EOC */
- result = request_irq( spi->irq, max1027_interrupt, 0, DRIVER_NAME, max1027 );
+ max1027_send_cmd(spi, MAX1027_RESET_ALL);
+ max1027_send_cmd(spi, platform_info->setup | MAX1027_REG_SETUP);
+ max1027_send_cmd(spi, platform_info->avg | MAX1027_REG_AVG);
+ max1027->conv_reg = (u8)(platform_info->conv | MAX1027_REG_CONV);
+
+ set_irq_type(spi->irq, IRQF_TRIGGER_FALLING); /* machine specific... */
+ /* Request interrupt for EOC */ /* Should be put before GPIO init no ? */
+ result = request_irq(spi->irq, max1027_interrupt, 0, DRIVER_NAME, max1027);
if (result)
goto err_irq;
- printk( DRIVER_NAME " v" DRIVER_VERSION " successfully probed !\n");
+ printk(DRIVER_NAME " v" DRIVER_VERSION " successfully probed !\n");
+
return 0;
err_sys:
@@ -791,26 +879,25 @@ static int __devexit max1027_remove(struct spi_device *spi)
hwmon_device_unregister(max1027->cdev);
#endif
- tasklet_kill( &max1027->tasklet );
+ tasklet_kill(&max1027->tasklet);
/* De-register from /dev interface */
unregister_chrdev(max1027_major, DRIVER_NAME);
free_irq(spi->irq, max1027);
- /* free IOs*/
+ /* Free GPIOs*/
platform_info->exit(spi);
dev_set_drvdata(&spi->dev, NULL);
for (i=0; i < NB_CHANNELS; i++) {
- kfree( max1027->channels[i] );
+ kfree(max1027->channels[i]);
}
kfree(max1027);
return 0;
}
-
static struct spi_driver max1027_driver = {
.driver = {
.name = DRIVER_NAME,
diff --git a/target/packages/ch7024ctrl/ch7024.c b/target/packages/ch7024ctrl/ch7024.c
index 0d7706c..e8ce201 100644
--- a/target/packages/ch7024ctrl/ch7024.c
+++ b/target/packages/ch7024ctrl/ch7024.c
@@ -1,7 +1,7 @@
/*
** THE ARMADEUS PROJECT
**
-** Copyright (C) year The source forge armadeus project team
+** Copyright (C) 2007 The source forge armadeus project team
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -21,7 +21,6 @@
**
** author: th...@us...
*/
-
#include <stdio.h>
#include <fcntl.h>
@@ -37,53 +36,54 @@
#include "ch7024.h"
//#define DEBUG_CH7024 1
-#define VERSION 0.1f
+#define VERSION "0.2"
#define CONF_FILE "ch7024.conf"
#define MAX_DUMP_LINE 100
-/****************************************************************************************************************************/
+
/* MENU */
void usage()
{
- printf ("\nCH7024 utility ver %0.1f. Armadeus\n", VERSION);
- printf ("q: quit\n");
- printf ("m: modify\n");
- printf ("d: dump all\n");
- printf ("s: save\n");
- printf ("l: load\n");
- printf ("other: menu\n");
+ printf("\nCH7024 utility ver %s. Armadeus\n", VERSION);
+ printf("q: quit\n");
+ printf("m: modify\n");
+ printf("d: dump all\n");
+ printf("s: save\n");
+ printf("l: load\n");
+ printf("other: menu\n");
}
-/* Read a byte on the I2C bus
- This is done by writing the register address
+/* Read a byte on the I2C bus
+ This is done by writing the register address
we want to access and then by reading this register
@param fd: file descriptor of the device
@param reg: register to access
@param buf: buffer used to store the result
@return : -1 in case of error otherwise 0
*/
-int read_byte( int fd, unsigned char reg, unsigned char *buf )
-{
- // create an I2C write message (only one byte: the address)
- struct i2c_msg msg = { CH7024_I2C_SLAVE_ADDR, 0, 1, buf };
- // create a I2C IOCTL request
- struct i2c_rdwr_ioctl_data rdwr = { &msg, 1 };
+int read_byte(int fd, unsigned char reg, unsigned char *buf)
+{
+ /* create an I2C write message (only one byte: the address) */
+ struct i2c_msg msg = { CH7024_I2C_SLAVE_ADDR, 0, 1, buf };
+ /* create a I2C IOCTL request */
+ struct i2c_rdwr_ioctl_data rdwr = { &msg, 1 };
+
+ buf[0] = reg; /* select reg to read */
- buf[0] = reg; // select reg to read
-
- // write the desired register address
- if ( ioctl( fd, I2C_RDWR, &rdwr ) < 0 ){
+ /* write the desired register address */
+ if (ioctl(fd, I2C_RDWR, &rdwr) < 0) {
printf("Write error\n");
return -1;
}
- msg.flags = I2C_M_RD; // read
-
- // read the result and write it in buf[0]
- if ( ioctl( fd, I2C_RDWR, &rdwr ) < 0 ){
+ msg.flags = I2C_M_RD; /* read */
+
+ /* read the result and write it in buf[0] */
+ if (ioctl(fd, I2C_RDWR, &rdwr) < 0) {
printf("Read error\n");
return -1;
}
- return 0;
+
+ return 0;
}
/* Write a byte on the I2C bus
@@ -94,21 +94,22 @@ int read_byte( int fd, unsigned char reg, unsigned char *buf )
*/
int write_byte(int fd, unsigned char reg, unsigned char value)
{
- unsigned char buf[2] = {reg,value}; // initialise a data buffer with
- // address and data
+ unsigned char buf[2] = {reg, value}; /* initialise a data buffer with
+ address and data */
- // create an I2C write message
- struct i2c_msg msg = { CH7024_I2C_SLAVE_ADDR, 0, sizeof(buf), buf };
- // create a I2C IOCTL request
+ /* create an I2C write message */
+ struct i2c_msg msg = { CH7024_I2C_SLAVE_ADDR, 0, sizeof(buf), buf };
+ /* create a I2C IOCTL request */
struct i2c_rdwr_ioctl_data rdwr = { &msg, 1 };
#ifdef DEBUG_CH7024
printf("write ref %02X value %02X\n",reg, value);
#endif
- if ( ioctl( fd, I2C_RDWR, &rdwr ) < 0 ){
- printf("Write error\n");
- return -1;
- }
+ if (ioctl(fd, I2C_RDWR, &rdwr) < 0) {
+ printf("Write error\n");
+ return -1;
+ }
+
return 0;
}
@@ -116,12 +117,12 @@ int write_byte(int fd, unsigned char reg, unsigned char value)
@param string: string to dump
@param destFile: file in which to write
*/
- void dump2Output(char* string, FILE* destFile)
+void dump2Output(char* string, FILE* destFile)
{
- if( destFile == NULL )
+ if (destFile == NULL)
printf("%s", string);
else
- fprintf(destFile,"%s", string);
+ fprintf(destFile, "%s", string);
}
/* dump the register values on the screen if destFile is NULL or in a file
@@ -134,29 +135,29 @@ void dump(int fd, FILE* destFile)
unsigned char buf[2];
char dumpString[MAX_DUMP_LINE];
- if( destFile == NULL )
+ if (destFile == NULL)
printf("Ad:Va\tRe:Va\tRe:Va\tRe:Va\n");
- for( i = 0; i<14; i++ ){
- for( j = 0; j<4; j++ ){
+ for (i=0; i<14; i++) {
+ for (j=0; j<4; j++) {
address = i*4+j;
- if( !read_byte( fd, address, buf ) ){
- sprintf( dumpString, "%02X:%02X\t", address, buf[0] );
- dump2Output( dumpString, destFile );
+ if (!read_byte(fd, address, buf)) {
+ sprintf(dumpString, "%02X:%02X\t", address, buf[0]);
+ dump2Output(dumpString, destFile);
}
}
- dump2Output( "\n", destFile );
+ dump2Output("\n", destFile);
}
- if( !read_byte( fd, DAC_TRIMMING_CMD, buf ) ){
- sprintf( dumpString, "%02X:%02X\t", DAC_TRIMMING_CMD, buf[0] );
- dump2Output( dumpString, destFile );
+ if (!read_byte(fd, DAC_TRIMMING_CMD, buf)) {
+ sprintf(dumpString, "%02X:%02X\t", DAC_TRIMMING_CMD, buf[0]);
+ dump2Output(dumpString, destFile);
}
- if( !read_byte( fd, DATA_IO_CMD, buf ) ){
- sprintf( dumpString, "%02X:%02X\t", DATA_IO_CMD, buf[0] );
- dump2Output( dumpString, destFile );
+ if (!read_byte(fd, DATA_IO_CMD, buf)) {
+ sprintf(dumpString, "%02X:%02X\t", DATA_IO_CMD, buf[0]);
+ dump2Output(dumpString, destFile);
}
- if( !read_byte( fd, ATTACHED_DISPLAY, buf ) ){
- sprintf( dumpString, "%02X:%02X\n", ATTACHED_DISPLAY, buf[0] );
- dump2Output( dumpString, destFile );
+ if (!read_byte(fd, ATTACHED_DISPLAY, buf)) {
+ sprintf(dumpString, "%02X:%02X\n", ATTACHED_DISPLAY, buf[0]);
+ dump2Output(dumpString, destFile);
}
}
@@ -164,7 +165,7 @@ void dump(int fd, FILE* destFile)
@param fd: file descriptor of the CH7024
@param fileName: file containing the values. If "" then the name has to be entered
*/
-void load( int fd, char* fileName )
+void load(int fd, char* fileName)
{
char line[MAX_DUMP_LINE];
char tempFileName[MAX_DUMP_LINE];
@@ -173,118 +174,115 @@ void load( int fd, char* fileName )
int val1, val2, val3, val4;
int nb;
- if( strlen(fileName) == 0 ){
+ if (strlen(fileName) == 0) {
printf("Enter file name: ");
- fgets (tempFileName, sizeof(tempFileName), stdin);
- tempFileName[strlen(tempFileName)-1] = '\0'; //suppress \n
- }
- else{
- strcpy(tempFileName,fileName);
+ fgets(tempFileName, sizeof(tempFileName), stdin);
+ tempFileName[strlen(tempFileName)-1] = '\0'; /* suppress \n */
+ } else {
+ strcpy(tempFileName, fileName);
}
- if ((fd_conf = fopen(tempFileName,"r")) == NULL){
+ if ((fd_conf = fopen(tempFileName, "r")) == NULL) {
perror("Open error: ");
exit (1);
}
- while(fgets(line, MAX_DUMP_LINE, fd_conf) != NULL){
- nb = sscanf(line,"%2X%*c%2X%2X%*c%2X%2X%*c%2X%2X%*c%2X",
- &addr1,&val1,&addr2,&val2,&addr3,&val3,&addr4,&val4 );
- if(nb>=2)
- write_byte (fd, addr1, val1);
- if(nb>=4)
- write_byte (fd, addr2, val2);
- if(nb>=6)
- write_byte (fd, addr3, val3);
- if(nb>=8)
- write_byte (fd, addr4, val4);
+ while(fgets(line, MAX_DUMP_LINE, fd_conf) != NULL) {
+ nb = sscanf(line, "%2X%*c%2X%2X%*c%2X%2X%*c%2X%2X%*c%2X",
+ &addr1, &val1, &addr2, &val2, &addr3, &val3, &addr4, &val4);
+ if (nb >= 2)
+ write_byte(fd, addr1, val1);
+ if (nb >= 4)
+ write_byte(fd, addr2, val2);
+ if (nb >= 6)
+ write_byte(fd, addr3, val3);
+ if (nb >= 8)
+ write_byte(fd, addr4, val4);
}
- /* power down to reset the dac after parameter changing*/
- write_byte (fd, POWER_STATE_CMD, 0xFF);
- /* power on the dac after parameter changing*/
- write_byte (fd, POWER_STATE_CMD, 0x00);
- if(fd_conf != NULL)
+ /* power down to reset the DAC after parameter changing */
+ write_byte(fd, POWER_STATE_CMD, 0xFF);
+ /* power on the DAC after parameter changing */
+ write_byte(fd, POWER_STATE_CMD, 0x00);
+ if (fd_conf != NULL)
fclose(fd_conf);
}
int main(int argc, char *argv[])
{
- int fd; // CH7024 file descriptor
- FILE *fd_conf = NULL; // config file
- char string[10]; // user input string
- unsigned char buf[2]; // buf to store I2C command/data
+ int fd; /* CH7024 file descriptor */
+ FILE *fd_conf = NULL; /* config file */
+ char string[10]; /* user input string */
+ unsigned char buf[2]; /* buf to store I2C command/data */
int regAddr;
int regValue;
- if ( argc >2 ){ // too many args
- usage();
+ if (argc > 2) { /* too many args */
+ usage();
exit(1);
}
- // open I2C /dev
- if ((fd = open("/dev/i2c-0",O_RDWR)) < 0){
- perror("Open error: ");
- exit (1);
- }
+ /* open I2C /dev */
+ if ((fd = open("/dev/i2c-0", O_RDWR)) < 0) {
+ perror("Open error: ");
+ exit (1);
+ }
- // configure I2C_SLAVE
- if ( ioctl(fd ,/*I2C_SLAVE*/ 0x703, CH7024_I2C_SLAVE_ADDR) < 0){
- perror("Ioctl error: ");
- exit (1);
- }
+ /* configure I2C_SLAVE */
+ if (ioctl(fd ,/*I2C_SLAVE*/ 0x703, CH7024_I2C_SLAVE_ADDR) < 0) {
+ perror("Ioctl error: ");
+ exit (1);
+ }
- // check CH7024 presence
- if( !read_byte( fd, DEVICE_ID_CMD, buf ) ){
- if( buf[0] != CH7024_ID ){
+ /* check CH7024 presence */
+ if (!read_byte( fd, DEVICE_ID_CMD, buf)) {
+ if (buf[0] != CH7024_ID) {
printf("CH7024 not recognized. Exit\n");
exit(1);
}
- }
- else{
+ } else {
printf("CH7024 not found. Exit\n");
exit(1);
}
-
- if ( argc == 2 ){ // read data from file
+ if (argc == 2) { /* read data from file */
load(fd,argv[1]);
exit(0);
}
usage();
- while(1){
- fgets(string,sizeof(string),stdin);
- if(string[0] == 'q') // Exit
+ while(1) {
+ fgets(string, sizeof(string), stdin);
+ if (string[0] == 'q') /* Exit */
exit(0);
- else if (string[0] == 'm'){ // Modify registers
+ else if (string[0] == 'm') { /* Modify registers */
printf("reg addr (hex without 0x): ");
- fgets(string,sizeof(string),stdin);
- sscanf(string,"%2x", ®Addr);
+ fgets(string, sizeof(string), stdin);
+ sscanf(string, "%2x", ®Addr);
printf("reg value (hex without 0x): ");
- fgets(string,sizeof(string),stdin);
+ fgets(string, sizeof(string), stdin);
sscanf(string,"%2x", ®Value);
- write_byte (fd, regAddr, regValue);
+ write_byte(fd, regAddr, regValue);
}
- else if (string[0] == 'd') // Dump to screen
+ else if (string[0] == 'd') /* Dump to screen */
dump(fd,fd_conf);
- else if (string[0] == 's'){ // Save to file
- if ((fd_conf = fopen(CONF_FILE,"w")) < 0){
+ else if (string[0] == 's') { /* Save to file */
+ if ((fd_conf = fopen(CONF_FILE, "w")) < 0) {
perror("Open error: ");
exit (1);
}
- dump(fd,fd_conf);
- if(fd_conf != NULL)
+ dump(fd, fd_conf);
+ if (fd_conf != NULL)
fclose(fd_conf);
}
- else if (string[0] == 'l'){ // load from file
+ else if (string[0] == 'l') { /* load from file */
load(fd,"");
}
else
usage();
};
- if(fd >= 0)
+ if (fd >= 0)
close(fd);
- exit (0);
+ exit (0);
}
hooks/post-receive
--
armadeus
|
|
From: Nicolas <th...@us...> - 2009-11-20 17:08:52
|
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 ea401419e5cff42bf2ee9243e4a63e2c8ce3aa9c (commit)
from b1a0f554e835b94428d8b7edf7ad71aab26ea1f2 (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 ea401419e5cff42bf2ee9243e4a63e2c8ce3aa9c
Author: nicolas colombain <nic...@ar...>
Date: Fri Nov 20 18:08:13 2009 +0100
[LINUX] fix ad9889 video output format bug
-----------------------------------------------------------------------
Summary of changes:
.../2.6.29/281-apf27-armadeus-add_apf27.c.patch | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/281-apf27-armadeus-add_apf27.c.patch b/buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/281-apf27-armadeus-add_apf27.c.patch
index 0e24515..a470202 100644
--- a/buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/281-apf27-armadeus-add_apf27.c.patch
+++ b/buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/281-apf27-armadeus-add_apf27.c.patch
@@ -752,7 +752,7 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27-dev.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.29.6/arch/arm/mach-mx2/apf27-dev.c 2009-11-15 19:50:35.000000000 +0100
-@@ -0,0 +1,976 @@
+@@ -0,0 +1,978 @@
+ /*
+ * apf27-dev.c
+ * Support for AFP27 module's development baseboard
@@ -937,6 +937,8 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27-dev.c
+ /* set new FB params */
+ temp_var.xres = 640;
+ temp_var.yres = 480;
++ temp_var.xres_virtual = 640;
++ temp_var.yres_virtual = 480;
+ temp_var.pixclock = 37538;
+ temp_var.left_margin = 47;
+ temp_var.right_margin = 47; /* at least 3 & 1 */
hooks/post-receive
--
armadeus
|
|
From: Fabien M <fa...@us...> - 2009-11-20 15:14:02
|
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 b1a0f554e835b94428d8b7edf7ad71aab26ea1f2 (commit)
from a18d9bea9373c5a9d745a2fab38050b877f21513 (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 b1a0f554e835b94428d8b7edf7ad71aab26ea1f2
Author: Fabien Marteau <fab...@ar...>
Date: Fri Nov 20 16:13:19 2009 +0100
[as_devices] segfault fix on as_93lcxx_close()
-----------------------------------------------------------------------
Summary of changes:
target/packages/as_devices/c/as_93lcxx.c | 10 +++++-----
target/packages/as_devices/c/as_spi.c | 6 ++++--
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/target/packages/as_devices/c/as_93lcxx.c b/target/packages/as_devices/c/as_93lcxx.c
index 5caf3de..d0d36c6 100644
--- a/target/packages/as_devices/c/as_93lcxx.c
+++ b/target/packages/as_devices/c/as_93lcxx.c
@@ -64,12 +64,12 @@ struct as_93lcxx_device * as_93lcxx_open(unsigned char *aSpidev_filename,
uint32_t aSpeed,
uint8_t aWord_size)
{
- int ret=0;
+ int fd=-1;
struct as_93lcxx_device *dev;
/* open spidev bus */
- ret = as_spi_open(aSpidev_filename);
- if(ret < 0)
+ fd = as_spi_open(aSpidev_filename);
+ if(fd < 0)
return NULL;
/* verify datas */
@@ -87,6 +87,7 @@ struct as_93lcxx_device * as_93lcxx_open(unsigned char *aSpidev_filename,
dev->type = aType;
dev->speed = aSpeed;
dev->word_size = aWord_size;
+ dev->fd = fd;
return dev;
}
@@ -94,7 +95,6 @@ struct as_93lcxx_device * as_93lcxx_open(unsigned char *aSpidev_filename,
void as_93lcxx_close(struct as_93lcxx_device *aDev)
{
as_spi_close(aDev->fd);
- free(aDev->spidev_filename);
free(aDev);
}
@@ -220,7 +220,7 @@ int32_t as_93lcxx_write_all(struct as_93lcxx_device *aDev,
3 + add_length + aDev->word_size,
aDev->speed);
- /* TODO: mait for RDY/BSY_n */
+ /* TODO: wait for RDY/BSY_n */
return 0;
}
diff --git a/target/packages/as_devices/c/as_spi.c b/target/packages/as_devices/c/as_spi.c
index 5d82054..bc70b8c 100644
--- a/target/packages/as_devices/c/as_spi.c
+++ b/target/packages/as_devices/c/as_spi.c
@@ -117,13 +117,15 @@ uint32_t as_spi_msg(int aFd,
uint32_t aSpeed)
{
uint32_t msg;
- size_t len;
+ int len;
+
struct spi_ioc_transfer xfer[1];
unsigned char buf[32];
unsigned char buf_read[32];
int status;
int i;
+
msg = aMsg;
len = aLen;
@@ -131,7 +133,7 @@ uint32_t as_spi_msg(int aFd,
memset(buf, 0, sizeof buf);
memset(buf_read, 0, sizeof buf_read);
- if (aLen > sizeof buf)
+ if (len > sizeof buf)
len = sizeof buf;
for (i = len;i > 0;i--)
{
hooks/post-receive
--
armadeus
|
|
From: Fabien M <fa...@us...> - 2009-11-20 11:21:16
|
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 a18d9bea9373c5a9d745a2fab38050b877f21513 (commit)
via f7e04d02048a583f9b3e63256f8002163d3d48ea (commit)
via 697d371e3542b57acbfbeb322c81b898e4e8272c (commit)
via 05c71828927d8baaf7a62f77aeb9f1065b8101ec (commit)
from 70db9a135716bee90b209a7e6d3bef279693497a (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 a18d9bea9373c5a9d745a2fab38050b877f21513
Author: Fabien Marteau <fab...@ar...>
Date: Fri Nov 20 12:14:23 2009 +0100
[as_devices] first version of as_spi compile
commit f7e04d02048a583f9b3e63256f8002163d3d48ea
Author: Fabien Marteau <fab...@ar...>
Date: Fri Nov 20 10:20:10 2009 +0100
[as_devices] as_93lcxx lib compile, not tested
commit 697d371e3542b57acbfbeb322c81b898e4e8272c
Author: Fabien Marteau <fab...@ar...>
Date: Thu Nov 19 23:47:24 2009 +0100
[as_devices] Adding spidev API
commit 05c71828927d8baaf7a62f77aeb9f1065b8101ec
Author: Fabien Marteau <fab...@ar...>
Date: Thu Nov 19 23:02:06 2009 +0100
[as_devices] Adding API for as_93lcxx memory functions
-----------------------------------------------------------------------
Summary of changes:
target/packages/as_devices/c/Makefile | 2 +
target/packages/as_devices/c/as_93lcxx.c | 246 ++++++++++++++++
target/packages/as_devices/c/as_93lcxx.h | 141 +++++++++
target/packages/as_devices/c/as_i2c.c | 304 ++++++--------------
target/packages/as_devices/c/as_i2c.h | 157 +++++++---
target/packages/as_devices/c/as_spi.c | 168 +++++++++++
target/packages/as_devices/c/as_spi.h | 130 +++++++++
target/packages/as_devices/cpp/as_apf27_gpio.cpp | 4 +-
.../packages/as_devices/cpp/as_dynamic_table.hpp | 2 +
target/packages/as_devices/cpp/as_i2c.cpp | 8 +-
10 files changed, 890 insertions(+), 272 deletions(-)
create mode 100644 target/packages/as_devices/c/as_93lcxx.c
create mode 100644 target/packages/as_devices/c/as_93lcxx.h
create mode 100644 target/packages/as_devices/c/as_spi.c
create mode 100644 target/packages/as_devices/c/as_spi.h
diff --git a/target/packages/as_devices/c/Makefile b/target/packages/as_devices/c/Makefile
index c893427..b78f67c 100644
--- a/target/packages/as_devices/c/Makefile
+++ b/target/packages/as_devices/c/Makefile
@@ -9,6 +9,8 @@ LDFLAGS=
OBJ=as_apf27_pwm.o
OBJ+= as_i2c.o
OBJ+= as_apf27_gpio.o
+OBJ+= as_93lcxx.o
+OBJ+= as_spi.o
LIBRARY=as_devices
LIB_VERS=1
diff --git a/target/packages/as_devices/c/as_93lcxx.c b/target/packages/as_devices/c/as_93lcxx.c
new file mode 100644
index 0000000..5caf3de
--- /dev/null
+++ b/target/packages/as_devices/c/as_93lcxx.c
@@ -0,0 +1,246 @@
+/*
+ * This software is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of the
+ * License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ *
+ * Copyright (C) 2009 Fabien Marteau <fab...@ar...>
+ *
+ */
+
+#include "as_93lcxx.h"
+#include "as_spi.h"
+#include <stdlib.h>
+#include <stdio.h>
+
+/* define start bits + opcode */
+#define READ (6)
+#define EWEN (4)
+#define EWEN_ADDR (3)
+#define ERASE (7)
+#define ERAL (6)
+#define ERAL_ADDR (2)
+#define WRITE (5)
+#define WRAL (4)
+#define WRAL_ADDR (1)
+#define EWDS (4)
+#define EWDS_ADDR (0)
+
+/** @brief Private functions to ease making spi instructions
+ */
+
+uint8_t address_len(uint8_t aType, uint8_t aWord_size)
+{
+ switch(aType)
+ {
+ case 46:
+ if( aWord_size == 16)
+ return 6;
+ else
+ return 7;
+ case 56:
+ case 66:
+ if( aWord_size == 16)
+ return 8;
+ else
+ return 9;
+ default:
+ return 0;
+ }
+}
+
+struct as_93lcxx_device * as_93lcxx_open(unsigned char *aSpidev_filename,
+ uint8_t aType,
+ uint32_t aSpeed,
+ uint8_t aWord_size)
+{
+ int ret=0;
+ struct as_93lcxx_device *dev;
+
+ /* open spidev bus */
+ ret = as_spi_open(aSpidev_filename);
+ if(ret < 0)
+ return NULL;
+
+ /* verify datas */
+ if(!( (aType == 46) || (aType == 56) || (aType == 66)))
+ return NULL;
+ if( (aWord_size < 1) || (aWord_size > 16))
+ return NULL;
+
+ dev = (struct as_93lcxx_device *)malloc(sizeof(struct as_93lcxx_device));
+ if(dev == NULL)
+ return NULL;
+
+ /* fill in spidev structure */
+ dev->spidev_filename = aSpidev_filename;
+ dev->type = aType;
+ dev->speed = aSpeed;
+ dev->word_size = aWord_size;
+
+ return dev;
+}
+
+void as_93lcxx_close(struct as_93lcxx_device *aDev)
+{
+ as_spi_close(aDev->fd);
+ free(aDev->spidev_filename);
+ free(aDev);
+}
+
+int32_t as_93lcxx_read(struct as_93lcxx_device *aDev, uint16_t aAddress)
+{
+ uint32_t data_out,msg=0;
+ int add_length;
+
+ add_length = address_len(aDev->type,aDev->word_size);
+
+ /* forge message */
+ msg = ((READ << (add_length+ (aDev->word_size)))
+ | (aAddress << (aDev->word_size)));
+
+ data_out = as_spi_msg(aDev->fd, msg,
+ 3 + add_length + aDev->word_size,
+ aDev->speed);
+
+ if( aDev->word_size == 8)
+ return data_out & 0xff;
+ else
+ return data_out & 0xffff;
+}
+
+int32_t as_93lcxx_ewen(struct as_93lcxx_device *aDev)
+{
+ uint32_t msg=0;
+ int add_length;
+
+ add_length = address_len(aDev->type,aDev->word_size);
+
+ /* forge message */
+ msg = ((EWEN << add_length)
+ |(EWEN_ADDR << (add_length-2))
+ );
+
+ as_spi_msg(aDev->fd, msg,
+ 3 + add_length,
+ aDev->speed);
+ return 0;
+}
+
+int32_t as_93lcxx_erase(struct as_93lcxx_device *aDev, uint16_t aAddress)
+{
+ uint32_t msg=0;
+ int add_length;
+
+ add_length = address_len(aDev->type,aDev->word_size);
+
+ /* forge message */
+ msg = ((ERASE << (add_length + aDev->word_size ))
+ | (aAddress << (aDev->word_size)));
+
+ as_spi_msg(aDev->fd, msg,
+ 3 + add_length + aDev->word_size,
+ aDev->speed);
+ return 0;
+
+}
+
+int32_t as_93lcxx_erase_all(struct as_93lcxx_device *aDev)
+{
+ uint32_t msg=0;
+ int add_length;
+
+ add_length = address_len(aDev->type,aDev->word_size);
+
+ /* forge message */
+ msg = ((ERAL << add_length)
+ |(ERAL_ADDR << (add_length-2))
+ );
+
+ as_spi_msg(aDev->fd, msg,
+ 3 + add_length + aDev->word_size,
+ aDev->speed);
+
+ /* TODO: wait for RDY/BSY_n */
+
+ return 0;
+
+
+}
+
+int32_t as_93lcxx_write(struct as_93lcxx_device *aDev,
+ uint16_t aAddress,
+ uint16_t aValue)
+{
+ uint32_t msg=0;
+ int add_length;
+
+ add_length = address_len(aDev->type,aDev->word_size);
+
+ /* forge message */
+ msg = ((WRITE << (add_length+ (aDev->word_size)))
+ | (aAddress << (aDev->word_size))
+ | aValue
+ );
+
+ as_spi_msg(aDev->fd, msg,
+ 3 + add_length + aDev->word_size,
+ aDev->speed);
+
+ /* TODO: mait for RDY/BSY_n */
+
+ return 0;
+}
+
+int32_t as_93lcxx_write_all(struct as_93lcxx_device *aDev,
+ uint16_t aValue)
+{
+ uint32_t msg=0;
+ int add_length;
+
+ add_length = address_len(aDev->type,aDev->word_size);
+
+ /* forge message */
+ msg = ((WRAL << (add_length+ (aDev->word_size)))
+ |(WRAL_ADDR << ((aDev->word_size) + (add_length-2)))
+ |aValue
+ );
+
+ as_spi_msg(aDev->fd, msg,
+ 3 + add_length + aDev->word_size,
+ aDev->speed);
+
+ /* TODO: mait for RDY/BSY_n */
+
+ return 0;
+}
+
+int32_t as_93lcxx_ewds(struct as_93lcxx_device *aDev)
+{
+ uint32_t msg=0;
+ int add_length;
+
+ add_length = address_len(aDev->type,aDev->word_size);
+
+ /* forge message */
+ msg = ((EWDS << add_length)
+ |(EWDS_ADDR << (add_length-2))
+ );
+
+ as_spi_msg(aDev->fd, msg,
+ 3 + add_length,
+ aDev->speed);
+ return 0;
+}
+
+
diff --git a/target/packages/as_devices/c/as_93lcxx.h b/target/packages/as_devices/c/as_93lcxx.h
new file mode 100644
index 0000000..06ebd7c
--- /dev/null
+++ b/target/packages/as_devices/c/as_93lcxx.h
@@ -0,0 +1,141 @@
+/*
+ * This software is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of the
+ * License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ *
+ * Copyright (C) 2009 Fabien Marteau <fab...@ar...>
+ *
+ */
+
+
+#ifndef AS_93LCXX_H_
+#define AS_93LCXX_H_
+
+
+/** @file
+ * @brief Provide standard commands to drive 93LCxx eeprom (from microchip)
+ *
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <inttypes.h>
+#include <sys/types.h>
+#include <stdio.h>
+
+/**
+ * Store eeprom parameters
+ */
+struct as_93lcxx_device {
+ unsigned char *spidev_filename; /**< filename of the spidev /dev file */
+ uint8_t type; /**< type of the eeprom : 46, 56 or 66 (see DS) */
+ uint32_t speed; /**< SCLK speed, in Hz */
+ uint8_t word_size; /**< word size for transaction, 8 or 16 */
+ int fd; /**< File handler for spidev bus */
+};
+
+/** @brief open the device
+ *
+ * @param spidev_filename path to spidev
+ * @type type of the eeprom
+ * @speed clock speed in Hz
+ * @word_size word size for transaction
+ *
+ * @return as_93lcxx_device struct pointer on success, NULL on error
+ */
+struct as_93lcxx_device * as_93lcxx_open(unsigned char *aSpidev_filename,
+ uint8_t aType,
+ uint32_t aSpeed,
+ uint8_t aWord_size);
+
+/** @brief close the device
+ *
+ * @param spidev_filename path to spidev
+ *
+ */
+void as_93lcxx_close(struct as_93lcxx_device *aDev);
+
+/** @brief read a value in address given
+ *
+ * @param dev 93LCxx structure
+ * @param address addresse of register to be read
+ *
+ * @return positive register value on success, negative value on error.
+ */
+int32_t as_93lcxx_read(struct as_93lcxx_device *aDev, uint16_t aAddress);
+
+/** @brief enable write on eeprom
+ *
+ * @param dev 93LCxx structure
+ *
+ * @return positive value on success, negative value on error
+ */
+int32_t as_93lcxx_ewen(struct as_93lcxx_device *aDev);
+
+/** @brief Force all data bits of the specified iaddress to 1
+ *
+ * @param dev 93LCxx structure
+ * @param address addresse of register to be erased
+ *
+ * @return positive register value on success, negative value on error.
+ */
+int32_t as_93lcxx_erase(struct as_93lcxx_device *aDev, uint16_t aAddress);
+
+/** @brief Force all bits in eeprom to 1
+ *
+ * @param dev 93LCxx structure
+ *
+ * @return positive register value on success, negative value on error.
+ */
+int32_t as_93lcxx_erase_all(struct as_93lcxx_device *aDev);
+
+/** @brief write a value in given address
+ *
+ * @param dev 93LCxx structure
+ * @param address addresse of register to be read
+ * @param value value to be wrote
+ *
+ * @return positive register value on success, negative value on error.
+ */
+int32_t as_93lcxx_write(struct as_93lcxx_device *aDev,
+ uint16_t aAddress,
+ uint16_t aValue);
+
+/** @brief write the entire memory array with value given
+ *
+ * @param dev 93LCxx structure
+ * @param value value to be wrote
+ *
+ * @return positive register value on success, negative value on error.
+ */
+int32_t as_93lcxx_write_all(struct as_93lcxx_device *aDev,
+ uint16_t aValue);
+
+/** @brief disable write on eeprom
+ *
+ * @param dev 93LCxx structure
+ *
+ * @return positive value on success, negative value on error
+ */
+int32_t as_93lcxx_ewds(struct as_93lcxx_device *aDev);
+
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+#endif // AS_93LCXX_H_
diff --git a/target/packages/as_devices/c/as_i2c.c b/target/packages/as_devices/c/as_i2c.c
index 8d79ffd..0cb30eb 100644
--- a/target/packages/as_devices/c/as_i2c.c
+++ b/target/packages/as_devices/c/as_i2c.c
@@ -1,257 +1,119 @@
/*
-** THE ARMadeus Systems
-**
-** Copyright (C) 2009 The armadeus systems team
-** Fabien Marteau <fab...@ar...>
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License as published by the Free Software Foundation; either
-** version 2.1 of the License, or (at your option) any later version.
-**
-** This library is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-** Lesser General Public License for more details.
-**
-** You should have received a copy of the GNU Lesser General Public
-** License along with this library; if not, write to the Free Software
-** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-**
-** TODO: manage force correctly
-*/
+ * This software is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of the
+ * License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ *
+ * Copyright (C) 2009 Benoît Ryder <be...@ry...>
+ *
+ */
-#include "as_i2c.h"
#include <stdio.h>
-#include <stdlib.h>
-#include <linux/i2c.h>
-#include <linux/i2c-dev.h>
-#include <sys/ioctl.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+#include <string.h>
#include <fcntl.h>
+#include <sys/ioctl.h>
#include <unistd.h>
+#include <linux/i2c.h>
+#include <linux/i2c-dev.h>
-#define I2C_DEV_PATH "/dev/i2c-"
-
-/* global static variable */
-static int mFHandlerI2c[NUMBER_OF_I2C];
+#include "as_i2c.h"
-/*------------------------------------------------------------------------------*/
-/** Init i2c bus
- *
- * @param aBusNumber i2c bus number
- * @return error code
- */
-int
-as_i2c_init(int aBusNumber)
-{
- char buffer[40];
- /* make path */
- snprintf(buffer,39,"%s%d",I2C_DEV_PATH,aBusNumber);
- /* open i2c /dev */
- if((mFHandlerI2c[aBusNumber] = open(buffer,O_RDWR))<0)
- {
- perror("Open error : ");
- return -1;
- }
- return 0;
-}
+/// Format of path to I2C devices
+#define AS_I2C_DEV_PATH_FMT "/dev/i2c-%u"
+#define _STR(x) #x
+#define AS_I2C_DEV_PATH_SIZE (sizeof(AS_I2C_DEV_PATH_FMT)-2+sizeof(_STR(AS_I2C_DEV_COUNT))-1)
-/*------------------------------------------------------------------------------*/
-/** read byte on i2c bus
- * @param aBusNumber i2c bus number
- * @param aChipAddr chip address
- * @param aReg Register number
- * @param *aBuf char buffer
- * @return error code
- */
-int
-as_read_byte_data(int aBusNumber,
- unsigned char aChipAddr,
- unsigned char aReg,
- unsigned char *aBuf)
+int as_i2c_open(unsigned int i2c_id)
{
- // create an I2C write message (only one byte: the address)
- struct i2c_msg msg = { aChipAddr, 0, 1, aBuf };
- // create a I2C IOCTL request
- struct i2c_rdwr_ioctl_data rdwr = { &msg, 1 };
-
- aBuf[0] = aReg; // select aReg to read
-
- /* configure I2C slave */
- if ( ioctl(mFHandlerI2c[aBusNumber], I2C_SLAVE_FORCE, aChipAddr) < 0){
- perror("Ioctl error: ");
- return -1;
- }
-
- // write the desired aRegister address
- if ( ioctl( mFHandlerI2c[aBusNumber], I2C_RDWR, &rdwr ) < 0 ){
- printf("Write error\n");
- return -1;
- }
- msg.flags = I2C_M_RD; // read
-
- // read the result and write it in aBuf[0]
- if ( ioctl( mFHandlerI2c[aBusNumber], I2C_RDWR, &rdwr ) < 0 ){
- printf("Read error\n");
- return -1;
- }
- return 0;
+ char buf[AS_I2C_DEV_PATH_SIZE];
+ snprintf(buf, sizeof(buf), AS_I2C_DEV_PATH_FMT, i2c_id);
+ return open(buf, O_RDWR);
}
-/*------------------------------------------------------------------------------*/
-
-/** write byte on i2c bus
- * @param aChipAddr chip address
- * @param aReg Register number
- * @param aBuf char value to write
- * @return error return
- */
-int
-as_write_byte_data(int aBusNumber,
- unsigned char aChipAddr,
- unsigned char aReg,
- unsigned char aValue)
+int as_i2c_close(int fd)
{
- unsigned char buf[2] = {aReg,aValue}; // initialise a data buffer with
- // address and data
-
- // create an I2C write message
- struct i2c_msg msg = { aChipAddr, 0, sizeof(buf), buf };
- // create a I2C IOCTL request
- struct i2c_rdwr_ioctl_data rdwr = { &msg, 1 };
-
- /* configure I2C slave */
- if ( ioctl(mFHandlerI2c[aBusNumber],I2C_SLAVE_FORCE, aChipAddr) < 0){
- perror(">Ioctl error: ");
- return -1;
- }
-
- if ( ioctl( mFHandlerI2c[aBusNumber], I2C_RDWR, &rdwr ) < 0 ){
- printf("Write error\n");
- return -1;
- }
- return 0;
+ return close(fd);
}
-/*------------------------------------------------------------------------------*/
-
-/** write byte on i2c bus
- * @param aChipAddr chip address
- * @param aBuf char value to write
- * @return error return
- */
-int
-as_write_byte(int aBusNumber,
- unsigned char aChipAddr,
- unsigned char aValue)
+int as_i2c_set_slave(int fd, uint8_t addr)
{
- unsigned char buf[1] = {aValue}; // initialise a data buffer with
- // address and data
-
- // create an I2C write message
- struct i2c_msg msg = { aChipAddr, 0, sizeof(buf), buf };
- // create a I2C IOCTL request
- struct i2c_rdwr_ioctl_data rdwr = { &msg, 1 };
-
- /* configure I2C slave */
- if ( ioctl(mFHandlerI2c[aBusNumber], I2C_SLAVE_FORCE, aChipAddr) < 0){
- perror("Ioctl error: ");
- return -1;
- }
+ if( ioctl(fd, I2C_SLAVE_FORCE, addr) < 0 )
+ return -1;
+ return 0;
+}
- if ( ioctl( mFHandlerI2c[aBusNumber], I2C_RDWR, &rdwr ) < 0 ){
- printf("Write error\n");
- return -1;
- }
- return 0;
+int as_i2c_read(int fd, uint8_t addr, uint8_t *data, size_t n)
+{
+ struct i2c_msg msg = { addr, I2C_M_RD, n, data };
+ struct i2c_rdwr_ioctl_data rdwr = { &msg, 1 };
+ if( ioctl(fd, I2C_RDWR, &rdwr) < 0 )
+ return -1;
+ return 0;
}
-/*------------------------------------------------------------------------------*/
-/** Write several byte on I2C
- * @param aBusNumber i2c bus number
- * @param aChipAddr Chip address
- * @param aBuff message
- * @param aSize size of message
- * @return error code
- */
-int
-as_write_multiple_bytes(int aBusNumber,
- unsigned char aChipAddr,
- unsigned char *aBuff,
- int aSize)
+int as_i2c_write(int fd, uint8_t addr, const uint8_t *data, size_t n)
{
- // create an I2C write message
- struct i2c_msg msg = { aChipAddr, 0, aSize, aBuff };
- // create a I2C IOCTL request
- struct i2c_rdwr_ioctl_data rdwr = { &msg, 1 };
-
- /* configure I2C slave */
- if ( ioctl(mFHandlerI2c[aBusNumber], I2C_SLAVE_FORCE, aChipAddr) < 0){
- perror("Ioctl error: ");
- return -1;
- }
-
- if ( ioctl( mFHandlerI2c[aBusNumber], I2C_RDWR, &rdwr ) < 0 ){
- printf("Write error\n");
- return -1;
- }
-
- return 0;
+ struct i2c_msg msg = { addr, 0, n, (uint8_t *)data };
+ struct i2c_rdwr_ioctl_data rdwr = { &msg, 1 };
+ if( ioctl(fd, I2C_RDWR, &rdwr) < 0 )
+ return -1;
+ return 0;
}
-/*------------------------------------------------------------------------------*/
-/** read several bytes on I2C
- * @param aBusNumber i2c bus number
- * @param aChipAddr Chip address
- * @param aBuff message
- * @param aSize size of message
- * @return error code
- */
-int
-as_read_multiple_bytes(int aBusNumber,
- unsigned char aChipAddr,
- unsigned char *aBuff,
- int aSize)
+int as_i2c_read_reg(int fd, uint8_t addr, uint8_t reg, uint8_t *data, size_t n)
{
- // create an I2C read message
- struct i2c_msg msg = { aChipAddr,
- I2C_M_RD,
- aSize,
- aBuff };
- // create a I2C IOCTL request
- struct i2c_rdwr_ioctl_data rdwr = { &msg, 1 };
+ // write reg
+ struct i2c_msg msg = { addr, 0, 1, ® };
+ struct i2c_rdwr_ioctl_data rdwr = { &msg, 1 };
+ if( ioctl(fd, I2C_RDWR, &rdwr) < 0 )
+ return -1;
+ // read data
+ msg.flags = I2C_M_RD;
+ msg.len = n;
+ msg.buf = data;
+ if( ioctl(fd, I2C_RDWR, &rdwr) < 0 )
+ return -2;
+ return 0;
+}
- /* configure I2C slave */
- if ( ioctl(mFHandlerI2c[aBusNumber], I2C_SLAVE_FORCE, aChipAddr) < 0){
- perror("Ioctl error: ");
- return -1;
- }
+int as_i2c_write_reg(int fd, uint8_t addr, uint8_t reg, const uint8_t *data, size_t n)
+{
+ uint8_t buf[n+1];
+ buf[0] = reg;
+ memcpy(buf+1, data, n);
+ return as_i2c_write(fd, addr, buf, sizeof(buf));
+}
- if ( ioctl( mFHandlerI2c[aBusNumber], I2C_RDWR, &rdwr ) < 0 ){
- printf("Write error\n");
- return -1;
- }
- return 0;
+int as_i2c_read_reg_byte(int fd, uint8_t addr, uint8_t reg)
+{
+ uint8_t val;
+ int ret = as_i2c_read_reg(fd, addr, reg, &val, 1);
+ if( ret < 0 )
+ return ret;
+ return val;
}
-/*------------------------------------------------------------------------------*/
-
-/** Close i2c bus files
- * @param aBusNumber i2c bus number
- * @return error code
- */
-int
-as_close(int aBusNumber)
+int as_i2c_write_reg_byte(int fd, uint8_t addr, uint8_t reg, uint8_t val)
{
- return close(mFHandlerI2c[aBusNumber]);
+ uint8_t buf[2] = { reg, val };
+ return as_i2c_write(fd, addr, buf, 2);
}
+
diff --git a/target/packages/as_devices/c/as_i2c.h b/target/packages/as_devices/c/as_i2c.h
index 678a649..f0ec945 100644
--- a/target/packages/as_devices/c/as_i2c.h
+++ b/target/packages/as_devices/c/as_i2c.h
@@ -1,64 +1,131 @@
/*
-** THE ARMadeus Systems
-**
-** Copyright (C) 2009 The armadeus systems team
-** Fabien Marteau <fab...@ar...>
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License as published by the Free Software Foundation; either
-** version 2.1 of the License, or (at your option) any later version.
-**
-** This library is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-** Lesser General Public License for more details.
-**
-** You should have received a copy of the GNU Lesser General Public
-** License along with this library; if not, write to the Free Software
-** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#ifndef __ASI2C_H__
-#define __ASI2C_H__
+ * This software is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of the
+ * License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ *
+ * Copyright (C) 2009 Benoît Ryder <be...@ry...>
+ *
+ */
+
+
+#ifndef AS_I2C_H_
+#define AS_I2C_H_
+
+/** @file
+ * @brief Provide access to I2C devices.
+ *
+ * Once opened with as_i2c_open(), the I2C slave address to talk with should be
+ * set using as_i2c_set_slave(). Then, standard \e read(), \e write() and
+ * close() can be used. Otherwise, methods provided by this module can be used.
+ * These methods does not use standard <em>read()/write</em> methods nor
+ * combined transactions (several read/write messages in the same transaction).
+ *
+ * @note All methods will leave \e errno unchanged on system call errors, which
+ * will happen when -1 is returned.
+ */
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
-#define NUMBER_OF_I2C 2
+#include <inttypes.h>
+#include <sys/types.h>
+
+
+/// Number of I2C busses on system
+#define AS_I2C_DEV_COUNT 2
+
+
+/** @brief Open an I2C bus.
+ *
+ * \e i2c_id is the ID of the I2C bus to open, it should strictly lower than
+ * \e AS_I2C_DEV_COUNT.
+ *
+ * @return the file descriptor of the opened device, -1 on error.
+ */
+int as_i2c_open(unsigned int i2c_id);
+
+/** @brief Close an I2C device.
+ *
+ * @return 0 on success, -1 on error.
+ *
+ * @note This is an alias of the standard \e close() system call.
+ */
+int as_i2c_close(int fd);
+
+/** @brief Set I2C slave address to be used.
+ *
+ * @return 0 on success, -1 on error.
+ */
+int as_i2c_set_slave(int fd, uint8_t addr);
+
+
+/** @brief Read several bytes.
+ *
+ * @return 0 on success, -1 on error.
+ */
+int as_i2c_read(int fd, uint8_t addr, uint8_t *data, size_t n);
+
+/** @brief Write several bytes.
+ *
+ * @return 0 on success, -1 on error.
+ */
+int as_i2c_write(int fd, uint8_t addr, const uint8_t *data, size_t n);
-int as_i2c_init(int aBusNumber);
-int as_read_byte_data(int aBusNumber,
- unsigned char aChipAddr,
- unsigned char aReg,
- unsigned char *aBuf);
+/** @brief Read at a given register address.
+ *
+ * Send the \e reg byte, then read bytes.
+ *
+ * @return 0 on success, -1 on write error (\e reg byte), -2 on read error.
+ */
+int as_i2c_read_reg(int fd, uint8_t addr, uint8_t reg, uint8_t *data, size_t n);
-int as_write_byte_data(int aBusNumber,
- unsigned char aChipAddr,
- unsigned char aReg,
- unsigned char aValue);
+/** @brief Write at a given register address.
+ *
+ * Send the \e reg byte followed by data.
+ *
+ * @return 0 on success, -1 on error.
+ */
+int as_i2c_write_reg(int fd, uint8_t addr, uint8_t reg, const uint8_t *data, size_t n);
-int as_write_byte(int aBusNumber,
- unsigned char aChipAddr,
- unsigned char aValue);
-int as_write_multiple_bytes(int aBusNumber,
- unsigned char aChipAddr,
- unsigned char *aBuff,
- int aSize);
+/** @brief Read a given register byte.
+ *
+ * Send the \e reg byte, then read and return a single byte.
+ *
+ * @return the read byte, -1 on write error (\e reg byte), -2 on read error.
+ *
+ * @note Equivalent to \e as_i2c_read_reg() with a 1-byte buffer, but return
+ * the read byte.
+ */
+int as_i2c_read_reg_byte(int fd, uint8_t addr, uint8_t reg);
-int as_read_multiple_bytes(int aBusNumber,
- unsigned char aChipAddr,
- unsigned char *aBuff,
- int aSize);
+/** @brief Write a given register byte.
+ *
+ * Send the \e reg byte followed by the \e val byte.
+ *
+ * @return 0 on success, -1 on error.
+ *
+ * @note Equivalent to \e as_i2c_write() with a 2-byte buffer.
+ */
+int as_i2c_write_reg_byte(int fd, uint8_t addr, uint8_t reg, uint8_t val);
-int as_close(int aBusNumber);
#ifdef __cplusplus
}
#endif // __cplusplus
-#endif // __ASI2C_H__
+#endif // AS_I2C_H_
diff --git a/target/packages/as_devices/c/as_spi.c b/target/packages/as_devices/c/as_spi.c
new file mode 100644
index 0000000..5d82054
--- /dev/null
+++ b/target/packages/as_devices/c/as_spi.c
@@ -0,0 +1,168 @@
+/*
+ * This software is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of the
+ * License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ *
+ * Copyright (C) 2009 Fabien Marteau <fab...@ar...>
+ *
+ */
+
+#include "as_spi.h"
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <string.h>
+
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+
+#include <linux/types.h>
+#include <linux/spi/spidev.h>
+
+
+int as_spi_open(const unsigned char *spidev_name)
+{
+ int fd;
+ fd = open((char *)spidev_name, O_RDWR);
+ if (fd < 0) {
+ perror("open");
+ return -1;
+ }
+ return fd;
+}
+
+int as_spi_set_mode(int fd, uint8_t mode)
+{
+ /* TODO */
+ return -1;
+}
+
+int as_spi_set_lsb(int fd, uint8_t lsb)
+{
+ /* TODO */
+ return -1;
+}
+
+int as_spi_set_bits_per_word(int fd, uint8_t bits)
+{
+ /* TODO */
+ return -1;
+}
+
+int as_spi_set_speed(int fd)
+{
+ /* TODO */
+ return -1;
+}
+
+int as_spi_get_mode(int fd)
+{
+ uint8_t mode;
+
+ if (ioctl(fd, SPI_IOC_RD_MODE, &mode) < 0) {
+ perror("SPI rd_mode");
+ return -1;
+ }
+ return mode;
+}
+
+int as_spi_get_lsb(int fd)
+{
+ uint8_t lsb;
+
+ if (ioctl(fd, SPI_IOC_RD_LSB_FIRST, &lsb) < 0) {
+ perror("SPI rd_lsb_fist");
+ return -1;
+ }
+
+ return lsb;
+}
+
+int as_spi_get_bits_per_word(int fd)
+{
+ uint8_t bits;
+ if (ioctl(fd, SPI_IOC_RD_BITS_PER_WORD, &bits) < 0) {
+ perror("SPI bits_per_word");
+ return-1;
+ }
+ return bits;
+}
+
+int as_spi_get_speed(int fd)
+{
+ uint8_t speed;
+ if (ioctl(fd, SPI_IOC_RD_MAX_SPEED_HZ, &speed) < 0) {
+ perror("SPI max_speed_hz");
+ return -1;
+ }
+ return speed;
+}
+
+uint32_t as_spi_msg(int aFd,
+ uint32_t aMsg,
+ size_t aLen,
+ uint32_t aSpeed)
+{
+ uint32_t msg;
+ size_t len;
+ struct spi_ioc_transfer xfer[1];
+ unsigned char buf[32];
+ unsigned char buf_read[32];
+
+ int status;
+ int i;
+ msg = aMsg;
+ len = aLen;
+
+ memset(xfer, 0, sizeof xfer);
+ memset(buf, 0, sizeof buf);
+ memset(buf_read, 0, sizeof buf_read);
+
+ if (aLen > sizeof buf)
+ len = sizeof buf;
+ for (i = len;i > 0;i--)
+ {
+ buf[i-1] = msg & 0x01;
+ msg = msg >> 1;
+ }
+
+ xfer[0].tx_buf = (__u64) buf;
+ xfer[0].len = len;
+ xfer[0].rx_buf = (__u64) buf_read;
+ xfer[0].speed_hz = aSpeed;
+ xfer[0].bits_per_word = 1;
+
+ status = ioctl(aFd, SPI_IOC_MESSAGE(1), xfer);
+ if (status < 0) {
+ perror("SPI_IOC_MESSAGE");
+ return 0;
+ }
+ for (i = 0;i < len;i++)
+ {
+ msg = msg | buf_read[i];
+ msg = msg << 1;
+ }
+ return msg;
+}
+
+void as_spi_close(int fd)
+{
+ close(fd);
+ return;
+}
+
+
+
diff --git a/target/packages/as_devices/c/as_spi.h b/target/packages/as_devices/c/as_spi.h
new file mode 100644
index 0000000..bde5890
--- /dev/null
+++ b/target/packages/as_devices/c/as_spi.h
@@ -0,0 +1,130 @@
+/*
+ * This software is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of the
+ * License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ *
+ * Copyright (C) 2009 Fabien Marteau <fab...@ar...>
+ *
+ */
+
+
+#ifndef AS_SPI_H_
+#define AS_SPI_H_
+
+/** @file
+ * @brief Provide access to SPI Bus.
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+#include <inttypes.h>
+#include <sys/types.h>
+
+/** @brief Open a SPI bus.
+ *
+ * @return the file descriptor of the opened device, -1Â on error
+ */
+int as_spi_open(const unsigned char *spidev_name);
+
+/** @brief Set spi bus mode
+ *
+ * @param fd spidev file handler
+ * @param mode
+ *
+ * @return mode if positive value, negative value on error
+ *
+ */
+int as_spi_set_mode(int fd, uint8_t mode);
+
+/** @brief Set bits order
+ *
+ * @param fd spidev file handler
+ * @param lsb if 1 lsb first, else msb first
+ *
+ * @return lsb first if positive, msb first if 0, negative value on error
+ */
+int as_spi_set_lsb(int fd, uint8_t lsb);
+
+/** @brief Set bits per word
+ *
+ * @param fd spidev file handler
+ * @param bits number of bits per word
+ *
+ * @return bit per word if positive value, negative value on error
+ */
+int as_spi_set_bits_per_word(int fd, uint8_t bits);
+
+/** @brief Get spi bus mode
+ *
+ * @param fd spidev file handler
+ *
+ * @return mode if positive value, negative value on error
+ *
+ */
+int as_spi_get_mode(int fd);
+
+/** @brief Get bits order
+ *
+ * @param fd spidev file handler
+ *
+ * @return lsb first if positive, msb first if 0, negative value on error
+ */
+int as_spi_get_lsb(int fd);
+
+/** @brief Get clock bus speed
+ *
+ * @param fd spidev file handler
+ *
+ * @return speed in Hz, negative value on error
+ */
+int as_spi_get_speed(int fd);
+
+
+/** @brief Get bits per word
+ *
+ * @param fd spidev file handler
+ *
+ * @return bit per word if positive value, negative value on error
+ */
+int as_spi_get_bits_per_word(int fd);
+
+/** @brief Forge arbitrary length message (32bits max) and send it
+ *
+ * @param fd spidev file handler
+ * @param msg right adjusted message
+ * @param len lenght of the message
+ * @param speed clock speed in Hz
+ *
+ * @return message read
+ */
+uint32_t as_spi_msg(int fd,
+ uint32_t msg,
+ size_t len,
+ uint32_t speed);
+
+/** @brief Close a SPI bus.
+ *
+ */
+void as_spi_close(int fd);
+
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+#endif // AS_SPI_H_
+
diff --git a/target/packages/as_devices/cpp/as_apf27_gpio.cpp b/target/packages/as_devices/cpp/as_apf27_gpio.cpp
index 040f987..f9b19e9 100644
--- a/target/packages/as_devices/cpp/as_apf27_gpio.cpp
+++ b/target/packages/as_devices/cpp/as_apf27_gpio.cpp
@@ -20,7 +20,7 @@
*/
#include "as_apf27_gpio.hpp"
-static AsDynamicTable AsApf27Gpio::mInstances = new AsDynamicTable();
+AsDynamicTable * AsApf27Gpio::mInstances = new AsDynamicTable();
/*------------------------------------------------------------------------------*/
/** Singleton constructor
@@ -47,7 +47,7 @@ AsApf27Gpio::getInstance(char aPortLetter)
AsApf27Gpio::AsApf27Gpio(char aPortLetter)
{
mPortLetter = aPortLetter;
- as_apf27_gpio_init(aPortChar);
+ as_apf27_gpio_init(aPortLetter);
}
/*------------------------------------------------------------------------------*/
diff --git a/target/packages/as_devices/cpp/as_dynamic_table.hpp b/target/packages/as_devices/cpp/as_dynamic_table.hpp
index 7a18e8e..024c00c 100644
--- a/target/packages/as_devices/cpp/as_dynamic_table.hpp
+++ b/target/packages/as_devices/cpp/as_dynamic_table.hpp
@@ -22,6 +22,8 @@
#ifndef __ASDYNAMICTABLE_HPP_
#define __ASDYNAMICTABLE_HPP_
+#include <stdio.h>
+
class AsDynamicTable {
public:
AsDynamicTable()
diff --git a/target/packages/as_devices/cpp/as_i2c.cpp b/target/packages/as_devices/cpp/as_i2c.cpp
index fdbeb7d..cadad77 100644
--- a/target/packages/as_devices/cpp/as_i2c.cpp
+++ b/target/packages/as_devices/cpp/as_i2c.cpp
@@ -31,13 +31,13 @@ AsI2c *
AsI2c::getInstance(int aBusNumber)
{
AsI2c * instance;
- instance = mInstances->getInstance(aBusNumber);
+ instance = (AsI2c *)mInstances->getInstance(aBusNumber);
if(instance == NULL)
{
- instance = AsI2c(aBusNumber);
+ instance = new AsI2c(aBusNumber);
mInstances->setInstance(instance,aBusNumber);
}
- return instance
+ return instance;
}
/*------------------------------------------------------------------------------*/
@@ -51,7 +51,7 @@ AsI2c::AsI2c(int aBusNumber)
ret = as_i2c_init(aBusNumber);
if (ret < 0)
{
- cout << "AsI2C initialization error" << endl;
+ std::cout << "AsI2C initialization error" << std::endl;
}
}
/*------------------------------------------------------------------------------*/
hooks/post-receive
--
armadeus
|
|
From: Julien B a. A. <ar...@us...> - 2009-11-19 16:04:35
|
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 70db9a135716bee90b209a7e6d3bef279693497a (commit)
via 93e6b71cbf9731fcd1b6cdeb946fc97979cad682 (commit)
from 2588da1dd7cfe6f6c6d035a9d911e424fc99966b (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 70db9a135716bee90b209a7e6d3bef279693497a
Merge: 93e6b71cbf9731fcd1b6cdeb946fc97979cad682 2588da1dd7cfe6f6c6d035a9d911e424fc99966b
Author: Julien Boibessot <jul...@ar...>
Date: Thu Nov 19 17:02:59 2009 +0100
Merge branch 'master' of ssh://artemys@armadeus.git.sourceforge.net/gitroot/armadeus/armadeus
commit 93e6b71cbf9731fcd1b6cdeb946fc97979cad682
Author: Julien Boibessot <jul...@ar...>
Date: Wed Oct 7 14:58:45 2009 +0200
[LINUX] Removes compilation warning in apf9328 when max1027 is not selected
-----------------------------------------------------------------------
Summary of changes:
.../2.6.29/021-armadeus-apf9328.patch | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/021-armadeus-apf9328.patch b/buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/021-armadeus-apf9328.patch
index 0afb8fb..2f6dfee 100644
--- a/buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/021-armadeus-apf9328.patch
+++ b/buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/021-armadeus-apf9328.patch
@@ -1,10 +1,10 @@
PATCH AUTOMATICALLY GENERATED
DON'T EDIT IT OR YOUR MODIFICATIONS WILL BE LOST
(Take a look at armadeus/target/linux/ directory to know how to generate it)
-Index: linux-2.6.29.4/arch/arm/mach-imx/apf9328.c
+Index: linux-2.6.29.6/arch/arm/mach-imx/apf9328.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.29.4/arch/arm/mach-imx/apf9328.c 2009-08-18 13:53:44.000000000 +0200
++++ linux-2.6.29.6/arch/arm/mach-imx/apf9328.c 2009-10-07 14:48:32.000000000 +0200
@@ -0,0 +1,635 @@
+/*
+ * linux/arch/arm/mach-imx/apf9328.c
@@ -451,8 +451,8 @@ Index: linux-2.6.29.4/arch/arm/mach-imx/apf9328.c
+#endif /* CONFIG_ARMADEUS_MAX1027 */
+
+
-+static struct spi_board_info spi_board_info[] __initdata = {
+#ifdef CONFIG_ARMADEUS_MAX1027
++static struct spi_board_info spi_board_info[] __initdata = {
+{
+ .modalias = "max1027",
+ .controller_data= &max1027_hw,
@@ -463,8 +463,8 @@ Index: linux-2.6.29.4/arch/arm/mach-imx/apf9328.c
+ .irq = IRQ_GPIOA(MAX1027_EOC_INT),
+ .platform_data = &apf9328_max1027_config,
+},
-+#endif
+};
++#endif
+
+#ifdef CONFIG_IMX_BACKLIGHT
+static struct imxbl_machinfo imx_bl_machinfo = {
@@ -641,10 +641,10 @@ Index: linux-2.6.29.4/arch/arm/mach-imx/apf9328.c
+ .timer = &imx_timer,
+ .init_machine = apf9328_init,
+MACHINE_END
-Index: linux-2.6.29.4/arch/arm/mach-imx/apf9328_lcd_config.h
+Index: linux-2.6.29.6/arch/arm/mach-imx/apf9328_lcd_config.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.29.4/arch/arm/mach-imx/apf9328_lcd_config.h 2009-08-17 11:04:40.000000000 +0200
++++ linux-2.6.29.6/arch/arm/mach-imx/apf9328_lcd_config.h 2009-10-02 08:54:08.000000000 +0200
@@ -0,0 +1,301 @@
+/*
+ *
@@ -947,10 +947,10 @@ Index: linux-2.6.29.4/arch/arm/mach-imx/apf9328_lcd_config.h
+#endif /* CONFIG_FB_IMX */
+
+#endif /* APF_LCD_CONFIG_H */
-Index: linux-2.6.29.4/arch/arm/mach-imx/include/mach/apf9328.h
+Index: linux-2.6.29.6/arch/arm/mach-imx/include/mach/apf9328.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.29.4/arch/arm/mach-imx/include/mach/apf9328.h 2009-08-18 13:55:07.000000000 +0200
++++ linux-2.6.29.6/arch/arm/mach-imx/include/mach/apf9328.h 2009-10-02 08:54:08.000000000 +0200
@@ -0,0 +1,68 @@
+/*
+ * linux/include/asm-arm/arch-imx/apf9328.h
@@ -1020,10 +1020,10 @@ Index: linux-2.6.29.4/arch/arm/mach-imx/include/mach/apf9328.h
+#endif
+
+#endif /* __ASM_ARCH_APF9328_H */
-Index: linux-2.6.29.4/arch/arm/mach-imx/apf9328-dev.c
+Index: linux-2.6.29.6/arch/arm/mach-imx/apf9328-dev.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.29.4/arch/arm/mach-imx/apf9328-dev.c 2009-08-18 13:56:55.000000000 +0200
++++ linux-2.6.29.6/arch/arm/mach-imx/apf9328-dev.c 2009-10-02 08:54:08.000000000 +0200
@@ -0,0 +1,281 @@
+/*
+ * linux/arch/arm/mach-imx/apf9328-dev.c
hooks/post-receive
--
armadeus
|
|
From: Julien B a. A. <ar...@us...> - 2009-11-18 07:47:51
|
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 2588da1dd7cfe6f6c6d035a9d911e424fc99966b (commit)
via 325da3fe9b60ab19127d9c3e493df94bc0f57e2c (commit)
from 0a74a183b123d72998709f042616a7178f94f16e (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 2588da1dd7cfe6f6c6d035a9d911e424fc99966b
Merge: 325da3fe9b60ab19127d9c3e493df94bc0f57e2c 0a74a183b123d72998709f042616a7178f94f16e
Author: Julien Boibessot <jul...@ar...>
Date: Tue Nov 17 22:38:08 2009 +0100
Merge branch 'master' of ssh://artemys@armadeus.git.sourceforge.net/gitroot/armadeus/armadeus
commit 325da3fe9b60ab19127d9c3e493df94bc0f57e2c
Author: Julien Boibessot <jul...@ar...>
Date: Tue Nov 17 22:37:38 2009 +0100
[BUILDROOT] ldd wasn't installed anymore in rootfs, correct that (Buildroot upstream patch)
-----------------------------------------------------------------------
Summary of changes:
...091-ldd-make_it_installed_again_in_rootfs.patch | 35 ++++++++++++++++++++
1 files changed, 35 insertions(+), 0 deletions(-)
create mode 100644 patches/buildroot/091-ldd-make_it_installed_again_in_rootfs.patch
diff --git a/patches/buildroot/091-ldd-make_it_installed_again_in_rootfs.patch b/patches/buildroot/091-ldd-make_it_installed_again_in_rootfs.patch
new file mode 100644
index 0000000..38e1c99
--- /dev/null
+++ b/patches/buildroot/091-ldd-make_it_installed_again_in_rootfs.patch
@@ -0,0 +1,35 @@
+commit: http://git.buildroot.net/buildroot/commit/?id=09d62e89e761a238cc4c04108e74be3abdd391c1
+branch: http://git.buildroot.net/buildroot/commit/?id=refs/heads/master
+
+Reported by Julien Boibessot <jul...@fr...>.
+
+This somehow got disabled by cb815ae003d40cc971d (two years ago!).
+
+Signed-off-by: Peter Korsgaard <ja...@su...>
+---
+ toolchain/uClibc/uclibc.mk | 3 +--
+ 1 files changed, 1 insertions(+), 2 deletions(-)
+
+diff --git a/toolchain/uClibc/uclibc.mk b/toolchain/uClibc/uclibc.mk
+index 74b058d..62fc40b 100644
+--- a/toolchain/uClibc/uclibc.mk
++++ b/toolchain/uClibc/uclibc.mk
+@@ -581,8 +581,7 @@ uclibc-clean: uclibc-test-clean
+ uclibc-dirclean: uclibc-test-dirclean
+ rm -rf $(UCLIBC_DIR)
+
+-uclibc-target-utils:
+-#$(TARGET_DIR)/usr/bin/ldd
++uclibc-target-utils: $(TARGET_DIR)/usr/bin/ldd
+
+ uclibc-target-utils-source: $(DL_DIR)/$(UCLIBC_SOURCE)
+
+--
+1.6.3.3
+
+_______________________________________________
+buildroot mailing list
+bui...@bu...
+http://lists.busybox.net/mailman/listinfo/buildroot
+
+
hooks/post-receive
--
armadeus
|
|
From: Nicolas <th...@us...> - 2009-11-17 17:51:29
|
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 0a74a183b123d72998709f042616a7178f94f16e (commit)
from c5818fd66025f283068b88b49dfd293408a870aa (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 0a74a183b123d72998709f042616a7178f94f16e
Author: nicolas colombain <nic...@ar...>
Date: Tue Nov 17 18:51:04 2009 +0100
[LINUX]fix vertical alignment bug
-----------------------------------------------------------------------
Summary of changes:
...rmadeus-add_TX12D17VM1BDP_to_mxcfb_modedb.patch | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/286d-apf27-armadeus-add_TX12D17VM1BDP_to_mxcfb_modedb.patch b/buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/286d-apf27-armadeus-add_TX12D17VM1BDP_to_mxcfb_modedb.patch
index 93c5ac0..95b2ba8 100644
--- a/buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/286d-apf27-armadeus-add_TX12D17VM1BDP_to_mxcfb_modedb.patch
+++ b/buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/286d-apf27-armadeus-add_TX12D17VM1BDP_to_mxcfb_modedb.patch
@@ -13,7 +13,7 @@ Index: linux-2.6.29.6/drivers/video/mxc/mxcfb_modedb.c
+ .yres = 480,
+ .pixclock = 40000, /* picoS */
+ .left_margin = 80, .right_margin = 48, /* at least 3 & 1 */
-+ .upper_margin = 10, .lower_margin = 35,
++ .upper_margin = 11, .lower_margin = 34,
+ .hsync_len = 64, .vsync_len = 2,
+ .sync = FB_SYNC_CLK_IDLE_EN | FB_SYNC_OE_ACT_HIGH | FB_SYNC_CLK_INVERT,
+ .vmode = FB_VMODE_NONINTERLACED,
hooks/post-receive
--
armadeus
|
|
From: Julien B a. A. <ar...@us...> - 2009-11-15 19:06:51
|
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 c5818fd66025f283068b88b49dfd293408a870aa (commit)
via 0d8cec2953ea69984c9f020f6ec02e9351a9a5a9 (commit)
via 5d6d7cea8a7e645a120b3c5364e41f1efe22db10 (commit)
via ae357ab994972a9486a5d7f97d499a74415e3e17 (commit)
from 431472083eb67eaca4f4df32c1c397da59d9b983 (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 c5818fd66025f283068b88b49dfd293408a870aa
Author: Julien Boibessot <jul...@ar...>
Date: Sun Nov 15 20:06:09 2009 +0100
[LINUX] Sometimes TSC210x may need a reset before asking revision number
commit 0d8cec2953ea69984c9f020f6ec02e9351a9a5a9
Author: Julien Boibessot <jul...@ar...>
Date: Sun Nov 15 20:00:06 2009 +0100
[LINUX] Continue to better separate apf27.c and apf27-dev.c platform files
commit 5d6d7cea8a7e645a120b3c5364e41f1efe22db10
Author: Julien Boibessot <jul...@ar...>
Date: Sun Nov 15 19:44:11 2009 +0100
Indentation
commit ae357ab994972a9486a5d7f97d499a74415e3e17
Author: Julien Boibessot <jul...@ar...>
Date: Mon Nov 2 21:37:17 2009 +0100
[DEMOS] Updates input_test Makefile
-----------------------------------------------------------------------
Summary of changes:
.../2.6.29/073-armadeus-tsc2102.patch | 98 ++-
.../2.6.29/281-apf27-armadeus-add_apf27.c.patch | 839 ++++++++++----------
target/demos/input_test/Makefile | 2 +-
target/packages/as_devices/cpp/as_max1027.cpp | 20 +-
4 files changed, 474 insertions(+), 485 deletions(-)
diff --git a/buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/073-armadeus-tsc2102.patch b/buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/073-armadeus-tsc2102.patch
index 76fe944..0902885 100644
--- a/buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/073-armadeus-tsc2102.patch
+++ b/buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/073-armadeus-tsc2102.patch
@@ -1,13 +1,15 @@
PATCH AUTOMATICALLY GENERATED
DON'T EDIT IT OR YOUR MODIFICATIONS WILL BE LOST
(Take a look at armadeus/target/linux/ directory to know how to generate it)
---- linux-2.6.27.13.original/include/linux/spi/tsc2102.h
-+++ linux-2.6.27.13.mod/include/linux/spi/tsc2102.h
+Index: linux-2.6.29.6/include/linux/spi/tsc2102.h
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.29.6/include/linux/spi/tsc2102.h 2009-11-10 13:37:50.000000000 +0100
@@ -0,0 +1,299 @@
+/*
+ * include/linux/spi/tsc2102.h
+ *
-+ * TI TSC2102 Touchscreen, Audio and Battery control register definitions
++ * TI TSC2102 Touchscreen, Audio and Battery control register definitions
+ *
+ * Copyright (c) 2005 Andrzej Zaborowski <ba...@za...>
+ *
@@ -39,7 +41,7 @@ DON'T EDIT IT OR YOUR MODIFICATIONS WILL BE LOST
+ /* Report status to APM based on battery[] */
+ void *alsa_config; /* .platform_data for the ALSA device */
+ int (*init)(void); /* allocate GPIOs */
-+ void (*exit)(void);
++ void (*exit)(void);
+};
+
+#define TSC_BAT1 (1 << 0)
@@ -303,19 +305,18 @@ DON'T EDIT IT OR YOUR MODIFICATIONS WILL BE LOST
+};
+
+#endif /* __LINUX_SPI_TSC2102_H */
-PATCH AUTOMATICALLY GENERATED
-DON'T EDIT IT OR YOUR MODIFICATIONS WILL BE LOST
-(Take a look at armadeus/target/linux/ directory to know how to generate it)
---- linux-2.6.27.13.original/drivers/spi/tsc2102.c
-+++ linux-2.6.27.13.mod/drivers/spi/tsc2102.c
-@@ -0,0 +1,1114 @@
+Index: linux-2.6.29.6/drivers/spi/tsc2102.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.29.6/drivers/spi/tsc2102.c 2009-11-10 13:41:13.000000000 +0100
+@@ -0,0 +1,1125 @@
+/*
+ * drivers/spi/tsc2102.c
+ *
+ * TSC2102 interface driver.
+ * Copyright (C) 2008 Armadeus systems (nc)
+ * -> spi communication reworked to avoid deadlock
-+ * Copyright (c) 2005 Andrzej Zaborowski <ba...@za...>
++ * Copyright (c) 2005 Andrzej Zaborowski <ba...@za...>
+ *
+ * This package is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
@@ -514,7 +515,9 @@ DON'T EDIT IT OR YOUR MODIFICATIONS WILL BE LOST
+u16 tsc210x_read_sync(int page, u8 address)
+{
+ u16 ret;
++
+ tsc210x_reads_sync(page, address, &ret, 1);
++
+ return ret;
+}
+
@@ -525,42 +528,41 @@ DON'T EDIT IT OR YOUR MODIFICATIONS WILL BE LOST
+#define T1STAT (1<<2)
+
+ int status;
-+
++
+ mutex_lock(&tsc.lock_sync);
+
+ /* state of SM has to be changed ? */
-+ if( test_and_clear_bit( WORK_CHANGE_MODE,&tsc.todo) ){
++ if (test_and_clear_bit(WORK_CHANGE_MODE, &tsc.todo)) {
+ tsc210x_write_sync(TSC2102_TS_ADC_CTRL, TSC2102_ADC_ADST);
+ /* change state of SM */
-+ if( tsc.state == SM_TEMP1 ){
++ if (tsc.state == SM_TEMP1) {
+ tsc.state = SM_BAT_AUX;
-+ tsc210x_write_sync(TSC2102_TS_STATUS_CTRL,
-+ TSC2102_ADC_DAV);
-+ tsc210x_write_sync(TSC2102_TS_ADC_CTRL,
-+ TSC2102_ADC_SCAN_CONTROL);
-+ }
-+ else{
++ tsc210x_write_sync(TSC2102_TS_STATUS_CTRL,
++ TSC2102_ADC_DAV);
++ tsc210x_write_sync(TSC2102_TS_ADC_CTRL,
++ TSC2102_ADC_SCAN_CONTROL);
++ } else {
+ tsc.state = SM_TEMP1;
-+ tsc210x_write_sync(TSC2102_TS_STATUS_CTRL,
-+ TSC2102_ADC_DAV);
-+ tsc210x_write_sync(TSC2102_TS_ADC_CTRL,
-+ TSC2102_ADC_T1_CONTROL);
++ tsc210x_write_sync(TSC2102_TS_STATUS_CTRL,
++ TSC2102_ADC_DAV);
++ tsc210x_write_sync(TSC2102_TS_ADC_CTRL,
++ TSC2102_ADC_T1_CONTROL);
+ }
+ /* restart mode timer */
+ mod_timer(&tsc.mode_timer, jiffies +
+ msecs_to_jiffies(tsc.mode_msecs));
+ }
+ status = tsc210x_read_sync(TSC2102_TS_STATUS_CTRL);
-+
++
+ if (status & Z2STAT) {
+ /* get pendown status */
-+ int pendown = tsc210x_read_sync(TSC2102_TS_ADC_CTRL) & TSC2102_ADC_PSTCM;
++ int pendown = tsc210x_read_sync(TSC2102_TS_ADC_CTRL) & TSC2102_ADC_PSTCM;
+ /* postponed next interrupt to avoid processor overload */
+ msleep(3);
-+ tsc210x_reads_sync( TSC2102_TS_X, tsc.adc_data, 4);
++ tsc210x_reads_sync(TSC2102_TS_X, tsc.adc_data, 4);
+ /* avoid sending data if pen is up*/
-+ if (tsc.coords_cb && pendown){
-+ tsc.coords_cb(tsc.adc_data[0], tsc.adc_data[1],
++ if (tsc.coords_cb && pendown) {
++ tsc.coords_cb(tsc.adc_data[0], tsc.adc_data[1],
+ tsc.adc_data[2], tsc.adc_data[3]);
+ }
+ }
@@ -568,25 +570,25 @@ DON'T EDIT IT OR YOUR MODIFICATIONS WILL BE LOST
+ if (status & AXSTAT) {
+ tsc210x_reads_sync(TSC2102_TS_BAT1, tsc.adc_data, 4);
+ if (tsc.ports_cb)
-+ tsc.ports_cb(tsc.adc_data[0], tsc.adc_data[1],
++ tsc.ports_cb(tsc.adc_data[0], tsc.adc_data[1],
+ tsc.adc_data[2]);
+ tsc.bat[0] = tsc.adc_data[0];
+ tsc.bat[1] = tsc.adc_data[1];
+ tsc.aux[0] = tsc.adc_data[2];
+ tsc.aux[1] = tsc.adc_data[3];
+ /* switch to pintdav and TS control */
-+ tsc210x_write_sync(TSC2102_TS_ADC_CTRL,
++ tsc210x_write_sync(TSC2102_TS_ADC_CTRL,
+ TSC2102_ADC_TS_CONTROL);
-+ tsc210x_write_sync(TSC2102_TS_STATUS_CTRL, TSC2102_ADC_PINTDAV);
++ tsc210x_write_sync(TSC2102_TS_STATUS_CTRL, TSC2102_ADC_PINTDAV);
+ }
+ else if (status & T1STAT) {
-+ tsc.temp = tsc210x_read_sync(TSC2102_TS_TEMP1);
++ tsc.temp = tsc210x_read_sync(TSC2102_TS_TEMP1);
+ if (tsc.temp1_cb)
+ tsc.temp1_cb(tsc.temp);
+ /* switch to pintdav and TS control */
-+ tsc210x_write_sync( TSC2102_TS_ADC_CTRL,
++ tsc210x_write_sync( TSC2102_TS_ADC_CTRL,
+ TSC2102_ADC_TS_CONTROL);
-+ tsc210x_write_sync(TSC2102_TS_STATUS_CTRL, TSC2102_ADC_PINTDAV);
++ tsc210x_write_sync(TSC2102_TS_STATUS_CTRL, TSC2102_ADC_PINTDAV);
+ }
+
+ mutex_unlock(&tsc.lock_sync);
@@ -655,6 +657,7 @@ DON'T EDIT IT OR YOUR MODIFICATIONS WILL BE LOST
+static void tsc2102_mode(unsigned long data)
+{
+ struct tsc210x_dev *dev = (struct tsc210x_dev *) data;
++
+// if(!test_bit( PENDOWN,&dev->todo)){
+ /* request change of SM state */
+ set_bit(WORK_CHANGE_MODE, &dev->todo);
@@ -666,17 +669,20 @@ DON'T EDIT IT OR YOUR MODIFICATIONS WILL BE LOST
+static irqreturn_t tsc2102_handler(int irq, void *dev_id)
+{
+ struct tsc210x_dev *dev = (struct tsc210x_dev *) dev_id;
++
+ /* restart pen up timer */
-+ mod_timer(&tsc.ts_timer, jiffies +
++ mod_timer(&tsc.ts_timer, jiffies +
+ msecs_to_jiffies(tsc.ts_msecs));
-+
++
+ schedule_work(&dev->work);
++
+ return IRQ_HANDLED;
+}
+
+static void tsc2102_pressure(unsigned long data)
+{
+ struct tsc210x_dev *dev = (struct tsc210x_dev *) data;
++
+ //printk("pen up\n");
+ //clear_bit(PENDOWN, &dev->todo);
+ if (dev->touch_cb)
@@ -837,7 +843,7 @@ DON'T EDIT IT OR YOUR MODIFICATIONS WILL BE LOST
+ } else { /* 48000 */
+ switch(mclk)
+ {
-+ case 12288000:
++ case 12288000:
+ /*pll->pll1 = (PLL1_Q_VAL(2)) -> doesn't work without enabling PLL */
+ pll->pll1 = (PLL1_PLLEN | PLL1_Q_VAL(0) | PLL1_P_VAL(1) | PLL1_J_VAL(8));
+ pll->pll2 = (PLL2_D_VAL(0));
@@ -962,10 +968,15 @@ DON'T EDIT IT OR YOUR MODIFICATIONS WILL BE LOST
+EXPORT_SYMBOL(tsc210x_set_i2s_master);
+#endif /* CONFIG_SOUND || CONFIG_SOUND_MODULE */
+
++static void tsc210x_reset(void)
++{
++ tsc210x_write_sync(TSC2102_TS_RESET_CTRL, TSC2102_RESET);
++}
++
+static int tsc2102_configure(struct tsc210x_dev *dev)
+{
+ /* Reset the chip */
-+ tsc210x_write_sync(TSC2102_TS_RESET_CTRL, TSC2102_RESET);
++ tsc210x_reset();
+
+ /* Reference mode, 100 usec delay, 2.5V reference */
+ if (dev->pdata->use_internal)
@@ -1009,7 +1020,7 @@ DON'T EDIT IT OR YOUR MODIFICATIONS WILL BE LOST
+#endif /* CONFIG_SOUND || CONFIG_SOUND_MODULE */
+
+ /* Init mode state machine */
-+ dev->state = SM_BAT_AUX;
++ dev->state = SM_BAT_AUX;
+
+ /* Start mode timer */
+ mod_timer(&dev->mode_timer, jiffies +
@@ -1233,7 +1244,7 @@ DON'T EDIT IT OR YOUR MODIFICATIONS WILL BE LOST
+ err = -EPERM;
+ goto done;
+ }
-+
++
+ clk_enable(tsc.bclk_ck);
+#else
+ /* Retrieve Master Clock from platform data */
@@ -1244,7 +1255,7 @@ DON'T EDIT IT OR YOUR MODIFICATIONS WILL BE LOST
+#endif /* CONFIG_TSC_SLAVE */
+
+ if (request_irq(spi->irq, tsc2102_handler, IRQF_DISABLED | IRQF_SHARED | IRQF_TRIGGER_FALLING, "tsc2102", &tsc)) {
-+ printk(KERN_ERR "Could not allocate touchscreen IRQ (n %d)\n", spi->irq);
++ printk(KERN_ERR "Couldn't allocate touchscreen IRQ (%d)\n", spi->irq);
+ err = -EINVAL;
+ goto err_clk;
+ }
@@ -1264,6 +1275,7 @@ DON'T EDIT IT OR YOUR MODIFICATIONS WILL BE LOST
+ goto err_timer;
+
+ /* Now try to detect the chip, make first contact */
++ tsc210x_reset(); /* Seems like TSC can be messed up and needs a reset even to get revision */
+ rev_id = tsc2102_get_revision();
+ if (rev_id == 0x01) {
+ printk("TSC2102 detected\n");
@@ -1368,7 +1380,7 @@ DON'T EDIT IT OR YOUR MODIFICATIONS WILL BE LOST
+
+ del_timer(&tsc.mode_timer);
+ del_timer(&tsc.ts_timer);
-+ flush_scheduled_work();
++ flush_scheduled_work();
+
+#if defined(CONFIG_HWMON) || defined(CONFIG_HWMON_MODULE)
+ hwmon_device_unregister(dev->hwmondev);
diff --git a/buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/281-apf27-armadeus-add_apf27.c.patch b/buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/281-apf27-armadeus-add_apf27.c.patch
index e9e803c..0e24515 100644
--- a/buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/281-apf27-armadeus-add_apf27.c.patch
+++ b/buildroot/target/device/armadeus/linux/kernel-patches/2.6.29/281-apf27-armadeus-add_apf27.c.patch
@@ -9,11 +9,13 @@ Signed-off-by: Eric Jarrige <eri...@ar...>
Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.29.6/arch/arm/mach-mx2/apf27.c 2009-10-11 21:52:46.000000000 +0200
-@@ -0,0 +1,1090 @@
++++ linux-2.6.29.6/arch/arm/mach-mx2/apf27.c 2009-11-13 23:22:19.000000000 +0100
+@@ -0,0 +1,737 @@
+ /*
+ * apf27.c
+ *
++ * Support for the APF27 System On Module
++ *
+ * Copyright (C) 2008 Armadeus Systems
+ * Authors: Julien Boibessot <jul...@ar...>
+ * Eric Jarrige <eri...@ar...>
@@ -39,7 +41,6 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27.c
+#include <linux/platform_device.h>
+#include <linux/mtd/physmap.h>
+#include <asm/mach/flash.h>
-+#include <linux/spi/spi.h>
+#include <linux/i2c.h>
+#include <linux/serial.h>
+#include <linux/delay.h>
@@ -57,32 +58,11 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27.c
+#include <mach/iomux-mx1-mx2.h>
+#include <mach/gpio.h>
+#include <mach/imx_i2c.h>
-+//#include <mach/imx_spi.h>
-+#include <../mach-imx/include/mach/spi_imx.h>
+#include <mach/imx-uart.h>
-+#include <mach/mmc.h>
-+#ifdef CONFIG_FB_MXC /* Freescale Framebuffer */
-+#include <mach/imx_fb.h>
-+#include <mach/imxfb.h>
-+#endif
-+#include <linux/fb.h>
+#include <mach/mxc_nand.h>
+#include <mach/mxc_ehci.h>
+#include <mach/ulpi.h>
-+#include <linux/spi/max1027.h>
-+#include <linux/spi/tsc2102.h>
-+#include "../../../drivers/net/can/mcp251x.h"
+#include "../../../drivers/armadeus/pwm/pwm.h"
-+#include <media/ad9889.h>
-+#if defined(CONFIG_SND) || defined (CONFIG_SND_MODULE)
-+#include <mach/imx_dam.h>
-+#include <mach/imx_sound.h>
-+#include <mach/imx_ssi.h>
-+#include <mach/imx-alsa.h>
-+#endif
-+#if defined(CONFIG_VIDEO_MX27_MODULE) || defined(CONFIG_VIDEO_MX27)
-+#include <mach/imx_cam.h>
-+#endif
+#if defined(CONFIG_CPU_FREQ_IMX27) || defined(CONFIG_CPU_FREQ_IMX27_MODULE)
+#include "cpufreq_imx.h"
+#endif
@@ -191,6 +171,7 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27.c
+ .exit = apf27_i2c_1_exit,
+};
+
++/* APF27 has an I2C EEPROM */
+static struct i2c_board_info apf27_i2c_devices_bus1[] = {
+ [0] = {
+ .type = "24c02",
@@ -203,61 +184,6 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27.c
+#endif /* CONFIG_I2C */
+
+
-+#ifdef CONFIG_SPI
-+static int mxc_cspi0_pins[] = {
-+ /* PD28_PF_CSPI1_SS0, Preferably use a GPIO for CS */
-+ PD29_PF_CSPI1_SCLK,
-+ PD30_PF_CSPI1_MISO,
-+ PD31_PF_CSPI1_MOSI
-+};
-+
-+static int mxc_cspi1_pins[] = {
-+ /*PD19_PF_CSPI2_SS2,
-+ PD20_PF_CSPI2_SS1, Preferably use a GPIO for CS
-+ PD21_PF_CSPI2_SS0, */
-+ PD22_PF_CSPI2_SCLK,
-+ PD23_PF_CSPI2_MISO,
-+ PD24_PF_CSPI2_MOSI
-+};
-+
-+static int gpio_spi0_active(struct platform_device *pdev)
-+{
-+ return mxc_gpio_setup_multiple_pins(mxc_cspi0_pins, ARRAY_SIZE(mxc_cspi0_pins), "CSPI0");
-+}
-+
-+static int gpio_spi0_inactive(struct platform_device *pdev)
-+{
-+ mxc_gpio_release_multiple_pins(mxc_cspi0_pins, ARRAY_SIZE(mxc_cspi0_pins));
-+ return 0;
-+}
-+
-+static int gpio_spi1_active(struct platform_device *pdev)
-+{
-+ return mxc_gpio_setup_multiple_pins(mxc_cspi1_pins, ARRAY_SIZE(mxc_cspi1_pins), "CSPI1");
-+}
-+
-+static int gpio_spi1_inactive(struct platform_device *pdev)
-+{
-+ mxc_gpio_release_multiple_pins(mxc_cspi1_pins, ARRAY_SIZE(mxc_cspi1_pins));
-+ return 0;
-+}
-+
-+static struct spi_imx_master imx_spi0_master_info = {
-+ .num_chipselect = 1,
-+ .enable_dma = 0,
-+ .init = gpio_spi0_active,
-+ .exit = gpio_spi0_inactive,
-+};
-+
-+static struct spi_imx_master imx_spi1_master_info = {
-+ .num_chipselect = 2,
-+ .enable_dma = 0,
-+ .init = gpio_spi1_active,
-+ .exit = gpio_spi1_inactive,
-+};
-+#endif /* CONFIG_SPI */
-+
-+
+static int mxc_uart0_pins[] = {
+ PE12_PF_UART1_TXD,
+ PE13_PF_UART1_RXD
@@ -283,7 +209,8 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27.c
+
+static int mxc_uart2_pins[] = {
+ PE8_PF_UART3_TXD,
-+ PE9_PF_UART3_RXD,};
++ PE9_PF_UART3_RXD,
++};
+
+static int uart_mxc_port2_init(struct platform_device *pdev)
+{
@@ -303,6 +230,7 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27.c
+ .flags = 0,
+};
+
++/* APF27 has an onboard Ethernet PHY */
+#ifdef CONFIG_FEC_OLD
+static int mxc_fec_pins[] = {
+ PD0_AIN_FEC_TXD0,
@@ -337,100 +265,7 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27.c
+#endif /* CONFIG_FEC_OLD */
+
+
-+
-+#ifdef CONFIG_MMC_MXC
-+
-+# ifdef CONFIG_APF27_DEVTEST
-+static int mxc_sdhc1_pins[] = {
-+ PE18_PF_SDHC1_D0,
-+ PE19_PF_SDHC1_D1,
-+ PE20_PF_SDHC1_D2,
-+ PE21_PF_SDHC1_D3,
-+ PE22_PF_SDHC1_CMD,
-+ PE22_PF_SDHC1_CLK,
-+};
-+
-+static void apf27_sdhc1_init(struct device *dev)
-+{
-+ u16 data;
-+
-+ printk("apf27: configuring SDHC1 GPIOs\n");
-+ mxc_gpio_setup_multiple_pins(mxc_sdhc1_pins, ARRAY_SIZE(mxc_sdhc1_pins), "SDHC1");
-+ /* set 100k pull-down on sdhc1 dat3 pin (for card insertion/removal detection) */
-+ data = __raw_readw(IO_ADDRESS(SYSCTRL_BASE_ADDR + 0x54)); /* -> PSCR register */
-+ data &= ~(0x0c);
-+ __raw_writew(data, IO_ADDRESS(SYSCTRL_BASE_ADDR + 0x54));
-+ /* ?? enable clock ?? */
-+}
-+
-+static void apf27_sdhc1_exit(struct device *pdev)
-+{
-+ printk("apf27: unconfiguring SDHC1 GPIOs\n");
-+ mxc_gpio_release_multiple_pins(mxc_sdhc1_pins, ARRAY_SIZE(mxc_sdhc1_pins));
-+}
-+
-+static struct imxmmc_platform_data apf27_sdhc1_pdata = {
-+// .card_present = apf27_mmc_card_present,
-+ .clk = "sdhc_clk",
-+ .init = apf27_sdhc1_init,
-+ .exit = apf27_sdhc1_exit,
-+};
-+# endif /* CONFIG_APF27_DEVTEST */
-+
-+static int mxc_sdhc2_pins[] = {
-+ PB4_PF_SDHC2_D0,
-+ PB5_PF_SDHC2_D1,
-+ PB6_PF_SDHC2_D2,
-+ PB7_PF_SDHC2_D3,
-+ PB8_PF_SDHC2_CMD,
-+ PB9_PF_SDHC2_CLK,
-+};
-+
-+static int apf27_sdhc2_init(struct device *dev, irq_handler_t detect_irq, void *data)
-+{
-+ int ret;
-+
-+ printk("apf27: configuring SDHC2 GPIOs\n");
-+ mxc_gpio_setup_multiple_pins(mxc_sdhc2_pins, ARRAY_SIZE(mxc_sdhc2_pins), "SDHC2");
-+
-+ ret = request_irq(IRQ_GPIOC(14), detect_irq, 0, "imx-mmc-detect", data);
-+ if (ret)
-+ goto out_release_gpio;
-+ set_irq_type(IRQ_GPIOC(14), IRQ_TYPE_EDGE_BOTH);
-+
-+ return 0;
-+
-+out_release_gpio:
-+ mxc_gpio_release_multiple_pins(mxc_sdhc2_pins, ARRAY_SIZE(mxc_sdhc2_pins));
-+
-+ return ret;
-+}
-+
-+static void apf27_sdhc2_exit(struct device *dev, void *data)
-+{
-+ printk("apf27: unconfiguring SDHC2 GPIOs\n");
-+
-+ free_irq(IRQ_GPIOC(14), data);
-+ mxc_gpio_release_multiple_pins(mxc_sdhc2_pins, ARRAY_SIZE(mxc_sdhc2_pins));
-+}
-+
-+static struct imxmmc_platform_data apf27_sdhc2_pdata = {
-+/* .card_present = apf27_mmc_card_present,
-+ .clk = "sdhc_clk", */
-+ .init = apf27_sdhc2_init,
-+ .exit = apf27_sdhc2_exit,
-+};
-+
-+static inline void apf27_init_mmc(void)
-+{
-+# ifdef CONFIG_APF27_DEVTEST
-+ mxc_register_device(&mxc_sdhc_device0, &apf27_sdhc1_pdata);
-+# endif
-+ mxc_register_device(&mxc_sdhc_device1, &apf27_sdhc2_pdata);
-+}
-+#endif /* CONFIG_MMC_MXC */
-+
-+
++/* APF27 has an onboard PHY for OTG USB port */
+#ifdef CONFIG_USB_EHCI_MXC
+static int mxc_usbotg_pins[] = {
+ PE0_PF_USBOTG_NXT,
@@ -538,128 +373,8 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27.c
+struct mxc_usb2_platform_data ehci0_pdata = {
+ .init = apf27_usbotg_init,
+};
-+
-+static int mxc_usbh1_pins[] = {
-+ PB22_PF_USBH1_SUSP,
-+ PB23_PF_USB_PWR,
-+ PB24_PF_USB_OC_B,
-+ PB25_PF_USBH1_RCV,
-+ PB26_PF_USBH1_FS,
-+ PB27_PF_USBH1_OE_B,
-+ PB28_PF_USBH1_TXDM,
-+ PB29_PF_USBH1_TXDP,
-+ PB30_PF_USBH1_RXDM,
-+ PB31_PF_USBH1_RXDP
-+};
-+
-+static int apf27_usbh1_init(struct platform_device *pdev)
-+{
-+ int ret;
-+ uint32_t temp;
-+
-+ ret = mxc_gpio_setup_multiple_pins(mxc_usbh1_pins,
-+ ARRAY_SIZE(mxc_usbh1_pins), "usbh1");
-+ if (ret)
-+ return ret;
-+
-+ temp = readl(IO_ADDRESS(OTG_BASE_ADDR) + 0x600);
-+ pr_debug("USB_CTRL before: 0x%08x\n", temp);
-+ temp &= ~( (3 << 13) | (1 << 8) | 1 );
-+ temp |= (1 << 4) | (1 << 11) ;
-+ writel(temp, IO_ADDRESS(OTG_BASE_ADDR) + 0x600);
-+ pr_debug("USB_CTRL after: 0x%08x\n", temp);
-+
-+ temp = readl(IO_ADDRESS(OTG_BASE_ADDR) + 0x384);
-+ pr_debug("PORTSC1 before: 0x%08x\n", temp);
-+ temp &= ~(3 << 30);
-+ temp |= 3 << 30;
-+ writel(temp, IO_ADDRESS(OTG_BASE_ADDR) + 0x384);
-+ pr_debug("PORTSC1 after: 0x%08x\n", temp);
-+ mdelay(10);
-+
-+ temp = readl(IO_ADDRESS(OTG_BASE_ADDR) + 0x340);
-+ temp |= 0x02; /* reset controller */
-+ writel(temp, IO_ADDRESS(OTG_BASE_ADDR) + 0x340);
-+ pr_debug("reset controller: 0x%08x\n", temp);
-+ mdelay(10);
-+
-+ /* force port powerup in case of connected device */
-+ temp = readl(IO_ADDRESS(OTG_BASE_ADDR) + 0x384);
-+ pr_debug("PORTSC1 before: 0x%08x\n", temp);
-+ temp &= ~(1 << 12);
-+ temp |= 1 << 12;
-+ writel(temp, IO_ADDRESS(OTG_BASE_ADDR) + 0x384);
-+ mdelay(10);
-+
-+ return ret;
-+}
-+
-+struct mxc_usb2_platform_data ehci1_pdata = {
-+ .init = apf27_usbh1_init,
-+};
+#endif /* CONFIG_USB_EHCI_MXC */
+
-+#if defined(CONFIG_SND) || defined (CONFIG_SND_MODULE)
-+static int mxc_ssi1_pins[] = {
-+ PC20_PF_SSI1_FS,
-+ PC21_PF_SSI1_RXD,
-+ PC22_PF_SSI1_TXD,
-+ PC23_PF_SSI1_CLK,
-+};
-+
-+static int gpio_ssi1_active(struct platform_device *pdev)
-+{
-+ int err;
-+
-+ err = mxc_gpio_setup_multiple_pins(mxc_ssi1_pins,
-+ ARRAY_SIZE(mxc_ssi1_pins), "mx2-sound");
-+ if (err < 0)
-+ pr_err("Failed to register SSI pins\n");
-+
-+ return err;
-+}
-+
-+static int gpio_ssi1_inactive(struct platform_device *pdev)
-+{
-+ mxc_gpio_release_multiple_pins(mxc_ssi1_pins, ARRAY_SIZE(mxc_ssi1_pins));
-+ return 0;
-+}
-+
-+static struct imx_ssi_platform_data apf27_ssi0_pdata = {
-+ .init = gpio_ssi1_active,
-+ .exit = gpio_ssi1_inactive
-+};
-+
-+
-+static int apf27_late_init(void)
-+{
-+ mxc_register_device(&mxc_dam_device, NULL);
-+ mxc_register_device(&imx_ssi_device0, &apf27_ssi0_pdata);
-+
-+ return 0;
-+}
-+
-+late_initcall(apf27_late_init);
-+#endif /* CONFIG_SND || CONFIG_SND_MODULE */
-+
-+
-+#ifdef DEBUG
-+static void apf27_dump_clocks(void)
-+{
-+ printk("CSCR: 0x%08x\n", __raw_readl(CCM_CSCR));
-+ printk("MPCTL0: 0x%08x\n", __raw_readl(CCM_MPCTL0));
-+ printk("MPCTL1: 0x%08x\n", __raw_readl(CCM_MPCTL1));
-+ printk("SPCTL0: 0x%08x\n", __raw_readl(CCM_SPCTL0));
-+ printk("SPCTL1: 0x%08x\n", __raw_readl(CCM_SPCTL1));
-+ printk("OSC26: 0x%08x\n", __raw_readl(CCM_OSC26MCTL));
-+ printk("PCDR0: 0x%08x\n", __raw_readl(CCM_PCDR0));
-+ printk("PCDR1: 0x%08x\n", __raw_readl(CCM_PCDR1));
-+ printk("PCCR0: 0x%08x\n", __raw_readl(CCM_PCCR0));
-+ printk("PCCR1: 0x%08x\n", __raw_readl(CCM_PCCR1));
-+ printk("CCSR: 0x%08x\n", __raw_readl(CCM_CCSR));
-+}
-+#endif /* DEBUG */
-+
+
+/* APF27 frequency scaling stuff */
+#if defined(CONFIG_CPU_FREQ_IMX27) || defined(CONFIG_CPU_FREQ_IMX27_MODULE)
@@ -787,73 +502,9 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27.c
+};
+
+
-+/* Camera / CSI stuff */
-+#ifdef CONFIG_VIDEO_MX27
-+
-+# ifdef CONFIG_VIDEO_OV96xx
-+#define OV9653_PWDN (GPIO_PORTC | 30) /* SSI3_TX as POWERDOWN*/
-+#define OV9653_RESET (GPIO_PORTC | 31) /* SSI3_CLK as RESET */
-+
-+static int apf27dev_ov9653_ctl_pins[] = {
-+ (OV9653_PWDN | GPIO_OUT | GPIO_GPIO),
-+ (OV9653_RESET | GPIO_OUT | GPIO_GPIO),
-+};
-+# endif
-+
-+static int mxc_csi_pins[] = {
-+ PB10_PF_CSI_D0,
-+ PB11_PF_CSI_D1,
-+ PB12_PF_CSI_D2,
-+ PB13_PF_CSI_D3,
-+ PB14_PF_CSI_D4,
-+ PB15_PF_CSI_MCLK,
-+ PB16_PF_CSI_PIXCLK,
-+ PB17_PF_CSI_D5,
-+ PB18_PF_CSI_D6,
-+ PB19_PF_CSI_D7,
-+ PB20_PF_CSI_VSYNC,
-+ PB21_PF_CSI_HSYNC
-+};
-+
-+static int apf27_camera_init(struct platform_device *pdev)
-+{
-+# ifdef CONFIG_VIDEO_OV96xx
-+ /* To be put in ov96xx driver init part: */
-+ int err;
-+
-+ err = mxc_gpio_setup_multiple_pins(apf27dev_ov9653_ctl_pins,
-+ ARRAY_SIZE(apf27dev_ov9653_ctl_pins), "OV9653");
-+ if (err) {
-+ printk("Error %s", __func__);
-+ }
-+ gpio_set_value(OV9653_PWDN, 0);
-+ gpio_set_value(OV9653_RESET, 0);
-+# endif
-+
-+ return mxc_gpio_setup_multiple_pins(mxc_csi_pins,
-+ ARRAY_SIZE(mxc_csi_pins), "CSI");
-+}
-+
-+static int apf27_camera_exit(struct platform_device *pdev)
-+{
-+ mxc_gpio_release_multiple_pins(mxc_csi_pins, ARRAY_SIZE(mxc_csi_pins));
-+
-+ return 0;
-+}
-+
-+struct mx27_camera_platform_data apf27_camera = {
-+ .init = apf27_camera_init,
-+ .exit = apf27_camera_exit,
-+ .clk = 26600000,
-+ .flags = MX27_CAMERA_HSYNC_HIGH | MX27_CAMERA_GATED_CLOCK |
-+ MX27_CAMERA_PACK_DIR_MSB,
-+};
-+#endif /* CONFIG_VIDEO_MX27 */
-+
-+
+/* APF27 power management stuff */
+
-+static void gpio_pwr_ctl_active(void)
++static void apf27_pwr_ctl_active(void)
+{
+#ifdef CONFIG_FB_MXC
+ apf27_lcd_startup();
@@ -865,16 +516,20 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27.c
+#ifdef APF27_PM_DEBUG
+#define CCM_PCCR0 (IO_ADDRESS(CCM_BASE_ADDR) + 0x20)
+#define CCM_PCCR1 (IO_ADDRESS(CCM_BASE_ADDR) + 0x24)
-+static void dump_clocks(void)
-+{
-+ u32 reg;
+
-+ reg = __raw_readl(CCM_CSCR);
-+ printk("CSCR: 0x%08x\n", reg);
-+ reg = __raw_readl(CCM_PCCR0);
-+ printk("PCCR0: 0x%08x\n", reg);
-+ reg = __raw_readl(CCM_PCCR1);
-+ printk("PCCR1: 0x%08x\n", reg);
++static void apf27_dump_clocks(void)
++{
++ printk("CSCR: 0x%08x\n", __raw_readl(CCM_CSCR));
++ printk("MPCTL0: 0x%08x\n", __raw_readl(CCM_MPCTL0));
++ printk("MPCTL1: 0x%08x\n", __raw_readl(CCM_MPCTL1));
++ printk("SPCTL0: 0x%08x\n", __raw_readl(CCM_SPCTL0));
++ printk("SPCTL1: 0x%08x\n", __raw_readl(CCM_SPCTL1));
++ printk("OSC26: 0x%08x\n", __raw_readl(CCM_OSC26MCTL));
++ printk("PCDR0: 0x%08x\n", __raw_readl(CCM_PCDR0));
++ printk("PCDR1: 0x%08x\n", __raw_readl(CCM_PCDR1));
++ printk("PCCR0: 0x%08x\n", __raw_readl(CCM_PCCR0));
++ printk("PCCR1: 0x%08x\n", __raw_readl(CCM_PCCR1));
++ printk("CCSR: 0x%08x\n", __raw_readl(CCM_CCSR));
+}
+
+char port[6] = {'A', 'B', 'C', 'D', 'E', 'F'};
@@ -946,7 +601,7 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27.c
+ apf27_baseboard_suspend();
+#ifdef APF27_PM_DEBUG
+ apf27_force_gpios();
-+ dump_clocks();
++ apf27_dump_clocks();
+ dump_gpios();
+#endif
+ __raw_writel(0x0c090c0A, IO_ADDRESS(SYSCTRL_BASE_ADDR + 0x1c)); /* WBCR */
@@ -979,7 +634,8 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27.c
+};
+
+
-+/* FPGA */
++/* APF27 has an optional Spartan3A FPGA connected to i.MX27 address/data
++ busses */
+#ifdef CONFIG_MACH_APF27_FPGA
+static int fpga_pins[] = {
+ (APF27_FPGA_INT_PIN | GPIO_IN | GPIO_GPIO),
@@ -991,7 +647,7 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27.c
+
+ res = mxc_gpio_setup_multiple_pins(fpga_pins, ARRAY_SIZE(fpga_pins), "FPGA");
+ if (!res)
-+ set_irq_type(APF27_FPGA_IRQ, IRQF_TRIGGER_RISING);
++ set_irq_type(APF27_FPGA_IRQ, IRQ_TYPE_EDGE_RISING);
+
+ return res;
+}
@@ -1012,17 +668,19 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27.c
+};
+#endif /* CONFIG_MACH_APF27_FPGA */
+
++
+static void __init apf27_init(void)
+{
+ sysdev_class_register(&apf27_pm_sysclass);
+ sysdev_register(&apf27_pm_sysdev);
+
-+ /* init apf27dev power management related pins */
-+ gpio_pwr_ctl_active();
++ /* Init apf27 power management related pins */
++ apf27_pwr_ctl_active();
+
+#ifdef CONFIG_FEC_OLD
+ gpio_fec_active();
+#endif
++ /* UART1 and UART3 have "on module" tranceivers */
+ mxc_register_device(&mxc_uart_device0, &uart0_pdata); /* console */
+ mxc_register_device(&mxc_uart_device2, &uart2_pdata);
+
@@ -1036,7 +694,6 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27.c
+#endif
+#ifdef CONFIG_USB_EHCI_MXC
+ mxc_register_device(&mxc_otg, &ehci0_pdata);
-+ mxc_register_device(&mxc_ehci1, &ehci1_pdata);
+#endif
+#ifdef CONFIG_I2C
+ mxc_register_device(&imx_i2c_device0, &apf27_i2c_0_data);
@@ -1045,18 +702,8 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27.c
+ i2c_register_board_info(1, apf27_i2c_devices_bus1,
+ ARRAY_SIZE(apf27_i2c_devices_bus1));
+#endif
-+#ifdef CONFIG_SPI
-+ mxc_register_device(&mxc_spi_device0, &imx_spi0_master_info);
-+ mxc_register_device(&mxc_spi_device1, &imx_spi1_master_info);
-+#endif
+ platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
+
-+#ifdef CONFIG_MMC_MXC
-+ apf27_init_mmc();
-+#endif
-+#ifdef CONFIG_VIDEO_MX27
-+ mxc_register_device(&mx27_camera_device, &apf27_camera);
-+#endif
+#ifdef CONFIG_MACH_APF27_FPGA
+ mxc_register_device(&apf27_ocore_irq_mng_device, &apf27_fpga_irq);
+#endif
@@ -1104,11 +751,11 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27.c
Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27-dev.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.29.6/arch/arm/mach-mx2/apf27-dev.c 2009-10-11 21:52:46.000000000 +0200
-@@ -0,0 +1,650 @@
++++ linux-2.6.29.6/arch/arm/mach-mx2/apf27-dev.c 2009-11-15 19:50:35.000000000 +0100
+@@ -0,0 +1,976 @@
+ /*
+ * apf27-dev.c
-+ * Support of AFP27 module's development baseboard
++ * Support for AFP27 module's development baseboard
+ *
+ * Copyright (C) 2009 Armadeus Systems
+ * Authors: Julien Boibessot <jul...@ar...>
@@ -1221,8 +868,10 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27-dev.c
+
+#ifdef CONFIG_I2C
+
++/* I2C1 devices */
+static struct i2c_board_info apf27dev_i2c_devices_bus0[] = {
+ [0] = {
++ /* APF27Dev has an RTC */
+ .type = "ds1374",
+ .flags = 0, /* FIXME */
+ .addr = 0x68, /* E0=0, E1=1, E2=0 */
@@ -1240,6 +889,8 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27-dev.c
+# endif
+};
+
++
++/* APF27Dev contains an optionnal HDMI video output (I2C controlled) */
+# ifdef CONFIG_VIDEO_AD9889
+#define AD9889_INT 15
+
@@ -1333,9 +984,10 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27-dev.c
+ .data = &apf27_ad9889_fb_data,
+ .EDID_I2C_addr = 0x3f
+};
-+
+# endif /* CONFIG_VIDEO_AD9889 */
+
++
++/* I2C2 devices */
+static struct i2c_board_info apf27dev_i2c_devices_bus1[] = {
+# ifdef CONFIG_VIDEO_AD9889
+ [0] = {
@@ -1350,6 +1002,7 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27-dev.c
+#endif /* CONFIG_I2C */
+
+
++/* An optional GSM module can be added to APF27Dev (wireless extension board) */
+#ifdef CONFIG_GSM
+#define GSM_POK_IN (GPIO_PORTE | 11)
+static int mxc_uart1_pins[] = {
@@ -1357,7 +1010,7 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27-dev.c
+ PE4_PF_UART2_RTS,
+ PE6_PF_UART2_TXD,
+ PE7_PF_UART2_RXD,
-+ (GSM_POK_IN | GPIO_OUT | GPIO_GPIO ) /* GSM_PWR_ON_not */
++ (GSM_POK_IN | GPIO_OUT | GPIO_GPIO) /* GSM_PWR_ON_not */
+};
+
+static int uart_mxc_port1_init(struct platform_device *pdev)
@@ -1366,6 +1019,7 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27-dev.c
+ gpio_set_value(GSM_POK_IN, 0); /* start GSM */
+ mdelay(5000);
+ gpio_set_value(GSM_POK_IN, 1); /* start GSM */
++
+ return res;
+}
+
@@ -1383,6 +1037,8 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27-dev.c
+};
+#endif /* CONFIG_GSM */
+
++
++/* An optionnal GPS module can be added to APF27Dev (wireless extension board) */
+#ifdef CONFIG_GPS
+#define GPS_WAKEUP (GPIO_PORTB | 20)
+#define GPS_TIMEPULSE (GPIO_PORTB | 21)
@@ -1417,6 +1073,63 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27-dev.c
+#endif /* CONFIG_GPS */
+
+
++/* Both APF27 SPI ports are used on APF27Dev */
++#ifdef CONFIG_SPI
++static int mxc_cspi0_pins[] = {
++ /* PD28_PF_CSPI1_SS0, Preferably use CS pin as GPIO */
++ PD29_PF_CSPI1_SCLK,
++ PD30_PF_CSPI1_MISO,
++ PD31_PF_CSPI1_MOSI
++};
++
++static int mxc_cspi1_pins[] = {
++ /* PD19_PF_CSPI2_SS2,
++ PD20_PF_CSPI2_SS1, Preferably use CS pin as GPIO
++ PD21_PF_CSPI2_SS0, */
++ PD22_PF_CSPI2_SCLK,
++ PD23_PF_CSPI2_MISO,
++ PD24_PF_CSPI2_MOSI
++};
++
++static int gpio_spi0_active(struct platform_device *pdev)
++{
++ return mxc_gpio_setup_multiple_pins(mxc_cspi0_pins, ARRAY_SIZE(mxc_cspi0_pins), "CSPI0");
++}
++
++static int gpio_spi0_inactive(struct platform_device *pdev)
++{
++ mxc_gpio_release_multiple_pins(mxc_cspi0_pins, ARRAY_SIZE(mxc_cspi0_pins));
++ return 0;
++}
++
++static int gpio_spi1_active(struct platform_device *pdev)
++{
++ return mxc_gpio_setup_multiple_pins(mxc_cspi1_pins, ARRAY_SIZE(mxc_cspi1_pins), "CSPI1");
++}
++
++static int gpio_spi1_inactive(struct platform_device *pdev)
++{
++ mxc_gpio_release_multiple_pins(mxc_cspi1_pins, ARRAY_SIZE(mxc_cspi1_pins));
++ return 0;
++}
++
++static struct spi_imx_master imx_spi0_master_info = {
++ .num_chipselect = 1,
++ .enable_dma = 0,
++ .init = gpio_spi0_active,
++ .exit = gpio_spi0_inactive,
++};
++
++static struct spi_imx_master imx_spi1_master_info = {
++ .num_chipselect = 2,
++ .enable_dma = 0,
++ .init = gpio_spi1_active,
++ .exit = gpio_spi1_inactive,
++};
++#endif /* CONFIG_SPI */
++
++
++/* APF27Dev has an optionnal 7 channels 10 bits ADC (SPI) */
+#ifdef CONFIG_ARMADEUS_MAX1027
+#define MAX1027_EOC_INT 15
+#define MAX1027_CNVST 14
@@ -1442,14 +1155,14 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27-dev.c
+
+static void max1027_cs(u32 command)
+{
-+ if( command == SPI_CS_DEASSERT )
++ if (command == SPI_CS_DEASSERT)
+ gpio_set_value(MAX1027_CS, 1);
+ else
+ gpio_set_value(MAX1027_CS, 0);
+}
+
+static struct spi_imx_chip max1027_hw = {
-+ .cs_control = max1027_cs,
++ .cs_control = max1027_cs,
+};
+
+static struct max1027_config apf27_max1027_config = {
@@ -1462,22 +1175,38 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27-dev.c
+};
+#endif /* CONFIG_ARMADEUS_MAX1027 */
+
-+#ifdef CONFIG_SPI_TSC2102
++
++/* APF27Dev has a SPI Touchscreen controller */
+#define TSC2101_INT 17
-+#define TSC2101_CS (GPIO_PORTD | 21)
++#define TSC2101_CS (GPIO_PORTD | 21) /* SPI2_SS0 used as GPIO */
+
++/* CS can be used as GPIO too, if communication with TSC is deactivated (thanks
++ to TXB0108 chip (U23). INT pin can't and so must be reserved in any case */
+static int tsc2101_pins[] = {
+ (TSC2101_CS | GPIO_OUT | GPIO_GPIO),
-+ (GPIO_PORTF | TSC2101_INT | GPIO_IN | GPIO_GPIO), /* configure int pin as GPIO */
++};
++static int tsc2101_fixed_pins[] = {
++ (GPIO_PORTF | TSC2101_INT | GPIO_IN | GPIO_GPIO), /* configure INT pin as GPIO */
+};
+
+static int tsc2101_init_gpio(void)
+{
++ /* Initialize CS high */
+ gpio_set_value(TSC2101_CS, 1);
++
+ return mxc_gpio_setup_multiple_pins(tsc2101_pins, ARRAY_SIZE(tsc2101_pins), "TSC2101");
+}
+
-+/* Chip select toggle for TSC2101 */
++static int tsc2101_init_fixed_gpio(void)
++{
++ return mxc_gpio_setup_multiple_pins(tsc2101_fixed_pins, ARRAY_SIZE(tsc2101_fixed_pins), "TSC2101");
++}
++
++static void tsc2101_release_gpio(void)
++{
++ mxc_gpio_release_multiple_pins(tsc2101_pins, ARRAY_SIZE(tsc2101_pins));
++}
++
+static void tsc2101_cs(u32 command)
+{
+ if (command == SPI_CS_DEASSERT)
@@ -1491,16 +1220,15 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27-dev.c
+};
+
+static struct tsc210x_config apf27_tsc2101_config = {
-+ .mclk = 12288000, /* MCLK value in Master mode */
++ .mclk = 12288000, /* MCLK value in Master mode */
+ .use_internal = 1, /* -> use internal voltage reference */
-+ .monitor = TSC_BAT1 | TSC_AUX | TSC_TEMP,
-+ .init = tsc2101_init_gpio,
-+/* .apm_report = palmte_get_power_status,
-+ .alsa_config = &palmte_alsa_config,*/
++ .monitor = TSC_BAT1 | TSC_AUX | TSC_TEMP,
++ .init = tsc2101_init_gpio,
++ .exit = tsc2101_release_gpio,
+};
-+#endif /* CONFIG_SPI_TSC2102 */
+
+
++/* APF27Dev has a optional CAN Bus controller */
+#ifdef CONFIG_CAN_MCP251X
+
+#define CAN_MCP251X_INT 19
@@ -1511,14 +1239,13 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27-dev.c
+ (MCP251X_CS | GPIO_OUT | GPIO_GPIO),
+};
+
-+static void mcp251X_init_irq(void)
++static void mcp251x_init_irq(void)
+{
+ gpio_set_value(MCP251X_CS, 1);
+ mxc_gpio_setup_multiple_pins(mcp251x_pins, ARRAY_SIZE(mcp251x_pins), "MCP251x");
+}
+
-+// Chip select command for MCP251X
-+static void mcp251X_cs(u32 command)
++static void mcp251x_cs(u32 command)
+{
+ if (command == SPI_CS_DEASSERT)
+ gpio_set_value(MCP251X_CS, 1);
@@ -1527,17 +1254,15 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27-dev.c
+}
+
+static struct spi_imx_chip mcp251X_hw = {
-+ .cs_control = mcp251X_cs,
++ .cs_control = mcp251x_cs,
+};
+
-+
+static struct mcp251x_platform_data apf27_mcp251x_config = {
+ .oscillator_frequency = 16000000,
-+ .board_specific_setup = mcp251X_init_irq,
++ .board_specific_setup = mcp251x_init_irq,
+ .device_reset = NULL,
+ .transceiver_enable = NULL,
+};
-+
+#endif /* CONFIG_CAN_MCP251X */
+
+
@@ -1568,19 +1293,82 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27-dev.c
+#endif /* CONFIG_SPI_TSC2102 */
+#ifdef CONFIG_CAN_MCP251X
+ {
-+ .modalias = "mcp251x",
-+ .controller_data = &mcp251X_hw,
-+ .max_speed_hz = 8000000, /* 8MHz */
-+ .bus_num = 1, /* SPI2 */
-+ .mode = 0,
-+ .chip_select = 1,
-+ .irq = IRQ_GPIOD(CAN_MCP251X_INT),
-+ .platform_data = &apf27_mcp251x_config,
++ .modalias = "mcp251x",
++ .controller_data = &mcp251X_hw,
++ .max_speed_hz = 8000000, /* 8MHz */
++ .bus_num = 1, /* SPI2 */
++ .mode = 0,
++ .chip_select = 1,
++ .irq = IRQ_GPIOD(CAN_MCP251X_INT),
++ .platform_data = &apf27_mcp251x_config,
+ },
+#endif /* CONFIG_CAN_MCP251X */
+};
+
+
++/* APF27Dev adds an USB PHY on i.MX27 port 2 */
++#ifdef CONFIG_USB_EHCI_MXC
++static int mxc_usbh1_pins[] = {
++ PB22_PF_USBH1_SUSP,
++ PB23_PF_USB_PWR,
++ PB24_PF_USB_OC_B,
++ PB25_PF_USBH1_RCV,
++ PB26_PF_USBH1_FS,
++ PB27_PF_USBH1_OE_B,
++ PB28_PF_USBH1_TXDM,
++ PB29_PF_USBH1_TXDP,
++ PB30_PF_USBH1_RXDM,
++ PB31_PF_USBH1_RXDP
++};
++
++static int apf27_usbh1_init(struct platform_device *pdev)
++{
++ int ret;
++ uint32_t temp;
++
++ ret = mxc_gpio_setup_multiple_pins(mxc_usbh1_pins,
++ ARRAY_SIZE(mxc_usbh1_pins), "usbh1");
++ if (ret)
++ return ret;
++
++ temp = readl(IO_ADDRESS(OTG_BASE_ADDR) + 0x600);
++ pr_debug("USB_CTRL before: 0x%08x\n", temp);
++ temp &= ~( (3 << 13) | (1 << 8) | 1 );
++ temp |= (1 << 4) | (1 << 11) ;
++ writel(temp, IO_ADDRESS(OTG_BASE_ADDR) + 0x600);
++ pr_debug("USB_CTRL after: 0x%08x\n", temp);
++
++ temp = readl(IO_ADDRESS(OTG_BASE_ADDR) + 0x384);
++ pr_debug("PORTSC1 before: 0x%08x\n", temp);
++ temp &= ~(3 << 30);
++ temp |= 3 << 30;
++ writel(temp, IO_ADDRESS(OTG_BASE_ADDR) + 0x384);
++ pr_debug("PORTSC1 after: 0x%08x\n", temp);
++ mdelay(10);
++
++ temp = readl(IO_ADDRESS(OTG_BASE_ADDR) + 0x340);
++ temp |= 0x02; /* reset controller */
++ writel(temp, IO_ADDRESS(OTG_BASE_ADDR) + 0x340);
++ pr_debug("reset controller: 0x%08x\n", temp);
++ mdelay(10);
++
++ /* force port powerup in case of connected device */
++ temp = readl(IO_ADDRESS(OTG_BASE_ADDR) + 0x384);
++ pr_debug("PORTSC1 before: 0x%08x\n", temp);
++ temp &= ~(1 << 12);
++ temp |= 1 << 12;
++ writel(temp, IO_ADDRESS(OTG_BASE_ADDR) + 0x384);
++ mdelay(10);
++
++ return ret;
++}
++
++struct mxc_usb2_platform_data ehci1_pdata = {
++ .init = apf27_usbh1_init,
++};
++#endif /* CONFIG_USB_EHCI_MXC */
++
++
+#if defined(CONFIG_SND) || defined (CONFIG_SND_MODULE)
+
+#if defined(CONFIG_SND_IMX_TSC2102) || defined(CONFIG_SND_IMX_TSC2102_MODULE)
@@ -1595,7 +1383,7 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27-dev.c
+};
+
+static struct platform_device tsc2101_alsa_device = {
-+ .name = "tsc210x-alsa", /* Should be the same as the driver name */
++ .name = "tsc210x-alsa",
+ .id = 0,
+ .num_resources = ARRAY_SIZE(ssi_resources),
+ .resource = ssi_resources,
@@ -1616,8 +1404,145 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27-dev.c
+};
+
+
-+/* Camera stuff: TO BE DONE*/
++/* SSI1 port is directly connected to TSC2101 and can't be used for
++ anything else */
++static int mxc_ssi1_pins[] = {
++ PC20_PF_SSI1_FS,
++ PC21_PF_SSI1_RXD,
++ PC22_PF_SSI1_TXD,
++ PC23_PF_SSI1_CLK,
++};
++
++static int gpio_ssi1_active(struct platform_device *pdev)
++{
++ int err;
++
++ err = mxc_gpio_setup_multiple_pins(mxc_ssi1_pins,
++ ARRAY_SIZE(mxc_ssi1_pins), "mx2-sound");
++ if (err < 0)
++ pr_err("Failed to register SSI pins\n");
++
++ return err;
++}
++
++static int gpio_ssi1_inactive(struct platform_device *pdev)
++{
++ mxc_gpio_release_multiple_pins(mxc_ssi1_pins, ARRAY_SIZE(mxc_ssi1_pins));
++ return 0;
++}
++
++static struct imx_ssi_platform_data apf27_ssi0_pdata = {
++ .init = gpio_ssi1_active,
++ .exit = gpio_ssi1_inactive
++};
++
++static int apf27_late_init(void)
++{
++ mxc_register_device(&mxc_dam_device, NULL);
++ mxc_register_device(&imx_ssi_device0, &apf27_ssi0_pdata);
++
++ return 0;
++}
++
++late_initcall(apf27_late_init);
++
++
++/* APF27Dev has a microSD connector */
++#ifdef CONFIG_MMC_MXC
++# ifdef CONFIG_APF27_DEVTEST
++static int mxc_sdhc1_pins[] = {
++ PE18_PF_SDHC1_D0,
++ PE19_PF_SDHC1_D1,
++ PE20_PF_SDHC1_D2,
++ PE21_PF_SDHC1_D3,
++ PE22_PF_SDHC1_CMD,
++ PE22_PF_SDHC1_CLK,
++};
++
++static void apf27_sdhc1_init(struct device *dev)
++{
++ u16 data;
++
++ printk("apf27: configuring SDHC1 GPIOs\n");
++ mxc_gpio_setup_multiple_pins(mxc_sdhc1_pins, ARRAY_SIZE(mxc_sdhc1_pins), "SDHC1");
++ /* set 100k pull-down on sdhc1 dat3 pin (for card insertion/removal detection) */
++ data = __raw_readw(IO_ADDRESS(SYSCTRL_BASE_ADDR + 0x54)); /* -> PSCR register */
++ data &= ~(0x0c);
++ __raw_writew(data, IO_ADDRESS(SYSCTRL_BASE_ADDR + 0x54));
++ /* ?? enable clock ?? */
++}
++
++static void apf27_sdhc1_exit(struct device *pdev)
++{
++ printk("apf27: unconfiguring SDHC1 GPIOs\n");
++ mxc_gpio_release_multiple_pins(mxc_sdhc1_pins, ARRAY_SIZE(mxc_sdhc1_pins));
++}
++
++static struct imxmmc_platform_data apf27_sdhc1_pdata = {
++// .card_present = apf27_mmc_card_present,
++ .clk = "sdhc_clk",
++ .init = apf27_sdhc1_init,
++ .exit = apf27_sdhc1_exit,
++};
++# endif /* CONFIG_APF27_DEVTEST */
++
++static int mxc_sdhc2_pins[] = {
++ PB4_PF_SDHC2_D0,
++ PB5_PF_SDHC2_D1,
++ PB6_PF_SDHC2_D2,
++ PB7_PF_SDHC2_D3,
++ PB8_PF_SDHC2_CMD,
++ PB9_PF_SDHC2_CLK,
++};
++
++static int apf27_sdhc2_init(struct device *dev, irq_handler_t detect_irq, void *data)
++{
++ int ret;
++
++ printk("apf27: configuring SDHC2 GPIOs\n");
++ mxc_gpio_setup_multiple_pins(mxc_sdhc2_pins, ARRAY_SIZE(mxc_sdhc2_pins), "SDHC2");
++
++ ret = request_irq(IRQ_GPIOC(14), detect_irq, 0, "imx-mmc-detect", data);
++ if (ret)
++ goto out_release_gpio;
++ set_irq_type(IRQ_GPIOC(14), IRQ_TYPE_EDGE_BOTH);
++
++ return 0;
++
++out_release_gpio:
++ mxc_gpio_release_multiple_pins(mxc_sdhc2_pins, ARRAY_SIZE(mxc_sdhc2_pins));
++
++ return ret;
++}
++
++static void apf27_sdhc2_exit(struct device *dev, void *data)
++{
++ printk("apf27: unconfiguring SDHC2 GPIOs\n");
++
++ free_irq(IRQ_GPIOC(14), data);
++ mxc_gpio_release_multiple_pins(mxc_sdhc2_pins, ARRAY_SIZE(mxc_sdhc2_pins));
++}
++
++static struct imxmmc_platform_data apf27_sdhc2_pdata = {
++/* .card_present = apf27_mmc_card_present,
++ .clk = "sdhc_clk", */
++ .init = apf27_sdhc2_init,
++ .exit = apf27_sdhc2_exit,
++};
++
++static inline void apf27dev_init_mmc(void)
++{
++# ifdef CONFIG_APF27_DEVTEST
++ mxc_register_device(&mxc_sdhc_device0, &apf27_sdhc1_pdata);
++# endif
++ mxc_register_device(&mxc_sdhc_device1, &apf27_sdhc2_pdata);
++}
++#endif /* CONFIG_MMC_MXC */
++
+
++/* APF27Dev can have an optionnal Camera module extension using i.MX27 CSI */
++/* TO BE DONE */
++#ifdef CONFIG_VIDEO_MX27
+# ifdef CONFIG_VIDEO_OV96xx
+#define OV9653_PWDN (GPIO_PORTC | 30) /* SSI3_TX as POWERDOWN*/
+#define OV9653_RESET (GPIO_PORTC | 31) /* SSI3_CLK as RESET */
@@ -1626,32 +1551,63 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27-dev.c
+ (OV9653_PWDN | GPIO_OUT | GPIO_GPIO),
+ (OV9653_RESET | GPIO_OUT | GPIO_GPIO),
+};
++# endif
++
++static int apf27dev_csi_pins[] = {
++ PB10_PF_CSI_D0,
++ PB11_PF_CSI_D1,
++ PB12_PF_CSI_D2,
++ PB13_PF_CSI_D3,
++ PB14_PF_CSI_D4,
++ PB15_PF_CSI_MCLK,
++ PB16_PF_CSI_PIXCLK,
++ PB17_PF_CSI_D5,
++ PB18_PF_CSI_D6,
++ PB19_PF_CSI_D7,
++ PB20_PF_CSI_VSYNC,
++ PB21_PF_CSI_HSYNC
++};
+
+static int apf27dev_camera_init(struct platform_device *pdev)
+{
-+ /* To be put in ov96xx driver init part: */
++# ifdef CONFIG_VIDEO_OV96xx
++ /* To be put in OV96xx driver init part: */
++ int err;
++
+ gpio_set_value(OV9653_PWDN, 0);
+ gpio_set_value(OV9653_RESET, 0);
-+
-+ return mxc_gpio_setup_multiple_pins(apf27dev_ov9653_ctl_pins,
++ err = mxc_gpio_setup_multiple_pins(apf27dev_ov9653_ctl_pins,
+ ARRAY_SIZE(apf27dev_ov9653_ctl_pins), "OV9653");
++ if (err) {
++ printk("Error %s", __func__);
++ }
++# endif
++
++ return mxc_gpio_setup_multiple_pins(apf27dev_csi_pins,
++ ARRAY_SIZE(apf27dev_csi_pins), "CSI");
+}
+
+static int apf27dev_camera_exit(struct platform_device *pdev)
+{
-+ mxc_gpio_release_multiple_pins(apf27dev_ov9653_ctl_pins, ARRAY_SIZE(apf27dev_ov9653_ctl_pins));
++# ifdef CONFIG_VIDEO_OV96xx
++ /* To be put in OV96xx driver specific exit */
++ mxc_gpio_release_multiple_pins(apf27dev_ov9653_ctl_pins,
++ ARRAY_SIZE(apf27dev_ov9653_ctl_pins));
++# endif
++
++ mxc_gpio_release_multiple_pins(apf27dev_csi_pins, ARRAY_SIZE(apf27dev_csi_pins));
+
+ return 0;
+}
-+/*
++
+struct mx27_camera_platform_data apf27_camera = {
-+ .init = apf27_camera_init,
-+ .exit = apf27_camera_exit,
++ .init = apf27dev_camera_init,
++ .exit = apf27dev_camera_exit,
+ .clk = 26600000,
+ .flags = MX27_CAMERA_HSYNC_HIGH | MX27_CAMERA_GATED_CLOCK |
+ MX27_CAMERA_PACK_DIR_MSB,
-+};*/
-+#endif /* CONFIG_VIDEO_OV96xx */
++};
++#endif /* CONFIG_VIDEO_MX27 */
+
+
+/* APF27Dev power management stuff */
@@ -1723,6 +1679,7 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27-dev.c
+ printk(" Registering APF27_Dev ressources:");
+
+#if defined(CONFIG_FB_MXC) || defined(CONFIG_FB_IMX)
++ /* APF27Dev has an LCD connector */
+ apf27_lcd_init();
+#endif
+
@@ -1734,32 +1691,48 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27-dev.c
+#ifdef CONFIG_GPS
+ mxc_register_device(&mxc_uart_device4, &uart4_pdata);
+#endif
-+
++#ifdef CONFIG_USB_EHCI_MXC
++ mxc_register_device(&mxc_ehci1, &ehci1_pdata);
++#endif
+#ifdef CONFIG_I2C
+ i2c_register_board_info(0, apf27dev_i2c_devices_bus0,
+ ARRAY_SIZE(apf27dev_i2c_devices_bus0));
-+
+ i2c_register_board_info(1, apf27dev_i2c_devices_bus1,
+ ARRAY_SIZE(apf27dev_i2c_devices_bus1));
+#endif
++#ifdef CONFIG_SPI
++ mxc_register_device(&mxc_spi_device0, &imx_spi0_master_info);
++ mxc_register_device(&mxc_spi_device1, &imx_spi1_master_info);
++#endif
+ platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
+
++#ifdef CONFIG_SPI_TSC2102
++ /* Due to an hardware "bug", force TSC2101 ChipSelect at startup
++ (on some APF27Dev boards CS stays low, due to TXB0108 chip (U23))
++ and too weak i.MX27 internal pullup resistors */
++ tsc2101_init_gpio();
++ tsc2101_release_gpio();
++ /* Reserve "fixed" GPIOs */
++ tsc2101_init_fixed_gpio();
++#endif
+#if defined (CONFIG_ARMADEUS_MAX1027) || defined (CONFIG_SPI_TSC2102) || defined (CONFIG_CAN_MCP251X)
+ spi_register_board_info(spi_board_info,
+ ARRAY_SIZE(spi_board_info));
+#endif
-+/*
++#ifdef CONFIG_MMC_MXC
++ apf27dev_init_mmc();
++#endif
+#ifdef CONFIG_VIDEO_MX27
+ mxc_register_device(&mx27_camera_device, &apf27_camera);
+#endif
-+*/
++
+ printk("done\n");
+}
+
Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27-lcd.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.29.6/arch/arm/mach-mx2/apf27-lcd.c 2009-10-11 22:37:33.000000000 +0200
++++ linux-2.6.29.6/arch/arm/mach-mx2/apf27-lcd.c 2009-11-10 15:35:23.000000000 +0100
@@ -0,0 +1,220 @@
+/*
+ * apf27-lcd.c
@@ -1952,8 +1925,8 @@ Index: linux-2.6.29.6/arch/arm/mach-mx2/apf27-lcd.c
+#ifdef CONFIG_IMX_BACKLIGHT
+static struct platform_device *platform_devices[] __initdata = {
+ &imxbl_device,
-+#endif
+};
++#endif
+
+void apf27_lcd_startup(void)
+{
diff --git a/target/demos/input_test/Makefile b/target/demos/input_test/Makefile
index a0fbd71..1c405b3 100644
--- a/target/demos/input_test/Makefile
+++ b/target/demos/input_test/Makefile
@@ -5,7 +5,7 @@ ifeq ($(TARGET),)
STAGING_DIR:=$(ARMADEUS_BUILD_DIR)/staging_dir/
INSTALL_DIR:=$(ARMADEUS_ROOTFS_DIR)/usr/bin/
- CC:=$(STAGING_DIR)/usr/bin/arm-linux-gcc
+ CC:=$(ARMADEUS_TOOLCHAIN_PATH)/arm-linux-gcc
DEFINES="-DAPF"
CFLAGS:=$(shell STAGING_DIR=$(STAGING_DIR) sh $(ARMADEUS_SDL_DIR)/sdl-config --cflags)
LIBS:=$(shell STAGING_DIR=$(STAGING_DIR) sh $(ARMADEUS_SDL_DIR)/sdl-config --libs)
diff --git a/target/packages/as_devices/cpp/as_max1027.cpp b/target/packages/as_devices/cpp/as_max1027.cpp
index f18e366..bd5ba9a 100644
--- a/target/packages/as_devices/cpp/as_max1027.cpp
+++ b/target/packages/as_devices/cpp/as_max1027.cpp
@@ -119,7 +119,7 @@ AsMax1027::init(int aSpiNumber)
setSysPath(str_tmp);
/* open setup */
- mFSetup = open(string(getSysPath()+string(SETUP_NAME)).c_str(),O_RDWR);
+ mFSetup = open(string(getSysPath()+string(SETUP_NAME)).c_str(), O_RDWR);
if (mFSetup < 0)
{
perror(string(
@@ -139,7 +139,7 @@ AsMax1027::init(int aSpiNumber)
}
/* open conversion */
- mFConversion = open(string(getSysPath()+string(CONVERSION_NAME)).c_str(),O_WRONLY);
+ mFConversion = open(string(getSysPath()+string(CONVERSION_NAME)).c_str(), O_WRONLY);
if (mFConversion < 0)
{
perror(string(
@@ -435,18 +435,19 @@ AsMax1027::readBuffer(int aFile_handler, string *aValueRead)
ret = read(aFile_handler, valueRead, SIZEOFBUFF);
if (ret < 0)
{
- perror("Read error ");
- printf("error %d\n",ret);
+ perror("Read error");
+ printf("error %d\n", ret);
return AS_ADC_READFILE;
}
valueRead[ret] = '\0';
ret = lseek(aFile_handler, 0, SEEK_SET);
if (ret < 0)
{
- perror("lseek error ");
+ perror("lseek error");
return AS_ADC_LSEEK;
}
*aValueRead = string(valueRead);
+
return AS_ADC_OK;
}
@@ -462,17 +463,20 @@ AsAdc::AsAdc_errors
AsMax1027::writeBuffer(int aFile_handler, string aValueWrite)
{
int ret;
+
ret = write(aFile_handler, aValueWrite.c_str(), aValueWrite.length());
if (ret < 0)
{
- perror("Can't write file ");
+ perror("Can't write file");
return AS_ADC_WRITEFILE;
}
- ret = lseek(aFile_handler,0,SEEK_SET);
+ ret = lseek(aFile_handler, 0, SEEK_SET);
if (ret < 0)
{
- perror("lseek error ");
+ perror("lseek error");
return AS_ADC_LSEEK;
}
+
return AS_ADC_OK;
}
+
hooks/post-receive
--
armadeus
|
|
From: Julien B a. A. <ar...@us...> - 2009-11-02 19:29:17
|
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 431472083eb67eaca4f4df32c1c397da59d9b983 (commit)
from 97473365d71fb109f9919bda9e3d1b99afdacec5 (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 431472083eb67eaca4f4df32c1c397da59d9b983
Author: Julien Boibessot <jul...@ar...>
Date: Mon Nov 2 20:28:35 2009 +0100
Indentation
-----------------------------------------------------------------------
Summary of changes:
target/packages/ad9889ctrl/ad9889ctrl.c | 71 ++++++++++++++++---------------
1 files changed, 37 insertions(+), 34 deletions(-)
diff --git a/target/packages/ad9889ctrl/ad9889ctrl.c b/target/packages/ad9889ctrl/ad9889ctrl.c
index 246e95d..eec76ff 100644
--- a/target/packages/ad9889ctrl/ad9889ctrl.c
+++ b/target/packages/ad9889ctrl/ad9889ctrl.c
@@ -65,13 +65,14 @@ static inline __s32 i2c_smbus_access(int file, char read_write, __u8 command,
args.command = command;
args.size = size;
args.data = data;
- return ioctl(file,I2C_SMBUS,&args);
+ return ioctl(file, I2C_SMBUS, &args);
}
/* Read a byte on the I2C bus
This is done by writing the register address
we want to access and then by reading this register
@param fd: file descriptor of the device
+ @param dev: address of the device on I2C bus
@param reg: register to access
@param buf: buffer used to store the result
@return : -1 in case of error otherwise 0
@@ -81,13 +82,13 @@ int read_byte(int fd, unsigned char dev, unsigned char reg, unsigned char *buf)
union i2c_smbus_data data;
/* configure I2C_SLAVE */
- if ( ioctl(fd ,I2C_SLAVE, dev) < 0){
+ if (ioctl(fd, I2C_SLAVE, dev) < 0) {
perror("Ioctl error: ");
return -1;
}
- if (i2c_smbus_access(fd,I2C_SMBUS_READ,reg,
- I2C_SMBUS_BYTE_DATA,&data)) {
+ if (i2c_smbus_access(fd, I2C_SMBUS_READ, reg,
+ I2C_SMBUS_BYTE_DATA, &data)) {
printf("Read error\n");
return -1;
} else {
@@ -98,6 +99,7 @@ int read_byte(int fd, unsigned char dev, unsigned char reg, unsigned char *buf)
/* Write a byte on the I2C bus
@param fd: file descriptor of the device
+ @param dev: address of the device on I2C bus
@param reg: register to access
@param value: value to write
@return : -1 in case of error otherwise 0
@@ -153,7 +155,7 @@ void dump(int fd, FILE* destFile)
for (j = 0; j<4; j++) {
address = i*4+j;
if (!read_byte(fd, dev, address, buf)) {
- sprintf( dumpString, " %02X:%02X:%02X\t",
+ sprintf(dumpString, " %02X:%02X:%02X\t",
AD9889_I2C_SLAVE_ADDR, address, buf[0] );
dump2Output(dumpString, destFile);
}
@@ -207,11 +209,11 @@ void dumpedid(int fd, FILE* destFile)
printf("Dev:Ad:Va\tDev:Ad:Va\tDev:Ad:Va\tDev:Ad:Va\n");
/* dumping EDID memory */
- if (!read_byte( fd, AD9889_I2C_SLAVE_ADDR, 0x43, buf )) {
+ if (!read_byte(fd, AD9889_I2C_SLAVE_ADDR, 0x43, buf)) {
dev = buf[0]>>1;
for (address = 0; address<0x100; address++) {
- if (!read_byte( fd, dev, address, buf )) {
- sprintf( dumpString, " %02X:%02X:%02X\t",
+ if (!read_byte(fd, dev, address, buf)) {
+ sprintf(dumpString, " %02X:%02X:%02X\t",
dev, address, buf[0] );
dump2Output(dumpString, destFile);
}
@@ -253,21 +255,21 @@ void load(int fd, char* fileName)
if (strlen(fileName) == 0) {
printf("Enter file name: ");
- fgets (tempFileName, sizeof(tempFileName), stdin);
+ fgets(tempFileName, sizeof(tempFileName), stdin);
tempFileName[strlen(tempFileName)-1] = '\0'; /* suppress \n */
}
else {
- strcpy(tempFileName,fileName);
+ strcpy(tempFileName, fileName);
}
- if ((fd_conf = fopen(tempFileName,"r")) == NULL) {
+ if ((fd_conf = fopen(tempFileName, "r")) == NULL) {
perror("Open error: ");
exit (1);
}
while (fgets(line, MAX_DUMP_LINE, fd_conf) != NULL) {
nb = sscanf(line,"%2X%*c%2X%*c%2X%2X%*c%2X%*c%2X%2X%*c%2X%*c%2X%2X%*c%2X%*c%2X",
- &dev1,&addr1,&val1,&dev2,&addr2,&val2,
- &dev3,&addr3,&val3,&dev4,&addr4,&val4 );
+ &dev1, &addr1, &val1, &dev2, &addr2, &val2,
+ &dev3, &addr3, &val3, &dev4, &addr4, &val4 );
if (nb >= 3)
write_byte (fd, dev1, addr1, val1);
if (nb >= 6)
@@ -305,6 +307,7 @@ int ad9889_init(int fd)
printf("hpd not active, force powerup.\n");
}
write_byte(fd, AD9889_I2C_SLAVE_ADDR, 0x41, 0x10);
+
return 0;
}
@@ -318,73 +321,73 @@ int main(int argc, char *argv[])
int regValue;
char* bus = "/dev/i2c-1";
- if (argc >2 ) { /* too many args */
+ if (argc > 2) { /* too many args */
usage();
exit(1);
- } else if (argc == 2) { /* i2c bus */
+ } else if (argc == 2) { /* i2c bus */
bus = argv[1];
}
/* open I2C /dev */
- if ((fd = open(bus,O_RDWR)) < 0) {
+ if ((fd = open(bus, O_RDWR)) < 0) {
perror("Open error: ");
exit (1);
}
/* configure I2C_SLAVE */
- if (ioctl(fd ,I2C_SLAVE, AD9889_I2C_SLAVE_ADDR) < 0) {
+ if (ioctl(fd, I2C_SLAVE, AD9889_I2C_SLAVE_ADDR) < 0) {
perror("Ioctl error: ");
exit (1);
}
/* check AD9889 presence */
- if (!read_byte( fd, AD9889_I2C_SLAVE_ADDR, CHIP_REVISION, buf)) {
+ if (!read_byte(fd, AD9889_I2C_SLAVE_ADDR, CHIP_REVISION, buf)) {
if ((AD9889_MAX_REV < buf[0])) {
- printf("AD9889 not recognized. Exit\n");
+ printf("AD9889 revision not supported. Exiting\n");
exit(1);
}
} else {
- printf("AD9889 not found. Exit\n");
+ printf("AD9889 not found. Exiting\n");
exit(1);
}
usage();
while(1) {
- fgets(string,sizeof(string),stdin);
- if(string[0] == 'q') { /* Exit */
+ fgets(string, sizeof(string), stdin);
+ if (string[0] == 'q') { /* Exit */
exit(0);
}
else if (string[0] == 'm') { /* Modify registers */
int dev;
printf("chip addr (hex without 0x)(ex 39): ");
- fgets(string,sizeof(string),stdin);
- sscanf(string,"%2x", &dev);
+ fgets(string, sizeof(string), stdin);
+ sscanf(string, "%2x", &dev);
printf("reg addr (hex without 0x): ");
- fgets(string,sizeof(string),stdin);
- sscanf(string,"%2x", ®Addr);
+ fgets(string, sizeof(string), stdin);
+ sscanf(string, "%2x", ®Addr);
printf("reg value (hex without 0x): ");
- fgets(string,sizeof(string),stdin);
- sscanf(string,"%2x", ®Value);
- write_byte (fd, dev, regAddr, regValue);
+ fgets(string, sizeof(string), stdin);
+ sscanf(string, "%2x", ®Value);
+ write_byte(fd, dev, regAddr, regValue);
}
else if (string[0] == 'd') { /* Dump to screen */
- dump(fd,fd_conf);
+ dump(fd, fd_conf);
}
else if (string[0] == 'e') { /* Dump to screen */
- dumpedid(fd,NULL);
+ dumpedid(fd, NULL);
}
else if (string[0] == 's') { /* Save to file */
- if ((fd_conf = fopen(CONF_FILE,"w")) < 0) {
+ if ((fd_conf = fopen(CONF_FILE, "w")) < 0) {
perror("Open error: ");
exit (1);
}
- dump(fd,fd_conf);
+ dump(fd, fd_conf);
if (fd_conf != NULL) {
fclose(fd_conf);
}
}
else if (string[0] == 'l') { /* load from file */
- load(fd,"");
+ load(fd, "");
}
else if (string[0] == 'i') { /* init ad9889 */
printf("initialize...\n");
hooks/post-receive
--
armadeus
|
|
From: Julien B a. A. <ar...@us...> - 2009-11-01 11:20:14
|
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 97473365d71fb109f9919bda9e3d1b99afdacec5 (commit)
via 67bb77e038555dd0f7749cfde1d3993ae7a1efdc (commit)
via 1ce8527a7e8cb160c997a6c67e1b40d32b3ef5c5 (commit)
via 11e6911536d90e7b2d8fc0d231db1758a96ee91b (commit)
via 269c1882d60a7034917fb79f367cd5dec3e774c7 (commit)
from 316c31fd75f2895c67ca21ae9ace86e0ddecfa62 (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 97473365d71fb109f9919bda9e3d1b99afdacec5
Merge: 67bb77e038555dd0f7749cfde1d3993ae7a1efdc 316c31fd75f2895c67ca21ae9ace86e0ddecfa62
Author: Julien Boibessot <jul...@ar...>
Date: Sun Nov 1 12:19:33 2009 +0100
Merge branch 'master' of ssh://artemys@armadeus.git.sourceforge.net/gitroot/armadeus/armadeus
commit 67bb77e038555dd0f7749cfde1d3993ae7a1efdc
Author: Julien Boibessot <jul...@ar...>
Date: Sun Nov 1 12:18:49 2009 +0100
[DEBUG] imxssi doesn't require libpow to compile
commit 1ce8527a7e8cb160c997a6c67e1b40d32b3ef5c5
Author: Julien Boibessot <jul...@ar...>
Date: Sat Oct 31 22:39:10 2009 +0100
Add some .gitignore files
commit 11e6911536d90e7b2d8fc0d231db1758a96ee91b
Author: Julien Boibessot <jul...@ar...>
Date: Sat Oct 31 22:35:29 2009 +0100
[TOOLS] Simplify setDAC tool sources
commit 269c1882d60a7034917fb79f367cd5dec3e774c7
Author: Julien Boibessot <jul...@ar...>
Date: Thu Oct 29 15:47:10 2009 +0100
[TOOLS] ad9889ctrl: Cleanup + indentation
-----------------------------------------------------------------------
Summary of changes:
buildroot/package/ad9889ctrl/ad9889.mk | 5 +-
target/linux/debug/imxssi/configure.ac | 2 -
target/{demos => packages}/.gitignore | 0
target/packages/ad9889ctrl/ad9889ctrl.c | 177 +++++++++++++++----------------
target/packages/max5821ctrl/.gitignore | 1 +
target/packages/max5821ctrl/max5821.h | 6 +-
target/packages/max5821ctrl/setDAC.c | 120 +++++++++------------
7 files changed, 143 insertions(+), 168 deletions(-)
copy target/{demos => packages}/.gitignore (100%)
create mode 100644 target/packages/max5821ctrl/.gitignore
diff --git a/buildroot/package/ad9889ctrl/ad9889.mk b/buildroot/package/ad9889ctrl/ad9889.mk
index 6ee401e..6ff0cef 100644
--- a/buildroot/package/ad9889ctrl/ad9889.mk
+++ b/buildroot/package/ad9889ctrl/ad9889.mk
@@ -1,6 +1,6 @@
#############################################################
#
-# ad9889 tool
+# ad9889 control tool
#
#############################################################
@@ -12,12 +12,11 @@ AD9889CTRL_BINARY:=ad9889ctrl
AD9889CTRL_TARGET_BINARY:=usr/bin/ad9889ctrl
$(AD9889CTRL_DIR)/ad9889ctrl.c:
- set
mkdir -p $(AD9889CTRL_DIR)/
cp $(AD9889CTRL_SOURCE)/* $(AD9889CTRL_DIR)/
$(AD9889CTRL_DIR)/$(AD9889CTRL_BINARY): $(AD9889CTRL_DIR)/ad9889ctrl.c $(AD9889CTRL_DIR)/ad9889ctrl.h
- $(TARGET_CONFIGURE_OPTS) $(MAKE) CC=$(TARGET_CC) -C $(AD9889CTRL_DIR)
+ $(MAKE) CC=$(TARGET_CC) -C $(AD9889CTRL_DIR)
$(TARGET_DIR)/$(AD9889CTRL_TARGET_BINARY): $(AD9889CTRL_DIR)/$(AD9889CTRL_BINARY)
install -D $< $@
diff --git a/target/linux/debug/imxssi/configure.ac b/target/linux/debug/imxssi/configure.ac
index 50afb78..65f49e1 100644
--- a/target/linux/debug/imxssi/configure.ac
+++ b/target/linux/debug/imxssi/configure.ac
@@ -9,6 +9,4 @@ AC_CONFIG_FILES([
Makefile
])
-AC_SEARCH_LIBS(pow, m)
-
AC_OUTPUT
diff --git a/target/demos/.gitignore b/target/packages/.gitignore
similarity index 100%
copy from target/demos/.gitignore
copy to target/packages/.gitignore
diff --git a/target/packages/ad9889ctrl/ad9889ctrl.c b/target/packages/ad9889ctrl/ad9889ctrl.c
index 3784474..246e95d 100644
--- a/target/packages/ad9889ctrl/ad9889ctrl.c
+++ b/target/packages/ad9889ctrl/ad9889ctrl.c
@@ -1,7 +1,7 @@
/*
** THE ARMADEUS PROJECT
**
-** Copyright (C) year The source forge armadeus project team
+** Copyright (C) 2009 The source forge armadeus project team
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
** along with this program; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
**
-** ad9889ctrl: manage the Svideo controller AD9889
+** ad9889ctrl: manage the AD9889 Video controller
**
** authors: th...@us..., jo...@ar...
*/
@@ -45,15 +45,15 @@
/* MENU */
void usage()
{
- printf ("\nad9889ctrl utility ver %s Armadeus\n", VERSION);
- printf ("q: quit\n");
- printf ("i: initialize\n");
- printf ("m: modify\n");
- printf ("d: dump AD9889 registers\n");
- printf ("e: dump EDID registers\n");
- printf ("s: save\n");
- printf ("l: load\n");
- printf ("other: menu\n");
+ printf("\nad9889ctrl utility ver %s Armadeus\n", VERSION);
+ printf("q: quit\n");
+ printf("i: initialize\n");
+ printf("m: modify\n");
+ printf("d: dump AD9889 registers\n");
+ printf("e: dump EDID registers\n");
+ printf("s: save\n");
+ printf("l: load\n");
+ printf("other: this menu\n");
}
static inline __s32 i2c_smbus_access(int file, char read_write, __u8 command,
@@ -68,19 +68,19 @@ static inline __s32 i2c_smbus_access(int file, char read_write, __u8 command,
return ioctl(file,I2C_SMBUS,&args);
}
-/* Read a byte on the I2C bus
- This is done by writing the register address
+/* Read a byte on the I2C bus
+ This is done by writing the register address
we want to access and then by reading this register
@param fd: file descriptor of the device
@param reg: register to access
@param buf: buffer used to store the result
@return : -1 in case of error otherwise 0
*/
-int read_byte( int fd, unsigned char dev, unsigned char reg, unsigned char *buf )
-{
+int read_byte(int fd, unsigned char dev, unsigned char reg, unsigned char *buf)
+{
union i2c_smbus_data data;
- // configure I2C_SLAVE
+ /* configure I2C_SLAVE */
if ( ioctl(fd ,I2C_SLAVE, dev) < 0){
perror("Ioctl error: ");
return -1;
@@ -108,15 +108,15 @@ int write_byte(int fd, unsigned char dev, unsigned char reg, unsigned char value
data.byte = value;
#ifdef DEBUG_AD9889
- printf("write chip %02X ref %02X value %02X\n", dev, reg, value);
+ printf("write chip %02X ref %02X value %02X\n", dev, reg, value);
#endif
- // configure I2C_SLAVE
- if ( ioctl(fd ,I2C_SLAVE, dev) < 0){
+ /* configure I2C_SLAVE */
+ if (ioctl(fd, I2C_SLAVE, dev) < 0) {
perror("Ioctl error: ");
return -1;
}
- return i2c_smbus_access(fd,I2C_SMBUS_WRITE,reg,
+ return i2c_smbus_access(fd, I2C_SMBUS_WRITE, reg,
I2C_SMBUS_BYTE_DATA, &data);
return 0;
@@ -126,12 +126,12 @@ int write_byte(int fd, unsigned char dev, unsigned char reg, unsigned char value
@param string: string to dump
@param destFile: file in which to write
*/
- void dump2Output(char* string, FILE* destFile)
+void dump2Output(char* string, FILE* destFile)
{
- if( destFile == NULL )
+ if (destFile == NULL)
printf("%s", string);
else
- fprintf(destFile,"%s", string);
+ fprintf(destFile, "%s", string);
}
/* dump the register values on the screen if destFile is NULL or in a file
@@ -145,39 +145,37 @@ void dump(int fd, FILE* destFile)
char dumpString[MAX_DUMP_LINE];
unsigned char dev = AD9889_I2C_SLAVE_ADDR;
- if( destFile == NULL )
+ if (destFile == NULL)
printf("Dev:Ad:Va\tDev:Ad:Va\tDev:Ad:Va\tDev:Ad:Va\n");
- // dumping main registers
- for( i = 0; i<(0xd0/4); i++ ){
- for( j = 0; j<4; j++ ){
+ /* dumping main registers */
+ for (i = 0; i<(0xd0/4); i++) {
+ for (j = 0; j<4; j++) {
address = i*4+j;
- if( !read_byte( fd, dev, address, buf ) ){
+ if (!read_byte(fd, dev, address, buf)) {
sprintf( dumpString, " %02X:%02X:%02X\t",
AD9889_I2C_SLAVE_ADDR, address, buf[0] );
- dump2Output( dumpString, destFile );
+ dump2Output(dumpString, destFile);
}
}
- dump2Output( "\n", destFile );
+ dump2Output("\n", destFile);
}
- // dumping secondary registers
- if( !read_byte( fd, AD9889_I2C_SLAVE_ADDR, 0xCF, buf ) ) {
+ /* dumping secondary registers */
+ if (!read_byte(fd, AD9889_I2C_SLAVE_ADDR, 0xCF, buf)) {
dev = buf[0]>>1;
- for( address = 0; address<0x1F; address++ ){
- if( !read_byte( fd, dev, address, buf ) ){
- sprintf( dumpString, " %02X:%02X:%02X\t",
- dev, address, buf[0] );
- dump2Output( dumpString, destFile );
+ for (address = 0; address<0x1F; address++) {
+ if (!read_byte( fd, dev, address, buf)) {
+ sprintf(dumpString, " %02X:%02X:%02X\t",
+ dev, address, buf[0]);
+ dump2Output(dumpString, destFile);
}
if ((3 == address % 4) && (0x1E != address)) {
- dump2Output( "\n", destFile );
+ dump2Output("\n", destFile);
}
}
- dump2Output( "\n", destFile );
-
+ dump2Output("\n", destFile);
}
-
/*
if( !read_byte( fd, DAC_TRIMMING_CMD, buf ) ){
sprintf( dumpString, "%02X:%02X\t", DAC_TRIMMING_CMD, buf[0] );
@@ -200,30 +198,28 @@ void dump(int fd, FILE* destFile)
*/
void dumpedid(int fd, FILE* destFile)
{
- int i,j, address;
+ int address;
unsigned char buf[2];
char dumpString[MAX_DUMP_LINE];
unsigned char dev = AD9889_I2C_SLAVE_ADDR;
- if( destFile == NULL )
+ if (destFile == NULL)
printf("Dev:Ad:Va\tDev:Ad:Va\tDev:Ad:Va\tDev:Ad:Va\n");
-
- // dumping EBID memory
- if( !read_byte( fd, AD9889_I2C_SLAVE_ADDR, 0x43, buf ) ) {
+ /* dumping EDID memory */
+ if (!read_byte( fd, AD9889_I2C_SLAVE_ADDR, 0x43, buf )) {
dev = buf[0]>>1;
- for( address = 0; address<0x100; address++ ){
- if( !read_byte( fd, dev, address, buf ) ){
+ for (address = 0; address<0x100; address++) {
+ if (!read_byte( fd, dev, address, buf )) {
sprintf( dumpString, " %02X:%02X:%02X\t",
dev, address, buf[0] );
- dump2Output( dumpString, destFile );
+ dump2Output(dumpString, destFile);
}
if ((3 == address % 4) && (0xFF != address)) {
- dump2Output( "\n", destFile );
+ dump2Output("\n", destFile);
}
}
- dump2Output( "\n", destFile );
-
+ dump2Output("\n", destFile);
}
/*
if( !read_byte( fd, DAC_TRIMMING_CMD, buf ) ){
@@ -245,7 +241,7 @@ void dumpedid(int fd, FILE* destFile)
@param fd: file descriptor of the AD9889
@param fileName: file containing the values. If "" then the name has to be entered
*/
-void load( int fd, char* fileName )
+void load(int fd, char* fileName)
{
char line[MAX_DUMP_LINE];
char tempFileName[MAX_DUMP_LINE];
@@ -255,37 +251,37 @@ void load( int fd, char* fileName )
int val1, val2, val3, val4;
int nb;
- if( strlen(fileName) == 0 ){
+ if (strlen(fileName) == 0) {
printf("Enter file name: ");
fgets (tempFileName, sizeof(tempFileName), stdin);
- tempFileName[strlen(tempFileName)-1] = '\0'; //suppress \n
+ tempFileName[strlen(tempFileName)-1] = '\0'; /* suppress \n */
}
- else{
+ else {
strcpy(tempFileName,fileName);
}
- if ((fd_conf = fopen(tempFileName,"r")) == NULL){
+ if ((fd_conf = fopen(tempFileName,"r")) == NULL) {
perror("Open error: ");
exit (1);
}
- while(fgets(line, MAX_DUMP_LINE, fd_conf) != NULL){
+ while (fgets(line, MAX_DUMP_LINE, fd_conf) != NULL) {
nb = sscanf(line,"%2X%*c%2X%*c%2X%2X%*c%2X%*c%2X%2X%*c%2X%*c%2X%2X%*c%2X%*c%2X",
&dev1,&addr1,&val1,&dev2,&addr2,&val2,
&dev3,&addr3,&val3,&dev4,&addr4,&val4 );
- if(nb>=3)
+ if (nb >= 3)
write_byte (fd, dev1, addr1, val1);
- if(nb>=6)
+ if (nb >= 6)
write_byte (fd, dev2, addr2, val2);
- if(nb>=9)
+ if (nb >= 9)
write_byte (fd, dev3, addr3, val3);
- if(nb>=12)
+ if (nb >= 12)
write_byte (fd, dev4, addr4, val4);
}
/* power down to reset the dac after parameter changing*/
// write_byte (fd, POWER_STATE_CMD, 0xFF);
/* power on the dac after parameter changing*/
// write_byte (fd, POWER_STATE_CMD, 0x00);
- if(fd_conf != NULL)
+ if (fd_conf != NULL)
fclose(fd_conf);
}
@@ -296,19 +292,19 @@ int ad9889_init(int fd)
int i= 10000;
while ((!hpd) && (i-- >0)) {
- if( !read_byte( fd, AD9889_I2C_SLAVE_ADDR, 0x42, buf ) )
- {
+ if (!read_byte(fd, AD9889_I2C_SLAVE_ADDR, 0x42, buf)) {
hpd = buf[0]&0x40;
- }
- else printf("hpd read failed\n");
+ } else {
+ printf("hpd read failed\n");
+ }
}
- if (hpd){
+ if (hpd) {
printf("hpd active.\n");
} else {
printf("hpd not active, force powerup.\n");
}
- write_byte (fd, AD9889_I2C_SLAVE_ADDR, 0x41, 0x10);
+ write_byte(fd, AD9889_I2C_SLAVE_ADDR, 0x41, 0x10);
return 0;
}
@@ -322,45 +318,43 @@ int main(int argc, char *argv[])
int regValue;
char* bus = "/dev/i2c-1";
- if ( argc >2 ){ // too many args
+ if (argc >2 ) { /* too many args */
usage();
exit(1);
- } else if ( argc == 2 ){ // i2c bus
+ } else if (argc == 2) { /* i2c bus */
bus = argv[1];
}
-
- // open I2C /dev
- if ((fd = open(bus,O_RDWR)) < 0){
+ /* open I2C /dev */
+ if ((fd = open(bus,O_RDWR)) < 0) {
perror("Open error: ");
exit (1);
}
- // configure I2C_SLAVE
- if ( ioctl(fd ,I2C_SLAVE, AD9889_I2C_SLAVE_ADDR) < 0){
+ /* configure I2C_SLAVE */
+ if (ioctl(fd ,I2C_SLAVE, AD9889_I2C_SLAVE_ADDR) < 0) {
perror("Ioctl error: ");
exit (1);
}
- // check AD9889 presence
- if( !read_byte( fd, AD9889_I2C_SLAVE_ADDR, CHIP_REVISION, buf ) ){
- if ( (AD9889_MAX_REV < buf[0] )){
+ /* check AD9889 presence */
+ if (!read_byte( fd, AD9889_I2C_SLAVE_ADDR, CHIP_REVISION, buf)) {
+ if ((AD9889_MAX_REV < buf[0])) {
printf("AD9889 not recognized. Exit\n");
exit(1);
}
- }
- else {
+ } else {
printf("AD9889 not found. Exit\n");
exit(1);
}
usage();
- while(1){
+ while(1) {
fgets(string,sizeof(string),stdin);
- if(string[0] == 'q') { // Exit
+ if(string[0] == 'q') { /* Exit */
exit(0);
}
- else if (string[0] == 'm') { // Modify registers
+ else if (string[0] == 'm') { /* Modify registers */
int dev;
printf("chip addr (hex without 0x)(ex 39): ");
fgets(string,sizeof(string),stdin);
@@ -373,26 +367,26 @@ int main(int argc, char *argv[])
sscanf(string,"%2x", ®Value);
write_byte (fd, dev, regAddr, regValue);
}
- else if (string[0] == 'd') { // Dump to screen
+ else if (string[0] == 'd') { /* Dump to screen */
dump(fd,fd_conf);
}
- else if (string[0] == 'e') { // Dump to screen
+ else if (string[0] == 'e') { /* Dump to screen */
dumpedid(fd,NULL);
}
- else if (string[0] == 's') { // Save to file
+ else if (string[0] == 's') { /* Save to file */
if ((fd_conf = fopen(CONF_FILE,"w")) < 0) {
perror("Open error: ");
exit (1);
}
dump(fd,fd_conf);
- if(fd_conf != NULL) {
+ if (fd_conf != NULL) {
fclose(fd_conf);
}
}
- else if (string[0] == 'l') { // load from file
+ else if (string[0] == 'l') { /* load from file */
load(fd,"");
}
- else if (string[0] == 'i') { // init ad9889
+ else if (string[0] == 'i') { /* init ad9889 */
printf("initialize...\n");
ad9889_init(fd);
} else {
@@ -400,9 +394,10 @@ int main(int argc, char *argv[])
}
};
- if(fd >= 0) {
+ if (fd >= 0) {
close(fd);
}
exit (0);
}
+
diff --git a/target/packages/max5821ctrl/.gitignore b/target/packages/max5821ctrl/.gitignore
new file mode 100644
index 0000000..5eafa2b
--- /dev/null
+++ b/target/packages/max5821ctrl/.gitignore
@@ -0,0 +1 @@
+setDAC
diff --git a/target/packages/max5821ctrl/max5821.h b/target/packages/max5821ctrl/max5821.h
index 0d9fda9..14e7b09 100644
--- a/target/packages/max5821ctrl/max5821.h
+++ b/target/packages/max5821ctrl/max5821.h
@@ -52,7 +52,7 @@
#define POWER_CTRL_SELECTED 0x1
#define POWER_CTRL_UNSELECTED 0x0
-#define MAX5821M_MAX_DATA_VALUE 1024
+#define MAX5821M_MAX_DATA_VALUE 1023
/* transfered data structs */
typedef struct
@@ -85,8 +85,8 @@ typedef struct
#define BUILD_DATA_COMMAND(InSruct, Buf) \
{ \
- Buf[0] = (InSruct.command << 4) + (unsigned char) (InSruct.data>>6);\
- Buf[1] = (unsigned char) (InSruct.data<<2);\
+ Buf[0] = (InSruct.command << 4) + (unsigned char) (InSruct.data >> 6);\
+ Buf[1] = (unsigned char) (InSruct.data << 2);\
}
#define BUILD_EXTENDED_COMMAND(InSruct, Buf) \
diff --git a/target/packages/max5821ctrl/setDAC.c b/target/packages/max5821ctrl/setDAC.c
index c96f5de..d1cd50d 100644
--- a/target/packages/max5821ctrl/setDAC.c
+++ b/target/packages/max5821ctrl/setDAC.c
@@ -1,7 +1,7 @@
/*
** THE ARMADEUS PROJECT
**
-** Copyright (C) year The source forge armadeus project team
+** Copyright (C) 2008 The source forge armadeus project team
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
@@ -22,7 +22,6 @@
** author: ca...@us...
*/
-
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
@@ -34,7 +33,13 @@
#include <sys/ioctl.h>
#include "max5821.h"
-// #define DEBUG_MAX5821 1
+/*#define DEBUG_MAX5821 1 */
+
+#ifdef DEBUG_MAX5821
+# define DEBUG(fmt, ...) printf(fmt, ##__VA_ARGS__)
+#else
+# define DEBUG(fmt, ...) do { ; } while (0)
+#endif
void usage()
@@ -51,96 +56,73 @@ int main(int argc, char *argv[])
{
int bus;
int value;
- extended_command powerDownCommand = {0, 0, 0, 0};
- extended_command powerUpCommand = {0, 0, 0, 0};
- data_command setDACOutput = {0, 0, 0};
+ extended_command powerCommand = {0, 0, 0, 0};
+ data_command setOutputCommand = {0, 0, 0};
unsigned char buf[2];
- if ((argc != 2) && (argc != 3))
- {
+ if ((argc != 2) && (argc != 3)) {
usage();
}
- if ((bus = open("/dev/i2c-0", O_RDWR)) < 0)
- {
- perror("Open error: ");
+ if ((bus = open("/dev/i2c-0", O_RDWR)) < 0) {
+ perror("Open error");
exit(1);
}
- if (ioctl(bus,/*I2C_SLAVE*/ 0x703, MAX5821L_IC_SLAVE_ADDRESS_GND) < 0)
- {
- perror("Ioctl error: ");
+ if (ioctl(bus, I2C_SLAVE, MAX5821L_IC_SLAVE_ADDRESS_GND) < 0) {
+ perror("Ioctl error");
exit(1);
}
- powerDownCommand.command = MAX5821_EXTENDED_COMMAND_MODE;
- powerDownCommand.powerMode = POWER_DOWN_MODE0;
- powerUpCommand.command = MAX5821_EXTENDED_COMMAND_MODE;
- powerUpCommand.powerMode = POWER_UP;
+ powerCommand.command = MAX5821_EXTENDED_COMMAND_MODE;
- setDACOutput.Sbits = 0;
- if (0 == strcmp(argv[1],"A"))
- {
- powerDownCommand.ctrlA = POWER_CTRL_SELECTED;
- powerDownCommand.ctrlB = POWER_CTRL_UNSELECTED;
- powerUpCommand.ctrlA = POWER_CTRL_SELECTED;
- powerUpCommand.ctrlB = POWER_CTRL_UNSELECTED;
- setDACOutput.command = MAX5821_LOAD_DAC_A_IN_REG_B;
+ setOutputCommand.Sbits = 0;
+ if (0 == strcmp(argv[1], "A")) {
+ powerCommand.ctrlA = POWER_CTRL_SELECTED;
+ powerCommand.ctrlB = POWER_CTRL_UNSELECTED;
+ setOutputCommand.command = MAX5821_LOAD_DAC_A_IN_REG_B;
}
- else if (0 == strcmp(argv[1],"B"))
- {
- powerDownCommand.ctrlA = POWER_CTRL_UNSELECTED;
- powerDownCommand.ctrlB = POWER_CTRL_SELECTED;
- powerUpCommand.ctrlA = POWER_CTRL_UNSELECTED;
- powerUpCommand.ctrlB = POWER_CTRL_SELECTED;
- setDACOutput.command = MAX5821_LOAD_DAC_B_IN_REG_A;
+ else if (0 == strcmp(argv[1], "B")) {
+ powerCommand.ctrlA = POWER_CTRL_UNSELECTED;
+ powerCommand.ctrlB = POWER_CTRL_SELECTED;
+ setOutputCommand.command = MAX5821_LOAD_DAC_B_IN_REG_A;
}
- else if (0 == strcmp(argv[1],"AB"))
- {
- powerDownCommand.ctrlA = POWER_CTRL_SELECTED;
- powerDownCommand.ctrlB = POWER_CTRL_SELECTED;
- powerUpCommand.ctrlA = POWER_CTRL_SELECTED;
- powerUpCommand.ctrlB = POWER_CTRL_SELECTED;
- setDACOutput.command = MAX5821_LOAD_DAC_ALL_IN_UPDATE_ALL;
- }
- else
- {
+ else if (0 == strcmp(argv[1], "AB")) {
+ powerCommand.ctrlA = POWER_CTRL_SELECTED;
+ powerCommand.ctrlB = POWER_CTRL_SELECTED;
+ setOutputCommand.command = MAX5821_LOAD_DAC_ALL_IN_UPDATE_ALL;
+ } else {
usage();
}
- if (argc == 2)
- {
- BUILD_EXTENDED_COMMAND(powerDownCommand, buf);
-#ifdef DEBUG_MAX5821
- printf("Set the DAC : %02X %02X \n", buf[0], buf[1]);
-#endif
- }
- else
- {
+ if (argc == 2) {
+ /* No value given -> power down channel */
+ powerCommand.powerMode = POWER_DOWN_MODE0;
+ BUILD_EXTENDED_COMMAND(powerCommand, buf);
+ DEBUG("Set the DAC: %02X %02X \n", buf[0], buf[1]);
+ } else {
value = atoi(argv[2]);
- if (value >= MAX5821M_MAX_DATA_VALUE)
+ if (value > MAX5821M_MAX_DATA_VALUE)
usage();
- /* first, we power up the DAC */
- BUILD_EXTENDED_COMMAND(powerUpCommand, buf);
-#ifdef DEBUG_MAX5821
- printf("Set the DAC : %02X %02X \n", buf[0], buf[1]);
-#endif
- if (0 > write(bus, buf, 2))
- {
- printf("Write error\n");
+ /* First, we power up the channel(s) */
+ powerCommand.powerMode = POWER_UP;
+ BUILD_EXTENDED_COMMAND(powerCommand, buf);
+ DEBUG("Set the DAC: %02X %02X \n", buf[0], buf[1]);
+ if (0 > write(bus, buf, 2)) {
+ perror("Write error");
exit(1);
}
- setDACOutput.data = value;
- BUILD_DATA_COMMAND(setDACOutput, buf);
-#ifdef DEBUG_MAX5821
- printf("Set the DAC : %02X %02X \n", buf[0], buf[1]);
-#endif
+ /* Then we prepare the command to set channel value */
+ setOutputCommand.data = value;
+ BUILD_DATA_COMMAND(setOutputCommand, buf);
+ DEBUG("Set the DAC: %02X %02X \n", buf[0], buf[1]);
}
- if (0 > write(bus, buf, 2))
- {
- printf("Write error\n");
+ /* Send previously built command */
+ if (0 > write(bus, buf, 2)) {
+ perror("Write error");
exit(1);
}
exit(0);
}
+
hooks/post-receive
--
armadeus
|
|
From: Fabien M <fa...@us...> - 2009-10-28 08:15:17
|
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 316c31fd75f2895c67ca21ae9ace86e0ddecfa62 (commit)
from 7f2510c6bd02ebf475728fb9846e3421ade85279 (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 316c31fd75f2895c67ca21ae9ace86e0ddecfa62
Author: Fabien Marteau <fab...@ar...>
Date: Wed Oct 28 09:14:44 2009 +0100
[as_devices] python module in LGPL
-----------------------------------------------------------------------
Summary of changes:
.../as_devices/python/AsDevices/Apf27Pwm.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/target/packages/as_devices/python/AsDevices/Apf27Pwm.py b/target/packages/as_devices/python/AsDevices/Apf27Pwm.py
index e5c1e32..ac19491 100644
--- a/target/packages/as_devices/python/AsDevices/Apf27Pwm.py
+++ b/target/packages/as_devices/python/AsDevices/Apf27Pwm.py
@@ -9,7 +9,7 @@
# Copyright (2008) Armadeus Systems
#
# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
+# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
hooks/post-receive
--
armadeus
|
|
From: Julien B a. A. <ar...@us...> - 2009-10-27 21:55:03
|
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 7f2510c6bd02ebf475728fb9846e3421ade85279 (commit)
from 12f30aa66017901fe26dbd72fb217df58cdd44b8 (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 7f2510c6bd02ebf475728fb9846e3421ade85279
Author: Julien Boibessot <jul...@ar...>
Date: Tue Oct 27 22:54:28 2009 +0100
[TOOLS] Cleanup setDAC
-----------------------------------------------------------------------
Summary of changes:
target/packages/max5821ctrl/Makefile | 46 +++--------------
target/packages/max5821ctrl/max5821.h | 56 ++++++++++-----------
target/packages/max5821ctrl/setDAC.c | 88 ++++++++++++++++-----------------
3 files changed, 76 insertions(+), 114 deletions(-)
diff --git a/target/packages/max5821ctrl/Makefile b/target/packages/max5821ctrl/Makefile
index 4d1ece6..eb72e06 100755
--- a/target/packages/max5821ctrl/Makefile
+++ b/target/packages/max5821ctrl/Makefile
@@ -1,59 +1,27 @@
#
-# Makefile for the Armadeus DAC control
+# Makefile for the Armadeus DAC control tool
#
-CFLAGS = -Wall -O
+CFLAGS = -Wall -O
INCLUDES =
PWD := $(shell pwd)
-#HEADERS =
-
-SOURCES = setDAC.c
-OBJECTS = setDAC.o
-
+SOURCES = setDAC.c
+OBJECTS = setDAC.o
TARGET = setDAC
-####### Implicit rules
-
-.SUFFIXES: .cpp .cxx .cc .C .c
-
-.cpp.o:
- $(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $<
-
-.cxx.o:
- $(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $<
-
-.cc.o:
- $(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $<
-
-.C.o:
- $(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $<
-
-.c.o:
- $(CC) -c $(CFLAGS) $(INCLUDES) -o $@ $<
-
-
-####### Build rules
-
-
-$(TARGET): $(OBJECTS) Makefile $(HEADERS)
- @echo
- @echo "Building I2C dac test programm..."
+$(TARGET): $(OBJECTS)
$(CC) $(OBJECTS) $(CFLAGS) $(INCLUDES) -o $(TARGET)
-
all: $(TARGET)
clean:
-rm -f $(TARGET)
-rm -f *.o *~ core
-setDAC.o: setDAC.c max5821.h Makefile
- @echo
- $(CC) -c $(CFLAGS) $(INCLUDES) setDAC.c
-
-
+setDAC.o: setDAC.c max5821.h
+ $(CC) -c $(CFLAGS) $(INCLUDES) setDAC.c
diff --git a/target/packages/max5821ctrl/max5821.h b/target/packages/max5821ctrl/max5821.h
index 85b7330..0d9fda9 100644
--- a/target/packages/max5821ctrl/max5821.h
+++ b/target/packages/max5821ctrl/max5821.h
@@ -23,53 +23,50 @@
*/
-// I2C slave Adresses
-
+/* I2C slave addresses */
#define MAX5821L_IC_SLAVE_ADDRESS_GND 0x38
#define MAX5821L_IC_SLAVE_ADDRESS_VDD 0x39
#define MAX5821M_IC_SLAVE_ADDRESS_GND 0x58
#define MAX5821M_IC_SLAVE_ADDRESS_VDD 0x59
-// command bytes
-
-#define MAX5821_LOAD_DAC_A_IN_REG_B 0x0
-#define MAX5821_LOAD_DAC_B_IN_REG_A 0x1
-#define MAX5821_LOAD_DAC_A 0x4
-#define MAX5821_LOAD_DAC_B 0x5
+/* command bytes */
+#define MAX5821_LOAD_DAC_A_IN_REG_B 0x0
+#define MAX5821_LOAD_DAC_B_IN_REG_A 0x1
+#define MAX5821_LOAD_DAC_A 0x4
+#define MAX5821_LOAD_DAC_B 0x5
#define MAX5821_LOAD_DAC_A_IN_UPDATE_ALL 0x8
#define MAX5821_LOAD_DAC_B_IN_UPDATE_ALL 0x9
#define MAX5821_LOAD_DAC_ALL_IN_UPDATE_ALL 0xC
-#define MAX5821_LOAD_DAC_ALL_IN 0xD
+#define MAX5821_LOAD_DAC_ALL_IN 0xD
-#define MAX5821_UPDATE_ALL_DAC_COMMAND 0xE
-#define MAX5821_EXTENDED_COMMAND_MODE 0xF
+#define MAX5821_UPDATE_ALL_DAC_COMMAND 0xE
+#define MAX5821_EXTENDED_COMMAND_MODE 0xF
#define MAX5821_READ_DAC_A_COMMAND 0x1
#define MAX5821_READ_DAC_B_COMMAND 0x2
-#define POWER_UP 0x0
-#define POWER_DOWN_MODE0 0x1
-#define POWER_DOWN_MODE1 0x2
-#define POWER_DOWN_MODE2 0x3
+#define POWER_UP 0x0
+#define POWER_DOWN_MODE0 0x1
+#define POWER_DOWN_MODE1 0x2
+#define POWER_DOWN_MODE2 0x3
-#define POWER_CTRL_SELECTED 0x1
-#define POWER_CTRL_UNSELECTED 0x0
+#define POWER_CTRL_SELECTED 0x1
+#define POWER_CTRL_UNSELECTED 0x0
#define MAX5821M_MAX_DATA_VALUE 1024
-// transfered data structs.
-
+/* transfered data structs */
typedef struct
{
- unsigned char command;
- unsigned char ctrlB;
- unsigned char ctrlA;
- unsigned char powerMode;
-} extended_command;
+ unsigned char command;
+ unsigned char ctrlB;
+ unsigned char ctrlA;
+ unsigned char powerMode;
+} extended_command;
typedef struct
{
unsigned char command;
- unsigned short data;
+ unsigned short data;
unsigned char Sbits;
} data_command;
@@ -79,22 +76,21 @@ typedef struct
unsigned char command;
} read_command;
-
typedef struct
{
- unsigned short powerMode;
+ unsigned short powerMode;
unsigned short data;
unsigned short Sbits;
} data_read;
-#define Build_data_command( InSruct, Buf ) \
+#define BUILD_DATA_COMMAND(InSruct, Buf) \
{ \
Buf[0] = (InSruct.command << 4) + (unsigned char) (InSruct.data>>6);\
Buf[1] = (unsigned char) (InSruct.data<<2);\
}
-#define Build_extended_command( InSruct, Buf ) \
+#define BUILD_EXTENDED_COMMAND(InSruct, Buf) \
{ \
Buf[0] = (InSruct.command << 4) ;\
Buf[1] = (InSruct.ctrlB << 3) + (InSruct.ctrlA << 2) + InSruct.powerMode;\
-}
+}
diff --git a/target/packages/max5821ctrl/setDAC.c b/target/packages/max5821ctrl/setDAC.c
index e7acd70..c96f5de 100644
--- a/target/packages/max5821ctrl/setDAC.c
+++ b/target/packages/max5821ctrl/setDAC.c
@@ -30,119 +30,117 @@
#include <stdlib.h>
#include <string.h>
-// #include <linux/i2c.h> // seems to make trouble during compiling ....
#include <linux/i2c-dev.h>
-
#include <sys/ioctl.h>
+
#include "max5821.h"
// #define DEBUG_MAX5821 1
-/****************************************************************************************************************************/
void usage()
{
- printf ("Usage: setDAC OUTPUT [VALUE]\n");
- printf ("power down or set DAC output with value 0 - 1023 \n\n");
- printf (" OUTPUT is A , B or AB (both)\n");
- printf (" VALUE must be 0 - 1023 \n\n");
- printf (" If no VALUE is given, then the output is powered down \n");
+ printf("Usage: setDAC OUTPUT [VALUE]\n");
+ printf("Power down or set DAC output with VALUE\n\n");
+ printf(" OUTPUT is A, B or AB (both)\n");
+ printf(" VALUE must be [0 - 1023]\n\n");
+ printf(" If no VALUE is given, then the output is powered down\n");
exit(1);
}
-/****************************************************************************************************************************/
-
int main(int argc, char *argv[])
{
int bus;
int value;
- extended_command powerDownCommand;
- extended_command powerUpCommand;
- data_command setDACOutput;
+ extended_command powerDownCommand = {0, 0, 0, 0};
+ extended_command powerUpCommand = {0, 0, 0, 0};
+ data_command setDACOutput = {0, 0, 0};
unsigned char buf[2];
- if ( (argc !=2) && (argc != 3) )
+ if ((argc != 2) && (argc != 3))
{
usage();
}
- if ((bus = open("/dev/i2c-0",O_RDWR)) < 0)
+ if ((bus = open("/dev/i2c-0", O_RDWR)) < 0)
{
perror("Open error: ");
- exit (1);
+ exit(1);
}
- if ( ioctl(bus ,/*I2C_SLAVE*/ 0x703, MAX5821L_IC_SLAVE_ADDRESS_GND) < 0)
+ if (ioctl(bus,/*I2C_SLAVE*/ 0x703, MAX5821L_IC_SLAVE_ADDRESS_GND) < 0)
{
perror("Ioctl error: ");
- exit (1);
+ exit(1);
}
- powerDownCommand.command = MAX5821_EXTENDED_COMMAND_MODE ;
- powerDownCommand.powerMode = POWER_DOWN_MODE0 ;
- powerUpCommand.command = MAX5821_EXTENDED_COMMAND_MODE ;
- powerUpCommand.powerMode = POWER_UP ;
+ powerDownCommand.command = MAX5821_EXTENDED_COMMAND_MODE;
+ powerDownCommand.powerMode = POWER_DOWN_MODE0;
+ powerUpCommand.command = MAX5821_EXTENDED_COMMAND_MODE;
+ powerUpCommand.powerMode = POWER_UP;
setDACOutput.Sbits = 0;
- if (0==strcmp(argv[1],"A"))
+ if (0 == strcmp(argv[1],"A"))
{
powerDownCommand.ctrlA = POWER_CTRL_SELECTED;
powerDownCommand.ctrlB = POWER_CTRL_UNSELECTED;
powerUpCommand.ctrlA = POWER_CTRL_SELECTED;
powerUpCommand.ctrlB = POWER_CTRL_UNSELECTED;
- setDACOutput.command = MAX5821_LOAD_DAC_A_IN_REG_B ;
+ setDACOutput.command = MAX5821_LOAD_DAC_A_IN_REG_B;
}
- else if (0==strcmp(argv[1],"B"))
+ else if (0 == strcmp(argv[1],"B"))
{
powerDownCommand.ctrlA = POWER_CTRL_UNSELECTED;
powerDownCommand.ctrlB = POWER_CTRL_SELECTED;
powerUpCommand.ctrlA = POWER_CTRL_UNSELECTED;
powerUpCommand.ctrlB = POWER_CTRL_SELECTED;
- setDACOutput.command = MAX5821_LOAD_DAC_B_IN_REG_A ;
+ setDACOutput.command = MAX5821_LOAD_DAC_B_IN_REG_A;
}
- else if (0==strcmp(argv[1],"AB"))
+ else if (0 == strcmp(argv[1],"AB"))
{
powerDownCommand.ctrlA = POWER_CTRL_SELECTED;
powerDownCommand.ctrlB = POWER_CTRL_SELECTED;
powerUpCommand.ctrlA = POWER_CTRL_SELECTED;
powerUpCommand.ctrlB = POWER_CTRL_SELECTED;
- setDACOutput.command = MAX5821_LOAD_DAC_ALL_IN_UPDATE_ALL ;
+ setDACOutput.command = MAX5821_LOAD_DAC_ALL_IN_UPDATE_ALL;
}
else
{
usage();
}
- if (argc == 2 )
+ if (argc == 2)
{
- Build_extended_command( powerDownCommand, buf);
-#ifdef DEBUG_MAX5821
- printf("Set the DAC : %02X %02X \n", buf[0],buf[1] );
+ BUILD_EXTENDED_COMMAND(powerDownCommand, buf);
+#ifdef DEBUG_MAX5821
+ printf("Set the DAC : %02X %02X \n", buf[0], buf[1]);
#endif
}
else
{
value = atoi(argv[2]);
- if (value >= MAX5821M_MAX_DATA_VALUE) usage();
- // first, we power up the DAC j
- Build_extended_command( powerUpCommand, buf);
-#ifdef DEBUG_MAX5821
- printf("Set the DAC : %02X %02X \n", buf[0],buf[1] );
+ if (value >= MAX5821M_MAX_DATA_VALUE)
+ usage();
+ /* first, we power up the DAC */
+ BUILD_EXTENDED_COMMAND(powerUpCommand, buf);
+#ifdef DEBUG_MAX5821
+ printf("Set the DAC : %02X %02X \n", buf[0], buf[1]);
#endif
- if ( 0 > write (bus, buf,2))
+ if (0 > write(bus, buf, 2))
{
printf("Write error\n");
- exit (1);
+ exit(1);
}
setDACOutput.data = value;
- Build_data_command(setDACOutput,buf);
-#ifdef DEBUG_MAX5821
- printf("Set the DAC : %02X %02X \n", buf[0],buf[1] );
+ BUILD_DATA_COMMAND(setDACOutput, buf);
+#ifdef DEBUG_MAX5821
+ printf("Set the DAC : %02X %02X \n", buf[0], buf[1]);
#endif
}
- if ( 0 > write (bus, buf,2))
+ if (0 > write(bus, buf, 2))
{
printf("Write error\n");
- exit (1);
+ exit(1);
}
- exit (0);
+
+ exit(0);
}
hooks/post-receive
--
armadeus
|