亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? modem_test.c

?? Dynamic C 程式語言源碼 嵌入式控制系統(tǒng) ppp網(wǎng)路撥號 連線~
?? C
字號:
/*****

   modem_test.c

   Tests the PPP interface, with modem attached to serial port C (default).
   Brings the PPP interface up and down three times, each time connecting to the
   ISP and sending a test email.

   You will need to change the default macro definitions for DIALUP_NAME,
   DIALUP_NUMBER, DIALUP_PASSWORD, EMAIL_FROM, EMAIL_TO and SMTP_SERVER.

   You also may need to alter the choice of serial port, whether or not CTS/RTS
   flow control is enabled via the DIALUP_FLOWCONTROL macro and the choice of
   flow control (CTS, RTS) I/O bits and ports, and the send/expect sequence
   defined in the DIALUP_SENDEXPECT macro.

   This sample assumes you are using hardware modem flow control i.e. CTS and
   RTS.  The CTS port and bit number are defined in the IFS_PPP_CTSPIN
   parameter, defaulting to parallel port C, bit 1.  Likewise, RTS is set via
   IFS_PPP_RTSPIN and defaults to parallel port C, bit 0.

   Changing either or both I/O bits and ports used for CTS / RTS is simply a
   matter of updating the MY_xTS_BIT and MY_xTS_PORT macro definitions
   appropriately.

   Note that no real checking of these CTS / RTS macro definitions is performed,
   so it is entirely possible to make a non-working choice.  In fact, the
   default selections are not appropriate for some Rabbit boards.  Please check
   your hardware manual in order to make choices that are appropriate for your
   board.

   When using a Rabbit SBC or an RCM on a protyping board, it can be convenient
   to choose the CTS / RTS flow control lines based on a second RS-232 port, if
   available.  In many cases, the second RS-232 serial port will already have an
   RS-223 tranceiver chip installed, saving some time and effort.  The second
   serial port's RX line is repurposed as the CTS, and the TX line as the RTS.
   The standard I/O pins used for serial ports are:
      RXA (CTS) on PC7
      TXA (RTS) on PC6
      RXB (CTS) on PC5
      TXB (RTS) on PC4
      RXC (CTS) on PC3
      TXC (RTS) on PC2
      RXD (CTS) on PC1
      TXD (RTS) on PC0
      RXE (CTS) on PG7 (Rabbit 3000) or PC7 (Rabbit 4000)
      TXE (RTS) on PG6 (Rabbit 3000) or PC6 (Rabbit 4000)
      RXF (CTS) on PG3 (Rabbit 3000) or PC3 (Rabbit 4000)
      TXF (RTS) on PG2 (Rabbit 3000) or PC2 (Rabbit 4000)

   It is important to ensure that your modem is set up correctly for your choice
   of CTS/RTS hardware flow control enabled vs. disabled on the Rabbit board.
   Please consult your modem's manual to determine what its setup requirements
   are for your choice of flow control enabled vs. disabled.

********/

#define DIALUP_FLOWCONTROL 1	// 0 to disable, 1 to enable CTS/RTS flow control
#define DIALUP_NAME "username"
#define DIALUP_NUMBER "5551212"
#define DIALUP_PASSWORD "password"
#define EMAIL_FROM "rabbit@isp.com"
#define EMAIL_TO "you@wherever.com"
#define SMTP_SERVER "smtp.isp.com"

// select the PPP serial port, as appropriate for the target board
//  defining MY_PPP_SERIAL_PORT to 1 selects A, 2 selects B, ..., 6 selects F
#define MY_PPP_SERIAL_PORT 3	// our default is serial port C

// select the CTS and RTS bits and ports
// our defaults are PC1 (standard RXD) and PC0 (standard TXD), respectively
#define MY_CTS_BIT 1
#define MY_CTS_PORT PCDR
#define MY_RTS_BIT 0
#define MY_RTS_PORT PCDR

