• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ disk_initialize函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中disk_initialize函数的典型用法代码示例。如果您正苦于以下问题:C++ disk_initialize函数的具体用法?C++ disk_initialize怎么用?C++ disk_initialize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了disk_initialize函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: USBDMSCStorageOpen

//*****************************************************************************
//
// This function opens the drive number and prepares it for use by the Mass
// storage class device.
//
// /param ulDrive is the driver number to open.
//
// This function is used to initialize and open the physical drive number
// associated with the parameter /e ulDrive.  The function will return zero if
// the drive could not be opened for some reason.  In the case of removable
// device like an SD card this function should return zero if the SD card is
// not present.
//
// /return Returns a pointer to data that should be passed to other APIs or it
// will return 0 if no drive was found.
//
//*****************************************************************************
void *
USBDMSCStorageOpen(unsigned long ulDrive)
{
    unsigned char ucPower;
    unsigned long ulTemp;

    ASSERT(ulDrive == 0);

    //
    // Return if already in use.
    //
    if(g_sDriveInformation.ulFlags & SDCARD_IN_USE)
    {
        return(0);
    }

    //
    // Initialize the drive if it is present.
    //
    ulTemp = disk_initialize(0);

    if(ulTemp == RES_OK)
    {
        //
        // Power up the card.
        //
        ucPower = 1;
        disk_ioctl(0, CTRL_POWER, &ucPower);

        //
        // Card is present and in use.
        //
        g_sDriveInformation.ulFlags = SDCARD_PRESENT | SDCARD_IN_USE;
    }
    else if(ulTemp == STA_NODISK)
    {
        //
        // Allocate the card but it is not present.
        //
        g_sDriveInformation.ulFlags = SDCARD_IN_USE;
    }
    else
    {
        return(0);
    }

    return((void *)&g_sDriveInformation);
}
开发者ID:fejerson108,项目名称:Stellarisware,代码行数:65,代码来源:usbdsdcard.c


示例2: log_init

void log_init(void)
{
	disk_initialize(0);
	delay(1);
	int result = disk_initialize(0);
	if(result == 0)
	{
		f_mount(0, &FATFS_Obj);

		char filename[200];
		{
			int filecounter = 0;
			FILINFO filetest;
			sprintf(filename,"0:log%05u.txt",filecounter);
			while(f_stat(filename,&filetest) == FR_OK)
			{
				filecounter++;
				sprintf(filename,"0:log%05u.txt",filecounter);
			}
		}
		int result = f_open(&file, filename, FA_CREATE_NEW | FA_WRITE);
		if(result != 0)
		{
			led_fastBlink(LED_SDCARD);
			sd_card_available = 0;
			return;
		}
		result = f_sync(&file);
		if(result != 0)
		{
			led_fastBlink(LED_SDCARD);
			sd_card_available = 0;
			return;
		}
		result = f_lseek(&file, file.fsize);
		if(result != 0)
		{
			led_fastBlink(LED_SDCARD);
			sd_card_available = 0;
			return;
		}
		//usb_printfi_buffered("SD filename: %s\n",filename);
		led_on(LED_SDCARD);
		sd_card_available = 1;
		
	}
	{
		//usb_printf_buffered("NO SD");
	}
}
开发者ID:sebseb7,项目名称:Murdock-Firmware,代码行数:50,代码来源:log.c


示例3: sd_fs_init

void sd_fs_init(void)
{
    /* SD卡中断初始化 */
		SDIO_NVIC_Configuration();		
		/* SD 卡硬件初始化,初始化盘符为0 */	 
    disk_initialize( 0 );	         
}
开发者ID:matao1314,项目名称:STM32MEDIA,代码行数:7,代码来源:sd_fs_app.c


示例4: user_init

//Init function 
void ICACHE_FLASH_ATTR
user_init()
{
    disk_initialize(MMC);
    //Start os task
    system_os_task(user_procTask, user_procTaskPrio,user_procTaskQueue, user_procTaskQueueLen);
}
开发者ID:Duality4Y,项目名称:esp-projects,代码行数:8,代码来源:user_main.c


示例5: SDCARD_Initialization

/**************************************************************************//**
 * @brief
 *   SDCARD_Initialization.
 * @details
 *   Initialize SD Card
 *****************************************************************************/
