This project is read-only.

USB CRC5 Algorithm

Topics: Developing Cosmos (Working on Cosmos source code directly), Using Cosmos (Developing your own OS, projects, etc)
Jun 14, 2014 at 7:50 PM
If anyone has a USB CRC5 algorithm could u please share the code. Im working on USB Host Controller driver. It would be a great help if i could get the code for CRC5.

Its for the 11 Bit (Device Address + Endpoint) number in a Token Packet.
Jun 15, 2014 at 2:04 AM
Edited Jun 15, 2014 at 2:13 AM
Thanks but USB doesn't use 32 bit CRCs. it uses 5 Bit CRC for tokens and 16 Bit CRCs for data.

Just a little info on what i already have working in USB subsystem

EHCI Reset and Halt.
USB port suspend, resume, disable, enable, reset, overcurrent
detect a Device on Individual ports
Setup USB PIRQs ( 0x2A on ICH7)
Setup ECHI controller for all IRQs

Im testing Async packets now

Hopefully i can get us out of using the unfriendly PS/2 mouse and. to using USB one
Jun 15, 2014 at 3:58 AM
You do know that the code you posted is under Apache License? It's a direct copy-paste from here:
That code isn't free, it's under Apache 2.0. Please give proper credit as stated by the license.
Dude, PS/2 IMO is much better than USB Mouses, one thing it's Standard no EHCI, XHCI, UHCI,.... mess. After implementing the USB stack you need to handle the HID mess, there are computers which don't have the USB Logo and will hence be incompatible with our USB drivers. (Yep, I've had problems with the Linux USB driver on my machine). Thirdly the PS/2 Emulation is done by the SMM code which is supposed to be given by the vendor, if the vendor's implementation is faulty the machine can be safely said to be broken. And lastly PS/2 can handle much more keystrokes than USB can, USB is limited to 5 (?) keystrokes at once.
Plus the CPU will badly waste time polling, the best part of PS/2 is it's like a UART which makes it best for development and use. In fact a lot of gaming sites suggest to use a PS/2 Keyboard than a USB one!
Nevertheless, go ahead USB HID implementation is something really cool to have!
Jun 15, 2014 at 2:17 PM
Edited Jun 15, 2014 at 2:18 PM
Im saying PS/2 is unfriendly because not all usb mouse supports it and as well as motherboards
Its PS/2 enulation is not guaranted on new motherboards.

Ive got two USB optical mouses. I tested both on my Asus P5G41TM-LX3 and neither worked in PS/2 mode. Then i tested both on a older mainboard HP MS 7336 ver 1.0. Only one mouse worked in PS/2 mode