⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bsp.c

📁 从Luminary官方网站下载的LM3S6000系列的UCos+Tcp/IP的源码, 经本人稍微修改后可直接在IAR6.2下编译通过,里面包括了LM3S6000系列的所有外设UART, PWn....
💻 C
📖 第 1 页 / 共 2 页
字号:
             }
             break;

        case 2:
             pins = GPIOPinRead(GPIO_PORTE_BASE, GPIOE_SW_UP);
             if (pins == 0) {
                 status = DEF_TRUE;
             }
             break;

        case 3:
             pins = GPIOPinRead(GPIO_PORTE_BASE, GPIOE_SW_DOWN);
             if (pins == 0) {
                 status = DEF_TRUE;
             }
             break;

        case 4:
             pins = GPIOPinRead(GPIO_PORTE_BASE, GPIOE_SW_LEFT);
             if (pins == 0) {
                 status = DEF_TRUE;
             }
             break;

        case 5:
             pins = GPIOPinRead(GPIO_PORTE_BASE, GPIOE_SW_RIGHT);
             if (pins == 0) {
                 status = DEF_TRUE;
             }
             break;

        default:
             break;
    }

    return (status);
}


/*
*********************************************************************************************************
*                                         LED INITIALIZATION
*
* Description : This function initializes the board's LEDs
*
* Arguments   : none
*
* Returns     ; none
*********************************************************************************************************
*/

static  void  LED_Init (void)
{
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
    GPIODirModeSet(GPIO_PORTF_BASE, GPIOF_PWM0, GPIO_DIR_MODE_OUT);
    GPIOPadConfigSet(GPIO_PORTF_BASE, GPIOF_PWM0, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD);
    LED_Off(0);                                                 /* Turn OFF all the LEDs                                    */
}


/*
*********************************************************************************************************
*                                             LED ON
*
* Description : This function is used to control any or all the LEDs on the board.
*
* Arguments   : led    is the number of the LED to control
*                      0    indicates that you want ALL the LEDs to be ON
*                      1    turns ON user LED on the board
*
* Returns     ; none
*********************************************************************************************************
*/

void  LED_On (CPU_INT08U led)
{
    switch (led) {
        case 0:
        case 1:
             GPIOPinWrite(GPIO_PORTF_BASE, GPIOF_PWM0, 0);
             break;

        default:
             break;
    }
}


/*
*********************************************************************************************************
*                                             LED OFF
*
* Description : This function is used to control any or all the LEDs on the board.
*
* Arguments   : led    is the number of the LED to turn OFF
*                      0    indicates that you want ALL the LEDs to be OFF
*                      1    turns OFF user LED on the board
*
* Returns     ; none
*********************************************************************************************************
*/

void  LED_Off (CPU_INT08U led)
{
    switch (led) {
        case 0:
        case 1:
             GPIOPinWrite(GPIO_PORTF_BASE, GPIOF_PWM0, 1);
             break;

        default:
             break;
    }
}


/*
*********************************************************************************************************
*                                             LED TOGGLE
*
* Description : This function is used to toggle any or all the LEDs on the board.
*
* Arguments   : led    is the number of the LED to control
*                      0    indicates that you want to toggle ALL the LEDs
*                      1    toggles user LED on the board
*
* Returns     ; none
*********************************************************************************************************
*/

void  LED_Toggle (CPU_INT08U led)
{
    CPU_INT32U  pins;


    switch (led) {
        case 0:
        case 1:
             pins = GPIOPinRead(GPIO_PORTF_BASE, GPIOF_PWM0);
             if ((pins & GPIOF_PWM0) == 0) {
                 GPIOPinWrite(GPIO_PORTF_BASE, GPIOF_PWM0, 1);
             } else {
                 GPIOPinWrite(GPIO_PORTF_BASE, GPIOF_PWM0, 0);
             }
            break;

        default:
             break;
    }
}


/*
******************************************************************************************************************************
******************************************************************************************************************************
**                                         uC/OS-II Timer Functions
******************************************************************************************************************************
******************************************************************************************************************************
*/

/*
*********************************************************************************************************
*                                       TICKER INITIALIZATION
*
* Description : This function is called to initialize uC/OS-II's tick source (typically a timer generating
*               interrupts every 1 to 100 mS).
*
* Arguments   : none
*
* Note(s)     : 1) The timer is setup for output compare mode BUT 'MUST' also 'freerun' so that the timer
*                  count goes from 0x00000000 to 0xFFFFFFFF to ALSO be able to read the free running count.
*                  The reason this is needed is because we use the free-running count in uC/OS-View.
*********************************************************************************************************
*/

static  void  Tmr_TickInit (void)
{
    CPU_INT32U  cnts;


    cnts = (CPU_INT32U)SysCtlClockGet() / OS_TICKS_PER_SEC;
    SysTickPeriodSet(cnts);
    SysTickEnable();
    SysTickIntEnable();
}


/*
*********************************************************************************************************
*                                         TIMER IRQ HANDLER
*
* Description : This function handles the timer interrupt that is used to generate TICKs for uC/OS-II.
*
* Arguments   : none
*
* Note(s)     : 1) The timer is 'reloaded' with the count at compare + the time for the next interrupt.
*                  Since we are using 'unsigned' integer math, overflows are irrelevant.
*********************************************************************************************************
*/

void  Tmr_TickISR_Handler (void)
{
    OS_CPU_SR  cpu_sr;


    OS_ENTER_CRITICAL();                         /* Tell uC/OS-II that we are starting an ISR          */
    OSIntNesting++;
    OS_EXIT_CRITICAL();

    OSTimeTick();                                /* Call uC/OS-II's OSTimeTick()                       */

    OSIntExit();                                 /* Tell uC/OS-II that we are leaving the ISR          */
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -