您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ C_ASSERT函数代码示例

51自学网 2021-06-01 20:08:39
  C++
这篇教程C++ C_ASSERT函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中C_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ C_ASSERT函数的具体用法?C++ C_ASSERT怎么用?C++ C_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了C_ASSERT函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: hk_app

SAT_returnState hk_app(tc_tm_pkt *pkt) {    if(!C_ASSERT(pkt != NULL && pkt->data != NULL) == true) { return SATR_ERROR; }    if(!C_ASSERT(pkt->ser_subtype == TC_HK_REPORT_PARAMETERS ||                 pkt->ser_subtype == TM_HK_PARAMETERS_REPORT) == true) {return SATR_ERROR; }    if(pkt->ser_subtype == TC_HK_REPORT_PARAMETERS) {        tc_tm_pkt *temp_pkt = 0;        HK_struct_id sid = (HK_struct_id)pkt->data[0];        hk_crt_empty_pkt_TM(&temp_pkt, (TC_TM_app_id)pkt->dest_id, sid);        if(!C_ASSERT(temp_pkt != NULL) == true) {            return SATR_ERROR;        }        route_pkt(temp_pkt);    } else if(pkt->ser_subtype == TM_HK_PARAMETERS_REPORT) {        const SAT_returnState res = hk_parameters_report(pkt->app_id, (HK_struct_id)pkt->data[0],  pkt->data, pkt->len);        if(res == SATR_OK) {            pkt->verification_state = SATR_OK;        }    }    return SATR_OK;}
开发者ID:nchronas,项目名称:ecss_services,代码行数:30,


示例2: GetImageInfoFromPEHeader

