/*
 * Copyright (c) 1999-2000 University of California, Riverside.
 * Permission to copy is granted provided that this header remains
 * intact.  This software is provided with no warranties.
 *
 * Version : 1.0
 */


static unsigned char xdata C_STAT_REG_ADDR _at_ 65527;
static unsigned char xdata C_CMND_REG_ADDR _at_ 65528;
static unsigned char xdata C_DATAI_REG_ADDR _at_ 65529;
static unsigned char xdata C_DATAO_REG_ADDR _at_ 65530;

/*--------------------------------------------------------------------------*/

void CodecInitialize(void) {
    
    /* no code */
}

/*--------------------------------------------------------------------------*/

void CodecPushPixel(short p) {
    
    C_DATAO_REG_ADDR = (char)p;
}

/*--------------------------------------------------------------------------*/

short CodecPopPixel(void) {
    
    short p;
    
    p = C_DATAI_REG_ADDR;
    p <<= 8;
    p |= C_DATAI_REG_ADDR;
    
    return p;
}

/*--------------------------------------------------------------------------*/

void CodecDoFdct(void) {
    
    C_CMND_REG_ADDR = 1;
    
    while( C_STAT_REG_ADDR == 1 ) {
        
        /* busy wait */
    }    
}
