Tech:CLT Tutor Sources
From Texas Instruments Embedded Processors Wiki
Translate this page to
C sources for Program Cache Layout Tutorial.
Return to Program Cache Layout
main.c
/*****************************************************************************/ /* MAIN.C - defines main() and static function local() for Cache Layout */ /* Tool Tutorial. */ /*****************************************************************************/ #include <stdio.h>
void lots(int i); void rare(); static void local();
/*****************************************************************************/
/* MAIN() - calls rare() once; calls main.c:local() 4 times. */
/*****************************************************************************/
void main()
{
int i;
rare();
for (i = 1; i < 5; i++)
local();
printf("\n");
fflush(stdout);
}
/*****************************************************************************/
/* LOCAL() - calls lots() 80 times. */
/*****************************************************************************/
static void local()
{
int i;
printf("-");
for (i = 0; i < 20; ++i)
lots(i);
}
lots.c
/*****************************************************************************/ /* LOTS.C - defines lots() and static function local() for Cache Layout */ /* Tool Tutorial. */ /*****************************************************************************/ #include <stdio.h> static void local();
/*****************************************************************************/
/* LOTS() - calls lots.c:local() 100+ times. */
/*****************************************************************************/
void lots(int i)
{
local();
if (i % 3 == 0) local();
}
/*****************************************************************************/
/* LOCAL() - print out a '.' to stdout. */
/*****************************************************************************/
void local()
{
printf(".");
}
rare.c
/*****************************************************************************/
/* RARE.C - defines global function rare() for Cache Layout Tool Tutorial. */
/*****************************************************************************/
void rare()
{
}
Leave a Comment
