📄 globals.c
字号:
//##############################################################
//#
//# GLOBALS.C
//#
//# ADSP-21535 Embedded Web Server Project
//#
//# (c) ANALOG DEVICES 2002
//# eDSP Division
//# Stefan Hacker
//# 23-DEC-2002
//#
//# History
//# 16-APR-2003 HS release 1.0
//#
#include "ez_lan_types.h"
#include "tcp_ip.h"
#include "http_svr.h"
#include "cf_ide.h"
#define M1 section("L1_data_a")
#define M2 section("L1_data_b")
///////////////////////////
// SYSTEM specific Vaiables
// IRQ status variables
M1 volatile BYTE IRQ_DISK;
M1 volatile BYTE IRQ_LAN;
M1 volatile BYTE Timeout_DISK;
M1 volatile BYTE Timeout_LAN;
M1 volatile BYTE Timeout_SYS;
M1 volatile DWORD sys_time;
M1 volatile BYTE sys_day, sys_hour, sys_min, sys_sec;
M1 struct netdev_stats stats;
M1 volatile BYTE ATA_ERROR;
///////////////////////////
// CF ATA variables
M1 struct ATA_CMD_BUF ATA_CMD;
M1 WORD ATA_buffer[256];
// raw structures
M1 WORD ATA_N_Cyl;
M1 WORD ATA_N_Head;
M1 WORD ATA_N_Sec;
M1 DWORD ATA_N_LBA;
// FAT Structures
M1 struct ATA_DPARA ATA_P;
M1 struct ATA_DIRENTRY ATA_D[MAX_NORM_DIR];
M1 struct ATA_DIRSHORT ATA_DS[MAX_SHORT_DIR];
M1 WORD ATA_FirstDataSector;
M1 WORD ATA_LBAHidden;
M1 WORD ATA_RootDirSectors;
M1 WORD ATA_RootDirSecCnt;
M1 WORD ATA_FATSz;
M1 WORD ATA_TotSec;
M1 WORD ATA_DataSec;
M1 WORD ATA_CountOfClusters;
M1 BYTE ATA_media_present;
M1 BYTE ATA_FAT16_detected;
M1 WORD ATA_CurFATBuffer[256];
M1 WORD ATA_CurFATPtr;
M1 WORD ATA_CurClusterBuffer[512];
M1 WORD ATA_CurDirEnt;
M1 DWORD ATA_CurDirPtr;
M1 DWORD ATA_CurFilePtr;
M1 DWORD ATA_CurFileSize;
///////////////////////////
// LAN variables
M1 struct SMC_LOCAL LAN_state;
M1 struct ETH_PACKET LAN_rx_packet;
M1 struct ETH_PACKET LAN_tx_packet;
M1 volatile BYTE LAN_pkt_avail;
M1 volatile BYTE LAN_error;
///////////////////////////
// TCPIP variables
// LOCAL_IP_2.LOCAL_IP_2.LOCAL_IP_3.LOCAL_IP_4
M1 WORD TCP_Local_IP[2] =
{
LOCAL_IP_1 | (LOCAL_IP_2 << 8),
LOCAL_IP_3 | (LOCAL_IP_4 << 8)
};
// SUBNETMASK_1.SUBNETMASK_2.SUBNETMASK_3.SUBNETMASK_4
M1 WORD TCP_SubnetMask[2] =
{
SUBNETMASK_1 + (SUBNETMASK_2 << 8),
SUBNETMASK_3 + (SUBNETMASK_4 << 8)
};
// GATEWAY_IP_1.GATEWAY_IP_2.GATEWAY_IP_3.GATEWAY_IP_4
M1 WORD TCP_GatewayIP[2] =
{
GATEWAY_IP_1 + (GATEWAY_IP_2 << 8),
GATEWAY_IP_3 + (GATEWAY_IP_4 << 8)
};
// "M1-M2-M3-M4-M5-M6"
M1 BYTE TCP_MyMAC[6] =
{
MAC_IA_1, MAC_IA_2, MAC_IA_3, MAC_IA_4, MAC_IA_5, MAC_IA_6
};
M1 tTCPStateMachine TCP_StateMachine; // TCP_IP Statemachine
M1 tLastFrameSent TCP_LastFrameSent; // Retransmission types
M1 WORD TCP_ISN_Gen_High; // upper word of our Initial Sequence Number
// Sequence numbers
M1 DWORD TCP_Seq_Nr; // to send
M1 DWORD TCP_UNA_Seq_Nr; // unacknowledged, incremented after send
M1 DWORD TCP_Ack_Nr; // next seq to receive and ack to send
M1 BYTE TCP_Timer; // inc'd each 262ms
M1 BYTE TCP_RetryCounter; // nr. of retransmissions
// properties of the received frame
M1 WORD TCP_Recd_Frame_Length; // SMSC reported frame length
M1 WORD TCP_Recd_Frame_MAC[3]; // 48 bit MAC
M1 WORD TCP_Recd_Frame_IP[2]; // 32 bit IP
M1 WORD TCP_Recd_IP_Frame_Length; // 16 bit IP packet length
M1 WORD TCP_TxFrame1Size; // bytes to send in TxFrame1
M1 WORD TCP_TxFrame2Size; // bytes to send in TxFrame2
M1 WORD TCP_Rx_Data_Count; // nr. of bytes rec'd
M1 WORD TCP_Tx_Data_Count; // nr. of bytes to send
M1 WORD TCP_LocalPort; // TCP ports
M1 WORD TCP_RemotePort;
M1 WORD TCP_RemoteMAC[3]; // MAC and IP of current TCP-session
M1 WORD TCP_RemoteIP[2];
M1 BYTE TCP_SocketStatus;
M1 BYTE TCP_TransmitControl;
M1 BYTE TCP_Flags;
// make these buffer 32bit access aligned
#pragma align 4
M1 BYTE TCP_TxFrame1[TCP_TX_FRAME1_SIZE];
#pragma align 4
M1 BYTE TCP_TxFrame2[TCP_TX_FRAME2_SIZE];
#pragma align 4
M1 BYTE TCP_RxTCPBuffer[MAX_TCP_RX_SIZE]; // space for incoming TCP-data
///////////////////////////
// HTTP_SVR variables
M1 BYTE *HTTP_WebSide;
M1 DWORD HTTP_WEBSideSize;
M1 DWORD HTTP_BytesToSend;
M1 DWORD HTTP_Buffer[375];
M1 BYTE HTTP_Status;
M1 BYTE HTTP_FileType;
M1 BYTE GetResponse[GetResponseSize] =
{
"HTTP/1.1 200 OK\r\n" // protocol ver 1.1, code 200, reason OK
"Content-Type: text/html\r\n" // type of data we want to send
"\r\n" // indicate end of HTTP-header
};
M1 BYTE GetPDFFile[GetPDFFileSize] =
{
"HTTP/1.1 200 OK\r\n" // protocol ver 1.1, code 200, reason OK
"Content-Type: application/pdf\r\n" // type of data we want to send
"\r\n" // indicate end of HTTP-header
};
M1 BYTE GetJPEGFile[GetPDFFileSize] =
{
"HTTP/1.1 200 OK\r\n" // protocol ver 1.1, code 200, reason OK
"Content-Type: image/jpeg\r\n" // type of data we want to send
"\r\n" // indicate end of HTTP-header
};
// end of file
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -