The Gen 2 uses three PCAL953A devices for IO. These are 16 bit i2c IO expanders (so we have 48 bits here). Most of these bits are used internally. These are supported by the linux pca953x driver (extended for the Galileo to support interrupts).
PWM is supported by an NXP PCA9685 driver chip and is now 12 bit capable. It is suppored by the linux "pca9685" driver (new for the Galileo).
So, in order to manipulate the GPIO system, you need to be able to talk to the Quark GPIO module, as well as to several devices on the i2c bus.
Note the datasheet for the "157" two input multiplexor above. Many (11 by my count) of the arduino pins can be driven by one of two sources, selected by the multiplexor (which is typically controlled by a bit from one of the IO expanders). Careful study of the schematic is the only way to sort all of this out.
There are 20 pins that could be used as GPIO. We have the main 14 on the upper connector row (io0 through io13). 12 of these are driven by the Quark GPIO section. Two are drive by IO expanders (io7 and io8). There are another 6 that can be either analog inputs or gpio. Of the 12 driven by the Quark, 11 have mux (multiplexor) selected drive signals. More on all of this eventually.
An additional complication in sorting out the schematic is the ability of the arduino pins to be jumper configured to either 3.3 or 5 volt logic.
It is also worth noting that the 6 analog input pins can also be used for GPIO. They are connected to one of the IO expanders. Having them also connected to the ADC converter should cause no conflict, but if they are intended to be used as analog input pins, the IO expander must certainly be placed into a "high impedance" mode so it does not drive its output in any way.
Tom's Computer Info / [email protected]