Changeset 277cf60 in mainline
- Timestamp:
- 2010-07-25T16:52:18Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b8b4efa
- Parents:
- ec08286
- Location:
- kernel
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm32/src/mach/gta02/gta02.c
rec08286 r277cf60 75 75 static void gta02_timer_irq_handler(irq_t *irq); 76 76 77 static void *gta02_scons_out;78 77 static outdev_t *gta02_scons_dev; 79 78 static s3c24xx_irqc_t gta02_irqc; … … 97 96 s3c24xx_irqc_regs_t *irqc_regs; 98 97 99 gta02_scons_out = (void *) hw_map(GTA02_SCONS_BASE, PAGE_SIZE);100 98 gta02_timer = (void *) hw_map(S3C24XX_TIMER_ADDRESS, PAGE_SIZE); 101 99 irqc_regs = (void *) hw_map(S3C24XX_IRQC_ADDRESS, PAGE_SIZE); … … 176 174 177 175 /* Initialize serial port of the debugging console. */ 178 gta02_scons_dev = s3c24xx_uart_init((ioport8_t *) gta02_scons_out, 179 S3C24XX_INT_UART2); 176 s3c24xx_uart_io_t *scons_io; 177 178 scons_io = (void *) hw_map(GTA02_SCONS_BASE, PAGE_SIZE); 179 gta02_scons_dev = s3c24xx_uart_init(scons_io, S3C24XX_INT_UART2); 180 180 181 if (gta02_scons_dev) { 181 182 182 /* Create output device. */ 183 183 stdout_wire(gta02_scons_dev); … … 187 187 static void gta02_input_init(void) 188 188 { 189 s3c24xx_uart_ instance_t *scons_inst;189 s3c24xx_uart_t *scons_inst; 190 190 191 191 if (gta02_scons_dev) { -
kernel/genarch/include/drivers/s3c24xx_uart/s3c24xx_uart.h
rec08286 r277cf60 42 42 #include <typedefs.h> 43 43 44 /** S3C24xx UART I/O */ 44 45 typedef struct { 45 ioport8_t *base; 46 uint32_t ulcon; 47 uint32_t ucon; 48 uint32_t ufcon; 49 uint32_t umcon; 50 51 uint32_t utrstat; 52 uint32_t uerstat; 53 uint32_t ufstat; 54 uint32_t umstat; 55 56 uint32_t utxh; 57 uint32_t urxh; 58 59 uint32_t ubrdiv; 60 } s3c24xx_uart_io_t; 61 62 /** S3C24xx UART instance */ 63 typedef struct { 64 s3c24xx_uart_io_t *io; 46 65 indev_t *indev; 47 66 irq_t irq; 48 } s3c24xx_uart_ instance_t;67 } s3c24xx_uart_t; 49 68 50 extern outdev_t *s3c24xx_uart_init( ioport8_t *, inr_t inr);51 extern void s3c24xx_uart_input_wire(s3c24xx_uart_ instance_t *,69 extern outdev_t *s3c24xx_uart_init(s3c24xx_uart_io_t *, inr_t inr); 70 extern void s3c24xx_uart_input_wire(s3c24xx_uart_t *, 52 71 indev_t *); 53 72 -
kernel/genarch/src/drivers/s3c24xx_uart/s3c24xx_uart.c
rec08286 r277cf60 47 47 #include <str.h> 48 48 49 /** S3C24xx UART register offsets */50 #define S3C24XX_ULCON 0x0051 #define S3C24XX_UCON 0x0452 #define S3C24XX_UFCON 0x0853 #define S3C24XX_UMCON 0x0c54 #define S3C24XX_UTRSTAT 0x1055 #define S3C24XX_UERSTAT 0x1456 #define S3C24XX_UFSTAT 0x1857 #define S3C24XX_UMSTAT 0x1c58 #define S3C24XX_UTXH 0x2059 #define S3C24XX_URXH 0x2460 #define S3C24XX_UBRDIV 0x2861 62 49 /* Bits in UTRSTAT register */ 63 50 #define S3C24XX_UTRSTAT_TX_EMPTY 0x4 … … 66 53 static void s3c24xx_uart_sendb(outdev_t *dev, uint8_t byte) 67 54 { 68 s3c24xx_uart_instance_t *instance = 69 (s3c24xx_uart_instance_t *) dev->data; 70 ioport32_t *utrstat, *utxh; 71 72 utrstat = (ioport32_t *) (instance->base + S3C24XX_UTRSTAT); 73 utxh = (ioport32_t *) (instance->base + S3C24XX_UTXH); 55 s3c24xx_uart_t *uart = 56 (s3c24xx_uart_t *) dev->data; 74 57 75 58 /* Wait for transmitter to be empty. */ 76 while ((pio_read_32( utrstat) & S3C24XX_UTRSTAT_TX_EMPTY) == 0)59 while ((pio_read_32(&uart->io->utrstat) & S3C24XX_UTRSTAT_TX_EMPTY) == 0) 77 60 ; 78 61 79 pio_write_32( utxh, byte);62 pio_write_32(&uart->io->utxh, byte); 80 63 } 81 64 … … 100 83 static void s3c24xx_uart_irq_handler(irq_t *irq) 101 84 { 102 s3c24xx_uart_instance_t *instance = irq->instance; 103 ioport32_t *utrstat, *urxh; 85 s3c24xx_uart_t *uart = irq->instance; 104 86 105 utrstat = (ioport32_t *) (instance->base + S3C24XX_UTRSTAT); 106 urxh = (ioport32_t *) (instance->base + S3C24XX_URXH); 107 108 if ((pio_read_32(utrstat) & S3C24XX_UTRSTAT_RDATA) != 0) { 109 uint32_t data = pio_read_32(urxh); 110 indev_push_character(instance->indev, data & 0xff); 87 if ((pio_read_32(&uart->io->utrstat) & S3C24XX_UTRSTAT_RDATA) != 0) { 88 uint32_t data = pio_read_32(&uart->io->urxh); 89 indev_push_character(uart->indev, data & 0xff); 111 90 } 112 91 } … … 117 96 }; 118 97 119 outdev_t *s3c24xx_uart_init( ioport8_t *base, inr_t inr)98 outdev_t *s3c24xx_uart_init(s3c24xx_uart_io_t *io, inr_t inr) 120 99 { 121 100 outdev_t *uart_dev = malloc(sizeof(outdev_t), FRAME_ATOMIC); … … 123 102 return NULL; 124 103 125 s3c24xx_uart_ instance_t *instance=126 malloc(sizeof(s3c24xx_uart_ instance_t), FRAME_ATOMIC);127 if (! instance) {104 s3c24xx_uart_t *uart = 105 malloc(sizeof(s3c24xx_uart_t), FRAME_ATOMIC); 106 if (!uart) { 128 107 free(uart_dev); 129 108 return NULL; … … 131 110 132 111 outdev_initialize("s3c24xx_uart_dev", uart_dev, &s3c24xx_uart_ops); 133 uart_dev->data = instance;112 uart_dev->data = uart; 134 113 135 instance->base = base;136 instance->indev = NULL;114 uart->io = io; 115 uart->indev = NULL; 137 116 138 117 /* Initialize IRQ structure. */ 139 irq_initialize(& instance->irq);140 instance->irq.devno = device_assign_devno();141 instance->irq.inr = inr;142 instance->irq.claim = s3c24xx_uart_claim;143 instance->irq.handler = s3c24xx_uart_irq_handler;144 instance->irq.instance = instance;118 irq_initialize(&uart->irq); 119 uart->irq.devno = device_assign_devno(); 120 uart->irq.inr = inr; 121 uart->irq.claim = s3c24xx_uart_claim; 122 uart->irq.handler = s3c24xx_uart_irq_handler; 123 uart->irq.instance = uart; 145 124 146 125 /* Disable FIFO */ 147 ioport32_t *ufcon; 148 ufcon = (ioport32_t *) (instance->base + S3C24XX_UFCON); 149 pio_write_32(ufcon, pio_read_32(ufcon) & ~0x01); 126 pio_write_32(&uart->io->ufcon, 127 pio_read_32(&uart->io->ufcon) & ~0x01); 150 128 151 129 /* Set RX interrupt to pulse mode */ 152 ioport32_t *ucon; 153 ucon = (ioport32_t *) (instance->base + S3C24XX_UCON); 154 pio_write_32(ucon, pio_read_32(ucon) & ~(1 << 8)); 130 pio_write_32(&uart->io->ucon, 131 pio_read_32(&uart->io->ucon) & ~(1 << 8)); 155 132 156 133 if (!fb_exported) { … … 161 138 sysinfo_set_item_val("fb", NULL, true); 162 139 sysinfo_set_item_val("fb.kind", NULL, 3); 163 sysinfo_set_item_val("fb.address.physical", NULL, KA2PA( base));140 sysinfo_set_item_val("fb.address.physical", NULL, KA2PA(io)); 164 141 165 142 fb_exported = true; … … 169 146 } 170 147 171 void s3c24xx_uart_input_wire(s3c24xx_uart_ instance_t *instance, indev_t *indev)148 void s3c24xx_uart_input_wire(s3c24xx_uart_t *uart, indev_t *indev) 172 149 { 173 ASSERT( instance);150 ASSERT(uart); 174 151 ASSERT(indev); 175 152 176 instance->indev = indev;177 irq_register(& instance->irq);153 uart->indev = indev; 154 irq_register(&uart->irq); 178 155 } 179 156 -
kernel/generic/src/main/kinit.c
rec08286 r277cf60 226 226 * Run user tasks. 227 227 */ 228 for (i = 0; i < init.cnt; i++) {228 /* for (i = 0; i < init.cnt; i++) { 229 229 if (programs[i].task != NULL) 230 230 program_ready(&programs[i]); 231 } 231 }*/ 232 232 233 233 #ifdef CONFIG_KCONSOLE
Note:
See TracChangeset
for help on using the changeset viewer.