Exemple #1
0
/*******************************************************************************
  Function:
    TCPIP_MAC_EVENT_RESULT    PIC32MACEventInit(TCPIP_MAC_HANDLE hMac, int intPri, int intSubPri)

  Summary:
    Initializes the ethernet event notification.

  Description:
     This function initializes the ethernet event notification.
     It performs any resource allocation that may be needed.

  Precondition:
     None.

  Parameters:
    hMac      - parameter identifying the intended MAC  
    intPri     - priority of the TCPIP interrupt events
    intSubPri  - sub-priority of the TCPIP interrupt events
    
  Returns:
    TCPIP_MAC_EVRES_OK  if initialization succeeded,
    an error code otherwise

  Example:
    <code>
    PIC32MACEventInit( hMac, 4, 3 );
    </code>

  Remarks:

    Not multi-threaded safe.
*****************************************************************************/
TCPIP_MAC_EVENT_RESULT PIC32MACEventInit(TCPIP_MAC_HANDLE hMac, int intPri, int intSubPri)
{
    int grpIx;
    PIC32_EV_GROUP_DCPT*    pDcpt; 
    PIC32_EMB_MAC_DCPT*     pMacD = (PIC32_EMB_MAC_DCPT*)hMac;

    SYS_INT_SourceDisable(pMacD->mData._macIntSrc);      // stop Eth ints
    SYS_INT_SourceStatusClear(pMacD->mData._macIntSrc);
    SYS_INT_PrioritySet(pMacD->mData._macIntSrc, (INT_PRIORITY_LEVEL_1-1)+intPri);
    SYS_INT_SubprioritySet(pMacD->mData._macIntSrc, INT_SUB_PRIORITY_LEVEL_0+intSubPri);
    SYS_INT_DynamicRegister(pMacD->mData._macIntSrc, TcpIpEthIsr, pMacD); 
    
    pDcpt = pMacD->mData._pic32_ev_group_dcpt;
    for(grpIx = 0; grpIx < sizeof(pMacD->mData._pic32_ev_group_dcpt)/sizeof(*pMacD->mData._pic32_ev_group_dcpt); grpIx++)
    {
        pDcpt->_TcpGroupEventsMask = _pic32_mac_group_ev_mask[grpIx];
        pDcpt->_TcpEnabledEvents = pDcpt->_TcpPendingEvents = TCPIP_EV_NONE;
        pDcpt->_EthEnabledEvents = pDcpt->_EthPendingEvents = 0;
        pDcpt->_TcpNotifyFnc = 0;
        pDcpt++;
    }

    _hEventMac = hMac;    
    return TCPIP_MAC_EVRES_OK;
}
Exemple #2
0
void SYS_Initialize ( void* data )
{
	unsigned int cache_status;
    
   /* enable cache */
    cache_status = CHECON;
    cache_status |= (3 << _CHECON_PREFEN_POSITION);
    CHECON = cache_status;
    CheKseg0CacheOn();
    
    /* Initialize the BSP */
    BSP_Initialize( );

    /* Initialize the USB Controller driver */
    appDrvObject.usbCDObject = DRV_USB_Initialize (DRV_USB_INDEX_0 ,
                                                   ( SYS_MODULE_INIT* ) & usbCDInitData);

    /* check if the object returned by the controller driver is valid */
    SYS_ASSERT((SYS_MODULE_OBJ_INVALID != appDrvObject.usbCDObject), "Invalid USB CD object");
	
     /* Initialize the USB device layer */
	appDrvObject.usbDevObject = USB_DEVICE_Initialize (USB_DEVICE_INDEX_0 ,
                                                    ( SYS_MODULE_INIT* ) & usbDevInitData);
    
    /* check if the object returned by the device layer is valid */
    SYS_ASSERT((SYS_MODULE_OBJ_INVALID != appDrvObject.usbDevObject), "Invalid USB DEVICE object");
    
    /* open an instance of the device layer */
    appData.usbDevHandle = USB_DEVICE_Open( USB_DEVICE_INDEX_0, DRV_IO_INTENT_READWRITE );
    
    /* Register a callback with device layer to get event notification (for end point 0) */
    USB_DEVICE_EventCallBackSet(appData.usbDevHandle, APP_UsbDeviceEventCallBack);

    /* Initialize the Application */
    APP_Initialize ( );

    /* Initializethe interrupt system  */
    SYS_INT_Initialize();
    
     /* set priority for USB interrupt source */
    SYS_INT_PrioritySet(INT_SOURCE_USB_1, INT_PRIORITY_LEVEL3);
    
    /* set sub-priority for USB interrupt source */
    SYS_INT_SubprioritySet(INT_SOURCE_USB_1, INT_SUBPRIORITY_LEVEL3);

    /* Initialize the global interrupts */
    SYS_INT_Enable();
    
   
}
Exemple #3
0
/*******************************************************************************
  Function:
    TCPIP_MAC_EVENT_RESULT    MRF24W_MACEventInit(TCPIP_MAC_HANDLE hMac, int intPri, int intSubPri)

  Summary:
    Initializes the ethernet event notification.

  Description:
     This function initializes the ethernet event notification.
     It performs any resource allocation that may be needed.

  Precondition:
     None.

  Parameters:
    hMac      - parameter identifying the intended MAC  
    intPri     - priority of the TCPIP interrupt events
    intSubPri  - sub-priority of the TCPIP interrupt events
    
  Returns:
    TCPIP_MAC_EVRES_OK  if initialization succeeded,
    an error code otherwise

  Example:
    <code>
    MRF24W_MACEventInit( hMac, 4, 3 );
    </code>

  Remarks:

    Not multi-threaded safe.
*****************************************************************************/
TCPIP_MAC_EVENT_RESULT MRF24W_MACEventInit(TCPIP_MAC_HANDLE hMac, int intPri, int intSubPri)
{
    SYS_INT_SourceDisable(MRFWB0M_INT_SOURCE);      // stop MRF ints
    SYS_INT_SourceStatusClear(MRFWB0M_INT_SOURCE);
    SYS_INT_PrioritySet(MRFWB0M_INT_SOURCE, (INT_PRIORITY_LEVEL_1-1)+intPri);
#if defined (__C32__)
    SYS_INT_SubprioritySet(MRFWB0M_INT_SOURCE, INT_SUB_PRIORITY_LEVEL_0+intSubPri);
#endif
    SYS_INT_DynamicRegister(MRFWB0M_INT_SOURCE, MRF24W_ISR, 0); 
    
    _mrfGroupDcpt._mrfNotifyFnc = 0;
    _mrfGroupDcpt._mrfEnabledEvents = false;
    _mrfGroupDcpt._mrfPendingEvents = 0;

    _mrfUsrEvent.trafficEvents = _mrfUsrEvent.mgmtEvents = 0;
    _mrfUsrEvent.trafficEventInfo = _mrfUsrEvent.mgmtEventInfo =0;


    return TCPIP_MAC_EVRES_OK;
}
/****************************************************************************
 * Function:        DRV_EXTPHY_IntInit
 *
 * PreCondition:    EthInit and EthPhyInit should have been called.
 *
 * Input:         hClientObj - A valid open-instance handle, returned from the driver's open routine
 *                  src - interrupt source
 *                  intPri - intrrupt priority
 *                  intSubPri - Interuupt Sub Priority
 *
 * Output:         none
 *
 *
 * Side Effects:    None
 *
 * Overview:       Initialize External Interrupt 3.	One can take this as refreence for their WOL 
 *                      Interrupt.
 *
 * Note:            None
 *****************************************************************************/
