- Timestamp:
- 2007-06-01T14:15:42Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- ea7890e7
- Parents:
- 60133d0
- Location:
- uspace
- Files:
-
- 3 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/libc/include/ipc/services.h
r60133d0 rff3a34b 43 43 #define SERVICE_CONSOLE 4 44 44 #define SERVICE_RD 5 45 #define SERVICE_FS 6 45 46 46 47 /* Memory area to be received from NS */ -
uspace/rd/rd.c
r60133d0 rff3a34b 1 1 /* 2 * Copyright (c) 2006 Martin Decky 2 * Copyright (c) 2007 Michal Konopa 3 * Copyright (c) 2007 Martin Jelen 4 * Copyright (c) 2007 Peter Majer 3 5 * All rights reserved. 4 6 * … … 46 48 #include <errno.h> 47 49 #include <async.h> 50 #include <stdlib.h> 51 #include <unistd.h> 52 #include <align.h> 53 #include <async.h> 54 #include <ddi.h> 55 #include <libarch/ddi.h> 56 #include <stdio.h> 57 #include "rd.h" 48 58 59 static void *rd_addr; 60 static void *fs_addr; 49 61 50 62 static void rd_connection(ipc_callid_t iid, ipc_call_t *icall) … … 55 67 56 68 ipc_answer_fast(iid, 0, 0, 0); 69 ipcarg_t offset; 57 70 58 71 while (1) { 59 72 callid = async_get_call(&call); 60 73 switch (IPC_GET_METHOD(call)) { 61 case IPC_M_PHONE_HUNGUP: 62 ipc_answer_fast(callid, 0,0,0); 63 return; 64 default: 65 retval = EINVAL; 74 case IPC_M_PHONE_HUNGUP: 75 ipc_answer_fast(callid, 0,0,0); 76 return; 77 case IPC_M_AS_AREA_SEND: 78 ipc_answer_fast(callid, 0, (uintptr_t)fs_addr, 0); 79 continue; 80 case RD_READ_BLOCK: 81 offset = IPC_GET_ARG1(call); 82 memcpy((void *)fs_addr, rd_addr+offset, BLOCK_SIZE); 83 retval = EOK; 84 break; 85 default: 86 retval = EINVAL; 66 87 } 67 88 ipc_answer_fast(callid, retval, 0, 0); … … 72 93 static bool rd_init(void) 73 94 { 95 int retval, flags; 96 74 97 size_t rd_size = sysinfo_value("rd.size"); 75 98 void * rd_ph_addr = (void *) sysinfo_value("rd.address.physical"); … … 78 101 return false; 79 102 80 void *rd_addr = as_get_mappable_page(rd_size);103 rd_addr = as_get_mappable_page(rd_size); 81 104 82 physmem_map(rd_ph_addr, rd_addr, ALIGN_UP(rd_size, PAGE_SIZE) >> PAGE_WIDTH, AS_AREA_READ | AS_AREA_WRITE); 105 flags = AS_AREA_READ | AS_AREA_WRITE | AS_AREA_CACHEABLE; 106 retval = physmem_map(rd_ph_addr, rd_addr, ALIGN_UP(rd_size, PAGE_SIZE) >> PAGE_WIDTH, flags); 107 108 if (retval < 0) 109 return false; 83 110 111 size_t fs_size = ALIGN_UP(BLOCK_SIZE * sizeof(char), PAGE_SIZE); 112 fs_addr = as_get_mappable_page(fs_size); 113 84 114 return true; 85 115 } 86 87 116 88 117 int main(int argc, char **argv)
Note:
See TracChangeset
for help on using the changeset viewer.