Changeset 357b5f5 in mainline for uspace/lib/c/include/device/hw_res.h


Ignore:
Timestamp:
2011-01-23T20:09:13Z (13 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fdb9982c
Parents:
cead2aa (diff), 7e36c8d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/device/hw_res.h

    rcead2aa r357b5f5  
    2727 */
    2828 
    29  /** @addtogroup libc
     29/** @addtogroup libc
    3030 * @{
    3131 */
     
    3939#include <bool.h>
    4040
    41 // HW resource provider interface
     41/** HW resource provider interface */
     42typedef enum {
     43        HW_RES_GET_RESOURCE_LIST = 0,
     44        HW_RES_ENABLE_INTERRUPT
     45} hw_res_method_t;
    4246
    43 typedef enum {
    44         GET_RESOURCE_LIST = 0,
    45         ENABLE_INTERRUPT       
    46 } hw_res_funcs_t;
    47 
    48 /** HW resource types. */
     47/** HW resource types */
    4948typedef enum {
    5049        INTERRUPT,
     
    5857} endianness_t;
    5958
    60 
    61 /** HW resource (e.g. interrupt, memory register, i/o register etc.). */
    62 typedef struct hw_resource {
     59/** HW resource (e.g. interrupt, memory register, i/o register etc.) */
     60typedef struct {
    6361        hw_res_type_t type;
    6462        union {
    6563                struct {
    6664                        uint64_t address;
    67                         endianness_t endianness;                       
    68                         size_t size;                   
     65                        endianness_t endianness;
     66                        size_t size;
    6967                } mem_range;
     68
    7069                struct {
    7170                        uint64_t address;
    72                         endianness_t endianness;                       
    73                         size_t size;                   
     71                        endianness_t endianness;
     72                        size_t size;
    7473                } io_range;
     74
    7575                struct {
    76                         int irq;                       
    77                 } interrupt;           
    78         } res; 
     76                        int irq;
     77                } interrupt;
     78        } res;
    7979} hw_resource_t;
    8080
    81 typedef struct hw_resource_list {
     81typedef struct {
    8282        size_t count;
    83         hw_resource_t *resources;       
     83        hw_resource_t *resources;
    8484} hw_resource_list_t;
    8585
    86 static inline void clean_hw_resource_list(hw_resource_list_t *hw_res)
     86static inline void hw_res_clean_resource_list(hw_resource_list_t *hw_res)
    8787{
    88         if(NULL != hw_res->resources) {
     88        if (hw_res->resources != NULL) {
    8989                free(hw_res->resources);
     90
    9091                hw_res->resources = NULL;
    9192        }
    92         hw_res->count = 0;     
     93
     94        hw_res->count = 0;
    9395}
    9496
    95 
    96 
    97 bool get_hw_resources(int dev_phone, hw_resource_list_t *hw_resources);
    98 
    99 bool enable_interrupt(int dev_phone);
    100 
     97extern int hw_res_get_resource_list(int, hw_resource_list_t *);
     98extern bool hw_res_enable_interrupt(int);
    10199
    102100#endif
Note: See TracChangeset for help on using the changeset viewer.