Skip to content

Commit

Permalink
build/configs/rtl8730e: Enable csi build for flat_apps
Browse files Browse the repository at this point in the history
  • Loading branch information
sahil1dotgupta committed Dec 16, 2024
1 parent cfdc8e0 commit a8c9663
Show file tree
Hide file tree
Showing 18 changed files with 700 additions and 533 deletions.
376 changes: 204 additions & 172 deletions apps/examples/csifw_test/csifw_test.c

Large diffs are not rendered by default.

12 changes: 2 additions & 10 deletions apps/examples/csifw_test/csifw_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,15 @@
*
****************************************************************************/

/**
* @file csifw_test.h
* @brief Sample application to show case usage of CSI Framework basic functionality.
*/

#pragma once

#ifdef __cplusplus
extern "C" {
extern "C"
{
#endif

/**
* @brief: It starts csifw test application.
*/
void csifw_test_main(int argc, char **args);

#ifdef __cplusplus
}
#endif

28 changes: 28 additions & 0 deletions build/configs/rtl8730e/flat_apps/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,17 @@ CONFIG_SPI_EXCHANGE=y
# CONFIG_AUDIO_DEVICES is not set
# CONFIG_DRIVERS_VIDEO is not set

#
# CSI Driver Support
#
CONFIG_WIFI_CSI=y
CONFIG_WIFICSI_CUSTOM_DEV_PATH="/dev/wificsi"

#
# CSI Devices
#
CONFIG_WIFI_CSI_RTL8730E=y

#
# LCD Driver Support
#
Expand Down Expand Up @@ -1047,6 +1058,20 @@ CONFIG_MTD_SMART_JOURNALING=y
#
# CONFIG_UI is not set

#
# CSI Framework
#
CONFIG_CSIFW=y

#
# CSIFW Debug Logs
#
CONFIG_CSIFW_LOGS=y
CONFIG_CSIFW_LOGE=y
# CONFIG_CSIFW_LOGI is not set
# CONFIG_CSIFW_LOGD is not set
# CONFIG_CSIFW_LOGV is not set

#
# Memory Management
#
Expand Down Expand Up @@ -1108,6 +1133,8 @@ CONFIG_DEBUG_BLE_ERROR=y
# CONFIG_DEBUG_PM is not set
# CONFIG_DEBUG_SCHED is not set
# CONFIG_DEBUG_TASH is not set
CONFIG_DEBUG_WIFICSI=y
CONFIG_DEBUG_WIFICSI_ERROR=y

#
# Framework Debug Options
Expand Down Expand Up @@ -1318,6 +1345,7 @@ CONFIG_BUILTIN_APPS=y
# CONFIG_EXAMPLES_BLE_PERFS is not set
# CONFIG_EXAMPLES_BLE_RMC is not set
# CONFIG_EXAMPLES_BLE_TESTER is not set
# CONFIG_EXAMPLES_CSIFW_TEST is not set

#
# Board Specific Demos
Expand Down
74 changes: 53 additions & 21 deletions framework/include/csifw/csifw_api.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/****************************************************************************
*
* Copyright 2024 Samsung Electronics All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*
****************************************************************************/

#ifndef __CSIFW_API_H__
#define __CSIFW_API_H__

Expand All @@ -8,31 +26,24 @@
#include <tinyara/config.h>
#include <tinyara/wifi_csi/wifi_csi_struct.h>


typedef enum {
CSIFW_ERROR_CLIENT_NOT_REGISTERED = -8, /* Client not registered. Cannot start/stop/deinit */
CSIFW_ERROR_WIFI_NOT_CONNECTED = -7, /* WIFI not connected */
CSIFW_ERROR_WIFI_DIS_CONNECTED = -6, /* WIFI WIFI_DISCONNECTED */
CSIFW_INVALID_RAWDATA = -5, /* Invalid Raw Data */
CSIFW_INVALID_ARG = -4, /* Invalid argument */
CSIFW_NOT_ENOUGH_SPACE = -3, /* read/write/other buffer has empty space less than required size */
CSIFW_NO_MEM = -2, /* Memory allocation (malloc/calloc) failed */
CSIFW_ERROR = -1, /* ERROR: All other types of error not specified by any following enum */
CSIFW_OK = 0 /* OK: Without any error */
CSIFW_ERROR_CLIENT_NOT_REGISTERED = -8, /* Client not registered. Cannot start/stop/deinit */
CSIFW_ERROR_WIFI_NOT_CONNECTED = -7, /* WIFI not connected */
CSIFW_ERROR_WIFI_DIS_CONNECTED = -6, /* WIFI WIFI_DISCONNECTED */
CSIFW_INVALID_RAWDATA = -5, /* Invalid Raw Data */
CSIFW_INVALID_ARG = -4, /* Invalid argument */
CSIFW_NOT_ENOUGH_SPACE = -3, /* read/write/other buffer has empty space less than required size */
CSIFW_NO_MEM = -2, /* Memory allocation (malloc/calloc) failed */
CSIFW_ERROR = -1, /* ERROR: All other types of error not specified by any following enum */
CSIFW_OK = 0, /* OK: Without any error */
CSIFW_OK_WIFI_CONNECTED = 1 /* OK: Without any error */
} CSIFW_RES;

typedef enum {
CSIFW_WIFI_DISCONNECTED = -1,
CSIFW_NORMAL = 0
} CSIFW_REASON;

typedef enum CSI_CONFIG_TYPE {
HT_CSI_DATA = 0, /* 56 subcarriers each sub-carrier data is 2 bytes */
NON_HT_CSI_DATA = 1, /* 52 subcarriers each sub-carrier data is 2 bytes */
HT_CSI_DATA_ACC1 = 2, /* 56 subcarriers each sub-carrier data is 4 bytes */
NON_HT_CSI_DATA_ACC1 = 3, /* 52 subcarriers each sub-carrier data is 4 bytes */
}CSI_CONFIG_TYPE;

/**
* @brief Callback function for receiving raw CSI data.
*
Expand Down Expand Up @@ -65,12 +76,12 @@ typedef void (*client_parsed_data_listener)(CSIFW_RES status, int csi_data_len,
* @param[in] config_type Configuration type for the CSI service. These parameters control various aspects of the CSI service, such as the number of antennas, accuracy, mode of CSI data, etc.
* @param[in] raw_callback Callback function for receiving raw CSI data. Pass NULL if raw csi data not required.
* @param[in] parsed_callback Callback function for receiving parsed CSI data. Pass NULL if parsed csi data not required.
* @param[in] interval Data collection interval in ms. For Non-HT data Interval range (3.2 ~ 81.6 ms), HT data Interval range (30ms ~ 1000ms)
* @param[in] interval Data collection interval in ms. For Non-HT data Interval range (3.2 ~ 500 ms), HT data Interval range (30ms ~ 1000ms)
* @param[in] ptr An optional pointer that can be used to pass additional context data to the callbacks.
*
* @return #CSIFW_OK on success, otherwise an error code.
*/
CSIFW_RES csi_service_init(CSI_CONFIG_TYPE config_type, client_raw_data_listener raw_callback, client_parsed_data_listener parsed_callback, unsigned int interval, void* ptr);
CSIFW_RES csi_service_init(csi_config_type_t config_type, client_raw_data_listener raw_callback, client_parsed_data_listener parsed_callback, unsigned int interval, void* ptr);

/**
* @brief Get MAC address of the connected AP.
Expand All @@ -90,7 +101,7 @@ CSIFW_RES csi_get_ap_mac_addr(csifw_mac_info *mac_info);
*
* @return #CSIFW_OK on success, otherwise an error code.
*/
CSIFW_RES csi_service_start();
CSIFW_RES csi_service_start(void);

/**
* @brief Stops the CSI service.
Expand All @@ -108,7 +119,28 @@ CSIFW_RES csi_service_stop(CSIFW_REASON reason);
*
* @return #CSIFW_OK on success, otherwise an error code.
*/
CSIFW_RES csi_service_deinit();
CSIFW_RES csi_service_deinit(void);

/**
* @brief Change CSI Data collection interval in ms.
*
* It should be called after CSI service Init and start state of csi.
*
* @param[in] interval Data collection interval in ms. For Non-HT data Interval range (3.2 ~ 500 ms), HT data Interval range (30ms ~ 1000ms)
*
* @return #CSIFW_OK on success, otherwise an error code.
*/
CSIFW_RES csi_service_change_interval(unsigned int interval);

/**
* @brief Get Current interval of CSI Data collection in ms.
*
* It should be called after CSI service Init state of csi.
*
* @return Current CSI Data collection interval in ms.
*/
unsigned int csi_service_get_current_interval(void);


#ifdef __cplusplus /* If this is a C++ compiler, end C linkage */
}
Expand Down
103 changes: 80 additions & 23 deletions framework/include/csifw/readme.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,83 @@
# A. How to build csifw test app

