Changeset 7c014d1 in mainline for uspace/srv/hid/fb/port
- Timestamp:
- 2011-09-09T15:46:21Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c69646f8
- Parents:
- 14a60e3
- Location:
- uspace/srv/hid/fb/port
- Files:
-
- 2 added
- 8 moved
-
ega.c (added)
-
ega.h (moved) (moved from uspace/srv/hid/fb/ega.h ) (1 diff)
-
kchar.c (moved) (moved from uspace/srv/hid/fb/msim.c ) (1 diff)
-
kchar.h (moved) (moved from uspace/srv/hid/fb/main.h ) (2 diffs)
-
kfb.c (added)
-
kfb.h (moved) (moved from uspace/lib/imgmap/imgmap.h ) (2 diffs)
-
niagara.c (moved) (moved from uspace/srv/hid/fb/niagara.c ) (1 diff)
-
niagara.h (moved) (moved from uspace/srv/hid/fb/niagara.h ) (1 diff)
-
ski.c (moved) (moved from uspace/srv/hid/fb/ski.c ) (3 diffs)
-
ski.h (moved) (moved from uspace/srv/hid/fb/ski.h ) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/fb/port/ega.h
r14a60e3 r7c014d1 27 27 */ 28 28 29 /** @addtogroup egafb30 * @brief HelenOS EGA framebuffer.31 * @ingroup fbs32 * @{33 */34 29 /** @file 35 30 */ 36 31 37 #ifndef FB_ EGA_H_38 #define FB_ EGA_H_32 #ifndef FB_PORT_EGA_H_ 33 #define FB_PORT_EGA_H_ 39 34 40 35 extern int ega_init(void); -
uspace/srv/hid/fb/port/kchar.c
r14a60e3 r7c014d1 28 28 */ 29 29 30 /** @defgroup msimfb MSIM text console31 * @brief HelenOS MSIM text console.32 * @ingroup fbs33 * @{34 */35 30 /** @file 36 31 */ 37 32 38 #include < async.h>39 #include < libc.h>33 #include <sys/types.h> 34 #include <errno.h> 40 35 #include <sysinfo.h> 36 #include <ddi.h> 41 37 #include <as.h> 42 #include <ddi.h> 43 #include <errno.h> 38 #include <align.h> 39 #include "../ctl/serial.h" 40 #include "kchar.h" 44 41 45 #include "serial_console.h" 46 #include "msim.h" 42 typedef struct { 43 uint8_t *addr; 44 } kchar_t; 47 45 48 #define WIDTH 80 49 #define HEIGHT 24 46 static kchar_t kchar; 50 47 51 static char *virt_addr; 52 53 static void msim_putc(const char c) 48 static void kchar_putchar(wchar_t ch) 54 49 { 55 *virt_addr = c; 50 if ((ch >= 0) && (ch < 128)) 51 *kchar.addr = ch; 52 else 53 *kchar.addr = '?'; 56 54 } 57 55 58 int msim_init(void)56 static void kchar_control_puts(const char *str) 59 57 { 60 sysarg_t phys_addr; 61 if (sysinfo_get_value("fb.address.physical", &phys_addr) != EOK) 62 return -1; 58 while (*str) 59 *kchar.addr = *(str++); 60 } 61 62 int kchar_init(void) 63 { 64 sysarg_t present; 65 int rc = sysinfo_get_value("fb", &present); 66 if (rc != EOK) 67 present = false; 63 68 64 virt_addr = (char *) as_get_mappable_page(1); 69 if (!present) 70 return ENOENT; 65 71 66 if (physmem_map((void *) phys_addr, virt_addr, 1, 67 AS_AREA_READ | AS_AREA_WRITE) != 0) 68 return -1; 72 sysarg_t kind; 73 rc = sysinfo_get_value("fb.kind", &kind); 74 if (rc != EOK) 75 kind = (sysarg_t) -1; 69 76 70 serial_console_init(msim_putc, WIDTH, HEIGHT); 77 if (kind != 3) 78 return EINVAL; 71 79 72 async_set_client_connection(serial_client_connection); 73 return 0; 80 sysarg_t paddr; 81 rc = sysinfo_get_value("fb.address.physical", &paddr); 82 if (rc != EOK) 83 return rc; 84 85 kchar.addr = as_get_mappable_page(1); 86 if (kchar.addr == NULL) 87 return ENOMEM; 88 89 rc = physmem_map((void *) paddr, kchar.addr, 90 ALIGN_UP(1, PAGE_SIZE) >> PAGE_WIDTH, AS_AREA_READ | AS_AREA_WRITE); 91 if (rc != EOK) 92 return rc; 93 94 return serial_init(kchar_putchar, kchar_control_puts); 74 95 } 75 96 -
uspace/srv/hid/fb/port/kchar.h
r14a60e3 r7c014d1 1 1 /* 2 2 * Copyright (c) 2006 Ondrej Palkovsky 3 * Copyright (c) 2008 Martin Decky 3 4 * All rights reserved. 4 5 * … … 27 28 */ 28 29 29 #ifndef FB_MAIN_H_ 30 #define FB_MAIN_H_ 30 /** @file 31 */ 31 32 32 extern void receive_comm_area(ipc_callid_t, ipc_call_t *, void **); 33 #ifndef FB_PORT_KCHAR_H_ 34 #define FB_PORT_KCHAR_H_ 35 36 extern int kchar_init(void); 33 37 34 38 #endif 39 40 /** @} 41 */ -
uspace/srv/hid/fb/port/kfb.h
r14a60e3 r7c014d1 1 1 /* 2 * Copyright (c) 20 11 Martin Decky2 * Copyright (c) 2006 Ondrej Palkovsky 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 29 /** @addtogroup imgmap 29 /** @addtogroup fb 30 * @ingroup fbs 30 31 * @{ 31 32 */ 32 /** 33 * @file 33 /** @file 34 34 */ 35 35 36 #ifndef IMGMAP_IMGMAP_H_37 #define IMGMAP_IMGMAP_H_36 #ifndef FB_PORT_KFB_H_ 37 #define FB_PORT_KFB_H_ 38 38 39 #include <sys/types.h> 40 #include <abi/fb/visuals.h> 41 42 typedef struct { 43 size_t size; 44 sysarg_t width; 45 sysarg_t height; 46 visual_t visual; 47 uint8_t data[]; 48 } imgmap_t; 49 50 extern imgmap_t *imgmap_decode_tga(void *, size_t); 39 extern int kfb_init(void); 51 40 52 41 #endif -
uspace/srv/hid/fb/port/niagara.c
r14a60e3 r7c014d1 29 29 */ 30 30 31 /** @defgroup niagarafb32 * @brief userland driver of the Niagara console output33 * @{34 */35 31 /** @file 36 32 */ 37 33 38 #include <async.h> 34 #include <sys/types.h> 35 #include <errno.h> 39 36 #include <sysinfo.h> 37 #include <ddi.h> 40 38 #include <as.h> 41 #include <errno.h> 42 #include <stdio.h> 43 #include <ddi.h> 44 45 #include "serial_console.h" 39 #include <align.h> 40 #include "../ctl/serial.h" 46 41 #include "niagara.h" 47 42 48 #define WIDTH 80 49 #define HEIGHT 24 43 #define OUTPUT_FIFO_SIZE ((PAGE_SIZE) - 2 * sizeof(uint64_t)) 50 44 51 /**52 * Virtual address mapped to the buffer shared with the kernel counterpart.53 */54 static uintptr_t output_buffer_addr;55 56 /*57 * Kernel counterpart of the driver reads characters to be printed from here.58 * Keep in sync with the definition from59 * kernel/arch/sparc64/src/drivers/niagara.c.60 */61 #define OUTPUT_BUFFER_SIZE ((PAGE_SIZE) - 2 * 8)62 45 typedef volatile struct { 63 46 uint64_t read_ptr; 64 47 uint64_t write_ptr; 65 char data[OUTPUT_BUFFER_SIZE]; 66 } 67 __attribute__ ((packed)) 68 __attribute__ ((aligned(PAGE_SIZE))) 69 *output_buffer_t; 48 char data[OUTPUT_FIFO_SIZE]; 49 } __attribute__((packed)) output_fifo_t; 70 50 71 output_buffer_t output_buffer; 51 typedef struct { 52 output_fifo_t *fifo; 53 } niagara_t; 72 54 73 /** 74 * Pushes the character to the Niagara serial. 75 * @param c character to be pushed 76 */ 77 static void niagara_putc(char c) 55 static niagara_t niagara; 56 57 static void niagara_putc(const char c) 78 58 { 79 while ( output_buffer->write_ptr ==80 (output_buffer->read_ptr + OUTPUT_BUFFER_SIZE - 1)81 % OUTPUT_BUFFER_SIZE)82 ;83 output_buffer->data[output_buffer->write_ptr] = (uint64_t)c;84 output_buffer->write_ptr =85 ((output_buffer->write_ptr) + 1) % OUTPUT_BUFFER_SIZE;59 while (niagara.fifo->write_ptr == 60 (niagara.fifo->read_ptr + OUTPUT_FIFO_SIZE - 1) 61 % OUTPUT_FIFO_SIZE); 62 63 niagara.fifo->data[niagara.fifo->write_ptr] = c; 64 niagara.fifo->write_ptr = 65 ((niagara.fifo->write_ptr) + 1) % OUTPUT_FIFO_SIZE; 86 66 } 87 67 88 /** 89 * Initializes the Niagara serial driver. 90 */ 68 static void niagara_putchar(wchar_t ch) 69 { 70 if ((ch >= 0) && (ch < 128)) 71 niagara_putc(ch); 72 else 73 niagara_putc('?'); 74 } 75 76 static void niagara_control_puts(const char *str) 77 { 78 while (*str) 79 niagara_putc(*(str++)); 80 } 81 91 82 int niagara_init(void) 92 83 { 84 sysarg_t present; 85 int rc = sysinfo_get_value("fb", &present); 86 if (rc != EOK) 87 present = false; 88 89 if (!present) 90 return ENOENT; 91 92 sysarg_t kind; 93 rc = sysinfo_get_value("fb.kind", &kind); 94 if (rc != EOK) 95 kind = (sysarg_t) -1; 96 97 if (kind != 5) 98 return EINVAL; 99 93 100 sysarg_t paddr; 94 if (sysinfo_get_value("niagara.outbuf.address", &paddr) != EOK) 95 return -1; 101 rc = sysinfo_get_value("niagara.outbuf.address", &paddr); 102 if (rc != EOK) 103 return rc; 96 104 97 output_buffer_addr = (uintptr_t) as_get_mappable_page(PAGE_SIZE); 98 int result = physmem_map((void *) paddr, 99 (void *) output_buffer_addr, 1, 105 niagara.fifo = 106 (output_fifo_t *) as_get_mappable_page(sizeof(output_fifo_t)); 107 if (niagara.fifo == NULL) 108 return ENOMEM; 109 110 rc = physmem_map((void *) paddr, (void *) niagara.fifo, 1, 100 111 AS_AREA_READ | AS_AREA_WRITE); 101 102 if (result != 0) { 103 printf("Niagara: uspace driver couldn't map physical memory: %d\n", 104 result); 105 } 106 107 output_buffer = (output_buffer_t) output_buffer_addr; 108 109 serial_console_init(niagara_putc, WIDTH, HEIGHT); 110 async_set_client_connection(serial_client_connection); 111 return 0; 112 if (rc != EOK) 113 return rc; 114 115 return serial_init(niagara_putchar, niagara_control_puts); 112 116 } 113 117 114 /** 115 * @} 118 /** @} 116 119 */ 117 -
uspace/srv/hid/fb/port/niagara.h
r14a60e3 r7c014d1 27 27 */ 28 28 29 /** @defgroup niagarafb30 * @brief userland driver of the Niagara console output31 * @{32 */33 34 29 /** @file 35 30 */ 36 31 37 #ifndef FB_ NIAGARA_H_38 #define FB_ NIAGARA_H_32 #ifndef FB_PORT_NIAGARA_H_ 33 #define FB_PORT_NIAGARA_H_ 39 34 40 int niagara_init(void);35 extern int niagara_init(void); 41 36 42 37 #endif 43 38 44 /** 39 /** 45 40 * @} 46 41 */ -
uspace/srv/hid/fb/port/ski.c
r14a60e3 r7c014d1 1 1 /* 2 * Copyright (c) 200 5 Jakub Jermar3 * Copyright (c) 2008 Jiri Svoboda2 * Copyright (c) 2006 Ondrej Palkovsky 3 * Copyright (c) 2008 Martin Decky 4 4 * All rights reserved. 5 5 * … … 28 28 */ 29 29 30 /** @defgroup msimfb MSIM text console31 * @brief HelenOS MSIM text console.32 * @ingroup fbs33 * @{34 */35 30 /** @file 36 31 */ 37 32 38 #include < async.h>39 #include < libc.h>33 #include <sys/types.h> 34 #include <errno.h> 40 35 #include <sysinfo.h> 41 #include <as.h> 42 #include <ddi.h> 43 44 #include "serial_console.h" 36 #include "../ctl/serial.h" 45 37 #include "ski.h" 46 38 47 # define SKI_PUTCHAR 3139 #ifdef UARCH_ia64 48 40 49 #define WIDTH 80 50 #define HEIGHT 24 41 #define SKI_PUTCHAR 31 51 42 52 43 /** Display character on ski debug console … … 55 46 * display character on debug console. 56 47 * 57 * @param ch Character to be printed. 48 * @param c Character to be printed. 49 * 58 50 */ 59 static void ski_putc(const char c h)51 static void ski_putc(const char c) 60 52 { 61 53 asm volatile ( 62 54 "mov r15 = %0\n" 63 "mov r32 = %1\n" /* r32 is in0 */64 "break 0x80000\n" /* modifies r8 */55 "mov r32 = %1\n" /* r32 is in0 */ 56 "break 0x80000\n" /* modifies r8 */ 65 57 : 66 : "i" (SKI_PUTCHAR), "r" (c h)58 : "i" (SKI_PUTCHAR), "r" (c) 67 59 : "r15", "in0", "r8" 68 60 ); 69 61 70 if (c h== '\n')62 if (c == '\n') 71 63 ski_putc('\r'); 64 } 65 66 static void ski_putchar(wchar_t ch) 67 { 68 if ((ch >= 0) && (ch < 128)) 69 ski_putc(ch); 70 else 71 ski_putc('?'); 72 } 73 74 static void ski_control_puts(const char *str) 75 { 76 while (*str) 77 ski_putc(*(str++)); 72 78 } 73 79 74 80 int ski_init(void) 75 81 { 76 serial_console_init(ski_putc, WIDTH, HEIGHT); 82 sysarg_t present; 83 int rc = sysinfo_get_value("fb", &present); 84 if (rc != EOK) 85 present = false; 77 86 78 async_set_client_connection(serial_client_connection); 79 return 0; 87 if (!present) 88 return ENOENT; 89 90 sysarg_t kind; 91 rc = sysinfo_get_value("fb.kind", &kind); 92 if (rc != EOK) 93 kind = (sysarg_t) -1; 94 95 if (kind != 6) 96 return EINVAL; 97 98 return serial_init(ski_putchar, ski_control_puts); 80 99 } 81 100 82 /** 83 * @} 101 #else /* UARCH_ia64 */ 102 103 int ski_init(void) 104 { 105 return ENOENT; 106 } 107 108 #endif 109 110 /** @} 84 111 */ -
uspace/srv/hid/fb/port/ski.h
r14a60e3 r7c014d1 27 27 */ 28 28 29 /** @addtogroup skifb30 * @brief HelenOS ski text console.31 * @ingroup fbs32 * @{33 */34 29 /** @file 35 30 */ 36 31 37 #ifndef FB_ SKI_H_38 #define FB_ SKI_H_32 #ifndef FB_PORT_SKI_H_ 33 #define FB_PORT_SKI_H_ 39 34 40 35 extern int ski_init(void); … … 44 39 /** @} 45 40 */ 46
Note:
See TracChangeset
for help on using the changeset viewer.