HRESULT GetImageInfoFromPEHeader( HANDLE hProcess, void* dllBase, uint16_t& machine, uint32_t& size, Address& prefBase ){    IMAGE_DOS_HEADER    dosHeader = { 0 };    SIZE_T              cActual = 0;    if ( !::ReadProcessMemory( hProcess, dllBase, &dosHeader, sizeof dosHeader, &cActual ) )     {        _ASSERT( !"Failed to read IMAGE_DOS_HEADER from loaded module" );        return GetLastHr();    }    IMAGE_NT_HEADERS    ntHeaders = { 0 };    void*               ntHeadersAddr = (void*) ((DWORD_PTR) dosHeader.e_lfanew + (DWORD_PTR) dllBase);        if ( !::ReadProcessMemory( hProcess, ntHeadersAddr, &ntHeaders, sizeof ntHeaders, &cActual ) )     {        _ASSERT( !"Failed to read IMAGE_NT_HEADERS from loaded module" );        return GetLastHr();    }    // These fields line up for 32 and 64-bit IMAGE_NT_HEADERS; make sure of it    // otherwise, we would have had to check fileHeader.Characteristics & IMAGE_FILE_32BIT_MACHINE    C_ASSERT( &((IMAGE_NT_HEADERS32*) 0)->OptionalHeader.SizeOfImage ==               &((IMAGE_NT_HEADERS64*) 0)->OptionalHeader.SizeOfImage );    C_ASSERT( &((IMAGE_NT_HEADERS32*) 0)->FileHeader.Machine ==               &((IMAGE_NT_HEADERS64*) 0)->FileHeader.Machine );    machine = ntHeaders.FileHeader.Machine;    size = ntHeaders.OptionalHeader.SizeOfImage;    prefBase = ntHeaders.OptionalHeader.ImageBase;    return S_OK;}
开发者ID:Kentorix,项目名称:MagoWrapper,代码行数:33,


示例3: seqiter_new

PmReturn_tseqiter_new(pPmObj_t pobj, pPmObj_t *r_pobj){    PmReturn_t retval;    uint8_t *pchunk;    pPmSeqIter_t psi;    C_ASSERT(pobj != C_NULL);    C_ASSERT(*r_pobj != C_NULL);    /* Raise a TypeError if pobj is not a sequence */    if ((OBJ_GET_TYPE(pobj) != OBJ_TYPE_STR)            && (OBJ_GET_TYPE(pobj) != OBJ_TYPE_TUP)            && (OBJ_GET_TYPE(pobj) != OBJ_TYPE_LST))    {        PM_RAISE(retval, PM_RET_EX_TYPE);        return retval;    }    /* Alloc a chunk for the sequence iterator obj */    retval = heap_getChunk(sizeof(PmSeqIter_t), &pchunk);    PM_RETURN_IF_ERROR(retval);    /* Set the sequence iterator's fields */    psi = (pPmSeqIter_t)pchunk;    OBJ_SET_TYPE(psi, OBJ_TYPE_SQI);    psi->si_sequence = pobj;    psi->si_index = 0;    *r_pobj = (pPmObj_t)psi;    return retval;}
开发者ID:rumjack,项目名称:megapython,代码行数:32,


示例4: seqiter_getNext

PmReturn_tseqiter_getNext(pPmObj_t pobj, pPmObj_t *r_pitem){    PmReturn_t retval;    int16_t length;    C_ASSERT(pobj != C_NULL);    C_ASSERT(*r_pitem != C_NULL);    C_ASSERT(OBJ_GET_TYPE(pobj) == OBJ_TYPE_SQI);    /*     * Raise TypeError if sequence iterator's object is not a sequence     * otherwise, the get sequence's length     */    retval = seq_getLength(((pPmSeqIter_t)pobj)->si_sequence, &length);    PM_RETURN_IF_ERROR(retval);    /* Raise StopIteration if at the end of the sequence */    if (((pPmSeqIter_t)pobj)->si_index == length)    {        /* Make null the pointer to the sequence */        ((pPmSeqIter_t)pobj)->si_sequence = C_NULL;        PM_RAISE(retval, PM_RET_EX_STOP);        return retval;    }    /* Get the item at the current index */    retval = seq_getSubscript(((pPmSeqIter_t)pobj)->si_sequence,                              ((pPmSeqIter_t)pobj)->si_index, r_pitem);    /* Increment the index */    ((pPmSeqIter_t)pobj)->si_index++;    return retval;}
开发者ID:rumjack,项目名称:megapython,代码行数:35,


示例5: DriverEntry

// driver entryNTSTATUS DriverEntry(__in PDRIVER_OBJECT pDriverObject,__in PUNICODE_STRING pRegPath){	PAGED_CODE();	C_ASSERT(sizeof(CHidData) == 0x6c);	C_ASSERT(sizeof(CDeviceExtension) == 0x200);	NTSTATUS statusRet = STATUS_SUCCESS;	AppleDebugPrint(DBGLEVEL_INFO,"Enter AppleKeyboard DriverEntry %p,%p/n",pDriverObject,pRegPath);	pDriverObject->MajorFunction[IRP_MJ_CREATE] = AppleKeyboardCreate;	pDriverObject->MajorFunction[IRP_MJ_CLOSE] = AppleKeyboardClose;	pDriverObject->MajorFunction[IRP_MJ_DEVICE_CONTROL] = AppleKeyboardIoControl;	pDriverObject->MajorFunction[IRP_MJ_INTERNAL_DEVICE_CONTROL] = AppleKeyboardInternalIoControl;	pDriverObject->MajorFunction[IRP_MJ_PNP] = AppleKeyboardPnp;	pDriverObject->MajorFunction[IRP_MJ_FLUSH_BUFFERS] = AppleKeyboardFlush;	pDriverObject->MajorFunction[IRP_MJ_POWER] = AppleKeyboardPower;	pDriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = AppleKeyboardSystemControl;	pDriverObject->DriverUnload = AppleKeyboardUnload;	pDriverObject->DriverExtension->AddDevice = AppleKeyboardAddDevice;	g_regPath.Length = pRegPath->Length;	g_regPath.MaximumLength = g_regPath.Length + sizeof(WCHAR);	g_regPath.Buffer = static_cast<PWCH>(ExAllocatePoolWithTag(PagedPool,g_regPath.MaximumLength,'Appl'));	if(g_regPath.Buffer)		RtlCopyMemory(g_regPath.Buffer,pRegPath->Buffer,pRegPath->Length);	else		statusRet = STATUS_INSUFFICIENT_RESOURCES;	AppleDebugPrint(DBGLEVEL_INFO,"Leave DriverEntry 0x%08x/n",statusRet);	return statusRet;}
开发者ID:killbug2004,项目名称:applebluetoothwirelesskeyboardhiddriverforwindows,代码行数:35,


示例6: float_print

PmReturn_tfloat_print(pPmObj_t pf){    uint8_t tBuffer[32];    uint8_t bytesWritten;    uint8_t i;    PmReturn_t retval = PM_RET_OK;    C_ASSERT(pf != C_NULL);    /* Raise TypeError if obj is not an float */    if (OBJ_GET_TYPE(pf) != OBJ_TYPE_FLT)    {        PM_RAISE(retval, PM_RET_EX_TYPE);        return retval;    }    /* #196: Changed to use snprintf */    bytesWritten = snprintf((char *)&tBuffer, 32, "%f", ((pPmFloat_t) pf)->val);    /* Sanity check */    C_ASSERT(bytesWritten != 0);    C_ASSERT(bytesWritten < sizeof(tBuffer));    for (i = (uint8_t)0; i < bytesWritten; i++)    {        retval = plat_putByte(tBuffer[i]);        PM_RETURN_IF_ERROR(retval);    }    return PM_RET_OK;}
开发者ID:01iv3r,项目名称:OpenPilot,代码行数:31,


示例7: UpdateCacheEntryAtomically

// Helper method for updating an interface dispatch cache entry atomically. See comments by the usage of// this method for the details of why we need this. If a racing update is detected false is returned and the// update abandoned. This is necessary since it's not safe to update a valid cache entry (one with a non-NULL// m_pInstanceType field) outside of a GC.static bool UpdateCacheEntryAtomically(InterfaceDispatchCacheEntry *pEntry,                                       EEType * pInstanceType,                                       void * pTargetCode){    C_ASSERT(sizeof(InterfaceDispatchCacheEntry) == (sizeof(void*) * 2));    C_ASSERT(offsetof(InterfaceDispatchCacheEntry, m_pInstanceType) < offsetof(InterfaceDispatchCacheEntry, m_pTargetCode));    return UpdatePointerPairAtomically(pEntry, pInstanceType, pTargetCode, true) == NULL;}
开发者ID:danmosemsft,项目名称:corert,代码行数:13,


示例8: C_ASSERT

staticint32_tIDNA_FlagsToICU(	DWORD dwFlags){	C_ASSERT(IDN_ALLOW_UNASSIGNED == UIDNA_ALLOW_UNASSIGNED);	C_ASSERT(IDN_USE_STD3_ASCII_RULES == UIDNA_USE_STD3_RULES);	return dwFlags;}
开发者ID:HBelusca,项目名称:NasuTek-Odyssey,代码行数:11,


示例9: thread_new

PmReturn_tthread_new(pPmObj_t pframe, pPmObj_t *r_pobj){    PmReturn_t retval = PM_RET_OK;    pPmThread_t pthread = C_NULL;    C_ASSERT(pframe != C_NULL);    /* If it's not a frame, raise TypeError */    if (OBJ_GET_TYPE(pframe) != OBJ_TYPE_FRM)    {        PM_RAISE(retval, PM_RET_EX_TYPE);        return retval;    }    /* Allocate a thread */    retval = heap_getChunk(sizeof(PmThread_t), (uint8_t **)r_pobj);    PM_RETURN_IF_ERROR(retval);    /* Set type, frame and initialize status */    pthread = (pPmThread_t)*r_pobj;    OBJ_SET_TYPE(pthread, OBJ_TYPE_THR);    pthread->pframe = (pPmFrame_t)pframe;    pthread->interpctrl = INTERP_CTRL_CONT;    return retval;}
开发者ID:BackupGGCode,项目名称:megapython,代码行数:27,


示例10: dict_clear

PmReturn_tdict_clear(pPmObj_t pdict){    PmReturn_t retval = PM_RET_OK;    C_ASSERT(pdict != C_NULL);    /* Raise TypeError if arg is not a dict */    if (OBJ_GET_TYPE(pdict) != OBJ_TYPE_DIC)    {        PM_RAISE(retval, PM_RET_EX_TYPE);        return retval;    }    /* clear length */    ((pPmDict_t)pdict)->length = 0;    /* Free the keys and values seglists if needed */    if (((pPmDict_t)pdict)->d_keys != C_NULL)    {        PM_RETURN_IF_ERROR(seglist_clear(((pPmDict_t)pdict)->d_keys));        PM_RETURN_IF_ERROR(heap_freeChunk((pPmObj_t)                                          ((pPmDict_t)pdict)->d_keys));        ((pPmDict_t)pdict)->d_keys = C_NULL;    }    if (((pPmDict_t)pdict)->d_vals != C_NULL)    {        PM_RETURN_IF_ERROR(seglist_clear(((pPmDict_t)pdict)->d_vals));        retval = heap_freeChunk((pPmObj_t)((pPmDict_t)pdict)->d_vals);        ((pPmDict_t)pdict)->d_vals = C_NULL;    }    return retval;}
开发者ID:AGM1968,项目名称:python-on-a-chip,代码行数:33,


示例11: rx_ecss

/** * This functions handles an incoming ECSS packet. * If the ECSS packet is part of a large data transfer consisting from * several sequential ECSS packets, it handles them automatically. * * In other words, there is no need to explicitly check for a fragmented data * transfer. * * @param payload the received payload * @param payload_size the size of the payload * @return SATR_OK if all went ok or appropriate error code */SAT_returnStaterx_ecss (uint8_t *payload, const uint16_t payload_size){  SAT_returnState ret;  tc_tm_pkt *pkt;  pkt = get_pkt (payload_size);  if (!C_ASSERT(pkt != NULL)) {    return SATR_ERROR;  }  if (unpack_pkt (payload, pkt, payload_size) == SATR_OK) {    ret = route_pkt (pkt);  }  TC_TM_app_id dest = 0;  if(pkt->type == TC) {    dest = pkt->app_id;  }  else if(pkt->type == TM) {    dest = pkt->dest_id;  }  if(dest == SYSTEM_APP_ID) {      free_pkt(pkt);  }  return ret;}
开发者ID:mashua,项目名称:ecss_services,代码行数:42,


示例12: pm_vmPeriodic

/* Warning: Can be called in interrupt context! */PmReturn_tpm_vmPeriodic(uint16_t usecsSinceLastCall){    /*     * Add the full milliseconds to pm_timerMsTicks and store additional     * microseconds for the next run. Thus, usecsSinceLastCall must be     * less than 2^16-1000 so it will not overflow usecResidual.     */    static uint16_t usecResidual = 0;    C_ASSERT(usecsSinceLastCall < 64536);    usecResidual += usecsSinceLastCall;    while (usecResidual >= 1000)    {        usecResidual -= 1000;        pm_timerMsTicks++;    }    /* Check if enough time has passed for a scheduler run */    if ((pm_timerMsTicks - pm_lastRescheduleTimestamp)        >= PM_THREAD_TIMESLICE_MS)    {        interp_setRescheduleFlag((uint8_t)1);        pm_lastRescheduleTimestamp = pm_timerMsTicks;    }    return PM_RET_OK;}
开发者ID:01iv3r,项目名称:OpenPilot,代码行数:29,


示例13: dict_delItem

PmReturn_tdict_delItem(pPmObj_t pdict, pPmObj_t pkey){    PmReturn_t retval = PM_RET_OK;    int16_t indx = 0;    C_ASSERT(pdict != C_NULL);    /* Check for matching key */    retval = seglist_findEqual(((pPmDict_t)pdict)->d_keys, pkey, &indx);    /* Raise KeyError if key is not found */    if (retval == PM_RET_NO)    {        PM_RAISE(retval, PM_RET_EX_KEY);    }    /* Return any other error */    PM_RETURN_IF_ERROR(retval);    /* Remove the key and value */    retval = seglist_removeItem(((pPmDict_t)pdict)->d_keys, indx);    PM_RETURN_IF_ERROR(retval);    retval = seglist_removeItem(((pPmDict_t)pdict)->d_vals, indx);    /* Reduce the item count */    ((pPmDict_t)pdict)->length--;    return retval;}
开发者ID:AGM1968,项目名称:python-on-a-chip,代码行数:30,


示例14: obj_repr

PmReturn_tobj_repr(pPmObj_t pobj, pPmObj_t *r_pstr){    uint8_t tBuffer[32];    PmReturn_t retval = PM_RET_OK;    uint8_t const *pcstr = (uint8_t *)tBuffer;;    C_ASSERT(pobj != C_NULL);    switch (OBJ_GET_TYPE(pobj))    {    case OBJ_TYPE_INT:        retval = sli_ltoa10(((pPmInt_t)pobj)->val, tBuffer, sizeof(tBuffer));        PM_RETURN_IF_ERROR(retval);        retval = string_new(&pcstr, r_pstr);        break;#ifdef HAVE_FLOAT    case OBJ_TYPE_FLT:        /* #212: Use homebrew float formatter */        retval = sli_ftoa(((pPmFloat_t)pobj)->val, tBuffer, sizeof(tBuffer));        sli_strlen((char *)tBuffer);        retval = string_new(&pcstr, r_pstr);        break;#endif /* HAVE_FLOAT */    default:        /* Otherwise raise a TypeError */        PM_RAISE(retval, PM_RET_EX_TYPE);        break;    }    return retval;}
开发者ID:KnightSch,项目名称:python-on-a-chip,代码行数:34,


示例15: heap_linkToFreelist

/* Inserts in order a chunk into the free list.  Caller adjusts heap state */static PmReturn_theap_linkToFreelist(pPmHeapDesc_t pchunk){    uint16_t size;    pPmHeapDesc_t pscan;    /* Ensure the object is already free */    C_ASSERT(OBJ_GET_FREE(pchunk) != 0);    /* If free list is empty, add to head of list */    if (pmHeap.pfreelist == C_NULL)    {        pmHeap.pfreelist = pchunk;        pchunk->next = C_NULL;        pchunk->prev = C_NULL;        return PM_RET_OK;    }    /* Scan free list for insertion point */    pscan = pmHeap.pfreelist;    size = OBJ_GET_SIZE(pchunk);    while ((OBJ_GET_SIZE(pscan) < size) && (pscan->next != C_NULL))    {        pscan = pscan->next;    }    /*     * Insert chunk after the scan chunk (next is NULL).     * This is a slightly rare case where the last chunk in the free list     * is smaller than the chunk being freed.     */    if (size > OBJ_GET_SIZE(pscan))    {        pchunk->next = pscan->next;        pscan->next = pchunk;        pchunk->prev = pscan;    }    /* Insert chunk before the scan chunk */    else    {        pchunk->next = pscan;        pchunk->prev = pscan->prev;        /* If chunk will be first item in free list */        if (pscan->prev == C_NULL)        {            pmHeap.pfreelist = pchunk;        }        else        {            pscan->prev->next = pchunk;        }        pscan->prev = pchunk;    }    return PM_RET_OK;}
开发者ID:BackupGGCode,项目名称:megapython,代码行数:60,


示例16: HLDLC_deframe

SAT_returnState HLDLC_deframe(uint8_t *buf_in,                              uint8_t *buf_out,                              const uint16_t size_in,                              uint16_t *size_out) {    if(!C_ASSERT(buf_in != 0 && buf_out != 0) == true)    { return SATR_ERROR; }    uint16_t cnt = 0;  //  for(uint16_t i = 1; i < size_in; i++) {  //          if(buf_in[i] == HLDLC_START_FLAG) {  //              cnt = 0;   // }    for(uint16_t i = 0; i < size_in; i++) {        uint8_t c = buf_in[i];        if(c == HLDLC_START_FLAG) {            cnt = 0;        } else if(c == HLDLC_STOP_FLAG) {            *size_out = cnt;            return SATR_EOT;        } else if(c == HLDLC_CONTROL_FLAG) {            i++;            if(c == 0x5E) {              buf_out[cnt++] = 0x7E;            } else if(c == 0x5D) {              buf_out[cnt++] = 0x7D;            } else if(c== 0x5C) {              buf_out[cnt++] = 0x7C;            } else {              return SATR_ERROR;            }        } else {            buf_out[cnt++] = c;        }        if(!C_ASSERT(cnt < MAX_HLDLC_PKT_SIZE - 1) == true) {          return SATR_ERROR;        }    }    return SATR_ERROR;}
开发者ID:nchronas,项目名称:ecss_services,代码行数:46,


示例17: hk_crt_empty_pkt_TM

SAT_returnState hk_crt_empty_pkt_TM(tc_tm_pkt **pkt, const TC_TM_app_id app_id, const HK_struct_id sid) {    *pkt = get_pkt(PKT_NORMAL);    if(!C_ASSERT(*pkt != NULL) == true) { return SATR_ERROR; }    hk_crt_pkt_TM(*pkt, app_id, sid);    return SATR_OK;}
开发者ID:nchronas,项目名称:ecss_services,代码行数:8,


示例18: while

static t_block	*cycle_fd(t_block **train, const int fd){	t_block			*tmp;	tmp = *train;	while (tmp && tmp->fd != fd)		tmp = tmp->next;	if (!tmp)	{		C_ASSERT(tmp = (t_block *)ft_memalloc(sizeof(t_block)));		tmp->fd = fd;		C_ASSERT(tmp->str = ft_strnew(0));		tmp->next = *train;		*train = tmp;	}	return (tmp);}
开发者ID:fakejoshmeier,项目名称:fdf,代码行数:17,


示例19: dict_update

PmReturn_tdict_update(pPmObj_t pdestdict, pPmObj_t psourcedict, uint8_t omit_underscored){    PmReturn_t retval = PM_RET_OK;    int16_t i;    pPmObj_t pkey;    pPmObj_t pval;    C_ASSERT(pdestdict != C_NULL);    C_ASSERT(psourcedict != C_NULL);    /* If it's not a dict, raise TypeError */    if (OBJ_GET_TYPE(pdestdict) != OBJ_TYPE_DIC)    {        PM_RAISE(retval, PM_RET_EX_TYPE);        return retval;    }    /* If it's not a dict, raise TypeError */    if (OBJ_GET_TYPE(psourcedict) != OBJ_TYPE_DIC)    {        PM_RAISE(retval, PM_RET_EX_TYPE);        return retval;    }    /* Iterate over the add-on dict */    for (i = 0; i < ((pPmDict_t)psourcedict)->length; i++)    {        /* Get the key,val from the add-on dict */        retval = seglist_getItem(((pPmDict_t)psourcedict)->d_keys, i, &pkey);        PM_RETURN_IF_ERROR(retval);        retval = seglist_getItem(((pPmDict_t)psourcedict)->d_vals, i, &pval);        PM_RETURN_IF_ERROR(retval);        if (!(omit_underscored && (OBJ_GET_TYPE(pkey) == OBJ_TYPE_STR)              && ((pPmString_t)pkey)->val[0] == '_'))        {            /* Set the key,val to the destination dict */            retval = dict_setItem(pdestdict, pkey, pval);            PM_RETURN_IF_ERROR(retval);        }    }    return retval;}
开发者ID:AGM1968,项目名称:python-on-a-chip,代码行数:45,


示例20: writeRegisterNoFence

 template < typename _T_REG_UNION > __forceinline void writeRegisterNoFence (     _T_REG_UNION RegUnion     ) const throw () {     C_ASSERT(sizeof(UINT32) == sizeof(ULONG));     ULONG* const regPtr = reinterpret_cast<ULONG*>(         ULONG_PTR(this->basePtr) + ULONG(RegUnion.OFFSET));     ::WRITE_REGISTER_NOFENCE_ULONG(regPtr, RegUnion.AsUint32); } // writeRegisterNoFence<...> ( _T_REG_UNION )
开发者ID:parameshbabu,项目名称:bsp,代码行数:9,


示例21: NdasPortCtlBuildNdasAtaDeviceDescriptor

PNDAS_LOGICALUNIT_DESCRIPTORWINAPINdasPortCtlBuildNdasAtaDeviceDescriptor(	__in NDAS_LOGICALUNIT_ADDRESS LogicalUnitAddress,	__in ULONG LogicalUnitFlags,	__in CONST NDAS_DEVICE_IDENTIFIER* DeviceIdentifier,	__in ULONG NdasDeviceFlagMask,	__in ULONG NdasDeviceFlags,	__in ACCESS_MASK AccessMode,	__in ULONG VirtualBytesPerBlock,	__in PLARGE_INTEGER VirtualLogicalBlockAddress){	DWORD requiredBytes = sizeof(NDAS_ATA_DEVICE_DESCRIPTOR);		PNDAS_ATA_DEVICE_DESCRIPTOR ndasAtaDeviceDescriptor = 		static_cast<PNDAS_ATA_DEVICE_DESCRIPTOR>(			HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, requiredBytes));	if (NULL == ndasAtaDeviceDescriptor)	{		CTRACE(TRACE_LEVEL_ERROR, NDASPORTCTL_GENERAL,			"Memory allocation failure for %d bytes/n", requiredBytes);		SetLastError(ERROR_OUTOFMEMORY);		return NULL;	}	PNDAS_LOGICALUNIT_DESCRIPTOR logicalUnitDescriptor = 		&ndasAtaDeviceDescriptor->Header;	logicalUnitDescriptor->Version = sizeof(NDAS_LOGICALUNIT_DESCRIPTOR);	logicalUnitDescriptor->Size = requiredBytes;	logicalUnitDescriptor->Address = LogicalUnitAddress;	logicalUnitDescriptor->Type = NdasAtaDevice;	logicalUnitDescriptor->Flags = LogicalUnitFlags;	ndasAtaDeviceDescriptor->NdasDeviceId = *DeviceIdentifier;	ndasAtaDeviceDescriptor->NdasDeviceFlagMask = NdasDeviceFlagMask;	ndasAtaDeviceDescriptor->NdasDeviceFlags = NdasDeviceFlags;	ndasAtaDeviceDescriptor->AccessMode = AccessMode;	const BYTE NDAS_DEVICE_PASSWORD_ANY[8] = { 			0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };	CopyMemory(		ndasAtaDeviceDescriptor->DevicePassword,		NDAS_DEVICE_PASSWORD_ANY,		sizeof(ndasAtaDeviceDescriptor->DevicePassword));	C_ASSERT(		sizeof(NDAS_DEVICE_PASSWORD_ANY) == 		sizeof(ndasAtaDeviceDescriptor->DevicePassword));	ndasAtaDeviceDescriptor->VirtualBytesPerBlock = VirtualBytesPerBlock;	ndasAtaDeviceDescriptor->VirtualLogicalBlockAddress = *VirtualLogicalBlockAddress;	return logicalUnitDescriptor;}
开发者ID:tigtigtig,项目名称:ndas4windows,代码行数:57,


示例22: power_control_api

/*Must use real pins*/SAT_returnState power_control_api(FM_dev_id did, FM_fun_id fid, uint8_t *state) {    if(!C_ASSERT(did == SYS_DBG) == true)                             { return SATR_ERROR; }    if(!C_ASSERT(fid == P_OFF || fid == P_ON || fid == P_RESET || fid == SET_VAL) == true)    { return SATR_ERROR; }    if(did == ADCS_SD_DEV_ID && fid == P_ON)         { } //HAL_adcs_SD_ON(); }    else if(did == ADCS_SD_DEV_ID && fid == P_OFF)   { }//HAL_adcs_SD_OFF(); }    else if(did == ADCS_SD_DEV_ID && fid == P_RESET) {        //HAL_adcs_SD_OFF();        HAL_sys_delay(60);        //HAL_adcs_SD_ON();    }    else if(did == SYS_DBG && fid == SET_VAL)    {      //FIXME    }    return SATR_OK;}
开发者ID:ppapadeas,项目名称:ecss_services,代码行数:19,


示例23: UpdateCellStubAndCache

// Helper method for updating an interface dispatch indirection cell's stub and cache pointer atomically.// Returns the value of the cache pointer that is not referenced by the cell after this operation. This can be// NULL on the initial cell update, the value of the old cache pointer or the value of the new cache pointer// supplied (in the case where another thread raced with us for the update and won). In any case, if the// returned pointer is non-NULL it represents a cache that should be scheduled for release.static InterfaceDispatchCache * UpdateCellStubAndCache(InterfaceDispatchCell * pCell,                                                       void * pStub,                                                       UIntNative newCacheValue){    C_ASSERT(offsetof(InterfaceDispatchCell, m_pStub) == 0);    C_ASSERT(offsetof(InterfaceDispatchCell, m_pCache) == sizeof(void*));    UIntNative oldCacheValue = (UIntNative)UpdatePointerPairAtomically(pCell, pStub, (void*)newCacheValue, false);    if (InterfaceDispatchCell::IsCache(oldCacheValue))    {        return (InterfaceDispatchCache *)oldCacheValue;    }    else    {        return nullptr;    }}
开发者ID:danmosemsft,项目名称:corert,代码行数:23,


示例24: readRegisterNoFence

 template < typename _T_REG_UNION > __forceinline void readRegisterNoFence (     _Out_ _T_REG_UNION* RegUnionPtr     ) const throw () {     C_ASSERT(sizeof(UINT32) == sizeof(ULONG));     ULONG* const regPtr = reinterpret_cast<ULONG*>(         ULONG_PTR(this->basePtr) + ULONG(RegUnionPtr->OFFSET));     RegUnionPtr->AsUint32 = ::READ_REGISTER_NOFENCE_ULONG(regPtr);  } // readRegisterNoFence<...> ( _T_REG_UNION* )
开发者ID:parameshbabu,项目名称:bsp,代码行数:9,


示例25: obj_loadFromImgObj

PmReturn_tobj_loadFromImgObj(pPmObj_t pimg, pPmObj_t *r_pobj){    uint8_t const *imgaddr;    PmReturn_t retval;    C_ASSERT(OBJ_GET_TYPE(pimg) == OBJ_TYPE_CIO);    imgaddr = (uint8_t const *)&(((pPmCodeImgObj_t)pimg)->val);    retval = obj_loadFromImg(MEMSPACE_RAM, &imgaddr, r_pobj);    C_ASSERT(OBJ_GET_TYPE(*r_pobj) == OBJ_TYPE_COB);    /* All COs must reference the top of the code img obj      * so the image is marked and prevented from being reclaimed */    co_rSetCodeImgAddr((pPmCo_t)*r_pobj, (uint8_t const *)pimg);    return retval;}
开发者ID:Nonpython,项目名称:projects,代码行数:18,


示例26: HLDLC_frame

//used for DMASAT_returnState HLDLC_frame(uint8_t *buf_in, uint8_t *buf_out, uint16_t *size) {    if(!C_ASSERT(buf_in != NULL && buf_out != NULL && size != NULL) == true) { return SATR_ERROR; }    if(!C_ASSERT(*size <= MAX_PKT_SIZE) == true)                      { return SATR_ERROR; }    uint16_t cnt = 2;    for(uint16_t i = 0; i < *size; i++) {        if(i == 0) {            buf_out[0] = HLDLC_START_FLAG;            buf_out[1] = buf_in[0];        } else if(i == (*size) - 1) {            if(buf_in[i] == HLDLC_START_FLAG) {                buf_out[cnt++] = HLDLC_CONTROL_FLAG;                buf_out[cnt++] = 0x5E;            } else if(buf_in[i] == HLDLC_STOP_FLAG) {                buf_out[cnt++] = HLDLC_CONTROL_FLAG;                buf_out[cnt++] = 0x5C;            } else if(buf_in[i] == HLDLC_CONTROL_FLAG) {                buf_out[cnt++] = HLDLC_CONTROL_FLAG;                buf_out[cnt++] = 0x5D;            } else {                buf_out[cnt++] = buf_in[i];            }            buf_out[cnt++] = HLDLC_STOP_FLAG;            *size = cnt;            return SATR_EOT;        } else if(buf_in[i] == HLDLC_START_FLAG) {            buf_out[cnt++] = HLDLC_CONTROL_FLAG;            buf_out[cnt++] = 0x5E;        } else if(buf_in[i] == HLDLC_STOP_FLAG) {            buf_out[cnt++] = HLDLC_CONTROL_FLAG;            buf_out[cnt++] = 0x5C;        } else if(buf_in[i] == HLDLC_CONTROL_FLAG) {            buf_out[cnt++] = HLDLC_CONTROL_FLAG;            buf_out[cnt++] = 0x5D;        } else {            buf_out[cnt++] = buf_in[i];        }    }    return SATR_ERROR;}
开发者ID:nchronas,项目名称:ecss_services,代码行数:45,


示例27: power_control_api

/*Must use real pins*/SAT_returnState power_control_api(FM_dev_id did, FM_fun_id fid, uint8_t *state) {    if(!C_ASSERT(did == COMMS_WOD_PAT || did == SYS_DBG) == true) {      return SATR_ERROR;    }    if (!C_ASSERT(fid == P_OFF || fid == P_ON || fid == P_RESET		  || fid == SET_VAL) == true) {      return SATR_ERROR;    }    if (did == COMMS_WOD_PAT && fid == SET_VAL) {      comms_write_persistent_word(state[0],				  __COMMS_HEADLESS_TX_FLASH_OFFSET);    }    else if(did == SYS_DBG && fid == SET_VAL)    {      //FIXME    }    return SATR_OK;}
开发者ID:mashua,项目名称:ecss_services,代码行数:21,


示例28: hk_crt_pkt_TC

SAT_returnState hk_crt_pkt_TC(tc_tm_pkt *pkt, const TC_TM_app_id app_id, const HK_struct_id sid) {    if(!C_ASSERT(app_id < LAST_APP_ID) == true)  { return SATR_ERROR; }    crt_pkt(pkt, app_id, TC, TC_ACK_NO, TC_HOUSEKEEPING_SERVICE, TC_HK_REPORT_PARAMETERS, (TC_TM_app_id)SYSTEM_APP_ID);    pkt->data[0] = (char)sid;    pkt->len = 1;    return SATR_OK;}
开发者ID:nchronas,项目名称:ecss_services,代码行数:11,



注:本文中的C_ASSERT函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ C_ENUM函数代码示例
C++ C_ADDTO函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。