1. Run command `./os/dbuild.sh menu`.
2. Select board `rtl8730e`
3. Select configuration `loadable_ext_psram`
4. Modify build by selecting `Modify Current Configuration`
5. Enable csifw_test and wm_test app from menuconfig:

Application Configuration-> Examples-> [*] CSIFW test application
Wifi Manager-> [*] Wi-Fi Manager Sample

6. Turn on CSIFW logs from menuconfig:

CSI Framework-> CSIFW Debug Logs-> [*] CSIFW Logs
[*] CSIFW Error Logs
[ ] CSIFW Information Logs
[ ] CSIFW Debug Logs
[ ] CSIFW Verbose Logs
# How to build and run CSIFW

## A. Guide to build

### 1. Make dir
```
mkdir -p product_code
cd product_code
```


### 2. cbuild.sh
```
#!/usr/bin/env bash
# Set helper home path
export CONANHELPER_HOME="/data1/1212/sahil1.gupta/product_code/myhelperpath" <-- Change this path as per your environment
if [ -z "$CONANHELPER_HOME" ]; then
export CONANHELPER_HOME="/conanhelper"
fi
if [ ! -d "$CONANHELPER_HOME" ]; then
echo "The conanhelper does not exist."
mkdir $CONANHELPER_HOME
chmod 777 $CONANHELPER_HOME
git clone [email protected]:TizenRT/ssot.git $CONANHELPER_HOME
fi
$CONANHELPER_HOME/conanscript/conanscript.sh "$@"
```

