api_common.rst 945 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. 其他
  2. =========================
  3. usb_malloc
  4. """"""""""""""""""""""""""""""""""""
  5. ``usb_malloc`` 用来申请内存。
  6. .. code-block:: C
  7. void *usb_malloc(size_t size);
  8. - **size** 要申请的内存大小
  9. - **return** 申请的内存地址
  10. usb_free
  11. """"""""""""""""""""""""""""""""""""
  12. ``usb_free`` 用来释放申请的内存。
  13. .. code-block:: C
  14. void usb_free(void *ptr);
  15. - **ptr** 要释放的内存地址
  16. usb_iomalloc
  17. """"""""""""""""""""""""""""""""""""
  18. ``usb_iomalloc`` 用来申请内存,并按照 `CONFIG_DCACHE_LINE_SIZE` 对齐,一般使用到 dcache 和 dma 需要对齐操作的时候使用。
  19. .. code-block:: C
  20. void *usb_iomalloc(size_t size);
  21. - **size** 要申请的内存大小
  22. - **return** 申请的内存地址
  23. usb_iofree
  24. """"""""""""""""""""""""""""""""""""
  25. ``usb_iofree`` 用来释放申请的内存。
  26. .. code-block:: C
  27. void usb_iofree(void *ptr);
  28. - **ptr** 要释放的内存地址