Changes in uspace/drv/platform/msim/msim.c [676e833:1569a9b] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/platform/msim/msim.c
r676e833 r1569a9b 38 38 39 39 #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>48 40 #include <ddf/driver.h> 49 41 #include <ddf/log.h> 42 #include <errno.h> 50 43 #include <ipc/dev_iface.h> 51 44 #include <ops/hw_res.h> 52 45 #include <ops/pio_window.h> 46 #include <stdbool.h> 47 #include <stdio.h> 53 48 54 49 #define NAME "msim" 55 50 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 58 58 59 59 typedef struct msim_fun { … … 65 65 static void msim_init(void); 66 66 67 /** The root device driver's standardoperations. */67 /** Standard driver operations. */ 68 68 static driver_ops_t msim_ops = { 69 69 .dev_add = &msim_dev_add 70 70 }; 71 71 72 /** The root device driver structure. */72 /** Driver structure. */ 73 73 static driver_t msim_driver = { 74 74 .name = NAME, … … 89 89 .type = INTERRUPT, 90 90 .res.interrupt = { 91 .irq = 691 .irq = MSIM_DDISK_IRQ 92 92 } 93 93 } … … 101 101 .pio_window = { 102 102 .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 109 static 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 127 static 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 105 136 } 106 137 } … … 125 156 /* Nothing to do. */ 126 157 127 return true;158 return EOK; 128 159 } 129 160 … … 163 194 164 195 msim_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(msim_fun_t)); 196 if (fun == NULL) 197 goto failure; 198 165 199 *fun = *fun_proto; 166 200 … … 194 228 if (!msim_add_fun(dev, "disk0", "msim/ddisk", &disk_data)) 195 229 return false; 196 if (!msim_add_fun(dev, "console", "msim/console", & disk_data))230 if (!msim_add_fun(dev, "console", "msim/console", &console_data)) 197 231 return false; 198 232 return true; 199 233 } 200 234 201 /** Get the root device. 202 * 203 * @param dev The device which is root of the whole device tree (both 204 * of HW and pseudo devices). 205 * @return Zero on success, negative error number otherwise. 235 /** Add MSIM platform device. 236 * 237 * @param dev DDF device 238 * @return Zero on success or non-zero error code. 206 239 */ 207 240 static int msim_dev_add(ddf_dev_t *dev)
Note:
See TracChangeset
for help on using the changeset viewer.