### 3. Clone repo

Clone product_TizenLite5 and CSI_Platform

git clone [email protected]:TizenRT/product_TizenLite5.git
git clone [email protected]:TizenRT/CSI_Platform.git



### 4. (OPTIONAL) Changes to enable csifw_test app

|STEPS | |
|--- | ---|
|1. Disable Presence detection service | In file *'product_conan/config_presets/modules/csi_prs.config'* Disable following flag: `CONFIG_PRESENCE_DETECTION_APP`|
|2. Enable csifw_test app | In file *'CSI_Platform/configs/default/defconfig'* Enable following flag: `CONFIG_CSIFW_TEST`|
|3. Extra step for long run | In file *'CSI_Platform/apps/csifw_test/src/csifw_test.c'* `#define LONG_RUN_TEST 1`|


## 5. Build commands

### 5.1 If changes in repo CSI_Platform (if step 4 performed)
```
./cbuild.sh repo create -p=product_conan -b=CSI_Platform
```
### 5.2 If no changes in CSI_Platform
```
./cbuild.sh repo create -p=product_conan
```


### 6. target board download
```
./cbuild.sh repo -C product_conan download ALL
```
<br>

# B. How to run csifw test app on board

1. Connect board to wifi.
### 1. __TURN ON LOGS__:
- First run command `setlog` on TASH, note the number for CSIFW.

TASH>> setlog
PRODUCT_OCF_COMMON : 55
SEC_CPM : 69
CSIFW : 70 // ==> num: use this number to control csifw logs
- `setlog num 3` (to enable info logs)
- `setlog num 6` (to enable all logs)
2. Connect board to wifi.

3. Run csifw_test command as shown below:

Expand All @@ -36,7 +93,7 @@
<br>
<hr>

# B. CSI Framework Guide
# C. CSI Framework Guide


### Supported CSI Data Configs
Expand All @@ -48,7 +105,7 @@ CSIFW supports following configurations in STA mode:
- `NON_HT_CSI_DATA_ACC1` (52 subcarriers each sub-carrier data is 4 bytes)
<br>

The config can be set using `CSI_CONFIG_TYPE` enum.
The config can be set using `csi_config_type_t` enum.



Expand All @@ -74,7 +131,7 @@ The config can be set using `CSI_CONFIG_TYPE` enum.

2. __csi_service_init__: After implementing the callbacks, client can initialize CSIFW by calling `csi_service_init`

CSIFW_RES csi_service_init(CSI_CONFIG_TYPE config_type, client_raw_data_listener raw_callback, client_parsed_data_listener parsed_callback, unsigned int interval, void* ptr);
CSIFW_RES csi_service_init(csi_config_type_t config_type, client_raw_data_listener raw_callback, client_parsed_data_listener parsed_callback, unsigned int interval, void* ptr);
- `interval` : The interval in microseconds.
- If raw/parsed data is not required, pass `NULL` in place of callback.
<br>
Expand Down
Loading

0 comments on commit a8c9663

Please sign in to comment.