1 /* 2 (c) Copyright 2001-2009 The world wide DirectFB Open Source Community (directfb.org) 3 (c) Copyright 2000-2004 Convergence (integrated media) GmbH 4 5 All rights reserved. 6 7 Written by Denis Oliver Kropp <dok@directfb.org>, 8 Andreas Hundt <andi@fischlustig.de>, 9 Sven Neumann <neo@directfb.org>, 10 Ville Syrjälä <syrjala@sci.fi> and 11 Claudio Ciccani <klan@users.sf.net>. 12 13 This library is free software; you can redistribute it and/or 14 modify it under the terms of the GNU Lesser General Public 15 License as published by the Free Software Foundation; either 16 version 2 of the License, or (at your option) any later version. 17 18 This library is distributed in the hope that it will be useful, 19 but WITHOUT ANY WARRANTY; without even the implied warranty of 20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 21 Lesser General Public License for more details. 22 23 You should have received a copy of the GNU Lesser General Public 24 License along with this library; if not, write to the 25 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 26 Boston, MA 02111-1307, USA. 27 */ 28 29 #ifndef __CORE_PARTS_H__ 30 #define __CORE_PARTS_H__ 31 32 #include <fusion/types.h> 33 #include <fusion/lock.h> 34 35 #include <directfb.h> 36 37 #include <core/coretypes.h> 38 #include <core/coredefs.h> 39 40 41 typedef DFBResult (*CoreInitialize)( CoreDFB *core, 42 void *data_local, 43 void *data_shared ); 44 45 typedef DFBResult (*CoreJoin) ( CoreDFB *core, 46 void *data_local, 47 void *data_shared ); 48 49 typedef DFBResult (*CoreShutdown) ( void *data_local, 50 bool emergency ); 51 52 typedef DFBResult (*CoreLeave) ( void *data_local, 53 bool emergency ); 54 55 typedef DFBResult (*CoreSuspend) ( void *data_local ); 56 57 typedef DFBResult (*CoreResume) ( void *data_local ); 58 59 60 typedef struct { 61 const char *name; 62 63 int size_local; 64 int size_shared; 65 66 CoreInitialize Initialize; 67 CoreJoin Join; 68 CoreShutdown Shutdown; 69 CoreLeave Leave; 70 CoreSuspend Suspend; 71 CoreResume Resume; 72 73 void *data_local; 74 void *data_shared; 75 76 bool initialized; 77 } CorePart; 78 79 80 DFBResult dfb_core_part_initialize( CoreDFB *core, 81 CorePart *core_part ); 82 83 DFBResult dfb_core_part_join ( CoreDFB *core, 84 CorePart *core_part ); 85 86 DFBResult dfb_core_part_shutdown ( CoreDFB *core, 87 CorePart *core_part, 88 bool emergency ); 89 90 DFBResult dfb_core_part_leave ( CoreDFB *core, 91 CorePart *core_part, 92 bool emergency ); 93 94 95 #define DFB_CORE_PART(part,Type) \ 96 \ 97 static DFBResult dfb_##part##_initialize( CoreDFB *core, \ 98 DFB##Type *local, \ 99 DFB##Type##Shared *shared ); \ 100 \ 101 static DFBResult dfb_##part##_join ( CoreDFB *core, \ 102 DFB##Type *local, \ 103 DFB##Type##Shared *shared ); \ 104 \ 105 static DFBResult dfb_##part##_shutdown ( DFB##Type *local, \ 106 bool emergency ); \ 107 \ 108 static DFBResult dfb_##part##_leave ( DFB##Type *local, \ 109 bool emergency ); \ 110 \ 111 static DFBResult dfb_##part##_suspend ( DFB##Type *local ); \ 112 \ 113 static DFBResult dfb_##part##_resume ( DFB##Type *local ); \ 114 \ 115 CorePart dfb_##part = { \ 116 .name = #part, \ 117 \ 118 .size_local = sizeof(DFB##Type), \ 119 .size_shared = sizeof(DFB##Type##Shared), \ 120 \ 121 .Initialize = (void*)dfb_##part##_initialize, \ 122 .Join = (void*)dfb_##part##_join, \ 123 .Shutdown = (void*)dfb_##part##_shutdown, \ 124 .Leave = (void*)dfb_##part##_leave, \ 125 .Suspend = (void*)dfb_##part##_suspend, \ 126 .Resume = (void*)dfb_##part##_resume, \ 127 } 128 129 130 #endif 131 132