Subversion Repositories NaviCtrl

Rev

Rev 134 | Rev 139 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 134 Rev 136
Line 56... Line 56...
56
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
56
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
57
#include <stdio.h>
57
#include <stdio.h>
58
#include <stdarg.h>
58
#include <stdarg.h>
59
#include <string.h>
59
#include <string.h>
60
#include "91x_lib.h"
60
#include "91x_lib.h"
-
 
61
#include "config.h"
61
#include "main.h"
62
#include "main.h"
62
#include "uart0.h"
63
#include "uart0.h"
63
#include "uart1.h"
64
#include "uart1.h"
64
#include "timer1.h"
65
#include "timer1.h"
65
#include "ubx.h"
66
#include "ubx.h"
Line 69... Line 70...
69
//------------------------------------------------------------------------------------
70
//------------------------------------------------------------------------------------
70
// global variables
71
// global variables
Line 71... Line 72...
71
 
72
 
Line 72... Line -...
72
MKOSD_VersionInfo_t MKOSD_VersionInfo;
-
 
73
 
73
MKOSD_VersionInfo_t MKOSD_VersionInfo;
74
#define UART0_BAUD_RATE 57600           //Baud Rate for the serial interfaces
74
 
75
// UART0 MUXER
75
// UART0 MUXER
76
UART0_MuxerState_t UART0_Muxer = UART0_UNDEF;
76
UART0_MuxerState_t UART0_Muxer = UART0_UNDEF;
Line 222... Line 222...
222
    UART_InitStructure.UART_BaudRate =                          Uart0Baudrate;
222
    UART_InitStructure.UART_BaudRate =                          Uart0Baudrate;
223
    UART_InitStructure.UART_HardwareFlowControl =       UART_HardwareFlowControl_None;
223
    UART_InitStructure.UART_HardwareFlowControl =       UART_HardwareFlowControl_None;
224
    UART_InitStructure.UART_Mode =                                      UART_Mode_Tx_Rx;
224
    UART_InitStructure.UART_Mode =                                      UART_Mode_Tx_Rx;
225
    UART_InitStructure.UART_FIFO =                                      UART_FIFO_Enable;
225
    UART_InitStructure.UART_FIFO =                                      UART_FIFO_Enable;
226
    UART_InitStructure.UART_TxFIFOLevel =                       UART_FIFOLevel_1_2;
226
    UART_InitStructure.UART_TxFIFOLevel =                       UART_FIFOLevel_1_2;
227
    UART_InitStructure.UART_RxFIFOLevel =                       UART_FIFOLevel_1_2;
227
    UART_InitStructure.UART_RxFIFOLevel =                       UART_FIFOLevel_1_8;
Line 228... Line 228...
228
 
228
 
229
        UART_DeInit(UART0);     // reset uart 0 to default
229
        UART_DeInit(UART0);     // reset uart 0 to default
Line 230... Line 230...
230
    UART_Init(UART0, &UART_InitStructure);  // initialize uart 0
230
    UART_Init(UART0, &UART_InitStructure);  // initialize uart 0
231
 
231
 
232
        // enable uart 0 interrupts selective
232
        // enable uart 0 interrupts selective
233
    UART_ITConfig(UART0, UART_IT_Receive | UART_IT_ReceiveTimeOut  /*| UART_IT_FrameError*/, ENABLE);
233
    UART_ITConfig(UART0, UART_IT_Receive | UART_IT_ReceiveTimeOut  /*| UART_IT_FrameError*/, ENABLE);
234
        UART_Cmd(UART0, ENABLE); // enable uart 0
234
        UART_Cmd(UART0, ENABLE); // enable uart 0
235
        // configure the uart 0 interupt line as an IRQ with priority 9 (0 is highest)
235
        // configure the uart 0 interupt line
236
        VIC_Config(UART0_ITLine, VIC_IRQ, 9);
236
        VIC_Config(UART0_ITLine, VIC_IRQ, PRIORITY_UART0);
237
        // enable the uart 0 IRQ
237
        // enable the uart 0 IRQ
Line 238... Line 238...
238
        VIC_ITCmd(UART0_ITLine, ENABLE);
238
        VIC_ITCmd(UART0_ITLine, ENABLE);
Line 251... Line 251...
251
/*            UART0 Interrupt Handler                   */
251
/*            UART0 Interrupt Handler                   */
252
/********************************************************/
252
/********************************************************/
253
void UART0_IRQHandler(void)
253
void UART0_IRQHandler(void)
254
{
254
{
255
        u8 c;
255
        u8 c;
256
        // if receive irq or receive timeout irq has occured
256
        // if receive irq (FIFO is over trigger level) or receive timeout irq (FIFO is not empty for longer times) has occured
257
        if((UART_GetITStatus(UART0, UART_IT_Receive) != RESET) || (UART_GetITStatus(UART0, UART_IT_ReceiveTimeOut) != RESET) )
257
        if((UART_GetITStatus(UART0, UART_IT_Receive) != RESET) || (UART_GetITStatus(UART0, UART_IT_ReceiveTimeOut) != RESET) )
258
        {
258
        {
259
                UART_ClearITPendingBit(UART0, UART_IT_Receive);                 // clear receive interrupt flag
259
                UART_ClearITPendingBit(UART0, UART_IT_Receive);                 // clear receive interrupt flag
260
                UART_ClearITPendingBit(UART0, UART_IT_ReceiveTimeOut);  // clear receive timeout interrupt flag
260
                UART_ClearITPendingBit(UART0, UART_IT_ReceiveTimeOut);  // clear receive timeout interrupt flag