1 /*
2  * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>
3  *     economic rights: Technische Universität Dresden (Germany)
4  *
5  * This file is part of TUD:OS and distributed under the terms of the
6  * GNU General Public License 2.
7  * Please see the COPYING-GPL-2 file for details.
8  *
9  * As a special exception, you may use this file as part of a free software
10  * library without restriction.  Specifically, if other files instantiate
11  * templates or use macros or inline functions from this file, or you compile
12  * this file and link it with other files to produce an executable, this
13  * file does not by itself cause the resulting executable to be covered by
14  * the GNU General Public License.  This exception does not however
15  * invalidate any other reasons why the executable file might be covered by
16  * the GNU General Public License.
17  */
18 
19 #include <l4/re/c/video/goos.h>
20 
21 #include <l4/re/video/goos>
22 
23 using namespace L4Re::Video;
24 
25 L4_CV int
l4re_video_goos_create_buffer(l4re_video_goos_t goos,unsigned long size,l4_cap_idx_t buffer)26 l4re_video_goos_create_buffer(l4re_video_goos_t goos, unsigned long size,
27                               l4_cap_idx_t buffer) L4_NOTHROW
28 {
29   L4::Cap<Goos> g(goos);
30   return g->create_buffer(size, L4::Cap<L4Re::Dataspace>(buffer));
31 }
32 
33 L4_CV int
l4re_video_goos_refresh(l4re_video_goos_t goos,int x,int y,int w,int h)34 l4re_video_goos_refresh(l4re_video_goos_t goos, int x, int y, int w,
35                         int h) L4_NOTHROW
36 {
37   L4::Cap<Goos> g(goos);
38   return g->refresh(x, y, w, h);
39 }
40 
41 
42 L4_CV int
l4re_video_goos_delete_buffer(l4re_video_goos_t goos,unsigned idx)43 l4re_video_goos_delete_buffer(l4re_video_goos_t goos, unsigned idx) L4_NOTHROW
44 {
45   L4::Cap<Goos> g(goos);
46   return g->delete_buffer(idx);
47 }
48 
49 L4_CV int
l4re_video_goos_get_static_buffer(l4re_video_goos_t goos,unsigned idx,l4_cap_idx_t buffer)50 l4re_video_goos_get_static_buffer(l4re_video_goos_t goos, unsigned idx,
51                                   l4_cap_idx_t buffer) L4_NOTHROW
52 {
53   L4::Cap<Goos> g(goos);
54   return g->get_static_buffer(idx, L4::Cap<L4Re::Dataspace>(buffer));
55 }
56 
57 L4_CV int
l4re_video_goos_create_view(l4re_video_goos_t goos,l4re_video_view_t * view)58 l4re_video_goos_create_view(l4re_video_goos_t goos,
59                             l4re_video_view_t *view) L4_NOTHROW
60 {
61   L4::Cap<Goos> g(goos);
62   return g->create_view(reinterpret_cast<View*>(view));
63 }
64 
65 L4_CV int
l4re_video_goos_delete_view(l4re_video_goos_t goos,l4re_video_view_t * view)66 l4re_video_goos_delete_view(l4re_video_goos_t goos,
67                             l4re_video_view_t *view) L4_NOTHROW
68 {
69   L4::Cap<Goos> g(goos);
70   return g->delete_view(*reinterpret_cast<View*>(view));
71 }
72 
73 L4_CV int
l4re_video_goos_get_view(l4re_video_goos_t goos,unsigned idx,l4re_video_view_t * view)74 l4re_video_goos_get_view(l4re_video_goos_t goos, unsigned idx,
75                          l4re_video_view_t *view) L4_NOTHROW
76 {
77   L4::Cap<Goos> g(goos);
78   *reinterpret_cast<View*>(view) = g->view(idx);
79   return 0;
80 }
81 
82