static void DRV_EXTPHY_IntInit(DRV_HANDLE hClientObj,SYS_INT_SOURCE src,int intPri, int intSubPri)
{
	// set up the External Interrupt 3 with a prioirty of 5 and 1 sub-priority    

    SYS_INT_SourceDisable(src);      // stop Eth ints
    SYS_INT_SourceStatusClear(src);
    
#if defined (HARMONY_INT)
    SYS_INT_VectorPrioritySet(src, intPri);
    SYS_INT_VectorSubprioritySet(src, intSubPri);
#else
    SYS_INT_PrioritySet(src, intPri);
    SYS_INT_SubprioritySet(src, intSubPri);
    SYS_INT_DynamicRegister(src, LAN8740WOLIsr, (void*)&hClientObj);
#endif
    
    SYS_INT_SourceEnable(src);


}
Exemple #5
0
/*******************************************************************************
  Function:
    TCPIP_MAC_RES    MRF24W_MACEventInit(TCPIP_MAC_HANDLE hMac, TCPIP_MAC_EventF eventF, const void* eventParam, int intPri, int intSubPri)

  Summary:
    Initializes the ethernet event notification.

  Description:
     This function initializes the ethernet event notification.
     It performs any resource allocation that may be needed.

  Precondition:
     None.

  Parameters:
    hMac      - parameter identifying the intended MAC  
    intPri     - priority of the TCPIP interrupt events
    intSubPri  - sub-priority of the TCPIP interrupt events
    
  Returns:
    TCPIP_MAC_RES_OK  if initialization succeeded,
    an error code otherwise

  Example:
    <code>
    MRF24W_MACEventInit( hMac, 4, 3 );
    </code>

  Remarks:

    Not multi-threaded safe.
*****************************************************************************/
TCPIP_MAC_RES MRF24W_MACEventInit(TCPIP_MAC_HANDLE hMac, TCPIP_MAC_EventF eventF, const void* eventParam, int intPri, int intSubPri)
{

#if 0  //todo: jian. you should fix this
    SYS_INT_SourceDisable(MRFWB0M_INT_SOURCE);      // stop MRF ints
    SYS_INT_SourceStatusClear(MRFWB0M_INT_SOURCE);
    SYS_INT_PrioritySet(MRFWB0M_INT_SOURCE, (INT_PRIORITY_LEVEL_1-1)+intPri);
    SYS_INT_SubprioritySet(MRFWB0M_INT_SOURCE, INT_SUB_PRIORITY_LEVEL_0+intSubPri);
#endif
    SYS_INT_DynamicRegister(MRFWB0M_INT_SOURCE, MRF24W_ISR, 0); 
    
    _mrfGroupDcpt._mrfNotifyFnc = eventF;     // set new handler
    _mrfGroupDcpt._mrfNotifyParam = eventParam;   
    _mrfGroupDcpt._mrfEnabledEvents = false;
    _mrfGroupDcpt._mrfPendingEvents = 0;

    _mrfUsrEvent.trafficEvents = _mrfUsrEvent.mgmtEvents = 0;
    _mrfUsrEvent.trafficEventInfo = _mrfUsrEvent.mgmtEventInfo =0;

 
    return TCPIP_MAC_RES_OK;
}