提交 7a31ab91 编写于 作者: S sion 提交者: mysterywolf

[bsp]Fix Chinese coding errors in annotations.

上级 d7ef1d1b
...@@ -34,12 +34,12 @@ extern "C" { ...@@ -34,12 +34,12 @@ extern "C" {
typedef enum typedef enum
{ {
OTP_Complete = 0, OTP_Complete = 0,
OTP_ReadOnProgramOrSleep, //�ڱ�̡�����״̬�¶�OTP���ж����� OTP_ReadOnProgramOrSleep, //在编程或休眠状态下读取OTP数据
OTP_ProgramIn_HiddenOrRO_Block, //��ֻ�������б�� OTP_ProgramIn_HiddenOrRO_Block, //在只读或隐藏块中编程
OTP_ProgramOutOfAddr, //��̷�Χ����OTP��Χ OTP_ProgramOutOfAddr, //超出OTP地址范围
OTP_ProgramOnSleep, //������״̬���б�̲��� OTP_ProgramOnSleep, //在睡眠状态下编程
OTP_WakeUpOnNoSleep, //�ڷ�����״̬�½��л��Ѳ��� OTP_WakeUpOnNoSleep, //在非睡眠状态下从唤醒
OTP_TimeOut, //OTP��ɱ�־λ��ʱû����λ OTP_TimeOut, //OTP写入超时
OTP_DataWrong, OTP_DataWrong,
}OTP_StatusTypeDef; }OTP_StatusTypeDef;
......
...@@ -65,14 +65,14 @@ typedef struct ...@@ -65,14 +65,14 @@ typedef struct
#define SENSOR_Port_S67 (SENSOR_Port_S6 | SENSOR_Port_S7) #define SENSOR_Port_S67 (SENSOR_Port_S6 | SENSOR_Port_S7)
#define IS_SENSOR_PORT(PORT) ((((PORT) & (uint32_t)0xFFFFFF00) == 0x00) && ((PORT) != (uint32_t)0x00)) #define IS_SENSOR_PORT(PORT) ((((PORT) & (uint32_t)0xFFFFFF00) == 0x00) && ((PORT) != (uint32_t)0x00))
/* �ⲿ��̬��������������Ƶ�� */ /* 外部静态检测频率 */
#define SENSOR_PUPU_Frequency_Default ((uint32_t)0x0000) #define SENSOR_PUPU_Frequency_Default ((uint32_t)0x0000)
#define SENSOR_PUPU_Frequency_500ms ((uint32_t)0x0000) #define SENSOR_PUPU_Frequency_500ms ((uint32_t)0x0000)
#define SENSOR_PUPU_Frequency_1s ((uint32_t)0x0001) #define SENSOR_PUPU_Frequency_1s ((uint32_t)0x0001)
#define IS_SENSOR_EXT_PUPU_FREQ(FREQ) ((FREQ) == SENSOR_PUPU_Frequency_500ms ||\ #define IS_SENSOR_EXT_PUPU_FREQ(FREQ) ((FREQ) == SENSOR_PUPU_Frequency_500ms ||\
(FREQ) == SENSOR_PUPU_Frequency_1s) (FREQ) == SENSOR_PUPU_Frequency_1s)
/* �ⲿ��̬�������������� */ /* 外部静态采样个数 */
#define SENSOR_STATIC_SAMPLE_Default ((uint32_t)0x0001) #define SENSOR_STATIC_SAMPLE_Default ((uint32_t)0x0001)
#define SENSOR_STATIC_SAMPLE_1 ((uint32_t)0x0000) #define SENSOR_STATIC_SAMPLE_1 ((uint32_t)0x0000)
#define SENSOR_STATIC_SAMPLE_2 ((uint32_t)0x0001) #define SENSOR_STATIC_SAMPLE_2 ((uint32_t)0x0001)
...@@ -81,7 +81,7 @@ typedef struct ...@@ -81,7 +81,7 @@ typedef struct
#define IS_SENSOR_EXT_STATIC_SAMPLE(COUNT) ((COUNT) >= SENSOR_STATIC_SAMPLE_1 &&\ #define IS_SENSOR_EXT_STATIC_SAMPLE(COUNT) ((COUNT) >= SENSOR_STATIC_SAMPLE_1 &&\
(COUNT) <= SENSOR_STATIC_SAMPLE_4) (COUNT) <= SENSOR_STATIC_SAMPLE_4)
/* �ⲿ��̬�������������� */ /* 外部动态采样个数 */
#define SENSOR_DYNAMIC_SAMPLE_Default ((uint32_t)0x0002) #define SENSOR_DYNAMIC_SAMPLE_Default ((uint32_t)0x0002)
#define SENSOR_DYNAMIC_SAMPLE_1 ((uint32_t)0x0000) #define SENSOR_DYNAMIC_SAMPLE_1 ((uint32_t)0x0000)
#define SENSOR_DYNAMIC_SAMPLE_2 ((uint32_t)0x0001) #define SENSOR_DYNAMIC_SAMPLE_2 ((uint32_t)0x0001)
...@@ -91,7 +91,7 @@ typedef struct ...@@ -91,7 +91,7 @@ typedef struct
(COUNT) <= SENSOR_DYNAMIC_SAMPLE_4) (COUNT) <= SENSOR_DYNAMIC_SAMPLE_4)
/* �ⲿ��̬�����������������裬������Чʱ�� */ /* 外部动态采样保持时间,单位为标准时钟周期 */
#define SENSOR_PUPU_HoldTime_Default ((uint32_t)0x0002) #define SENSOR_PUPU_HoldTime_Default ((uint32_t)0x0002)
#define SENSOR_PUPU_HoldTime_1_2 ((uint32_t)0x0000) #define SENSOR_PUPU_HoldTime_1_2 ((uint32_t)0x0000)
#define SENSOR_PUPU_HoldTime_1_4 ((uint32_t)0x0001) #define SENSOR_PUPU_HoldTime_1_4 ((uint32_t)0x0001)
...@@ -102,7 +102,7 @@ typedef struct ...@@ -102,7 +102,7 @@ typedef struct
(TIME) == SENSOR_PUPU_HoldTime_1_8 ||\ (TIME) == SENSOR_PUPU_HoldTime_1_8 ||\
(TIME) == SENSOR_PUPU_HoldTime_1_16) (TIME) == SENSOR_PUPU_HoldTime_1_16)
/* ��̬���������Ƶ�� */ /* 动态检测频率 */
#define SENSOR_DynamicFrequency_Default ((uint32_t)0x0003) #define SENSOR_DynamicFrequency_Default ((uint32_t)0x0003)
#define SENSOR_DynamicFrequency_31_25ms ((uint32_t)0x0000) #define SENSOR_DynamicFrequency_31_25ms ((uint32_t)0x0000)
#define SENSOR_DynamicFrequency_125ms ((uint32_t)0x0001) #define SENSOR_DynamicFrequency_125ms ((uint32_t)0x0001)
......
...@@ -31,21 +31,20 @@ ...@@ -31,21 +31,20 @@
/* Includes ------------------------------------------------------------------*/ /* Includes ------------------------------------------------------------------*/
#include "air105.h" #include "air105.h"
#define SSC_ITSysXTAL12M BIT(18) //系统12M时钟源标志
#define SSC_ITSysXTAL12M BIT(18) //ϵͳ��12Mʱ�ӱ�־ #define SSC_ITSysGlitch BIT(17) //供源噪声标志
#define SSC_ITSysGlitch BIT(17) //����Դë�̱�־ #define SSC_ITSysVolHigh BIT(16) //供源电压高标志
#define SSC_ITSysVolHigh BIT(16) //����Դ��ѹ��־ #define SSC_ITSysVolLow BIT(15) //供源电压低标志
#define SSC_ITSysVolLow BIT(15) //����ԴǷѹ��־
typedef struct typedef struct
{ {
FunctionalState ParityCheck; //��żУ��ʹ�� FunctionalState ParityCheck; //偶校验使用
}SSC_InitTypeDef; }SSC_InitTypeDef;
/* /*
* ��BPK��Ϊ4��ÿ��256����Ϊ��λ���ö�дȨ�� * 以BPK为4,每256为一单元格编号,用于多单元格写入
* SSC_BPKAccessCtrBlock_0Ϊ��ʼ0��ַ�� * SSC_BPKAccessCtrBlock_0为初始0地址。
*/ */
#define SSC_BPKAccessCtrBlock_0 (0x01) #define SSC_BPKAccessCtrBlock_0 (0x01)
#define SSC_BPKAccessCtrBlock_1 (0x02) #define SSC_BPKAccessCtrBlock_1 (0x02)
...@@ -53,9 +52,9 @@ typedef struct ...@@ -53,9 +52,9 @@ typedef struct
typedef enum typedef enum
{ {
SSC_BPKReadOnly = 0x01, //BPK��ֻ�� SSC_BPKReadOnly = 0x01, //BPK只读
SSC_BPKWriteOnly = 0x02, //BPK��ֻд SSC_BPKWriteOnly = 0x02, //BPK只写
SSC_BPKReadWrite = 0x03 //BPK���д SSC_BPKReadWrite = 0x03 //BPK读写
}SSC_BPKAccessCtrlTypeDef; }SSC_BPKAccessCtrlTypeDef;
#define IS_BPK_ACCESS_CTRL(CTRL) (((CTRL) == SSC_BPKReadOnly) || ((CTRL) == SSC_BPKWriteOnly) || \ #define IS_BPK_ACCESS_CTRL(CTRL) (((CTRL) == SSC_BPKReadOnly) || ((CTRL) == SSC_BPKWriteOnly) || \
((CTRL) == SSC_BPKReadWrite)) ((CTRL) == SSC_BPKReadWrite))
...@@ -76,7 +75,7 @@ typedef enum ...@@ -76,7 +75,7 @@ typedef enum
/** /**
* @method SSC_Init * @method SSC_Init
* @brief SSC��ȫ���Գ�ʼ�� * @brief SSC全局初始化函数
* @param SSC_InitTypeDef SSC_InitStruct * @param SSC_InitTypeDef SSC_InitStruct
* @retval void * @retval void
*/ */
...@@ -85,7 +84,7 @@ void SSC_Init(SSC_InitTypeDef *SSC_InitStruct); ...@@ -85,7 +84,7 @@ void SSC_Init(SSC_InitTypeDef *SSC_InitStruct);
/** /**
* @method SSC_GetITStatus * @method SSC_GetITStatus
* @brief SSC��ȫ�ж�״̬ * @brief SSC全局状态判断函数
* @param uint32_t SSC_IT * @param uint32_t SSC_IT
* @retval ITStatus * @retval ITStatus
*/ */
...@@ -94,7 +93,7 @@ ITStatus SSC_GetITStatus(uint32_t SSC_IT); ...@@ -94,7 +93,7 @@ ITStatus SSC_GetITStatus(uint32_t SSC_IT);
/** /**
* @method SSC_ClearITPendingBit * @method SSC_ClearITPendingBit
* @brief SSC��ȫ�ж���� * @brief SSC清除全局中断状态函数
* @param uint32_t SSC_IT * @param uint32_t SSC_IT
* @retval void * @retval void
*/ */
...@@ -103,7 +102,7 @@ void SSC_ClearITPendingBit( uint32_t SSC_IT); ...@@ -103,7 +102,7 @@ void SSC_ClearITPendingBit( uint32_t SSC_IT);
/** /**
* @method SSC_SetDataRAMScrambler * @method SSC_SetDataRAMScrambler
* @brief ��������RAM���� * @brief 设置数据RAM扰码
* @param uint32_t Scrambler * @param uint32_t Scrambler
* @retval void * @retval void
*/ */
...@@ -112,7 +111,7 @@ void SSC_SetDataRAMScrambler(uint32_t Scrambler); ...@@ -112,7 +111,7 @@ void SSC_SetDataRAMScrambler(uint32_t Scrambler);
/** /**
* @method SSC_BPKAccessCtrConfig * @method SSC_BPKAccessCtrConfig
* @brief ����BPK����Ȩ�� * @brief 配置BPK访问权限
* @param uint32_t SSC_BPKAccessCtrBlock * @param uint32_t SSC_BPKAccessCtrBlock
* @param SSC_BPKAccessCtrlTypeDef SSC_BPKAccessCtr * @param SSC_BPKAccessCtrlTypeDef SSC_BPKAccessCtr
* @retval void * @retval void
...@@ -122,7 +121,7 @@ void SSC_BPKAccessCtrlConfig(uint32_t SSC_BPKAccessCtrBlock, SSC_BPKAccessCtrlTy ...@@ -122,7 +121,7 @@ void SSC_BPKAccessCtrlConfig(uint32_t SSC_BPKAccessCtrBlock, SSC_BPKAccessCtrlTy
/** /**
* @method SSC_SENSOR_Enable * @method SSC_SENSOR_Enable
* @brief ����ϵͳSensor * @brief 使能系统Sensor
* @param SSC_SENSOR * @param SSC_SENSOR
* @retval * @retval
*/ */
...@@ -131,7 +130,7 @@ uint32_t SSC_SENSORCmd(uint32_t SSC_SENSOR, FunctionalState NewState); ...@@ -131,7 +130,7 @@ uint32_t SSC_SENSORCmd(uint32_t SSC_SENSOR, FunctionalState NewState);
/** /**
* @method SSC_SENSORLock * @method SSC_SENSORLock
* @brief ����ϵͳSensor����״̬ * @brief 锁定系统Sensor状态
* @param SSC_SENSOR * @param SSC_SENSOR
* @retval * @retval
*/ */
...@@ -140,7 +139,7 @@ void SSC_SENSORLock(uint32_t SSC_SENSOR); ...@@ -140,7 +139,7 @@ void SSC_SENSORLock(uint32_t SSC_SENSOR);
/** /**
* @method SSC_SENSOR_AttackRespMode * @method SSC_SENSOR_AttackRespMode
* @brief ϵͳSensor��Ӧ��ʽ * @brief 系统Sensor响应模式
* @param SSC_SENSOR_RespMode * @param SSC_SENSOR_RespMode
* @retval * @retval
*/ */
......
...@@ -116,7 +116,7 @@ ITStatus TRNG_GetITStatus(uint32_t TRNG_IT) ...@@ -116,7 +116,7 @@ ITStatus TRNG_GetITStatus(uint32_t TRNG_IT)
} }
/** /**
* @brief ����жϱ�־λ * @brief 设置TRNG中断标志位
* @param TRNG_IT: * @param TRNG_IT:
* TRNG_IT_RNG0_S128 * TRNG_IT_RNG0_S128
* TRNG_IT_RNG1_S128 * TRNG_IT_RNG1_S128
......
...@@ -147,19 +147,19 @@ typedef enum { ...@@ -147,19 +147,19 @@ typedef enum {
G2D_SEQ_NORMAL = 0x0, G2D_SEQ_NORMAL = 0x0,
/* for interleaved yuv422 */ /* for interleaved yuv422 */
G2D_SEQ_VYUY = 0x1, /* pixel 0�ڵ�16λ */ G2D_SEQ_VYUY = 0x1, /* pixel 0在16位 */
G2D_SEQ_YVYU = 0x2, /* pixel 1�ڵ�16λ */ G2D_SEQ_YVYU = 0x2, /* pixel 1在16位 */
/* for uv_combined yuv420 */ /* for uv_combined yuv420 */
G2D_SEQ_VUVU = 0x3, G2D_SEQ_VUVU = 0x3,
/* for 16bpp rgb */ /* for 16bpp rgb */
G2D_SEQ_P10 = 0x4, /* pixel 0�ڵ�16λ */ G2D_SEQ_P10 = 0x4, /* pixel 0在16位 */
G2D_SEQ_P01 = 0x5, /* pixel 1�ڵ�16λ */ G2D_SEQ_P01 = 0x5, /* pixel 1在16位 */
/* planar format or 8bpp rgb */ /* planar format or 8bpp rgb */
G2D_SEQ_P3210 = 0x6, /* pixel 0�ڵ�8λ */ G2D_SEQ_P3210 = 0x6, /* pixel 0在8位 */
G2D_SEQ_P0123 = 0x7, /* pixel 3�ڵ�8λ */ G2D_SEQ_P0123 = 0x7, /* pixel 3在8位 */
/* for 4bpp rgb */ /* for 4bpp rgb */
G2D_SEQ_P76543210 = 0x8, /* 7,6,5,4,3,2,1,0 */ G2D_SEQ_P76543210 = 0x8, /* 7,6,5,4,3,2,1,0 */
......
...@@ -300,7 +300,7 @@ __s32 g2d_vsu_para_set(struct scaler_submodule *p_scal, __u32 fmt, __u32 in_w, ...@@ -300,7 +300,7 @@ __s32 g2d_vsu_para_set(struct scaler_submodule *p_scal, __u32 fmt, __u32 in_w,
temp = in_w << VSU_PHASE_FRAC_BITWIDTH; temp = in_w << VSU_PHASE_FRAC_BITWIDTH;
if (out_w) if (out_w)
//do_div(temp, out_w);/////////////tempǽ // do_div(temp, out_w); /////////// temp是被除数
temp = temp/out_w; temp = temp/out_w;
else else
temp = 0; temp = 0;
......
...@@ -39,7 +39,7 @@ static inline void put_be32(__u8 *buf, __u32 val) ...@@ -39,7 +39,7 @@ static inline void put_be32(__u8 *buf, __u32 val)
buf[3] = (__u8)val; buf[3] = (__u8)val;
} }
/* ȡ����ֵ */ /* 取绝对值 */
#undef absolute #undef absolute
#define absolute(p) ((p) > 0 ? (p) : -(p)) #define absolute(p) ((p) > 0 ? (p) : -(p))
......
...@@ -33,13 +33,13 @@ ...@@ -33,13 +33,13 @@
* mscUrbCallBack * mscUrbCallBack
* *
* Description: * Description:
* urb call back���� * urb call back函数
* *
* Parameters: * Parameters:
* urb : input. ��Ҫ������URB * urb : input. 需要提交的URB
* *
* Return value: * Return value:
* �� *
* *
* note: * note:
* *
...@@ -113,14 +113,14 @@ static void mscTimeOut(void *parg) ...@@ -113,14 +113,14 @@ static void mscTimeOut(void *parg)
* mscUsbTransport * mscUsbTransport
* *
* Description: * Description:
* ����URB * 发送URB
* *
* Parameters: * Parameters:
* mscDev : input. Ŀ���豸 * mscDev : input. 目标设备
* TimeOut : input. ��ʱʱ�� * TimeOut : input. 超时时间
* *
* Return value: * Return value:
* ����URB��״̬ * 返回URB状态
* *
* note: * note:
* *
...@@ -149,14 +149,15 @@ static int mscUsbTransport(__mscDev_t *mscDev, unsigned int TimeOut) ...@@ -149,14 +149,15 @@ static int mscUsbTransport(__mscDev_t *mscDev, unsigned int TimeOut)
mscDev->CurrentUrb->actual_length = 0; mscDev->CurrentUrb->actual_length = 0;
mscDev->CurrentUrb->error_count = 0; mscDev->CurrentUrb->error_count = 0;
mscDev->CurrentUrb->status = 0; mscDev->CurrentUrb->status = 0;
/* ����buffer���䷽ʽ, �������msc��buff, �Ͳ���ʹ��DMA�� ��Ϊbuffer, Ҫpalloc������ */ /* 设置buffer传输方式, 如果使用msc的buff,则不使用DMA,需要palloc分配内存 */
mscDev->CurrentUrb->transfer_flags = URB_ASYNC_UNLINK; mscDev->CurrentUrb->transfer_flags = URB_ASYNC_UNLINK;
// mscDev->CurrentUrb->transfer_flags = URB_ASYNC_UNLINK | URB_NO_SETUP_DMA_MAP; // mscDev->CurrentUrb->transfer_flags = URB_ASYNC_UNLINK | URB_NO_SETUP_DMA_MAP;
// if (mscDev->CurrentUrb->transfer_buffer == mscDev->iobuf)
// {
// mscDev->CurrentUrb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
// }
// if (mscDev->CurrentUrb->transfer_buffer == mscDev->iobuf)
// {
// mscDev->CurrentUrb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
// }
mscDev->CurrentUrb->transfer_dma = 0; mscDev->CurrentUrb->transfer_dma = 0;
mscDev->CurrentUrb->setup_dma = 0; mscDev->CurrentUrb->setup_dma = 0;
...@@ -220,21 +221,21 @@ static int mscUsbTransport(__mscDev_t *mscDev, unsigned int TimeOut) ...@@ -220,21 +221,21 @@ static int mscUsbTransport(__mscDev_t *mscDev, unsigned int TimeOut)
* mscCtrlMsg * mscCtrlMsg
* *
* Description: * Description:
* ���Ϳ������� * USB控制消息函数
* *
* Parameters: * Parameters:
* mscDev : input. Ŀ���豸 * mscDev : input. 目标设备
* Pipe : input. URB�ܵ� * Pipe : input. URB通道
* Request : input. �������� * Request : input. 请求类型
* RequestType : input. ������������ * RequestType : input. 请求方向(读/写)和请求类型
* Value : input. ֵ * Value : input.
* Index : input. ���� * Index : input. 索引
* Buffer : input. ������ * Buffer : input. 输入/输出缓存区
* BufferLen : input. ��������С * BufferLen : input. 输入/输出缓存区大小
* TimeOut : input. URB��ʱʱ�� * TimeOut : input. URB超时时间
* *
* Return value: * Return value:
* ����URB��״̬ * 返回URB状态
* *
* note: * note:
* *
...@@ -257,13 +258,13 @@ static int mscSendCtrlReq(__mscDev_t *mscDev, ...@@ -257,13 +258,13 @@ static int mscSendCtrlReq(__mscDev_t *mscDev,
return USB_ERR_BAD_ARGUMENTS; return USB_ERR_BAD_ARGUMENTS;
} }
/* ���ctrl���� */ /* 填充控制请求结构体 */
mscDev->CtrlReq->bRequest = Request; mscDev->CtrlReq->bRequest = Request; // 请求类型
mscDev->CtrlReq->bRequestType = RequestType; mscDev->CtrlReq->bRequestType = RequestType; // 请求方向(读/写)和请求类型
mscDev->CtrlReq->wValue = cpu_to_le16(Value); mscDev->CtrlReq->wValue = cpu_to_le16(Value); // 值, 使用小端字节序
mscDev->CtrlReq->wIndex = cpu_to_le16(Index); mscDev->CtrlReq->wIndex = cpu_to_le16(Index); // 索引, 使用小端字节序
mscDev->CtrlReq->wLength = cpu_to_le16(BufferLen); mscDev->CtrlReq->wLength = cpu_to_le16(BufferLen); // 缓冲区大小, 使用小端字节序
/* fill and submit the Urb */ /* 填充并提交Urb */
memset(mscDev->CurrentUrb, 0x00, sizeof(struct urb)); memset(mscDev->CurrentUrb, 0x00, sizeof(struct urb));
usb_fill_control_urb(mscDev->CurrentUrb, usb_fill_control_urb(mscDev->CurrentUrb,
mscDev->pusb_dev, mscDev->pusb_dev,
...@@ -273,7 +274,7 @@ static int mscSendCtrlReq(__mscDev_t *mscDev, ...@@ -273,7 +274,7 @@ static int mscSendCtrlReq(__mscDev_t *mscDev,
BufferLen, BufferLen,
mscUrbCallBack, mscUrbCallBack,
NULL); NULL);
/* transport */ /* 发送请求并等待响应 */
return mscUsbTransport(mscDev, TimeOut); return mscUsbTransport(mscDev, TimeOut);
} }
...@@ -282,14 +283,14 @@ static int mscSendCtrlReq(__mscDev_t *mscDev, ...@@ -282,14 +283,14 @@ static int mscSendCtrlReq(__mscDev_t *mscDev,
* mscClearHalt * mscClearHalt
* *
* Description: * Description:
* ���ep����״̬ * 清除端点状态
* *
* Parameters: * Parameters:
* mscDev : input. Ŀ���豸 * mscDev : input. 目标设备
* Pipe : input. urb��pipe * Pipe : input. urbpipe
* *
* Return value: * Return value:
* ����URB��ִ�н�� * 返回URB执行结果
* *
* note: * note:
* *
...@@ -339,17 +340,17 @@ static int mscClearHalt(__mscDev_t *mscDev, unsigned int Pipe) ...@@ -339,17 +340,17 @@ static int mscClearHalt(__mscDev_t *mscDev, unsigned int Pipe)
* AnalyseBlukUrbState * AnalyseBlukUrbState
* *
* Description: * Description:
* ����Bulk Urb��״̬ * 分析Bulk Urb状态
* *
* Parameters: * Parameters:
* mscDev : input. Ŀ���豸 * mscDev : input. 目标设备
* UrbState : input. URB��ִ��״̬ * UrbState : input. URB执行状态
* Pipe : input. urb��pipe * Pipe : input. urbpipe
* WantLen : input. ԭ���봫������ݳ��� * WantLen : input. 原始要求传输数据长度
* ActLen : input. ʵ�ʴ�������ݳ��� * ActLen : input. 实际传输数据长度
* *
* Return value: * Return value:
* ����USB����Ľ�� * 返回USB操作结果
* *
* note: * note:
* *
...@@ -437,18 +438,18 @@ static int AnalyseBulkUrbState(__mscDev_t *mscDev, ...@@ -437,18 +438,18 @@ static int AnalyseBulkUrbState(__mscDev_t *mscDev,
* mscSendBlukReq * mscSendBlukReq
* *
* Description: * Description:
* ����bulk���� * 发送bulk请求
* *
* Parameters: * Parameters:
* mscDev : input. Ŀ���豸 * mscDev : input. 目标设备
* Pipe : input. urb��pipe * Pipe : input. urbpipe
* Buffer : input. ������ * Buffer : input. 数据缓冲区
* BufferLen : input. ��������С * BufferLen : input. 数据缓冲区大小
* ActLen : input. ʵ�ʴ�������ݳ��� * ActLen : input. 实际传输数据长度
* TimeOut : input. URB��ʱʱ�� * TimeOut : input. URB超时时间
* *
* Return value: * Return value:
* ����USB����Ľ�� * 返回USB操作结果
* *
* note: * note:
* *
...@@ -491,13 +492,13 @@ static int mscSendBulkReq(__mscDev_t *mscDev, ...@@ -491,13 +492,13 @@ static int mscSendBulkReq(__mscDev_t *mscDev,
* GetMaxLun * GetMaxLun
* *
* Description: * Description:
* ������Lun������������豸���ʧ�ܣ���ô��Ĭ���豸ֻ��1��Lun * 获取当前设备的最大Lun编号,如果获取失败,则默认设备只有1个Lun
* *
* Parameters: * Parameters:
* mscDev : input. Ŀ���豸 * mscDev : input. 目标设备
* *
* Return value: * Return value:
* Lun ���� * Lun 编号
* *
* note: * note:
* *
...@@ -620,13 +621,13 @@ static int mscBoReset(__mscDev_t *mscDev) ...@@ -620,13 +621,13 @@ static int mscBoReset(__mscDev_t *mscDev)
* mscPortReset * mscPortReset
* *
* Description: * Description:
* reset �豸 * 重置设备
* *
* Parameters: * Parameters:
* mscDev : input. Ŀ���豸 * mscDev : input. 目标设备
* *
* Return value: * Return value:
* ���سɹ�����ʧ�� * 返回成功或失败
* *
* note: * note:
* *
...@@ -775,8 +776,8 @@ int mscBoTransport(__mscDev_t *mscDev, __ScsiCmnd_t *ScsiCmnd) ...@@ -775,8 +776,8 @@ int mscBoTransport(__mscDev_t *mscDev, __ScsiCmnd_t *ScsiCmnd)
&ActLen, &ActLen,
TimeOut); TimeOut);
/* ��Щ�豸��read/write��������ݴ�������У������ep stall�� /* 有些设备在read/write数据时会发生endpoint stall的情况,
�����������������clear feature�Dz����ģ�������Ҫ�����ش��� 解除stall可能需要进行clear feature操作,所以需要进行重试
*/ */
if (ret == USB_STOR_XFER_STALLED) if (ret == USB_STOR_XFER_STALLED)
{ {
......
...@@ -44,8 +44,8 @@ ...@@ -44,8 +44,8 @@
#define MSC_DRV_NAME "Mass Storage Class" #define MSC_DRV_NAME "Mass Storage Class"
#define MSC_DRV_AUTHOR "Host Driver Author" #define MSC_DRV_AUTHOR "Host Driver Author"
static struct usb_host_func_drv mscDrv; /* */ static struct usb_host_func_drv mscDrv; /* 存储USB Mass Storage设备驱动 */
static __u32 mscDev_id_array; /* ��¼��mscDev�ı�� */ static __u32 mscDev_id_array; /* 记录已连接的mscDev的id值 */
static struct usb_drv_dev_match_table msc_match_table [] = static struct usb_drv_dev_match_table msc_match_table [] =
{ {
...@@ -255,16 +255,16 @@ static struct usb_drv_dev_match_table msc_match_table [] = ...@@ -255,16 +255,16 @@ static struct usb_drv_dev_match_table msc_match_table [] =
* get_mscDev_id * get_mscDev_id
* *
* Description: * Description:
* ���²�����豸����ID * 获取USB Mass Storage设备的ID
* *
* Parameters: * Parameters:
* void * void
* *
* Return value: * Return value:
* ���ط����ID * 返回设备的ID
* *
* note: * note:
* �� *
* *
******************************************************************************* *******************************************************************************
*/ */
...@@ -288,17 +288,17 @@ static unsigned int get_mscDev_id(void) ...@@ -288,17 +288,17 @@ static unsigned int get_mscDev_id(void)
* free_mscDev_id * free_mscDev_id
* *
* Description: * Description:
* �ͷŷ����ID * 释放USB Mass Storage设备的ID
* *
* Parameters: * Parameters:
* bit : input. mscDev��ID�� * bit : input. mscDev的ID号
* *
* Return value: * Return value:
* 0 ���ɹ� * 0 成功
* !0 ��ʧ�� * !0 失败
* *
* note: * note:
* �� *
* *
******************************************************************************* *******************************************************************************
*/ */
...@@ -306,15 +306,16 @@ static int free_mscDev_id(unsigned int bit) ...@@ -306,15 +306,16 @@ static int free_mscDev_id(unsigned int bit)
{ {
if (usb_test_bit(bit, (volatile uint32_t *)&mscDev_id_array) == 0) if (usb_test_bit(bit, (volatile uint32_t *)&mscDev_id_array) == 0)
{ {
hal_log_err("ERR: free_host_id: invalid bit(%d)", bit); hal_log_err("ERR: free_mscDev_id: invalid bit(%d)", bit);
return -1; return -1;
} }
/* ���ո�λ */ /* 释放占用位 */
usb_clear_bit(bit, (volatile uint32_t *)&mscDev_id_array); usb_clear_bit(bit, (volatile uint32_t *)&mscDev_id_array);
return 0; return 0;
} }
/* /*
******************************************************************************* *******************************************************************************
* mscDevInit * mscDevInit
...@@ -323,18 +324,19 @@ static int free_mscDev_id(unsigned int bit) ...@@ -323,18 +324,19 @@ static int free_mscDev_id(unsigned int bit)
* *
* *
* Parameters: * Parameters:
* mscDev �� input. msc�豸��Ϣ * mscDev : input. msc设备信息
* intf : input. USB�ӿ� * intf : input. USB接口
* *
* Return value: * Return value:
* 0 ���ɹ� * 0 成功
* !0 ��ʧ�� * !0 失败
* *
* note: * note:
* �� *
* *
******************************************************************************* *******************************************************************************
*/ */
static int mscDevInit(__mscDev_t *mscDev, struct usb_interface *intf) static int mscDevInit(__mscDev_t *mscDev, struct usb_interface *intf)
{ {
int ret = 0; int ret = 0;
...@@ -369,7 +371,7 @@ static int mscDevInit(__mscDev_t *mscDev, struct usb_interface *intf) ...@@ -369,7 +371,7 @@ static int mscDevInit(__mscDev_t *mscDev, struct usb_interface *intf)
return USB_ERR_ALLOC_URB_FAILED; return USB_ERR_ALLOC_URB_FAILED;
} }
/* һ��Կ�� */ /* 一次性锁 */
mscDev->scan_lock = hal_sem_create(1); mscDev->scan_lock = hal_sem_create(1);
if (mscDev->scan_lock == NULL) if (mscDev->scan_lock == NULL)
...@@ -388,7 +390,7 @@ static int mscDevInit(__mscDev_t *mscDev, struct usb_interface *intf) ...@@ -388,7 +390,7 @@ static int mscDevInit(__mscDev_t *mscDev, struct usb_interface *intf)
goto error1; goto error1;
} }
/* �߳�ͬ�� */ /* 线程同步 */
mscDev->ThreadSemi = hal_sem_create(0); mscDev->ThreadSemi = hal_sem_create(0);
if (mscDev->ThreadSemi == NULL) if (mscDev->ThreadSemi == NULL)
...@@ -463,13 +465,13 @@ error0: ...@@ -463,13 +465,13 @@ error0:
* *
* *
* Parameters: * Parameters:
* mscDev �� input. msc�豸��Ϣ * mscDev -- input. msc设备信息
* *
* Return value: * Return value:
* �� * none
* *
* note: * note:
* �� * none
* *
******************************************************************************* *******************************************************************************
*/ */
...@@ -529,10 +531,10 @@ static void mscDevFree(__mscDev_t *mscDev) ...@@ -529,10 +531,10 @@ static void mscDevFree(__mscDev_t *mscDev)
* *
* *
* Return value: * Return value:
* �� * none
* *
* note: * note:
* �� * none
* *
******************************************************************************* *******************************************************************************
*/ */
...@@ -555,10 +557,10 @@ static void SetMscDevState(__mscDev_t *mscDev, mscDev_state_t state) ...@@ -555,10 +557,10 @@ static void SetMscDevState(__mscDev_t *mscDev, mscDev_state_t state)
* *
* *
* Return value: * Return value:
* ��/�� * none/error
* *
* note: * note:
* �� * none
* *
******************************************************************************* *******************************************************************************
*/ */
...@@ -578,10 +580,10 @@ unsigned int mscDevOnline(__mscDev_t *mscDev) ...@@ -578,10 +580,10 @@ unsigned int mscDevOnline(__mscDev_t *mscDev)
* *
* *
* Return value: * Return value:
* �� * void
* *
* note: * note:
* �� * none
* *
******************************************************************************* *******************************************************************************
*/ */
...@@ -598,17 +600,17 @@ static void GetDeviceInfo(__mscDev_t *mscDev, unsigned int index) ...@@ -598,17 +600,17 @@ static void GetDeviceInfo(__mscDev_t *mscDev, unsigned int index)
* GetTransport * GetTransport
* *
* Description: * Description:
* ���msc�豸�Ĵ��䷽ʽ * 获取msc设备的传输方式
* *
* Parameters: * Parameters:
* mscDev �� input. msc�豸��Ϣ * mscDev 获取 input.msc设备信息
* *
* Return value: * Return value:
* 0 ���ɹ� * 0 成功
* !0 ��ʧ�� * !0 失败
* *
* note: * note:
* �� * none
* *
******************************************************************************* *******************************************************************************
*/ */
...@@ -638,20 +640,20 @@ static int GetTransport(__mscDev_t *mscDev) ...@@ -638,20 +640,20 @@ static int GetTransport(__mscDev_t *mscDev)
/* /*
******************************************************************************* *******************************************************************************
* GetTransport * GetProtocol
* *
* Description: * Description:
* ���msc�豸�Ĵ��䷽ʽ * 获取msc设备的传输方式
* *
* Parameters: * Parameters:
* mscDev �� input. msc�豸��Ϣ * mscDev 获取 input.msc设备信息
* *
* Return value: * Return value:
* 0 ���ɹ� * 0 成功
* !0 ��ʧ�� * !0 失败
* *
* note: * note:
* �� * none
* *
******************************************************************************* *******************************************************************************
*/ */
...@@ -702,20 +704,21 @@ static int GetProtocol(__mscDev_t *mscDev) ...@@ -702,20 +704,21 @@ static int GetProtocol(__mscDev_t *mscDev)
* CreatePipes * CreatePipes
* *
* Description: * Description:
* ��������ܵ� * 创建管道函数
* *
* Parameters: * Parameters:
* mscDev �� input. msc�豸��Ϣ * mscDev 获取 input.msc设备信息
* *
* Return value: * Return value:
* 0 ���ɹ� * 0 成功
* !0 ��ʧ�� * !0 失败
* *
* note: * note:
* �� * none
* *
******************************************************************************* *******************************************************************************
*/ */
static int CreatePipes(__mscDev_t *mscDev) static int CreatePipes(__mscDev_t *mscDev)
{ {
struct usb_host_virt_interface *altsetting = mscDev->pusb_intf->cur_altsetting; struct usb_host_virt_interface *altsetting = mscDev->pusb_intf->cur_altsetting;
...@@ -786,16 +789,16 @@ static int CreatePipes(__mscDev_t *mscDev) ...@@ -786,16 +789,16 @@ static int CreatePipes(__mscDev_t *mscDev)
* mscDevAdd * mscDevAdd
* *
* Description: * Description:
* * 添加msc设备
* *
* Parameters: * Parameters:
* mscDev �� input. msc�豸��Ϣ * mscDev : input. msc设备信息
* *
* Return value: * Return value:
* �� * None
* *
* note: * note:
* �� *
* *
******************************************************************************* *******************************************************************************
*/ */
...@@ -827,7 +830,7 @@ static void mscDevAdd(__mscDev_t *mscDev) ...@@ -827,7 +830,7 @@ static void mscDevAdd(__mscDev_t *mscDev)
mscLun->mscDev = mscDev; mscLun->mscDev = mscDev;
mscLun->LunNo = i; mscLun->LunNo = i;
mscLun->DiskSubClass = mscDev->SubClass; mscLun->DiskSubClass = mscDev->SubClass;
mscLun->RemoveAble = 1; /* Ĭ�Ͼ��ǿ��ƶ��豸 */ mscLun->RemoveAble = 1; /* 默认为可移动设备 */
mscDev->Lun[i] = mscLun; mscDev->Lun[i] = mscLun;
hal_log_info("begin mscLunAdd\n"); hal_log_info("begin mscLunAdd\n");
ret = mscLunAdd(mscLun); ret = mscLunAdd(mscLun);
...@@ -839,7 +842,7 @@ static void mscDevAdd(__mscDev_t *mscDev) ...@@ -839,7 +842,7 @@ static void mscDevAdd(__mscDev_t *mscDev)
continue; continue;
} }
/* ����豸�Ƿ��ƶ��豸, ��delay */ /* 判断设备是否可移动设备, 若不是则delay */
if (mscLun->RemoveAble == 0) if (mscLun->RemoveAble == 0)
{ {
mscDev->SuspendTime = 10000; /* 10s */ mscDev->SuspendTime = 10000; /* 10s */
...@@ -863,13 +866,13 @@ static void mscDevAdd(__mscDev_t *mscDev) ...@@ -863,13 +866,13 @@ static void mscDevAdd(__mscDev_t *mscDev)
* *
* *
* Parameters: * Parameters:
* mscDev �� input. msc�豸��Ϣ * mscDev : input. msc设备信息
* *
* Return value: * Return value:
* �� *
* *
* note: * note:
* �� *
* *
******************************************************************************* *******************************************************************************
*/ */
...@@ -908,19 +911,20 @@ static void mscDevDel(__mscDev_t *mscDev) ...@@ -908,19 +911,20 @@ static void mscDevDel(__mscDev_t *mscDev)
* MediaChangeThread * MediaChangeThread
* *
* Description: * Description:
* ���ʼ���߳� * 媒体变化线程
* *
* Parameters: * Parameters:
* p_arg �� input. ��mscDev, msc�豸��Ϣ * p_arg : input. 为mscDev, msc设备信息
* *
* Return value: * Return value:
* �� *
* *
* note: * note:
* �� *
* *
******************************************************************************* *******************************************************************************
*/ */
static void MediaChangeThread(void *p_arg) static void MediaChangeThread(void *p_arg)
{ {
__mscDev_t *mscDev = (__mscDev_t *)p_arg; __mscDev_t *mscDev = (__mscDev_t *)p_arg;
...@@ -928,7 +932,7 @@ static void MediaChangeThread(void *p_arg) ...@@ -928,7 +932,7 @@ static void MediaChangeThread(void *p_arg)
while (1) while (1)
{ {
unsigned int i = 0; unsigned int i = 0;
//--<1>--ɱ���߳� //--<1>--销毁线程
//TryTo//KillThreadSelf("MediaChangeThread"); //TryTo//KillThreadSelf("MediaChangeThread");
for (i = 0; i < mscDev->MaxLun; i++) for (i = 0; i < mscDev->MaxLun; i++)
...@@ -958,16 +962,16 @@ static void MediaChangeThread(void *p_arg) ...@@ -958,16 +962,16 @@ static void MediaChangeThread(void *p_arg)
* mscDevScanThread * mscDevScanThread
* *
* Description: * Description:
* mscDevɨ�� * mscDev扫描
* *
* Parameters: * Parameters:
* p_arg �� input. ��mscDev, msc�豸��Ϣ * p_arg : input. 指向mscDev, msc设备信息
* *
* Return value: * Return value:
* �� *
* *
* note: * note:
* �� *
* *
******************************************************************************* *******************************************************************************
*/ */
...@@ -985,18 +989,18 @@ static void mscDevScanThread(void *p_arg) ...@@ -985,18 +989,18 @@ static void mscDevScanThread(void *p_arg)
* QueueCmnd * QueueCmnd
* *
* Description: * Description:
* �������Lun * 将命令队列提交到Lun
* *
* Parameters: * Parameters:
* mscLun �� input. �����Ӧ��Lun * mscLun : input. 对应的Lun
* scsi_cmnd : input. ���� * scsi_cmnd : input. 命令
* *
* Return value: * Return value:
* 0 ���ɹ� * 0 成功
* !0 ��ʧ�� * !0 失败
* *
* note: * note:
* �� *
* *
******************************************************************************* *******************************************************************************
*/ */
...@@ -1056,18 +1060,18 @@ int mscDevQueueCmnd(__mscLun_t *mscLun, __ScsiCmnd_t *ScsiCmnd) ...@@ -1056,18 +1060,18 @@ int mscDevQueueCmnd(__mscLun_t *mscLun, __ScsiCmnd_t *ScsiCmnd)
* mscCmndDone * mscCmndDone
* *
* Description: * Description:
* ���������ȥ���ط�������� * 处理命令完成后的回调函数
* *
* Parameters: * Parameters:
* mscLun �� input. �����Ӧ��Lun * mscLun : input. 对应的Lun
* scsi_cmnd : input. ���� * scsi_cmnd : input. 命令
* TransStatus : input. ����״̬ * TransStatus : input. 数据传输状态
* *
* Return value: * Return value:
* �� *
* *
* note: * note:
* �� *
* *
******************************************************************************* *******************************************************************************
*/ */
...@@ -1105,7 +1109,7 @@ static void mscCmndDone(__mscDev_t *mscDev, __ScsiCmnd_t *ScsiCmnd, int TransSta ...@@ -1105,7 +1109,7 @@ static void mscCmndDone(__mscDev_t *mscDev, __ScsiCmnd_t *ScsiCmnd, int TransSta
{ {
hal_log_err("ERR: ScsiCmnd(%x) retry %d times, maybe device is died", hal_log_err("ERR: ScsiCmnd(%x) retry %d times, maybe device is died",
((__u8 *)(ScsiCmnd->cmnd.CommandBlock))[0], ScsiCmnd->retries); ((__u8 *)(ScsiCmnd->cmnd.CommandBlock))[0], ScsiCmnd->retries);
/* ��ʹ����ִ�ж��ʧ��Ҳ������Ϊ�豸����, ��Ϊ�豸���ܲ�֧��������� */ /* 不要使用异步执行操作,因为设备可能不支持并且可能会导致失败 */
} }
} }
else else
...@@ -1132,16 +1136,16 @@ static void mscCmndDone(__mscDev_t *mscDev, __ScsiCmnd_t *ScsiCmnd, int TransSta ...@@ -1132,16 +1136,16 @@ static void mscCmndDone(__mscDev_t *mscDev, __ScsiCmnd_t *ScsiCmnd, int TransSta
* mscMainThread * mscMainThread
* *
* Description: * Description:
* ���̣߳��������Ĵ��� * 线程函数,控制整个系统运行。
* *
* Parameters: * Parameters:
* p_arg �� input. ��mscDev, msc�豸��Ϣ * p_arg -- input. 对象指针,mscDev, msc设备信息。
* *
* Return value: * Return value:
* �� *
* *
* note: * note:
* �� *
* *
******************************************************************************* *******************************************************************************
*/ */
...@@ -1155,16 +1159,16 @@ static void mscMainThread(void *p_arg) ...@@ -1155,16 +1159,16 @@ static void mscMainThread(void *p_arg)
while (1) while (1)
{ {
//--<1>--ɱ���߳� //--<1>--线程退出
//TryTo//KillThreadSelf("mscMainThread"); //TryTo//KillThreadSelf("mscMainThread");
/* sleep */ /* sleep */
//UsbThreadSleep(mscDev->ThreadSemi); //UsbThreadSleep(mscDev->ThreadSemi);
// kthread_stop(mscDev->MainThreadId); // kthread_stop(mscDev->MainThreadId);
hal_sem_wait(mscDev->ThreadSemi); hal_sem_wait(mscDev->ThreadSemi);
/* cmd_list is empty? /* cmd_list is empty?
* mscDevQueueCmnd��cmd�ӵ�cmd_list���պ�����mscMainThread������������� * 如果mscDevQueueCmnd的cmd加入了cmd_list队列就会唤醒mscMainThread线程去执行,
* forѭ����⵽cmd_list���վͻ�ȥִ����һ�����ִ����Ϻ�cmd_list���ˡ� * for循环从cmd_list取出一个cmd执行完再继续取下一个。
* ��ʱUsbThreadWakeUp����mscMainThread������cmd_list�Ѿ����ˡ� * 所以UsbThreadWakeUp函数用于将mscMainThread线程唤醒,去执行已经加入到cmd_list的cmd。
*/ */
if (usb_list_empty(&(mscDev->cmd_list))) if (usb_list_empty(&(mscDev->cmd_list)))
{ {
...@@ -1209,18 +1213,18 @@ static void mscMainThread(void *p_arg) ...@@ -1209,18 +1213,18 @@ static void mscMainThread(void *p_arg)
* mscDevProbe * mscDevProbe
* *
* Description: * Description:
* ��������ܵ� * 设备探测函数
* *
* Parameters: * Parameters:
* intf �� input. USB�ӿ���Ϣ * intf : input. USB接口信息
* table_item : input. ƥ��� * table_item : input. 匹配项
* *
* Return value: * Return value:
* 0 ���ɹ� * 0 成功
* !0 ��ʧ�� * !0 失败
* *
* note: * note:
* �� * 备注
* *
******************************************************************************* *******************************************************************************
*/ */
...@@ -1240,9 +1244,9 @@ static int32_t mscDevProbe(struct usb_interface *intf, const struct usb_drv_dev_ ...@@ -1240,9 +1244,9 @@ static int32_t mscDevProbe(struct usb_interface *intf, const struct usb_drv_dev_
} }
//---------------------------------------------------------------- //----------------------------------------------------------------
// ��ʼ��mscDev // 初始化mscDev
//---------------------------------------------------------------- //----------------------------------------------------------------
/* ��ʼ��һ��mscDev */ /* 初始化一个mscDev */
mscDev = (__mscDev_t *)hal_malloc(sizeof(__mscDev_t)); mscDev = (__mscDev_t *)hal_malloc(sizeof(__mscDev_t));
if (mscDev == NULL) if (mscDev == NULL)
...@@ -1263,7 +1267,7 @@ static int32_t mscDevProbe(struct usb_interface *intf, const struct usb_drv_dev_ ...@@ -1263,7 +1267,7 @@ static int32_t mscDevProbe(struct usb_interface *intf, const struct usb_drv_dev_
} }
GetDeviceInfo(mscDev, match_table_index); GetDeviceInfo(mscDev, match_table_index);
/* ���SubClass */ /* 获取 SubClass */
ret = GetProtocol(mscDev); ret = GetProtocol(mscDev);
if (ret != USB_ERR_SUCCESS) if (ret != USB_ERR_SUCCESS)
...@@ -1273,7 +1277,7 @@ static int32_t mscDevProbe(struct usb_interface *intf, const struct usb_drv_dev_ ...@@ -1273,7 +1277,7 @@ static int32_t mscDevProbe(struct usb_interface *intf, const struct usb_drv_dev_
goto error2; goto error2;
} }
/* ���Transport */ /* 获取 Transport */
ret = GetTransport(mscDev); ret = GetTransport(mscDev);
if (ret != USB_ERR_SUCCESS) if (ret != USB_ERR_SUCCESS)
...@@ -1283,7 +1287,7 @@ static int32_t mscDevProbe(struct usb_interface *intf, const struct usb_drv_dev_ ...@@ -1283,7 +1287,7 @@ static int32_t mscDevProbe(struct usb_interface *intf, const struct usb_drv_dev_
goto error3; goto error3;
} }
/* ��������ܵ� */ /* 创建管道 */
ret = CreatePipes(mscDev); ret = CreatePipes(mscDev);
if (ret != USB_ERR_SUCCESS) if (ret != USB_ERR_SUCCESS)
{ {
...@@ -1292,11 +1296,12 @@ static int32_t mscDevProbe(struct usb_interface *intf, const struct usb_drv_dev_ ...@@ -1292,11 +1296,12 @@ static int32_t mscDevProbe(struct usb_interface *intf, const struct usb_drv_dev_
goto error4; goto error4;
} }
//---------------------------------------------------------------- //----------------------------------------------------------------
// ʶ��mscDev //识别mscDev
//---------------------------------------------------------------- //----------------------------------------------------------------
SetMscDevState(mscDev, MSC_DEV_ONLINE); SetMscDevState(mscDev, MSC_DEV_ONLINE);
/* ���MaxLun */ /* 获取MaxLun */
mscDev->MaxLun = mscGetMaxLun(mscDev) + 1; mscDev->MaxLun = mscGetMaxLun(mscDev) + 1;
if (mscDev->MaxLun > MSC_MAX_LUN) if (mscDev->MaxLun > MSC_MAX_LUN)
...@@ -1368,17 +1373,17 @@ error0: ...@@ -1368,17 +1373,17 @@ error0:
* mscDevSuspend * mscDevSuspend
* *
* Description: * Description:
* �����豸 * 挂起设备
* *
* Parameters: * Parameters:
* intf �� input. USB�ӿ���Ϣ * intf : input. USB接口信息
* *
* Return value: * Return value:
* 0 ���ɹ� * 0 成功
* !0 ��ʧ�� * !0 失败
* *
* note: * note:
* �� *
* *
******************************************************************************* *******************************************************************************
*/ */
...@@ -1413,17 +1418,17 @@ static int32_t mscDevSuspend(struct usb_interface *intf) ...@@ -1413,17 +1418,17 @@ static int32_t mscDevSuspend(struct usb_interface *intf)
* mscDevRemove * mscDevRemove
* *
* Description: * Description:
* msc�豸�Ƴ� * msc设备移除
* *
* Parameters: * Parameters:
* intf �� input. USB�ӿ���Ϣ * intf : input. USB接口信息
* *
* Return value: * Return value:
* 0 ���ɹ� * 0 成功
* !0 ��ʧ�� * !0 失败
* *
* note: * note:
* �� *
* *
******************************************************************************* *******************************************************************************
*/ */
...@@ -1447,9 +1452,9 @@ static void mscDevRemove(struct usb_interface *intf) ...@@ -1447,9 +1452,9 @@ static void mscDevRemove(struct usb_interface *intf)
SetMscDevState(mscDev, MSC_DEV_OFFLINE); SetMscDevState(mscDev, MSC_DEV_OFFLINE);
hal_log_info("mscDevRemove: SetMscDevState MSC_DEV_OFFLINE"); hal_log_info("mscDevRemove: SetMscDevState MSC_DEV_OFFLINE");
/* ֹͣ��ǰ���� */ /* 停止当前传输 */
mscDev->StopTransport(mscDev); mscDev->StopTransport(mscDev);
/* �Ͽ�mscDev��������е�Lun */ /* 断开mscDev与所有Lun的关联 */
mscDevDel(mscDev); mscDevDel(mscDev);
/* kill media change thrad */ /* kill media change thrad */
kthread_stop(mscDev->MediaChangeId); kthread_stop(mscDev->MediaChangeId);
...@@ -1461,7 +1466,7 @@ static void mscDevRemove(struct usb_interface *intf) ...@@ -1461,7 +1466,7 @@ static void mscDevRemove(struct usb_interface *intf)
hal_sem_delete(mscDev->ThreadSemi); hal_sem_delete(mscDev->ThreadSemi);
mscDev->ThreadSemi = NULL; mscDev->ThreadSemi = NULL;
} }
/* �ͷ�mscDev��Դ */ /* 释放mscDev资源 */
mscDevFree(mscDev); mscDevFree(mscDev);
hal_free(mscDev); hal_free(mscDev);
hal_log_info("mscDevRemove complete"); hal_log_info("mscDevRemove complete");
...@@ -1473,17 +1478,17 @@ static void mscDevRemove(struct usb_interface *intf) ...@@ -1473,17 +1478,17 @@ static void mscDevRemove(struct usb_interface *intf)
* mscDrv_init * mscDrv_init
* *
* Description: * Description:
* msc������ʼ�� * msc驱动初始化
* *
* Parameters: * Parameters:
* drv �� input. msc���� * drv 为input.msc驱动
* *
* Return value: * Return value:
* 0 ���ɹ� * 0 成功
* !0 ��ʧ�� * !0 失败
* *
* note: * note:
* �� *
* *
******************************************************************************* *******************************************************************************
*/ */
...@@ -1511,16 +1516,16 @@ static int mscDrvInit(struct usb_host_func_drv *drv) ...@@ -1511,16 +1516,16 @@ static int mscDrvInit(struct usb_host_func_drv *drv)
* scsi_bus_drv_reg * scsi_bus_drv_reg
* *
* Description: * Description:
* ��scsi����ע������ * SCSI总线驱动注册函数
* *
* Parameters: * Parameters:
* drv : input. ���� * drv : input. 驱动
* *
* Return value: * Return value:
* EPDK_OK / EPDK_FAIL * EPDK_OK / EPDK_FAIL
* *
* note: * note:
* �� *
* *
******************************************************************************* *******************************************************************************
*/ */
...@@ -1532,7 +1537,7 @@ int mscInit(void) ...@@ -1532,7 +1537,7 @@ int mscInit(void)
mscDev_id_array = 0; mscDev_id_array = 0;
init_usbh_buff_manager(); init_usbh_buff_manager();
usbh_disk_time_init(); usbh_disk_time_init();
/* ���ݿͻ�������Ҫ��ӳdisk��״̬, ������ǹ���disk��״̬ */ /* 数据库客户端需要映射disk状态, 这就是针对disk状态 */
usbh_disk_info_reg(); usbh_disk_info_reg();
if (mscDrvInit(&mscDrv) != 0) if (mscDrvInit(&mscDrv) != 0)
...@@ -1555,16 +1560,16 @@ int mscInit(void) ...@@ -1555,16 +1560,16 @@ int mscInit(void)
* scsi_bus_drv_reg * scsi_bus_drv_reg
* *
* Description: * Description:
* ��scsi����ע������ * SCSI总线驱动注册
* *
* Parameters: * Parameters:
* drv : input. ���� * drv : input. 驱动
* *
* Return value: * Return value:
* EPDK_OK / EPDK_FAIL * EPDK_OK / EPDK_FAIL
* *
* note: * note:
* �� *
* *
******************************************************************************* *******************************************************************************
*/ */
......
...@@ -39,7 +39,7 @@ typedef struct tag_PARTITION ...@@ -39,7 +39,7 @@ typedef struct tag_PARTITION
__u8 classname[12]; // major device name __u8 classname[12]; // major device name
__u8 name[12]; // minor device name __u8 name[12]; // minor device name
__u8 res[24]; // reserved __u8 res[24]; // reserved
} PARTITION; // 64 bytes Ӧ�ô��� pack } PARTITION; // 64 bytes 应该使用 pack
// mbr information // mbr information
typedef struct tag_MBR typedef struct tag_MBR
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册