Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
Loading items

Target

Select target project
  • pgerwinski/bs
  • cloepke/bs
  • khaleeliyeh/bs
3 results
Select Git revision
Loading items
Show changes
Showing
with 0 additions and 269 deletions
cassini/home/peter/bo/2016ss/bs/20160418> echo '|' | hexdump -C 00000000 7c 0a ||.|
00000002
cassini/home/peter/bo/2016ss/bs/20160418> echo '¦' | hexdump -C
00000000 c2 a6 0a |...|
00000003
cassini/home/peter/bo/2016ss/bs/20160418> echo "Schlimmer geht nimmer." ¦ sed -e 's/nim/im/g' ¦ hexdump -C
Schlimmer geht nimmer. ¦ sed -e s/nim/im/g ¦ hexdump -C
cassini/home/peter/bo/2016ss/bs/20160418> echo "Schlimmer geht nimmer." | sed -e 's/nim/im/g' | hexdump -C
00000000 53 63 68 6c 69 6d 6d 65 72 20 67 65 68 74 20 69 |Schlimmer geht i|
00000010 6d 6d 65 72 2e 0a |mmer..|
00000016
cassini/home/peter/bo/2016ss/bs/20160418> echo "Schlimmer geht nimmer." ¦ sed -e 's/nim/im/g' ¦ hexdump -C | hexdump -C
00000000 53 63 68 6c 69 6d 6d 65 72 20 67 65 68 74 20 6e |Schlimmer geht n|
00000010 69 6d 6d 65 72 2e 20 c2 a6 20 73 65 64 20 2d 65 |immer. .. sed -e|
00000020 20 73 2f 6e 69 6d 2f 69 6d 2f 67 20 c2 a6 20 68 | s/nim/im/g .. h|
00000030 65 78 64 75 6d 70 20 2d 43 0a |exdump -C.|
0000003a
20160418/white.png

657 B

