Crate hw_dcmi_wrapper

Source
Expand description

§HW_DCMI

Huawei Ascend computing device third-party DCMI c library safe FFI binding

  • hw_dcmi_wrapper provides safe FFI bindings (encapsulated from the FFI bindings provided by hw_dcmi_wrapper_sys)
  • hw_dcmi_wrapper_sys provides unsafe FFI bindings (directly generated by bindgen)

§Usage

§Prerequisites

project has been tested on Ubuntu 22.04, with Atlas 6.0.0 DCMI API, you need to install the following dependencies:

  • DCMI shared library
  • Ascend driver

by default, library will try to find dcmi_interface_api.h and link libdcmi.so in /usr/local/dcmi, you can provide HW_DCMI_PATH env variable to specify the path of the dcmi shared library.

If you want to regenerate bindings, you can set HW_DCMI_BINDING_BUILD to true to regenerate bindings, the generated bindings will be saved in:

  • Static link: hw_dcmi_wrapper_sys/src/bindings.rs
  • Dynamic link: hw_dcmi_wrapper_sys/src/bindings_dyn.rs

§Example

  • Before using any DCMI API, you need to initialize the library first. You can Initialize the library with Dcmi::init
  • Most API interfaces are encapsulated to conform to ergonomics, such as Card: Query_cards returned a Vec<Card>.
  • If you are confident that the parameters are correct, you can use Card::new_uncheckto create a Card instance.

§Feature flag

  • serde: enable serde serialization and deserialization for all types in hw_dcmi_wrapper
  • load_dynamic: enable dynamic loading of the dcmi shared library

Modules§

device
Device of the DCMI.
enums
Wrapped enums for the DCMI peripheral
error
Error types for DCMI functions.
structs
Wrapped structs for the DCMI peripheral

Structs§

DCMI
DCMI