Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
colorEagleStdio
taskbus
提交
fb1ef557
taskbus
项目概览
colorEagleStdio
/
taskbus
通知
166
Star
12
Fork
6
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
taskbus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fb1ef557
编写于
4月 18, 2022
作者:
D
dev
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'qt6' of git@gitcode.net:coloreaglestdio/taskbus.git into qt6
# Conflicts: # taskbusplatform/taskbusplatform.pro
上级
e21585c4
731f24cb
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
460 addition
and
2 deletion
+460
-2
modules/modules.pro
modules/modules.pro
+1
-0
modules/transforms/filter_fir/CMakeLists.txt
modules/transforms/filter_fir/CMakeLists.txt
+24
-0
modules/transforms/filter_fir/filter_fir.json
modules/transforms/filter_fir/filter_fir.json
+53
-0
modules/transforms/filter_fir/filter_fir.pro
modules/transforms/filter_fir/filter_fir.pro
+9
-0
modules/transforms/filter_fir/info.qrc
modules/transforms/filter_fir/info.qrc
+5
-0
modules/transforms/filter_fir/main.cpp
modules/transforms/filter_fir/main.cpp
+366
-0
taskbusplatform/taskbusplatform.pro
taskbusplatform/taskbusplatform.pro
+2
-2
未找到文件。
modules/modules.pro
浏览文件 @
fb1ef557
...
...
@@ -4,6 +4,7 @@ TEMPLATE = subdirs
SUBDIRS
+=
sources
/
source_plutosdr
\
transforms
/
transform_fft
\
transforms
/
mod_fm
\
transforms
/
filter_fir
\
sources
/
source_files
\
sinks
/
sink_file
\
sinks
/
sink_plutosdr
\
...
...
modules/transforms/filter_fir/CMakeLists.txt
0 → 100644
浏览文件 @
fb1ef557
cmake_minimum_required
(
VERSION 3.5
)
set
(
CMAKE_INCLUDE_CURRENT_DIR ON
)
set
(
CMAKE_AUTOUIC ON
)
set
(
CMAKE_AUTOMOC ON
)
set
(
CMAKE_AUTORCC ON
)
set
(
CMAKE_CXX_STANDARD 17
)
set
(
CMAKE_CXX_STANDARD_REQUIRED ON
)
find_package
(
QT NAMES Qt6 COMPONENTS Core REQUIRED
)
find_package
(
Qt
${
QT_VERSION_MAJOR
}
COMPONENTS Core REQUIRED
)
include_directories
(
${
TASKBUS_INTERFACEDIR
}
)
set
(
PRJ_SOURCES
main.cpp
filter_fir.cpp
)
#############Target======================
add_executable
(
filter_fir
${
PRJ_SOURCES
}
)
target_link_libraries
(
filter_fir Qt
${
QT_VERSION_MAJOR
}
::Core
)
modules/transforms/filter_fir/filter_fir.json
0 → 100644
浏览文件 @
fb1ef557
{
"filter_fir"
:{
"name"
:
"filter_fir"
,
"parameters"
:{
"sptype"
:{
"type"
:
"enum"
,
"tooltip"
:
"sample point format"
,
"default"
:
0
,
"range"
:{
"0"
:
"16 bit Intel"
,
"1"
:
"16 bit Moto"
,
"2"
:
"int8"
,
"3"
:
"uint8"
}
},
"type"
:{
"type"
:
"int"
,
"tooltip"
:
"type"
,
"default"
:
"1"
,
"range"
:
"0:real,1:complex"
},
"hn"
:{
"type"
:
"double"
,
"tooltip"
:
"h(t)"
,
"default"
:
"0,0,0,1.0,0,0,0"
,
"range"
:
"0~1 array"
}
},
"input_subjects"
:
{
"in"
:{
"type"
:
"byte"
,
"tooltip"
:
"Input"
},
"in_time"
:{
"type"
:
"timestamp"
,
"tooltip"
:
"Input timestamp"
}
},
"output_subjects"
:{
"out"
:{
"type"
:
"vector"
,
"tooltip"
:
"Output"
},
"out_time"
:{
"type"
:
"timestamp"
,
"tooltip"
:
"Out timestamp"
}
}
}
}
modules/transforms/filter_fir/filter_fir.pro
0 → 100644
浏览文件 @
fb1ef557
TEMPLATE
=
app
QT
-=
gui
CONFIG
+=
c
++
11
console
CONFIG
-=
app_bundle
INCLUDEPATH
+=
..
/../../
tb_interface
DESTDIR
=
$$
OUT_PWD
/../../../
bin
/
modules
SOURCES
+=
\
main
.
cpp
RESOURCES
+=
info
.
qrc
modules/transforms/filter_fir/info.qrc
0 → 100644
浏览文件 @
fb1ef557
<RCC>
<qresource prefix="/">
<file>filter_fir.json</file>
</qresource>
</RCC>
modules/transforms/filter_fir/main.cpp
0 → 100644
浏览文件 @
fb1ef557
#
include
<
QCoreApplication
>
#include <QVector>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <string>
#include <memory>
#include <QFile>
#include "cmdlineparser.h"
#include "tb_interface.h"
using
namespace
TASKBUS
;
const
int
OFFLINEDEBUG
=
0
;
//数据源方法
int
do_fir
(
const
cmdlineParser
&
args
);
//全局的终止标记
static
bool
bfinished
=
false
;
using
namespace
std
;
int
main
(
int
argc
,
char
*
argv
[])
{
QCoreApplication
a
(
argc
,
argv
);
//重要!设置输入输出为二进制!
init_client
();
//解释命令行
cmdlineParser
args
;
if
(
OFFLINEDEBUG
==
0
)
args
.
parser
(
argc
,
argv
);
else
{
FILE
*
old_stdin
,
*
old_stdout
;
auto
ars
=
debug
(
"debug/pid4113"
,
&
old_stdin
,
&
old_stdout
);
args
.
parser
(
ars
);
}
int
ret
=
0
;
//每个模块要响应 --information参数,打印自己的功能定义字符串。或者提供一个json文件。
if
(
args
.
contains
(
"information"
))
{
QFile
fp
(
":/filter_fir.json"
);
if
(
fp
.
open
(
QIODevice
::
ReadOnly
)
==
false
)
{
fp
.
setFileName
(
":/json/filter_fir.json"
);
fp
.
open
(
QIODevice
::
ReadOnly
);
}
if
(
fp
.
isOpen
())
{
QByteArray
arr
=
fp
.
readAll
();
arr
.
push_back
(
'\0'
);
puts
(
arr
.
constData
());
fflush
(
stdout
);
}
ret
=
0
;
}
else
if
(
args
.
contains
(
"function"
/*,"filter_fir"*/
))
//正常运行模式
{
ret
=
do_fir
(
args
);
}
else
{
fprintf
(
stderr
,
"Error:Function does not exits."
);
ret
=
-
1
;
}
return
ret
;
}
int
do_fir
(
const
cmdlineParser
&
args
)
{
using
namespace
TASKBUS
;
int
res
=
0
;
//获得平台告诉自己的实例名
const
unsigned
int
instance
=
args
.
toInt
(
"instance"
,
0
);
const
unsigned
int
iinput
=
args
.
toInt
(
"in"
,
0
);
const
unsigned
int
i_tmin
=
args
.
toInt
(
"in_time"
,
0
);
const
unsigned
int
i_tmout
=
args
.
toInt
(
"out_time"
,
0
);
const
double
iout
=
args
.
toInt
(
"out"
,
0
);
std
::
vector
<
double
>
hn
=
args
.
toDoubleArray
(
"hn"
);
//工作模式
const
int
sptype
=
args
.
toInt
(
"sptype"
,
0
);
fprintf
(
stderr
,
"sptype is %d."
,
sptype
);
int
type
=
args
.
toInt
(
"type"
,
1
);
if
(
type
<
0
||
type
>
1
)
type
=
0
;
fflush
(
stderr
);
//计算加速表,乘法预先做完
const
int
stages
=
hn
.
size
();
if
(
stages
<
1
)
{
fprintf
(
stderr
,
"h(t) is empty. failed.
\n
"
);
return
-
1
;
}
fprintf
(
stderr
,
"Init fast filter Boost table %.1lf M bytes.
\n
"
,
stages
*
65536
/
1024.0
/
1024.0
*
sizeof
(
int
));
std
::
shared_ptr
<
int
[][
65536
]
>
boostTb
(
new
int
[
stages
][
65536
]);
if
(
boostTb
)
{
int
(
*
pBTB
)[
65536
]
=
boostTb
.
get
();
for
(
int
s
=
0
;
s
<
stages
;
++
s
)
{
for
(
unsigned
int
v
=
0
;
v
<=
0xffff
;
++
v
)
{
unsigned
short
vs
=
v
&
0xffff
;
short
*
vp
=
(
short
*
)
&
vs
;
double
vr
=
hn
[
s
]
*
(
*
vp
);
if
(
vr
>
32766
)
vr
=
32766
;
if
(
vr
<
-
32766
)
vr
=
-
32766
;
pBTB
[
s
][
vs
]
=
int
(
vr
*
32768
+
(
vr
<
0
?-
0.5
:
0.5
));
}
}
}
else
{
fprintf
(
stderr
,
"Failed."
);
return
-
1
;
}
const
int
(
*
BTB
)[
65536
]
=
boostTb
.
get
();
fprintf
(
stderr
,
"Succeeded."
);
std
::
vector
<
short
>
vec_regs
[
2
];
vec_regs
[
0
]
=
std
::
vector
<
short
>
(
stages
,
0
);
vec_regs
[
1
]
=
std
::
vector
<
short
>
(
stages
,
0
);
short
*
reg
[
2
]
=
{
vec_regs
[
0
].
data
(),
vec_regs
[
1
].
data
()};
unsigned
short
*
ureg
[
2
]
=
{(
unsigned
short
*
)
vec_regs
[
0
].
data
(),(
unsigned
short
*
)
vec_regs
[
1
].
data
()};
unsigned
long
long
clk
=
0
;
try
{
//判断参数合法性
if
(
instance
==
0
)
throw
"function=quit;{
\"
error
\"
:
\"
instance is 0, quit.
\"
}"
;
int
failed_header
=
0
;
QVector
<
qint16
>
vec_output
;
while
(
false
==
bfinished
)
{
subject_package_header
header
;
vector
<
unsigned
char
>
packagedta
=
pull_subject
(
&
header
);
if
(
is_valid_header
(
header
)
==
false
)
{
if
(
++
failed_header
>
16
)
bfinished
=
true
;
continue
;
}
if
(
is_control_subject
(
header
))
{
//收到命令进程退出的广播消息,退出
if
(
strstr
(
control_subject
(
header
,
packagedta
).
c_str
(),
"function=quit;"
)
!=
nullptr
)
bfinished
=
true
;
}
else
if
(
header
.
subject_id
==
i_tmin
&&
i_tmout
)
{
push_subject
(
i_tmout
,
instance
,
packagedta
.
size
(),
(
unsigned
char
*
)
packagedta
.
data
()
);
}
else
if
(
header
.
subject_id
==
iinput
)
{
if
(
vec_output
.
size
()
<
packagedta
.
size
()
*
2
)
vec_output
.
resize
(
packagedta
.
size
()
*
2
);
short
*
outptr
=
(
short
*
)
vec_output
.
data
();
//Input Buffer
switch
(
sptype
)
{
//Intel 16bit
case
0
:{
if
(
type
==
0
)
{
const
short
*
pdata
=
(
const
short
*
)
packagedta
.
data
();
const
int
samples
=
packagedta
.
size
()
/
sizeof
(
short
);
for
(
int
spid
=
0
;
spid
<
samples
;
++
spid
)
{
int
curr_pos
=
clk
%
stages
;
reg
[
0
][
curr_pos
]
=
pdata
[
spid
];
int
res
=
0
;
for
(
int
ids
=
0
;
ids
<
stages
;
++
ids
)
res
+=
BTB
[
ids
][
ureg
[
0
][(
curr_pos
+
ids
+
1
)
%
stages
]];
outptr
[
spid
]
=
(
res
>>
15
);
++
clk
;
}
}
else
{
const
short
(
*
pdata
)[
2
]
=
(
const
short
(
*
)[
2
])
packagedta
.
data
();
const
int
samples
=
packagedta
.
size
()
/
sizeof
(
short
)
/
2
;
for
(
int
spid
=
0
;
spid
<
samples
;
++
spid
)
{
int
curr_pos
=
clk
%
stages
;
reg
[
0
][
curr_pos
]
=
pdata
[
spid
][
0
];
reg
[
1
][
curr_pos
]
=
pdata
[
spid
][
1
];
int
res
[
2
]
=
{
0
,
0
};
for
(
int
ids
=
0
;
ids
<
stages
;
++
ids
)
{
res
[
0
]
+=
BTB
[
ids
][
ureg
[
0
][(
curr_pos
+
ids
+
1
)
%
stages
]];
res
[
1
]
+=
BTB
[
ids
][
ureg
[
1
][(
curr_pos
+
ids
+
1
)
%
stages
]];
}
outptr
[
spid
*
2
]
=
(
res
[
0
]
>>
15
);
outptr
[
spid
*
2
+
1
]
=
(
res
[
1
]
>>
15
);
++
clk
;
}
}
}
break
;
//16bit U
case
1
:{
if
(
type
==
0
)
{
const
unsigned
char
*
pdata
=
(
const
unsigned
char
*
)
packagedta
.
data
();
const
int
samples
=
packagedta
.
size
()
/
sizeof
(
short
);
for
(
int
spid
=
0
;
spid
<
samples
;
++
spid
)
{
unsigned
char
pt
[
2
]
=
{
pdata
[
spid
*
2
+
1
],
pdata
[
spid
*
2
]};
short
*
ptv
=
(
short
*
)
pt
;
int
curr_pos
=
clk
%
stages
;
reg
[
0
][
curr_pos
]
=
*
ptv
;
push_subject
(
iout
,
instance
,
vec_output
.
size
()
*
2
,
(
unsigned
char
*
)
vec_output
.
constData
()
);
int
res
=
0
;
for
(
int
ids
=
0
;
ids
<
stages
;
++
ids
)
res
+=
BTB
[
ids
][
ureg
[
0
][(
curr_pos
+
ids
+
1
)
%
stages
]];
outptr
[
spid
]
=
(
res
>>
15
);
++
clk
;
}
}
else
{
const
unsigned
char
*
pdata
=
(
const
unsigned
char
*
)
packagedta
.
data
();
const
int
samples
=
packagedta
.
size
()
/
sizeof
(
short
)
/
2
;
for
(
int
spid
=
0
;
spid
<
samples
;
++
spid
)
{
unsigned
char
pt
[
2
][
2
]
=
{
{
pdata
[
spid
*
4
+
1
],
pdata
[
spid
*
4
]},
{
pdata
[
2
+
spid
*
4
+
1
],
pdata
[
2
+
spid
*
4
]}
};
short
*
ptv
[
2
]
=
{(
short
*
)
pt
[
0
],(
short
*
)
pt
[
1
]};
int
curr_pos
=
clk
%
stages
;
reg
[
0
][
curr_pos
]
=
*
(
ptv
[
0
]);
reg
[
1
][
curr_pos
]
=
*
(
ptv
[
1
]);
int
res
[
2
]
=
{
0
,
0
};
for
(
int
ids
=
0
;
ids
<
stages
;
++
ids
)
{
res
[
0
]
+=
BTB
[
ids
][
ureg
[
0
][(
curr_pos
+
ids
+
1
)
%
stages
]];
res
[
1
]
+=
BTB
[
ids
][
ureg
[
1
][(
curr_pos
+
ids
+
1
)
%
stages
]];
}
outptr
[
spid
*
2
]
=
(
res
[
0
]
>>
15
);
outptr
[
spid
*
2
+
1
]
=
(
res
[
1
]
>>
15
);
++
clk
;
}
}
}
break
;
//int8
case
2
:{
if
(
type
==
0
)
{
const
char
*
pdata
=
(
const
char
*
)
packagedta
.
data
();
const
int
samples
=
packagedta
.
size
()
/
sizeof
(
char
);
for
(
int
spid
=
0
;
spid
<
samples
;
++
spid
)
{
int
curr_pos
=
clk
%
stages
;
reg
[
0
][
curr_pos
]
=
pdata
[
spid
];
int
res
=
0
;
for
(
int
ids
=
0
;
ids
<
stages
;
++
ids
)
res
+=
BTB
[
ids
][
ureg
[
0
][(
curr_pos
+
ids
+
1
)
%
stages
]];
outptr
[
spid
]
=
(
res
>>
15
);
++
clk
;
}
}
else
{
const
char
(
*
pdata
)[
2
]
=
(
const
char
(
*
)[
2
])
packagedta
.
data
();
const
int
samples
=
packagedta
.
size
()
/
sizeof
(
char
)
/
2
;
for
(
int
spid
=
0
;
spid
<
samples
;
++
spid
)
{
int
curr_pos
=
clk
%
stages
;
reg
[
0
][
curr_pos
]
=
pdata
[
spid
][
0
];
reg
[
1
][
curr_pos
]
=
pdata
[
spid
][
1
];
int
res
[
2
]
=
{
0
,
0
};
for
(
int
ids
=
0
;
ids
<
stages
;
++
ids
)
{
res
[
0
]
+=
BTB
[
ids
][
ureg
[
0
][(
curr_pos
+
ids
+
1
)
%
stages
]];
res
[
1
]
+=
BTB
[
ids
][
ureg
[
1
][(
curr_pos
+
ids
+
1
)
%
stages
]];
}
outptr
[
spid
*
2
]
=
(
res
[
0
]
>>
15
);
outptr
[
spid
*
2
+
1
]
=
(
res
[
1
]
>>
15
);
++
clk
;
}
}
}
break
;
case
3
:{
if
(
type
==
0
)
{
const
unsigned
char
*
pdata
=
(
const
unsigned
char
*
)
packagedta
.
data
();
const
int
samples
=
packagedta
.
size
()
/
sizeof
(
char
);
for
(
int
spid
=
0
;
spid
<
samples
;
++
spid
)
{
int
curr_pos
=
clk
%
stages
;
reg
[
0
][
curr_pos
]
=
pdata
[
spid
];
int
res
=
0
;
for
(
int
ids
=
0
;
ids
<
stages
;
++
ids
)
res
+=
BTB
[
ids
][
ureg
[
0
][(
curr_pos
+
ids
+
1
)
%
stages
]];
outptr
[
spid
]
=
(
res
>>
15
);
++
clk
;
}
}
else
{
const
unsigned
(
*
pdata
)[
2
]
=
(
const
unsigned
(
*
)[
2
])
packagedta
.
data
();
const
int
samples
=
packagedta
.
size
()
/
sizeof
(
char
)
/
2
;
for
(
int
spid
=
0
;
spid
<
samples
;
++
spid
)
{
int
curr_pos
=
clk
%
stages
;
reg
[
0
][
curr_pos
]
=
pdata
[
spid
][
0
];
reg
[
1
][
curr_pos
]
=
pdata
[
spid
][
1
];
int
res
[
2
]
=
{
0
,
0
};
for
(
int
ids
=
0
;
ids
<
stages
;
++
ids
)
{
res
[
0
]
+=
BTB
[
ids
][
ureg
[
0
][(
curr_pos
+
ids
+
1
)
%
stages
]];
res
[
1
]
+=
BTB
[
ids
][
ureg
[
1
][(
curr_pos
+
ids
+
1
)
%
stages
]];
}
outptr
[
spid
*
2
]
=
(
res
[
0
]
>>
15
);
outptr
[
spid
*
2
+
1
]
=
(
res
[
1
]
>>
15
);
++
clk
;
}
}
}
break
;
default:
break
;
}
//播发
if
(
iout
)
{
push_subject
(
iout
,
instance
,
vec_output
.
size
()
*
2
,
(
unsigned
char
*
)
vec_output
.
constData
()
);
}
}
}
}
catch
(
const
char
*
errMessage
)
{
//向所有部位广播,偶要退出。
push_subject
(
control_subect_id
(),
/*instance,broadcast_destin_id(),*/
0
,
errMessage
);
fprintf
(
stderr
,
"Error:%s."
,
errMessage
);
fflush
(
stderr
);
res
=
-
1
;
}
return
res
;
}
taskbusplatform/taskbusplatform.pro
浏览文件 @
fb1ef557
...
...
@@ -60,7 +60,7 @@ SOURCES += \
watchdog
/
tbwatchdog
.
cpp
\
watchdog
/
watchmemmodule
.
cpp
\
gui
/
custom_item_editor
.
cpp
\
gui
/
tbscene
.
cpp
gui
/
tbscene
.
cpp
HEADERS
+=
\
core
/
tasknode
.
h
\
...
...
@@ -77,7 +77,7 @@ HEADERS += \
watchdog
/
profile_log
.
h
\
watchdog
/
tbwatchdog
.
h
\
watchdog
/
watchmemmodule
.
h
\
gui
/
tbscene
.
h
gui
/
tbscene
.
h
FORMS
+=
\
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录