Part 1
요약·해설
저수준 usb_write()/usb_read() 흐름과 고수준 usb_transfer 흐름의 packet 분할 및 callback 책임 차이를 설명합니다.
Read · Write · Callback
usb_transfer
Endpoint max packet size
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
022E3366D9F3BB8F1DDC93D67FE50D809F09C108CCFF7D170E2E7FCBE9D37CC9
.. _usb_device_stack_api:
USB device stack API
####################
API reference
*************
There are two ways to transmit data, using the 'low' level read/write API or
the 'high' level transfer API.
Low level API
To transmit data to the host, the class driver should call usb_write().
Upon completion the registered endpoint callback will be called. Before
sending another packet the class driver should wait for the completion of
the previous write. When data is received, the registered endpoint callback
is called. usb_read() should be used for retrieving the received data.
For CDC ACM sample driver this happens via the OUT bulk endpoint handler
(cdc_acm_bulk_out) mentioned in the endpoint array (cdc_acm_ep_data).
High level API
The usb_transfer method can be used to transfer data to/from the host. The
transfer API will automatically split the data transmission into one or more
USB transaction(s), depending endpoint max packet size. The class driver does
not have to implement endpoint callback and should set this callback to the
generic usb_transfer_ep_callback.
.. doxygengroup:: _usb_device_core_api
Part 3
한국어 전문 번역
USB device stack API
API reference
Data를 전송하는 방법에는 저수준 read/write API와 고수준 transfer API 두 가지가 있습니다.
- Low level API
Host로 data를 전송하려면 class driver가
usb_write()를 호출해야 합니다. 전송이 완료되면 등록된 endpoint callback이 호출됩니다. Class driver는 다음 packet을 보내기 전에 이전 write가 완료될 때까지 기다려야 합니다.Data가 수신되면 등록된 endpoint callback이 호출됩니다. 수신 data는
usb_read()로 가져와야 합니다. CDC ACM sample driver에서는 endpoint array에 명시된 OUT bulk endpoint handler인cdc_acm_bulk_out을 통해 이 과정이 일어납니다.- High level API
usb_transfermethod를 사용해 host와 data를 주고받을 수 있습니다. Transfer API는 endpoint의 maximum packet size에 따라 data 전송을 하나 이상의 USB transaction으로 자동 분할합니다.Class driver가 endpoint callback을 직접 구현할 필요는 없으며, callback을 범용
usb_transfer_ep_callback으로 설정해야 합니다.
USB device core API reference는 Doxygen group _usb_device_core_api에서 제공합니다.
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.