Changeset a416d070 in mainline
- Timestamp:
- 2017-10-16T15:50:37Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 95c675b, b446b02
- Parents:
- 1974f56a
- Files:
-
- 3 added
- 5 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
.bzrignore
r1974f56a ra416d070 1 *.ag.probe.[cs]2 1 *.disasm 3 2 *.la … … 205 204 uspace/dist/drv/hdaudio/ 206 205 uspace/dist/drv/i8042/ 206 uspace/dist/drv/icp/ 207 uspace/dist/drv/icp-ic/ 207 208 uspace/dist/drv/isa/ 208 209 uspace/dist/drv/kfb/ … … 212 213 uspace/dist/drv/pc/ 213 214 uspace/dist/drv/pciintel/ 215 uspace/dist/drv/pl050/ 214 216 uspace/dist/drv/ps2mouse/ 215 217 uspace/dist/drv/root/ … … 274 276 uspace/drv/block/ata_bd/ata_bd 275 277 uspace/drv/block/ddisk/ddisk 278 uspace/drv/bus/adb/cuda_adb/cuda_adb 276 279 uspace/drv/bus/isa/isa 277 280 uspace/drv/bus/pci/pciintel/pciintel … … 293 296 uspace/drv/fb/amdm37x_dispc/amdm37x_dispc 294 297 uspace/drv/fb/kfb/kfb 298 uspace/drv/intctl/icp-ic/icp-ic 295 299 uspace/drv/nic/ar9271/ar9271 296 300 uspace/drv/nic/e1k/e1k … … 318 322 uspace/lib/c/arch/amd64/include/libarch/fibril_context.h 319 323 uspace/lib/c/arch/amd64/include/libarch/istate_struct.h 324 uspace/lib/c/arch/arm32/_link-dlexe.ld 325 uspace/lib/c/arch/arm32/_link-loader.ld 326 uspace/lib/c/arch/arm32/_link-shlib.ld 327 uspace/lib/c/arch/arm32/_link.ld 320 328 uspace/lib/c/arch/arm32/include/libarch/fibril_context.h 321 329 uspace/lib/c/arch/arm32/include/libarch/istate_struct.h … … 376 384 uspace/srv/hw/irc/apic/apic 377 385 uspace/srv/hw/irc/i8259/i8259 378 uspace/srv/hw/irc/icp-ic/icp-ic379 386 uspace/srv/hw/irc/obio/obio 380 387 uspace/srv/klog/klog -
boot/arch/arm32/Makefile.inc
r1974f56a ra416d070 76 76 char/atkbd \ 77 77 char/ps2mouse \ 78 intctl/icp-ic \ 78 79 platform/icp 79 RD_SRVS_ESSENTIAL += \80 $(USPACE_PATH)/srv/hw/irc/icp-ic/icp-ic81 80 endif 82 81 -
uspace/Makefile
r1974f56a ra416d070 137 137 srv/hw/irc/apic \ 138 138 srv/hw/irc/i8259 \ 139 srv/hw/irc/icp-ic \140 139 srv/hw/irc/obio \ 141 140 srv/hid/rfb \ … … 170 169 drv/fb/amdm37x_dispc \ 171 170 drv/fb/kfb \ 171 drv/intctl/icp-ic \ 172 172 drv/nic/ne2k \ 173 173 drv/nic/e1k \ -
uspace/app/init/init.c
r1974f56a ra416d070 340 340 srv_start("/srv/apic"); 341 341 srv_start("/srv/i8259"); 342 srv_start("/srv/icp-ic");343 342 srv_start("/srv/obio"); 344 343 srv_start("/srv/s3c24xx_uart"); -
uspace/drv/intctl/icp-ic/Makefile
r1974f56a ra416d070 27 27 # 28 28 29 USPACE_PREFIX = ../../../.. 29 USPACE_PREFIX = ../../.. 30 LIBS = $(LIBDRV_PREFIX)/libdrv.a 31 EXTRA_CFLAGS += -I$(LIBDRV_PREFIX)/include 30 32 BINARY = icp-ic 31 33 32 34 SOURCES = \ 33 icp-ic.c 35 icp-ic.c \ 36 main.c 34 37 35 38 include $(USPACE_PREFIX)/Makefile.common -
uspace/drv/intctl/icp-ic/icp-ic.c
r1974f56a ra416d070 33 33 /** 34 34 * @file icp-ic.c 35 * @brief IntegratorCP interrupt controller driver .35 * @brief IntegratorCP interrupt controller driver 36 36 */ 37 37 … … 39 39 #include <bitops.h> 40 40 #include <ddi.h> 41 #include <ddf/log.h> 41 42 #include <errno.h> 42 #include <io/log.h>43 43 #include <ipc/irc.h> 44 44 #include <loc.h> 45 #include <sysinfo.h>46 #include <stdio.h>47 45 #include <stdint.h> 48 #include <str.h>49 46 47 #include "icp-ic.h" 50 48 #include "icp-ic_hw.h" 51 49 52 #define NAME "icp-ic"53 54 50 enum { 55 icp_pic_base = 0x14000000,56 51 icpic_max_irq = 32 57 52 }; 58 53 59 static icpic_regs_t *icpic_regs; 60 61 static int icpic_enable_irq(sysarg_t irq) 54 static int icpic_enable_irq(icpic_t *icpic, sysarg_t irq) 62 55 { 63 56 if (irq > icpic_max_irq) 64 57 return EINVAL; 65 58 66 log_msg(LOG_DEFAULT,LVL_NOTE, "Enable IRQ %zu", irq);59 ddf_msg(LVL_NOTE, "Enable IRQ %zu", irq); 67 60 68 pio_write_32(&icpic _regs->irq_enableset, BIT_V(uint32_t, irq));61 pio_write_32(&icpic->regs->irq_enableset, BIT_V(uint32_t, irq)); 69 62 return EOK; 70 63 } 71 64 72 /** Handle one connection to i8259.65 /** Client connection handler. 73 66 * 74 67 * @param iid Hash of the request that opened the connection. … … 80 73 ipc_callid_t callid; 81 74 ipc_call_t call; 75 icpic_t *icpic; 82 76 83 77 /* … … 85 79 */ 86 80 async_answer_0(iid, EOK); 81 82 icpic = (icpic_t *)ddf_dev_data_get(ddf_fun_get_dev((ddf_fun_t *)arg)); 87 83 88 84 while (true) { … … 98 94 case IRC_ENABLE_INTERRUPT: 99 95 async_answer_0(callid, 100 icpic_enable_irq( IPC_GET_ARG1(call)));96 icpic_enable_irq(icpic, IPC_GET_ARG1(call))); 101 97 break; 102 98 case IRC_DISABLE_INTERRUPT: … … 115 111 } 116 112 117 static int icpic_init(void) 113 /** Add icp-ic device. */ 114 int icpic_add(icpic_t *icpic, icpic_res_t *res) 118 115 { 119 char *platform = NULL; 120 char *pstr = NULL; 121 size_t platform_size; 122 category_id_t irc_cat; 123 service_id_t svc_id; 116 ddf_fun_t *fun_a = NULL; 124 117 void *regs; 125 118 int rc; 126 119 127 platform = sysinfo_get_data("platform", &platform_size); 128 if (platform == NULL) { 129 log_msg(LOG_DEFAULT, LVL_ERROR, "Error getting platform type."); 130 rc = ENOENT; 120 rc = pio_enable((void *)res->base, sizeof(icpic_regs_t), ®s); 121 if (rc != EOK) { 122 ddf_msg(LVL_ERROR, "Error enabling PIO"); 131 123 goto error; 132 124 } 133 125 134 pstr = str_ndup(platform, platform_size); 135 if (pstr == NULL) { 136 log_msg(LOG_DEFAULT, LVL_ERROR, "Out of memory."); 126 icpic->regs = (icpic_regs_t *)regs; 127 128 fun_a = ddf_fun_create(icpic->dev, fun_exposed, "a"); 129 if (fun_a == NULL) { 130 ddf_msg(LVL_ERROR, "Failed creating function 'a'."); 137 131 rc = ENOMEM; 138 132 goto error; 139 133 } 140 134 141 if (str_cmp(pstr, "integratorcp") != 0) { 142 log_msg(LOG_DEFAULT, LVL_ERROR, "Platform '%s' is not 'integratorcp'.", 135 ddf_fun_set_conn_handler(fun_a, icpic_connection); 143 136 144 pstr); 145 rc = ENOENT; 137 rc = ddf_fun_bind(fun_a); 138 if (rc != EOK) { 139 ddf_msg(LVL_ERROR, "Failed binding function 'a'. (%d)", rc); 146 140 goto error; 147 141 } 148 142 149 rc = pio_enable((void *)icp_pic_base, sizeof(icpic_regs_t), ®s); 150 if (rc != EOK) { 151 log_msg(LOG_DEFAULT, LVL_ERROR, "Error enabling PIO"); 143 rc = ddf_fun_add_to_category(fun_a, "irc"); 144 if (rc != EOK) 152 145 goto error; 153 }154 146 155 icpic_regs = (icpic_regs_t *)regs;156 157 async_set_fallback_port_handler(icpic_connection, NULL);158 159 rc = loc_server_register(NAME);160 if (rc != EOK) {161 printf("%s: Failed registering server. (%d)\n", NAME, rc);162 return rc;163 }164 165 rc = loc_service_register("irc/" NAME, &svc_id);166 if (rc != EOK) {167 printf("%s: Failed registering service. (%d)\n", NAME, rc);168 return rc;169 }170 171 rc = loc_category_get_id("irc", &irc_cat, IPC_FLAG_BLOCKING);172 if (rc != EOK) {173 printf("%s: Failed resolving category 'iplink' (%d).\n", NAME,174 rc);175 goto error;176 }177 178 rc = loc_service_add_to_cat(svc_id, irc_cat);179 if (rc != EOK) {180 printf("%s: Failed adding service to category (%d).\n", NAME,181 rc);182 goto error;183 }184 185 free(platform);186 free(pstr);187 147 return EOK; 188 148 error: 189 free(platform);190 free(pstr);149 if (fun_a != NULL) 150 ddf_fun_destroy(fun_a); 191 151 return rc; 192 152 } 193 153 194 int main(int argc, char **argv) 154 /** Remove icp-ic device */ 155 int icpic_remove(icpic_t *icpic) 195 156 { 196 int rc; 157 return ENOTSUP; 158 } 197 159 198 printf("%s: HelenOS IntegratorCP interrupt controller driver\n", NAME); 199 200 rc = log_init(NAME); 201 if (rc != EOK) { 202 printf(NAME ": Error connecting logging service."); 203 return 1; 204 } 205 206 if (icpic_init() != EOK) 207 return -1; 208 209 log_msg(LOG_DEFAULT, LVL_NOTE, "%s: Accepting connections\n", NAME); 210 task_retval(0); 211 async_manager(); 212 213 /* Not reached */ 214 return 0; 160 /** icp-ic device gone */ 161 int icpic_gone(icpic_t *icpic) 162 { 163 return ENOTSUP; 215 164 } 216 165 -
uspace/drv/platform/icp/icp.c
r1974f56a ra416d070 54 54 icp_kbd_irq = 3, 55 55 icp_mouse_base = 0x19000000, 56 icp_mouse_irq = 4 56 icp_mouse_irq = 4, 57 icp_ic_base = 0x14000000 57 58 }; 58 59 … … 108 109 }; 109 110 111 static hw_resource_t icp_ic_res[] = { 112 { 113 .type = MEM_RANGE, 114 .res.mem_range = { 115 .address = icp_ic_base, 116 .size = 40, 117 .relative = false, 118 .endianness = LITTLE_ENDIAN 119 } 120 } 121 }; 122 110 123 static pio_window_t icp_pio_window = { 111 124 .mem = { … … 126 139 sizeof(icp_mouse_res) / sizeof(icp_mouse_res[0]), 127 140 icp_mouse_res 141 }, 142 }; 143 144 static icp_fun_t icp_ic_fun_proto = { 145 .hw_resources = { 146 sizeof(icp_ic_res) / sizeof(icp_ic_res[0]), 147 icp_ic_res 128 148 }, 129 149 }; … … 267 287 return rc; 268 288 289 rc = icp_add_fun(dev, "intctl", "integratorcp/intctl", 290 &icp_ic_fun_proto); 291 if (rc != EOK) 292 return rc; 293 269 294 return EOK; 270 295 }
Note:
See TracChangeset
for help on using the changeset viewer.