Gpio speedup

These are the changes I made to help speed up changing the direction of IO pins. 

Not sure if I should first try to merge in to the current latest sources or not.  I don't think any of the other changes made clash much with what I changed.

Kurt