Subversion Repositories freemyipod

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
465 theseven 1
//
2
//
3
//    Copyright 2011 TheSeven
4
//
5
//
6
//    This file is part of emCORE.
7
//
8
//    emCORE is free software: you can redistribute it and/or
9
//    modify it under the terms of the GNU General Public License as
10
//    published by the Free Software Foundation, either version 2 of the
11
//    License, or (at your option) any later version.
12
//
13
//    emCORE is distributed in the hope that it will be useful,
14
//    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
//    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
//    See the GNU General Public License for more details.
17
//
18
//    You should have received a copy of the GNU General Public License along
19
//    with emCORE.  If not, see <http://www.gnu.org/licenses/>.
20
//
21
//
22
 
23
 
24
#ifndef __LIBRARY_H__
25
#define __LIBRARY_H__
26
 
27
 
28
#ifdef _TOOL
29
#include <stdint.h>
30
#else
31
#include "global.h"
32
#include "thread.h"
33
#endif
34
 
35
 
36
#define EMCORELIB_HEADER_VERSION 1
37
struct emcorelib_header
38
{
39
    uint32_t headerversion;
40
    uint32_t identifier;
41
	uint32_t version;
467 theseven 42
	uint32_t minversion;
468 theseven 43
    int (*setupfunc)();
465 theseven 44
    int (*initfunc)();
45
    int (*shutdownfunc)();
46
    void* api;
47
};
48
 
49
struct library_handle
50
{
51
    struct library_handle* next;
52
    struct emcorelib_header* lib;
53
    void* alloc;
54
    void* users[16];
55
    void** moreusers;
56
    size_t moreusers_size;
57
};
58
 
59
enum library_sourcetype
60
{
466 theseven 61
    LIBSOURCE_NONE = 0,
465 theseven 62
    LIBSOURCE_RAM_ALLOCED = 1,
63
    LIBSOURCE_RAM_NEEDCOPY = 2,
64
    LIBSOURCE_BOOTFLASH = 3,
65
    LIBSOURCE_FILESYSTEM = 4
66
};
67
 
68
 
69
#ifndef _TOOL
835 theseven 70
struct library_handle* library_register(void* image, struct emcorelib_header* header,
71
                                        int argc, const char** argv);
489 theseven 72
int library_unload(struct emcorelib_header* lib);
467 theseven 73
struct emcorelib_header* get_library(uint32_t identifier, uint32_t version,
465 theseven 74
                                     enum library_sourcetype sourcetype, void* source);
467 theseven 75
struct emcorelib_header* get_library_ext(uint32_t identifier, uint32_t version,
76
                                         enum library_sourcetype sourcetype, void* source,
77
                                         struct scheduler_thread* owner);
465 theseven 78
int release_library(struct emcorelib_header* lib);
79
int release_library_ext(struct emcorelib_header* lib, struct scheduler_thread* owner);
80
int library_release_all_of_thread(struct scheduler_thread* thread);
81
#endif
82
 
83
 
84
#endif