[bsp]Fix Chinese coding errors in annotations.
This commit is contained in:
parent
d7ef1d1b4e
commit
7a31ab9115
|
@ -34,12 +34,12 @@ extern "C" {
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
OTP_Complete = 0,
|
OTP_Complete = 0,
|
||||||
OTP_ReadOnProgramOrSleep, //<EFBFBD>ڱ<EFBFBD>̡<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<EFBFBD>¶<EFBFBD>OTP<EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
OTP_ReadOnProgramOrSleep, //在编程或休眠状态下读取OTP数据
|
||||||
OTP_ProgramIn_HiddenOrRO_Block, //<EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><EFBFBD>
|
OTP_ProgramIn_HiddenOrRO_Block, //在只读或隐藏块中编程
|
||||||
OTP_ProgramOutOfAddr, //<EFBFBD><EFBFBD>̷<EFBFBD>Χ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>OTP<EFBFBD><EFBFBD>Χ
|
OTP_ProgramOutOfAddr, //超出OTP地址范围
|
||||||
OTP_ProgramOnSleep, //<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>̲<EFBFBD><EFBFBD><EFBFBD>
|
OTP_ProgramOnSleep, //在睡眠状态下编程
|
||||||
OTP_WakeUpOnNoSleep, //<EFBFBD>ڷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<EFBFBD>½<EFBFBD><EFBFBD>л<EFBFBD><EFBFBD>Ѳ<EFBFBD><EFBFBD><EFBFBD>
|
OTP_WakeUpOnNoSleep, //在非睡眠状态下从唤醒
|
||||||
OTP_TimeOut, //OTP<EFBFBD><EFBFBD>ɱ<EFBFBD>־λ<EFBFBD><EFBFBD>ʱû<EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ
|
OTP_TimeOut, //OTP写入超时
|
||||||
OTP_DataWrong,
|
OTP_DataWrong,
|
||||||
}OTP_StatusTypeDef;
|
}OTP_StatusTypeDef;
|
||||||
|
|
||||||
|
|
|
@ -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))
|
||||||
|
|
||||||
/* <EFBFBD>ⲿ<EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD> */
|
/* 外部静态检测频率 */
|
||||||
#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)
|
||||||
|
|
||||||
/* <EFBFBD>ⲿ<EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
/* 外部静态采样个数 */
|
||||||
#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
|
||||||
#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)
|
||||||
|
|
||||||
/* <EFBFBD>ⲿ<EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
/* 外部动态采样个数 */
|
||||||
#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
|
||||||
(COUNT) <= SENSOR_DYNAMIC_SAMPLE_4)
|
(COUNT) <= SENSOR_DYNAMIC_SAMPLE_4)
|
||||||
|
|
||||||
|
|
||||||
/* <EFBFBD>ⲿ<EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>裬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Чʱ<EFBFBD><EFBFBD> */
|
/* 外部动态采样保持时间,单位为标准时钟周期 */
|
||||||
#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
|
||||||
(TIME) == SENSOR_PUPU_HoldTime_1_8 ||\
|
(TIME) == SENSOR_PUPU_HoldTime_1_8 ||\
|
||||||
(TIME) == SENSOR_PUPU_HoldTime_1_16)
|
(TIME) == SENSOR_PUPU_HoldTime_1_16)
|
||||||
|
|
||||||
/* <EFBFBD><EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD> */
|
/* 动态检测频率 */
|
||||||
#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,31 +31,30 @@
|
||||||
/* Includes ------------------------------------------------------------------*/
|
/* Includes ------------------------------------------------------------------*/
|
||||||
#include "air105.h"
|
#include "air105.h"
|
||||||
|
|
||||||
|
#define SSC_ITSysXTAL12M BIT(18) //系统12M时钟源标志
|
||||||
#define SSC_ITSysXTAL12M BIT(18) //ϵͳ<CFB5><CDB3>12Mʱ<4D>ӱ<EFBFBD>־
|
#define SSC_ITSysGlitch BIT(17) //供源噪声标志
|
||||||
#define SSC_ITSysGlitch BIT(17) //<2F><><EFBFBD><EFBFBD>Դë<D4B4>̱<EFBFBD>־
|
#define SSC_ITSysVolHigh BIT(16) //供源电压高标志
|
||||||
#define SSC_ITSysVolHigh BIT(16) //<2F><><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4>ѹ<EFBFBD><D1B9>־
|
#define SSC_ITSysVolLow BIT(15) //供源电压低标志
|
||||||
#define SSC_ITSysVolLow BIT(15) //<2F><><EFBFBD><EFBFBD>ԴǷѹ<C7B7><D1B9>־
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
FunctionalState ParityCheck; //<EFBFBD><EFBFBD>żУ<EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>
|
FunctionalState ParityCheck; //偶校验使用
|
||||||
}SSC_InitTypeDef;
|
}SSC_InitTypeDef;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* <EFBFBD><EFBFBD>BPK<EFBFBD><EFBFBD>Ϊ4<EFBFBD><EFBFBD>ÿ<EFBFBD><EFBFBD>256<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD>ö<EFBFBD>дȨ<EFBFBD><EFBFBD>
|
* 以BPK为4,每256为一单元格编号,用于多单元格写入
|
||||||
* SSC_BPKAccessCtrBlock_0Ϊ<EFBFBD><EFBFBD>ʼ0<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD>
|
* SSC_BPKAccessCtrBlock_0为初始0地址。
|
||||||
*/
|
*/
|
||||||
#define SSC_BPKAccessCtrBlock_0 (0x01)
|
#define SSC_BPKAccessCtrBlock_0 (0x01)
|
||||||
#define SSC_BPKAccessCtrBlock_1 (0x02)
|
#define SSC_BPKAccessCtrBlock_1 (0x02)
|
||||||
#define SSC_BPKAccessCtrBlock_All (0x03)
|
#define SSC_BPKAccessCtrBlock_All (0x03)
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
SSC_BPKReadOnly = 0x01, //BPK<EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD>
|
SSC_BPKReadOnly = 0x01, //BPK只读
|
||||||
SSC_BPKWriteOnly = 0x02, //BPK<EFBFBD><EFBFBD>ֻд
|
SSC_BPKWriteOnly = 0x02, //BPK只写
|
||||||
SSC_BPKReadWrite = 0x03 //BPK<EFBFBD><EFBFBD><EFBFBD>д
|
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
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method SSC_Init
|
* @method SSC_Init
|
||||||
* @brief SSC<EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD><EFBFBD>Գ<EFBFBD>ʼ<EFBFBD><EFBFBD>
|
* @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);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method SSC_GetITStatus
|
* @method SSC_GetITStatus
|
||||||
* @brief SSC<EFBFBD><EFBFBD>ȫ<EFBFBD>ж<EFBFBD>״̬
|
* @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);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method SSC_ClearITPendingBit
|
* @method SSC_ClearITPendingBit
|
||||||
* @brief SSC<EFBFBD><EFBFBD>ȫ<EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* @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);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method SSC_SetDataRAMScrambler
|
* @method SSC_SetDataRAMScrambler
|
||||||
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>RAM<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* @brief 设置数据RAM扰码
|
||||||
* @param uint32_t Scrambler
|
* @param uint32_t Scrambler
|
||||||
* @retval void
|
* @retval void
|
||||||
*/
|
*/
|
||||||
|
@ -112,7 +111,7 @@ void SSC_SetDataRAMScrambler(uint32_t Scrambler);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method SSC_BPKAccessCtrConfig
|
* @method SSC_BPKAccessCtrConfig
|
||||||
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD>BPK<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD>
|
* @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
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method SSC_SENSOR_Enable
|
* @method SSC_SENSOR_Enable
|
||||||
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ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);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method SSC_SENSORLock
|
* @method SSC_SENSORLock
|
||||||
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳSensor<EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
* @brief 锁定系统Sensor状态
|
||||||
* @param SSC_SENSOR
|
* @param SSC_SENSOR
|
||||||
* @retval
|
* @retval
|
||||||
*/
|
*/
|
||||||
|
@ -140,7 +139,7 @@ void SSC_SENSORLock(uint32_t SSC_SENSOR);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @method SSC_SENSOR_AttackRespMode
|
* @method SSC_SENSOR_AttackRespMode
|
||||||
* @brief ϵͳSensor<EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD>ʽ
|
* @brief 系统Sensor响应模式
|
||||||
* @param SSC_SENSOR_RespMode
|
* @param SSC_SENSOR_RespMode
|
||||||
* @retval
|
* @retval
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -116,7 +116,7 @@ ITStatus TRNG_GetITStatus(uint32_t TRNG_IT)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD>жϱ<EFBFBD>־λ
|
* @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 {
|
||||||
G2D_SEQ_NORMAL = 0x0,
|
G2D_SEQ_NORMAL = 0x0,
|
||||||
|
|
||||||
/* for interleaved yuv422 */
|
/* for interleaved yuv422 */
|
||||||
G2D_SEQ_VYUY = 0x1, /* pixel 0<EFBFBD>ڵ<EFBFBD>16λ */
|
G2D_SEQ_VYUY = 0x1, /* pixel 0在16位 */
|
||||||
G2D_SEQ_YVYU = 0x2, /* pixel 1<EFBFBD>ڵ<EFBFBD>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<EFBFBD>ڵ<EFBFBD>16λ */
|
G2D_SEQ_P10 = 0x4, /* pixel 0在16位 */
|
||||||
G2D_SEQ_P01 = 0x5, /* pixel 1<EFBFBD>ڵ<EFBFBD>16λ */
|
G2D_SEQ_P01 = 0x5, /* pixel 1在16位 */
|
||||||
|
|
||||||
/* planar format or 8bpp rgb */
|
/* planar format or 8bpp rgb */
|
||||||
G2D_SEQ_P3210 = 0x6, /* pixel 0<EFBFBD>ڵ<EFBFBD>8λ */
|
G2D_SEQ_P3210 = 0x6, /* pixel 0在8位 */
|
||||||
G2D_SEQ_P0123 = 0x7, /* pixel 3<EFBFBD>ڵ<EFBFBD>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,
|
||||||
|
|
||||||
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)
|
||||||
buf[3] = (__u8)val;
|
buf[3] = (__u8)val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ȡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ */
|
/* 取绝对值 */
|
||||||
#undef absolute
|
#undef absolute
|
||||||
#define absolute(p) ((p) > 0 ? (p) : -(p))
|
#define absolute(p) ((p) > 0 ? (p) : -(p))
|
||||||
|
|
||||||
|
|
|
@ -33,13 +33,13 @@
|
||||||
* mscUrbCallBack
|
* mscUrbCallBack
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* urb call back<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* urb call back函数
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* urb : input. <EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>URB
|
* urb : input. 需要提交的URB
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* <EFBFBD><EFBFBD>
|
* 无
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
*
|
*
|
||||||
|
@ -113,14 +113,14 @@ static void mscTimeOut(void *parg)
|
||||||
* mscUsbTransport
|
* mscUsbTransport
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>URB
|
* 发送URB
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* mscDev : input. Ŀ<EFBFBD><EFBFBD><EFBFBD>豸
|
* mscDev : input. 目标设备
|
||||||
* TimeOut : input. <EFBFBD><EFBFBD>ʱʱ<EFBFBD><EFBFBD>
|
* TimeOut : input. 超时时间
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>URB<EFBFBD><EFBFBD>״̬
|
* 返回URB状态
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
*
|
*
|
||||||
|
@ -145,18 +145,19 @@ static int mscUsbTransport(__mscDev_t *mscDev, unsigned int TimeOut)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* fill URB */
|
/* fill URB */
|
||||||
mscDev->CurrentUrb->context = (void *)mscDev->UrbWait;
|
mscDev->CurrentUrb->context = (void *)mscDev->UrbWait;
|
||||||
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;
|
||||||
/* <20><><EFBFBD><EFBFBD>buffer<65><72><EFBFBD>䷽ʽ, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>msc<73><63>buff, <20>Ͳ<EFBFBD><CDB2><EFBFBD>ʹ<EFBFBD><CAB9>DMA<4D><41> <20><>Ϊbuffer, Ҫpalloc<6F><63><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
/* 设置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)
|
// if (mscDev->CurrentUrb->transfer_buffer == mscDev->iobuf)
|
||||||
// {
|
// {
|
||||||
// mscDev->CurrentUrb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
|
// 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)
|
||||||
* mscCtrlMsg
|
* mscCtrlMsg
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* <EFBFBD><EFBFBD><EFBFBD>Ϳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* USB控制消息函数
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* mscDev : input. Ŀ<EFBFBD><EFBFBD><EFBFBD>豸
|
* mscDev : input. 目标设备
|
||||||
* Pipe : input. URB<EFBFBD>ܵ<EFBFBD>
|
* Pipe : input. URB通道
|
||||||
* Request : input. <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* Request : input. 请求类型
|
||||||
* RequestType : input. <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* RequestType : input. 请求方向(读/写)和请求类型
|
||||||
* Value : input. ֵ
|
* Value : input. 值
|
||||||
* Index : input. <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* Index : input. 索引
|
||||||
* Buffer : input. <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* Buffer : input. 输入/输出缓存区
|
||||||
* BufferLen : input. <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
* BufferLen : input. 输入/输出缓存区大小
|
||||||
* TimeOut : input. URB<EFBFBD><EFBFBD>ʱʱ<EFBFBD><EFBFBD>
|
* TimeOut : input. URB超时时间
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>URB<EFBFBD><EFBFBD>״̬
|
* 返回URB状态
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
*
|
*
|
||||||
|
@ -257,24 +258,24 @@ static int mscSendCtrlReq(__mscDev_t *mscDev,
|
||||||
return USB_ERR_BAD_ARGUMENTS;
|
return USB_ERR_BAD_ARGUMENTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* <20><><EFBFBD>ctrl<72><6C><EFBFBD><EFBFBD> */
|
/* 填充控制请求结构体 */
|
||||||
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,
|
||||||
Pipe,
|
Pipe,
|
||||||
(unsigned char *)mscDev->CtrlReq,
|
(unsigned char *)mscDev->CtrlReq,
|
||||||
Buffer,
|
Buffer,
|
||||||
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,
|
||||||
* mscClearHalt
|
* mscClearHalt
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* <EFBFBD><EFBFBD><EFBFBD>ep<EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
* 清除端点状态
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* mscDev : input. Ŀ<EFBFBD><EFBFBD><EFBFBD>豸
|
* mscDev : input. 目标设备
|
||||||
* Pipe : input. urb<EFBFBD><EFBFBD>pipe
|
* Pipe : input. urb的pipe
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>URB<EFBFBD><EFBFBD>ִ<EFBFBD>н<EFBFBD><EFBFBD>
|
* 返回URB执行结果
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
*
|
*
|
||||||
|
@ -339,17 +340,17 @@ static int mscClearHalt(__mscDev_t *mscDev, unsigned int Pipe)
|
||||||
* AnalyseBlukUrbState
|
* AnalyseBlukUrbState
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Bulk Urb<EFBFBD><EFBFBD>״̬
|
* 分析Bulk Urb状态
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* mscDev : input. Ŀ<EFBFBD><EFBFBD><EFBFBD>豸
|
* mscDev : input. 目标设备
|
||||||
* UrbState : input. URB<EFBFBD><EFBFBD>ִ<EFBFBD><EFBFBD>״̬
|
* UrbState : input. URB执行状态
|
||||||
* Pipe : input. urb<EFBFBD><EFBFBD>pipe
|
* Pipe : input. urb的pipe
|
||||||
* WantLen : input. ԭ<EFBFBD><EFBFBD><EFBFBD>봫<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
* WantLen : input. 原始要求传输数据长度
|
||||||
* ActLen : input. ʵ<EFBFBD>ʴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
* ActLen : input. 实际传输数据长度
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>USB<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><EFBFBD>
|
* 返回USB操作结果
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
*
|
*
|
||||||
|
@ -437,18 +438,18 @@ static int AnalyseBulkUrbState(__mscDev_t *mscDev,
|
||||||
* mscSendBlukReq
|
* mscSendBlukReq
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>bulk<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* 发送bulk请求
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* mscDev : input. Ŀ<EFBFBD><EFBFBD><EFBFBD>豸
|
* mscDev : input. 目标设备
|
||||||
* Pipe : input. urb<EFBFBD><EFBFBD>pipe
|
* Pipe : input. urb的pipe
|
||||||
* Buffer : input. <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* Buffer : input. 数据缓冲区
|
||||||
* BufferLen : input. <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
* BufferLen : input. 数据缓冲区大小
|
||||||
* ActLen : input. ʵ<EFBFBD>ʴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
* ActLen : input. 实际传输数据长度
|
||||||
* TimeOut : input. URB<EFBFBD><EFBFBD>ʱʱ<EFBFBD><EFBFBD>
|
* TimeOut : input. URB超时时间
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>USB<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD><EFBFBD>
|
* 返回USB操作结果
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
*
|
*
|
||||||
|
@ -491,13 +492,13 @@ static int mscSendBulkReq(__mscDev_t *mscDev,
|
||||||
* GetMaxLun
|
* GetMaxLun
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Lun<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD><EFBFBD><EFBFBD>ô<EFBFBD><EFBFBD>Ĭ<EFBFBD><EFBFBD><EFBFBD>豸ֻ<EFBFBD><EFBFBD>1<EFBFBD><EFBFBD>Lun
|
* 获取当前设备的最大Lun编号,如果获取失败,则默认设备只有1个Lun
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* mscDev : input. Ŀ<EFBFBD><EFBFBD><EFBFBD>豸
|
* mscDev : input. 目标设备
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* Lun <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* Lun 编号
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
*
|
*
|
||||||
|
@ -620,13 +621,13 @@ static int mscBoReset(__mscDev_t *mscDev)
|
||||||
* mscPortReset
|
* mscPortReset
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* reset <EFBFBD>豸
|
* 重置设备
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* mscDev : input. Ŀ<EFBFBD><EFBFBD><EFBFBD>豸
|
* mscDev : input. 目标设备
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* <EFBFBD><EFBFBD><EFBFBD>سɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
|
* 返回成功或失败
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
*
|
*
|
||||||
|
@ -775,9 +776,9 @@ int mscBoTransport(__mscDev_t *mscDev, __ScsiCmnd_t *ScsiCmnd)
|
||||||
&ActLen,
|
&ActLen,
|
||||||
TimeOut);
|
TimeOut);
|
||||||
|
|
||||||
/* <EFBFBD><EFBFBD>Щ<EFBFBD>豸<EFBFBD><EFBFBD>read/write<74><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD><DDB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ep stall<6C><6C>
|
/* 有些设备在read/write数据时会发生endpoint stall的情况,
|
||||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>clear feature<EFBFBD>Dz<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><EFBFBD><EFBFBD>
|
解除stall可能需要进行clear feature操作,所以需要进行重试
|
||||||
*/
|
*/
|
||||||
if (ret == USB_STOR_XFER_STALLED)
|
if (ret == USB_STOR_XFER_STALLED)
|
||||||
{
|
{
|
||||||
__u8 Command = 0;
|
__u8 Command = 0;
|
||||||
|
|
|
@ -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; /* <EFBFBD><EFBFBD>¼<EFBFBD><EFBFBD>mscDev<EFBFBD>ı<EFBFBD><EFBFBD> */
|
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 [] =
|
||||||
* get_mscDev_id
|
* get_mscDev_id
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* <EFBFBD><EFBFBD><EFBFBD>²<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID
|
* 获取USB Mass Storage设备的ID
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* void
|
* void
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* <EFBFBD><EFBFBD><EFBFBD>ط<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID
|
* 返回设备的ID
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
* <EFBFBD><EFBFBD>
|
* 无
|
||||||
*
|
*
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -288,17 +288,17 @@ static unsigned int get_mscDev_id(void)
|
||||||
* free_mscDev_id
|
* free_mscDev_id
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* <EFBFBD>ͷŷ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID
|
* 释放USB Mass Storage设备的ID
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* bit : input. mscDev<EFBFBD><EFBFBD>ID<EFBFBD><EFBFBD>
|
* bit : input. mscDev的ID号
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* 0 <EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>
|
* 0 成功
|
||||||
* !0 <EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
|
* !0 失败
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
* <EFBFBD><EFBFBD>
|
* 无
|
||||||
*
|
*
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* <EFBFBD><EFBFBD><EFBFBD>ո<EFBFBD>λ */
|
/* 释放占用位 */
|
||||||
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)
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* mscDev <EFBFBD><EFBFBD> input. msc<EFBFBD>豸<EFBFBD><EFBFBD>Ϣ
|
* mscDev : input. msc设备信息
|
||||||
* intf : input. USB<EFBFBD>ӿ<EFBFBD>
|
* intf : input. USB接口
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* 0 <EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>
|
* 0 成功
|
||||||
* !0 <EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
|
* !0 失败
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
* <EFBFBD><EFBFBD>
|
* 无
|
||||||
*
|
*
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
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)
|
||||||
return USB_ERR_ALLOC_URB_FAILED;
|
return USB_ERR_ALLOC_URB_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* һ<EFBFBD><EFBFBD>Կ<EFBFBD><EFBFBD> */
|
/* 一次性锁 */
|
||||||
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)
|
||||||
goto error1;
|
goto error1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* <EFBFBD>߳<EFBFBD>ͬ<EFBFBD><EFBFBD> */
|
/* 线程同步 */
|
||||||
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:
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* mscDev <EFBFBD><EFBFBD> input. msc<EFBFBD>豸<EFBFBD><EFBFBD>Ϣ
|
* mscDev -- input. msc设备信息
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* <EFBFBD><EFBFBD>
|
* none
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
* <EFBFBD><EFBFBD>
|
* none
|
||||||
*
|
*
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -529,10 +531,10 @@ static void mscDevFree(__mscDev_t *mscDev)
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* <EFBFBD><EFBFBD>
|
* none
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
* <EFBFBD><EFBFBD>
|
* none
|
||||||
*
|
*
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -555,10 +557,10 @@ static void SetMscDevState(__mscDev_t *mscDev, mscDev_state_t state)
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* <EFBFBD><EFBFBD>/<EFBFBD><EFBFBD>
|
* none/error
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
* <EFBFBD><EFBFBD>
|
* none
|
||||||
*
|
*
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -578,10 +580,10 @@ unsigned int mscDevOnline(__mscDev_t *mscDev)
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* <EFBFBD><EFBFBD>
|
* void
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
* <EFBFBD><EFBFBD>
|
* none
|
||||||
*
|
*
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -598,17 +600,17 @@ static void GetDeviceInfo(__mscDev_t *mscDev, unsigned int index)
|
||||||
* GetTransport
|
* GetTransport
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* <EFBFBD><EFBFBD><EFBFBD>msc<EFBFBD>豸<EFBFBD>Ĵ<EFBFBD><EFBFBD>䷽ʽ
|
* 获取msc设备的传输方式
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* mscDev <EFBFBD><EFBFBD> input. msc<EFBFBD>豸<EFBFBD><EFBFBD>Ϣ
|
* mscDev 获取 input.msc设备信息
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* 0 <EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>
|
* 0 成功
|
||||||
* !0 <EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
|
* !0 失败
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
* <EFBFBD><EFBFBD>
|
* none
|
||||||
*
|
*
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -638,20 +640,20 @@ static int GetTransport(__mscDev_t *mscDev)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
* GetTransport
|
* GetProtocol
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* <EFBFBD><EFBFBD><EFBFBD>msc<EFBFBD>豸<EFBFBD>Ĵ<EFBFBD><EFBFBD>䷽ʽ
|
* 获取msc设备的传输方式
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* mscDev <EFBFBD><EFBFBD> input. msc<EFBFBD>豸<EFBFBD><EFBFBD>Ϣ
|
* mscDev 获取 input.msc设备信息
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* 0 <EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>
|
* 0 成功
|
||||||
* !0 <EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
|
* !0 失败
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
* <EFBFBD><EFBFBD>
|
* none
|
||||||
*
|
*
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -702,20 +704,21 @@ static int GetProtocol(__mscDev_t *mscDev)
|
||||||
* CreatePipes
|
* CreatePipes
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD>
|
* 创建管道函数
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* mscDev <EFBFBD><EFBFBD> input. msc<EFBFBD>豸<EFBFBD><EFBFBD>Ϣ
|
* mscDev 获取 input.msc设备信息
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* 0 <EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>
|
* 0 成功
|
||||||
* !0 <EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
|
* !0 失败
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
* <EFBFBD><EFBFBD>
|
* 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)
|
||||||
* mscDevAdd
|
* mscDevAdd
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
*
|
* 添加msc设备
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* mscDev <EFBFBD><EFBFBD> input. msc<EFBFBD>豸<EFBFBD><EFBFBD>Ϣ
|
* mscDev : input. msc设备信息
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* <EFBFBD><EFBFBD>
|
* None
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
* <EFBFBD><EFBFBD>
|
* 无
|
||||||
*
|
*
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -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; /* Ĭ<EFBFBD>Ͼ<EFBFBD><EFBFBD>ǿ<EFBFBD><EFBFBD>ƶ<EFBFBD><EFBFBD>豸 */
|
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)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD>Ƿ<EFBFBD><EFBFBD>ƶ<EFBFBD><EFBFBD>豸, <20><>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)
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* mscDev <EFBFBD><EFBFBD> input. msc<EFBFBD>豸<EFBFBD><EFBFBD>Ϣ
|
* mscDev : input. msc设备信息
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* <EFBFBD><EFBFBD>
|
* 无
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
* <EFBFBD><EFBFBD>
|
* 无
|
||||||
*
|
*
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -908,19 +911,20 @@ static void mscDevDel(__mscDev_t *mscDev)
|
||||||
* MediaChangeThread
|
* MediaChangeThread
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* <EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
* 媒体变化线程
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* p_arg <EFBFBD><EFBFBD> input. <EFBFBD><EFBFBD>mscDev, msc<EFBFBD>豸<EFBFBD><EFBFBD>Ϣ
|
* p_arg : input. 为mscDev, msc设备信息
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* <EFBFBD><EFBFBD>
|
* 无
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
* <EFBFBD><EFBFBD>
|
* 无
|
||||||
*
|
*
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
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)
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
//--<1>--ɱ<EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
//--<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)
|
||||||
* mscDevScanThread
|
* mscDevScanThread
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* mscDevɨ<EFBFBD><EFBFBD>
|
* mscDev扫描
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* p_arg <EFBFBD><EFBFBD> input. <EFBFBD><EFBFBD>mscDev, msc<EFBFBD>豸<EFBFBD><EFBFBD>Ϣ
|
* p_arg : input. 指向mscDev, msc设备信息
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* <EFBFBD><EFBFBD>
|
* 无
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
* <EFBFBD><EFBFBD>
|
* 无
|
||||||
*
|
*
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -985,18 +989,18 @@ static void mscDevScanThread(void *p_arg)
|
||||||
* QueueCmnd
|
* QueueCmnd
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Lun
|
* 将命令队列提交到Lun
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* mscLun <EFBFBD><EFBFBD> input. <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD>Lun
|
* mscLun : input. 对应的Lun
|
||||||
* scsi_cmnd : input. <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* scsi_cmnd : input. 命令
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* 0 <EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>
|
* 0 成功
|
||||||
* !0 <EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
|
* !0 失败
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
* <EFBFBD><EFBFBD>
|
* 无
|
||||||
*
|
*
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -1056,18 +1060,18 @@ int mscDevQueueCmnd(__mscLun_t *mscLun, __ScsiCmnd_t *ScsiCmnd)
|
||||||
* mscCmndDone
|
* mscCmndDone
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥ<EFBFBD><EFBFBD><EFBFBD>ط<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* 处理命令完成后的回调函数
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* mscLun <EFBFBD><EFBFBD> input. <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD>Lun
|
* mscLun : input. 对应的Lun
|
||||||
* scsi_cmnd : input. <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* scsi_cmnd : input. 命令
|
||||||
* TransStatus : input. <EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
* TransStatus : input. 数据传输状态
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* <EFBFBD><EFBFBD>
|
* 无
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
* <EFBFBD><EFBFBD>
|
* 无
|
||||||
*
|
*
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -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);
|
||||||
/* <20><>ʹ<EFBFBD><CAB9><EFBFBD><EFBFBD>ִ<EFBFBD>ж<EFBFBD><D0B6>ʧ<EFBFBD><CAA7>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>, <20><>Ϊ<EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD>ܲ<EFBFBD>֧<EFBFBD><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
/* 不要使用异步执行操作,因为设备可能不支持并且可能会导致失败 */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1132,16 +1136,16 @@ static void mscCmndDone(__mscDev_t *mscDev, __ScsiCmnd_t *ScsiCmnd, int TransSta
|
||||||
* mscMainThread
|
* mscMainThread
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* <EFBFBD><EFBFBD><EFBFBD>̣߳<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĵ<EFBFBD><EFBFBD><EFBFBD>
|
* 线程函数,控制整个系统运行。
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* p_arg <EFBFBD><EFBFBD> input. <EFBFBD><EFBFBD>mscDev, msc<EFBFBD>豸<EFBFBD><EFBFBD>Ϣ
|
* p_arg -- input. 对象指针,mscDev, msc设备信息。
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* <EFBFBD><EFBFBD>
|
* 无
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
* <EFBFBD><EFBFBD>
|
* 无
|
||||||
*
|
*
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -1155,17 +1159,17 @@ static void mscMainThread(void *p_arg)
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
//--<1>--ɱ<EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>
|
//--<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<EFBFBD><EFBFBD>cmd<EFBFBD>ӵ<EFBFBD>cmd_list<EFBFBD><EFBFBD><EFBFBD>պ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>mscMainThread<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* 如果mscDevQueueCmnd的cmd加入了cmd_list队列就会唤醒mscMainThread线程去执行,
|
||||||
* forѭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>cmd_list<EFBFBD><EFBFBD><EFBFBD>վͻ<EFBFBD>ȥִ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ִ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϻ<EFBFBD>cmd_list<EFBFBD><EFBFBD><EFBFBD>ˡ<EFBFBD>
|
* for循环从cmd_list取出一个cmd执行完再继续取下一个。
|
||||||
* <EFBFBD><EFBFBD>ʱUsbThreadWakeUp<EFBFBD><EFBFBD><EFBFBD><EFBFBD>mscMainThread<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>cmd_list<EFBFBD>Ѿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˡ<EFBFBD>
|
* 所以UsbThreadWakeUp函数用于将mscMainThread线程唤醒,去执行已经加入到cmd_list的cmd。
|
||||||
*/
|
*/
|
||||||
if (usb_list_empty(&(mscDev->cmd_list)))
|
if (usb_list_empty(&(mscDev->cmd_list)))
|
||||||
{
|
{
|
||||||
hal_log_err("Wrn: mscDev cmd_list is empty");
|
hal_log_err("Wrn: mscDev cmd_list is empty");
|
||||||
|
@ -1209,18 +1213,18 @@ static void mscMainThread(void *p_arg)
|
||||||
* mscDevProbe
|
* mscDevProbe
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD>
|
* 设备探测函数
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* intf <EFBFBD><EFBFBD> input. USB<EFBFBD>ӿ<EFBFBD><EFBFBD><EFBFBD>Ϣ
|
* intf : input. USB接口信息
|
||||||
* table_item : input. ƥ<EFBFBD><EFBFBD><EFBFBD>
|
* table_item : input. 匹配项
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* 0 <EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>
|
* 0 成功
|
||||||
* !0 <EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
|
* !0 失败
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
* <EFBFBD><EFBFBD>
|
* 备注
|
||||||
*
|
*
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -1240,9 +1244,9 @@ static int32_t mscDevProbe(struct usb_interface *intf, const struct usb_drv_dev_
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
// <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>mscDev
|
// 初始化mscDev
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
/* <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>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_
|
||||||
}
|
}
|
||||||
|
|
||||||
GetDeviceInfo(mscDev, match_table_index);
|
GetDeviceInfo(mscDev, match_table_index);
|
||||||
/* <EFBFBD><EFBFBD><EFBFBD>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_
|
||||||
goto error2;
|
goto error2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* <EFBFBD><EFBFBD><EFBFBD>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_
|
||||||
goto error3;
|
goto error3;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD> */
|
/* 创建管道 */
|
||||||
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_
|
||||||
goto error4;
|
goto error4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
// ʶ<><CAB6>mscDev
|
//识别mscDev
|
||||||
//----------------------------------------------------------------
|
//----------------------------------------------------------------
|
||||||
SetMscDevState(mscDev, MSC_DEV_ONLINE);
|
SetMscDevState(mscDev, MSC_DEV_ONLINE);
|
||||||
/* <EFBFBD><EFBFBD><EFBFBD>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:
|
||||||
* mscDevSuspend
|
* mscDevSuspend
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>豸
|
* 挂起设备
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* intf <EFBFBD><EFBFBD> input. USB<EFBFBD>ӿ<EFBFBD><EFBFBD><EFBFBD>Ϣ
|
* intf : input. USB接口信息
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* 0 <EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>
|
* 0 成功
|
||||||
* !0 <EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
|
* !0 失败
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
* <EFBFBD><EFBFBD>
|
* 无
|
||||||
*
|
*
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -1413,17 +1418,17 @@ static int32_t mscDevSuspend(struct usb_interface *intf)
|
||||||
* mscDevRemove
|
* mscDevRemove
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* msc<EFBFBD>豸<EFBFBD>Ƴ<EFBFBD>
|
* msc设备移除
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* intf <EFBFBD><EFBFBD> input. USB<EFBFBD>ӿ<EFBFBD><EFBFBD><EFBFBD>Ϣ
|
* intf : input. USB接口信息
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* 0 <EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>
|
* 0 成功
|
||||||
* !0 <EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
|
* !0 失败
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
* <EFBFBD><EFBFBD>
|
* 无
|
||||||
*
|
*
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -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");
|
||||||
/* ֹͣ<EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
/* 停止当前传输 */
|
||||||
mscDev->StopTransport(mscDev);
|
mscDev->StopTransport(mscDev);
|
||||||
/* <EFBFBD>Ͽ<EFBFBD>mscDev<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>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)
|
||||||
hal_sem_delete(mscDev->ThreadSemi);
|
hal_sem_delete(mscDev->ThreadSemi);
|
||||||
mscDev->ThreadSemi = NULL;
|
mscDev->ThreadSemi = NULL;
|
||||||
}
|
}
|
||||||
/* <EFBFBD>ͷ<EFBFBD>mscDev<EFBFBD><EFBFBD>Դ */
|
/* 释放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)
|
||||||
* mscDrv_init
|
* mscDrv_init
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* msc<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>
|
* msc驱动初始化
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* drv <EFBFBD><EFBFBD> input. msc<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* drv 为input.msc驱动
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* 0 <EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>
|
* 0 成功
|
||||||
* !0 <EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
|
* !0 失败
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
* <EFBFBD><EFBFBD>
|
*
|
||||||
*
|
*
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -1511,16 +1516,16 @@ static int mscDrvInit(struct usb_host_func_drv *drv)
|
||||||
* scsi_bus_drv_reg
|
* scsi_bus_drv_reg
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* <EFBFBD><EFBFBD>scsi<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* SCSI总线驱动注册函数
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* drv : input. <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* drv : input. 驱动
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* EPDK_OK / EPDK_FAIL
|
* EPDK_OK / EPDK_FAIL
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
* <EFBFBD><EFBFBD>
|
* 无
|
||||||
*
|
*
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
@ -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();
|
||||||
/* <EFBFBD><EFBFBD><EFBFBD>ݿͻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD>ӳdisk<EFBFBD><EFBFBD>״̬, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǹ<EFBFBD><C7B9><EFBFBD>disk<73><6B>״̬ */
|
/* 数据库客户端需要映射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)
|
||||||
* scsi_bus_drv_reg
|
* scsi_bus_drv_reg
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* <EFBFBD><EFBFBD>scsi<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* SCSI总线驱动注册
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* drv : input. <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
* drv : input. 驱动
|
||||||
*
|
*
|
||||||
* Return value:
|
* Return value:
|
||||||
* EPDK_OK / EPDK_FAIL
|
* EPDK_OK / EPDK_FAIL
|
||||||
*
|
*
|
||||||
* note:
|
* note:
|
||||||
* <EFBFBD><EFBFBD>
|
* 无
|
||||||
*
|
*
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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 Ӧ<EFBFBD>ô<EFBFBD><EFBFBD><EFBFBD> pack
|
} PARTITION; // 64 bytes 应该使用 pack
|
||||||
|
|
||||||
// mbr information
|
// mbr information
|
||||||
typedef struct tag_MBR
|
typedef struct tag_MBR
|
||||||
|
|
Loading…
Reference in New Issue