📄 net2272.h
字号:
#define TEST_J 1 //
#define TEST_K 2 //
#define TEST_SE0_NAK 3 //
#define TEST_PACKET 4 //
#define TEST_FORCE_ENABLE 5 //
///////////////////////////////////////////////////////////////////////////////
#define XCVRDIAG 0x33
// Transciever Diagnostic Register
// - This register is used by the manufacturer for chip testing
#define FORCE_FULL_SPEED 2
#define FORCE_HIGH_SPEED 3
#define OPMODE 4 // Bits 5:4
#define LINESTATE 6 // Bits 7:6
// OPMODE selectors (See OPMODE in XCVRDIAG)
#define NORMAL_OPERATION 0 //
#define NON_DRIVING 1 //
#define DISABLE_BITSTUFF_AND_NRZI_ENCODE 2 //
// LINESTATE selector (See LINESTATE in XCVRDIAG)
#define SE0_STATE 0 //
#define J_STATE 1 //
#define K_STATE 2 //
#define SE1_STATE 3 //
///////////////////////////////////////////////////////////////////////////////
#define VIRTOUT0 0x34
///////////////////////////////////////////////////////////////////////////////
#define VIRTOUT1 0x35
///////////////////////////////////////////////////////////////////////////////
#define VIRTIN0 0x36
///////////////////////////////////////////////////////////////////////////////
#define VIRTIN1 0x37
///////////////////////////////////////////////////////////////////////////////
#define SETUP0 0x40
///////////////////////////////////////////////////////////////////////////////
#define SETUP1 0x41
///////////////////////////////////////////////////////////////////////////////
#define SETUP2 0x42
///////////////////////////////////////////////////////////////////////////////
#define SETUP3 0x43
///////////////////////////////////////////////////////////////////////////////
#define SETUP4 0x44
///////////////////////////////////////////////////////////////////////////////
#define SETUP5 0x45
///////////////////////////////////////////////////////////////////////////////
#define SETUP6 0x46
///////////////////////////////////////////////////////////////////////////////
#define SETUP7 0x47
///////////////////////////////////////////////////////////////////////////////
// Endpoint Registers
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
#define EP_DATA 0x05
///////////////////////////////////////////////////////////////////////////////
#define EP_STAT0 0x06
// Endpoint Status Register (low byte)
#define DATA_IN_TOKEN_INTERRUPT 0 //
#define DATA_OUT_TOKEN_INTERRUPT 1 //
#define DATA_PACKET_TRANSMITTED_INTERRUPT 2 //
#define DATA_PACKET_RECEIVED_INTERRUPT 3 //
#define SHORT_PACKET_TRANSFERRED_INTERRUPT 4 //
#define NAK_OUT_PACKETS 5 //
#define BUFFER_EMPTY 6 //
#define BUFFER_FULL 7 //
///////////////////////////////////////////////////////////////////////////////
#define EP_STAT1 0x07
// Endpoint Status Register (low byte)
#define TIMEOUT 0 //
#define USB_OUT_ACK_SENT 1 //
#define USB_OUT_NAK_SENT 2 //
#define USB_IN_ACK_RCVD 3 //
#define USB_IN_NAK_SENT 4 //
#define USB_STALL_SENT 5 //
#define LOCAL_OUT_ZLP 6 //
#define BUFFER_FLUSH 7 //
///////////////////////////////////////////////////////////////////////////////
#define EP_TRANSFER0 0x08
///////////////////////////////////////////////////////////////////////////////
#define EP_TRANSFER1 0x09
///////////////////////////////////////////////////////////////////////////////
#define EP_TRANSFER2 0x0a
///////////////////////////////////////////////////////////////////////////////
#define EP_IRQENB 0x0b
// Endpoint Interrupt Enable Register
#define DATA_IN_TOKEN_INTERRUPT_ENABLE 0 //
#define DATA_OUT_TOKEN_INTERRUPT_ENABLE 1 //
#define DATA_PACKET_TRANSMITTED_INTERRUPT_ENABLE 2 //
#define DATA_PACKET_RECEIVED_INTERRUPT_ENABLE 3 //
#define SHORT_PACKET_TRANSFERRED_INTERRUPT_ENABLE 4 //
///////////////////////////////////////////////////////////////////////////////
#define EP_AVAIL0 0x0c
///////////////////////////////////////////////////////////////////////////////
#define EP_AVAIL1 0x0d
///////////////////////////////////////////////////////////////////////////////
#define EP_RSPCLR 0x0e
#define EP_RSPSET 0x0f
// Endpoint Response Register Clear (and Set)
#define ENDPOINT_HALT 0 //
#define ENDPOINT_TOGGLE 1 //
#define NAK_OUT_PACKETS_MODE 2 //
#define CONTROL_STATUS_PHASE_HANDSHAKE 3 //
#define INTERRUPT_MODE 4 //
#define AUTOVALIDATE 5 //
#define HIDE_STATUS_PHASE 6 //
#define ALT_NAK_OUT_PACKETS 7 // Same as NAK OUT Packets, but here it can be set OR cleared
///////////////////////////////////////////////////////////////////////////////
#define EP_MAXPKT0 0x28
///////////////////////////////////////////////////////////////////////////////
#define EP_MAXPKT1 0x29
// Number of addtional transaction opportunties per microframe for high-speed
// isochronous and interrupt endpoints.
#define ADDITIONAL_TRANSACTION_OPPORTUNITIES 3 // Bits 4:3
// ADDITIONAL_TRANSACTION_OPPORTUNITIES selectors (See bit 3 in EP_MAXPKT1)
#define NONE_ADDITIONAL_TRANSACTION 0 //
#define ONE_ADDITIONAL_TRANSACTION 1 //
#define TWO_ADDITIONAL_TRANSACTION 2 //
///////////////////////////////////////////////////////////////////////////////
#define EP_CFG 0x2a
// Endpoint Configuration Register
#define ENDPOINT_NUMBER 0 // Bits 3:0, NET2272 endpoint maps to this USB endpoint
#define ENDPOINT_DIRECTION 4 // 0:OUT, 1:IN
#define ENDPOINT_TYPE 5 // 1:Isochronous, 2:Bulk, 3:Interrupt
#define ENDPOINT_ENABLE 7 //
///////////////////////////////////////////////////////////////////////////////
#define EP_HBW 0x2b
// Provides the PID of the last high bandwidth OUT packet received.
#define HIGH_BANDWIDTH_OUT_TRANSACTION_PID 0 // Bits 1:0
// HIGH_BANDWIDTH_OUT_TRANSACTION_PID selector (See bit 0 in EP_HBW)
#define DATA0_PID 0 //
#define DATA1_PID 1 //
#define DATA2_PID 2 //
#define MDATA_PID 3 //
///////////////////////////////////////////////////////////////////////////////
#define EP_BUFF_STATES 0x2c
// Current state of endpoint buffer A
#define BUFFER_A_STATE 0 // Bits 1:0
// Current state of endpoint buffer B
#define BUFFER_B_STATE 2 // Bits 3:2
// Current State of the endpoint buffer
#define BUFF_FREE 0 // 00
#define BUFF_VALID 1 // 01
#define BUFF_LCL 2 // 10
#define BUFF_USB 3 // 11
///////////////////////////////////////////////////////////////////////////////
// Miscellaneous NET2272 constants
// - These constants may not be specifically listed in the NET2272 specification,
// nonetheless they are NET2272 constants
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Maximum packet size of Endpoint Zero
#define EP0_MAX_PACKET_SIZE 0x40
///////////////////////////////////////////////////////////////////////////////
// Endpoint interrupt bits conveniently map to endpoint indices:
#define EP0 ENDPOINT_0_INTERRUPT
#define EPA ENDPOINT_A_INTERRUPT
#define EPB ENDPOINT_B_INTERRUPT
#define EPC ENDPOINT_C_INTERRUPT
///////////////////////////////////////////////////////////////////////////////
// Physical data endpoints available on the NET2272 (EPA, EPB, EPC)
#define FIRST_PHYSICAL_ENDPOINT EPA
#define LAST_PHYSICAL_ENDPOINT EPC
#define PHYSICAL_ENDPOINT_COUNT (LAST_PHYSICAL_ENDPOINT + 1)
///////////////////////////////////////////////////////////////////////////////
#endif // NET2272_H
///////////////////////////////////////////////////////////////////////////////
// End of file
///////////////////////////////////////////////////////////////////////////////
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -