예제 #1
0
/*FUNCTION*-------------------------------------------------------------------
*
* Function Name    : _bsp_get_usb_timer_register_base
* Returned Value   : Address upon success, NULL upon failure
* Comments         :
*    This function returns the address of the VUSBHS Timer Registers
*
*END*----------------------------------------------------------------------*/
pointer _bsp_get_usb_timer_register_base(uint_8 dev_num)
{
    if (dev_num != 0) {
        return NULL;
    }
   if(host_device)
    	return (pointer)((uint_32)&(((VMCF5329_STRUCT_PTR)_PSP_GET_IPSBAR())->USBHOST) + 0x080);
   else 
        return (pointer)((uint_32)&(((VMCF5329_STRUCT_PTR)_PSP_GET_IPSBAR())->USBOTG) + 0x080);
}
예제 #2
0
/*FUNCTION*-------------------------------------------------------------------
*
* Function Name    : _bsp_get_usb_capability_register_base
* Returned Value   : Address upon success, NULL upon failure
* Comments         :
*    This function returns the address of the VUSBHS Capability Registers
*
*END*----------------------------------------------------------------------*/
pointer _bsp_get_usb_capability_register_base(uint_8 dev_num)
{
   switch (dev_num) {
      case 0:
         return (pointer)((uint_32)&(((VMCF5329_STRUCT_PTR)_PSP_GET_IPSBAR())->USBHOST) + 0x100);
      case 1:
         return (pointer)((uint_32)&(((VMCF5329_STRUCT_PTR)_PSP_GET_IPSBAR())->USBOTG) + 0x100);
      default:
         return NULL;
   }
}
예제 #3
0
/*FUNCTION*-------------------------------------------------------------------
*
* Function Name    : _bsp_get_usb_base
* Returned Value   : Address upon success, NULL upon failure
* Comments         :
*    This function returns the address of USB OTG module
*
*END*----------------------------------------------------------------------*/
pointer _bsp_get_usb_base(uint_8 dev_num)
{
   switch (dev_num) {
      case 0:
         return (pointer)(&((VMCF5329_STRUCT_PTR)_PSP_GET_IPSBAR())->USBHOST);
      case 1:
         return (pointer)(&((VMCF5329_STRUCT_PTR)_PSP_GET_IPSBAR())->USBOTG);
      default:
         return NULL;
   }
}
예제 #4
0
static uint_32 get_ticks_and_pmr
   (
      /* [IN] the timer to clear */
      uint_32     timer,

      /* [OUT] the timer's PMR value */
      uint_16_ptr pmrp
   )
{ /* Body */

   volatile MCF5222_STRUCT      _PTR_  reg_ptr = _PSP_GET_IPSBAR();
   volatile MCF522XX_PIT_STRUCT _PTR_  pit_ptr = &reg_ptr->PIT[timer];

   uint_16 pmr   = pit_ptr->PMR;
   uint_32 ticks = pmr - pit_ptr->PCNTR;

   if (pit_ptr->PCSR & MCF5222_PIT_PCSR_PIF) {
      /*
      ** Another full TICK period has expired since we handled
      ** the last timer interrupt.  We need to read the counter (PCNTR) again,
      ** since the wrap may have occurred between the previous read and 
      ** the checking of the PIF bit.
      */      
      ticks = pmr + (pmr - pit_ptr->PCNTR);      
   } /* Endif */

   *pmrp = pmr;

   return ticks;

} /* Endbody */
예제 #5
0
static void _bsp_setup_watchdog
   (
      void
   )
{ /* Body */

   VMCF5225_STRUCT_PTR reg_ptr = _PSP_GET_IPSBAR();

   reg_ptr->SCM.CWCR = 0;

   if (reg_ptr->SCM.CWCR & MCF5225_SCM_CWCR_CWTAVAL) {
      reg_ptr->SCM.CWCR = MCF5225_SCM_CWCR_CWTAVAL;
   } /* Endif */
   if (reg_ptr->SCM.CWCR & MCF5225_SCM_CWCR_CWTIC) {
      reg_ptr->SCM.CWCR = MCF5225_SCM_CWCR_CWTIC;
   } /* Endif */

   // Clear the watchdog count
   reg_ptr->SCM.CWSR = 0x55;
   reg_ptr->SCM.CWSR = 0xAA;

#if BSP_WATCHDOG_INITIALIZATION != BSP_WATCHDOG_DISABLED
   reg_ptr->SCM.CWCR = 0
# if BSP_WATCHDOG_INITIALIZATION == BSP_WATCHDOG_RESET
# error Watchdog resets immediately for some reason
      | MCF5225_SCM_CWCR_CWRI
# endif
      | MCF5225_SCM_CWCR_CWE
      | MCF5225_SCM_CWCR_CWT(BSP_WATCHDOG_DELAY);
#endif

} /* Endbody */
예제 #6
0
/*FUNCTION*-------------------------------------------------------------------
*
* Function Name    : _bsp_usb_io_init
* Returned Value   : none
* Comments         :
*    This function performs BSP-specific initialization related to USB
*
*END*----------------------------------------------------------------------*/
void _bsp_usb_io_init
(
    void
)
{
    VMCF5225_STRUCT_PTR reg_ptr = _PSP_GET_IPSBAR();

    /* Turn Vbus off before setting pin peripheral mode */
    reg_ptr->GPIO.PORTUA |= MCF5225_GPIO_PORTxP3;

    /* USB_VBUSE as secondary function (Alt1) */
    reg_ptr->GPIO.PUAPAR &= 0x3f;
    reg_ptr->GPIO.DDRUA |= MCF5225_GPIO_DDRx3;
   
    /* USB_VBUSD as secondary function (Alt1) */
    reg_ptr->GPIO.PUAPAR &= 0xcf;
    reg_ptr->GPIO.DDRUA &= ~MCF5225_GPIO_DDRx2;
   
    /* Turn Vbus on */
    reg_ptr->GPIO.PORTUA &= ~MCF5225_GPIO_PORTxP3;
   
    /* Use external PD resistors on D+ (PQSPA6) and D- (PQSPA5) */
    //reg_ptr->GPIO.PQSPAR |= MCF5225_GPIO_PQSPAR_PQSPA5(3) | MCF5225_GPIO_PQSPAR_PQSPA6(3);

    /* Set clock source from internal PLL oscillator */
    reg_ptr->USBOTG.USBCTRL &= ~USB_USBCTRL_CLKSRC_MASK;
    reg_ptr->USBOTG.USBCTRL |= USB_USBCTRL_CLKSRC_OSCCLK;
}
예제 #7
0
/*FUNCTION*-------------------------------------------------------------------
*
* Function Name    : _bsp_serial_io_init
* Returned Value   : 0 for success, -1 for failure
* Comments         :
*    This function performs BSP-specific initialization related to serial
*
*END*----------------------------------------------------------------------*/
_mqx_int _bsp_serial_io_init
(
    uint_8 dev_num
)
{
    VMCF5227_STRUCT_PTR reg_ptr = _PSP_GET_IPSBAR();
    
    switch (dev_num) {
        case 0:
           reg_ptr->GPIO.PAR_UART |= MCF5227_GPIO_PAR_UART_U0TXD_U0TXD | MCF5227_GPIO_PAR_UART_U0RXD_U0RXD
#if BSPCFG_ENABLE_TTYA_HW_SIGNALS
                                  |  MCF5227_GPIO_PAR_UART_U0RTS_U0RTS | MCF5227_GPIO_PAR_UART_U0CTS_U0CTS
#endif                                     
                                  ;
           break;
        case 1:
           reg_ptr->GPIO.PAR_UART |= MCF5227_GPIO_PAR_UART_U1TXD_U1TXD | MCF5227_GPIO_PAR_UART_U1RXD_U1RXD
#if BSPCFG_ENABLE_TTYB_HW_SIGNALS
                                  |  MCF5227_GPIO_PAR_UART_U1RTS_U1RTS | MCF5227_GPIO_PAR_UART_U1CTS_U1CTS
#endif                                     
                                  ;
           break;
        case 2:
           reg_ptr->GPIO.PAR_DSPI |= MCF5227_GPIO_PAR_DSPI_SIN_U2RXD | MCF5227_GPIO_PAR_DSPI_SOUT_U2TXD
                                  ;
           break;
        default:
           return -1;
    }
    return 0;
}
예제 #8
0
/*FUNCTION****************************************************************
* 
* Function Name    : _bsp_get_rtc_base_address
* Returned Value   : pointer to base of RTC registers
* Comments         :
*    This function returns base address of RTC related register space.
*
*END*********************************************************************/
pointer _bsp_get_rtc_base_address 
(
    void
)
{
    return (pointer)(&((VMCF5225_STRUCT_PTR)_PSP_GET_IPSBAR())->RTC);
}
예제 #9
0
/*FUNCTION*-------------------------------------------------------------------
*
* Function Name    : _bsp_get_usb_capability_register_base
* Returned Value   : Address upon success, NULL upon failure
* Comments         :
*    This function returns the address of the VUSBHS Capability Registers
*
*END*----------------------------------------------------------------------*/
pointer _bsp_get_usb_capability_register_base(uint_8 dev_num)
{
    if (dev_num != 0) {
        return NULL;
    }
   
    return (pointer)((uint_32)&(((VMCF5445_STRUCT_PTR)_PSP_GET_IPSBAR())->USBOTG) + 0x100);
}
예제 #10
0
/*FUNCTION*-------------------------------------------------------------------
*
* Function Name    : _bsp_get_usb_base
* Returned Value   : Address upon success, NULL upon failure
* Comments         :
*    This function returns the address of USB OTG module
*
*END*----------------------------------------------------------------------*/
pointer _bsp_get_usb_base(uint_8 dev_num)
{
    if (dev_num != 0) {
        return NULL;
    }
   
    return (pointer)(&((VMCF5445_STRUCT_PTR)_PSP_GET_IPSBAR())->USBOTG);
}
예제 #11
0
/*FUNCTION*-------------------------------------------------------------------
*
* Function Name    : _bsp_get_usb_otg_csr
* Returned Value   : Address upon success, NULL upon failure
* Comments         :
*    This function returns the address of the U0CSR register
*
*END*----------------------------------------------------------------------*/
pointer _bsp_get_usb_otg_csr(uint_8 dev_num)
{
    if (dev_num != 0) {
        return NULL;
    }
   
    return (pointer) &(((VMCF5329_STRUCT_PTR)_PSP_GET_IPSBAR())->CCM).UOCSR;
}
예제 #12
0
uint_32 _mcf5222_timer_init_freq
   (
      /* [IN] the timer to initialize */
      _mqx_uint timer,

      /* [IN] ticks per second */
      uint_32   tickfreq,

      /* [IN] the system clock speed in MHz */
      uint_32   system_clock,

      /* [IN] Unmask the timer after initializing */
      boolean   unmask_timer
   )
{ /* Body */

   volatile MCF5222_STRUCT      _PTR_  reg_ptr = _PSP_GET_IPSBAR();
   volatile MCF522XX_PIT_STRUCT _PTR_  pit_ptr = &reg_ptr->PIT[timer];
   uint_32 rate, prescale = 0;
   uint_32 ticks_per_sec = tickfreq;    // usually 200
   uint_32 tps = (ticks_per_sec << 1);  // scaled for division
   uint_32 clk = system_clock << 1;     // scaled for division

   _mcf5222_int_init(_bsp_timers[timer].INTERRUPT,
      _bsp_timers[timer].LEVEL, _bsp_timers[timer].SUBLEVEL, FALSE);

   pit_ptr->PCSR = MCF5222_PIT_PCSR_HALTED  // stop timer when halted
      | MCF5222_PIT_PCSR_PIF                // Clear interrupt if present
      | MCF5222_PIT_PCSR_OVW;               // Overwrite count with PMR when written

   rate = (clk / tps ) >> 1;                // divide with rounding
   while (rate > 0xFFFF) {
      prescale += 1;                        // divides clock in half
      clk >>= 1;
      rate = (clk / tps ) >> 1;             // divide with rounding
   } /* Endwhile */

   pit_ptr->PCSR = (prescale << MCF5222_PIT_PCSR_PRESCALE_SHIFT)
      | MCF5222_PIT_PCSR_OVW
      | MCF5222_PIT_PCSR_PIE
      | MCF5222_PIT_PCSR_RLD;

   /* Set counter reload value and counter value */
   pit_ptr->PMR = (uint_16)rate;

   if (unmask_timer) {
      _mcf5222_timer_unmask_int(timer);
   } /* Endif */

   /* Enable the timer */
   pit_ptr->PCSR |= MCF5222_PIT_PCSR_EN;

   /* Return the tick rate */
   return rate;

} /* Endbody */
예제 #13
0
_mqx_int gpio_cpu_init()
{ /* Body */
    VMCF5225_STRUCT_PTR  mcf5225_ptr;
 
    mcf5225_ptr = _PSP_GET_IPSBAR();
    mcf5225_gpio_ptr = &mcf5225_ptr->GPIO;
    mcf5225_eport_ptr = &mcf5225_ptr->EPORT[0];
 
    return IO_OK;
} /* Endbody */
예제 #14
0
/*FUNCTION*-------------------------------------------------------------------
* 
* Function Name    : _bsp_flexbus_io_init
* Returned Value   :  none
* Comments         :
*    This function performs BSP-specific initialization Mini FlexBUS 
*    signals for compact flash card or MRAM
*
*END*----------------------------------------------------------------------*/
void _bsp_flexbus_io_init (void)
{
   VMCF5225_STRUCT_PTR reg_ptr = _PSP_GET_IPSBAR();
   /* Enable Mini FlexBUS signals (used by external MRAM and CPLD) */
   reg_ptr->GPIO.PASPAR = 0x20;   /* enable CS1 operation for CPLD */
   reg_ptr->GPIO.PTEPAR = 0xff;
   reg_ptr->GPIO.PTFPAR = 0xff;
   reg_ptr->GPIO.PTGPAR = 0xff;   /* enable CS0 operation for MRAM */
   reg_ptr->GPIO.PTHPAR = 0x5555;
}
예제 #15
0
/*FUNCTION*-------------------------------------------------------------------
*
* Function Name    : _bsp_usb_io_init
* Returned Value   : none
* Comments         :
*    This function performs BSP-specific initialization related to USB
*
*END*----------------------------------------------------------------------*/
void _bsp_usb_io_init
(
    void
)
{
    VMCF5227_STRUCT_PTR reg_ptr = _PSP_GET_IPSBAR();

    // setup gpio state, func and directions
    
    // USB_VBUS_OC
    reg_ptr->GPIO.PAR_UART = (reg_ptr->GPIO.PAR_UART & ~MCF5227_GPIO_PAR_UART_U0RTS_U0RTS) | MCF5227_GPIO_PAR_UART_U0RTS_USBVBOC;
}
예제 #16
0
/*FUNCTION*-------------------------------------------------------------------
*
* Function Name    : _bsp_get_serial_base_address
* Returned Value   : Address upon success, NULL upon failure
* Comments         :
*    This function returns the base register address of the corresponding UART
*
*END*----------------------------------------------------------------------*/
void *_bsp_get_serial_base_address
(
    uint8_t dev_num
)
{
   if (dev_num >= MCF5225_NUM_UARTS)
   {
      return NULL;
   }
   
   return (void *)(&((VMCF5225_STRUCT_PTR)_PSP_GET_IPSBAR())->UART[dev_num]);
}
예제 #17
0
/*FUNCTION*-------------------------------------------------------------------
*
* Function Name    : _bsp_get_serial_base_address
* Returned Value   : Address upon success, NULL upon failure
* Comments         :
*    This function returns the base register address of the corresponding UART
*
*END*----------------------------------------------------------------------*/
pointer _bsp_get_serial_base_address
(
    uint_8 dev_num
)
{
   if (dev_num >= MCF5208_NUM_UARTS)
   {
      return NULL;
   }
   
   return (pointer)(&((VMCF5208_STRUCT_PTR)_PSP_GET_IPSBAR())->UART[dev_num]);
}
예제 #18
0
void *_bsp_get_i2c_base_address
(
   uint8_t dev_num
)
{
   void   *addr;
   
   switch (dev_num) 
   {
      case 0:
         addr = (void *)&(((VMCF5441_STRUCT_PTR)_PSP_GET_IPSBAR())->I2C0);
         break;
      case 1:
         addr = (void *)&(((VMCF5441_STRUCT_PTR)_PSP_GET_IPSBAR())->I2C1);
         break;
      case 2:
         addr = (void *)&(((VMCF5441_STRUCT_PTR)_PSP_GET_IPSBAR())->I2C2);
         break;
      case 3:
         addr = (void *)&(((VMCF5441_STRUCT_PTR)_PSP_GET_IPSBAR())->I2C3);
         break;
      case 4:
         addr = (void *)&(((VMCF5441_STRUCT_PTR)_PSP_GET_IPSBAR())->I2C4);
         break;
      case 5:
         addr = (void *)&(((VMCF5441_STRUCT_PTR)_PSP_GET_IPSBAR())->I2C5);
         break;
      default:
        addr = NULL;
        break;
    }
    return addr;
}
예제 #19
0
/*FUNCTION****************************************************************
* 
* Function Name    : _bsp_get_flexcan_base_address  
* Returned Value   : Pointer to desired CAN device or NULL if not present
* Comments         :
*    This function returns pointer to base address of address space of the 
*    desired CAN device. Returns NULL otherwise.
*
*END*********************************************************************/
void *_bsp_get_flexcan_base_address
(
   /* [IN] FlexCAN device number */
   uint8_t dev_num
)
{ /* Body */
    if (dev_num != 0)
    {
        return NULL;
    }
   
    return (void *)(&((VMCF5225_STRUCT_PTR)_PSP_GET_IPSBAR())->FCAN);
} /* EndBody */
예제 #20
0
/*FUNCTION*-------------------------------------------------------------------
* 
* Function Name    : _bsp_qspi_io_init
* Returned Value   : 0 for success, -1 for failure
* Comments         :
*    This function performs BSP-specific initialization related to QSPI
*
*END*----------------------------------------------------------------------*/
_mqx_int _bsp_qspi_io_init
(
   uint_8 dev_num
)
{
    VMCF5225_STRUCT_PTR reg_ptr = _PSP_GET_IPSBAR();
    
    if (0 != dev_num) return -1;

    reg_ptr->GPIO.PQSPAR &= (~ (MCF5225_GPIO_PQSPAR_PQSPA0(3) | MCF5225_GPIO_PQSPAR_PQSPA1(3) | MCF5225_GPIO_PQSPAR_PQSPA2(3) | MCF5225_GPIO_PQSPAR_PQSPA3(3)));
    reg_ptr->GPIO.PQSPAR |= (MCF5225_GPIO_PQSPAR_PQSPA0(1) | MCF5225_GPIO_PQSPAR_PQSPA1(1) | MCF5225_GPIO_PQSPAR_PQSPA2(1) | MCF5225_GPIO_PQSPAR_PQSPA3(1));

    return 0;
} /* Endbody */
예제 #21
0
/*FUNCTION****************************************************************
* 
* Function Name    : _bsp_rtc_io_init
* Returned Value   : none
* Comments         :
*    This function sets up the RTC clk source register and prescaler.
*
*END*********************************************************************/
void _bsp_rtc_io_init 
(
    void
)
{
    VMCF5227_CCM_STRUCT_PTR ccm = &(((VMCF5227_STRUCT_PTR)_PSP_GET_IPSBAR())->CCM);
    VMCF52XX_RTC_STRUCT_PTR rtc = _bsp_get_rtc_base_address ();
    ccm->MISCCR &= (~ MCF5227_CCM_MISCCR_RTCSRC);
    rtc->RTCGOCU = BSP_RTC_PRESCALER_GOCU;
    rtc->RTCGOCU = BSP_RTC_PRESCALER_GOCU;       // according to RTC register write protocol - 2x
    rtc->RTCGOCL = BSP_RTC_PRESCALER_GOCL;
    rtc->RTCGOCL = BSP_RTC_PRESCALER_GOCL;       // according to RTC register write protocol - 2x
    _rtc_init (RTC_INIT_FLAG_ENABLE);
}
예제 #22
0
/*FUNCTION*-------------------------------------------------------------------
* 
* Function Name    : _bsp_rtc_io_init
* Returned Value   : none
* Comments         :
*    This function performs BSP-specific initialization related to RTC
*
*END*----------------------------------------------------------------------*/
void _bsp_rtc_io_init 
(
   void
)
{
   VMCF5225_CLK_STRUCT_PTR clk = &(((VMCF5225_STRUCT_PTR)_PSP_GET_IPSBAR())->CLK);
   VMCF52XX_RTC_STRUCT_PTR rtc = _bsp_get_rtc_base_address ();
   clk->RTCCR = MCF5225_CLOCK_RTCCR_EXTALEN | MCF5225_CLOCK_RTCCR_REFS | MCF5225_CLOCK_RTCCR_LPEN | MCF5225_CLOCK_RTCCR_RTCSEL;
   rtc->RTCGOCU = BSP_RTC_PRESCALER_GOCU;
   rtc->RTCGOCU = BSP_RTC_PRESCALER_GOCU;    // according to RTC register write protocol - 2x
   rtc->RTCGOCL = BSP_RTC_PRESCALER_GOCL;
   rtc->RTCGOCL = BSP_RTC_PRESCALER_GOCL;    // according to RTC register write protocol - 2x
   _rtc_init (RTC_INIT_FLAG_ENABLE);
}
예제 #23
0
/*FUNCTION*-------------------------------------------------------------------
*
* Function Name    : _bsp_usb_dev_init
* Returned Value   : 0 for success, -1 for failure
* Comments         :
*    This function performs BSP-specific initialization related to USB
*
*END*----------------------------------------------------------------------*/
_mqx_int _bsp_usb_dev_init(struct usb_dev_if_struct *usb_if)
{
    VMCF5329_STRUCT_PTR reg_ptr = _PSP_GET_IPSBAR();
    uint_32 status;
    _bsp_usb_io_init(USB_CONNECTOR_OTG);
    
    /* setup interrupt */
    status = _mcf5329_int_init(MCF5329_INT_USB_OTG, 2, TRUE);
    
    if (status != MQX_OK) {
        return -1;
    }

    return MQX_OK;
}
예제 #24
0
/*FUNCTION*-------------------------------------------------------------------
* 
* Function Name    : _bsp_enet_io_init
* Returned Value   : none
* Comments         :
*    This function performs BSP-specific initialization related to ENET
*
*END*----------------------------------------------------------------------*/
void _bsp_enet_io_init 
(
   uint_32  device
) 
{
   VMCF5225_STRUCT_PTR mcf5225_ptr;

   if (device >= BSP_ENET_DEVICE_COUNT) 
      return;

   mcf5225_ptr = _PSP_GET_IPSBAR();
   mcf5225_ptr->GPIO.PNQPAR = (mcf5225_ptr->GPIO.PNQPAR & ~(3 << 6 | 3 << 10)) | 0x880;
   mcf5225_ptr->GPIO.PTIPAR = 0xFF;
   mcf5225_ptr->GPIO.PTJPAR = 0xFF;
}
예제 #25
0
void _bsp_timer_isr
   (
      pointer dummy
   )
{ /* Body */
#if BSP_WATCHDOG_INITIALIZATION != BSP_WATCHDOG_DISABLED
   // Service the watchdog timer to verify we are still in control
   VMCF5225_STRUCT_PTR reg_ptr = _PSP_GET_IPSBAR();
   reg_ptr->SCM.CWSR = 0x55;
   reg_ptr->SCM.CWSR = 0xAA;
#endif

   _mcf5225_timer_clear_int(BSP_TIMER);
   _time_notify_kernel();

} /* Endbody */
예제 #26
0
/*FUNCTION*-------------------------------------------------------------------
* 
* Function Name    : _bsp_flexcan_io_init
* Returned Value   : 0 for success, -1 for failure
* Comments         :
*    This function performs BSP-specific initialization related to FLEXCAN
*
*END*----------------------------------------------------------------------*/
_mqx_int _bsp_flexcan_io_init
(
    uint_8 dev_num
)
{
    VMCF5227_STRUCT_PTR reg_ptr = _PSP_GET_IPSBAR();

    switch (dev_num) {
        case 0:
            reg_ptr->GPIO.PAR_I2C = 0x0A;
            break;
        default:
            return -1;
    }
    return 0;
}
예제 #27
0
/*FUNCTION*-------------------------------------------------------------------
*
* Function Name    : _bsp_usb_host_init
* Returned Value   : 0 for success, -1 for failure
* Comments         :
*    This function performs BSP-specific initialization related to USB
*
*END*----------------------------------------------------------------------*/
_mqx_int _bsp_usb_host_init(struct usb_host_if_struct *usb_if)
{
    VMCF5445_STRUCT_PTR reg_ptr = _PSP_GET_IPSBAR();
    uint_32 status;

    _bsp_usb_io_init(USBCFG_USBOTG_CONNECTOR);
    
    // setup interrupt
    status = _mcf5445_int_init(MCF5445_INT_USB, 2, TRUE);
    
    if (status != MQX_OK) {
        return -1;
    }

    return MQX_OK;
}
예제 #28
0
/*FUNCTION*-------------------------------------------------------------------
* 
* Function Name    : _bsp_i2c_io_init
* Returned Value   : 0 for success, -1 for failure
* Comments         :
*    This function performs BSP-specific initialization related to I2C
*
*END*----------------------------------------------------------------------*/
_mqx_int _bsp_i2c_io_init
(
    uint_8 dev_num
)
{
    VMCF5227_STRUCT_PTR reg_ptr = _PSP_GET_IPSBAR();

    switch (dev_num) {
        case 0:         
            /* mask with old values not needed, all bits are set */
            reg_ptr->GPIO.PAR_I2C = MCF5227_GPIO_PAR_SDA_I2C | MCF5227_GPIO_PAR_SCL_I2C;
            break;
        default:
            return -1;
    }
    return 0;
} /* Endbody */
예제 #29
0
/*FUNCTION*-------------------------------------------------------------------
*
* Function Name    : _bsp_usb_init
* Returned Value   : 0 for success, -1 for failure
* Comments         :
*    This function performs BSP-specific initialization related to USB
*
*END*----------------------------------------------------------------------*/
_mqx_int _bsp_usb_host_init(pointer param)
{
    VMCF5329_STRUCT_PTR reg_ptr = _PSP_GET_IPSBAR();
    uint_32 status;
    host_device=1;

    _bsp_usb_io_init(USB_CONNECTOR_HOST);
    
    /* setup interrupt */
    status = _mcf5329_int_init(MCF5329_INT_USB_HOST, 2, TRUE);
    
    if (status != MQX_OK) {
        return -1;
    }

    return MQX_OK;
}
예제 #30
0
/*FUNCTION*-------------------------------------------------------------------
* 
* Function Name    : _bsp_flexcan_io_init
* Returned Value   : 0 for success, -1 for failure
* Comments         :
*    This function performs BSP-specific initialization related to FLEXCAN
*
*END*----------------------------------------------------------------------*/
_mqx_int _bsp_flexcan_io_init
(
   uint_8 dev_num
)
{
    VMCF5225_STRUCT_PTR reg_ptr = _PSP_GET_IPSBAR();

    switch (dev_num) {
      case 0:
         reg_ptr->GPIO.PUCPAR = (reg_ptr->GPIO.PUCPAR & ~0x03) | 0x02;
         reg_ptr->GPIO.PUCPAR = (reg_ptr->GPIO.PUCPAR & ~0x0C) | 0x08;
         break;
      default:
         return -1;
    }
    return 0;
}