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 |
|---|---|---|---|---|---|---|---|
/* Setup a pair of shorts that are returned by value, rather than as a reference to an array. */ | static int TIFFSetupShortPair(TIFF *, ttag_t, TIFFDirEntry *) | /* Setup a pair of shorts that are returned by value, rather than as a reference to an array. */
static int TIFFSetupShortPair(TIFF *, ttag_t, TIFFDirEntry *) | {
uint16 v[2];
TIFFGetField(tif, tag, &v[0], &v[1]);
return (TIFFWriteShortArray(tif, TIFF_SHORT, tag, dir, 2, v));
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Helper function stating whether the acceleromter is on or off. */ | int inv_get_accel_on() | /* Helper function stating whether the acceleromter is on or off. */
int inv_get_accel_on() | {
return (sensors.accel.status & INV_SENSOR_ON) == INV_SENSOR_ON;
} | Luos-io/luos_engine | C++ | MIT License | 496 |
/* 6.5.2.3. SM Identify (Confirmed Service Id = 3) 6.5.2.3.1. Request Message Parameters */ | static void dissect_ff_msg_sm_id_req(tvbuff_t *tvb, gint offset, guint32 length, packet_info *pinfo, proto_tree *tree) | /* 6.5.2.3. SM Identify (Confirmed Service Id = 3) 6.5.2.3.1. Request Message Parameters */
static void dissect_ff_msg_sm_id_req(tvbuff_t *tvb, gint offset, guint32 length, packet_info *pinfo, proto_tree *tree) | {
proto_tree *sub_tree;
col_set_str(pinfo->cinfo, COL_INFO, "SM Identify Request");
if (!tree) {
return;
}
if (length) {
sub_tree = proto_tree_add_subtree(tree, tvb, offset, length,
ett_ff_sm_id_req, NULL, "SM Identify Request");
proto_tree_add_item(sub_tree, hf_f... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* check if the interface has this anycast address */ | static int ipv6_chk_acast_dev(struct net_device *dev, struct in6_addr *addr) | /* check if the interface has this anycast address */
static int ipv6_chk_acast_dev(struct net_device *dev, struct in6_addr *addr) | {
struct inet6_dev *idev;
struct ifacaddr6 *aca;
idev = in6_dev_get(dev);
if (idev) {
read_lock_bh(&idev->lock);
for (aca = idev->ac_list; aca; aca = aca->aca_next)
if (ipv6_addr_equal(&aca->aca_addr, addr))
break;
read_unlock_bh(&idev->lock);
in6_dev_put(idev);
return aca != NULL;
}
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* as the real entry point for the application. */ | EFI_STATUS EFIAPI UefiMain(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* as the real entry point for the application. */
EFI_STATUS EFIAPI UefiMain(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | {
Print (L"ShellExecute - Pass");
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Convert variable MTRRs to a RAW MTRR_MEMORY_RANGE array. One MTRR_MEMORY_RANGE element is created for each MTRR setting. The routine doesn't remove the overlap or combine the near-by region. */ | UINT32 MtrrLibGetRawVariableRanges(IN CONST MTRR_VARIABLE_SETTINGS *VariableSettings, IN UINTN VariableMtrrCount, IN UINT64 MtrrValidBitsMask, IN UINT64 MtrrValidAddressMask, OUT MTRR_MEMORY_RANGE *VariableMtrr) | /* Convert variable MTRRs to a RAW MTRR_MEMORY_RANGE array. One MTRR_MEMORY_RANGE element is created for each MTRR setting. The routine doesn't remove the overlap or combine the near-by region. */
UINT32 MtrrLibGetRawVariableRanges(IN CONST MTRR_VARIABLE_SETTINGS *VariableSettings, IN UINTN VariableMtrrCount, IN UINT64... | {
UINTN Index;
UINT32 UsedMtrr;
ZeroMem (VariableMtrr, sizeof (MTRR_MEMORY_RANGE) * ARRAY_SIZE (VariableSettings->Mtrr));
for (Index = 0, UsedMtrr = 0; Index < VariableMtrrCount; Index++) {
if (((MSR_IA32_MTRR_PHYSMASK_REGISTER *)&VariableSettings->Mtrr[Index].Mask)->Bits.V != 0) {
VariableMtrr[Ind... | tianocore/edk2 | C++ | Other | 4,240 |
/* install a session keyring directly to a credentials struct */ | static int install_session_keyring_to_cred(struct cred *cred, struct key *keyring) | /* install a session keyring directly to a credentials struct */
static int install_session_keyring_to_cred(struct cred *cred, struct key *keyring) | {
unsigned long flags;
struct key *old;
might_sleep();
if (!keyring) {
flags = KEY_ALLOC_QUOTA_OVERRUN;
if (cred->tgcred->session_keyring)
flags = KEY_ALLOC_IN_QUOTA;
keyring = keyring_alloc("_ses", cred->uid, cred->gid,
cred, flags, NULL);
if (IS_ERR(keyring))
return PTR_ERR(keyring);
} else {
... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* The digit counter callback function, as described at the top of this file. */ | static void prvDigitCounterTimerCallback(xTimerHandle xTimer) | /* The digit counter callback function, as described at the top of this file. */
static void prvDigitCounterTimerCallback(xTimerHandle xTimer) | {
static const unsigned short usNumbersPatterns[] = { 0xC000U, 0xF900U, 0xA400U, 0xB000U, 0x9900U, 0x9200U, 0x8200U, 0xF800U, 0x8000U, 0x9000U };
static long lCounter = 0L;
const long lNumberOfDigits = 10L;
FM3_GPIO->PDOR1 = usNumbersPatterns[ lCounter ]; lCounter++;
if( lCounter >= lNumberOfDigits )
{
lCounter = ... | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Wrapper function to SmmInstallProtocolInterfaceNotify. This is the public API which Calls the private one which contains a BOOLEAN parameter for notifications */ | EFI_STATUS EFIAPI SmmInstallProtocolInterface(IN OUT EFI_HANDLE *UserHandle, IN EFI_GUID *Protocol, IN EFI_INTERFACE_TYPE InterfaceType, IN VOID *Interface) | /* Wrapper function to SmmInstallProtocolInterfaceNotify. This is the public API which Calls the private one which contains a BOOLEAN parameter for notifications */
EFI_STATUS EFIAPI SmmInstallProtocolInterface(IN OUT EFI_HANDLE *UserHandle, IN EFI_GUID *Protocol, IN EFI_INTERFACE_TYPE InterfaceType, IN VOID *Interface... | {
return SmmInstallProtocolInterfaceNotify (
UserHandle,
Protocol,
InterfaceType,
Interface,
TRUE
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Perform DAC activation procedure to make it ready to generate a voltage (DAC instance: DAC1). */ | void Activate_DAC(void) | /* Perform DAC activation procedure to make it ready to generate a voltage (DAC instance: DAC1). */
void Activate_DAC(void) | {
__IO uint32_t wait_loop_index = 0;
LL_DAC_ConvertData12RightAligned(DAC1, LL_DAC_CHANNEL_1, 0x00);
LL_DAC_Enable(DAC1, LL_DAC_CHANNEL_1);
wait_loop_index = ((LL_DAC_DELAY_STARTUP_VOLTAGE_SETTLING_US * (SystemCoreClock / (100000 * 2))) / 10);
while(wait_loop_index != 0)
{
wait_loop_index--;
}
LL_DA... | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Sever an established IUCV communication path and trigger a hang-up of the underlying HVC terminal. */ | static int hvc_iucv_pm_freeze(struct device *dev) | /* Sever an established IUCV communication path and trigger a hang-up of the underlying HVC terminal. */
static int hvc_iucv_pm_freeze(struct device *dev) | {
struct hvc_iucv_private *priv = dev_get_drvdata(dev);
local_bh_disable();
hvc_iucv_hangup(priv);
local_bh_enable();
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Save the performance counter value before running the MP procedure. */ | VOID MpPerfBegin(IN UINTN CpuIndex, IN UINTN MpProcedureId) | /* Save the performance counter value before running the MP procedure. */
VOID MpPerfBegin(IN UINTN CpuIndex, IN UINTN MpProcedureId) | {
mSmmMpProcedurePerformance[CpuIndex].Begin[MpProcedureId] = GetPerformanceCounter ();
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Rewind the last single-dot in the parser's output buffer. */ | STATIC VOID ParserRewindDot(IN CHAR8 *Buffer, IN OUT UINTN *Position) | /* Rewind the last single-dot in the parser's output buffer. */
STATIC VOID ParserRewindDot(IN CHAR8 *Buffer, IN OUT UINTN *Position) | {
ASSERT (*Position >= 2);
ASSERT (Buffer[*Position - 1] == '.');
ASSERT (Buffer[*Position - 2] == '/');
(*Position)--;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Function initialization and configuration of RTC driver instance. */ | static void rtc_config(void) | /* Function initialization and configuration of RTC driver instance. */
static void rtc_config(void) | {
uint32_t err_code;
nrf_drv_rtc_config_t config = NRF_DRV_RTC_DEFAULT_CONFIG;
config.prescaler = 4095;
err_code = nrf_drv_rtc_init(&rtc, &config, rtc_handler);
APP_ERROR_CHECK(err_code);
nrf_drv_rtc_tick_enable(&rtc,true);
err_code = nrf_drv_rtc_cc_set(&rtc,0,COMPARE_COUNTERTIME * 8,true);
... | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Routine to get the next Handle, when you are searching for a given protocol. */ | IHANDLE* SmmGetNextLocateByProtocol(IN OUT LOCATE_POSITION *Position, OUT VOID **Interface) | /* Routine to get the next Handle, when you are searching for a given protocol. */
IHANDLE* SmmGetNextLocateByProtocol(IN OUT LOCATE_POSITION *Position, OUT VOID **Interface) | {
IHANDLE *Handle;
LIST_ENTRY *Link;
PROTOCOL_INTERFACE *Prot;
Handle = NULL;
*Interface = NULL;
for ( ; ;) {
Link = Position->Position->ForwardLink;
Position->Position = Link;
if (Link == &Position->ProtEntry->Protocols) {
Handle = NULL;
break... | tianocore/edk2 | C++ | Other | 4,240 |
/* The pressure offset value is 16-bit data that can be used to implement one-point calibration (OPC) after soldering.. */ | int32_t lps22hh_pressure_offset_get(stmdev_ctx_t *ctx, int16_t *val) | /* The pressure offset value is 16-bit data that can be used to implement one-point calibration (OPC) after soldering.. */
int32_t lps22hh_pressure_offset_get(stmdev_ctx_t *ctx, int16_t *val) | {
uint8_t buff[2];
int32_t ret;
ret = lps22hh_read_reg(ctx, LPS22HH_RPDS_L, buff, 2);
*val = (int16_t)buff[1];
*val = (*val * 256) + (int16_t)buff[0];
return ret;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Assumes that the dwc2_core_params struct contains only integers. */ | void dwc2_set_all_params(struct dwc2_core_params *params, int value) | /* Assumes that the dwc2_core_params struct contains only integers. */
void dwc2_set_all_params(struct dwc2_core_params *params, int value) | {
int *p = (int *)params;
size_t size = sizeof(*params) / sizeof(*p);
int i;
for (i = 0; i < size; i++)
p[i] = value;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* brief Return Frequency of 32kHz osc return Frequency of 32kHz osc */ | static uint32_t GetOsc32KFreq(void) | /* brief Return Frequency of 32kHz osc return Frequency of 32kHz osc */
static uint32_t GetOsc32KFreq(void) | {
return ((0UL == (PMC->PDRUNCFG0 & PMC_PDRUNCFG0_PDEN_FRO32K_MASK)) && (0UL == (PMC->RTCOSC32K & PMC_RTCOSC32K_SEL_MASK))) ?
CLK_RTC_32K_CLK :
((0UL == (PMC->PDRUNCFG0 & PMC_PDRUNCFG0_PDEN_XTAL32K_MASK)) && ((PMC->RTCOSC32K & PMC_RTCOSC32K_SEL_MASK) != 0UL)) ?
CLK_RTC_3... | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Returns: a pointer to the found occurrence, or NULL if not found. */ | gchar* g_strrstr_len(const gchar *haystack, gssize haystack_len, const gchar *needle) | /* Returns: a pointer to the found occurrence, or NULL if not found. */
gchar* g_strrstr_len(const gchar *haystack, gssize haystack_len, const gchar *needle) | {
g_return_val_if_fail (haystack != NULL, NULL);
g_return_val_if_fail (needle != NULL, NULL);
if (haystack_len < 0)
return g_strrstr (haystack, needle);
else
{
gsize needle_len = strlen (needle);
const gchar *haystack_max = haystack + haystack_len;
const gchar *p = haystack;
gsiz... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Function for setting the RTC1 Capture Compare register 0, and enabling the corresponding event. */ | static __INLINE void rtc1_compare0_set(uint32_t value) | /* Function for setting the RTC1 Capture Compare register 0, and enabling the corresponding event. */
static __INLINE void rtc1_compare0_set(uint32_t value) | {
NRF_RTC1->CC[0] = value;
} | labapart/polymcu | C++ | null | 201 |
/* strcat - Append one NUL-terminated string to another @dest: The string to be appended to @src: The string to append to it */ | char* strcat(char *dest, const char *src) | /* strcat - Append one NUL-terminated string to another @dest: The string to be appended to @src: The string to append to it */
char* strcat(char *dest, const char *src) | {
char *tmp = dest;
while (*dest)
dest++;
while ((*dest++ = *src++) != '\0')
;
return tmp;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables multicast address in RAR and the use of the multicast hash table. */ | s32 ixgbe_enable_mc_generic(struct ixgbe_hw *hw) | /* Enables multicast address in RAR and the use of the multicast hash table. */
s32 ixgbe_enable_mc_generic(struct ixgbe_hw *hw) | {
u32 i;
u32 rar_entries = hw->mac.num_rar_entries;
struct ixgbe_addr_filter_info *a = &hw->addr_ctrl;
if (a->mc_addr_in_rar_count > 0)
for (i = (rar_entries - a->mc_addr_in_rar_count);
i < rar_entries; i++)
ixgbe_enable_rar(hw, i);
if (a->mta_in_use > 0)
IXGBE_WRITE_REG(hw, IXGBE_MCSTCTRL, IXGBE_MCS... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Deinitializes the BKP peripheral registers to their default reset values. */ | void BKP_DeInit(void) | /* Deinitializes the BKP peripheral registers to their default reset values. */
void BKP_DeInit(void) | {
RCC_EnableBackupReset(ENABLE);
RCC_EnableBackupReset(DISABLE);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Gets the name of a Haptic device by index. */ | const char* SDL_HapticName(int device_index) | /* Gets the name of a Haptic device by index. */
const char* SDL_HapticName(int device_index) | {
if ((device_index < 0) || (device_index >= SDL_NumHaptics())) {
SDL_SetError("Haptic: There are %d haptic devices available",
SDL_NumHaptics());
return NULL;
}
return SDL_SYS_HapticName(device_index);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Clear one or more interrupts of PortA. Parameters: pinno: return: SUCCESS. */ | static void gpio_irq_clear(gpio_pin_handle_t pin, uint32_t idx) | /* Clear one or more interrupts of PortA. Parameters: pinno: return: SUCCESS. */
static void gpio_irq_clear(gpio_pin_handle_t pin, uint32_t idx) | {
dw_gpio_pin_priv_t *gpio_pin_priv = pin;
dw_gpio_priv_t *port_handle = &gpio_handle[gpio_pin_priv->portidx];
dw_gpio_control_reg_t *gpio_control_reg = (dw_gpio_control_reg_t *)(port_handle->base + 0x30);
gpio_control_reg->PORTA_EOI = idx;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* bforget() is like brelse(), except it discards any potentially dirty data. */ | void __bforget(struct buffer_head *bh) | /* bforget() is like brelse(), except it discards any potentially dirty data. */
void __bforget(struct buffer_head *bh) | {
clear_buffer_dirty(bh);
if (bh->b_assoc_map) {
struct address_space *buffer_mapping = bh->b_page->mapping;
spin_lock(&buffer_mapping->private_lock);
list_del_init(&bh->b_assoc_buffers);
bh->b_assoc_map = NULL;
spin_unlock(&buffer_mapping->private_lock);
}
__brelse(bh);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Check if Overrun in reception has been detected @rmtoll ISR RXOVRF LL_SWPMI_IsActiveFlag_RXOVR. */ | uint32_t LL_SWPMI_IsActiveFlag_RXOVR(SWPMI_TypeDef *SWPMIx) | /* Check if Overrun in reception has been detected @rmtoll ISR RXOVRF LL_SWPMI_IsActiveFlag_RXOVR. */
uint32_t LL_SWPMI_IsActiveFlag_RXOVR(SWPMI_TypeDef *SWPMIx) | {
return ((READ_BIT(SWPMIx->ISR, SWPMI_ISR_RXOVRF) == (SWPMI_ISR_RXOVRF)) ? 1UL : 0UL);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Release resources when all the ports have been stopped. */ | static void cxgb_down(struct adapter *adapter) | /* Release resources when all the ports have been stopped. */
static void cxgb_down(struct adapter *adapter) | {
t1_sge_stop(adapter->sge);
t1_interrupts_disable(adapter);
free_irq(adapter->pdev->irq, adapter);
if (adapter->params.has_msi)
pci_disable_msi(adapter->pdev);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* this function takes the SH-1 exception number and attempts to translate this number into a unix compatible signal value */ | static int computeSignal(int exceptionVector) | /* this function takes the SH-1 exception number and attempts to translate this number into a unix compatible signal value */
static int computeSignal(int exceptionVector) | {
case EXC_ILLEGAL_INSTR:
case EXC_SLOT_ILLEGAL_INSTR:
sigval = 4;
break;
case EXC_DATA_ADDRESS_READ:
case EXC_DATA_ADDRESS_WRITE:
sigval = 10;
break;
case EXC_TRAPA:
sigval = 5;
break;
default:
... | DC-SWAT/DreamShell | C++ | null | 404 |
/* Sends the current Idle rate of the input report to the host. */ | static void HIDDJoystickDriver_GetIdle() | /* Sends the current Idle rate of the input report to the host. */
static void HIDDJoystickDriver_GetIdle() | {
TRACE_INFO("gIdle ");
USBD_Write(0, &(hiddJoystickDriver.inputReportIdleRate), 1, 0, 0);
} | opentx/opentx | C++ | GNU General Public License v2.0 | 2,025 |
/* rtnl_link_unregister - Unregister rtnl_link_ops from rtnetlink. @ops: struct rtnl_link_ops * to unregister */ | void rtnl_link_unregister(struct rtnl_link_ops *ops) | /* rtnl_link_unregister - Unregister rtnl_link_ops from rtnetlink. @ops: struct rtnl_link_ops * to unregister */
void rtnl_link_unregister(struct rtnl_link_ops *ops) | {
rtnl_lock();
__rtnl_link_unregister(ops);
rtnl_unlock();
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Disable USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */ | void USBD_DisableEP(U32 EPNum) | /* Disable USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
void USBD_DisableEP(U32 EPNum) | {
EPNum &= EPNUM_MASK;
MXC_USB->ep[EPNum] = 0;
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* If AesContext is NULL, then return FALSE. If Input is NULL, then return FALSE. If InputSize is not multiple of block size (16 bytes), then return FALSE. If Ivec is NULL, then return FALSE. If Output is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ | BOOLEAN EFIAPI AesCbcDecrypt(IN VOID *AesContext, IN CONST UINT8 *Input, IN UINTN InputSize, IN CONST UINT8 *Ivec, OUT UINT8 *Output) | /* If AesContext is NULL, then return FALSE. If Input is NULL, then return FALSE. If InputSize is not multiple of block size (16 bytes), then return FALSE. If Ivec is NULL, then return FALSE. If Output is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI AesCbcDecrypt(IN ... | {
CALL_CRYPTO_SERVICE (AesCbcDecrypt, (AesContext, Input, InputSize, Ivec, Output), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Description: Enables a low level driver to set an upper limit on the number of physical data segments in a request. This would be the largest sized scatter list the driver could handle. */ | void blk_queue_max_phys_segments(struct request_queue *q, unsigned short max_segments) | /* Description: Enables a low level driver to set an upper limit on the number of physical data segments in a request. This would be the largest sized scatter list the driver could handle. */
void blk_queue_max_phys_segments(struct request_queue *q, unsigned short max_segments) | {
if (!max_segments) {
max_segments = 1;
printk(KERN_INFO "%s: set to minimum %d\n",
__func__, max_segments);
}
q->limits.max_phys_segments = max_segments;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* check the CRCs after the restore event and free the memory used to hold them */ | void s3c_pm_check_restore(void) | /* check the CRCs after the restore event and free the memory used to hold them */
void s3c_pm_check_restore(void) | {
if (crcs != NULL)
s3c_pm_run_sysram(s3c_pm_runcheck, crcs);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If 16-bit MMIO register operations are not supported, 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(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ | UINT16 EFIAPI S3MmioBitFieldWrite16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 Value) | /* If 16-bit MMIO register operations are not supported, 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(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT16 E... | {
return InternalSaveMmioWrite16ValueToBootScript (Address, MmioBitFieldWrite16 (Address, StartBit, EndBit, Value));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Get a buffer for the block, return it with no data read. Long-form addressing. */ | xfs_buf_t* xfs_btree_get_bufl(xfs_mount_t *mp, xfs_trans_t *tp, xfs_fsblock_t fsbno, uint lock) | /* Get a buffer for the block, return it with no data read. Long-form addressing. */
xfs_buf_t* xfs_btree_get_bufl(xfs_mount_t *mp, xfs_trans_t *tp, xfs_fsblock_t fsbno, uint lock) | {
xfs_buf_t *bp;
xfs_daddr_t d;
ASSERT(fsbno != NULLFSBLOCK);
d = XFS_FSB_TO_DADDR(mp, fsbno);
bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, d, mp->m_bsize, lock);
ASSERT(bp);
ASSERT(!XFS_BUF_GETERROR(bp));
return bp;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* SYSCTRL USB Bus&Function Clock Disable and Reset Assert. */ | void LL_SYSCTRL_USB_ClkDisRstAssert(void) | /* SYSCTRL USB Bus&Function Clock Disable and Reset Assert. */
void LL_SYSCTRL_USB_ClkDisRstAssert(void) | {
__LL_SYSCTRL_CTRLReg_Unlock(SYSCTRL);
__LL_SYSCTRL_USBBusClk_Dis(SYSCTRL);
__LL_SYSCTRL_USBFunClk_Dis(SYSCTRL);
__LL_SYSCTRL_USBSoftRst_Assert(SYSCTRL);
__LL_SYSCTRL_Reg_Lock(SYSCTRL);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* USART Wait for Transmit Data Buffer Empty.
Blocks until the transmit data buffer becomes empty and is ready to accept the next data word. */ | void usart_wait_send_ready(uint32_t usart) | /* USART Wait for Transmit Data Buffer Empty.
Blocks until the transmit data buffer becomes empty and is ready to accept the next data word. */
void usart_wait_send_ready(uint32_t usart) | {
while ((USART_ISR(usart) & USART_ISR_TXE) == 0);
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Initializes the WWDT according to the specified parameters. */ | void ald_wwdt_init(uint32_t load, ald_wwdt_win_t win, type_func_t interrupt) | /* Initializes the WWDT according to the specified parameters. */
void ald_wwdt_init(uint32_t load, ald_wwdt_win_t win, type_func_t interrupt) | {
assert_param(IS_WWDT_WIN_TYPE(win));
assert_param(IS_FUNC_STATE(interrupt));
ALD_WWDT_UNLOCK();
WRITE_REG(WWDT->LOAD, load);
MODIFY_REG(WWDT->CON, WWDT_CON_WWDTWIN_MSK, win << WWDT_CON_WWDTWIN_POSS);
SET_BIT(WWDT->CON, WWDT_CON_CLKS_MSK);
SET_BIT(WWDT->CON, WWDT_CON_RSTEN_MSK);
MODIFY_... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* drive->addressing: 0: 28-bit 1: 48-bit 2: 48-bit capable doing 28-bit */ | static int set_addressing(ide_drive_t *drive, int arg) | /* drive->addressing: 0: 28-bit 1: 48-bit 2: 48-bit capable doing 28-bit */
static int set_addressing(ide_drive_t *drive, int arg) | {
if (arg < 0 || arg > 2)
return -EINVAL;
if (arg && ((drive->hwif->host_flags & IDE_HFLAG_NO_LBA48) ||
ata_id_lba48_enabled(drive->id) == 0))
return -EIO;
if (arg == 2)
arg = 0;
if (arg)
drive->dev_flags |= IDE_DFLAG_LBA48;
else
drive->dev_flags &= ~IDE_DFLAG_LBA48;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set the Timer to Generate Update IRQ or DMA on any Event.
The events which will generate an interrupt or DMA request can be */ | void timer_update_on_any(uint32_t timer_peripheral) | /* Set the Timer to Generate Update IRQ or DMA on any Event.
The events which will generate an interrupt or DMA request can be */
void timer_update_on_any(uint32_t timer_peripheral) | {
TIM_CR1(timer_peripheral) &= ~TIM_CR1_URS;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Hosts that support power saving can use the 'enable' and 'disable' methods to exit and enter power saving states. For more information see comments for struct mmc_host_ops. */ | int mmc_host_lazy_disable(struct mmc_host *host) | /* Hosts that support power saving can use the 'enable' and 'disable' methods to exit and enter power saving states. For more information see comments for struct mmc_host_ops. */
int mmc_host_lazy_disable(struct mmc_host *host) | {
if (!(host->caps & MMC_CAP_DISABLE))
return 0;
if (host->en_dis_recurs)
return 0;
if (--host->nesting_cnt)
return 0;
if (!host->enabled)
return 0;
if (host->disable_delay) {
mmc_schedule_delayed_work(&host->disable,
msecs_to_jiffies(host->disable_delay));
return 0;
} else
return mmc_host_do_di... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* macio_register_driver - Registers a new MacIO device driver @drv: pointer to the driver definition structure */ | int macio_register_driver(struct macio_driver *drv) | /* macio_register_driver - Registers a new MacIO device driver @drv: pointer to the driver definition structure */
int macio_register_driver(struct macio_driver *drv) | {
drv->driver.name = drv->name;
drv->driver.bus = &macio_bus_type;
return driver_register(&drv->driver);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This will set the receive buffer length corresponding to the mtu size of networkinterface. */ | static void amd8111e_set_rx_buff_len(struct net_device *dev) | /* This will set the receive buffer length corresponding to the mtu size of networkinterface. */
static void amd8111e_set_rx_buff_len(struct net_device *dev) | {
struct amd8111e_priv* lp = netdev_priv(dev);
unsigned int mtu = dev->mtu;
if (mtu > ETH_DATA_LEN){
lp->rx_buff_len = mtu + ETH_HLEN + 10;
lp->options |= OPTION_JUMBO_ENABLE;
} else{
lp->rx_buff_len = PKT_BUFF_SZ;
lp->options &= ~OPTION_JUMBO_ENABLE;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* 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 (EfiBootServicesData, OldSize, NewSize, OldBuffer);
if (Buffer != NULL) {
MemoryProfileLibRecord (
(PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0),
MEMORY_PROFILE_ACTION_LIB_REALLOCATE_POOL,
EfiBootServicesData,
Buffer,
NewSize,
... | tianocore/edk2 | C++ | Other | 4,240 |
/* Handles an incoming read-response for the specified read-characteristic-value proc. */ | static int ble_gattc_read_rx_read_rsp(struct ble_gattc_proc *proc, int status, struct os_mbuf **om) | /* Handles an incoming read-response for the specified read-characteristic-value proc. */
static int ble_gattc_read_rx_read_rsp(struct ble_gattc_proc *proc, int status, struct os_mbuf **om) | {
struct ble_gatt_attr attr;
ble_gattc_dbg_assert_proc_not_inserted(proc);
attr.handle = proc->read.handle;
attr.offset = 0;
attr.om = *om;
ble_gattc_read_cb(proc, status, 0, &attr);
*om = attr.om;
return BLE_HS_EDONE;
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* Get to know the Tx FIFO length from the specified port. */ | long UARTFIFOTxLength(unsigned long ulBase) | /* Get to know the Tx FIFO length from the specified port. */
long UARTFIFOTxLength(unsigned long ulBase) | {
xASSERT(UARTBaseValid(ulBase));
return((xHWREG(ulBase + UART_FSR) & UART_FSR_TXP_M) >> UART_FSR_TXP_S);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Finish up at the end of a Huffman-compressed scan. */ | finish_pass_huff(j_decompress_ptr cinfo) | /* Finish up at the end of a Huffman-compressed scan. */
finish_pass_huff(j_decompress_ptr cinfo) | {
huff_entropy_ptr entropy = (huff_entropy_ptr) cinfo->entropy;
cinfo->marker->discarded_bytes += entropy->bitstate.bits_left / 8;
entropy->bitstate.bits_left = 0;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Called from kernel/module.c:sys_init_module and routine for a.out format. */ | static void sh7705_flush_icache_range(void *args) | /* Called from kernel/module.c:sys_init_module and routine for a.out format. */
static void sh7705_flush_icache_range(void *args) | {
struct flusher_data *data = args;
unsigned long start, end;
start = data->addr1;
end = data->addr2;
__flush_wback_region((void *)start, end - start);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Get the base address and size for the fault tolerant write (FTW) working area used for UEFI variable storage. */ | EFI_STATUS EFIAPI GetVariableFlashFtwWorkingInfo(OUT EFI_PHYSICAL_ADDRESS *BaseAddress, OUT UINT64 *Length) | /* Get the base address and size for the fault tolerant write (FTW) working area used for UEFI variable storage. */
EFI_STATUS EFIAPI GetVariableFlashFtwWorkingInfo(OUT EFI_PHYSICAL_ADDRESS *BaseAddress, OUT UINT64 *Length) | {
EFI_STATUS Status;
VARIABLE_FLASH_INFO *VariableFlashInfo;
if ((BaseAddress == NULL) || (Length == NULL)) {
return EFI_INVALID_PARAMETER;
}
Status = GetVariableFlashInfoFromHob (&VariableFlashInfo);
if (!EFI_ERROR (Status)) {
*BaseAddress = VariableFlashInfo->FtwWorkingBaseAddress;
... | tianocore/edk2 | C++ | Other | 4,240 |
/* Write a value to the specified backup register. */ | void gpbr_write(gpbr_num_t ul_reg_num, uint32_t ul_value) | /* Write a value to the specified backup register. */
void gpbr_write(gpbr_num_t ul_reg_num, uint32_t ul_value) | {
GPBR->SYS_GPBR[ul_reg_num] = ul_value;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* System calibration rtc disable.
Use this function to disable system calibration rtc. */ | void system_rtc_calibration_disable(void) | /* System calibration rtc disable.
Use this function to disable system calibration rtc. */
void system_rtc_calibration_disable(void) | {
LP_CLK_CAL_REGS0->CONFIG_REG.reg &= \
~LP_CLK_CAL_REGS_CONFIG_REG_START_RTC_CALIB;
} | memfault/zero-to-main | C++ | null | 200 |
/* System reset should not return, if it returns, it means the system does not support cold reset. */ | VOID EFIAPI ResetCold(VOID) | /* System reset should not return, if it returns, it means the system does not support cold reset. */
VOID EFIAPI ResetCold(VOID) | {
IoWrite8 (0xCF9, BIT2 | BIT1);
MicroSecondDelay (50);
IoWrite8 (0x64, 0xfe);
CpuDeadLoop ();
} | tianocore/edk2 | C++ | Other | 4,240 |
/* usbvision_begin_streaming() Sure you have to put bit 7 to 0, if not incoming frames are droped, but no idea about the rest */ | int usbvision_begin_streaming(struct usb_usbvision *usbvision) | /* usbvision_begin_streaming() Sure you have to put bit 7 to 0, if not incoming frames are droped, but no idea about the rest */
int usbvision_begin_streaming(struct usb_usbvision *usbvision) | {
int errCode = 0;
if (usbvision->isocMode == ISOC_MODE_COMPRESS) {
usbvision_init_compression(usbvision);
}
errCode = usbvision_write_reg(usbvision, USBVISION_VIN_REG2, USBVISION_NOHVALID |
usbvision->Vin_Reg2_Preset);
return errCode;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get the total number of logical processors in the platform. */ | UINT32 CpuCacheInfoGetNumberOfProcessors(IN MP_SERVICES MpServices) | /* Get the total number of logical processors in the platform. */
UINT32 CpuCacheInfoGetNumberOfProcessors(IN MP_SERVICES MpServices) | {
EFI_STATUS Status;
UINTN NumberOfProcessor;
UINTN NumberOfEnabledProcessor;
Status = MpServices.Protocol->GetNumberOfProcessors (MpServices.Protocol, &NumberOfProcessor, &NumberOfEnabledProcessor);
ASSERT_EFI_ERROR (Status);
return (UINT32)NumberOfProcessor;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Configure the size of the source or destination data circular buffer used by the DMA Controller . */ | void DMATransferAddressModulo(unsigned long ulChannelID, unsigned long ulModVal, unsigned long ulAddrType) | /* Configure the size of the source or destination data circular buffer used by the DMA Controller . */
void DMATransferAddressModulo(unsigned long ulChannelID, unsigned long ulModVal, unsigned long ulAddrType) | {
xASSERT(xDMAChannelIDValid(ulChannelID));
xASSERT((ulAddrType == DMA_MOD_SMODE) || (ulAddrType == DMA_MOD_DMODE));
xASSERT((ulModVal >= 0) || (ulModVal < 16));
if(ulAddrType == DMA_MOD_SMODE)
{
xHWREG(g_psDMAChannelAddress[ulChannelID] + DMA_DCR) &= ~DMA_DCR_SMOD_M;
xHWREG(g_psDMAC... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Return 0 if a subject with the smack of sock could access an object with the smack of other, otherwise an error code */ | static int smack_unix_stream_connect(struct socket *sock, struct socket *other, struct sock *newsk) | /* Return 0 if a subject with the smack of sock could access an object with the smack of other, otherwise an error code */
static int smack_unix_stream_connect(struct socket *sock, struct socket *other, struct sock *newsk) | {
struct inode *sp = SOCK_INODE(sock);
struct inode *op = SOCK_INODE(other);
struct smk_audit_info ad;
smk_ad_init(&ad, __func__, LSM_AUDIT_DATA_NET);
smk_ad_setfield_u_net_sk(&ad, other->sk);
return smk_access(smk_of_inode(sp), smk_of_inode(op),
MAY_READWRITE, &ad);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Send SWITCH_FUNCTION command to switch the card function group. */ | static status_t SD_SwitchFunction(sd_card_t *card, uint32_t mode, uint32_t group, uint32_t number, uint32_t *status) | /* Send SWITCH_FUNCTION command to switch the card function group. */
static status_t SD_SwitchFunction(sd_card_t *card, uint32_t mode, uint32_t group, uint32_t number, uint32_t *status) | {
assert(card);
assert(status);
HOST_TRANSFER content = {0};
HOST_COMMAND command = {0};
HOST_DATA data = {0};
command.index = kSD_Switch;
command.argument = (mode << 31U | 0x00FFFFFFU);
command.argument &= ~((uint32_t)(0xFU) << (group * 4U));
command.argument |= (number << (group * ... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Used to process(transform) blocks of data, either encrypt or decrypt it. */ | bool AESDataProcess(uint32_t ui32Base, uint32_t *pui32Src, uint32_t *pui32Dest, uint32_t ui32Length) | /* Used to process(transform) blocks of data, either encrypt or decrypt it. */
bool AESDataProcess(uint32_t ui32Base, uint32_t *pui32Src, uint32_t *pui32Dest, uint32_t ui32Length) | {
uint32_t ui32Count;
ASSERT(ui32Base == AES_BASE);
AESLengthSet(AES_BASE, (uint64_t)ui32Length);
for (ui32Count = 0; ui32Count < ui32Length; ui32Count += 16)
{
AESDataWrite(ui32Base, pui32Src + (ui32Count / 4));
AESDataRead(ui32Base, pui32Dest + (ui32Count / 4));
}
return (t... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Get the PWM duty of the PWM module.
The */ | unsigned long PWMDutyGet(unsigned long ulBase, unsigned long ulChannel) | /* Get the PWM duty of the PWM module.
The */
unsigned long PWMDutyGet(unsigned long ulBase, unsigned long ulChannel) | {
unsigned long ulChannelTemp;
unsigned long ulCMRData;
unsigned long ulCNRData;
ulChannelTemp = (ulBase == PWMA_BASE) ? ulChannel : (ulChannel - 4);
xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE));
xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 3)));
ulCNRData = (xHWREG(ulBase +... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* set power down sleep VDDCORE gpio interrupt mask */ | BL_Err_Type PDS_Set_Vddcore_GPIO_IntMask(BL_Mask_Type intMask) | /* set power down sleep VDDCORE gpio interrupt mask */
BL_Err_Type PDS_Set_Vddcore_GPIO_IntMask(BL_Mask_Type intMask) | {
uint32_t tmpVal = 0;
tmpVal = BL_RD_REG(PDS_BASE, PDS_GPIO_INT);
if (intMask != UNMASK) {
tmpVal = BL_SET_REG_BIT(tmpVal, PDS_GPIO_INT_MASK);
} else {
tmpVal = BL_CLR_REG_BIT(tmpVal, PDS_GPIO_INT_MASK);
}
BL_WR_REG(PDS_BASE, PDS_GPIO_INT, tmpVal);
return SUCCESS;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Callback for interrupt through some level changes on pcf857x pins */ | static void pcf857x_int_gpio_handler(const struct device *dev, struct gpio_callback *gpio_cb, uint32_t pins) | /* Callback for interrupt through some level changes on pcf857x pins */
static void pcf857x_int_gpio_handler(const struct device *dev, struct gpio_callback *gpio_cb, uint32_t pins) | {
ARG_UNUSED(dev);
ARG_UNUSED(pins);
struct pcf857x_drv_data *drv_data =
CONTAINER_OF(gpio_cb, struct pcf857x_drv_data, int_gpio_cb);
k_work_submit(&drv_data->work);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* A bit more gossip about the iron we're running on ... */ | static void sni_pcimt_detect(void) | /* A bit more gossip about the iron we're running on ... */
static void sni_pcimt_detect(void) | {
char boardtype[80];
unsigned char csmsr;
char *p = boardtype;
unsigned int asic;
csmsr = *(volatile unsigned char *)PCIMT_CSMSR;
p += sprintf(p, "%s PCI", (csmsr & 0x80) ? "RM200" : "RM300");
if ((csmsr & 0x80) == 0)
p += sprintf(p, ", board revision %s",
(csmsr & 0x20) ? "D" : "C");
asic = c... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* For all these reasons, the caller must be prepared for this function to return. The simplest way to handle it is to just enter an infinite loop and wait for the power to be removed. */ | void HibernateRequest(void) | /* For all these reasons, the caller must be prepared for this function to return. The simplest way to handle it is to just enter an infinite loop and wait for the power to be removed. */
void HibernateRequest(void) | {
HWREG(HIB_CTL) |= HIB_CTL_HIBREQ;
} | watterott/WebRadio | C++ | null | 71 |
/* asd_verify_flash_seg - verify data with flash memory @asd_ha: pointer to the host adapter structure @src: pointer to the source data to be verified @dest_offset: offset from flash memory @bytes_to_verify: total bytes to verify */ | int asd_verify_flash_seg(struct asd_ha_struct *asd_ha, const void *src, u32 dest_offset, u32 bytes_to_verify) | /* asd_verify_flash_seg - verify data with flash memory @asd_ha: pointer to the host adapter structure @src: pointer to the source data to be verified @dest_offset: offset from flash memory @bytes_to_verify: total bytes to verify */
int asd_verify_flash_seg(struct asd_ha_struct *asd_ha, const void *src, u32 dest_offse... | {
const u8 *src_buf;
u8 flash_char;
int err;
u32 nv_offset, reg, i;
reg = asd_ha->hw_prof.flash.bar;
src_buf = NULL;
err = FLASH_OK;
nv_offset = dest_offset;
src_buf = (const u8 *)src;
for (i = 0; i < bytes_to_verify; i++) {
flash_char = asd_read_reg_byte(asd_ha, reg + nv_offset + i);
if (flash_char != sr... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Return false if folding can raise an error. Bitwise operations need operands convertible to integers; division operations cannot have 0 as divisor. */ | static int validop(int op, TValue *v1, TValue *v2) | /* Return false if folding can raise an error. Bitwise operations need operands convertible to integers; division operations cannot have 0 as divisor. */
static int validop(int op, TValue *v1, TValue *v2) | {
case LUA_OPBAND: case LUA_OPBOR: case LUA_OPBXOR:
case LUA_OPSHL: case LUA_OPSHR: case LUA_OPBNOT: {
lua_Integer i;
return (luaV_tointegerns(v1, &i, LUA_FLOORN2I) &&
luaV_tointegerns(v2, &i, LUA_FLOORN2I));
}
case LUA_OPDIV: case LUA_OPIDIV: case LUA_OPMOD:
return (nval... | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF C... | s32 krb5_make_seq_num(struct crypto_blkcipher *key, int direction, u32 seqnum, unsigned char *cksum, unsigned char *buf) | /* OPENVISION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL OPENVISION BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF C... | {
unsigned char plain[8];
plain[0] = (unsigned char) (seqnum & 0xff);
plain[1] = (unsigned char) ((seqnum >> 8) & 0xff);
plain[2] = (unsigned char) ((seqnum >> 16) & 0xff);
plain[3] = (unsigned char) ((seqnum >> 24) & 0xff);
plain[4] = direction;
plain[5] = direction;
plain[6] = direction;
plain[7] = direction... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* NOTE! unlike strncmp, ext3_match returns 1 for success, 0 for failure. */ | static int ext3_match(int len, const char *const name, struct ext3_dir_entry_2 *de) | /* NOTE! unlike strncmp, ext3_match returns 1 for success, 0 for failure. */
static int ext3_match(int len, const char *const name, struct ext3_dir_entry_2 *de) | {
if (len != de->name_len)
return 0;
if (!de->inode)
return 0;
return !memcmp(name, de->name, len);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This routine is called each time the system is reset (file load, capture) and so it should take care of freeing any of our persistent stuff. */ | static void dof_dpp_reset(void) | /* This routine is called each time the system is reset (file load, capture) and so it should take care of freeing any of our persistent stuff. */
static void dof_dpp_reset(void) | {
dpp_reset_opid_support();
dpp_reset_sid_support();
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */ | void Vector24_handler(void) | /* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
void Vector24_handler(void) | {
asm
{
LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (24 * 2))
JMP 0,X
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Function for handling the Timer 0 interrupt used for TX/RX sweep. The carrier is started with the new channel, and the channel is incremented for the next interrupt. */ | void TIMER0_IRQHandler(void) | /* Function for handling the Timer 0 interrupt used for TX/RX sweep. The carrier is started with the new channel, and the channel is incremented for the next interrupt. */
void TIMER0_IRQHandler(void) | {
if (sweep_tx_)
{
radio_tx_carrier(txpower_, mode_, channel_);
}
else
{
radio_rx_carrier(mode_, channel_);
}
channel_++;
if (channel_ > channel_end_)
{
channel_ = channel_start_;
}
NRF_TIMER0->EVENTS_COMPARE[0] = 0;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Prints a formatted unicode string to the default console, at the supplied cursor position. */ | UINTN EFIAPI PrintAt(IN UINTN Width, IN UINTN Column, IN UINTN Row, IN CHAR16 *Fmt,...) | /* Prints a formatted unicode string to the default console, at the supplied cursor position. */
UINTN EFIAPI PrintAt(IN UINTN Width, IN UINTN Column, IN UINTN Row, IN CHAR16 *Fmt,...) | {
VA_LIST Args;
UINTN LengthOfPrinted;
VA_START (Args, Fmt);
LengthOfPrinted = PrintInternal (Width, Column, Row, gST->ConOut, Fmt, Args);
VA_END (Args);
return LengthOfPrinted;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Fills each I2S_Config_T member with its default value. */ | void I2S_ConfigStructInit(I2S_Config_T *i2sConfig) | /* Fills each I2S_Config_T member with its default value. */
void I2S_ConfigStructInit(I2S_Config_T *i2sConfig) | {
i2sConfig->mode = I2S_MODE_SLAVE_TX;
i2sConfig->standard = I2S_STANDARD_PHILLIPS;
i2sConfig->length = I2S_DATA_LENGHT_16B;
i2sConfig->MCLKOutput = I2S_MCLK_OUTPUT_DISABLE;
i2sConfig->audioDiv = I2S_AUDIO_DIV_DEFAULT;
i2sConfig->polarity = I2S_CLKPOL_LOW;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* qla4xxx_init_local_data - initialize adapter specific local data @ha: pointer to host adapter structure. */ | static int qla4xxx_init_local_data(struct scsi_qla_host *ha) | /* qla4xxx_init_local_data - initialize adapter specific local data @ha: pointer to host adapter structure. */
static int qla4xxx_init_local_data(struct scsi_qla_host *ha) | {
ha->aen_q_count = MAX_AEN_ENTRIES;
return qla4xxx_get_firmware_status(ha);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Helper method for drivers which want to hardwire 80 wire cable detection. */ | int ata_cable_80wire(struct ata_port *ap) | /* Helper method for drivers which want to hardwire 80 wire cable detection. */
int ata_cable_80wire(struct ata_port *ap) | {
return ATA_CBL_PATA80;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This file is part of the Simba project. */ | int mock_write_nrf24l01_module_init(int res) | /* This file is part of the Simba project. */
int mock_write_nrf24l01_module_init(int res) | {
harness_mock_write("nrf24l01_module_init()",
NULL,
0);
harness_mock_write("nrf24l01_module_init(): return (res)",
&res,
sizeof(res));
return (0);
} | eerimoq/simba | C++ | Other | 337 |
/* the command must previously have been allocated by scsi_pool_alloc_command. */ | static void scsi_pool_free_command(struct scsi_host_cmd_pool *pool, struct scsi_cmnd *cmd) | /* the command must previously have been allocated by scsi_pool_alloc_command. */
static void scsi_pool_free_command(struct scsi_host_cmd_pool *pool, struct scsi_cmnd *cmd) | {
if (cmd->prot_sdb)
kmem_cache_free(scsi_sdb_cache, cmd->prot_sdb);
kmem_cache_free(pool->sense_slab, cmd->sense_buffer);
kmem_cache_free(pool->cmd_slab, cmd);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Configures the discontinuous mode for the selected ADC regular group channel. */ | void ADC_ConfigDiscModeChannelCount(ADC_Module *ADCx, uint8_t Number) | /* Configures the discontinuous mode for the selected ADC regular group channel. */
void ADC_ConfigDiscModeChannelCount(ADC_Module *ADCx, uint8_t Number) | {
uint32_t tmpreg1 = 0;
uint32_t tmpreg2 = 0;
assert_param(IsAdcModule(ADCx));
assert_param(IsAdcSeqDiscNumberValid(Number));
tmpreg1 = ADCx->CTRL1;
tmpreg1 &= CR1_DISCNUM_Reset;
tmpreg2 = Number - 1;
tmpreg1 |= tmpreg2 << 13;
ADCx->CTRL1 = tmpreg1;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Configure a voltage threshold detected by a power supply voltage detector (PVD). */ | void PMU_ConfigPVDLevel(PMU_PVD_LEVEL_T level) | /* Configure a voltage threshold detected by a power supply voltage detector (PVD). */
void PMU_ConfigPVDLevel(PMU_PVD_LEVEL_T level) | {
PMU->CTRL_B.PLSEL = 0x0000;
PMU->CTRL_B.PLSEL = level;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function sends to the host the last transmitted packet, filling the radiotap headers with transmission information. */ | void lbs_send_tx_feedback(struct lbs_private *priv, u32 try_count) | /* This function sends to the host the last transmitted packet, filling the radiotap headers with transmission information. */
void lbs_send_tx_feedback(struct lbs_private *priv, u32 try_count) | {
struct tx_radiotap_hdr *radiotap_hdr;
if (!priv->monitormode || priv->currenttxskb == NULL)
return;
radiotap_hdr = (struct tx_radiotap_hdr *)priv->currenttxskb->data;
radiotap_hdr->data_retries = try_count ?
(1 + priv->txretrycount - try_count) : 0;
priv->currenttxskb->protocol = eth_type_trans(priv->current... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* A parser parses a Device Tree to populate a specific CmObj type. None, one or many CmObj can be created by the parser. The created CmObj are then handed to the parser's caller through the HW_INFO_ADD_OBJECT interface. This can also be a dispatcher. I.e. a function that not parsing a Device Tree but calling other par... | EFI_STATUS EFIAPI ArmGicRInfoParser(IN CONST FDT_HW_INFO_PARSER_HANDLE FdtParserHandle, IN INT32 FdtBranch) | /* A parser parses a Device Tree to populate a specific CmObj type. None, one or many CmObj can be created by the parser. The created CmObj are then handed to the parser's caller through the HW_INFO_ADD_OBJECT interface. This can also be a dispatcher. I.e. a function that not parsing a Device Tree but calling other par... | {
EFI_STATUS Status;
UINT32 GicVersion;
VOID *Fdt;
if (FdtParserHandle == NULL) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
Fdt = FdtParserHandle->Fdt;
if (!FdtNodeHasProperty (Fdt, FdtBranch, "interrupt-controller")) {
ASSERT (0);
return EFI_INVALID_PARAMETER;
}
Status ... | tianocore/edk2 | C++ | Other | 4,240 |
/* Determine if the character is valid for a filename. */ | BOOLEAN IsValidFileNameChar(IN CONST CHAR16 Ch) | /* Determine if the character is valid for a filename. */
BOOLEAN IsValidFileNameChar(IN CONST CHAR16 Ch) | {
if ((Ch < 0x20) || (Ch == L'\"') || (Ch == L'*') || (Ch == L'/') || (Ch == L'<') || (Ch == L'>') || (Ch == L'?') || (Ch == L'|')) {
return FALSE;
}
return TRUE;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Return: 1 (true) for active line and 0 (false) for no link (timeout) */ | static int wait_link_up(struct pcie_dw_ti *pci) | /* Return: 1 (true) for active line and 0 (false) for no link (timeout) */
static int wait_link_up(struct pcie_dw_ti *pci) | {
unsigned long timeout;
timeout = get_timer(0) + PCIE_LINK_UP_TIMEOUT_MS;
while (!is_link_up(pci)) {
if (get_timer(0) > timeout)
return 0;
};
return 1;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* This allows for a dynamic start/restart of the entire card. */ | static int cops_jumpstart(struct net_device *dev) | /* This allows for a dynamic start/restart of the entire card. */
static int cops_jumpstart(struct net_device *dev) | {
struct cops_local *lp = netdev_priv(dev);
cops_reset(dev,1);
cops_load(dev);
if(lp->nodeid == 1)
cops_nodeid(dev,lp->node_acquire);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* megasas_disable_intr_gen2 - Disables interrupt @regs: MFI register set */ | static void megasas_disable_intr_gen2(struct megasas_register_set __iomem *regs) | /* megasas_disable_intr_gen2 - Disables interrupt @regs: MFI register set */
static void megasas_disable_intr_gen2(struct megasas_register_set __iomem *regs) | {
u32 mask = 0xFFFFFFFF;
writel(mask, ®s->outbound_intr_mask);
readl(®s->outbound_intr_mask);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* get the current position at the given channel from CCCA register */ | static int emu8k_get_curpos(struct snd_emu8k_pcm *rec, int ch) | /* get the current position at the given channel from CCCA register */
static int emu8k_get_curpos(struct snd_emu8k_pcm *rec, int ch) | {
int val = EMU8000_CCCA_READ(rec->emu, ch) & 0xfffffff;
val -= rec->loop_start[ch] - 1;
return val;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Search for the next AP that is put in waiting state by single-threaded StartupAllAPs(). */ | EFI_STATUS GetNextWaitingProcessorNumber(OUT UINTN *NextProcessorNumber) | /* Search for the next AP that is put in waiting state by single-threaded StartupAllAPs(). */
EFI_STATUS GetNextWaitingProcessorNumber(OUT UINTN *NextProcessorNumber) | {
UINTN ProcessorNumber;
CPU_MP_DATA *CpuMpData;
CpuMpData = GetCpuMpData ();
for (ProcessorNumber = 0; ProcessorNumber < CpuMpData->CpuCount; ProcessorNumber++) {
if (CpuMpData->CpuData[ProcessorNumber].Waiting) {
*NextProcessorNumber = ProcessorNumber;
return EFI_SUCCESS;
}
}
r... | tianocore/edk2 | C++ | Other | 4,240 |
/* Do arp resolution from arp cache in PxeBcMode. */ | BOOLEAN PxeBcCheckArpCache(IN EFI_PXE_BASE_CODE_MODE *Mode, IN EFI_IPv4_ADDRESS *Ip4Addr, OUT EFI_MAC_ADDRESS *MacAddress) | /* Do arp resolution from arp cache in PxeBcMode. */
BOOLEAN PxeBcCheckArpCache(IN EFI_PXE_BASE_CODE_MODE *Mode, IN EFI_IPv4_ADDRESS *Ip4Addr, OUT EFI_MAC_ADDRESS *MacAddress) | {
UINT32 Index;
ASSERT (!Mode->UsingIpv6);
for (Index = 0; Index < Mode->ArpCacheEntries; Index++) {
if (EFI_IP4_EQUAL (&Mode->ArpCache[Index].IpAddr.v4, Ip4Addr)) {
CopyMem (
MacAddress,
&Mode->ArpCache[Index].MacAddr,
sizeof (EFI_MAC_ADDRESS)
);
return TRUE;
... | tianocore/edk2 | C++ | Other | 4,240 |
/* Determine the number of SCBs available on the controller */ | int ahc_probe_scbs(struct ahc_softc *ahc) | /* Determine the number of SCBs available on the controller */
int ahc_probe_scbs(struct ahc_softc *ahc) | {
ahc_outb(ahc, SCBPTR, i);
ahc_outb(ahc, SCB_BASE, i);
if (ahc_inb(ahc, SCB_BASE) != i)
break;
ahc_outb(ahc, SCBPTR, 0);
if (ahc_inb(ahc, SCB_BASE) != 0)
break;
}
return (i);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function is used to config the pin in gpio or 7816 mode for the 7816 power on timing. */ | void wm_sc_io_clk_config(uint8_t mode) | /* This function is used to config the pin in gpio or 7816 mode for the 7816 power on timing. */
void wm_sc_io_clk_config(uint8_t mode) | { if (sc_io.initialed == 0)
{
printf("error : 7816 io map must init....\r\n");
return ;
}
if (mode)
{
tls_io_cfg_set(sc_io.clk_pin_num, WM_IO_OPTION5);
tls_io_cfg_set(sc_io.io_pin_num, WM_IO_OPTION5);
tls_gpio_cfg(sc_io.clk_pin_num, WM_GPIO_DIR_OUTPUT, WM_GPIO_ATTR_PULLHIGH);
tls_gpio_cfg(sc_io.io_pin_n... | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* pmcraid_get_error_info - return error string for an ioasc @ioasc: ioasc code Return Value none */ | static struct pmcraid_ioasc_error* pmcraid_get_error_info(u32 ioasc) | /* pmcraid_get_error_info - return error string for an ioasc @ioasc: ioasc code Return Value none */
static struct pmcraid_ioasc_error* pmcraid_get_error_info(u32 ioasc) | {
int i;
for (i = 0; i < ARRAY_SIZE(pmcraid_ioasc_error_table); i++) {
if (pmcraid_ioasc_error_table[i].ioasc_code == ioasc)
return &pmcraid_ioasc_error_table[i];
}
return NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Memory scanning is a long process and it needs to be interruptable. This function checks whether such interrupt condition occured. */ | static int scan_should_stop(void) | /* Memory scanning is a long process and it needs to be interruptable. This function checks whether such interrupt condition occured. */
static int scan_should_stop(void) | {
if (!atomic_read(&kmemleak_enabled))
return 1;
if (current->mm)
return signal_pending(current);
else
return kthread_should_stop();
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set beeper frequency. Max allowed frequency is 2.5 KHz. This limit is mostly arbitrary, but the beeper isn't really much good beyond this frequency. */ | void set_beeper_frequency(uint frequency) | /* Set beeper frequency. Max allowed frequency is 2.5 KHz. This limit is mostly arbitrary, but the beeper isn't really much good beyond this frequency. */
void set_beeper_frequency(uint frequency) | {
#define FREQ_LIMIT 2500
volatile immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
if (frequency > FREQ_LIMIT)
frequency = FREQ_LIMIT;
frequency = 1000000 / frequency;
immap->im_cpmtimer.cpmt_trr1 = (ushort) frequency;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* 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 QemuVideoComponentNameGetDriverName(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,
mQemuVideoDriverNameTable,
DriverName,
(BOOLEAN)(This == &gQemuVideoComponentName)
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Deinitializes the CEC peripheral registers to their default reset values. */ | void CEC_DeInit(void) | /* Deinitializes the CEC peripheral registers to their default reset values. */
void CEC_DeInit(void) | {
RCC_APB1PeriphResetCmd(RCC_APB1Periph_CEC, ENABLE);
RCC_APB1PeriphResetCmd(RCC_APB1Periph_CEC, DISABLE);
} | gcallipo/RadioDSP-Stm32f103 | C++ | Common Creative - Attribution 3.0 | 51 |
/* It is safe to call this on paths that no locks or extent buffers held. */ | noinline void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p) | /* It is safe to call this on paths that no locks or extent buffers held. */
noinline void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p) | {
int i;
for (i = 0; i < BTRFS_MAX_LEVEL; i++) {
p->slots[i] = 0;
if (!p->nodes[i])
continue;
if (p->locks[i]) {
btrfs_tree_unlock(p->nodes[i]);
p->locks[i] = 0;
}
free_extent_buffer(p->nodes[i]);
p->nodes[i] = NULL;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Report status code into runtime memory. If the runtime pool is full, roll back to the first record and overwrite it. */ | EFI_STATUS EFIAPI MemoryStatusCodeReportWorker(IN EFI_STATUS_CODE_TYPE CodeType, IN EFI_STATUS_CODE_VALUE Value, IN UINT32 Instance, IN EFI_GUID *CallerId, IN EFI_STATUS_CODE_DATA *Data OPTIONAL) | /* Report status code into runtime memory. If the runtime pool is full, roll back to the first record and overwrite it. */
EFI_STATUS EFIAPI MemoryStatusCodeReportWorker(IN EFI_STATUS_CODE_TYPE CodeType, IN EFI_STATUS_CODE_VALUE Value, IN UINT32 Instance, IN EFI_GUID *CallerId, IN EFI_STATUS_CODE_DATA *Data OPTIONAL) | {
MEMORY_STATUSCODE_RECORD *Record;
Record = (MEMORY_STATUSCODE_RECORD *)(mMmMemoryStatusCodeTable + 1);
Record = &Record[mMmMemoryStatusCodeTable->RecordIndex++];
Record->CodeType = CodeType;
Record->Value = Value;
Record->Instance = Instance;
mMmMemoryStatusCodeTable->NumberOfRecords++;
if (mMmMem... | tianocore/edk2 | C++ | Other | 4,240 |
/* The transition from "non-FP supporting" to "FP supporting" must be done atomically to avoid confusing the floating point logic used by z_swap(), so this routine locks interrupts to ensure that a context switch does not occur. The locking isn't really needed when the routine is called by a cooperative thread (since c... | void z_float_enable(struct k_thread *thread, unsigned int options) | /* The transition from "non-FP supporting" to "FP supporting" must be done atomically to avoid confusing the floating point logic used by z_swap(), so this routine locks interrupts to ensure that a context switch does not occur. The locking isn't really needed when the routine is called by a cooperative thread (since c... | {
unsigned int imask;
struct k_thread *fp_owner;
if (!thread) {
return;
}
imask = irq_lock();
thread->base.user_options |= (uint8_t)options;
__asm__ volatile("clts\n\t");
fp_owner = _kernel.current_fp;
if (fp_owner != NULL) {
if ((fp_owner->arch.flags & X86_THREAD_FLAG_ALL) != 0) {
FpCtxSave(fp_owner);
... | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Writes an unsigned 8 bit value over I2C. */ | err_t l3gd20Write8(uint8_t reg, uint8_t value) | /* Writes an unsigned 8 bit value over I2C. */
err_t l3gd20Write8(uint8_t reg, uint8_t value) | {
I2CWriteLength = 3;
I2CReadLength = 0;
I2CMasterBuffer[0] = L3GD20_ADDRESS;
I2CMasterBuffer[1] = reg;
I2CMasterBuffer[2] = value;
ASSERT_I2C_STATUS(i2cEngine());
return ERROR_NONE;
} | microbuilder/LPC11U_LPC13U_CodeBase | C++ | Other | 54 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.