void SDCARD_Initialization()
{
  /* Enable SPI */
  USART1->CMD = USART_CMD_MASTEREN | USART_CMD_TXEN | USART_CMD_RXEN;
  
  volatile int waiting;
  /* Initialize SD Card */
  while(1)
  {
    MICROSD_Init();                     /*Initialize MicroSD driver */
      USART1->CMD = USART_CMD_MASTEREN | USART_CMD_TXEN | USART_CMD_RXEN;

    resCard = disk_initialize(0);       /*Check micro-SD card status */
    
    switch(resCard)
    {
    case STA_NOINIT:                    /* Drive not initialized */
      break;
    case STA_NODISK:                    /* No medium in the drive */
      break;
    case STA_PROTECT:                   /* Write protected */
      break;
    default:
      break;
    }
   
    if (!resCard) break;                /* Drive initialized. */
 
    /* wait a moment */
    for(waiting = 0; waiting < 0xfff; waiting++){
      waiting++;
      waiting--;
    }
  }
}
开发者ID:Crob4,项目名称:HackaGecko,代码行数:41,代码来源:sdcard.c


示例6: main

/*******************************************************************************
*                                 Main Routine
*******************************************************************************/
int main (void)
{
    printf("\n\rInitializing SD Card...\r\n");
    /* Initialize SPI driver and SD Card */
    if(RES_OK != disk_initialize(SD))
    {
      printf("Failed to initialize SD disk\r\n");
      while(1);
    }
    if(FR_OK != fatdemo())
    {
      printf("FAT Demo failed\r\n");
      g_card_initialized = 0;
    }
    /* if the SD card is initialized, enable the USB MSD device */
    if(g_card_initialized)
    {
      usbd_init();

      usbd_connect(__TRUE);

      usb_state = USB_CONNECTING;
      
      while (!usbd_configured ());          /* Wait for device to configure */
    }
      
    EnableInterrupts;
    
    while(1) 
    {
      Delayms(500);
    }
		
}
开发者ID:Wangwenxue,项目名称:KL26_SDCard,代码行数:37,代码来源:main.c


示例7: SDCARD_Mount

BOOL SDCARD_Mount(void)
{
	if(fsMounted == FALSE)
	{
		if (!(disk_status(MMC_DRIVE) & STA_NODISK)) {
			// disk inserted so initialise it
			if (disk_initialize(MMC_DRIVE) == 0) {
				if (f_mount(MMC_DRIVE, &fatfs[MMC_DRIVE]) == FR_OK) {
					fsMounted = TRUE;
					return TRUE;
				}	
			}
			else
			{
				return FALSE;
			}
		}
		else
		{
			return FALSE;
		}
	}
	else
	{
		return TRUE;
	}
}
开发者ID:sidwarkd,项目名称:waterworx-device,代码行数:27,代码来源:sdcard.c


示例8: fatfs_init

void fatfs_init(unsigned char prio)
{
	FRESULT fret;
	
	raw_printf("FatFs init...\r\t\t\t\t");
	disk_initialize(0);
	fret = f_mount(&_FS, _T("0"), 0);
	if(FR_OK != fret)
	{
		RAW_ASSERT(0);
	}
	raw_printf("[OK]\n");
	
//	if( need_format(0) )
	if(1)
	{
		raw_printf("mkfs ...\r\t\t\t\t");
		fret = f_mkfs(_T("0:"), 0, 512);
		if(FR_OK != fret)
		{
			RAW_ASSERT(0);
		}
		raw_printf("[OK]\n");
	}
}
开发者ID:Niyunfeng,项目名称:stm32f429_discovery,代码行数:25,代码来源:fatfs_init.c


示例9: data_hub_init

void data_hub_init(){
  log_file_opened = FALSE;
  free_page = locked_page = payload_buf;
  log_block_size = PAGE_SIZE;

  disk_initialize(0);
}
开发者ID:ina111,项目名称:ninja-scan-light,代码行数:7,代码来源:data_hub.c


示例10: device_initialize

void device_initialize (void)
{
   /* call for each type of device */
  disk_initialize ();
  simpledisk_initialize ();
  mems_initialize ();
}
开发者ID:Devalay,项目名称:disksim-4-0-x64,代码行数:7,代码来源:disksim_device.c


示例11: deinitialize

/**
 ** FIXME - actual support for multiple volumes
 **/
bool CFile::initialize(int volume)
{
    volatile uint8_t err=0;
    mInitialized=false;
    do {
        deinitialize(volume);
        if ( (mFileSystem = (FATFS*)malloc(sizeof(FATFS))) )
        {
            memset(mFileSystem,0,sizeof(FATFS));
            if ( ( err = disk_initialize(volume) ) == FR_OK )
            {
                if ( ( err = disk_status(volume) ) == FR_OK )
                {
                    if ( ( err = f_mount(mFileSystem,"",0) ) == FR_OK )
                    {
                        mInitialized=true;
                    }
                }
            }
            if ( !initialized() )
            {
                free(mFileSystem);
                mFileSystem=NULL;
                disk_init_fail(err);
            }
        }
    } while ( err );
    disk_init_fail(0); // clear the status/diag LEDs
    return mInitialized;
}
开发者ID:8bitgeek,项目名称:caribou-rtos,代码行数:33,代码来源:cfile.cpp


示例12: connect

bool USBMSD::connect() {

    //disk initialization
    if (disk_status() & NO_INIT) {
        if (disk_initialize()) {
            return false;
        }
    }

    // get number of blocks
    BlockCount = disk_sectors();

    // get memory size
    MemorySize = disk_size();

    if (BlockCount > 0) {
        BlockSize = MemorySize / BlockCount;
        if (BlockSize != 0) {
            page = (uint8_t *)malloc(BlockSize * sizeof(uint8_t));
            if (page == NULL)
                return false;
        }
    } else {
        return false;
    }

    //connect the device
    USBDevice::connect();
    return true;
}
开发者ID:balazsracz,项目名称:libmbed_2387,代码行数:30,代码来源:USBMSD.cpp


示例13: InitStorage

/** Инициализация хранилища */
bool InitStorage(void)
{
	FRESULT result;
	StorageInit = 0;
	printf("Initialazing storage...");
	WORD status = (WORD)disk_initialize(0);
	if (status) {
		if (status == STA_NODISK) {
			print("no disk\n\r");
		}
		if (status == STA_NOINIT) {
			print("interal error\n\r");
		}
		if (status == STA_PROTECT) {
			print("write protect\n\r");
		}

		return false;
	}

	result = f_mount(0, &_FatFs);
	if (result != FR_OK) {
		print("Unable to mount fs\n\r");
		return false;
	}

	StorageInit = 1;
	print("done\n\r");
	return true;
}
开发者ID:0xE0F,项目名称:ir-system,代码行数:31,代码来源:Storage.c


示例14: file_init

void file_init() {
  // Set up the SD card SS pin.  Set it to off before setting it as an output,
  // in case it briefly gets turned on.
  spi_clear_ss(SELECT_SD_BIT);
  DDRC |= (1 << SELECT_SD_BIT);

  // Clear the file handle states.
  for (int i = 0; i < MAX_NUM_FILE_HANDLES; ++i)
    file_handle_active[i] = false;

  // Initialize the SD card file system.
  int status = disk_initialize(0);
#ifdef DEBUG
  if (status != RES_OK) {
    fprintf_P(stderr, file_init_str0, status);
    return;
  }
#endif  // defined(DEBUG)

  status = f_mount(0, &fatfs);
#ifdef DEBUG
  if (status != FR_OK) {
    fprintf_P(stderr, file_init_str1, status);
  }
#endif  // defined(DEBUG)
}
开发者ID:eecsninja,项目名称:duinocube,代码行数:26,代码来源:file.cpp


示例15: OTPWriter_Init

void OTPWriter_Init(void)
{
	u16 res;

#ifndef OTPWriter_IAP
	HS_PacketInfo PacketInfo;
#endif
	delay_init(72);
	//NVIC_Configuration();
	USB_Disconnect_Config();	  //USB软连接断开控制引脚
	//Console_init();
#ifdef OTPWriter_IAP
    u8 key = 0;
	printf("%s\r\n", SysInfo_OTPWriter_IAP);

	key = g_KEY.IsReleased();

	if(key==1)
	{
		MSD0_SPI_Configuration();
		//挂载文件系统
		disk_initialize(0);
		res = f_mount(0,&fs);
		if(res != FR_OK){
			printf("mount filesystem 0 failed : %d\r\n",res);
		}

		OTPWriter_IAP_from_SD();
		Execute_New_program();
	}
	else
		Execute_New_program();

#else		 //#ifdef OTPWriter_IAP
	printf("%s\r\n", SysInfo_OTPWriter);
	usb_init();
	//OTP_SPI_Init();
	MSD0_SPI_Configuration();
	//挂载文件系统
	disk_initialize(0);
	res = f_mount(0,&fs);
	if(res != FR_OK){
		printf("mount filesystem 0 failed : %d\r\n",res);
	}
	LED_Light(5);
#endif
}
开发者ID:houguozhi,项目名称:HS6206_CP_GS_MCU_FM,代码行数:47,代码来源:OTPWriter_main.c


示例16: OutPutFile

void OutPutFile(void)
{
  FRESULT res;
  FILINFO finfo;
  DIR dirs;
  int i;
  char *fn;
  char path[50]={""};  
  char name[]={"WVO.TXT"};
    
  printf("\n file system starting! \n");
  
  disk_initialize(0);
    
  f_mount(0, &fs);
/* 
  res = f_opendir(&dir, path);
  if (res == FR_OK) 
  {
    i = strlen(path);
    for (;;) 
    {
      res = f_readdir(&dir, &fno);
      if (res != FR_OK || fno.fname[0] == 0) break;
      fn = fno.fname;
      if (fno.fattrib & AM_DIR) 
      {
        sprintf(&path[i], "/%s", fn);
        res = scan_files(path);
        if (res != FR_OK) break;
        path[i] = 0;
      } 
      else 
      {
        printf("%s/%s\n\n", path, fn);
      }
    }
  }
*/  
 if (f_opendir(&dirs, path) == FR_OK) 
  {
    while (f_readdir(&dirs, &finfo) == FR_OK)  
    {
      if (finfo.fattrib & AM_ARC) 
      {
        if(!finfo.fname[0])	
          break;         
        printf("\n file name is:\n   %s\n",finfo.fname);
        res = f_open(&fsrc, finfo.fname, FA_OPEN_EXISTING | FA_READ);
        res = f_read(&fsrc, &buffer, 50, &br);
        printf("\n file contex is:\n   %s\n",buffer);
        f_close(&fsrc);			                      
      }
    } 
    
  }
  
  while(1);
}
开发者ID:a-c-t-i-n-i-u-m,项目名称:HY-STM32F103,代码行数:59,代码来源:main1.c


示例17: DiskOpen

/** @brief Initialize a disk.

    @param bVolNum  The volume number of the volume whose block device is being
                    initialized.
    @param mode     The open mode, indicating the type of access required.

    @return A negated ::REDSTATUS code indicating the operation result.

    @retval 0           Operation was successful.
    @retval -RED_EIO    A disk I/O error occurred.
*/
static REDSTATUS DiskOpen(
    uint8_t         bVolNum,
    BDEVOPENMODE    mode)
{
    DSTATUS         status;
    uint32_t        ulTries;
    REDSTATUS       ret = 0;

    /*  With some implementations of disk_initialize(), such as the one
        implemented by Atmel for the ASF, the first time the disk is opened, the
        SD card can take a while to get ready, in which time disk_initialize()
        returns an error.  Try numerous times, waiting half a second after each
        failure.  Empirically, this has been observed to succeed on the second
        try, so trying 10x more than that provides a margin of error.
    */
    for(ulTries = 0U; ulTries < 20U; ulTries++) {
        /*  Assuming that the volume number is also the correct drive number.
            If this is not the case in your environment, a static constant array
            can be declared to map volume numbers to the correct driver number.
        */
        status = disk_initialize(bVolNum);
        if(status == 0) {
            break;
        }

        vTaskDelay(500U / portTICK_PERIOD_MS);
    }

    if(status != 0) {
        ret = -RED_EIO;
    }

    /*  Retrieve the sector size and sector count to ensure they are compatible
        with our compile-time geometry.
    */
    if(ret == 0) {
        WORD    wSectorSize;
        DWORD   dwSectorCount;
        DRESULT result;

        result = disk_ioctl(bVolNum, GET_SECTOR_SIZE, &wSectorSize);
        if(result == RES_OK) {
            result = disk_ioctl(bVolNum, GET_SECTOR_COUNT, &dwSectorCount);
            if(result == RES_OK) {
                if(    (wSectorSize != gaRedVolConf[bVolNum].ulSectorSize)
                        || (dwSectorCount < gaRedVolConf[bVolNum].ullSectorCount)) {
                    ret = -RED_EINVAL;
                }
            } else {
                ret = -RED_EIO;
            }
        } else {
            ret = -RED_EIO;
        }
    }

    return ret;
}
开发者ID:peterliu2,项目名称:FreeRTOS,代码行数:69,代码来源:osbdev.c


示例18: diskMount

/**
 *	Mount the SD module. Internal static funtcion not to call from main 
 *	application.
 *
 *	\return TRUE - the initialization succeded
 *	\return FALSE - the initialization doesn't succeded (SD card not inserted?)
 */
static BOOL diskMount()
{	
	if ( f_mount(0, &Fatfs) == FR_OK)
	{
		disk_initialize(0);
		return TRUE;
	}
	else
		return FALSE;
}
开发者ID:classevirtuale2014,项目名称:openpicus-software,代码行数:17,代码来源:sd_manager.c


示例19: main

int main (void)
{
	clunet_init();  
	clunet_set_on_data_received(data_received);	
	time_init();
	sei();
	//eeprom_write_dword((void*)0, 0);
	record_num = eeprom_read_dword((void*)0); // Читаем кол-во записей
	mode_current = eeprom_read_byte((void*)4); // Режим 
	mode_temp = eeprom_read_byte((void*)5); // Временный режим

	disk_initialize(0);	

	unset_bit(DDRA, 3); set_bit(PORTA, 3);	 // Определение сигнала в линии	
	//unset_bit(DDRA, 4);	unset_bit(PORTA, 4); // Открывалка двери, напрямую
	set_bit(DDRA, 4);	unset_bit(PORTA, 4); // Открывалка двери, через реле
	set_bit(DDRA, 5); HANGUP; // Реле снимания трубки
	set_bit(DDRA, 6); MODE_NORMAL; // Реле выбора режима
	unset_bit(DDRG, 0); set_bit(PORTG, 0); // Определение, лежит ли трубка	
	set_bit(DDRD, 6); set_bit(DDRD, 7); // Светодиоды
	unset_bit(DDRA, 7); set_bit(PORTA, 7); // Счётчик оборотов диска

	unset_bit(DDRF, 0); // ADC+
	unset_bit(PORTF, 0);
	unset_bit(DDRF, 1); // ADC-
	unset_bit(PORTF, 1);

	beep(500, 200);
	beep(1500, 200);
	beep(3000, 200);
	_delay_ms(1000);
	if (play_wav_pgm(STARTED_WAV) == 0)
	{
		LED_GREEN_ON;
		while (sound_read() >= 0) ;
		LED_GREEN_OFF;
		sound_stop();
	} else {
		LED_RED_ON;
		beep(3000, 200);
		beep(1500, 200);
		beep(500, 200);
		LED_RED_OFF;
	}
	
	send_current_mode(CLUNET_BROADCAST_ADDRESS);

	while(1)
	{
		if (is_LINE_POWER()) incoming_ring();
		if (OFFHOOK) control_mode();
		transfer_data(); // Передаём данные на досуге.
	}
}
开发者ID:ClusterM,项目名称:intercom,代码行数:54,代码来源:intercom.c


示例20: number

DSTATUS PFFS::disk_init (
	void //unsigned char drv	/* Physical drive number (0) */
)
{
	DSTATUS res;

	SPI_SET_DIVIDER(_clkdivider);
	res = disk_initialize();
	SPI_SET_DIVIDER(_clkdivider);
	
	return res;
}
开发者ID:fmilburn3,项目名称:PFatFs,代码行数:12,代码来源:pfatfs.cpp



注:本文中的disk_initialize函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ disk_read函数代码示例发布时间:2022-05-30
下一篇:
C++ discrete_sound_w函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap