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 |
|---|---|---|---|---|---|---|---|
/* len <= UFS_MAXNAMLEN and de != NULL are guaranteed by caller. */ | static int ufs_match(struct super_block *sb, int len, const char *const name, struct ufs_dir_entry *de) | /* len <= UFS_MAXNAMLEN and de != NULL are guaranteed by caller. */
static int ufs_match(struct super_block *sb, int len, const char *const name, struct ufs_dir_entry *de) | {
if (len != ufs_get_de_namlen(sb, de))
return 0;
if (!de->d_ino)
return 0;
return !memcmp(name, de->d_name, len);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This initializes the FV lib with a pointer to the FV and length. It does not verify the FV in any way. */ | EFI_STATUS InitializeFvLib(IN VOID *Fv, IN UINT32 FvLength) | /* This initializes the FV lib with a pointer to the FV and length. It does not verify the FV in any way. */
EFI_STATUS InitializeFvLib(IN VOID *Fv, IN UINT32 FvLength) | {
if (Fv == NULL) {
return EFI_INVALID_PARAMETER;
}
mFvHeader = (EFI_FIRMWARE_VOLUME_HEADER *) Fv;
mFvLength = FvLength;
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* set up the iterator to start reading from the first line */ | static void* cachefiles_histogram_start(struct seq_file *m, loff_t *_pos) | /* set up the iterator to start reading from the first line */
static void* cachefiles_histogram_start(struct seq_file *m, loff_t *_pos) | {
if ((unsigned long long)*_pos >= HZ + 2)
return NULL;
if (*_pos == 0)
*_pos = 1;
return (void *)(unsigned long) *_pos;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param base Pointer to the FLEXIO_UART_Type structure. param txData The data bytes to send. param txSize The number of data bytes to send. */ | void FLEXIO_UART_WriteBlocking(FLEXIO_UART_Type *base, const uint8_t *txData, size_t txSize) | /* param base Pointer to the FLEXIO_UART_Type structure. param txData The data bytes to send. param txSize The number of data bytes to send. */
void FLEXIO_UART_WriteBlocking(FLEXIO_UART_Type *base, const uint8_t *txData, size_t txSize) | {
assert(txData);
assert(txSize);
while (txSize--)
{
while (!(FLEXIO_GetShifterStatusFlags(base->flexioBase) & (1U << base->shifterIndex[0])))
{
}
base->flexioBase->SHIFTBUF[base->shifterIndex[0]] = *txData++;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* @params ticks - Number of miliseconds to delay. */ | void timer_sleep(uint32_t ticks) | /* @params ticks - Number of miliseconds to delay. */
void timer_sleep(uint32_t ticks) | {
timer_delayCount = ticks;
while (timer_delayCount != 0u);
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* Defines the Own Address of the CEC device. */ | void CEC_OwnAddressConfig(uint8_t CEC_OwnAddress) | /* Defines the Own Address of the CEC device. */
void CEC_OwnAddressConfig(uint8_t CEC_OwnAddress) | {
assert_param(IS_CEC_ADDRESS(CEC_OwnAddress));
CEC->OAR = CEC_OwnAddress;
} | gcallipo/RadioDSP-Stm32f103 | C++ | Common Creative - Attribution 3.0 | 51 |
/* Now we can look at each of the routines this calls, in increasing order of complexity: do_hypercalls(), emulate_insn(), maybe_do_interrupt(), deliver_trap() and demand_page(). After all those, we'll be ready to examine the Switcher, and our philosophical understanding of the Host/Guest duality will be complete. : *... | static void adjust_pge(void *on) | /* Now we can look at each of the routines this calls, in increasing order of complexity: do_hypercalls(), emulate_insn(), maybe_do_interrupt(), deliver_trap() and demand_page(). After all those, we'll be ready to examine the Switcher, and our philosophical understanding of the Host/Guest duality will be complete. : *... | {
if (on)
write_cr4(read_cr4() | X86_CR4_PGE);
else
write_cr4(read_cr4() & ~X86_CR4_PGE);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Update the sequence numbers for the iSCSI command. */ | VOID IScsiUpdateCmdSN(IN OUT ISCSI_SESSION *Session, IN UINT32 MaxCmdSN, IN UINT32 ExpCmdSN) | /* Update the sequence numbers for the iSCSI command. */
VOID IScsiUpdateCmdSN(IN OUT ISCSI_SESSION *Session, IN UINT32 MaxCmdSN, IN UINT32 ExpCmdSN) | {
if (ISCSI_SEQ_LT (MaxCmdSN, ExpCmdSN - 1)) {
return;
}
if (ISCSI_SEQ_GT (MaxCmdSN, Session->MaxCmdSN)) {
Session->MaxCmdSN = MaxCmdSN;
}
if (ISCSI_SEQ_GT (ExpCmdSN, Session->ExpCmdSN)) {
Session->ExpCmdSN = ExpCmdSN;
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* bnx2i_find_hba_for_cnic - maps cnic device instance to bnx2i adapter instance @cnic: pointer to cnic device instance */ | struct bnx2i_hba* bnx2i_find_hba_for_cnic(struct cnic_dev *cnic) | /* bnx2i_find_hba_for_cnic - maps cnic device instance to bnx2i adapter instance @cnic: pointer to cnic device instance */
struct bnx2i_hba* bnx2i_find_hba_for_cnic(struct cnic_dev *cnic) | {
struct bnx2i_hba *hba, *temp;
mutex_lock(&bnx2i_dev_lock);
list_for_each_entry_safe(hba, temp, &adapter_list, link) {
if (hba->cnic == cnic) {
mutex_unlock(&bnx2i_dev_lock);
return hba;
}
}
mutex_unlock(&bnx2i_dev_lock);
return NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Stop the on going conversions for the selected ADC. */ | void ADC_StopOfConversion(ADC_TypeDef *ADCx) | /* Stop the on going conversions for the selected ADC. */
void ADC_StopOfConversion(ADC_TypeDef *ADCx) | {
assert_param(IS_ADC_ALL_PERIPH(ADCx));
ADCx->CR |= (uint32_t)ADC_CR_ADSTP;
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* Routine writes a core dump image in the current directory. Currently only a stub-function. */ | static int flat_core_dump(struct coredump_params *cprm) | /* Routine writes a core dump image in the current directory. Currently only a stub-function. */
static int flat_core_dump(struct coredump_params *cprm) | {
printk("Process %s:%d received signr %d and should have core dumped\n",
current->comm, current->pid, (int) cprm->signr);
return(1);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If the journal has been aborted on this mount time -EROFS will be returned. */ | int jbd2_journal_errno(journal_t *journal) | /* If the journal has been aborted on this mount time -EROFS will be returned. */
int jbd2_journal_errno(journal_t *journal) | {
int err;
spin_lock(&journal->j_state_lock);
if (journal->j_flags & JBD2_ABORT)
err = -EROFS;
else
err = journal->j_errno;
spin_unlock(&journal->j_state_lock);
return err;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* mbtype 0 1b direct(h263) mvdb 1 01b interpolate mc+q dbquant, mvdf, mvdb 2 001b backward mc+q dbquant, mvdb 3 0001b forward mc+q dbquant, mvdf */ | static __inline void put_bvop_mbtype(Bitstream *bs, int value) | /* mbtype 0 1b direct(h263) mvdb 1 01b interpolate mc+q dbquant, mvdf, mvdb 2 001b backward mc+q dbquant, mvdb 3 0001b forward mc+q dbquant, mvdf */
static __inline void put_bvop_mbtype(Bitstream *bs, int value) | {
switch (value) {
case MODE_FORWARD:
BitstreamPutBit(bs, 0);
case MODE_BACKWARD:
BitstreamPutBit(bs, 0);
case MODE_INTERPOLATE:
BitstreamPutBit(bs, 0);
case MODE_DIRECT:
BitstreamPutBit(bs, 1);
default:
break;
}
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* This function finishes the GCM operation and generates the authentication tag. */ | rt_err_t rt_hwcrypto_gcm_finish(struct rt_hwcrypto_ctx *ctx, const rt_uint8_t *tag, rt_size_t tag_len) | /* This function finishes the GCM operation and generates the authentication tag. */
rt_err_t rt_hwcrypto_gcm_finish(struct rt_hwcrypto_ctx *ctx, const rt_uint8_t *tag, rt_size_t tag_len) | {
struct hwcrypto_gcm *gcm_ctx = (struct hwcrypto_gcm *)ctx;
if (gcm_ctx && gcm_ctx->ops->finish)
{
return gcm_ctx->ops->finish(gcm_ctx, tag, tag_len);
}
return -RT_EINVAL;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* SPI2 interrupt handler. Clear the SPI interrupt flag and execute the callback function. */ | void SPI2IntHandler(void) | /* SPI2 interrupt handler. Clear the SPI interrupt flag and execute the callback function. */
void SPI2IntHandler(void) | {
unsigned long ulEventFlags;
unsigned long ulBase = SPI2_BASE;
ulEventFlags = xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_IF;
ulEventFlags |= xHWREG(ulBase + SPI_CNTRL2) & SPI_CNTRL2_SLV_START_INTSTS;
xHWREG(ulBase + SPI_CNTRL) |= SPI_CNTRL_IF;
xHWREG(ulBase + SPI_CNTRL2) |= SPI_CNTRL2_SLV_START_INT... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Sets the integration time to the specified value. */ | err_t tcs34725SetIntegrationTime(tcs34725IntegrationTime_t it) | /* Sets the integration time to the specified value. */
err_t tcs34725SetIntegrationTime(tcs34725IntegrationTime_t it) | {
if (!_tcs34725Initialised)
{
ASSERT_STATUS(tcs34725Init());
}
ASSERT_STATUS(tcs34725Write8(TCS34725_ATIME, it));
_tcs34725IntegrationTime = it;
return ERROR_NONE;
} | microbuilder/LPC11U_LPC13U_CodeBase | C++ | Other | 54 |
/* Initialize SSE register context information.
This routine initializes the system's "live" SSE registers. */ | static void z_do_sse_regs_init(void) | /* Initialize SSE register context information.
This routine initializes the system's "live" SSE registers. */
static void z_do_sse_regs_init(void) | {
__asm__ volatile("ldmxcsr _sse_mxcsr_default_value\n\t");
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* find the 1st available bus number for PPB to set as its secondary bus Parameters: bus_number of the primary bus Returns: bus_number of the secondary bus or 0xff in case of failure */ | static u8 find_sec_number(u8 primary_busno, u8 slotno) | /* find the 1st available bus number for PPB to set as its secondary bus Parameters: bus_number of the primary bus Returns: bus_number of the secondary bus or 0xff in case of failure */
static u8 find_sec_number(u8 primary_busno, u8 slotno) | {
int min, max;
u8 busno;
struct bus_info *bus;
struct bus_node *bus_cur;
bus = ibmphp_find_same_bus_num (primary_busno);
if (!bus) {
err ("cannot get slot range of the bus from the BIOS\n");
return 0xff;
}
max = bus->slot_max;
min = bus->slot_min;
if ((slotno > max) || (slotno < min)) {
err ("got the w... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function does an erase of all user flash area. */ | int8_t FLASH_If_Erase(uint32_t StartSector) | /* This function does an erase of all user flash area. */
int8_t FLASH_If_Erase(uint32_t StartSector) | {
uint32_t FlashAddress;
FlashAddress = StartSector;
if (FlashAddress <= (uint32_t) USER_FLASH_LAST_PAGE_ADDRESS)
{
FLASH_EraseInitTypeDef FLASH_EraseInitStruct;
uint32_t sectornb = 0;
FLASH_EraseInitStruct.TypeErase = FLASH_TYPEERASE_SECTORS;
FLASH_EraseInitStruct.Sector = FLASH_SECTOR_5;
... | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Insert new name cache entry into all hash cache. */ | static int pohmelfs_insert_name(struct pohmelfs_inode *parent, struct pohmelfs_name *n) | /* Insert new name cache entry into all hash cache. */
static int pohmelfs_insert_name(struct pohmelfs_inode *parent, struct pohmelfs_name *n) | {
struct pohmelfs_name *name;
name = pohmelfs_insert_hash(parent, n);
if (name)
return -EEXIST;
parent->total_len += n->len;
list_add_tail(&n->sync_create_entry, &parent->sync_create_list);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Write a data to the slave when the bus is idle, and waiting for all bus transmiton complete.(Write Step1)
This function is always used in thread mode. */ | unsigned long I2CMasterWriteS1(unsigned long ulBase, unsigned char ucSlaveAddr, unsigned char ucData, xtBoolean bEndTransmition) | /* Write a data to the slave when the bus is idle, and waiting for all bus transmiton complete.(Write Step1)
This function is always used in thread mode. */
unsigned long I2CMasterWriteS1(unsigned long ulBase, unsigned char ucSlaveAddr, unsigned char ucData, xtBoolean bEndTransmition) | {
unsigned long ulStatus;
xASSERT((ulBase == I2C1_BASE) || (ulBase == I2C2_BASE));
xASSERT(!(ucSlaveAddr & 0x80));
I2CMasterWriteRequestS1(ulBase, ucSlaveAddr, ucData, xfalse);
do
{
ulStatus = I2CStatusGet(ulBase);
if(xHWREG(ulBase + I2C_SR1) & 0x0F00)
break;
}
... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* The function waits for the transmission to complete. */ | static bool gzp_tx_packet(const uint8_t *tx_packet, uint8_t length, uint8_t pipe) | /* The function waits for the transmission to complete. */
static bool gzp_tx_packet(const uint8_t *tx_packet, uint8_t length, uint8_t pipe) | {
tx_complete = false;
tx_success = false;
if(nrf_gzll_add_packet_to_tx_fifo(pipe,(uint8_t *)tx_packet, length))
{
while(tx_complete == false)
{
__WFI();
}
return tx_success;
}
else
{
return false;
}
} | labapart/polymcu | C++ | null | 201 |
/* If the journal has been aborted on this mount time -EROFS will be returned. */ | int journal_errno(journal_t *journal) | /* If the journal has been aborted on this mount time -EROFS will be returned. */
int journal_errno(journal_t *journal) | {
int err;
spin_lock(&journal->j_state_lock);
if (journal->j_flags & JFS_ABORT)
err = -EROFS;
else
err = journal->j_errno;
spin_unlock(&journal->j_state_lock);
return err;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enable a PCI driver to access PCI config space. */ | STATIC EFI_STATUS EFIAPI PciIoPciRead(IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT32 Offset, IN UINTN Count, IN OUT VOID *Buffer) | /* Enable a PCI driver to access PCI config space. */
STATIC EFI_STATUS EFIAPI PciIoPciRead(IN EFI_PCI_IO_PROTOCOL *This, IN EFI_PCI_IO_PROTOCOL_WIDTH Width, IN UINT32 Offset, IN UINTN Count, IN OUT VOID *Buffer) | {
NON_DISCOVERABLE_PCI_DEVICE *Dev;
VOID *Address;
UINTN Length;
if ((Width < 0) || (Width >= EfiPciIoWidthMaximum) || (Buffer == NULL)) {
return EFI_INVALID_PARAMETER;
}
Dev = NON_DISCOVERABLE_PCI_DEVICE_FROM_PCI_IO (This);
Address = (UINT8 *)&Dev->... | tianocore/edk2 | C++ | Other | 4,240 |
/* Perform the initial reset handling for the 3x2n series controllers. Reset the hardware and state machine, */ | static int hpt3x2n_pre_reset(struct ata_link *link, unsigned long deadline) | /* Perform the initial reset handling for the 3x2n series controllers. Reset the hardware and state machine, */
static int hpt3x2n_pre_reset(struct ata_link *link, unsigned long deadline) | {
struct ata_port *ap = link->ap;
struct pci_dev *pdev = to_pci_dev(ap->host->dev);
pci_write_config_byte(pdev, 0x50 + 4 * ap->port_no, 0x37);
udelay(100);
return ata_sff_prereset(link, deadline);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Associate a virtual page frame with a given physical page frame and protection flags for that frame. */ | void set_pte_mfn(unsigned long vaddr, unsigned long mfn, pgprot_t flags) | /* Associate a virtual page frame with a given physical page frame and protection flags for that frame. */
void set_pte_mfn(unsigned long vaddr, unsigned long mfn, pgprot_t flags) | {
set_pte_vaddr(vaddr, mfn_pte(mfn, flags));
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Enables or disables the continuous mode for injected channels for the specified SDADC. */ | void SDADC_InjectedContinuousModeCmd(SDADC_TypeDef *SDADCx, FunctionalState NewState) | /* Enables or disables the continuous mode for injected channels for the specified SDADC. */
void SDADC_InjectedContinuousModeCmd(SDADC_TypeDef *SDADCx, FunctionalState NewState) | {
assert_param(IS_SDADC_ALL_PERIPH(SDADCx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
SDADCx->CR2 |= (uint32_t)SDADC_CR2_JCONT;
}
else
{
SDADCx->CR2 &= (uint32_t)(~SDADC_CR2_JCONT);
}
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* Specifies the TIMx Counter Mode to be used. */ | void TIM_CounterModeConfig(TIM_TypeDef *TIMx, uint16_t TIM_CounterMode) | /* Specifies the TIMx Counter Mode to be used. */
void TIM_CounterModeConfig(TIM_TypeDef *TIMx, uint16_t TIM_CounterMode) | {
uint16_t tmpcr1 = 0;
assert_param(IS_TIM_LIST3_PERIPH(TIMx));
assert_param(IS_TIM_COUNTER_MODE(TIM_CounterMode));
tmpcr1 = TIMx->CR1;
tmpcr1 &= (uint16_t)(~((uint16_t)(TIM_CR1_DIR | TIM_CR1_CMS)));
tmpcr1 |= TIM_CounterMode;
TIMx->CR1 = tmpcr1;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Resets the count of the running Watchdog Timer that was previously enabled.
Resets the current count of the Watchdog Timer, restarting the timeout period count elapsed. This function should be called after the window period (if one was set in the module configuration) but before the timeout period to prevent a rese... | void wdt_reset_count(void) | /* Resets the count of the running Watchdog Timer that was previously enabled.
Resets the current count of the Watchdog Timer, restarting the timeout period count elapsed. This function should be called after the window period (if one was set in the module configuration) but before the timeout period to prevent a rese... | {
Wdt *const WDT_module = WDT;
WDT_module->CLEAR.reg = WDT_CLEAR_CLEAR_KEY;
while (wdt_is_syncing()) {
}
} | memfault/zero-to-main | C++ | null | 200 |
/* Put the spdif to soft-reset mode, and then can be configured. */ | static int32_t spdif_soft_reset(audio_ctrl_p ctrl) | /* Put the spdif to soft-reset mode, and then can be configured. */
static int32_t spdif_soft_reset(audio_ctrl_p ctrl) | {
uint32_t instance = ctrl->instance;
uint32_t val;
int cycle = 0;
UNUSED_VARIABLE(instance);
val = HW_SPDIF_SCR_RD();
val |= BM_SPDIF_SCR_SOFT_RESET;
HW_SPDIF_SCR_WR(val);
while ((HW_SPDIF_SCR_RD() & BM_SPDIF_SCR_SOFT_RESET) && (cycle++ < 100)) ;
return 0;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* UART MSP Initialization This function configures the hardware resources used in this example: */ | void HAL_UART_MspInit(UART_HandleTypeDef *huart) | /* UART MSP Initialization This function configures the hardware resources used in this example: */
void HAL_UART_MspInit(UART_HandleTypeDef *huart) | {
GPIO_InitTypeDef GPIO_InitStruct;
USARTx_TX_GPIO_CLK_ENABLE();
USARTx_RX_GPIO_CLK_ENABLE();
USARTx_CLK_ENABLE();
GPIO_InitStruct.Pin = USARTx_TX_PIN;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FAST;
GPIO_InitS... | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* simple conversion of two-digit string with error checking */ | static int cnvrt2(const char *str, int *valp) | /* simple conversion of two-digit string with error checking */
static int cnvrt2(const char *str, int *valp) | {
int val;
if ((*str < '0') || (*str > '9'))
return (-1);
val = *str - '0';
++str;
if ((*str < '0') || (*str > '9'))
return (-1);
*valp = 10 * val + (*str - '0');
return (0);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Writes user data to the specified data Backup Register. */ | void BKP_WriteBackupRegister(BKPDR_Typedef bkp_dr, u16 data) | /* Writes user data to the specified data Backup Register. */
void BKP_WriteBackupRegister(BKPDR_Typedef bkp_dr, u16 data) | {
*(vu16*)(BKP_BASE + bkp_dr) = data;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* e1000_set_mdio_slow_mode_hv - Set slow MDIO access mode @hw: pointer to the HW structure */ | static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw) | /* e1000_set_mdio_slow_mode_hv - Set slow MDIO access mode @hw: pointer to the HW structure */
static s32 e1000_set_mdio_slow_mode_hv(struct e1000_hw *hw) | {
s32 ret_val;
u16 data;
ret_val = e1e_rphy(hw, HV_KMRN_MODE_CTRL, &data);
if (ret_val)
return ret_val;
data |= HV_KMRN_MDIO_SLOW;
ret_val = e1e_wphy(hw, HV_KMRN_MODE_CTRL, data);
return ret_val;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* XPC calls this when it (the XPC module) is being unloaded. */ | void xpc_clear_interface(void) | /* XPC calls this when it (the XPC module) is being unloaded. */
void xpc_clear_interface(void) | {
xpc_interface.connect = (void (*)(int))xpc_notloaded;
xpc_interface.disconnect = (void (*)(int))xpc_notloaded;
xpc_interface.send = (enum xp_retval(*)(short, int, u32, void *, u16))
xpc_notloaded;
xpc_interface.send_notify = (enum xp_retval(*)(short, int, u32, void *,
u16, xpc_notify_func,
... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function also performs validation of the ACPI table fields. */ | VOID EFIAPI ParseAcpiFacs(IN BOOLEAN Trace, IN UINT8 *Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision) | /* This function also performs validation of the ACPI table fields. */
VOID EFIAPI ParseAcpiFacs(IN BOOLEAN Trace, IN UINT8 *Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision) | {
if (!Trace) {
return;
}
ParseAcpi (
Trace,
0,
"FACS",
Ptr,
AcpiTableLength,
PARSER_PARAMS (FacsParser)
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This is the NotifyFunction passed to CreateEvent in the FastbootAppEntryPoint It will be called by the UEFI event framework when the transport protocol implementation signals that data has been received from the Fastboot host. The parameters are ignored. */ | STATIC VOID DataReady(IN EFI_EVENT Event, IN VOID *Context) | /* This is the NotifyFunction passed to CreateEvent in the FastbootAppEntryPoint It will be called by the UEFI event framework when the transport protocol implementation signals that data has been received from the Fastboot host. The parameters are ignored. */
STATIC VOID DataReady(IN EFI_EVENT Event, IN VOID *Context... | {
UINTN Size;
VOID *Data;
EFI_STATUS Status;
do {
Status = mTransport->Receive (&Size, &Data);
if (!EFI_ERROR (Status)) {
if (mState == ExpectCmdState) {
AcceptCmd (Size, (CHAR8 *)Data);
} else if (mState == ExpectDataState) {
AcceptData (Size, Data);
} el... | tianocore/edk2 | C++ | Other | 4,240 |
/* IRQ Handler for GPIO port 0 (currently checks pin 0.1)
IRQ Handler for GPIO port 2 (currently checks pin 2.1) */ | void gpioInit(void) | /* IRQ Handler for GPIO port 0 (currently checks pin 0.1)
IRQ Handler for GPIO port 2 (currently checks pin 2.1) */
void gpioInit(void) | {
SCB_SYSAHBCLKCTRL |= (SCB_SYSAHBCLKCTRL_GPIO);
NVIC_EnableIRQ(EINT0_IRQn);
NVIC_EnableIRQ(EINT1_IRQn);
NVIC_EnableIRQ(EINT2_IRQn);
NVIC_EnableIRQ(EINT3_IRQn);
_gpioInitialised = true;
return;
} | microbuilder/LPC1343CodeBase | C++ | Other | 73 |
/* Helper dissector for ZCL Read Report Configuration command. */ | static void dissect_zcl_read_report_config(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint *offset, guint16 cluster_id) | /* Helper dissector for ZCL Read Report Configuration command. */
static void dissect_zcl_read_report_config(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, guint *offset, guint16 cluster_id) | {
proto_tree *sub_tree;
guint tvb_len;
guint i = 0;
tvb_len = tvb_captured_length(tvb);
while ( *offset < tvb_len && i < ZBEE_ZCL_NUM_ATTR_ETT ) {
sub_tree = proto_tree_add_subtree(tree, tvb, *offset, 3, ett_zbee_zcl_attr[i], NULL, "Attribute Status Record");
i++;
dissect_zcl... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Set a bit in a control register of all cpus */ | void smp_ctl_set_bit(int cr, int bit) | /* Set a bit in a control register of all cpus */
void smp_ctl_set_bit(int cr, int bit) | {
struct ec_creg_mask_parms parms;
memset(&parms.orvals, 0, sizeof(parms.orvals));
memset(&parms.andvals, 0xff, sizeof(parms.andvals));
parms.orvals[cr] = 1 << bit;
on_each_cpu(smp_ctl_bit_callback, &parms, 1);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Initializes MCU, drivers and middleware in the project */ | void atmel_start_init(void) | /* Initializes MCU, drivers and middleware in the project */
void atmel_start_init(void) | {
system_init();
ethernet_phys_init();
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The return value is masked so as to only return the value of DCR_STROBE, DCR_AUTOFD, DCR_nINIT, and DCR_SELECT. */ | static unsigned char parport_ip32_read_control(struct parport *p) | /* The return value is masked so as to only return the value of DCR_STROBE, DCR_AUTOFD, DCR_nINIT, and DCR_SELECT. */
static unsigned char parport_ip32_read_control(struct parport *p) | {
const unsigned int rm =
DCR_STROBE | DCR_AUTOFD | DCR_nINIT | DCR_SELECT;
return __parport_ip32_read_control(p) & rm;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* @handle: handle of the loaded image @systable: system table */ | static int setup(const efi_handle_t img_handle, const struct efi_system_table *systable) | /* @handle: handle of the loaded image @systable: system table */
static int setup(const efi_handle_t img_handle, const struct efi_system_table *systable) | {
efi_status_t ret;
boottime = systable->boottime;
ret = boottime->create_event(EVT_NOTIFY_SIGNAL,
TPL_CALLBACK, notify, &context,
&event);
if (ret != EFI_SUCCESS) {
efi_st_error("could not create event\n");
return EFI_ST_FAILURE;
}
ret = boottime->register_protocol_notify(&guid1, event,
... | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* We need this only for ATAPI bmdma transactions, as otherwise we experience spurious interrupts after libata-sff handles the bmdma interrupts. */ | static void mv_sff_irq_clear(struct ata_port *ap) | /* We need this only for ATAPI bmdma transactions, as otherwise we experience spurious interrupts after libata-sff handles the bmdma interrupts. */
static void mv_sff_irq_clear(struct ata_port *ap) | {
mv_clear_and_enable_port_irqs(ap, mv_ap_base(ap), ERR_IRQ);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If 32-bit I/O port operations are not supported, then ASSERT(). */ | VOID EFIAPI IoWriteFifo32(IN UINTN Port, IN UINTN Count, IN VOID *Buffer) | /* If 32-bit I/O port operations are not supported, then ASSERT(). */
VOID EFIAPI IoWriteFifo32(IN UINTN Port, IN UINTN Count, IN VOID *Buffer) | {
UINT32 *Buffer32;
ASSERT ((Port & 3) == 0);
Buffer32 = (UINT32 *)Buffer;
while (Count-- > 0) {
IoWrite32 (Port, *Buffer32++);
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* So what we do is to mark the page "pending dirty" and next time writepage is called, propagate that into the buffers appropriately. */ | static int ext3_journalled_set_page_dirty(struct page *page) | /* So what we do is to mark the page "pending dirty" and next time writepage is called, propagate that into the buffers appropriately. */
static int ext3_journalled_set_page_dirty(struct page *page) | {
SetPageChecked(page);
return __set_page_dirty_nobuffers(page);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* @abstract Set the current vectory object index to operate on. */ | BOOL ElmSetCurrentVector(int32_t id) | /* @abstract Set the current vectory object index to operate on. */
BOOL ElmSetCurrentVector(int32_t id) | {
elm_tls_t* elm_tls;
elm_tls = (elm_tls_t *) elm_os_get_tls();
if (elm_tls == NULL)
return FALSE;
elm_tls->gContext.vector_id = id;
return TRUE;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Helper function for rcu_qsctr_inc() and rcu_bh_qsctr_inc(). Also disable irqs to avoid confusion due to interrupt handlers invoking call_rcu(). */ | static int rcu_qsctr_help(struct rcu_ctrlblk *rcp) | /* Helper function for rcu_qsctr_inc() and rcu_bh_qsctr_inc(). Also disable irqs to avoid confusion due to interrupt handlers invoking call_rcu(). */
static int rcu_qsctr_help(struct rcu_ctrlblk *rcp) | {
unsigned long flags;
local_irq_save(flags);
if (rcp->rcucblist != NULL &&
rcp->donetail != rcp->curtail) {
rcp->donetail = rcp->curtail;
local_irq_restore(flags);
return 1;
}
local_irq_restore(flags);
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Fills in smi_info.device_id.oem_data_available_handler when we know what function to use there. */ | static void setup_oem_data_handler(struct smi_info *smi_info) | /* Fills in smi_info.device_id.oem_data_available_handler when we know what function to use there. */
static void setup_oem_data_handler(struct smi_info *smi_info) | {
setup_dell_poweredge_oem_data_handler(smi_info);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This service allocates memory from the Hand-Off Block (HOB) heap. */ | EFI_STATUS EFIAPI PeiServicesAllocatePool(IN UINTN Size, OUT VOID **Buffer) | /* This service allocates memory from the Hand-Off Block (HOB) heap. */
EFI_STATUS EFIAPI PeiServicesAllocatePool(IN UINTN Size, OUT VOID **Buffer) | {
CONST EFI_PEI_SERVICES **PeiServices;
PeiServices = GetPeiServicesTablePointer ();
return (*PeiServices)->AllocatePool (PeiServices, Size, Buffer);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Delete a directory entry. Hide the details of directory implementation from the caller. */ | int ocfs2_delete_entry(handle_t *handle, struct inode *dir, struct ocfs2_dir_lookup_result *res) | /* Delete a directory entry. Hide the details of directory implementation from the caller. */
int ocfs2_delete_entry(handle_t *handle, struct inode *dir, struct ocfs2_dir_lookup_result *res) | {
if (ocfs2_dir_indexed(dir))
return ocfs2_delete_entry_dx(handle, dir, res);
if (OCFS2_I(dir)->ip_dyn_features & OCFS2_INLINE_DATA_FL)
return ocfs2_delete_entry_id(handle, dir, res->dl_entry,
res->dl_leaf_bh);
return ocfs2_delete_entry_el(handle, dir, res->dl_entry,
res->dl_leaf_bh);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enable any unicast packet filtered by the MAC address recognition to be a wake-up frame. */ | void ETH_EnableGlobalUnicastWakeUp(void) | /* Enable any unicast packet filtered by the MAC address recognition to be a wake-up frame. */
void ETH_EnableGlobalUnicastWakeUp(void) | {
ETH->PMTCTRLSTS_B.GUN = SET;
ETH_Delay(ETH_REG_WRITE_DELAY);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* DumpIntTT is MBE and embeds a type encoding for string length and integers. It also handles negative integers by forcing the type to LUAU_TNUMNINT. 0TTTNNNN or 1TTTNNNN (1NNNNNNN)* 0NNNNNNN */ | static void DumpIntTT(lu_byte tt, lua_Integer y, DumpState *D) | /* DumpIntTT is MBE and embeds a type encoding for string length and integers. It also handles negative integers by forcing the type to LUAU_TNUMNINT. 0TTTNNNN or 1TTTNNNN (1NNNNNNN)* 0NNNNNNN */
static void DumpIntTT(lu_byte tt, lua_Integer y, DumpState *D) | { *b-- = 0x80 + (x & 0x7f); x >>= 7; }
b++;
if (*b & cast(lu_byte, LUAU_TMASK) )
*--b = 0x80;
*b |= (y >= 0) ? tt: LUAU_TNUMNINT;
lua_assert (b >= buf);
DumpVector(b, (buf - b) + sizeof(buf), D);
} | nodemcu/nodemcu-firmware | C++ | MIT License | 7,566 |
/* This function should be called before entering STOP/VLPS/LLS/VLLS modes. */ | void SMC_PreEnterStopModes(void) | /* This function should be called before entering STOP/VLPS/LLS/VLLS modes. */
void SMC_PreEnterStopModes(void) | {
g_savedPrimask = DisableGlobalIRQ();
__ISB();
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Pass in a pointer to an ARM MOVT or MOVW immediate instruciton and return the immediate data encoded in the instruction. */ | UINT16 ThumbMovtImmediateAddress(IN UINT16 *Instruction) | /* Pass in a pointer to an ARM MOVT or MOVW immediate instruciton and return the immediate data encoded in the instruction. */
UINT16 ThumbMovtImmediateAddress(IN UINT16 *Instruction) | {
UINT32 Movt;
UINT16 Address;
Movt = (*Instruction << 16) | (*(Instruction + 1));
Address = (UINT16)(Movt & 0x000000ff);
Address |= (UINT16)((Movt >> 4) & 0x0000f700);
Address |= (((Movt & BIT26) != 0) ? BIT11 : 0);
return Address;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* The libata core provides separate functions for handling PIO and DMA programming. The architecture of the Firestar makes it easier for us to have a common function so we provide wrappers */ | static void optiplus_set_pio_mode(struct ata_port *ap, struct ata_device *adev) | /* The libata core provides separate functions for handling PIO and DMA programming. The architecture of the Firestar makes it easier for us to have a common function so we provide wrappers */
static void optiplus_set_pio_mode(struct ata_port *ap, struct ata_device *adev) | {
optiplus_mode_setup(ap, adev, adev->pio_mode);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Build a netlink message to change attributes of a existing qdisc */ | int rtnl_qdisc_build_change_request(struct rtnl_qdisc *qdisc, struct rtnl_qdisc *new, struct nl_msg **result) | /* Build a netlink message to change attributes of a existing qdisc */
int rtnl_qdisc_build_change_request(struct rtnl_qdisc *qdisc, struct rtnl_qdisc *new, struct nl_msg **result) | {
return qdisc_build(qdisc, RTM_NEWQDISC, NLM_F_REPLACE, result);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This function is a re-implementation of the Altera provided function. The function is re-implemented to prevent it from enabling an interrupt when it is registered. Interrupts should only be enabled after the FreeRTOS.org kernel has its scheduler started so that contexts are saved and switched correctly. */ | int alt_irq_register(alt_u32 id, void *context, void(*handler)(void *, alt_u32)) | /* This function is a re-implementation of the Altera provided function. The function is re-implemented to prevent it from enabling an interrupt when it is registered. Interrupts should only be enabled after the FreeRTOS.org kernel has its scheduler started so that contexts are saved and switched correctly. */
int alt... | {
int rc = -EINVAL;
alt_irq_context status;
if (id < ALT_NIRQ)
{
status = alt_irq_disable_all ();
alt_irq[id].handler = handler;
alt_irq[id].context = context;
rc = (handler) ? alt_irq_enable (id): alt_irq_disable (id);
}
return rc;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* If the string doesn't end with a newline, append one. Then word-wrap it to 80 columns. */ | static void end_string(GString *str) | /* If the string doesn't end with a newline, append one. Then word-wrap it to 80 columns. */
static void end_string(GString *str) | {
size_t point;
char *p, *q;
point = str->len;
if (point == 0 || str->str[point - 1] != '\n')
g_string_append(str, "\n");
p = str->str;
while (*p != '\0') {
q = strchr(p, '\n');
if (q - p > 80) {
q = p + 80;
while (q > p && *q != ' ')
q--;
if (q != p)
*q = '\n';
}
p = q + 1;
}
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This function create a dump memory mailbox command to dump wake up parameters. */ | void lpfc_dump_wakeup_param(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | /* This function create a dump memory mailbox command to dump wake up parameters. */
void lpfc_dump_wakeup_param(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) | {
MAILBOX_t *mb;
void *ctx;
mb = &pmb->u.mb;
ctx = pmb->context2;
memset(pmb, 0, sizeof(LPFC_MBOXQ_t));
mb->mbxCommand = MBX_DUMP_MEMORY;
mb->mbxOwner = OWN_HOST;
mb->un.varDmp.cv = 1;
mb->un.varDmp.type = DMP_NV_PARAMS;
mb->un.varDmp.entry_index = 0;
mb->un.varDmp.region_id = WAKE_UP_PARMS_REGION_ID;
mb->u... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set the bits given by 'bitval' in PHY register 'reg'. */ | static void mdio_set_bit(struct cphy *cphy, int reg, u32 bitval) | /* Set the bits given by 'bitval' in PHY register 'reg'. */
static void mdio_set_bit(struct cphy *cphy, int reg, u32 bitval) | {
u32 val;
(void) simple_mdio_read(cphy, reg, &val);
(void) simple_mdio_write(cphy, reg, val | bitval);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* A wrapper for platform code responsible for controlling low-level USB code */ | static void s3c_hsotg_phy_enable(struct s3c_hsotg *hsotg) | /* A wrapper for platform code responsible for controlling low-level USB code */
static void s3c_hsotg_phy_enable(struct s3c_hsotg *hsotg) | {
struct platform_device *pdev = to_platform_device(hsotg->dev);
dev_dbg(hsotg->dev, "pdev 0x%p\n", pdev);
if (hsotg->uphy)
usb_phy_init(hsotg->uphy);
else if (hsotg->plat->phy_init)
hsotg->plat->phy_init(pdev, hsotg->plat->phy_type);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Stop photo of the PTC08 device.
Send stop photo Command to PTC08 device,It used to clear buffer */ | xtBoolean PTC08PhotoStop(void) | /* Stop photo of the PTC08 device.
Send stop photo Command to PTC08 device,It used to clear buffer */
xtBoolean PTC08PhotoStop(void) | {
unsigned long i;
unsigned char ucTmp[5];
UARTBufferPut(PTC08_UART, (unsigned char *)&ucStopPhotoCmd[0], 5);
if (!UARTBufferGet(PTC08_UART, ucTmp, 5))
{
return xfalse;
}
for (i = 0; i < 5; i++)
{
if (ucTmp[i] != ucStopPhotoRcv[i])
{
return xfalse;
... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Add provided partition to the partition list of a given device. */ | static int part_add(struct mtd_device *dev, struct part_info *part) | /* Add provided partition to the partition list of a given device. */
static int part_add(struct mtd_device *dev, struct part_info *part) | {
if (part_validate(dev->id, part) != 0)
return 1;
if (part_sort_add(dev, part) != 0)
return 1;
return 0;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* param base LPUART peripheral base address. param handle LPUART handle pointer. param count Send bytes count. retval kStatus_NoTransferInProgress No send in progress. retval kStatus_InvalidArgument Parameter is invalid. retval kStatus_Success Get successfully through the parameter */ | status_t LPUART_TransferGetSendCountEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle, uint32_t *count) | /* param base LPUART peripheral base address. param handle LPUART handle pointer. param count Send bytes count. retval kStatus_NoTransferInProgress No send in progress. retval kStatus_InvalidArgument Parameter is invalid. retval kStatus_Success Get successfully through the parameter */
status_t LPUART_TransferGetSendC... | {
assert(NULL != handle);
assert(NULL != handle->txEdmaHandle);
assert(NULL != count);
if ((uint8_t)kLPUART_TxIdle == handle->txState)
{
return kStatus_NoTransferInProgress;
}
*count = handle->txDataSizeAll -
((uint32_t)handle->nbytes *
EDMA_GetRemainingMaj... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* param base Pointer to the FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. */ | void FLEXIO_UART_TransferAbortReceive(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle) | /* param base Pointer to the FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. */
void FLEXIO_UART_TransferAbortReceive(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle) | {
if (NULL == handle->rxRingBuffer)
{
FLEXIO_UART_DisableInterrupts(base, (uint32_t)kFLEXIO_UART_RxDataRegFullInterruptEnable);
}
handle->rxDataSize = 0U;
handle->rxState = (uint8_t)kFLEXIO_UART_RxIdle;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* USBH_LL_Init Initialize the Low Level portion of the Host driver. */ | USBH_StatusTypeDef USBH_LL_Init(USBH_HandleTypeDef *phost) | /* USBH_LL_Init Initialize the Low Level portion of the Host driver. */
USBH_StatusTypeDef USBH_LL_Init(USBH_HandleTypeDef *phost) | {
hhcd.Instance = USB_OTG_FS;
hhcd.Init.Host_channels = 11;
hhcd.Init.dma_enable = 0;
hhcd.Init.low_power_enable = 0;
hhcd.Init.phy_itface = HCD_PHY_EMBEDDED;
hhcd.Init.Sof_enable = 0;
hhcd.Init.speed = HCD_SPEED_FULL;
hhcd.Init.vbus_sensing_enable = 0;
hhcd.Init.lpm_enable = 0;
hhcd.pData = phost... | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* This function returns the pointer to first HOB in the list. */ | VOID* EFIAPI PrePeiGetHobList(VOID) | /* This function returns the pointer to first HOB in the list. */
VOID* EFIAPI PrePeiGetHobList(VOID) | {
TDX_WORK_AREA *TdxWorkArea;
TdxWorkArea = (TDX_WORK_AREA *)(UINTN)FixedPcdGet32 (PcdOvmfWorkAreaBase);
ASSERT (TdxWorkArea != NULL);
ASSERT (TdxWorkArea->SecTdxWorkArea.HobList != 0);
return (VOID *)(UINTN)TdxWorkArea->SecTdxWorkArea.HobList;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Set the HFRCO startup delay.
Please refer to the reference manual for further details. */ | void CMU_HFRCOStartupDelaySet(uint32_t delay) | /* Set the HFRCO startup delay.
Please refer to the reference manual for further details. */
void CMU_HFRCOStartupDelaySet(uint32_t delay) | {
EFM_ASSERT(delay <= 31);
delay &= (_CMU_HFRCOCTRL_SUDELAY_MASK >> _CMU_HFRCOCTRL_SUDELAY_SHIFT);
CMU->HFRCOCTRL = (CMU->HFRCOCTRL & ~(_CMU_HFRCOCTRL_SUDELAY_MASK)) |
(delay << _CMU_HFRCOCTRL_SUDELAY_SHIFT);
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Unregisters an interrupt handler for the uDMA controller. */ | void uDMAIntUnregister(unsigned long ulIntChannel) | /* Unregisters an interrupt handler for the uDMA controller. */
void uDMAIntUnregister(unsigned long ulIntChannel) | {
IntDisable(ulIntChannel);
IntUnregister(ulIntChannel);
} | watterott/WebRadio | C++ | null | 71 |
/* Return buffer_head of bitmap on success or NULL. */ | static struct buffer_head* read_inode_bitmap(struct super_block *sb, unsigned long block_group) | /* Return buffer_head of bitmap on success or NULL. */
static struct buffer_head* read_inode_bitmap(struct super_block *sb, unsigned long block_group) | {
struct ext3_group_desc *desc;
struct buffer_head *bh = NULL;
desc = ext3_get_group_desc(sb, block_group, NULL);
if (!desc)
goto error_out;
bh = sb_bread(sb, le32_to_cpu(desc->bg_inode_bitmap));
if (!bh)
ext3_error(sb, "read_inode_bitmap",
"Cannot read inode bitmap - "
"block_group = %lu, inode... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Readiness of the guest to accept data on a port. Returns max. data the guest can receive */ | size_t virtio_serial_guest_ready(VirtIOSerialPort *port) | /* Readiness of the guest to accept data on a port. Returns max. data the guest can receive */
size_t virtio_serial_guest_ready(VirtIOSerialPort *port) | {
VirtIODevice *vdev = VIRTIO_DEVICE(port->vser);
VirtQueue *vq = port->ivq;
unsigned int bytes;
if (!virtio_queue_ready(vq) ||
!(vdev->status & VIRTIO_CONFIG_S_DRIVER_OK) ||
virtio_queue_empty(vq)) {
return 0;
}
if (use_multiport(port->vser) && !port->guest_connected) {
... | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* Before you start, select your target, on the right of the "Load" button */ | void GoToSleepMode(void) | /* Before you start, select your target, on the right of the "Load" button */
void GoToSleepMode(void) | {
LastTime = TM_DELAY_Time();
printf("W: %u; S: %u; L: %5.2f %%\n", WorkingTime, SleepingTime, ((float)WorkingTime / (float)(SleepingTime + WorkingTime) * 100));
SleepingTime = 0;
WorkingTime = 0;
}
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* For RF5111 we have an XPD -eXternal Power Detector- curve for each calibrated channel. Each curve has 0,5dB Power steps on x axis and PCDAC steps (offsets) on y axis and looks like an exponential function. To recreate the curve we read 11 points here and interpolate later. */ | static void ath5k_get_pcdac_intercepts(struct ath5k_hw *ah, u8 min, u8 max, u8 *vp) | /* For RF5111 we have an XPD -eXternal Power Detector- curve for each calibrated channel. Each curve has 0,5dB Power steps on x axis and PCDAC steps (offsets) on y axis and looks like an exponential function. To recreate the curve we read 11 points here and interpolate later. */
static void ath5k_get_pcdac_intercepts(... | {
static const u16 intercepts3[] =
{ 0, 5, 10, 20, 30, 50, 70, 85, 90, 95, 100 };
static const u16 intercepts3_2[] =
{ 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 };
const u16 *ip;
int i;
if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_3_2)
ip = intercepts3_2;
else
ip = intercepts3;
for (i = 0; i < ARRAY_SIZ... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set Baud Rate of FlexCAN.
This function set the baud rate of FlexCAN. */ | static void FLEXCAN_SetBaudRate(CAN_Type *base, uint32_t sourceClock_Hz, uint32_t baudRate_Bps, flexcan_timing_config_t timingConfig) | /* Set Baud Rate of FlexCAN.
This function set the baud rate of FlexCAN. */
static void FLEXCAN_SetBaudRate(CAN_Type *base, uint32_t sourceClock_Hz, uint32_t baudRate_Bps, flexcan_timing_config_t timingConfig) | {
uint32_t quantum = (1U + ((uint32_t)timingConfig.phaseSeg1 + 1U) + ((uint32_t)timingConfig.phaseSeg2 + 1U) +
((uint32_t)timingConfig.propSeg + 1U));
uint32_t priDiv = baudRate_Bps * quantum;
assert(baudRate_Bps <= 1000000U);
assert(priDiv <= sourceClock_Hz);
if (0U == priD... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Manages the sleep mode following the UHP state. */ | static void uhd_sleep_mode(enum uhd_uhp_state_enum new_state) | /* Manages the sleep mode following the UHP state. */
static void uhd_sleep_mode(enum uhd_uhp_state_enum new_state) | {
enum sleepmgr_mode sleep_mode[] = {
SLEEPMGR_ACTIVE,
SLEEPMGR_ACTIVE,
SLEEPMGR_ACTIVE,
SLEEPMGR_ACTIVE,
SLEEPMGR_ACTIVE,
SLEEPMGR_ACTIVE,
};
static enum uhd_uhp_state_enum uhd_state = UHD_STATE_OFF;
if (uhd_state == new_state) {
return;
}
if (new_state != UHD_STATE_OFF) {
sleepmgr_lock_mode(slee... | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Sets the designated bits in a 16/32-bit data word at the remote CPU system address */ | uint16_t IPCLiteLtoRSetBits(uint32_t ulFlag, uint32_t ulAddress, uint32_t ulMask, uint16_t usLength, uint32_t ulStatusFlag) | /* Sets the designated bits in a 16/32-bit data word at the remote CPU system address */
uint16_t IPCLiteLtoRSetBits(uint32_t ulFlag, uint32_t ulAddress, uint32_t ulMask, uint16_t usLength, uint32_t ulStatusFlag) | {
uint16_t returnStatus;
if (IpcRegs.IPCFLG.all & (ulFlag | ulStatusFlag))
{
returnStatus = STATUS_FAIL;
}
else
{
if (usLength == IPC_LENGTH_16_BITS)
{
IpcRegs.IPCSENDCOM = IPC_SET_BITS_16;
IpcRegs.IPCSENDADDR = ulAddress;
IpcRegs.IPCSE... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* If Eax is not NULL, then the value of EAX after CPUID is returned in Eax. If Ebx is not NULL, then the value of EBX after CPUID is returned in Ebx. If Ecx is not NULL, then the value of ECX after CPUID is returned in Ecx. If Edx is not NULL, then the value of EDX after CPUID is returned in Edx. */ | UINT32 EFIAPI AsmCpuidEx(IN UINT32 Index, IN UINT32 SubIndex, OUT UINT32 *RegisterEax OPTIONAL, OUT UINT32 *RegisterEbx OPTIONAL, OUT UINT32 *RegisterEcx OPTIONAL, OUT UINT32 *RegisterEdx OPTIONAL) | /* If Eax is not NULL, then the value of EAX after CPUID is returned in Eax. If Ebx is not NULL, then the value of EBX after CPUID is returned in Ebx. If Ecx is not NULL, then the value of ECX after CPUID is returned in Ecx. If Edx is not NULL, then the value of EDX after CPUID is returned in Edx. */
UINT32 EFIAPI AsmC... | {
_asm {
mov eax, Index
mov ecx, SubIndex
cpuid
push ecx
mov ecx, RegisterEax
jecxz SkipEax
mov [ecx], eax
SkipEax:
mov ecx, RegisterEbx
jecxz SkipEbx
mov [ecx], ebx
SkipEbx:
pop eax
mov ecx, RegisterEcx
jecxz SkipEcx
mov... | tianocore/edk2 | C++ | Other | 4,240 |
/* This is called by do_exit or de_thread, only when there are no more references to the shared signal_struct. */ | void exit_itimers(struct signal_struct *sig) | /* This is called by do_exit or de_thread, only when there are no more references to the shared signal_struct. */
void exit_itimers(struct signal_struct *sig) | {
struct k_itimer *tmr;
while (!list_empty(&sig->posix_timers)) {
tmr = list_entry(sig->posix_timers.next, struct k_itimer, list);
itimer_delete(tmr);
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* While we find nice hex chars, build a long_val. Return number of chars processed. */ | int kgdb_hex2long(char **ptr, unsigned long *long_val) | /* While we find nice hex chars, build a long_val. Return number of chars processed. */
int kgdb_hex2long(char **ptr, unsigned long *long_val) | {
int hex_val;
int num = 0;
int negate = 0;
*long_val = 0;
if (**ptr == '-') {
negate = 1;
(*ptr)++;
}
while (**ptr) {
hex_val = hex(**ptr);
if (hex_val < 0)
break;
*long_val = (*long_val << 4) | hex_val;
num++;
(*ptr)++;
}
if (negate)
*long_val = -*long_val;
return num;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* periodic_next_shadow - return "next" pointer on shadow list @periodic: host pointer to qh/itd/sitd @tag: hardware tag for type of this record */ | static union ehci_shadow* periodic_next_shadow(struct ehci_hcd *ehci, union ehci_shadow *periodic, __hc32 tag) | /* periodic_next_shadow - return "next" pointer on shadow list @periodic: host pointer to qh/itd/sitd @tag: hardware tag for type of this record */
static union ehci_shadow* periodic_next_shadow(struct ehci_hcd *ehci, union ehci_shadow *periodic, __hc32 tag) | {
switch (hc32_to_cpu(ehci, tag)) {
case Q_TYPE_QH:
return &periodic->qh->qh_next;
case Q_TYPE_FSTN:
return &periodic->fstn->fstn_next;
case Q_TYPE_ITD:
return &periodic->itd->itd_next;
default:
return &periodic->sitd->sitd_next;
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ` */ | char* strichr(char *p, int c) | /* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ` */
char* strichr(char *p, int c) | {
char *t;
if (p != NULL) {
for(t = p; *t; t++);
for (; t >= p; t--) {
*(t + 1) = *t;
}
*p = c;
}
return (p);
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* Release the device and return 0 if there is one. */ | static int __devexit pmcmsptwi_remove(struct platform_device *pldev) | /* Release the device and return 0 if there is one. */
static int __devexit pmcmsptwi_remove(struct platform_device *pldev) | {
struct resource *res;
i2c_del_adapter(&pmcmsptwi_adapter);
platform_set_drvdata(pldev, NULL);
if (pmcmsptwi_data.irq) {
pmcmsptwi_writel(0,
pmcmsptwi_data.iobase + MSP_TWI_INT_MSK_REG_OFFSET);
free_irq(pmcmsptwi_data.irq, &pmcmsptwi_data);
}
iounmap(pmcmsptwi_data.iobase);
res = platform_get_resource(pl... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* just like aio_run_iocbs, but keeps running them until the list stays empty */ | static void aio_run_all_iocbs(struct kioctx *ctx) | /* just like aio_run_iocbs, but keeps running them until the list stays empty */
static void aio_run_all_iocbs(struct kioctx *ctx) | {
spin_lock_irq(&ctx->ctx_lock);
while (__aio_run_iocbs(ctx))
;
spin_unlock_irq(&ctx->ctx_lock);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This API converts the range value into corresponding integer value. */ | static void map_range(uint8_t range_in, uint8_t *range_out) | /* This API converts the range value into corresponding integer value. */
static void map_range(uint8_t range_in, uint8_t *range_out) | {
switch (range_in) {
case BMA4_ACCEL_RANGE_2G:
*range_out = 2;
break;
case BMA4_ACCEL_RANGE_4G:
*range_out = 4;
break;
case BMA4_ACCEL_RANGE_8G:
*range_out = 8;
break;
case BMA4_ACCEL_RANGE_16G:
*range_out = 16;
break;
default:... | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* Clock the UART module from the system clock. */ | void uart_clock_from_sysclk(uint32_t uart) | /* Clock the UART module from the system clock. */
void uart_clock_from_sysclk(uint32_t uart) | {
UART_CC(uart) = UART_CC_CS_SYSCLK;
}
/**@} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Routine to get the next Handle, when you are searching for a given protocol. */ | IHANDLE* MmGetNextLocateByProtocol(IN OUT LOCATE_POSITION *Position, OUT VOID **Interface) | /* Routine to get the next Handle, when you are searching for a given protocol. */
IHANDLE* MmGetNextLocateByProtocol(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 |
/* Create a PCI_CAP_DEV object from an EFI_PCI_IO_PROTOCOL instance. The config space accessors are based upon EFI_PCI_IO_PROTOCOL.Pci.Read() and EFI_PCI_IO_PROTOCOL.Pci.Write(). */ | EFI_STATUS EFIAPI PciCapPciIoDeviceInit(IN EFI_PCI_IO_PROTOCOL *PciIo, OUT PCI_CAP_DEV **PciDevice) | /* Create a PCI_CAP_DEV object from an EFI_PCI_IO_PROTOCOL instance. The config space accessors are based upon EFI_PCI_IO_PROTOCOL.Pci.Read() and EFI_PCI_IO_PROTOCOL.Pci.Write(). */
EFI_STATUS EFIAPI PciCapPciIoDeviceInit(IN EFI_PCI_IO_PROTOCOL *PciIo, OUT PCI_CAP_DEV **PciDevice) | {
PROTO_DEV *ProtoDev;
ProtoDev = AllocatePool (sizeof *ProtoDev);
if (ProtoDev == NULL) {
return EFI_OUT_OF_RESOURCES;
}
ProtoDev->Signature = PROTO_DEV_SIG;
ProtoDev->PciIo = PciIo;
ProtoDev->BaseDevice.ReadConfig = ProtoDevReadConfig;
ProtoDev->BaseDevice.WriteConf... | tianocore/edk2 | C++ | Other | 4,240 |
/* note Don't use this function with DMA APIs. */ | void FLEXIO_MCULCD_ClearStatusFlags(FLEXIO_MCULCD_Type *base, uint32_t mask) | /* note Don't use this function with DMA APIs. */
void FLEXIO_MCULCD_ClearStatusFlags(FLEXIO_MCULCD_Type *base, uint32_t mask) | {
uint32_t flags = 0U;
if (mask & kFLEXIO_MCULCD_RxFullFlag)
{
flags |= (1U << base->rxShifterEndIndex);
}
if (mask & kFLEXIO_MCULCD_TxEmptyFlag)
{
flags |= (1U << base->txShifterStartIndex);
}
FLEXIO_ClearShifterStatusFlags(base->flexioBase, flags);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Checks whether the specified interrupt has occurred or not. */ | uint8_t I2C_ReadIntFlag(I2C_T *i2c, I2C_INT_FLAG_T flag) | /* Checks whether the specified interrupt has occurred or not. */
uint8_t I2C_ReadIntFlag(I2C_T *i2c, I2C_INT_FLAG_T flag) | {
uint32_t temp = 0;
uint32_t enable = 0;
if (flag & ((uint32_t)0x000000C0))
{
enable = (uint32_t)((BIT6) & (i2c->CTRL1));
}
else if (flag & ((uint32_t)0x00003F00))
{
enable = (uint32_t)((BIT7) & (i2c->CTRL1));
}
else
{
enable = (uint32_t)((flag) & (i2c->C... | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Unaligned writes are ignored, causing the 8-bit probe to fail and proceed to the 16-bit probe (which succeeds). */ | static void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long adr) | /* Unaligned writes are ignored, causing the 8-bit probe to fail and proceed to the 16-bit probe (which succeeds). */
static void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long adr) | {
if (!(adr & 1))
flash_write16(d.x[0], map->virt + adr);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* We can't address 8 and 16 bit words directly. Instead we have to read/write a 32bit word and mask/modify the data we actually want. */ | static int msc_pcibios_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val) | /* We can't address 8 and 16 bit words directly. Instead we have to read/write a 32bit word and mask/modify the data we actually want. */
static int msc_pcibios_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val) | {
u32 data = 0;
if ((size == 2) && (where & 1))
return PCIBIOS_BAD_REGISTER_NUMBER;
else if ((size == 4) && (where & 3))
return PCIBIOS_BAD_REGISTER_NUMBER;
if (msc_pcibios_config_access(PCI_ACCESS_READ, bus, devfn, where,
&data))
return -1;
if (size == 1)
*val = (data >> ((w... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns: a newly allocated string, with all characters converted to uppercase. */ | gchar* g_utf8_strup(const gchar *str, gssize len) | /* Returns: a newly allocated string, with all characters converted to uppercase. */
gchar* g_utf8_strup(const gchar *str, gssize len) | {
gsize result_len;
LocaleType locale_type;
gchar *result;
g_return_val_if_fail (str != NULL, NULL);
locale_type = get_locale_type ();
result_len = real_toupper (str, len, NULL, locale_type);
result = g_malloc (result_len + 1);
real_toupper (str, len, result, locale_type);
result[result_len] = '\0';
... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Determines if there are any space in the transmit FIFO. */ | xtBoolean UARTFIFOTxIsEmpty(unsigned long ulBase) | /* Determines if there are any space in the transmit FIFO. */
xtBoolean UARTFIFOTxIsEmpty(unsigned long ulBase) | {
xASSERT(UARTBaseValid(ulBase));
return (xHWREG(ulBase + USART_SR) & USART_SR_TXE);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Delete a group control block from the instance. If the controlled group address's reference count reaches zero, the group address is removed too. */ | BOOLEAN MnpGroupOpDelCtrlBlk(IN MNP_INSTANCE_DATA *Instance, IN MNP_GROUP_CONTROL_BLOCK *CtrlBlk) | /* Delete a group control block from the instance. If the controlled group address's reference count reaches zero, the group address is removed too. */
BOOLEAN MnpGroupOpDelCtrlBlk(IN MNP_INSTANCE_DATA *Instance, IN MNP_GROUP_CONTROL_BLOCK *CtrlBlk) | {
MNP_DEVICE_DATA *MnpDeviceData;
MNP_GROUP_ADDRESS *GroupAddress;
NET_CHECK_SIGNATURE (Instance, MNP_INSTANCE_DATA_SIGNATURE);
MnpDeviceData = Instance->MnpServiceData->MnpDeviceData;
NET_CHECK_SIGNATURE (MnpDeviceData, MNP_DEVICE_DATA_SIGNATURE);
GroupAddress = CtrlBlk->GroupAddress;
RemoveEntryList... | tianocore/edk2 | C++ | Other | 4,240 |
/* param base DCP peripheral base address param handle Handle used for this request. param plaintext Input plain text to encrypt param ciphertext Output cipher text param size Size of input and output data in bytes. Must be multiple of 16 bytes. param iv Input initial vector to combine with the first input block. retur... | status_t DCP_AES_EncryptCbc(DCP_Type *base, dcp_handle_t *handle, const uint8_t *plaintext, uint8_t *ciphertext, size_t size, const uint8_t iv[16]) | /* param base DCP peripheral base address param handle Handle used for this request. param plaintext Input plain text to encrypt param ciphertext Output cipher text param size Size of input and output data in bytes. Must be multiple of 16 bytes. param iv Input initial vector to combine with the first input block. retur... | {
status_t completionStatus = kStatus_Fail;
dcp_work_packet_t dcpWork = {0};
do
{
completionStatus = DCP_AES_EncryptCbcNonBlocking(base, handle, &dcpWork, plaintext, ciphertext, size, iv);
} while (completionStatus == kStatus_DCP_Again);
if (completionStatus != kStatus_Success)
{
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* If the underlying (data/log/rt) device is readonly, there are some operations that cannot proceed. */ | int xfs_dev_is_read_only(xfs_mount_t *mp, char *message) | /* If the underlying (data/log/rt) device is readonly, there are some operations that cannot proceed. */
int xfs_dev_is_read_only(xfs_mount_t *mp, char *message) | {
if (xfs_readonly_buftarg(mp->m_ddev_targp) ||
xfs_readonly_buftarg(mp->m_logdev_targp) ||
(mp->m_rtdev_targp && xfs_readonly_buftarg(mp->m_rtdev_targp))) {
cmn_err(CE_NOTE,
"XFS: %s required on read-only device.", message);
cmn_err(CE_NOTE,
"XFS: write access unavailable, cannot proceed.");
ret... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* VDM Discovery identity callback (answer after sending a Discover Identity req message) */ | static void USBPD_VDM_InformIdentity(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, USBPD_VDM_CommandType_Typedef CommandStatus, USBPD_DiscoveryIdentity_TypeDef *pIdentity) | /* VDM Discovery identity callback (answer after sending a Discover Identity req message) */
static void USBPD_VDM_InformIdentity(uint8_t PortNum, USBPD_SOPType_TypeDef SOPType, USBPD_VDM_CommandType_Typedef CommandStatus, USBPD_DiscoveryIdentity_TypeDef *pIdentity) | {
switch(CommandStatus)
{
case SVDM_RESPONDER_ACK :
Remote_IDHeaderVDO[PortNum].d32 = pIdentity->IDHeader.d32;
Remote_CertStatVDO[PortNum].d32 = pIdentity->CertStatVDO.d32;
Remote_ProductVDO[PortNum].d32 = pIdentity->ProductVDO.d32;
{
if (pIdentity->AMA_VDO_Presence == 1)
{
... | st-one/X-CUBE-USB-PD | C++ | null | 110 |
/* This function is going to be called with interrupts disabled, so it cannot iounmap the virtual addresses used to access the NVS region. */ | void hibernate_nvs_restore(void) | /* This function is going to be called with interrupts disabled, so it cannot iounmap the virtual addresses used to access the NVS region. */
void hibernate_nvs_restore(void) | {
struct nvs_page *entry;
printk(KERN_INFO "PM: Restoring platform NVS memory\n");
list_for_each_entry(entry, &nvs_list, node)
if (entry->data)
memcpy(entry->kaddr, entry->data, entry->size);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* SPI MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi) | /* SPI MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_SPI_MspDeInit(SPI_HandleTypeDef *hspi) | {
if(hspi->Instance==SPI4)
{
__HAL_RCC_SPI4_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOE, GPIO_PIN_11|GPIO_PIN_12|GPIO_PIN_14);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.