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 |
|---|---|---|---|---|---|---|---|
/* PARAMETER erp current erp_head RETURN VALUES erp new erp_head - pointer to new ERP */ | static struct dasd_ccw_req* dasd_3990_erp_file_prot(struct dasd_ccw_req *erp) | /* PARAMETER erp current erp_head RETURN VALUES erp new erp_head - pointer to new ERP */
static struct dasd_ccw_req* dasd_3990_erp_file_prot(struct dasd_ccw_req *erp) | {
struct dasd_device *device = erp->startdev;
dev_err(&device->cdev->dev, "Accessing the DASD failed because of "
"a hardware error\n");
return dasd_3990_erp_cleanup(erp, DASD_CQR_FAILED);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Get remain size of specified Key Store memory. */ | uint32_t KS_GetRemainSize(KS_MEM_Type mem) | /* Get remain size of specified Key Store memory. */
uint32_t KS_GetRemainSize(KS_MEM_Type mem) | {
uint32_t u32Reg;
uint32_t u32SramRemain, u32FlashRemain;
u32Reg = KS->REMAIN;
u32SramRemain = (u32Reg & KS_REMAIN_RRMNG_Msk) >> KS_REMAIN_RRMNG_Pos;
u32FlashRemain = (u32Reg & KS_REMAIN_FRMNG_Msk) >> KS_REMAIN_FRMNG_Pos;
if (mem == KS_SRAM)
return u32SramRemain;
else
return... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enter energy mode 2 (EM2).
However, prior to entering EM2, the core may have been using another oscillator than HFRCO. The */ | void EMU_EnterEM2(bool restore) | /* Enter energy mode 2 (EM2).
However, prior to entering EM2, the core may have been using another oscillator than HFRCO. The */
void EMU_EnterEM2(bool restore) | {
cmuStatus = (uint16_t)(CMU->STATUS);
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
__WFI();
if (restore)
{
EMU_Restore();
}
else if (!(cmuStatus & CMU_STATUS_HFRCOSEL))
{
SystemCoreClockUpdate();
}
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Check permission between a pair of credentials fork check, ptrace check, etc. */ | static int cred_has_perm(const struct cred *actor, const struct cred *target, u32 perms) | /* Check permission between a pair of credentials fork check, ptrace check, etc. */
static int cred_has_perm(const struct cred *actor, const struct cred *target, u32 perms) | {
u32 asid = cred_sid(actor), tsid = cred_sid(target);
return avc_has_perm(asid, tsid, SECCLASS_PROCESS, perms, NULL);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* PCI controller config registers are accessed through these functions i.e. these allow us to set up our own BARs etc. */ | void crp_read(unsigned int offset, unsigned int *data) | /* PCI controller config registers are accessed through these functions i.e. these allow us to set up our own BARs etc. */
void crp_read(unsigned int offset, unsigned int *data) | {
REG_WRITE (PCI_CSR_BASE, PCI_CRP_AD_CBE_OFFSET, offset);
REG_READ (PCI_CSR_BASE, PCI_CRP_RDATA_OFFSET, *data);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Enable or disable the Read of low-voltage mode. */ | void EFM_LowVoltageReadCmd(en_functional_state_t enNewState) | /* Enable or disable the Read of low-voltage mode. */
void EFM_LowVoltageReadCmd(en_functional_state_t enNewState) | {
DDL_ASSERT(IS_FUNCTIONAL_STATE(enNewState));
DDL_ASSERT(IS_EFM_REG_UNLOCK());
WRITE_REG32(bCM_EFM->FRMC_b.LVM, enNewState);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Function to manage HID report generation and transmission to the host, when in report mode. */ | void HID_Task(void) | /* Function to manage HID report generation and transmission to the host, when in report mode. */
void HID_Task(void) | {
if (USB_DeviceState != DEVICE_STATE_Configured)
return;
SendNextReport();
ReceiveNextReport();
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Display the VLAN configuration of all, or a specified network interface. */ | VOID DisplayVlan(IN CHAR16 *Name OPTIONAL) | /* Display the VLAN configuration of all, or a specified network interface. */
VOID DisplayVlan(IN CHAR16 *Name OPTIONAL) | {
UINTN NumberOfHandles;
EFI_HANDLE *HandleBuffer;
UINTN Index;
EFI_HANDLE NicHandle;
if (Name != NULL) {
NicHandle = NicNameToHandle (Name);
if (NicHandle == NULL) {
return;
}
ShowNicVlanInfo (NicHandle, 0);
return;
}
LocateNicHandleBuffer (&NumberOfHandles, &Handl... | tianocore/edk2 | C++ | Other | 4,240 |
/* Accelerometer X-axis user offset correction expressed in two’s complement, weight depends on USR_OFF_W in CTRL6_C (15h). The value must be in the range .. */ | int32_t lsm6dso_xl_usr_offset_x_set(lsm6dso_ctx_t *ctx, uint8_t *buff) | /* Accelerometer X-axis user offset correction expressed in two’s complement, weight depends on USR_OFF_W in CTRL6_C (15h). The value must be in the range .. */
int32_t lsm6dso_xl_usr_offset_x_set(lsm6dso_ctx_t *ctx, uint8_t *buff) | {
int32_t ret;
ret = lsm6dso_write_reg(ctx, LSM6DSO_X_OFS_USR, buff, 1);
return ret;
} | alexander-g-dean/ESF | C++ | null | 41 |
/* Returns: TRUE on success, FALSE if an error was set */ | gboolean g_spawn_command_line_sync(const gchar *command_line, gchar **standard_output, gchar **standard_error, gint *exit_status, GError **error) | /* Returns: TRUE on success, FALSE if an error was set */
gboolean g_spawn_command_line_sync(const gchar *command_line, gchar **standard_output, gchar **standard_error, gint *exit_status, GError **error) | {
gboolean retval;
gchar **argv = NULL;
g_return_val_if_fail (command_line != NULL, FALSE);
if (!g_shell_parse_argv (command_line,
NULL, &argv,
error))
return FALSE;
retval = g_spawn_sync (NULL,
argv,
N... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Resets and disables the Analog Comparator driver.
Resets and disables the Analog Comparator driver, resets the internal states and registers of the hardware module to their power-on defaults. */ | enum status_code ac_reset(struct ac_module *const module_inst) | /* Resets and disables the Analog Comparator driver.
Resets and disables the Analog Comparator driver, resets the internal states and registers of the hardware module to their power-on defaults. */
enum status_code ac_reset(struct ac_module *const module_inst) | {
Assert(module_inst);
Assert(module_inst->hw);
Ac *const ac_module = module_inst->hw;
ac_disable(module_inst);
while (ac_is_syncing(module_inst)) {
}
ac_module->CTRLA.reg |= AC_CTRLA_SWRST;
return STATUS_OK;
} | memfault/zero-to-main | C++ | null | 200 |
/* pcmcia_do_loop_tuple() is the internal callback for the call from pcmcia_loop_tuple() to pccard_loop_tuple(). Data is transferred by a struct */ | static int pcmcia_do_loop_tuple(tuple_t *tuple, cisparse_t *parse, void *priv) | /* pcmcia_do_loop_tuple() is the internal callback for the call from pcmcia_loop_tuple() to pccard_loop_tuple(). Data is transferred by a struct */
static int pcmcia_do_loop_tuple(tuple_t *tuple, cisparse_t *parse, void *priv) | {
struct pcmcia_loop_mem *loop = priv;
return loop->loop_tuple(loop->p_dev, tuple, loop->priv_data);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Clean up from issuing a BUS DEVICE RESET message to a device. */ | static void fas216_devicereset_done(FAS216_Info *info, struct scsi_cmnd *SCpnt, unsigned int result) | /* Clean up from issuing a BUS DEVICE RESET message to a device. */
static void fas216_devicereset_done(FAS216_Info *info, struct scsi_cmnd *SCpnt, unsigned int result) | {
fas216_log(info, LOG_ERROR, "fas216 device reset complete");
info->rstSCpnt = NULL;
info->rst_dev_status = 1;
wake_up(&info->eh_wait);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Angular rate sensor. The value is expressed as a 16-bit word in two’s complement.. */ | int32_t lsm6dso_angular_rate_raw_get(lsm6dso_ctx_t *ctx, uint8_t *buff) | /* Angular rate sensor. The value is expressed as a 16-bit word in two’s complement.. */
int32_t lsm6dso_angular_rate_raw_get(lsm6dso_ctx_t *ctx, uint8_t *buff) | {
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_OUTX_L_G, buff, 6);
return ret;
} | alexander-g-dean/ESF | C++ | null | 41 |
/* @uc should be 0xD800..0xDBFF, and @lc should be 0xDC00..0xDFFF. If they aren't, this function returns false. */ | static bool from_surrogate_pair(uint16_t uc, uint16_t lc, uchar_t *unicode) | /* @uc should be 0xD800..0xDBFF, and @lc should be 0xDC00..0xDFFF. If they aren't, this function returns false. */
static bool from_surrogate_pair(uint16_t uc, uint16_t lc, uchar_t *unicode) | {
if (uc >= 0xD800 && uc <= 0xDBFF && lc >= 0xDC00 && lc <= 0xDFFF) {
*unicode = 0x10000 + ((((uchar_t)uc & 0x3FF) << 10) | (lc & 0x3FF));
return true;
} else {
return false;
}
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* The user Entry Point for module EmuBusDriver. The user code starts with this function. */ | EFI_STATUS EFIAPI InitializeEmuBusDriver(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | /* The user Entry Point for module EmuBusDriver. The user code starts with this function. */
EFI_STATUS EFIAPI InitializeEmuBusDriver(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) | {
EFI_STATUS Status;
Status = EfiLibInstallAllDriverProtocols (
ImageHandle,
SystemTable,
&gEmuBusDriverBinding,
ImageHandle,
&gEmuBusDriverComponentName,
NULL,
NULL
);
ASSERT_EFI_ERROR (Status);
return Stat... | tianocore/edk2 | C++ | Other | 4,240 |
/* Call a specific function in the thread context of tcpip_thread for easy access synchronization. A function called in that way may access lwIP core code without fearing concurrent access. */ | err_t tcpip_callback_with_block(tcpip_callback_fn function, void *ctx, u8_t block) | /* Call a specific function in the thread context of tcpip_thread for easy access synchronization. A function called in that way may access lwIP core code without fearing concurrent access. */
err_t tcpip_callback_with_block(tcpip_callback_fn function, void *ctx, u8_t block) | {
struct tcpip_msg *msg;
if (sys_mbox_valid(&mbox)) {
msg = (struct tcpip_msg *)memp_malloc(MEMP_TCPIP_MSG_API);
if (msg == NULL) {
return ERR_MEM;
}
msg->type = TCPIP_MSG_CALLBACK;
msg->msg.cb.function = function;
msg->msg.cb.ctx = ctx;
if (block) {
sys_mbox_post(&mbox, msg)... | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* ADC MSP Initialization This function configures the hardware resources used in this example. */ | void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc) | /* ADC MSP Initialization This function configures the hardware resources used in this example. */
void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc) | {
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(hadc->Instance==ADC1)
{
__HAL_RCC_ADC1_CLK_ENABLE();
__HAL_RCC_GPIOC_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_3;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Swap in the new signal mask, and wait for a signal. Define some dummy arguments to be able to reach the regs argument. */ | int sys_sigsuspend(old_sigset_t mask, long r11, long r12, long r13, long mof, long srp, struct pt_regs *regs) | /* Swap in the new signal mask, and wait for a signal. Define some dummy arguments to be able to reach the regs argument. */
int sys_sigsuspend(old_sigset_t mask, long r11, long r12, long r13, long mof, long srp, struct pt_regs *regs) | {
mask &= _BLOCKABLE;
spin_lock_irq(¤t->sighand->siglock);
current->saved_sigmask = current->blocked;
siginitset(¤t->blocked, mask);
recalc_sigpending();
spin_unlock_irq(¤t->sighand->siglock);
current->state = TASK_INTERRUPTIBLE;
schedule();
set_thread_flag(TIF_RESTORE_SIGMASK);
return -ERES... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Gets the direction and mode of a pin. */ | uint32_t GPIODirModeGet(uint32_t ui32Port, uint8_t ui8Pin) | /* Gets the direction and mode of a pin. */
uint32_t GPIODirModeGet(uint32_t ui32Port, uint8_t ui8Pin) | {
uint32_t ui32Dir, ui32AFSEL;
ASSERT(_GPIOBaseValid(ui32Port));
ASSERT(ui8Pin < 8);
ui8Pin = 1 << ui8Pin;
ui32Dir = HWREG(ui32Port + GPIO_O_DIR);
ui32AFSEL = HWREG(ui32Port + GPIO_O_AFSEL);
return (((ui32Dir & ui8Pin) ? 1 : 0) | ((ui32AFSEL & ui8Pin) ? 2 : 0));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Set bank size and count for IN transactions */ | static void _usbd_ep_set_in_trans(uint8_t epn, uint8_t bank_n, uint32_t size, uint32_t count) | /* Set bank size and count for IN transactions */
static void _usbd_ep_set_in_trans(uint8_t epn, uint8_t bank_n, uint32_t size, uint32_t count) | {
_usbd_ep_set_in_size(epn, bank_n, size);
_usbd_ep_set_in_count(epn, bank_n, count);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Switch the current stack to the previous saved stack. */ | UINTN EFIAPI SwapStack(IN UINTN NewStack) | /* Switch the current stack to the previous saved stack. */
UINTN EFIAPI SwapStack(IN UINTN NewStack) | {
FSP_GLOBAL_DATA *FspData;
UINTN OldStack;
FspData = GetFspGlobalDataPointer ();
OldStack = FspData->CoreStack;
FspData->CoreStack = (UINTN)NewStack;
return OldStack;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Checks if the given bit string contains only bits specified by the flags vector. Returns 0 if there is at least one bit set in 'a' which is not specified in 'flags', 1 otherwise. 'len' is the length of 'flags'. */ | int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a, unsigned char *flags, int flags_len) | /* Checks if the given bit string contains only bits specified by the flags vector. Returns 0 if there is at least one bit set in 'a' which is not specified in 'flags', 1 otherwise. 'len' is the length of 'flags'. */
int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a, unsigned char *flags, int flags_len) | {
int i, ok;
if (!a || !a->data)
return 1;
ok = 1;
for (i = 0; i < a->length && ok; ++i) {
unsigned char mask = i < flags_len ? ~flags[i] : 0xff;
ok = (a->data[i] & mask) == 0;
}
return ok;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* slave recv target length data use interrupt mode. */ | int32_t spi_slave_read_stream(spi_t *obj, char *rx_buffer, uint32_t length) | /* slave recv target length data use interrupt mode. */
int32_t spi_slave_read_stream(spi_t *obj, char *rx_buffer, uint32_t length) | {
uint8_t spi_idx = obj->spi_idx &0x0F;
PHAL_SSI_ADAPTOR ssi_adapter = &ssi_adapter_g[spi_idx];
int32_t ret;
if (obj->state & SPI_STATE_RX_BUSY) {
DBG_PRINTF(MODULE_SPI, LEVEL_WARN, "spis int rx: state(0x%x) is not ready\r\n",
obj->state);
return HAL_BUSY;
}
obj->state |= SPI_STATE_RX_BUSY;
if ((ret = ss... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* As get_timer is used in the u-boot only for timeouts this should be sufficient */ | ulong get_timer(ulong base) | /* As get_timer is used in the u-boot only for timeouts this should be sufficient */
ulong get_timer(ulong base) | {
ulong milisec;
ulong clocks = (MAX_TIM_LOAD - bfin_read_TCOUNT());
if (clocks < last_time)
timestamp++;
last_time = clocks;
milisec = clocks / (CONFIG_CCLK_HZ / 1000);
milisec += timestamp * (MAX_TIM_LOAD / (CONFIG_CCLK_HZ / 1000));
return (milisec - base);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* This function delays for a number of microseconds (not compiled). */ | void sha204h_start_timer(uint16_t delay, uint8_t is_blocking) | /* This function delays for a number of microseconds (not compiled). */
void sha204h_start_timer(uint16_t delay, uint8_t is_blocking) | {
tc_set_resolution(DELAY_COUNTER, 1000);
uint32_t resolution = tc_get_resolution(DELAY_COUNTER);
tc_write_period(DELAY_COUNTER, (resolution * (uint32_t) delay) / 1000);
tc_restart(DELAY_COUNTER);
sha204_timer_expired = false;
if (is_blocking)
while (sha204_timer_expired == false);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* USART Read a Received Data Word.
If parity is enabled the MSB (bit 7 or 8 depending on the word length) is the parity bit. */ | uint16_t usart_recv(uint32_t usart) | /* USART Read a Received Data Word.
If parity is enabled the MSB (bit 7 or 8 depending on the word length) is the parity bit. */
uint16_t usart_recv(uint32_t usart) | {
return USART_DR(usart) & USART_DR_MASK;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* Getting a lock on a stable anon_vma from a page off the LRU is tricky: page_lock_anon_vma rely on RCU to guard against the races. */ | struct anon_vma* page_lock_anon_vma(struct page *page) | /* Getting a lock on a stable anon_vma from a page off the LRU is tricky: page_lock_anon_vma rely on RCU to guard against the races. */
struct anon_vma* page_lock_anon_vma(struct page *page) | {
struct anon_vma *anon_vma;
unsigned long anon_mapping;
rcu_read_lock();
anon_mapping = (unsigned long) ACCESS_ONCE(page->mapping);
if ((anon_mapping & PAGE_MAPPING_FLAGS) != PAGE_MAPPING_ANON)
goto out;
if (!page_mapped(page))
goto out;
anon_vma = (struct anon_vma *) (anon_mapping - PAGE_MAPPING_ANON);
sp... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Reads and returns the current value of CR2. This function is only available on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on X64. */ | UINTN EFIAPI AsmReadCr2(VOID) | /* Reads and returns the current value of CR2. This function is only available on IA-32 and X64. This returns a 32-bit value on IA-32 and a 64-bit value on X64. */
UINTN EFIAPI AsmReadCr2(VOID) | {
UINTN Data;
__asm__ __volatile__ (
"mov %%cr2, %0"
: "=r" (Data)
);
return Data;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* ubi_is_erase_work - checks whether a work is erase work. @wrk: The work object to be checked */ | int ubi_is_erase_work(struct ubi_work *wrk) | /* ubi_is_erase_work - checks whether a work is erase work. @wrk: The work object to be checked */
int ubi_is_erase_work(struct ubi_work *wrk) | {
return wrk->func == erase_worker;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* During commit it is sometimes necessary to copy a pnode (see dirty_cow_pnode) and the lprops that the pnode contains. When that happens, references in the category heaps to those lprops must be updated to point to the new lprops. This function does that. */ | static void lpt_heap_replace(struct ubifs_info *c, struct ubifs_lprops *old_lprops, struct ubifs_lprops *new_lprops, int cat) | /* During commit it is sometimes necessary to copy a pnode (see dirty_cow_pnode) and the lprops that the pnode contains. When that happens, references in the category heaps to those lprops must be updated to point to the new lprops. This function does that. */
static void lpt_heap_replace(struct ubifs_info *c, struct ... | {
struct ubifs_lpt_heap *heap;
int hpos = new_lprops->hpos;
heap = &c->lpt_heap[cat - 1];
heap->arr[hpos] = new_lprops;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Callback function for asserts in the SoftDevice.
See nrf_fault_handler_t for more details. */ | void softdevice_fault_handler(uint32_t id, uint32_t pc, uint32_t info) | /* Callback function for asserts in the SoftDevice.
See nrf_fault_handler_t for more details. */
void softdevice_fault_handler(uint32_t id, uint32_t pc, uint32_t info) | {
app_error_fault_handler(id, pc, info);
} | labapart/polymcu | C++ | null | 201 |
/* Returns a boolean to indicate whether SEV is enabled. */ | BOOLEAN EFIAPI MemEncryptSevIsEnabled(VOID) | /* Returns a boolean to indicate whether SEV is enabled. */
BOOLEAN EFIAPI MemEncryptSevIsEnabled(VOID) | {
MSR_SEV_STATUS_REGISTER Msr;
Msr.Uint32 = InternalMemEncryptSevStatus ();
return Msr.Bits.SevBit ? TRUE : FALSE;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Configure the internal OSC48M oscillator clock source.
Configures the 48MHz (nominal) internal RC oscillator with the given configuration settings. */ | void system_clock_source_osc48m_set_config(struct system_clock_source_osc48m_config *const config) | /* Configure the internal OSC48M oscillator clock source.
Configures the 48MHz (nominal) internal RC oscillator with the given configuration settings. */
void system_clock_source_osc48m_set_config(struct system_clock_source_osc48m_config *const config) | {
Assert(config);
OSCCTRL_OSC48MCTRL_Type temp = OSCCTRL->OSC48MCTRL;
temp.bit.ONDEMAND = config->on_demand;
temp.bit.RUNSTDBY = config->run_in_standby;
OSCCTRL->OSC48MCTRL = temp;
if (config->div != OSCCTRL->OSC48MDIV.reg) {
OSCCTRL->OSC48MDIV.reg = OSCCTRL_OSC48MDIV_DIV(config->div);
while(OSCCTRL->OSC48MSY... | memfault/zero-to-main | C++ | null | 200 |
/* Checks if the power on a specified port is enabled. */ | USBPD_FunctionalState USBPD_PWR_IF_VBUSIsEnabled(uint8_t PortNum) | /* Checks if the power on a specified port is enabled. */
USBPD_FunctionalState USBPD_PWR_IF_VBUSIsEnabled(uint8_t PortNum) | {
return USBPD_PORT_IsValid(PortNum) ? (USBPD_FunctionalState)HW_IF_PWR_VBUSIsEnabled(PortNum) : USBPD_DISABLE;
} | st-one/X-CUBE-USB-PD | C++ | null | 110 |
/* Function to check that PLL can be modified. */ | static uint32_t UTILS_GetPLLOutputFrequency(uint32_t PLL_InputFrequency, LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct) | /* Function to check that PLL can be modified. */
static uint32_t UTILS_GetPLLOutputFrequency(uint32_t PLL_InputFrequency, LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct) | {
uint32_t pllfreq;
assert_param(IS_LL_UTILS_PLLM_VALUE(UTILS_PLLInitStruct->PLLM));
assert_param(IS_LL_UTILS_PLLN_VALUE(UTILS_PLLInitStruct->PLLN));
assert_param(IS_LL_UTILS_PLLR_VALUE(UTILS_PLLInitStruct->PLLR));
pllfreq = PLL_InputFrequency / (UTILS_PLLInitStruct->PLLM);
assert_param(IS_LL_UTILS_PLLVCO_I... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Clock-gated I2C clock domain for address matching interrupts wake up. */ | void USI_I2C_Sleep_Cmd(USI_TypeDef *USIx, u32 NewStatus) | /* Clock-gated I2C clock domain for address matching interrupts wake up. */
void USI_I2C_Sleep_Cmd(USI_TypeDef *USIx, u32 NewStatus) | {
assert_param(IS_USI_I2C_ALL_PERIPH(USIx));
if (NewStatus != DISABLE) {
USI_I2C_INTConfig(USIx, USI_I2C_LP_WAKE_INTER_EN, ENABLE);
USIx->I2C_DIG_FILTER &= ~ USI_I2C_DIG_FLTR_SEL;
USIx->I2C_CTRL &= ~(USI_I2C_SLV_DISABLE);
USIx->I2C_ENABLE |= USI_I2C_SLEEP;
} else {
USI_I2C_INTConfig(USIx, USI_I2C_LP_WAKE_I... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Configures the TIMx Internal Trigger as External Clock. */ | void TIM_ITRxExternalClockConfig(TIM_TypeDef *TIMx, uint16_t TIM_InputTriggerSource) | /* Configures the TIMx Internal Trigger as External Clock. */
void TIM_ITRxExternalClockConfig(TIM_TypeDef *TIMx, uint16_t TIM_InputTriggerSource) | {
assert_param(IS_TIM_123458_PERIPH(TIMx));
assert_param(IS_TIM_INTERNAL_TRIGGER_SELECTION(TIM_InputTriggerSource));
TIM_SelectInputTrigger(TIMx, TIM_InputTriggerSource);
TIMx->SMCR |= TIM_SlaveMode_External1;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Searches a string for the first occurrence of a character contained in a specified buffer. */ | CHAR8* EFIAPI AsciiStrBrk(IN CHAR8 *String, IN CHAR8 *CharSet) | /* Searches a string for the first occurrence of a character contained in a specified buffer. */
CHAR8* EFIAPI AsciiStrBrk(IN CHAR8 *String, IN CHAR8 *CharSet) | {
CHAR8 *Str1;
CHAR8 *Str2;
for (Str1 = String; *Str1 != L'\0'; Str1++) {
for (Str2 = CharSet; *Str2 != L'\0'; Str2++) {
if (*Str1 == *Str2) {
return (CHAR8 *)Str1;
}
}
}
return NULL;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Get a list of all capture sources that are up and that we can open. Returns -1 on error, 0 otherwise. The list, as returned through "alldevsp", may be null if no interfaces were up and could be opened. */ | int pcap_findalldevs(pcap_if_t **alldevsp, char *errbuf) | /* Get a list of all capture sources that are up and that we can open. Returns -1 on error, 0 otherwise. The list, as returned through "alldevsp", may be null if no interfaces were up and could be opened. */
int pcap_findalldevs(pcap_if_t **alldevsp, char *errbuf) | {
size_t i;
pcap_if_list_t devlist;
devlist.beginning = NULL;
if (pcap_platform_finddevs(&devlist, errbuf) == -1) {
if (devlist.beginning != NULL)
pcap_freealldevs(devlist.beginning);
*alldevsp = NULL;
return (-1);
}
for (i = 0; capture_source_types[i].findalldevs_op != NULL; i++) {
if (capture_source_... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* dispose of the links from a revoked keyring */ | void user_revoke(struct key *key) | /* dispose of the links from a revoked keyring */
void user_revoke(struct key *key) | {
struct user_key_payload *upayload = key->payload.data;
key_payload_reserve(key, 0);
if (upayload) {
rcu_assign_pointer(key->payload.data, NULL);
call_rcu(&upayload->rcu, user_update_rcu_disposal);
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Configure the maximum resynchronization offset (How long, in simulation time, can we spend without talking with the Phy) Note that this value may be configured as a command line argument too */ | void phy_sync_ctrl_set_max_resync_offset(bs_time_t max_resync_offset) | /* Configure the maximum resynchronization offset (How long, in simulation time, can we spend without talking with the Phy) Note that this value may be configured as a command line argument too */
void phy_sync_ctrl_set_max_resync_offset(bs_time_t max_resync_offset) | {
sync_args.max_resync_offset = max_resync_offset;
psc_program_next_event();
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* If RsaContext is NULL, then return FALSE. If BnSize is NULL, then return FALSE. If BnSize is large enough but BigNumber is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ | BOOLEAN EFIAPI RsaGetKey(IN OUT VOID *RsaContext, IN RSA_KEY_TAG KeyTag, OUT UINT8 *BigNumber, IN OUT UINTN *BnSize) | /* If RsaContext is NULL, then return FALSE. If BnSize is NULL, then return FALSE. If BnSize is large enough but BigNumber is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI RsaGetKey(IN OUT VOID *RsaContext, IN RSA_KEY_TAG KeyTag, OUT UINT8 *BigNumber, IN OUT UINTN *Bn... | {
CALL_CRYPTO_SERVICE (RsaGetKey, (RsaContext, KeyTag, BigNumber, BnSize), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Get maximum firmware image us_size able to be stored. */ | uint32_t hal_get_max_fw_size(void) | /* Get maximum firmware image us_size able to be stored. */
uint32_t hal_get_max_fw_size(void) | {
return HAL_FU_MAXIMUM_FIRMW_SIZE;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Enable the analogue monitoring on VDDA Power source. */ | FMC_STATE_T FMC_EnableOptionByteVDDA(void) | /* Enable the analogue monitoring on VDDA Power source. */
FMC_STATE_T FMC_EnableOptionByteVDDA(void) | {
FMC_STATE_T state;
state = FMC_WaitForReady(FMC_DELAY_ERASE);
if (state == FMC_STATE_COMPLETE)
{
FMC->CTRL2_B.OBP = BIT_SET;
OB->USER_B.VDDAMON = BIT_SET;
state = FMC_WaitForReady(FMC_DELAY_ERASE);
if (state != FMC_STATE_TIMEOUT)
{
FMC->CTRL2_B.OBP =... | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* This function will get bootloader specific parameter address for UEFI payload. e.g. HobList pointer for Slim Bootloader, and coreboot table header for Coreboot. */ | VOID* EFIAPI GetParameterBase(VOID) | /* This function will get bootloader specific parameter address for UEFI payload. e.g. HobList pointer for Slim Bootloader, and coreboot table header for Coreboot. */
VOID* EFIAPI GetParameterBase(VOID) | {
EFI_HOB_HANDOFF_INFO_TABLE *HandoffTable;
HandoffTable = (EFI_HOB_HANDOFF_INFO_TABLE *)(UINTN)GET_BOOTLOADER_PARAMETER ();
if ((HandoffTable->Header.HobType == EFI_HOB_TYPE_HANDOFF) &&
(HandoffTable->Header.HobLength == sizeof (EFI_HOB_HANDOFF_INFO_TABLE)) &&
(HandoffTable->Header.Reserved == 0))
... | tianocore/edk2 | C++ | Other | 4,240 |
/* check_free_sector: check if a free sector is actually FREE, i.e. All 0xff in data and oob area. */ | static int check_free_sectors(struct INFTLrecord *inftl, unsigned int address, int len, int check_oob) | /* check_free_sector: check if a free sector is actually FREE, i.e. All 0xff in data and oob area. */
static int check_free_sectors(struct INFTLrecord *inftl, unsigned int address, int len, int check_oob) | {
u8 buf[SECTORSIZE + inftl->mbd.mtd->oobsize];
struct mtd_info *mtd = inftl->mbd.mtd;
size_t retlen;
int i;
for (i = 0; i < len; i += SECTORSIZE) {
if (mtd->read(mtd, address, SECTORSIZE, &retlen, buf))
return -1;
if (memcmpb(buf, 0xff, SECTORSIZE) != 0)
return -1;
if (check_oob) {
if(inftl_read_oo... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Retrieves the current module status.
Retrieves the status of the module, giving overall state information. */ | uint32_t adc_get_status(void) | /* Retrieves the current module status.
Retrieves the status of the module, giving overall state information. */
uint32_t adc_get_status(void) | {
return (LPMCU_MISC_REGS0->SENS_ADC_RAW_STATUS.reg);
} | memfault/zero-to-main | C++ | null | 200 |
/* Get the I2C time out flag of the specified I2C port.
The */ | xtBoolean I2CTimeoutFlagGet(unsigned long ulBase) | /* Get the I2C time out flag of the specified I2C port.
The */
xtBoolean I2CTimeoutFlagGet(unsigned long ulBase) | {
xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE) ||
(ulBase == I2C2_BASE) || (ulBase == I2C3_BASE) ||
(ulBase == I2C4_BASE));
return ((xHWREG(ulBase + I2C_TOCTL) & I2C_TOCTL_TIF) ? xtrue : xfalse);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Create a virtual mapping cookie for a PCI BAR (memory or IO) */ | void __iomem* pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) | /* Create a virtual mapping cookie for a PCI BAR (memory or IO) */
void __iomem* pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen) | {
resource_size_t start = pci_resource_start(dev, bar);
resource_size_t len = pci_resource_len(dev, bar);
unsigned long flags = pci_resource_flags(dev, bar);
if (!len || !start)
return NULL;
if ((flags & IORESOURCE_IO) || (flags & IORESOURCE_MEM))
return (void __iomem *) start;
return NULL;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Note that if RowsPerStrip is larger than the recorded ImageLength, then the strip size is truncated to reflect the actual space required to hold the strip. */ | uint64 TIFFStripSize64(TIFF *tif) | /* Note that if RowsPerStrip is larger than the recorded ImageLength, then the strip size is truncated to reflect the actual space required to hold the strip. */
uint64 TIFFStripSize64(TIFF *tif) | {
TIFFDirectory* td = &tif->tif_dir;
uint32 rps = td->td_rowsperstrip;
if (rps > td->td_imagelength)
rps = td->td_imagelength;
return (TIFFVStripSize64(tif, rps));
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* NOTE: All of this startup code assumes the low 16mb (approx.) of kernel mappings are done with one single contiguous chunk of ram. On small ram machines (classics mainly) we only get around 8mb mapped for us. */ | static void __init early_pgtable_allocfail(char *type) | /* NOTE: All of this startup code assumes the low 16mb (approx.) of kernel mappings are done with one single contiguous chunk of ram. On small ram machines (classics mainly) we only get around 8mb mapped for us. */
static void __init early_pgtable_allocfail(char *type) | {
prom_printf("inherit_prom_mappings: Cannot alloc kernel %s.\n", type);
prom_halt();
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* 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 = {0};
if(huart->Instance==USART3)
{
__HAL_RCC_USART3_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_10|GPIO_PIN_11;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED... | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Return the reason code for a reservations's companion DRP IE . */ | int uwb_rsv_companion_reason_code(struct uwb_rsv *rsv) | /* Return the reason code for a reservations's companion DRP IE . */
int uwb_rsv_companion_reason_code(struct uwb_rsv *rsv) | {
static const int companion_reason_codes[] = {
[UWB_RSV_STATE_O_MOVE_EXPANDING] = UWB_DRP_REASON_ACCEPTED,
[UWB_RSV_STATE_T_EXPANDING_ACCEPTED] = UWB_DRP_REASON_ACCEPTED,
[UWB_RSV_STATE_T_EXPANDING_CONFLICT] = UWB_DRP_REASON_CONFLICT,
[UWB_RSV_STATE_T_EXPANDING_PENDING] = UWB_DRP_REASON_PENDING,
[UWB_R... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set up the control registers for the SPI clock spi_no - SPI (0) or HSPI (1) prediv - predivider value (actual division value) cntdiv - postdivider value (actual division value) Set either divider to 0 to disable all division (80MHz sysclock) */ | void spi_clock(uint8_t spi_no, uint16_t prediv, uint8_t cntdiv) | /* Set up the control registers for the SPI clock spi_no - SPI (0) or HSPI (1) prediv - predivider value (actual division value) cntdiv - postdivider value (actual division value) Set either divider to 0 to disable all division (80MHz sysclock) */
void spi_clock(uint8_t spi_no, uint16_t prediv, uint8_t cntdiv) | {
WRITE_PERI_REG(SPI_CLOCK(spi_no), SPI_CLK_EQU_SYSCLK);
} else {
WRITE_PERI_REG(SPI_CLOCK(spi_no),
(((prediv - 1) & SPI_CLKDIV_PRE) << SPI_CLKDIV_PRE_S) |
(((cntdiv - 1) & SPI_CLKCNT_N) << SPI_CLKCNT_N_S) |
(((cntdiv >> 1) & SPI_CLKCNT_H) << SPI_CLKCNT_H_S) |
... | micropython/micropython | C++ | Other | 18,334 |
/* Disable I2C interrupt of the specified I2C port.
The */ | void xI2CMasterIntDisable(unsigned long ulBase, unsigned long ulIntType) | /* Disable I2C interrupt of the specified I2C port.
The */
void xI2CMasterIntDisable(unsigned long ulBase, unsigned long ulIntType) | {
xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE) ||
(ulBase == I2C2_BASE) || (ulBase == I2C3_BASE) ||
(ulBase == I2C4_BASE));
xHWREG(ulBase + I2C_CON) &= ~I2C_CON_EI;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Configurate The WatchDog Timer(WDT)'s Timer Interval. This function is to configure The WatchDog Timer(WDT)'s Timer Interval. There are three factors to determine the Timer Interval, they are: */ | void xWDTInit(unsigned long ulBase, unsigned long ulConfig, unsigned long ulReload) | /* Configurate The WatchDog Timer(WDT)'s Timer Interval. This function is to configure The WatchDog Timer(WDT)'s Timer Interval. There are three factors to determine the Timer Interval, they are: */
void xWDTInit(unsigned long ulBase, unsigned long ulConfig, unsigned long ulReload) | {
SysCtlPeripheralClockSourceSet(ulConfig);
WDTimerInit(ulReload);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* If this function returns, it means that the system does not support shutdown reset. */ | VOID EFIAPI ResetShutdown(VOID) | /* If this function returns, it means that the system does not support shutdown reset. */
VOID EFIAPI ResetShutdown(VOID) | {
PerformPsciAction (ARM_SMC_ID_PSCI_SYSTEM_OFF);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Build WAVE & WAVEB register values from configuration. */ | static enum status_code _tcc_build_waves(const uint8_t module_index, const struct tcc_config *const config, uint32_t *value_buffer) | /* Build WAVE & WAVEB register values from configuration. */
static enum status_code _tcc_build_waves(const uint8_t module_index, const struct tcc_config *const config, uint32_t *value_buffer) | {
int n;
uint8_t cc_num = _tcc_cc_nums[module_index];
struct tcc_match_wave_config const *wav_cfg = &config->compare;
uint32_t wave;
wave = TCC_WAVE_RAMP(wav_cfg->wave_ramp) |
TCC_WAVE_WAVEGEN(wav_cfg->wave_generation);
for (n = 0; n < TCC_NUM_CHANNELS; n++) {
if (wav_cfg->wave_polarity[n]) {
if (n >= cc_... | memfault/zero-to-main | C++ | null | 200 |
/* Information regarding the number of caches and their sizes, frequency of operation, slot numbers is all considered platform-related information and is not provided by this service. */ | EFI_STATUS EFIAPI CpuMpServicesGetProcessorInfo(IN EFI_MP_SERVICES_PROTOCOL *This, IN UINTN ProcessorNumber, OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer) | /* Information regarding the number of caches and their sizes, frequency of operation, slot numbers is all considered platform-related information and is not provided by this service. */
EFI_STATUS EFIAPI CpuMpServicesGetProcessorInfo(IN EFI_MP_SERVICES_PROTOCOL *This, IN UINTN ProcessorNumber, OUT EFI_PROCESSOR_INFORM... | {
if (ProcessorInfoBuffer == NULL) {
return EFI_INVALID_PARAMETER;
}
if (!IsBSP ()) {
return EFI_DEVICE_ERROR;
}
if (ProcessorNumber >= gMPSystem.NumberOfProcessors) {
return EFI_NOT_FOUND;
}
CopyMem (ProcessorInfoBuffer, &gMPSystem.ProcessorData[ProcessorNumber], sizeof (EFI_PROCESSOR_INFORMA... | tianocore/edk2 | C++ | Other | 4,240 |
/* Sync internal data structures on xenstore updates. Node specifies the changed field. node = NULL means update all fields (used for initialization). */ | static void xen_be_backend_changed(struct XenDevice *xendev, const char *node) | /* Sync internal data structures on xenstore updates. Node specifies the changed field. node = NULL means update all fields (used for initialization). */
static void xen_be_backend_changed(struct XenDevice *xendev, const char *node) | {
if (node == NULL || strcmp(node, "online") == 0) {
if (xenstore_read_be_int(xendev, "online", &xendev->online) == -1) {
xendev->online = 0;
}
}
if (node) {
xen_be_printf(xendev, 2, "backend update: %s\n", node);
if (xendev->ops->backend_changed) {
... | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* Find a prescaler/divisor couple to generate the desired ul_frequency from ul_mck. */ | static uint32_t pwm_clocks_generate(uint32_t ul_frequency, uint32_t ul_mck) | /* Find a prescaler/divisor couple to generate the desired ul_frequency from ul_mck. */
static uint32_t pwm_clocks_generate(uint32_t ul_frequency, uint32_t ul_mck) | {
uint32_t ul_divisors[PWM_CLOCK_PRE_MAX] =
{1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024 };
uint32_t ul_pre = 0;
uint32_t ul_div;
do {
ul_div = (ul_mck / ul_divisors[ul_pre]) / ul_frequency;
if (ul_div <= PWM_CLOCK_DIV_MAX) {
break;
}
ul_pre++;
} while (ul_pre < PWM_CLOCK_PRE_MAX);
if (ul_pre < PWM_... | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* param handle codec handle. param module audio codec module. param powerOn true is power on, false is power down. return kStatus_Success is success, else configure failed. */ | status_t HAL_CODEC_SetPower(void *handle, uint32_t module, bool powerOn) | /* param handle codec handle. param module audio codec module. param powerOn true is power on, false is power down. return kStatus_Success is success, else configure failed. */
status_t HAL_CODEC_SetPower(void *handle, uint32_t module, bool powerOn) | {
assert(handle != NULL);
if (powerOn)
{
return SGTL_EnableModule((sgtl_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)),
HAL_SGTL_MAP_MODULE(module));
}
else
{
return SGTL_DisableModule((sgtl_handle_t *)((uint32_t)(((codec_hand... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* In both cases we assume, that caller reserved enough room for headers. */ | static void ipv6_push_rthdr(struct sk_buff *skb, u8 *proto, struct ipv6_rt_hdr *opt, struct in6_addr **addr_p) | /* In both cases we assume, that caller reserved enough room for headers. */
static void ipv6_push_rthdr(struct sk_buff *skb, u8 *proto, struct ipv6_rt_hdr *opt, struct in6_addr **addr_p) | {
struct rt0_hdr *phdr, *ihdr;
int hops;
ihdr = (struct rt0_hdr *) opt;
phdr = (struct rt0_hdr *) skb_push(skb, (ihdr->rt_hdr.hdrlen + 1) << 3);
memcpy(phdr, ihdr, sizeof(struct rt0_hdr));
hops = ihdr->rt_hdr.hdrlen >> 1;
if (hops > 1)
memcpy(phdr->addr, ihdr->addr + 1,
(hops - 1) * sizeof(struct in6_... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* param handle eDMA handle pointer. param callback eDMA callback function pointer. param userData A parameter for the callback function. */ | void EDMA_SetCallback(edma_handle_t *handle, edma_callback callback, void *userData) | /* param handle eDMA handle pointer. param callback eDMA callback function pointer. param userData A parameter for the callback function. */
void EDMA_SetCallback(edma_handle_t *handle, edma_callback callback, void *userData) | {
assert(handle != NULL);
handle->callback = callback;
handle->userData = userData;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* 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 |
/* this function will read specified length data from a file descriptor to a buffer. */ | int dfs_file_read(struct dfs_fd *fd, void *buf, size_t len) | /* this function will read specified length data from a file descriptor to a buffer. */
int dfs_file_read(struct dfs_fd *fd, void *buf, size_t len) | {
int result = 0;
if (fd == NULL)
return -EINVAL;
if (fd->fops->read == NULL)
return -ENOSYS;
if ((result = fd->fops->read(fd, buf, len)) < 0)
fd->flags |= DFS_F_EOF;
return result;
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* This function dumps the ACPI table to a file. */ | STATIC BOOLEAN DumpAcpiTableToFile(IN CONST UINT8 *Ptr, IN CONST UINTN Length) | /* This function dumps the ACPI table to a file. */
STATIC BOOLEAN DumpAcpiTableToFile(IN CONST UINT8 *Ptr, IN CONST UINTN Length) | {
CHAR16 FileNameBuffer[MAX_FILE_NAME_LEN];
UINTN TransferBytes;
SELECTED_ACPI_TABLE *SelectedTable;
GetSelectedAcpiTable (&SelectedTable);
UnicodeSPrint (
FileNameBuffer,
sizeof (FileNameBuffer),
L".\\%s%04d.bin",
SelectedTable->Name,
mBinTableCount++
);
... | tianocore/edk2 | C++ | Other | 4,240 |
/* This API reads the FIFO configuration from the sensor. */ | uint16_t bma4_get_fifo_config(uint8_t *fifo_config, struct bma4_dev *dev) | /* This API reads the FIFO configuration from the sensor. */
uint16_t bma4_get_fifo_config(uint8_t *fifo_config, struct bma4_dev *dev) | {
uint16_t rslt = 0;
uint8_t data[2] = {0, 0};
if (dev == NULL) {
rslt |= BMA4_E_NULL_PTR;
} else {
rslt |= bma4_read_regs(BMA4_FIFO_CONFIG_0_ADDR, data, BMA4_FIFO_CONFIG_LENGTH, dev);
if (rslt == BMA4_OK)
*fifo_config = ((uint8_t)((data[0] & BMA4_FIFO_CONFIG_0_MASK) ... | arendst/Tasmota | C++ | GNU General Public License v3.0 | 21,318 |
/* This function searches in this TLV data chunk for a given TLV type and returns a pointer to the first data byte of the TLV, or to NULL if the TLV hasn't been found. */ | static void* lbs_tlv_find(uint16_t tlv_type, const uint8_t *tlv, uint16_t size) | /* This function searches in this TLV data chunk for a given TLV type and returns a pointer to the first data byte of the TLV, or to NULL if the TLV hasn't been found. */
static void* lbs_tlv_find(uint16_t tlv_type, const uint8_t *tlv, uint16_t size) | {
struct mrvl_ie_header *tlv_h;
uint16_t length;
ssize_t pos = 0;
while (pos < size) {
tlv_h = (struct mrvl_ie_header *) tlv;
if (!tlv_h->len)
return NULL;
if (tlv_h->type == cpu_to_le16(tlv_type))
return tlv_h;
length = le16_to_cpu(tlv_h->len) + sizeof(*tlv_h);
pos += length;
tlv += length;
}
r... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns: TRUE if the two strings are identical or equivalent, FALSE otherwise. */ | gboolean g_content_type_equals(const gchar *type1, const gchar *type2) | /* Returns: TRUE if the two strings are identical or equivalent, FALSE otherwise. */
gboolean g_content_type_equals(const gchar *type1, const gchar *type2) | {
gboolean res;
g_return_val_if_fail (type1 != NULL, FALSE);
g_return_val_if_fail (type2 != NULL, FALSE);
G_LOCK (gio_xdgmime);
res = xdg_mime_mime_type_equal (type1, type2);
G_UNLOCK (gio_xdgmime);
return res;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Produce a mtd_info given a type and num. */ | static int get_mtd_info(u8 type, u8 num, struct mtd_info **mtd) | /* Produce a mtd_info given a type and num. */
static int get_mtd_info(u8 type, u8 num, struct mtd_info **mtd) | {
char mtd_dev[16];
sprintf(mtd_dev, "%s%d", MTD_DEV_TYPE(type), num);
*mtd = get_mtd_device_nm(mtd_dev);
if (IS_ERR(*mtd)) {
printf("Device %s not found!\n", mtd_dev);
return 1;
}
put_mtd_device(*mtd);
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* strcspn - Calculate the length of the initial substring of @s which does not contain letters in @reject @s: The string to be searched @reject: The string to avoid */ | size_t strcspn(const char *s, const char *reject) | /* strcspn - Calculate the length of the initial substring of @s which does not contain letters in @reject @s: The string to be searched @reject: The string to avoid */
size_t strcspn(const char *s, const char *reject) | {
const char *p;
const char *r;
size_t count = 0;
for (p = s; *p != '\0'; ++p) {
for (r = reject; *r != '\0'; ++r) {
if (*p == *r)
return count;
}
++count;
}
return count;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Callback function which provided by user to remove one node in NetDestroyLinkList process. */ | EFI_STATUS EFIAPI Ip4DestroyChildEntryInHandleBuffer(IN LIST_ENTRY *Entry, IN VOID *Context) | /* Callback function which provided by user to remove one node in NetDestroyLinkList process. */
EFI_STATUS EFIAPI Ip4DestroyChildEntryInHandleBuffer(IN LIST_ENTRY *Entry, IN VOID *Context) | {
IP4_PROTOCOL *IpInstance;
EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding;
UINTN NumberOfChildren;
EFI_HANDLE *ChildHandleBuffer;
if ((Entry == NULL) || (Context == NULL)) {
return EFI_INVALID_PARAMETER;
}
IpInstance = NET_LIST_USER_ST... | tianocore/edk2 | C++ | Other | 4,240 |
/* TIM_Base MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim_base) | /* TIM_Base MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim_base) | {
if(htim_base->Instance==TIM10)
{
__HAL_RCC_TIM10_CLK_DISABLE();
}
else if(htim_base->Instance==TIM11)
{
__HAL_RCC_TIM11_CLK_DISABLE();
}
else if(htim_base->Instance==TIM13)
{
__HAL_RCC_TIM13_CLK_DISABLE();
}
else if(htim_base->Instance==TIM14)
{
__HAL_RCC_TIM14_CLK_DISABLE();
}... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* If 8-bit I/O port operations are not supported, then ASSERT(). */ | UINT8 EFIAPI S3IoOr8(IN UINTN Port, IN UINT8 OrData) | /* If 8-bit I/O port operations are not supported, then ASSERT(). */
UINT8 EFIAPI S3IoOr8(IN UINTN Port, IN UINT8 OrData) | {
return InternalSaveIoWrite8ValueToBootScript (Port, IoOr8 (Port, OrData));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Converts a text device path node to firmware volume device path structure. */ | EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextFv(IN CHAR16 *TextDeviceNode) | /* Converts a text device path node to firmware volume device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextFv(IN CHAR16 *TextDeviceNode) | {
CHAR16 *GuidStr;
MEDIA_FW_VOL_DEVICE_PATH *Fv;
GuidStr = GetNextParamStr (&TextDeviceNode);
Fv = (MEDIA_FW_VOL_DEVICE_PATH *)CreateDeviceNode (
MEDIA_DEVICE_PATH,
MEDIA_PIWG_FW_VOL_DP,
... | tianocore/edk2 | C++ | Other | 4,240 |
/* Returns information about the regular expression syntax types supported by the implementation. */ | EFI_STATUS EFIAPI RegularExpressionGetInfo(IN EFI_REGULAR_EXPRESSION_PROTOCOL *This, IN OUT UINTN *RegExSyntaxTypeListSize, OUT EFI_REGEX_SYNTAX_TYPE *RegExSyntaxTypeList) | /* Returns information about the regular expression syntax types supported by the implementation. */
EFI_STATUS EFIAPI RegularExpressionGetInfo(IN EFI_REGULAR_EXPRESSION_PROTOCOL *This, IN OUT UINTN *RegExSyntaxTypeListSize, OUT EFI_REGEX_SYNTAX_TYPE *RegExSyntaxTypeList) | {
UINTN SyntaxSize;
UINTN Index;
if ((This == NULL) || (RegExSyntaxTypeListSize == NULL)) {
return EFI_INVALID_PARAMETER;
}
if ((*RegExSyntaxTypeListSize != 0) && (RegExSyntaxTypeList == NULL)) {
return EFI_INVALID_PARAMETER;
}
SyntaxSize = ARRAY_SIZE (mSupportedSyntaxes) * sizeof (**mSupportedS... | tianocore/edk2 | C++ | Other | 4,240 |
/* Allocates a dtr from the reserve array. If the reserve array is empty, it swaps the reserve and free arrays. */ | enum vxge_hw_status vxge_hw_channel_dtr_alloc(struct __vxge_hw_channel *channel, void **dtrh) | /* Allocates a dtr from the reserve array. If the reserve array is empty, it swaps the reserve and free arrays. */
enum vxge_hw_status vxge_hw_channel_dtr_alloc(struct __vxge_hw_channel *channel, void **dtrh) | {
void **tmp_arr;
if (channel->reserve_ptr - channel->reserve_top > 0) {
_alloc_after_swap:
*dtrh = channel->reserve_arr[--channel->reserve_ptr];
return VXGE_HW_OK;
}
if (channel->length - channel->free_ptr > 0) {
tmp_arr = channel->reserve_arr;
channel->reserve_arr = channel->free_arr;
channel->free_arr ... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Deinitializes the EXTI peripheral registers to their default reset values. */ | void EXTI_DeInit(void) | /* Deinitializes the EXTI peripheral registers to their default reset values. */
void EXTI_DeInit(void) | {
EXTI->IMR = 0x00000000;
EXTI->EMR = 0x00000000;
EXTI->RTSR = 0x00000000;
EXTI->FTSR = 0x00000000;
EXTI->PR = 0x007FFFFF;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Transition the entire system into a new APM power state. */ | static int set_system_power_state(u_short state) | /* Transition the entire system into a new APM power state. */
static int set_system_power_state(u_short state) | {
return set_power_state(APM_DEVICE_ALL, state);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If 16-bit I/O port operations are not supported, then ASSERT(). */ | UINT16 EFIAPI IoRead16(IN UINTN Port) | /* If 16-bit I/O port operations are not supported, then ASSERT(). */
UINT16 EFIAPI IoRead16(IN UINTN Port) | {
ASSERT ((Port & 1) == 0);
return (UINT16)IoReadWorker (Port, EfiCpuIoWidthUint16);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This call is similar to hwconfig_arg(), except that it takes an additional argument @subopt, and so works with sub-options. */ | const char* hwconfig_subarg(const char *opt, const char *subopt, size_t *subarglen) | /* This call is similar to hwconfig_arg(), except that it takes an additional argument @subopt, and so works with sub-options. */
const char* hwconfig_subarg(const char *opt, const char *subopt, size_t *subarglen) | {
size_t arglen;
const char *arg;
arg = __hwconfig(opt, &arglen);
if (!arg)
return NULL;
return hwconfig_parse(arg, arglen, subopt, ',', '=', subarglen);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Configure serial Console.
GLCK for SERCOM -> GCLK_GENERATOR_0 (8MHz) SERCOM instance -> 3 TXD -> PA22 RXD -> PA23 BAUDRATE -> 115200 STOP BIT -> 1 CHARACTER -> 8 PARITY -> NONE */ | void configure_console(void) | /* Configure serial Console.
GLCK for SERCOM -> GCLK_GENERATOR_0 (8MHz) SERCOM instance -> 3 TXD -> PA22 RXD -> PA23 BAUDRATE -> 115200 STOP BIT -> 1 CHARACTER -> 8 PARITY -> NONE */
void configure_console(void) | {
struct usart_config conf_usart;
usart_get_config_defaults(&conf_usart);
conf_usart.baudrate = 115200;
conf_usart.mux_setting = EDBG_CDC_SERCOM_MUX_SETTING;
conf_usart.pinmux_pad0 = EDBG_CDC_SERCOM_PINMUX_PAD0;
conf_usart.pinmux_pad1 = EDBG_CDC_SERCOM_PINMUX_PAD1;
conf_usart.pinmux_pad2 = EDBG_CDC_SERCOM_PINMUX... | memfault/zero-to-main | C++ | null | 200 |
/* 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==SPI5)
{
__HAL_RCC_SPI5_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOF, SPI5_SCK_Pin|SPI5_MISO_Pin|SPI5_MOSI_Pin);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Allocate a circular buffer and all associated memory. */ | static struct circ_buf* serial_buf_alloc(void) | /* Allocate a circular buffer and all associated memory. */
static struct circ_buf* serial_buf_alloc(void) | {
struct circ_buf *cb;
cb = kmalloc(sizeof(struct circ_buf), GFP_KERNEL);
if (cb == NULL)
return NULL;
cb->buf = kmalloc(AIRCABLE_BUF_SIZE, GFP_KERNEL);
if (cb->buf == NULL) {
kfree(cb);
return NULL;
}
serial_buf_clear(cb);
return cb;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enable the main oscillator.
Clears the MOSCDIS bit in SYSCTL_RCC, enabling the main oscillator. */ | void rcc_enable_main_osc(void) | /* Enable the main oscillator.
Clears the MOSCDIS bit in SYSCTL_RCC, enabling the main oscillator. */
void rcc_enable_main_osc(void) | {
SYSCTL_RCC &= ~SYSCTL_RCC_MOSCDIS;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* @drv: Legacy block driver @devnum: Device number (0 = first) @descp: Returns block device descriptor on success */ | static int get_desc(struct blk_driver *drv, int devnum, struct blk_desc **descp) | /* @drv: Legacy block driver @devnum: Device number (0 = first) @descp: Returns block device descriptor on success */
static int get_desc(struct blk_driver *drv, int devnum, struct blk_desc **descp) | {
if (drv->desc) {
if (devnum < 0 || devnum >= drv->max_devs)
return -ENODEV;
*descp = &drv->desc[devnum];
return 0;
}
if (!drv->get_dev)
return -ENOSYS;
return drv->get_dev(devnum, descp);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Special handler for fault exception. Rip/Eip in SystemContext will be modified to the instruction after the exception instruction. */ | VOID EFIAPI AdjustRipForFaultHandler(IN EFI_EXCEPTION_TYPE ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext) | /* Special handler for fault exception. Rip/Eip in SystemContext will be modified to the instruction after the exception instruction. */
VOID EFIAPI AdjustRipForFaultHandler(IN EFI_EXCEPTION_TYPE ExceptionType, IN EFI_SYSTEM_CONTEXT SystemContext) | {
mExceptionType = ExceptionType;
SystemContext.SystemContextIa32->Eip += mFaultInstructionLength;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Uses a critical section to determine if there is any data in a queue. */ | static BaseType_t prvIsQueueEmpty(const Queue_t *pxQueue) PRIVILEGED_FUNCTION | /* Uses a critical section to determine if there is any data in a queue. */
static BaseType_t prvIsQueueEmpty(const Queue_t *pxQueue) PRIVILEGED_FUNCTION | {
BaseType_t xReturn;
taskENTER_CRITICAL();
{
if( pxQueue->uxMessagesWaiting == ( UBaseType_t ) 0 )
{
xReturn = pdTRUE;
}
else
{
xReturn = pdFALSE;
}
}
taskEXIT_CRITICAL();
return xReturn;
} | ua1arn/hftrx | C++ | null | 69 |
/* Fixup internal data so that EFI can be called in virtual mode. Call the passed in Child Notify event and convert any pointers in lib to virtual mode. */ | STATIC VOID EFIAPI VirtualNotifyEvent(IN EFI_EVENT Event, IN VOID *Context) | /* Fixup internal data so that EFI can be called in virtual mode. Call the passed in Child Notify event and convert any pointers in lib to virtual mode. */
STATIC VOID EFIAPI VirtualNotifyEvent(IN EFI_EVENT Event, IN VOID *Context) | {
EfiConvertPointer (0x0, (VOID **)&mRtcIndexRegister);
EfiConvertPointer (0x0, (VOID **)&mRtcTargetRegister);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Reset the timer by placing the timer back into it's default reset configuration. */ | void TimerReset(void) | /* Reset the timer by placing the timer back into it's default reset configuration. */
void TimerReset(void) | {
S32_SysTick->CSR = 0;
S32_SysTick->RVR = 0;
S32_SysTick->CVR = 0;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* This is where hid.c calls into hiddev to pass an event that occurred over the interrupt pipe */ | void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value) | /* This is where hid.c calls into hiddev to pass an event that occurred over the interrupt pipe */
void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value) | {
unsigned type = field->report_type;
struct hiddev_usage_ref uref;
uref.report_type =
(type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT :
((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT :
((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE : 0));
uref.report_id = field->report->id;
uref.field... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Read bytes from the Frequency EEprom (frequency select cards). */ | static void fee_read(u_long base, u_short o, u_short *b, int n) | /* Read bytes from the Frequency EEprom (frequency select cards). */
static void fee_read(u_long base, u_short o, u_short *b, int n) | {
b += n;
mmc_out(base, mmwoff(0, mmw_fee_addr), o + n - 1);
while(n-- > 0)
{
mmc_out(base, mmwoff(0, mmw_fee_ctrl), MMW_FEE_CTRL_READ);
fee_wait(base, 10, 100);
*--b = ((mmc_in(base, mmroff(0, mmr_fee_data_h)) << 8) |
mmc_in(base, mmroff(0, mmr_fee_data_l)));
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Sets the system to sleep into the lowest possible energy mode.
This function takes care of the system states protected by the sleep block provided by */ | SLEEP_EnergyMode_t SLEEP_Sleep(void) | /* Sets the system to sleep into the lowest possible energy mode.
This function takes care of the system states protected by the sleep block provided by */
SLEEP_EnergyMode_t SLEEP_Sleep(void) | {
CORE_DECLARE_IRQ_STATE;
SLEEP_EnergyMode_t allowedEM;
CORE_ENTER_CRITICAL();
allowedEM = SLEEP_LowestEnergyModeGet();
if ((allowedEM >= sleepEM1) && (allowedEM <= sleepEM3))
{
enterEMx(allowedEM);
}
else
{
allowedEM = sleepEM0;
}
CORE_EXIT_CRITICAL();
return allowedEM;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Return a pointer to a free buffer within xEthernetBuffers. */ | static unsigned char * prvGetNextBuffer(void) | /* Return a pointer to a free buffer within xEthernetBuffers. */
static unsigned char * prvGetNextBuffer(void) | {
long x;
unsigned char *pucReturn = NULL;
unsigned long ulAttempts = 0;
while( pucReturn == NULL )
{
for( x = 0; x < emacNUM_BUFFERS; x++ )
{
if( ucBufferInUse[ x ] == pdFALSE )
{
ucBufferInUse[ x ] = pdTRUE;
pucReturn = ( unsigned char * ) &( xEthernetBuffers.cBuffer[ x ][ 0 ] );
break;
}
... | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Description: Free all bios in @rq for a cloned request. */ | void blk_rq_unprep_clone(struct request *rq) | /* Description: Free all bios in @rq for a cloned request. */
void blk_rq_unprep_clone(struct request *rq) | {
struct bio *bio;
while ((bio = rq->bio) != NULL) {
rq->bio = bio->bi_next;
bio_put(bio);
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* 8.33 Paging Cause 8.33 Void (TS 129 274 V9.4.0 (2010-10)) */ | static void dissect_gtpv2_pti(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_, session_args_t *args _U_) | /* 8.33 Paging Cause 8.33 Void (TS 129 274 V9.4.0 (2010-10)) */
static void dissect_gtpv2_pti(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, proto_item *item _U_, guint16 length _U_, guint8 message_type _U_, guint8 instance _U_, session_args_t *args _U_) | {
proto_tree_add_item(tree, hf_gtpv2_pti, tvb, 0, 1, ENC_BIG_ENDIAN);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Checks whether the descriptor is owned by DMA. If descriptor is owned by DMA then the OWN bit is set to 1. This API is same for both ring and chain mode. */ | bool synopGMAC_is_desc_owned_by_dma(DmaDesc *desc) | /* Checks whether the descriptor is owned by DMA. If descriptor is owned by DMA then the OWN bit is set to 1. This API is same for both ring and chain mode. */
bool synopGMAC_is_desc_owned_by_dma(DmaDesc *desc) | {
return ((desc -> status & DescOwnByDma) == DescOwnByDma);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* lc_destroy - frees memory allocated by lc_create() @lc: the lru cache to destroy */ | void lc_destroy(struct lru_cache *lc) | /* lc_destroy - frees memory allocated by lc_create() @lc: the lru cache to destroy */
void lc_destroy(struct lru_cache *lc) | {
unsigned i;
if (!lc)
return;
for (i = 0; i < lc->nr_elements; i++)
lc_free_by_index(lc, i);
kfree(lc->lc_element);
kfree(lc->lc_slot);
kfree(lc);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.