NSUKit
1.4.0
板卡级统一交互接口
载入中...
搜索中...
未找到
soc_config.cpp
浏览该文件的文档.
1
2
// Copyright (c) 2024. Naishu
3
// NSUKit is licensed under Mulan PSL v2.
4
// You can use this software according to the terms and conditions of the Mulan PSL v2.
5
// You may obtain a copy of Mulan PSL v2 at:
6
// http://license.coscl.org.cn/MulanPSL2
7
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
8
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
9
// MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
10
// See the Mulan PSL v2 for more details.
12
13
//
14
// Created by jilianyi<jilianyi@naishu.tech> on 2024/4/12.
15
//
16
17
#include <iostream>
18
#include "
NSUKit.h
"
19
20
int
main
(
int
argc,
char
*argv[]) {
21
nsukit::NSUSoc<nsukit::TCPCmdUItf, nsukit::PCIECmdUItf, nsukit::PCIEStreamUItf>
kit{};
22
nsuInitParam_t
param;
23
24
param.
cmd_ip
= argv[1];
25
param.
icd_path
=
"./icd.json"
;
26
param.
cmd_board
= 0;
27
param.
stream_board
= 0;
28
auto
res = kit.link_cmd(¶m);
29
if
(res !=
nsukitStatus_t::NSUKIT_STATUS_SUCCESS
) {
30
std::cout <<
"建立连接:"
<<
nsukit::status2_string
(res) << std::endl;
31
}
32
33
switch
(argc) {
34
case
2:
35
// SocConfig {SocIP}
36
res = kit.execute(
"RF配置"
);
37
if
(res !=
nsukitStatus_t::NSUKIT_STATUS_SUCCESS
) {
38
std::cout <<
"RF配置:"
<<
nsukit::status2_string
(res) << std::endl;
39
}
40
std::cout <<
"RF配置执行结果:"
<< kit.get_param<
nsuRegValue_t
>(
"RF配置结果"
) << std::endl;
41
42
res = kit.execute(
"DDS配置"
);
43
if
(res !=
nsukitStatus_t::NSUKIT_STATUS_SUCCESS
) {
44
std::cout <<
"DDS配置:"
<<
nsukit::status2_string
(res) << std::endl;
45
}
46
std::cout <<
"DDS配置执行结果:"
<< kit.get_param<
nsuRegValue_t
>(
"DDS配置结果"
) << std::endl;
47
48
res = kit.execute(
"奈奎斯特区配置"
);
49
if
(res !=
nsukitStatus_t::NSUKIT_STATUS_SUCCESS
) {
50
std::cout <<
"奈奎斯特区配置:"
<<
nsukit::status2_string
(res) << std::endl;
51
}
52
break
;
53
case
3:
54
// SocConfig {SocIP} {CmdName}
55
res = kit.execute(argv[2]);
56
if
(res !=
nsukitStatus_t::NSUKIT_STATUS_SUCCESS
) {
57
std::cout << argv[2] <<
": "
<<
nsukit::status2_string
(res) << std::endl;
58
}
59
break
;
60
default
:
61
std::cout <<
"不受支持的传参方法"
<< std::endl;
62
std::cout << argv[0] <<
" IP "
<< std::endl;
63
std::cout << argv[0] <<
" IP cmdName"
<< std::endl;
64
}
65
66
return
0;
67
}
NSUKit.h
nsukit::NSUSoc
Definition:
NSUKit.h:31
main
int main()
Definition:
link_only_eth.cpp:19
nsukit::status2_string
std::string NSU_DLLEXPORT status2_string(nsukitStatus_t status)
Definition:
config.cpp:15
nsuInitParam_t
Definition:
type.h:155
nsuMwParam_t::icd_path
std::string icd_path
Definition:
type.h:145
nsuTCPParam_t::cmd_ip
std::string cmd_ip
Definition:
type.h:98
nsuXDMAParam_t::cmd_board
nsuBoardNum_t cmd_board
Definition:
type.h:115
nsuXDMAParam_t::stream_board
nsuBoardNum_t stream_board
Definition:
type.h:121
nsukitStatus_t::NSUKIT_STATUS_SUCCESS
@ NSUKIT_STATUS_SUCCESS
nsuRegValue_t
DLLEXTERN typedef uint32_t nsuRegValue_t
Definition:
type.h:90
examples
soc_config.cpp
制作者
1.9.6