In memory of Ben “bushing” Byer, who passed away on Monday, February 8th, 2016.

Changes

Jump to navigation Jump to search
628 bytes added ,  02:44, 18 April 2016
m
CRC16 with 0x8408 poly
Line 90: Line 90:  
     COSInfo(6, "%s() depricated, no need to call\n", "CCRHIDTeardown"); //Typo in binary
 
     COSInfo(6, "%s() depricated, no need to call\n", "CCRHIDTeardown"); //Typo in binary
 
     return 0;
 
     return 0;
 +
}
 +
</syntaxhighlight>
 +
 +
===CCRCDC - Gamepad Communications Device Class API===
 +
<syntaxhighlight lang="C">
 +
uint16_t CCRCDCCalcCRC16(uint32_t *data, uint32_t size) //02002EAC
 +
{
 +
    uint16_t crc = 0xFFFF;
 +
    if (size > 0)
 +
    {
 +
        for (int j = 0; j < size; j++)
 +
        {
 +
            crc = (uint16_t)(crc ^ data[j]); //load in new byte
 +
            for (int i = 0; i < 8; i++)
 +
            {
 +
                if ((crc & 0x0001) == 1) //if LSB is set, do xor
 +
                    crc = (uint16_t)((crc >> 1) ^ 0x8408);
 +
                else //just cycle 1
 +
                    crc >>= 1;
 +
            }
 +
        }
 +
    }
 +
    return crc;
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
52

edits

Navigation menu