This directory contains Version-2 drivers and kernels for serialICE. The files named d*.rec are drivers and the files named k*.rec are kernels. The drivers are intended to be downloaded to IMON, the kernels are intended to be "blown" into PROM or flash memory. Version-2 kernels have two major differences from Version-1 kernels; the format of the savearea, and the ability to respond to ATTN characters in the stopped state. The new savearea format uses a fixed header that contains the following fields. struct SaveareaHdr { Ulong ICE_SAV; /* save area version */ Ulong ICE_SAH; /* save area header size */ Ulong ICE_MAP; /* bit-map for savearea */ Ulong ICE_IBS; /* size of instr buffer */ Ulong ICE_GWP; /* pointer to get_word routine */ Ulong ICE_PWP; /* pointer to put_word routine */ Ulong ICE_EPC; /* saved so that it can be set */ Ulong ICE_LE; /* set if little endian */ }; The ICE_SAV field contains an integer that is used to identify the header version. The current version is 2. The ICE_SAH field contains an integer that specifies the size of the header. This allows us to add fields to the end of the header without changing the version. The ICE_MAP field contains a 32-bit value that defines which of the 32 GP registers can be found immediately following this header. These registers must be saved in asending numerical order. ie. register 1..2..3 etc. For each register saved, you must set one bit in this field. For example, if you have a ICE_MAP value of 0x80011ff6, it means that you have saved GP registers 1,2,4-12,16, and 31. The ICE_IBS field contains an integer that specifies the size of the instruction buffer. This permits the host to avoid overflowing the instruction buffer. The ICE_GWP field contains the address of the get_word routine in the kernel. This is used by the host during downloads. The ICE_PWP field contains the address of the put_word routine in the kernel. This is used by the host during uploads. The ICE_EPC field contains the saved value of the C0_EPC register. The ICE_LE field containa a zero in big endian targets, and a one in little endian targets. In Version-2, the kernel sets the LS bit of the savearea address when responding to a SENDSAP command. This permits the host to recognize that the target is equipped with a version-2 kernel. In Version-2 there are two separate routines for getting a word from the serial port. get_word and get_cmd. get_word is used for downloads, and get_cmd is used for all other cases. The begining of the ice_loop now calls get_cmd rather than get_word. The difference between get_word and get_cmd, is that get_cmd checks the first byte of each word, and if it is an ATTN character, it responds with ACK. This permits the host to determine the state of the target. Example pseudo code follows... Ulong get_cmd(void) { Ulong v,rtn; int i; for (i=4;i>0;) { /* wait for RXRDY */ while (!(inw(UART_RXS)&RXS_RXRDY)) ; v = inw(UART_RXHDR); /* get the byte */ if (i==4 && v == ATTN) { /* first byte is ATTN */ /* wait for TXRDY */ while (!(inw(UART_TXS)&RXS_TXRDY)) ; outw(UART_TXHDR,ACK); /* send the ACK */ } else { rtn <<= 8; rtn |= v; i--; } } return(rtn); }