Just an update, I was able to offload the base thread to an external PIC micro using SPI.
My observation is that bit-banging an 8 bit data bus is not optimal. The RPi SPI has 64 bytes of buffer so transferring data is quick with minimal cpu overhead.
I'm currently running the SPI clock at 15 MHz, a 64 bytes transfer completes in around 45 us. The maximum SPI speed that the RPi can operate at is 31 MHz. This is too fast for a PIC but doable with an FPGA.
image missing http://imageshack.us/a/img541/9489/img2013021300165.th.jpg
Cheers!
UDPATE:
I finished porting my rt-8p8c code to the new PIC micro.
It's currently running using the mini tk interface over ssh.
Here is the output of top with backplot enabled:
Code:
top - 10:48:06 up 9:58, 2 users, load average: 0.53, 0.60, 0.56
Tasks: 59 total, 1 running, 58 sleeping, 0 stopped, 0 zombie
%Cpu(s): 38.7 us, 6.6 sy, 0.0 ni, 53.1 id, 0.0 wa, 0.0 hi, 1.6 si, 0.0 st
KiB Mem: 498864 total, 204120 used, 294744 free, 21304 buffers
KiB Swap: 0 total, 0 used, 0 free, 117996 cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
6547 root 20 0 29216 12m 4936 S 35.2 2.6 8:51.26 wish8.5
6546 root 20 0 11548 5224 4520 S 5.2 1.0 2:00.87 milltask
4237 root 20 0 10496 3368 2360 S 3.9 0.7 1:29.53 sshd
6537 root 20 0 30040 11m 6144 S 2.9 2.4 0:47.77 hal_manualtoolc
6553 root 20 0 4620 1340 1024 R 1.3 0.3 0:10.15 top
2972 root 20 0 9504 3092 2364 S 0.3 0.6 0:29.58 sshd
6524 root 20 0 4128 1728 1440 S 0.3 0.3 0:03.32 io
1 root 20 0 2104 712 612 S 0.0 0.1 0:02.03 init
2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd
3 root 20 0 0 0 0 S 0.0 0.0 0:00.02 ksoftirqd/0
5 root 20 0 0 0 0 S 0.0 0.0 0:04.17 kworker/u:0
6 root -2 0 0 0 0 S 0.0 0.0 0:02.12 rcu_kthread
7 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 khelper
8 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kdevtmpfs
9 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 netns
10 root 20 0 0 0 0 S 0.0 0.0 0:00.23 sync_supers
11 root 20 0 0 0 0 S 0.0 0.0 0:00.00 bdi-default