⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 system.h

📁 cs8900 c51应用
💻 H
📖 第 1 页 / 共 2 页
字号:
#ifdef CS8900
 
#define RECEIVE_NETWORK_B()				inBUF() //inNE2000again()

/** \def SEND_NETWORK_B
 *	\brief Use this macro to write data to Ethernet controller
 *
 *	This macro should be used to write data to Ethernet
 *	controller. Procedure for doing this would be as follows:
 *		\li Initialize writing of data to certain address in the
 *		Ethernet controller. Buffer space in Ethernet controller is
 *		divided among the protocols in the following way:
 *			\li 256 byte Tx for ARP (see ARP_BUFFER )
 *			\li 1536 byte Tx for ICMP (see ICMP_BUF)
 *			\li 1536 byte Tx for TCP (see TCP_BUF)
 *			\li 1536 byte Tx for UDP (see UDP_BUF)
 *		\li Write the data by using SEND_NETWORK_B() macro
 *		\li When all of the data is written instruct the Ethernet controller
 *		to send the data by calling the NETWORK_COMPLETE_SEND() macro with
 *		number of bytes to send as a parameter
 *
 */
#define SEND_NETWORK_B(c) 				outBUF(c) //outNE2000again(c)

/** \def NETWORK_CHECK_IF_RECEIVED
 *	\ingroup periodic_functions
 *	\brief Use this macro to check if there is recieved data in Ethernet controller
 *
 *	Invoke this macro periodically (see main_demo.c for example) to check
 *	if there is new data in the Ethernet controller.
 *
 *	If there is new data in the Ethernet controller, this macro (function
 *	that it points to that is) will return a value of TRUE and fill in
 *	the appropriate values in the received_frame variable. Otherwise it
 *	returns FALSE.
 */
#define NETWORK_CHECK_IF_RECEIVED() 	CSReceiveFrame() //NE2000ReceiveFrame()

/** \def NETWORK_RECEIVE_INITIALIZE
 *	\brief Initialize reading from a given address
 *
 *	This macro initializes reading of the received Ethernet frame from
 *	a given address in the Ethernet controller.
 */
#define NETWORK_RECEIVE_INITIALIZE(c)	CSInitRx_position(c) //NE2000DMAInit_position(c)

/** \def NETWORK_RECEIVE_END
 *	\ingroup periodic_functions
 *	\brief Dump received packet in the Ethernet controller
 *
 *	Invoke this macro when the received Ethernet packet is not needed
 *	any more and can be discarded.
 */
#define NETWORK_RECEIVE_END() 			CSDumpRxFrame() //NE2000DumpRxFrame()

/** \def NETWORK_COMPLETE_SEND
 *	\brief Send the Ethernet packet that was formed in the Ethernet controller
 *
 *	After the data has been written to the Ethernet controller, use this
 *	function to instruct the Ethernet controller that data is in it's 
 *	internal buffer and should be sent.
 */
#define NETWORK_COMPLETE_SEND(c) 		CSSendFrame(c) //NE2000SendFrame(c)

/** \def NETWORK_SEND_INITIALIZE
 *	\brief Initialize sending of Ethernet packet from a given address
 *
 *	Use this function to initialize sending (or creating) of an Ethernet
 *	packet from a given address in the Ethernet controller.
 */
#define NETWORK_SEND_INITIALIZE(c) 		CSInitTx_position(c) //InitTransmission(c)

/** \def NETWORK_ADD_DATALINK
 *	\brief	Add lower-level datalink information
 *
 *	This implementation adds Ethernet data-link information by
 *	invoking NE2000WriteEthernetHeader() function that writes Ethernet
 *	header based on information provided (destination and source ethernet
 *	address and protocol field).
 */
#define NETWORK_ADD_DATALINK(c)			CSWriteEthernetHeader(c) //NE2000WriteEthernetHeader(c)

#endif //#ifdef CS8900

/**********************************************************************
*	SLIP section
***********************************************************************/

#ifdef SLIP
/** \def RECEIVE_NETWORK_B
 *	\brief Use this macro to read data from Ethernet controller
 *
 *	This macro should be used to read data from the Ethernet
 *	controller. Procedure for doing this would be as follows:
 *		\li Initialize reading of data from certain address in the
 *		Ethernet controller (usually you will do that based on buf_index
 *		value of ip_frame, udp_frame or tcp_frame type of variables; 
 *		in certain special situations you can also use buf_index from 
 *		ethernet_frame type of var.
 *		\li Keep invoking RECEIVE_NETWORK_B() to read one byte at a time from
 *		the ethernet controller. Take care not to read more data than
 *		actually received
 *		\li If needed, reinitialize reading of data again and start all
 *		over again
 *		\li When finished discard the current frame in the Ethernet
 *		controller by invoking NETWORK_RECEIVE_END() macro
 *
 */
