亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? usb stack implementation.txt

?? USB CDC using C8051F320/340, virtual COM port thru usb connection
?? TXT
字號:
[ Select compiler - Keil or SDCC ]

On the SiLabs IDE, open one of these project files, according to the compiler.
	KEIL_USB_CDC_skeleton.wsp
	SDCC_USB_CDC_skeleton.wsp
Then, the project file handles everything.

For command line users,
	memory model:	small (Keil / SDCC)
	link library:	KEIL_FIFO_RW.lib (Keil)
			SDCC_FIFO_RW.lib (SDCC)

	The source code of these libraries are included in FIFO_RW_source folder.



[ Switch the MCU type - 'F32x, 'F340 ]

The MCU type is defined in USB_Type.h, as the include file.
Select one of appropriate include file for the device.
     USB_Type.h
	//#include <C8051F320.h>
	#include <C8051F340.h>

Then, the compiler sees the symbols in the include file, like C8051F320_H, and automatically dispatches the conditional compilation in the source code.

The USB engines of these MCUs are almost common, including register assignment.
Therefore, the the most of source code is common, except for USB_Main.c.
In USB_Main.c, the difference of peripherals on MCUs and Dev board configuration make the source code complicated with the MCU type switch. It may be better to split the USB_Main.c into each MCU type.



[ USB_Configuration.h ]

This include file lists up the essential parameters of the USB implementation.
VID/PID, revision number, MaxPacketSize of each EP.

Other than these parameters, these items for the endpoint setting are available.

- The endpoint usage        : USE_OUT_EP1, USE_IN_EP1, etc
- Double buffer for the EP  : ENABLE_OUT_EP1_DOUBLE_BUF, etc
- Isochronous EP (*1)       : ENABLE_OUT_EP1_ISO, etc
- Interrupt usage on the EP : ENABLE_OUT_EP1_INTERRUPT, etc

(*1) When this option is disabled, the EP is handled as a bulk or interrupt EP

Using these switches, you can quickly select the endpoint configuration. Also these switches ensure the proper handling on the standard request, without further modification of the code.

- ENABLE_SUSPEND_RESUME
This option enables suspend/resume interrupts on the code.
The actual handling of suspend/resume is implemented in the USB_Main.c, Usb_Suspend() and Usb_Resume().

- ENABLE_SOF_INTERRUPT
This option enables SOF interrupt. SOF interrupt is invoked by SOF (Start Of Frame) signaling on the USB bus, which gives handy 1 ms interval. Please note, SOF interrupt is generated by the engine, even when the device is not connected to host.

- ENABLE_INLINE_POLL_READ_WRITE
This option switches the definition of POLL_READ_BYTE and POLL_WRITE_BYTE between inline macro and function. Inline macro gives faster execution, but greater code size. The function implementation does vice-versa.


[ Where is the best place to initialize the USB-related variables? ]

When you need to initialize variables every time at the USB connection, these functions are the good place to implement it.
	Usb_Reset()         (USB_ISR.c)
	OR
	Set_Configuration() (USB_Standard_Requests.c)
	( Set_Interface() )
At the device connection to USB bus, host issues bus reset - Usb_Reset() is invoked.
Then, enumeration starts and Set_Configuration() is always called (almost) at the end of enumeration.
When the device has alternate interface(s), Set_Interface() will be called. But the device doesn't have any alternate interface, Set_Interface() is not called.

In this implementation, two flags, IN_FIFO_empty, OUT_FIFO_loaded, are initialized in Set_Configuration().



[ How to handle the endpoint(s) - interrupt or polling? ]

As of the EP1-3, either will do. Select appropriate option which fits to your requirement.
In this implementation, I showed a combined method.

- interrupt IN
When you already have large size of data on a buffer (more than the MaxPacketSize of the EP), interrupt gives better performance. Enable double buffer, too.

- interrupt OUT
When the host sends large size of data to the device, interrupt gives better performance. Enable double buffer, too.

- polling IN
When you don't have any new data to send to the host, leave the FIFO unloaded. Just when you get data to send, load the data to the FIFO in the main loop. Until the firmware loads data to the FIFO, the USB engine returns NAK to the host. And the host retries the transfer again and again without any error. This is the flow control mechanism built-in to the USB protocol.

- polling OUT
When you don't want to accept new data from host until the current process finishes, polling in the main loop gives smart coding. Until the firmware unloads the FIFO, the USB engine returns NAK to the host. And the host retries the transfer again and again without any error. This is also the flow control mechanism built-in to the USB protocol.

Around the access to the USB engine from the main loop, disable USB interrupt to prevent the conflict with the USB ISR.

When you apply the polling method, you may see the host app hangs, when the host app calls ReadFile / WriteFile synchronously. When these API is called synchronously, they don't return until the transfer finishes, then they block the execution of the host app. In this case, these APIs should be called in OVERLAPPED. Or use ReadFileEX or WriteFileEx, instead.


As of the default EP (EP0), it is the usual way to split the control transfer handling into interrupt and polling;
	SETUP stage           - interrupt
	DATA and STATUS stage - polling on main loop
However, I didn't take this approach on this implementation, because of the bug of Windows (*1) and the defect of this USB engine (*2). Handling control transfers as fast as possible in the USB ISR, the chance of hang reduces.

(*1) Bug of Windows
http://support.microsoft.com/kb/892050/en-us
In this bug, TT (transaction translator) issues the next control transfer prematurely.
This bug is not fixed until the next SP (WinXP SP3).

(*2) Defect of the USB engine
This USB engine has just one common FIFO for the EP0 IN/OUT. When new SETUP is prematurely issued by host while the engine (firmware) handles previous control transfer, the FIFO write from the firmware may overwrite the new SETUP on the FIFO. This causes hang on the control transfer handling.
When common IN/OUT FIFO is applied, the engine is usually equipped a mechanism to prevent the overwrite, because SETUP has priority. I can see this mechanism on most of engines on other manufacturers. However, SiLabs engine doesn't have this mechanism, it allows the overwrite. This is the background which is not told in this SiLabs KB article.
"USB Driver Freezing"
http://portal.knowledgebase.net/article.asp?article=194217&p=4120



[ Detailed implementation suggestions ]

In USB_Standard_Requests.c, I attached suggestions for these items.
In this implementation, I chose one of popular option. If you need other option, these suggestions will guide you how to modify this implementation.

	USB_Standard_Requests.c
	- HALT and STALL handling on interrupt and bulk EPs
	- Data toggle handling on interrupt and bulk EPs
	- Bus-powered/Self-powered
	- Suspend/Resume and Remote wakeup



[ Thanks to forum members ]
This implementation has been inspired by the discussion with members on SiLabs Forum,
Patryk, vanmierlo, frief, egawtry, ReneK, dsnook, MarcelJ, and many many other members.
Thanks to you all.


Enjoy!!

