;;wwwpic2.inc ;; include file for wwwpic2 project ;;======================================================================== ;; settings ;;======================================================================== QUARTZ_FREQ equ 10000000 ;; soft uart defines RS_BAUD equ 19200 ; baud rate RS_DATA equ 8 ; number of data bits RS_TICKS equ (((QUARTZ_FREQ/4)/RS_BAUD)+1); add one because ; of fractions see _delay_x_9 for details B_RS232_RxD equ 0 ; bit 0 on PORTB (RB0) B_RS232_TxD equ 3 ; bit 3 on PORTA (RA3) B_RS232_CTS equ 2 ; bit 2 on PORTA (RA2) ;; IP defines ADDR_MYSELF_0 equ 192 ; 192.168.2.2 - private net addr ADDR_MYSELF_1 equ 168 ADDR_MYSELF_2 equ 2 ADDR_MYSELF_3 equ 2 ;; TCP defines TCP_PORT_HTTP equ 80 ; 1..255 TCP_RCV_WINDOW equ 128;!sic!; [non-volatile] TCP_SND_WINDOW equ 128 ; [non-volatile] ;; Filesystem defines FS_UNIT_SIZE equ 128 ; [non-volatile] FS_ROOT_DIR_ENTRIES equ 8 ; min 2: INDEX and ERROR. FS_USE_INTERNAL_ROM equ 1 FS_INTERNAL_ROM_UNITS equ 4 ; number of 128-byte pages FS_USE_INTERNAL_EEPROM equ 0 ; FS_USE_EXTERNAL_ROM equ 0 ;; Bits for flags B_HTTP_STATE_0 equ 5 ; in TCPS_FLAG B_HTTP_STATE_1 equ 6 ; in TCPS_FLAG B_TCP_ONLINE equ 7 ; in TCPS_FLAG socket data valid ; discard data flag - when set slip recive routines simply discards data B_SLIP_OUTPKT equ 7 ; ; escape flag set when previous char was a slip escape char B_SLIP_ESCAPE equ 6 ; ;;======================================================================== ;; special macros ;;======================================================================== ;;transmits given character TXLW macro value movlw value call _tx endm ;;sends a slip escaped char SLITXLW macro value movlw value call _slitx endm SUM0 macro value __TMPSUM set (((value)+((value) >> 16)) >> 8) movlw (__TMPSUM & 0xff) ENDM SUM1 MACRO value __TMPSUM set (((value)+((value) >> 16)) >> 0) movlw (__TMPSUM & 0xff) endm ;;======================================================================== ;; code macros ;;======================================================================== ;; branch if bit clear brclr macro reg,bit,dest_addr btfss reg,bit goto dest_addr endm ;branch if bit set brset macro reg,bit,dest_addr btfsc reg,bit goto dest_addr endm ;;replace us! ;bit ;; skip if bit==0 skip0 macro reg,bit btfsc reg,bit endm ;bit ;; skip if bit==1 skip1 macro reg,bit btfss reg,bit endm skipc macro ; skip if carry btfss STATUS,C endm skipnc macro ; skip if not carry btfsc STATUS,C endm skipz macro ; skip if zero btfss STATUS,Z endm skipnz macro ; skip if not zero btfsc STATUS,Z endm