aboutsummaryrefslogtreecommitdiff
path: root/write-stm-device/example.c
diff options
context:
space:
mode:
authorChunyan Zhang <zhang.chunyan@linaro.org>2016-08-19 20:56:48 +0800
committerChunyan Zhang <zhang.chunyan@linaro.org>2016-08-22 13:52:53 +0800
commit0fac4baa140f501f527d33a81c936a63eea45f63 (patch)
tree58dfde1ccddedb2dec50123abf28f154f4526db7 /write-stm-device/example.c
parent8eb9940ca4591dd6b92788b2aad6d4056cd74ec7 (diff)
downloadsample-app-stm-write-sample.tar.gz
write STM directly without policy assignationstm-write-sample
If no policy assigned to STM device before writing, a default policy will be applied, so we have to be sure that a policy named 'default' can be found under /config/stp-policy/<stm_device>/ Signed-off-by: Chunyan Zhang <zhang.chunyan@linaro.org>
Diffstat (limited to 'write-stm-device/example.c')
-rw-r--r--write-stm-device/example.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/write-stm-device/example.c b/write-stm-device/example.c
index dd58b0e..64e802e 100644
--- a/write-stm-device/example.c
+++ b/write-stm-device/example.c
@@ -14,23 +14,23 @@ extern struct stm_dev g_stm_dev;
void main()
{
- unsigned int chan_start = 0;
- unsigned int width = PAGE_SIZE / BYTES_PER_CHANNEL;
unsigned int wrbytes = sizeof(unsigned int) * TEST_DATA_SIZE;
unsigned int real_wrbytes;
unsigned int trace_data[TEST_DATA_SIZE] = {0x5555aaaa, 0xaaaa5555, 0x66666666, 0x99999999};
- if (request_stm_resource(&g_stm_dev, chan_start, width))
+ if (request_stm_resource(&g_stm_dev, 0, 0))
return;
/*
* You can use any channel between [g_stm_dev.policy->channel ...
* (g_stm_dev.policy->channel + g_stm_dev.policy->width)]
*/
- real_wrbytes = stm_char_write(g_stm_dev.fd, (char *)trace_data, wrbytes);
+ real_wrbytes = stm_char_write(g_stm_dev.fd, (char *)trace_data,
+ wrbytes);
if (real_wrbytes != wrbytes)
- printf("write %d bytes and left % bytes data\n", real_wrbytes, wrbytes - real_wrbytes);
-
+ printf("write %d bytes and left % bytes data\n", real_wrbytes,
+ wrbytes - real_wrbytes);
+
printf("Success to write %d bytes\n", real_wrbytes);
release_stm_resource(&g_stm_dev);