docstring
stringlengths
22
576
signature
stringlengths
9
317
prompt
stringlengths
57
886
code
stringlengths
20
1.36k
repository
stringclasses
49 values
language
stringclasses
2 values
license
stringclasses
9 values
stars
int64
15
21.3k
/* If Address > 0x0FFFFFFF, then ASSERT(). If the register specified by Address >= 0x100, then ASSERT(). */
UINT8 EFIAPI PciCf8AndThenOr8(IN UINTN Address, IN UINT8 AndData, IN UINT8 OrData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If the register specified by Address >= 0x100, then ASSERT(). */ UINT8 EFIAPI PciCf8AndThenOr8(IN UINTN Address, IN UINT8 AndData, IN UINT8 OrData)
{ BOOLEAN InterruptState; UINT32 AddressPort; UINT8 Result; ASSERT_INVALID_PCI_ADDRESS (Address, 0); InterruptState = SaveAndDisableInterrupts (); AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT); IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address)); Result = IoAndThenOr8 ( PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 3), AndData, OrData ); IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); SetInterruptState (InterruptState); return Result; }
tianocore/edk2
C++
Other
4,240
/* param base VREF peripheral address. return 6-bit value of trim setting. */
uint8_t VREF_GetVrefTrimVal(VREF_Type *base)
/* param base VREF peripheral address. return 6-bit value of trim setting. */ uint8_t VREF_GetVrefTrimVal(VREF_Type *base)
{ uint8_t trimValue; trimValue = (uint8_t)((base->UTRIM & VREF_UTRIM_VREFTRIM_MASK) >> VREF_UTRIM_VREFTRIM_SHIFT); return trimValue; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ` */
void strtoupper(unsigned char *p)
/* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ` */ void strtoupper(unsigned char *p)
{ if(!p) return; for (; *p; p++) *p = toupper (*p); }
Nicholas3388/LuaNode
C++
Other
1,055
/* Releases a Modbus client channel object, previously created with */
void TbxMbClientFree(tTbxMbClient channel)
/* Releases a Modbus client channel object, previously created with */ void TbxMbClientFree(tTbxMbClient channel)
{ TBX_ASSERT(channel != NULL); if (channel != NULL) { tTbxMbClientCtx * clientCtx = (tTbxMbClientCtx *)channel; TBX_ASSERT(clientCtx->type == TBX_MB_CLIENT_CONTEXT_TYPE); TbxMbOsalSemFree(clientCtx->transceiveSem); TbxCriticalSectionEnter(); clientCtx->tpCtx->channelCtx = NULL; clientCtx->tpCtx = NULL; clientCtx->type = 0U; clientCtx->pollFcn = NULL; clientCtx->processFcn = NULL; clientCtx->transceiveSem = NULL; TbxCriticalSectionExit(); TbxMemPoolRelease(clientCtx); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Like insb but in the opposite direction. Don't worry as much about doing aligned memory transfers: doing byte reads the "slow" way isn't nearly as slow as doing byte writes the slow way (no r-m-w cycle). */
void outsb(unsigned long port, const void *src, unsigned long count)
/* Like insb but in the opposite direction. Don't worry as much about doing aligned memory transfers: doing byte reads the "slow" way isn't nearly as slow as doing byte writes the slow way (no r-m-w cycle). */ void outsb(unsigned long port, const void *src, unsigned long count)
{ const unsigned char *p; p = (const unsigned char *)src; while (count) { count--; outb(*p, port); p++; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* return the absolute path of 'path', as represented by the dentry / mnt pair in the path parameter. */
int seq_path(struct seq_file *m, struct path *path, char *esc)
/* return the absolute path of 'path', as represented by the dentry / mnt pair in the path parameter. */ int seq_path(struct seq_file *m, struct path *path, char *esc)
{ char *buf; size_t size = seq_get_buf(m, &buf); int res = -1; if (size) { char *p = d_path(path, buf, size); if (!IS_ERR(p)) { char *end = mangle_path(buf, p, esc); if (end) res = end - buf; } } seq_commit(m, res); return res; }
robutest/uclinux
C++
GPL-2.0
60
/* Configure a set of GPIO pins using the given configuration table. Returns 0 on success. */
int kinetis_gpio_config_table(const struct kinetis_gpio_pin_config *table, unsigned int len)
/* Configure a set of GPIO pins using the given configuration table. Returns 0 on success. */ int kinetis_gpio_config_table(const struct kinetis_gpio_pin_config *table, unsigned int len)
{ unsigned int i; int rv; for (i = 0; i < len; i ++) { rv = kinetis_gpio_config(&table[i].dsc, table[i].regval); if (rv != 0) goto out; } rv = 0; out: return rv; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Add cic into ioc, using cfqd as the search key. This enables us to lookup the process specific cfq io context when entered from the block layer. Also adds the cic to a per-cfqd list, used when this queue is removed. */
static int cfq_cic_link(struct cfq_data *cfqd, struct io_context *ioc, struct cfq_io_context *cic, gfp_t gfp_mask)
/* Add cic into ioc, using cfqd as the search key. This enables us to lookup the process specific cfq io context when entered from the block layer. Also adds the cic to a per-cfqd list, used when this queue is removed. */ static int cfq_cic_link(struct cfq_data *cfqd, struct io_context *ioc, struct cfq_io_context *cic, gfp_t gfp_mask)
{ unsigned long flags; int ret; ret = radix_tree_preload(gfp_mask); if (!ret) { cic->ioc = ioc; cic->key = cfqd; spin_lock_irqsave(&ioc->lock, flags); ret = radix_tree_insert(&ioc->radix_root, (unsigned long) cfqd, cic); if (!ret) hlist_add_head_rcu(&cic->cic_list, &ioc->cic_list); spin_unlock_irqrestore(&ioc->lock, flags); radix_tree_preload_end(); if (!ret) { spin_lock_irqsave(cfqd->queue->queue_lock, flags); list_add(&cic->queue_list, &cfqd->cic_list); spin_unlock_irqrestore(cfqd->queue->queue_lock, flags); } } if (ret) printk(KERN_ERR "cfq: cic link failed!\n"); return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Used on SMP for either the local timer or SMP_MSG_TIMER */
void local_timer_interrupt(void)
/* Used on SMP for either the local timer or SMP_MSG_TIMER */ void local_timer_interrupt(void)
{ struct clock_event_device *clk = &__get_cpu_var(local_clockevent); irq_enter(); clk->event_handler(clk); irq_exit(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Signal event for every protocol in protocol entry. */
VOID CoreNotifyProtocolEntry(IN PROTOCOL_ENTRY *ProtEntry)
/* Signal event for every protocol in protocol entry. */ VOID CoreNotifyProtocolEntry(IN PROTOCOL_ENTRY *ProtEntry)
{ PROTOCOL_NOTIFY *ProtNotify; LIST_ENTRY *Link; ASSERT_LOCKED (&gProtocolDatabaseLock); for (Link = ProtEntry->Notify.ForwardLink; Link != &ProtEntry->Notify; Link = Link->ForwardLink) { ProtNotify = CR (Link, PROTOCOL_NOTIFY, Link, PROTOCOL_NOTIFY_SIGNATURE); CoreSignalEvent (ProtNotify->Event); } }
tianocore/edk2
C++
Other
4,240
/* Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA384 use. */
VOID* EFIAPI CryptoServiceHmacSha384New(VOID)
/* Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA384 use. */ VOID* EFIAPI CryptoServiceHmacSha384New(VOID)
{ return CALL_BASECRYPTLIB (HmacSha384.Services.New, HmacSha384New, (), NULL); }
tianocore/edk2
C++
Other
4,240
/* Acquire a DMA channel for exclusive access, similar to clk_get(). */
int kinetis_dma_ch_get(int ch)
/* Acquire a DMA channel for exclusive access, similar to clk_get(). */ int kinetis_dma_ch_get(int ch)
{ unsigned long fl; int rv; if (!kinetis_dma_ch_valid(ch)) { rv = -EINVAL; goto out; } spin_lock_irqsave(&dma_ch[ch].lock, fl); rv = dma_ch[ch].in_use ? -EBUSY : 0; dma_ch[ch].in_use = 1; spin_unlock_irqrestore(&dma_ch[ch].lock, fl); out: return rv; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* slot is the slot the inode is in, objectid is the objectid of the inode */
static noinline int acls_after_inode_item(struct extent_buffer *leaf, int slot, u64 objectid)
/* slot is the slot the inode is in, objectid is the objectid of the inode */ static noinline int acls_after_inode_item(struct extent_buffer *leaf, int slot, u64 objectid)
{ u32 nritems = btrfs_header_nritems(leaf); struct btrfs_key found_key; int scanned = 0; slot++; while (slot < nritems) { btrfs_item_key_to_cpu(leaf, &found_key, slot); if (found_key.objectid != objectid) return 0; if (found_key.type == BTRFS_XATTR_ITEM_KEY) return 1; if (found_key.type > BTRFS_XATTR_ITEM_KEY) return 0; slot++; scanned++; if (scanned >= 8) break; } return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* This function will set an interface to the usb device. */
rt_err_t rt_usbh_set_interface(uinst_t device, int intf)
/* This function will set an interface to the usb device. */ rt_err_t rt_usbh_set_interface(uinst_t device, int intf)
{ struct urequest setup; int timeout = USB_TIMEOUT_BASIC; RT_ASSERT(device != RT_NULL); setup.request_type = USB_REQ_TYPE_DIR_OUT | USB_REQ_TYPE_STANDARD | USB_REQ_TYPE_INTERFACE; setup.bRequest = USB_REQ_SET_INTERFACE; setup.wIndex = 0; setup.wLength = 0; setup.wValue = intf; if(rt_usb_hcd_setup_xfer(device->hcd, device->pipe_ep0_out, &setup, timeout) != 8) { return -RT_ERROR; } return RT_EOK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Process SEAD sound header return 1 if success, 0 if invalid format, otherwise AVERROR_xxx */
static int process_audio_header_sead(AVFormatContext *s)
/* Process SEAD sound header return 1 if success, 0 if invalid format, otherwise AVERROR_xxx */ static int process_audio_header_sead(AVFormatContext *s)
{ EaDemuxContext *ea = s->priv_data; ByteIOContext *pb = s->pb; ea->sample_rate = get_le32(pb); ea->bytes = get_le32(pb); ea->num_channels = get_le32(pb); ea->audio_codec = CODEC_ID_ADPCM_IMA_EA_SEAD; return 1; }
DC-SWAT/DreamShell
C++
null
404
/* Created on: Oct 27, 2021 Author: jiangyuanyuan Configure pins as Analog Input Output EVENT_OUT EXTI */
void MY_KEY_Init(void)
/* Created on: Oct 27, 2021 Author: jiangyuanyuan Configure pins as Analog Input Output EVENT_OUT EXTI */ void MY_KEY_Init(void)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; __HAL_RCC_GPIO_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_5; GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING; GPIO_InitStruct.Pull = GPIO_PULLUP; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); HAL_NVIC_SetPriority(GPIOB_IRQn, 0); HAL_NVIC_EnableIRQ(GPIOB_IRQn); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Select the specified ADC channel as an analog watchdog channel. */
void ADC_AWD_SelectCh(CM_ADC_TypeDef *ADCx, uint8_t u8AwdUnit, uint8_t u8Ch)
/* Select the specified ADC channel as an analog watchdog channel. */ void ADC_AWD_SelectCh(CM_ADC_TypeDef *ADCx, uint8_t u8AwdUnit, uint8_t u8Ch)
{ uint32_t u32AwdChsr; DDL_ASSERT(IS_ADC_CH(ADCx, u8Ch)); DDL_ASSERT(IS_ADC_AWD(u8AwdUnit)); u32AwdChsr = (uint32_t)&ADCx->AWD0CHSR; WRITE_REG8(ADC_AWDx_CHSR(u8AwdUnit, u32AwdChsr), u8Ch); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Message: KeypadButtonMessage Opcode: 0x0003 Type: CallControl Direction: dev2pbx VarLength: no */
static void handle_KeypadButtonMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
/* Message: KeypadButtonMessage Opcode: 0x0003 Type: CallControl Direction: dev2pbx VarLength: no */ static void handle_KeypadButtonMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
{ guint32 hdr_data_length = tvb_get_letohl(ptvcursor_tvbuff(cursor), 0); ptvcursor_add(cursor, hf_skinny_kpButton, 4, ENC_LITTLE_ENDIAN); if (hdr_data_length > 8) { si->lineId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor)); ptvcursor_add(cursor, hf_skinny_lineInstance, 4, ENC_LITTLE_ENDIAN); si->callId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor)); ptvcursor_add(cursor, hf_skinny_callReference, 4, ENC_LITTLE_ENDIAN); } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Perform a dquot buffer recovery. Simple algorithm: if we have found a QUOTAOFF logitem of the same type (ie. USR or GRP), then just toss this buffer away; don't recover it. Else, treat it as a regular buffer and do recovery. */
STATIC void xlog_recover_do_dquot_buffer(xfs_mount_t *mp, xlog_t *log, xlog_recover_item_t *item, xfs_buf_t *bp, xfs_buf_log_format_t *buf_f)
/* Perform a dquot buffer recovery. Simple algorithm: if we have found a QUOTAOFF logitem of the same type (ie. USR or GRP), then just toss this buffer away; don't recover it. Else, treat it as a regular buffer and do recovery. */ STATIC void xlog_recover_do_dquot_buffer(xfs_mount_t *mp, xlog_t *log, xlog_recover_item_t *item, xfs_buf_t *bp, xfs_buf_log_format_t *buf_f)
{ uint type; if (mp->m_qflags == 0) { return; } type = 0; if (buf_f->blf_flags & XFS_BLI_UDQUOT_BUF) type |= XFS_DQ_USER; if (buf_f->blf_flags & XFS_BLI_PDQUOT_BUF) type |= XFS_DQ_PROJ; if (buf_f->blf_flags & XFS_BLI_GDQUOT_BUF) type |= XFS_DQ_GROUP; if (log->l_quotaoffs_flag & type) return; xlog_recover_do_reg_buffer(item, bp, buf_f); }
robutest/uclinux
C++
GPL-2.0
60
/* Fill the addresses in the CacheEntry using the information passed in by HwAddr and SwAddr. */
VOID ArpFillAddressInCacheEntry(IN ARP_CACHE_ENTRY *CacheEntry, IN NET_ARP_ADDRESS *HwAddr OPTIONAL, IN NET_ARP_ADDRESS *SwAddr OPTIONAL)
/* Fill the addresses in the CacheEntry using the information passed in by HwAddr and SwAddr. */ VOID ArpFillAddressInCacheEntry(IN ARP_CACHE_ENTRY *CacheEntry, IN NET_ARP_ADDRESS *HwAddr OPTIONAL, IN NET_ARP_ADDRESS *SwAddr OPTIONAL)
{ NET_ARP_ADDRESS *Address[2]; NET_ARP_ADDRESS *CacheAddress; UINT32 Index; Address[Hardware] = HwAddr; Address[Protocol] = SwAddr; for (Index = 0; Index < 2; Index++) { if (Address[Index] != NULL) { CacheAddress = &CacheEntry->Addresses[Index]; CacheAddress->Type = Address[Index]->Type; CacheAddress->Length = Address[Index]->Length; if (Address[Index]->AddressPtr != NULL) { CopyMem ( CacheAddress->AddressPtr, Address[Index]->AddressPtr, CacheAddress->Length ); } else { ZeroMem (CacheAddress->AddressPtr, CacheAddress->Length); } } } }
tianocore/edk2
C++
Other
4,240
/* Wait for a semaphore with timeout (specified in ms) */
int sys_sem_wait_timeout(sys_sem_t sem, u32_t timeout)
/* Wait for a semaphore with timeout (specified in ms) */ int sys_sem_wait_timeout(sys_sem_t sem, u32_t timeout)
{ struct sswt_cb sswt_cb; sswt_cb.psem = &sem; sswt_cb.timeflag = 0; if (timeout > 0) { sys_timeout(timeout, sswt_handler, &sswt_cb); } sys_sem_wait(sem); if (sswt_cb.timeflag) { return 0; } else { sys_untimeout(sswt_handler, &sswt_cb); return 1; } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Enables IWDG (write access to IWDG_PR and IWDG_RLR registers disabled). */
void IWDG_Enable(void)
/* Enables IWDG (write access to IWDG_PR and IWDG_RLR registers disabled). */ void IWDG_Enable(void)
{ IWDG->KR = KR_KEY_Enable; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return a compatible lock_state. If no initialized lock_state structure exists, return an uninitialized one. */
static struct nfs4_lock_state* nfs4_get_lock_state(struct nfs4_state *state, fl_owner_t owner)
/* Return a compatible lock_state. If no initialized lock_state structure exists, return an uninitialized one. */ static struct nfs4_lock_state* nfs4_get_lock_state(struct nfs4_state *state, fl_owner_t owner)
{ struct nfs4_lock_state *lsp, *new = NULL; for(;;) { spin_lock(&state->state_lock); lsp = __nfs4_find_lock_state(state, owner); if (lsp != NULL) break; if (new != NULL) { list_add(&new->ls_locks, &state->lock_states); set_bit(LK_STATE_IN_USE, &state->flags); lsp = new; new = NULL; break; } spin_unlock(&state->state_lock); new = nfs4_alloc_lock_state(state, owner); if (new == NULL) return NULL; } spin_unlock(&state->state_lock); if (new != NULL) nfs4_free_lock_state(new); return lsp; }
robutest/uclinux
C++
GPL-2.0
60
/* param base Pointer to FLEXIO_I2C_Type structure. param handle Pointer to flexio_i2c_master_handle_t structure to store the transfer state. param callback Pointer to user callback function. param userData User param passed to the callback function. retval kStatus_Success Successfully create the handle. retval kStatus_OutOfRange The FlexIO type/handle/isr table out of range. */
status_t FLEXIO_I2C_MasterTransferCreateHandle(FLEXIO_I2C_Type *base, flexio_i2c_master_handle_t *handle, flexio_i2c_master_transfer_callback_t callback, void *userData)
/* param base Pointer to FLEXIO_I2C_Type structure. param handle Pointer to flexio_i2c_master_handle_t structure to store the transfer state. param callback Pointer to user callback function. param userData User param passed to the callback function. retval kStatus_Success Successfully create the handle. retval kStatus_OutOfRange The FlexIO type/handle/isr table out of range. */ status_t FLEXIO_I2C_MasterTransferCreateHandle(FLEXIO_I2C_Type *base, flexio_i2c_master_handle_t *handle, flexio_i2c_master_transfer_callback_t callback, void *userData)
{ assert(handle); IRQn_Type flexio_irqs[] = FLEXIO_IRQS; memset(handle, 0, sizeof(*handle)); handle->completionCallback = callback; handle->userData = userData; EnableIRQ(flexio_irqs[FLEXIO_I2C_GetInstance(base)]); return FLEXIO_RegisterHandleIRQ(base, handle, FLEXIO_I2C_MasterTransferHandleIRQ); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Restore the audio codec state to default state and free all used resources. */
static uint32_t Codec_DeInit(void)
/* Restore the audio codec state to default state and free all used resources. */ static uint32_t Codec_DeInit(void)
{ uint32_t counter = 0; Codec_Reset(); counter += Codec_WriteRegister(0x02, 0x01); Codec_GPIO_DeInit(); Codec_CtrlInterface_DeInit(); Codec_AudioInterface_DeInit(); return counter; }
avem-labs/Avem
C++
MIT License
1,752
/* This function will fill a formatted string to buffer. */
int rt_sprintf(char *buf, const char *format,...)
/* This function will fill a formatted string to buffer. */ int rt_sprintf(char *buf, const char *format,...)
{ rt_int32_t n = 0; va_list arg_ptr; va_start(arg_ptr, format); n = rt_vsprintf(buf, format, arg_ptr); va_end(arg_ptr); return n; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Selects card, moving it into data transfer mode */
int sdmmc_select_card(struct sd_card *card)
/* Selects card, moving it into data transfer mode */ int sdmmc_select_card(struct sd_card *card)
{ struct sdhc_command cmd; int ret; cmd.opcode = SD_SELECT_CARD; cmd.arg = ((card->relative_addr) << 16U); cmd.response_type = SD_RSP_TYPE_R1; cmd.retries = CONFIG_SD_CMD_RETRIES; cmd.timeout_ms = CONFIG_SD_CMD_TIMEOUT; ret = sdhc_request(card->sdhc, &cmd, NULL); if (ret) { LOG_DBG("CMD7 failed"); return ret; } ret = sd_check_response(&cmd); if (ret) { LOG_DBG("CMD7 reports error"); return ret; } return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* If 32-bit I/O port operations are not supported, then ASSERT(). */
UINT32 EFIAPI S3IoAndThenOr32(IN UINTN Port, IN UINT32 AndData, IN UINT32 OrData)
/* If 32-bit I/O port operations are not supported, then ASSERT(). */ UINT32 EFIAPI S3IoAndThenOr32(IN UINTN Port, IN UINT32 AndData, IN UINT32 OrData)
{ return InternalSaveIoWrite32ValueToBootScript (Port, IoAndThenOr32 (Port, AndData, OrData)); }
tianocore/edk2
C++
Other
4,240
/* Get the length of received data in RX ring buffer. */
static size_t FLEXIO_UART_TransferGetRxRingBufferLength(flexio_uart_handle_t *handle)
/* Get the length of received data in RX ring buffer. */ static size_t FLEXIO_UART_TransferGetRxRingBufferLength(flexio_uart_handle_t *handle)
{ size_t size; uint16_t rxRingBufferHead = handle->rxRingBufferHead; uint16_t rxRingBufferTail = handle->rxRingBufferTail; if (rxRingBufferTail > rxRingBufferHead) { size = (size_t)rxRingBufferHead + handle->rxRingBufferSize - (size_t)rxRingBufferTail; } else { size = (size_t)rxRingBufferHead - (size_t)rxRingBufferTail; } return size; }
eclipse-threadx/getting-started
C++
Other
310
/* The function performs send, recv, check comIDs, check method status action. */
TCG_RESULT EFIAPI OpalPerformMethod(OPAL_SESSION *Session, UINT32 SendSize, VOID *Buffer, UINT32 BufferSize, TCG_PARSE_STRUCT *ParseStruct, UINT8 *MethodStatus, UINT32 EstimateTimeCost)
/* The function performs send, recv, check comIDs, check method status action. */ TCG_RESULT EFIAPI OpalPerformMethod(OPAL_SESSION *Session, UINT32 SendSize, VOID *Buffer, UINT32 BufferSize, TCG_PARSE_STRUCT *ParseStruct, UINT8 *MethodStatus, UINT32 EstimateTimeCost)
{ NULL_CHECK (Session); NULL_CHECK (MethodStatus); ERROR_CHECK ( OpalTrustedSend ( Session->Sscp, Session->MediaId, TCG_OPAL_SECURITY_PROTOCOL_1, Session->OpalBaseComId, SendSize, Buffer, BufferSize ) ); ERROR_CHECK ( OpalTrustedRecv ( Session->Sscp, Session->MediaId, TCG_OPAL_SECURITY_PROTOCOL_1, Session->OpalBaseComId, Buffer, BufferSize, EstimateTimeCost ) ); ERROR_CHECK (TcgInitTcgParseStruct (ParseStruct, Buffer, BufferSize)); ERROR_CHECK (TcgCheckComIds (ParseStruct, Session->OpalBaseComId, Session->ComIdExtension)); ERROR_CHECK (TcgGetMethodStatus (ParseStruct, MethodStatus)); return TcgResultSuccess; }
tianocore/edk2
C++
Other
4,240
/* Release the memory region(s) being used by 'port'. */
static void imx_release_port(struct uart_port *port)
/* Release the memory region(s) being used by 'port'. */ static void imx_release_port(struct uart_port *port)
{ struct platform_device *pdev = to_platform_device(port->dev); struct resource *mmres; mmres = platform_get_resource(pdev, IORESOURCE_MEM, 0); release_mem_region(mmres->start, mmres->end - mmres->start + 1); }
robutest/uclinux
C++
GPL-2.0
60
/* Set a cursor for a pointer input device (for LV_INPUT_TYPE_POINTER and LV_INPUT_TYPE_BUTTON) */
void lv_indev_set_cursor(lv_indev_t *indev, lv_obj_t *cur_obj)
/* Set a cursor for a pointer input device (for LV_INPUT_TYPE_POINTER and LV_INPUT_TYPE_BUTTON) */ void lv_indev_set_cursor(lv_indev_t *indev, lv_obj_t *cur_obj)
{ if(indev->driver.type != LV_INDEV_TYPE_POINTER && indev->driver.type != LV_INDEV_TYPE_BUTTON) return; indev->cursor = cur_obj; lv_obj_set_parent(indev->cursor, lv_layer_sys()); lv_obj_set_pos(indev->cursor, indev->proc.act_point.x, indev->proc.act_point.y); }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* Add a new head to a linked list */
void* _lv_ll_ins_head(lv_ll_t *ll_p)
/* Add a new head to a linked list */ void* _lv_ll_ins_head(lv_ll_t *ll_p)
{ lv_ll_node_t * n_new; n_new = lv_mem_alloc(ll_p->n_size + LL_NODE_META_SIZE); if(n_new != NULL) { node_set_prev(ll_p, n_new, NULL); node_set_next(ll_p, n_new, ll_p->head); if(ll_p->head != NULL) { node_set_prev(ll_p, ll_p->head, n_new); } ll_p->head = n_new; if(ll_p->tail == NULL) { ll_p->tail = n_new; } } return n_new; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Reset control endpoint. Called after a USB line reset or when UDD is enabled */
static void udd_reset_ep_ctrl(void)
/* Reset control endpoint. Called after a USB line reset or when UDD is enabled */ static void udd_reset_ep_ctrl(void)
{ irqflags_t flags; udd_configure_address(0); udd_enable_address(); udd_configure_endpoint(0, USB_EP_TYPE_CONTROL, 0, USB_DEVICE_EP_CTRL_SIZE, UDPHS_EPTCFG_BK_NUMBER_1 >> UDPHS_EPTCFG_BK_NUMBER_Pos, 0); dbg_print("rst(0:%08x) ", UDPHS->UDPHS_EPT[0].UDPHS_EPTCFG); udd_enable_endpoint(0); flags = cpu_irq_save(); udd_enable_setup_received_interrupt(0); udd_enable_out_received_interrupt(0); udd_enable_endpoint_interrupt(0); cpu_irq_restore(flags); }
remotemcu/remcu-chip-sdks
C++
null
436
/* get_nasid() returns the physical node id number of the caller. */
nasid_t get_nasid(void)
/* get_nasid() returns the physical node id number of the caller. */ nasid_t get_nasid(void)
{ return (nasid_t)((LOCAL_HUB_L(NI_STATUS_REV_ID) & NSRI_NODEID_MASK) >> NSRI_NODEID_SHFT); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */
int main(void)
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */ int main(void)
{ SetupHardware(); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); GlobalInterruptEnable(); for (;;) { USB_USBTask(); CCID_Task(); } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* This API function returns whether or not the policy interface is locked for the remainder of the boot. */
BOOLEAN EFIAPI IsVariablePolicyInterfaceLocked(VOID)
/* This API function returns whether or not the policy interface is locked for the remainder of the boot. */ BOOLEAN EFIAPI IsVariablePolicyInterfaceLocked(VOID)
{ if (!IsVariablePolicyLibInitialized ()) { return FALSE; } return mInterfaceLocked; }
tianocore/edk2
C++
Other
4,240
/* Returns 1 if successful, -EINVAL if m or choice is NULL, -ENOENT if no default has been set and the menu is set to not prompt or the timeout expires, or -EINTR if the user exits the menu via ^c. */
int menu_get_choice(struct menu *m, void **choice)
/* Returns 1 if successful, -EINVAL if m or choice is NULL, -ENOENT if no default has been set and the menu is set to not prompt or the timeout expires, or -EINTR if the user exits the menu via ^c. */ int menu_get_choice(struct menu *m, void **choice)
{ if (!m || !choice) return -EINVAL; if (!m->prompt || m->item_cnt == 1) return menu_default_choice(m, choice); return menu_interactive_choice(m, choice); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Caution: This function may receive untrusted input. The data size external input, so this function will validate it carefully to avoid buffer overflow. */
EFI_STATUS InitCommunicateBuffer(OUT VOID **DataPtr OPTIONAL, IN UINTN DataSize, IN UINTN Function)
/* Caution: This function may receive untrusted input. The data size external input, so this function will validate it carefully to avoid buffer overflow. */ EFI_STATUS InitCommunicateBuffer(OUT VOID **DataPtr OPTIONAL, IN UINTN DataSize, IN UINTN Function)
{ EFI_MM_COMMUNICATE_HEADER *SmmCommunicateHeader; SMM_VARIABLE_COMMUNICATE_HEADER *SmmVariableFunctionHeader; if (DataSize + SMM_COMMUNICATE_HEADER_SIZE + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE > mVariableBufferSize) { return EFI_INVALID_PARAMETER; } SmmCommunicateHeader = (EFI_MM_COMMUNICATE_HEADER *)mVariableBuffer; CopyGuid (&SmmCommunicateHeader->HeaderGuid, &gEfiSmmVariableProtocolGuid); SmmCommunicateHeader->MessageLength = DataSize + SMM_VARIABLE_COMMUNICATE_HEADER_SIZE; SmmVariableFunctionHeader = (SMM_VARIABLE_COMMUNICATE_HEADER *)SmmCommunicateHeader->Data; SmmVariableFunctionHeader->Function = Function; if (DataPtr != NULL) { *DataPtr = SmmVariableFunctionHeader->Data; } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Update the termios variables and send the neccessary signals to peform a terminal resize correctly */
int tty_do_resize(struct tty_struct *tty, struct winsize *ws)
/* Update the termios variables and send the neccessary signals to peform a terminal resize correctly */ int tty_do_resize(struct tty_struct *tty, struct winsize *ws)
{ struct pid *pgrp; unsigned long flags; mutex_lock(&tty->termios_mutex); if (!memcmp(ws, &tty->winsize, sizeof(*ws))) goto done; spin_lock_irqsave(&tty->ctrl_lock, flags); pgrp = get_pid(tty->pgrp); spin_unlock_irqrestore(&tty->ctrl_lock, flags); if (pgrp) kill_pgrp(pgrp, SIGWINCH, 1); put_pid(pgrp); tty->winsize = *ws; done: mutex_unlock(&tty->termios_mutex); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* NOTE: Do not use EFI_PAGES_TO_SIZE because it handles UINTN only. */
STATIC UINT64 EfiPagesToSize(IN UINT64 Pages)
/* NOTE: Do not use EFI_PAGES_TO_SIZE because it handles UINTN only. */ STATIC UINT64 EfiPagesToSize(IN UINT64 Pages)
{ return LShiftU64 (Pages, EFI_PAGE_SHIFT); }
tianocore/edk2
C++
Other
4,240
/* ADC Enable Single Conversion Mode. In this mode the ADC performs a conversion of one channel or a channel group and stops. */
void adc_set_single_conversion_mode(uint32_t adc)
/* ADC Enable Single Conversion Mode. In this mode the ADC performs a conversion of one channel or a channel group and stops. */ void adc_set_single_conversion_mode(uint32_t adc)
{ ADC_CR2(adc) &= ~ADC_CR2_CONT; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Gets a data element from the SPI interface with block. */
void xSPIDataGet(unsigned long ulBase, unsigned long *pulData)
/* Gets a data element from the SPI interface with block. */ void xSPIDataGet(unsigned long ulBase, unsigned long *pulData)
{ unsigned char ucBitLength = xSPIBitLengthGet(ulBase); xASSERT(ulBase == SPI0_BASE); while((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_GO_BUSY)) { } if (ucBitLength <= 8) { *pulData = xHWREG(ulBase + SPI_RX0) & 0xFF; } else if(ucBitLength <= 16) { *pulData = xHWREG(ulBase + SPI_RX0) & 0xFFFF; } else { *pulData = xHWREG(ulBase + SPI_RX0); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Fills the LCD with the specified 16-bit color. */
void lcdFillRGB(uint16_t data)
/* Fills the LCD with the specified 16-bit color. */ void lcdFillRGB(uint16_t data)
{ ssd1331FillRect(0,0,ssd1331Properties.width-1,ssd1331Properties.height-1, data, data); }
microbuilder/LPC1343CodeBase
C++
Other
73
/* LTDC MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef *hltdc)
/* LTDC MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef *hltdc)
{ if(hltdc->Instance==LTDC) { __HAL_RCC_LTDC_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOI, GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_0|GPIO_PIN_1 |GPIO_PIN_2|GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6 |GPIO_PIN_7); HAL_GPIO_DeInit(GPIOF, GPIO_PIN_10); HAL_GPIO_DeInit(GPIOH, GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_12 |GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15); HAL_GPIO_DeInit(GPIOG, GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_11); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Send a sequence of bytes to an SPI device using USART in SPI mode. Received bytes on the USART in SPI mode are discarded. */
uint32_t usart_spi_write_packet(volatile avr32_usart_t *p_usart, const uint8_t *data, size_t len)
/* Send a sequence of bytes to an SPI device using USART in SPI mode. Received bytes on the USART in SPI mode are discarded. */ uint32_t usart_spi_write_packet(volatile avr32_usart_t *p_usart, const uint8_t *data, size_t len)
{ uint32_t dummy_data; size_t i=0; while(len) { usart_putchar(p_usart, *(data+i)); dummy_data = usart_getchar(p_usart); len--; i++; } return 0; }
memfault/zero-to-main
C++
null
200
/* Write 4 bytes to Trace Hub MMIO addr + 0x10. */
VOID EFIAPI MipiSystWriteD32Ts(IN VOID *MipiSystHandle, IN UINT32 Data)
/* Write 4 bytes to Trace Hub MMIO addr + 0x10. */ VOID EFIAPI MipiSystWriteD32Ts(IN VOID *MipiSystHandle, IN UINT32 Data)
{ MIPI_SYST_HANDLE *MipiSystH; MipiSystH = (MIPI_SYST_HANDLE *)MipiSystHandle; MmioWrite32 ((UINTN)(MipiSystH->systh_platform.TraceHubPlatformData.MmioAddr + 0x10), Data); }
tianocore/edk2
C++
Other
4,240
/* Curl_mk_dnscache() inits a new DNS cache and returns success/failure. */
int Curl_mk_dnscache(struct curl_hash *hash)
/* Curl_mk_dnscache() inits a new DNS cache and returns success/failure. */ int Curl_mk_dnscache(struct curl_hash *hash)
{ return Curl_hash_init(hash, 7, Curl_hash_str, Curl_str_key_compare, freednsentry); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Process a parity error and queue the right data to indicate the error case if necessary. Locking as per n_tty_receive_buf. */
static void n_tty_receive_parity_error(struct tty_struct *tty, unsigned char c)
/* Process a parity error and queue the right data to indicate the error case if necessary. Locking as per n_tty_receive_buf. */ static void n_tty_receive_parity_error(struct tty_struct *tty, unsigned char c)
{ if (I_IGNPAR(tty)) return; if (I_PARMRK(tty)) { put_tty_queue('\377', tty); put_tty_queue('\0', tty); put_tty_queue(c, tty); } else if (I_INPCK(tty)) put_tty_queue('\0', tty); else put_tty_queue(c, tty); wake_up_interruptible(&tty->read_wait); }
robutest/uclinux
C++
GPL-2.0
60
/* Write data element to the SPI interface with Noblock. */
long xSPIDataPutNonBlocking(unsigned long ulBase, unsigned long ulData)
/* Write data element to the SPI interface with Noblock. */ long xSPIDataPutNonBlocking(unsigned long ulBase, unsigned long ulData)
{ xASSERT(ulBase == SPI0_BASE); if(!(xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_GO_BUSY)) { xHWREG(ulBase + SPI_TX0) = ulData; return(1); } else { return(0); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Check whether this value represents an NEC data bit 0. */
static bool bit_zero_if(rmt_item32_t *item)
/* Check whether this value represents an NEC data bit 0. */ static bool bit_zero_if(rmt_item32_t *item)
{ if((item->level0 == RMT_RX_ACTIVE_LEVEL && item->level1 != RMT_RX_ACTIVE_LEVEL) && check_in_range(item->duration0, BIT_ZERO_HIGH_US, BIT_MARGIN) && check_in_range(item->duration1, BIT_ZERO_LOW_US, BIT_MARGIN)) { return true; } return false; }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* This macro is used to disable input channel interrupt. */
void ECAP_DisableINT(ECAP_T *ecap, uint32_t u32Mask)
/* This macro is used to disable input channel interrupt. */ void ECAP_DisableINT(ECAP_T *ecap, uint32_t u32Mask)
{ (ecap->CTL0) &= ~(u32Mask); if((ecap == ECAP0) || (ecap == ECAP0_NS)) { NVIC_DisableIRQ(ECAP0_IRQn); } else { NVIC_DisableIRQ(ECAP1_IRQn); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* With this method one can define a function that will receive all incoming messages. */
static int32_t CanUsbLibFuncSetReceiveCallBack(CANHANDLE h, LPFNDLL_RECEIVE_CALLBACK fn)
/* With this method one can define a function that will receive all incoming messages. */ static int32_t CanUsbLibFuncSetReceiveCallBack(CANHANDLE h, LPFNDLL_RECEIVE_CALLBACK fn)
{ int32_t result = ERROR_CANUSB_GENERAL; assert(canUsbLibFuncSetReceiveCallBackPtr != NULL); assert(canUsbDllHandle != NULL); if ((canUsbLibFuncSetReceiveCallBackPtr != NULL) && (canUsbDllHandle != NULL)) { result = canUsbLibFuncSetReceiveCallBackPtr(h, fn); } return result; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* disable XDMAC for spi and forbidden transmit and receive by XDMAC. */
static void spi_disable_xdmac(void)
/* disable XDMAC for spi and forbidden transmit and receive by XDMAC. */ static void spi_disable_xdmac(void)
{ uint32_t xdmaint; xdmaint = (XDMAC_CIE_BIE | XDMAC_CIE_DIE | XDMAC_CIE_FIE | XDMAC_CIE_RBIE | XDMAC_CIE_WBIE | XDMAC_CIE_ROIE); xdmac_channel_disable_interrupt(XDMAC, XDMAC_RX_CH, xdmaint); xdmac_channel_disable(XDMAC, XDMAC_RX_CH); xdmac_disable_interrupt(XDMAC, XDMAC_RX_CH); xdmac_channel_disable_interrupt(XDMAC, XDMAC_TX_CH, xdmaint); xdmac_channel_disable(XDMAC, XDMAC_TX_CH); xdmac_disable_interrupt(XDMAC, XDMAC_TX_CH); NVIC_ClearPendingIRQ(XDMAC_IRQn); NVIC_DisableIRQ(XDMAC_IRQn); }
remotemcu/remcu-chip-sdks
C++
null
436
/* While the USB HID spec allows unlimited length bit fields in "report descriptors", most devices never use more than 16 bits. One model of UPS is claimed to report "LINEV" as a 32-bit field. Search linux-kernel and linux-usb-devel archives for "hid-core extract". */
static __inline__ __u32 extract(__u8 *report, unsigned offset, unsigned n)
/* While the USB HID spec allows unlimited length bit fields in "report descriptors", most devices never use more than 16 bits. One model of UPS is claimed to report "LINEV" as a 32-bit field. Search linux-kernel and linux-usb-devel archives for "hid-core extract". */ static __inline__ __u32 extract(__u8 *report, unsigned offset, unsigned n)
{ u64 x; if (n > 32) printk(KERN_WARNING "HID: extract() called with n (%d) > 32! (%s)\n", n, current->comm); report += offset >> 3; offset &= 7; x = get_unaligned_le64(report); x = (x >> offset) & ((1ULL << n) - 1); return (u32) x; }
robutest/uclinux
C++
GPL-2.0
60
/* This function is used for writing to XADC Registers using the command FIFO. */
void XAdcPs_WriteInternalReg(XAdcPs *InstancePtr, u32 RegOffset, u32 Data)
/* This function is used for writing to XADC Registers using the command FIFO. */ void XAdcPs_WriteInternalReg(XAdcPs *InstancePtr, u32 RegOffset, u32 Data)
{ u32 RegData; RegData = (XADCPS_JTAG_CMD_WRITE_MASK) | ((RegOffset << XADCPS_JTAG_ADDR_SHIFT) & XADCPS_JTAG_ADDR_MASK) | (Data & XADCPS_JTAG_DATA_MASK); XAdcPs_WriteFifo(InstancePtr, RegData); XAdcPs_ReadFifo(InstancePtr); }
ua1arn/hftrx
C++
null
69
/* This function returns a pointer to the current FV and the size. */
EFI_STATUS GetFvHeader(OUT EFI_FIRMWARE_VOLUME_HEADER **FvHeader, OUT UINT32 *FvLength)
/* This function returns a pointer to the current FV and the size. */ EFI_STATUS GetFvHeader(OUT EFI_FIRMWARE_VOLUME_HEADER **FvHeader, OUT UINT32 *FvLength)
{ if (mFvHeader == NULL || mFvLength == 0) { return EFI_ABORTED; } if (FvHeader == NULL) { return EFI_INVALID_PARAMETER; } *FvHeader = mFvHeader; *FvLength = mFvLength; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Increment remainder. Calculates whether the remainder should increments expiration time for above-microsecond precision counter HW. The remainder enables improved ticker precision, but is disabled for for sub-microsecond precision configurations. */
static uint8_t ticker_remainder_inc(struct ticker_node *ticker)
/* Increment remainder. Calculates whether the remainder should increments expiration time for above-microsecond precision counter HW. The remainder enables improved ticker precision, but is disabled for for sub-microsecond precision configurations. */ static uint8_t ticker_remainder_inc(struct ticker_node *ticker)
{ return ticker_add_to_remainder(&ticker->remainder_current, ticker->remainder_periodic); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* hpsb_iso_xmit_init - allocate the buffer and DMA context */
struct hpsb_iso* hpsb_iso_xmit_init(struct hpsb_host *host, unsigned int data_buf_size, unsigned int buf_packets, int channel, int speed, int irq_interval, void(*callback)(struct hpsb_iso *))
/* hpsb_iso_xmit_init - allocate the buffer and DMA context */ struct hpsb_iso* hpsb_iso_xmit_init(struct hpsb_host *host, unsigned int data_buf_size, unsigned int buf_packets, int channel, int speed, int irq_interval, void(*callback)(struct hpsb_iso *))
{ struct hpsb_iso *iso = hpsb_iso_common_init(host, HPSB_ISO_XMIT, data_buf_size, buf_packets, channel, HPSB_ISO_DMA_DEFAULT, irq_interval, callback); if (!iso) return NULL; iso->speed = speed; if (host->driver->isoctl(iso, XMIT_INIT, 0)) goto err; iso->flags |= HPSB_ISO_DRIVER_INIT; return iso; err: hpsb_iso_shutdown(iso); return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Register the Service B.3 and all its Characteristics... */
void service_b_3_1_init(void)
/* Register the Service B.3 and all its Characteristics... */ void service_b_3_1_init(void)
{ bt_gatt_service_register(&service_b_3_1_svc); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This API is used to get the tap duration in the register 0x2A bit form 0 to 2. */
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_tap_durn(u8 *tap_durn_u8)
/* This API is used to get the tap duration in the register 0x2A bit form 0 to 2. */ BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_tap_durn(u8 *tap_durn_u8)
{ u8 data_u8 = BMA2x2_INIT_VALUE; BMA2x2_RETURN_FUNCTION_TYPE com_rslt = ERROR; if (p_bma2x2 == BMA2x2_NULL) { return E_BMA2x2_NULL_PTR; } else { com_rslt = p_bma2x2->BMA2x2_BUS_READ_FUNC (p_bma2x2->dev_addr, BMA2x2_TAP_DURN_REG, &data_u8, BMA2x2_GEN_READ_WRITE_LENGTH); *tap_durn_u8 = BMA2x2_GET_BITSLICE (data_u8, BMA2x2_TAP_DURN); } return com_rslt; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function returns number of network interface instance. */
UINTN NumberOfNetworkInterface(VOID)
/* This function returns number of network interface instance. */ UINTN NumberOfNetworkInterface(VOID)
{ UINTN Num; EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *ThisNetworkInterface; if (IsListEmpty (&mEfiRedfishDiscoverNetworkInterface)) { return 0; } Num = 1; ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetFirstNode (&mEfiRedfishDiscoverNetworkInterface); while (TRUE) { if (IsNodeAtEnd (&mEfiRedfishDiscoverNetworkInterface, &ThisNetworkInterface->Entry)) { break; } ThisNetworkInterface = (EFI_REDFISH_DISCOVER_NETWORK_INTERFACE_INTERNAL *)GetNextNode (&mEfiRedfishDiscoverNetworkInterface, &ThisNetworkInterface->Entry); Num++; } return Num; }
tianocore/edk2
C++
Other
4,240
/* This function returns the size of the Null-terminated Ascii string specified by String in bytes, including the Null terminator. */
UINTN EFIAPI AsciiStrnSizeS(IN CONST CHAR8 *String, IN UINTN MaxSize)
/* This function returns the size of the Null-terminated Ascii string specified by String in bytes, including the Null terminator. */ UINTN EFIAPI AsciiStrnSizeS(IN CONST CHAR8 *String, IN UINTN MaxSize)
{ if (String == NULL) { return 0; } return (AsciiStrnLenS (String, MaxSize) + 1) * sizeof (*String); }
tianocore/edk2
C++
Other
4,240
/* returns the address of the first occurrence of */
void* memchr(const void *s, int c, size_t n)
/* returns the address of the first occurrence of */ void* memchr(const void *s, int c, size_t n)
{ const unsigned char *p = s; while (n-- != 0) { if ((unsigned char)c == *p++) { return (void *)(p - 1); } } return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Writes the 64-bit value specified by Value to the MSR specified by Index. The 64-bit value written to the MSR is returned. No parameter checking is performed on Index or Value, and some of these may cause CPU exceptions. The caller must either guarantee that Index and Value are valid, or the caller must establish proper exception handlers. This function is only available on IA-32 and x64. */
UINT64 EFIAPI AsmWriteMsr64(IN UINT32 Index, IN UINT64 Value)
/* Writes the 64-bit value specified by Value to the MSR specified by Index. The 64-bit value written to the MSR is returned. No parameter checking is performed on Index or Value, and some of these may cause CPU exceptions. The caller must either guarantee that Index and Value are valid, or the caller must establish proper exception handlers. This function is only available on IA-32 and x64. */ UINT64 EFIAPI AsmWriteMsr64(IN UINT32 Index, IN UINT64 Value)
{ BOOLEAN Flag; Flag = FilterBeforeMsrWrite (Index, &Value); if (Flag) { _asm { mov edx, dword ptr [Value + 4] mov eax, dword ptr [Value + 0] mov ecx, Index wrmsr } } FilterAfterMsrWrite (Index, &Value); return Value; }
tianocore/edk2
C++
Other
4,240
/* We need to check if we have done it before as for example, _suspend() call this; if after a suspend() we get a _disconnect() (as the case is when hibernating), nothing bad happens. */
void i2400mu_notification_release(struct i2400mu *i2400mu)
/* We need to check if we have done it before as for example, _suspend() call this; if after a suspend() we get a _disconnect() (as the case is when hibernating), nothing bad happens. */ void i2400mu_notification_release(struct i2400mu *i2400mu)
{ struct device *dev = &i2400mu->usb_iface->dev; d_fnstart(4, dev, "(i2400mu %p)\n", i2400mu); if (i2400mu->notif_urb != NULL) { usb_kill_urb(i2400mu->notif_urb); kfree(i2400mu->notif_urb->transfer_buffer); usb_free_urb(i2400mu->notif_urb); i2400mu->notif_urb = NULL; } d_fnend(4, dev, "(i2400mu %p)\n", i2400mu); }
robutest/uclinux
C++
GPL-2.0
60
/* Selects the ratio between the number of counter overflows to the number of ETMes the TOF bit is set. @无返回 */
void ETM_SetTOFFrequency(ETM_Type *pETM, uint8_t u8TOFNUM)
/* Selects the ratio between the number of counter overflows to the number of ETMes the TOF bit is set. @无返回 */ void ETM_SetTOFFrequency(ETM_Type *pETM, uint8_t u8TOFNUM)
{ ASSERT((ETM2 == pETM)); pETM->CONF &= ~ETM_CONF_NUMTOF_MASK; pETM->CONF |= ETM_CONF_NUMTOF(u8TOFNUM); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Sets the number of data units in the current DMAy Channelx transfer. */
void DMA_SetCurrDataCounter(DMA_Channel_TypeDef *DMAy_Channelx, uint16_t DataNumber)
/* Sets the number of data units in the current DMAy Channelx transfer. */ void DMA_SetCurrDataCounter(DMA_Channel_TypeDef *DMAy_Channelx, uint16_t DataNumber)
{ assert_param(IS_DMA_ALL_PERIPH(DMAy_Channelx)); DMAy_Channelx->CNDTR = DataNumber; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Output: void, but we will add to proto tree if !NULL. */
static void dissect_lsp_ori_buffersize_clv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int id_length, int length)
/* Output: void, but we will add to proto tree if !NULL. */ static void dissect_lsp_ori_buffersize_clv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int id_length, int length)
{ if ( length != 2 ) { proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_short_packet, tvb, offset, -1, "short lsp partition DIS(%d vs %d)", length, id_length ); return; } proto_tree_add_item(tree, hf_isis_lsp_originating_lsp_buffer_size, tvb, offset, length, ENC_BIG_ENDIAN); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This sequence is needed to properly initialize MC45 attached to OXCF950. I tried decreasing these msleep()s, but it worked properly (survived 1000 stop/start operations) with these timeouts (or bigger). */
static void quirk_wakeup_possio_gcc(struct pcmcia_device *link)
/* This sequence is needed to properly initialize MC45 attached to OXCF950. I tried decreasing these msleep()s, but it worked properly (survived 1000 stop/start operations) with these timeouts (or bigger). */ static void quirk_wakeup_possio_gcc(struct pcmcia_device *link)
{ struct serial_info *info = link->priv; unsigned int ctrl = info->c950ctrl; outb(0xA, ctrl + 1); msleep(100); outb(0xE, ctrl + 1); msleep(300); outb(0xC, ctrl + 1); msleep(100); outb(0xE, ctrl + 1); msleep(200); outb(0xF, ctrl + 1); msleep(100); outb(0xE, ctrl + 1); msleep(100); outb(0xC, ctrl + 1); }
robutest/uclinux
C++
GPL-2.0
60
/* Registers the event callback functions that should be called by the CAN interface. */
static void LeafLightRegisterEvents(tCanEvents const *events)
/* Registers the event callback functions that should be called by the CAN interface. */ static void LeafLightRegisterEvents(tCanEvents const *events)
{ assert(events != NULL); if (events != NULL) { leafLightEventsList = realloc(leafLightEventsList, (sizeof(tCanEvents) * (leafLightEventsEntries + 1))); assert(leafLightEventsList != NULL); if (leafLightEventsList != NULL) { leafLightEventsEntries++; leafLightEventsList[leafLightEventsEntries - 1] = *events; } else { leafLightEventsEntries = 0; } } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Read header information from EEPROM into global structure. */
static struct shc_eeprom __attribute__((section(".data")))
/* Read header information from EEPROM into global structure. */ static struct shc_eeprom __attribute__((section(".data")))
{ if (i2c_probe(CONFIG_SYS_I2C_EEPROM_ADDR)) { puts("Could not probe the EEPROM; something fundamentally wrong on the I2C bus.\n"); return -ENODEV; } if (i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, 2, (uchar *)&header, sizeof(header))) { puts("Could not read the EEPROM; something fundamentally wrong on the I2C bus.\n"); return -EIO; } if (header.magic != HDR_MAGIC) { printf("Incorrect magic number (0x%x) in EEPROM\n", header.magic); return -EIO; } shc_eeprom_valid = 1; return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* param base The LPI2C peripheral base address. param handle Pointer to the LPI2C master driver handle. param callback User provided pointer to the asynchronous callback function. param userData User provided pointer to the application callback data. */
void LPI2C_MasterTransferCreateHandle(LPI2C_Type *base, lpi2c_master_handle_t *handle, lpi2c_master_transfer_callback_t callback, void *userData)
/* param base The LPI2C peripheral base address. param handle Pointer to the LPI2C master driver handle. param callback User provided pointer to the asynchronous callback function. param userData User provided pointer to the application callback data. */ void LPI2C_MasterTransferCreateHandle(LPI2C_Type *base, lpi2c_master_handle_t *handle, lpi2c_master_transfer_callback_t callback, void *userData)
{ uint32_t instance; assert(handle); memset(handle, 0, sizeof(*handle)); instance = LPI2C_GetInstance(base); handle->completionCallback = callback; handle->userData = userData; s_lpi2cMasterHandle[instance] = handle; s_lpi2cMasterIsr = LPI2C_MasterTransferHandleIRQ; LPI2C_MasterDisableInterrupts(base, kMasterIrqFlags); EnableIRQ(kLpi2cIrqs[instance]); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* These {i,o}bf_status functions return whether the buffers are full or not. */
static unsigned int ibf_status(unsigned int port)
/* These {i,o}bf_status functions return whether the buffers are full or not. */ static unsigned int ibf_status(unsigned int port)
{ return !!(inb(port) & 0x02); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Remove a device from the list of MTD devices present in the system, and notify each currently active MTD 'user' of its departure. Returns zero on success or 1 on failure, which currently will happen if the requested device does not appear to be present in the list. */
int del_mtd_device(struct mtd_info *mtd)
/* Remove a device from the list of MTD devices present in the system, and notify each currently active MTD 'user' of its departure. Returns zero on success or 1 on failure, which currently will happen if the requested device does not appear to be present in the list. */ int del_mtd_device(struct mtd_info *mtd)
{ int ret; mutex_lock(&mtd_table_mutex); if (mtd_table[mtd->index] != mtd) { ret = -ENODEV; } else if (mtd->usecount) { printk(KERN_NOTICE "Removing MTD device #%d (%s) with use count %d\n", mtd->index, mtd->name, mtd->usecount); ret = -EBUSY; } else { struct mtd_notifier *not; device_unregister(&mtd->dev); list_for_each_entry(not, &mtd_notifiers, list) not->remove(mtd); mtd_table[mtd->index] = NULL; module_put(THIS_MODULE); ret = 0; } mutex_unlock(&mtd_table_mutex); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Check padding data all bit should be 1. */
BOOLEAN CheckPaddingData(IN UINT8 *Buffer, IN UINT32 BufferSize)
/* Check padding data all bit should be 1. */ BOOLEAN CheckPaddingData(IN UINT8 *Buffer, IN UINT32 BufferSize)
{ UINT32 index; for (index = 0; index < BufferSize; index++) { if (Buffer[index] != 0xFF) { return FALSE; } } return TRUE; }
tianocore/edk2
C++
Other
4,240
/* Free what has been allocated by avcodec_thread_init(). Must be called after decoding has finished, especially do not call while avcodec_thread_execute() is running. */
void avcodec_thread_free(AVCodecContext *s)
/* Free what has been allocated by avcodec_thread_init(). Must be called after decoding has finished, especially do not call while avcodec_thread_execute() is running. */ void avcodec_thread_free(AVCodecContext *s)
{ c[i].func= NULL; release_sem(c[i].work_sem); wait_for_thread(c[i].thread, &ret); if(c[i].work_sem > B_OK) delete_sem(c[i].work_sem); if(c[i].done_sem > B_OK) delete_sem(c[i].done_sem); } av_freep(&s->thread_opaque); }
DC-SWAT/DreamShell
C++
null
404
/* The delay is 3 AC97 link frames + the touchpanel settling delay */
static void poll_delay(int d)
/* The delay is 3 AC97 link frames + the touchpanel settling delay */ static void poll_delay(int d)
{ udelay(3 * AC97_LINK_FRAME + delay_table[d]); }
robutest/uclinux
C++
GPL-2.0
60
/* return status (called by SMT) type state remote phy type remote mac yes/no */
void pcm_status_state(struct s_smc *smc, int np, int *type, int *state, int *remote, int *mac)
/* return status (called by SMT) type state remote phy type remote mac yes/no */ void pcm_status_state(struct s_smc *smc, int np, int *type, int *state, int *remote, int *mac)
{ struct s_phy *phy = &smc->y[np] ; struct fddi_mib_p *mib ; mib = phy->mib ; *mac = 0 ; *type = mib->fddiPORTMy_Type ; *state = mib->fddiPORTConnectState ; *remote = mib->fddiPORTNeighborType ; switch(mib->fddiPORTPCMState) { case PC8_ACTIVE : *mac = mib->fddiPORTMacIndicated.R_val ; break ; } }
robutest/uclinux
C++
GPL-2.0
60
/* Get the node at the input Index in the fixed argument list of the input ObjectNode. */
AML_NODE_HEADER* EFIAPI AmlGetFixedArgument(IN AML_OBJECT_NODE *ObjectNode, IN EAML_PARSE_INDEX Index)
/* Get the node at the input Index in the fixed argument list of the input ObjectNode. */ AML_NODE_HEADER* EFIAPI AmlGetFixedArgument(IN AML_OBJECT_NODE *ObjectNode, IN EAML_PARSE_INDEX Index)
{ if (IS_AML_OBJECT_NODE (ObjectNode)) { if (Index < (EAML_PARSE_INDEX)AmlGetFixedArgumentCount (ObjectNode)) { return ObjectNode->FixedArgs[Index]; } } return NULL; }
tianocore/edk2
C++
Other
4,240
/* tipc_media_get_names - record names of registered media in buffer */
struct sk_buff* tipc_media_get_names(void)
/* tipc_media_get_names - record names of registered media in buffer */ struct sk_buff* tipc_media_get_names(void)
{ struct sk_buff *buf; struct media *m_ptr; int i; buf = tipc_cfg_reply_alloc(MAX_MEDIA * TLV_SPACE(TIPC_MAX_MEDIA_NAME)); if (!buf) return NULL; read_lock_bh(&tipc_net_lock); for (i = 0, m_ptr = media_list; i < media_count; i++, m_ptr++) { tipc_cfg_append_tlv(buf, TIPC_TLV_MEDIA_NAME, m_ptr->name, strlen(m_ptr->name) + 1); } read_unlock_bh(&tipc_net_lock); return buf; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return: 0 if all went ok, else corresponding error message */
static int k3_sec_proxy_thread_setup(struct k3_sec_proxy_mbox *spm)
/* Return: 0 if all went ok, else corresponding error message */ static int k3_sec_proxy_thread_setup(struct k3_sec_proxy_mbox *spm)
{ struct k3_sec_proxy_thread *spt; int i, ind; for (i = 0; i < spm->desc->num_valid_threads; i++) { spt = &spm->chans[i]; ind = spm->desc->valid_threads[i]; spt->id = ind; spt->data = (void *)SEC_PROXY_THREAD(spm->target_data, ind); spt->scfg = (void *)SEC_PROXY_THREAD(spm->scfg, ind); spt->rt = (void *)SEC_PROXY_THREAD(spm->rt, ind); spt->rx_buf = calloc(1, spm->desc->max_msg_size); if (!spt->rx_buf) return -ENOMEM; } return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* For non-root nodes this is equivalent to xfs_bmbt_get_maxrecs, but for the root node this checks the available space in the dinode fork so that we can resize the in-memory buffer to match it. After a resize to the maximum size this function returns the same value as xfs_bmbt_get_maxrecs for the root node, too. */
STATIC int xfs_bmbt_get_dmaxrecs(struct xfs_btree_cur *cur, int level)
/* For non-root nodes this is equivalent to xfs_bmbt_get_maxrecs, but for the root node this checks the available space in the dinode fork so that we can resize the in-memory buffer to match it. After a resize to the maximum size this function returns the same value as xfs_bmbt_get_maxrecs for the root node, too. */ STATIC int xfs_bmbt_get_dmaxrecs(struct xfs_btree_cur *cur, int level)
{ if (level != cur->bc_nlevels - 1) return cur->bc_mp->m_bmap_dmxr[level != 0]; return xfs_bmdr_maxrecs(cur->bc_mp, cur->bc_private.b.forksize, level == 0); }
robutest/uclinux
C++
GPL-2.0
60
/* Return nonzero if the data is returned in MSB-to-LSB bit order. */
int TIFFIsMSB2LSB(TIFF *tif)
/* Return nonzero if the data is returned in MSB-to-LSB bit order. */ int TIFFIsMSB2LSB(TIFF *tif)
{ return (isFillOrder(tif, FILLORDER_MSB2LSB)); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Clears the RCC reset flags. The reset flags are: RCC_FLAG_OBLRST, RCC_FLAG_PINRST, RCC_FLAG_PORRST, RCC_FLAG_SFTRST, RCC_FLAG_IWDGRST, RCC_FLAG_WWDGRST, RCC_FLAG_LPWRRST. */
void RCC_ClearFlag(void)
/* Clears the RCC reset flags. The reset flags are: RCC_FLAG_OBLRST, RCC_FLAG_PINRST, RCC_FLAG_PORRST, RCC_FLAG_SFTRST, RCC_FLAG_IWDGRST, RCC_FLAG_WWDGRST, RCC_FLAG_LPWRRST. */ void RCC_ClearFlag(void)
{ RCC->CSR |= RCC_CSR_RMVF; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Creates a new and empty linked list that can be used for building a list with block nodes. Memory needed for the linked list object itself is allocated on the heap. */
static tBlockList * TbxMemPoolBlockListCreate(void)
/* Creates a new and empty linked list that can be used for building a list with block nodes. Memory needed for the linked list object itself is allocated on the heap. */ static tBlockList * TbxMemPoolBlockListCreate(void)
{ tBlockList * result; result = TbxHeapAllocate(sizeof(tBlockList)); if (result != NULL) { *result = NULL; } return result; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Set the slave select pins of the specified SPI port. The */
void SPISSSet(unsigned long ulBase, unsigned long ulSlaveSel)
/* Set the slave select pins of the specified SPI port. The */ void SPISSSet(unsigned long ulBase, unsigned long ulSlaveSel)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE) ||(ulBase == SPI3_BASE)); xASSERT((ulSlaveSel == SPI_SS_NONE) || (ulSlaveSel == SPI_SS0) || (ulSlaveSel == SPI_SS1) || (ulSlaveSel == SPI_SS0_SS1)); xHWREG(ulBase + SPI_SSR) &= ~SPI_SSR_SSR_M; xHWREG(ulBase + SPI_SSR) |= ulSlaveSel; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Displays a maximum of 20 char on the LCD. */
void LCD_DisplayStringLine(uint16_t Line, uint8_t *ptr)
/* Displays a maximum of 20 char on the LCD. */ void LCD_DisplayStringLine(uint16_t Line, uint8_t *ptr)
{ uint16_t refcolumn = LCD_PIXEL_WIDTH - 1; while ((*ptr != 0) & (((refcolumn + 1) & 0xFFFF) >= LCD_Currentfonts->Width)) { LCD_DisplayChar(Line, refcolumn, *ptr); refcolumn -= LCD_Currentfonts->Width; ptr++; } }
avem-labs/Avem
C++
MIT License
1,752
/* Functions that run in a work_queue work handling context */
static void cx18_mdl_send_to_dvb(struct cx18_stream *s, struct cx18_mdl *mdl)
/* Functions that run in a work_queue work handling context */ static void cx18_mdl_send_to_dvb(struct cx18_stream *s, struct cx18_mdl *mdl)
{ struct cx18_buffer *buf; if (!s->dvb.enabled || mdl->bytesused == 0) return; if (list_is_singular(&mdl->buf_list)) { buf = list_first_entry(&mdl->buf_list, struct cx18_buffer, list); if (buf->bytesused) dvb_dmx_swfilter(&s->dvb.demux, buf->buf, buf->bytesused); return; } list_for_each_entry(buf, &mdl->buf_list, list) { if (buf->bytesused == 0) break; dvb_dmx_swfilter(&s->dvb.demux, buf->buf, buf->bytesused); } }
robutest/uclinux
C++
GPL-2.0
60
/* This is a no-op stub of the SPI API's */
static int spi_emul_release(const struct device *dev, const struct spi_config *config)
/* This is a no-op stub of the SPI API's */ static int spi_emul_release(const struct device *dev, const struct spi_config *config)
{ ARG_UNUSED(dev); ARG_UNUSED(config); return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* e1000_read_mac_addr_vf - Read device MAC address @hw: pointer to the HW structure */
static s32 e1000_read_mac_addr_vf(struct e1000_hw *)
/* e1000_read_mac_addr_vf - Read device MAC address @hw: pointer to the HW structure */ static s32 e1000_read_mac_addr_vf(struct e1000_hw *)
{ int i; for (i = 0; i < ETH_ADDR_LEN; i++) hw->mac.addr[i] = hw->mac.perm_addr[i]; return E1000_SUCCESS; }
robutest/uclinux
C++
GPL-2.0
60
/* Free vm_structs and the array allocated by pcpu_get_vm_areas(). */
void pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms)
/* Free vm_structs and the array allocated by pcpu_get_vm_areas(). */ void pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms)
{ int i; for (i = 0; i < nr_vms; i++) free_vm_area(vms[i]); kfree(vms); }
robutest/uclinux
C++
GPL-2.0
60
/* Description: called by writing "scsi remove-single-device" to /proc/scsi/scsi. Does a scsi_device_lookup() and scsi_remove_device() */
static int scsi_remove_single_device(uint host, uint channel, uint id, uint lun)
/* Description: called by writing "scsi remove-single-device" to /proc/scsi/scsi. Does a scsi_device_lookup() and scsi_remove_device() */ static int scsi_remove_single_device(uint host, uint channel, uint id, uint lun)
{ struct scsi_device *sdev; struct Scsi_Host *shost; int error = -ENXIO; shost = scsi_host_lookup(host); if (!shost) return error; sdev = scsi_device_lookup(shost, channel, id, lun); if (sdev) { scsi_remove_device(sdev); scsi_device_put(sdev); error = 0; } scsi_host_put(shost); return error; }
robutest/uclinux
C++
GPL-2.0
60
/* Q7 neural network activation function using direct table look-up. Assume here the integer part of the fixed-point is <= 3. More than 3 just not making much sense, makes no difference with saturation followed by any of these activation functions. */
void arm_nn_activations_direct_q7(q7_t *data, uint16_t size, uint16_t int_width, arm_nn_activation_type type)
/* Q7 neural network activation function using direct table look-up. Assume here the integer part of the fixed-point is <= 3. More than 3 just not making much sense, makes no difference with saturation followed by any of these activation functions. */ void arm_nn_activations_direct_q7(q7_t *data, uint16_t size, uint16_t int_width, arm_nn_activation_type type)
{ uint16_t i = size; q7_t *pIn = data; q7_t *pOut = data; q7_t in; q7_t out; uint16_t shift_size = 3 - int_width; const q7_t *lookup_table; switch (type) { case ARM_SIGMOID: lookup_table = sigmoidTable_q7; break; case ARM_TANH: default: lookup_table = tanhTable_q7; break; } while (i) { in = *pIn++; out = lookup_table[(uint8_t) (in >> shift_size)]; *pOut++ = out; i--; } }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Checks whether the Tamper Pin Event flag is set or not. */
FlagStatus BKP_GetFlagStatus(void)
/* Checks whether the Tamper Pin Event flag is set or not. */ FlagStatus BKP_GetFlagStatus(void)
{ return (FlagStatus)(*(__IO uint32_t *) CSR_TEF_BB); }
gcallipo/RadioDSP-Stm32f103
C++
Common Creative - Attribution 3.0
51
/* Switches to assigned BSP after CPU features initialization. */
VOID EFIAPI SwitchBspAfterFeaturesInitialize(IN UINTN ProcessorNumber)
/* Switches to assigned BSP after CPU features initialization. */ VOID EFIAPI SwitchBspAfterFeaturesInitialize(IN UINTN ProcessorNumber)
{ CPU_FEATURES_DATA *CpuFeaturesData; CpuFeaturesData = GetCpuFeaturesData (); CpuFeaturesData->BspNumber = ProcessorNumber; }
tianocore/edk2
C++
Other
4,240
/* Change Logs: Date Author Notes BruceOu first implementation */
static void systick_config(rt_uint32_t ticks)
/* Change Logs: Date Author Notes BruceOu first implementation */ static void systick_config(rt_uint32_t ticks)
{ *(rt_uint64_t *) (TIMER_CTRL_ADDR + TIMER_MTIMECMP) = ticks; eclic_irq_enable(CLIC_INT_TMR, 0, 0); *(rt_uint64_t *) (TIMER_CTRL_ADDR + TIMER_MTIME) = 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Refresh the style of all children of an object. (Called recursively) */
static void report_style_mod_core(void *style_p, lv_obj_t *obj)
/* Refresh the style of all children of an object. (Called recursively) */ static void report_style_mod_core(void *style_p, lv_obj_t *obj)
{ lv_obj_t * i; LL_READ(obj->child_ll, i) { if(i->style_p == style_p || style_p == NULL) { refresh_childen_style(i); lv_obj_refresh_style(i); } report_style_mod_core(style_p, i); } }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* Tx has completed, mark the buffers that were assigned to the Tx descriptors as free again. */
void MSS_MAC_FreeTxBuffers(void)
/* Tx has completed, mark the buffers that were assigned to the Tx descriptors as free again. */ void MSS_MAC_FreeTxBuffers(void)
{ if( g_mss_mac.tx_descriptors[ 0 ].buffer_1 != NULL ) { if( ( ( (g_mss_mac.tx_descriptors[ 0 ].descriptor_0) & TDES0_OWN) == 0 ) && ( ( (g_mss_mac.tx_descriptors[ 1 ].descriptor_0) & TDES0_OWN) == 0 ) ) { configASSERT( g_mss_mac.tx_descriptors[ 0 ].buffer_1 == g_mss_mac.tx_descriptors[ 1 ].buffer_1 ); MAC_release_buffer( ( unsigned char * ) g_mss_mac.tx_descriptors[ 0 ].buffer_1 ); g_mss_mac.tx_descriptors[ 0 ].buffer_1 = NULL; } } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Enable the time tick or alarm interrupt of RTC. The */
void RTCIntEnable(unsigned long ulIntType)
/* Enable the time tick or alarm interrupt of RTC. The */ void RTCIntEnable(unsigned long ulIntType)
{ xASSERT(((ulIntType & RTC_INT_TIME_TICK) == RTC_INT_TIME_TICK) || ((ulIntType & RTC_INT_ALARM) == RTC_INT_ALARM) || ((ulIntType & RTC_INT_OVERFLOW) == RTC_INT_OVERFLOW)); xHWREG(RTC_IWEN) |= ulIntType; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104