Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
2c6554bc
Q
qemu
项目概览
openeuler
/
qemu
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
qemu
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2c6554bc
编写于
6月 02, 2009
作者:
P
Paul Brook
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implement multiple samplers on stellaris ADC
Signed-off-by:
N
Paul Brook
<
paul@codesourcery.com
>
上级
5cea8590
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
31 addition
and
19 deletion
+31
-19
hw/stellaris.c
hw/stellaris.c
+31
-19
未找到文件。
hw/stellaris.c
浏览文件 @
2c6554bc
...
...
@@ -921,7 +921,7 @@ typedef struct
uint32_t
ssmux
[
4
];
uint32_t
ssctl
[
4
];
uint32_t
noise
;
qemu_irq
irq
;
qemu_irq
irq
[
4
]
;
}
stellaris_adc_state
;
static
uint32_t
stellaris_adc_fifo_read
(
stellaris_adc_state
*
s
,
int
n
)
...
...
@@ -945,6 +945,8 @@ static void stellaris_adc_fifo_write(stellaris_adc_state *s, int n,
{
int
head
;
/* TODO: Real hardware has limited size FIFOs. We have a full 16 entry
FIFO fir each sequencer. */
head
=
(
s
->
fifo
[
n
].
state
>>
4
)
&
0xf
;
if
(
s
->
fifo
[
n
].
state
&
STELLARIS_ADC_FIFO_FULL
)
{
s
->
ostat
|=
1
<<
n
;
...
...
@@ -961,26 +963,36 @@ static void stellaris_adc_fifo_write(stellaris_adc_state *s, int n,
static
void
stellaris_adc_update
(
stellaris_adc_state
*
s
)
{
int
level
;
int
n
;
level
=
(
s
->
ris
&
s
->
im
)
!=
0
;
qemu_set_irq
(
s
->
irq
,
level
);
for
(
n
=
0
;
n
<
4
;
n
++
)
{
level
=
(
s
->
ris
&
s
->
im
&
(
1
<<
n
))
!=
0
;
qemu_set_irq
(
s
->
irq
[
n
],
level
);
}
}
static
void
stellaris_adc_trigger
(
void
*
opaque
,
int
irq
,
int
level
)
{
stellaris_adc_state
*
s
=
(
stellaris_adc_state
*
)
opaque
;
int
n
;
if
((
s
->
actss
&
1
)
==
0
)
{
return
;
}
for
(
n
=
0
;
n
<
4
;
n
++
)
{
if
((
s
->
actss
&
(
1
<<
n
))
==
0
)
{
continue
;
}
/* Some applications use the ADC as a random number source, so introduce
some variation into the signal. */
s
->
noise
=
s
->
noise
*
314159
+
1
;
/* ??? actual inputs not implemented. Return an arbitrary value. */
stellaris_adc_fifo_write
(
s
,
0
,
0x200
+
((
s
->
noise
>>
16
)
&
7
));
s
->
ris
|=
1
;
stellaris_adc_update
(
s
);
if
(((
s
->
emux
>>
(
n
*
4
))
&
0xff
)
!=
5
)
{
continue
;
}
/* Some applications use the ADC as a random number source, so introduce
some variation into the signal. */
s
->
noise
=
s
->
noise
*
314159
+
1
;
/* ??? actual inputs not implemented. Return an arbitrary value. */
stellaris_adc_fifo_write
(
s
,
n
,
0x200
+
((
s
->
noise
>>
16
)
&
7
));
s
->
ris
|=
(
1
<<
n
);
stellaris_adc_update
(
s
);
}
}
static
void
stellaris_adc_reset
(
stellaris_adc_state
*
s
)
...
...
@@ -1068,9 +1080,6 @@ static void stellaris_adc_write(void *opaque, target_phys_addr_t offset,
switch
(
offset
)
{
case
0x00
:
/* ACTSS */
s
->
actss
=
value
&
0xf
;
if
(
value
&
0xe
)
{
hw_error
(
"Not implemented: ADC sequencers 1-3
\n
"
);
}
break
;
case
0x08
:
/* IM */
s
->
im
=
value
;
...
...
@@ -1169,14 +1178,17 @@ static int stellaris_adc_load(QEMUFile *f, void *opaque, int version_id)
return
0
;
}
static
qemu_irq
stellaris_adc_init
(
uint32_t
base
,
qemu_irq
irq
)
static
qemu_irq
stellaris_adc_init
(
uint32_t
base
,
qemu_irq
*
irq
)
{
stellaris_adc_state
*
s
;
int
iomemtype
;
qemu_irq
*
qi
;
int
n
;
s
=
(
stellaris_adc_state
*
)
qemu_mallocz
(
sizeof
(
stellaris_adc_state
));
s
->
irq
=
irq
;
for
(
n
=
0
;
n
<
4
;
n
++
)
{
s
->
irq
[
n
]
=
irq
[
n
];
}
iomemtype
=
cpu_register_io_memory
(
0
,
stellaris_adc_readfn
,
stellaris_adc_writefn
,
s
);
...
...
@@ -1295,7 +1307,7 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model,
pic
=
armv7m_init
(
flash_size
,
sram_size
,
kernel_filename
,
cpu_model
);
if
(
board
->
dc1
&
(
1
<<
16
))
{
adc
=
stellaris_adc_init
(
0x40038000
,
pic
[
14
]
);
adc
=
stellaris_adc_init
(
0x40038000
,
pic
+
14
);
}
else
{
adc
=
NULL
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录