本文整理汇总了C++中osal_strlen函数的典型用法代码示例。如果您正苦于以下问题:C++ osal_strlen函数的具体用法?C++ osal_strlen怎么用?C++ osal_strlen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了osal_strlen函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WMT_read
ssize_t WMT_read(struct file *filp, char __user *buf, size_t count, loff_t *f_pos)
{
INT32 iRet = 0;
PUINT8 pCmd = NULL;
UINT32 cmdLen = 0;
pCmd = wmt_lib_get_cmd();
if (pCmd != NULL) {
cmdLen = osal_strlen(pCmd) < NAME_MAX ? osal_strlen(pCmd) : NAME_MAX;
WMT_DBG_FUNC("cmd str(%s)\n", pCmd);
if (copy_to_user(buf, pCmd, cmdLen)) {
iRet = -EFAULT;
} else {
iRet = cmdLen;
}
}
#if 0
if (test_and_clear_bit(WMT_STAT_CMD, &pWmtDevCtx->state)) {
iRet = osal_strlen(localBuf) < NAME_MAX ? osal_strlen(localBuf) : NAME_MAX;
/* we got something from STP driver */
WMT_DBG_FUNC("copy cmd to user by read:%s\n", localBuf);
if (copy_to_user(buf, localBuf, iRet)) {
iRet = -EFAULT;
goto read_done;
}
}
#endif
return iRet;
}
示例2: wmt_dev_is_file_exist
MTK_WCN_BOOL wmt_dev_is_file_exist(PUINT8 pFileName)
{
struct file *fd = NULL;
/* ssize_t iRet; */
INT32 fileLen = -1;
const struct cred *cred = get_current_cred();
if (pFileName == NULL) {
WMT_ERR_FUNC("invalid file name pointer(%p)\n", pFileName);
return MTK_WCN_BOOL_FALSE;
}
if (osal_strlen(pFileName) < osal_strlen(defaultPatchName)) {
WMT_ERR_FUNC("invalid file name(%s)\n", pFileName);
return MTK_WCN_BOOL_FALSE;
}
/* struct cred *cred = get_task_cred(current); */
fd = filp_open(pFileName, O_RDONLY, 0);
if (!fd || IS_ERR(fd) || !fd->f_op || !fd->f_op->read) {
WMT_ERR_FUNC("failed to open or read(%s)!(0x%p, %d, %d)\n", pFileName, fd,
cred->fsuid, cred->fsgid);
return MTK_WCN_BOOL_FALSE;
}
fileLen = fd->f_path.dentry->d_inode->i_size;
filp_close(fd, NULL);
fd = NULL;
if (fileLen <= 0) {
WMT_ERR_FUNC("invalid file(%s), length(%d)\n", pFileName, fileLen);
return MTK_WCN_BOOL_FALSE;
}
WMT_ERR_FUNC("valid file(%s), length(%d)\n", pFileName, fileLen);
return true;
}
示例3: HalLcdWriteStringValueValue
/**************************************************************************************************
* @fn HalLcdWriteStringValue
*
* @brief Write a string followed by a value to the LCD
*
* @param title - Title that will be displayed before the value
* value1 - value #1
* format1 - redix of value #1
* value2 - value #2
* format2 - redix of value #2
* line - line number
*
* @return None
**************************************************************************************************/
void HalLcdWriteStringValueValue( char *title, uint16 value1, uint8 format1,
uint16 value2, uint8 format2, uint8 line )
{
#if (HAL_LCD == TRUE)
uint8 tmpLen;
uint8 buf[LCD_MAX_BUF];
uint32 err;
tmpLen = (uint8)osal_strlen( (char*)title );
if ( tmpLen )
{
osal_memcpy( buf, title, tmpLen );
buf[tmpLen++] = ' ';
}
err = (uint32)(value1);
_ltoa( err, &buf[tmpLen], format1 );
tmpLen = (uint8)osal_strlen( (char*)buf );
buf[tmpLen++] = ',';
buf[tmpLen++] = ' ';
err = (uint32)(value2);
_ltoa( err, &buf[tmpLen], format2 );
HalLcdWriteString( (char *)buf, line );
#endif
}
示例4: HalLcdWriteString
/**************************************************************************************************
* @fn HalLcdWriteString
*
* @brief Write a string to the LCD
*
* @param str - pointer to the string that will be displayed
* option - display options
*
* @return None
**************************************************************************************************/
void HalLcdWriteString ( char *str, uint8 option)
{
#if (HAL_LCD == TRUE)
uint8 strLen = 0;
uint8 totalLen = 0;
uint8 *buf;
uint8 tmpLen;
if ( Lcd_Line1 == NULL )
{
Lcd_Line1 = osal_mem_alloc( HAL_LCD_MAX_CHARS+1 );
HalLcdWriteString( "TexasInstruments", 1 );
}
strLen = (uint8)osal_strlen( (char*)str );
/* Check boundries */
if ( strLen > HAL_LCD_MAX_CHARS )
strLen = HAL_LCD_MAX_CHARS;
if ( option == HAL_LCD_LINE_1 )
{
/* Line 1 gets saved for later */
osal_memcpy( Lcd_Line1, str, strLen );
Lcd_Line1[strLen] = '\0';
}
else
{
/* Line 2 triggers action */
tmpLen = (uint8)osal_strlen( (char*)Lcd_Line1 );
totalLen = tmpLen + 1 + strLen + 1;
buf = osal_mem_alloc( totalLen );
if ( buf != NULL )
{
/* Concatenate strings */
osal_memcpy( buf, Lcd_Line1, tmpLen );
buf[tmpLen++] = ' ';
osal_memcpy( &buf[tmpLen], str, strLen );
buf[tmpLen+strLen] = '\0';
/* Send it out */
#if defined (ZTOOL_P1) || defined (ZTOOL_P2)
debug_str( (uint8*)buf );
#endif //ZTOOL_P1
/* Free mem */
osal_mem_free( buf );
}
}
/* Display the string */
HalLcd_HW_WriteLine (option, str);
#endif //HAL_LCD
}
示例5: zb_ReceiveDataIndication
void zb_ReceiveDataIndication( uint16 source, uint16 command, uint16 len, uint8 *pData )
{
uint8 buf[32];
uint8 *pBuf;
uint8 tmpLen;
uint8 sensorReading;
if (command == SENSOR_REPORT_CMD_ID)
{
// Received report from a sensor
sensorReading = pData[1];
// If tool available, write to serial port
tmpLen = (uint8)osal_strlen( (char*)strDevice );
pBuf = osal_memcpy( buf, strDevice, tmpLen );
_ltoa( source, pBuf, 16 );
pBuf += 4;
*pBuf++ = ' ';
if ( pData[0] == BATTERY_REPORT )
{
tmpLen = (uint8)osal_strlen( (char*)strBattery );
pBuf = osal_memcpy( pBuf, strBattery, tmpLen );
*pBuf++ = (sensorReading / 10 ) + '0'; // convent msb to ascii
*pBuf++ = '.'; // decimal point ( battery reading is in units of 0.1 V
*pBuf++ = (sensorReading % 10 ) + '0'; // convert lsb to ascii
*pBuf++ = ' ';
*pBuf++ = 'V';
}
else
{
tmpLen = (uint8)osal_strlen( (char*)strTemp );
pBuf = osal_memcpy( pBuf, strTemp, tmpLen );
*pBuf++ = (sensorReading / 10 ) + '0'; // convent msb to ascii
*pBuf++ = (sensorReading % 10 ) + '0'; // convert lsb to ascii
*pBuf++ = ' ';
*pBuf++ = 'C';
}
*pBuf++ = '\r';
*pBuf++ = '\n';
*pBuf = '\0';
#if defined( MT_TASK )
debug_str( (uint8 *)buf );
#endif
// can also write directly to uart
}
}
示例6: wcn_core_dump_flush
/* wcn_core_dump_flush - Fulsh dump data and reset core dump sys
*
* Retunr 0 if success, else error code
*/
INT32 wcn_core_dump_flush(INT32 rst)
{
PUINT8 pbuf = NULL;
INT32 len = 0;
INT32 ret = 0;
if (!g_core_dump) {
STP_DBG_ERR_FUNC("invalid pointer!\n");
return -1;
}
wcn_core_dump_out(g_core_dump, &pbuf, &len);
STP_DBG_INFO_FUNC("buf 0x%08x, len %d\n", (unsigned int)pbuf, len);
// show coredump end info on UI
//osal_dbg_assert_aee("MT662x f/w coredump end", "MT662x firmware coredump ends");
#if WMT_PLAT_ALPS
aee_kernel_dal_show("MT662x coredump end\n");
ret = stp_dbg_set_fw_info(pbuf, 512, STP_FW_ASSERT_ISSUE);
if (ret) {
STP_DBG_ERR_FUNC("set fw issue infor fail(%d),maybe fw warm reset...\n", ret);
stp_dbg_set_fw_info("Fw Warm reset", osal_strlen("Fw Warm reset"), STP_FW_WARM_RST_ISSUE);
}
// call AEE driver API
aed_combo_exception(NULL, 0, (const int*)pbuf, len, (const char*)g_core_dump->info);
#endif
// reset
wcn_core_dump_reset(g_core_dump, STP_CORE_DUMP_TIMEOUT);
return 0;
}
示例7: ParkWay_SendTheMessage
//This function send the status of own park to the coordinator
static void ParkWay_SendTheMessage( void )
{
uint8 pData[6];
pData[0] = 'E';
pData[1] = 'D';
pData[2] = DEVICE_PW_1;
pData[3] = DEVICE_PW_2;
pData[4] = '-';
pData[5] = vaga;
//Send data to the coordinator ADDRESS(0000)
if ( AF_DataRequest( &ParkWay_DstAddr, &ParkWay_epDesc,
ParkWay_CLUSTERID,
(byte)osal_strlen( pData ) + 1,
(byte *)&pData,
&ParkWay_TransID,
AF_DISCV_ROUTE, AF_DEFAULT_RADIUS ) == afStatus_SUCCESS )
{
// Successfully requested to be sent.
}
else
{
osal_stop_timerEx( ParkWay_TaskID,
ParkWay_SEND_MSG_EVT);
osal_start_timerEx( ParkWay_TaskID,
POLLING_OF_DEV_EVT,
200);
}
}
示例8: _stp_trigger_firmware_assert_via_emi
INT32 _stp_trigger_firmware_assert_via_emi(VOID)
{
INT32 status = -1;
INT32 j = 0;
wmt_plat_force_trigger_assert(STP_FORCE_TRG_ASSERT_DEBUG_PIN);
do {
if(0 != mtk_wcn_stp_coredump_start_get()){
status = 0;
break;
}
stp_dbg_poll_cpupcr(5 , 1 , 1);
stp_dbg_poll_dmaregs(5 , 1);
j++;
STP_BTM_INFO_FUNC("Wait for assert message (%d)\n", j);
osal_sleep_ms(20);
if(j > 49) { /* wait for 1 second*/
stp_dbg_set_fw_info("host trigger fw assert timeout",
osal_strlen("host trigger fw assert timeout"),STP_HOST_TRIGGER_ASSERT_TIMEOUT);
wcn_core_dump_timeout();/* trigger collect SYS_FTRACE*/
break;
}
} while(1);
return status;
}
示例9: wmt_conf_parse_int
static int wmt_conf_parse_int(P_DEV_WMT pWmtDev, const struct parse_data *data, const PINT8 pos)
{
PUINT32 dst;
long res;
int ret;
dst = (PINT32) (((PUINT8) pWmtDev) + (long)data->param1);
/* WMT_INFO_FUNC(">strlen(pos)=%d\n", strlen(pos)); */
if ((osal_strlen(pos) > 2) && ((*pos) == '0') && (*(pos + 1) == 'x')) {
ret = osal_strtol(pos + 2, 16, &res);
if (ret)
WMT_ERR_FUNC("fail(%d)\n", ret);
*dst = res;
WMT_DBG_FUNC("wmtcfg==> %s=0x%x\n", data->name, *dst);
} else {
ret = osal_strtol(pos, 10, &res);
if (ret)
WMT_ERR_FUNC("fail(%d)\n", ret);
*dst = res;
WMT_DBG_FUNC("wmtcfg==> %s=%d\n", data->name, *dst);
}
return 0;
}
示例10: debug_str
/*********************************************************************
* @fn debug_str
*
* @brief
*
* This feature allows modules to display a debug text string as
* applications execute in real-time. This feature will output to
* the serial port for display in the Z-Test tool.
*
* This feature will most likely be compiled out in the production
* code in order to save code space.
*
* @param byte *str_ptr - pointer to null-terminated string
*
* @return void
*/
void debug_str( byte *str_ptr )
{
mtDebugStr_t *msg;
byte mln;
byte strLen;
// Text string length
strLen = (byte)osal_strlen( (void*)str_ptr );
// Debug string message length
mln = sizeof ( mtDebugStr_t ) + strLen;
// Get a message buffer to build the debug message
msg = (mtDebugStr_t *)osal_msg_allocate( mln );
if ( msg )
{
// Message type, length
msg->hdr.event = CMD_DEBUG_STR;
msg->strLen = strLen;
// Append message, no terminator
msg->pString = (uint8 *)(msg+1);
osal_memcpy ( msg->pString, str_ptr, strLen );
osal_msg_send( MT_TaskID, (uint8 *)msg );
}
} // debug_str()
示例11: performPeriodicTask
static void performPeriodicTask( void )
{
//static bool a = true;
//a = !a;
//HalLedSet(HAL_LED_1,a);
#if 0
char strTemp[35] = {0};
sprintf(strTemp, "led1 = %d\r\n",a);
NPI_WriteTransport((uint8*)strTemp, osal_strlen(strTemp));
#endif
if ( simpleBLEState == BLE_STATE_CONNECTED && simpleBLEProcedureInProgress == FALSE )
{
uint8 status;
attReadReq_t req;
req.handle = simpleBLECharHdl;
status = GATT_ReadCharValue( simpleBLEConnHandle, &req, simpleBLETaskId );
#if 0
sprintf(strTemp, "read status = %d\r\n",status);
NPI_WriteTransport((uint8*)strTemp, osal_strlen(strTemp));
#endif
}
#if 0
uint8 valueToCopy;
uint8 stat;
// Call to retrieve the value of the third characteristic in the profile
stat = SimpleProfile_GetParameter( SIMPLEPROFILE_CHAR3, &valueToCopy);
if( stat == SUCCESS )
{
/*
* Call to set that value of the fourth characteristic in the profile. Note
* that if notifications of the fourth characteristic have been enabled by
* a GATT client device, then a notification will be sent every time this
* function is called.
*/
SimpleProfile_SetParameter( SIMPLEPROFILE_CHAR4, sizeof(uint8), &valueToCopy);
}
#endif
}
示例12: wmt_conf_set_cfg_file
INT32 wmt_conf_set_cfg_file(const char *name)
{
if (NULL == name) {
WMT_ERR_FUNC("name is NULL\n");
return -1;
}
if (osal_strlen(name) >= osal_sizeof(gDevWmt.cWmtcfgName)) {
WMT_ERR_FUNC("name is too long, length=%d, expect to < %d\n", osal_strlen(name),
osal_sizeof(gDevWmt.cWmtcfgName));
return -2;
}
osal_memset(&gDevWmt.cWmtcfgName[0], 0, osal_sizeof(gDevWmt.cWmtcfgName));
osal_strcpy(&(gDevWmt.cWmtcfgName[0]), name);
WMT_ERR_FUNC("WMT config file is set to (%s)\n", &(gDevWmt.cWmtcfgName[0]));
return 0;
}
示例13: wmt_conf_read_file
INT32 wmt_conf_read_file(VOID)
{
INT32 ret = -1;
osal_memset(&gDevWmt.rWmtGenConf, 0, osal_sizeof(gDevWmt.rWmtGenConf));
osal_memset(&gDevWmt.pWmtCfg, 0, osal_sizeof(gDevWmt.pWmtCfg));
#if 1
osal_memset(&gDevWmt.cWmtcfgName[0], 0, osal_sizeof(gDevWmt.cWmtcfgName));
osal_strncat(&(gDevWmt.cWmtcfgName[0]), CUST_CFG_WMT_PREFIX, osal_sizeof(CUST_CFG_WMT_PREFIX));
osal_strncat(&(gDevWmt.cWmtcfgName[0]), CUST_CFG_WMT, osal_sizeof(CUST_CFG_WMT));
#endif
if (!osal_strlen(&(gDevWmt.cWmtcfgName[0]))) {
WMT_ERR_FUNC("empty Wmtcfg name\n");
osal_assert(0);
return ret;
}
WMT_INFO_FUNC("WMT config file:%s\n", &(gDevWmt.cWmtcfgName[0]));
if (0 == wmt_dev_patch_get(&gDevWmt.cWmtcfgName[0], (osal_firmware **) &gDevWmt.pWmtCfg, 0)) {
/*get full name patch success */
WMT_INFO_FUNC("get full file name(%s) buf(0x%p) size(%d)\n",
&gDevWmt.cWmtcfgName[0], gDevWmt.pWmtCfg->data, gDevWmt.pWmtCfg->size);
if (0 == wmt_conf_parse(&gDevWmt, (const PINT8)gDevWmt.pWmtCfg->data, gDevWmt.pWmtCfg->size)) {
/*config file exists */
gDevWmt.rWmtGenConf.cfgExist = 1;
WMT_INFO_FUNC("&gDevWmt.rWmtGenConf=%p\n", &gDevWmt.rWmtGenConf);
ret = 0;
} else {
WMT_ERR_FUNC("wmt conf parsing fail\n");
osal_assert(0);
ret = -1;
}
wmt_dev_patch_put((osal_firmware **) &gDevWmt.pWmtCfg);
/*
if (gDevWmt.pWmtCfg)
{
if (gDevWmt.pWmtCfg->data)
{
osal_free(gDevWmt.pWmtCfg->data);
}
osal_free(gDevWmt.pWmtCfg);
gDevWmt.pWmtCfg = 0;
}
*/
return ret;
} else {
WMT_ERR_FUNC("read %s file fails\n", &(gDevWmt.cWmtcfgName[0]));
osal_assert(0);
gDevWmt.rWmtGenConf.cfgExist = 0;
return ret;
}
}
示例14: hifsdiod_start
INT32 hifsdiod_start(void)
{
int iRet = -1;
init_waitqueue_head(&gHifsdiodEvent);
#if 0
osal_event_init(&gHifsdiodEvent);
gConIdQueryThread.pThreadData = (VOID *)NULL;
gConIdQueryThread.pThreadFunc = (VOID *)hif_sdio_proc;
osal_memcpy(gConIdQueryThread.threadName, gConIdQueryName , osal_strlen(gConIdQueryName));
iRet = osal_thread_create(&gConIdQueryThread);
if (iRet < 0)
{
HIF_SDIO_ERR_FUNC("osal_thread_create fail...\n");
goto ERR_EXIT1;
}
#else
gConIdQueryThread = kthread_create(hif_sdio_proc, NULL, gConIdQueryName);
if (NULL == gConIdQueryThread)
{
HIF_SDIO_ERR_FUNC("osal_thread_create fail...\n");
goto ERR_EXIT1;
}
#endif
#if 0
/* Start STPd thread*/
iRet = osal_thread_run(&gConIdQueryThread);
if(iRet < 0)
{
HIF_SDIO_ERR_FUNC("osal_thread_run FAILS\n");
goto ERR_EXIT1;
}
#else
if (gConIdQueryThread) {
wake_up_process(gConIdQueryThread);
}
else
{
goto ERR_EXIT1;
}
#endif
iRet = 0;
HIF_SDIO_INFO_FUNC("succeed\n");
return iRet;
ERR_EXIT1:
HIF_SDIO_ERR_FUNC("failed\n");
return iRet;
}
示例15: NPI_PrintValue
/*
打印指定的格式的数值
参数
title,前缀字符串
value,需要显示的数值
format,需要显示的进制,十进制为10,十六进制为16
*/
void NPI_PrintValue(char *title, uint16 value, uint8 format)
{
uint8 tmpLen;
uint8 buf[128];
uint32 err;
tmpLen = (uint8)osal_strlen( (char*)title );
osal_memcpy( buf, title, tmpLen );
buf[tmpLen] = ' ';
err = (uint32)(value);
_ltoa( err, &buf[tmpLen+1], format );
NPI_PrintString(buf);
}