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 |
|---|---|---|---|---|---|---|---|
/* Find the section, containing the supplied offset and return file offset for that value */ | static size_t llext_file_offset(struct llext_loader *ldr, size_t offset) | /* Find the section, containing the supplied offset and return file offset for that value */
static size_t llext_file_offset(struct llext_loader *ldr, size_t offset) | {
unsigned int i;
for (i = 0; i < LLEXT_MEM_COUNT; i++)
if (ldr->sects[i].sh_addr <= offset &&
ldr->sects[i].sh_addr + ldr->sects[i].sh_size > offset)
return offset - ldr->sects[i].sh_addr + ldr->sects[i].sh_offset;
return offset;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Reverses "nbits" bits of the value "val" and returns the result in the least significant bits. */ | static uint16_t inv_bits(uint16_t val, int nbits) | /* Reverses "nbits" bits of the value "val" and returns the result in the least significant bits. */
static uint16_t inv_bits(uint16_t val, int nbits) | {
uint16_t res;
if (nbits <= 8) {
res = av_reverse[val] >> (8-nbits);
} else
res = ((av_reverse[val & 0xFF] << 8) + (av_reverse[val >> 8])) >> (16-nbits);
return res;
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* Trigger restart of a waiting thread in fas216_command */ | static void fas216_internal_done(struct scsi_cmnd *SCpnt) | /* Trigger restart of a waiting thread in fas216_command */
static void fas216_internal_done(struct scsi_cmnd *SCpnt) | {
FAS216_Info *info = (FAS216_Info *)SCpnt->device->host->hostdata;
fas216_checkmagic(info);
info->internal_done = 1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Iterate through the children of an object (start from the "youngest") */ | lv_obj_t* lv_obj_get_child(const lv_obj_t *obj, const lv_obj_t *child) | /* Iterate through the children of an object (start from the "youngest") */
lv_obj_t* lv_obj_get_child(const lv_obj_t *obj, const lv_obj_t *child) | {
lv_obj_t * result = NULL;
if(child == NULL) {
result = lv_ll_get_head(&obj->child_ll);
} else {
result = lv_ll_get_next(&obj->child_ll, child);
}
return result;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* When done, the reference should be dropped with 'dev_put(wimax_dev->net_dev)'. */ | struct wimax_dev* wimax_dev_get_by_genl_info(struct genl_info *info, int ifindex) | /* When done, the reference should be dropped with 'dev_put(wimax_dev->net_dev)'. */
struct wimax_dev* wimax_dev_get_by_genl_info(struct genl_info *info, int ifindex) | {
struct wimax_dev *wimax_dev = NULL;
d_fnstart(3, NULL, "(info %p ifindex %d)\n", info, ifindex);
spin_lock(&wimax_id_table_lock);
list_for_each_entry(wimax_dev, &wimax_id_table, id_table_node) {
if (wimax_dev->net_dev->ifindex == ifindex) {
dev_hold(wimax_dev->net_dev);
goto found;
}
}
wimax_dev = NULL;
d_printf(1, NULL, "wimax: no devices found with ifindex %d\n",
ifindex);
found:
spin_unlock(&wimax_id_table_lock);
d_fnend(3, NULL, "(info %p ifindex %d) = %p\n",
info, ifindex, wimax_dev);
return wimax_dev;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */ | gboolean _g_freedesktop_dbus_call_get_id_finish(_GFreedesktopDBus *proxy, gchar **out_unique_id, GAsyncResult *res, GError **error) | /* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */
gboolean _g_freedesktop_dbus_call_get_id_finish(_GFreedesktopDBus *proxy, gchar **out_unique_id, GAsyncResult *res, GError **error) | {
GVariant *_ret;
_ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error);
if (_ret == NULL)
goto _out;
g_variant_get (_ret,
"(s)",
out_unique_id);
g_variant_unref (_ret);
_out:
return _ret != NULL;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Turns off creation and storage of HAL type results. */ | inv_error_t inv_disable_hal_outputs(void) | /* Turns off creation and storage of HAL type results. */
inv_error_t inv_disable_hal_outputs(void) | {
inv_error_t result;
inv_stop_hal_outputs();
result = inv_unregister_mpl_start_notification(inv_start_hal_outputs);
return result;
} | Luos-io/luos_engine | C++ | MIT License | 496 |
/* Gets the I
The default configuration is as follows: */ | void i2c_master_get_config_defaults(struct i2c_master_config *const config) | /* Gets the I
The default configuration is as follows: */
void i2c_master_get_config_defaults(struct i2c_master_config *const config) | {
Assert(config);
config->clock_source = I2C_CLK_INPUT_3;
config->clock_divider = 0x10;
config->pin_number_pad0 = PIN_LP_GPIO_8;
config->pin_number_pad1 = PIN_LP_GPIO_9;
config->pinmux_sel_pad0 = MUX_LP_GPIO_8_I2C0_SDA;
config->pinmux_sel_pad1 = MUX_LP_GPIO_9_I2C0_SCL;
} | memfault/zero-to-main | C++ | null | 200 |
/* Updates the configuration ROM image of a host. rom_version must be the current version, otherwise it will fail with return value -1. If this host does not support config-rom-update, it will return -EINVAL. Return value 0 indicates success. */ | int hpsb_update_config_rom_image(struct hpsb_host *host) | /* Updates the configuration ROM image of a host. rom_version must be the current version, otherwise it will fail with return value -1. If this host does not support config-rom-update, it will return -EINVAL. Return value 0 indicates success. */
int hpsb_update_config_rom_image(struct hpsb_host *host) | {
unsigned long reset_delay;
int next_gen = host->csr.generation + 1;
if (!host->update_config_rom)
return -EINVAL;
if (next_gen > 0xf)
next_gen = 2;
cancel_delayed_work(&host->delayed_reset);
if (time_before(jiffies, host->csr.gen_timestamp[next_gen] + 60 * HZ))
reset_delay =
(60 * HZ) + host->csr.gen_timestamp[next_gen] - jiffies;
else
reset_delay = HZ;
PREPARE_DELAYED_WORK(&host->delayed_reset, delayed_reset_bus);
schedule_delayed_work(&host->delayed_reset, reset_delay);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Clear All Status Flags Program error, end of operation, write protect error, busy. */ | void flash_clear_status_flags(void) | /* Clear All Status Flags Program error, end of operation, write protect error, busy. */
void flash_clear_status_flags(void) | {
flash_clear_pgserr_flag();
flash_clear_pgaerr_flag();
flash_clear_wrperr_flag();
flash_clear_pgperr_flag();
flash_clear_eop_flag();
flash_clear_bsy_flag();
} | insane-adding-machines/unicore-mx | C++ | GNU General Public License v3.0 | 50 |
/* set up a mapping for shared memory segments */ | int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma) | /* set up a mapping for shared memory segments */
int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma) | {
if (!(vma->vm_flags & VM_SHARED))
return -ENOSYS;
file_accessed(file);
vma->vm_ops = &generic_file_vm_ops;
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* It will first init some states, then send the WRQ request packet, and start receiving the packet. */ | EFI_STATUS Mtftp4WrqStart(IN MTFTP4_PROTOCOL *Instance, IN UINT16 Operation) | /* It will first init some states, then send the WRQ request packet, and start receiving the packet. */
EFI_STATUS Mtftp4WrqStart(IN MTFTP4_PROTOCOL *Instance, IN UINT16 Operation) | {
EFI_STATUS Status;
Status = Mtftp4InitBlockRange (&Instance->Blocks, 0, 0xffff);
if (EFI_ERROR (Status)) {
return Status;
}
Status = Mtftp4SendRequest (Instance);
if (EFI_ERROR (Status)) {
return Status;
}
return UdpIoRecvDatagram (Instance->UnicastPort, Mtftp4WrqInput, Instance, 0);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This routine restarts fcp_poll timer, when FCP ring polling is enable and FCP Ring interrupt is disable. */ | void lpfc_poll_timeout(unsigned long ptr) | /* This routine restarts fcp_poll timer, when FCP ring polling is enable and FCP Ring interrupt is disable. */
void lpfc_poll_timeout(unsigned long ptr) | {
struct lpfc_hba *phba = (struct lpfc_hba *) ptr;
if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) {
lpfc_sli_handle_fast_ring_event(phba,
&phba->sli.ring[LPFC_FCP_RING], HA_R0RE_REQ);
if (phba->cfg_poll & DISABLE_FCP_RING_INT)
lpfc_poll_rearm_timer(phba);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set the number of data bits in the termios structure. */ | static void native_tty_data_bits_set(struct termios *ter, enum native_tty_bottom_data_bits data_bits) | /* Set the number of data bits in the termios structure. */
static void native_tty_data_bits_set(struct termios *ter, enum native_tty_bottom_data_bits data_bits) | {
unsigned int data_bits_to_set = CS5;
switch (data_bits) {
case NTB_DATA_BITS_5:
data_bits_to_set = CS5;
break;
case NTB_DATA_BITS_6:
data_bits_to_set = CS6;
break;
case NTB_DATA_BITS_7:
data_bits_to_set = CS7;
break;
case NTB_DATA_BITS_8:
data_bits_to_set = CS8;
break;
default:
ERROR("Could not set number of data bits.\n");
}
ter->c_cflag &= ~CSIZE;
ter->c_cflag |= data_bits_to_set;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Return: 0 if all went fine, else return appropriate error. */ | static int ti_sci_cmd_put_device(const struct ti_sci_handle *handle, u32 id) | /* Return: 0 if all went fine, else return appropriate error. */
static int ti_sci_cmd_put_device(const struct ti_sci_handle *handle, u32 id) | {
return ti_sci_set_device_state(handle, id, 0,
MSG_DEVICE_SW_STATE_AUTO_OFF);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Verify bus voltages for all ina237 nodes in DT. */ | static void test_shunt_cal(struct ina237_fixture *fixture) | /* Verify bus voltages for all ina237 nodes in DT. */
static void test_shunt_cal(struct ina237_fixture *fixture) | {
double shunt_cal = 819.2e6 * fixture->current_lsb_uA * 1e-6 * fixture->rshunt_uOhms * 1e-6;
if (fixture->config & INA237_CFG_HIGH_PRECISION) {
shunt_cal *= 4;
}
uint32_t shunt_register_actual;
uint16_t shunt_register_expected = (uint16_t)shunt_cal;
zassert_ok(ina237_mock_get_register(fixture->mock->data, INA237_REG_CALIB,
&shunt_register_actual));
zexpect_within(shunt_register_expected, shunt_register_actual, 1,
"Expected %d, got %d", shunt_register_expected, shunt_register_actual);
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Returns the pointer of the buffer, or NULL if no enoguh memory. */ | void* snd_malloc_pages(size_t size, gfp_t gfp_flags) | /* Returns the pointer of the buffer, or NULL if no enoguh memory. */
void* snd_malloc_pages(size_t size, gfp_t gfp_flags) | {
int pg;
void *res;
if (WARN_ON(!size))
return NULL;
if (WARN_ON(!gfp_flags))
return NULL;
gfp_flags |= __GFP_COMP;
pg = get_order(size);
if ((res = (void *) __get_free_pages(gfp_flags, pg)) != NULL)
inc_snd_pages(pg);
return res;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ | UINT32 EFIAPI PciExpressOr32(IN UINTN Address, IN UINT32 OrData) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciExpressOr32(IN UINTN Address, IN UINT32 OrData) | {
ASSERT_INVALID_PCI_ADDRESS (Address);
if (Address >= PcdPciExpressBaseSize ()) {
return (UINT32)-1;
}
return MmioOr32 ((UINTN)GetPciExpressBaseAddress () + Address, OrData);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* select the input connection of the given node. */ | static int select_input_connection(struct hda_codec *codec, struct hda_gnode *node, unsigned int index) | /* select the input connection of the given node. */
static int select_input_connection(struct hda_codec *codec, struct hda_gnode *node, unsigned int index) | {
snd_printdd("CONNECT: NID=0x%x IDX=0x%x\n", node->nid, index);
return snd_hda_codec_write_cache(codec, node->nid, 0,
AC_VERB_SET_CONNECT_SEL, index);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Convert an integer (13-bit words, little-endian) to unsigned big-endian encoding. The total encoding length is provided; all the destination bytes will be filled. */ | static void le13_to_be8(unsigned char *dst, size_t len, const uint32_t *src) | /* Convert an integer (13-bit words, little-endian) to unsigned big-endian encoding. The total encoding length is provided; all the destination bytes will be filled. */
static void le13_to_be8(unsigned char *dst, size_t len, const uint32_t *src) | {
uint32_t acc;
int acc_len;
acc = 0;
acc_len = 0;
while (len -- > 0) {
if (acc_len < 8) {
acc |= (*src ++) << acc_len;
acc_len += 13;
}
dst[len] = (unsigned char)acc;
acc >>= 8;
acc_len -= 8;
}
} | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* Configures the tim Output Compare 2 Fast feature. */ | void TIM_OC2FastConfig(TIM_TypeDef *tim, TIMOCFE_Typedef fast) | /* Configures the tim Output Compare 2 Fast feature. */
void TIM_OC2FastConfig(TIM_TypeDef *tim, TIMOCFE_Typedef fast) | {
MODIFY_REG(tim->CCMR1, TIM_CCMR1_OC2FEN, fast << 8);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* get the configuration descriptor and return the its pointer */ | uint8_t * usb_dev_composite_getcfgdesc(uint16_t *length) | /* get the configuration descriptor and return the its pointer */
uint8_t * usb_dev_composite_getcfgdesc(uint16_t *length) | {
*length = (uint16_t)sizeof(usb_dev_composite_cfgdesc);
return usb_dev_composite_cfgdesc;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* atl2_exit_module is called just before the driver is removed from memory. */ | static void __exit atl2_exit_module(void) | /* atl2_exit_module is called just before the driver is removed from memory. */
static void __exit atl2_exit_module(void) | {
pci_unregister_driver(&atl2_driver);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns the absolute FIFO address for a specified endpoint. */ | uint32_t USBFIFOAddrGet(uint32_t ui32Base, uint32_t ui32Endpoint) | /* Returns the absolute FIFO address for a specified endpoint. */
uint32_t USBFIFOAddrGet(uint32_t ui32Base, uint32_t ui32Endpoint) | {
return (ui32Base + USB_O_FIFO0 + (ui32Endpoint >> 2));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Modified by the GLib Team and others 1997-2000. See the AUTHORS file for a list of people on the GLib Team. See the ChangeLog files for a list of changes. These files are distributed with GLib at */ | void g_thread_init(gpointer init) | /* Modified by the GLib Team and others 1997-2000. See the AUTHORS file for a list of people on the GLib Team. See the ChangeLog files for a list of changes. These files are distributed with GLib at */
void g_thread_init(gpointer init) | {
if (init != NULL)
g_warning ("GThread system no longer supports custom thread implementations.");
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Checks if sequence number of received PDU is in range of receive window. Returns 0 for success, 1 otherwise */ | static u16 llc_util_ns_inside_rx_window(u8 ns, u8 vr, u8 rw) | /* Checks if sequence number of received PDU is in range of receive window. Returns 0 for success, 1 otherwise */
static u16 llc_util_ns_inside_rx_window(u8 ns, u8 vr, u8 rw) | {
return !llc_circular_between(vr, ns,
(vr + rw - 1) % LLC_2_SEQ_NBR_MODULO);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Use the TDVMCALL instruction to handle msr read */ | STATIC UINT64 ReadMsrExit(IN OUT EFI_SYSTEM_CONTEXT_X64 *Regs, IN TDCALL_VEINFO_RETURN_DATA *Veinfo) | /* Use the TDVMCALL instruction to handle msr read */
STATIC UINT64 ReadMsrExit(IN OUT EFI_SYSTEM_CONTEXT_X64 *Regs, IN TDCALL_VEINFO_RETURN_DATA *Veinfo) | {
MSR_DATA Data;
UINT64 Status;
Status = TdVmCall (EXIT_REASON_MSR_READ, Regs->Rcx, 0, 0, 0, &Data);
if (Status == 0) {
Regs->Rax = Data.Regs.Eax;
Regs->Rdx = Data.Regs.Edx;
}
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* or we will underclock the device and get reduced performance. */ | static void hpt3x2n_set_clock(struct ata_port *ap, int source) | /* or we will underclock the device and get reduced performance. */
static void hpt3x2n_set_clock(struct ata_port *ap, int source) | {
void __iomem *bmdma = ap->ioaddr.bmdma_addr - ap->port_no * 8;
iowrite8(0x80, bmdma+0x73);
iowrite8(0x80, bmdma+0x77);
iowrite8(source, bmdma+0x7B);
iowrite8(0xC0, bmdma+0x79);
iowrite8(ioread8(bmdma+0x70) | 0x32, bmdma+0x70);
iowrite8(ioread8(bmdma+0x74) | 0x32, bmdma+0x74);
iowrite8(0x00, bmdma+0x79);
iowrite8(0x00, bmdma+0x73);
iowrite8(0x00, bmdma+0x77);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Gets the states of the CTS modem status signal. */ | unsigned long UARTModemStatusGet(unsigned long ulBase) | /* Gets the states of the CTS modem status signal. */
unsigned long UARTModemStatusGet(unsigned long ulBase) | {
ASSERT(ulBase == UARTA1_BASE);
return(HWREG(ulBase + UART_O_FR) & (UART_INPUT_CTS));
} | micropython/micropython | C++ | Other | 18,334 |
/* Returns: (transfer none): the data, or NULL if no data was found */ | gpointer g_type_get_qdata(GType type, GQuark quark) | /* Returns: (transfer none): the data, or NULL if no data was found */
gpointer g_type_get_qdata(GType type, GQuark quark) | {
TypeNode *node;
gpointer data;
node = lookup_type_node_I (type);
if (node)
{
G_READ_LOCK (&type_rw_lock);
data = type_get_qdata_L (node, quark);
G_READ_UNLOCK (&type_rw_lock);
}
else
{
g_return_val_if_fail (node != NULL, NULL);
data = NULL;
}
return data;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Add a memory region to the kernel e820 map. */ | static void __init __e820_add_region(struct e820map *e820x, u64 start, u64 size, int type) | /* Add a memory region to the kernel e820 map. */
static void __init __e820_add_region(struct e820map *e820x, u64 start, u64 size, int type) | {
int x = e820x->nr_map;
if (x >= ARRAY_SIZE(e820x->map)) {
printk(KERN_ERR "Ooops! Too many entries in the memory map!\n");
return;
}
e820x->map[x].addr = start;
e820x->map[x].size = size;
e820x->map[x].type = type;
e820x->nr_map++;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* RETURNS: 1 if SCRs are accessible, 0 otherwise. */ | int sata_scr_valid(struct ata_link *link) | /* RETURNS: 1 if SCRs are accessible, 0 otherwise. */
int sata_scr_valid(struct ata_link *link) | {
struct ata_port *ap = link->ap;
return (ap->flags & ATA_FLAG_SATA) && ap->ops->scr_read;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Get the status of the specified ADC flag. */ | en_flag_status_t ADC_GetStatus(const CM_ADC_TypeDef *ADCx, uint8_t u8Flag) | /* Get the status of the specified ADC flag. */
en_flag_status_t ADC_GetStatus(const CM_ADC_TypeDef *ADCx, uint8_t u8Flag) | {
en_flag_status_t enStatus = RESET;
DDL_ASSERT(IS_ADC_UNIT(ADCx));
DDL_ASSERT(IS_ADC_FLAG(u8Flag));
if (READ_REG8_BIT(ADCx->ISR, u8Flag) != 0U) {
enStatus = SET;
}
return enStatus;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Attribute read call back for the Long descriptor V2D1 attribute. */ | static ssize_t read_long_des_v2d1_2(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset) | /* Attribute read call back for the Long descriptor V2D1 attribute. */
static ssize_t read_long_des_v2d1_2(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset) | {
const uint8_t *value = attr->user_data;
return bt_gatt_attr_read(conn, attr, buf, len, offset, value,
sizeof(long_des_v2d1_2_value));
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* THIS APPROACH WAS CHOSEN DU TO THE COMPLEX NATURE OF THE LPC32XX GPIOS; DO NOT TAKE THIS AS AN EXAMPLE FOR NEW CODE. */ | static int lpc32xx_gpio_get_function(struct udevice *dev, unsigned offset) | /* THIS APPROACH WAS CHOSEN DU TO THE COMPLEX NATURE OF THE LPC32XX GPIOS; DO NOT TAKE THIS AS AN EXAMPLE FOR NEW CODE. */
static int lpc32xx_gpio_get_function(struct udevice *dev, unsigned offset) | {
struct lpc32xx_gpio_priv *gpio_priv = dev_get_priv(dev);
return gpio_priv->function[offset];
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Returns: (transfer none): the #GParamSpec for the property, or NULL if the class doesn't have a property of that name */ | GParamSpec* g_object_class_find_property(GObjectClass *class, const gchar *property_name) | /* Returns: (transfer none): the #GParamSpec for the property, or NULL if the class doesn't have a property of that name */
GParamSpec* g_object_class_find_property(GObjectClass *class, const gchar *property_name) | {
GParamSpec *pspec;
GParamSpec *redirect;
g_return_val_if_fail (G_IS_OBJECT_CLASS (class), NULL);
g_return_val_if_fail (property_name != NULL, NULL);
pspec = g_param_spec_pool_lookup (pspec_pool,
property_name,
G_OBJECT_CLASS_TYPE (class),
TRUE);
if (pspec)
{
redirect = g_param_spec_get_redirect_target (pspec);
if (redirect)
return redirect;
else
return pspec;
}
else
return NULL;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Starts final checksum computation.
Configures the CRC module for the specified CRC protocol. */ | static void crc_SetProtocolConfig(CRC_Type *base, const crc_config_t *protocolConfig) | /* Starts final checksum computation.
Configures the CRC module for the specified CRC protocol. */
static void crc_SetProtocolConfig(CRC_Type *base, const crc_config_t *protocolConfig) | {
crc_module_config_t moduleConfig;
moduleConfig.polynomial = protocolConfig->polynomial;
moduleConfig.seed = protocolConfig->seed;
moduleConfig.readTranspose = crc_GetTransposeTypeFromReflectOut(protocolConfig->reflectOut);
moduleConfig.writeTranspose = crc_GetTransposeTypeFromReflectIn(protocolConfig->reflectIn);
moduleConfig.complementChecksum = protocolConfig->complementChecksum;
moduleConfig.crcBits = protocolConfig->crcBits;
crc_ConfigureAndStart(base, &moduleConfig);
} | labapart/polymcu | C++ | null | 201 |
/* Returns max number of buses (exclude current one) used by Virtual Functions. */ | int pci_iov_bus_range(struct pci_bus *bus) | /* Returns max number of buses (exclude current one) used by Virtual Functions. */
int pci_iov_bus_range(struct pci_bus *bus) | {
int max = 0;
u8 busnr;
struct pci_dev *dev;
list_for_each_entry(dev, &bus->devices, bus_list) {
if (!dev->is_physfn)
continue;
busnr = virtfn_bus(dev, dev->sriov->total - 1);
if (busnr > max)
max = busnr;
}
return max ? max - bus->number : 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* "export" pending gotos to outer level, to check them against outer labels; if the block being exited has upvalues, and the goto exits the scope of any variable (which can be the upvalue), close those variables being exited. */ | static void movegotosout(FuncState *fs, BlockCnt *bl) | /* "export" pending gotos to outer level, to check them against outer labels; if the block being exited has upvalues, and the goto exits the scope of any variable (which can be the upvalue), close those variables being exited. */
static void movegotosout(FuncState *fs, BlockCnt *bl) | {
Labeldesc *gt = &gl->arr[i];
if (gt->nactvar > bl->nactvar) {
if (bl->upval)
luaK_patchclose(fs, gt->pc, bl->nactvar);
gt->nactvar = bl->nactvar;
}
if (!findlabel(fs->ls, i))
i++;
}
} | opentx/opentx | C++ | GNU General Public License v2.0 | 2,025 |
/* If 8-bit I/O port operations are not supported, then ASSERT(). */ | UINT8 EFIAPI IoRead8(IN UINTN Port) | /* If 8-bit I/O port operations are not supported, then ASSERT(). */
UINT8 EFIAPI IoRead8(IN UINTN Port) | {
CONST EFI_PEI_SERVICES **PeiServices;
EFI_PEI_CPU_IO_PPI *CpuIo;
PeiServices = GetPeiServicesTablePointer ();
CpuIo = (*PeiServices)->CpuIo;
ASSERT (CpuIo != NULL);
return CpuIo->IoRead8 (PeiServices, CpuIo, (UINT64)Port);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* GMAC strips the Pad/FCS field of incoming frames. This is true only if the length field value is less than or equal to 1500 bytes. All received frames with length field greater than or equal to 1501 bytes are passed to the application without stripping the Pad/FCS field. */ | void synopGMAC_pad_crc_strip_enable(synopGMACdevice *gmacdev) | /* GMAC strips the Pad/FCS field of incoming frames. This is true only if the length field value is less than or equal to 1500 bytes. All received frames with length field greater than or equal to 1501 bytes are passed to the application without stripping the Pad/FCS field. */
void synopGMAC_pad_crc_strip_enable(synopGMACdevice *gmacdev) | {
synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacPadCrcStrip);
return;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Function called in case of error detected in USART IT Handler. */ | void Error_Callback(void) | /* Function called in case of error detected in USART IT Handler. */
void Error_Callback(void) | {
__IO uint32_t sr_reg;
NVIC_DisableIRQ(USARTx_IRQn);
sr_reg = LL_USART_ReadReg(USARTx_INSTANCE, SR);
if (sr_reg & LL_USART_SR_NE)
{
LED_Blinking(LED_BLINK_FAST);
}
else
{
LED_Blinking(LED_BLINK_ERROR);
}
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Returns CR_OK upon successful completion, an error code otherwise. */ | enum CRStatus cr_input_increment_col_num(CRInput *a_this, glong a_increment) | /* Returns CR_OK upon successful completion, an error code otherwise. */
enum CRStatus cr_input_increment_col_num(CRInput *a_this, glong a_increment) | {
g_return_val_if_fail (a_this && PRIVATE (a_this), CR_BAD_PARAM_ERROR);
PRIVATE (a_this)->col += a_increment;
return CR_OK;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* configure ADC sync DMA engine is disabled after the end of transfer signal from DMA controller is detected */ | void adc_sync_dma_request_after_last_enable(void) | /* configure ADC sync DMA engine is disabled after the end of transfer signal from DMA controller is detected */
void adc_sync_dma_request_after_last_enable(void) | {
ADC_SYNCCTL |= ADC_SYNCCTL_SYNCDDM;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* We need to be extremely careful not to follow any invalid pointers, because this function can be called for */ | void* kmemcheck_shadow_lookup(unsigned long address) | /* We need to be extremely careful not to follow any invalid pointers, because this function can be called for */
void* kmemcheck_shadow_lookup(unsigned long address) | {
pte_t *pte;
struct page *page;
if (!virt_addr_valid(address))
return NULL;
pte = kmemcheck_pte_lookup(address);
if (!pte)
return NULL;
page = virt_to_page(address);
if (!page->shadow)
return NULL;
return page->shadow + (address & (PAGE_SIZE - 1));
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */ | VOID* EFIAPI AllocateZeroPool(IN UINTN AllocationSize) | /* Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
VOID* EFIAPI AllocateZeroPool(IN UINTN AllocationSize) | {
VOID *Buffer;
Buffer = malloc (AllocationSize);
if (Buffer == NULL) {
return NULL;
}
memset (Buffer, 0, AllocationSize);
return Buffer;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Waits for an event to occur which completes our */ | static void vt_event_wait(struct vt_event_wait *vw) | /* Waits for an event to occur which completes our */
static void vt_event_wait(struct vt_event_wait *vw) | {
unsigned long flags;
INIT_LIST_HEAD(&vw->list);
vw->done = 0;
spin_lock_irqsave(&vt_event_lock, flags);
list_add(&vw->list, &vt_events);
spin_unlock_irqrestore(&vt_event_lock, flags);
wait_event_interruptible(vt_event_waitqueue, vw->done);
spin_lock_irqsave(&vt_event_lock, flags);
list_del(&vw->list);
spin_unlock_irqrestore(&vt_event_lock, flags);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set the pulse width of the specified channel in seconds. */ | void pwmout_pulsewidth(pwmout_t *obj, float seconds) | /* Set the pulse width of the specified channel in seconds. */
void pwmout_pulsewidth(pwmout_t *obj, float seconds) | {
pwmout_pulsewidth_us(obj, (int)(seconds * 1000000.0f));
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* 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_node(size, 1, GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL_EXEC,
-1, __builtin_return_address(0));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Reverses the effect of usb_hcd_3c2410_probe(), first invoking the HCD's stop() method. It is always called from a thread context, normally "rmmod", "apmd", or something similar. */ | static void usb_hcd_s3c2410_remove(struct usb_hcd *hcd, struct platform_device *dev) | /* Reverses the effect of usb_hcd_3c2410_probe(), first invoking the HCD's stop() method. It is always called from a thread context, normally "rmmod", "apmd", or something similar. */
static void usb_hcd_s3c2410_remove(struct usb_hcd *hcd, struct platform_device *dev) | {
usb_remove_hcd(hcd);
s3c2410_stop_hc(dev);
iounmap(hcd->regs);
release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
usb_put_hcd(hcd);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Add a new tail to a linked list */ | void* lv_ll_ins_tail(lv_ll_t *ll_p) | /* Add a new tail to a linked list */
void* lv_ll_ins_tail(lv_ll_t *ll_p) | {
lv_ll_node_t * n_new;
n_new = lv_mem_alloc(ll_p->n_size + LL_NODE_META_SIZE);
if(n_new == NULL) return NULL;
if(n_new != NULL) {
node_set_next(ll_p, n_new, NULL);
node_set_prev(ll_p, n_new, ll_p->tail);
if(ll_p->tail != NULL) {
node_set_next(ll_p, ll_p->tail, n_new);
}
ll_p->tail = n_new;
if(ll_p->head == NULL) {
ll_p->head = n_new;
}
}
return n_new;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Calibrate the gyro data in the DMP. After eight seconds of no motion, the DMP will compute gyro biases and subtract them from the quaternion output. If */ | int dmp_enable_gyro_cal(unsigned char enable) | /* Calibrate the gyro data in the DMP. After eight seconds of no motion, the DMP will compute gyro biases and subtract them from the quaternion output. If */
int dmp_enable_gyro_cal(unsigned char enable) | {
if (enable) {
unsigned char regs[9] = {0xb8, 0xaa, 0xb3, 0x8d, 0xb4, 0x98, 0x0d, 0x35, 0x5d};
return mpu_write_mem(CFG_MOTION_BIAS, 9, regs);
} else {
unsigned char regs[9] = {0xb8, 0xaa, 0xaa, 0xaa, 0xb0, 0x88, 0xc3, 0xc5, 0xc7};
return mpu_write_mem(CFG_MOTION_BIAS, 9, regs);
}
} | Luos-io/luos_engine | C++ | MIT License | 496 |
/* Iterate through the children of an object (start from the "youngest") */ | lv_obj_t* lv_obj_get_child(const lv_obj_t *obj, const lv_obj_t *child) | /* Iterate through the children of an object (start from the "youngest") */
lv_obj_t* lv_obj_get_child(const lv_obj_t *obj, const lv_obj_t *child) | {
if(child == NULL) {
return lv_ll_get_head(&obj->child_ll);
} else {
return lv_ll_get_next(&obj->child_ll, child);
}
return NULL;
} | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* Enables or disables the specified DAC channel DMA request. */ | void DAC_DMACmd(uint32_t DAC_Channel, FunctionalState NewState) | /* Enables or disables the specified DAC channel DMA request. */
void DAC_DMACmd(uint32_t DAC_Channel, FunctionalState NewState) | {
assert_param(IS_DAC_CHANNEL(DAC_Channel));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
DAC->CR |= CR_DMAEN_Set << DAC_Channel;
}
else
{
DAC->CR &= ~(CR_DMAEN_Set << DAC_Channel);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Used to retrieve the interface given the name (the name is used in AirpcapOpen) */ | airpcap_if_info_t* get_airpcap_if_from_name(GList *if_list, const gchar *name) | /* Used to retrieve the interface given the name (the name is used in AirpcapOpen) */
airpcap_if_info_t* get_airpcap_if_from_name(GList *if_list, const gchar *name) | {
GList* curr;
airpcap_if_info_t* if_info;
for (curr = g_list_first(if_list); curr; curr = g_list_next(curr)) {
if_info = (airpcap_if_info_t *)curr->data;
if (if_info && (g_ascii_strcasecmp(if_info->name, name) == 0)) {
return (if_info);
}
if (strlen(if_info->name) > 4 && (g_ascii_strcasecmp(if_info->name + 4, name) == 0)) {
return (if_info);
}
}
return (NULL);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* . Set or Get the sctp partial delivery point (chapter and verse is quoted at sctp_setsockopt_partial_delivery_point()) */ | static int sctp_getsockopt_partial_delivery_point(struct sock *sk, int len, char __user *optval, int __user *optlen) | /* . Set or Get the sctp partial delivery point (chapter and verse is quoted at sctp_setsockopt_partial_delivery_point()) */
static int sctp_getsockopt_partial_delivery_point(struct sock *sk, int len, char __user *optval, int __user *optlen) | {
u32 val;
if (len < sizeof(u32))
return -EINVAL;
len = sizeof(u32);
val = sctp_sk(sk)->pd_point;
if (put_user(len, optlen))
return -EFAULT;
if (copy_to_user(optval, &val, len))
return -EFAULT;
return -ENOTSUPP;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Sensing chain FIFO stop values memorization at threshold level.. */ | int32_t lsm6dso_fifo_stop_on_wtm_get(lsm6dso_ctx_t *ctx, uint8_t *val) | /* Sensing chain FIFO stop values memorization at threshold level.. */
int32_t lsm6dso_fifo_stop_on_wtm_get(lsm6dso_ctx_t *ctx, uint8_t *val) | {
lsm6dso_fifo_ctrl2_t reg;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_FIFO_CTRL2, (uint8_t*)®, 1);
*val = reg.stop_on_wtm;
return ret;
} | alexander-g-dean/ESF | C++ | null | 41 |
/* Set attributes (cache operations) Stores the attributes for cache operation to be used in Define Extend (DE). */ | static int dasd_eckd_set_attrib(struct dasd_device *device, void __user *argp) | /* Set attributes (cache operations) Stores the attributes for cache operation to be used in Define Extend (DE). */
static int dasd_eckd_set_attrib(struct dasd_device *device, void __user *argp) | {
struct dasd_eckd_private *private =
(struct dasd_eckd_private *)device->private;
struct attrib_data_t attrib;
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
if (!argp)
return -EINVAL;
if (copy_from_user(&attrib, argp, sizeof(struct attrib_data_t)))
return -EFAULT;
private->attrib = attrib;
dev_info(&device->cdev->dev,
"The DASD cache mode was set to %x (%i cylinder prestage)\n",
private->attrib.operation, private->attrib.nr_cyl);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Sets up TUSB6010 CPU interface specific signals and registers Note: Settings optimized for OMAP24xx */ | static void __init tusb_setup_cpu_interface(struct musb *musb) | /* Sets up TUSB6010 CPU interface specific signals and registers Note: Settings optimized for OMAP24xx */
static void __init tusb_setup_cpu_interface(struct musb *musb) | {
void __iomem *tbase = musb->ctrl_base;
musb_writel(tbase, TUSB_PULLUP_1_CTRL, 0x0000003F);
musb_writel(tbase, TUSB_PULLUP_2_CTRL, 0x01FFFFFF);
musb_writel(tbase, TUSB_GPIO_CONF, TUSB_GPIO_CONF_DMAREQ(0x3f));
musb_writel(tbase, TUSB_DMA_REQ_CONF,
TUSB_DMA_REQ_CONF_BURST_SIZE(2) |
TUSB_DMA_REQ_CONF_DMA_REQ_EN(0x3f) |
TUSB_DMA_REQ_CONF_DMA_REQ_ASSER(2));
musb_writel(tbase, TUSB_WAIT_COUNT, 1);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Ensure no single-step breakpoint is pending. Returns non-zero value if child was being single-stepped. */ | int ptrace_cancel_bpt(struct task_struct *child) | /* Ensure no single-step breakpoint is pending. Returns non-zero value if child was being single-stepped. */
int ptrace_cancel_bpt(struct task_struct *child) | {
int i, nsaved = task_thread_info(child)->bpt_nsaved;
task_thread_info(child)->bpt_nsaved = 0;
if (nsaved > 2) {
printk("ptrace_cancel_bpt: bogus nsaved: %d!\n", nsaved);
nsaved = 2;
}
for (i = 0; i < nsaved; ++i) {
write_int(child, task_thread_info(child)->bpt_addr[i],
task_thread_info(child)->bpt_insn[i]);
}
return (nsaved != 0);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This file is part of the Simba project. */ | int mock_write_circular_buffer_init(void *buf_p, size_t size, int res) | /* This file is part of the Simba project. */
int mock_write_circular_buffer_init(void *buf_p, size_t size, int res) | {
harness_mock_write("circular_buffer_init(buf_p)",
buf_p,
size);
harness_mock_write("circular_buffer_init(size)",
&size,
sizeof(size));
harness_mock_write("circular_buffer_init(): return (res)",
&res,
sizeof(res));
return (0);
} | eerimoq/simba | C++ | Other | 337 |
/* One notified function to stop the Host Controller when gBS->ExitBootServices() called. */ | VOID EFIAPI UhcExitBootService(EFI_EVENT Event, VOID *Context) | /* One notified function to stop the Host Controller when gBS->ExitBootServices() called. */
VOID EFIAPI UhcExitBootService(EFI_EVENT Event, VOID *Context) | {
USB_HC_DEV *Uhc;
Uhc = (USB_HC_DEV *)Context;
UhciStopHc (Uhc, UHC_GENERIC_TIMEOUT);
UhciSetRegBit (Uhc->PciIo, USBCMD_OFFSET, USBCMD_HCRESET);
gBS->Stall (UHC_ROOT_PORT_RECOVERY_STALL);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Disable the automatic slave select function of the specified SPI port. */ | void SPIAutoSSDisable(unsigned long ulBase) | /* Disable the automatic slave select function of the specified SPI port. */
void SPIAutoSSDisable(unsigned long ulBase) | {
xASSERT(ulBase == SPI0_BASE);
xHWREG(ulBase + SPI_SSR) &= ~SPI_AUTOSS;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Returns CR_OK upon successful completion otherwise returns CR_BAD_PARAM_ERROR if at least one of the parameters is not valid or CR_OUT_BOUNDS_ERROR in case of error. */ | enum CRStatus cr_input_seek_index(CRInput *a_this, enum CRSeekPos a_origin, gint a_pos) | /* Returns CR_OK upon successful completion otherwise returns CR_BAD_PARAM_ERROR if at least one of the parameters is not valid or CR_OUT_BOUNDS_ERROR in case of error. */
enum CRStatus cr_input_seek_index(CRInput *a_this, enum CRSeekPos a_origin, gint a_pos) | {
glong abs_offset = 0;
g_return_val_if_fail (a_this && PRIVATE (a_this), CR_BAD_PARAM_ERROR);
switch (a_origin) {
case CR_SEEK_CUR:
abs_offset = PRIVATE (a_this)->next_byte_index - 1 + a_pos;
break;
case CR_SEEK_BEGIN:
abs_offset = a_pos;
break;
case CR_SEEK_END:
abs_offset = PRIVATE (a_this)->in_buf_size - 1 - a_pos;
break;
default:
return CR_BAD_PARAM_ERROR;
}
if ((abs_offset > 0)
&& (gulong) abs_offset < PRIVATE (a_this)->nb_bytes) {
PRIVATE (a_this)->next_byte_index = abs_offset + 1;
return CR_OK;
}
return CR_OUT_OF_BOUNDS_ERROR;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This function returns zero in case of success and a negative error code in case of failure. */ | static int default_mtd_writev(struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to, size_t *retlen) | /* This function returns zero in case of success and a negative error code in case of failure. */
static int default_mtd_writev(struct mtd_info *mtd, const struct kvec *vecs, unsigned long count, loff_t to, size_t *retlen) | {
unsigned long i;
size_t totlen = 0, thislen;
int ret = 0;
for (i = 0; i < count; i++) {
if (!vecs[i].iov_len)
continue;
ret = mtd_write(mtd, to, vecs[i].iov_len, &thislen,
vecs[i].iov_base);
totlen += thislen;
if (ret || thislen != vecs[i].iov_len)
break;
to += vecs[i].iov_len;
}
*retlen = totlen;
return ret;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Flush the L2 cache on Macs that have it by flipping the system into 24-bit mode for an instant. */ | void via_flush_cache(void) | /* Flush the L2 cache on Macs that have it by flipping the system into 24-bit mode for an instant. */
void via_flush_cache(void) | {
via2[gBufB] &= ~VIA2B_vMode32;
via2[gBufB] |= VIA2B_vMode32;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Record capsule status variable and to local cache. */ | EFI_STATUS RecordCapsuleStatusVariable(IN EFI_CAPSULE_HEADER *CapsuleHeader, IN EFI_STATUS CapsuleStatus) | /* Record capsule status variable and to local cache. */
EFI_STATUS RecordCapsuleStatusVariable(IN EFI_CAPSULE_HEADER *CapsuleHeader, IN EFI_STATUS CapsuleStatus) | {
EFI_CAPSULE_RESULT_VARIABLE_HEADER CapsuleResultVariable;
EFI_STATUS Status;
CapsuleResultVariable.VariableTotalSize = sizeof (CapsuleResultVariable);
CapsuleResultVariable.Reserved = 0;
CopyGuid (&CapsuleResultVariable.CapsuleGuid, &CapsuleHeader->CapsuleGuid);
ZeroMem (&CapsuleResultVariable.CapsuleProcessed, sizeof (CapsuleResultVariable.CapsuleProcessed));
gRT->GetTime (&CapsuleResultVariable.CapsuleProcessed, NULL);
CapsuleResultVariable.CapsuleStatus = CapsuleStatus;
Status = EFI_SUCCESS;
if ((CapsuleHeader->Flags & CAPSULE_FLAGS_PERSIST_ACROSS_RESET) != 0) {
Status = WriteNewCapsuleResultVariable (&CapsuleResultVariable, sizeof (CapsuleResultVariable));
}
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* In full data journalling mode the buffer may be of type BJ_AsyncData, because we're write()ing a buffer which is also part of a shared mapping. */ | int jbd2_journal_get_write_access(handle_t *handle, struct buffer_head *bh) | /* In full data journalling mode the buffer may be of type BJ_AsyncData, because we're write()ing a buffer which is also part of a shared mapping. */
int jbd2_journal_get_write_access(handle_t *handle, struct buffer_head *bh) | {
struct journal_head *jh = jbd2_journal_add_journal_head(bh);
int rc;
rc = do_get_write_access(handle, jh, 0);
jbd2_journal_put_journal_head(jh);
return rc;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Start the PWM of the PWM module.
The */ | void xPWMStart(unsigned long ulBase, unsigned long ulChannel) | /* Start the PWM of the PWM module.
The */
void xPWMStart(unsigned long ulBase, unsigned long ulChannel) | {
unsigned long ulChannelTemp;
ulChannelTemp = (ulBase == PWMA_BASE) ? ulChannel : (ulChannel - 4);
xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE));
xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 3)));
xHWREG(ulBase + PWM_PCR) |= (PWM_PCR_CH0EN << (ulChannelTemp << 3));
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Reads the value of the an area end address. */ | int32_t BSP_NFCTAG_ReadEndZonex(uint32_t Instance, const ST25DV_END_ZONE EndZone, uint8_t *pEndZ) | /* Reads the value of the an area end address. */
int32_t BSP_NFCTAG_ReadEndZonex(uint32_t Instance, const ST25DV_END_ZONE EndZone, uint8_t *pEndZ) | {
UNUSED(Instance);
return ST25DV_ReadEndZonex(&NfcTagObj, EndZone, pEndZ);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Configure the RTC AlarmA/B Subseconds value and mask. */ | void RTC_AlarmSubSecondConfig(uint32_t RTC_Alarm, uint32_t RTC_AlarmSubSecondValue, uint8_t RTC_AlarmSubSecondMask) | /* Configure the RTC AlarmA/B Subseconds value and mask. */
void RTC_AlarmSubSecondConfig(uint32_t RTC_Alarm, uint32_t RTC_AlarmSubSecondValue, uint8_t RTC_AlarmSubSecondMask) | {
uint32_t tmpreg = 0;
assert_param(IS_RTC_ALARM(RTC_Alarm));
assert_param(IS_RTC_ALARM_SUB_SECOND_VALUE(RTC_AlarmSubSecondValue));
assert_param(IS_RTC_ALARM_SUB_SECOND_MASK(RTC_AlarmSubSecondMask));
RTC->WPR = 0xCA;
RTC->WPR = 0x53;
tmpreg = (uint32_t) (((uint32_t)(RTC_AlarmSubSecondValue)) | ((uint32_t)(RTC_AlarmSubSecondMask) << 24));
RTC->ALRMASSR = tmpreg;
RTC->WPR = 0xFF;
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* Check the status of the Rx buffer of the specified SPI port. */ | xtBoolean xSPIIsRxEmpty(unsigned long ulBase) | /* Check the status of the Rx buffer of the specified SPI port. */
xtBoolean xSPIIsRxEmpty(unsigned long ulBase) | {
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE)||(ulBase == SPI3_BASE) );
return ((xHWREG(ulBase + SPI_STATUS) & SPI_STATUS_RX_EMPTY)? xtrue : xfalse);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Enables or disables the specified DMA Channeln interrupts. */ | void DMA_ITConfig(DMA_Channel_TypeDef *channel, DMA_Interrupt_EN_TypeDef it, FunctionalState state) | /* Enables or disables the specified DMA Channeln interrupts. */
void DMA_ITConfig(DMA_Channel_TypeDef *channel, DMA_Interrupt_EN_TypeDef it, FunctionalState state) | {
(state) ? (channel->CCR |= it) : (channel->CCR &= ~it);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This interface is limited to be used in either physical mode or virtual modes with paging enabled where the virtual to physical mappings for ThunkContext.RealModeBuffer is mapped 1:1. */ | VOID EFIAPI AsmThunk16(IN OUT THUNK_CONTEXT *ThunkContext) | /* This interface is limited to be used in either physical mode or virtual modes with paging enabled where the virtual to physical mappings for ThunkContext.RealModeBuffer is mapped 1:1. */
VOID EFIAPI AsmThunk16(IN OUT THUNK_CONTEXT *ThunkContext) | {
IA32_REGISTER_SET *UpdatedRegs;
ASSERT (ThunkContext != NULL);
ASSERT ((UINTN)ThunkContext->RealModeBuffer < 0x100000);
ASSERT (ThunkContext->RealModeBufferSize >= m16Size);
ASSERT ((UINTN)ThunkContext->RealModeBuffer + m16Size <= 0x100000);
ASSERT (
((ThunkContext->ThunkAttributes & (THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 | THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL)) != \
(THUNK_ATTRIBUTE_DISABLE_A20_MASK_INT_15 | THUNK_ATTRIBUTE_DISABLE_A20_MASK_KBD_CTRL))
);
UpdatedRegs = InternalAsmThunk16 (
ThunkContext->RealModeState,
ThunkContext->RealModeBuffer
);
CopyMem (ThunkContext->RealModeState, UpdatedRegs, sizeof (*UpdatedRegs));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Read packets from a capture file, and call the callback for each packet. If cnt > 0, return after 'cnt' packets, otherwise continue until eof. */ | int pcap_offline_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) | /* Read packets from a capture file, and call the callback for each packet. If cnt > 0, return after 'cnt' packets, otherwise continue until eof. */
int pcap_offline_read(pcap_t *p, int cnt, pcap_handler callback, u_char *user) | {
struct bpf_insn *fcode;
int status = 0;
int n = 0;
u_char *data;
while (status == 0) {
struct pcap_pkthdr h;
if (p->break_loop) {
if (n == 0) {
p->break_loop = 0;
return (-2);
} else
return (n);
}
status = p->next_packet_op(p, &h, &data);
if (status) {
if (status == 1)
return (0);
return (status);
}
if ((fcode = p->fcode.bf_insns) == NULL ||
bpf_filter(fcode, data, h.len, h.caplen)) {
(*callback)(user, &h, data);
if (++n >= cnt && cnt > 0)
break;
}
}
return (n);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Convenience functions for opening and closing files using sqlite3_malloc() to obtain space for the file-handle structure. */ | SQLITE_PRIVATE int sqlite3OsOpenMalloc(sqlite3_vfs *, const char *, sqlite3_file **, int, int *) | /* Convenience functions for opening and closing files using sqlite3_malloc() to obtain space for the file-handle structure. */
SQLITE_PRIVATE int sqlite3OsOpenMalloc(sqlite3_vfs *, const char *, sqlite3_file **, int, int *) | {
int rc = SQLITE_NOMEM;
sqlite3_file *pFile;
pFile = (sqlite3_file *)sqlite3MallocZero(pVfs->szOsFile);
if( pFile ){
rc = sqlite3OsOpen(pVfs, zFile, pFile, flags, pOutFlags);
if( rc!=SQLITE_OK ){
sqlite3_free(pFile);
}else{
*ppFile = pFile;
}
}
return rc;
} | DC-SWAT/DreamShell | C++ | null | 404 |
/* Send address which has failed during check memory. */ | static bool udi_dfu_atmel_mem_send_last_add(void) | /* Send address which has failed during check memory. */
static bool udi_dfu_atmel_mem_send_last_add(void) | {
udi_dfu_atmel_buf_trans[0] = (uint8_t)(udi_dfu_atmel_mem_add>>8);
udi_dfu_atmel_buf_trans[1] = (uint8_t)udi_dfu_atmel_mem_add;
udd_set_setup_payload( udi_dfu_atmel_buf_trans, 2);
return true;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* @hob_list: A HOB list pointer. @len: A pointer to the GUID HOB data buffer length. If the GUID HOB is located, the length will be updated. @guid A pointer to HOB GUID. */ | void* hob_get_guid_hob_data(const void *hob_list, u32 *len, const efi_guid_t *guid) | /* @hob_list: A HOB list pointer. @len: A pointer to the GUID HOB data buffer length. If the GUID HOB is located, the length will be updated. @guid A pointer to HOB GUID. */
void* hob_get_guid_hob_data(const void *hob_list, u32 *len, const efi_guid_t *guid) | {
const struct hob_header *guid_hob;
guid_hob = hob_get_next_guid_hob(guid, hob_list);
if (!guid_hob)
return NULL;
if (len)
*len = get_guid_hob_data_size(guid_hob);
return get_guid_hob_data(guid_hob);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Load palette into the DAC registers. arg points to a colour map, 3 bytes per colour, 16 colours, range from 0 to 255. */ | int con_set_cmap(unsigned char __user *arg) | /* Load palette into the DAC registers. arg points to a colour map, 3 bytes per colour, 16 colours, range from 0 to 255. */
int con_set_cmap(unsigned char __user *arg) | {
int rc;
acquire_console_sem();
rc = set_get_cmap (arg,1);
release_console_sem();
return rc;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns 1 if the given PCM format is linear, 0 if not. */ | int snd_pcm_format_linear(snd_pcm_format_t format) | /* Returns 1 if the given PCM format is linear, 0 if not. */
int snd_pcm_format_linear(snd_pcm_format_t format) | {
return snd_pcm_format_signed(format) >= 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* 8-bit packed YCbCr samples w/ no subsampling => RGB */ | DECLAREContigPutFunc(putcontig8bitYCbCr11tile) | /* 8-bit packed YCbCr samples w/ no subsampling => RGB */
DECLAREContigPutFunc(putcontig8bitYCbCr11tile) | {
(void) y;
fromskew = (fromskew / 1) * (1 * 1 + 2);
do {
x = w;
do {
int32 Cb = pp[1];
int32 Cr = pp[2];
YCbCrtoRGB(*cp++, pp[0]);
pp += 3;
} while (--x);
cp += toskew;
pp += fromskew;
} while (--h);
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Sets the color ramps on behalf of RandR */ | void intel_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, u16 blue, int regno) | /* Sets the color ramps on behalf of RandR */
void intel_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green, u16 blue, int regno) | {
struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
intel_crtc->lut_r[regno] = red >> 8;
intel_crtc->lut_g[regno] = green >> 8;
intel_crtc->lut_b[regno] = blue >> 8;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Setup timer 1 compare match A to generate a tick interrupt. */ | static void prvSetupTimerInterrupt(void) | /* Setup timer 1 compare match A to generate a tick interrupt. */
static void prvSetupTimerInterrupt(void) | {
unsigned long ulCompareMatch;
unsigned char ucHighByte, ucLowByte;
ulCompareMatch = configCPU_CLOCK_HZ / configTICK_RATE_HZ;
ulCompareMatch /= portCLOCK_PRESCALER;
ulCompareMatch -= ( unsigned long ) 1;
ucLowByte = ( unsigned char ) ( ulCompareMatch & ( unsigned long ) 0xff );
ulCompareMatch >>= 8;
ucHighByte = ( unsigned char ) ( ulCompareMatch & ( unsigned long ) 0xff );
OCR1AH = ucHighByte;
OCR1AL = ucLowByte;
ucLowByte = portCLEAR_COUNTER_ON_MATCH | portPRESCALE_64;
TCCR1B = ucLowByte;
TIMSK |= portCOMPARE_MATCH_A_INTERRUPT_ENABLE;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* This function must be called with @dev->sem held. */ | int device_bind_driver(struct device *dev) | /* This function must be called with @dev->sem held. */
int device_bind_driver(struct device *dev) | {
int ret;
ret = driver_sysfs_add(dev);
if (!ret)
driver_bound(dev);
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Requests received while the lockspace is in recovery get added to the request queue and processed when recovery is complete. This happens when the lockspace is suspended on some nodes before it is on others, or the lockspace is enabled on some while still suspended on others. */ | void dlm_add_requestqueue(struct dlm_ls *ls, int nodeid, struct dlm_message *ms) | /* Requests received while the lockspace is in recovery get added to the request queue and processed when recovery is complete. This happens when the lockspace is suspended on some nodes before it is on others, or the lockspace is enabled on some while still suspended on others. */
void dlm_add_requestqueue(struct dlm_ls *ls, int nodeid, struct dlm_message *ms) | {
struct rq_entry *e;
int length = ms->m_header.h_length - sizeof(struct dlm_message);
e = kmalloc(sizeof(struct rq_entry) + length, GFP_NOFS);
if (!e) {
log_print("dlm_add_requestqueue: out of memory len %d", length);
return;
}
e->nodeid = nodeid;
memcpy(&e->request, ms, ms->m_header.h_length);
mutex_lock(&ls->ls_requestqueue_mutex);
list_add_tail(&e->list, &ls->ls_requestqueue);
mutex_unlock(&ls->ls_requestqueue_mutex);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Checks whether the specified ETHERNET Rx Desc flag is set or not. */ | uint8_t ETH_ReadDMARxDescFlagStatus(ETH_DMADescConfig_T *DMARxDesc, ETH_DMARXDESC_FLAG_T flag) | /* Checks whether the specified ETHERNET Rx Desc flag is set or not. */
uint8_t ETH_ReadDMARxDescFlagStatus(ETH_DMADescConfig_T *DMARxDesc, ETH_DMARXDESC_FLAG_T flag) | {
return (DMARxDesc->Status & flag) ? SET : RESET;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The function reads the requested number of blocks from the device. All the blocks are read, or an error is returned. If there is no media in the device, the function returns EFI_NO_MEDIA. */ | EFI_STATUS EFIAPI UfsBlockIoPeimReadBlocks2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, IN UINTN DeviceIndex, IN EFI_PEI_LBA StartLBA, IN UINTN BufferSize, OUT VOID *Buffer) | /* The function reads the requested number of blocks from the device. All the blocks are read, or an error is returned. If there is no media in the device, the function returns EFI_NO_MEDIA. */
EFI_STATUS EFIAPI UfsBlockIoPeimReadBlocks2(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_RECOVERY_BLOCK_IO2_PPI *This, IN UINTN DeviceIndex, IN EFI_PEI_LBA StartLBA, IN UINTN BufferSize, OUT VOID *Buffer) | {
EFI_STATUS Status;
UFS_PEIM_HC_PRIVATE_DATA *Private;
Status = EFI_SUCCESS;
Private = GET_UFS_PEIM_HC_PRIVATE_DATA_FROM_THIS2 (This);
Status = UfsBlockIoPeimReadBlocks (
PeiServices,
&Private->BlkIoPpi,
DeviceIndex,
StartLBA,
BufferSize,
Buffer
);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* param base DCDC peripheral base address. param clockSource Clock source for DCDC. See to "dcdc_clock_source_t". */ | void DCDC_SetClockSource(DCDC_Type *base, dcdc_clock_source_t clockSource) | /* param base DCDC peripheral base address. param clockSource Clock source for DCDC. See to "dcdc_clock_source_t". */
void DCDC_SetClockSource(DCDC_Type *base, dcdc_clock_source_t clockSource) | {
uint32_t tmp32;
tmp32 = base->REG0 & ~(DCDC_REG0_XTAL_24M_OK_MASK | DCDC_REG0_DISABLE_AUTO_CLK_SWITCH_MASK |
DCDC_REG0_SEL_CLK_MASK | DCDC_REG0_PWD_OSC_INT_MASK);
switch (clockSource)
{
case kDCDC_ClockInternalOsc:
tmp32 |= DCDC_REG0_DISABLE_AUTO_CLK_SWITCH_MASK;
break;
case kDCDC_ClockExternalOsc:
tmp32 |= DCDC_REG0_DISABLE_AUTO_CLK_SWITCH_MASK | DCDC_REG0_SEL_CLK_MASK | DCDC_REG0_PWD_OSC_INT_MASK;
break;
case kDCDC_ClockAutoSwitch:
tmp32 |= DCDC_REG0_XTAL_24M_OK_MASK;
break;
default:
assert(false);
break;
}
base->REG0 = tmp32;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* DeInitializes the peripherals used by the SPI EEPROM driver. */ | void sEE_DeInit(void) | /* DeInitializes the peripherals used by the SPI EEPROM driver. */
void sEE_DeInit(void) | {
sEE_SPI_LowLevel_DeInit();
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* Read PHY register. Return 1 if successfully, 0 if timeout. */ | unsigned char EMAC_ReadPhy(unsigned char PhyAddress, unsigned char Address, unsigned int *pValue, unsigned int retry) | /* Read PHY register. Return 1 if successfully, 0 if timeout. */
unsigned char EMAC_ReadPhy(unsigned char PhyAddress, unsigned char Address, unsigned int *pValue, unsigned int retry) | {
AT91C_BASE_EMAC->EMAC_MAN = (AT91C_EMAC_SOF & (0x01 << 30))
| (AT91C_EMAC_CODE & (2 << 16))
| (AT91C_EMAC_RW & (2 << 28))
| (AT91C_EMAC_PHYA & ((PhyAddress & 0x1f) << 23))
| (AT91C_EMAC_REGA & (Address << 18));
if ( EMAC_WaitPhy(retry) == 0 ) {
trace_LOG(trace_ERROR, "TimeOut EMAC_ReadPhy\n\r");
return 0;
}
*pValue = ( AT91C_BASE_EMAC->EMAC_MAN & 0x0000ffff );
return 1;
} | apopple/Pandaboard-FreeRTOS | C++ | null | 25 |
/* Returns the current protection level for an EEPROM block. */ | uint32_t EEPROMBlockProtectGet(uint32_t ui32Block) | /* Returns the current protection level for an EEPROM block. */
uint32_t EEPROMBlockProtectGet(uint32_t ui32Block) | {
ASSERT(ui32Block < BLOCKS_FROM_EESIZE(HWREG(EEPROM_EESIZE)));
HWREG(EEPROM_EEBLOCK) = ui32Block;
return (HWREG(EEPROM_EEPROT));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* If this interface is not supported, then return FALSE. */ | BOOLEAN EFIAPI Pkcs7Sign(IN CONST UINT8 *PrivateKey, IN UINTN PrivateKeySize, IN CONST UINT8 *KeyPassword, IN UINT8 *InData, IN UINTN InDataSize, IN UINT8 *SignCert, IN UINT8 *OtherCerts OPTIONAL, OUT UINT8 **SignedData, OUT UINTN *SignedDataSize) | /* If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI Pkcs7Sign(IN CONST UINT8 *PrivateKey, IN UINTN PrivateKeySize, IN CONST UINT8 *KeyPassword, IN UINT8 *InData, IN UINTN InDataSize, IN UINT8 *SignCert, IN UINT8 *OtherCerts OPTIONAL, OUT UINT8 **SignedData, OUT UINTN *SignedDataSize) | {
CALL_CRYPTO_SERVICE (Pkcs7Sign, (PrivateKey, PrivateKeySize, KeyPassword, InData, InDataSize, SignCert, OtherCerts, SignedData, SignedDataSize), FALSE);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ | UINT8 EFIAPI PciExpressBitFieldWrite8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 Value) | /* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT8 EFIAPI PciExpressBitFieldWrite8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 Value) | {
if (Address >= mSmmPciExpressLibPciExpressBaseSize) {
return (UINT8)-1;
}
return MmioBitFieldWrite8 (
GetPciExpressAddress (Address),
StartBit,
EndBit,
Value
);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This will advance the pointer to the data portion of the control message of the work request's buffer that was populated after the work request finished. */ | static void qemu_rdma_move_header(RDMAContext *rdma, int idx, RDMAControlHeader *head) | /* This will advance the pointer to the data portion of the control message of the work request's buffer that was populated after the work request finished. */
static void qemu_rdma_move_header(RDMAContext *rdma, int idx, RDMAControlHeader *head) | {
rdma->wr_data[idx].control_len = head->len;
rdma->wr_data[idx].control_curr =
rdma->wr_data[idx].control + sizeof(RDMAControlHeader);
} | ve3wwg/teensy3_qemu | C | Other | 15 |
/* param base Pointer to FLEXIO_I2S_Type structure. param handle FlexIO I2S handle pointer. param format Pointer to audio data format structure. param srcClock_Hz FlexIO I2S bit clock source frequency in Hz. This parameter should be 0 while in slave mode. */ | void FLEXIO_I2S_TransferSetFormat(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, flexio_i2s_format_t *format, uint32_t srcClock_Hz) | /* param base Pointer to FLEXIO_I2S_Type structure. param handle FlexIO I2S handle pointer. param format Pointer to audio data format structure. param srcClock_Hz FlexIO I2S bit clock source frequency in Hz. This parameter should be 0 while in slave mode. */
void FLEXIO_I2S_TransferSetFormat(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, flexio_i2s_format_t *format, uint32_t srcClock_Hz) | {
assert((handle != NULL) && (format != NULL));
handle->bitWidth = format->bitWidth;
if (srcClock_Hz != 0UL)
{
FLEXIO_I2S_MasterSetFormat(base, format, srcClock_Hz);
}
else
{
FLEXIO_I2S_SlaveSetFormat(base, format);
}
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Return: 0 if all went well, else returns appropriate error value. */ | static int ti_sci_cmd_clk_is_on(const struct ti_sci_handle *handle, u32 dev_id, u8 clk_id, bool *req_state, bool *curr_state) | /* Return: 0 if all went well, else returns appropriate error value. */
static int ti_sci_cmd_clk_is_on(const struct ti_sci_handle *handle, u32 dev_id, u8 clk_id, bool *req_state, bool *curr_state) | {
u8 c_state = 0, r_state = 0;
int ret;
if (!req_state && !curr_state)
return -EINVAL;
ret = ti_sci_cmd_get_clock_state(handle, dev_id, clk_id,
&r_state, &c_state);
if (ret)
return ret;
if (req_state)
*req_state = (r_state == MSG_CLOCK_SW_STATE_REQ);
if (curr_state)
*curr_state = (c_state == MSG_CLOCK_HW_STATE_READY);
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Returns the current device address in device mode. */ | uint32_t USBDevAddrGet(uint32_t ui32Base) | /* Returns the current device address in device mode. */
uint32_t USBDevAddrGet(uint32_t ui32Base) | {
ASSERT(ui32Base == USB0_BASE);
return (HWREGB(ui32Base + USB_O_FADDR));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Recognize the Hash algorithm in PE/COFF Authenticode and calculate hash of Pe/Coff image based on the authenticated image hashing in PE/COFF Specification 8.0 Appendix A */ | EFI_STATUS HashPeImageByType(VOID) | /* Recognize the Hash algorithm in PE/COFF Authenticode and calculate hash of Pe/Coff image based on the authenticated image hashing in PE/COFF Specification 8.0 Appendix A */
EFI_STATUS HashPeImageByType(VOID) | {
UINT8 Index;
WIN_CERTIFICATE_EFI_PKCS *PkcsCertData;
PkcsCertData = (WIN_CERTIFICATE_EFI_PKCS *)(mImageBase + mSecDataDir->Offset);
for (Index = 0; Index < HASHALG_MAX; Index++) {
if ((*(PkcsCertData->CertData + 1) & TWO_BYTE_ENCODE) != TWO_BYTE_ENCODE) {
continue;
}
if (CompareMem (PkcsCertData->CertData + 32, mHash[Index].OidValue, mHash[Index].OidLength) == 0) {
break;
}
}
if (Index == HASHALG_MAX) {
return EFI_UNSUPPORTED;
}
if (!HashPeImage (Index)) {
return EFI_UNSUPPORTED;
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Enables or disables the specified DAC channel DMA request. */ | void DAC_DmaEnable(uint32_t DAC_Channel, FunctionalState Cmd) | /* Enables or disables the specified DAC channel DMA request. */
void DAC_DmaEnable(uint32_t DAC_Channel, FunctionalState Cmd) | {
assert_param(IS_DAC_CHANNEL(DAC_Channel));
assert_param(IS_FUNCTIONAL_STATE(Cmd));
if (Cmd != DISABLE)
{
DAC->CTRL |= (DAC_CTRL_DMA1EN << DAC_Channel);
}
else
{
DAC->CTRL &= ~(DAC_CTRL_DMA1EN << DAC_Channel);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* LTDC MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef *hltdc) | /* LTDC MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_LTDC_MspDeInit(LTDC_HandleTypeDef *hltdc) | {
if(hltdc->Instance==LTDC)
{
__HAL_RCC_LTDC_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOI, GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_2
|GPIO_PIN_5);
HAL_GPIO_DeInit(GPIOF, GPIO_PIN_10);
HAL_GPIO_DeInit(GPIOH, GPIO_PIN_4|GPIO_PIN_9|GPIO_PIN_10|GPIO_PIN_11
|GPIO_PIN_14);
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_6|GPIO_PIN_8);
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_1|GPIO_PIN_10|GPIO_PIN_8|GPIO_PIN_9);
HAL_GPIO_DeInit(GPIOG, GPIO_PIN_6|GPIO_PIN_7|GPIO_PIN_12);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.