/*
 * NETWORK CONFIGURATION
 * Please see the function help (Ctrl-H) on TCPCONFIG for instructions on
 * compile-time network configuration.
 */
#define TCPCONFIG 0				// No predefined config for this sample

//Uncomment to get PPP detail
//#define PPP_VERBOSE
//#define PPP_DEBUG
//#define PPPLINK_VERBOSE
//#define PPPLINK_DEBUG
//#define SMTP_VERBOSE
//#define SMTP_DEBUG 1
#define CHAT_VERBOSE				// See what's going on.
//#define CHAT_DEBUG

// The following macro sets up the initial login screen navigation.  This is
// necessary for access to many ISPs, since when you dial in with the modem, the
// ISP does user authentication via an old-fashioned login screen.
//
// %0 gets userid substituted, %1 is password -- obtained from values passed for
// IFS_PPP_REMOTEAUTH.  The string below gets compiled to
// "ATZ #ok @ATDT5551212 #CONNECT '' #ogin: @%0 #word: @%1 ~"
//
// This is a send/expect sequence used to establish a modem connection to the
// ISP (ready for PPP to take over).  Expanded out:
//  ATZ         - send the modem reset command (usually default config 0).
//                This helps get the modem into a known initial state.
//  #ok         - wait for 'ok' string (the leading '#' means case-insensitive
//                i.e. will accept 'OK', 'Ok' etc.
//  @ATDT5551212 - After 1.5 seconds pause, send the dialout command. The pause
//                allows time for the modem's reset to complete for those modems
//                which respond with an early 'ok' to the prior reset command.
//  #CONNECT    - wait for 'connect' message
//  ''          - Send nothing (quotes are a place-holder).  Note that the CRLF
//                is appended to any send-string _except_ an empty string like
//                this (but you can suppress the CRLF by prefixing the
//                send-string with '#').
//  #ogin:      - Wait for a 'login:' message.  We don't actually look for the
//                initial 'L' since the first character can sometimes be lost.
//  @%0         - send the userid (i.e. the value supplied by the
//                IFS_PPP_REMOTEAUTH parameter.  If the character-based login
//                prompt expects a different userid than the one passed to the
//                following PPP authentication phase, then you can't use %0.  In
//                this case, put the character-based login ID directly in the
//                send/expect string.  The initial '@' character causes us to
//                pause for 1.5 seconds before sending the string.  This is not
//                theoretically required, however some ISPs have software which
//                tries to discourage machine-based hacking attempts.  If we
//                respond too quickly, the ISP thinks we are typing at inhumanly
//                fast rates, and deems us to be a hacker.
//  #word:      - Wait for the 'password:' prompt.
//  @%1         - Send the password string.  See considerations above for the
//                logon ID string.
//  ~           - Wait for ASCII tilde char (0x7E).  This is handy, since this
//                is the first character sent by PPP when it starts up on the
//                peer.  Some peers send an ascii 'PPP' string, but this is not
//                usually so reliable as a means of detecting PPP startup.  Both
//                methods are provided in the choice of send / expect macros,
//                below.  If one doesn't work (i.e. CHAT: times out waiting for
//                the '~' or the 'PPP') try the other macro definition.
// Comment out exactly one of the following two send / expect macro definitions.
// It may be necessary to edit these send / expect macro definitions to suit.
#define DIALUP_SENDEXPECT "ATZ #ok @ATDT" DIALUP_NUMBER " #CONNECT '' #ogin: @%0 #word: @%1 ~"
//#define DIALUP_SENDEXPECT "ATZ #ok @ATDT" DIALUP_NUMBER " #CONNECT '' #ogin: @%0 #word: @%1 PPP"

#if DIALUP_FLOWCONTROL
	#define DIALUP_SPEED 57600L	// higher serial rate if flow control enabled
#else
	#define DIALUP_SPEED 19200L	// lower serial rate if flow control disabled
#endif

