2014年5月30日金曜日

Raspberry Pi ACT LEDの制御について

元ネタはここ
アセンブリで、GPIOを制御するレジスターに(マップされたメモリの上にあるレジスター)直接書くという方法。
では、何でACT LEDがGPIO16を経由して制御できるでしょう?!
elinux.orgでは結論としてこう書いてあるだけど、
D5(Green) - SDCard Access (via GPIO16) -
それは証拠にはならないね・・・
しょうがないあんまり電子回路とか分からないが、
schemantic見ないと分からないかもと思って見てみたら、あった!!!
↓ここです↓

GPIO16 -> STATUS_LED_N -> D5 GRN
やっと分かった!!!

そして、残り一つ納得できてないところはLEDをON(aka. GPIO16をOFF)するとき、0x2020 0040のアドレスからのレジスタGPEDS0を使いましたね。なんでEdge Eventと関係あるでしょう?・・・

2014年5月26日月曜日

K&R Style Function Definition

I first met this kind of old function prototype here(glibc/socket.c).

24 int
26             int domain;
27             int type;
28             int protocol;
29 {
31  return -1;
32 }
Notice the parameters domain,type and protocol are defined outside of the parenthesizes.

Actually it is a old style function prototype, though it is still widely seen in kernel code.
It is also known as pre-ISO function definition.