Skip to content

Commit

Permalink
VSI Sensor: Add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
TeoMahnic committed Nov 16, 2023
1 parent 16440d3 commit 4cbac81
Show file tree
Hide file tree
Showing 3 changed files with 203 additions and 9 deletions.
19 changes: 10 additions & 9 deletions DoxyGen/examples/src/main.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

This chapter describes the examples that demonstrate how to use **Arm Virtual Hardware (AVH)** in various scenarios. Detailed descriptions can be found from the references provided in the table below:

Example | Description | Repository
:---------------------|:----------------|:----------------
\subpage GetStarted | Simple example that explains the setup of a CI test run on Arm Virtual Hardware| [github.com/Arm-Software/AVH-GetStarted](https://github.com/Arm-Software/AVH-GetStarted)
Hello VSI Example | Simple example that streams data from a file via Virtual Streaming Interface (VSI) .| [github.com/Arm-Examples/Hello_AVH](https://github.com/Arm-Examples/Hello_AVH)
\subpage MicroSpeech | Tensorflow voice recognition example that runs on Arm Virtual Hardware and physical hardware targets |[github.com/Arm-Software/AVH-TFLmicrospeech](https://github.com/Arm-Software/AVH-TFLmicrospeech)
\subpage aws_mqtt | IoT application with MQTT connectivity to AWS cloud service | [github.com/Arm-Software/AVH-AWS_MQTT_Demo](https://github.com/Arm-Software/AVH-AWS_MQTT_Demo)
\subpage ATS-Keyword | Arm Total Solution example with ML-based keyword recognition and AWS Cloud connectivity | [github.com/Arm-Software/open-iot-sdk/tree/main/examples/ats-keyword](https://github.com/Arm-Software/open-iot-sdk/tree/main/examples/ats-keyword)
AVH System Modeling | Integrates the keyword spotting on Arm Virtual Hardware with a [Modelica-simulated](https://modelica.org/) audio room echo.<br/> [Find more details here](https://github.com/ARM-software/AVH-SystemModeling/blob/main/EchoCanceller/Documentation/BLOG.md). | [github.com/Arm-Software/AVH-SystemModeling](https://github.com/Arm-Software/AVH-SystemModeling)
CMSIS-RTOS2 Validation | Test suite for validating CMSIS-RTOS2 implementations on supported Cortex-M cores using AVH | [github.com/Arm-Software/CMSIS-RTOS2_Validation](https://github.com/Arm-Software/CMSIS-RTOS2_Validation)
Example | Description | Repository
:-----------------------|:----------------|:----------------
\subpage GetStarted | Simple example that explains the setup of a CI test run on Arm Virtual Hardware. | [github.com/Arm-Software/AVH-GetStarted](https://github.com/Arm-Software/AVH-GetStarted)
Hello VSI Example | Simple example that streams data from a file via Virtual Streaming Interface (VSI). | [github.com/Arm-Examples/Hello_AVH](https://github.com/Arm-Examples/Hello_AVH)
\subpage MicroSpeech | Tensorflow voice recognition example that runs on Arm Virtual Hardware and physical hardware targets. |[github.com/Arm-Software/AVH-TFLmicrospeech](https://github.com/Arm-Software/AVH-TFLmicrospeech)
SDS Buffer | This project shows how to use Synchronous Data Stream Recorder Buffer (Non-Blocking Read/Write to circular buffer). | [github.com/ARM-software/SDS-Framework](https://github.com/ARM-software/SDS-Framework/tree/main/examples/sds_buffer)
\subpage aws_mqtt | IoT application with MQTT connectivity to AWS cloud service. | [github.com/Arm-Software/AVH-AWS_MQTT_Demo](https://github.com/Arm-Software/AVH-AWS_MQTT_Demo)
\subpage ATS-Keyword | Arm Total Solution example with ML-based keyword recognition and AWS Cloud connectivity. | [github.com/Arm-Software/open-iot-sdk/tree/main/examples/ats-keyword](https://github.com/Arm-Software/open-iot-sdk/tree/main/examples/ats-keyword)
AVH System Modeling | Integrates the keyword spotting on Arm Virtual Hardware with a [Modelica-simulated](https://modelica.org/) audio room echo.<br/> [Find more details here](https://github.com/ARM-software/AVH-SystemModeling/blob/main/EchoCanceller/Documentation/BLOG.md). | [github.com/Arm-Software/AVH-SystemModeling](https://github.com/Arm-Software/AVH-SystemModeling)
CMSIS-RTOS2 Validation | Test suite for validating CMSIS-RTOS2 implementations on supported Cortex-M cores using AVH. | [github.com/Arm-Software/CMSIS-RTOS2_Validation](https://github.com/Arm-Software/CMSIS-RTOS2_Validation)
2 changes: 2 additions & 0 deletions DoxyGen/simulation/simulation.dxy
Original file line number Diff line number Diff line change
Expand Up @@ -931,8 +931,10 @@ INPUT = ./src/main.md \
./src/peripheral_use_cases.txt \
./src/audio_drv.txt \
./src/video_drv.txt \
./src/sensor_drv.txt \
../../interface/audio/include/audio_drv.h \
../../interface/video/include/video_drv.h \
../../interface/sensor/include/sensor_drv.h \

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
Expand Down
191 changes: 191 additions & 0 deletions DoxyGen/simulation/src/sensor_drv.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
/**
\addtogroup arm_vsi_sensor Sensor via VSI
\ingroup arm_vsi_cases
\brief Sensor data streaming interface
\details

VSI Sensor interface use case is implemented for Arm FVPs based on the general-purpose \ref arm_vsi.

The use of common sensor driver API simplifies re-targeting of the application code between virtual and physical devices.
Currently sensor driver implementations are available for the following platforms:
- Arm FVPs using \ref arm_vsi_api "VSI" with an interface to Python script that streams local SDS files.
- ST Microelectronics B-U585I-IOT02A Discovery kit for IoT which uses on-board MEMS sensors (Microphone, 3D Accelerometer, 3D Gyroscope, Temperature)

and support for other hardware platforms can be added following the same concept.

The table below references the files that implement the sensor peripheral:

Item | Description
:--------------------------------------------------------------------------------------------------------------------------------------|:-----------------------
[./interface/sensor/template/sensor_config.h](https://github.com/ARM-software/AVH/blob/main/interface/sensor/template/sensor_config.h) | Sensor configuration.
[./interface/sensor/include/sensor_drv.h](https://github.com/ARM-software/AVH/blob/main/interface/sensor/include/sensor_drv.h) | Common \ref arm_vsi_sensor "Sensor Driver API" header file. Used by implementations on Arm Virtual Hardware and real HW boards.
[./interface/sensor/source/sensor_drv.c](https://github.com/ARM-software/AVH/blob/main/interface/sensor/source/sensor_drv.c) | Common sensor driver implementation. Used in combination with hardware specific implementations.
[./interface/sensor/include/sensor_drv_hw.h](https://github.com/ARM-software/AVH/blob/main/interface/sensor/include/sensor_drv_hw.h) | Hardware specific \ref arm_vsi_sensor "Sensor Driver API" header file.
[./interface/sensor/source/sensor_drv_hw.c](https://github.com/ARM-software/AVH/blob/main/interface/sensor/source/sensor_drv_hw.c) | Sensor driver implementation for Arm Virtual Hardware based on \ref arm_vsi_api "VSI".
[./interface/sensor/python/arm_vsi2.py](https://github.com/ARM-software/AVH/blob/main/interface/sensor/python/arm_vsi2.py) | \ref arm_vsi_sensor "VSI Sensor" Python script for sensor emulation based on \ref arm_vsi_py "VSI Python Interface".
[./interface/sensor/python/vsi_sensor.py](https://github.com/ARM-software/AVH/blob/main/interface/sensor/python/vsi_sensor.py) | \ref arm_vsi_sensor "VSI Sensor" Python module for sensor interface.
Hardware specific sensor driver for ST Microelectronics B-U585I-IOT02A Discovery kit for IoT | Hardware specific sensor driver implementation for ST Microelectronics B-U585I-IOT02A Discovery kit for IoT. See [SDS-Framework GitHub repo](https://github.com/ARM-software/SDS-Framework/tree/main/examples/framework/layer/Board/B-U585I-IOT02A/Driver).

@{
\defgroup sensor_drv_functions Sensor Driver API Functions
\ingroup arm_vsi_sensor
\brief Sensor Driver API functions.
\details

@{
\typedef sensorId_t


\typedef sensorEvent_t
\details
Provides the typedef for the event callback function <b>sensorEvent (sensorId_t id, uint32_t event)</b> to be registered with \ref sensorRegisterEvents.

The parameter \em id specifies the sensor.

The parameter \em event indicates the reported event(s) that occurred during driver operation.
Each event is encoded in a separate bit so it is possible to signal multiple events within the same call.
\ref SENSOR_EVENT_DATA "SENSOR_EVENT_..." definitions list the events that can be reported.

<b>Parameter for:</b>
- \ref sensorRegisterEvents


\fn sensorId_t sensorGetId (const char *name)
\details
The function \b sensorGetId retrieves the sensor identifier, which is then used to specify which sensor is affected by the function call.

The parameter \em name specifies sensor name.

Possible return values:
- \ref sensorId_t
- NULL : sensor name was not specified.


\fn sensorConfig_t *sensorGetConfig (sensorId_t id)
\details
The function \b sensorGetConfig retrieves sensor configuration.

The parameter \em id specifies the sensor.


\fn int32_t sensorRegisterEvents (sensorId_t id, sensorEvent_t event_cb, uint32_t event_mask)
\details
The function \b sensorRegisterEvents registers sensor events.

The parameter \em id specifies the sensor.

The parameter \em event_cb is a pointer to the \ref sensorEvent_t callback function.

The parameter \em event_mask specifies the event. Each event is encoded in a separate bit. \ref SENSOR_EVENT_DATA "SENSOR_EVENT_..." definitions list the events that can be reported.

Possible return values:
- \ref SENSOR_OK : events registered.
- \ref SENSOR_ERROR : returned in the following cases:
- sensor \em id is invalid.
- \em event_cb is NULL.
- \em event_mask is 0.


\fn int32_t sensorEnable (sensorId_t id)
\details
The function \b sensorEnable enables the specified sensor.

The parameter \em id specifies the sensor.

Possible return values:
- \ref SENSOR_OK : sensor enabled.
- \ref SENSOR_ERROR : returned in the following cases:
- sensor \em id is invalid.
- sensor is already active.


\fn int32_t sensorDisable (sensorId_t id)
\details
The function \b sensorDisable disables the specified sensor.

The parameter \em id specifies the sensor.

Possible return values:
- \ref SENSOR_OK : sensor disabled.
- \ref SENSOR_ERROR : returned in the following cases:
- sensor \em id is invalid.
- sensor is already disabled.


\fn sensorStatus_t sensorGetStatus (sensorId_t id)
\details
The function \b sensorGetStatus retrieves the current status of the specified sensor.

The parameter \em id specifies the sensor.


\fn uint32_t sensorReadSamples (sensorId_t id, uint32_t num_samples, void *buf, uint32_t buf_size)
\details
The function \b sensorReadSamples reads requested number of samples from sensor and stores them in the specified buffer.
If the requested number of samples is higher than the number of available samples, the available number of samples will be read and stored in the buffer.
If the provided buffer size is not big enough, no samples will be read from the sensor.

The parameter \em id specifies the sensor.

The parameter \em num_samples specifies the maximum number of samples to be read from the sensor.

The parameter \em buf points to the sensor sample memory buffer provided by the user.

The parameter \em buf_size defines the size of user provided sensor sample buffer.


\fn void *sensorGetBlockData (sensorId_t id)
\details
The function \b sensorGetBlockData gets a pointer to block data.

The parameter \em id specifies the sensor.
@}

@{
\struct sensorStatus_t
\details
Structure with information about the sensor status. The data fields encode active and buffer state flags.

<b>Returned by:</b>
- \ref sensorGetStatus
@}


@{
\struct sensorConfig_t
\details
Structure with sensor configuration parameters.

<b>Returned by:</b>
- \ref sensorGetConfig
@}
@}


@{
\defgroup sensor_drv_defines Sensor Driver API Defines
\ingroup arm_vsi_sensor
\brief Sensor Driver API Definitions.
\details

@{
\def SENSOR_OK
\def SENSOR_ERROR
@}

@{
\def SENSOR_EVENT_DATA
\details Triggered to indicate that new data is available.

If \ref sensorConfig_t.dma_mode "sensorConfig_t.dma_mode" is set to 1 (DMA mode) the event will be generated on \ref sensorConfig_t.u.fifo "sensorConfig_t.fifo.sample_interval".

If \ref sensorConfig_t.dma_mode "sensorConfig_t.dma_mode" is set to 0 (FIFO mode) the event will be generated on \ref sensorConfig_t.u.dma "sensorConfig_t.dma.block_interval".

\def SENSOR_EVENT_OVERFLOW
\details Triggered to indicate that overflow of data buffer has occurred.
@}
@}

*/
*/
// End Sensor Interface

0 comments on commit 4cbac81

Please sign in to comment.