/**
  Template C code for a DSP Library.

  @author Jeff Schoen
  @version $Id: libDSP.c,v 1.6 2011/04/27 13:07:25 jwb Exp $
*/
#define KEY_MODE 1
#define KEY_XFER 2

#include "cdefs.h"
#include <stdlib.h>

typedef struct {
  int_4 mode;
  int_4 xfer;
} DSPLibPlan;

void *DSPLib_alloc() {
  DSPLibPlan *plan = (DSPLibPlan*)malloc( sizeof(DSPLibPlan) );
  plan->mode = 0;
  plan->xfer = 0;
  return (void*)plan;
}

int_4 DSPLib_setkey (void *handle, int_4 key, void *data, int_4 len) {
  DSPLibPlan *plan = (DSPLibPlan*)handle;
       if (key==KEY_MODE) plan->mode = *(int_4*)data;
  else if (key==KEY_XFER) plan->xfer = *(int_4*)data;
  else return -1;
  return 0;
}

int_4 DSPLib_getkey (void *handle, int_4 key, void *data, int_4 len) {
  DSPLibPlan *plan = (DSPLibPlan*)handle;
       if (key==KEY_MODE) *(int_4*)data = plan->mode;
  else if (key==KEY_XFER) *(int_4*)data = plan->xfer;
  else return -1;
  return 0;
}

int_4 DSPLib_init (void *handle) {
  DSPLibPlan *plan = (DSPLibPlan*)handle;
  return 0;
}

int_4 DSPLib_work (void *handle, void *buf1, void *buf2, int_4 n) {
  DSPLibPlan *plan = (DSPLibPlan*)handle;
  return 0;
}

int_4 DSPLib_free (void *handle) {
  DSPLibPlan *plan = (DSPLibPlan*)handle;
  free (handle);
  return 0;
}