#define RECEIVE_NETWORK_B()				*RxPtr++//instead of inSLIPagain()

/** \def SEND_NETWORK_B
 *	\brief Use this macro to write data to Ethernet controller
 *
 *	This macro should be used to write data to Ethernet
 *	controller. Procedure for doing this would be as follows:
 *		\li Initialize writing of data to certain address in the
 *		Ethernet controller. Buffer space in Ethernet controller is
 *		divided among the protocols in the following way:
 *			\li 256 byte Tx for ARP (see ARP_BUFFER )
 *			\li 1536 byte Tx for ICMP (see ICMP_BUF)
 *			\li 1536 byte Tx for TCP (see TCP_BUF)
 *			\li 1536 byte Tx for UDP (see UDP_BUF)
 *		\li Write the data by using SEND_NETWORK_B() macro
 *		\li When all of the data is written instruct the Ethernet controller
 *		to send the data by calling the NETWORK_COMPLETE_SEND() macro with
 *		number of bytes to send as a parameter
 *
 */
#define SEND_NETWORK_B(c) 			*TxPtr++ = c	//instead of outSLIPagain(c)

/** \def NETWORK_CHECK_IF_RECEIVED
 *	\ingroup periodic_functions
 *	\brief Use this macro to check if there is recieved data in Ethernet controller
 *
 *	Invoke this macro periodically (see main_demo.c for example) to check
 *	if there is new data in the Ethernet controller.
 *
 *	If there is new data in the Ethernet controller, this macro (function
 *	that it points to that is) will return a value of TRUE and fill in
 *	the appropriate values in the received_frame variable. Otherwise it
 *	returns FALSE.
 */
#define NETWORK_CHECK_IF_RECEIVED() 	SLIPReceiveFrame()

/** \def NETWORK_RECEIVE_INITIALIZE
 *	\brief Initialize reading from a given address
 *
 *	This macro initializes reading of the received Ethernet frame from
 *	a given address in the Ethernet controller.
 */
#define NETWORK_RECEIVE_INITIALIZE(c)	SLIPInit_position(c)

/** \def NETWORK_RECEIVE_END
 *	\ingroup periodic_functions
 *	\brief Dump received packet in the Ethernet controller
 *
 *	Invoke this macro when the received Ethernet packet is not needed
 *	any more and can be discarded.
 */
#define NETWORK_RECEIVE_END() 			SLIPDumpRxFrame()

/** \def NETWORK_COMPLETE_SEND
 *	\brief Send the Ethernet packet that was formed in the Ethernet controller
 *
 *	After the data has been written to the Ethernet controller, use this
 *	function to instruct the Ethernet controller that data is in it's 
 *	internal buffer and should be sent.
 */
#define NETWORK_COMPLETE_SEND(c) 		send_packet(c)

/** \def NETWORK_SEND_INITIALIZE
 *	\brief Initialize sending of Ethernet packet from a given address
 *
 *	Use this function to initialize sending (or creating) of an Ethernet
 *	packet from a given address in the Ethernet controller.
 */
#define NETWORK_SEND_INITIALIZE(c) 		dummy()

/** \def NETWORK_ADD_DATALINK
 *	\brief	Add lower-level datalink information
 *
 *	This implementation adds Ethernet data-link information by
 *	invoking NE2000WriteEthernetHeader() function that writes Ethernet
 *	header based on information provided (destination and source ethernet
 *	address and protocol field).
 */
#define NETWORK_ADD_DATALINK(c)			SLIPInit_position(ETH_HEADER_LEN)

#endif //#ifdef SLIP


/* System functions	*/

extern void kick_WD(void);
extern void wait(INT16);
extern void enter_power_save(void);
extern void exit_power_save(void);
extern INT16 strlen(UINT8*, UINT16);
extern INT16 bufsearch(UINT8*, UINT16, UINT8*);
extern UINT16 hextoascii(UINT8);
extern void itoa(UINT16, UINT8*);
extern void ltoa(UINT32, UINT8*);
extern INT16 atoi(UINT8*, UINT8);
extern UINT8 asciitohex(UINT8);
extern UINT8 isnumeric(UINT8);
extern void mputs(UINT8*);
void mputhex(UINT8 );
extern UINT32 random(void);
extern void dummy(void);

/*	External functions	*/

extern void init(void);


#endif





⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -