Я нашел свой косяк (вернее Атмела). В файле lib_AT91RM9200.h неправильно были прописаны функции AT91F_UDP_EnableEp () и AT91F_UDP_DisableEp () (выделено жирным). Выяснилось после сравнения с аналогичным файлом для SAM7. Еще дописал туда несколько функций для совместимости с SAM7. Теперь то, что относится к UDP в файле lib_AT91RM9200.h выглядит так:
/* ***************************************************************************** SOFTWARE API FOR UDP ***************************************************************************** */ //*---------------------------------------------------------------------------- //* \fn AT91F_UDP_EnableIt //* \brief Enable UDP IT //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EnableIt ( AT91PS_UDP pUDP, // \arg pointer to a UDP controller unsigned int flag) // \arg IT to be enabled { //* Write to the IER register pUDP->UDP_IER = flag; }
//*---------------------------------------------------------------------------- //* \fn AT91F_UDP_DisableIt //* \brief Disable UDP IT //*---------------------------------------------------------------------------- __inline void AT91F_UDP_DisableIt ( AT91PS_UDP pUDP, // \arg pointer to a UDP controller unsigned int flag) // \arg IT to be disabled { //* Write to the IDR register pUDP->UDP_IDR = flag; }
//*---------------------------------------------------------------------------- //* \fn AT91F_UDP_SetAddress //* \brief Set UDP functional address //*---------------------------------------------------------------------------- __inline void AT91F_UDP_SetAddress ( AT91PS_UDP pUDP, // \arg pointer to a UDP controller unsigned char address) // \arg new UDP address { pUDP->UDP_FADDR = (AT91C_UDP_FEN | address); }
//*---------------------------------------------------------------------------- //* \fn AT91F_UDP_EnableEp //* \brief Enable Endpoint //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EnableEp ( AT91PS_UDP pUDP, // \arg pointer to a UDP controller unsigned char endpoint) // \arg endpoint number { pUDP->UDP_CSR[endpoint] |= AT91C_UDP_EPEDS; }
//*---------------------------------------------------------------------------- //* \fn AT91F_UDP_DisableEp //* \brief Enable Endpoint //*---------------------------------------------------------------------------- __inline void AT91F_UDP_DisableEp ( AT91PS_UDP pUDP, // \arg pointer to a UDP controller unsigned char endpoint) // \arg endpoint number { pUDP->UDP_CSR[endpoint] &= ~AT91C_UDP_EPEDS; }
//*---------------------------------------------------------------------------- //* \fn AT91F_UDP_SetState //* \brief Set UDP Device state //*---------------------------------------------------------------------------- __inline void AT91F_UDP_SetState ( AT91PS_UDP pUDP, // \arg pointer to a UDP controller unsigned int flag) // \arg new UDP address { pUDP->UDP_GLBSTATE &= ~(AT91C_UDP_FADDEN | AT91C_UDP_CONFG); pUDP->UDP_GLBSTATE |= flag; }
//*---------------------------------------------------------------------------- //* \fn AT91F_UDP_GetState //* \brief return UDP Device state //*---------------------------------------------------------------------------- __inline unsigned int AT91F_UDP_GetState ( // \return the UDP device state AT91PS_UDP pUDP) // \arg pointer to a UDP controller { return (pUDP->UDP_GLBSTATE & (AT91C_UDP_FADDEN | AT91C_UDP_CONFG)); }
//*---------------------------------------------------------------------------- //* \fn AT91F_UDP_ResetEp //* \brief Reset UDP endpoint //*---------------------------------------------------------------------------- __inline void AT91F_UDP_ResetEp ( // \return the UDP device state AT91PS_UDP pUDP, // \arg pointer to a UDP controller unsigned int flag) // \arg Endpoints to be reset { pUDP->UDP_RSTEP = flag; pUDP->UDP_RSTEP = 0; }
//*---------------------------------------------------------------------------- //* \fn AT91F_UDP_EpStall //* \brief Endpoint will STALL requests //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EpStall( AT91PS_UDP pUDP, // \arg pointer to a UDP controller unsigned char endpoint) // \arg endpoint number { pUDP->UDP_CSR[endpoint] |= AT91C_UDP_FORCESTALL; }
//*---------------------------------------------------------------------------- //* \fn AT91F_UDP_EpWrite //* \brief Write value in the DPR //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EpWrite( AT91PS_UDP pUDP, // \arg pointer to a UDP controller unsigned char endpoint, // \arg endpoint number unsigned char value) // \arg value to be written in the DPR { pUDP->UDP_FDR[endpoint] = value; }
//*---------------------------------------------------------------------------- //* \fn AT91F_UDP_EpRead //* \brief Return value from the DPR //*---------------------------------------------------------------------------- __inline unsigned int AT91F_UDP_EpRead( AT91PS_UDP pUDP, // \arg pointer to a UDP controller unsigned char endpoint) // \arg endpoint number { return pUDP->UDP_FDR[endpoint]; }
//*---------------------------------------------------------------------------- //* \fn AT91F_UDP_EpEndOfWr //* \brief Notify the UDP that values in DPR are ready to be sent //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EpEndOfWr( AT91PS_UDP pUDP, // \arg pointer to a UDP controller unsigned char endpoint) // \arg endpoint number { pUDP->UDP_CSR[endpoint] |= AT91C_UDP_TXPKTRDY; }
//*---------------------------------------------------------------------------- //* \fn AT91F_UDP_EpClear //* \brief Clear flag in the endpoint CSR register //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EpClear( AT91PS_UDP pUDP, // \arg pointer to a UDP controller unsigned char endpoint, // \arg endpoint number unsigned int flag) // \arg flag to be cleared { pUDP->UDP_CSR[endpoint] &= ~(flag); }
//*---------------------------------------------------------------------------- //* \fn AT91F_UDP_EpSet //* \brief Set flag in the endpoint CSR register //*---------------------------------------------------------------------------- __inline void AT91F_UDP_EpSet( AT91PS_UDP pUDP, // \arg pointer to a UDP controller unsigned char endpoint, // \arg endpoint number unsigned int flag) // \arg flag to be cleared { pUDP->UDP_CSR[endpoint] |= flag; }
//*---------------------------------------------------------------------------- //* \fn AT91F_UDP_EpStatus //* \brief Return the endpoint CSR register //*---------------------------------------------------------------------------- __inline unsigned int AT91F_UDP_EpStatus( AT91PS_UDP pUDP, // \arg pointer to a UDP controller unsigned char endpoint) // \arg endpoint number { return pUDP->UDP_CSR[endpoint]; }
//*---------------------------------------------------------------------------- //* \fn AT91F_UDP_GetInterruptMaskStatus //* \brief Return UDP Interrupt Mask Status //*---------------------------------------------------------------------------- __inline unsigned int AT91F_UDP_GetInterruptMaskStatus( // \return UDP Interrupt Mask Status AT91PS_UDP pUdp) // \arg pointer to a UDP controller { return pUdp->UDP_IMR; }
//*---------------------------------------------------------------------------- //* \fn AT91F_UDP_IsInterruptMasked //* \brief Test if UDP Interrupt is Masked //*---------------------------------------------------------------------------- __inline int AT91F_UDP_IsInterruptMasked( AT91PS_UDP pUdp, // \arg pointer to a UDP controller unsigned int flag) // \arg flag to be tested { return (AT91F_UDP_GetInterruptMaskStatus(pUdp) & flag); }
// ---------------------------------------------------------------------------- // \fn AT91F_UDP_InterruptStatusRegister // \brief Return the Interrupt Status Register // ---------------------------------------------------------------------------- __inline unsigned int AT91F_UDP_InterruptStatusRegister( AT91PS_UDP pUDP ) // \arg pointer to a UDP controller { return pUDP->UDP_ISR; }
// ---------------------------------------------------------------------------- // \fn AT91F_UDP_InterruptClearRegister // \brief Clear Interrupt Register // ---------------------------------------------------------------------------- __inline void AT91F_UDP_InterruptClearRegister ( AT91PS_UDP pUDP, // \arg pointer to UDP controller unsigned int flag) // \arg IT to be cleat { pUDP->UDP_ICR = flag; }
// ---------------------------------------------------------------------------- // \fn AT91F_UDP_EnableTransceiver // \brief Enable transceiver // ---------------------------------------------------------------------------- __inline void AT91F_UDP_EnableTransceiver( AT91PS_UDP pUDP ) // \arg pointer to a UDP controller { pUDP->UDP_TXVC &= ~AT91C_UDP_TXVDIS; }
// ---------------------------------------------------------------------------- // \fn AT91F_UDP_DisableTransceiver // \brief Disable transceiver // ---------------------------------------------------------------------------- __inline void AT91F_UDP_DisableTransceiver( AT91PS_UDP pUDP ) // \arg pointer to a UDP controller { pUDP->UDP_TXVC = AT91C_UDP_TXVDIS; }
/* ***************************************************************************** SOFTWARE API FOR ST ***************************************************************************** */
|