// set up the selected PPP serial port
#if 1 == MY_PPP_SERIAL_PORT
	// for PPP on serial port A
	#warnt "Choosing serial port A disallows debugging via the programming port."
	#define USE_PPP_SERIAL 0x01
#elif 2 == MY_PPP_SERIAL_PORT
	// for PPP on serial port B
	#define USE_PPP_SERIAL 0x02
#elif 3 == MY_PPP_SERIAL_PORT
	// for PPP on serial port C
	#define USE_PPP_SERIAL 0x04
#elif 4 == MY_PPP_SERIAL_PORT
	// for PPP on serial port D
	#define USE_PPP_SERIAL 0x08
#elif 5 == MY_PPP_SERIAL_PORT && _CPU_ID_ >= R3000
	// for PPP on serial port E
	#define USE_PPP_SERIAL 0x10
#elif 6 == MY_PPP_SERIAL_PORT && _CPU_ID_ >= R3000
	// for PPP on serial port F
	#define USE_PPP_SERIAL 0x20
#else
	#error "Invalid PPP serial port selection!"
#endif

#ifndef PFDR
	#define PFDR 0
#endif
#ifndef PGDR
	#define PGDR 0
#endif

#if PADR == MY_CTS_PORT
	// parallel port A
 #if MY_CTS_PORT == MY_RTS_PORT
	#error "Parallel port A can't be shared between inputs and outputs."
 #endif
	#define MY_CTS_BIT_SETUP WrPortI(SPCR, &SPCRShadow, 0x80);
#elif PBDR == MY_CTS_PORT
	// parallel port B
	#define MY_CTS_BIT_SETUP BitWrPortI(PBDDR, &PBDDRShadow, 0, MY_CTS_BIT);
#elif PCDR == MY_CTS_PORT
	// parallel port C
	#define MY_CTS_BIT_SETUP BitWrPortI(PCFR, &PCFRShadow, 0, MY_CTS_BIT);
	                         // no DDR setup is possible
#elif PDDR == MY_CTS_PORT
	// parallel port D
	#define MY_CTS_BIT_SETUP BitWrPortI(PDFR, &PDFRShadow, 0, MY_CTS_BIT); \
	                         BitWrPortI(PDDDR, &PDDDRShadow, 0, MY_CTS_BIT);
#elif PEDR == MY_CTS_PORT
	// parallel port E
	#define MY_CTS_BIT_SETUP BitWrPortI(PEFR, &PEFRShadow, 0, MY_CTS_BIT); \
	                         BitWrPortI(PEDDR, &PEDDRShadow, 0, MY_CTS_BIT);
#elif PFDR && PFDR == MY_CTS_PORT
	// parallel port F
	#define MY_CTS_BIT_SETUP BitWrPortI(PFFR, &PFFRShadow, 0, MY_CTS_BIT); \
	                         BitWrPortI(PFDDR, &PFDDRShadow, 0, MY_CTS_BIT);
#elif PGDR && PGDR == MY_CTS_PORT
	// parallel port G
	#define MY_CTS_BIT_SETUP BitWrPortI(PGFR, &PGFRShadow, 0, MY_CTS_BIT); \
	                         BitWrPortI(PGDDR, &PGDDRShadow, 0, MY_CTS_BIT);
#else
	#error "Invalid MY_CTS_PORT selection!"
#endif

#if PADR == MY_RTS_PORT
	// parallel port A
	#define MY_RTS_BIT_SETUP BitWrPortI(PADR, &PADRShadow, 0, MY_RTS_BIT); \
	                         WrPortI(SPCR, &SPCRShadow, 0x84);
#elif PBDR == MY_RTS_PORT
	// parallel port B
	#define MY_RTS_BIT_SETUP BitWrPortI(PBDR, &PBDRShadow, 0, MY_RTS_BIT); \
	                         BitWrPortI(PBDDR, &PBDDRShadow, 1, MY_RTS_BIT);
#elif PCDR == MY_RTS_PORT
	// parallel port C
	#define MY_RTS_BIT_SETUP BitWrPortI(PCFR, &PCFRShadow, 0, MY_RTS_BIT); \
	                         BitWrPortI(PCDR, &PCDRShadow, 0, MY_RTS_BIT);
	                         // no DDR setup is possible
#elif PDDR == MY_RTS_PORT
	// parallel port D
	#define MY_RTS_BIT_SETUP BitWrPortI(PDFR, &PDFRShadow, 0, MY_RTS_BIT); \
	                         BitWrPortI(PDDR, &PDDRShadow, 0, MY_RTS_BIT); \
	                         BitWrPortI(PDDDR, &PDDDRShadow, 1, MY_RTS_BIT);
#elif PEDR == MY_RTS_PORT
	// parallel port E
	#define MY_RTS_BIT_SETUP BitWrPortI(PEFR, &PEFRShadow, 0, MY_RTS_BIT); \
	                         BitWrPortI(PEDR, &PEDRShadow, 0, MY_RTS_BIT); \
	                         BitWrPortI(PEDDR, &PEDDRShadow, 1, MY_RTS_BIT);
#elif PFDR && PFDR == MY_RTS_PORT
	// parallel port F
	#define MY_RTS_BIT_SETUP BitWrPortI(PFFR, &PFFRShadow, 0, MY_RTS_BIT); \
	                         BitWrPortI(PFDR, &PFDRShadow, 0, MY_RTS_BIT); \
	                         BitWrPortI(PFDDR, &PFDDRShadow, 1, MY_RTS_BIT);
#elif PGDR && PGDR == MY_RTS_PORT
	// parallel port G
	#define MY_RTS_BIT_SETUP BitWrPortI(PGFR, &PGFRShadow, 0, MY_RTS_BIT); \
	                         BitWrPortI(PGDR, &PGDRShadow, 0, MY_RTS_BIT); \
	                         BitWrPortI(PGDDR, &PGDDRShadow, 1, MY_RTS_BIT);
#else
	#error "Invalid MY_RTS_PORT selection!"
#endif

#memmap xmem
#use "dcrtcp.lib"
#use "smtp.lib"


#define TIMEZONE        -8

#define LCP_TIMEOUT 5000

const char mail_to[] = EMAIL_TO;
const char mail_from[] = EMAIL_FROM;
const char mail_subject[] = "Mail from Rabbit";
const char mail_body[] = "This is a test message sent by a Rabbit through an ISP.";


