/* @(#) 3psppc-213: apps/sldemo/data.c 1.1 95/04/14 09:50:02 */ /***********************************************************************/ /* */ /* MODULE: spotlight/data.c */ /* DATE: 95/04/14 */ /* PURPOSE: A sample application for the SpOTLIGHT debugger */ /* */ /*---------------------------------------------------------------------*/ /* */ /* Copyright 1991 - 1995, Integrated Systems, Inc. */ /* ALL RIGHTS RESERVED */ /* */ /* Permission is hereby granted to licensees of Integrated Systems, */ /* Inc. products to use or abstract this computer program for the */ /* sole purpose of implementing a product based on Integrated */ /* Systems, Inc. products. No other rights to reproduce, use, */ /* or disseminate this computer program, whether in part or in */ /* whole, are granted. */ /* */ /* Integrated Systems, Inc. makes no representation or warranties */ /* with respect to the performance of this computer program, and */ /* specifically disclaims any responsibility for any damages, */ /* special or consequential, connected with the use of this program. */ /* */ /*---------------------------------------------------------------------*/ /* */ /* This module contains code to simulate processing of RAM disk */ /* data. */ /* */ /***********************************************************************/ #include "sys_conf.h" #include #include "demo.h" /*---------------------------------------------------------------------*/ /* Function prototypes. */ /*---------------------------------------------------------------------*/ void process_data(char *); void calc_sum(unsigned long); long myequate(long x); long cube(long x); /***********************************************************************/ /* process_data: Simulate processing RAM disk data. */ /* */ /***********************************************************************/ void process_data(char *dataptr) { int Index; unsigned long date, time, ticks; unsigned long rc; rc = tm_get(&date, &time, &ticks); calc_sum(ticks); for (Index = 0; Index < BLOCK_SIZE; Index++) dataptr[Index] = ~dataptr[Index]; tm_wkafter(10); } /***********************************************************************/ /* calc_sum: Calculates the sum of an arbitrary function. */ /* */ /* NOTE: Called from either 'IO1 ' or 'IO2 ' */ /***********************************************************************/ void calc_sum(ticks) unsigned long ticks; { long sum = 0; long x, y; long max_value; long count; #define INCREMENT 1 /*---------------------------------------------------------------------*/ /* Use ticks to determine values to plug into function. */ /*---------------------------------------------------------------------*/ max_value = (ticks % 16) + 16; /* some number */ x = -max_value; while (x < max_value) { y = myequate(x); sum = sum + y; x += INCREMENT; } /*---------------------------------------------------------------------*/ /* Loop some more to simulate processing time. */ /*---------------------------------------------------------------------*/ count = max_value * 9000; while (count--) ;; } /***********************************************************************/ /* myequate: Calculate the function, y = x^3 */ /* given the value of x. */ /* */ /* NOTE: Called by 'IO1 ' and 'IO2 ' tasks */ /***********************************************************************/ long myequate(x) long x; { return(cube(x)); } /***********************************************************************/ /* cube: Calculate the cube of a number, i.e. x times x times x */ /* */ /* NOTE: Called by 'IO1 ' and 'IO2 ' tasks */ /***********************************************************************/ long cube(x) long x; { return(x * x * x); }