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 |
|---|---|---|---|---|---|---|---|
/* scsi_flush_work - Flush a Scsi_Host's workqueue. @shost: Pointer to Scsi_Host. */ | void scsi_flush_work(struct Scsi_Host *shost) | /* scsi_flush_work - Flush a Scsi_Host's workqueue. @shost: Pointer to Scsi_Host. */
void scsi_flush_work(struct Scsi_Host *shost) | {
if (!shost->work_q) {
printk(KERN_ERR
"ERROR: Scsi host '%s' attempted to flush scsi-work, "
"when no workqueue created.\n", shost->hostt->name);
dump_stack();
return;
}
flush_workqueue(shost->work_q);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Brief This function handles I2C1 (Slave) event interrupt request. Param None Retval None */ | void I2C1_EV_IRQHandler(void) | /* Brief This function handles I2C1 (Slave) event interrupt request. Param None Retval None */
void I2C1_EV_IRQHandler(void) | {
if(LL_I2C_IsActiveFlag_ADDR(I2C1))
{
if(LL_I2C_GetTransferDirection(I2C1) == LL_I2C_DIRECTION_WRITE)
{
LL_I2C_EnableIT_BUF(I2C1);
LL_I2C_ClearFlag_ADDR(I2C1);
}
else
{
LL_I2C_ClearFlag_ADDR(I2C1);
Error_Callback();
}
}
else if(LL_I2C_IsActiveFlag_TXE(I2C1))
{
... | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Disables the packet output. Does not affect any configuration. */ | void cvmx_pko_disable(void) | /* Disables the packet output. Does not affect any configuration. */
void cvmx_pko_disable(void) | {
union cvmx_pko_reg_flags pko_reg_flags;
pko_reg_flags.u64 = cvmx_read_csr(CVMX_PKO_REG_FLAGS);
pko_reg_flags.s.ena_pko = 0;
cvmx_write_csr(CVMX_PKO_REG_FLAGS, pko_reg_flags.u64);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Check that an RPC call that returned attributes has not overlapped with other recent updates of the inode metadata, then decide whether it is safe to do a full update of the inode attributes, or whether just to call nfs_check_inode_attributes. */ | int nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr) | /* Check that an RPC call that returned attributes has not overlapped with other recent updates of the inode metadata, then decide whether it is safe to do a full update of the inode attributes, or whether just to call nfs_check_inode_attributes. */
int nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr) | {
int status;
if ((fattr->valid & NFS_ATTR_FATTR) == 0)
return 0;
spin_lock(&inode->i_lock);
status = nfs_refresh_inode_locked(inode, fattr);
spin_unlock(&inode->i_lock);
return status;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does no... | EFI_STATUS EFIAPI PartitionComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName) | /* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does no... | {
return LookupUnicodeString2 (
Language,
This->SupportedLanguages,
mPartitionDriverNameTable,
DriverName,
(BOOLEAN)(This == &gPartitionComponentName)
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Advance this CPU's callbacks, but only if the current grace period has ended. This may be called only from the CPU to whom the rdp belongs. In addition, the corresponding leaf rcu_node structure's ->lock must be held by the caller, with irqs disabled. */ | static void __rcu_process_gp_end(struct rcu_state *rsp, struct rcu_node *rnp, struct rcu_data *rdp) | /* Advance this CPU's callbacks, but only if the current grace period has ended. This may be called only from the CPU to whom the rdp belongs. In addition, the corresponding leaf rcu_node structure's ->lock must be held by the caller, with irqs disabled. */
static void __rcu_process_gp_end(struct rcu_state *rsp, struc... | {
if (rdp->completed != rnp->completed) {
rdp->nxttail[RCU_DONE_TAIL] = rdp->nxttail[RCU_WAIT_TAIL];
rdp->nxttail[RCU_WAIT_TAIL] = rdp->nxttail[RCU_NEXT_READY_TAIL];
rdp->nxttail[RCU_NEXT_READY_TAIL] = rdp->nxttail[RCU_NEXT_TAIL];
rdp->completed = rnp->completed;
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Ensures final expression result is in a valid R/K index (that is, it is either in a register or in 'k' with an index in the range of R/K indices). Returns R/K index. */ | int luaK_exp2RK(FuncState *fs, expdesc *e) | /* Ensures final expression result is in a valid R/K index (that is, it is either in a register or in 'k' with an index in the range of R/K indices). Returns R/K index. */
int luaK_exp2RK(FuncState *fs, expdesc *e) | {
case VTRUE: e->u.info = boolK(fs, 1); goto vk;
case VFALSE: e->u.info = boolK(fs, 0); goto vk;
case VNIL: e->u.info = nilK(fs); goto vk;
case VKINT: e->u.info = luaK_intK(fs, e->u.ival); goto vk;
case VKFLT: e->u.info = luaK_numberK(fs, e->u.nval); goto vk;
case VK:
vk:
e->k = VK;
... | nodemcu/nodemcu-firmware | C++ | MIT License | 7,566 |
/* Removes the USB controller from the bus in device mode. */ | void USBDevDisconnect(unsigned long ulBase) | /* Removes the USB controller from the bus in device mode. */
void USBDevDisconnect(unsigned long ulBase) | {
ASSERT(ulBase == USB0_BASE);
HWREGB(ulBase + USB_O_POWER) &= (~USB_POWER_SOFTCONN);
} | watterott/WebRadio | C++ | null | 71 |
/* Erase Sector in Flash Memory Parameter: adr: Sector Address Return Value: 0 - OK, 1 - Failed */ | uint32_t EraseSector(uint32_t adr) | /* Erase Sector in Flash Memory Parameter: adr: Sector Address Return Value: 0 - OK, 1 - Failed */
uint32_t EraseSector(uint32_t adr) | {
cortex_int_state_t state = cortex_int_get_and_disable();
int status = FLASH_Erase(&g_flash, adr, g_flash.PFlashSectorSize, kFLASH_apiEraseKey);
if (status == kStatus_Success)
{
status = FLASH_VerifyErase(&g_flash, adr, g_flash.PFlashSectorSize, kFLASH_marginValueNormal);
}
cortex_int_r... | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Draw or delete indicator arrow in front of spinner. */ | static void gfx_mono_spinctrl_draw_indicator(struct gfx_mono_spinctrl *spinner, bool draw) | /* Draw or delete indicator arrow in front of spinner. */
static void gfx_mono_spinctrl_draw_indicator(struct gfx_mono_spinctrl *spinner, bool draw) | {
if (draw) {
gfx_mono_put_bitmap(&gfx_mono_spinctrl_bitmap_indicator, 0,
spinner->y);
} else {
gfx_mono_draw_filled_rect(0, spinner->y,
GFX_MONO_SPINCTRL_INDICATOR_WIDTH,
GFX_MONO_SPINCTRL_INDICATOR_HEIGHT,
GFX_PIXEL_CLR);
}
} | memfault/zero-to-main | C++ | null | 200 |
/* Function to return a pointer to the currently running script file object. */ | SCRIPT_FILE* EFIAPI ShellCommandGetCurrentScriptFile(VOID) | /* Function to return a pointer to the currently running script file object. */
SCRIPT_FILE* EFIAPI ShellCommandGetCurrentScriptFile(VOID) | {
SCRIPT_FILE_LIST *List;
if (IsListEmpty (&mScriptList.Link)) {
return (NULL);
}
List = ((SCRIPT_FILE_LIST *)GetFirstNode (&mScriptList.Link));
return (List->Data);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* if we suspect dcerpc, just send them all down to packet-smb-pipe.c and let him sort them out */ | static int dissect_file_data_maybe_dcerpc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *top_tree, int offset, guint16 bc, guint16 datalen, guint32 ofs, guint16 fid, smb_info_t *si) | /* if we suspect dcerpc, just send them all down to packet-smb-pipe.c and let him sort them out */
static int dissect_file_data_maybe_dcerpc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree *top_tree, int offset, guint16 bc, guint16 datalen, guint32 ofs, guint16 fid, smb_info_t *si) | {
DISSECTOR_ASSERT(si);
if ( (si->sip && (si->sip->flags & SMB_SIF_TID_IS_IPC)) && (ofs == 0) ) {
return dissect_file_data_dcerpc(tvb, pinfo, tree,
top_tree, offset, bc, datalen, fid, si);
} else {
return dissect_file_data(tvb, tree, offset, bc, datalen);
}
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* When ARM7TDMI comes across an instruction which it cannot handle, it takes the undefined instruction trap. */ | void rt_hw_trap_udef(struct rt_hw_register *regs) | /* When ARM7TDMI comes across an instruction which it cannot handle, it takes the undefined instruction trap. */
void rt_hw_trap_udef(struct rt_hw_register *regs) | {
rt_hw_show_register(regs);
rt_kprintf("undefined instruction\n");
rt_hw_cpu_shutdown();
} | armink/FreeModbus_Slave-Master-RTT-STM32 | C++ | Other | 1,477 |
/* Enables access to the RTC and backup registers. */ | void PMU_EnableBackupAccess(void) | /* Enables access to the RTC and backup registers. */
void PMU_EnableBackupAccess(void) | {
PMU->CTRL_B.BPWEN = ENABLE ;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Read generic data through generic payload dta in/out register. */ | static int gen_read_data(uint32_t cmd) | /* Read generic data through generic payload dta in/out register. */
static int gen_read_data(uint32_t cmd) | {
gen_write_cmd(cmd);
while (!HW_MIPI_DSI_CMD_PKT_STATUS.B.GEN_RD_CMD_BUSY) ;
while (HW_MIPI_DSI_CMD_PKT_STATUS.B.GEN_RD_CMD_BUSY) ;
return HW_MIPI_DSI_GEN_PLD_DATA_RD();
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Cleans up the LED blink driver. This is intended to be used upon program exit. */ | void LedBlinkExit(void) | /* Cleans up the LED blink driver. This is intended to be used upon program exit. */
void LedBlinkExit(void) | {
LL_GPIO_ResetOutputPin(GPIOB, LL_GPIO_PIN_7);
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* nilfs_destroy_gccache() - free gc_inode hash table @nilfs - the nilfs */ | void nilfs_destroy_gccache(struct the_nilfs *nilfs) | /* nilfs_destroy_gccache() - free gc_inode hash table @nilfs - the nilfs */
void nilfs_destroy_gccache(struct the_nilfs *nilfs) | {
if (nilfs->ns_gc_inodes_h) {
nilfs_remove_all_gcinode(nilfs);
kfree(nilfs->ns_gc_inodes_h);
nilfs->ns_gc_inodes_h = NULL;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns a pointer to the start of the DMA receive descriptor list. */ | tEMACDMADescriptor* EMACRxDMADescriptorListGet(uint32_t ui32Base) | /* Returns a pointer to the start of the DMA receive descriptor list. */
tEMACDMADescriptor* EMACRxDMADescriptorListGet(uint32_t ui32Base) | {
return((tEMACDMADescriptor *)HWREG(ui32Base + EMAC_O_RXDLADDR));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enables or Disables the RTC TimeStamp functionality with the specified time stamp pin stimulating edge. */ | void RTC_EnableTimeStamp(uint32_t RTC_TimeStampEdge, FunctionalState Cmd) | /* Enables or Disables the RTC TimeStamp functionality with the specified time stamp pin stimulating edge. */
void RTC_EnableTimeStamp(uint32_t RTC_TimeStampEdge, FunctionalState Cmd) | {
uint32_t tmpregister = 0;
assert_param(IS_RTC_TIMESTAMP_EDGE_MODE(RTC_TimeStampEdge));
assert_param(IS_FUNCTIONAL_STATE(Cmd));
tmpregister = (uint32_t)(RTC->CTRL & (uint32_t) ~(RTC_CTRL_TEDGE | RTC_CTRL_TSEN));
if (Cmd != DISABLE)
{
tmpregister |= (uint32_t)(RTC_TimeStampEdge | RTC_CTRL... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* If the conversion results in an overflow or an underflow condition, then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ | RETURN_STATUS EFIAPI SafeInt64ToInt32(IN INT64 Operand, OUT INT32 *Result) | /* If the conversion results in an overflow or an underflow condition, then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeInt64ToInt32(IN INT64 Operand, OUT INT32 *Result) | {
RETURN_STATUS Status;
if (Result == NULL) {
return RETURN_INVALID_PARAMETER;
}
if ((Operand >= MIN_INT32) && (Operand <= MAX_INT32)) {
*Result = (INT32)Operand;
Status = RETURN_SUCCESS;
} else {
*Result = INT32_ERROR;
Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* edma3_write_slot - write parameter RAM data for slot @base: base address of edma @slot: number of parameter RAM slot being modified */ | void edma3_write_slot(u32 base, int slot, struct edma3_slot_layout *param) | /* edma3_write_slot - write parameter RAM data for slot @base: base address of edma @slot: number of parameter RAM slot being modified */
void edma3_write_slot(u32 base, int slot, struct edma3_slot_layout *param) | {
int i;
u32 *p = (u32 *)param;
u32 *addr = (u32 *)(base + EDMA3_SL_BASE(slot));
for (i = 0; i < sizeof(struct edma3_slot_layout)/4; i += 4)
__raw_writel(*p++, addr++);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* mixer creation - all stuff is implemented in hda module */ | static int __devinit azx_mixer_create(struct azx *chip) | /* mixer creation - all stuff is implemented in hda module */
static int __devinit azx_mixer_create(struct azx *chip) | {
return snd_hda_build_controls(chip->bus);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Write to TC Register B (RB) on the specified channel. */ | void tc_write_rb(Tc *p_tc, uint32_t ul_channel, uint32_t ul_value) | /* Write to TC Register B (RB) on the specified channel. */
void tc_write_rb(Tc *p_tc, uint32_t ul_channel, uint32_t ul_value) | {
Assert(p_tc);
Assert(ul_channel <
(sizeof(p_tc->TC_CHANNEL) / sizeof(p_tc->TC_CHANNEL[0])));
p_tc->TC_CHANNEL[ul_channel].TC_RB = ul_value;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Returns: (transfer full): a #GFileInfo for the @stream, or NULL on error. */ | GFileInfo* g_file_output_stream_query_info(GFileOutputStream *stream, const char *attributes, GCancellable *cancellable, GError **error) | /* Returns: (transfer full): a #GFileInfo for the @stream, or NULL on error. */
GFileInfo* g_file_output_stream_query_info(GFileOutputStream *stream, const char *attributes, GCancellable *cancellable, GError **error) | {
GFileOutputStreamClass *class;
GOutputStream *output_stream;
GFileInfo *info;
g_return_val_if_fail (G_IS_FILE_OUTPUT_STREAM (stream), NULL);
output_stream = G_OUTPUT_STREAM (stream);
if (!g_output_stream_set_pending (output_stream, error))
return NULL;
info = NULL;
if (cancellable)
g_cancellab... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Copy a 4kB page of main memory to an expanded memory page */ | static long xpram_page_out(unsigned long page_addr, unsigned int xpage_index) | /* Copy a 4kB page of main memory to an expanded memory page */
static long xpram_page_out(unsigned long page_addr, unsigned int xpage_index) | {
int cc = 2;
asm volatile(
" .insn rre,0xb22f0000,%1,%2\n"
"0: ipm %0\n"
" srl %0,28\n"
"1:\n"
EX_TABLE(0b,1b)
: "+d" (cc) : "a" (__pa(page_addr)), "d" (xpage_index) : "cc");
if (cc == 3)
return -ENXIO;
if (cc == 2)
return -ENXIO;
if (cc == 1)
return -EIO;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Converts a text device path node to USB HUB device path structure. */ | EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbHub(CHAR16 *TextDeviceNode) | /* Converts a text device path node to USB HUB device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbHub(CHAR16 *TextDeviceNode) | {
USB_CLASS_TEXT UsbClassText;
UsbClassText.ClassExist = FALSE;
UsbClassText.Class = USB_CLASS_HUB;
UsbClassText.SubClassExist = TRUE;
return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If 64-bit MMIO register operations are not supported, then ASSERT(). */ | UINT64 EFIAPI S3MmioWrite64(IN UINTN Address, IN UINT64 Value) | /* If 64-bit MMIO register operations are not supported, then ASSERT(). */
UINT64 EFIAPI S3MmioWrite64(IN UINTN Address, IN UINT64 Value) | {
return InternalSaveMmioWrite64ValueToBootScript (Address, MmioWrite64 (Address, Value));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns: the index of the child of @node which contains @data, or -1 if the data is not found */ | gint g_node_child_index(GNode *node, gpointer data) | /* Returns: the index of the child of @node which contains @data, or -1 if the data is not found */
gint g_node_child_index(GNode *node, gpointer data) | {
guint n = 0;
g_return_val_if_fail (node != NULL, -1);
node = node->children;
while (node)
{
if (node->data == data)
return n;
n++;
node = node->next;
}
return -1;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Disable I2C module of the specified I2C port.
The */ | void I2CDisable(unsigned long ulBase) | /* Disable I2C module of the specified I2C port.
The */
void I2CDisable(unsigned long ulBase) | {
xASSERT((ulBase == I2C0_BASE) || ((ulBase == I2C1_BASE)));
xHWREGB(ulBase + I2C_CON1) &= ~I2C_CON1_EN;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Minimum value of a q31 vector without index. */ | void arm_min_no_idx_q31(const q31_t *pSrc, uint32_t blockSize, q31_t *pResult) | /* Minimum value of a q31 vector without index. */
void arm_min_no_idx_q31(const q31_t *pSrc, uint32_t blockSize, q31_t *pResult) | {
q31_t minVal1, out;
uint32_t blkCnt;
out = *pSrc++;
blkCnt = (blockSize - 1U);
while (blkCnt > 0U)
{ ... | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* param base ENET peripheral base address. param macAddr The six-byte Mac address pointer. The pointer is allocated by application and input into the API. */ | void ENET_GetMacAddr(ENET_Type *base, uint8_t *macAddr) | /* param base ENET peripheral base address. param macAddr The six-byte Mac address pointer. The pointer is allocated by application and input into the API. */
void ENET_GetMacAddr(ENET_Type *base, uint8_t *macAddr) | {
assert(macAddr != NULL);
uint32_t address;
address = base->PALR;
macAddr[0] = 0xFFU & (uint8_t)(address >> 24U);
macAddr[1] = 0xFFU & (uint8_t)(address >> 16U);
macAddr[2] = 0xFFU & (uint8_t)(address >> 8U);
macAddr[3] = 0xFFU & (uint8_t)address;
address = (base->PAUR & ENET_PAUR... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* At present only a single emulator is supported on the bus, since we do not support chip selects, despite there being a chipsel field. It cannot be implemented until we have a GPIO emulator. */ | static struct spi_emul* spi_emul_find(const struct device *dev, unsigned int chipsel) | /* At present only a single emulator is supported on the bus, since we do not support chip selects, despite there being a chipsel field. It cannot be implemented until we have a GPIO emulator. */
static struct spi_emul* spi_emul_find(const struct device *dev, unsigned int chipsel) | {
struct spi_emul_data *data = dev->data;
sys_snode_t *node;
SYS_SLIST_FOR_EACH_NODE(&data->emuls, node) {
struct spi_emul *emul;
emul = CONTAINER_OF(node, struct spi_emul, node);
if (emul->chipsel == chipsel) {
return emul;
}
}
return NULL;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* retrieves the acceptable frame type filter for a port */ | IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBAcceptableFrameTypeGet(IxEthDBPortId portID, IxEthDBFrameFilter *frameFilter) | /* retrieves the acceptable frame type filter for a port */
IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBAcceptableFrameTypeGet(IxEthDBPortId portID, IxEthDBFrameFilter *frameFilter) | {
IX_ETH_DB_CHECK_PORT(portID);
IX_ETH_DB_CHECK_SINGLE_NPE(portID);
IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS);
IX_ETH_DB_CHECK_REFERENCE(frameFilter);
*frameFilter = ixEthDBPortInfo[portID].frameFilter;
return IX_ETH_DB_SUCCESS;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Pass data to the CRC engine while ensuring that we don't attempt to read from an erased flash sector. */ | void crc_write_data_safely(const void *data, int count) | /* Pass data to the CRC engine while ensuring that we don't attempt to read from an erased flash sector. */
void crc_write_data_safely(const void *data, int count) | {
if (!((uint32_t)data >= DAPLINK_ROM_START && (uint32_t)data < (DAPLINK_ROM_START + DAPLINK_ROM_SIZE))) {
CRC_WriteData(CRC_ENGINE, data, count);
return;
}
uint32_t n = ROUND_UP((uint32_t)data, DAPLINK_SECTOR_SIZE) - (uint32_t)data;
if (n) {
crc_checked_write_data(data, n);
... | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* This function replaces the original SSIDataNonBlockingGet() API and performs the same actions. A macro is provided in */ | long SSIDataGetNonBlocking(unsigned long ulBase, unsigned long *pulData) | /* This function replaces the original SSIDataNonBlockingGet() API and performs the same actions. A macro is provided in */
long SSIDataGetNonBlocking(unsigned long ulBase, unsigned long *pulData) | {
ASSERT((ulBase == SSI0_BASE) || (ulBase == SSI1_BASE));
if(HWREG(ulBase + SSI_O_SR) & SSI_SR_RNE)
{
*pulData = HWREG(ulBase + SSI_O_DR);
return(1);
}
else
{
return(0);
}
} | watterott/WebRadio | C++ | null | 71 |
/* This is the MPS sched_clock implementation. This has a resolution of 40ns. */ | unsigned long long sched_clock(void) | /* This is the MPS sched_clock implementation. This has a resolution of 40ns. */
unsigned long long sched_clock(void) | {
return (unsigned long long)readl(MPS_REFCOUNTER) * 40;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Un-Register the Service A and all its Characteristics... */ | void service_a_2_remove(void) | /* Un-Register the Service A and all its Characteristics... */
void service_a_2_remove(void) | {
bt_gatt_service_unregister(&service_a_2_svc);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Finds the protocol entry for the requested protocol. */ | PROTOCOL_ENTRY* MmFindProtocolEntry(IN EFI_GUID *Protocol, IN BOOLEAN Create) | /* Finds the protocol entry for the requested protocol. */
PROTOCOL_ENTRY* MmFindProtocolEntry(IN EFI_GUID *Protocol, IN BOOLEAN Create) | {
LIST_ENTRY *Link;
PROTOCOL_ENTRY *Item;
PROTOCOL_ENTRY *ProtEntry;
ProtEntry = NULL;
for (Link = mProtocolDatabase.ForwardLink;
Link != &mProtocolDatabase;
Link = Link->ForwardLink)
{
Item = CR (Link, PROTOCOL_ENTRY, AllEntries, PROTOCOL_ENTRY_SIGNATURE);
if (CompareGuid (&Ite... | tianocore/edk2 | C++ | Other | 4,240 |
/* Synchronizes the counters in one or multiple PWM generator blocks. */ | void PWMSyncTimeBase(unsigned long ulBase, unsigned long ulGenBits) | /* Synchronizes the counters in one or multiple PWM generator blocks. */
void PWMSyncTimeBase(unsigned long ulBase, unsigned long ulGenBits) | {
ASSERT((ulBase == PWM0_BASE) || (ulBase == PWM1_BASE));
ASSERT(!(ulGenBits & ~(PWM_GEN_0_BIT | PWM_GEN_1_BIT | PWM_GEN_2_BIT |
PWM_GEN_3_BIT)));
HWREG(ulBase + PWM_O_SYNC) = ulGenBits;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Helper function of memory free with Guard pages. */ | EFI_STATUS SmmInternalFreePagesExWithGuard(IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN NumberOfPages, IN BOOLEAN AddRegion) | /* Helper function of memory free with Guard pages. */
EFI_STATUS SmmInternalFreePagesExWithGuard(IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN NumberOfPages, IN BOOLEAN AddRegion) | {
EFI_PHYSICAL_ADDRESS MemoryToFree;
UINTN PagesToFree;
if (((Memory & EFI_PAGE_MASK) != 0) || (Memory == 0) || (NumberOfPages == 0)) {
return EFI_INVALID_PARAMETER;
}
MemoryToFree = Memory;
PagesToFree = NumberOfPages;
AdjustMemoryF (&MemoryToFree, &PagesToFree);
UnsetGuardForMemo... | tianocore/edk2 | C++ | Other | 4,240 |
/* Wait for packets currently being received to be done. Does not block later packets from starting. */ | void synchronize_net(void) | /* Wait for packets currently being received to be done. Does not block later packets from starting. */
void synchronize_net(void) | {
might_sleep();
synchronize_rcu();
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Read a value from a register in an TCM825X sensor device. The value is returned in 'val'. Returns zero if successful, or non-zero otherwise. */ | static int tcm825x_read_reg(struct i2c_client *client, int reg) | /* Read a value from a register in an TCM825X sensor device. The value is returned in 'val'. Returns zero if successful, or non-zero otherwise. */
static int tcm825x_read_reg(struct i2c_client *client, int reg) | {
int err;
struct i2c_msg msg[2];
u8 reg_buf, data_buf = 0;
if (!client->adapter)
return -ENODEV;
msg[0].addr = client->addr;
msg[0].flags = 0;
msg[0].len = 1;
msg[0].buf = ®_buf;
msg[1].addr = client->addr;
msg[1].flags = I2C_M_RD;
msg[1].len = 1;
msg[1].buf = &data_buf;
reg_buf = reg;
err = i2c_tra... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* @this: the instance of the Simple Network Protocol @read_write: true for read, false for write @offset: offset in NVRAM @buffer_size: size of buffer @buffer: buffer Return: status code */ | static efi_status_t EFIAPI efi_net_nvdata(struct efi_simple_network *this, int read_write, ulong offset, ulong buffer_size, char *buffer) | /* @this: the instance of the Simple Network Protocol @read_write: true for read, false for write @offset: offset in NVRAM @buffer_size: size of buffer @buffer: buffer Return: status code */
static efi_status_t EFIAPI efi_net_nvdata(struct efi_simple_network *this, int read_write, ulong offset, ulong buffer_size, char... | {
EFI_ENTRY("%p, %x, %lx, %lx, %p", this, read_write, offset, buffer_size,
buffer);
return EFI_EXIT(EFI_UNSUPPORTED);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* frees or reduces the usage count of a mac descriptor smart pointer
If the reference count reaches 0 (structure is no longer used anywhere) then the descriptor is freed back into the pool using */ | IX_ETH_DB_PUBLIC void ixEthDBFreeMacDescriptor(MacDescriptor *macDescriptor) | /* frees or reduces the usage count of a mac descriptor smart pointer
If the reference count reaches 0 (structure is no longer used anywhere) then the descriptor is freed back into the pool using */
IX_ETH_DB_PUBLIC void ixEthDBFreeMacDescriptor(MacDescriptor *macDescriptor) | {
if (macDescriptor != NULL)
{
LOCK_MAC_POOL;
if (macDescriptor->refCount > 0)
{
macDescriptor->refCount--;
if (macDescriptor->refCount == 0)
{
UNLOCK_MAC_POOL;
ixEthDBPoolFreeMacDescriptor(macDescriptor);
}
... | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Task function for blinking the LED as a fixed timer interval. */ | void LedBlinkTask(void) | /* Task function for blinking the LED as a fixed timer interval. */
void LedBlinkTask(void) | {
static blt_bool ledOn = BLT_FALSE;
static blt_int32u nextBlinkEvent = 0;
if (TimerGet() >= nextBlinkEvent)
{
if (ledOn == BLT_FALSE)
{
ledOn = BLT_TRUE;
GPIOPinWrite(GPIO_PORTG_BASE, GPIO_PIN_2, GPIO_PIN_2);
}
else
{
ledOn = BLT_FALSE;
GPIOPinWrite(GPIO_PORTG_BASE, ... | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Selects the TIMx peripheral Capture Compare DMA source. */ | void TIM_SelectCCDMA(TIM_TypeDef *TIMx, FunctionalState NewState) | /* Selects the TIMx peripheral Capture Compare DMA source. */
void TIM_SelectCCDMA(TIM_TypeDef *TIMx, FunctionalState NewState) | {
assert_param(IS_TIM_LIST5_PERIPH(TIMx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
TIMx->CR2 |= TIM_CR2_CCDS;
}
else
{
TIMx->CR2 &= (uint16_t)~((uint16_t)TIM_CR2_CCDS);
}
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* Get function for the contrast level of the LCD. */ | unsigned char halLcdGetContrast(void) | /* Get function for the contrast level of the LCD. */
unsigned char halLcdGetContrast(void) | {
return LcdInitMacro[ 0x04 * 6 + 5 ] ;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* return_fm_pebs - returns all PEBs used by a fastmap back to the WL sub-system. @ubi: UBI device object @fm: fastmap layout object */ | static void return_fm_pebs(struct ubi_device *ubi, struct ubi_fastmap_layout *fm) | /* return_fm_pebs - returns all PEBs used by a fastmap back to the WL sub-system. @ubi: UBI device object @fm: fastmap layout object */
static void return_fm_pebs(struct ubi_device *ubi, struct ubi_fastmap_layout *fm) | {
int i;
if (!fm)
return;
for (i = 0; i < fm->used_blocks; i++) {
if (fm->e[i]) {
ubi_wl_put_fm_peb(ubi, fm->e[i], i,
fm->to_be_tortured[i]);
fm->e[i] = NULL;
}
}
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* IDL long BrowserrResetNetlogonState( IDL wchar_t *element_24 IDL ); */ | static int dissect_browser_browserr_reset_netlogon_state_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) | /* IDL long BrowserrResetNetlogonState( IDL wchar_t *element_24 IDL ); */
static int dissect_browser_browserr_reset_netlogon_state_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) | {
offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, di, drep,
NDR_POINTER_UNIQUE, "unknown string",
hf_browser_unknown_string, 0);
return offset;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Pass in a pointer to an ARM MOVW/MOVT instruciton pair and return the immediate data encoded in the two` instruction. */ | UINT32 ThumbMovwMovtImmediateAddress(IN UINT16 *Instructions) | /* Pass in a pointer to an ARM MOVW/MOVT instruciton pair and return the immediate data encoded in the two` instruction. */
UINT32 ThumbMovwMovtImmediateAddress(IN UINT16 *Instructions) | {
UINT16 *Word;
UINT16 *Top;
Word = Instructions;
Top = Word + 2;
return (ThumbMovtImmediateAddress (Top) << 16) + ThumbMovtImmediateAddress (Word);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Map GPIO pins to button number Change to select different GPIO input pins */ | static uint8_t pin_to_sw(uint32_t pin_pos) | /* Map GPIO pins to button number Change to select different GPIO input pins */
static uint8_t pin_to_sw(uint32_t pin_pos) | {
switch (pin_pos) {
case BIT(DT_GPIO_PIN(DT_ALIAS(sw0), gpios)): return 0;
case BIT(DT_GPIO_PIN(DT_ALIAS(sw1), gpios)): return 1;
case BIT(DT_GPIO_PIN(DT_ALIAS(sw2), gpios)): return 2;
case BIT(DT_GPIO_PIN(DT_ALIAS(sw3), gpios)): return 3;
}
printk("No match for GPIO pin 0x%08x\n", pin_pos);
return 0;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* MCU decoding for DC successive approximation refinement scan. Note: we assume such scans can be multi-component, although the spec is not very clear on the point. */ | decode_mcu_DC_refine(j_decompress_ptr cinfo, JBLOCKROW *MCU_data) | /* MCU decoding for DC successive approximation refinement scan. Note: we assume such scans can be multi-component, although the spec is not very clear on the point. */
decode_mcu_DC_refine(j_decompress_ptr cinfo, JBLOCKROW *MCU_data) | {
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
int p1, blkn;
BITREAD_STATE_VARS;
if (cinfo->restart_interval) {
if (entropy->restarts_to_go == 0)
if (! process_restart(cinfo))
return FALSE;
}
BITREAD_LOAD_STATE(cinfo,entropy->bitstate);
p1 = 1 << cinfo->Al;
for (blkn = 0; ... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* cgroup_create_dir - create a directory for an object. @cgrp: the cgroup we create the directory for. It must have a valid ->parent field. And we are going to fill its ->dentry field. @dentry: dentry of the new cgroup @mode: mode to set on new directory. */ | static int cgroup_create_dir(struct cgroup *cgrp, struct dentry *dentry, mode_t mode) | /* cgroup_create_dir - create a directory for an object. @cgrp: the cgroup we create the directory for. It must have a valid ->parent field. And we are going to fill its ->dentry field. @dentry: dentry of the new cgroup @mode: mode to set on new directory. */
static int cgroup_create_dir(struct cgroup *cgrp, struct de... | {
struct dentry *parent;
int error = 0;
parent = cgrp->parent->dentry;
error = cgroup_create_file(dentry, S_IFDIR | mode, cgrp->root->sb);
if (!error) {
dentry->d_fsdata = cgrp;
inc_nlink(parent->d_inode);
rcu_assign_pointer(cgrp->dentry, dentry);
dget(dentry);
}
dput(dentry);
return error;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Calculate number of records in an inobt btree block. */ | int xfs_inobt_maxrecs(struct xfs_mount *mp, int blocklen, int leaf) | /* Calculate number of records in an inobt btree block. */
int xfs_inobt_maxrecs(struct xfs_mount *mp, int blocklen, int leaf) | {
blocklen -= XFS_INOBT_BLOCK_LEN(mp);
if (leaf)
return blocklen / sizeof(xfs_inobt_rec_t);
return blocklen / (sizeof(xfs_inobt_key_t) + sizeof(xfs_inobt_ptr_t));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Allocates the number bytes specified by AllocationSize of a certain pool type and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */ | VOID* InternalAllocatePool(IN EFI_MEMORY_TYPE MemoryType, IN UINTN AllocationSize) | /* Allocates the number bytes specified by AllocationSize of a certain pool type and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
VOID* InternalAllocatePool(IN EFI_M... | {
EFI_STATUS Status;
VOID *Memory;
Status = gBS->AllocatePool (MemoryType, AllocationSize, &Memory);
if (EFI_ERROR (Status)) {
Memory = NULL;
}
return Memory;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Obtains the item that is located one position further down in the list, relative to the item given in the parameter. Note that the item is just read, not removed. */ | void* TbxListGetNextItem(tTbxList const *list, void const *itemRef) | /* Obtains the item that is located one position further down in the list, relative to the item given in the parameter. Note that the item is just read, not removed. */
void* TbxListGetNextItem(tTbxList const *list, void const *itemRef) | {
void * result = NULL;
tTbxListNode const * listNodePtr;
TBX_ASSERT(list != NULL);
TBX_ASSERT(itemRef != NULL);
if ( (list != NULL) && (itemRef != NULL) )
{
TbxCriticalSectionEnter();
listNodePtr = TbxListFindListNode(list, itemRef);
if (listNodePtr != NULL)
{
listNodePt... | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Get the captured data for the ADC sample channel. */ | unsigned long ADCDataGet(unsigned long ulBase, unsigned long ulChannel) | /* Get the captured data for the ADC sample channel. */
unsigned long ADCDataGet(unsigned long ulBase, unsigned long ulChannel) | {
unsigned long ulData;
unsigned long ulCRReg;
xASSERT(ulBase == ADC_BASE);
xASSERT((ulChannel >= 0) && (ulChannel < 8));
ulData = xHWREG(ulBase + ADC_DR0 + (ulChannel * 4));
ulCRReg = xHWREG(ulBase + ADC_CR);
if(ulCRReg & ADC_CR_DIFFEN)
{
if(ulCRReg & ADC_CR_DMOF)
{
... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* The functions for insering/removing us as a module. */ | static int __init lkkbd_init(void) | /* The functions for insering/removing us as a module. */
static int __init lkkbd_init(void) | {
return serio_register_driver(&lkkbd_drv);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Search for a name for a function in all loaded and ROM modules */ | static int pushglobalfuncname(lua_State *L, lua_Debug *ar) | /* Search for a name for a function in all loaded and ROM modules */
static int pushglobalfuncname(lua_State *L, lua_Debug *ar) | {
lua_settop(L, top+1);
lua_getglobal(L, "ROM");
if (!findfield(L, top + 1, 2)) {
lua_settop(L, top);
return 0;
}
}
const char *name = lua_tostring(L, -1);
if (strncmp(name, "_G.", 3) == 0) {
lua_pushstring(L, name + 3);
lua_remove(L, -2);
}
lua_copy(L, -1, top + 1);
lua_... | nodemcu/nodemcu-firmware | C++ | MIT License | 7,566 |
/* Called by the Device Policy Manager to suspend the USB-C Subsystem. */ | int usbc_suspend(const struct device *dev) | /* Called by the Device Policy Manager to suspend the USB-C Subsystem. */
int usbc_suspend(const struct device *dev) | {
struct usbc_port_data *data = dev->data;
data->request.val = PRIV_PORT_REQUEST_SUSPEND;
k_fifo_put(&data->request_fifo, &data->request);
return 0;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* This routine builds either a type0 or type1 configuration command. If the bus is on the 803xx then a type0 made, else a type1 is created. */ | static u32 iop3xx_cfg_address(struct pci_bus *bus, int devfn, int where) | /* This routine builds either a type0 or type1 configuration command. If the bus is on the 803xx then a type0 made, else a type1 is created. */
static u32 iop3xx_cfg_address(struct pci_bus *bus, int devfn, int where) | {
struct pci_sys_data *sys = bus->sysdata;
u32 addr;
if (sys->busnr == bus->number)
addr = 1 << (PCI_SLOT(devfn) + 16) | (PCI_SLOT(devfn) << 11);
else
addr = bus->number << 16 | PCI_SLOT(devfn) << 11 | 1;
addr |= PCI_FUNC(devfn) << 8 | (where & ~3);
return addr;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* s e t u p A l l U p p e r */ | returnValue Constraints_setupAllUpper(Constraints *_THIS) | /* s e t u p A l l U p p e r */
returnValue Constraints_setupAllUpper(Constraints *_THIS) | {
return Constraints_setupAll( _THIS,ST_UPPER );
} | DanielMartensson/EmbeddedLapack | C++ | MIT License | 129 |
/* This set option adds a chunk type that the user is requesting to be received only in an authenticated way. Changes to the list of chunks will only effect future associations on the socket. */ | static int sctp_setsockopt_auth_chunk(struct sock *sk, char __user *optval, unsigned int optlen) | /* This set option adds a chunk type that the user is requesting to be received only in an authenticated way. Changes to the list of chunks will only effect future associations on the socket. */
static int sctp_setsockopt_auth_chunk(struct sock *sk, char __user *optval, unsigned int optlen) | {
struct sctp_authchunk val;
if (!sctp_auth_enable)
return -EACCES;
if (optlen != sizeof(struct sctp_authchunk))
return -EINVAL;
if (copy_from_user(&val, optval, optlen))
return -EFAULT;
switch (val.sauth_chunk) {
case SCTP_CID_INIT:
case SCTP_CID_INIT_ACK:
case SCTP_CID_SHUTDOWN_COMPLETE:
case SCTP_... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* this function is a POSIX compliant version, which will close a directory stream. */ | int closedir(DIR *d) | /* this function is a POSIX compliant version, which will close a directory stream. */
int closedir(DIR *d) | {
int result;
struct dfs_file *file;
if (d == NULL)
{
rt_set_errno(-EBADF);
return -1;
}
file = fd_get(d->fd);
if (file == NULL)
{
rt_set_errno(-EBADF);
return -1;
}
result = dfs_file_close(file);
if (result < 0)
{
rt_set_errno(resu... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function does not return until the block has been erased. */ | int32_t FlashErase(uint32_t ui32Address) | /* This function does not return until the block has been erased. */
int32_t FlashErase(uint32_t ui32Address) | {
ASSERT(!(ui32Address & (FLASH_ERASE_SIZE - 1)));
HWREG(FLASH_FCMISC) = (FLASH_FCMISC_AMISC | FLASH_FCMISC_VOLTMISC |
FLASH_FCMISC_ERMISC);
HWREG(FLASH_FMA) = ui32Address;
HWREG(FLASH_FMC) = FLASH_FMC_WRKEY | FLASH_FMC_ERASE;
while(HWREG(FLASH_FMC) & FLASH_FMC_ERASE)
... | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* For DualPoint devices select the device that should respond to subsequent commands. It looks like glidepad is behind stickpointer, I'd thought it would be other way around... */ | static int alps_passthrough_mode(struct psmouse *psmouse, bool enable) | /* For DualPoint devices select the device that should respond to subsequent commands. It looks like glidepad is behind stickpointer, I'd thought it would be other way around... */
static int alps_passthrough_mode(struct psmouse *psmouse, bool enable) | {
struct ps2dev *ps2dev = &psmouse->ps2dev;
int cmd = enable ? PSMOUSE_CMD_SETSCALE21 : PSMOUSE_CMD_SETSCALE11;
if (ps2_command(ps2dev, NULL, cmd) ||
ps2_command(ps2dev, NULL, cmd) ||
ps2_command(ps2dev, NULL, cmd) ||
ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE))
return -1;
ps2_drain(ps2dev, 3, 1... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* note This must be called after all the ENET initilization. And should be called when the ENET receive/transmit is required. */ | void ENET_StartRxTx(ENET_Type *base, uint8_t txRingNum, uint8_t rxRingNum) | /* note This must be called after all the ENET initilization. And should be called when the ENET receive/transmit is required. */
void ENET_StartRxTx(ENET_Type *base, uint8_t txRingNum, uint8_t rxRingNum) | {
assert(txRingNum);
assert(rxRingNum);
uint8_t index;
if (txRingNum > ENET_RING_NUM_MAX)
{
txRingNum = ENET_RING_NUM_MAX;
}
if (rxRingNum > ENET_RING_NUM_MAX)
{
rxRingNum = ENET_RING_NUM_MAX;
}
for (index = 0; index < rxRingNum; index++)
{
base->DMA_C... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* If HmacSha384Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ | BOOLEAN EFIAPI CryptoServiceHmacSha384SetKey(OUT VOID *HmacSha384Context, IN CONST UINT8 *Key, IN UINTN KeySize) | /* If HmacSha384Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI CryptoServiceHmacSha384SetKey(OUT VOID *HmacSha384Context, IN CONST UINT8 *Key, IN UINTN KeySize) | {
return CALL_BASECRYPTLIB (HmacSha384.Services.SetKey, HmacSha384SetKey, (HmacSha384Context, Key, KeySize), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* oversamplingRate: a value from 0 to 7 that decides about the precision of the measurement If this value equals n, the DPS310 will perform 2^n measurements and combine the results returns: 0 on success -3 if the DPS310 is already busy -2 if the object initialization failed -1 on other fail */ | int16_t startMeasurePressureOnce(uint8_t oversamplingRate) | /* oversamplingRate: a value from 0 to 7 that decides about the precision of the measurement If this value equals n, the DPS310 will perform 2^n measurements and combine the results returns: 0 on success -3 if the DPS310 is already busy -2 if the object initialization failed -1 on other fail */
int16_t startMeasurePre... | {
if (dps310_ctx.m_initFail) {
return DPS310__FAIL_INIT_FAILED;
}
if (dps310_ctx.m_opMode != IDLE) {
return DPS310__FAIL_TOOBUSY;
}
if (oversamplingRate != dps310_ctx.m_prsOsr) {
if (configPressure(0U, oversamplingRate)) {
return DPS310__FAIL_UNKNOWN;
}
... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* This resets, configures the MAC, initialises the RX ring and DMA engines and starts the TX queue for a KS8695 ethernet device. */ | static int ks8695_open(struct net_device *ndev) | /* This resets, configures the MAC, initialises the RX ring and DMA engines and starts the TX queue for a KS8695 ethernet device. */
static int ks8695_open(struct net_device *ndev) | {
struct ks8695_priv *ksp = netdev_priv(ndev);
int ret;
if (!is_valid_ether_addr(ndev->dev_addr))
return -EADDRNOTAVAIL;
ks8695_reset(ksp);
ks8695_update_mac(ksp);
ret = ks8695_init_net(ksp);
if (ret) {
ks8695_shutdown(ksp);
return ret;
}
napi_enable(&ksp->napi);
netif_start_queue(ndev);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If the conversion results in an overflow or an underflow condition, then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ | RETURN_STATUS EFIAPI SafeUintnToInt32(IN UINTN Operand, OUT INT32 *Result) | /* If the conversion results in an overflow or an underflow condition, then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeUintnToInt32(IN UINTN Operand, OUT INT32 *Result) | {
RETURN_STATUS Status;
if (Result == NULL) {
return RETURN_INVALID_PARAMETER;
}
if (Operand <= MAX_INT32) {
*Result = (INT32)Operand;
Status = RETURN_SUCCESS;
} else {
*Result = INT32_ERROR;
Status = RETURN_BUFFER_TOO_SMALL;
}
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: */ | const SDL_version* SDLNet_Linked_Version(void) | /* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: */
const SDL_version* SDLNet_Linked_Version(void) | {
static SDL_version linked_version;
SDL_NET_VERSION(&linked_version);
return(&linked_version);
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* Configure the compare data of an ADC digital comparator. */ | void ADCCompDataSet(unsigned long ulBase, unsigned long ulComp, unsigned long ulCompData, unsigned long ulMatchCnt) | /* Configure the compare data of an ADC digital comparator. */
void ADCCompDataSet(unsigned long ulBase, unsigned long ulComp, unsigned long ulCompData, unsigned long ulMatchCnt) | {
unsigned long ulCompRegAddr;
unsigned long ulConfig;
xASSERT(ulBase == ADC_BASE);
xASSERT((ulComp >= 0) && (ulComp < 2));
xASSERT(ulCompData < 0x0400);
xASSERT(ulMatchCnt < 16);
ulCompRegAddr = ulBase + ADC_CMPR0 + (4 * ulComp);
ulConfig = ((ulCompData << ADC_CMPRX_CMPD_S) |
... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Socket removal during an interrupt is now safe. */ | static void nr_remove_socket(struct sock *sk) | /* Socket removal during an interrupt is now safe. */
static void nr_remove_socket(struct sock *sk) | {
spin_lock_bh(&nr_list_lock);
sk_del_node_init(sk);
spin_unlock_bh(&nr_list_lock);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Some checks before doing config cycles: In PCI Device Mode, hide everything on bus 0 except the LDT host bridge. Otherwise, access is controlled by bridge MasterEn bits. */ | static int bcm1480_pci_can_access(struct pci_bus *bus, int devfn) | /* Some checks before doing config cycles: In PCI Device Mode, hide everything on bus 0 except the LDT host bridge. Otherwise, access is controlled by bridge MasterEn bits. */
static int bcm1480_pci_can_access(struct pci_bus *bus, int devfn) | {
u32 devno;
if (!(bcm1480_bus_status & (PCI_BUS_ENABLED | PCI_DEVICE_MODE)))
return 0;
if (bus->number == 0) {
devno = PCI_SLOT(devfn);
if (bcm1480_bus_status & PCI_DEVICE_MODE)
return 0;
else
return 1;
} else
return 1;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Opens a pipe of the Low Level Driver. */ | USBH_StatusTypeDef USBH_LL_OpenPipe(USBH_HandleTypeDef *phost, uint8_t pipe, uint8_t epnum, uint8_t dev_address, uint8_t speed, uint8_t ep_type, uint16_t mps) | /* Opens a pipe of the Low Level Driver. */
USBH_StatusTypeDef USBH_LL_OpenPipe(USBH_HandleTypeDef *phost, uint8_t pipe, uint8_t epnum, uint8_t dev_address, uint8_t speed, uint8_t ep_type, uint16_t mps) | {
HAL_HCD_HC_Init(phost->pData, pipe, epnum, dev_address, speed, ep_type, mps);
return USBH_OK;
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* The entry point for Hash driver which installs the service binding protocol. */ | EFI_STATUS EFIAPI Hash2DriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* The entry point for Hash driver which installs the service binding protocol. */
EFI_STATUS EFIAPI Hash2DriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | {
EFI_STATUS Status;
HASH2_SERVICE_DATA *Hash2ServiceData;
Hash2ServiceData = AllocateZeroPool (sizeof (HASH2_SERVICE_DATA));
if (Hash2ServiceData == NULL) {
return EFI_OUT_OF_RESOURCES;
}
Hash2ServiceData->Signature = HASH2_SERVICE_DATA_SIGNATURE;
CopyMem (&Hash2ServiceData->ServiceBinding,... | tianocore/edk2 | C++ | Other | 4,240 |
/* g_value_set_param: @value: a valid #GValue of type G_TYPE_PARAM */ | void g_value_set_param(GValue *value, GParamSpec *param) | /* g_value_set_param: @value: a valid #GValue of type G_TYPE_PARAM */
void g_value_set_param(GValue *value, GParamSpec *param) | {
g_return_if_fail (G_VALUE_HOLDS_PARAM (value));
if (param)
g_return_if_fail (G_IS_PARAM_SPEC (param));
if (value->data[0].v_pointer)
g_param_spec_unref (value->data[0].v_pointer);
value->data[0].v_pointer = param;
if (value->data[0].v_pointer)
g_param_spec_ref (value->data[0].v_pointer);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Calculates the temperature (in °C) at the destination altitude based on the current seal-level pressure (in hPa), altitude (in meters) and temperature (in C) */ | float pressureTempAtDestination(float currTemp, float currAltitude, float destAltitude) | /* Calculates the temperature (in °C) at the destination altitude based on the current seal-level pressure (in hPa), altitude (in meters) and temperature (in C) */
float pressureTempAtDestination(float currTemp, float currAltitude, float destAltitude) | {
return currTemp - 0.0065F * (destAltitude - currAltitude);
} | microbuilder/LPC11U_LPC13U_CodeBase | C++ | Other | 54 |
/* Wheck whether task has been finished by all APs. */ | BOOLEAN WaitForAllAPsNotBusy(IN BOOLEAN BlockMode) | /* Wheck whether task has been finished by all APs. */
BOOLEAN WaitForAllAPsNotBusy(IN BOOLEAN BlockMode) | {
UINTN Index;
for (Index = 0; Index < mMaxNumberOfCpus; Index++) {
if (!IsPresentAp (Index)) {
continue;
}
if (BlockMode) {
AcquireSpinLock (mSmmMpSyncData->CpuData[Index].Busy);
ReleaseSpinLock (mSmmMpSyncData->CpuData[Index].Busy);
} else {
if (AcquireSpinLockOrFail (mSmm... | tianocore/edk2 | C++ | Other | 4,240 |
/* The return value is the disposition of the chunk. */ | sctp_disposition_t sctp_sf_do_ecne(const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) | /* The return value is the disposition of the chunk. */
sctp_disposition_t sctp_sf_do_ecne(const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) | {
sctp_ecnehdr_t *ecne;
struct sctp_chunk *chunk = arg;
if (!sctp_vtag_verify(chunk, asoc))
return sctp_sf_pdiscard(ep, asoc, type, arg, commands);
if (!sctp_chunk_length_valid(chunk, sizeof(sctp_ecne_chunk_t)))
return sctp_sf_violation_chunklen(ep, asoc, type, arg,
commands);
ecne = (sctp_ecnehdr_t *)... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Indentifies a timer causing interrupt.
This functions returns a timer causing interrupt */ | tmrHw_ID_t tmrHw_getInterruptSource(void) | /* Indentifies a timer causing interrupt.
This functions returns a timer causing interrupt */
tmrHw_ID_t tmrHw_getInterruptSource(void) | {
int i;
for (i = 0; i < tmrHw_TIMER_NUM_COUNT; i++) {
if (pTmrHw[i].InterruptStatus) {
return i;
}
}
return 0xFFFFFFFF;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* When scsi can't dispatch I/Os anymore and needs to kill I/Os (e.g. !sdev), scsi needs to return 'not busy'. Otherwise, request stacking drivers may hold requests forever. */ | static int scsi_lld_busy(struct request_queue *q) | /* When scsi can't dispatch I/Os anymore and needs to kill I/Os (e.g. !sdev), scsi needs to return 'not busy'. Otherwise, request stacking drivers may hold requests forever. */
static int scsi_lld_busy(struct request_queue *q) | {
struct scsi_device *sdev = q->queuedata;
struct Scsi_Host *shost;
struct scsi_target *starget;
if (!sdev)
return 0;
shost = sdev->host;
starget = scsi_target(sdev);
if (scsi_host_in_recovery(shost) || scsi_host_is_busy(shost) ||
scsi_target_is_busy(starget) || scsi_device_is_busy(sdev))
return 1;
ret... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* In TDX a serial of TdIoWrite16 is invoked to write data to the I/O port. */ | VOID EFIAPI TdIoWriteFifo16(IN UINTN Port, IN UINTN Count, IN VOID *Buffer) | /* In TDX a serial of TdIoWrite16 is invoked to write data to the I/O port. */
VOID EFIAPI TdIoWriteFifo16(IN UINTN Port, IN UINTN Count, IN VOID *Buffer) | {
UINT16 *Buf16;
UINTN Index;
Buf16 = (UINT16 *)Buffer;
for (Index = 0; Index < Count; Index++) {
TdIoWrite16 (Port, Buf16[Index]);
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* SMP locking strategy: hash table is protected with spinlock unix_table_lock each socket state is protected by separate rwlock. */ | static unsigned unix_hash_fold(__wsum n) | /* SMP locking strategy: hash table is protected with spinlock unix_table_lock each socket state is protected by separate rwlock. */
static unsigned unix_hash_fold(__wsum n) | {
unsigned hash = (__force unsigned)n;
hash ^= hash>>16;
hash ^= hash>>8;
return hash&(UNIX_HASH_SIZE-1);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If 64-bit MMIO register operations are not supported, then ASSERT(). */ | UINT64 EFIAPI MmioWrite64(IN UINTN Address, IN UINT64 Value) | /* If 64-bit MMIO register operations are not supported, then ASSERT(). */
UINT64 EFIAPI MmioWrite64(IN UINTN Address, IN UINT64 Value) | {
ASSERT ((Address & 7) == 0);
return (UINT64)MmioWriteWorker (Address, SMM_IO_UINT64, Value);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function will read the specified length of data from the pipe. */ | rt_ssize_t rt_pipe_read(rt_device_t device, rt_off_t pos, void *buffer, rt_size_t count) | /* This function will read the specified length of data from the pipe. */
rt_ssize_t rt_pipe_read(rt_device_t device, rt_off_t pos, void *buffer, rt_size_t count) | {
uint8_t *pbuf;
rt_size_t read_bytes = 0;
rt_pipe_t *pipe = (rt_pipe_t *)device;
if (device == RT_NULL)
{
rt_set_errno(-EINVAL);
return 0;
}
if (count == 0)
{
return 0;
}
pbuf = (uint8_t*)buffer;
rt_mutex_take(&pipe->lock, RT_WAITING_FOREVER);
whi... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* returns SUCCESS if the PF has set the Status bit or else ERR_MBX */ | static s32 e1000_check_for_msg_vf(struct e1000_hw *hw) | /* returns SUCCESS if the PF has set the Status bit or else ERR_MBX */
static s32 e1000_check_for_msg_vf(struct e1000_hw *hw) | {
s32 ret_val = -E1000_ERR_MBX;
if (!e1000_check_for_bit_vf(hw, E1000_V2PMAILBOX_PFSTS)) {
ret_val = E1000_SUCCESS;
hw->mbx.stats.reqs++;
}
return ret_val;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Function for getting the sequence number of a reliable TX packet for which peer protocol entity acknowledgment is pending. */ | static __INLINE uint8_t packet_number_to_transmit_get(void) | /* Function for getting the sequence number of a reliable TX packet for which peer protocol entity acknowledgment is pending. */
static __INLINE uint8_t packet_number_to_transmit_get(void) | {
return m_packet_transmit_seq_number;
} | labapart/polymcu | C++ | null | 201 |
/* NOTE: This routine doesn't need to take the socket lock since it only accesses socket information that is unchanging (or which changes in a completely predictable manner). */ | static int get_name(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len, int peer) | /* NOTE: This routine doesn't need to take the socket lock since it only accesses socket information that is unchanging (or which changes in a completely predictable manner). */
static int get_name(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len, int peer) | {
struct sockaddr_tipc *addr = (struct sockaddr_tipc *)uaddr;
struct tipc_sock *tsock = tipc_sk(sock->sk);
if (peer) {
if ((sock->state != SS_CONNECTED) &&
((peer != 2) || (sock->state != SS_DISCONNECTING)))
return -ENOTCONN;
addr->addr.id.ref = tsock->peer_name.ref;
addr->addr.id.node = tsock->peer_name... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* PC_to_RDR_Abort Execute the Abort command from host, This stops all Bulk transfers from host and ICC Response to this command message is the RDR_to_PC_SlotStatus. */ | uint8_t PC_to_RDR_Abort(USBD_HandleTypeDef *pdev) | /* PC_to_RDR_Abort Execute the Abort command from host, This stops all Bulk transfers from host and ICC Response to this command message is the RDR_to_PC_SlotStatus. */
uint8_t PC_to_RDR_Abort(USBD_HandleTypeDef *pdev) | {
USBD_CCID_HandleTypeDef *hccid = (USBD_CCID_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId];
uint8_t error;
error = CCID_CheckCommandParams(pdev, CHK_PARAM_SLOT | CHK_PARAM_ABRFU3 |
CHK_PARAM_DWLENGTH);
if (error != 0U)
{
return error;
}
(void)CCID_CmdAbort(pd... | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* This function handles the sequence abort accept iocb command complete event. It properly releases the memory allocated to the sequence abort accept iocb. */ | static void lpfc_sli4_seq_abort_acc_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmd_iocbq, struct lpfc_iocbq *rsp_iocbq) | /* This function handles the sequence abort accept iocb command complete event. It properly releases the memory allocated to the sequence abort accept iocb. */
static void lpfc_sli4_seq_abort_acc_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmd_iocbq, struct lpfc_iocbq *rsp_iocbq) | {
if (cmd_iocbq)
lpfc_sli_release_iocbq(phba, cmd_iocbq);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function will set default network interface device. */ | void netdev_set_default(struct netdev *netdev) | /* This function will set default network interface device. */
void netdev_set_default(struct netdev *netdev) | {
if (netdev)
{
netdev_default = netdev;
netdev->ops->set_default_netif(netdev);
LOGD("Setting default network interface device name(%s) successfully.", netdev->name);
}
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* check if the device is valid synth device */ | int snd_seq_oss_synth_is_valid(struct seq_oss_devinfo *dp, int dev) | /* check if the device is valid synth device */
int snd_seq_oss_synth_is_valid(struct seq_oss_devinfo *dp, int dev) | {
struct seq_oss_synth *rec;
rec = get_synthdev(dp, dev);
if (rec) {
snd_use_lock_free(&rec->use_lock);
return 1;
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns TRUE is interrupts are currently enabled. Otherwise returns FALSE. */ | BOOLEAN EFIAPI GetInterruptState(VOID) | /* Returns TRUE is interrupts are currently enabled. Otherwise returns FALSE. */
BOOLEAN EFIAPI GetInterruptState(VOID) | {
unsigned long RetValue;
RetValue = RiscVGetSupervisorModeInterrupts ();
return RetValue ? TRUE : FALSE;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Bring an interface down, disabling any traffic processing. */ | void netif_set_down(struct netif *netif) | /* Bring an interface down, disabling any traffic processing. */
void netif_set_down(struct netif *netif) | {
netif->flags &= ~NETIF_FLAG_UP;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* If Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 32-bit boundary, then ASSERT(). If Length is not aligned on a 32-bit boundary, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */ | UINT32 EFIAPI CalculateCheckSum32(IN CONST UINT32 *Buffer, IN UINTN Length) | /* If Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 32-bit boundary, then ASSERT(). If Length is not aligned on a 32-bit boundary, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */
UINT32 EFIAPI CalculateCheckSum32(IN CONST UINT32 *Buffer, IN UINTN Length) | {
UINT32 CheckSum;
CheckSum = CalculateSum32 (Buffer, Length);
return (UINT32)((UINT32)(-1) - CheckSum + 1);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Constructs a new net device, complete with a private data area of size @sizeof_priv. A 32-byte (not bit) alignment is enforced for this private data area. */ | struct net_device* alloc_fddidev(int sizeof_priv) | /* Constructs a new net device, complete with a private data area of size @sizeof_priv. A 32-byte (not bit) alignment is enforced for this private data area. */
struct net_device* alloc_fddidev(int sizeof_priv) | {
return alloc_netdev(sizeof_priv, "fddi%d", fddi_setup);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Checks whether the start of frame interrupt has occurred or not. */ | ITStatus LCD_GetITStatus(void) | /* Checks whether the start of frame interrupt has occurred or not. */
ITStatus LCD_GetITStatus(void) | {
ITStatus pendingbitstatus = RESET;
uint8_t enablestatus = 0;
enablestatus = (uint8_t)((uint8_t)LCD->CR3 & LCD_CR3_SOFIE);
if (((LCD->CR3 & LCD_CR3_SOF) != RESET) && enablestatus)
{
pendingbitstatus = SET;
}
else
{
pendingbitstatus = RESET;
}
return pendingbitstatus;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Increment the message ID counter for the last transmitted packet type. */ | static void increment_msgid_counter(const struct device *dev) | /* Increment the message ID counter for the last transmitted packet type. */
static void increment_msgid_counter(const struct device *dev) | {
struct usbc_port_data *data = dev->data;
struct protocol_layer_tx_t *prl_tx = data->prl_tx;
if (prl_tx->last_xmit_type >= NUM_SOP_STAR_TYPES) {
return;
}
prl_tx->msg_id_counter[prl_tx->last_xmit_type] =
(prl_tx->msg_id_counter[prl_tx->last_xmit_type] + 1) & PD_MESSAGE_ID_COUNT;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.