// filename lltest.C // Test of dynamic linked lists, simple heap // Last modified 12/16/02 by Jonathan W. Valvano // Copyright 2003 by Jonathan W. Valvano, valvano@uts.cc.utexas.edu // You may use, edit, run or distribute this file // as long as the above copyright notice remains #include "HC12.h" #include "SCI12.H" #include "llfifo.h" void Init(void){ COPCTL = 0x00; // disable COP DDRT |= 0x40; // PortT bit 6 is output to LED TSCR = 0x80; // TEN(enable) } void TestPut(unsigned short data){ SCI_OutString("Put "); SCI_OutUDec(data); if(LLFifo_Put(data)){ SCI_OutString(" ok"); SCI_OutChar(CR); } else{ SCI_OutString(" full"); SCI_OutChar(CR); } PORTT ^= 0x40; // toggle LED } void TestGet(void){ unsigned short data; SCI_OutString("Get "); if(LLFifo_Get(&data)){ SCI_OutUDec(data); SCI_OutString(" ok"); SCI_OutChar(CR); } else{ SCI_OutString(" empty"); SCI_OutChar(CR); } PORTT ^= 0x40; // toggle LED } void main(void){ Init(); // disable COP, enable Port T SCI_Init(13); LLFifo_Init(); // Initialize linked list SCI_OutString("Linked list test 12/16/02 -JWV"); SCI_OutChar(CR); while(1){ TestPut(0); TestGet(); TestPut(1234); TestPut(6789); TestGet(); TestGet(); TestPut(1); TestPut(2); TestPut(3); TestGet(); TestGet(); TestGet(); TestPut(1); TestPut(2); TestPut(3); TestPut(4); // full error TestGet(); TestGet(); TestGet(); TestGet(); // empty error SCI_OutString("Type any key to repeat"); SCI_OutChar(CR); SCI_InChar(); } } #include "SCI12.C" #include "llfifo.c" extern void _start(); #pragma abs_address:0xfffe void (*reset_vector[])() = { _start }; #pragma end_abs_address