?? main.c
字號:
/*
*********************************************************************************************************
* uC/OS-II
* The Real-Time Kernel
*
* (c) Copyright 1992-2002, Jean J. Labrosse, Weston, FL
* All Rights Reserved
*
* EXAMPLE #3
*********************************************************************************************************
*/
//#include "includes.h" //change by cmj ,includes => config
#include "main.h"
#include "../include/cfg_net.h"
void Timer1_Init(void);
/*
*********************************************************************************************************
* CONSTANTS
*********************************************************************************************************
*/
#define TASK_START_ID 0 /* Application tasks */
#define TASK_1_ID 1
#define TASK_2_ID 2
#define TASK_3_ID 3
#define TASK_4_ID 4
#define TASK_5_ID 5
#define TASK_6_ID 6
#define TASK_START_PRIO 10 /* Application tasks priorities */
#define TASK_1_PRIO 11
#define TASK_2_PRIO 12
#define TASK_3_PRIO 13
#define TASK_4_PRIO 14
#define TASK_5_PRIO 15
#define TASK_6_PRIO 16
#define MSG_QUEUE_SIZE 20 /* Size of message queue used in example */
OS_EVENT *RecPackedFlag;
OS_EVENT *RecBufOverFlowFlag;
OS_EVENT *RecTcpPackedFlag;
OS_EVENT *RecPingPackedFlag;
OS_STK task0_stack[400];
OS_STK task1_stack[400];
OS_STK task2_stack[400];
OS_STK task3_stack[400];
OS_STK task4_stack[400];
//OS_STK task5_stack[500];
const uint8 httpweb[]={
"HTTP/1.0 200 OK\r\n"
"Date: Mon, 24 Nov 2003 01:24:17 GMT\r\n"
"Server: microHttp/1.0 Zlgmcu Corporation\r\n"
"Accept-Ranges: bytes\r\n"
//"Content-Length: 116\r\n"//"Connection: Keep-Alive\r\n"
"Connection: Keep-Close\r\n"
"Content-Type: text/html\r\n"
"\r\n"};
const uint8 web[]={
"<HTML>\r\n"
"<HEAD>\r\n"
"<TITLE>ARM_NET演示網頁(周立功單片機)</TITLE>\r\n"
"<BODY aLink=green background=/100.bmp bgColor=#f1f1dd link=red\r\n"
"vLink=#321afd>\r\n"
"<H1>HELLO WELCOME TO EasyArm WEBSERVER</H1>\r\n"
"<UL>\r\n"
"<LI> <A HREF=\"http://www.zlgmcu.com/\">周立功單片機網站 </A>\r\n"
"<LI> <A HREF=\"http://www.zlg.cn/\">周立功單片機內部BBS </A>\r\n"
"<LI> <A HREF=\"http://www.zlgmcu.cn/\">周立功單片機 </A>\r\n"
"</UL>\r\n"
"</BODY>\r\n"
"</HTML>\r\n"
};
const uint8 httpgif[]={
"HTTP/1.0 200 OK\r\n"
"Date: Mon, 24 Nov 2003 01:24:17 GMT\r\n"
"Server: microHttp/1.0 Zlgmcu Corporation\r\n"
"Accept-Ranges: bytes\r\n"
//"Content-Length: 116\r\n"//"Connection: Keep-Alive\r\n"
"Connection: Keep-Close\r\n"
"Content-Type: image/bmp\r\n"
"\r\n"};
const uint8 bmp[442]={
0x42,0x4d,0xb6,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x76,0x00,0x00,0x00,0x28,0x00,
0x00,0x00,0x1a,0x00,0x00,0x00,0x14,0x00,0x00,0x00,0x01,0x00,0x04,0x00,0x00,0x00,
0x00,0x00,0x40,0x01,0x00,0x00,0xc4,0x0e,0x00,0x00,0xc4,0x0e,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x00,0x00,0x80,
0x00,0x00,0x00,0x80,0x80,0x00,0x80,0x00,0x00,0x00,0x80,0x00,0x80,0x00,0x80,0x80,
0x00,0x00,0xc0,0xc0,0xc0,0x00,0x80,0x80,0x80,0x00,0x00,0x00,0xff,0x00,0x00,0xff,
0x00,0x00,0x00,0xff,0xff,0x00,0xff,0x00,0x00,0x00,0xff,0x00,0xff,0x00,0xff,0xff,
0x00,0x00,0xff,0xff,0xff,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf6,0x66,0xff,
0xff,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x6f,
0xff,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0xff,0x66,0x66,0x6f,0x6f,0xff,0x66,0x66,
0xff,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0xff,0xf6,0xff,0xff,0x6f,0xf6,0xff,0xf6,
0xff,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0x6f,0xff,0x6f,0xf6,0xff,0xf6,
0xff,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xf6,0xff,0xf6,0xf6,0xff,0xff,
0x6f,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0x6f,0xf6,0xff,0x6f,0xff,
0x6f,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0xff,0xf6,0x66,0x66,0xf6,0xff,0xf6,0x66,
0x6f,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x6f,0xff,0xff,
0xff,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x6f,0xff,0xff,
0xff,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x6f,0xff,0xff,
0xff,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0x00,0x00,0x00
};
/*
*********************************************************************************************************
* DATA TYPES
*********************************************************************************************************
*/
/*
typedef struct {
char TaskName[30];
INT16U TaskCtr;
INT16U TaskExecTime;
INT32U TaskTotExecTime;
} TASK_USER_DATA;
*/
/*
*********************************************************************************************************
* VARIABLES
*********************************************************************************************************
*/
//TASK_USER_DATA TaskUserData[7];
//OS_EVENT *MsgQueue; /* Message queue pointer */
//void *MsgQueueTbl[20]; /* Storage for messages */
/*
*********************************************************************************************************
* FUNCTION PROTOTYPES
*********************************************************************************************************
*/
void TaskB(void *pdata)
{
void * UdpTemp;
uint8 eer;
while (1)
{
UdpTemp=OSQPend(RecUdpQFlag,0,&eer);
if(eer==OS_NO_ERR)
{
Udp_Process((Rec_Ptr *)UdpTemp);
eer=eer;
}
}
}
void TaskC(void *pdata)
{
void * TcpTemp;
uint8 err;
while (1)
{
TcpTemp=OSQPend(RecTcpQFlag,0,&err);
if(err==OS_NO_ERR)
{
Process_Tcp1((Rec_Ptr *)TcpTemp);
TcpTemp=TcpTemp;
}
}
}
void TaskD(void *pdata)
{
uint8 add[36]={"ZLGMCUyhbabcdefghijklmnopqrstuvwxyz"};
uint8 add1[10]={"123456789"};
uint8 rec_buffer[100];
SOCKET s;
uint8 couter_byte=5;
//uint8 Temp;
int rec_coute,send_coute;
uint16 iii;
struct sockaddr servaddr,clientaddr;
OSTimeDly(60);
servaddr.sin_family=0;
servaddr.sin_addr[0]=192;
servaddr.sin_addr[1]=168;
servaddr.sin_addr[2]=0;
servaddr.sin_addr[3]=58;
servaddr.sin_port=1026;
OSTimeDly(60);
s=*socket( 0, SOCK_DGRAM, UDP_PROTOCOL);
clientaddr.sin_family=0;
clientaddr.sin_addr[0]=192;
clientaddr.sin_addr[1]=168;
clientaddr.sin_addr[2]=0;
clientaddr.sin_addr[3]=174;
clientaddr.sin_port=1025;
iii=bind( (SOCKET * )&s, (struct sockaddr*)&clientaddr,sizeof(clientaddr));
while (1)
{
rec_coute=recvfrom( s, rec_buffer, 100, 0, (struct sockaddr*)&servaddr, &iii );
if(rec_coute>0)
{
if(rec_buffer[0]=='A')
couter_byte=5;
else
send_coute=sendto(s, rec_buffer, rec_coute, 0, (struct sockaddr*)&servaddr, sizeof(servaddr) );
}
while(couter_byte!=0)
{
send_coute=sendto(s, add, 34, 0, (struct sockaddr*)&servaddr, sizeof(servaddr) );
if(send_coute==34)
OSTimeDly(40);
else
send_coute=sendto(s, add1, 9, 0, (struct sockaddr*)&servaddr, sizeof(servaddr) );
OSTimeDly(40);
couter_byte--;
}
}
}
void TaskE(void *pdata)
{
uint8 Temp=0;
uint16 TempLength;
int addrlen;
int ei;
unsigned char ip_add[4]={192,168,0,1};
uint8 tempdata[400];
//uint8 err;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -