Skip to content

IOIO FW and Theory of operation.

mark97229 edited this page Aug 22, 2011 · 4 revisions

This is a partial theory of operation document for the IOIO device.

Its a PIC24 with a usb host stack implementing the ADB server on the PIC side.

It listens to port 4545 for IOIO messages and sends data back and forth to the android target over the same port.

There are 3 execution contexts in the FW:

  1. boot loader tasts
  2. application protocol tasks
  3. interrupts / timers

Comments:

  • the buffer processing is hard for me to tell if its right or not from the code. Its hard to read for me.
  • there are a only a few too many layers in the code for my tastes. I'd consider a re-factoring of the FW code to make it more readable and less complicated.

on the PIC we have the following basic flows:

  • main

    • init
    • while 1
      • BootloaderTasks() : bootloader/bootloader.c

        • ADBTasks()
          • ADBPacketTasks()
            • ADBPacketSendTasks()
            • ADBPacketRecvTasks()
        • ADBHandlePacket
          • recv_func callback called on ADB protocol state change to
            • AppProtocaleHandleIncoming
              • MessageDone() implements some of the protocol commands switched on rx_msg.type (the immediate ones) looks like additional queues are populated for ICSP, SPI, UART and I2c processing
        • ADBFileTasks(): <-- not sure what this is about
      • AppProtocalTasks() <-- non immediate processing (reads from spi or something and queues up usb transfers)

        • UARTTasks();
        • SPITasks();
        • I2CTasks();
        • ICSPTasks();
  • timers and interrupts:

    • ADC transfers are on timer. What else is going on in the ISRs?
    • uarts, spi, i2c, (not ICSP though but ICSP processing has a lot of buffer processing so perhaps its best to queue that shit up...)