int main()
{
	auto unsigned long t;
	auto char buffer[100];
	auto int mail_status;
	auto int count;

	MY_CTS_BIT_SETUP	// set up the CTS handshake input
	MY_RTS_BIT_SETUP	// set up the RTS handshake output

	sock_init(); //initialize TCP/IP

	//test repeated open/close of modem link
	for(count = 0; count < 3; count++)
	{

	   //configure PPP for dialing in to ISP and bring it up
	   ifconfig(IF_DEFAULT,
	            IFS_PPP_SPEED, DIALUP_SPEED,
	            // Note: the NULL is for the shadow register.  From DC 9.0 on,
	            //       this is computed automatically - the value passed here
	            //       for the shadow register is ignored.
	            IFS_PPP_RTSPIN, MY_RTS_PORT, NULL, MY_RTS_BIT,
	            IFS_PPP_CTSPIN, MY_CTS_PORT, MY_CTS_BIT,
	            IFS_PPP_FLOWCONTROL, DIALUP_FLOWCONTROL,
	            IFS_PPP_SENDEXPECT, DIALUP_SENDEXPECT,
	            IFS_PPP_HANGUP, "ATH #ok",
	            IFS_PPP_MODEMESCAPE, 1,
	            IFS_PPP_ACCEPTIP, 1,
	            IFS_PPP_ACCEPTDNS, 1,
	            IFS_PPP_REMOTEAUTH, DIALUP_NAME, DIALUP_PASSWORD,
	            IFS_UP,
	            IFS_END);

	   while(ifpending(IF_DEFAULT) & 1)
	      tcp_tick(NULL);

	   if(ifstatus(IF_DEFAULT))
	      printf("PPP established\n");
	   else
	      printf("PPP failed\n");

	   ifconfig(IF_DEFAULT, IFG_IPADDR, &t, IFS_END);
	   printf("IP address is %s\n", inet_ntoa( buffer, t));

	   smtp_sendmail(mail_to, mail_from, mail_subject, mail_body);

	   while (SMTP_PENDING == (mail_status = smtp_mailtick()));

	   if(mail_status == SMTP_SUCCESS)
	      printf("Message sent\n");
	   else
	      printf("Failed to send message\n");

	   ifconfig(IF_DEFAULT, IFS_DOWN, IFS_END);

	   //wait while PPP terminates
	   while(ifpending(IF_DEFAULT) & 1)
	      tcp_tick(NULL);

	} //end of for loop

   return 0;
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美日韩色综合| 亚洲欧美综合另类在线卡通| 粉嫩高潮美女一区二区三区| 午夜av区久久| 午夜伊人狠狠久久| 亚洲不卡一区二区三区| 亚洲伊人伊色伊影伊综合网| 一区二区三区在线观看国产| 亚洲精品国产无天堂网2021| 亚洲精品成人少妇| 亚洲va欧美va国产va天堂影院| 亚洲一区二区三区影院| 精品欧美一区二区在线观看| 欧美亚洲动漫另类| 91啪在线观看| 色拍拍在线精品视频8848| 91久久精品一区二区三| 色综合天天在线| 欧美性生活久久| 日韩一区二区三区在线观看| 精品免费国产二区三区 | 成人sese在线| 91原创在线视频| 国产乱一区二区| 国产99精品国产| 97se亚洲国产综合自在线不卡 | 1000部国产精品成人观看| 亚洲免费毛片网站| 强制捆绑调教一区二区| 男人操女人的视频在线观看欧美| 精品制服美女丁香| 成人av免费在线| 欧美军同video69gay| 亚洲精品在线免费观看视频| 综合网在线视频| 视频一区二区三区中文字幕| 26uuuu精品一区二区| 日韩女优毛片在线| 亚洲成人精品一区二区| 18涩涩午夜精品.www| 亚洲婷婷综合久久一本伊一区| 亚洲综合激情另类小说区| 久久国产精品一区二区| 97久久精品人人做人人爽| 欧美一级视频精品观看| 成人欧美一区二区三区黑人麻豆| 日本午夜精品一区二区三区电影| 国产乱理伦片在线观看夜一区| 一本一道久久a久久精品综合蜜臀 一本一道综合狠狠老 | 亚洲一区二区不卡免费| 精品一区二区三区免费观看| 91亚洲国产成人精品一区二区三| 欧美一区二区三区视频免费| 亚洲视频免费观看| 国产精品亚洲午夜一区二区三区| 欧美高清视频一二三区| 最新日韩av在线| 国产成人亚洲综合色影视| 欧美人xxxx| 亚洲一区二区三区四区在线| 国产91丝袜在线播放| 精品欧美久久久| 日本亚洲欧美天堂免费| 欧美视频一区二区在线观看| 国产精品毛片大码女人| 国产成人在线看| 久久久久久亚洲综合影院红桃| 天堂在线亚洲视频| 欧美色视频在线| 亚洲国产一区二区三区| 91福利在线免费观看| 成人欧美一区二区三区小说| www.66久久| 国产欧美一区在线| 国产91丝袜在线播放九色| 久久男人中文字幕资源站| 九一九一国产精品| 久久综合九色综合久久久精品综合| 蜜臀久久99精品久久久久宅男| 欧美日韩国产首页| 五月天精品一区二区三区| 欧美日韩一区二区三区高清| 亚洲国产综合色| 666欧美在线视频| 日本伊人精品一区二区三区观看方式| 欧美性大战久久久久久久 | 同产精品九九九| 91超碰这里只有精品国产| 日韩在线播放一区二区| 91精品国产综合久久久久久| 蜜桃在线一区二区三区| 精品少妇一区二区三区免费观看 | 久久丁香综合五月国产三级网站 | 国产日本欧洲亚洲| 成人禁用看黄a在线| 中文字幕免费一区| 99精品一区二区三区| 亚洲欧美综合色| 欧美亚洲国产一区二区三区| 亚洲1区2区3区4区| 亚洲精品在线免费播放| 成人午夜视频免费看| 国产精品美女视频| 欧美亚洲日本一区| 国产做a爰片久久毛片| 中日韩av电影| 欧美午夜片在线看| 精品中文字幕一区二区| 欧美国产精品v| 欧美在线观看一区二区| 蜜臀av一区二区三区| 中文字幕不卡一区| 欧美日韩一区二区电影| 韩国三级电影一区二区| 亚洲欧洲www| 日韩亚洲国产中文字幕欧美| 成人午夜视频在线| 人妖欧美一区二区| 成人欧美一区二区三区白人| 欧美亚洲丝袜传媒另类| 国产精品一线二线三线精华| 亚洲另类春色校园小说| 欧美不卡一区二区| 在线观看日韩一区| 国产尤物一区二区| 亚洲电影视频在线| 国产日韩欧美一区二区三区综合| 欧美中文字幕一区二区三区| 精品亚洲免费视频| 亚洲电影激情视频网站| 日本一区二区视频在线| 91精品国产综合久久久久久漫画| 成人理论电影网| 老汉av免费一区二区三区| 亚洲欧美日韩国产手机在线| 久久青草欧美一区二区三区| 欧美日韩免费电影| 色爱区综合激月婷婷| 国产精品一区二区免费不卡| 日日摸夜夜添夜夜添精品视频| 中文字幕在线不卡一区二区三区| 精品少妇一区二区三区在线播放 | 成人aaaa免费全部观看| 久久精品国产精品亚洲精品| 一区二区三区免费看视频| 国产精品视频一二三区| 精品日韩一区二区三区| 67194成人在线观看| 欧美精品在线观看一区二区| 91日韩精品一区| av综合在线播放| 不卡的av中国片| 成人av动漫网站| 成人av影视在线观看| 成人一区在线看| 粉嫩一区二区三区在线看| 国产一区二区精品在线观看| 久久国产夜色精品鲁鲁99| 首页亚洲欧美制服丝腿| 天堂蜜桃一区二区三区| 亚洲成人av电影在线| 午夜欧美大尺度福利影院在线看| 一区二区三区在线视频免费 | 欧美岛国在线观看| 在线播放欧美女士性生活| 欧美精品一二三| 欧美α欧美αv大片| 欧美videossexotv100| 精品国产乱码久久久久久浪潮| 欧美一区二区视频免费观看| 日韩欧美一二三四区| 日韩欧美一级特黄在线播放| 久久免费美女视频| 中文在线资源观看网站视频免费不卡 | 91丨porny丨最新| 日本黄色一区二区| 欧美日韩高清一区| 欧美成人高清电影在线| 国产日韩欧美麻豆| 欧美变态tickling挠脚心| 蜜臀久久99精品久久久久久9 | 国产成人精品亚洲日本在线桃色 | 免费成人在线影院| 经典三级视频一区| 成人听书哪个软件好| 91亚洲精华国产精华精华液| 欧美日韩在线播| 日韩美女一区二区三区| 国产精品乱码一区二三区小蝌蚪| 一区二区三区在线播| 蜜臀久久久99精品久久久久久| 国产成人精品一区二区三区网站观看| 96av麻豆蜜桃一区二区| 欧美精品丝袜中出| 91小视频免费观看| 欧美一区二区三级| 国产精品久久久久久久久图文区| 亚洲一区在线观看免费观看电影高清 | 亚洲日本va午夜在线影院| 亚洲免费av高清|