Initial cut of the open ath9k htc firmware.
[open-ath9k-htc-firmware.git] / target_firmware / magpie_fw_dev / target / inc / adf_os_module.h
1 /**
2  * @ingroup adf_os_public
3  * @file adf_os_module.h
4  * This file abstracts "kernel module" semantics.
5  */
6
7 #ifndef _ADF_OS_MODULE_H
8 #define _ADF_OS_MODULE_H
9
10 #include <adf_os_module_pvt.h>
11
12 typedef a_status_t (*module_init_func_t)(void);
13
14 /**
15  * @brief Specify the module's entry point.
16  */ 
17 #define adf_os_virt_module_init(_mod_init_func)  __adf_os_virt_module_init(_mod_init_func)
18
19 /**
20  * @brief Specify the module's exit point.
21  */ 
22 #define adf_os_virt_module_exit(_mod_exit_func)  __adf_os_virt_module_exit(_mod_exit_func)
23
24 /**
25  * @brief Specify the module's name.
26  */ 
27 #define adf_os_virt_module_name(_name)      __adf_os_virt_module_name(_name)
28
29 /**
30  * @brief Specify the module's dependency on another module.
31  */ 
32 #define adf_os_module_dep(_name,_dep)       __adf_os_module_dep(_name,_dep)
33
34 /**
35  * @brief Export a symbol from a module.
36  */ 
37 #define adf_os_export_symbol(_sym)         __adf_os_export_symbol(_sym)
38      
39 /**
40  * @brief Module parameter of type integer.
41  */ 
42 #define ADF_OS_PARAM_TYPE_INT32             __ADF_OS_PARAM_TYPE_INT32
43
44 /**
45  * @brief Module parameter of type string.
46  */ 
47 #define ADF_OS_PARAM_TYPE_STRING            __ADF_OS_PARAM_TYPE_STRING
48
49 /**
50  * @brief Declare a module parameter. 
51  *
52  * @param[in] name name of the parameter
53  * @param[in] type type of the parameter
54  *
55  * @note These provide the config data defined by the userland
56  * for this device. It can be queried at any time, given the name string
57  * Only two types are supported
58  * ADF_OS_PARAM_TYPE_STRING
59  * ADF_OS_PARAM_TYPE_INT32
60  * For example, say, the parameters name "my_int" and "my_name" are of 
61  * variables of type int and string respectively. Then you would declare them 
62  * as follows:
63  * @code
64  * adf_os_declare_param(my_int, ADF_OS_PARAM_TYPE_INT32);
65  * adf_os_declare_param(my_name, ADF_OS_PARAM_TYPE_STRING);
66  * @endcode
67  * To read the userland provided config value, you would do something like
68  *
69  * @code
70  * adf_os_read_param(my_name, &softc->sc_my_name);
71  * @endcode
72  *
73  * or 
74  * @code
75  * st = adf_os_read_param(my_int, &softc->sc_my_int);
76  * @endcode
77  * st could be :
78  *
79  * A_STATUS_OK
80  * A_STATUS_ENOMEM
81  * A_STATUS_ENOENT
82  *
83  */
84 #define adf_os_declare_param(_name, _type) __adf_os_declare_param(_name, _type)
85
86 /**
87  * @brief Read a parameter's value
88  *
89  * @param[in]  osdev    os handle
90  * @param[in]  name     name of parameter
91  * @param[in]  type     type of parameter
92  * @param[out] val      value read
93  *
94  * @note pval is a point to the variable. Therefore,
95  * for strings it is a_uint8_t **
96  * for integers it is a_int_t *
97  */
98 #define adf_os_read_param(_osdev, _name, _type, _pval)        \
99                         __adf_os_read_param(_osdev, _name, _type, _pval)
100
101 #endif /*_ADF_OS_MODULE_H*/