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 |
|---|---|---|---|---|---|---|---|
/* Configure the internal OSC8M oscillator clock source.
Configures the 8MHz (nominal) internal RC oscillator with the given configuration settings. */ | void system_clock_source_osc8m_set_config(struct system_clock_source_osc8m_config *const config) | /* Configure the internal OSC8M oscillator clock source.
Configures the 8MHz (nominal) internal RC oscillator with the given configuration settings. */
void system_clock_source_osc8m_set_config(struct system_clock_source_osc8m_config *const config) | {
SYSCTRL_OSC8M_Type temp = SYSCTRL->OSC8M;
temp.bit.PRESC = config->prescaler;
temp.bit.ONDEMAND = config->on_demand;
temp.bit.RUNSTDBY = config->run_in_standby;
SYSCTRL->OSC8M = temp;
} | memfault/zero-to-main | C++ | null | 200 |
/* Write data into transmit FIFO to send data out. */ | void SCUART_Write(SC_T *sc, uint8_t pu8TxBuf[], uint32_t u32WriteBytes) | /* Write data into transmit FIFO to send data out. */
void SCUART_Write(SC_T *sc, uint8_t pu8TxBuf[], uint32_t u32WriteBytes) | {
uint32_t u32Count;
for(u32Count = 0UL; u32Count != u32WriteBytes; u32Count++)
{
while(SCUART_GET_TX_FULL(sc) == SC_STATUS_TXFULL_Msk) {}
sc->DAT = pu8TxBuf[u32Count];
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This service enables the sending of commands to the TPM2. */ | EFI_STATUS EFIAPI Tpm2SubmitCommand(IN UINT32 InputParameterBlockSize, IN UINT8 *InputParameterBlock, IN OUT UINT32 *OutputParameterBlockSize, IN UINT8 *OutputParameterBlock) | /* This service enables the sending of commands to the TPM2. */
EFI_STATUS EFIAPI Tpm2SubmitCommand(IN UINT32 InputParameterBlockSize, IN UINT8 *InputParameterBlock, IN OUT UINT32 *OutputParameterBlockSize, IN UINT8 *OutputParameterBlock) | {
if (mInternalTpm2DeviceInterface.Tpm2SubmitCommand == NULL) {
return EFI_UNSUPPORTED;
}
return mInternalTpm2DeviceInterface.Tpm2SubmitCommand (
InputParameterBlockSize,
InputParameterBlock,
... | tianocore/edk2 | C++ | Other | 4,240 |
/* Set the dividers for the PLLSAI clock outputs divider p is only available on F4x9 parts, pass 0 for other parts. */ | void rcc_pllsai_config(uint16_t n, uint16_t p, uint16_t q, uint16_t r) | /* Set the dividers for the PLLSAI clock outputs divider p is only available on F4x9 parts, pass 0 for other parts. */
void rcc_pllsai_config(uint16_t n, uint16_t p, uint16_t q, uint16_t r) | {
RCC_PLLSAICFGR = (
((n & RCC_PLLSAICFGR_PLLSAIN_MASK) << RCC_PLLSAICFGR_PLLSAIN_SHIFT) |
((p & RCC_PLLSAICFGR_PLLSAIP_MASK) << RCC_PLLSAICFGR_PLLSAIP_SHIFT) |
((q & RCC_PLLSAICFGR_PLLSAIQ_MASK) << RCC_PLLSAICFGR_PLLSAIQ_SHIFT) |
((r & RCC_PLLSAICFGR_PLLSAIR_MASK) << RCC_PLLSAICFGR_PLLSAIR_SHIFT));
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* @msg: Pointer to a message created with wimax_msg_alloc() */ | ssize_t wimax_msg_len(struct sk_buff *msg) | /* @msg: Pointer to a message created with wimax_msg_alloc() */
ssize_t wimax_msg_len(struct sk_buff *msg) | {
struct nlmsghdr *nlh = (void *) msg->head;
struct nlattr *nla;
nla = nlmsg_find_attr(nlh, sizeof(struct genlmsghdr),
WIMAX_GNL_MSG_DATA);
if (nla == NULL) {
printk(KERN_ERR "Cannot find attribute WIMAX_GNL_MSG_DATA\n");
return -EINVAL;
}
return nla_len(nla);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* RETURNS: Number of completed commands on success, -errno otherwise. */ | int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active) | /* RETURNS: Number of completed commands on success, -errno otherwise. */
int ata_qc_complete_multiple(struct ata_port *ap, u32 qc_active) | {
int nr_done = 0;
u32 done_mask;
done_mask = ap->qc_active ^ qc_active;
if (unlikely(done_mask & qc_active)) {
ata_port_printk(ap, KERN_ERR, "illegal qc_active transition "
"(%08x->%08x)\n", ap->qc_active, qc_active);
return -EINVAL;
}
while (done_mask) {
struct ata_queued_cmd *qc;
unsigned int tag =... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Calls a read-long-characteristic proc's callback with the specified parameters. If the proc has no callback, this function is a no-op. */ | static int ble_gattc_read_long_cb(struct ble_gattc_proc *proc, int status, uint16_t att_handle, struct ble_gatt_attr *attr) | /* Calls a read-long-characteristic proc's callback with the specified parameters. If the proc has no callback, this function is a no-op. */
static int ble_gattc_read_long_cb(struct ble_gattc_proc *proc, int status, uint16_t att_handle, struct ble_gatt_attr *attr) | {
int rc;
BLE_HS_DBG_ASSERT(!ble_hs_locked_by_cur_task());
BLE_HS_DBG_ASSERT(attr != NULL || status != 0);
ble_gattc_dbg_assert_proc_not_inserted(proc);
if (status != 0 && status != BLE_HS_EDONE) {
STATS_INC(ble_gattc_stats, read_long_fail);
}
if (proc->read_long.cb == NULL) {
... | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* Selects the data transfer direction in bi-directional mode. */ | void SPI_BiDirectionalLineConfig(SPI_TypeDef *SPIx, SPI_Direction_TypeDef SPI_Direction) | /* Selects the data transfer direction in bi-directional mode. */
void SPI_BiDirectionalLineConfig(SPI_TypeDef *SPIx, SPI_Direction_TypeDef SPI_Direction) | {
assert_param(IS_SPI_DIRECTION(SPI_Direction));
if (SPI_Direction != SPI_Direction_Rx)
{
SPIx->CR2 |= SPI_CR2_BDOE;
}
else
{
SPIx->CR2 &= (uint8_t)(~SPI_CR2_BDOE);
}
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* For 32 bit architectures, we use the pointer itself; for 64 bits, a 32-bit hash of the pointer. */ | static struct wa_xfer* wa_xfer_get_by_id(struct wahc *wa, u32 id) | /* For 32 bit architectures, we use the pointer itself; for 64 bits, a 32-bit hash of the pointer. */
static struct wa_xfer* wa_xfer_get_by_id(struct wahc *wa, u32 id) | {
unsigned long flags;
struct wa_xfer *xfer_itr;
spin_lock_irqsave(&wa->xfer_list_lock, flags);
list_for_each_entry(xfer_itr, &wa->xfer_list, list_node) {
if (id == xfer_itr->id) {
wa_xfer_get(xfer_itr);
goto out;
}
}
xfer_itr = NULL;
out:
spin_unlock_irqrestore(&wa->xfer_list_lock, flags);
return xfe... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* move request from sort list to dispatch queue. */ | static void deadline_move_to_dispatch(struct deadline_data *dd, struct request *rq) | /* move request from sort list to dispatch queue. */
static void deadline_move_to_dispatch(struct deadline_data *dd, struct request *rq) | {
struct request_queue *q = rq->q;
deadline_remove_request(q, rq);
elv_dispatch_add_tail(q, rq);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* mangle_path - mangle and copy path to buffer beginning @s: buffer start */ | char* mangle_path(char *s, char *p, char *esc) | /* mangle_path - mangle and copy path to buffer beginning @s: buffer start */
char* mangle_path(char *s, char *p, char *esc) | {
while (s <= p) {
char c = *p++;
if (!c) {
return s;
} else if (!strchr(esc, c)) {
*s++ = c;
} else if (s + 4 > p) {
break;
} else {
*s++ = '\\';
*s++ = '0' + ((c & 0300) >> 6);
*s++ = '0' + ((c & 070) >> 3);
*s++ = '0' + (c & 07);
}
}
return NULL;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The node is not changed if it (or its first child) is not an opaque node. */ | int mxmlSetOpaque(mxml_node_t *node, const char *opaque) | /* The node is not changed if it (or its first child) is not an opaque node. */
int mxmlSetOpaque(mxml_node_t *node, const char *opaque) | {
if (node && node->type == MXML_ELEMENT &&
node->child && node->child->type == MXML_OPAQUE)
node = node->child;
if (!node || node->type != MXML_OPAQUE || !opaque)
return (-1);
if (node->value.opaque)
free(node->value.opaque);
node->value.opaque = strdup(opaque);
return (0);
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* Return Value: TRUE if succeeded; FALSE if failed. */ | BOOL RFbSelectChannel(DWORD_PTR dwIoBase, BYTE byRFType, BYTE byChannel) | /* Return Value: TRUE if succeeded; FALSE if failed. */
BOOL RFbSelectChannel(DWORD_PTR dwIoBase, BYTE byRFType, BYTE byChannel) | {
BOOL bResult = TRUE;
switch (byRFType) {
case RF_AIROHA :
case RF_AL2230S:
bResult = RFbAL2230SelectChannel(dwIoBase, byChannel);
break;
case RF_AIROHA7230 :
bResult = s_bAL7230SelectChannel(dwIoBase, byChannel);
break;
case RF_NOT... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Some USBAT-specific commands can only be executed over a command transport This transport allows one (len=8) or two (len=16) vendor-specific commands to be executed. */ | static int usbat_execute_command(struct us_data *us, unsigned char *commands, unsigned int len) | /* Some USBAT-specific commands can only be executed over a command transport This transport allows one (len=8) or two (len=16) vendor-specific commands to be executed. */
static int usbat_execute_command(struct us_data *us, unsigned char *commands, unsigned int len) | {
return usb_stor_ctrl_transfer(us, us->send_ctrl_pipe,
USBAT_CMD_EXEC_CMD, 0x40, 0, 0,
commands, len);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Initialize the 2.4GHz Radio Frequency SW-controlled Switch.
The Re-Mote features an on-board RF switch to programatically select to enable either the internal ceramic antenna, or an external antenna over an uFL connector. As default we prefer to use the internal one. */ | static void rf_switch_init(void) | /* Initialize the 2.4GHz Radio Frequency SW-controlled Switch.
The Re-Mote features an on-board RF switch to programatically select to enable either the internal ceramic antenna, or an external antenna over an uFL connector. As default we prefer to use the internal one. */
static void rf_switch_init(void) | {
RF_SWITCH_PORT->AFSEL &= ~(1 << RF_SWITCH_PIN);
RF_SWITCH_PORT->DIR |= (1 << RF_SWITCH_PIN);
IOC->PC_OVER[RF_SWITCH_PIN] = IOC_OVERRIDE_OE;
RF_SWITCH_INTERNAL;
} | labapart/polymcu | C++ | null | 201 |
/* Reads the PHY register at offset using the kumeran interface. The information retrieved is stored in data. Assumes semaphore already acquired. */ | s32 e1000e_read_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 *data) | /* Reads the PHY register at offset using the kumeran interface. The information retrieved is stored in data. Assumes semaphore already acquired. */
s32 e1000e_read_kmrn_reg_locked(struct e1000_hw *hw, u32 offset, u16 *data) | {
return __e1000_read_kmrn_reg(hw, offset, data, true);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Create a menu with specified formset GUID and form ID, and add it as a child of the given parent menu. */ | FORM_ENTRY_INFO* UiAddMenuList(IN EFI_HII_HANDLE HiiHandle, IN EFI_GUID *FormSetGuid, IN UINT16 FormId, IN UINT16 QuestionId) | /* Create a menu with specified formset GUID and form ID, and add it as a child of the given parent menu. */
FORM_ENTRY_INFO* UiAddMenuList(IN EFI_HII_HANDLE HiiHandle, IN EFI_GUID *FormSetGuid, IN UINT16 FormId, IN UINT16 QuestionId) | {
FORM_ENTRY_INFO *MenuList;
MenuList = AllocateZeroPool (sizeof (FORM_ENTRY_INFO));
if (MenuList == NULL) {
return NULL;
}
MenuList->Signature = FORM_ENTRY_INFO_SIGNATURE;
MenuList->HiiHandle = HiiHandle;
CopyMem (&MenuList->FormSetGuid, FormSetGuid, sizeof (EFI_GUID));
MenuList->FormId = Form... | tianocore/edk2 | C++ | Other | 4,240 |
/* usleep_range - Drop in replacement for udelay where wakeup is flexible @min: Minimum time in usecs to sleep @max: Maximum time in usecs to sleep */ | void usleep_range(unsigned long min, unsigned long max) | /* usleep_range - Drop in replacement for udelay where wakeup is flexible @min: Minimum time in usecs to sleep @max: Maximum time in usecs to sleep */
void usleep_range(unsigned long min, unsigned long max) | {
__set_current_state(TASK_UNINTERRUPTIBLE);
do_usleep_range(min, max);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Sets the specified data holding register value for dual channel DAC. */ | void DAC_ConfigDualChannelData(DAC_DATA_ALIGN_T dataAlign, uint16_t data2, uint16_t data1) | /* Sets the specified data holding register value for dual channel DAC. */
void DAC_ConfigDualChannelData(DAC_DATA_ALIGN_T dataAlign, uint16_t data2, uint16_t data1) | {
uint32_t data = 0, tmp = 0;
if (dataAlign == DAC_ALIGN_8B_R)
{
data = ((uint32_t)data2 << 8) | data1;
}
else
{
data = ((uint32_t)data2 << 16) | data1;
}
tmp = (uint32_t)DAC_BASE;
tmp += DH12RD_OFFSET + dataAlign;
*(__IO uint32_t*)tmp = data;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* set up the GDB stub serial port baud rate timers */ | void gdbstub_set_baud(unsigned baud) | /* set up the GDB stub serial port baud rate timers */
void gdbstub_set_baud(unsigned baud) | {
unsigned value, high, low;
u8 lcr;
value = __serial_clock_speed_HZ / 16 / baud;
high = __serial_clock_speed_HZ / 16 / value;
low = __serial_clock_speed_HZ / 16 / (value + 1);
if (low + (high - low) / 2 > baud)
value++;
lcr = __UART(LCR);
__UART(LCR) |= UART_LCR_DLAB;
mb();
__UART(DLL) = value & 0xff;
__U... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* ==> THREAD 0B (IPC instance 0 - endpoint B) <== */ | static void ipc0B_ept_bound(void *priv) | /* ==> THREAD 0B (IPC instance 0 - endpoint B) <== */
static void ipc0B_ept_bound(void *priv) | {
k_sem_give(&ipc0B_bound_sem);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Output a single byte to the serial port. */ | void serial_putc(const char c) | /* Output a single byte to the serial port. */
void serial_putc(const char c) | {
while( !uart->m_stat.bf.txBufEmpty);
uart->m_tx = c;
if (c=='\n')
serial_putc('\r');
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* Resume failed: Print error message and call panic. */ | static void xpram_resume_error(const char *message) | /* Resume failed: Print error message and call panic. */
static void xpram_resume_error(const char *message) | {
pr_err("Resuming the system failed: %s\n", message);
panic("xpram resume error\n");
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function implements the API that's compatible with current GPIO API used in U-Boot. The request is forwarded to particular GPIO driver. Returns 0 on success, negative value on error. */ | int gpio_request(unsigned gpio, const char *label) | /* This function implements the API that's compatible with current GPIO API used in U-Boot. The request is forwarded to particular GPIO driver. Returns 0 on success, negative value on error. */
int gpio_request(unsigned gpio, const char *label) | {
struct gpio_desc desc;
int ret;
ret = gpio_to_device(gpio, &desc);
if (ret)
return ret;
return dm_gpio_request(&desc, label);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Change the I2C address used in communication with the memory. */ | int32_t memory_change_i2c_address(struct memory_desc *dev, uint8_t address) | /* Change the I2C address used in communication with the memory. */
int32_t memory_change_i2c_address(struct memory_desc *dev, uint8_t address) | {
dev->i2c_address = 0x50 | address;
return i2c_set_address(dev->i2c_dev, dev->i2c_address);
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* pos: channel void *buffer: rt_uint32_t pulse size : number of pulse, only set to sizeof(rt_uint32_t). */ | static rt_size_t _pwm_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size) | /* pos: channel void *buffer: rt_uint32_t pulse size : number of pulse, only set to sizeof(rt_uint32_t). */
static rt_size_t _pwm_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size) | {
rt_err_t result = RT_EOK;
struct rt_device_pwm *pwm = (struct rt_device_pwm *)dev;
rt_uint32_t *pulse = (rt_uint32_t *)buffer;
struct rt_pwm_configuration configuration = {0};
configuration.channel = pos;
if (pwm->ops->control)
{
result = pwm->ops->control(pwm, PWM_CMD_GET, &config... | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Returns: the name for the given @volume. The returned string should be freed with g_free() when no longer needed. */ | char* g_volume_get_name(GVolume *volume) | /* Returns: the name for the given @volume. The returned string should be freed with g_free() when no longer needed. */
char* g_volume_get_name(GVolume *volume) | {
GVolumeIface *iface;
g_return_val_if_fail (G_IS_VOLUME (volume), NULL);
iface = G_VOLUME_GET_IFACE (volume);
return (* iface->get_name) (volume);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Returns pointer to "struct tomoyo_path_info" on success, NULL otherwise. */ | static struct tomoyo_path_info* tomoyo_get_path(struct path *path) | /* Returns pointer to "struct tomoyo_path_info" on success, NULL otherwise. */
static struct tomoyo_path_info* tomoyo_get_path(struct path *path) | {
int error;
struct tomoyo_path_info_with_data *buf = tomoyo_alloc(sizeof(*buf));
if (!buf)
return NULL;
error = tomoyo_realpath_from_path2(path, buf->body,
sizeof(buf->body) - 2);
if (!error) {
buf->head.name = buf->body;
tomoyo_fill_path_info(&buf->head);
return &buf->head;
}
tomoyo_free(buf);
... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Writes and returns a new value to DR7. This function is only available on IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. */ | UINTN EFIAPI AsmWriteDr7(IN UINTN Value) | /* Writes and returns a new value to DR7. This function is only available on IA-32 and x64. This writes a 32-bit value on IA-32 and a 64-bit value on x64. */
UINTN EFIAPI AsmWriteDr7(IN UINTN Value) | {
_asm {
mov eax, Value
mov dr7, eax
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Starts the counter. It must be previously configured with hw_counter_set_period() and hw_counter_set_target(). */ | void hw_counter_start(void) | /* Starts the counter. It must be previously configured with hw_counter_set_period() and hw_counter_set_target(). */
void hw_counter_start(void) | {
if (counter_running) {
return;
}
counter_running = true;
hw_counter_timer = hwm_get_time() + counter_period;
hwm_find_next_timer();
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Request a full hardware reset of the chip. This will also reset the radio controller and any other PALs. */ | void wusbhc_reset_all(struct wusbhc *wusbhc) | /* Request a full hardware reset of the chip. This will also reset the radio controller and any other PALs. */
void wusbhc_reset_all(struct wusbhc *wusbhc) | {
uwb_rc_reset_all(wusbhc->uwb_rc);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables or disables access to the Backup domain registers. */ | void PWR_BackupAccessCmd(FunctionalState NewState) | /* Enables or disables access to the Backup domain registers. */
void PWR_BackupAccessCmd(FunctionalState NewState) | {
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
PWR->CR |= PWR_CR_DBP;
}
else
{
PWR->CR &= (uint32_t)~((uint32_t)PWR_CR_DBP);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Sends received pdus to the sap state machine. */ | static void llc_sap_rcv(struct llc_sap *sap, struct sk_buff *skb, struct sock *sk) | /* Sends received pdus to the sap state machine. */
static void llc_sap_rcv(struct llc_sap *sap, struct sk_buff *skb, struct sock *sk) | {
struct llc_sap_state_ev *ev = llc_sap_ev(skb);
ev->type = LLC_SAP_EV_TYPE_PDU;
ev->reason = 0;
skb->sk = sk;
llc_sap_state_process(sap, skb);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Registers an interrupt handler for the I2S controller. */ | void I2SIntRegister(unsigned long ulBase, void(*pfnHandler)(void)) | /* Registers an interrupt handler for the I2S controller. */
void I2SIntRegister(unsigned long ulBase, void(*pfnHandler)(void)) | {
ASSERT(ulBase == I2S0_BASE);
ASSERT(pfnHandler);
IntRegister(INT_I2S0, pfnHandler);
IntEnable(INT_I2S0);
} | watterott/WebRadio | C++ | null | 71 |
/* Return either enabled or raw selected ADC interrupt status. */ | uint32_t am_hal_adc_int_status_get(bool bEnabledOnly) | /* Return either enabled or raw selected ADC interrupt status. */
uint32_t am_hal_adc_int_status_get(bool bEnabledOnly) | {
if (bEnabledOnly)
{
uint32_t u32RetVal = AM_REG(ADC, INTEN);
u32RetVal &= AM_REG(ADC, INTSTAT);
return u32RetVal;
}
else
{
return AM_REG(ADC, INTSTAT);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* If 16-bit MMIO register operations are not supported, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ | UINT16 EFIAPI MmioAndThenOr16(IN UINTN Address, IN UINT16 AndData, IN UINT16 OrData) | /* If 16-bit MMIO register operations are not supported, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI MmioAndThenOr16(IN UINTN Address, IN UINT16 AndData, IN UINT16 OrData) | {
return MmioWrite16 (Address, (UINT16)((MmioRead16 (Address) & AndData) | OrData));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Return the battery Relative State-of-Charge Or < 0 if something fails. */ | static int bq27x00_battery_rsoc(struct bq27x00_device_info *di) | /* Return the battery Relative State-of-Charge Or < 0 if something fails. */
static int bq27x00_battery_rsoc(struct bq27x00_device_info *di) | {
int ret;
int rsoc = 0;
ret = bq27x00_read(BQ27x00_REG_RSOC, &rsoc, 1, di);
if (ret) {
dev_err(di->dev, "error reading relative State-of-Charge\n");
return ret;
}
return rsoc >> 8;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Send data via reliable llc2 connection. Returns 0 upon success, non-zero if action did not succeed. */ | static int llc_ui_send_data(struct sock *sk, struct sk_buff *skb, int noblock) | /* Send data via reliable llc2 connection. Returns 0 upon success, non-zero if action did not succeed. */
static int llc_ui_send_data(struct sock *sk, struct sk_buff *skb, int noblock) | {
struct llc_sock* llc = llc_sk(sk);
int rc = 0;
if (unlikely(llc_data_accept_state(llc->state) ||
llc->remote_busy_flag ||
llc->p_flag)) {
long timeout = sock_sndtimeo(sk, noblock);
rc = llc_ui_wait_for_busy_core(sk, timeout);
}
if (unlikely(!rc))
rc = llc_build_and_send_pkt(sk, skb);
return ... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* param base ADC peripheral base address. param mask Mask value for the cleared flags. See "adc_status_flags_t". */ | void ADC_ClearStatusFlags(ADC_Type *base, uint32_t mask) | /* param base ADC peripheral base address. param mask Mask value for the cleared flags. See "adc_status_flags_t". */
void ADC_ClearStatusFlags(ADC_Type *base, uint32_t mask) | {
uint32_t tmp32 = 0;
if (0U != (mask & kADC_CalibrationFailedFlag))
{
tmp32 |= ADC_GS_CALF_MASK;
}
if (0U != (mask & kADC_ConversionActiveFlag))
{
tmp32 |= ADC_GS_ADACT_MASK;
}
base->GS = tmp32;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Start a clocksource using Timer2 in 32-bit mode */ | static void __init timer_clocksource_init(void) | /* Start a clocksource using Timer2 in 32-bit mode */
static void __init timer_clocksource_init(void) | { MSS_TIMER[1].tim_loadval = 0xFFFFFFFF;
MSS_TIMER[1].tim_ctrl = TIMER_CTRL_ENBL;
clocksource_calc_mult_shift(&timer_2_clocksource, timer_ref_clk, 4);
clocksource_register(&timer_2_clocksource);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Cause a processor trigger for a sample sequence. */ | void xADCProcessorTrigger(unsigned long ulBase) | /* Cause a processor trigger for a sample sequence. */
void xADCProcessorTrigger(unsigned long ulBase) | {
xASSERT(ulBase == ADC0_BASE);
xHWREG(ulBase + ADC_CR) |= ADC_CR_SWTRG;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Resets all MAC subsystem internal registers and logic. */ | void ETH_SoftwareReset(void) | /* Resets all MAC subsystem internal registers and logic. */
void ETH_SoftwareReset(void) | {
ETH->DMABMOD_B.SWR = SET;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* et131x_align_allocated_memory - Align allocated memory on a given boundary @adapter: pointer to our adapter structure @phys_addr: pointer to Physical address @offset: pointer to the offset variable @mask: correct mask */ | void et131x_align_allocated_memory(struct et131x_adapter *adapter, uint64_t *phys_addr, uint64_t *offset, uint64_t mask) | /* et131x_align_allocated_memory - Align allocated memory on a given boundary @adapter: pointer to our adapter structure @phys_addr: pointer to Physical address @offset: pointer to the offset variable @mask: correct mask */
void et131x_align_allocated_memory(struct et131x_adapter *adapter, uint64_t *phys_addr, uint64_... | {
uint64_t new_addr;
*offset = 0;
new_addr = *phys_addr & ~mask;
if (new_addr != *phys_addr) {
new_addr += mask + 1;
*offset = new_addr - *phys_addr;
*phys_addr = new_addr;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ | UINT16 EFIAPI PciExpressOr16(IN UINTN Address, IN UINT16 OrData) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI PciExpressOr16(IN UINTN Address, IN UINT16 OrData) | {
ASSERT_INVALID_PCI_ADDRESS (Address);
return MmioOr16 ((UINTN)GetPciExpressBaseAddress () + Address, OrData);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function waits until all asynchronous function calls for the synchronization domain specified by the running list @list have been done. */ | void async_synchronize_full_domain(struct list_head *list) | /* This function waits until all asynchronous function calls for the synchronization domain specified by the running list @list have been done. */
void async_synchronize_full_domain(struct list_head *list) | {
async_synchronize_cookie_domain(next_cookie, list);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* CAN MSP Initialization This function configures the hardware resources used in this example. */ | void HAL_CAN_MspInit(CAN_HandleTypeDef *hcan) | /* CAN MSP Initialization This function configures the hardware resources used in this example. */
void HAL_CAN_MspInit(CAN_HandleTypeDef *hcan) | {
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(hcan->Instance==CAN)
{
__HAL_RCC_CAN1_CLK_ENABLE();
__HAL_RCC_GPIOB_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HI... | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* The TPM driver should be built-in, but for whatever reason it isn't, protect against the chip disappearing, by incrementing the module usage count. */ | int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf) | /* The TPM driver should be built-in, but for whatever reason it isn't, protect against the chip disappearing, by incrementing the module usage count. */
int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf) | {
struct tpm_chip *chip;
int rc;
chip = tpm_chip_find_get(chip_num);
if (chip == NULL)
return -ENODEV;
rc = __tpm_pcr_read(chip, pcr_idx, res_buf);
module_put(chip->dev->driver->owner);
return rc;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The QEMU mouse can be in either relative, or absolute mode. Movement is sent separately from button state, which has to be encoded as virtual key events. We also don't actually get given any button up/down events, so have to track changes in the button state. */ | static void xenfb_mouse_event(void *opaque, int dx, int dy, int dz, int button_state) | /* The QEMU mouse can be in either relative, or absolute mode. Movement is sent separately from button state, which has to be encoded as virtual key events. We also don't actually get given any button up/down events, so have to track changes in the button state. */
static void xenfb_mouse_event(void *opaque, int dx, i... | {
struct XenInput *xenfb = opaque;
DisplaySurface *surface = qemu_console_surface(xenfb->c.con);
int dw = surface_width(surface);
int dh = surface_height(surface);
int i;
if (xenfb->abs_pointer_wanted)
xenfb_send_position(xenfb,
dx * (dw - 1) / 0x7fff,
dy * (dh - 1) / 0x7fff,
... | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* Determines whether the UART transmitter is busy or not. */ | xtBoolean UARTBusy(unsigned long ulBase) | /* Determines whether the UART transmitter is busy or not. */
xtBoolean UARTBusy(unsigned long ulBase) | {
xASSERT(UARTBaseValid(ulBase));
return (!(xHWREG(ulBase + UART_FSR) & UART_FSR_TX_EF));
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* This function releases all the application virtual buffer physical pages, that were previously locked */ | static int sep_free_dma_pages(struct page **page_array_ptr, unsigned long num_pages, unsigned long dirtyFlag) | /* This function releases all the application virtual buffer physical pages, that were previously locked */
static int sep_free_dma_pages(struct page **page_array_ptr, unsigned long num_pages, unsigned long dirtyFlag) | {
unsigned long count;
if (dirtyFlag) {
for (count = 0; count < num_pages; count++) {
if (!PageReserved(page_array_ptr[count]))
SetPageDirty(page_array_ptr[count]);
page_cache_release(page_array_ptr[count]);
}
} else {
for (count = 0; count < num_pages; count++)
page_cache_release(page_array_ptr[c... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This routine writes the 3 pages allocated for Key store data. */ | status_t FFR_CustKeystoreWrite(flash_config_t *config, ffr_key_store_t *pKeyStore) | /* This routine writes the 3 pages allocated for Key store data. */
status_t FFR_CustKeystoreWrite(flash_config_t *config, ffr_key_store_t *pKeyStore) | {
assert(BOOTLOADER_API_TREE_POINTER);
return BOOTLOADER_API_TREE_POINTER->flashDriver->ffr_cust_keystore_write(config, pKeyStore);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Stops or Disables GEMAC pointing to this eth iface. */ | static void pfe_eth_stop(struct udevice *dev) | /* Stops or Disables GEMAC pointing to this eth iface. */
static void pfe_eth_stop(struct udevice *dev) | {
struct pfe_eth_dev *priv = dev_get_priv(dev);
pfe_gemac_disable(priv->gem->gemac_base);
gpi_disable(priv->gem->egpi_base);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Function to append a Guid to the mapping item. */ | EFI_STATUS AppendCSDGuid(DEVICE_CONSIST_MAPPING_INFO *MappingItem, EFI_GUID *Guid) | /* Function to append a Guid to the mapping item. */
EFI_STATUS AppendCSDGuid(DEVICE_CONSIST_MAPPING_INFO *MappingItem, EFI_GUID *Guid) | {
CHAR16 Buffer[64];
ASSERT (Guid != NULL && MappingItem != NULL);
UnicodeSPrint (
Buffer,
0,
L"%g",
Guid
);
return AppendCSDStr (MappingItem, Buffer);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Stops audio stream playing on the used Media. */ | static void Audio_MAL_Stop(void) | /* Stops audio stream playing on the used Media. */
static void Audio_MAL_Stop(void) | {
DMA_Cmd(AUDIO_MAL_DMA_CHANNEL, DISABLE);
DMA_ClearFlag(AUDIO_MAL_DMA_FLAG_TC |AUDIO_MAL_DMA_FLAG_HT | AUDIO_MAL_DMA_FLAG_TE);
I2S_Cmd(CODEC_I2S, DISABLE);
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* Enables the power down mode of GMAC. This function puts the Gmac in power down mode. */ | void synopGMAC_power_down_enable(synopGMACdevice *gmacdev) | /* Enables the power down mode of GMAC. This function puts the Gmac in power down mode. */
void synopGMAC_power_down_enable(synopGMACdevice *gmacdev) | {
synopGMACSetBits(gmacdev->MacBase, GmacPmtCtrlStatus, GmacPmtPowerDown);
return;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Function for initializing the ANT BSC profile instance. */ | static ret_code_t ant_bsc_init(ant_bsc_profile_t *p_profile, ant_channel_config_t const *p_channel_config) | /* Function for initializing the ANT BSC profile instance. */
static ret_code_t ant_bsc_init(ant_bsc_profile_t *p_profile, ant_channel_config_t const *p_channel_config) | {
p_profile->channel_number = p_channel_config->channel_number;
p_profile->page_0 = DEFAULT_ANT_BSC_PAGE0();
p_profile->page_1 = DEFAULT_ANT_BSC_PAGE1();
p_profile->page_2 = DEFAULT_ANT_BSC_PAGE2();
p_profile->page_3 = DEFAULT_ANT_BSC_PAGE3();
p_profile->page_4 = DE... | labapart/polymcu | C++ | null | 201 |
/* Enable the discontinuous mode for the selected ADC channels. */ | void ADC_DiscModeCmd(ADC_TypeDef *ADCx, FunctionalState NewState) | /* Enable the discontinuous mode for the selected ADC channels. */
void ADC_DiscModeCmd(ADC_TypeDef *ADCx, FunctionalState NewState) | {
assert_param(IS_ADC_ALL_PERIPH(ADCx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
ADCx->CFGR1 |= (uint32_t)ADC_CFGR1_DISCEN;
}
else
{
ADCx->CFGR1 &= (uint32_t)(~ADC_CFGR1_DISCEN);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Clean up after the HPT3x2n and later DMA engine */ | static void hpt3x2n_bmdma_stop(struct ata_queued_cmd *qc) | /* Clean up after the HPT3x2n and later DMA engine */
static void hpt3x2n_bmdma_stop(struct ata_queued_cmd *qc) | {
struct ata_port *ap = qc->ap;
struct pci_dev *pdev = to_pci_dev(ap->host->dev);
int mscreg = 0x50 + 2 * ap->port_no;
u8 bwsr_stat, msc_stat;
pci_read_config_byte(pdev, 0x6A, &bwsr_stat);
pci_read_config_byte(pdev, mscreg, &msc_stat);
if (bwsr_stat & (1 << ap->port_no))
pci_write_config_byte(pdev, mscreg, msc... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Read specified Event port output data port pins. */ | en_ep_state_t EP_ReadOutputPins(uint8_t u8EventPort, uint16_t u16EventPin) | /* Read specified Event port output data port pins. */
en_ep_state_t EP_ReadOutputPins(uint8_t u8EventPort, uint16_t u16EventPin) | {
DDL_ASSERT(IS_EVENT_PORT(u8EventPort));
DDL_ASSERT(IS_EVENT_PIN(u16EventPin));
return ((READ_REG32(PEVNTODR_REG(u8EventPort)) & (u16EventPin)) != 0UL) ? EVT_PIN_SET : EVT_PIN_RESET;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Configure a Brown Out Detector module.
Configures a given BOD module with the settings stored in the given configuration structure. */ | enum status_code bodvdd_set_config(struct bodvdd_config *const conf) | /* Configure a Brown Out Detector module.
Configures a given BOD module with the settings stored in the given configuration structure. */
enum status_code bodvdd_set_config(struct bodvdd_config *const conf) | {
Assert(conf);
uint32_t temp = 0;
if (SUPC->BODVDD.reg & SUPC_BODVDD_ENABLE) {
SUPC->BODVDD.reg &= ~SUPC_BODVDD_ENABLE;
}
temp |= (uint32_t)conf->prescaler | (uint32_t)conf->action |
(uint32_t)conf->mode_in_active | (uint32_t)conf->mode_in_standby;
if (conf->hysteresis == true) {
temp |= SUPC_BODVDD_HYST;... | memfault/zero-to-main | C++ | null | 200 |
/* The ParseOptions() function parses the option fields in an MTFTPv4 OACK packet and returns the number of options that were found and optionally a list of pointers to the options in the packet. If one or more of the option fields are not valid, then EFI_PROTOCOL_ERROR is returned and *OptionCount and *OptionList stop... | EFI_STATUS EFIAPI EfiMtftp4ParseOptions(IN EFI_MTFTP4_PROTOCOL *This, IN UINT32 PacketLen, IN EFI_MTFTP4_PACKET *Packet, OUT UINT32 *OptionCount, OUT EFI_MTFTP4_OPTION **OptionList OPTIONAL) | /* The ParseOptions() function parses the option fields in an MTFTPv4 OACK packet and returns the number of options that were found and optionally a list of pointers to the options in the packet. If one or more of the option fields are not valid, then EFI_PROTOCOL_ERROR is returned and *OptionCount and *OptionList stop... | {
EFI_STATUS Status;
if ((This == NULL) || (PacketLen < MTFTP4_OPCODE_LEN) ||
(Packet == NULL) || (OptionCount == NULL))
{
return EFI_INVALID_PARAMETER;
}
Status = Mtftp4ExtractOptions (Packet, PacketLen, OptionCount, OptionList);
if (EFI_ERROR (Status)) {
return Status;
}
if (*OptionCoun... | tianocore/edk2 | C++ | Other | 4,240 |
/* Enable compare match interrupt (CMPMIE). @rmtoll IER CMPMIE LPTIM_EnableIT_CMPM. */ | void LPTIM_EnableIT_CMPM(LPTIM_Module *LPTIMx) | /* Enable compare match interrupt (CMPMIE). @rmtoll IER CMPMIE LPTIM_EnableIT_CMPM. */
void LPTIM_EnableIT_CMPM(LPTIM_Module *LPTIMx) | {
SET_BIT(LPTIMx->INTEN, LPTIM_INTEN_CMPMIE);
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Addend Register Update This function loads the contents of Time stamp addend register with the supplied 32 value. This is reserved function when only coarse correction option is selected */ | s32 synopGMAC_TS_addend_update(synopGMACdevice *gmacdev, u32 addend_value) | /* Addend Register Update This function loads the contents of Time stamp addend register with the supplied 32 value. This is reserved function when only coarse correction option is selected */
s32 synopGMAC_TS_addend_update(synopGMACdevice *gmacdev, u32 addend_value) | {
u32 loop_variable;
synopGMACWriteReg(gmacdev->MacBase,GmacTSAddend,addend_value);
for(loop_variable = 0; loop_variable < DEFAULT_LOOP_VARIABLE; loop_variable++){
if(!((synopGMACReadReg(gmacdev->MacBase,GmacTSControl)) & GmacTSADDREG)){
break;
}
plat_delay(DEFAULT_DE... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Helper function to read packet data from some source into a buffer */ | int mqtt_packet_read(unsigned char *buf, int buflen, int(*getfn)(unsigned char *, int)) | /* Helper function to read packet data from some source into a buffer */
int mqtt_packet_read(unsigned char *buf, int buflen, int(*getfn)(unsigned char *, int)) | {
int rc = -1;
mqtt_header_t header = {0};
int len = 0;
int rem_len = 0;
if ((*getfn)(buf, 1) != 1)
goto exit;
len = 1;
mqtt_packet_decode(getfn, &rem_len);
len += mqtt_packet_encode(buf + 1, rem_len);
if((rem_len + len) > buflen)
goto exit;
if ((*getfn)(buf + len, rem_len) != rem_len)
goto exit;
heade... | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* @locations: An array of supported splash locations. @size: Size of splash_locations array. */ | static struct splash_location* select_splash_location(struct splash_location *locations, uint size) | /* @locations: An array of supported splash locations. @size: Size of splash_locations array. */
static struct splash_location* select_splash_location(struct splash_location *locations, uint size) | {
int i;
char *env_splashsource;
if (!locations || size == 0)
return NULL;
env_splashsource = env_get("splashsource");
if (env_splashsource == NULL)
return &locations[0];
for (i = 0; i < size; i++) {
if (!strcmp(locations[i].name, env_splashsource))
return &locations[i];
}
printf("splashsource env vari... | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Sets the operating mode and bit rate of a CAN connection. */ | static HRESULT IxxatVciLibFuncCanControlInitialize(HANDLE hCanCtl, UINT8 bMode, UINT8 bBtr0, UINT8 bBtr1) | /* Sets the operating mode and bit rate of a CAN connection. */
static HRESULT IxxatVciLibFuncCanControlInitialize(HANDLE hCanCtl, UINT8 bMode, UINT8 bBtr0, UINT8 bBtr1) | {
HRESULT result = VCI_E_UNEXPECTED;
assert(ixxatVciLibFuncCanControlInitializePtr != NULL);
assert(ixxatVciDllHandle != NULL);
if ((ixxatVciLibFuncCanControlInitializePtr != NULL) && (ixxatVciDllHandle != NULL))
{
result = ixxatVciLibFuncCanControlInitializePtr(hCanCtl, bMode, bBtr0, bBtr1);
}
return... | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* Respond on ep 0.
Auxiliary function for sending respond on endpoint 0 */ | static void respond_setup_data(nrf_drv_usbd_setup_t const *const p_setup, void const *p_data, size_t size) | /* Respond on ep 0.
Auxiliary function for sending respond on endpoint 0 */
static void respond_setup_data(nrf_drv_usbd_setup_t const *const p_setup, void const *p_data, size_t size) | {
if(size > p_setup->wLength)
{
size = p_setup->wLength;
}
ret_code_t ret;
nrf_drv_usbd_transfer_t transfer =
{
.p_data = {.tx = p_data},
.size = size
};
ret = nrf_drv_usbd_ep_transfer(NRF_DRV_USBD_EPIN0, &transfer, NULL);
if(ret != NRF_SUCCESS)
{
... | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Function for filling a page in flash with a value. */ | static void flash_word_write(uint32_t *address, uint32_t value) | /* Function for filling a page in flash with a value. */
static void flash_word_write(uint32_t *address, uint32_t value) | {
NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Wen << NVMC_CONFIG_WEN_Pos);
while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
{
}
*address = value;
while (NRF_NVMC->READY == NVMC_READY_READY_Busy)
{
}
NRF_NVMC->CONFIG = (NVMC_CONFIG_WEN_Ren << NVMC_CONFIG_WEN_Pos);
while (NRF_NVMC->READY =... | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param mute true is mute, false is unmute. return kStatus_Success is success, else configure failed. */ | status_t CODEC_SetMute(codec_handle_t *handle, uint32_t playChannel, bool mute) | /* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param mute true is mute, false is unmute. return kStatus_Success is success, else configure failed. */
status_t CODEC_SetMute(codec_handle_t *handle, uint32_t playChannel, bool mute) | {
assert((handle != NULL) && (handle->codecConfig != NULL));
assert(handle->codecCapability != NULL);
if ((GET_PLAY_CHANNEL_CAPABILITY(handle->codecCapability->codecPlayCapability) & playChannel) == 0U)
{
return kStatus_CODEC_NotSupport;
}
return HAL_CODEC_SetMute(handle, playChannel, mu... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Tries to activate the SpeedStep status and control registers. Returns -EINVAL on an unsupported chipset, and zero on success. */ | static int speedstep_activate(void) | /* Tries to activate the SpeedStep status and control registers. Returns -EINVAL on an unsupported chipset, and zero on success. */
static int speedstep_activate(void) | {
u16 value = 0;
if (!speedstep_chipset_dev)
return -EINVAL;
pci_read_config_word(speedstep_chipset_dev, 0x00A0, &value);
if (!(value & 0x08)) {
value |= 0x08;
dprintk("activating SpeedStep (TM) registers\n");
pci_write_config_word(speedstep_chipset_dev, 0x00A0, value);
}
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* For tight control over page level allocator and protection flags use __vmalloc() instead. */ | void* vmalloc_exec(unsigned long size) | /* For tight control over page level allocator and protection flags use __vmalloc() instead. */
void* vmalloc_exec(unsigned long size) | {
return __vmalloc(size, GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL_EXEC);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Converts a text device path node to USB video device path structure. */ | EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbVideo(IN CHAR16 *TextDeviceNode) | /* Converts a text device path node to USB video device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbVideo(IN CHAR16 *TextDeviceNode) | {
USB_CLASS_TEXT UsbClassText;
UsbClassText.ClassExist = FALSE;
UsbClassText.Class = USB_CLASS_VIDEO;
UsbClassText.SubClassExist = TRUE;
return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Enable Receive buffer full interrupt @rmtoll IER RXBFIE LL_SWPMI_EnableIT_RXBF. */ | void LL_SWPMI_EnableIT_RXBF(SWPMI_TypeDef *SWPMIx) | /* Enable Receive buffer full interrupt @rmtoll IER RXBFIE LL_SWPMI_EnableIT_RXBF. */
void LL_SWPMI_EnableIT_RXBF(SWPMI_TypeDef *SWPMIx) | {
SET_BIT(SWPMIx->IER, SWPMI_IER_RXBFIE);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* USART Set Hardware Flow Control.
The flow control bit can be selected as none, RTS, CTS or RTS+CTS. */ | void usart_set_flow_control(uint32_t usart, uint32_t flowcontrol) | /* USART Set Hardware Flow Control.
The flow control bit can be selected as none, RTS, CTS or RTS+CTS. */
void usart_set_flow_control(uint32_t usart, uint32_t flowcontrol) | {
uint32_t reg32;
reg32 = USART_CR3(usart);
reg32 = (reg32 & ~USART_FLOWCONTROL_MASK) | flowcontrol;
USART_CR3(usart) = reg32;
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* allow the slow work item processor to get a ref on an operation */ | static int fscache_op_get_ref(struct slow_work *work) | /* allow the slow work item processor to get a ref on an operation */
static int fscache_op_get_ref(struct slow_work *work) | {
struct fscache_operation *op =
container_of(work, struct fscache_operation, slow_work);
atomic_inc(&op->usage);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* stop the USB host and clean up FIFO */ | void usb_host_stop(usb_core_driver *udev) | /* stop the USB host and clean up FIFO */
void usb_host_stop(usb_core_driver *udev) | {
uint32_t i;
__IO uint32_t pp_ctl = 0U;
udev->regs.hr->HACHINTEN = 0x0U;
udev->regs.hr->HACHINT = 0xFFFFFFFFU;
for (i = 0U; i < udev->bp.num_pipe; i++) {
pp_ctl = udev->regs.pr[i]->HCHCTL;
pp_ctl &= ~(HCHCTL_CEN | HCHCTL_EPDIR);
pp_ctl |= HCHCTL_CDIS;
udev->regs.pr[i... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Set SPIx Rx Sample Dealy. support form AZ BCUT. */ | void SSI_SetSampleDelay(SPI_TypeDef *spi_dev, u32 SampleDelay) | /* Set SPIx Rx Sample Dealy. support form AZ BCUT. */
void SSI_SetSampleDelay(SPI_TypeDef *spi_dev, u32 SampleDelay) | {
SSI_Cmd(spi_dev, DISABLE);
spi_dev->RX_SAMPLE_DLY = (SampleDelay & BIT_RX_SAMPLE_DELAY);
SSI_Cmd(spi_dev, ENABLE);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* This function sets the verification mode flags for the TLS connection. */ | VOID EFIAPI TlsSetVerify(IN VOID *Tls, IN UINT32 VerifyMode) | /* This function sets the verification mode flags for the TLS connection. */
VOID EFIAPI TlsSetVerify(IN VOID *Tls, IN UINT32 VerifyMode) | {
TLS_CONNECTION *TlsConn;
TlsConn = (TLS_CONNECTION *)Tls;
if ((TlsConn == NULL) || (TlsConn->Ssl == NULL)) {
return;
}
SSL_set_verify (TlsConn->Ssl, VerifyMode, NULL);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* In a fault condition, pins which have not been configured to be suppressed via a call to */ | void PWMOutputFaultLevel(unsigned long ulBase, unsigned long ulPWMOutBits, tBoolean bDriveHigh) | /* In a fault condition, pins which have not been configured to be suppressed via a call to */
void PWMOutputFaultLevel(unsigned long ulBase, unsigned long ulPWMOutBits, tBoolean bDriveHigh) | {
ASSERT((ulBase == PWM0_BASE) || (ulBase == PWM1_BASE));
ASSERT(!(ulPWMOutBits & ~(PWM_OUT_0_BIT | PWM_OUT_1_BIT | PWM_OUT_2_BIT |
PWM_OUT_3_BIT | PWM_OUT_4_BIT | PWM_OUT_5_BIT |
PWM_OUT_6_BIT | PWM_OUT_7_BIT)));
if(bDriveHigh == true)
{
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* IDL long BrowserrSetNetlogonState( IDL wchar_t *element_78, IDL wchar_t *element_79, IDL wchar_t *element_80, IDL long element_81 IDL ); */ | static int dissect_browser_browserr_set_netlogon_state_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) | /* IDL long BrowserrSetNetlogonState( IDL wchar_t *element_78, IDL wchar_t *element_79, IDL wchar_t *element_80, IDL long element_81 IDL ); */
static int dissect_browser_browserr_set_netlogon_state_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) | {
offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, di, drep,
NDR_POINTER_UNIQUE, "unknown string",
hf_browser_unknown_string, 0);
offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, di, drep,
NDR_POINTER_REF, "unknown string",
hf_browser_unknown_string, 0);
offset = dissect_ndr... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* reservetop=size reserves a hole at the top of the kernel address space which a hypervisor can load into later. Needed for dynamically loaded hypervisors, so relocating the fixmap can be done before paging initialization. */ | static int __init parse_reservetop(char *arg) | /* reservetop=size reserves a hole at the top of the kernel address space which a hypervisor can load into later. Needed for dynamically loaded hypervisors, so relocating the fixmap can be done before paging initialization. */
static int __init parse_reservetop(char *arg) | {
unsigned long address;
if (!arg)
return -EINVAL;
address = memparse(arg, &arg);
reserve_top_address(address);
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* param base LPSPI peripheral address. param handle LPSPI handle pointer to lpspi_slave_handle_t. param callback DSPI callback. param userData callback function parameter. */ | void LPSPI_SlaveTransferCreateHandle(LPSPI_Type *base, lpspi_slave_handle_t *handle, lpspi_slave_transfer_callback_t callback, void *userData) | /* param base LPSPI peripheral address. param handle LPSPI handle pointer to lpspi_slave_handle_t. param callback DSPI callback. param userData callback function parameter. */
void LPSPI_SlaveTransferCreateHandle(LPSPI_Type *base, lpspi_slave_handle_t *handle, lpspi_slave_transfer_callback_t callback, void *userData) | {
assert(handle);
memset(handle, 0, sizeof(*handle));
s_lpspiHandle[LPSPI_GetInstance(base)] = handle;
s_lpspiSlaveIsr = LPSPI_SlaveTransferHandleIRQ;
handle->callback = callback;
handle->userData = userData;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* TEL0026 role mode set.
This function is to set TEL0026 working role mode. */ | tBtResult BTDeviceRoleSet(char cRoleMode) | /* TEL0026 role mode set.
This function is to set TEL0026 working role mode. */
tBtResult BTDeviceRoleSet(char cRoleMode) | {
char cTmp[2];
cTmp[0] = cRoleMode;
cTmp[1] = 0;
s_cCmdBuffer[0] = 0;
ClearRecBuf();
StrCat(s_cCmdBuffer, BtCmdRoleSet);
StrCat(s_cCmdBuffer, cTmp);
BTSendCmdString(s_cCmdBuffer);
return (BTGetResponse());
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Free the resource related to the configure parameters. */ | VOID Dns6CleanConfigure(IN OUT EFI_DNS6_CONFIG_DATA *Config) | /* Free the resource related to the configure parameters. */
VOID Dns6CleanConfigure(IN OUT EFI_DNS6_CONFIG_DATA *Config) | {
if (Config->DnsServerList != NULL) {
FreePool (Config->DnsServerList);
}
ZeroMem (Config, sizeof (EFI_DNS6_CONFIG_DATA));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Interruptible by fatal signals only. The user is responsible for holding a count on the request. */ | int nfs_wait_on_request(struct nfs_page *req) | /* Interruptible by fatal signals only. The user is responsible for holding a count on the request. */
int nfs_wait_on_request(struct nfs_page *req) | {
return wait_on_bit(&req->wb_flags, PG_BUSY,
nfs_wait_bit_uninterruptible,
TASK_UNINTERRUPTIBLE);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Toggle the card between the standby and transfer states. */ | int card_enter_trans(uint32_t instance) | /* Toggle the card between the standby and transfer states. */
int card_enter_trans(uint32_t instance) | {
command_t cmd;
int card_address, port, status = FAIL;
port = card_get_port(instance);
card_address = usdhc_device[port].rca << RCA_SHIFT;
card_cmd_config(&cmd, CMD7, card_address, READ, RESPONSE_48_CHECK_BUSY,
DATA_PRESENT_NONE, TRUE, TRUE);
usdhc_printf("Send CMD7.\n");
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Deinitializes the IRTIM peripheral registers to their default reset values. */ | void IRTIM_DeInit(void) | /* Deinitializes the IRTIM peripheral registers to their default reset values. */
void IRTIM_DeInit(void) | {
IRTIM->CR = IRTIM_CR_RESET_VALUE;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Safely destroy a workqueue. All work currently pending will be done first. */ | void destroy_workqueue(struct workqueue_struct *wq) | /* Safely destroy a workqueue. All work currently pending will be done first. */
void destroy_workqueue(struct workqueue_struct *wq) | {
const struct cpumask *cpu_map = wq_cpu_map(wq);
int cpu;
cpu_maps_update_begin();
spin_lock(&workqueue_lock);
list_del(&wq->list);
spin_unlock(&workqueue_lock);
for_each_cpu(cpu, cpu_map)
cleanup_workqueue_thread(per_cpu_ptr(wq->cpu_wq, cpu));
cpu_maps_update_done();
free_percpu(wq->cpu_wq);
kfree(wq);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If the register specified by Address >= 0x100, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */ | UINT32 EFIAPI PciCf8BitFieldRead32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). If the register specified by Address >= 0x100, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT32 EF... | {
BOOLEAN InterruptState;
UINT32 AddressPort;
UINT32 Result;
ASSERT_INVALID_PCI_ADDRESS (Address, 3);
InterruptState = SaveAndDisableInterrupts ();
AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT);
IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address));
Result = IoBitFie... | tianocore/edk2 | C++ | Other | 4,240 |
/* i810_load_color - loads the color depth of the display */ | static void i810_load_color(struct i810fb_par *par) | /* i810_load_color - loads the color depth of the display */
static void i810_load_color(struct i810fb_par *par) | {
u8 __iomem *mmio = par->mmio_start_virtual;
u32 reg1;
u16 reg2;
reg1 = i810_readl(PIXCONF, mmio) & ~(0xF0000 | 1 << 27);
reg2 = i810_readw(BLTCNTL, mmio) & ~0x30;
reg1 |= 0x8000 | par->pixconf;
reg2 |= par->bltcntl;
i810_writel(PIXCONF, mmio, reg1);
i810_writew(BLTCNTL, mmio, reg2);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Check whether float 'f' is less than or equal to integer 'i'. See comments on previous function. */ | l_sinline int LEfloatint(lua_Number f, lua_Integer i) | /* Check whether float 'f' is less than or equal to integer 'i'. See comments on previous function. */
l_sinline int LEfloatint(lua_Number f, lua_Integer i) | {
lua_Integer fi;
if (luaV_flttointeger(f, &fi, F2Iceil))
return fi <= i;
else
return f < 0;
}
} | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* Look up a header name (assume lower-case header_name). */ | static gint* get_hf_for_header(char *header_name) | /* Look up a header name (assume lower-case header_name). */
static gint* get_hf_for_header(char *header_name) | {
gint* hf_id = NULL;
if (header_fields_hash) {
hf_id = (gint*) g_hash_table_lookup(header_fields_hash, header_name);
} else {
hf_id = NULL;
}
return hf_id;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Sets a callback that can enable or disable VCONN if the TCPC is unable to or the system is configured in a way that does not use the VCONN control capabilities of the TCPC. */ | static void ucpd_set_vconn_cb(const struct device *dev, tcpc_vconn_control_cb_t vconn_cb) | /* Sets a callback that can enable or disable VCONN if the TCPC is unable to or the system is configured in a way that does not use the VCONN control capabilities of the TCPC. */
static void ucpd_set_vconn_cb(const struct device *dev, tcpc_vconn_control_cb_t vconn_cb) | {
struct tcpc_data *data = dev->data;
data->vconn_cb = vconn_cb;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* API to assign the event handler function to be executed on occurrence of the selected event. */ | XMC_SCU_STATUS_t XMC_SCU_INTERRUPT_SetEventHandler(const XMC_SCU_INTERRUPT_EVENT_t event, const XMC_SCU_INTERRUPT_EVENT_HANDLER_t handler) | /* API to assign the event handler function to be executed on occurrence of the selected event. */
XMC_SCU_STATUS_t XMC_SCU_INTERRUPT_SetEventHandler(const XMC_SCU_INTERRUPT_EVENT_t event, const XMC_SCU_INTERRUPT_EVENT_HANDLER_t handler) | {
index++;
}
if (index == XMC_SCU_INTERRUPT_EVENT_MAX)
{
status = XMC_SCU_STATUS_ERROR;
}
else
{
event_handler_list[index] = handler;
status = XMC_SCU_STATUS_OK;
}
return (status);
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* This internal API fills the standby duration settings provided by the user in the data buffer so as to write in the sensor. */ | static void fill_standby_settings(uint8_t *reg_data, const struct bme280_settings *settings) | /* This internal API fills the standby duration settings provided by the user in the data buffer so as to write in the sensor. */
static void fill_standby_settings(uint8_t *reg_data, const struct bme280_settings *settings) | {
*reg_data = BME280_SET_BITS(*reg_data, BME280_STANDBY, settings->standby_time);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ | UINTN EFIAPI InternalBaseLibBitFieldOrUint(IN UINTN Operand, IN UINTN StartBit, IN UINTN EndBit, IN UINTN OrData) | /* If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINTN EFIAPI InternalBaseLibBitFieldOrUint(IN UINTN Operand, IN UINTN StartBit, IN UINTN EndBit, IN UINTN OrData) | {
ASSERT ((OrData >> (EndBit - StartBit)) == ((OrData >> (EndBit - StartBit)) & 1));
return Operand | ((OrData << StartBit) & ~((UINTN)-2 << EndBit));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Configure the dcp channel.
@para ch the channel index @para pkt_list pointer to work packet chain */ | int dcp_config_channel(uint32_t ch, dcp_work_pkt_p pkt_list) | /* Configure the dcp channel.
@para ch the channel index @para pkt_list pointer to work packet chain */
int dcp_config_channel(uint32_t ch, dcp_work_pkt_p pkt_list) | { HW_DCP_CHnCMDPTR_WR(ch, (uint32_t)pkt_list);
return 0;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Abort all outstanding requests. This is only safe to use if the completion ring will never be walked again or the device has been reset, because it destroys the 1-1 mapping between context field passed to emulation and our request structure. */ | static void pvscsi_reset_all(struct pvscsi_adapter *adapter) | /* Abort all outstanding requests. This is only safe to use if the completion ring will never be walked again or the device has been reset, because it destroys the 1-1 mapping between context field passed to emulation and our request structure. */
static void pvscsi_reset_all(struct pvscsi_adapter *adapter) | {
unsigned i;
for (i = 0; i < adapter->req_depth; i++) {
struct pvscsi_ctx *ctx = &adapter->cmd_map[i];
struct scsi_cmnd *cmd = ctx->cmd;
if (cmd) {
scmd_printk(KERN_ERR, cmd,
"Forced reset on cmd %p\n", cmd);
pvscsi_unmap_buffers(adapter, ctx);
pvscsi_release_context(adapter, ctx);
cmd->res... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function looks for a PCI device matching the requested board name, bus and slot. This function checks and requests an I/O region, reporting an error if there is a conflict. */ | static int dio200_request_region(unsigned minor, unsigned long from, unsigned long extent) | /* This function looks for a PCI device matching the requested board name, bus and slot. This function checks and requests an I/O region, reporting an error if there is a conflict. */
static int dio200_request_region(unsigned minor, unsigned long from, unsigned long extent) | {
if (!from || !request_region(from, extent, DIO200_DRIVER_NAME)) {
printk(KERN_ERR "comedi%d: I/O port conflict (%#lx,%lu)!\n",
minor, from, extent);
return -EIO;
}
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function returns %0 on success and a negative error code on failure. */ | static int check_lpt_crc(void *buf, int len) | /* This function returns %0 on success and a negative error code on failure. */
static int check_lpt_crc(void *buf, int len) | {
int pos = 0;
uint8_t *addr = buf;
uint16_t crc, calc_crc;
crc = ubifs_unpack_bits(&addr, &pos, UBIFS_LPT_CRC_BITS);
calc_crc = crc16(-1, buf + UBIFS_LPT_CRC_BYTES,
len - UBIFS_LPT_CRC_BYTES);
if (crc != calc_crc) {
ubifs_err("invalid crc in LPT node: crc %hx calc %hx", crc,
calc_crc);
dbg_dump_stac... | EmcraftSystems/u-boot | C++ | Other | 181 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.