Tsueno

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品亚洲视频| 国产精品白丝av| 日韩理论片在线| 中文在线免费一区三区高中清不卡| 欧美成人三级电影在线| 欧美日本不卡视频| 777xxx欧美| 欧美va在线播放| 久久综合中文字幕| 国产午夜亚洲精品午夜鲁丝片| 久久亚洲私人国产精品va媚药| 日韩美女视频在线| 国产视频在线观看一区二区三区 | 日产国产欧美视频一区精品| 亚洲男女一区二区三区| 亚洲激情图片小说视频| 亚洲一级在线观看| 奇米精品一区二区三区在线观看一| 蜜桃视频一区二区三区| 麻豆精品一区二区综合av| 精品一区二区三区香蕉蜜桃| 美女视频黄 久久| 国产成人精品亚洲日本在线桃色| 国产精品系列在线观看| 日本丰满少妇一区二区三区| 欧美一区二区三区思思人| 精品毛片乱码1区2区3区| 久久―日本道色综合久久| 中文字幕亚洲不卡| 日韩精品乱码免费| 国产一区二区调教| 在线观看亚洲精品视频| 日韩精品一区在线观看| 亚洲欧洲美洲综合色网| 日本aⅴ精品一区二区三区| 国产成人精品aa毛片| 欧美综合在线视频| 久久噜噜亚洲综合| 午夜精品视频在线观看| 高清成人免费视频| 欧美色电影在线| 国产精品欧美综合在线| 日本不卡一二三| 色综合天天综合| 欧美一区二区三区免费观看视频| 91精品国产乱| 亚洲四区在线观看| 国产福利一区二区| 欧美另类变人与禽xxxxx| 亚洲欧美综合色| 久久国产欧美日韩精品| 欧美亚洲一区二区在线| 欧美激情一区不卡| 麻豆国产欧美一区二区三区| 欧美制服丝袜第一页| 国产精品三级av| 国产一区视频在线看| 欧美精品v国产精品v日韩精品| 综合久久综合久久| 国产98色在线|日韩| 欧美videos大乳护士334| 日本午夜一本久久久综合| 欧美日韩视频专区在线播放| 亚洲欧美另类综合偷拍| 91在线视频免费91| 国产精品乱码久久久久久| 国产在线精品免费av| 精品免费视频.| 国产在线视频不卡二| 日韩一区二区在线看| 免费不卡在线观看| 日韩午夜精品视频| 老司机精品视频导航| 欧美成人综合网站| 久久99精品国产麻豆婷婷| 精品少妇一区二区三区视频免付费 | 欧美三级一区二区| 亚洲成年人影院| 欧美绝品在线观看成人午夜影视| 亚洲电影视频在线| 欧美日韩一区二区三区不卡| 图片区日韩欧美亚洲| 欧美福利视频导航| 精品在线观看视频| 日本一区二区三区视频视频| 国产99久久久国产精品免费看 | 亚洲成人精品一区二区| 色94色欧美sute亚洲线路一久| 中文字幕在线一区| 色综合天天综合网国产成人综合天 | 一区二区三区中文字幕电影 | 亚洲香肠在线观看| 欧美人与z0zoxxxx视频| 精东粉嫩av免费一区二区三区| 精品盗摄一区二区三区| 成年人网站91| 亚洲国产精品一区二区久久恐怖片| 欧美日高清视频| 激情综合网最新| 国产亚洲欧美中文| 欧美手机在线视频| 久久se精品一区二区| 国产精品久久久久天堂| 欧美日韩免费在线视频| 国产制服丝袜一区| 中文字幕一区三区| 欧美丰满美乳xxx高潮www| 激情久久久久久久久久久久久久久久| 欧美激情一区二区三区蜜桃视频| 欧美亚洲免费在线一区| 久草精品在线观看| √…a在线天堂一区| 日韩写真欧美这视频| 99re热视频精品| 久久国产精品72免费观看| 中文字幕一区不卡| 日韩限制级电影在线观看| 91网站在线播放| 国产综合色产在线精品| 一区二区三区在线观看网站| 久久男人中文字幕资源站| 欧美日免费三级在线| 972aa.com艺术欧美| 久久er99精品| 日韩精品电影一区亚洲| 亚洲男人的天堂在线aⅴ视频| 337p粉嫩大胆噜噜噜噜噜91av| 欧美综合欧美视频| 国产99一区视频免费| 麻豆精品一区二区| 亚洲va韩国va欧美va| 亚洲精选视频在线| 欧美极品aⅴ影院| 精品欧美一区二区在线观看| 欧美日韩一本到| 91色porny| 99精品一区二区| 国产丶欧美丶日本不卡视频| 黄色日韩三级电影| 美腿丝袜在线亚洲一区| 日本午夜一本久久久综合| 亚洲电影你懂得| 亚洲不卡av一区二区三区| 一区二区三区欧美日韩| 亚洲天堂2016| 一区二区三区在线观看动漫| 亚洲精品国产视频| 一区二区在线观看av| 亚洲欧美自拍偷拍| 国产精品久久久久久久久免费丝袜| 久久久影视传媒| 国产欧美一区二区精品性色| 久久久精品日韩欧美| 国产日韩精品一区二区三区| 久久九九久久九九| 国产农村妇女精品| 国产精品久久久久久久久晋中| 国产精品大尺度| 亚洲天堂成人网| 亚洲成人高清在线| 免费美女久久99| 激情五月播播久久久精品| 国产精品一区二区久久精品爱涩| 国产精品一区二区三区乱码| 不卡一区二区中文字幕| 在线视频中文字幕一区二区| 欧美中文字幕久久| 欧美一区二区黄| 国产日韩精品视频一区| 最近中文字幕一区二区三区| 亚洲在线视频网站| 日日摸夜夜添夜夜添亚洲女人| 美国十次综合导航| 丰满岳乱妇一区二区三区| 91麻豆产精品久久久久久| 欧美日韩亚洲综合在线 欧美亚洲特黄一级 | 成人免费视频视频在线观看免费| bt欧美亚洲午夜电影天堂| 日本韩国欧美在线| 日韩午夜电影av| 国产精品精品国产色婷婷| 亚洲成人自拍偷拍| 国产一区 二区| 在线中文字幕一区二区| 精品久久久三级丝袜| 1区2区3区精品视频| 日日夜夜精品视频免费| 成人h精品动漫一区二区三区| 欧美性一二三区| 国产亚洲精品aa| 日本午夜精品视频在线观看| 国产91高潮流白浆在线麻豆 | 日韩美女视频一区二区| 日本成人在线网站| 91丨porny丨国产入口| 日韩一区二区在线看| 伊人婷婷欧美激情| 丁香婷婷深情五月亚洲| 欧美一级二级在线观看| 亚洲欧洲日韩在线|