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

[bsp]Fix Chinese coding errors in annotations.

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