提交 796d2cb7 编写于 作者: 葛亚芳 提交者: Gitee

Merge branch 'master' of gitee.com:openharmony/docs into master

# Agent-Powered Scheduled Reminders
# Agent-Powered Scheduled Reminder
- [Overview](background-agent-scheduled-reminder-overview.md)
- [Development Guidelines](background-agent-scheduled-reminder-guide.md)
- [Agent-Powered Scheduled Reminder Overview](background-agent-scheduled-reminder-overview.md)
- [Agent-Powered Scheduled Reminder Development](background-agent-scheduled-reminder-guide.md)
# Development Guidelines<a name="EN-US_TOPIC_0000001185364575"></a>
# Agent-Powered Scheduled Reminder Development<a name="EN-US_TOPIC_0000001185364575"></a>
## When to Use<a name="section18502174174019"></a>
......
# Overview<a name="EN-US_TOPIC_0000001139084594"></a>
# Agent-Powered Scheduled Reminder Overview<a name="EN-US_TOPIC_0000001139084594"></a>
Your application can call the **ReminderRequest** class to create scheduled reminders for countdown timers, calendar events, and alarm clocks. When the created reminders are published, the timing and pop-up notification functions of your application will be taken over by the reminder agent in the background, even when your application is frozen or exits.
# Common Event and Notification
[Common Event and Notification Overview](notification-brief.md)
### Common Event
* [Common Event Development](common-event.md)
### Notification
* [Notification Development](notification.md)
### Debugging Tools
* [Debugging Assistant Usage](assistant-guidelines.md)
- [Common Event and Notification Overview](notification-brief.md)
- Common Event
- [Common Event Development](common-event.md)
- Notification
- [Notification Development](notification.md)
- Debugging Tools
- [Debugging Assistant Usage](assistant-guidelines.md)
# Quick Start
- Getting Started
- [Preparations](start-overview.md)
- [Getting Started with eTS in the Traditional Coding Approach](start-with-ets.md)
- [Getting Started with eTS in the Low-Code Approach](start-with-ets-low-code.md)
- [Getting Started with JavaScript in the Traditional Coding Approach](start-with-js.md)
- [Getting Started with JavaScript in the Low-Code Approach](start-with-js-low-code.md)
- Development Fundamentals
- [Application Development Package Structure (FA Model)](package-structure.md)
- [Application Development Package Structure (Stage Model)](module-structure.md)
- [Resource File Categories](basic-resource-file-categories.md)
- [SysCap](syscap.md)
- Getting Started
- [Preparations](start-overview.md)
- [Getting Started with eTS in the Traditional Coding Approach](start-with-ets.md)
- [Getting Started with eTS in the Low-Code Approach](start-with-ets-low-code.md)
- [Getting Started with JavaScript in the Traditional Coding Approach](start-with-js.md)
- [Getting Started with JavaScript in the Low-Code Approach](start-with-js-low-code.md)
- Development Fundamentals
- [Application Development Package Structure (FA Model)](package-structure.md)
- [Application Development Package Structure (Stage Model)](module-structure.md)
- [Resource File Categories](basic-resource-file-categories.md)
- [SysCap](syscap.md)
......@@ -44,6 +44,7 @@
- application/[ProcessRunningInfo](js-apis-processrunninginfo.md)
- application/[ServiceExtensionContext](js-apis-service-extension-context.md)
- application/[shellCmdResult](js-apis-application-shellCmdResult.md)
- Common Event and Notification
- [@ohos.commonEvent](js-apis-commonEvent.md)
......@@ -51,16 +52,20 @@
- [@ohos.notification](js-apis-notification.md)
- [@ohos.reminderAgent](js-apis-reminderAgent.md)
- application/[EventHub](js-apis-eventhub.md)
- Bundle Management
- [@ohos.bundle](js-apis-Bundle.md)
- [@ohos.bundleState](js-apis-deviceUsageStatistics.md)
- [@ohos.zlib](js-apis-zlib.md)
- UI Page
- [@ohos.animator](js-apis-animator.md)
- [@ohos.mediaquery](js-apis-mediaquery.md)
- [@ohos.prompt](js-apis-prompt.md)
- [@ohos.router](js-apis-router.md)
- Graphics
- [@ohos.display ](js-apis-display.md)
......@@ -68,6 +73,7 @@
- [@ohos.window](js-apis-window.md)
- [webgl](js-apis-webgl.md)
- [webgl2](js-apis-webgl2.md)
- Media
- [@ohos.multimedia.audio](js-apis-audio.md)
......@@ -75,27 +81,30 @@
- [@ohos.multimedia.image](js-apis-image.md)
- [@ohos.multimedia.media](js-apis-media.md)
- [@ohos.multimedia.medialibrary](js-apis-medialibrary.md)
- Resource Management
- [@ohos.i18n](js-apis-i18n.md)
- [@ohos.intl](js-apis-intl.md)
- [@ohos.resourceManager](js-apis-resource-manager.md)
- Resource Scheduling
- [@ohos.backgroundTaskManager](js-apis-backgroundTaskManager.md)
- [@ohos.workScheduler ](js-apis-workScheduler.md)
- [@ohos.WorkSchedulerExtensionAbility](js-apis-WorkSchedulerExtensionAbility.md)
- [@ohos.bundleState ](js-apis-deviceUsageStatistics.md)
- Custom Management
- [@ohos.configPolicy](js-apis-config-policy.md)
- [@ohos.enterpriseDeviceManager](js-apis-enterprise-device-manager.md)
- Security
- [@ohos.abilityAccessCtrl](js-apis-abilityAccessCtrl.md)
- [@ohos.security.huks ](js-apis-huks.md)
- [@ohos.userIAM.userAuth ](js-apis-useriam-userauth.md)
- [@system.cipher](js-apis-system-cipher.md)
- Data Management
- [@ohos.data.dataAbility ](js-apis-data-ability.md)
......@@ -105,6 +114,7 @@
- [@ohos.data.rdb](js-apis-data-rdb.md)
- [@ohos.settings](js-apis-settings.md)
- data/rdb/[resultSet](js-apis-data-resultset.md)
- File Management
- [@ohos.document](js-apis-document.md)
......@@ -114,6 +124,7 @@
- [@ohos.statfs](js-apis-statfs.md)
- [@ohos.storageStatistics](js-apis-storage-statistics.md)
- [@ohos.volumeManager](js-apis-volumemanager.md)
- Telephony Service
- [@ohos.contact](js-apis-contact.md)
......@@ -123,12 +134,14 @@
- [@ohos.telephony.sim](js-apis-sim.md)
- [@ohos.telephony.sms](js-apis-sms.md)
- [@ohos.telephony.data](js-apis-telephony-data.md)
- Network Management
- [@ohos.net.connection](js-apis-net-connection.md)
- [@ohos.net.http](js-apis-http.md)
- [@ohos.request](js-apis-request.md)
- [@ohos.net.socket](js-apis-socket.md)
- [@ohos.net.webSocket](js-apis-webSocket.md)
- Connectivity
- [@ohos.bluetooth](js-apis-bluetooth.md)
......@@ -136,6 +149,7 @@
- [@ohos.rpc](js-apis-rpc.md)
- [@ohos.wifi](js-apis-wifi.md)
- [@ohos.wifiext](js-apis-wifiext.md)
- Basic Features
- [@ohos.accessibility](js-apis-accessibility.md)
......@@ -153,6 +167,7 @@
- [@ohos.systemTime](js-apis-system-time.md)
- [@ohos.wallpaper](js-apis-wallpaper.md)
- [Timer](js-apis-timer.md)
- Device Management
- [@ohos.batteryInfo ](js-apis-battery-info.md)
......@@ -172,11 +187,13 @@
- [@ohos.update](js-apis-update.md)
- [@ohos.usb](js-apis-usb.md)
- [@ohos.vibrator](js-apis-vibrator.md)
- Account Management
- [@ohos.account.appAccount](js-apis-appAccount.md)
- [@ohos.account.distributedAccount](js-apis-distributed-account.md)
- [@ohos.account.osAccount](js-apis-osAccount.md)
- Language Base Class Library
- [@ohos.convertxml](js-apis-convertxml.md)
......@@ -200,15 +217,18 @@
- [@ohos.util.Vector](js-apis-vector.md)
- [@ohos.worker](js-apis-worker.md)
- [@ohos.xml](js-apis-xml.md)
- Test
- [@ohos.application.testRunner](js-apis-testRunner.md)
- [@ohos.uitest](js-apis-uitest.md)
- APIs No Longer Maintained
- [@ohos.bytrace](js-apis-bytrace.md)
- [@ohos.data.storage](js-apis-data-storage.md)
- [@system.app](js-apis-system-app.md)
- [@system.battery](js-apis-system-battery.md)
- [@system.bluetooth](js-apis-system-bluetooth.md)
- [@system.brightness](js-apis-system-brightness.md)
- [@system.configuration](js-apis-system-configuration.md)
- [@system.device](js-apis-system-device.md)
......@@ -217,6 +237,7 @@
- [@system.geolocation](js-apis-system-location.md)
- [@system.mediaquery](js-apis-system-mediaquery.md)
- [@system.network](js-apis-system-network.md)
- [@system.notification](js-apis-system-notification.md)
- [@system.package](js-apis-system-package.md)
- [@system.prompt](js-apis-system-prompt.md)
- [@system.request](js-apis-system-request.md)
......
# Enterprise Device Management
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......@@ -18,16 +19,18 @@ activateAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, call
Activates a device administrator application based on the specified bundle name and class name. This API uses an asynchronous callback to return the result.
**Required permissions**
ohos.permission.MANAGE_ADMIN
**System capability**
SystemCapability.Customation.EnterpriseDeviceManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| admin | [Want](js-apis-featureAbility.md#Want)| Yes | Device administrator application. |
| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. |
| enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | Yes | Enterprise information of the device administrator application.|
| type | [AdminType](#AdminType) | Yes| Type of the device administrator to activate.|
| callback | AsyncCallback\<boolean> | Yes| Callback used to return the result.|
......@@ -59,16 +62,18 @@ activateAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType): Pro
Activates a device administrator application based on the specified bundle name and class name. This API uses a promise to return the result.
**Required permissions**
ohos.permission.MANAGE_ADMIN
**System capability**
SystemCapability.Customation.EnterpriseDeviceManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------------- | ---------------------------------------------- | ---- | ------------------------ |
| admin | [Want](js-apis-featureAbility.md#Want)| Yes | Device administrator application. |
| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. |
| enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | Yes | Enterprise information of the device administrator application.|
| type | [AdminType](#AdminType) | Yes | Type of the device administrator to activate. |
......@@ -104,16 +109,18 @@ deactivateAdmin(admin: Want, callback: AsyncCallback\<boolean>): void
Deactivates a device common administrator application based on the specified bundle name and class name. This API uses an asynchronous callback to return the result.
**Required permissions**
ohos.permission.MANAGE_ADMIN
**System capability**
SystemCapability.Customation.EnterpriseDeviceManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------------------------------- | ---- | ------------------------------ |
| admin | [Want](js-apis-featureAbility.md#Want)| Yes | Device common administrator application. |
| admin | [Want](js-apis-application-Want.md) | Yes | Device common administrator application. |
| callback | AsyncCallback\<boolean> | Yes | Callback used to return the result.|
**Example**
......@@ -141,16 +148,18 @@ deactivateAdmin(admin: Want): Promise\<boolean>
Deactivates a device common administrator application based on the specified bundle name and class name. This API uses a promise to return the result.
**Required permissions**
ohos.permission.MANAGE_ADMIN
**System capability**
SystemCapability.Customation.EnterpriseDeviceManager
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ---------------------------------------------- | ---- | ------------------ |
| admin | [Want](js-apis-featureAbility.md#Want)| Yes | Device common administrator application.|
| admin | [Want](js-apis-application-Want.md) | Yes | Device common administrator application.|
**Return value**
......@@ -179,6 +188,7 @@ deactivateSuperAdmin(bundleName: String, callback: AsyncCallback\<boolean>): voi
Deactivates a device super administrator application based on the specified bundle name. This API uses an asynchronous callback to return the result.
**System capability**
SystemCapability.Customation.EnterpriseDeviceManager
**Parameters**
......@@ -208,6 +218,7 @@ deactivateSuperAdmin(bundleName: String): Promise\<boolean>
Deactivates a device super administrator application based on the specified bundle name. This API uses a promise to return the result.
**System capability**
SystemCapability.Customation.EnterpriseDeviceManager
**Parameters**
......@@ -240,13 +251,14 @@ isAdminAppActive(admin: Want, callback: AsyncCallback\<boolean>): void
Checks whether a device administrator application is activated based on the specified bundle name and class name. This API uses an asynchronous callback to return the result.
**System capability**
SystemCapability.Customation.EnterpriseDeviceManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------------------------------- | ---- | -------------------------------- |
| admin | [Want](js-apis-featureAbility.md#Want)| Yes | Device administrator application. |
| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. |
| callback | AsyncCallback\<boolean> | Yes | Callback used to return the result.|
**Example**
......@@ -274,13 +286,14 @@ isAdminAppActive(admin: Want): Promise\<boolean>
Checks whether a device administrator application is activated based on the specified bundle name and class name. This API uses a promise to return the result.
**System capability**
SystemCapability.Customation.EnterpriseDeviceManager
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ---------------------------------------------- | ---- | -------------- |
| admin | [Want](js-apis-featureAbility.md#Want)| Yes | Device administrator application.|
| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application.|
**Return value**
......@@ -309,6 +322,7 @@ isSuperAdmin(bundleName: String, callback: AsyncCallback\<boolean>): void
Checks whether a device super administrator application is activated based on the specified bundle name. This API uses an asynchronous callback to return the result.
**System capability**
SystemCapability.Customation.EnterpriseDeviceManager
**Parameters**
......@@ -340,6 +354,7 @@ isSuperAdmin(bundleName: String): Promise\<boolean>
Checks whether a device super administrator application is activated based on the specified bundle name. This API uses a promise to return the result.
**System capability**
SystemCapability.Customation.EnterpriseDeviceManager
**Parameters**
......@@ -372,6 +387,7 @@ getDeviceSettingsManager(callback: AsyncCallback&lt;DeviceSettingsManager&gt;):
Obtains a **DeviceSettingsManager** object. This API uses an asynchronous callback to return the result.
**System capability**
SystemCapability.Customation.EnterpriseDeviceManager
**Parameters**
......@@ -410,6 +426,7 @@ getDeviceSettingsManager(): Promise&lt;DeviceSettingsManager&gt;
Obtains a **DeviceSettingsManager** object. This API uses a promise to return the result.
**System capability**
SystemCapability.Customation.EnterpriseDeviceManager
**Return value**
......@@ -443,13 +460,14 @@ setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo, callback: AsyncCa
Sets the enterprise information of a device administrator application. This API uses an asynchronous callback to return the result.
**System capability**
SystemCapability.Customation.EnterpriseDeviceManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------------- | ---------------------------------------------- | ---- | ------------------------------------ |
| admin | [Want](js-apis-featureAbility.md#Want)| Yes | Device administrator application. |
| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. |
| enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | Yes | Enterprise information of the device administrator application. |
| callback | AsyncCallback\<boolean&gt; | Yes | Callback used to return the result.|
......@@ -480,13 +498,14 @@ setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo): Promise&lt;boole
Sets the enterprise information of a device administrator application. This API uses a promise to return the result.
**System capability**
SystemCapability.Customation.EnterpriseDeviceManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------------- | ---------------------------------------------- | ---- | ------------------------ |
| admin | [Want](js-apis-featureAbility.md#Want)| Yes | Device administrator application. |
| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. |
| enterpriseInfo | [EnterpriseInfo](#EnterpriseInfo) | Yes | Enterprise information of the device administrator application.|
**Return value**
......@@ -521,13 +540,14 @@ getEnterpriseInfo(admin: Want, callback: AsyncCallback&lt;EnterpriseInfo&gt;): v
Obtains the enterprise information of a device administrator application. This API uses an asynchronous callback to return the result.
**System capability**
SystemCapability.Customation.EnterpriseDeviceManager
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------ | ---- | ---------------------------------------- |
| admin | [Want](js-apis-featureAbility.md#Want) | Yes | Device administrator application. |
| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application. |
| callback | AsyncCallback&lt;[EnterpriseInfo](#EnterpriseInfo)&gt; | Yes | Callback used to return the enterprise information of the device administrator application.|
**Example**
......@@ -555,13 +575,14 @@ getDeviceSettingsManager(admin: Want): Promise&lt;EnterpriseInfo&gt;
Obtains the enterprise information of a device administrator application. This API uses a promise to return the result.
**System capability**
SystemCapability.Customation.EnterpriseDeviceManager
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ---------------------------------------------- | ---- | -------------- |
| admin | [Want](js-apis-featureAbility.md#Want)| Yes | Device administrator application.|
| admin | [Want](js-apis-application-Want.md) | Yes | Device administrator application.|
**Return value**
......@@ -588,8 +609,10 @@ enterpriseDeviceManager.getEnterpriseInfo(wantTemp).then((result) => {
Describes the enterprise information of a device administrator application.
**System capability**:
**System capability**
SystemCapability.Customation.EnterpriseDeviceManager
| Name | Readable/Writable| Type | Mandatory| Description |
| ----------- | -------- | ------ | ---- | ---------------------------------- |
| name | Read only | string | Yes | Name of the enterprise to which the device administrator application belongs.|
......@@ -600,8 +623,10 @@ SystemCapability.Customation.EnterpriseDeviceManager
Enumerates the administrator types of the device administrator application.
**System capability**:
**System capability**
SystemCapability.Customation.EnterpriseDeviceManager
| Name| Default Value| Description|
| -------- | -------- | -------- |
| ADMIN_TYPE_NORMAL | 0x00 | Common administrator.|
......
......@@ -2,6 +2,7 @@
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
>
> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
......@@ -21,7 +22,8 @@ Supported
## APIs
- Button(options?: {type?: ButtonType, stateEffect?: boolean})
**Table1** options parameters
**Table 1** options parameters
| Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- |
......@@ -30,14 +32,15 @@ Supported
- Button(label?: string, options?: { type?: ButtonType, stateEffect?: boolean })
Creates a button component based on text content. In this case, the **&lt;Button&gt;** component cannot contain child components.
**Table2** value parameters
| Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- |
| label | string | No | - | Button text. |
| options | Object | No | - | For details, see the **options** parameters. |
**Table 2** value parameters
| Name | Type | Mandatory | Default Value | Description |
| -------- | -------- | -------- | -------- | -------- |
| label | string | No | - | Button text. |
| options | Object | No | - | For details, see the **options** parameters. |
## Attributes
......
# Overview
The web-like development paradigm uses the classical three-stage programming model, in which OpenHarmony Markup Language (HML) is used for building layouts, CSS for defining styles, and JavaScript for adding processing logic. UI components are associated with data through one-way data-binding. This means that when data changes, the UI automatically updates with the new data. This development paradigm has a low learning curve for frontend web developers, allowing them to quickly transform existing web applications into ArkUI applications. It could be helpful if you are developing small- and medium-sized applications with simple UIs.
For details about the components, see [Component Reference (JavaScript-based Web-like Development Paradigm)](../reference/arkui-js/js-components-common-attributes.md).
## Overall Architecture
......
# Button
The **\<Button>** component is usually activated by user clicks to perform a specific action, for example, submitting a form. Buttons are classified as capsule, circle, or normal buttons.
The **\<Button>** component is usually activated by user clicks to perform a specific action, for example, submitting a form. Buttons are classified as capsule, circle, or normal buttons. For details, see [Button](../reference/arkui-ts/ts-basic-components-button.md).
## Creating a Button
......
......@@ -8,20 +8,26 @@ The TypeScript-based declarative development paradigm of ArkUI is a simplified,
In ArkUI that uses the TypeScript-based declarative development paradigm, the programming mode is closer to natural semantics. You can intuitively describe the UI without caring about how the framework implements UI drawing and rendering, leading to simplified and efficient development. The UI capabilities are provided from three dimensions: component, animation, and state management. System capability APIs are also provided to allow for effortless invocation of system capabilities.
For details about the UI components, see [Component Reference (TypeScript-based Declarative Development Paradigm)](../reference/arkui-ts/ts-universal-events-click.md).
- Out-of-the-box components
A wide range of preset system components are provided. You can set the rendering effect of these components in method chaining mode. You can combine system components to form custom components. In this way, page components are divided into independent UI units to implement independent creation, development, and reuse of different units on pages, making pages more engineering-oriented.
- A diverse array of animation APIs
By drawing from the standard SVG drawing capability and various open animation APIs, you can customize animation tracks by encapsulating physical models or calling the provided APIs.
- State and data management
State data management provides clear page update and rendering processes and pipes through decorators with different functions. State management covers UI component states and application states. With these features, you are able to build an application-wide data update and UI rendering process.
- System capability APIs
Development has never been so easy, with a diverse array of encapsulated system capability APIs, from UI design to system capability invoking.
......@@ -32,16 +38,21 @@ In ArkUI that uses the TypeScript-based declarative development paradigm, the pr
![en-us_image_0000001223287712](figures/en-us_image_0000001223287712.png)
- Declarative UI frontend
Provides basic language specifications of the UI development paradigm, built-in UI components, layouts, and animations, and multiple state management mechanisms, with a wide array of APIs for you to call as required.
Provides basic language specifications of the UI development paradigm, built-in UI components, layouts, and animations, and multiple state management mechanisms, with a wide array of APIs for you to call as required.
- Language runtime
Provides the parsing capability for the UI paradigm syntax and allows for cross-language API calls for a high-performance running environment of the TS language.
Provides the parsing capability for the UI paradigm syntax and allows for cross-language API calls for a high-performance running environment of the TS language.
- Declarative UI backend engine
Provides UI rendering pipelines that are compatible with different development paradigms, multiple basic components, layout calculation, dynamic effects, and interaction events, with state management and drawing capabilities.
Provides UI rendering pipelines that are compatible with different development paradigms, multiple basic components, layout calculation, dynamic effects, and interaction events, with state management and drawing capabilities.
- Render engine
Provides efficient drawing capabilities, which enable rendering instructions collected by the rendering pipeline to be drawn to the screen.
Provides efficient drawing capabilities, which enable rendering instructions collected by the rendering pipeline to be drawn to the screen.
- Porting layer
Provides abstract APIs to connect to different systems, such as system rendering pipelines and lifecycle scheduling.
# Work Scheduler
- [Work Scheduler Overview](work-scheduler-overview.md)
- [Work Scheduler Development](work-scheduler-dev-guide.md)
- Background Tasks
- [Work Scheduler Overview](work-scheduler-overview.md)
- [Work Scheduler Development](work-scheduler-dev-guide.md)
......@@ -2,26 +2,27 @@
## Overview<a name="section1155271783811"></a>
- Secure Digital Input/Output \(SDIO\) is a peripheral interface evolved from the Secure Digital \(SD\) memory card interface. The SDIO interface is compatible with SD memory cards and can be connected to devices that support the SDIO interface.
- SDIO is widely used. Currently, many smartphones support SDIO, and many SDIO peripherals are developed for connections to smartphones. Common SDIO peripherals include WLAN, GPS, cameras, and Bluetooth.
- The SDIO bus has two ends, named host and device. All communication starts when the host sends a command. The device can communicate with the host as long as it can parse the command of the host. An SDIO host can connect to multiple devices, as shown in the figure below.
Secure Digital Input/Output \(SDIO\) is a peripheral interface evolved from the Secure Digital \(SD\) memory card interface. The SDIO interface is compatible with SD memory cards and can be connected to devices that support the SDIO interface.
- CLK signal: clock signal sent from the host to the device
- VDD signal: power signal
- VSS signal: ground signal
- D0-3 signal: four data lines. The DAT1 signal cable is multiplexed as the interrupt line. In 1-bit mode, DAT0 is used to transmit data. In 4-bit mode, DAT0 to DAT3 are used to transmit data.
- CMD signal: used by the host to send commands and the device to respond to commands.
SDIO is widely used. Currently, many smartphones support SDIO, and many SDIO peripherals are developed for connections to smartphones. Common SDIO peripherals include WLAN, GPS, cameras, and Bluetooth.
**Figure 1** Connections between the host and devices in SDIO<a name="fig1185316527498"></a>
The SDIO bus has two ends, named host and device. All communication starts when the host sends a command. The device can communicate with the host as long as it can parse the command of the host. An SDIO host can connect to multiple devices, as shown in the figure below.
- CLK signal: clock signal sent from the host to the device
- VDD signal: power signal
- VSS signal: ground signal
- D0-3 signal: four data lines. The DAT1 signal cable is multiplexed as the interrupt line. In 1-bit mode, DAT0 is used to transmit data. In 4-bit mode, DAT0 to DAT3 are used to transmit data.
- CMD signal: used by the host to send commands and the device to respond to commands.
**Figure 1** Connections between the host and devices in SDIO<a name="fig1185316527498"></a>
![](figures/en-us_image_0000001160971556.png)
![](figures/en-us_image_0000001160971556.png)
- The SDIO interface defines a set of common methods for operating an SDIO device, including opening and closing an SDIO controller, exclusively claiming and releasing the host, enabling and disabling devices, claiming and releasing an SDIO IRQ, reading and writing data based on SDIO, and obtaining and setting common information.
The SDIO interface defines a set of common methods for operating an SDIO device, including opening and closing an SDIO controller, exclusively claiming and releasing the host, enabling and disabling devices, claiming and releasing an SDIO IRQ, reading and writing data based on SDIO, and obtaining and setting common information.
## Available APIs<a name="section12601496259"></a>
**Table 1** APIs available for the SDIO driver
**Table 1** APIs available for the SDIO driver
<a name="table1731550155318"></a>
<table><thead align="left"><tr id="row1625342317507"><th class="cellrowborder" valign="top" width="21.07%" id="mcps1.2.4.1.1"><p id="p1779183435016"><a name="p1779183435016"></a><a name="p1779183435016"></a>Capability</p>
......@@ -141,7 +142,7 @@
</tbody>
</table>
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>![](../public_sys-resources/icon-note.gif) **NOTE:**<br>
>All functions provided in this document can be called only in kernel mode.
## Usage Guidelines<a name="section1878939192515"></a>
......@@ -150,18 +151,18 @@
[Figure 2](#fig1343742311264) illustrates the process of using an SDIO.
**Figure 2** Process of using an SDIO<a name="fig1343742311264"></a>
**Figure 2** Process of using an SDIO<a name="fig1343742311264"></a>
![](figures/en-us_image_0000001206291517.png)
### Opening an SDIO Controller<a name="section10782428132616"></a>
Before performing SDIO communication, obtain the device handle of an SDIO controller by calling **SdioOpen**. This function returns the device handle of the SDIO controller with a specified bus number.
Before performing SDIO communication, obtain the device handle of an SDIO controller by calling **SdioOpen**. This function returns the device handle of the SDIO controller with a specified bus number.
DevHandle SdioOpen\(int16\_t mmcBusNum, struct SdioFunctionConfig \*config\);
**Table 2** Parameters and return values of SdioOpen
**Table 2** Parameters and return values of SdioOpen
<a name="table1036944152712"></a>
<table><thead align="left"><tr id="row4370114192717"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p737074112720"><a name="p737074112720"></a><a name="p737074112720"></a>Parameter</p>
......@@ -219,7 +220,7 @@ After obtaining the device handle of an SDIO controller, exclusively claim the h
void SdioClaimHost\(DevHandle handle\);
**Table 3** Parameter description of SdioClaimHost
**Table 3** Parameter description of SdioClaimHost
<a name="table192822447271"></a>
<table><thead align="left"><tr id="row192829443279"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p1128284452713"><a name="p1128284452713"></a><a name="p1128284452713"></a>Parameter</p>
......@@ -248,7 +249,7 @@ Before accessing a register, enable the SDIO device.
int32\_t SdioEnableFunc\(DevHandle handle\);
**Table 4** Parameters and return values of SdioEnableFunc
**Table 4** Parameters and return values of SdioEnableFunc
<a name="table144881047485"></a>
<table><thead align="left"><tr id="row8487204184815"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p1648611415486"><a name="p1648611415486"></a><a name="p1648611415486"></a>Parameter</p>
......@@ -297,7 +298,7 @@ Before SDIO communication, claim an SDIO IRQ.
int32\_t SdioClaimIrq\(DevHandle handle, SdioIrqHandler \*handler\);
**Table 5** Parameters and return values of SdioClaimIrq
**Table 5** Parameters and return values of SdioClaimIrq
<a name="table1149014114815"></a>
<table><thead align="left"><tr id="row114891042488"><th class="cellrowborder" valign="top" width="49.980000000000004%" id="mcps1.2.3.1.1"><p id="p1348864164811"><a name="p1348864164811"></a><a name="p1348864164811"></a>Parameter</p>
......@@ -357,13 +358,13 @@ if (ret != 0) {
### Performing SDIO Communication<a name="section85661522153420"></a>
- Incrementally write a given length of data into the SDIO device.
- Incrementally write a given length of data into the SDIO device.
The corresponding function is as follows:
int32\_t SdioWriteBytes\(DevHandle handle, uint8\_t \*data, uint32\_t addr, uint32\_t size\);
**Table 6** Parameters and return values of SdioWriteBytes
**Table 6** Parameters and return values of SdioWriteBytes
<a name="table6887174174111"></a>
<table><thead align="left"><tr id="row10887144111419"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p181381751164113"><a name="p181381751164113"></a><a name="p181381751164113"></a>Parameter</p>
......@@ -423,13 +424,13 @@ if (ret != 0) {
}
```
- Incrementally read a given length of data from the SDIO device.
- Incrementally read a given length of data from the SDIO device.
The corresponding function is as follows:
int32\_t SdioReadBytes\(DevHandle handle, uint8\_t \*data, uint32\_t addr, uint32\_t size\);
**Table 7** Parameters and return values of SdioReadBytes
**Table 7** Parameters and return values of SdioReadBytes
<a name="table5783755152110"></a>
<table><thead align="left"><tr id="row19783355162116"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p635754142212"><a name="p635754142212"></a><a name="p635754142212"></a>Parameter</p>
......@@ -489,13 +490,13 @@ if (ret != 0) {
}
```
- Write a given length of data into the fixed address of an SDIO device.
- Write a given length of data into the fixed address of an SDIO device.
The corresponding function is as follows:
int32\_t SdioWriteBytesToFixedAddr\(DevHandle handle, uint8\_t \*data, uint32\_t addr, uint32\_t size, uint32\_t scatterLen\);
**Table 8** Parameters and return values of SdioWriteBytesToFixedAddr
**Table 8** Parameters and return values of SdioWriteBytesToFixedAddr
<a name="table1982918113010"></a>
<table><thead align="left"><tr id="row1582911114010"><th class="cellrowborder" valign="top" width="48.43%" id="mcps1.2.3.1.1"><p id="p28301411903"><a name="p28301411903"></a><a name="p28301411903"></a>Parameter</p>
......@@ -560,13 +561,13 @@ if (ret != 0) {
}
```
- Read a given length of data from the fixed address of an SDIO device.
- Read a given length of data from the fixed address of an SDIO device.
The corresponding function is as follows:
int32\_t SdioReadBytesFromFixedAddr\(DevHandle handle, uint8\_t \*data, uint32\_t addr, uint32\_t size, uint32\_t scatterLen\);
**Table 9** Parameters and return values of SdioReadBytesFromFixedAddr
**Table 9** Parameters and return values of SdioReadBytesFromFixedAddr
<a name="table2724132220115"></a>
<table><thead align="left"><tr id="row8724142214115"><th class="cellrowborder" valign="top" width="48.699999999999996%" id="mcps1.2.3.1.1"><p id="p16752055131112"><a name="p16752055131112"></a><a name="p16752055131112"></a>Parameter</p>
......@@ -632,13 +633,13 @@ if (ret != 0) {
```
- Writes a given length of data into the address space of SDIO function 0.
- Writes a given length of data into the address space of SDIO function 0.
Currently, only 1-byte data can be written. The corresponding function is as follows:
int32\_t SdioWriteBytesToFunc0\(DevHandle handle, uint8\_t \*data, uint32\_t addr, uint32\_t size\);
**Table 10** Parameters and return values of SdioWriteBytesToFunc0
**Table 10** Parameters and return values of SdioWriteBytesToFunc0
<a name="table5339151811112"></a>
<table><thead align="left"><tr id="row2033991881120"><th class="cellrowborder" valign="top" width="49.94%" id="mcps1.2.3.1.1"><p id="p1116916499117"><a name="p1116916499117"></a><a name="p1116916499117"></a>Parameter</p>
......@@ -697,13 +698,13 @@ if (ret != 0) {
}
```
- Reads a given length of data from the address space of SDIO function 0.
- Reads a given length of data from the address space of SDIO function 0.
Currently, only 1-byte data can be read. The corresponding function is as follows:
int32\_t SdioReadBytesFromFunc0\(DevHandle handle, uint8\_t \*data, uint32\_t addr, uint32\_t size\);
**Table 11** Parameters and return values of SdioReadBytesFromFunc0
**Table 11** Parameters and return values of SdioReadBytesFromFunc0
<a name="table1071931161814"></a>
<table><thead align="left"><tr id="row771918171819"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p71291418171813"><a name="p71291418171813"></a><a name="p71291418171813"></a>Parameter</p>
......@@ -768,7 +769,7 @@ After the SDIO communication, release the SDIO IRQ.
int32\_t SdioReleaseIrq\(DevHandle handle\);
**Table 12** Parameters and return values of SdioReleaseIrq
**Table 12** Parameters and return values of SdioReleaseIrq
<a name="table165006412481"></a>
<table><thead align="left"><tr id="row15499849482"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p1549964114814"><a name="p1549964114814"></a><a name="p1549964114814"></a>Parameter</p>
......@@ -817,7 +818,7 @@ After the SDIO communication, disable the SDIO device.
int32\_t SdioDisableFunc\(DevHandle handle\);
**Table 13** Parameters and return values of SdioDisableFunc
**Table 13** Parameters and return values of SdioDisableFunc
<a name="table25012415481"></a>
<table><thead align="left"><tr id="row1050010474810"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p05002419488"><a name="p05002419488"></a><a name="p05002419488"></a>Parameter</p>
......@@ -866,7 +867,7 @@ After the SDIO communication, release the exclusively claimed host.
void SdioReleaseHost\(DevHandle handle\);
**Table 14** Parameter description of SdioReleaseHost
**Table 14** Parameter description of SdioReleaseHost
<a name="table1350214164813"></a>
<table><thead align="left"><tr id="row6502134194814"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p18501945486"><a name="p18501945486"></a><a name="p18501945486"></a>Parameter</p>
......@@ -897,7 +898,7 @@ void SdioClose\(DevHandle handle\);
This function releases the resources requested.
**Table 15** Parameter description of SdioClose
**Table 15** Parameter description of SdioClose
<a name="table950324124815"></a>
<table><thead align="left"><tr id="row1050213424819"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p18502134194818"><a name="p18502134194818"></a><a name="p18502134194818"></a>Parameter</p>
......@@ -1047,5 +1048,4 @@ ENABLE_ERR:
/* Close an SDIO controller. */
SdioClose(handle);
}
```
```
\ No newline at end of file
......@@ -3,9 +3,9 @@
## Overview<a name="section1347805272150053"></a>
A Secure Digital Input Output \(SDIO\) card is an extension of the SD specification to cover I/O functions. SD and SDIO are called multimedia card \(MMCs\). In the Hardware Driver Foundation \(HDF\) framework, the SDIO module uses the independent service mode for API adaptation. In this mode, each device independently publishes a device service to handle external access requests. After receiving an access request from an API, the device manager extracts the parameters in the request to call the internal method of the target device. In the independent service mode, the service management capabilities of the HDFDeviceManager can be directly used. However, you need to configure a device node for each device, which increases the memory usage.
A Secure Digital Input Output \(SDIO\) card is an extension of the SD specification to cover I/O functions. SD and SDIO cards are called multimedia cards \(MMCs\). In the Hardware Driver Foundation \(HDF\) framework, the SDIO module uses the independent service mode for API adaptation. In this mode, each device independently publishes a device service to handle external access requests. After receiving an access request from an API, the device manager extracts the parameters in the request to call the internal method of the target device. In the independent service mode, the service management capabilities of the HDFDeviceManager can be directly used. However, you need to configure a device node for each device, which increases the memory usage.
**Figure 1** Independent service mode<a name="fig124181331222"></a>
**Figure 1** Independent service mode<a name="fig124181331222"></a>
![](figures/independent-service-mode.png "independent-service-mode-12")
## Available APIs<a name="section752964871810"></a>
......@@ -35,7 +35,7 @@ struct SdioDeviceOps {
};
```
**Table 1** Callbacks for the members in the SdioDeviceOps structure
**Table 1** Callbacks for the members in the SdioDeviceOps structure
<a name="table878215448417"></a>
<table><thead align="left"><tr id="row17784344241"><th class="cellrowborder" valign="top" width="20%" id="mcps1.2.6.1.1"><p id="p67842444414"><a name="p67842444414"></a><a name="p67842444414"></a>Callback</p>
......@@ -263,35 +263,33 @@ struct SdioDeviceOps {
</tbody>
</table>
>![](../public_sys-resources/icon-note.gif) **NOTE**
>![](../public_sys-resources/icon-note.gif) **NOTE**<br>
>CommonInfo includes the following information:
>- **maxBlockNum**: specifies the maximum number of blocks in a request.
>- **maxBlockSize**: specifies the maximum number of bytes in a block.
>- **maxRequestSize**: specifies the maximum number of bytes in a request.
>- **enTimeout**: specifies the maximum timeout period, in milliseconds.
>- **funcNum**: specifies the function number, which ranges from **1** to **7**.
>- **irqCap**: specifies the interrupt request \(IRQ\) capabilities.
>- **\(void \*\)data**
>- **maxBlockNum**: specifies the maximum number of blocks in a request.
>- **maxBlockSize**: specifies the maximum number of bytes in a block.
>- **maxRequestSize**: specifies the maximum number of bytes in a request.
>- **enTimeout**: specifies the maximum timeout period, in milliseconds.
>- **funcNum**: specifies the function number, which ranges from **1** to **7**.
>- **irqCap**: specifies the interrupt request \(IRQ\) capabilities.
>- **\(void \*\)data**
## How to Develop<a name="section581179475150053"></a>
The SDIO module adaptation involves the following steps:
1. Instantiate the driver entry.
- Instantiate the **HdfDriverEntry** structure.
- Call **HDF\_INIT** to register the **HdfDriverEntry** instance with the HDF.
- Instantiate the **HdfDriverEntry** structure.
- Call **HDF\_INIT** to register the **HdfDriverEntry** instance with the HDF.
2. Configure attribute files.
- Add the **deviceNode** information to the **device\_info.hcs** file.
- \(Optional\) Add the **sdio\_config.hcs** file.
- Add the **deviceNode** information to the **device\_info.hcs** file.
- \(Optional\) Add the **sdio\_config.hcs** file.
3. Instantiate the SDIO controller object.
- Initialize **SdioDevice**.
- Instantiate **SdioDeviceOps** in the **SdioDevice** object.
>![](../public_sys-resources/icon-note.gif) **NOTE**
- Initialize **SdioDevice**.
- Instantiate **SdioDeviceOps** in the **SdioDevice** object.
>![](../public_sys-resources/icon-note.gif) **NOTE**<br>
>For details, see [Available APIs](#available-apis).
......@@ -301,11 +299,11 @@ The SDIO module adaptation involves the following steps:
## Development Example<a name="section2112250242150053"></a>
The following uses **sdio\_adapter.c** as an example to present the contents that need to be provided by the vendor to implement device functions.
The following uses **sdio\_adapter.c** as an example to present the contents that need to be provided by the vendor to implement device functions.
1. Instantiate the driver entry. The driver entry must be a global variable of the **HdfDriverEntry** type \(defined in **hdf\_device\_desc.h**\), and the value of **moduleName** must be the same as that in **device\_info.hcs**. In the HDF, the start address of each **HdfDriverEntry** object of all loaded drivers is collected to form a segment address space similar to an array for the upper layer to invoke.
1. Instantiate the driver entry. The driver entry must be a global variable of the **HdfDriverEntry** type \(defined in **hdf\_device\_desc.h**\), and the value of **moduleName** must be the same as that in **device\_info.hcs**. In the HDF, the start address of each **HdfDriverEntry** object of all loaded drivers is collected to form a segment address space similar to an array for the upper layer to invoke.
Generally, HDF calls the **Bind** function and then the **Init** function to load a driver. If **Init** fails to be called, HDF calls **Release** to release driver resources and exit.
Generally, HDF calls the **Bind** function and then the **Init** function to load a driver. If **Init** fails to be called, HDF calls **Release** to release driver resources and exit.
- SDIO driver entry reference
......@@ -315,17 +313,17 @@ The following uses **sdio\_adapter.c** as an example to present the contents t
.Bind = Hi35xxLinuxSdioBind, // See the Bind function.
.Init = Hi35xxLinuxSdioInit, // See the Init function.
.Release = Hi35xxLinuxSdioRelease// See the Release function.
.moduleName = "HDF_PLATFORM_SDIO",// (Mandatory) The value must be the same as that of moduleName in the .hcs file.
.moduleName = "HDF_PLATFORM_SDIO",// (Mandatory) The value must be the same as that of moduleName in the **.hcs** file.
};
// Call HDF_INIT to register the driver entry with the HDF.
HDF_INIT(g_sdioDriverEntry);
```
2. Add the **deviceNode** information to the **device\_info.hcs** file and configure the device attributes in the **sdio\_config.hcs** file. The **deviceNode** information is related to registration of the driver entry. The device attribute values are closely related to the default values or value ranges of the **SdioDevice** members at the core layer.
2. Add the **deviceNode** information to the **device\_info.hcs** file and configure the device attributes in the **sdio\_config.hcs** file. The **deviceNode** information is related to registration of the driver entry. The device attribute values are closely related to the default values or value ranges of the **SdioDevice** members at the core layer.
In this example, there is only one SDIO controller. If there are multiple SDIO controllers, you need to add the **deviceNode** information to the **device\_info** file and add the corresponding device attributes to the **sdio\_config** file.
In this example, there is only one SDIO controller. If there are multiple SDIO controllers, you need to add the **deviceNode** information to the **device\_info** file and add the corresponding device attributes to the **sdio\_config** file.
- **device\_info.hcs** configuration reference
- **device\_info.hcs** configuration reference
```
root {
......@@ -349,7 +347,7 @@ The following uses **sdio\_adapter.c** as an example to present the contents t
}
```
- **sdio\_config.hcs** configuration reference
- **sdio\_config.hcs** configuration reference
```
root {
......@@ -357,8 +355,8 @@ The following uses **sdio\_adapter.c** as an example to present the contents t
sdio_config {
template sdio_controller {
match_attr = "";
hostId = 2; // (Mandatory) It is set to 2. For details, see mmc_config.hcs.
devType = 2; // (Mandatory) It is set to 2. For details, see mmc_config.hcs.
hostId = 2; // (Mandatory) Set the value to 2. For details, see mmc_config.hcs.
devType = 2; // (Mandatory) Set the value to 2. For details, see mmc_config.hcs.
}
controller_0x2dd1 :: sdio_controller {
match_attr = "hisilicon_hi35xx_sdio_0";// (Mandatory) The value must be the same as that of deviceMatchAttr in device_info.hcs.
......@@ -367,11 +365,11 @@ The following uses **sdio\_adapter.c** as an example to present the contents t
}
```
3. Initialize the **SdioDevice** object at the core layer, including initializing the vendor custom structure \(transferring parameters and data\), instantiating **SdioDeviceOps** \(used to call underlying functions of the driver\) in **SdioDevice**, and implementing the **HdfDriverEntry** member functions \(**Bind**, **Init**, and **Release**\).
3. Initialize the **SdioDevice** object at the core layer, including initializing the vendor custom structure \(transferring parameters and data\), instantiating **SdioDeviceOps** \(used to call underlying functions of the driver\) in **SdioDevice**, and implementing the **HdfDriverEntry** member functions \(**Bind**, **Init**, and **Release**\).
- Custom structure reference
To the driver, the custom structure carries parameters and data. The values in the **sdio\_config.hcs** file are read by HDF, and the structure members are initialized through **DeviceResourceIface**. Some important values are also passed to the objects at the core layer.
To the driver, the custom structure carries parameters and data. The values in the **sdio\_config.hcs** file are read by HDF, and the structure members are initialized through **DeviceResourceIface**. Some important values are also passed to the objects at the core layer.
```
typedef struct {
......@@ -399,7 +397,7 @@ The following uses **sdio\_adapter.c** as an example to present the contents t
};
```
- Instantiate the callback function structure **SdioDeviceOps** in **SdioDevice**. Other members are initialized by using the **Init** function.
- Instantiate the callback function structure **SdioDeviceOps** in **SdioDevice**. Other members are initialized by using the **Init** function.
```
static struct SdioDeviceOps g_sdioDeviceOps = {
......@@ -427,13 +425,13 @@ The following uses **sdio\_adapter.c** as an example to present the contents t
Input parameters:
**HdfDeviceObject**, an interface parameter exposed by the driver, contains the .hcs configuration file information.
**HdfDeviceObject**, an interface parameter exposed by the driver, contains the **.hcs** configuration file information.
Return values:
HDF\_STATUS \(The following table lists some status. For details about other status, see **HDF\_STATUS** in the **//drivers/framework/include/utils/hdf\_base.h** file.\)
HDF\_STATUS \(The following table lists some status. For details about other status, see **HDF\_STATUS** in the **//drivers/framework/include/utils/hdf\_base.h** file.\)
**Table 2** Input parameters and return values of the Bind function
**Table 2** Input parameters and return values of the Bind function
<a name="table297118388199"></a>
<table><thead align="left"><tr id="row197133831916"><th class="cellrowborder" valign="top" width="50%" id="mcps1.2.3.1.1"><p id="p1972138191917"><a name="p1972138191917"></a><a name="p1972138191917"></a>Status (Value)</p>
......@@ -477,7 +475,7 @@ The following uses **sdio\_adapter.c** as an example to present the contents t
Function description:
Initializes the custom structure object and **SdioCntlr**, calls the **SdioCntlrAdd** function at the core layer, and performs other initialization operations customized by the vendor.
Initializes the custom structure object and **SdioCntlr**, calls the **SdioCntlrAdd** function at the core layer, and performs other initialization operations customized by the vendor.
```
static int32_t Hi35xxLinuxSdioBind(struct HdfDeviceObject *obj)
......@@ -513,7 +511,7 @@ The following uses **sdio\_adapter.c** as an example to present the contents t
Input parameters:
**HdfDeviceObject**, an interface parameter exposed by the driver, contains the .hcs configuration file information.
**HdfDeviceObject**, an interface parameter exposed by the driver, contains the **.hcs** configuration file information.
Return values:
......@@ -536,7 +534,7 @@ The following uses **sdio\_adapter.c** as an example to present the contents t
Input parameters:
**HdfDeviceObject**, an interface parameter exposed by the driver, contains the .hcs configuration file information.
**HdfDeviceObject**, an interface parameter exposed by the driver, contains the **.hcs** configuration file information.
Return values:
......@@ -544,7 +542,7 @@ The following uses **sdio\_adapter.c** as an example to present the contents t
Function description:
Releases the memory and deletes the controller. This function assigns a value to the **Release** API in the driver entry structure. When the HDF fails to call the **Init** function to initialize the driver, the **Release** function can be called to release driver resources. All forced conversion operations for obtaining the corresponding object can be successful only when the **Bind** function has the corresponding value assignment operations.
Releases the memory and deletes the controller. This function assigns a value to the **Release** API in the driver entry structure. When the HDF fails to call the **Init** function to initialize the driver, the **Release** function can be called to release driver resources. All forced conversion operations for obtaining the corresponding object can be successful only when the **Bind** function has the corresponding value assignment operations.
```
......@@ -555,6 +553,4 @@ The following uses **sdio\_adapter.c** as an example to present the contents t
}
Hi35xxLinuxSdioDeleteCntlr((struct MmcCntlr *)obj->service);// (Mandatory) Custom function for releasing memory. A forced conversion from HdfDeviceObject to MmcCntlr is involved.
}
```
```
\ No newline at end of file
......@@ -26,10 +26,10 @@ The System Ability Manager (SAMGR) subsystem implements the system service frame
**SAMGR**
distributedschedule\_safwk
[distributedschedule\_safwk](https://gitee.com/openharmony/distributedschedule_safwk)
distributedschedule\_samgr
[distributedschedule\_samgr](https://gitee.com/openharmony/distributedschedule_samgr)
distributedschedule\_safwk\_lite
[distributedschedule\_safwk\_lite](https://gitee.com/openharmony/distributedschedule_safwk_lite)
distributedschedule\_samgr\_lite
[distributedschedule\_samgr\_lite](https://gitee.com/openharmony/distributedschedule_samgr_lite)
......@@ -10,10 +10,6 @@
import convertxml from '@ohos.convertxml';
```
## 系统能力
SystemCapability.Utils.Lang
## ConvertXML
......@@ -21,45 +17,50 @@ SystemCapability.Utils.Lang
convert(xml: string, options?: ConvertOptions) : Object
xml文本为JavaScript对象。
xml文本为JavaScript对象。
**系统能力:** SystemCapability.Utils.Lang
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| ------- | --------------------------------- | ---- | ------------------ |
| xml | string | 是 | 传入的xml文本。 |
| options | [ConvertOptions](#convertoptions) | 否 | 用户可进行的选项。 |
**参数:**
- 返回值:
| 参数名 | 类型 | 必填 | 说明 |
| ------- | --------------------------------- | ---- | --------------- |
| xml | string | 是 | 传入的xml文本。 |
| options | [ConvertOptions](#convertoptions) | 否 | 转换选项。 |
| 类型 | 说明 |
| ------ | ---------------------------- |
| Object | 处理后返回的JavaScript对象。 |
**返回值:**
- 示例:
| 类型 | 说明 |
| ------ | ---------------------------- |
| Object | 处理后返回的JavaScript对象。 |
```js
let xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
let conv = new convertxml.ConvertXML();
let options = {trim : false, declarationKey:"_declaration",
instructionKey : "_instruction", attributesKey : "_attributes",
textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
nameKey : "_name", elementsKey : "_elements"}
let result = JSON.stringify(conv.convert(xml, options));
console.log(result)
```
**示例:**
```js
let xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
let conv = new convertxml.ConvertXML();
let options = {trim : false, declarationKey:"_declaration",
instructionKey : "_instruction", attributesKey : "_attributes",
textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
nameKey : "_name", elementsKey : "_elements"}
let result = JSON.stringify(conv.convert(xml, options));
console.log(result)
```
## ConvertOptions
转换选项。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Utils.Lang
| 名称 | 参数类型 | 必填 | 说明 |
| ----------------- | -------- | ---- | ----------------------------------------------------------- |
| trim | boolean | 是 | 是否修剪位于文本前后的空白字符,默认false。 |
......
......@@ -10,15 +10,12 @@
import uri from '@ohos.uri'
```
## 系统能力
SystemCapability.Utils.Lang
## URI
### 属性
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Utils.Lang
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| scheme | string | 是 | 否 | 获取URI&nbsp;的协议部分。 |
......@@ -38,6 +35,8 @@ constructor(uri: string)
constructor是URI的构造函数。
**系统能力:** SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 可读 | 可写 | 说明 |
......@@ -59,6 +58,8 @@ new uri.URI('http://username:password@host:8080'); // Output 'http://username:pa
toString(): string
**系统能力:** SystemCapability.Utils.Lang
返回适用于URL中的查询字符串。
**返回值:**
......@@ -81,6 +82,8 @@ equals(other: URI): boolean
判断此URI是否与其他URI对象相等。
**系统能力:** SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -107,6 +110,8 @@ checkIsAbsolute(): boolean
判断此URI是否为绝对URI(是否定义了scheme组件)。
**系统能力:** SystemCapability.Utils.Lang
**返回值:**
| 类型 | 说明 |
......@@ -127,6 +132,8 @@ normalize(): URI
规范化此URI的路径。
**系统能力:** SystemCapability.Utils.Lang
**返回值:**
| 类型 | 说明 |
......
......@@ -10,10 +10,6 @@
import Url from '@ohos.url'
```
## 系统能力
SystemCapability.Utils.Lang
## URLSearchParams
......@@ -23,6 +19,8 @@ constructor(init?: string[][] | Record&lt;string, string&gt; | string | URLSearc
URLSearchParams的构造函数。
**系统能力:** SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -46,6 +44,8 @@ append(name: string, value: string): void
将新的键值对插入到查询字符串。
**系统能力:** SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -68,6 +68,8 @@ delete(name: string): void
删除指定名称的键值对。
**系统能力:** SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -89,6 +91,8 @@ getAll(name: string): string[]
获取指定名称的所有键值对。
**系统能力:** SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -117,6 +121,8 @@ entries(): IterableIterator<[string, string]>
返回一个ES6的迭代器,迭代器的每一项都是一个 JavaScript Array。Array的第一项是name,Array的第二项是value。
**系统能力:** SystemCapability.Utils.Lang
**返回值:**
| 类型 | 说明 |
......@@ -139,6 +145,8 @@ forEach(callbackfn: (value: string, key: string, searchParams: this) => void, th
通过回调函数来遍历URLSearchParams实例对象上的键值对。
**系统能力:** SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -170,6 +178,8 @@ get(name: string): string | null
获取指定名称对应的第一个值。
**系统能力:** SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -199,6 +209,8 @@ has(name: string): boolean
判断一个指定的键名对应的值是否存在。
**系统能力:** SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -226,6 +238,8 @@ set(name: string, value: string): void
将与name关联的URLSearchParams对象中的值设置为value。如果存在名称为name的键值对,请将第一个键值对的值设置为value并删除所有其他值。如果不是,则将键值对附加到查询字符串。
**系统能力:** SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -246,9 +260,10 @@ paramsObject.set('baz', 3); // Add a third parameter.
sort(): void
对包含在此对象中的所有键值对进行排序,并返回undefined。排序顺序是根据键的Unicode代码点。该方法使用稳定的排序算法 (即,将保留具有相等键的键值对之间的相对顺序)。
**系统能力:** SystemCapability.Utils.Lang
**示例:**
```js
......@@ -262,9 +277,10 @@ console.log(searchParamsObject.toString()); // Display the sorted query string /
keys(): IterableIterator&lt;string&gt;
返回一个所有键值对的name的ES6迭代器。
**系统能力:** SystemCapability.Utils.Lang
**返回值:**
| 类型 | 说明 |
......@@ -287,6 +303,8 @@ values(): IterableIterator&lt;string&gt;
返回一个所有键值对的value的ES6迭代器。
**系统能力:** SystemCapability.Utils.Lang
**返回值:**
| 类型 | 说明 |
......@@ -307,9 +325,10 @@ for (var value of searchParams.values()) {
[Symbol.iterator]\(): IterableIterator&lt;[string, string]&gt;
返回一个ES6的迭代器,迭代器的每一项都是一个 JavaScript Array。Array的第一项是name,Array的第二项是value。
**系统能力:** SystemCapability.Utils.Lang
**返回值:**
| 类型 | 说明 |
......@@ -330,9 +349,10 @@ for (const [name, value] of paramsObject) {
toString(): string
返回序列化为字符串的搜索参数,必要时对字符进行百分比编码。
**系统能力:** SystemCapability.Utils.Lang
**返回值:**
| 类型 | 说明 |
......@@ -351,9 +371,10 @@ console.log(params.toString());
## URL
### 属性
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Utils.Lang
| 名称 | 参数类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| hash | string | 是 | 是 | 获取和设置URL的片段部分。 |
......@@ -374,9 +395,10 @@ console.log(params.toString());
constructor(url: string, base?: string | URL)
URL的构造函数。
**系统能力:** SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -408,6 +430,8 @@ toString(): string
将解析过后的URL转化为字符串。
**系统能力:** SystemCapability.Utils.Lang
**返回值:**
| 类型 | 说明 |
......@@ -426,9 +450,10 @@ url.toString()
toJSON(): string
将解析过后的URL转化为JSON字符串。
**系统能力:** SystemCapability.Utils.Lang
**返回值:**
| 类型 | 说明 |
......
......@@ -10,10 +10,6 @@
import xml from '@ohos.xml';
```
## 系统能力
SystemCapability.Utils.Lang
## XmlSerializer
......@@ -23,6 +19,8 @@ constructor(buffer: ArrayBuffer | DataView, encoding?: string)
XmlSerializer的构造函数。
**系统能力:** SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -45,6 +43,8 @@ setAttributes(name: string, value: string): void
设置Attributes方法。
**系统能力:** SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -66,6 +66,8 @@ addEmptyElement(name: string): void
写入一个空元素。
**系统能力:** SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -86,6 +88,8 @@ setDeclaration(): void
设置Declaration方法。
**系统能力:** SystemCapability.Utils.Lang
**示例:**
```js
......@@ -100,6 +104,8 @@ startElement(name: string): void
根据给定名称写入元素开始标记。
**系统能力:** SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -122,6 +128,8 @@ endElement(): void
写入元素结束标记。
**系统能力:** SystemCapability.Utils.Lang
**示例:**
```js
......@@ -140,6 +148,8 @@ setNamespace(prefix: string, namespace: string): void
写入当前元素标记的命名空间。
**系统能力:** SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -164,6 +174,8 @@ setComment(text: string): void
写入comment属性。
**系统能力:** SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -187,6 +199,8 @@ setCDATA(text: string): void
写入CDATA属性。
**系统能力:** SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -208,6 +222,8 @@ setText(text: string): void
设置Text方法。
**系统能力:** SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -232,6 +248,8 @@ setDocType(text: string): void
写入DocType属性。
**系统能力:** SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -256,6 +274,8 @@ constructor(buffer: ArrayBuffer | DataView, encoding?: string)
创建并返回一个XmlPullParser对象,该XmlPullParser对象传参两个, 第一参数是ArrayBuffer或DataView类型的一段内存,第二个参数为文件格式(默认为UTF-8)
**系统能力:** SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -289,6 +309,8 @@ parse(option: ParseOptions): void
该接口用于解析xml。
**系统能力:** SystemCapability.Utils.Lang
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
......@@ -329,6 +351,8 @@ that.parse(options);
xml解析选项。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Utils.Lang
| 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
......@@ -349,6 +373,8 @@ getColumnNumber(): number
获取当前列号,从1开始。
**系统能力:** SystemCapability.Utils.Lang
**返回值:**
| 类型 | 说明 |
......@@ -362,6 +388,8 @@ getDepth(): number
获取元素的当前深度。
**系统能力:** SystemCapability.Utils.Lang
**返回值:**
| 类型 | 说明 |
......@@ -375,6 +403,8 @@ getLineNumber(): number
获取当前行号,从1开始。
**系统能力:** SystemCapability.Utils.Lang
**返回值:**
| 类型 | 说明 |
......@@ -388,6 +418,8 @@ getName(): string
获取当前元素名称。
**系统能力:** SystemCapability.Utils.Lang
**返回值:**
| 类型 | 说明 |
......@@ -401,6 +433,8 @@ getNamespace(): string
获取当前元素的命名空间。
**系统能力:** SystemCapability.Utils.Lang
**返回值:**
| 类型 | 说明 |
......@@ -414,6 +448,8 @@ getPrefix(): string
获取当前元素前缀。
**系统能力:** SystemCapability.Utils.Lang
**返回值:**
| 类型 | 说明 |
......@@ -427,6 +463,8 @@ getText(): string
获取当前事件的文本内容。
**系统能力:** SystemCapability.Utils.Lang
**返回值:**
| 类型 | 说明 |
......@@ -440,6 +478,8 @@ isEmptyElementTag(): boolean
判断当前元素是否为空元素。
**系统能力:** SystemCapability.Utils.Lang
**返回值:**
| 类型 | 说明 |
......@@ -453,6 +493,8 @@ isWhitespace(): boolean
判断当前文本事件是否仅包含空格字符。
**系统能力:** SystemCapability.Utils.Lang
**返回值:**
| 类型 | 说明 |
......@@ -466,6 +508,8 @@ getAttributeCount(): number
获取当前开始标记的属性数。
**系统能力:** SystemCapability.Utils.Lang
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
......@@ -476,6 +520,8 @@ getAttributeCount(): number
事件枚举。
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Utils.Lang
| 名称 | 枚举值 | 说明 |
| -------- | -------- | -------- |
| START_DOCUMENT | 0 | 启动文件事件。 |
......
......@@ -86,8 +86,8 @@ struct PanelExample {
.type(PanelType.Foldable).mode(PanelMode.Half)
.dragBar(true) // 默认开启
.halfHeight(500) // 默认一半
.onChange((value: any) => {
console.info(`width:${value.width},height:${value.height},mode:${value.mode}`)
.onChange((width: number, height: number, mode: PanelMode) => {
console.info(`width:${width},height:${height},mode:${mode}`)
})
}.width('100%').height('100%').backgroundColor(0xDCDCDC).padding({ top: 5 })
}
......
......@@ -3,7 +3,7 @@
***【写作要求】***
*必选。* *描述各个场景下,开发者如何完成开发任务。* *可根据多场景任务增加章节。写作要求见下,完成写作后,请逐项自检。*
*必选**描述各个场景下,开发者如何完成开发任务**可根据多场景任务增加章节。写作要求见下,完成写作后,请逐项自检*
| 内容要求 | 是否满足 |
......@@ -16,7 +16,7 @@
***【写作要求】***
*必选。* *描述在什么情景下解决什么问题,最终达到什么样的效果。*应用SCQA描述方法:
*必选**描述在什么情景下解决什么问题,最终达到什么样的效果*应用SCQA描述方法:
- S:situation(情景),由大家都熟悉的的情景,事实引入。
......@@ -26,29 +26,29 @@
- A:answer(回答),我们的解决方案是 …
*写作要求见下,完成写作后,请逐项自检。*
*写作要求见下,完成写作后,请逐项自检*
| 内容要求 | 是否满足 |
| -------- | -------- |
| 背景原因、什么时候在哪、做了什么操作、最终解决什么问题或操作效果都明确。 | |
**【写作样例】**
**写作样例**
音频播放的主要工作是将音频数据转码为可听见的音频模拟信号并通过输出设备进行播放,同时对播放任务进行管理。
## 接口说明
***【写作要求】***
*【**写作要求**】*
*必选。* *描述本开发指导相关的接口有哪些,旨在要开发者在开发前有大体了解,提升开发效率。* *写作要求见下,完成写作后,请逐项自检。*
*必选**描述本开发指导相关的接口有哪些,旨在要开发者在开发前有大体了解,提升开发效率**写作要求见下,完成写作后,请逐项自检*
| 内容要求 | 是否满足 |
| -------- | -------- |
| 不在本开发任务的接口无需提供。 | |
| 如果接口太多,超过10个,可以提供主要的接口 | |
**【写作样例】**
**写作样例**
音频播放开放能力如下:AudioRenderer类,具体的API详见接口文档。
......@@ -64,9 +64,9 @@
## 开发步骤
***【写作要求】***
*【**写作要求**】*
* 必选。描述* *开发的整体过程,便于开发者快速完成开发。* * 具体 写作要求见下,完成写作后,请逐项自检下。*
*必选。描述* *开发的整体过程,便于开发者快速完成开发**具体写作要求见下,完成写作后,请逐项自检下*
| 内容要求 | 是否满足 |
| -------- | -------- |
......@@ -85,7 +85,7 @@
| 代码显示符合代码缩进要求。 | |
| 步骤涉及接口调用,清晰给出接口及其使用说明或示例代码,代码来源于具体实例。 | |
**【写作样例】**
**写作样例**
1. 构造音频流参数的数据结构AudioStreamInfo,推荐使用AudioStreamInfo.Builder类来构造,模板如下,模板中设置的均为AudioStreamInfo.Builder类的默认值,根据音频流的具体规格来设置具体参数。
```
......@@ -115,9 +115,9 @@
## 调测验证(可选)
***【写作要求】***
*【**写作要求**】*
*可选。* *描述开发完成后,进行调测验证,确保最终操作成功。* *操作步骤要求同“开发指导”,其他具体写作要求见下,完成写作后,请逐项自检下。*
*可选**描述开发完成后,进行调测验证,确保最终操作成功**操作步骤要求同“开发指导”,其他具体写作要求见下,完成写作后,请逐项自检下*
| 内容要求 | 是否满足 |
| -------- | -------- |
......@@ -125,9 +125,9 @@
| 明确开发成功标准。 | |
## 开发实例
***【写作要求】***
*【**写作要求**】*
*提供完整的sample示例,同时简要描述示例原理和实现,并链接到源码仓。*
*提供完整的sample示例,同时简要描述示例原理和实现,并链接到源码仓*
针对xxx开发,有以下示例工程可供参考:
......
......@@ -54,11 +54,11 @@
图片统一存放到文档同级目录下的pic文件夹中(英文文档对应pic-en),如:
“OpenHarmony\_DOCUMENTS/docs/quick-start/write-standard.md中使用的图片,统一放置到
“OpenHarmony\_DOCUMENTS/docs/quick-start/write-standard.md中使用的图片,统一放置到
“OpenHarmony\_DOCUMENTS/docs/quick-start/pic目录下,文档中使用相对路径引用图片。
“OpenHarmony\_DOCUMENTS/docs/quick-start/pic目录下,文档中使用相对路径引用图片。
>![](public_sys-resources/icon-caution.gif) **注意:**
>![](public_sys-resources/icon-caution.gif) **注意**:
>请使用原创图片,避免存在知识产权侵权风险。
- 图形清晰可辨识,图形信息完整,如流程图有“开始”和“结束”。
......@@ -67,7 +67,7 @@
- 中文用中文图,英文用英文图形。
- 图片建议根据内容命名,只用数字序列不利于后续图片的继承。
>![](public_sys-resources/icon-note.gif) **说明:**
>![](public_sys-resources/icon-note.gif) **说明**:
>引用方式:
>!\[\]\(./pic/pic-standard.png\)
......
......@@ -3,22 +3,22 @@
## 概述
- SDIO是安全数字输入输出接口(Secure Digital Input and Output)的缩写,是从SD内存卡接口的基础上演化出来的一种外设接口。SDIO接口兼容以前的SD内存卡,并且可以连接支持SDIO接口的设备。
SDIO是安全数字输入输出接口(Secure Digital Input and Output)的缩写,是从SD内存卡接口的基础上演化出来的一种外设接口。SDIO接口兼容以前的SD内存卡,并且可以连接支持SDIO接口的设备。
- SDIO的应用比较广泛,目前,有许多手机都支持SDIO功能,并且很多SDIO外设也被开发出来,使得手机外接外设更加容易。常见的SDIO外设有WLAN、GPS、CAMERA、蓝牙等。
SDIO的应用比较广泛,目前,有许多手机都支持SDIO功能,并且很多SDIO外设也被开发出来,使得手机外接外设更加容易。常见的SDIO外设有WLAN、GPS、CAMERA、蓝牙等。
- SDIO总线有两端,其中一端是主机端(HOST),另一端是设备端(DEVICE)。所有的通信都是由HOST端发出命令开始的,在DEVICE端只要能解析HOST的命令,就可以同HOST进行通信了。SDIO的HOST可以连接多个DEVICE,如下图所示:
- CLK信号:HOST给DEVICE的时钟信号。
- VDD信号:电源信号。
- VSS信号:Ground信号。
- D0-3信号:4条数据线,其中,DAT1信号线复用为中断线,在1BIT模式下DAT0用来传输数据,在4BIT模式下DAT0-DAT3用来传输数据。
- CMD信号:用于HOST发送命令和DEVICE回复响应。
SDIO总线有两端,其中一端是主机端(HOST),另一端是设备端(DEVICE)。所有的通信都是由HOST端发出命令开始的,在DEVICE端只要能解析HOST的命令,就可以同HOST进行通信了。SDIO的HOST可以连接多个DEVICE,如下图所示:
- CLK信号:HOST给DEVICE的时钟信号。
- VDD信号:电源信号。
- VSS信号:Ground信号。
- D0-3信号:4条数据线,其中,DAT1信号线复用为中断线,在1BIT模式下DAT0用来传输数据,在4BIT模式下DAT0-DAT3用来传输数据。
- CMD信号:用于HOST发送命令和DEVICE回复响应。
**图1** SDIO的HOST-DEVICE连接示意图
**图1** SDIO的HOST-DEVICE连接示意图
![image](figures/SDIO的HOST-DEVICE连接示意图.png "SDIO的HOST-DEVICE连接示意图")
![image](figures/SDIO的HOST-DEVICE连接示意图.png "SDIO的HOST-DEVICE连接示意图")
- SDIO接口定义了操作SDIO的通用方法集合,包括打开/关闭SDIO控制器、独占/释放HOST、使能/去使能设备、申请/释放中断、读写、获取/设置公共信息等。
SDIO接口定义了操作SDIO的通用方法集合,包括打开/关闭SDIO控制器、独占/释放HOST、使能/去使能设备、申请/释放中断、读写、获取/设置公共信息等。
## 接口说明
......@@ -36,7 +36,7 @@
| SDIO使能/去使能功能设备接口 | -&nbsp;SdioEnableFunc:使能SDIO功能设备<br/>-&nbsp;SdioDisableFunc:去使能SDIO功能设备 |
| SDIO申请/释放中断接口 | -&nbsp;SdioClaimIrq:申请中断<br/>-&nbsp;SdioReleaseIrq:释放中断 |
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**<br>
> 本文涉及的所有接口,目前只支持在内核态使用,不支持在用户态使用。
......
......@@ -3,7 +3,7 @@
## 概述
SDIO由SD卡发展而来,被统称为mmc(MultiMediaCard),相关技术差别不大,在HDF框架中,SDIO的接口适配模式采用独立服务模式,在这种模式下,每一个设备对象会独立发布一个设备服务来处理外部访问,设备管理器收到API的访问请求之后,通过提取该请求的参数,达到调用实际设备对象的相应内部方法的目的。独立服务模式可以直接借助HDFDeviceManager的服务管理能力,但需要为每个设备单独配置设备节点,增加内存占用。
SDIO由SD卡发展而来,被统称为mmc(MultiMediaCard),相关技术差别不大。在HDF框架中,SDIO的接口适配模式采用独立服务模式。在这种模式下,每一个设备对象会独立发布一个设备服务来处理外部访问,设备管理器收到API的访问请求之后,通过提取该请求的参数,达到调用实际设备对象的相应内部方法的目的。独立服务模式可以直接借助HDFDeviceManager的服务管理能力,但需要为每个设备单独配置设备节点,增加内存占用。
**图1** SDIO独立服务模式结构图
......@@ -42,26 +42,26 @@ struct SdioDeviceOps {
| 函数 | 入参 | 出参 | 返回值 | 功能 |
| -------- | -------- | -------- | -------- | -------- |
| incrAddrReadBytes | dev:&nbsp;结构体指针,SDIO设备控制器;addr:&nbsp;uint32_t,地址值;size:&nbsp;uint32_t,大小 | data:&nbsp;uint8_t指针,传出值; | HDF_STATUS相关状态 | 从指定的SDIO地址增量读取给定长度的数据 |
| incrAddrWriteBytes | dev:&nbsp;结构体指针,SDIO设备控制器;data:&nbsp;uint8_t指针,传入值;addr:&nbsp;uint32_t,地址值;size:&nbsp;uint32_t,大小 | 无 | HDF_STATUS相关状态 | 将给定长度的数据增量写入指定的SDIO地址 |
| fixedAddrReadBytes | dev:&nbsp;结构体指针,SDIO设备控制器;addr:&nbsp;uint32_t,地址值;size:&nbsp;uint32_t,大小;scatterLen:&nbsp;uint32_t,数据长度; | data:&nbsp;uint8_t指针,传出值; | HDF_STATUS相关状态 | 从固定SDIO地址读取给定长度的数据。 |
| fixedAddrWriteBytes | dev:&nbsp;结构体指针,SDIO设备控制器;data:&nbsp;uint8_t指针,传入值;addr:&nbsp;uint32_t,地址值;size:&nbsp;uint32_t,大小;scatterLen:&nbsp;uint32_t,数据长度; | 无 | HDF_STATUS相关状态 | 将给定长度的数据写入固定SDIO地址 |
| func0ReadBytes | dev:&nbsp;结构体指针,SDIO设备控制器;addr:&nbsp;uint32_t,地址值;size:&nbsp;uint32_t,大小; | data:&nbsp;uint8_t指针,传出值; | HDF_STATUS相关状态 | 从SDIO函数0的地址空间读取给定长度的数据。 |
| func0WriteBytes | dev:&nbsp;结构体指针,SDIO设备控制器;data:&nbsp;uint8_t指针,传入值;addr:&nbsp;uint32_t,地址值;size:&nbsp;uint32_t,大小; | 无 | HDF_STATUS相关状态 | 将给定长度的数据写入SDIO函数0的地址空间。 |
| setBlockSize | dev:&nbsp;结构体指针,SDIO设备控制器;blockSize:&nbsp;uint32_t,Block大小 | 无 | HDF_STATUS相关状态 | 设置block大小 |
| getCommonInfo | dev:&nbsp;联合体指针,SDIO设备控制器;infoType:&nbsp;uint32_t,info类型; | info:&nbsp;结构体指针,传出SdioFuncInfo信息; | HDF_STATUS相关状态 | 获取CommonInfo,说明见下 |
| setCommonInfo | dev:&nbsp;结构体指针,SDIO设备控制器;info:&nbsp;联合体指针,SdioFuncInfo信息传入;infoType:&nbsp;uint32_t,info类型; | 无 | HDF_STATUS相关状态 | 设置CommonInfo,说明见下 |
| flushData | dev:&nbsp;结构体指针,SDIO设备控制器; | 无 | HDF_STATUS相关状态 | 当SDIO需要重新初始化或发生意外错误时调用的函数 |
| enableFunc | dev:&nbsp;结构体指针,SDIO设备控制器; | 无 | HDF_STATUS相关状态 | 使能SDIO设备 |
| disableFunc | dev:&nbsp;结构体指针,SDIO设备控制器; | 无 | HDF_STATUS相关状态 | 去使能SDIO设备 |
| claimIrq | dev:&nbsp;结构体指针,SDIO设备控制器;irqHandler:&nbsp;void函数指针; | 无 | HDF_STATUS相关状态 | 注册SDIO中断 |
| releaseIrq | dev:&nbsp;结构体指针,SDIO设备控制器; | 无 | HDF_STATUS相关状态 | 释放SDIO中断 |
| findFunc | dev:&nbsp;结构体指针,SDIO设备控制器;configData:&nbsp;结构体指针,&nbsp;SDIO函数关键信息 | 无 | HDF_STATUS相关状态 | 寻找匹配的funcNum |
| claimHost | dev:&nbsp;结构体指针,SDIO设备控制器; | 无 | HDF_STATUS相关状态 | 独占HOST |
| releaseHost | dev:&nbsp;结构体指针,SDIO设备控制器; | 无 | HDF_STATUS相关状态 | 释放HOST |
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> CommonInfo包括maxBlockNum(单个request中最大block数), maxBlockSize(单个block最大字节数), maxRequestSize(单个Request最大字节数), enTimeout(最大超时时间,毫秒), funcNum(功能编号1~7), irqCap(IRQ capabilities), (void \*)data.
| incrAddrReadBytes | dev:结构体指针,SDIO设备控制器<br>addr:uint32_t,地址值<br>size:uint32_t,大小 | data:uint8_t指针,传出值 | HDF_STATUS相关状态 | 从指定的SDIO地址增量读取给定长度的数据 |
| incrAddrWriteBytes | dev:结构体指针,SDIO设备控制器<br>data:uint8_t指针,传入值<br>addr:uint32_t,地址值<br>size:uint32_t,大小 | 无 | HDF_STATUS相关状态 | 将给定长度的数据增量写入指定的SDIO地址 |
| fixedAddrReadBytes | dev:结构体指针,SDIO设备控制器<br>addr:uint32_t,地址值<br>size:uint32_t,大小<br>scatterLen:uint32_t,数据长度 | data:uint8_t指针,传出值 | HDF_STATUS相关状态 | 从固定SDIO地址读取给定长度的数据。 |
| fixedAddrWriteBytes | dev:结构体指针,SDIO设备控制器<br>data:uint8_t指针,传入值<br>addr:uint32_t,地址值<br>size:uint32_t,大小<br>scatterLen:uint32_t,数据长度 | 无 | HDF_STATUS相关状态 | 将给定长度的数据写入固定SDIO地址 |
| func0ReadBytes | dev:结构体指针,SDIO设备控制器<br>addr:uint32_t,地址值<br>size:uint32_t,大小 | data:uint8_t指针,传出值 | HDF_STATUS相关状态 | 从SDIO函数0的地址空间读取给定长度的数据。 |
| func0WriteBytes | dev:结构体指针,SDIO设备控制器<br>data:uint8_t指针,传入值<br>addr:uint32_t,地址值<br>size:uint32_t,大小 | 无 | HDF_STATUS相关状态 | 将给定长度的数据写入SDIO函数0的地址空间。 |
| setBlockSize | dev:结构体指针,SDIO设备控制器<br>blockSize:uint32_t,Block大小 | 无 | HDF_STATUS相关状态 | 设置block大小 |
| getCommonInfo | dev:联合体指针,SDIO设备控制器<br>infoType:uint32_t,info类型 | info:结构体指针,传出SdioFuncInfo信息 | HDF_STATUS相关状态 | 获取CommonInfo,说明见下 |
| setCommonInfo | dev:结构体指针,SDIO设备控制器<br>info:联合体指针,SdioFuncInfo信息传入<br>infoType:uint32_t,info类型 | 无 | HDF_STATUS相关状态 | 设置CommonInfo,说明见下 |
| flushData | dev:结构体指针,SDIO设备控制器 | 无 | HDF_STATUS相关状态 | 当SDIO需要重新初始化或发生意外错误时调用的函数 |
| enableFunc | dev:结构体指针,SDIO设备控制器 | 无 | HDF_STATUS相关状态 | 使能SDIO设备 |
| disableFunc | dev:结构体指针,SDIO设备控制器 | 无 | HDF_STATUS相关状态 | 去使能SDIO设备 |
| claimIrq | dev:结构体指针,SDIO设备控制器<br>irqHandler:void函数指针 | 无 | HDF_STATUS相关状态 | 注册SDIO中断 |
| releaseIrq | dev:结构体指针,SDIO设备控制器 | 无 | HDF_STATUS相关状态 | 释放SDIO中断 |
| findFunc | dev:结构体指针,SDIO设备控制器<br>configData:结构体指针,SDIO函数关键信息 | 无 | HDF_STATUS相关状态 | 寻找匹配的funcNum |
| claimHost | dev:结构体指针,SDIO设备控制器 | 无 | HDF_STATUS相关状态 | 独占HOST |
| releaseHost | dev:结构体指针,SDIO设备控制器 | 无 | HDF_STATUS相关状态 | 释放HOST |
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**<br>
> CommonInfo包括maxBlockNum(单个request中最大block数), maxBlockSize(单个block最大字节数), maxRequestSize(单个Request最大字节数), enTimeout(最大超时时间,毫秒), funcNum(功能编号1~7), irqCap(IRQ capabilities), (void \*)data.
## 开发步骤
......@@ -79,7 +79,7 @@ SDIO模块适配HDF框架的三个环节是配置属性文件,实例化驱动
3. **实例化SDIO控制器对象:**
- 初始化SdioDevice成员。
- 实例化SdioDevice成员SdioDeviceOps。
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**<br>
> 实例化SdioDevice成员SdioDeviceOps,其定义和成员说明见[接口说明](#接口说明)。
4. **驱动调试:**
......@@ -98,12 +98,12 @@ SDIO模块适配HDF框架的三个环节是配置属性文件,实例化驱动
```
struct HdfDriverEntry g_sdioDriverEntry = {
.moduleVersion = 1,
.Bind = Hi35xxLinuxSdioBind, //见Bind参考
.Init = Hi35xxLinuxSdioInit, //见Init参考
.Release = Hi35xxLinuxSdioRelease,//见Release参考
.moduleName = "HDF_PLATFORM_SDIO",//【必要 且与 HCS文件中里面的moduleName匹配】
.Bind = Hi35xxLinuxSdioBind, // 见Bind参考
.Init = Hi35xxLinuxSdioInit, // 见Init参考
.Release = Hi35xxLinuxSdioRelease,// 见Release参考
.moduleName = "HDF_PLATFORM_SDIO",// 【必要,且与HCS文件中里面的moduleName匹配】
};
//调用HDF_INIT将驱动入口注册到HDF框架中
// 调用HDF_INIT将驱动入口注册到HDF框架中
HDF_INIT(g_sdioDriverEntry);
```
......@@ -124,9 +124,9 @@ SDIO模块适配HDF框架的三个环节是配置属性文件,实例化驱动
policy = 1;
priority = 70;
permission = 0644;
moduleName = "HDF_PLATFORM_SDIO"; //【必要】用于指定驱动名称,需要与驱动Entry中的moduleName一致;
serviceName = "HDF_PLATFORM_MMC_2"; //【必要】驱动对外发布服务的名称,必须唯一
deviceMatchAttr = "hisilicon_hi35xx_sdio_0";//【必要】用于配置控制器私有数据,要与sdio_config.hcs中对应控制器保持一致
moduleName = "HDF_PLATFORM_SDIO"; // 【必要】用于指定驱动名称,需要与驱动Entry中的moduleName一致;
serviceName = "HDF_PLATFORM_MMC_2"; // 【必要】驱动对外发布服务的名称,必须唯一
deviceMatchAttr = "hisilicon_hi35xx_sdio_0";// 【必要】用于配置控制器私有数据,要与sdio_config.hcs中对应控制器保持一致
}
}
}
......@@ -143,11 +143,11 @@ SDIO模块适配HDF框架的三个环节是配置属性文件,实例化驱动
sdio_config {
template sdio_controller {
match_attr = "";
hostId = 2; //【必要】模式固定为2,在mmc_config.hcs有介绍
devType = 2; //【必要】模式固定为2,在mmc_config.hcs有介绍
hostId = 2; // 【必要】模式固定为2,在mmc_config.hcs有介绍
devType = 2; // 【必要】模式固定为2,在mmc_config.hcs有介绍
}
controller_0x2dd1 :: sdio_controller {
match_attr = "hisilicon_hi35xx_sdio_0";//【必要】需要和device_info.hcs中的deviceMatchAttr值一致
match_attr = "hisilicon_hi35xx_sdio_0";// 【必要】需要和device_info.hcs中的deviceMatchAttr值一致
}
}
}
......@@ -170,7 +170,7 @@ SDIO模块适配HDF框架的三个环节是配置属性文件,实例化驱动
void *data; // 私有数据
} SdioFuncInfo;
//SdioDevice是核心层控制器结构体,其中的成员在Bind函数中会被赋值
// SdioDevice是核心层控制器结构体,其中的成员在Bind函数中会被赋值
struct SdioDevice {
struct SdDevice sd;
struct SdioDeviceOps *sdioOps;
......@@ -212,11 +212,11 @@ SDIO模块适配HDF框架的三个环节是配置属性文件,实例化驱动
入参:
HdfDeviceObject 是整个驱动对外暴露的接口参数,具备 HCS 配置文件的信息。
HdfDeviceObject是整个驱动对外暴露的接口参数,具备HCS配置文件的信息。
返回值:
HDF_STATUS相关状态 (下表为部分展示,如需使用其他状态,可见//drivers/framework/include/utils/hdf_base.h中HDF_STATUS 定义)。
HDF_STATUS相关状态(下表为部分展示,如需使用其他状态,可见//drivers/framework/include/utils/hdf_base.h中HDF_STATUS 定义)。
**表2** Bind函数入参及返回值
| 状态(值) | 问题描述 |
......@@ -241,18 +241,18 @@ SDIO模块适配HDF框架的三个环节是配置属性文件,实例化驱动
...
cntlr = (struct MmcCntlr *)OsalMemCalloc(sizeof(struct MmcCntlr));// 分配内存
...
cntlr->ops = &g_sdioCntlrOps; //【必要】struct MmcCntlrOps g_sdioCntlrOps={
cntlr->ops = &g_sdioCntlrOps; // 【必要】struct MmcCntlrOps g_sdioCntlrOps={
// .rescanSdioDev = Hi35xxLinuxSdioRescan,};
cntlr->hdfDevObj = obj; //【必要】使HdfDeviceObject与MmcCntlr可以相互转化的前提
obj->service = &cntlr->service;//【必要】使HdfDeviceObject与MmcCntlr可以相互转化的前提
cntlr->hdfDevObj = obj; // 【必要】使HdfDeviceObject与MmcCntlr可以相互转化的前提
obj->service = &cntlr->service;// 【必要】使HdfDeviceObject与MmcCntlr可以相互转化的前提
ret = Hi35xxLinuxSdioCntlrParse(cntlr, obj);//【必要】初始化cntlr 的 index, devType, 失败则 goto _ERR;
...
ret = MmcCntlrAdd(cntlr); //【必要】调用核心层mmc_core.c的函数, 失败则 goto _ERR;
ret = MmcCntlrAdd(cntlr); // 【必要】调用核心层mmc_core.c的函数, 失败则 goto _ERR;
...
ret = MmcCntlrAllocDev(cntlr, (enum MmcDevType)cntlr->devType);//【必要】调用核心层mmc_core.c的函数, 失败则 goto _ERR;
ret = MmcCntlrAllocDev(cntlr, (enum MmcDevType)cntlr->devType);// 【必要】调用核心层mmc_core.c的函数, 失败则 goto _ERR;
...
MmcDeviceAddOps(cntlr->curDev, &g_sdioDeviceOps);//【必要】调用核心层mmc_core.c的函数, 钩子函数挂载
MmcDeviceAddOps(cntlr->curDev, &g_sdioDeviceOps);// 【必要】调用核心层mmc_core.c的函数, 钩子函数挂载
HDF_LOGD("Hi35xxLinuxSdioBind: Success!");
return HDF_SUCCESS;
......@@ -267,7 +267,7 @@ SDIO模块适配HDF框架的三个环节是配置属性文件,实例化驱动
入参:
HdfDeviceObject 是整个驱动对外暴露的接口参数,具备 HCS 配置文件的信息。
HdfDeviceObject是整个驱动对外暴露的接口参数,具备HCS配置文件的信息。
返回值:
......@@ -281,7 +281,7 @@ SDIO模块适配HDF框架的三个环节是配置属性文件,实例化驱动
```
static int32_t Hi35xxLinuxSdioInit(struct HdfDeviceObject *obj)
{
(void)obj;//无操作,可根据厂商需要添加
(void)obj;// 无操作,可根据厂商需要添加
HDF_LOGD("Hi35xxLinuxSdioInit: Success!");
return HDF_SUCCESS;
}
......@@ -290,7 +290,7 @@ SDIO模块适配HDF框架的三个环节是配置属性文件,实例化驱动
入参:
HdfDeviceObject 是整个驱动对外暴露的接口参数,具备 HCS 配置文件的信息。
HdfDeviceObject是整个驱动对外暴露的接口参数,具备HCS配置文件的信息。
返回值:
......@@ -298,7 +298,7 @@ SDIO模块适配HDF框架的三个环节是配置属性文件,实例化驱动
函数说明:
释放内存和删除控制器,该函数需要在驱动入口结构体中赋值给 Release 接口, 当HDF框架调用Init函数初始化驱动失败时,可以调用 Release 释放驱动资源。所有强制转换获取相应对象的操作前提是在Bind函数中具备对应赋值的操作。
释放内存和删除控制器,该函数需要在驱动入口结构体中赋值给 Release 接口,当HDF框架调用Init函数初始化驱动失败时,可以调用Release释放驱动资源。所有强制转换获取相应对象的操作前提是在Bind函数中具备对应赋值的操作。
```
......@@ -307,6 +307,6 @@ SDIO模块适配HDF框架的三个环节是配置属性文件,实例化驱动
if (obj == NULL) {
return;
}
Hi35xxLinuxSdioDeleteCntlr((struct MmcCntlr *)obj->service);//【必要】自定义的内存释放函数,这里有HdfDeviceObject到MmcCntlr的强制转化
Hi35xxLinuxSdioDeleteCntlr((struct MmcCntlr *)obj->service);// 【必要】自定义的内存释放函数,这里有HdfDeviceObject到MmcCntlr的强制转化
}
```
```
\ No newline at end of file
......@@ -3,17 +3,15 @@
## 概述
- SPI是串行外设接口(Serial Peripheral Interface)的缩写,是一种高速的,全双工,同步的通信总线
SPI指串行外设接口(Serial Peripheral Interface),是一种高速的,全双工,同步的通信总线。SPI是由Motorola公司开发,用于在主设备和从设备之间进行通信,常用于与闪存、实时时钟、传感器以及模数转换器等进行通信
- SPI是由Motorola公司开发,用于在主设备和从设备之间进行通信,常用于与闪存、实时时钟、传感器以及模数转换器等进行通信。
SPI以主从方式工作,通常有一个主设备和一个或者多个从设备。主设备和从设备之间一般用4根线相连,它们分别是:
- SCLK:时钟信号,由主设备产生;
- MOSI:主设备数据输出,从设备数据输入;
- MISO:主设备数据输入,从设备数据输出;
- CS:片选,从设备使能信号,由主设备控制。
- SPI以主从方式工作,通常有一个主设备和一个或者多个从设备。主设备和从设备之间一般用4根线相连,它们分别是:
- SCLK – 时钟信号,由主设备产生;
- MOSI – 主设备数据输出,从设备数据输入;
- MISO – 主设备数据输入,从设备数据输出;
- CS – 片选,从设备使能信号,由主设备控制。
- 一个主设备和两个从设备的连接示意图如下所示,Device A和Device B共享主设备的SCLK、MISO和MOSI三根引脚,Device A的片选CS0连接主设备的CS0,Device B的片选CS1连接主设备的CS1。
一个主设备和两个从设备的连接示意图如下所示,Device A和Device B共享主设备的SCLK、MISO和MOSI三根引脚,Device A的片选CS0连接主设备的CS0,Device B的片选CS1连接主设备的CS1。
**图1** SPI主从设备连接示意图
......@@ -32,11 +30,11 @@
- SPI接口定义了操作SPI设备的通用方法集合,包括:
- SPI设备句柄获取和释放。
- SPI读写: 从SPI设备读取或写入指定长度数据。
- SPI读写: 从SPI设备读取或写入指定长度数据。
- SPI自定义传输:通过消息传输结构体执行任意读写组合过程。
- SPI设备配置:获取和设置SPI设备属性。
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**<br>
> 当前只支持主机模式,不支持从机模式。
......@@ -44,13 +42,17 @@
**表1** SPI驱动API接口功能介绍
| 功能分类 | 接口名 |
| 接口名 | 接口描述 |
| -------- | -------- |
| SPI设备句柄获取释放接口 | -&nbsp;SpiOpen:获取SPI设备句柄<br/>-&nbsp;SpiClose:释放SPI设备句柄 |
| SPI读写接口 | -&nbsp;SpiRead:读取指定长度的数据<br/>-&nbsp;SpiWrite:写入指定长度的数据<br/>-&nbsp;SpiTransfer:SPI数据传输接口 |
| SPI设备配置接口 | -&nbsp;SpiSetCfg:根据指定参数,配置SPI设备<br/>-&nbsp;SpiGetCfg:获取SPI设备配置参数 |
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
| SpiOpen | 获取SPI设备句柄 |
| SpiClose | 释放SPI设备句柄 |
| SpiRead | 读取指定长度的数据 |
| SpiWrite | 写入指定长度的数据 |
| SpiTransfer | SPI数据传输接口 |
| SpiSetCfg | 根据指定参数,配置SPI设备 |
| SpiGetCfg | 获取SPI设备配置参数 |
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**<br>
> 本文涉及的所有接口,仅限内核态使用,不支持在用户态使用。
......@@ -79,10 +81,10 @@ DevHandle SpiOpen(const struct SpiDevInfo *info);
| **参数** | **参数描述** |
| -------- | -------- |
| info | SPI设备描述符 |
| **返回值** | **返回值描述** |
| NULL | 获取SPI设备句柄失败 |
| 设备句柄 | 对应的SPI设备句柄 |
| info | SPI设备描述符 |
| **返回值** | **返回值描述** |
| NULL | 获取SPI设备句柄失败 |
| 设备句柄 | 对应的SPI设备句柄 |
假设系统中的SPI设备总线号为0,片选号为0,获取该SPI设备句柄的示例如下:
......@@ -115,11 +117,11 @@ int32_t SpiGetCfg(DevHandle handle, struct SpiCfg *cfg);
| **参数** | **参数描述** |
| -------- | -------- |
| handle | SPI设备句柄 |
| handle | SPI设备句柄 |
| cfg | SPI设备配置参数 |
| **返回值** | **返回值描述** |
| 0 | 获取配置成功 |
| 负数 | 获取配置失败 |
| **返回值** | **返回值描述** |
| 0 | 获取配置成功 |
| 负数 | 获取配置失败 |
```
......@@ -145,11 +147,11 @@ int32_t SpiSetCfg(DevHandle handle, struct SpiCfg *cfg);
| **参数** | **参数描述** |
| -------- | -------- |
| handle | SPI设备句柄 |
| handle | SPI设备句柄 |
| cfg | SPI设备配置参数 |
| **返回值** | **返回值描述** |
| 0 | 配置成功 |
| 负数 | 配置失败 |
| **返回值** | **返回值描述** |
| 0 | 配置成功 |
| 负数 | 配置失败 |
```
......@@ -181,12 +183,12 @@ if (ret != 0) {
| **参数** | **参数描述** |
| -------- | -------- |
| handle | SPI设备句柄 |
| handle | SPI设备句柄 |
| buf | 待写入数据的指针 |
| len | 待写入的数据长度 |
| **返回值** | **返回值描述** |
| 0 | 写入成功 |
| 负数 | 写入失败 |
| **返回值** | **返回值描述** |
| 0 | 写入成功 |
| 负数 | 写入失败 |
```
......@@ -212,12 +214,12 @@ if (ret != 0) {
| **参数** | **参数描述** |
| -------- | -------- |
| handle | SPI设备句柄 |
| buf | 待读取数据的指针 |
| len | 待读取的数据长度 |
| **返回值** | **返回值描述** |
| 0 | 读取成功 |
| 负数 | 读取失败 |
| handle | SPI设备句柄 |
| buf | 待读取数据的指针 |
| len | 待读取的数据长度 |
| **返回值** | **返回值描述** |
| 0 | 读取成功 |
| 负数 | 读取失败 |
```
......@@ -243,19 +245,19 @@ if (ret != 0) {
| **参数** | **参数描述** |
| -------- | -------- |
| handle | SPI设备句柄 |
| msgs | 待传输数据的数组 |
| count | msgs数组长度 |
| **返回值** | **返回值描述** |
| 0 | 执行成功 |
| 负数 | 执行失败 |
| handle | SPI设备句柄 |
| msgs | 待传输数据的数组 |
| count | msgs数组长度 |
| **返回值** | **返回值描述** |
| 0 | 执行成功 |
| 负数 | 执行失败 |
```
int32_t ret;
uint8_t wbuff[1] = {0x12};
uint8_t rbuff[1] = {0};
struct SpiMsg msg; /* 自定义传输的消息*/
struct SpiMsg msg; /* 自定义传输的消息 */
msg.wbuf = wbuff; /* 写入的数据 */
msg.rbuf = rbuff; /* 读取的数据 */
msg.len = 1; /* 读取、写入数据的长度都是1 */
......@@ -285,7 +287,7 @@ void SpiClose(DevHandle handle);
| **参数** | **参数描述** |
| -------- | -------- |
| handle | SPI设备句柄 |
| handle | SPI设备句柄 |
```
......
......@@ -3,7 +3,7 @@
## 概述
SPI即串行外设接口(Serial Peripheral Interface)在HDF框架中,SPI的接口适配模式采用独立服务模式,在这种模式下,每一个设备对象会独立发布一个设备服务来处理外部访问,设备管理器收到API的访问请求之后,通过提取该请求的参数,达到调用实际设备对象的相应内部方法的目的。独立服务模式可以直接借助HDFDeviceManager的服务管理能力,但需要为每个设备单独配置设备节点,增加内存占用。
SPI即串行外设接口(Serial Peripheral Interface)在HDF框架中,SPI的接口适配模式采用独立服务模式,在这种模式下,每一个设备对象会独立发布一个设备服务来处理外部访问,设备管理器收到API的访问请求之后,通过提取该请求的参数,达到调用实际设备对象的相应内部方法的目的。独立服务模式可以直接借助HDFDeviceManager的服务管理能力,但需要为每个设备单独配置设备节点,增加内存占用。
**图1** SPI独立服务模式结构图
......@@ -28,11 +28,11 @@ struct SpiCntlrMethod {
| 成员函数 | 入参 | 返回值 | 功能 |
| -------- | -------- | -------- | -------- |
| Transfer | cntlr:结构体指针,核心层spi控制器。<br/>msg:结构体指针,Spi消息。<br/>count:uint32_t,消息个数。 | HDF_STATUS相关状态 | 传输消息 |
| SetCfg | cntlr:结构体指针,核心层spi控制器。<br/>cfg:结构体指针,Spi属性。 | HDF_STATUS相关状态 | 设置控制器属性 |
| GetCfg | cntlr:结构体指针,核心层spi控制器。<br/>cfg:结构体指针,Spi属性。 | HDF_STATUS相关状态 | 获取控制器属性 |
| Open | cntlr:结构体指针,核心层spi控制器。 | HDF_STATUS相关状态 | 打开SPI |
| Close | cntlr:结构体指针,核心层spi控制器。 | HDF_STATUS相关状态 | 关闭SPI |
| Transfer | cntlr:结构体指针,核心层SPI控制器。<br/>msg:结构体指针,Spi消息。<br/>count:uint32_t,消息个数。 | HDF_STATUS相关状态 | 传输消息 |
| SetCfg | cntlr:结构体指针,核心层SPI控制器。<br/>cfg:结构体指针,Spi属性。 | HDF_STATUS相关状态 | 设置控制器属性 |
| GetCfg | cntlr:结构体指针,核心层SPI控制器。<br/>cfg:结构体指针,Spi属性。 | HDF_STATUS相关状态 | 获取控制器属性 |
| Open | cntlr:结构体指针,核心层SPI控制器。 | HDF_STATUS相关状态 | 打开SPI |
| Close | cntlr:结构体指针,核心层SPI控制器。 | HDF_STATUS相关状态 | 关闭SPI |
## 开发步骤
......@@ -50,18 +50,18 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动
3. **实例化SPI控制器对象:**
- 初始化SpiCntlr成员。
- 实例化SpiCntlr成员SpiCntlrMethod。
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**<br>
> 实例化SpiCntlr成员SpiCntlrMethod,其定义和成员说明见[接口说明](#接口说明)。
4. **驱动调试:**
【可选】针对新增驱动程序,建议验证驱动基本功能,例如spi控制状态,中断响应情况等。
【可选】针对新增驱动程序,建议验证驱动基本功能,例如SPI控制状态,中断响应情况等。
## 开发实例
下方将以spi_hi35xx.c为示例,展示需要厂商提供哪些内容来完整实现设备功能。
1. 驱动开发首先需要实例化驱动入口,驱动入口必须为HdfDriverEntry(在 hdf_device_desc.h 中定义)类型的全局变量,且moduleName要和device_info.hcs中保持一致。HDF框架会将所有加载的驱动的HdfDriverEntry对象首地址汇总,形成一个类似数组的段地址空间,方便上层调用。
1. 首先需要实例化驱动入口,驱动入口必须为HdfDriverEntry(在 hdf_device_desc.h 中定义)类型的全局变量,且moduleName要和device_info.hcs中保持一致。HDF框架会将所有加载的驱动的HdfDriverEntry对象首地址汇总,形成一个类似数组的段地址空间,方便上层调用。
一般在加载驱动时HDF会先调用Bind函数,再调用Init函数加载该驱动。当Init调用异常时,HDF框架会调用Release释放驱动资源并退出。
SPI驱动入口参考:
......@@ -74,13 +74,13 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动
.Init = HdfSpiDeviceInit, //见Init参考
.Release = HdfSpiDeviceRelease, //见Release参考
};
//调用HDF_INIT将驱动入口注册到HDF框架中
// 调用HDF_INIT将驱动入口注册到HDF框架中
HDF_INIT(g_hdfSpiDevice);
```
2. 完成驱动入口注册之后,下一步请在device_info.hcs文件中添加deviceNode信息,并在 spi_config.hcs 中配置器件属性。deviceNode信息与驱动入口注册相关,器件属性值与核心层SpiCntlr 成员的默认值或限制范围有密切关系。
2. 完成驱动入口注册之后,在device_info.hcs文件中添加deviceNode信息,并在 spi_config.hcs中配置器件属性。deviceNode信息与驱动入口注册相关,器件属性值与核心层SpiCntlr成员的默认值或限制范围有密切关系。
本例只有一个SPI控制器,如有多个器件信息,则需要在device_info文件增加deviceNode信息,以及在spi_config文件中增加对应的器件属性。
- device_info.hcs 配置参考。
- device_info.hcs配置参考
```
......@@ -105,7 +105,7 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动
permission = 0644;
moduleName = "HDF_PLATFORM_SPI"; // 【必要】用于指定驱动名称,该字段的值必须和驱动入口结构的moduleName值一致
serviceName = "HDF_PLATFORM_SPI_1"; // 【必要且唯一】驱动对外发布服务的名称
deviceMatchAttr = "hisilicon_hi35xx_spi_1";// 需要与设备hcs文件中的 match_attr 匹配
deviceMatchAttr = "hisilicon_hi35xx_spi_1";// 需要与设备hcs文件中的match_attr匹配
}
...
}
......@@ -114,14 +114,14 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动
}
```
- spi_config.hcs 配置参考
- spi_config.hcs 配置参考
```
root {
platform {
spi_config {//每一个SPI控制器配置私有数据
template spi_controller {//模板公共参数, 继承该模板的节点如果使用模板中的默认值, 则节点字段可以缺省
spi_config {// 每一个SPI控制器配置私有数据
template spi_controller {// 模板公共参数, 继承该模板的节点如果使用模板中的默认值,则节点字段可以缺省
serviceName = "";
match_attr = "";
transferMode = 0; // 数据传输模式:中断传输(0),流控传输(1),DMA传输(2)
......@@ -144,28 +144,28 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动
MISC_CTRL_SPI_CS_SHIFT = 0;
}
controller_0x120c0000 :: spi_controller {
busNum = 0; //【必要】总线号
busNum = 0; // 【必要】总线号
CRG_SPI_CKEN = 0x10000; // (0x1 << 16) 0:close clk, 1:open clk
CRG_SPI_RST = 0x1; // (0x1 << 0) 0:cancel reset, 1:reset
match_attr = "hisilicon_hi35xx_spi_0";//【必要】需要和device_info.hcs中的deviceMatchAttr值一致
match_attr = "hisilicon_hi35xx_spi_0";// 【必要】需要和device_info.hcs中的deviceMatchAttr值一致
}
controller_0x120c1000 :: spi_controller {
busNum = 1;
CRG_SPI_CKEN = 0x20000; // (0x1 << 17) 0:close clk, 1:open clk
CRG_SPI_RST = 0x2; // (0x1 << 1) 0:cancel reset, 1:reset
match_attr = "hisilicon_hi35xx_spi_1";
regBase = 0x120c1000; //【必要】地址映射需要
irqNum = 101; //【必要】中断号
regBase = 0x120c1000; // 【必要】地址映射需要
irqNum = 101; // 【必要】中断号
}
...
// 【可选】可新增,但需要在 device_info.hcs 添加对应的节点
// 【可选】可新增,但需要在device_info.hcs添加对应的节点
}
}
}
```
3. 完成驱动入口注册之后,最后一步就是以核心层SpiCntlr对象的初始化为核心,包括厂商自定义结构体(传递参数和数据),实例化SpiCntlr成员SpiCntlrMethod(让用户可以通过接口来调用驱动底层函数),实现HdfDriverEntry成员函数(Bind,Init,Release)。
- 自定义结构体参考
- 自定义结构体参考
从驱动的角度看,自定义结构体是参数和数据的载体,而且spi_config.hcs文件中的数值会被HDF读入通过DeviceResourceIface来初始化结构体成员,一些重要数值也会传递给核心层对象,例如设备号、总线号等。
......@@ -197,7 +197,7 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动
uint8_t transferMode;
};
//SpiCntlr是核心层控制器结构体,其中的成员在Init函数中会被赋值
// SpiCntlr是核心层控制器结构体,其中的成员在Init函数中会被赋值
struct SpiCntlr {
struct IDeviceIoService service;
struct HdfDeviceObject *device;
......@@ -215,7 +215,7 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动
```
// spi_hi35xx.c 中的示例:钩子函数的实例化
// spi_hi35xx.c中的示例:钩子函数的实例化
struct SpiCntlrMethod g_method = {
.Transfer = Pl022Transfer,
.SetCfg = Pl022SetCfg,
......@@ -225,11 +225,11 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动
};
```
- Bind 函数参考
- Bind函数参考
入参:
HdfDeviceObject 是整个驱动对外暴露的接口参数,具备 HCS 配置文件的信息。
HdfDeviceObject是整个驱动对外暴露的接口参数,具备HCS配置文件的信息。
返回值:
......@@ -237,7 +237,7 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动
函数说明:
SpiCntlr 对象同 HdfDeviceObject 进行了关联。
SpiCntlr对象同HdfDeviceObject进行了关联。
```
......@@ -249,14 +249,14 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动
struct SpiCntlr *SpiCntlrCreate(struct HdfDeviceObject *device)
{
struct SpiCntlr *cntlr = NULL; //创建核心层 SpiCntlr 对象
struct SpiCntlr *cntlr = NULL; // 创建核心层SpiCntlr对象
...
cntlr = (struct SpiCntlr *)OsalMemCalloc(sizeof(*cntlr));//分配内存
cntlr = (struct SpiCntlr *)OsalMemCalloc(sizeof(*cntlr));// 分配内存
...
cntlr->device = device; //使HdfDeviceObject与SpiCntlr可以相互转化的前提
device->service = &(cntlr->service);//使HdfDeviceObject与SpiCntlr可以相互转化的前提
(void)OsalMutexInit(&cntlr->lock); //锁初始化
DListHeadInit(&cntlr->list); //添加对应的节点
cntlr->device = device; // 使HdfDeviceObject与SpiCntlr可以相互转化的前提
device->service = &(cntlr->service);// 使HdfDeviceObject与SpiCntlr可以相互转化的前提
(void)OsalMutexInit(&cntlr->lock); // 锁初始化
DListHeadInit(&cntlr->list); // 添加对应的节点
cntlr->priv = NULL;
return cntlr;
}
......@@ -266,15 +266,15 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动
入参:
HdfDeviceObject 是整个驱动对外暴露的接口参数,具备 HCS 配置文件的信息。
HdfDeviceObject是整个驱动对外暴露的接口参数,具备HCS配置文件的信息。
返回值:
HDF_STATUS相关状态 (下表为部分展示,如需使用其他状态,可见//drivers/framework/include/utils/hdf_base.h中HDF_STATUS 定义)。
HDF_STATUS相关状态(下表为部分展示,如需使用其他状态,可见//drivers/framework/include/utils/hdf_base.h中HDF_STATUS 定义)。
**表2** Init函数入参和返回值
**表2** HDF_STATUS返回值描述
| 状态(值) | 问题描述 |
| 状态(值) | 描述 |
| -------- | -------- |
| HDF_ERR_INVALID_OBJECT | 控制器对象非法 |
| HDF_ERR_MALLOC_FAIL | 内存分配失败 |
......@@ -294,10 +294,10 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动
int32_t ret;
struct SpiCntlr *cntlr = NULL;
...
cntlr = SpiCntlrFromDevice(device);//这里有HdfDeviceObject到SpiCntlr的强制转化,通过service成员,赋值见Bind函数
//return (device == NULL) ? NULL : (struct SpiCntlr *)device->service;
cntlr = SpiCntlrFromDevice(device);// 这里有HdfDeviceObject到SpiCntlr的强制转化,通过service成员,赋值见Bind函数
// return (device == NULL) ? NULL : (struct SpiCntlr *)device->service;
...
ret = Pl022Init(cntlr, device);//【必要】实例化厂商自定义操作对象,示例见下
ret = Pl022Init(cntlr, device);// 【必要】实例化厂商自定义操作对象,示例见下
...
ret = Pl022Probe(cntlr->priv);
...
......@@ -309,24 +309,24 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动
int32_t ret;
struct Pl022 *pl022 = NULL;
...
pl022 = (struct Pl022 *)OsalMemCalloc(sizeof(*pl022));//申请内存
pl022 = (struct Pl022 *)OsalMemCalloc(sizeof(*pl022));// 申请内存
...
ret = SpiGetBaseCfgFromHcs(pl022, device->property); //初始化busNum, numCs, speed, fifoSize, clkRate,mode, bitsPerWord, transferMode参数值
ret = SpiGetBaseCfgFromHcs(pl022, device->property); // 初始化busNum, numCs, speed, fifoSize, clkRate,mode, bitsPerWord, transferMode参数值
...
ret = SpiGetRegCfgFromHcs(pl022, device->property); //初始化regBase, phyBase, irqNum, regCrg, clkEnBit,clkRstBit, regMiscCtrl, regMiscCtrl, miscCtrlCs,miscCtrlCsShift参数值
ret = SpiGetRegCfgFromHcs(pl022, device->property); // 初始化regBase, phyBase, irqNum, regCrg, clkEnBit,clkRstBit, regMiscCtrl, regMiscCtrl, miscCtrlCs,miscCtrlCsShift参数值
...
//计算最大,最小速度对应的频率
// 计算最大,最小速度对应的频率
pl022->maxSpeedHz = (pl022->clkRate) / ((SCR_MIN + 1) * CPSDVSR_MIN);
pl022->minSpeedHz = (pl022->clkRate) / ((SCR_MAX + 1) * CPSDVSR_MAX);
DListHeadInit(&pl022->deviceList);//初始化DList链表
pl022->cntlr = cntlr; //使Pl022与SpiCntlr可以相互转化的前提
cntlr->priv = pl022; //使Pl022与SpiCntlr可以相互转化的前提
cntlr->busNum = pl022->busNum; //给SpiCntlr的busNum赋值
cntlr->method = &g_method; //SpiCntlrMethod的实例化对象的挂载
DListHeadInit(&pl022->deviceList);// 初始化DList链表
pl022->cntlr = cntlr; // 使Pl022与SpiCntlr可以相互转化的前提
cntlr->priv = pl022; // 使Pl022与SpiCntlr可以相互转化的前提
cntlr->busNum = pl022->busNum; // 给SpiCntlr的busNum赋值
cntlr->method = &g_method; // SpiCntlrMethod的实例化对象的挂载
...
ret = Pl022CreatAndInitDevice(pl022);
if (ret != 0) {
Pl022Release(pl022); //初始化失败就释放Pl022对象
Pl022Release(pl022); // 初始化失败就释放Pl022对象
return ret;
}
return 0;
......@@ -336,7 +336,7 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动
入参:
HdfDeviceObject 是整个驱动对外暴露的接口参数,具备 HCS 配置文件的信息。
HdfDeviceObject是整个驱动对外暴露的接口参数,具备HCS配置文件的信息。
返回值:
......@@ -344,7 +344,7 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动
函数说明:
释放内存和删除控制器,该函数需要在驱动入口结构体中赋值给 Release 接口, 当HDF框架调用Init函数初始化驱动失败时,可以调用 Release 释放驱动资源。所有强制转换获取相应对象的操作**前提**是在Init函数中具备对应赋值的操作。
释放内存和删除控制器,该函数需要在驱动入口结构体中赋值给Release接口,当HDF框架调用Init函数初始化驱动失败时,可以调用Release释放驱动资源。所有强制转换获取相应对象的操作**前提**是在Init函数中具备对应赋值的操作。
```
......@@ -352,12 +352,12 @@ SPI模块适配HDF框架的三个环节是配置属性文件,实例化驱动
{
struct SpiCntlr *cntlr = NULL;
...
cntlr = SpiCntlrFromDevice(device);//这里有HdfDeviceObject到SpiCntlr的强制转化,通过service成员,赋值见Bind函数
cntlr = SpiCntlrFromDevice(device);// 这里有HdfDeviceObject到SpiCntlr的强制转化,通过service成员,赋值见Bind函数
// return (device==NULL) ?NULL:(struct SpiCntlr *)device->service;
...
if (cntlr->priv != NULL) {
Pl022Remove((struct Pl022 *)cntlr->priv);//这里有SpiCntlr到Pl022的强制转化
Pl022Remove((struct Pl022 *)cntlr->priv);// 这里有SpiCntlr到Pl022的强制转化
}
SpiCntlrDestroy(cntlr); //释放Pl022对象
SpiCntlrDestroy(cntlr); // 释放Pl022对象
}
```
......@@ -3,15 +3,15 @@
## 概述
- UART是通用异步收发传输器(Universal Asynchronous Receiver/Transmitter)的缩写,是通用串行数据总线,用于异步通信。该总线双向通信,可以实现全双工传输。
UART指异步收发传输器(Universal Asynchronous Receiver/Transmitter),是通用串行数据总线,用于异步通信。该总线双向通信,可以实现全双工传输。
- UART应用比较广泛,常用于输出打印信息,也可以外接各种模块,如GPS、蓝牙等。
UART应用比较广泛,常用于输出打印信息,也可以外接各种模块,如GPS、蓝牙等。
- 两个UART设备的连接示意图如下,UART与其他模块一般用2线(图1)或4线(图2)相连,它们分别是:
- TX:发送数据端,和对端的RX相连
- RX:接收数据端,和对端的TX相连
- RTS:发送请求信号,用于指示本设备是否准备好,可接受数据,和对端CTS相连
- CTS:允许发送信号,用于判断是否可以向对端发送数据,和对端RTS相连
两个UART设备的连接示意图如下,UART与其他模块一般用2线(图1)或4线(图2)相连,它们分别是:
- TX:发送数据端,和对端的RX相连
- RX:接收数据端,和对端的TX相连
- RTS:发送请求信号,用于指示本设备是否准备好,可接受数据,和对端CTS相连
- CTS:允许发送信号,用于判断是否可以向对端发送数据,和对端RTS相连
**图1** 2线UART设备连接示意图
......@@ -30,15 +30,19 @@
**表1** UART驱动API接口功能介绍
| 功能分类 | 接口名 |
| 接口名 | 接口描述 |
| -------- | -------- |
| UART获取/释放设备句柄 | -&nbsp;UartOpen:UART获取设备句柄<br/>-&nbsp;UartClose:UART释放设备句柄 |
| UART读写接口 | -&nbsp;UartRead:从UART设备中读取指定长度的数据<br/>-&nbsp;UartWrite:向UART设备中写入指定长度的数据 |
| UART获取/设置波特率接口 | -&nbsp;UartGetBaud:UART获取波特率<br/>-&nbsp;UartSetBaud:UART设置波特率 |
| UART获取/设置设备属性 | -&nbsp;UartGetAttribute:UART获取设备属性<br/>-&nbsp;UartSetAttribute:UART设置设备属性 |
| UART设置传输模式 | UartSetTransMode:UART设置传输模式 |
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
| UartOpen | UART获取设备句柄 |
| UartClose | UART释放设备句柄 |
| UartRead | 从UART设备中读取指定长度的数据 |
| UartWrite | 向UART设备中写入指定长度的数据 |
| UartGetBaud | UART获取波特率 |
| UartSetBaud | UART设置波特率 |
| UartGetAttribute | UART获取设备属性 |
| UartSetAttribute | UART设置设备属性 |
| UartSetTransMode | UART设置传输模式 |
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**<br>
> 本文涉及的所有接口,仅限内核态使用,不支持在用户态使用。
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册