📄 vectors.s
字号:
// Call the output processing code. // _IMPORT_ OutputFilter bl OutputFilter // // Restore r0, r1, r12 and r14 from the stack. // ldmia r13!, {r0, r1, r12, r14} // // Increment the keyboard counter. //output_done _LABEL_ ldr r2, =ulSystemFlags ldr r3, [r2] add r3, r3, _CONST_ 0x00000001 bic r3, r3, _CONST_ 0x00000004 str r3, [r2] and r3, r3, _CONST_ 0x00000003 // // If the count is not zero, then do not scan the keyboard. // cmp r3, _CONST_ 0x00000000 bne keyboard_done // // Save r0, r1, r12, and r14 to the stack. // stmdb r13!, {r0, r1, r12, r14} // // Call the UI ISR. // _IMPORT_ UIISR bl UIISR // // Check on the USB connection. //#ifdef HwRegUSBCable _IMPORT_ USBCheck bl USBCheck#endif // // Restore r0, r1, r12, and r14 from the stack. // ldmia r13!, {r0, r1, r12, r14} // // Clear the timer1 interrupt. //keyboard_done _LABEL_ str r0, [r0, _CONST_ HwTimer1EOI] // // See if the USB caused the interrupt. //timer1_done _LABEL_ tst r1, _CONST_ HwIrqUSB beq usb_done // // Save r0, r1, r12, and r14 to the stack. // stmdb r13!, {r0, r1, r12, r14} // // Call the USB interrupt handler. // _IMPORT_ USBISR bl USBISR // // Restore r0, r1, r12, and r14 from the stack. // ldmia r13!, {r0, r1, r12, r14} // // See if either SmartMedia interrupt caused the interupt. //usb_done _LABEL_#ifdef HwIrqSmartMediaInsert tst r1, _CONST_ (HwIrqSmartMediaInsert | HwIrqSmartMediaRemove) beq smartmedia_done // // Save r0, r1, r12, and r14 to the stack. // stmdb r13!, {r0, r1, r12, r14} // // Call the SmartMedia interrupt handler. // _IMPORT_ SMISR bl SMISR // // Restore r0, r1, r12, adn r14 from the stack. // ldmia r13!, {r0, r1, r12, r14}#endif // // Restore r0 through r3 from the stack. //smartmedia_done _LABEL_ ldmia r13!, {r0-r3} // // Return to the interrupted code. // subs pc, lr, _CONST_ 4 // // Tell the assembler to put in-line data here. // _LTORG_//****************************************************************************//// The FIQ interrupt handler. This is called when the FIQ line going into the// ARM processor goes high, indicating an external device is requesting the// attention of the processor.//// The only FIQ which we handle is the DAI interrupt. Because of this, we// define the banked FIQ registers (r8-r12) as follows://// r8 => current play buffer (left channel)// r9 => current play buffer (right channel)// r10 => play buffer samples left// r11 => current record buffer// r12 => record buffer space left//// With this arrangement, we do not need to go to memory for buffer pointers// or sizes unless we've reached the end of the buffer (which is relatively// infrequent). For added efficiency, we assume that the play and record// buffers are a multiple of 4 samples in size (since we process 4 samples per// DAI interrupt).////****************************************************************************FIQHandler _LABEL_ // // Save r0 through r3 to the stack. // stmdb r13!, {r0-r3} // // Load r1 with a pointer to the DAI registers. // ldr r1, =(HwBaseAddress + 0x00002000) // // Handle writing data into the transmit FIFO. First, see if our current // play buffer pointer needs to be re-loaded. // cmp r10, _CONST_ 0x00000000 bne play_fill // // We need to re-load the play buffer pointers. First, get a pointer // to the play buffer. // _IMPORT_ sPlayBuffer ldr r0, =sPlayBuffer // // Get the read and write pointers for the buffer. // ldr r2, [r0, _CONST_ 0x0c] ldr r3, [r0, _CONST_ 0x10] // // Is the buffer empty? // subs r10, r3, r2 bne play_next // // Since there is no more data available, write silence to the // digital audio interface. // str r10, [r1, _CONST_ (HwDAIData1 - 0x2000)] str r10, [r1, _CONST_ (HwDAIData0 - 0x2000)] str r10, [r1, _CONST_ (HwDAIData1 - 0x2000)] str r10, [r1, _CONST_ (HwDAIData0 - 0x2000)] str r10, [r1, _CONST_ (HwDAIData1 - 0x2000)] str r10, [r1, _CONST_ (HwDAIData0 - 0x2000)] str r10, [r1, _CONST_ (HwDAIData1 - 0x2000)] str r10, [r1, _CONST_ (HwDAIData0 - 0x2000)] // // We're done handling the play FIFO. // b play_doneplay_next _LABEL_ // // If the difference between the read and write pointers is negative, // then only read samples up to the end of the buffer. // ldrmi r3, [r0, _CONST_ 0x08] submi r10, r3, r2 // // Get pointers to the beginning of the buffers. // ldr r8, [r0, _CONST_ 0x00] ldr r9, [r0, _CONST_ 0x04] // // Increment the buffer pointers by the current read pointer. // add r8, r8, r2, lsl _CONST_ 1 add r9, r9, r2, lsl _CONST_ 1play_fill _LABEL_ // // Read four samples from the play buffer and write them to the DAI FIFO. // ldrh r0, [r8], _CONST_ 2 str r0, [r1, _CONST_ (HwDAIData1 - 0x2000)] ldrh r0, [r9], _CONST_ 2 str r0, [r1, _CONST_ (HwDAIData0 - 0x2000)] ldrh r0, [r8], _CONST_ 2 str r0, [r1, _CONST_ (HwDAIData1 - 0x2000)] ldrh r0, [r9], _CONST_ 2 str r0, [r1, _CONST_ (HwDAIData0 - 0x2000)] ldrh r0, [r8], _CONST_ 2 str r0, [r1, _CONST_ (HwDAIData1 - 0x2000)] ldrh r0, [r9], _CONST_ 2 str r0, [r1, _CONST_ (HwDAIData0 - 0x2000)] ldrh r0, [r8], _CONST_ 2 str r0, [r1, _CONST_ (HwDAIData1 - 0x2000)] ldrh r0, [r9], _CONST_ 2 str r0, [r1, _CONST_ (HwDAIData0 - 0x2000)] // // Decrement the sample count by 4. // sub r10, r10, _CONST_ 4 // // Load a pointer to the play buffer. // ldr r0, =sPlayBuffer // // Get the read pointer for the buffer. // ldr r2, [r0, _CONST_ 0x0c] // // Increment the read pointer by 4. // add r2, r2, _CONST_ 4 // // Get the length of the buffer. // ldr r3, [r0, _CONST_ 0x08] // // If the read pointer is at the end of the buffer, then reset it to the // beginning. // cmp r2, r3 moveq r2, _CONST_ 0x00000000 // // Save the read pointer for the buffer. // str r2, [r0, _CONST_ 0x0c]play_done _LABEL_#ifdef REQUIRE_RECORD // // See if our current record buffer pointer needs to be re-loaded. // cmp r12, _CONST_ 0x00000000 bne record_fill // // We need to re-load the record buffer pointer. First, get a pointer // to the record buffer. // _IMPORT_ sRecordBuffer ldr r0, =sRecordBuffer // // Get a pointer to the beginning of the buffer. // ldr r11, [r0, _CONST_ 0x00] // // Get the length of the buffer. // ldr r12, [r0, _CONST_ 0x08] // // Is the length zero? // cmp r12, _CONST_ 0x00000000 bne record_fill // // Throw away the samples in the receive FIFO. // ldr r0, [r1, _CONST_ (HwDAIData1 - 0x2000)] ldr r0, [r1, _CONST_ (HwDAIData0 - 0x2000)] ldr r0, [r1, _CONST_ (HwDAIData1 - 0x2000)] ldr r0, [r1, _CONST_ (HwDAIData0 - 0x2000)] ldr r0, [r1, _CONST_ (HwDAIData1 - 0x2000)] ldr r0, [r1, _CONST_ (HwDAIData0 - 0x2000)] ldr r0, [r1, _CONST_ (HwDAIData1 - 0x2000)] ldr r0, [r1, _CONST_ (HwDAIData0 - 0x2000)] // // We're done handling the record FIFO. // b record_donerecord_fill _LABEL_ // // Read four samples from the DAI FIFO and write them to the record buffer. // ldr r0, [r1, _CONST_ (HwDAIData1 - 0x2000)] ldr r2, [r1, _CONST_ (HwDAIData0 - 0x2000)] mov r2, r2, lsl _CONST_ 1 strh r2, [r11], _CONST_ 2 ldr r0, [r1, _CONST_ (HwDAIData1 - 0x2000)] ldr r2, [r1, _CONST_ (HwDAIData0 - 0x2000)] mov r2, r2, lsl _CONST_ 1 strh r2, [r11], _CONST_ 2 ldr r0, [r1, _CONST_ (HwDAIData1 - 0x2000)] ldr r2, [r1, _CONST_ (HwDAIData0 - 0x2000)] mov r2, r2, lsl _CONST_ 1 strh r2, [r11], _CONST_ 2 ldr r0, [r1, _CONST_ (HwDAIData1 - 0x2000)] ldr r2, [r1, _CONST_ (HwDAIData0 - 0x2000)] mov r2, r2, lsl _CONST_ 1 strh r2, [r11], _CONST_ 2 // // Decrement the sample count by 4. // sub r12, r12, _CONST_ 4 // // Load a pointer to the record buffer. // ldr r0, =sRecordBuffer // // Get the write pointer for the buffer. // ldr r2, [r0, _CONST_ 0x10] // // Increment the write pointer by 4. // add r2, r2, _CONST_ 4 // // If the write pointer is at the end of the buffer, then reset it to the // beginning. // cmp r12, _CONST_ 0x00000000 moveq r2, _CONST_ 0x00000000 // // Save the write pointer for the buffer. // str r2, [r0, _CONST_ 0x10]record_done _LABEL_#else // // Throw away the samples in the receive FIFO. // ldr r0, [r1, _CONST_ (HwDAIData1 - 0x2000)] ldr r0, [r1, _CONST_ (HwDAIData0 - 0x2000)] ldr r0, [r1, _CONST_ (HwDAIData1 - 0x2000)] ldr r0, [r1, _CONST_ (HwDAIData0 - 0x2000)] ldr r0, [r1, _CONST_ (HwDAIData1 - 0x2000)] ldr r0, [r1, _CONST_ (HwDAIData0 - 0x2000)] ldr r0, [r1, _CONST_ (HwDAIData1 - 0x2000)] ldr r0, [r1, _CONST_ (HwDAIData0 - 0x2000)]#endif // // Clear the overrun and underrun bits in the DAI status register. // ldr r0, =0xffffffff str r0, [r1, _CONST_ (HwDAIStatus - 0x2000)] // // Restore r0 through r3 from the stack. // ldmia r13!, {r0-r3} // // Return to the interrupted code. // subs pc, lr, _CONST_ 4 // // Tell the assembler to put in-line data here. // _LTORG_//****************************************************************************//// SupportUpdate determines if the current environment support a software// update.////**************************************************************************** _EXPORT_ SupportUpdateSupportUpdate _LABEL_ // // Get the address of our vector table. // ldr r0, =vectortable // // See if our vector table is at location 0, the actual vector table // location. // ldr r1, =0x00000000 cmp r0, r1 // // If the vector table is at 0, then we do not support software updates. // If it is not at 0, then we dos upport software updates (since it is the // update code which resides at location 0, not our code). // moveq r0, _CONST_ 0 movne r0, _CONST_ 1 // // Return to the caller. // mov pc, lr//****************************************************************************//// StartUpdate transfers control to the update code at the beginning of the// ROM. This should only be called if SupportUpdate returns TRUE.////**************************************************************************** _EXPORT_ StartUpdateStartUpdate _LABEL_ // // Branch to the update "vector" at the beginning of ROM. // ldr pc, =0x00000020//****************************************************************************//// A constant which contains the address of the last word of RAM.////**************************************************************************** _EXPORT_ ulExtentOfRAMulExtentOfRAM _LABEL_#if defined(PROCESSOR_EP72XX) _WORD_ HwSRAMAddress + 0x9600#elif defined(PROCESSOR_EP73XX) _WORD_ HwSRAMAddress + 0xc000#endif _END_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -