Changeset 4d2dba7 in mainline
- Timestamp:
- 2013-10-15T17:05:26Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f988a13
- Parents:
- a73ebf0
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
HelenOS.config
ra73ebf0 r4d2dba7 64 64 % Machine type 65 65 @ "leon3" Gaisler Aeroflex LEON3 66 ! [PLATFORM=s arc32] MACHINE (choice)66 ! [PLATFORM=sparc32] MACHINE (choice) 67 67 68 68 % Machine type … … 504 504 % Support for OMAP on-chip UART 505 505 ! [(CONFIG_HID_OUT=generic|CONFIG_HID_OUT=serial)&PLATFORM=arm32&(MACHINE=beagleboardxm|MACHINE=beaglebone)] CONFIG_OMAP_UART (y/n) 506 507 % Support for GRLIB UART 508 ! [PLATFORM=sparc32&MACHINE=leon3] CONFIG_GRLIB_UART (y) 509 510 % Support for GRLIB IRQMP 511 ! [PLATFORM=sparc32&MACHINE=leon3] CONFIG_GRLIB_IRQMP (y) 506 512 507 513 % Support for i8042 controller … … 639 645 @ "5" Linux kernel 640 646 ! [PLATFORM=arm32&MACHINE!=beagleboardxm&MACHINE!=beaglebone] UIMAGE_OS (choice) 647 648 % uImage OS type 649 @ "5" Linux kernel 650 ! [PLATFORM=sparc32] UIMAGE_OS (choice) -
defaults/sparc32/leon3/Makefile.config
ra73ebf0 r4d2dba7 10 10 # GRLIB APBUART 11 11 CONFIG_GRLIB_UART = y 12 13 # GRLIB IRQMP 14 CONFIG_GRLIB_IRQMP = y -
kernel/genarch/include/genarch/drivers/grlib_irqmp/grlib_irqmp.h
ra73ebf0 r4d2dba7 39 39 40 40 #include <typedefs.h> 41 #include <arch.h> 41 42 42 43 #define GRLIB_IRQMP_MASK_OFFSET 0x40 … … 70 71 } grlib_irqmp_t; 71 72 72 extern void grlib_irqmp_init(grlib_irqmp_t *, grlib_irqmp_regs_t *);73 extern unsignedgrlib_irqmp_inum_get(grlib_irqmp_t *);74 extern void grlib_irqmp_clear(grlib_irq c_t *, int);75 extern void grlib_irqmp_ irq_mask(grlib_irqc_t *, int);76 extern void grlib_irqmp_ irq_unmask(grlib_irqc_t *, int);73 extern void grlib_irqmp_init(grlib_irqmp_t *, bootinfo_t *); 74 extern int grlib_irqmp_inum_get(grlib_irqmp_t *); 75 extern void grlib_irqmp_clear(grlib_irqmp_t *, int); 76 extern void grlib_irqmp_mask(grlib_irqmp_t *, int); 77 extern void grlib_irqmp_unmask(grlib_irqmp_t *, int); 77 78 78 79 #endif -
kernel/genarch/include/genarch/drivers/grlib_uart/grlib_uart.h
ra73ebf0 r4d2dba7 44 44 #include <typedefs.h> 45 45 46 /** GRLIB UART registers */47 typedef struct {48 uint32_t data;49 grlib_uart_status_t status;50 grlib_uart_control_t control;51 uint32_t scaler;52 uint32_t debug;53 } grlib_uart_io_t;54 55 46 typedef struct { 56 47 unsigned int rcnt: 6; … … 88 79 unsigned int te: 1; 89 80 unsigned int re: 1; 90 }; 81 } grlib_uart_control_t; 82 83 /** GRLIB UART registers */ 84 typedef struct { 85 uint32_t data; 86 uint32_t status; 87 uint32_t control; 88 uint32_t scaler; 89 uint32_t debug; 90 } grlib_uart_io_t; 91 91 92 92 typedef struct { -
kernel/genarch/src/drivers/grlib_irqmp/grlib_irqmp.c
ra73ebf0 r4d2dba7 38 38 #include <arch/asm.h> 39 39 40 void grlib_irqmp_init(grlib_irqmp_t *irqc, grlib_irqmp_regs_t *regs) 40 #include <mm/km.h> 41 42 void grlib_irqmp_init(grlib_irqmp_t *irqc, bootinfo_t *bootinfo) 41 43 { 42 irqc->regs = regs; 44 irqc->regs = (void *) km_map(bootinfo->intc_base, PAGE_SIZE, 45 PAGE_NOT_CACHEABLE); 46 47 /* Mask all interrupts */ 48 pio_write_32((void *)&irqc->regs + GRLIB_IRQMP_MASK_OFFSET, 0); 43 49 } 44 50 45 unsignedgrlib_irqmp_inum_get(grlib_irqmp_t *irqc)51 int grlib_irqmp_inum_get(grlib_irqmp_t *irqc) 46 52 { 47 return 0; 53 int i; 54 uint32_t pending = pio_read_32(&irqc->regs->pending); 55 56 for (i = 1; i < 16; i++) { 57 if (pending & (1 << i)) 58 return i; 59 } 60 61 return -1; 48 62 } 49 63 50 void grlib_irqmp_clear(grlib_irqmp_t *irqc, unsignedinum)64 void grlib_irqmp_clear(grlib_irqmp_t *irqc, int inum) 51 65 { 66 pio_write_32(&irqc->regs->clear, (1 << inum)); 52 67 } 53 68 54 void grlib_irqmp_ src_enable(grlib_irqmp_t *irqc, unsignedsrc)69 void grlib_irqmp_mask(grlib_irqmp_t *irqc, int src) 55 70 { 71 uint32_t mask = pio_read_32((void *)&irqc->regs + GRLIB_IRQMP_MASK_OFFSET); 72 73 mask &= ~(1 << src); 74 75 pio_write_32((void *)&irqc->regs + GRLIB_IRQMP_MASK_OFFSET, mask); 56 76 } 57 77 58 void grlib_irqmp_ src_disable(grlib_irqmp_t *irqc, unsignedsrc)78 void grlib_irqmp_unmask(grlib_irqmp_t *irqc, int src) 59 79 { 80 uint32_t mask = pio_read_32((void *)&irqc->regs + GRLIB_IRQMP_MASK_OFFSET); 81 82 mask |= (1 << src); 83 84 pio_write_32((void *)&irqc->regs + GRLIB_IRQMP_MASK_OFFSET, mask); 60 85 } 61 86 -
kernel/genarch/src/drivers/grlib_uart/grlib_uart.c
ra73ebf0 r4d2dba7 50 50 static void grlib_uart_sendb(outdev_t *dev, uint8_t byte) 51 51 { 52 uint32_t reg; 52 53 grlib_uart_status_t *status; 53 54 grlib_uart_t *uart = … … 56 57 /* Wait for space becoming available in Tx FIFO. */ 57 58 do { 58 status = pio_read_32(&uart->io->status); 59 reg = pio_read_32(&uart->io->status); 60 status = (grlib_uart_status_t *)® 59 61 } while (status->tf != 0); 60 62 … … 85 87 static void grlib_uart_irq_handler(irq_t *irq) 86 88 { 89 uint32_t reg; 87 90 grlib_uart_t *uart = irq->instance; 88 grlib_ status_tstatus;91 grlib_uart_status_t *status; 89 92 90 status = (grlib_status_t)pio_read_32(&uart->io->status); 93 reg = pio_read_32(&uart->io->status); 94 status = (grlib_uart_status_t *)® 91 95 92 96 while (status->dr != 0) { 93 97 uint32_t data = pio_read_32(&uart->io->data); 94 status = (grlib_status_t)pio_read_32(&uart->io->status); 98 reg = pio_read_32(&uart->io->status); 99 status = (grlib_uart_status_t *)® 95 100 indev_push_character(uart->indev, data & 0xff); 96 101 } … … 131 136 132 137 /* Enable FIFO, Tx trigger level: empty, Rx trigger level: 1 byte. */ 133 grlib_ control_t control =138 grlib_uart_control_t control = 134 139 { .fa = 1, .rf = 1, .tf = 1, .ri = 1, 135 140 .te = 1, .re = 1}; 136 141 137 pio_write_32(&uart->io->control, control); 142 uint32_t *reg = (uint32_t *)&control; 143 pio_write_32(&uart->io->control, *reg); 138 144 139 145 link_initialize(&uart->parea.link);
Note:
See TracChangeset
for help on using the changeset viewer.