微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI蓝牙设计交流 > cc2640r2,运行到osal_memcpy这个函数程序就跑飞了。

cc2640r2,运行到osal_memcpy这个函数程序就跑飞了。

时间:10-02 整理:3721RD 点击:
我想要从SIMPLEPROFILE_CHAR4发送数据,但是发现程序执行到osal_memcpy这一句就停了,是我的参数不对吗?

unsigned char A_TX_DATA[12]; 
.
.
.
GetData(A_TX_DATA);
SimpleProfile_SetParameter(SIMPLEPROFILE_CHAR4, 12,A_TX_DATA);
.
.
.
bStatus_t SimpleProfile_SetParameter( uint8 param, uint8 len, void *value )
{
  bStatus_t ret = SUCCESS;
  switch ( param )
  {
.
.
.
case SIMPLEPROFILE_CHAR4:
      if ( len == sizeof ( uint8 ) )
      {
        simpleProfileChar4 = *((uint8*)value);

        // See if Notification has been enabled
        GATTServApp_ProcessCharCfg( simpleProfileChar4Config, &simpleProfileChar4, FALSE,
                                    simpleProfileAttrTbl, GATT_NUM_ATTRS( simpleProfileAttrTbl ),
                                    INVALID_TASK_ID, simpleProfile_ReadAttrCB );
      }
      else if(len == 12)
      {
          uint8 client_gate_open;
          uint16 notify_Handle;
          GAPRole_GetParameter(0x30E,&notify_Handle);
          
          client_gate_open = GATTServApp_ReadCharCfg(notify_Handle,simpleProfileChar4Config);
          if(client_gate_open & GATT_CLIENT_CFG_NOTIFY)
          {
            static attHandleValueNoti_t pReport;
            pReport.handle = simpleProfileAttrTbl[11].handle;
            pReport.len = len;
           osal_memcpy( pReport.pValue,(uint8 *)value,len);
            GATT_Notification(notify_Handle,&pReport,FALSE);
           }
      }
 
 

哎哟,格式没搞好。

已解决,因为这个版本的attHandleValueNoti_t结构体不一样,需要先分配空间,加上GATT_bm_alloc这个函数分配空间就好了。

pReport.handle = simpleProfileAttrTbl[11].handle;
pReport.len = len;
pReport.pValue = GATT_bm_alloc(notify_Handle, ATT_HANDLE_VALUE_NOTI, len, NULL);
osal_memcpy( pReport.pValue,value,len);

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top