コード例 #1
0
int test_timer_slice(void)
{
	u32 low=0,high=0;
	if(mdrv_timer_get_accuracy_timestamp(&high,&low))
		return -1;
	else{
		hardtimer_print_error("low =0x%x\n",low);
		hardtimer_print_error("high =0x%x\n",high);
	}
	return 0;
}
コード例 #2
0
ssize_t DMS_ReadGetSliceFile(
    struct file                        *file,
    char __user                        *buf,
    size_t                              len,
    loff_t                             *ppos
)
{
    VOS_CHAR                            acModeTemp[DMS_GET_SLICE_FILE_LEN];
    VOS_UINT32                          ulLength;
    VOS_UINT32                          ulHigh32bitValue;
    VOS_UINT32                          ulLow32bitValue;

    if (*ppos > 0)
    {
        return 0;
    }

    /* 初始化 */
    ulLength            = 0;
    ulHigh32bitValue    = 0;
    ulLow32bitValue     = 0;

    VOS_MemSet(acModeTemp, 0x00, DMS_GET_SLICE_FILE_LEN);

    /* 获取时间  Seattle 和 Portland不一样 */
    mdrv_timer_get_accuracy_timestamp(&ulHigh32bitValue, &ulLow32bitValue);

    if (ulHigh32bitValue != 0)
    {
        VOS_sprintf((VOS_CHAR *)acModeTemp, "%x%08x", ulHigh32bitValue, ulLow32bitValue);
    }
    else
    {
        VOS_sprintf((VOS_CHAR *)acModeTemp, "%x", ulLow32bitValue);
    }

    ulLength        = VOS_StrLen(acModeTemp);
    len             = PS_MIN(len, ulLength);

    /*拷贝内核空间数据到用户空间上面*/
    if (0 == copy_to_user(buf,(VOS_VOID *)acModeTemp, (VOS_ULONG)len))
    {
        *ppos += (loff_t)len;

        return (ssize_t)len;
    }
    else
    {
        return -EPERM;
    }

}