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 |
|---|---|---|---|---|---|---|---|
/* USB hub control transfer to set the hub depth. */ | EFI_STATUS UsbHubCtrlSetHubDepth(IN USB_DEVICE *HubDev, IN UINT16 Depth) | /* USB hub control transfer to set the hub depth. */
EFI_STATUS UsbHubCtrlSetHubDepth(IN USB_DEVICE *HubDev, IN UINT16 Depth) | {
EFI_STATUS Status;
Status = UsbCtrlRequest (
HubDev,
EfiUsbNoData,
USB_REQ_TYPE_CLASS,
USB_HUB_TARGET_HUB,
USB_HUB_REQ_SET_DEPTH,
Depth,
0,
NULL,
0
);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* You must know what list the SKB is on. */ | void skb_unlink(struct sk_buff *skb, struct sk_buff_head *list) | /* You must know what list the SKB is on. */
void skb_unlink(struct sk_buff *skb, struct sk_buff_head *list) | {
unsigned long flags;
spin_lock_irqsave(&list->lock, flags);
__skb_unlink(skb, list);
spin_unlock_irqrestore(&list->lock, flags);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* The function sets different link parameters provided by the user onto the NIC. Return value: 0 on success. */ | static int vxge_ethtool_sset(struct net_device *dev, struct ethtool_cmd *info) | /* The function sets different link parameters provided by the user onto the NIC. Return value: 0 on success. */
static int vxge_ethtool_sset(struct net_device *dev, struct ethtool_cmd *info) | {
if ((info->autoneg == AUTONEG_ENABLE) ||
(info->speed != SPEED_10000) || (info->duplex != DUPLEX_FULL))
return -EINVAL;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If Eax is not NULL, then the value of EAX after CPUID is returned in Eax. If Ebx is not NULL, then the value of EBX after CPUID is returned in Ebx. If Ecx is not NULL, then the value of ECX after CPUID is returned in Ecx. If Edx is not NULL, then the value of EDX after CPUID is returned in Edx. */ | UINT32 EFIAPI UnitTestHostBaseLibAsmCpuidEx(IN UINT32 Index, IN UINT32 SubIndex, OUT UINT32 *Eax OPTIONAL, OUT UINT32 *Ebx OPTIONAL, OUT UINT32 *Ecx OPTIONAL, OUT UINT32 *Edx OPTIONAL) | /* If Eax is not NULL, then the value of EAX after CPUID is returned in Eax. If Ebx is not NULL, then the value of EBX after CPUID is returned in Ebx. If Ecx is not NULL, then the value of ECX after CPUID is returned in Ecx. If Edx is not NULL, then the value of EDX after CPUID is returned in Edx. */
UINT32 EFIAPI Unit... | {
if (Eax != NULL) {
*Eax = 0;
}
if (Ebx != NULL) {
*Ebx = 0;
}
if (Ecx != NULL) {
*Ecx = 0;
}
if (Edx != NULL) {
*Edx = 0;
}
return Index;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* On success, return a pointer to the newly allocated, or recycled, memory. On error, return -errno. The following error codes are defined: -ENOMEM - Not enough memory to allocate runlist array. -EINVAL - Invalid parameters were passed in. */ | static runlist_element* ntfs_rl_realloc(runlist_element *rl, int old_size, int new_size) | /* On success, return a pointer to the newly allocated, or recycled, memory. On error, return -errno. The following error codes are defined: -ENOMEM - Not enough memory to allocate runlist array. -EINVAL - Invalid parameters were passed in. */
static runlist_element* ntfs_rl_realloc(runlist_element *rl, int old_size, ... | {
runlist_element *new_rl;
old_size = PAGE_ALIGN(old_size * sizeof(*rl));
new_size = PAGE_ALIGN(new_size * sizeof(*rl));
if (old_size == new_size)
return rl;
new_rl = ntfs_malloc_nofs(new_size);
if (unlikely(!new_rl))
return ERR_PTR(-ENOMEM);
if (likely(rl != NULL)) {
if (unlikely(old_size > new_size))
... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Called by fc_user_scan to locate an rport on the shost that matches the channel and target id, and invoke scsi_scan_target() on the rport. */ | static void fc_user_scan_tgt(struct Scsi_Host *shost, uint channel, uint id, uint lun) | /* Called by fc_user_scan to locate an rport on the shost that matches the channel and target id, and invoke scsi_scan_target() on the rport. */
static void fc_user_scan_tgt(struct Scsi_Host *shost, uint channel, uint id, uint lun) | {
struct fc_rport *rport;
unsigned long flags;
spin_lock_irqsave(shost->host_lock, flags);
list_for_each_entry(rport, &fc_host_rports(shost), peers) {
if (rport->scsi_target_id == -1)
continue;
if (rport->port_state != FC_PORTSTATE_ONLINE)
continue;
if ((channel == rport->channel) &&
(id == rport-... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enable/disable the FIFO mode of the specified SPI port.
The */ | void SPIFIFOModeSet(unsigned long ulBase, xtBoolean xtEnable, unsigned long ulInterval) | /* Enable/disable the FIFO mode of the specified SPI port.
The */
void SPIFIFOModeSet(unsigned long ulBase, xtBoolean xtEnable, unsigned long ulInterval) | {
xASSERT(ulBase == SPI0_BASE);
xASSERT((ulInterval == 0) ||((ulInterval >= 2) && (ulInterval <= 15)));
if (xtEnable)
{
xHWREG(ulBase + SPI_CNTRL) &= ~SPI_CNTRL_SP_CYCLE_M;
xHWREG(ulBase + SPI_CNTRL) |= (ulInterval << SPI_CNTRL_SP_CYCLE_S);
xHWREG(ulBase + SPI_CNTRL) |= SPI_CNTRL... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Probe the media status and return EFI_NO_MEDIA or EFI_MEDIA_CHANGED for no media or media change case. Otherwise DefaultStatus is returned. */ | EFI_STATUS ProbeMediaStatus(IN EFI_DISK_IO_PROTOCOL *DiskIo, IN UINT32 MediaId, IN EFI_STATUS DefaultStatus) | /* Probe the media status and return EFI_NO_MEDIA or EFI_MEDIA_CHANGED for no media or media change case. Otherwise DefaultStatus is returned. */
EFI_STATUS ProbeMediaStatus(IN EFI_DISK_IO_PROTOCOL *DiskIo, IN UINT32 MediaId, IN EFI_STATUS DefaultStatus) | {
EFI_STATUS Status;
UINT8 Buffer[1];
Status = DiskIo->ReadDisk (DiskIo, MediaId, 0, 1, (VOID *)Buffer);
if ((Status == EFI_NO_MEDIA) || (Status == EFI_MEDIA_CHANGED)) {
return Status;
}
return DefaultStatus;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If PatchVariable is NULL, then ASSERT(). If SizeOfPatchVariable is NULL, then ASSERT(). If SizeOfBuffer is NULL, then ASSERT(). If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). */ | RETURN_STATUS EFIAPI LibPatchPcdSetPtrAndSizeS(OUT VOID *PatchVariable, OUT UINTN *SizeOfPatchVariable, IN UINTN MaximumDatumSize, IN OUT UINTN *SizeOfBuffer, IN CONST VOID *Buffer) | /* If PatchVariable is NULL, then ASSERT(). If SizeOfPatchVariable is NULL, then ASSERT(). If SizeOfBuffer is NULL, then ASSERT(). If SizeOfBuffer > 0 and Buffer is NULL, then ASSERT(). */
RETURN_STATUS EFIAPI LibPatchPcdSetPtrAndSizeS(OUT VOID *PatchVariable, OUT UINTN *SizeOfPatchVariable, IN UINTN MaximumDatumSize, ... | {
ASSERT (PatchVariable != NULL);
ASSERT (SizeOfPatchVariable != NULL);
ASSERT (SizeOfBuffer != NULL);
if (*SizeOfBuffer > 0) {
ASSERT (Buffer != NULL);
}
if ((*SizeOfBuffer > MaximumDatumSize) ||
(*SizeOfBuffer == MAX_ADDRESS))
{
*SizeOfBuffer = MaximumDatumSize;
return RETURN_INVALID_... | tianocore/edk2 | C++ | Other | 4,240 |
/* Reads byteCount number of bytes from the EZRadio SPI port. */ | void ezradio_hal_SpiReadData(uint8_t byteCount, uint8_t *pData) | /* Reads byteCount number of bytes from the EZRadio SPI port. */
void ezradio_hal_SpiReadData(uint8_t byteCount, uint8_t *pData) | {
SPIDRV_MReceiveB(ezradioSpiHandlePtr, pData, byteCount);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* The board id and revision are stored both in the reset register and in the PCI configuration space - the documentation says to check each of them. If revp!=NULL we store the revision there */ | static int check_board_id_and_rev(const char *name, u32 val, int *revp) | /* The board id and revision are stored both in the reset register and in the PCI configuration space - the documentation says to check each of them. If revp!=NULL we store the revision there */
static int check_board_id_and_rev(const char *name, u32 val, int *revp) | {
DPRINTK("%s says board_id=%d, board_rev=%d\n", name,
(int) RESET_GET_BOARD_ID(val),
(int) RESET_GET_BOARD_REV(val));
if (RESET_GET_BOARD_ID(val) != BOARD_ID_LANAI256) {
printk(KERN_ERR DEV_LABEL ": Found %s board-id %d -- not a "
"Lanai 25.6\n", name, (int) RESET_GET_BOARD_ID(val));
return -ENODEV;
}... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Truncate a byte range, avoiding pages within partial clusters. This preserves those pages for the zeroing code to write to. */ | static void ocfs2_truncate_cluster_pages(struct inode *inode, u64 byte_start, u64 byte_len) | /* Truncate a byte range, avoiding pages within partial clusters. This preserves those pages for the zeroing code to write to. */
static void ocfs2_truncate_cluster_pages(struct inode *inode, u64 byte_start, u64 byte_len) | {
struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
loff_t start, end;
struct address_space *mapping = inode->i_mapping;
start = (loff_t)ocfs2_align_bytes_to_clusters(inode->i_sb, byte_start);
end = byte_start + byte_len;
end = end & ~(osb->s_clustersize - 1);
if (start < end) {
unmap_mapping_range(mapping, sta... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Fix an expression to return the number of results 'nresults'. Either 'e' is a multi-ret expression (function call or vararg) or 'nresults' is LUA_MULTRET (as any expression can satisfy that). */ | void luaK_setreturns(FuncState *fs, expdesc *e, int nresults) | /* Fix an expression to return the number of results 'nresults'. Either 'e' is a multi-ret expression (function call or vararg) or 'nresults' is LUA_MULTRET (as any expression can satisfy that). */
void luaK_setreturns(FuncState *fs, expdesc *e, int nresults) | {
SETARG_C(getinstruction(fs, e), nresults + 1);
}
else if (e->k == VVARARG) {
Instruction *pc = &getinstruction(fs, e);
SETARG_B(*pc, nresults + 1);
SETARG_A(*pc, fs->freereg);
luaK_reserveregs(fs, 1);
}
else lua_assert(nresults == LUA_MULTRET);
} | nodemcu/nodemcu-firmware | C++ | MIT License | 7,566 |
/* Converts a union code character to upper case. This functions converts a unicode character to upper case. If the input Letter is not a lower-cased letter, the original value is returned. */ | CHAR16 ToUpper(IN CHAR16 Letter) | /* Converts a union code character to upper case. This functions converts a unicode character to upper case. If the input Letter is not a lower-cased letter, the original value is returned. */
CHAR16 ToUpper(IN CHAR16 Letter) | {
if (('a' <= Letter) && (Letter <= 'z')) {
Letter = (CHAR16)(Letter - 0x20);
}
return Letter;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Make sure that delay_ms() is functional before calling this function! */ | void lcdInit() | /* Make sure that delay_ms() is functional before calling this function! */
void lcdInit() | {
lcdHardwareInit();
if (!WAS_RESET_BY_WATCHDOG_OR_SOFTWARE()) {
lcdReset();
}
} | opentx/opentx | C++ | GNU General Public License v2.0 | 2,025 |
/* Check whether the Range overlaps with any one in Ranges. */ | BOOLEAN RangesOverlap(IN MTRR_MEMORY_RANGE *Range, IN MTRR_MEMORY_RANGE *Ranges, IN UINTN Count) | /* Check whether the Range overlaps with any one in Ranges. */
BOOLEAN RangesOverlap(IN MTRR_MEMORY_RANGE *Range, IN MTRR_MEMORY_RANGE *Ranges, IN UINTN Count) | {
while (Count-- != 0) {
if ( ((Range->BaseAddress <= Ranges[Count].BaseAddress) && (Ranges[Count].BaseAddress < Range->BaseAddress + Range->Length))
|| ((Ranges[Count].BaseAddress <= Range->BaseAddress) && (Range->BaseAddress < Ranges[Count].BaseAddress + Ranges[Count].Length)))
{
return TRUE;
... | tianocore/edk2 | C++ | Other | 4,240 |
/* RCC Clear the Oscillator Ready Interrupt Flag.
Clear the interrupt flag that was set when a clock oscillator became ready to use. */ | void rcc_osc_ready_int_clear(enum rcc_osc osc) | /* RCC Clear the Oscillator Ready Interrupt Flag.
Clear the interrupt flag that was set when a clock oscillator became ready to use. */
void rcc_osc_ready_int_clear(enum rcc_osc osc) | {
switch (osc) {
case RCC_PLL:
RCC_CIR |= RCC_CIR_PLLRDYC;
break;
case RCC_PLL2:
RCC_CIR |= RCC_CIR_PLL2RDYC;
break;
case RCC_PLL3:
RCC_CIR |= RCC_CIR_PLL3RDYC;
break;
case RCC_HSE:
RCC_CIR |= RCC_CIR_HSERDYC;
break;
case RCC_HSI:
RCC_CIR |= RCC_CIR_HSIRDYC;
break;
case RCC_LSE:
RCC_CIR |= ... | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Transfer the connection's peer label to the newly created socket. */ | static void smack_inet_csk_clone(struct sock *sk, const struct request_sock *req) | /* Transfer the connection's peer label to the newly created socket. */
static void smack_inet_csk_clone(struct sock *sk, const struct request_sock *req) | {
struct socket_smack *ssp = sk->sk_security;
char *smack;
if (req->peer_secid != 0) {
smack = smack_from_secid(req->peer_secid);
strncpy(ssp->smk_packet, smack, SMK_MAXLEN);
} else
ssp->smk_packet[0] = '\0';
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* param base eDMA peripheral base address. param channel eDMA channel number. param mask The mask of channel status to be cleared. Users need to use the defined _edma_channel_status_flags type. */ | void EDMA_ClearChannelStatusFlags(DMA_Type *base, uint32_t channel, uint32_t mask) | /* param base eDMA peripheral base address. param channel eDMA channel number. param mask The mask of channel status to be cleared. Users need to use the defined _edma_channel_status_flags type. */
void EDMA_ClearChannelStatusFlags(DMA_Type *base, uint32_t channel, uint32_t mask) | {
assert(channel < FSL_FEATURE_EDMA_MODULE_CHANNEL);
if (mask & kEDMA_DoneFlag)
{
base->CDNE = channel;
}
if (mask & kEDMA_ErrorFlag)
{
base->CERR = channel;
}
if (mask & kEDMA_InterruptFlag)
{
base->CINT = channel;
}
} | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* param base USART peripheral base address. param handle USART handle pointer. param count Receive bytes count. retval kStatus_NoTransferInProgress No receive in progress. retval kStatus_InvalidArgument Parameter is invalid. retval kStatus_Success Get successfully through the parameter */ | status_t USART_TransferGetReceiveCount(USART_Type *base, usart_handle_t *handle, uint32_t *count) | /* param base USART peripheral base address. param handle USART handle pointer. param count Receive bytes count. retval kStatus_NoTransferInProgress No receive in progress. retval kStatus_InvalidArgument Parameter is invalid. retval kStatus_Success Get successfully through the parameter */
status_t USART_TransferGetRe... | {
assert(NULL != handle);
assert(NULL != count);
if ((uint8_t)kUSART_RxIdle == handle->rxState)
{
return kStatus_NoTransferInProgress;
}
*count = handle->rxDataSizeAll - handle->rxDataSize;
return kStatus_Success;
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Free register 'reg', if it is neither a constant index nor a local variable. ) */ | static void freereg(FuncState *fs, int reg) | /* Free register 'reg', if it is neither a constant index nor a local variable. ) */
static void freereg(FuncState *fs, int reg) | {
fs->freereg--;
lua_assert(reg == fs->freereg);
}
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* Remove bdi from the global list and shutdown any threads we have running */ | static void bdi_wb_shutdown(struct backing_dev_info *bdi) | /* Remove bdi from the global list and shutdown any threads we have running */
static void bdi_wb_shutdown(struct backing_dev_info *bdi) | {
struct bdi_writeback *wb;
if (!bdi_cap_writeback_dirty(bdi))
return;
wait_on_bit(&bdi->state, BDI_pending, bdi_sched_wait,
TASK_UNINTERRUPTIBLE);
bdi_remove_from_list(bdi);
list_for_each_entry(wb, &bdi->wb_list, list) {
thaw_process(wb->task);
kthread_stop(wb->task);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The first thing we do is save the registers so we can use a naked attribute. */ | void vPortYield(void) | /* The first thing we do is save the registers so we can use a naked attribute. */
void vPortYield(void) | {
asm volatile ( "push r2" );
_DINT();
portSAVE_CONTEXT();
vTaskSwitchContext();
portRESTORE_CONTEXT();
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* bsec_read_shadow() - read an otp data value from shadow @base: base address of bsec IP @val: read value @otp: otp number (0 - BSEC_OTP_MAX_VALUE) Return: 0 if no error */ | static int bsec_read_shadow(u32 base, u32 *val, u32 otp) | /* bsec_read_shadow() - read an otp data value from shadow @base: base address of bsec IP @val: read value @otp: otp number (0 - BSEC_OTP_MAX_VALUE) Return: 0 if no error */
static int bsec_read_shadow(u32 base, u32 *val, u32 otp) | {
*val = readl(base + BSEC_OTP_DATA_OFF + otp * sizeof(u32));
return bsec_check_error(base, otp);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Register address automatically incremented during a multiple byte access with a serial interface.. */ | int32_t lsm6dso_auto_increment_set(stmdev_ctx_t *ctx, uint8_t val) | /* Register address automatically incremented during a multiple byte access with a serial interface.. */
int32_t lsm6dso_auto_increment_set(stmdev_ctx_t *ctx, uint8_t val) | {
lsm6dso_ctrl3_c_t reg;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_CTRL3_C, (uint8_t *)®, 1);
if (ret == 0) {
reg.if_inc = val;
ret = lsm6dso_write_reg(ctx, LSM6DSO_CTRL3_C, (uint8_t *)®, 1);
}
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* In all other cases, there is no concept of ownership on a STA entry, each structure is owned by the global hash table/list until it is removed. All users of the structure need to be RCU protected so that the structure won't be freed before they are done using it. */ | static int sta_info_hash_del(struct ieee80211_local *local, struct sta_info *sta) | /* In all other cases, there is no concept of ownership on a STA entry, each structure is owned by the global hash table/list until it is removed. All users of the structure need to be RCU protected so that the structure won't be freed before they are done using it. */
static int sta_info_hash_del(struct ieee80211_loc... | {
struct sta_info *s;
s = local->sta_hash[STA_HASH(sta->sta.addr)];
if (!s)
return -ENOENT;
if (s == sta) {
rcu_assign_pointer(local->sta_hash[STA_HASH(sta->sta.addr)],
s->hnext);
return 0;
}
while (s->hnext && s->hnext != sta)
s = s->hnext;
if (s->hnext) {
rcu_assign_pointer(s->hnext, sta->hnex... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Converts a text device path node to USB device firmware update device path structure. */ | EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbDeviceFirmwareUpdate(CHAR16 *TextDeviceNode) | /* Converts a text device path node to USB device firmware update device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbDeviceFirmwareUpdate(CHAR16 *TextDeviceNode) | {
USB_CLASS_TEXT UsbClassText;
UsbClassText.ClassExist = FALSE;
UsbClassText.Class = USB_CLASS_RESERVE;
UsbClassText.SubClassExist = FALSE;
UsbClassText.SubClass = USB_SUBCLASS_FW_UPDATE;
return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Function to append a 64 bit number / 25 onto the string. */ | EFI_STATUS AppendCSDNum2(IN OUT POOL_PRINT *Str, IN UINT64 Num) | /* Function to append a 64 bit number / 25 onto the string. */
EFI_STATUS AppendCSDNum2(IN OUT POOL_PRINT *Str, IN UINT64 Num) | {
EFI_STATUS Status;
UINT64 Result;
UINT32 Rem;
ASSERT (Str != NULL);
Result = DivU64x32Remainder (Num, 25, &Rem);
if (Result > 0) {
Status = AppendCSDNum2 (Str, Result);
if (EFI_ERROR (Status)) {
return Status;
}
}
return CatPrint (Str, L"%c", Rem + 'a');
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Let drivers register callback in order to get notified when there is an interrupt on the gpio pin */ | int gpio_register_callback(unsigned gpio, int(*func)(void *arg), void *data) | /* Let drivers register callback in order to get notified when there is an interrupt on the gpio pin */
int gpio_register_callback(unsigned gpio, int(*func)(void *arg), void *data) | {
if (gpio_pin[gpio].callback)
dev_warn(gpiodev, "%s: WARNING: callback already "
"registered for gpio pin#%d\n", __func__, gpio);
gpio_pin[gpio].callback = func;
gpio_pin[gpio].data = data;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Waits to send a character from the specified port. */ | void UARTCharPut(unsigned long ulBase, unsigned char ucData) | /* Waits to send a character from the specified port. */
void UARTCharPut(unsigned long ulBase, unsigned char ucData) | {
ASSERT(UARTBaseValid(ulBase));
while(HWREG(ulBase + UART_O_FR) & UART_FR_TXFF)
{
}
HWREG(ulBase + UART_O_DR) = ucData;
} | watterott/WebRadio | C++ | null | 71 |
/* ISR for the GPMI dma complete IRQ.
Then clears and enables the interrupt. */ | void gpmi_dma_complete_isr() | /* ISR for the GPMI dma complete IRQ.
Then clears and enables the interrupt. */
void gpmi_dma_complete_isr() | {
GpmiDmaInfo_t * pWaitStruct = &g_gpmi.dmaInfo;
bool bSomeError = FALSE;
if ((HW_APBH_CTRL2_RD() & (BM_APBH_CTRL2_CH0_ERROR_IRQ << (pWaitStruct->dmaChannel))) != 0)
{
HW_APBH_CTRL2_CLR(BP_APBH_CTRL2_CH0_ERROR_IRQ << pWaitStruct->dmaChannel);
bSomeError = TRUE;
}
pWaitStruct->u16... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* pcm_data_rec_task() - n/a yet Triggered by the driver ISR when data for record mode is available. */ | static int dispatch_callback(lua_State *L, int self_ref, int cb_ref, int returns) | /* pcm_data_rec_task() - n/a yet Triggered by the driver ISR when data for record mode is available. */
static int dispatch_callback(lua_State *L, int self_ref, int cb_ref, int returns) | {
if (cb_ref != LUA_NOREF) {
lua_rawgeti( L, LUA_REGISTRYINDEX, cb_ref );
lua_rawgeti( L, LUA_REGISTRYINDEX, self_ref );
return luaL_pcallx( L, 1, returns );
}
return LUA_OK;
} | nodemcu/nodemcu-firmware | C++ | MIT License | 7,566 |
/* param config Pointer to configuration structure. See to "dcdc_low_power_config_t" */ | void DCDC_GetDefaultLowPowerConfig(dcdc_low_power_config_t *config) | /* param config Pointer to configuration structure. See to "dcdc_low_power_config_t" */
void DCDC_GetDefaultLowPowerConfig(dcdc_low_power_config_t *config) | {
assert(NULL != config);
memset(config, 0, sizeof(*config));
config->enableOverloadDetection = true;
config->enableAdjustHystereticValue = false;
config->countChargingTimePeriod = kDCDC_CountChargingTimePeriod8Cycle;
config->countChargingTimeThreshold = kDCDC_CountChargingTimeThreshold... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Close the protocol identified by its GUID on the child handle of the service identified by its service binding protocol GUID, then destroy the child handle. */ | STATIC VOID CloseProtocolAndDestroyServiceChild(IN EFI_HANDLE ControllerHandle, IN EFI_GUID *ServiceBindingProtocolGuid, IN EFI_GUID *ProtocolGuid, IN EFI_HANDLE ChildHandle) | /* Close the protocol identified by its GUID on the child handle of the service identified by its service binding protocol GUID, then destroy the child handle. */
STATIC VOID CloseProtocolAndDestroyServiceChild(IN EFI_HANDLE ControllerHandle, IN EFI_GUID *ServiceBindingProtocolGuid, IN EFI_GUID *ProtocolGuid, IN EFI_HA... | {
gBS->CloseProtocol (
ChildHandle,
ProtocolGuid,
gImageHandle,
ControllerHandle
);
NetLibDestroyServiceChild (
ControllerHandle,
gImageHandle,
ServiceBindingProtocolGuid,
ChildHandle
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Compare pbuf contents at specified offset with memory s2, both of length n */ | u16_t pbuf_memcmp(struct pbuf *p, u16_t offset, const void *s2, u16_t n) | /* Compare pbuf contents at specified offset with memory s2, both of length n */
u16_t pbuf_memcmp(struct pbuf *p, u16_t offset, const void *s2, u16_t n) | {
u16_t start = offset;
struct pbuf* q = p;
while ((q != NULL) && (q->len <= start)) {
start -= q->len;
q = q->next;
}
if ((q != NULL) && (q->len > start)) {
u16_t i;
for(i = 0; i < n; i++) {
u8_t a = pbuf_get_at(q, start + i);
u8_t b = ((u8_t*)s2)[i];
if (a != b) {
r... | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* If HmacSha384Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ | BOOLEAN EFIAPI HmacSha384Update(IN OUT VOID *HmacSha384Context, IN CONST VOID *Data, IN UINTN DataSize) | /* If HmacSha384Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI HmacSha384Update(IN OUT VOID *HmacSha384Context, IN CONST VOID *Data, IN UINTN DataSize) | {
CALL_CRYPTO_SERVICE (HmacSha384Update, (HmacSha384Context, Data, DataSize), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Adjust the multiplier to reduce the error value, this is optimized for the most common adjustments of -1,0,1, for other values we can do a bit more work. */ | static void timekeeping_adjust(s64 offset) | /* Adjust the multiplier to reduce the error value, this is optimized for the most common adjustments of -1,0,1, for other values we can do a bit more work. */
static void timekeeping_adjust(s64 offset) | {
s64 error, interval = timekeeper.cycle_interval;
int adj;
error = timekeeper.ntp_error >> (timekeeper.ntp_error_shift - 1);
if (error > interval) {
error >>= 2;
if (likely(error <= interval))
adj = 1;
else
adj = timekeeping_bigadjust(error, &interval, &offset);
} else if (error < -interval) {
error... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */ | UINT16 EFIAPI PciExpressBitFieldRead16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT16 EFIAPI PciExpressBitFieldRead16(IN UINTN Address, IN UINTN Start... | {
ASSERT_INVALID_PCI_ADDRESS (Address);
return MmioBitFieldRead16 (
(UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* get the user set circle value . This parameter can be one of the following values: */ | uint16_t GetSetRcnt(void) | /* get the user set circle value . This parameter can be one of the following values: */
uint16_t GetSetRcnt(void) | {
uint16_t Temp;
Temp = (uint16_t)LPRCNT->CTRL;
return Temp ;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Resets the device.
This function will perform a software reset of the entire device. Processor and all peripherals will be reset and all device registers will return to their default values (with the exception of the reset cause register, which will maintain its current value but have the software reset bit set as ... | void xSysCtlReset(void) | /* Resets the device.
This function will perform a software reset of the entire device. Processor and all peripherals will be reset and all device registers will return to their default values (with the exception of the reset cause register, which will maintain its current value but have the software reset bit set as ... | {
xHWREG(NVIC_APINT) = NVIC_APINT_VECTKEY | NVIC_APINT_SYSRESETREQ;
while(1)
{
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* this routine initializes driver's internal data in preparation of subsequent probe callbacks */ | void mcs7830_eth_before_probe(void) | /* this routine initializes driver's internal data in preparation of subsequent probe callbacks */
void mcs7830_eth_before_probe(void) | {
mcs7830_iface_idx = 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* This function returns information about a specific firmware volume, including its name, type, attributes, starting address and size. */ | EFI_STATUS EFIAPI PeiFfsGetVolumeInfo(IN EFI_PEI_FV_HANDLE VolumeHandle, OUT EFI_FV_INFO *VolumeInfo) | /* This function returns information about a specific firmware volume, including its name, type, attributes, starting address and size. */
EFI_STATUS EFIAPI PeiFfsGetVolumeInfo(IN EFI_PEI_FV_HANDLE VolumeHandle, OUT EFI_FV_INFO *VolumeInfo) | {
PEI_CORE_FV_HANDLE *CoreHandle;
if ((VolumeInfo == NULL) || (VolumeHandle == NULL)) {
return EFI_INVALID_PARAMETER;
}
CoreHandle = FvHandleToCoreHandle (VolumeHandle);
if ((CoreHandle == NULL) || (CoreHandle->FvPpi == NULL)) {
return EFI_INVALID_PARAMETER;
}
return CoreHandle->FvPpi->GetVolumeI... | tianocore/edk2 | C++ | Other | 4,240 |
/* Read a single byte from the serial port. Returns 1 on success, 0 otherwise. When the function is succesfull, the character read is written into its argument c. */ | int serial_getc(void) | /* Read a single byte from the serial port. Returns 1 on success, 0 otherwise. When the function is succesfull, the character read is written into its argument c. */
int serial_getc(void) | {
int rv;
for(;;) {
rv = serial_tstc();
if (rv) {
return uart->m_rx & 0xFF;
}
}
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Parameters : pin_number : The GPIO Pin number to program the direction for pin_value : The value of the GPIO Pin under reference. 0 = set it to 0 1 = set it to 1 */ | int cx231xx_set_gpio_value(struct cx231xx *dev, int pin_number, int pin_value) | /* Parameters : pin_number : The GPIO Pin number to program the direction for pin_value : The value of the GPIO Pin under reference. 0 = set it to 0 1 = set it to 1 */
int cx231xx_set_gpio_value(struct cx231xx *dev, int pin_number, int pin_value) | {
int status = 0;
u32 value = 0;
if (pin_number >= 32)
return -EINVAL;
if ((dev->gpio_dir & (1 << pin_number)) == 0x00) {
value = dev->gpio_dir | (1 << pin_number);
dev->gpio_dir = value;
status = cx231xx_set_gpio_bit(dev, dev->gpio_dir,
(u8 *) &dev->gpio_val);
value = 0;
}
if (pin_value == 0... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* ES1887 modifications: some mixer registers reside in the range above 0xa0. These must be accessed in another way. */ | void sb_setmixer(sb_devc *devc, unsigned int port, unsigned int value) | /* ES1887 modifications: some mixer registers reside in the range above 0xa0. These must be accessed in another way. */
void sb_setmixer(sb_devc *devc, unsigned int port, unsigned int value) | {
unsigned long flags;
if (devc->model == MDL_ESS) {
ess_setmixer (devc, port, value);
return;
}
spin_lock_irqsave(&devc->lock, flags);
outb(((unsigned char) (port & 0xff)), MIXER_ADDR);
udelay(20);
outb(((unsigned char) (value & 0xff)), MIXER_DATA);
udelay(20);
spin_unlock_irqrestore(&devc->lock, flags);
... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Open the high-level part of the X.25 channel. This function is called by the TTY module when the X.25 line discipline is called for. Because we are sure the tty line exists, we only have to link it to a free X.25 channel... */ | static int x25_asy_open_tty(struct tty_struct *tty) | /* Open the high-level part of the X.25 channel. This function is called by the TTY module when the X.25 line discipline is called for. Because we are sure the tty line exists, we only have to link it to a free X.25 channel... */
static int x25_asy_open_tty(struct tty_struct *tty) | {
struct x25_asy *sl = tty->disc_data;
int err;
if (tty->ops->write == NULL)
return -EOPNOTSUPP;
if (sl && sl->magic == X25_ASY_MAGIC)
return -EEXIST;
sl = x25_asy_alloc();
if (sl == NULL)
return -ENFILE;
sl->tty = tty;
tty->disc_data = sl;
tty->receive_room = 65536;
tty_driver_flush_buffer(tty);
tty_l... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns the endpoint interrupt status on a specified USB controller. */ | uint32_t USBIntStatusEndpoint(uint32_t ui32Base) | /* Returns the endpoint interrupt status on a specified USB controller. */
uint32_t USBIntStatusEndpoint(uint32_t ui32Base) | {
uint32_t ui32Status;
ASSERT(ui32Base == USB0_BASE);
ui32Status = HWREGH(ui32Base + USB_O_TXIS);
ui32Status |= (HWREGH(ui32Base + USB_O_RXIS) << USB_INTEP_RX_SHIFT);
return (ui32Status);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Allow caller to read a specific SMBIOS string */ | CHAR8* EFIAPI SmbiosLibReadString(IN SMBIOS_STRUCTURE *Header, IN EFI_SMBIOS_STRING StringNumber) | /* Allow caller to read a specific SMBIOS string */
CHAR8* EFIAPI SmbiosLibReadString(IN SMBIOS_STRUCTURE *Header, IN EFI_SMBIOS_STRING StringNumber) | {
CHAR8 *Data;
UINTN Match;
Data = (CHAR8 *)Header + Header->Length;
for (Match = 1; !(*Data == 0 && *(Data+1) == 0); ) {
if (StringNumber == Match) {
return Data;
}
Data++;
if (*(Data - 1) == '\0') {
Match++;
}
}
return NULL;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Checks whether the specified RTC flag is set or not. */ | FlagStatus RTC_GetFlagStatus(uint32_t RTC_FLAG) | /* Checks whether the specified RTC flag is set or not. */
FlagStatus RTC_GetFlagStatus(uint32_t RTC_FLAG) | {
FlagStatus bitstatus = RESET;
uint32_t tmpreg = 0;
assert_param(IS_RTC_GET_FLAG(RTC_FLAG));
tmpreg = (uint32_t)(RTC->ISR & RTC_FLAGS_MASK);
if ((tmpreg & RTC_FLAG) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Message: MediaPathEventMessage Opcode: 0x0049 Type: CallControl Direction: dev2pbx VarLength: no */ | static void handle_MediaPathEventMessage(ptvcursor_t *cursor, packet_info *pinfo _U_) | /* Message: MediaPathEventMessage Opcode: 0x0049 Type: CallControl Direction: dev2pbx VarLength: no */
static void handle_MediaPathEventMessage(ptvcursor_t *cursor, packet_info *pinfo _U_) | {
ptvcursor_add(cursor, hf_skinny_mediaPathID, 4, ENC_LITTLE_ENDIAN);
ptvcursor_add(cursor, hf_skinny_mediaPathEvent, 4, ENC_LITTLE_ENDIAN);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* do_fpu_inst - Handle reserved instructions for FPU emulation @inst: instruction code. @regs: registers on stack. */ | int do_fpu_inst(unsigned short inst, struct pt_regs *regs) | /* do_fpu_inst - Handle reserved instructions for FPU emulation @inst: instruction code. @regs: registers on stack. */
int do_fpu_inst(unsigned short inst, struct pt_regs *regs) | {
struct task_struct *tsk = current;
struct sh_fpu_soft_struct *fpu = &(tsk->thread.fpu.soft);
if (!(task_thread_info(tsk)->status & TS_USEDFPU)) {
fpu_init(fpu);
task_thread_info(tsk)->status |= TS_USEDFPU;
}
return fpu_emulate(inst, fpu, regs);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Enables or disables the USART's Half Duplex communication. */ | void USART_EnableHalfDuplex(USART_Module *USARTx, FunctionalState Cmd) | /* Enables or disables the USART's Half Duplex communication. */
void USART_EnableHalfDuplex(USART_Module *USARTx, FunctionalState Cmd) | {
assert_param(IS_USART_ALL_PERIPH(USARTx));
assert_param(IS_FUNCTIONAL_STATE(Cmd));
if (Cmd != DISABLE)
{
USARTx->CTRL3 |= CTRL3_HDMEN_SET;
}
else
{
USARTx->CTRL3 &= CTRL3_HDMEN_RESET;
}
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* If Buffer is not aligned on a 16-bit boundary, then ASSERT(). */ | UINT16* EFIAPI MmioReadBuffer16(IN UINTN StartAddress, IN UINTN Length, OUT UINT16 *Buffer) | /* If Buffer is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16* EFIAPI MmioReadBuffer16(IN UINTN StartAddress, IN UINTN Length, OUT UINT16 *Buffer) | {
UINT16 *ReturnBuffer;
ASSERT ((StartAddress & (sizeof (UINT16) - 1)) == 0);
ASSERT ((Length - 1) <= (MAX_ADDRESS - StartAddress));
ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer));
ASSERT ((Length & (sizeof (UINT16) - 1)) == 0);
ASSERT (((UINTN)Buffer & (sizeof (UINT16) - 1)) == 0);
ReturnBuffe... | tianocore/edk2 | C++ | Other | 4,240 |
/* This is necessitated by the fact that blk_cleanup_queue does not necesserily destroy the queue. Instead, it may merely decrease q->refcnt. Since our blk_init_queue() passes a spinlock common with */ | static spinlock_t* ub_next_lock(void) | /* This is necessitated by the fact that blk_cleanup_queue does not necesserily destroy the queue. Instead, it may merely decrease q->refcnt. Since our blk_init_queue() passes a spinlock common with */
static spinlock_t* ub_next_lock(void) | {
unsigned long flags;
spinlock_t *ret;
spin_lock_irqsave(&ub_lock, flags);
ret = &ub_qlockv[ub_qlock_next];
ub_qlock_next = (ub_qlock_next + 1) % UB_QLOCK_NUM;
spin_unlock_irqrestore(&ub_lock, flags);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get i2c index according to the SDA PinName. */ | static uint32_t i2c_index_get(PinName sda) | /* Get i2c index according to the SDA PinName. */
static uint32_t i2c_index_get(PinName sda) | {
if ((sda == _PA_26) || (sda == _PB_6)) {
return 0;
} else {
assert_param(0);
}
return 2;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Get the delta value of two index in queue. */ | static uint32_t CSI_TransferGetQueueDelta(uint32_t startIdx, uint32_t endIdx) | /* Get the delta value of two index in queue. */
static uint32_t CSI_TransferGetQueueDelta(uint32_t startIdx, uint32_t endIdx) | {
if (endIdx >= startIdx)
{
return endIdx - startIdx;
}
else
{
return startIdx + CSI_DRIVER_ACTUAL_QUEUE_SIZE - endIdx;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* XXX - whether we mention the source pathname, the target pathname, or both depends on the error and on what we find if we look for one or both of them. */ | static void cf_rename_failure_alert_box(const char *filename, int err) | /* XXX - whether we mention the source pathname, the target pathname, or both depends on the error and on what we find if we look for one or both of them. */
static void cf_rename_failure_alert_box(const char *filename, int err) | {
gchar *display_basename;
display_basename = g_filename_display_basename(filename);
switch (err) {
case ENOENT:
simple_error_message_box("The path to the file \"%s\" doesn't exist.",
display_basename);
break;
case EACCES:
simple_error_message_box("You don't have permi... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Returns SRTC time in seconds.
This function is used internally to get actual SRTC time in seconds. */ | static uint32_t SNVS_LP_SRTC_GetSeconds(SNVS_Type *base) | /* Returns SRTC time in seconds.
This function is used internally to get actual SRTC time in seconds. */
static uint32_t SNVS_LP_SRTC_GetSeconds(SNVS_Type *base) | {
uint32_t seconds = 0;
uint32_t tmp = 0;
do
{
seconds = tmp;
tmp = (base->LPSRTCMR << 17U);
tmp |= (base->LPSRTCLR >> 15U);
} while (tmp != seconds);
return seconds;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Initializes a #cairo_user_data_array_t structure for future use. After initialization, the array has no keys. Call _cairo_user_data_array_fini() to free any allocated memory when done using the array. */ | void _cairo_user_data_array_init(cairo_user_data_array_t *array) | /* Initializes a #cairo_user_data_array_t structure for future use. After initialization, the array has no keys. Call _cairo_user_data_array_fini() to free any allocated memory when done using the array. */
void _cairo_user_data_array_init(cairo_user_data_array_t *array) | {
_cairo_array_init (array, sizeof (cairo_user_data_slot_t));
} | xboot/xboot | C++ | MIT License | 779 |
/* init_parisc_bus - Some preparation to be done before inventory */ | void init_parisc_bus(void) | /* init_parisc_bus - Some preparation to be done before inventory */
void init_parisc_bus(void) | {
if (bus_register(&parisc_bus_type))
panic("Could not register PA-RISC bus type\n");
if (device_register(&root))
panic("Could not register PA-RISC root device\n");
get_device(&root);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Calculate the CRC32 value and start with the specified initial value. */ | uint32_t CRC_CRC32_Calculate(uint32_t u32InitValue, uint8_t u8DataWidth, const void *pvData, uint32_t u32Len) | /* Calculate the CRC32 value and start with the specified initial value. */
uint32_t CRC_CRC32_Calculate(uint32_t u32InitValue, uint8_t u8DataWidth, const void *pvData, uint32_t u32Len) | {
uint32_t u32CrcValue = 0UL;
if ((pvData != NULL) && (u32Len != 0UL)) {
WRITE_REG32(CM_CRC->RESLT, u32InitValue);
u32CrcValue = CRC_CRC32_AccumulateData(u8DataWidth, pvData, u32Len);
}
return u32CrcValue;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Called with preemption disabled, and from cross-cpu IRQ context. */ | static void rcu_barrier_func(void *type) | /* Called with preemption disabled, and from cross-cpu IRQ context. */
static void rcu_barrier_func(void *type) | {
int cpu = smp_processor_id();
struct rcu_head *head = &per_cpu(rcu_barrier_head, cpu);
void (*call_rcu_func)(struct rcu_head *head,
void (*func)(struct rcu_head *head));
atomic_inc(&rcu_barrier_cpu_count);
call_rcu_func = type;
call_rcu_func(head, rcu_barrier_callback);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* We want to tanks the Authors of those projects and the Ndiswrapper project Authors. */ | static void eprom_cs(struct net_device *dev, short bit) | /* We want to tanks the Authors of those projects and the Ndiswrapper project Authors. */
static void eprom_cs(struct net_device *dev, short bit) | {
if(bit)
write_nic_byte(dev, EPROM_CMD,
(1<<EPROM_CS_SHIFT) | \
read_nic_byte(dev, EPROM_CMD));
else
write_nic_byte(dev, EPROM_CMD, read_nic_byte(dev, EPROM_CMD)\
&~(1<<EPROM_CS_SHIFT));
force_pci_posting(dev);
udelay(EPROM_DELAY);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Return value: CAIRO_STATUS_SUCCESS if successful or CAIRO_STATUS_NO_MEMORY if insufficient memory is available. */ | cairo_status_t _cairo_hash_table_insert(cairo_hash_table_t *hash_table, cairo_hash_entry_t *key_and_value) | /* Return value: CAIRO_STATUS_SUCCESS if successful or CAIRO_STATUS_NO_MEMORY if insufficient memory is available. */
cairo_status_t _cairo_hash_table_insert(cairo_hash_table_t *hash_table, cairo_hash_entry_t *key_and_value) | {
cairo_hash_entry_t **entry;
cairo_status_t status;
assert (hash_table->iterating == 0);
status = _cairo_hash_table_manage (hash_table);
if (unlikely (status))
return status;
entry = _cairo_hash_table_lookup_unique_key (hash_table, key_and_value);
if (ENTRY_IS_FREE (*entry))
hash_table->f... | xboot/xboot | C++ | MIT License | 779 |
/* Get summary text of an expert_info field. This is intended for use in expert_add_info_format or proto_tree_add_expert_format to get the "base" string to then append additional information */ | const gchar* expert_get_summary(expert_field *eiindex) | /* Get summary text of an expert_info field. This is intended for use in expert_add_info_format or proto_tree_add_expert_format to get the "base" string to then append additional information */
const gchar* expert_get_summary(expert_field *eiindex) | {
expert_field_info *eiinfo;
EXPERT_REGISTRAR_GET_NTH(eiindex->ei, eiinfo);
return eiinfo->summary;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This is the connector callback that delivers data that was sent from userspace. */ | static void cn_ulog_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp) | /* This is the connector callback that delivers data that was sent from userspace. */
static void cn_ulog_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp) | {
struct dm_ulog_request *tfr = (struct dm_ulog_request *)(msg + 1);
if (!cap_raised(nsp->eff_cap, CAP_SYS_ADMIN))
return;
spin_lock(&receiving_list_lock);
if (msg->len == 0)
fill_pkg(msg, NULL);
else if (msg->len < sizeof(*tfr))
DMERR("Incomplete message received (expected %u, got %u): [%u]",
(unsig... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* hwconfig_arg_cmp_f - compare hwconfig option's argument @opt: a string representing an option */ | int hwconfig_arg_cmp_f(const char *opt, const char *arg, char *buf) | /* hwconfig_arg_cmp_f - compare hwconfig option's argument @opt: a string representing an option */
int hwconfig_arg_cmp_f(const char *opt, const char *arg, char *buf) | {
const char *argstr;
size_t arglen;
argstr = hwconfig_arg_f(opt, &arglen, buf);
if (!argstr || arglen != strlen(arg))
return 0;
return !strncmp(argstr, arg, arglen);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ | void GPIOPinTypeI2C(uint32_t ui32Port, uint8_t ui8Pins) | /* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinTypeI2C(uint32_t ui32Port, uint8_t ui8Pins) | {
ASSERT(_GPIOBaseValid(ui32Port));
GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_HW);
GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_OD);
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Get the length of the HPFEED message, including header This is a trivial function, but it's mandatory as it is used as a callback by the routine to re-assemble the protocol spread on multiple TCP packets */ | static guint get_hpfeeds_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_) | /* Get the length of the HPFEED message, including header This is a trivial function, but it's mandatory as it is used as a callback by the routine to re-assemble the protocol spread on multiple TCP packets */
static guint get_hpfeeds_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_) | {
return tvb_get_ntohl(tvb, offset + 0);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Checks whether the specified DMA2D's interrupt has occurred or not. */ | ITStatus DMA2D_GetITStatus(uint32_t DMA2D_IT) | /* Checks whether the specified DMA2D's interrupt has occurred or not. */
ITStatus DMA2D_GetITStatus(uint32_t DMA2D_IT) | {
ITStatus bitstatus = RESET;
uint32_t DMA2D_IT_FLAG = DMA2D_IT >> 8;
assert_param(IS_DMA2D_IT(DMA2D_IT));
if ((DMA2D->ISR & DMA2D_IT_FLAG) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
if (((DMA2D->CR & DMA2D_IT) != (uint32_t)RESET) && (bitstatus != (uint32_t)RESET))
... | MaJerle/stm32f429 | C++ | null | 2,036 |
/* USB Device Set Address Function Parameters: adr: USB Device Address Return Value: None */ | void USBD_SetAddress(U32 adr, U32 setup) | /* USB Device Set Address Function Parameters: adr: USB Device Address Return Value: None */
void USBD_SetAddress(U32 adr, U32 setup) | {
if (!setup) {
LPC_USB->DEVCMDSTAT &= ~0x7F;
LPC_USB->DEVCMDSTAT |= adr | (1UL << 7);
}
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Checks whether the specified SYSCFG flag is set or not. */ | FlagStatus SYSCFG_GetFlagStatus(uint32_t SYSCFG_Flag) | /* Checks whether the specified SYSCFG flag is set or not. */
FlagStatus SYSCFG_GetFlagStatus(uint32_t SYSCFG_Flag) | {
FlagStatus bitstatus = RESET;
assert_param(IS_SYSCFG_FLAG(SYSCFG_Flag));
if ((SYSCFG->CFGR2 & SYSCFG_CFGR2_SRAM_PE) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Copies data from an arbitrary memory location into an array of pages The copy is assumed to be non-overlapping. */ | static void _copy_to_pages(struct page **pages, size_t pgbase, const char *p, size_t len) | /* Copies data from an arbitrary memory location into an array of pages The copy is assumed to be non-overlapping. */
static void _copy_to_pages(struct page **pages, size_t pgbase, const char *p, size_t len) | {
struct page **pgto;
char *vto;
size_t copy;
pgto = pages + (pgbase >> PAGE_CACHE_SHIFT);
pgbase &= ~PAGE_CACHE_MASK;
for (;;) {
copy = PAGE_CACHE_SIZE - pgbase;
if (copy > len)
copy = len;
vto = kmap_atomic(*pgto, KM_USER0);
memcpy(vto + pgbase, p, copy);
kunmap_atomic(vto, KM_USER0);
len -= copy... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Switch high performance to high speed, set the drive ability. */ | int32_t PWC_HighPerformanceToHighSpeed(void) | /* Switch high performance to high speed, set the drive ability. */
int32_t PWC_HighPerformanceToHighSpeed(void) | {
DDL_ASSERT(IS_PWC_UNLOCKED());
MODIFY_REG8(CM_PWC->PWRC2, PWC_PWRC2_DDAS | PWC_PWRC2_DVS, PWC_PWRC2_DDAS | PWC_PWRC2_DVS);
WRITE_REG8(CM_PWC->MDSWCR, PWC_MD_SWITCH_CMD);
DDL_DelayUS(PWC_MD_SWITCH_TIMEOUT);
return LL_OK;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Release page and open context resources associated with a read/write request after it has completed. */ | void nfs_clear_request(struct nfs_page *req) | /* Release page and open context resources associated with a read/write request after it has completed. */
void nfs_clear_request(struct nfs_page *req) | {
struct page *page = req->wb_page;
struct nfs_open_context *ctx = req->wb_context;
if (page != NULL) {
page_cache_release(page);
req->wb_page = NULL;
}
if (ctx != NULL) {
put_nfs_open_context(ctx);
req->wb_context = NULL;
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Reset the Tx and Rx FIFO of smartcard module. */ | void SC_ClearFIFO(SC_T *sc) | /* Reset the Tx and Rx FIFO of smartcard module. */
void SC_ClearFIFO(SC_T *sc) | {
uint32_t u32TimeOutCount = SC_TIMEOUT;
while ((sc->ALTCTL & SC_ALTCTL_SYNC_Msk) == SC_ALTCTL_SYNC_Msk)
{
if (--u32TimeOutCount == 0) break;
}
sc->ALTCTL |= (SC_ALTCTL_TXRST_Msk | SC_ALTCTL_RXRST_Msk);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Rounds the refcount table size up to avoid growing the table for each single refcount block that is allocated. */ | static unsigned int next_refcount_table_size(BDRVQcowState *s, unsigned int min_size) | /* Rounds the refcount table size up to avoid growing the table for each single refcount block that is allocated. */
static unsigned int next_refcount_table_size(BDRVQcowState *s, unsigned int min_size) | {
unsigned int min_clusters = (min_size >> (s->cluster_bits - 3)) + 1;
unsigned int refcount_table_clusters =
MAX(1, s->refcount_table_size >> (s->cluster_bits - 3));
while (min_clusters > refcount_table_clusters) {
refcount_table_clusters = (refcount_table_clusters * 3 + 1) / 2;
}
r... | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* Change Logs: Date Author Notes Meco Man First version Meco Man improve rt-thread initialization process */ | void lv_user_gui_init(void) | /* Change Logs: Date Author Notes Meco Man First version Meco Man improve rt-thread initialization process */
void lv_user_gui_init(void) | {
extern void lv_demo_music(void);
lv_demo_music();
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This internal function performs run-time sanity check for PMA region start address and size. */ | static int pma_region_is_valid(const struct pma_region *region) | /* This internal function performs run-time sanity check for PMA region start address and size. */
static int pma_region_is_valid(const struct pma_region *region) | {
if (region->size < CONFIG_SOC_ANDES_V5_PMA_REGION_MIN_ALIGN_AND_SIZE) {
return -EINVAL;
}
if (region->size & (region->size - 1)) {
return -EINVAL;
}
if (region->start & (region->size - 1)) {
return -EINVAL;
}
return 0;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Handles an incoming ATT error response for the specified indication proc. A device should never send an error in response to an indication. If this happens, we treat it like a confirmation (indication ack), but report the error status to the application. */ | static void ble_gattc_indicate_err(struct ble_gattc_proc *proc, int status, uint16_t att_handle) | /* Handles an incoming ATT error response for the specified indication proc. A device should never send an error in response to an indication. If this happens, we treat it like a confirmation (indication ack), but report the error status to the application. */
static void ble_gattc_indicate_err(struct ble_gattc_proc *... | {
int rc;
ble_gattc_dbg_assert_proc_not_inserted(proc);
if (status != BLE_HS_ENOTCONN) {
rc = ble_gatts_rx_indicate_ack(proc->conn_handle,
proc->indicate.chr_val_handle);
if (rc != 0) {
return;
}
}
ble_gap_notify_tx_event(sta... | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* If the allocation of the new buffer is successful and the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). */ | VOID* EFIAPI ReallocatePool(IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL) | /* If the allocation of the new buffer is successful and the smaller of NewSize and OldSize is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT(). */
VOID* EFIAPI ReallocatePool(IN UINTN OldSize, IN UINTN NewSize, IN VOID *OldBuffer OPTIONAL) | {
VOID *Buffer;
Buffer = InternalReallocatePool (EfiRuntimeServicesData, OldSize, NewSize, OldBuffer);
if (Buffer != NULL) {
MemoryProfileLibRecord (
(PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0),
MEMORY_PROFILE_ACTION_LIB_REALLOCATE_POOL,
EfiRuntimeServicesData,
Buffer,
NewSize,
... | tianocore/edk2 | C++ | Other | 4,240 |
/* Enables or disables the specified I2C software reset. */ | void I2C_SoftwareResetCmd(I2C_TypeDef *I2Cx, FunctionalState NewState) | /* Enables or disables the specified I2C software reset. */
void I2C_SoftwareResetCmd(I2C_TypeDef *I2Cx, FunctionalState NewState) | {
assert_param(IS_I2C_ALL_PERIPH(I2Cx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
I2Cx->CR1 |= I2C_CR1_SWRST;
}
else
{
I2Cx->CR1 &= (uint16_t)~((uint16_t)I2C_CR1_SWRST);
}
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* This is an 'atomic' high-level operation to receive a single, unified control-channel message. */ | static int qemu_rdma_exchange_recv(RDMAContext *rdma, RDMAControlHeader *head, int expecting) | /* This is an 'atomic' high-level operation to receive a single, unified control-channel message. */
static int qemu_rdma_exchange_recv(RDMAContext *rdma, RDMAControlHeader *head, int expecting) | {
RDMAControlHeader ready = {
.len = 0,
.type = RDMA_CONTROL_READY,
.repeat = 1,
};
int ret;
ret = qemu_rdma_post_send_control(rdma, NULL, &ready);
if (ret < 0) {
fprintf... | ve3wwg/teensy3_qemu | C | Other | 15 |
/* This MUST get called after proxy magic has been figured out. */ | static CURLcode setup_connection_internals(struct connectdata *conn) | /* This MUST get called after proxy magic has been figured out. */
static CURLcode setup_connection_internals(struct connectdata *conn) | {
const struct Curl_handler * p;
CURLcode result;
conn->socktype = SOCK_STREAM;
p = conn->handler;
if(p->setup_connection) {
result = (*p->setup_connection)(conn);
if(result)
return result;
p = conn->handler;
}
if(conn->port < 0)
conn->port = p->defport;
return CURLE_OK;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Store the receive time-stamp for event PTP frame in the time-stamp buffer ring. */ | static void ENET_QOS_StoreRxFrameTime(ENET_QOS_Type *base, enet_qos_handle_t *handle, enet_qos_rx_bd_struct_t *rxDesc, enet_qos_ptp_time_t *ts) | /* Store the receive time-stamp for event PTP frame in the time-stamp buffer ring. */
static void ENET_QOS_StoreRxFrameTime(ENET_QOS_Type *base, enet_qos_handle_t *handle, enet_qos_rx_bd_struct_t *rxDesc, enet_qos_ptp_time_t *ts) | {
assert(ts != NULL);
uint32_t nanosecond;
nanosecond = rxDesc->buff1Addr;
if ((base->MAC_TIMESTAMP_CONTROL & ENET_QOS_MAC_TIMESTAMP_CONTROL_TSCTRLSSR_MASK) == 0U)
{
nanosecond = (uint32_t)(((uint64_t)nanosecond * 465U) / 1000U);
}
ts->second = rxDesc->reserved;
ts->nanosecon... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Otherwise execute "bootm <fastboot_buf_addr>", if that fails, reset the board. */ | void fastboot_boot(void) | /* Otherwise execute "bootm <fastboot_buf_addr>", if that fails, reset the board. */
void fastboot_boot(void) | {
char *s;
s = env_get("fastboot_bootcmd");
if (s) {
run_command(s, CMD_FLAG_ENV);
} else {
static char boot_addr_start[20];
static char *const bootm_args[] = {
"bootm", boot_addr_start, NULL
};
snprintf(boot_addr_start, sizeof(boot_addr_start) - 1,
"0x%p", fastboot_buf_addr);
printf("Booting ker... | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Returns true if the socket in either in the first or second state. */ | static int iucv_sock_in_state(struct sock *sk, int state, int state2) | /* Returns true if the socket in either in the first or second state. */
static int iucv_sock_in_state(struct sock *sk, int state, int state2) | {
return (sk->sk_state == state || sk->sk_state == state2);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If you have some data to be interpreted as external data representation or to be converted to external data representation in a memory buffer, then this is the package for you. */ | static bool_t xdrmem_getlong(XDR *, long *) | /* If you have some data to be interpreted as external data representation or to be converted to external data representation in a memory buffer, then this is the package for you. */
static bool_t xdrmem_getlong(XDR *, long *) | {
if (xdrs->x_handy < 4) return FALSE;
xdrs->x_handy -= 4;
*lp = (int32_t) ntohl((*((int32_t *) (xdrs->x_private))));
xdrs->x_private += 4;
return TRUE;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Get UEFI image protection policy based upon image type. */ | UINT32 GetProtectionPolicyFromImageType(IN UINT32 ImageType) | /* Get UEFI image protection policy based upon image type. */
UINT32 GetProtectionPolicyFromImageType(IN UINT32 ImageType) | {
if ((ImageType & mImageProtectionPolicy) == 0) {
return DO_NOT_PROTECT;
} else {
return PROTECT_IF_ALIGNED_ELSE_ALLOW;
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Log the header of the leaf1 or leafn block. */ | void xfs_dir2_leaf_log_header(xfs_trans_t *tp, xfs_dabuf_t *bp) | /* Log the header of the leaf1 or leafn block. */
void xfs_dir2_leaf_log_header(xfs_trans_t *tp, xfs_dabuf_t *bp) | {
xfs_dir2_leaf_t *leaf;
leaf = bp->data;
ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAF1_MAGIC ||
be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC);
xfs_da_log_buf(tp, bp, (uint)((char *)&leaf->hdr - (char *)leaf),
(uint)(sizeof(leaf->hdr) - 1));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function is the primary way for a multi/multi_socket application to figure out if a transfer has ended. We MUST make this function as fast as possible as it will be polled frequently and we MUST NOT scan any lists in here to figure out things. We must scale fine to thousands of handles and beyond. The current d... | CURLMsg* curl_multi_info_read(struct Curl_multi *multi, int *msgs_in_queue) | /* This function is the primary way for a multi/multi_socket application to figure out if a transfer has ended. We MUST make this function as fast as possible as it will be polled frequently and we MUST NOT scan any lists in here to figure out things. We must scale fine to thousands of handles and beyond. The current d... | {
struct Curl_message *msg;
*msgs_in_queue = 0;
if(GOOD_MULTI_HANDLE(multi) &&
!multi->in_callback &&
Curl_llist_count(&multi->msglist)) {
struct curl_llist_element *e;
e = multi->msglist.head;
msg = e->ptr;
Curl_llist_remove(&multi->msglist, e, NULL);
*msgs_in_queue = curlx_uztosi(C... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Registers a callback.
Registers a callback function which is implemented by the user. */ | enum status_code slcd_register_callback(const slcd_callback_t callback, const enum slcd_callback_type type) | /* Registers a callback.
Registers a callback function which is implemented by the user. */
enum status_code slcd_register_callback(const slcd_callback_t callback, const enum slcd_callback_type type) | {
if (type >= SLCD_CALLBACK_TYPE_NUM){
return STATUS_ERR_INVALID_ARG;
}
slcd_callback_pointer[type] = callback;
return STATUS_OK;
} | memfault/zero-to-main | C++ | null | 200 |
/* PCI: Device 23.90 ReadL I/O Error( 0): 0x1234 PCI: Device 23.90 ReadL Retry( 1) PCI: Device 23.90 ReadL Retry Successful(1) */ | static int check_return_code(char *type, struct device_node *dn, int *retry, u64 ret) | /* PCI: Device 23.90 ReadL I/O Error( 0): 0x1234 PCI: Device 23.90 ReadL Retry( 1) PCI: Device 23.90 ReadL Retry Successful(1) */
static int check_return_code(char *type, struct device_node *dn, int *retry, u64 ret) | {
if (ret != 0) {
struct pci_dn *pdn = PCI_DN(dn);
(*retry)++;
printk("PCI: %s: Device 0x%04X:%02X I/O Error(%2d): 0x%04X\n",
type, pdn->busno, pdn->devfn,
*retry, (int)ret);
if (((*retry) > PCI_RETRY_MAX) &&
(limit_pci_retries > 0)) {
mf_display_src(0xB6000103);
panic_timeout = 0;
panic... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Configures system clock after wakeup from STOP mode. */ | static void SystemClockConfig_STOP(void) | /* Configures system clock after wakeup from STOP mode. */
static void SystemClockConfig_STOP(void) | {
LL_RCC_HSI48_Enable();
while(LL_RCC_HSI48_IsReady() != 1)
{
};
LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSI48, LL_RCC_PLL_MUL_2, LL_RCC_PREDIV_DIV_2);
LL_RCC_PLL_Enable();
while(LL_RCC_PLL_IsReady() != 1)
{
};
} | st-one/X-CUBE-USB-PD | C++ | null | 110 |
/* Deinitializes all CEC peripheral registers to their default reset values. */ | void CEC_DeInit(void) | /* Deinitializes all CEC peripheral registers to their default reset values. */
void CEC_DeInit(void) | {
RCC_APB1PeriphResetCmd(RCC_APB1Periph_CEC, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_CEC, DISABLE);
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* Perform basic hardware initialization at boot.
This needs to be run from the very beginning. So the init priority has to be 0 (zero). */ | static int stm32m4_init(void) | /* Perform basic hardware initialization at boot.
This needs to be run from the very beginning. So the init priority has to be 0 (zero). */
static int stm32m4_init(void) | {
LL_AHB3_GRP1_EnableClock(LL_AHB3_GRP1_PERIPH_HSEM);
SystemCoreClock = 209000000;
return 0;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* SPI MSP Initialization This function configures the hardware resources used in this example. */ | void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi) | /* SPI MSP Initialization This function configures the hardware resources used in this example. */
void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi) | {
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(hspi->Instance==SPI2)
{
__HAL_RCC_SPI2_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_In... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* STUSB1602 checks the VCONN_DISCHARGE status on CC (bit4 0x18 */ | VCONN_Discharge_Status_TypeDef STUSB1602_VCONN_Discharge_Status_Get(uint8_t Addr) | /* STUSB1602 checks the VCONN_DISCHARGE status on CC (bit4 0x18 */
VCONN_Discharge_Status_TypeDef STUSB1602_VCONN_Discharge_Status_Get(uint8_t Addr) | {
STUSB1602_CC_CAPABILITY_CTRL_RegTypeDef reg;
STUSB1602_ReadReg(®.d8, Addr, STUSB1602_CC_CAPABILITY_CTRL_REG, 1);
return (VCONN_Discharge_Status_TypeDef)(reg.b.CC_VCONN_DISCHARGE_EN);
} | st-one/X-CUBE-USB-PD | C++ | null | 110 |
/* Read a single byte from the serial port. Returns 1 on success, 0 otherwise. When the function is succesfull, the character read is written into its argument c. */ | int pxa_tstc_dev(unsigned int uart_index) | /* Read a single byte from the serial port. Returns 1 on success, 0 otherwise. When the function is succesfull, the character read is written into its argument c. */
int pxa_tstc_dev(unsigned int uart_index) | {
switch (uart_index) {
case FFUART_INDEX:
return FFLSR & LSR_DR;
case BTUART_INDEX:
return BTLSR & LSR_DR;
case STUART_INDEX:
return STLSR & LSR_DR;
}
return -1;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Checks for error conditions for R2 (CID or CSD) response. */ | static SD_Error CmdResp2Error(void) | /* Checks for error conditions for R2 (CID or CSD) response. */
static SD_Error CmdResp2Error(void) | {
SD_Error errorstatus = SD_OK;
uint32_t status;
status = SDIO ->STA;
while (!(status & (SDIO_FLAG_CCRCFAIL | SDIO_FLAG_CTIMEOUT | SDIO_FLAG_CMDREND))) {
status = SDIO ->STA;
}
if (status & SDIO_FLAG_CTIMEOUT) {
errorstatus = SD_CMD_RSP_TIMEOUT;
SDIO->ICR = (SDIO_FLAG_CTIMEOUT);
return (errorstatus);
} ... | MaJerle/stm32f429 | C++ | null | 2,036 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.