/* NOTES ABOUT DIGIPID SOFTWARES*/
Check in <Erbium>D:\Projects\Utils\Microchip for more Read Me files.

/********** DAC CONNECTION AND CALCULATIONS ***********************************
All DAC calculations and registers are 16-bit. However, the current DAC only uses the 14-MSB but can
be upgraded to 16-bit later. DAC scaling is -10V = 0 and +10V = 65535.


/********** CHANGES TO ENABLE E'NET PHY CHIP **********************************
The ethernet phy IC needs reseting at boot. Phy reset is port RA0.
Find SYS_PORTS_Initialize(void), possibly in default\system_init.c. After SYS_PORTS_Initialize(),
add the following lines:

  	/********** Added to reset phy chip ********** /
	PLIB_PORTS_PinWrite (PORTS_ID_0, PORT_CHANNEL_A, 0, 1);						//enable phy chip
	int i;  for (i = 0; i < 1000; i++);											//10uS in reset
	PLIB_PORTS_PinWrite (PORTS_ID_0, PORT_CHANNEL_A, 0, 0);						//reset phy chip
	for (i = 0; i < 1000; i++);													//10uS in reset
	PLIB_PORTS_PinWrite (PORTS_ID_0, PORT_CHANNEL_A, 0, 1);						//enable phy chip
	/********************************************* /


/********** CHANGES TO ENABLE 1mS ISR *****************************************
In dynamic\drv_tmr.c, in DRV_TMR_Tasks(), just before the function's end add:
	mS_Timer ();																//Added for app's ISR


/********** CHANGES TO COUNT CONNECTED CLIENTS ********************************
In webserver_auth.c, in TCPIP_HTTP_FileAuthenticate(), add:
	ClientCount(connHandle);																		//number of clients connected


/********** FUTURE USE, TO ENABLE OTHER TIMER ISRs ****************************
In default\system_interrupt.c are the timer ISR calls, but are not used here e.g:
	__ISR(_EXTERNAL_1_VECTOR, IPL1AUTO)...


/********** KLUDGE TO MAKE PIN CHANGE NOTICES FIND THE DEFINES (if needed) ****************
For unknown reasons, one system file could not find the defines for the pin
change notices. This project does not use pin change notices but can't get rid
of the system's functions, which in turn can't find its defines.
The defines are found in the compiler directoy, in the file
	XC32\<ver#>\pic32mx\include\proc\p32mz1024efe100.h
The guilty Harmony file which can't see those defines is
	Harmony\<ver#>\framework\peripheral\ports\processor\ports_p32mz1024efe100.h
Into that file, anywhere near the top, add the missing defines:
    #define _CNCONA_SIDL_POSITION                    0x0000000D
    #define _CNCONA_SIDL_MASK                        0x00002000
    #define _CNCONA_SIDL_LENGTH                      0x00000001
    #define _CNCONB_SIDL_POSITION                    0x0000000D
    #define _CNCONB_SIDL_MASK                        0x00002000
    #define _CNCONB_SIDL_LENGTH                      0x00000001
    #define _CNCONC_SIDL_POSITION                    0x0000000D
    #define _CNCONC_SIDL_MASK                        0x00002000
    #define _CNCONC_SIDL_LENGTH                      0x00000001
    #define _CNCOND_SIDL_POSITION                    0x0000000D
    #define _CNCOND_SIDL_MASK                        0x00002000
    #define _CNCOND_SIDL_LENGTH                      0x00000001
    #define _CNCONE_SIDL_POSITION                    0x0000000D
    #define _CNCONE_SIDL_MASK                        0x00002000
    #define _CNCONE_SIDL_LENGTH                      0x00000001
    #define _CNCONF_SIDL_POSITION                    0x0000000D
    #define _CNCONF_SIDL_MASK                        0x00002000
    #define _CNCONF_SIDL_LENGTH                      0x00000001
    #define _CNCONG_SIDL_POSITION                    0x0000000D
    #define _CNCONG_SIDL_MASK                        0x00002000
    #define _CNCONG_SIDL_LENGTH                      0x00000001


/********** USER NVM (UNVM) QUIRKS *********************************************
This section is a repeat of the Projects\Util\Microchip\~NVM Mapping.txt which surecedes it.
For the PIC32MZ1024EFE100:
	Read: block is 1 byte
	Write: block (called "row") is 2K
	Erase: block (called "page") is 16k
	Can read any number of bytes. Although can write any number of rows, must erase
		in multiples of pages. Simplest to use DRV_NVM_EraseWrite(), the start and
		length parameters are in rows.
The MPFS and UNVM make up the NVM. The MPFS will grab as much of the lower range
	as it needs, the rest is available for UNVM. In DigiPid, MPFS (>30K) gets 64K
	and UNVM gets the next 16K.
In Harmony, NVM section, select a large enough NVM Media Size on multiples of
	page size. Okay to go too big, have 1MB for program and NVM. In DigiPid, the
	NVM is 80K.
From Harmony, get the NVM Media Start Address. In Project Properties - ICD3
	(or whichever programmer is used) - Memories to Program - Auto Select Memories
	and Ranges, select Manually Select Memories and Ranges and check Preserve
	Program Memory and in Preserve Program Memory Range(s)(hex) enter
	0x1d020000-0x1d024000, which is the upper 16K of the 80K in DigiPid. This will
	keep the UNVM while debugging. However, if preserved in release (non-debug)
	mode then it crashes, had to deselect the Preserve range for release.
*/