Changeset 7de5f12 in mainline for uspace/drv/platform/msim/msim.c


Ignore:
Timestamp:
2017-11-15T20:23:50Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6ac1243d, 7f4937e
Parents:
e7a8bd2
Message:

MSIM console driver can use hw_res instead of sysinfo for configuration.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/platform/msim/msim.c

    re7a8bd2 r7de5f12  
    3838
    3939#include <assert.h>
    40 #include <stdio.h>
    41 #include <errno.h>
    42 #include <stdbool.h>
    43 #include <stdlib.h>
    44 #include <ctype.h>
    45 #include <macros.h>
    46 
    47 #include <ddi.h>
    4840#include <ddf/driver.h>
    4941#include <ddf/log.h>
     42#include <errno.h>
    5043#include <ipc/dev_iface.h>
    5144#include <ops/hw_res.h>
    5245#include <ops/pio_window.h>
     46#include <stdbool.h>
     47#include <stdio.h>
    5348
    5449#define NAME "msim"
    5550
    56 #define MSIM_DISK_BASE  UINT32_C(0x10000200)
    57 #define MSIM_DISK_SIZE  UINT32_C(0x00000010)
     51#define MSIM_DDISK_BASE UINT32_C(0x10000200)
     52#define MSIM_DDISK_SIZE UINT32_C(0x00000010)
     53#define MSIM_DDISK_IRQ 6
     54
     55#define MSIM_KBD_ADDRESS UINT32_C(0x10000000)
     56#define MSIM_KBD_SIZE 1
     57#define MSIM_KBD_IRQ 2
    5858
    5959typedef struct msim_fun {
     
    8989                .type = INTERRUPT,
    9090                .res.interrupt = {
    91                         .irq = 6
     91                        .irq = MSIM_DDISK_IRQ
    9292                }
    9393        }
     
    101101        .pio_window = {
    102102                .mem = {
    103                         .base = MSIM_DISK_BASE,
    104                         .size = MSIM_DISK_SIZE
     103                        .base = MSIM_DDISK_BASE,
     104                        .size = MSIM_DDISK_SIZE
     105                }
     106        }
     107};
     108
     109static hw_resource_t console_regs[] = {
     110        {
     111                .type = MEM_RANGE,
     112                .res.mem_range = {
     113                        .address = 0,
     114                        .size = 1,
     115                        .relative = true,
     116                        .endianness = LITTLE_ENDIAN
     117                }
     118        },
     119        {
     120                .type = INTERRUPT,
     121                .res.interrupt = {
     122                        .irq = MSIM_KBD_IRQ
     123                }
     124        }
     125};
     126
     127static msim_fun_t console_data = {
     128        .hw_resources = {
     129                sizeof(console_regs) / sizeof(console_regs[0]),
     130                console_regs
     131        },
     132        .pio_window = {
     133                .mem = {
     134                        .base = MSIM_KBD_ADDRESS,
     135                        .size = MSIM_KBD_SIZE
    105136                }
    106137        }
     
    194225        if (!msim_add_fun(dev, "disk0", "msim/ddisk", &disk_data))
    195226                return false;
    196         if (!msim_add_fun(dev, "console", "msim/console", &disk_data))
     227        if (!msim_add_fun(dev, "console", "msim/console", &console_data))
    197228                return false;
    198229        return true;
Note: See TracChangeset for help on using the changeset viewer.