Changes in / [d6b1359:0c70f7e] in mainline


Ignore:
Location:
uspace
Files:
8 added
8 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/tester/hw/misc/virtchar1.c

    rd6b1359 r0c70f7e  
    4040#include <sys/types.h>
    4141#include <async.h>
    42 #include <device/char_dev.h>
     42#include <device/char.h>
    4343#include <str.h>
    4444#include <vfs/vfs.h>
    4545#include <sys/stat.h>
    4646#include <fcntl.h>
     47#include <device/char.h>
    4748#include "../../tester.h"
    4849
     
    7879        size_t i;
    7980        char buffer[BUFFER_SIZE];
    80         char_dev_read(phone, buffer, BUFFER_SIZE);
     81        read_dev(phone, buffer, BUFFER_SIZE);
    8182        TPRINTF(" ...verifying that we read zeroes only...\n");
    8283        for (i = 0; i < BUFFER_SIZE; i++) {
  • uspace/app/tester/hw/serial/serial1.c

    rd6b1359 r0c70f7e  
    4545#include <ipc/devman.h>
    4646#include <devman.h>
    47 #include <device/char_dev.h>
     47#include <device/char.h>
    4848#include <str.h>
    4949#include <ipc/serial_ctl.h>
     
    121121        size_t total = 0;
    122122        while (total < cnt) {
    123                 ssize_t read = char_dev_read(phone, buf, cnt - total);
     123                ssize_t read = read_dev(phone, buf, cnt - total);
    124124               
    125125                if (read < 0) {
     
    152152                         * direction of data transfer.
    153153                         */
    154                         ssize_t written = char_dev_write(phone, buf, read);
     154                        ssize_t written = write_dev(phone, buf, read);
    155155                       
    156156                        if (written < 0) {
     
    181181       
    182182        size_t eot_size = str_size(EOT);
    183         ssize_t written = char_dev_write(phone, (void *) EOT, eot_size);
     183        ssize_t written = write_dev(phone, (void *) EOT, eot_size);
    184184       
    185185        ipc_call_sync_4_0(phone, SERIAL_SET_COM_PROPS, old_baud,
  • uspace/drv/isa/isa.c

    rd6b1359 r0c70f7e  
    5151
    5252#include <driver.h>
    53 #include <ops/hw_res.h>
     53#include <resource.h>
    5454
    5555#include <devman.h>
     
    8484}
    8585
    86 static hw_res_ops_t isa_child_hw_res_ops = {
     86static resource_iface_t isa_child_res_iface = {
    8787        &isa_get_child_resources,
    8888        &isa_enable_child_interrupt
     
    502502static void isa_init()
    503503{
    504         isa_child_dev_ops.interfaces[HW_RES_DEV_IFACE] = &isa_child_hw_res_ops;
     504        isa_child_dev_ops.interfaces[HW_RES_DEV_IFACE] = &isa_child_res_iface;
    505505}
    506506
  • uspace/drv/ns8250/ns8250.c

    rd6b1359 r0c70f7e  
    5353
    5454#include <driver.h>
    55 #include <ops/char_dev.h>
     55#include <char.h>
     56#include <resource.h>
    5657
    5758#include <devman.h>
     
    226227
    227228/** The character interface's callbacks. */
    228 static char_dev_ops_t ns8250_char_dev_ops = {
     229static char_iface_t ns8250_char_iface = {
    229230        .read = &ns8250_read,
    230231        .write = &ns8250_write
     
    346347       
    347348        /* Get hw resources. */
    348         ret = hw_res_get_resource_list(dev->parent_phone, &hw_resources);
     349        ret = get_hw_resources(dev->parent_phone, &hw_resources);
    349350        if (ret != EOK) {
    350351                printf(NAME ": failed to get hw resources for the device "
     
    393394        }
    394395       
    395         hw_res_clean_resource_list(&hw_resources);
     396        clean_hw_resource_list(&hw_resources);
    396397        return ret;
    397398       
    398399failed:
    399400        ns8250_dev_cleanup(dev);
    400         hw_res_clean_resource_list(&hw_resources);
     401        clean_hw_resource_list(&hw_resources);
    401402        return ret;
    402403}
     
    923924        ns8250_dev_ops.close = &ns8250_close;
    924925       
    925         ns8250_dev_ops.interfaces[CHAR_DEV_IFACE] = &ns8250_char_dev_ops;
     926        ns8250_dev_ops.interfaces[CHAR_DEV_IFACE] = &ns8250_char_iface;
    926927        ns8250_dev_ops.default_handler = &ns8250_default_handler;
    927928}
  • uspace/drv/pciintel/pci.c

    rd6b1359 r0c70f7e  
    4949#include <ipc/devman.h>
    5050#include <ipc/dev_iface.h>
    51 #include <ops/hw_res.h>
     51#include <resource.h>
    5252#include <device/hw_res.h>
    5353#include <ddi.h>
     
    7777}
    7878
    79 static hw_res_ops_t pciintel_child_hw_res_ops = {
     79static resource_iface_t pciintel_child_res_iface = {
    8080        &pciintel_get_child_resources,
    8181        &pciintel_enable_child_interrupt
     
    473473        hw_resource_list_t hw_resources;
    474474       
    475         rc = hw_res_get_resource_list(dev->parent_phone, &hw_resources);
     475        rc = get_hw_resources(dev->parent_phone, &hw_resources);
    476476        if (rc != EOK) {
    477477                printf(NAME ": pci_add_device failed to get hw resources for "
     
    497497                delete_pci_bus_data(bus_data);
    498498                ipc_hangup(dev->parent_phone);
    499                 hw_res_clean_resource_list(&hw_resources);
     499                clean_hw_resource_list(&hw_resources);
    500500                return EADDRNOTAVAIL;
    501501        }
     
    508508        pci_bus_scan(dev, 0);
    509509       
    510         hw_res_clean_resource_list(&hw_resources);
     510        clean_hw_resource_list(&hw_resources);
    511511       
    512512        return EOK;
     
    515515static void pciintel_init(void)
    516516{
    517         pci_child_ops.interfaces[HW_RES_DEV_IFACE] = &pciintel_child_hw_res_ops;
     517        pci_child_ops.interfaces[HW_RES_DEV_IFACE] = &pciintel_child_res_iface;
    518518}
    519519
     
    537537{
    538538        if (dev_data != NULL) {
    539                 hw_res_clean_resource_list(&dev_data->hw_resources);
     539                clean_hw_resource_list(&dev_data->hw_resources);
    540540                free(dev_data);
    541541        }
  • uspace/drv/rootpc/rootpc.c

    rd6b1359 r0c70f7e  
    5050#include <ipc/devman.h>
    5151#include <ipc/dev_iface.h>
    52 #include <ops/hw_res.h>
     52#include <resource.h>
    5353#include <device/hw_res.h>
    5454
     
    107107}
    108108
    109 static hw_res_ops_t child_hw_res_ops = {
     109static resource_iface_t child_res_iface = {
    110110        &rootpc_get_child_resources,
    111111        &rootpc_enable_child_interrupt
     
    190190static void root_pc_init(void)
    191191{
    192         rootpc_child_ops.interfaces[HW_RES_DEV_IFACE] = &child_hw_res_ops;
     192        rootpc_child_ops.interfaces[HW_RES_DEV_IFACE] = &child_res_iface;
    193193}
    194194
  • uspace/drv/test1/char.c

    rd6b1359 r0c70f7e  
    3333#include <errno.h>
    3434#include <mem.h>
    35 #include <ops/char_dev.h>
     35#include <char.h>
    3636
    3737#include "test1.h"
     
    4646}
    4747
    48 static char_dev_ops_t char_dev_ops = {
     48static char_iface_t char_interface = {
    4949        .read = &impl_char_read,
    5050        .write = &imp_char_write
     
    5252
    5353device_ops_t char_device_ops = {
    54         .interfaces[CHAR_DEV_IFACE] = &char_dev_ops
     54        .interfaces[CHAR_DEV_IFACE] = &char_interface
    5555};
    5656
  • uspace/lib/c/Makefile

    rd6b1359 r0c70f7e  
    5959        generic/devman.c \
    6060        generic/device/hw_res.c \
    61         generic/device/char_dev.c \
     61        generic/device/char.c \
    6262        generic/event.c \
    6363        generic/errno.c \
  • uspace/lib/c/generic/device/hw_res.c

    rd6b1359 r0c70f7e  
    2626 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    2727 */
    28 
     28 
    2929 /** @addtogroup libc
    3030 * @{
     
    3232/** @file
    3333 */
    34 
     34 
    3535#include <device/hw_res.h>
    3636#include <errno.h>
     
    3838#include <malloc.h>
    3939
    40 int hw_res_get_resource_list(int dev_phone, hw_resource_list_t *hw_resources)
     40int get_hw_resources(int dev_phone, hw_resource_list_t *hw_resources)
    4141{
    4242        sysarg_t count = 0;
    43 
    44         int rc = async_req_1_1(dev_phone, DEV_IFACE_ID(HW_RES_DEV_IFACE),
    45             HW_RES_GET_RESOURCE_LIST, &count);
    46 
     43        int rc = async_req_1_1(dev_phone, DEV_IFACE_ID(HW_RES_DEV_IFACE), GET_RESOURCE_LIST, &count);
    4744        hw_resources->count = count;
    4845        if (rc != EOK)
     
    6057                return rc;
    6158        }
    62        
     59                 
    6360        return EOK;
    6461}
    6562
    66 bool hw_res_enable_interrupt(int dev_phone)
     63bool enable_interrupt(int dev_phone)
    6764{
    68         int rc = async_req_1_0(dev_phone, DEV_IFACE_ID(HW_RES_DEV_IFACE),
    69             HW_RES_ENABLE_INTERRUPT);
    70 
     65        int rc = async_req_1_0(dev_phone, DEV_IFACE_ID(HW_RES_DEV_IFACE), ENABLE_INTERRUPT);
    7166        return rc == EOK;
    7267}
    73 
    74 /** @}
     68 
     69 
     70 
     71 /** @}
    7572 */
  • uspace/lib/c/include/device/hw_res.h

    rd6b1359 r0c70f7e  
    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
     42
    4243typedef enum {
    43         HW_RES_GET_RESOURCE_LIST = 0,
    44         HW_RES_ENABLE_INTERRUPT
    45 } hw_res_method_t;
     44        GET_RESOURCE_LIST = 0,
     45        ENABLE_INTERRUPT       
     46} hw_res_funcs_t;
    4647
    47 /** HW resource types */
     48/** HW resource types. */
    4849typedef enum {
    4950        INTERRUPT,
     
    5758} endianness_t;
    5859
    59 /** HW resource (e.g. interrupt, memory register, i/o register etc.) */
    60 typedef struct {
     60
     61/** HW resource (e.g. interrupt, memory register, i/o register etc.). */
     62typedef struct hw_resource {
    6163        hw_res_type_t type;
    6264        union {
    6365                struct {
    6466                        uint64_t address;
    65                         endianness_t endianness;
    66                         size_t size;
     67                        endianness_t endianness;                       
     68                        size_t size;                   
    6769                } mem_range;
    68 
    6970                struct {
    7071                        uint64_t address;
    71                         endianness_t endianness;
    72                         size_t size;
     72                        endianness_t endianness;                       
     73                        size_t size;                   
    7374                } 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 {
     81typedef struct hw_resource_list {
    8282        size_t count;
    83         hw_resource_t *resources;
     83        hw_resource_t *resources;       
    8484} hw_resource_list_t;
    8585
    86 static inline void hw_res_clean_resource_list(hw_resource_list_t *hw_res)
     86static inline void clean_hw_resource_list(hw_resource_list_t *hw_res)
    8787{
    88         if (hw_res->resources != NULL) {
     88        if(NULL != hw_res->resources) {
    8989                free(hw_res->resources);
    90 
    9190                hw_res->resources = NULL;
    9291        }
    93 
    94         hw_res->count = 0;
     92        hw_res->count = 0;     
    9593}
    9694
    97 extern int hw_res_get_resource_list(int, hw_resource_list_t *);
    98 extern bool hw_res_enable_interrupt(int);
     95
     96
     97extern int get_hw_resources(int, hw_resource_list_t *);
     98extern bool enable_interrupt(int);
     99
    99100
    100101#endif
  • uspace/lib/c/include/ipc/dev_iface.h

    rd6b1359 r0c70f7e  
    3535#include <libarch/types.h>
    3636
    37 typedef enum {
    38         HW_RES_DEV_IFACE = 0,
     37typedef enum { 
     38        HW_RES_DEV_IFACE = 0,   
    3939        CHAR_DEV_IFACE,
     40        // TODO add more interfaces
    4041        DEV_IFACE_MAX
    4142} dev_inferface_idx_t;
  • uspace/lib/drv/Makefile

    rd6b1359 r0c70f7e  
    3535        generic/driver.c \
    3636        generic/dev_iface.c \
    37         generic/remote_hw_res.c \
    38         generic/remote_char_dev.c
     37        generic/remote_res.c \
     38        generic/remote_char.c
    3939
    4040include $(USPACE_PREFIX)/Makefile.common
  • uspace/lib/drv/generic/dev_iface.c

    rd6b1359 r0c70f7e  
    3737
    3838#include "dev_iface.h"
    39 #include "remote_hw_res.h"
    40 #include "remote_char_dev.h"
     39#include "remote_res.h"
     40#include "remote_char.h"
    4141
    4242static iface_dipatch_table_t remote_ifaces = {
    4343        .ifaces = {
    44                 &remote_hw_res_iface,
    45                 &remote_char_dev_iface
     44                &remote_res_iface,
     45                &remote_char_iface
    4646        }
    4747};
    4848
    4949remote_iface_t* get_remote_iface(int idx)
    50 {
     50{       
    5151        assert(is_valid_iface_idx(idx));
    5252        return remote_ifaces.ifaces[idx];
  • uspace/lib/drv/include/driver.h

    rd6b1359 r0c70f7e  
    4141#include <ipc/devman.h>
    4242#include <ipc/dev_iface.h>
     43#include <device/hw_res.h>
     44#include <device/char.h>
    4345#include <assert.h>
    4446#include <ddi.h>
Note: See TracChangeset for help on using the changeset viewer.