Sie sind auf Seite 1von 4

/**********************************************************************

* $Id$ main.c
*//**
* @file main.c
* @brief This example describes how to test EMAC driver with raw
* packet frame format that is not related with any
* upper-layer (i.e. TCP/IP...)
* @version 1.0
* @date 11. Dec. 2013
* @author Dwijay.Edutech Learning Solutions
***********************************************************************
* Software that is described herein is for illustrative purposes only
* which provides customers with programming information regarding the
* products. This software is supplied "AS IS" without any warranties.
* NXP Semiconductors assumes no responsibility or liability for the
* use of the software, conveys no license or title under any patent,
* copyright, or mask work right to the product. NXP Semiconductors
* reserves the right to make changes in the software without
* notification. NXP Semiconductors also make no representation or
* warranty that such application will be suitable for the specified
* use without further testing or modification.
**********************************************************************/
#include "lpc_system_init.h"

/* Example group ----------------------------------------------------------- */


/** @defgroup EMAC
* @ingroup EMAC_Examples
* @{
*/

/*-------------------------MAIN Page------------------------------*/
/** @mainpage EMAC Test Example
* @par Description:
* - Test EMAC driver with raw packet frame format that is not
* related with any upper-layer (i.e. TCP/IP...)
*
* @par Activity - more information:
* - Connect Serial cable from PC to LPC1768 board
* - Open Hyperterminal at Baudrate 9600 8N1
* - Use CrossOver cable to connect two boards or board with PC.
* - Connect UART0 on two boards to COM ports on your computer.
* - There are two ways to test:
* - TX_ONLY and BOUNCE_RX flags can be set one at a time, not both.
* When TX_ONLY is set to 1, it's a TX_ONLY packet from the MCB1700
* board to the LAN. Use the traffic analyzer such as wireshark, once
* the program is running, the packets can be monitored on the traffic
* analyzer.
* - When BOUNCE_RX is set to 1 (TX_ONLY needs to reset to 0), it's a
* test to test both TX and RX, use the traffic generator/analyzer,
* you can creat a packet with the destination address as that on the
* MCB1700 board, use the traffic generator to send packets, as long
* as the destination address matches, MCB1700 will reverse the
source
* and destination address and send the packets back on the network.
* ENABLE_WOL flag is used to test power down and WOL functionality.
* BOUNCE_RX flag needs to be set to 1 when WOL is being tested.
*/
/*-------------------------MAIN FUNCTION------------------------------*/
/*********************************************************************//**
* @brief Main I2C testing example sub-routine
**********************************************************************/

/* With ARM and GHS toolsets, the entry point is main() - this will
allow the linker to generate wrapper code to setup stacks, allocate
heap area, and initialize and copy code and data segments. For GNU
toolsets, the entry point is through __start() in the crt0_gnu.asm
file, and that startup code will setup stacks and data */
int main(void)
{
/* Data Packet format */
EMAC_PACKETBUF_Type DataPacket;
uint8_t *txptr;
uint32_t j;

System_Init();

txptr = (uint8_t *)gTxBuf;


/* pre-format the transmit packets */
PacketGen(txptr);

/* Transmit packets only */


while ( 1 )
{
txptr = (uint8_t *)gTxBuf;
printf(LPC_UART0,"Send packet\n\r");

DataPacket.pbDataBuf = (uint32_t *)txptr;


// Note that there're 4-byte CRC added
DataPacket.ulDataLen = TX_PACKET_SIZE + 4;
EMAC_WritePacketBuffer(&DataPacket);
EMAC_UpdateTxProduceIndex();

for ( j = 0; j < 0x200000; j++ ); /* delay */


}

return 0;
}

#ifdef DEBUG
/*******************************************************************************
* @brief Reports the name of the source file and the source line
number
* where the CHECK_PARAM error has occurred.
* @param[in] file Pointer to the source file name
* @param[in] line assert_param error line source number
* @return None
*******************************************************************************/
void check_failed(uint8_t *file, uint32_t line)
{
/* User can add his own implementation to report the file name and line
number,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

/* Infinite loop */
while(1);
}
#endif

/*
* @}
*/

Das könnte Ihnen auch gefallen