Treiberentwicklung, 02.05.2016, 11:37:07
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Entwicklung einer Character-Device für ein Raspberry Pi @@@
unter Raspbian @@@
Eine funktionierende Internet-Verbindung wird vorausgesetzt.
$ sudo su -
Password:
# export http_proxy=http://cache.hs-bochum.de:8080
# apt-get install bc libncurses5-dev
...
# rpi-update
# wget https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source \
-O /usr/bin/rpi-source
# chmod +x /usr/bin/rpi-source # ==8-O Datei aus dem Internet herunterladen
# rpi-source --tag-update # und unbesehen ausführen!
*** gcc version check: OK
...
(lädt 140 MB herunter)
...
Danach sollten die Kernel-Header und Entwicklungswerkzeuge einsatzbereit sein.
Quelltext von Christian Löpke herunterladen:
$ wget https://gitlab.cvh-server.de/cloepke/bs/raw/master/20160425/chardev-1write.c
$ wget https://gitlab.cvh-server.de/cloepke/bs/raw/master/20160425/Makefile
Rolle des %eax-Registers in printf(), 02.05.2016, 15:23:22
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://stackoverflow.com/questions/6212665
Suchbegriffe: Why is eax zeroed before a call to printf?
--> Anzahl der übergebenen Fließkommazahlen
#include <printf.h>
int main (void)
{
printf ("Hello, world!\n");
return 0;
}
#include <unistd.h>
int main (void)
{
write (0, "Hello, world!\n", 14);
return 0;
}
#include <unistd.h>
int main (void)
{
write (0, "Hello, world!\n", 14);
}
#include <unistd.h>
int main (void)
{
write (0, "", 0);
}
../common/os-layers-1.jpg
\ No newline at end of file
../common/os-layers-2.jpg
\ No newline at end of file
../common/os-layers-3.jpg
\ No newline at end of file
../common/os-layers-4.jpg
\ No newline at end of file
../common/os-layers-5.jpg
\ No newline at end of file
#include <stdio.h>
#include <string.h>
int main (void)
{
int compare;
compare = strcmp ("Dings", "Bums");
printf ("%d\n", compare);
compare = strcmp ("Bums", "Dings");
printf ("%d\n", compare);
compare = strcmp ("Dings", "Dings");
printf ("%d\n", compare);
if (!strcmp ("Bums", "Bums"))
printf ("Strings sind gleich.\n");
return 0;
}
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>
volatile sig_atomic_t keep_going = 1;
struct timeval tv;
int uOffset;
void exitHandler(int sig)
{
keep_going = 0;
}
void catchAlarm (int sig)
{
if(keep_going)
alarm(10);
gettimeofday(&tv, NULL); //Get current time
printf("Hello World at %d seconds and %d microseconds! us between: %d microseconds!\n",
(int)tv.tv_sec, (int)tv.tv_usec, (int)tv.tv_usec - uOffset);
uOffset = (int)tv.tv_usec;
}
int main(void)
{
keep_going = 1;
uOffset = 0;
signal(SIGINT, exitHandler);
signal(SIGALRM, catchAlarm);
alarm(10);
while(keep_going);
}
/*
ALARM alle 1 Sekunden mittels IRealTimers und manueller Aktivierung des Timers mittels alarm().
Nachteil gegenüber einmaligem Intervall Setup: einige µs gehen bei jedem "nachstellen" des Int.
in catchAlarm() verloren.
*/
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/time.h>
volatile sig_atomic_t keep_going = 1;
struct timeval tv;
int uOffset;
void exitHandler(int sig)
{
keep_going = 0;
}
void catchAlarm (int sig)
{
if(keep_going)
alarm(1);
gettimeofday(&tv, NULL); //Get current time
printf("Hello World at %d seconds and %d microseconds! us between: %d microseconds!\n",
(int)tv.tv_sec, (int)tv.tv_usec, (int)tv.tv_usec - uOffset);
uOffset = (int)tv.tv_usec;
}
int main(void)
{
keep_going = 1;
uOffset = 0;
signal(SIGINT, exitHandler);
signal(SIGALRM, catchAlarm);
alarm(1);
while(keep_going);
}
#include <signal.h>
#include <stdio.h>
static void signal_handler (int signo)
{
printf ("Hello, world!\n");
}
int main (void)
{
if (signal (SIGINT, signal_handler) == SIG_ERR)
{
fputs ("Error installing signal handler.\n", stderr);
return 1;
}
while (1);
return 0;
}
#include <signal.h>
#include <stdio.h>
static void signal_handler (int signo)
{
printf ("Hello, world!\n");
}
int main (void)
{
if (signal (SIGUSR1, signal_handler) == SIG_ERR)
{
fputs ("Error installing signal handler.\n", stderr);
return 1;
}
while (1);
return 0;
}
#include <signal.h>
#include <stdio.h>
#include <sys/time.h>
static void signal_handler (int signo)
{
printf ("Hello, world!\n");
}
int main (void)
{
if (signal (SIGVTALRM, signal_handler) == SIG_ERR)
{
fputs ("Error installing signal handler.\n", stderr);
return 1;
}
struct itimerval timer;
timer.it_value.tv_sec = 1;
timer.it_value.tv_usec = 0;
timer.it_interval.tv_sec = 1;
timer.it_interval.tv_usec = 0;
setitimer (ITIMER_VIRTUAL, &timer, NULL);
while (1);
return 0;
}
#include <signal.h>
#include <stdio.h>
#include <sys/time.h>
#include <unistd.h>
static void signal_handler (int signo)
{
printf ("Hello, world!\n");
}
int main (void)
{
if (signal (SIGVTALRM, signal_handler) == SIG_ERR)
{
fputs ("Error installing signal handler.\n", stderr);
return 1;
}
struct itimerval timer;
timer.it_value.tv_sec = 1;
timer.it_value.tv_usec = 0;
timer.it_interval.tv_sec = 1;
timer.it_interval.tv_usec = 0;
setitimer (ITIMER_VIRTUAL, &timer, NULL);
while (1)
sleep (10);
return 0;
}