Changes in uspace/drv/platform/msim/msim.c [1569a9b:676e833] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/platform/msim/msim.c
r1569a9b r676e833 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> 40 48 #include <ddf/driver.h> 41 49 #include <ddf/log.h> 42 #include <errno.h>43 50 #include <ipc/dev_iface.h> 44 51 #include <ops/hw_res.h> 45 52 #include <ops/pio_window.h> 46 #include <stdbool.h>47 #include <stdio.h>48 53 49 54 #define NAME "msim" 50 55 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 56 #define MSIM_DISK_BASE UINT32_C(0x10000200) 57 #define MSIM_DISK_SIZE UINT32_C(0x00000010) 58 58 59 59 typedef struct msim_fun { … … 65 65 static void msim_init(void); 66 66 67 /** Standard driveroperations. */67 /** The root device driver's standard operations. */ 68 68 static driver_ops_t msim_ops = { 69 69 .dev_add = &msim_dev_add 70 70 }; 71 71 72 /** Driver structure. */72 /** The root device driver structure. */ 73 73 static driver_t msim_driver = { 74 74 .name = NAME, … … 89 89 .type = INTERRUPT, 90 90 .res.interrupt = { 91 .irq = MSIM_DDISK_IRQ91 .irq = 6 92 92 } 93 93 } … … 101 101 .pio_window = { 102 102 .mem = { 103 .base = MSIM_D DISK_BASE,104 .size = MSIM_D DISK_SIZE103 .base = MSIM_DISK_BASE, 104 .size = MSIM_DISK_SIZE 105 105 } 106 106 } 107 107 }; 108 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_ENDIAN117 }118 },119 {120 .type = INTERRUPT,121 .res.interrupt = {122 .irq = MSIM_KBD_IRQ123 }124 }125 };126 127 static msim_fun_t console_data = {128 .hw_resources = {129 sizeof(console_regs) / sizeof(console_regs[0]),130 console_regs131 },132 .pio_window = {133 .mem = {134 .base = MSIM_KBD_ADDRESS,135 .size = MSIM_KBD_SIZE136 }137 }138 };139 140 109 /** Obtain function soft-state from DDF function node */ 141 110 static msim_fun_t *msim_fun(ddf_fun_t *fnode) … … 156 125 /* Nothing to do. */ 157 126 158 return EOK;127 return true; 159 128 } 160 129 … … 194 163 195 164 msim_fun_t *fun = ddf_fun_data_alloc(fnode, sizeof(msim_fun_t)); 196 if (fun == NULL)197 goto failure;198 199 165 *fun = *fun_proto; 200 166 … … 228 194 if (!msim_add_fun(dev, "disk0", "msim/ddisk", &disk_data)) 229 195 return false; 230 if (!msim_add_fun(dev, "console", "msim/console", & console_data))196 if (!msim_add_fun(dev, "console", "msim/console", &disk_data)) 231 197 return false; 232 198 return true; 233 199 } 234 200 235 /** Add MSIM platform device. 236 * 237 * @param dev DDF device 238 * @return Zero on success or non-zero error code. 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. 239 206 */ 240 207 static int msim_dev_add(ddf_dev_t *dev)
Note:
See TracChangeset
for help on using the changeset viewer.