Пример #1
0
void Main_task(uint32_t initial_data)
{
    int  ret = 0;
    char filesystem_name[] = "a:";
    char partman_name[]    = "pm:";
    MQX_FILE_PTR com_handle, sdcard_handle, filesystem_handle, partman_handle;

    printf("Starting client example... \n");

    ret = sdcard_open(&com_handle, &sdcard_handle, &partman_handle,
                      &filesystem_handle, partman_name, filesystem_name);

    if (ret != 0) {
        printf("error: sdcard_open(), ret = %d\n", ret);
        _mqx_exit(1);
    }
    printf("SD card installed to %s\n", filesystem_name);

    setup_ethernet();
    setup_clock();
    client_test();

    ret = sdcard_close(&sdcard_handle, &partman_handle, &filesystem_handle,
                       partman_name, filesystem_name);

    if (ret != 0) {
        printf("error: sdcard_close(), ret = %d\n", ret);
        _mqx_exit(1);
    }
    printf("SD card uninstalled.\n");

    _mqx_exit(0);
}
Пример #2
0
void Main_task(uint32_t initial_data)
{
    int          ret = 0;
    func_args    args;
    char         filesystem_name[] = "a:";
    char         partman_name[]    = "pm:";
    MQX_FILE_PTR com_handle, sdcard_handle, filesystem_handle, partman_handle;

    ret = sdcard_open(&com_handle, &sdcard_handle, &partman_handle,
                      &filesystem_handle, partman_name, filesystem_name);
    if (ret != 0) {
        printf("error: sdcard_open(), ret = %d\n", ret);
        _mqx_exit(1);
    }
    printf("SD card installed to %s\n", filesystem_name);

    benchmark_test(&args);

    ret = sdcard_close(&sdcard_handle, &partman_handle,
                       &filesystem_handle, partman_name, filesystem_name);
    if (ret != 0) {
        printf("error: sdcard_close(), ret = %d\n", ret);
        _mqx_exit(1);
    }
    printf("SD card uninstalled.\n");

    _mqx_exit(0);

}
Пример #3
0
static BOOL sdcard_init(SDC_PRMS_T* params)
{
  SDC_XFER_SETUP_T dataset;

	sddev = sdcard_open(SDCARD, 0);
	if (sddev == 0)
	{
		return FALSE;
	}

	/* Setup controller parameters */
	params->opendrain = TRUE;
	params->powermode = SD_POWER_ON_MODE;
	params->pullup0 = 1;
	params->pullup1 = 1;
	params->pullup23 = 1;
	params->pwrsave = FALSE;
	params->sdclk_rate = SDMMC_OCR_CLOCK;
	params->use_wide = FALSE;
	if (sdcard_ioctl(sddev, SD_SETUP_PARAMS,
		(INT_32) params) == _ERROR)
	{
//		blkdev_deinit();
		return FALSE;
	}

	/* Setup data transfer paramaters */
	dataset.data_callback = (PFV) wait4datadone;
	dataset.cmd_callback = (PFV) wait4cmddone;
	dataset.blocksize = SDMMC_BLK_SIZE;
	dataset.data_to = 0x001FFFFF; /* Long timeout for slow MMC cards */
	dataset.use_dma = FALSE;
	if (sdcard_ioctl(sddev, SD_SETUP_DATA_XFER, (INT_32) &dataset) != _NO_ERROR) {
    return FALSE;
  }
  
  return TRUE;  
}
Пример #4
0
void Main_task(uint_32 initial_data)
{	
	int          ret = 0;
	_mqx_int     error_code, bytes;
	_mqx_uint    param;
	_mqx_uint	 sz;
	MQX_FILE_PTR com_handle, sdcard_handle, filesystem_handle, partman_handle;
	MQX_FILE_PTR cert_file = NULL;
	char         filesystem_name[] = "a:";
	char         partman_name[] = "pm:";
    const char*  fileName = "a:\certs\\client-key.der";
	    
    printf("Starting client example... \n"); 

    ret = sdcard_open(&com_handle, &sdcard_handle, &partman_handle,
			&filesystem_handle, partman_name, filesystem_name);
    
	if (ret != 0) {
		printf("error: sdcard_open(), ret = %d\n", ret);
		_mqx_exit(1);
	}
	printf("SD card installed to %s\n", filesystem_name);

	setup_ethernet();
	client_test();

	ret = sdcard_close(&sdcard_handle, &partman_handle, &filesystem_handle,
			partman_name, filesystem_name);

	if (ret != 0) {
		printf("error: sdcard_close(), ret = %d\n", ret);
		_mqx_exit(1);
	}
	printf("SD card uninstalled.\n");
   
   _mqx_exit(0);
}