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

📄 bsp.c

📁 从Luminary官方网站下载的LM3S6000系列的UCos+Tcp/IP的源码, 经本人稍微修改后可直接在IAR6.2下编译通过,里面包括了LM3S6000系列的所有外设UART, PWn....
💻 C
📖 第 1 页 / 共 2 页
字号:
/*
*********************************************************************************************************
*                                     MICIRUM BOARD SUPPORT PACKAGE
*
*                          (c) Copyright 2003-2006; Micrium, Inc.; Weston, FL
*
*               All rights reserved.  Protected by international copyright laws.
*               Knowledge of the source code may NOT be used to develop a similar product.
*               Please help us continue to provide the Embedded community with the finest
*               software available.  Your honesty is greatly appreciated.
*********************************************************************************************************
*/

/*
*********************************************************************************************************
*
*                                        BOARD SUPPORT PACKAGE
*
*                                       Luminary Micro LM3S6965
*                                              with the
*                             Luminary Micro LM3S6965 ENET Development Kit
*
* Filename      : bsp.c
* Version       : V1.00
* Programmer(s) : Brian Nagel
*********************************************************************************************************
*/

/*
*********************************************************************************************************
*                                             INCLUDE FILES
*********************************************************************************************************
*/

#define  BSP_GLOBALS
#include <includes.h>


/*
*********************************************************************************************************
*                                            LOCAL DEFINES
*********************************************************************************************************
*/
                                                                /* ---------------------- GPIOA Pins ---------------------- */
#define  GPIOA_U0RX                     DEF_BIT_00              /* UART0 Receive                                            */
#define  GPIOA_U0TX                     DEF_BIT_01              /* UART1 Transmit                                           */
#define  GPIOA_SSI0CLK                  DEF_BIT_02              /* MicroSD Card Slot & OLED                                 */
#define  GPIOA_OLEDCSN                  DEF_BIT_03              /* OLED Chip Select                                         */
#define  GPIOA_SSI0RX                   DEF_BIT_04              /* MicroSD Card Slot & OLED                                 */
#define  GPIOA_SSI0TX                   DEF_BIT_05              /* MicroSD Card Slot                                        */

                                                                /* ---------------------- GPIOC Pins ---------------------- */
#define  GPIOC_OLEDDC                   DEF_BIT_07              /* OLED                                                     */

                                                                /* ---------------------- GPIOD Pins ---------------------- */
#define  GPIOD_CARDCSN                  DEF_BIT_00              /* MicroSD Card Slot Chip Select                            */
#define  GPIOD_PWM1                     DEF_BIT_01              /* Sound                                                    */

                                                                /* ---------------------- GPIOE Pins ---------------------- */
#define  GPIOE_SW_UP                    DEF_BIT_00              /* User Button: Up                                          */
#define  GPIOE_SW_DOWN                  DEF_BIT_01              /* User Button: Down                                        */
#define  GPIOE_SW_LEFT                  DEF_BIT_02              /* User Button: Left                                        */
#define  GPIOE_SW_RIGHT                 DEF_BIT_03              /* User Button: Right                                       */

                                                                /* ---------------------- GPIOF Pins ---------------------- */
#define  GPIOF_PWM0                     DEF_BIT_00              /* User LED                                                 */
#define  GPIOF_SW_SELECT                DEF_BIT_01              /* User Button: Select                                      */


/*
*********************************************************************************************************
*                                           LOCAL CONSTANTS
*********************************************************************************************************
*/


/*
*********************************************************************************************************
*                                          LOCAL DATA TYPES
*********************************************************************************************************
*/


/*
*********************************************************************************************************
*                                            LOCAL TABLES
*********************************************************************************************************
*/


/*
*********************************************************************************************************
*                                       LOCAL GLOBAL VARIABLES
*********************************************************************************************************
*/


/*
*********************************************************************************************************
*                                      LOCAL FUNCTION PROTOTYPES
*********************************************************************************************************
*/

static  void  Tmr_TickInit  (void);
static  void  LED_Init      (void);
static  void  PB_Init       (void);


/*
******************************************************************************************************************************
******************************************************************************************************************************
**                                         Global Functions
******************************************************************************************************************************
******************************************************************************************************************************
*/

/*
*********************************************************************************************************
*                                         BSP INITIALIZATION
*
* Description : This function should be called by your application code before you make use of any of the
*               functions found in this module.
*
* Arguments   : none
*********************************************************************************************************
*/

void  BSP_Init (void)
{
    SysCtlClockSet(SYSCTL_SYSDIV_5 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ);
    OSRAM128x64x4Init(1000000);

    LED_Init();                                                 /* Initialize the I/Os for the LED controls                 */
    PB_Init();

    Tmr_TickInit();                                             /* Initialize the uC/OS-II tick interrupt                   */
}


/*
*********************************************************************************************************
*                                     DISABLE ALL INTERRUPTS
*
* Description : This function disables all interrupts from the interrupt controller.
*
* Arguments   : none
*********************************************************************************************************
*/

void  BSP_IntDisAll (void)
{
    CPU_IntDis();
}


/*
******************************************************************************************************************************
******************************************************************************************************************************
**                                       PB and LED Functions
******************************************************************************************************************************
******************************************************************************************************************************
*/

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

static  void  PB_Init (void)
{
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);

    GPIODirModeSet(  GPIO_PORTE_BASE, GPIOE_SW_UP | GPIOE_SW_DOWN | GPIOE_SW_LEFT | GPIOE_SW_RIGHT, GPIO_DIR_MODE_IN);
    GPIOPadConfigSet(GPIO_PORTE_BASE, GPIOE_SW_UP | GPIOE_SW_DOWN | GPIOE_SW_LEFT | GPIOE_SW_RIGHT, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
    GPIODirModeSet(  GPIO_PORTF_BASE, GPIOF_SW_SELECT, GPIO_DIR_MODE_IN);
    GPIOPadConfigSet(GPIO_PORTF_BASE, GPIOF_SW_SELECT, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
}


/*
*********************************************************************************************************
*                                         GET 'PUSH BUTTON' STATUS
*
* Description : This function is used to get the status of any push button on the board.
*
* Arguments   : push_button    is the number of the push button to probe
*                              1    probe the user push button
*
* Returns     : DEF_TRUE  if the push button is pressed
*               DEF_FALSE if the push button is not pressed
*********************************************************************************************************
*/

CPU_BOOLEAN  PB_GetStatus (CPU_INT08U pb)
{
    CPU_BOOLEAN  status;
    CPU_INT32U   pins;


    status = DEF_FALSE;

    switch (pb) {
        case 1:
             pins = GPIOPinRead(GPIO_PORTF_BASE, GPIOF_SW_SELECT);
             if (pins == 0) {
                 status = DEF_TRUE;

⌨️ 快捷键说明

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