Develop and Download Open Source Software

Browse CVS Repository

Contents of /enbanfukusyaya/EnbanKensa/common/option.c

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download) (as text)
Sun Dec 11 15:25:30 2005 UTC (18 years, 4 months ago) by bananajinn
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +95 -95 lines
File MIME type: text/x-csrc
*** empty log message ***

1 /**
2 * 円盤複写屋 - EnbanKensa
3 * Copyright (C) 2005 Kagetani Hideto
4 * option.c - オプション設定
5 * $Date: 2005/12/11 15:21:45 $
6 * $Revision: 1.2 $
7 */
8 #include <string.h>
9 #include <stdlib.h>
10 #include "option.h"
11 #include "ui.h"
12
13 static OPTIONS g_Option;
14
15 /**
16 * 読み取り速度配列を取得
17 * @param[in] drive 装置
18 * @param[out] param 装置パラメータ構造体
19 * @retval RET_OK 正常終了
20 */
21 static int GetReadableSpeed(CMDDRIVE *drive, DRVPARAMS *param)
22 {
23 BYTE speeds[] = { 1, 2, 4, 6, 8, 10, 12, 16, 20, 24, 32, 48, 52, 0xff };
24
25 param->read_speeds = (BYTE *)malloc(sizeof(speeds));
26 if(param->read_speeds == NULL){
27 param->num_read_speed = 0;
28 }
29 else{
30 param->num_read_speed = sizeof(speeds)/sizeof(BYTE);
31 memcpy(param->read_speeds, speeds, sizeof(speeds));
32 }
33
34 return RET_OK;
35 }
36
37 /**
38 * 装置のデフォルト読み取りリトライ回数を取得
39 * @param[in] drive 装置
40 * @note 取得できない場合は0とする。
41 * 結果は g_Option.default_read_retry に格納。
42 */
43 static void GetDefaultReadRetry(CMDDRIVE *drive)
44 {
45 int ret;
46 struct _MODEPAGE01 *mp01;
47
48 g_Option.default_read_retry = 0;
49 ret = SendModeSense(drive, MSPC_DEFAULT, 1);
50 if(ret != RET_OK){
51 return;
52 }
53 mp01 = (struct _MODEPAGE01 *)
54 (drive->data_buf + (drive->cmd_type==CMDDRVCTYPE_ATAPI ? 8 : 16));
55 g_Option.default_read_retry = mp01->rd_retry_count;
56 }
57
58
59 /**
60 * ダイアログを表示してオプション設定をユーザにしてもらう
61 * @param[in] drive 装置
62 * @param[in] num_track トラック数
63 */
64 int SetOption(CMDDRIVE *drive, WORD num_track)
65 {
66 int ret;
67 DRVPARAMS param;
68
69 memset(&g_Option, 0, sizeof(g_Option));
70 g_Option.flag |= OPFLG_RDRETRY;
71 if(num_track == 1){
72 /* 1track/1sessionの場合だけ、外周から測定を有効にする */
73 g_Option.flag |= OPFLG_OUT2IN;
74 }
75 memset(&param, 0, sizeof(param));
76
77 param.dvd = DT_DVD_FAMILY(drive->disc_type);
78 GetReadableSpeed(drive, &param);
79 GetDefaultReadRetry(drive);
80
81 ret = UISetting(&g_Option/*, &param*/);
82 free(param.read_speeds);
83
84 return ret;
85 }
86
87
88 /**
89 * オプション設定情報構造体を取得
90 * @return オプション設定情報構造体
91 */
92 OPTIONS *GetOption()
93 {
94 return &g_Option;
95 }

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26