Load a precalculated version of ld.so.cache on startup

ctypes uses ldconfig to find libraries.  ldconfig caches its findings
about installed libraries in ld.so.cache.  We haven't shipped an
ld.so.cache on the BeagleBoard image, which means that from cold
ldconfig takes ages to run (it's like seconds...).  It would therefore
be inconvenient to run ldconfig from cold on every startup.

So this patch adds an ld.so.cache that I just generated on a
BeagleBoard to robot.zip.  It modifies run.py to install this cache
file in the right place upon startup.
Add support for reading the battery status

This adds a new attribute to the power class to read the battery status.
Both the voltage of the battery and current being drawn can be read.

Example usage:

from sr import *
R = Robot()
print R.power.battery.voltage
Add a docstring to TSSricDevice

Since I was here, I figured I'd add a small nugget of docs ;-)
Add a TSSricDevice wrapper providing a device-specific lock

Some things we would do with the boards involve multiple SRIC
transactions, such as setting a single output pin, or toggling an LED
on the power board.  These transactions were not protected by a lock,
so incorrect things would occur if two threads both attempted to
perform one of these multi-transaction operations at the same time.

This patch adds a wrapper class around TSSricDevice, which is the
class that all the Python libraries use to access devices at the
moment.  This wrapper class, called LockableDev, essentially adds one
thing to TSSricDevice: a lock.  The lock *must* be acquired before any
actions are performed on the LockableDev.

Python threading.Lock objects can be used with Python's 'with'
statement, which makes using this lock extremely straightforward.  For
example, given a LockableDev instance d:

with d.lock:
   d.txrx( ... )
   ... munge some things ...
   d.txrx( ... )

LockableDev also wraps the TSSricDevice's txrx function to check that
it is being called whilst the lock is held.  This will assist mainly
in development, catching cases where someone has attempted to do
something with the LockableDev without first acquiring the lock
first.  This performs no checking that the thread that holds the lock
is the thread that's attempting to do things.  So, this will only
assist in testing and will catch all fail in single-threaded cases,
which IMO makes it quite valuable...

Issue first described in trac #1096.
Switch to using locks for JointIO transactions

Some JointIO operations are read-modify-write operations, so these
require locks around them.  This patch switches the JointIO board over
to using the LockableDev wrapper that was introduced in the last commit.
Use LockableDev for power board sric transactions

The power board LED operations are read-modify-write, so this requires
a lock.
Update power board firmware

Commit 0189f36d266cef932f65c7cc4483e57ddf1011d4 in power-fw.git

Firmware version number 2

This update adds SRIC commands to read the battery voltage and current.
It also adds some code to filter the values read through the ADC as
they're very noisy.
Merge branch 'master' into ld-cache

Resolves an conflict in the import lines of pyenv/run.py
Merge branch 'master' into trans-lock
Fix LockableDev's accessing of TSSricDevice's txrx function

LockableDev attempted to get at TSSricDevice's underlying txrx
function using the naming-the-parent-class style approach.  However
this wouldn't work because the parent TSSricDevice instance's
__getattr__ would need to be called.  So do some moe sane things
instead.
Annihilate globals passed from sr.loggrok to the user's context

The user's code is run using execfile().  This is so that we can
achieve the standard output newline mangling etc.  One effect of this
was that __file__ was set to the path of "loggrok.py".  Not only is
not what we want because it's confusing, but also it has highly
confusing results when one is trying to import files and things.  Had
a team tried to call a file "power.py" and import it, they would have
actually ended up with the "power.py" from the same directory as
loggrok.py.

This patch clears the globals passed to the user's code, and sets
__file__ to be the thing that they expect.  This clearing means that
importing "power.py" in a user's code does what one would expect:
looking for "power.py" in the same directory as the user's code!
Add a "quiet" option to sr.Robot

This isn't part of the "typical sixth-former API", but is to
facilitate testing.  When it's present and set to True, it will stop
sr.Robot from displaying the contents of the bus all the time.
Add some API unit tests

The directory that this patch adds, called "tests", is designed to be
used as a user's code would be.  At the moment it exercises the
jointio board and power board APIs, and makes some basic checks of them.
Merge branch 'master' into trans-lock
Turn optimisation off in our Python environment

When Python's 'optimisation' is on, assert statements do not work.
This is somewhat irritating.  This is because in our OE build,
python was patched to default having Python on.  There's no Python- or
cli-based way of turning it off again.

So we use the python C API to make our own python interpreter.  It's
very short, as it just changes the value of Py_OptimizeFlag to 0 then
calls Py_Main...

This patch adds the wrapper from git://srobo.org/~rspanton/pynoopt.git
revision 7aceb096, and puts it in bin/python.  It also shuffles our
bin directory to the front of PATH so that we actually use it.

This results in assert statements working :-)

See the extended description of this in Trac #1110
Acquire lock for the JIO board before turning its smps on

The lock wasn't being acquired before this was done.
Fix assertion about device address not already being in local store

This assertion had previously never been run because asserts weren't
previously enabled!  Turns out it was bogus...
Add unit tests checking the power board code is using locks

Two checks:

1) That it's a LockableDev
2) That attempting to do things without acquiring the locks results in
   an AssertionError.
Add unit tests for stdout newline munging and that assert works

Two tests of the environment:

1) That the stdout newline windowsifier is present.
2) That assert statements work (we are not in optimisation mode)
Add JIO unit test ensuring that it's using LockableDev too

The JIO board needs locks etc, so it uses LockableDev.  This unit test
ensures that this is happening.