source: trunk/kernel/drivers/soclib/drvdb.h @ 1

Last change on this file since 1 was 1, checked in by alain, 7 years ago

First import

File size: 4.4 KB
Line 
1/*
2 * drvdb.h - a dictionary of supported devices and their drivers
3 *
4 * Copyright (c) 2008,2009,2010,2011,2012 Ghassan Almaless
5 * Copyright (c) 2011,2012 UPMC Sorbonne Universites
6 *
7 * This file is part of ALMOS-kernel.
8 *
9 * ALMOS-kernel is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; version 2.0 of the License.
12 *
13 * ALMOS-kernel is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with ALMOS-kernel; if not, write to the Free Software Foundation,
20 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#ifndef _DRVDB_H_
24#define _DRVDB_H_
25
26#include <driver.h>
27
28
29/******************************************************************************************
30 * This enum defines the Supported Drivers types
31 * This enum must be kept consistent with the global array in drvdb.c file
32 *****************************************************************************************/
33
34typedef enum
35{
36        SOCLIB_RAM_ID = 0,
37        SOCLIB_XICU_ID,
38        SOCLIB_TTY_ID,
39        SOCLIB_DMA_ID,
40        SOCLIB_BLKDEV_ID,
41        SOCLIB_FB_ID,
42        SOCLIB_ICU_ID,
43        SOCLIB_TIMER_ID,
44        SOCLIB_IOPIC_ID,
45        SOCLIB_MEMC_ID,
46        SOCLIB_MNIC_ID,
47        SOCLIB_CHDMA_ID,
48        SOCLIB_RESERVED_ID,
49        SOCLIB_DRVID_NR
50}soclib_drvid_t;
51
52/* Driver DataBase Entry */
53struct drvdb_entry_s;
54
55/* Entry Setters */
56#define drvdb_entry_set_id(entry,drvid)
57#define drvdb_entry_set_name(entry,name)
58#define drvdb_entry_set_info(entry,info)
59#define drvdb_entry_set_driver(entry,driver)
60
61/* Entry Getters */
62#define drvdb_entry_get_id(entry)
63#define drvdb_entry_get_name(entry)
64#define drvdb_entry_get_info(entry)
65#define drvdb_entry_get_driver(entry)
66
67
68/******************************************************************************************
69 * This structure define a Driver descriptor
70 *****************************************************************************************/
71typedef struct drvdb_entry_s
72{
73        uint32_t   id;
74        char     * name;
75        char     * info;
76        driver_t * driver;
77}
78drvdb_entry_t;
79
80
81#define drvdb_entry_get_id(_entry)       ((_entry)->id)
82#define drvdb_entry_get_name(_entry)     ((_entry)->name)
83#define drvdb_entry_get_info(_entry)     ((_entry)->info)
84#define drvdb_entry_get_driver(_entry)   ((_entry)->driver)
85
86#define drvdb_entry_set_id(_entry,_drvid)      do {(_entry)->id = (_drvid);}      while(0)
87#define drvdb_entry_set_name(_entry,_name)     do {(_entry)->name = (_name);}     while(0)
88#define drvdb_entry_set_info(_entry,_info)     do {(_entry)->info = (_info);}     while(0)
89#define drvdb_entry_set_driver(_entry,_driver) do {(_entry)->driver = (_driver);} while(0)
90
91/******************************************************************************************
92 * This function returns a pointer on driver descriptor from its index.
93 * @ drvid   : index in the drivers descriptors array.
94 *****************************************************************************************/
95drvdb_entry_t * drvdb_locate_byId( uint32_t drvid );
96
97/******************************************************************************************
98 * This function returns a pointer on driver descriptor from its name.
99 * @ name    : name in the drivers descriptors array.
100 *****************************************************************************************/
101drvdb_entry_t * drvdb_locate_byName( char * name );
102
103/******************************************************************************************
104 * This function register a driver pointer in the driver descriptors array.
105 * @ drvid    : index in the drivers descriptors array.
106 * @ driver   : function pointer to be registered.
107 *****************************************************************************************/
108error_t drvdb_set_driver( uint32_t   drvid, 
109                          driver_t * driver );
110
111/******************************************************************************************
112 * This function returns a driver pointer from the driver index
113 * @ drvid    : index in the drivers descriptors array.
114 * @ returns  function pointer to be registered.
115 *****************************************************************************************/
116driver_t * drvdb_get_driver( uint32_t drvid );
117
118#endif  /* _DRVDB_H_ */
Note: See TracBrowser for help on using the repository browser.