コード例 #1
0
// -----------------------------------------------------------------------------
//! \brief      This routine closes the transport layer
//!
//! \return     void
// -----------------------------------------------------------------------------
void NPITL_closeTL(void)
{
    _npiCSKey_t key;
    key = NPIUtil_EnterCS();
    
    // Clear NPI Task Call backs
    memset(&taskCBs, 0, sizeof(taskCBs));
  
    // Free Transport Layer RX/TX buffers
    npiBufSize = 0;
    NPIUTIL_FREE(npiRxBuf);
    NPIUTIL_FREE(npiTxBuf);
  
    // Close Transport Layer 
    transportClose();
    
#ifdef POWER_SAVING  
    // Close PIN Handle
    PIN_close(hNpiHandshakePins);
#ifdef NPI_SW_HANDSHAKING_DEBUG
    PIN_close(hNpiProfilingDebugPin);
#endif //NPI_SW_HANDSHAKING
    // Release Power Management
    NPITL_relPM();
#endif //POWER_SAVING

    NPIUtil_ExitCS(key);
}
コード例 #2
0
// -----------------------------------------------------------------------------
//! \brief      This routine closes the transport layer
//!
//! \return     void
// -----------------------------------------------------------------------------
void NPITL_closeTL(void)
{
    _npiCSKey_t key;
    key = NPIUtil_EnterCS();
    
    // Clear NPI Task Call backs
    memset(&taskCBs, 0, sizeof(taskCBs));
  
    // Free Transport Layer RX/TX buffers
    npiBufSize = 0;
    NPIUTIL_FREE(npiRxBuf);
    NPIUTIL_FREE(npiTxBuf);
  
    // Close Transport Layer 
    transportClose();
    
#if (NPI_FLOW_CTRL == 1)
    // Clear mrdy and srdy PIN IDs
    remRdyPIN = (IOID_UNUSED & IOC_IOID_MASK); // Set to 0x000000FF
    locRdyPIN = (IOID_UNUSED & IOC_IOID_MASK); // Set to 0x000000FF
    
    // Clear PIN IDs from PIN Configuration
    npiHandshakePinsCfg[REM_RDY_PIN_IDX] &= ~remRdyPIN; 
    npiHandshakePinsCfg[LOC_RDY_PIN_IDX] &= ~locRdyPIN;
    
    // Close PIN Handle
    PIN_close(hNpiHandshakePins);
    
    // Release Power Management
    NPITL_relPM();
#endif // NPI_FLOW_CTRL = 1

    NPIUtil_ExitCS(key);
}
コード例 #3
0
// -----------------------------------------------------------------------------
//! \brief      This callback is invoked on the completion of one transmission
//!             to/from the host MCU. Any bytes receives will be [0,Rxlen) in
//!             npiRxBuf.
//!             If bytes were receives or transmitted, this function notifies
//!             the NPI task via registered call backs
//!
//! \param[in]  Rxlen   - length of the data received
//! \param[in]  Txlen   - length of the data transferred
//!
//! \return     void
// -----------------------------------------------------------------------------
static void NPITL_transmissionCallBack(uint16_t Rxlen, uint16_t Txlen)
{
    npiRxBufHead = 0;
    npiRxBufTail = Rxlen;
    npiTxActive = FALSE;
    //Since the largest valid NPI packet size is 4096
    //valid RxLen fields should only be up to 0x0FFF
    //a larger RxLen value tells the TL that a Rx is in progress
    //and the UART cannot be closed yet
    //in the above case, a CB will be triggered for the Tx, but Rx will wait
    //until ReadCB completes at NPITLUART layer
    if(!(Rxlen & 0x1000))
    {
      //Since we have rx/tx'd a complete packet, it is time to close out the TL
      //and ready the processor for sleep
#ifdef SWHS_DEBUG  
      //Set Pin if in debug mode 
      PIN_setOutputValue(hNpiProfilingPin, Board_LED2, 1);
#endif //SWHS_DEBUG
      transportClose();
      // Open the Pins for ISR
      hNpiUartRxPin = PIN_open(&npiUartRxPin, npiUartRxPinCfg);
      PIN_registerIntCb(hNpiUartRxPin, NPITL_rxPinHwiFxn);
      PIN_setConfig(hNpiUartRxPin, 
                    PIN_BM_IRQ, 
                    Board_UART_RX | PIN_IRQ_BOTHEDGES);

      // Enable wakeup
      PIN_setConfig(hNpiUartRxPin, 
                    PINCC26XX_BM_WAKEUP, 
                    Board_UART_RX | PINCC26XX_WAKEUP_NEGEDGE);
  #ifdef SWHS_DEBUG  
      //Set Pin if in debug mode 
      PIN_setOutputValue(hNpiProfilingPin, Board_LED2, 0);
  #endif //SWHS_DEBUG
      //It is also valid to clear all flags at this point
      trasnportLayerState = TL_closed;
      
        // If Task is registered, invoke transaction complete callback
      if (taskCBs.transCompleteCB)
      {
          taskCBs.transCompleteCB(Rxlen, Txlen);
      }
      NPITL_relPM();
    }
    else
    {
      //be sure to indicate TL is still busy
      trasnportLayerState = TL_busy;
      // If Task is registered, invoke transaction complete callback
      //note that RxLen is zero because the read is incomplete
      if (taskCBs.transCompleteCB)
      {
          taskCBs.transCompleteCB(0, Txlen);
      }
      
    }
}
コード例 #4
0
// -----------------------------------------------------------------------------
//! \brief      This callback is invoked on the completion of one transmission
//!             to/from the host MCU. Any bytes receives will be [0,Rxlen) in
//!             npiRxBuf.
//!             If bytes were receives or transmitted, this function notifies
//!             the NPI task via registered call backs
//!
//! \param[in]  Rxlen   - length of the data received
//! \param[in]  Txlen   - length of the data transferred
//!
//! \return     void
// -----------------------------------------------------------------------------
static void NPITL_transmissionCallBack(uint16_t Rxlen, uint16_t Txlen)
{
    npiRxBufHead = 0;
    npiRxBufTail = Rxlen;
    npiTxActive = FALSE;
    
    // If Task is registered, invoke transaction complete callback
    if (taskCBs.transCompleteCB)
    {
        taskCBs.transCompleteCB(Rxlen, Txlen);
    }
#ifdef NPI_SW_HANDSHAKING_DEBUG
    //Set the profiling pin high
    PIN_setOutputValue(hNpiProfilingDebugPin, profilingDebugPin, 1);
#endif //NPI_SW_HANDSHAKING_DEBUG
    // Close the UART
    transportClose();
    // Open the Pins for ISR
    hNpiHandshakePins = PIN_open(&npiHandshakePins, npiHandshakePinsCfg);
    	//replace remRdyPIN with Board_UART_RX
    	PIN_registerIntCb(hNpiHandshakePins, NPITL_remRdyPINHwiFxn);
    	PIN_setConfig(hNpiHandshakePins,
    				  PIN_BM_IRQ,
    				  Board_UART_RX | PIN_IRQ_BOTHEDGES);

    	// Enable wakeup
    	PIN_setConfig(hNpiHandshakePins,
    				  PINCC26XX_BM_WAKEUP,
    				  Board_UART_RX | PINCC26XX_WAKEUP_NEGEDGE);
#ifdef NPI_SW_HANDSHAKING_DEBUG
    	//Indicate that we are now asleep in the GPIO state
    	PIN_setOutputValue(hNpiProfilingDebugPin, profilingDebugPin, 0);
#endif //NPI_SW_HANDSHAKING_DEBUG
    	//It is also valid to clear all flags at this point
    	_npiCSKey_t key;
    	key = NPIUtil_EnterCS();
    	handshakingState = HS_GPIO_STATE;
    	NPIUtil_ExitCS(key);
#ifdef POWER_SAVING
    NPITL_relPM();
#endif //POWER_SAVING
}
コード例 #5
0
// -----------------------------------------------------------------------------
//! \brief      This routine closes the transport layer
//!
//! \return     void
// -----------------------------------------------------------------------------
void NPITL_closeTL(void)
{
    _npiCSKey_t key;
    key = NPIUtil_EnterCS();
    
    // Clear NPI Task Call backs
    memset(&taskCBs, 0, sizeof(taskCBs));
  
    // Free Transport Layer RX/TX buffers
    npiBufSize = 0;
    NPIUTIL_FREE(npiRxBuf);
    NPIUTIL_FREE(npiTxBuf);
  
    // Close the RxPin
    PIN_close(hNpiUartRxPin);
    // Close UART transport Layer 
    transportClose();
    trasnportLayerState = TL_closed;
    
    NPITL_relPM();

    NPIUtil_ExitCS(key);
}