Listing 1-2. Exercise 1, Part 2
1-22
Getting Started with ADSP-BF537 EZ-KIT Lite
unsigned int get_real_time_clock_in_seconds ()
{
unsigned int clock = *pRTC_STAT;
/* second */
unsigned int seconds = ( clock & 0x3f );
/* minutes */
s= 60 * ( clock & 0xfc0 ) >> 6;
return seconds;
}
/* Initialize two arrays to the same set of random values */
void randomize_arrays ( int *v1, int *v2, unsigned int length )
{
unsigned int i;
for ( i = 0; i < length; ++i )
{
v1[ i ] = v2[ i ] = rand () % 1024;
}
}
/* A standard bubble sort algorithm, O(n^2) */
/* section("L1_code") */
void bubble_sort ( int *v, unsigned int length )
{
unsigned int i, j;
for ( i = 0; i < length - 1; ++i )
{
for ( j = i + 1; j < length; ++j )
{
if ( v[ i ] > v[ j ] )
{
int temp = v[ i ];
v[ i ] = v[ j ];
v[ j ] = temp;
www.BDTIC.com/ADI