From 6b28a07e6bba885b3f33e7b81d3e76544f18ce07 Mon Sep 17 00:00:00 2001 From: Timo Dritschler Date: Mon, 28 Apr 2014 19:24:44 +0200 Subject: Added new function 'kiro_trb_dma_push' that allows the user to directly write a new element into the buffers memory Changed the name of 'kiro_trb_ingest' to 'kiro_trb_adopt' Added new function 'kiro_trb_clone' that copies the pointed memory before 'adopting' it. Started to add documentation --- test.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test.c') diff --git a/test.c b/test.c index 56ed5cf..4aac2f5 100644 --- a/test.c +++ b/test.c @@ -31,16 +31,16 @@ int main(void) void *buffer = kiro_trb_get_raw_buffer(rb); uint64_t foo = 0xAFFED00F; uint64_t bar = 0x1337BEEF; - kiro_trb_push(rb, &foo); - kiro_trb_push(rb, &foo); - kiro_trb_push(rb, &foo); + memcpy(kiro_trb_dma_push(rb), &foo, sizeof(foo)); + memcpy(kiro_trb_dma_push(rb), &foo, sizeof(foo)); + memcpy(kiro_trb_dma_push(rb), &foo, sizeof(foo)); kiro_trb_push(rb, &bar); kiro_trb_push(rb, &foo); kiro_trb_push(rb, &foo); uint64_t *maman = kiro_trb_get_element(rb, 3); printf("Stored in old: %x\n", *maman); KiroTrb *rb2 = g_object_new(KIRO_TYPE_TRB, NULL); - kiro_trb_ingest(rb2, kiro_trb_get_raw_buffer(rb)); + kiro_trb_clone(rb2, kiro_trb_get_raw_buffer(rb)); maman = kiro_trb_get_element(rb2, 3); printf("Stored in New: %x\n", *maman); sleep(1); -- cgit v1.2.3