reimplement ringbuffer

The new implementation use the mirroring method to distinguish full
buffer and the empty buffer. It also support buffers of arbitrary size.
ringbuffer: format the code to a more symmetric structure
Merge pull request #84 from grissiom/ringbuffer

Ringbuffer
cdc_vcom: fix the bug that use ringbuffer pool as usb packet buffer

This commit set the buffer for packet to CDC_MaxPacketSize which is a
reasonable value for it. However, maybe we should make
CDC_{RX,TX}_BUFSIZE configurable as well.
cdc_vcom: send a zero-length-packet at the end is transaction
usbdevice/core: misc cleanup
cdc_vcom: send data as many as possible

The data filled into dcd_ep_write does not to be limited by
MaxPacketSize.
usbdevice/core: small optimization on the event loop

Sort the switch cases by the frequency of the events.
cdc_vcom: not to start sending data when the data is already sending

We start the sending transaction in SOF handler. But if the data is
already sending, start an other transaction will cause data lose.
Implement a state machine is cdc_vcom and avoid that.
serial: use RT_SERIAL_RB_BUFSZ to define the size of ring buffer.
Merge pull request #85 from grissiom/fix-usb-serial

Fix usb serial
Merge pull request #86 from grissiom/serial-rb-size

serial: use RT_SERIAL_RB_BUFSZ to define the size of ring buffer.
usbdevice/core: use static thread instead of dynamic thread

It also add two configurations for the USB device even loop thread:

    RT_USBD_THREAD_STACK_SZ to set the stack size, default to 2048
    RT_USBD_THREAD_PRIO     to set the priority, default to 8

You can overwrite the default values in rtconfig.h
usbdevice/core: use static message queue

Although currently the only message send to the queue is struct
udev_msg, in order to keep backward compacity and for extention in the
future, we set the size of message to 32.
Merge pull request #87 from grissiom/static-usbd

Static usbd
simulator: fix serial_write

printf("%s") will print a NULL terminated string, while rt_serial_write
should print buffer for size length. This also fix segfault when the
string is not null terminated but specified by size.
Merge pull request #87 from grissiom/static-usbd

Static usbd
Merge branch 'master' of https://github.com/RT-Thread/rt-thread into ForPullRequest
add missing dfs_mkfs prototype in dfs_fs.h
add usb state