Changeset 05a6548 in mainline
- Timestamp:
- 2012-03-04T20:40:19Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d2707fc
- Parents:
- e6a356dd
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/arm32/src/mach/beagleboardxm/beagleboardxm.c
re6a356dd r05a6548 30 30 */ 31 31 /** @file 32 * @brief BeagleBoard platform driver.32 * @brief BeagleBoard-xM platform driver. 33 33 */ 34 34 35 35 #include <arch/exception.h> 36 36 #include <arch/mach/beagleboardxm/beagleboardxm.h> 37 #include <genarch/drivers/amdm37x_irc/amdm37x_irc.h> 38 #include <genarch/drivers/amdm37x_uart/amdm37x_uart.h> 37 39 #include <interrupt.h> 40 #include <mm/km.h> 38 41 #include <ddi/ddi.h> 39 42 #include <ddi/device.h> … … 50 53 static const char *bbxm_get_platform_name(void); 51 54 55 static struct beagleboard { 56 amdm37x_irc_regs_t *irc_addr; 57 amdm37x_uart_t uart; 58 } beagleboard; 59 52 60 struct arm_machine_ops bbxm_machine_ops = { 53 61 bbxm_init, … … 63 71 }; 64 72 73 static irq_ownership_t bb_timer_irq_claim(irq_t *irq) 74 { 75 return IRQ_ACCEPT; 76 } 77 78 static void bb_timer_irq_handler(irq_t *irq) 79 { 80 /* 81 * We are holding a lock which prevents preemption. 82 * Release the lock, call clock() and reacquire the lock again. 83 */ 84 spinlock_unlock(&irq->lock); 85 clock(); 86 spinlock_lock(&irq->lock); 87 } 88 65 89 static void bbxm_init(void) 66 90 { 91 /* Initialize interrupt controller */ 92 beagleboard.irc_addr = 93 (void *) km_map(AMDM37x_IRC_BASE_ADDRESS, AMDM37x_IRC_SIZE, 94 PAGE_NOT_CACHEABLE); 95 amdm37x_irc_init(beagleboard.irc_addr); 96 97 //initialize timer here 67 98 } 68 99 69 100 static void bbxm_timer_irq_start(void) 70 101 { 102 /* Initialize timer IRQ */ 103 static irq_t timer_irq; 104 irq_initialize(&timer_irq); 105 timer_irq.devno = device_assign_devno(); 106 timer_irq.inr = 0;//BB_TIMER_IRQ; 107 timer_irq.claim = bb_timer_irq_claim; 108 timer_irq.handler = bb_timer_irq_handler; 109 irq_register(&timer_irq); 110 // start timer here 71 111 } 72 112 … … 82 122 static void bbxm_get_memory_extents(uintptr_t *start, size_t *size) 83 123 { 124 // FIXME: This is just a guess... 125 *start = 0; 126 *size = 256 * 1024 * 1024; 84 127 } 85 128 86 129 static void bbxm_irq_exception(unsigned int exc_no, istate_t *istate) 87 130 { 131 const unsigned inum = amdm37x_irc_inum_get(beagleboard.irc_addr); 132 amdm37x_irc_irq_ack(beagleboard.irc_addr); 133 134 irq_t *irq = irq_dispatch_and_lock(inum); 135 if (irq) { 136 /* The IRQ handler was found. */ 137 irq->handler(irq); 138 spinlock_unlock(&irq->lock); 139 } else { 140 /* Spurious interrupt.*/ 141 printf("cpu%d: spurious interrupt (inum=%d)\n", 142 CPU->id, inum); 143 } 88 144 } 89 145 … … 94 150 static void bbxm_output_init(void) 95 151 { 152 #ifdef CONFIG_FB 153 #error "Frame buffer is not yet supported!" 154 #endif 155 156 /* UART3 is wired to external RS232 connector */ 157 const bool ok = amdm37x_uart_init(&beagleboard.uart, 158 AMDM37x_UART3_IRQ, AMDM37x_UART3_BASE_ADDRESS, AMDM37x_UART3_SIZE); 159 if (ok) { 160 stdout_wire(&beagleboard.uart.outdev); 161 } 96 162 } 97 163 … … 102 168 size_t bbxm_get_irq_count(void) 103 169 { 104 return 0;170 return AMDM37x_IRC_IRQ_COUNT; 105 171 } 106 172
Note:
See TracChangeset
for help on using the changeset viewer.