Exemplo n.º 1
0
status_t HOST_Init(void *host)
{
    sdif_transfer_callback_t sdifCallback = {0};
    sdif_host_t *sdifHost = (sdif_host_t *)host;

    /* Sets callback in host driver. */
    EVENT_InitTimer();

    /* Initialize SDIF. */
    sdifHost->config.endianMode = kHOST_EndianModeLittle;
    sdifHost->config.responseTimeout = 0xFFU;
    sdifHost->config.cardDetDebounce_Clock = 0xFFFFFFU;
    sdifHost->config.dataTimeout = 0xFFFFFFU;
    SDIF_Init(sdifHost->base, &(sdifHost->config));

    /* Set callback for SDHC driver. */
    sdifCallback.TransferComplete = SDIF_TransferCompleteCallback;
    /* Create handle for SDHC driver */
    SDIF_TransferCreateHandle(sdifHost->base, &g_sdifHandle, &sdifCallback, NULL);

    /* Create transfer complete event. */
    if (false == EVENT_Create(kEVENT_TransferComplete))
    {
        return kStatus_Fail;
    }

    /* Define transfer function. */
    sdifHost->transfer = SDIF_TransferFunction;

    /* Enable the card power here for mmc card case, because mmc card don't need card detect*/
    SDIF_EnableCardPower(sdifHost->base, true);

    return kStatus_Success;
}
Exemplo n.º 2
0
int main(void){	
	SDIFresult r;

	version_post_copyright();

	if (r = SDIF_Init()) {
		ouchstring(NAME ": Couldn't initialize SDIF library! %s",
		           SDIF_GetErrorString(r));
	return 0;
}

	sdif_fileinfo_class = class_new("SDIF-fileinfo", (method) sdif_fileinfo_new, 0,
		  (short)sizeof(t_sdif_fileinfo), 0L, A_GIMME, 0);
	class_addmethod(sdif_fileinfo_class, (method)sdif_fileinfo_bang, "bang", 0);
	class_addmethod(sdif_fileinfo_class, (method)sdif_fileinfo_clear, "clear", 0);
	class_addmethod(sdif_fileinfo_class, (method)version, "version", 0);
	class_addmethod(sdif_fileinfo_class, (method)sdif_fileinfo_scan, "scan", A_SYM, 0);

	
	ps_file = gensym("/file");
	ps_stream = gensym("/stream");
	ps_no_file = gensym("<no SDIF file read>");
	ps_1NVT = gensym("/1NVT");

	class_register(CLASS_BOX, sdif_fileinfo_class);
}
Exemplo n.º 3
0
int main(void)
{
  SDIFresult r;
  
	version_post_copyright();
		
	/* tell Max about my class. The cast to short is important for 68K */
	SDIFranges_class = class_new("SDIF-ranges", (method)SDIFranges_new, (method)SDIFranges_free,
			(short)sizeof(SDIFranges), 0L, A_GIMME, 0);
	
	/* bind my methods to symbols */
    class_addmethod(SDIFranges_class, (method)version, "version", 0);
	class_addmethod(SDIFranges_class, (method)SDIFranges_set, "set", A_SYM, 0);	
	class_addmethod(SDIFranges_class, (method)SDIFranges_GetMaxNumColumns, "max-columns", A_DEFSYM, 0);
	class_addmethod(SDIFranges_class, (method)SDIFranges_GetColumnRanges, "column-ranges", A_DEFSYM, 0);
	class_addmethod(SDIFranges_class, (method)SDIFranges_GetColumnRange, "column-range", A_LONG, A_DEFSYM, 0);



  //  initialize SDIF libraries
	if (r = SDIF_Init()) {
		ouchstring("%s: Couldn't initialize SDIF library! %s", 
		           NAME,
		           SDIF_GetErrorString(r));
		return 0;
	}
	
	if (r = SDIFmem_Init(my_getbytes, my_freebytes)) {
		post("¥ %s: Couldn't initialize SDIF memory utilities! %s", 
		     NAME,
		     SDIF_GetErrorString(r));
        return 0;
	}
		
	if (r = SDIFbuf_Init()) {
		post("¥ %s: Couldn't initialize SDIF buffer utilities! %s", 
		     NAME,
		     SDIF_GetErrorString(r));
		return 0;
	}
	
	ps_SDIF_buffer_lookup = gensym("##SDIF-buffer-lookup");
	ps_column_mins = gensym("/column-mins");
	ps_column_maxes = gensym("/column-maxes");
	ps_maxcolumns = gensym("/max-num-columns");
	ps_column_range = gensym("/column-range");


	class_register(CLASS_BOX, SDIFranges_class);

	return 0;	
}
Exemplo n.º 4
0
int main(void) {
	SDIFresult r;
	
	
	version_post_copyright();
	
	r = SDIFmem_Init(my_getbytes, my_freebytes);
	
	if (r) {
		ouchstring("Couldn't initialize SDIF memory utilities! %s", SDIF_GetErrorString(r));
	}	
	
	SDIFlistpoke_class = class_new("SDIF-listpoke", (method)SDIFlistpoke_new, 0,
			(short)sizeof(SDIFlistpoke), 0L, A_GIMME, 0);
	
	/* bind my methods to symbols */
        class_addmethod(SDIFlistpoke_class, (method)version, "version", 0);
	class_addmethod(SDIFlistpoke_class, (method)SDIFlistpoke_set, "set", A_SYM, 0);	
	class_addmethod(SDIFlistpoke_class, (method)SDIFlistpoke_errorreporting, "errorreporting", A_LONG, 0);
	class_addmethod(SDIFlistpoke_class, (method)SDIFlistpoke_time, "time", A_FLOAT, 0);
	class_addmethod(SDIFlistpoke_class, (method)SDIFlistpoke_numcolumns, "numcolumns", A_LONG, 0);
	class_addmethod(SDIFlistpoke_class, (method)SDIFlistpoke_listpoke, "listpoke", A_GIMME, 0);
	class_addmethod(SDIFlistpoke_class, (method)SDIFlistpoke_listpoke, "list", A_GIMME, 0);
	class_addmethod(SDIFlistpoke_class, (method)SDIFlistpoke_newmatrix, "newmatrix", A_GIMME, 0);
	class_addmethod(SDIFlistpoke_class, (method)SDIFlistpoke_matrixtype, "matrixtype", A_DEFSYM, 0);
	class_addmethod(SDIFlistpoke_class, (method)SDIFlistpoke_tellmeeverything, "tellmeeverything", 0);

  //  initialize SDIF libraries
	if (r = SDIF_Init()) {
		ouchstring("%s: Couldn't initialize SDIF library! %s", 
		           NAME,
		           SDIF_GetErrorString(r));
    return 0;
	}
	
	if (r = SDIFmem_Init(my_getbytes, my_freebytes)) {
		post("¥ %s: Couldn't initialize SDIF memory utilities! %s", 
		     NAME,
		     SDIF_GetErrorString(r));
    return 0;
	}
		
	if (r = SDIFbuf_Init()) {
		post("¥ %s: Couldn't initialize SDIF buffer utilities! %s", 
		     NAME,
		     SDIF_GetErrorString(r));
		return 0;
	}

	/* list object in the new object list */
	finder_addclass("Data", NAME);
	
	ps_SDIFbuffer = gensym("SDIF-buffer");
	ps_SDIF_buffer_lookup = gensym("##SDIF-buffer-lookup");
	ps_emptysymbol  = gensym("");
	ps_concatenate = gensym("concatenate");
	ps_time = gensym("time");
	ps_reltime = gensym("reltime");
	ps_direction = gensym("direction");
	ps_numcolumns = gensym("numcolumns");
	ps_interp = gensym("interp");
	ps_max_rows = gensym("max_rows");

	class_register(CLASS_BOX, SDIFlistpoke_class);

	return 0;
	
}