source: branch/giet_vm_ioc_drivers/pgcd/main.c @ 287

Last change on this file since 287 was 254, checked in by alain, 11 years ago

Improving support for Chained Buffer DMA in drivers.c file.

File size: 947 bytes
Line 
1#include "stdio.h"
2
3/////////////////////////////////////////
4__attribute__ ((constructor)) void main()
5{
6    unsigned int opx;
7    unsigned int opy;
8
9    giet_tty_printf("Starting task PGCD on processor %d at cycle %d\n",
10                   giet_procid(), giet_proctime());
11
12    while (1) 
13    {
14        giet_tty_printf("\n*******************\n");
15        giet_tty_printf("operand X = ");
16        giet_tty_getw( &opx );
17        giet_tty_printf("\n");
18        giet_tty_printf("operand Y = ");
19        giet_tty_getw( &opy );
20        giet_tty_printf("\n");
21        if( (opx == 0) || (opy == 0) ) 
22        {
23           giet_tty_printf("operands must be larger than 0\n");
24        } 
25        else 
26        {
27            while (opx != opy) 
28            {
29                if(opx > opy)   opx = opx - opy;
30                else            opy = opy - opx;
31            }
32            giet_tty_printf("pgcd      = %d\n", opx);
33        }
34    }
35} // end pgcd
36
Note: See TracBrowser for help on using the repository browser.