Send commitlog mailing list submissions to
commitlog@lists.openmoko.org
To subscribe or unsubscribe via the World Wide Web, visit
http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
[EMAIL PROTECTED]
You can reach the person managing the list at
[EMAIL PROTECTED]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:
1. r4762 - developers/charlie/Wiki ([EMAIL PROTECTED])
2. r4763 - in developers/werner: . owping ([EMAIL PROTECTED])
3. r4764 - developers/werner/owping ([EMAIL PROTECTED])
4. r4765 - developers/werner/wlan-spi/patches-tracking
([EMAIL PROTECTED])
--- Begin Message ---
Author: charlie
Date: 2008-11-06 12:41:57 +0100 (Thu, 06 Nov 2008)
New Revision: 4762
Modified:
developers/charlie/Wiki/ATCommands
developers/charlie/Wiki/Hardware
developers/charlie/Wiki/PyGame
developers/charlie/Wiki/Todo
developers/charlie/Wiki/WelcomePage
developers/charlie/Wiki/Work
developers/charlie/Wiki/emacs
developers/charlie/Wiki/framework
Log:
Updated pesonnal wiki
Modified: developers/charlie/Wiki/ATCommands
===================================================================
--- developers/charlie/Wiki/ATCommands 2008-11-06 08:58:53 UTC (rev 4761)
+++ developers/charlie/Wiki/ATCommands 2008-11-06 11:41:57 UTC (rev 4762)
@@ -1,4 +1,4 @@
-* ATCOmmands
+* ATCommands
- ATZ : start the modem
- AT+IPR? : Get the bit rate of the UART
Modified: developers/charlie/Wiki/Hardware
===================================================================
--- developers/charlie/Wiki/Hardware 2008-11-06 08:58:53 UTC (rev 4761)
+++ developers/charlie/Wiki/Hardware 2008-11-06 11:41:57 UTC (rev 4762)
@@ -1,3 +1,4 @@
+- [[Calypso]]
- [[SMD]]
Modified: developers/charlie/Wiki/PyGame
===================================================================
--- developers/charlie/Wiki/PyGame 2008-11-06 08:58:53 UTC (rev 4761)
+++ developers/charlie/Wiki/PyGame 2008-11-06 11:41:57 UTC (rev 4762)
@@ -1,3 +1,5 @@
+* Pygame
-
-pygame.image.get_extended() should return 1 !!!
+About the png loading problem : To check that pygame has been compiled
+with proper support, we can check that *pygame.image.get_extended()*
+returns 1
Modified: developers/charlie/Wiki/Todo
===================================================================
--- developers/charlie/Wiki/Todo 2008-11-06 08:58:53 UTC (rev 4761)
+++ developers/charlie/Wiki/Todo 2008-11-06 11:41:57 UTC (rev 4762)
@@ -1,9 +1,13 @@
* TODO
-- Write automatic GSM testing script (IN PROGRESS)
+- Write automatic GSM testing script --> in progress
- Check connection
- - Check AT command list, compatible with framework
-- Do the same things with the testing board
-- Update Tichy to use Framework (GRR python-pygame is broken again !)
-- See how to handle SIM + PUK with AT commands (GRRR, I forgot my PIN number
!!!)
-- Put all this in my personal dir (remove private info !!!)
+ - Check AT command list, compatible with framework (do we need to create a
new modem class in ogmsd ?)
+ - How can i automatically get all the needed framework commands ?? (script
done)
+
+- Have a look at Chris production tests framework --> waiting for it to
be online
+- Check MC75i hardware spec, how does it fit into our kernel and production
test
+- Do the same things with the testing board --> ask DKay (2morrow
10am)
+- See how to handle SIM + PUK with AT commands --> I forgot my
PIN number !!!
+
+- BY PLANE TICKETS FOR XMASS !!!
Modified: developers/charlie/Wiki/WelcomePage
===================================================================
--- developers/charlie/Wiki/WelcomePage 2008-11-06 08:58:53 UTC (rev 4761)
+++ developers/charlie/Wiki/WelcomePage 2008-11-06 11:41:57 UTC (rev 4762)
@@ -1,7 +1,14 @@
* Welcome Page
+Welcome to my personal wiki. Most of the stuffs here are only for my
+personal use, so don't expect to find nuch useful information
+here. But I will use this wiki to send link to documentation when
+needed.
+
+To see the page correctly, and beeing able to navigate through them,
+use emacs-wiki-mode (need to set up emacs-wiki to use this directory
+as wiki dir though)
+
- [[Work]]
-- [[People]]
- [[Todo]]
-- [[Places]]
Modified: developers/charlie/Wiki/Work
===================================================================
--- developers/charlie/Wiki/Work 2008-11-06 08:58:53 UTC (rev 4761)
+++ developers/charlie/Wiki/Work 2008-11-06 11:41:57 UTC (rev 4762)
@@ -20,8 +20,8 @@
- [[Hardware]]
+- [[OpenmokoToFix]]
-
** Tools
- [[vi]]
- [[emacs]]
Modified: developers/charlie/Wiki/emacs
===================================================================
--- developers/charlie/Wiki/emacs 2008-11-06 08:58:53 UTC (rev 4761)
+++ developers/charlie/Wiki/emacs 2008-11-06 11:41:57 UTC (rev 4762)
@@ -1,6 +1,8 @@
* Emacs
+(setq-default indent-tabs-mode nil)
+
M-x c-set-style
set the c style for indentation
@@ -18,4 +20,7 @@
* Text mode
-M-q : auto justify paragraph
\ No newline at end of file
+M-q : auto justify paragraph
+
+* python mode
+M-; : add comment at the end of a line (but it uses tab :( )
Modified: developers/charlie/Wiki/framework
===================================================================
--- developers/charlie/Wiki/framework 2008-11-06 08:58:53 UTC (rev 4761)
+++ developers/charlie/Wiki/framework 2008-11-06 11:41:57 UTC (rev 4762)
@@ -3,9 +3,48 @@
* Framework
** How to run it
-I use nfs, then just start it, don't forget to set PYTHONPATH.
-We may need to edit /etc/framework.conf, we can set the debug output and the
log level of all subsystems.
+I use nfs, then just start it, don't forget to set PYTHONPATH. We may
+need to edit /etc/framework.conf, we can set the debug output and the
+log level of all subsystems.
+
** TODO
+
- More unittests
+** List of AT commands used by TI modem in framework
+
+(I used a small scrip to retrieve this list it may contains error but
+it is just to get an idea...)
+
+The Hidden commands are the ones that don't show up with the AT+CLAC
+command.
+
+AT%CBHZ
+AT%CGEREP
+AT%CGREG
+AT%CNIV
+AT%CPI
+AT%CSCN
+AT%CSQ
+AT%CSTAT
+AT%N0125 # Those are the magic commands for noise reduction
+AT%N028B # And echo cancel !
+AT%SLEEP (Hidden)
+AT+CAOC (Hidden)
+AT+CCWA
+AT+CEER
+AT+CGEREP
+AT+CGREG (Hidden)
+AT+CHLD (Hidden, but there is a %CHLD)
+AT+CLIP
+AT+COLP
+AT+CPAS
+AT+CREG
+AT+CSSN
+AT+CTZR
+AT+CTZU
[EMAIL PROTECTED]
+ATA
+ATH
+
--- End Message ---
--- Begin Message ---
Author: werner
Date: 2008-11-07 02:15:33 +0100 (Fri, 07 Nov 2008)
New Revision: 4763
Added:
developers/werner/owping/
developers/werner/owping/Makefile
developers/werner/owping/owping.c
developers/werner/owping/owping.h
developers/werner/owping/rx.c
developers/werner/owping/tx.c
Log:
One-way ping (UDP) to detect the sources of latency and jitter.
Added: developers/werner/owping/Makefile
===================================================================
--- developers/werner/owping/Makefile (rev 0)
+++ developers/werner/owping/Makefile 2008-11-07 01:15:33 UTC (rev 4763)
@@ -0,0 +1,34 @@
+CC=arm-angstrom-linux-gnueabi-gcc
+
+CFLAGS=-Wall -Wshadow -g -O
+
+PREFIX=/usr
+
+NAME=owping
+OBJS=owping.o rx.o tx.o
+
+.PHONY: all install uninstall clean depend spotless
+
+all: $(NAME)
+
+$(NAME): $(OBJS)
+
+install: $(NAME)
+ install -D $(NAME) $(PREFIX)/bin/$(NAME)
+
+uninstall:
+ rm -f $(PREFIX)/bin/$(NAME)
+
+depend:
+ $(CPP) $(CFLAGS) -MM -MG *.c >.depend || \
+ { rm -f .depend; exit 1; }
+
+ifeq (.depend,$(wildcard .depend))
+include .depend
+endif
+
+clean:
+ rm -f $(OBJS) .depend
+
+spotless: clean
+ rm -f $(NAME)
Added: developers/werner/owping/owping.c
===================================================================
--- developers/werner/owping/owping.c (rev 0)
+++ developers/werner/owping/owping.c 2008-11-07 01:15:33 UTC (rev 4763)
@@ -0,0 +1,52 @@
+/*
+ * owping.c - One-way ping (UDP)
+ *
+ * Copyright (C) 2008 by OpenMoko, Inc.
+ * Written by Werner Almesberger <[EMAIL PROTECTED]>
+ * All Rights Reserved
+ *
+ * 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.
+ */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <arpa/inet.h>
+
+#include "owping.h"
+
+
+#define PORT 23867
+
+
+static void usage(const char *name)
+{
+ fprintf(stderr, "usage: %s [ip_address]\n", name);
+ exit(1);
+}
+
+
+int main(int argc, char **argv)
+{
+ struct sockaddr_in addr;
+
+ switch (argc) {
+ case 1:
+ rx(PORT);
+ break;
+ case 2:
+ addr.sin_family = AF_INET;
+ addr.sin_addr.s_addr = inet_addr(argv[1]);
+ addr.sin_port = htons(PORT);
+ if (addr.sin_addr.s_addr == (in_addr_t) -1)
+ usage(*argv);
+ tx(addr, 100);
+ break;
+ default:
+ usage(*argv);
+ }
+ return 0;
+}
Added: developers/werner/owping/owping.h
===================================================================
--- developers/werner/owping/owping.h (rev 0)
+++ developers/werner/owping/owping.h 2008-11-07 01:15:33 UTC (rev 4763)
@@ -0,0 +1,32 @@
+/*
+ * owping.h - One-way ping (UDP)
+ *
+ * Copyright (C) 2008 by OpenMoko, Inc.
+ * Written by Werner Almesberger <[EMAIL PROTECTED]>
+ * All Rights Reserved
+ *
+ * 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.
+ */
+
+
+#ifndef OWPING_H
+#define OWPING_H
+
+#include <stdint.h>
+#include <arpa/inet.h>
+
+
+struct owping {
+ uint32_t seq;
+ uint32_t tv_sec;
+ uint32_t tv_usec;
+};
+
+
+void tx(struct sockaddr_in addr, int num);
+void rx(int port);
+
+#endif /* OWPING_H */
Added: developers/werner/owping/rx.c
===================================================================
--- developers/werner/owping/rx.c (rev 0)
+++ developers/werner/owping/rx.c 2008-11-07 01:15:33 UTC (rev 4763)
@@ -0,0 +1,92 @@
+/*
+ * rx.c - One-way ping (UDP) receiver
+ *
+ * Copyright (C) 2008 by OpenMoko, Inc.
+ * Written by Werner Almesberger <[EMAIL PROTECTED]>
+ * All Rights Reserved
+ *
+ * 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.
+ */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <sys/ioctl.h>
+#include <arpa/inet.h>
+
+#include "owping.h"
+
+
+static void delta(struct timeval t0, struct timeval t1)
+{
+ long us;
+
+ us = t1.tv_usec-t0.tv_usec;
+ us += (t1.tv_sec-t0.tv_sec)*1000000;
+ printf(" %ld.%03ldms", us/1000, us % 1000);
+}
+
+
+void rx(int port)
+{
+ struct sockaddr_in addr;
+ int s;
+
+ s = socket(PF_INET, SOCK_DGRAM, 0);
+ if (s < 0) {
+ perror("socket");
+ exit(1);
+ }
+
+ addr.sin_family = AF_INET;
+ addr.sin_addr.s_addr = INADDR_ANY;
+ addr.sin_port = htons(port);
+ if (bind(s, (const struct sockaddr *) &addr, sizeof(addr)) < 0) {
+ perror("bind");
+ exit(1);
+ }
+
+ // setsockopt timestamp
+
+ while (1) {
+ struct owping buf;
+ socklen_t addr_len;
+ ssize_t got;
+ struct timeval t_src, t_itf, t_user;
+
+ addr_len = sizeof(addr);
+ got = recvfrom(s, &buf, sizeof(buf), 0,
+ (struct sockaddr *) &addr, &addr_len);
+ if (got < 0) {
+ perror("recvmsg");
+ exit(1);
+ }
+ if (got == 1)
+ return;
+ if (got != sizeof(buf)) {
+ fprintf(stderr, "bad read: expected %u, got %u\n",
+ (unsigned) sizeof(buf), (unsigned) got);
+ exit(1);
+ }
+ if (gettimeofday(&t_user, NULL) < 0) {
+ perror("gettimeofday");
+ exit(1);
+ }
+ if (ioctl(s, SIOCGSTAMP, &t_itf) < 0) {
+ perror("ioctl(SIOCGSTAMP)");
+ exit(1);
+ }
+ printf("seq=%u from %s:", (unsigned) ntohl(buf.seq),
+ inet_ntoa(addr.sin_addr));
+ t_src.tv_sec = ntohl(buf.tv_sec);
+ t_src.tv_usec = ntohl(buf.tv_usec);
+ delta(t_src, t_itf);
+ delta(t_src, t_user);
+ putchar('\n');
+ }
+}
Added: developers/werner/owping/tx.c
===================================================================
--- developers/werner/owping/tx.c (rev 0)
+++ developers/werner/owping/tx.c 2008-11-07 01:15:33 UTC (rev 4763)
@@ -0,0 +1,76 @@
+/*
+ * tx.c - One-way ping (UDP) sender
+ *
+ * Copyright (C) 2008 by OpenMoko, Inc.
+ * Written by Werner Almesberger <[EMAIL PROTECTED]>
+ * All Rights Reserved
+ *
+ * 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.
+ */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+
+#include "owping.h"
+
+
+void tx(struct sockaddr_in addr, int num)
+{
+ ssize_t sent;
+ int s, seq;
+
+ s = socket(PF_INET, SOCK_DGRAM, 0);
+ if (s < 0) {
+ perror("socket");
+ exit(1);
+ }
+
+ if (connect(s, (const struct sockaddr *) &addr, sizeof(addr)) < 0) {
+ perror("connect");
+ exit(1);
+ }
+
+ for (seq = 0; seq != num; seq++) {
+ struct owping buf;
+ struct timeval now;
+
+ if (seq)
+ sleep(1);
+ buf.seq = htonl(seq);
+ if (gettimeofday(&now, NULL) < 0) {
+ perror("gettimeofday");
+ exit(1);
+ }
+ buf.tv_sec = htonl(now.tv_sec);
+ buf.tv_usec = htonl(now.tv_usec);
+
+ sent = write(s, &buf, sizeof(buf));
+ if (sent < 0) {
+ perror("write");
+ exit(1);
+ }
+ if (sent != sizeof(buf)) {
+ fprintf(stderr, "bad write: %u < %u\n", (unsigned) sent,
+ (unsigned) sizeof(buf));
+ exit(1);
+ }
+ }
+
+ sent = write(s, "", 1);
+ if (sent < 0) {
+ perror("write");
+ exit(1);
+ }
+ if (sent != 1) {
+ fprintf(stderr, "bad write: %u < 1\n", (unsigned) sent);
+ exit(1);
+ }
+}
--- End Message ---
--- Begin Message ---
Author: werner
Date: 2008-11-07 04:37:29 +0100 (Fri, 07 Nov 2008)
New Revision: 4764
Added:
developers/werner/owping/README
Modified:
developers/werner/owping/Makefile
developers/werner/owping/owping.c
developers/werner/owping/rx.c
developers/werner/owping/tx.c
Log:
- added README with a list of known issues
- receiver prints ping-like latency statistics at the end
- sender supports -c count option, like ping
- sender properly shuts down the receiver if failing or stopped with SIGINT
Modified: developers/werner/owping/Makefile
===================================================================
--- developers/werner/owping/Makefile 2008-11-07 01:15:33 UTC (rev 4763)
+++ developers/werner/owping/Makefile 2008-11-07 03:37:29 UTC (rev 4764)
@@ -1,6 +1,7 @@
CC=arm-angstrom-linux-gnueabi-gcc
CFLAGS=-Wall -Wshadow -g -O
+LDFLAGS=-lm
PREFIX=/usr
Added: developers/werner/owping/README
===================================================================
--- developers/werner/owping/README (rev 0)
+++ developers/werner/owping/README 2008-11-07 03:37:29 UTC (rev 4764)
@@ -0,0 +1,39 @@
+owping - One-way ping (UDP)
+===========================
+
+owping sends small UDP packets to determine the one-way latency and,
+indirectly, the one-way jitter.
+
+
+Usage
+-----
+
+Receiver:
+
+% owping
+
+Sender:
+
+% owping [-c count] ip_address
+
+
+Known issues
+------------
+
+- accuracy of latency measurements depends on precisely synchronized system
+ clocks on both sides (this is fundamentally unavoidable)
+
+- jitter measurements include application delays in the sending owping.
+ Should increase CPU priority.
+
+- even better jitter measurements may be possible if the sender includes
+ the time between transmissions in the packet data and the receiver
+ compares this with the inter-arrival time it measures.
+
+- receiver should also handle SIGINT, and print statistics
+
+- receiver should count gaps in the sequence numbers
+
+- should support host name resolution
+
+- should support setting the port number
Modified: developers/werner/owping/owping.c
===================================================================
--- developers/werner/owping/owping.c 2008-11-07 01:15:33 UTC (rev 4763)
+++ developers/werner/owping/owping.c 2008-11-07 03:37:29 UTC (rev 4764)
@@ -14,6 +14,7 @@
#include <stdlib.h>
#include <stdio.h>
+#include <unistd.h>
#include <arpa/inet.h>
#include "owping.h"
@@ -24,7 +25,7 @@
static void usage(const char *name)
{
- fprintf(stderr, "usage: %s [ip_address]\n", name);
+ fprintf(stderr, "usage: %s [[-c count] ip_address]\n", name);
exit(1);
}
@@ -32,18 +33,32 @@
int main(int argc, char **argv)
{
struct sockaddr_in addr;
+ int count = -1;
+ int c;
+ char *end;
- switch (argc) {
- case 1:
+ while ((c = getopt(argc, argv, "c:")) != EOF)
+ switch (c) {
+ case 'c':
+ count = strtoul(optarg, &end, 10);
+ if (*end)
+ usage(*argv);
+ break;
+ default:
+ usage(*argv);
+ }
+
+ switch (argc-optind) {
+ case 0:
rx(PORT);
break;
- case 2:
+ case 1:
addr.sin_family = AF_INET;
- addr.sin_addr.s_addr = inet_addr(argv[1]);
+ addr.sin_addr.s_addr = inet_addr(argv[optind]);
addr.sin_port = htons(PORT);
if (addr.sin_addr.s_addr == (in_addr_t) -1)
usage(*argv);
- tx(addr, 100);
+ tx(addr, count);
break;
default:
usage(*argv);
Modified: developers/werner/owping/rx.c
===================================================================
--- developers/werner/owping/rx.c 2008-11-07 01:15:33 UTC (rev 4763)
+++ developers/werner/owping/rx.c 2008-11-07 03:37:29 UTC (rev 4764)
@@ -14,6 +14,8 @@
#include <stdlib.h>
#include <stdio.h>
+#include <string.h>
+#include <math.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
@@ -22,18 +24,62 @@
#include "owping.h"
-static void delta(struct timeval t0, struct timeval t1)
+struct stats {
+ long min, max;
+ double sum, sq;
+ int n;
+};
+
+
+static void stats_init(struct stats *stats)
{
+ memset(stats, 0, sizeof(*stats));
+}
+
+
+static void stats_print(const char *label, const struct stats *stats)
+{
+ double avg = stats->sum/stats->n;
+
+ printf("%s min/avg/max/sdev = %.3f/%.3f/%.3f/%.3f ms (%d packets)\n",
+ label,
+ stats->min/1000.0, avg/1000.0, stats->max/1000.0,
+ sqrt(stats->sq/stats->n-avg*avg)/1000.0,
+ stats->n);
+}
+
+
+static void delta(struct timeval t0, struct timeval t1, struct stats *stats)
+{
+ char sign = ' ';
long us;
us = t1.tv_usec-t0.tv_usec;
us += (t1.tv_sec-t0.tv_sec)*1000000;
- printf(" %ld.%03ldms", us/1000, us % 1000);
+
+ if (!stats->n) {
+ stats->min = stats->max = us;
+ } else {
+ if (stats->min > us)
+ stats->min = us;
+ if (stats->max < us)
+ stats->max = us;
+ }
+ stats->n++;
+ stats->sum += us;
+ stats->sq += (double) us*us;
+
+ if (us < 0) {
+ us = -us;
+ sign = '-';
+ }
+ printf(" %c%ld.%03ldms", sign, us/1000, us % 1000);
}
void rx(int port)
{
+ struct stats stats_itf, stats_user;
struct sockaddr_in addr;
int s;
@@ -51,7 +97,8 @@
exit(1);
}
- // setsockopt timestamp
+ stats_init(&stats_itf);
+ stats_init(&stats_user);
while (1) {
struct owping buf;
@@ -67,7 +114,7 @@
exit(1);
}
if (got == 1)
- return;
+ break;
if (got != sizeof(buf)) {
fprintf(stderr, "bad read: expected %u, got %u\n",
(unsigned) sizeof(buf), (unsigned) got);
@@ -85,8 +132,11 @@
inet_ntoa(addr.sin_addr));
t_src.tv_sec = ntohl(buf.tv_sec);
t_src.tv_usec = ntohl(buf.tv_usec);
- delta(t_src, t_itf);
- delta(t_src, t_user);
+ delta(t_src, t_itf, &stats_itf);
+ delta(t_src, t_user, &stats_user);
putchar('\n');
}
+ stats_print("itf:", &stats_itf);
+ stats_print("app:", &stats_user);
+
}
Modified: developers/werner/owping/tx.c
===================================================================
--- developers/werner/owping/tx.c 2008-11-07 01:15:33 UTC (rev 4763)
+++ developers/werner/owping/tx.c 2008-11-07 03:37:29 UTC (rev 4764)
@@ -15,6 +15,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
+#include <signal.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <arpa/inet.h>
@@ -22,10 +23,26 @@
#include "owping.h"
+static int s;
+
+
+static void cleanup(void)
+{
+ write(s, "", 1);
+}
+
+
+static void handler(int sig)
+{
+ cleanup();
+ _exit(0);
+}
+
+
void tx(struct sockaddr_in addr, int num)
{
ssize_t sent;
- int s, seq;
+ int seq;
s = socket(PF_INET, SOCK_DGRAM, 0);
if (s < 0) {
@@ -38,7 +55,16 @@
exit(1);
}
- for (seq = 0; seq != num; seq++) {
+ if (atexit(cleanup)) {
+ perror("atexit");
+ exit(1);
+ }
+ if (signal(SIGINT, handler) == SIG_ERR) {
+ perror("signal(SIGINT)");
+ exit(1);
+ }
+
+ for (seq = 0; num < 0 || seq != num; seq++) {
struct owping buf;
struct timeval now;
@@ -63,14 +89,4 @@
exit(1);
}
}
-
- sent = write(s, "", 1);
- if (sent < 0) {
- perror("write");
- exit(1);
- }
- if (sent != 1) {
- fprintf(stderr, "bad write: %u < 1\n", (unsigned) sent);
- exit(1);
- }
}
--- End Message ---
--- Begin Message ---
Author: werner
Date: 2008-11-07 04:50:29 +0100 (Fri, 07 Nov 2008)
New Revision: 4765
Added:
developers/werner/wlan-spi/patches-tracking/find-irq-blockers.patch
Log:
WIP.
Added: developers/werner/wlan-spi/patches-tracking/find-irq-blockers.patch
===================================================================
--- developers/werner/wlan-spi/patches-tracking/find-irq-blockers.patch
(rev 0)
+++ developers/werner/wlan-spi/patches-tracking/find-irq-blockers.patch
2008-11-07 03:50:29 UTC (rev 4765)
@@ -0,0 +1,257 @@
+Quick and dirty interrupt blocking time detector.
+
+Index: ktrack/arch/arm/include/asm/irqflags.h
+===================================================================
+--- ktrack.orig/arch/arm/include/asm/irqflags.h 2008-11-05
23:28:34.000000000 -0200
++++ ktrack/arch/arm/include/asm/irqflags.h 2008-11-05 23:53:25.000000000
-0200
+@@ -5,6 +5,12 @@
+
+ #include <asm/ptrace.h>
+
++
++void iblock_start(void);
++void iblock_end(void);
++void iblock_end_maybe(unsigned long flags);
++
++
+ /*
+ * CPU interrupt mask handling.
+ */
+@@ -31,6 +37,7 @@
+ #define raw_local_irq_save(x) \
+ ({ \
+ unsigned long temp; \
++ iblock_start(); \
+ (void) (&temp == &x); \
+ __asm__ __volatile__( \
+ "mrs %0, cpsr @ local_irq_save\n" \
+@@ -47,6 +54,7 @@
+ #define raw_local_irq_enable() \
+ ({ \
+ unsigned long temp; \
++ iblock_start(); \
+ __asm__ __volatile__( \
+ "mrs %0, cpsr @ local_irq_enable\n" \
+ " bic %0, %0, #128\n" \
+@@ -62,6 +70,7 @@
+ #define raw_local_irq_disable() \
+ ({ \
+ unsigned long temp; \
++ iblock_start(); \
+ __asm__ __volatile__( \
+ "mrs %0, cpsr @ local_irq_disable\n" \
+ " orr %0, %0, #128\n" \
+@@ -117,11 +126,12 @@
+ * restore saved IRQ & FIQ state
+ */
+ #define raw_local_irq_restore(x) \
++ ({ iblock_end_maybe(x); \
+ __asm__ __volatile__( \
+ "msr cpsr_c, %0 @ local_irq_restore\n" \
+ : \
+ : "r" (x) \
+- : "memory", "cc")
++ : "memory", "cc"); })
+
+ #define raw_irqs_disabled_flags(flags) \
+ ({ \
+Index: ktrack/arch/arm/kernel/Makefile
+===================================================================
+--- ktrack.orig/arch/arm/kernel/Makefile 2008-11-05 23:50:06.000000000
-0200
++++ ktrack/arch/arm/kernel/Makefile 2008-11-07 01:47:47.000000000 -0200
+@@ -44,5 +44,6 @@
+
+ head-y := head$(MMUEXT).o
+ obj-$(CONFIG_DEBUG_LL) += debug.o
++obj-y += iblock.o
+
+ extra-y := $(head-y) init_task.o vmlinux.lds
+Index: ktrack/arch/arm/plat-s3c/time.c
+===================================================================
+--- ktrack.orig/arch/arm/plat-s3c/time.c 2008-11-06 00:07:12.000000000
-0200
++++ ktrack/arch/arm/plat-s3c/time.c 2008-11-06 00:07:18.000000000 -0200
+@@ -96,7 +96,7 @@
+ * IRQs are disabled before entering here from do_gettimeofday()
+ */
+
+-static unsigned long s3c2410_gettimeoffset (void)
++unsigned long s3c2410_gettimeoffset (void)
+ {
+ unsigned long tdone;
+ unsigned long tval;
+Index: ktrack/arch/arm/plat-s3c24xx/time.c
+===================================================================
+--- ktrack.orig/arch/arm/plat-s3c24xx/time.c 2008-11-06 00:03:12.000000000
-0200
++++ ktrack/arch/arm/plat-s3c24xx/time.c 2008-11-06 00:03:16.000000000
-0200
+@@ -99,7 +99,7 @@
+
+ #define SRCPND_TIMER4 (1<<(IRQ_TIMER4 - IRQ_EINT0))
+
+-static unsigned long s3c2410_gettimeoffset (void)
++unsigned long s3c2410_gettimeoffset (void)
+ {
+ unsigned long tdone;
+ unsigned long irqpend;
+Index: ktrack/arch/arm/kernel/iblock.c
+===================================================================
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ ktrack/arch/arm/kernel/iblock.c 2008-11-07 01:46:40.000000000 -0200
+@@ -0,0 +1,158 @@
++/*
++ *
++ * /sys/kernel/iblock/
++ * All times are in microseconds (us).
++ *
++ * - limit
++ * Interrupt blocking time reporting limit, in microseconds.
++ * 0 disables reporting. Auto-resets to zero after reporting.
++ *
++ * - max
++ * Maximum blocking time recorded. Reset to zero by writing anything.
++ *
++ * - test
++ * Force a delay with interrupts disabled.
++ *
++ */
++
++
++#include <linux/kernel.h>
++#include <linux/sysfs.h>
++#include <linux/kobject.h>
++#include <linux/device.h>
++#include <linux/init.h>
++#include <linux/delay.h>
++#include <asm/irqflags.h>
++
++
++unsigned long s3c2410_gettimeoffset(void);
++
++
++static unsigned long iblock_t0;
++static int iblock_limit;
++static int iblock_max;
++
++
++void iblock_start(void)
++{
++ unsigned long flags;
++
++ raw_local_save_flags(flags);
++ if (raw_irqs_disabled_flags(flags))
++ return;
++ iblock_t0 = s3c2410_gettimeoffset();
++}
++
++
++void iblock_end(void)
++{
++ unsigned long flags;
++ unsigned long t, us;
++
++ raw_local_save_flags(flags);
++ if (!raw_irqs_disabled_flags(flags))
++ return;
++ if (!iblock_t0)
++ return;
++ t = s3c2410_gettimeoffset();
++ us = t-iblock_t0;
++ if (us > 40000000)
++ return;
++ if (us > iblock_max)
++ iblock_max = us;
++ if (!iblock_limit)
++ return;
++ if (us < iblock_limit)
++ return;
++ iblock_limit = 0;
++ printk(KERN_ERR "interrupts were disabled for %lu us !\n", us);
++ WARN_ON(1);
++}
++
++
++void iblock_end_maybe(unsigned long flags)
++{
++ if (raw_irqs_disabled_flags(flags))
++ return;
++ iblock_end();
++}
++
++
++static ssize_t limit_read(struct device *dev, struct device_attribute *attr,
++ char *buf)
++{
++ return sprintf(buf, "%u us\n", iblock_limit);
++}
++
++
++static ssize_t limit_write(struct device *dev, struct device_attribute *attr,
++ const char *buf, size_t count)
++{
++ unsigned long tmp;
++ char *end;
++
++ tmp = simple_strtoul(buf, &end, 0);
++ if (end == buf)
++ return -EINVAL;
++ iblock_limit = tmp;
++ return count;
++}
++
++
++static ssize_t max_read(struct device *dev, struct device_attribute *attr,
++ char *buf)
++{
++ return sprintf(buf, "%u us\n", iblock_max);
++}
++
++
++static ssize_t max_write(struct device *dev, struct device_attribute *attr,
++ const char *buf, size_t count)
++{
++ iblock_max = 0;
++ return count;
++}
++
++
++static ssize_t test_write(struct device *dev,
++ struct device_attribute *attr, const char *buf, size_t count)
++{
++ unsigned long tmp, flags;
++ char *end;
++
++ tmp = simple_strtoul(buf, &end, 0);
++ if (end == buf)
++ return -EINVAL;
++ local_irq_save(flags);
++ udelay(tmp);
++ local_irq_restore(flags);
++ return count;
++}
++
++
++static DEVICE_ATTR(limit, 0644, limit_read, limit_write);
++static DEVICE_ATTR(max, 0644, max_read, max_write);
++static DEVICE_ATTR(test, 0200, NULL, test_write);
++
++
++static struct attribute *sysfs_entries[] = {
++ &dev_attr_limit.attr,
++ &dev_attr_max.attr,
++ &dev_attr_test.attr,
++ NULL
++};
++
++
++static struct attribute_group attr_group = {
++ .name = "iblock",
++ .attrs = sysfs_entries,
++};
++
++
++static int __devinit iblock_init(void)
++{
++ return sysfs_create_group(kernel_kobj, &attr_group);
++}
++
++
++module_init(iblock_init);
--- End Message ---
_______________________________________________
commitlog mailing list
commitlog@lists.openmoko.org
http://lists.openmoko.org/mailman/listinfo/commitlog