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 |
|---|---|---|---|---|---|---|---|
/* param base PDM base pointer. param handle PDM eDMA handle pointer. param channel channel index. param pdmConfig pdm channel configurations. */ | void PDM_TransferSetChannelConfigEDMA(PDM_Type *base, pdm_edma_handle_t *handle, uint32_t channel, const pdm_channel_config_t *config) | /* param base PDM base pointer. param handle PDM eDMA handle pointer. param channel channel index. param pdmConfig pdm channel configurations. */
void PDM_TransferSetChannelConfigEDMA(PDM_Type *base, pdm_edma_handle_t *handle, uint32_t channel, const pdm_channel_config_t *config) | {
assert((handle != NULL) && (config != NULL));
assert(channel < (uint32_t)FSL_FEATURE_PDM_CHANNEL_NUM);
PDM_SetChannelConfig(base, channel, config);
handle->endChannel = (uint8_t)channel;
handle->channelNums++;
handle->count = (uint8_t)(base->FIFO_CTRL & PDM_FIFO_CTRL_FIFOWMK_MASK);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This API function returns whether or not the policy engine is currently being enforced. */ | EFI_STATUS EFIAPI ProtocolIsVariablePolicyEnabled(OUT BOOLEAN *State) | /* This API function returns whether or not the policy engine is currently being enforced. */
EFI_STATUS EFIAPI ProtocolIsVariablePolicyEnabled(OUT BOOLEAN *State) | {
*State = IsVariablePolicyEnabled ();
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Call subsys's pre_destroy handler. This is called before css refcnt check. */ | static int cgroup_call_pre_destroy(struct cgroup *cgrp) | /* Call subsys's pre_destroy handler. This is called before css refcnt check. */
static int cgroup_call_pre_destroy(struct cgroup *cgrp) | {
struct cgroup_subsys *ss;
int ret = 0;
for_each_subsys(cgrp->root, ss)
if (ss->pre_destroy) {
ret = ss->pre_destroy(ss, cgrp);
if (ret)
break;
}
return ret;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* create a new Lua closure, push it in the stack, and initialize its upvalues. */ | static void pushclosure(lua_State *L, Proto *p, UpVal **encup, StkId base, StkId ra) | /* create a new Lua closure, push it in the stack, and initialize its upvalues. */
static void pushclosure(lua_State *L, Proto *p, UpVal **encup, StkId base, StkId ra) | {
int nup = p->sizeupvalues;
Upvaldesc *uv = p->upvalues;
int i;
LClosure *ncl = luaF_newLclosure(L, nup);
ncl->p = p;
setclLvalue2s(L, ra, ncl);
for (i = 0; i < nup; i++) {
if (uv[i].instack)
ncl->upvals[i] = luaF_findupval(L, base + uv[i].idx);
else
ncl->upvals[i] = encup[uv[i].idx];... | Nicholas3388/LuaNode | C++ | Other | 1,055 |
/* Function for enabling the IRQ for a given PWM instance. */ | __STATIC_INLINE void pwm_irq_enable(app_pwm_t const *const p_instance) | /* Function for enabling the IRQ for a given PWM instance. */
__STATIC_INLINE void pwm_irq_enable(app_pwm_t const *const p_instance) | {
nrf_drv_timer_compare_int_enable(p_instance->p_timer, PWM_MAIN_CC_CHANNEL);
} | labapart/polymcu | C++ | null | 201 |
/* Registers a function to be called when an interrupt occurs. */ | void IntRegister(uint32_t ui32Interrupt, void(*pfnHandler)(void)) | /* Registers a function to be called when an interrupt occurs. */
void IntRegister(uint32_t ui32Interrupt, void(*pfnHandler)(void)) | {
uint32_t ui32Idx, ui32Value;
ASSERT(ui32Interrupt < NUM_INTERRUPTS);
ASSERT(((uint32_t)g_pfnRAMVectors & 0x000003ff) == 0);
if (HWREG(NVIC_VTABLE) != (uint32_t)g_pfnRAMVectors)
{
ui32Value = HWREG(NVIC_VTABLE);
for (ui32Idx = 0; ui32Idx < NUM_INTERRUPTS; ui32Idx++)
{
... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Generic bitmap get function used in 'font->get_bitmap' when the font NOT contains all characters in the range (sparse) */ | const uint8_t* lv_font_get_bitmap_sparse(const lv_font_t *font, uint32_t unicode_letter) | /* Generic bitmap get function used in 'font->get_bitmap' when the font NOT contains all characters in the range (sparse) */
const uint8_t* lv_font_get_bitmap_sparse(const lv_font_t *font, uint32_t unicode_letter) | {
if(unicode_letter < font->unicode_first || unicode_letter > font->unicode_last) return NULL;
uint32_t i;
for(i = 0; font->unicode_list[i] != 0; i++) {
if(font->unicode_list[i] == unicode_letter) {
return &font->glyph_bitmap[font->glyph_dsc[i].glyph_index];
}
}
return NU... | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* Frees memory used by proto routines. Called at program shutdown */ | void prefs_cleanup(void) | /* Frees memory used by proto routines. Called at program shutdown */
void prefs_cleanup(void) | {
prefs_modules_foreach(free_module_prefs, NULL);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Return version of the Base protocol supported by SCP firmware. */ | STATIC EFI_STATUS BaseGetVersion(IN SCMI_BASE_PROTOCOL *This, OUT UINT32 *Version) | /* Return version of the Base protocol supported by SCP firmware. */
STATIC EFI_STATUS BaseGetVersion(IN SCMI_BASE_PROTOCOL *This, OUT UINT32 *Version) | {
return ScmiGetProtocolVersion (ScmiProtocolIdBase, Version);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Calculates the remaining file size and new position of the pointer. */ | void BSP_AUDIO_OUT_TransferComplete_CallBack(void) | /* Calculates the remaining file size and new position of the pointer. */
void BSP_AUDIO_OUT_TransferComplete_CallBack(void) | {
if(audio_state == AUDIO_STATE_PLAYING)
{
BSP_AUDIO_OUT_ChangeBuffer((uint16_t*)&buffer_ctl.buff[0], AUDIO_BUFFER_SIZE /2);
buffer_ctl.state = BUFFER_OFFSET_FULL;
}
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Performs an atomic decrement operation for semaphore. The compare exchange operation must be performed using MP safe mechanisms. */ | VOID LibWaitForSemaphore(IN OUT volatile UINT32 *Sem) | /* Performs an atomic decrement operation for semaphore. The compare exchange operation must be performed using MP safe mechanisms. */
VOID LibWaitForSemaphore(IN OUT volatile UINT32 *Sem) | {
UINT32 Value;
do {
Value = *Sem;
} while (Value == 0 ||
InterlockedCompareExchange32 (
Sem,
Value,
Value - 1
) != Value);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Program the DPLL with the supplied M, N values, and wait for the DPLL to lock.. Returns -EINVAL upon error, or 0 upon success. */ | int omap3_noncore_dpll_program(struct clk *clk, u16 m, u8 n, u16 freqsel) | /* Program the DPLL with the supplied M, N values, and wait for the DPLL to lock.. Returns -EINVAL upon error, or 0 upon success. */
int omap3_noncore_dpll_program(struct clk *clk, u16 m, u8 n, u16 freqsel) | {
struct dpll_data *dd = clk->dpll_data;
u32 v;
_omap3_noncore_dpll_bypass(clk);
if (!cpu_is_omap44xx()) {
v = __raw_readl(dd->control_reg);
v &= ~dd->freqsel_mask;
v |= freqsel << __ffs(dd->freqsel_mask);
__raw_writel(v, dd->control_reg);
}
v = __raw_readl(dd->mult_div1_reg);
v &= ~(dd->mult_mask | dd->... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Check the status of the Rx buffer of the specified SPI port. */ | xtBoolean SPIIsRxEmpty(unsigned long ulBase) | /* Check the status of the Rx buffer of the specified SPI port. */
xtBoolean SPIIsRxEmpty(unsigned long ulBase) | {
xASSERT(ulBase == SPI0_BASE);
return ((xHWREG(ulBase + SPI_SR) & SPI_SR_RXBNE)? xfalse : xtrue);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* This API is used to get the high rate(int2_high_rate) interrupt2 enable bits of the sensor in the registers 0x19 bit 3. */ | BMG160_RETURN_FUNCTION_TYPE bmg160_get_intr2_highrate(u8 *v_intr2_highrate_u8) | /* This API is used to get the high rate(int2_high_rate) interrupt2 enable bits of the sensor in the registers 0x19 bit 3. */
BMG160_RETURN_FUNCTION_TYPE bmg160_get_intr2_highrate(u8 *v_intr2_highrate_u8) | {
BMG160_RETURN_FUNCTION_TYPE comres = ERROR;
u8 v_data_u8 = BMG160_INIT_VALUE;
if (p_bmg160 == BMG160_NULL)
{
return E_BMG160_NULL_PTR;
}
else
{
comres = p_bmg160->BMG160_BUS_READ_FUNC(p_bmg160->dev_addr,
BMG160_INTR_MAP_TWO_... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* This function is triggered by timer periodically to check the state of APs for StartupAllAPs() and StartupThisAP() executed in non-blocking mode. */ | VOID EFIAPI CheckApsStatus(IN EFI_EVENT Event, IN VOID *Context) | /* This function is triggered by timer periodically to check the state of APs for StartupAllAPs() and StartupThisAP() executed in non-blocking mode. */
VOID EFIAPI CheckApsStatus(IN EFI_EVENT Event, IN VOID *Context) | {
if (!mStopCheckAllApsStatus) {
CheckAndUpdateApsStatus ();
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Hands off the ZCL Relative Humidity Measurement dissector. */ | void proto_reg_handoff_zbee_zcl_relhum_meas(void) | /* Hands off the ZCL Relative Humidity Measurement dissector. */
void proto_reg_handoff_zbee_zcl_relhum_meas(void) | {
zbee_zcl_init_cluster( proto_zbee_zcl_relhum_meas,
ett_zbee_zcl_relhum_meas,
ZBEE_ZCL_CID_REL_HUMIDITY_MEASUREMENT,
hf_zbee_zcl_relhum_meas_attr_id,
-1, -1,
(zbee_zcl_fn_att... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This thread will attempt to discover other partitions to activate based on info provided by SAL. This new thread is short lived and will exit once discovery is complete. */ | static int xpc_initiate_discovery(void *ignore) | /* This thread will attempt to discover other partitions to activate based on info provided by SAL. This new thread is short lived and will exit once discovery is complete. */
static int xpc_initiate_discovery(void *ignore) | {
xpc_discovery();
dev_dbg(xpc_part, "discovery thread is exiting\n");
complete(&xpc_discovery_exited);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* System global reset.
Use this function to reset system global. */ | void system_global_reset(void) | /* System global reset.
Use this function to reset system global. */
void system_global_reset(void) | {
AON_GP_REGS0->AON_GLOBAL_RESET.reg &= \
~AON_GP_REGS_AON_GLOBAL_RESET_GLOBAL_RSTN;
AON_GP_REGS0->AON_GLOBAL_RESET.reg |= \
AON_GP_REGS_AON_GLOBAL_RESET_GLOBAL_RSTN;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* -ECHILD should be in ->notask_error before the first call. Returns nonzero for a final return, when we have unlocked tasklist_lock. Returns zero if the search for a child should continue; then ->notask_error is 0 if there were any eligible children, or another error from security_task_wait(), or still -ECHILD. */ | static int do_wait_thread(struct wait_opts *wo, struct task_struct *tsk) | /* -ECHILD should be in ->notask_error before the first call. Returns nonzero for a final return, when we have unlocked tasklist_lock. Returns zero if the search for a child should continue; then ->notask_error is 0 if there were any eligible children, or another error from security_task_wait(), or still -ECHILD. */
s... | {
struct task_struct *p;
list_for_each_entry(p, &tsk->children, sibling) {
int ret = wait_consider_task(wo, 0, p);
if (ret)
return ret;
}
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Get the port status. This function is required to ACK the port change bits although it will return the port changes in PortState. Bus enumeration code doesn't need to ACK the port change bits. */ | EFI_STATUS UsbRootHubGetPortStatus(IN USB_INTERFACE *HubIf, IN UINT8 Port, OUT EFI_USB_PORT_STATUS *PortState) | /* Get the port status. This function is required to ACK the port change bits although it will return the port changes in PortState. Bus enumeration code doesn't need to ACK the port change bits. */
EFI_STATUS UsbRootHubGetPortStatus(IN USB_INTERFACE *HubIf, IN UINT8 Port, OUT EFI_USB_PORT_STATUS *PortState) | {
USB_BUS *Bus;
EFI_STATUS Status;
Bus = HubIf->Device->Bus;
Status = UsbHcGetRootHubPortStatus (Bus, Port, PortState);
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* For space efficiency regular files store uid and gid indexes, which are converted to 32-bit uids/gids using an id look up table. This table is stored compressed into metadata blocks. A second index table is used to locate these. This second index table for speed of access (and because it is small) is read at mount t... | int squashfs_get_id(struct super_block *sb, unsigned int index, unsigned int *id) | /* For space efficiency regular files store uid and gid indexes, which are converted to 32-bit uids/gids using an id look up table. This table is stored compressed into metadata blocks. A second index table is used to locate these. This second index table for speed of access (and because it is small) is read at mount t... | {
struct squashfs_sb_info *msblk = sb->s_fs_info;
int block = SQUASHFS_ID_BLOCK(index);
int offset = SQUASHFS_ID_BLOCK_OFFSET(index);
u64 start_block = le64_to_cpu(msblk->id_table[block]);
__le32 disk_id;
int err;
err = squashfs_read_metadata(sb, &disk_id, &start_block, &offset,
sizeof(disk_id));
if (err... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This helper function reads properties of a LEB @lnum and stores them in @lp. Returns zero in case of success and a negative error code in case of failure. */ | int ubifs_read_one_lp(struct ubifs_info *c, int lnum, struct ubifs_lprops *lp) | /* This helper function reads properties of a LEB @lnum and stores them in @lp. Returns zero in case of success and a negative error code in case of failure. */
int ubifs_read_one_lp(struct ubifs_info *c, int lnum, struct ubifs_lprops *lp) | {
int err = 0;
const struct ubifs_lprops *lpp;
ubifs_get_lprops(c);
lpp = ubifs_lpt_lookup(c, lnum);
if (IS_ERR(lpp)) {
err = PTR_ERR(lpp);
ubifs_err("cannot read properties of LEB %d, error %d",
lnum, err);
goto out;
}
memcpy(lp, lpp, sizeof(struct ubifs_lprops));
out:
ubifs_release_lprops(c);
retu... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Set nonblocking mode on an unactivated pcap_t; this sets a flag checked by pcap_activate(), which sets the mode after calling the activate routine. */ | static int pcap_setnonblock_unactivated(pcap_t *p, int nonblock) | /* Set nonblocking mode on an unactivated pcap_t; this sets a flag checked by pcap_activate(), which sets the mode after calling the activate routine. */
static int pcap_setnonblock_unactivated(pcap_t *p, int nonblock) | {
p->opt.nonblock = nonblock;
return (0);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Print the 48-bit EUI MAC address of the radio controller when reading /sys/class/uwb_rc/XX/mac_address */ | static ssize_t uwb_rc_mac_addr_show(struct device *dev, struct device_attribute *attr, char *buf) | /* Print the 48-bit EUI MAC address of the radio controller when reading /sys/class/uwb_rc/XX/mac_address */
static ssize_t uwb_rc_mac_addr_show(struct device *dev, struct device_attribute *attr, char *buf) | {
struct uwb_dev *uwb_dev = to_uwb_dev(dev);
struct uwb_rc *rc = uwb_dev->rc;
struct uwb_mac_addr addr;
ssize_t result;
mutex_lock(&rc->uwb_dev.mutex);
result = uwb_rc_addr_get(rc, &addr, UWB_ADDR_MAC);
mutex_unlock(&rc->uwb_dev.mutex);
if (result >= 0) {
result = uwb_mac_addr_print(buf, UWB_ADDR_STRSIZE, &ad... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* @priv: Device's private data @divider: Divider value (0 to disable the beep) */ | static int set_beep_divisor(struct hda_codec_priv *priv, uint divider) | /* @priv: Device's private data @divider: Divider value (0 to disable the beep) */
static int set_beep_divisor(struct hda_codec_priv *priv, uint divider) | {
return exec_verb(priv->regs,
hda_verb(priv->beep_nid, HDA_VERB_SET_BEEP, divider),
NULL);
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Starts the Low Level portion of the Device driver. */ | USBD_StatusTypeDef USBD_LL_Start(USBD_HandleTypeDef *pdev) | /* Starts the Low Level portion of the Device driver. */
USBD_StatusTypeDef USBD_LL_Start(USBD_HandleTypeDef *pdev) | {
HAL_PCD_Start(pdev->pData);
return USBD_OK;
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* This comparator searches for the next HID descriptor within the current HID interface descriptor. */ | uint8_t DComp_NextHID(void *CurrentDescriptor) | /* This comparator searches for the next HID descriptor within the current HID interface descriptor. */
uint8_t DComp_NextHID(void *CurrentDescriptor) | {
USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
if (Header->Type == HID_DTYPE_HID)
return DESCRIPTOR_SEARCH_Found;
else if (Header->Type == DTYPE_Interface)
return DESCRIPTOR_SEARCH_Fail;
else
return DESCRIPTOR_SEARCH_NotFound;
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Length of a allocated file in bytes. Sparse files are counted by actual allocated space. Return < 0 if error or unknown. */ | int64_t bdrv_get_allocated_file_size(BlockDriverState *bs) | /* Length of a allocated file in bytes. Sparse files are counted by actual allocated space. Return < 0 if error or unknown. */
int64_t bdrv_get_allocated_file_size(BlockDriverState *bs) | {
BlockDriver *drv = bs->drv;
if (!drv) {
return -ENOMEDIUM;
}
if (drv->bdrv_get_allocated_file_size) {
return drv->bdrv_get_allocated_file_size(bs);
}
if (bs->file) {
return bdrv_get_allocated_file_size(bs->file);
}
return -ENOTSUP;
} | ve3wwg/teensy3_qemu | C | Other | 15 |
/* Request the PE to send a hard reset. */ | USBPD_StatusTypeDef USBPD_DPM_RequestHardReset(uint8_t PortNum) | /* Request the PE to send a hard reset. */
USBPD_StatusTypeDef USBPD_DPM_RequestHardReset(uint8_t PortNum) | {
return USBPD_PE_Request_HardReset(PortNum);
} | st-one/X-CUBE-USB-PD | C++ | null | 110 |
/* Add the raw text of the message to the dissect tree if appropriate preferences are specified. */ | static void mgcp_raw_text_add(tvbuff_t *tvb, proto_tree *tree) | /* Add the raw text of the message to the dissect tree if appropriate preferences are specified. */
static void mgcp_raw_text_add(tvbuff_t *tvb, proto_tree *tree) | {
gint tvb_linebegin, tvb_lineend, linelen;
tvb_linebegin = 0;
do
{
tvb_find_line_end(tvb, tvb_linebegin, -1, &tvb_lineend, FALSE);
linelen = tvb_lineend - tvb_linebegin;
proto_tree_add_format_text(tree, tvb, tvb_linebegin, linelen);
tvb_linebegin = tvb_lineend;
} while (tvb_offset_exists(tvb, tvb_lineend)... | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_UART_MspDeInit(UART_HandleTypeDef *huart) | /* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart) | {
if(huart->Instance==UART4)
{
__HAL_RCC_UART4_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOH, GPIO_PIN_13|GPIO_PIN_14);
}
else if(huart->Instance==USART1)
{
__HAL_RCC_USART1_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_10|GPIO_PIN_9);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* check if an address is reserved in the iomem resource tree returns 1 if reserved, 0 if not reserved. */ | int iomem_is_exclusive(u64 addr) | /* check if an address is reserved in the iomem resource tree returns 1 if reserved, 0 if not reserved. */
int iomem_is_exclusive(u64 addr) | {
struct resource *p = &iomem_resource;
int err = 0;
loff_t l;
int size = PAGE_SIZE;
if (!strict_iomem_checks)
return 0;
addr = addr & PAGE_MASK;
read_lock(&resource_lock);
for (p = p->child; p ; p = r_next(NULL, p, &l)) {
if (p->start >= addr + size)
break;
if (p->end < addr)
continue;
if (p->fla... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Convert an hexadecimal char to a value of type UINTN. */ | UINTN HttpIoHexCharToUintn(IN CHAR8 Char) | /* Convert an hexadecimal char to a value of type UINTN. */
UINTN HttpIoHexCharToUintn(IN CHAR8 Char) | {
if ((Char >= '0') && (Char <= '9')) {
return Char - '0';
}
return (10 + AsciiCharToUpper (Char) - 'A');
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Given an array of @nr_slbs SLB entries, @slbs, return non-zero if the address @new_addr is present. */ | static int __slb_present(struct spu_slb *slbs, int nr_slbs, void *new_addr) | /* Given an array of @nr_slbs SLB entries, @slbs, return non-zero if the address @new_addr is present. */
static int __slb_present(struct spu_slb *slbs, int nr_slbs, void *new_addr) | {
unsigned long ea = (unsigned long)new_addr;
int i;
for (i = 0; i < nr_slbs; i++)
if (!((slbs[i].esid ^ ea) & ESID_MASK))
return 1;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* This is called after loading something into memory. We need to make sure that everything that was loaded is actually written to RAM, and that the icache will look for it. Cleaning the dcache and invalidating the icache will do the trick. */ | void flush_cache(unsigned long start_addr, unsigned long size) | /* This is called after loading something into memory. We need to make sure that everything that was loaded is actually written to RAM, and that the icache will look for it. Cleaning the dcache and invalidating the icache will do the trick. */
void flush_cache(unsigned long start_addr, unsigned long size) | {
dcache_clean_range((void *)start_addr, size);
icache_invalidate_range((void *)start_addr, size);
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* This function tries to write BufferSize bytes data from the Buffer into the specified TLS connection. */ | INTN EFIAPI TlsWrite(IN VOID *Tls, IN VOID *Buffer, IN UINTN BufferSize) | /* This function tries to write BufferSize bytes data from the Buffer into the specified TLS connection. */
INTN EFIAPI TlsWrite(IN VOID *Tls, IN VOID *Buffer, IN UINTN BufferSize) | {
CALL_CRYPTO_SERVICE (TlsWrite, (Tls, Buffer, BufferSize), 0);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Obtain the enclosure logical id for an expander. Returns 0 for success, non-zero for failure. */ | static int _transport_get_enclosure_identifier(struct sas_rphy *rphy, u64 *identifier) | /* Obtain the enclosure logical id for an expander. Returns 0 for success, non-zero for failure. */
static int _transport_get_enclosure_identifier(struct sas_rphy *rphy, u64 *identifier) | {
struct MPT2SAS_ADAPTER *ioc = rphy_to_ioc(rphy);
struct _sas_node *sas_expander;
unsigned long flags;
spin_lock_irqsave(&ioc->sas_node_lock, flags);
sas_expander = mpt2sas_scsih_expander_find_by_sas_address(ioc,
rphy->identify.sas_address);
spin_unlock_irqrestore(&ioc->sas_node_lock, flags);
if (!sas_expa... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enable the Continuous mode for the selected ADCx channels. */ | void ADC_ContinuousModeCmd(ADC_TypeDef *ADCx, FunctionalState NewState) | /* Enable the Continuous mode for the selected ADCx channels. */
void ADC_ContinuousModeCmd(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_CONT;
}
else
{
ADCx->CFGR1 &= (uint32_t)(~ADC_CFGR1_CONT);
}
} | ajhc/demo-cortex-m3 | C++ | null | 38 |
/* Copy data from IO memory space to "real" memory space. This needs to be optimized. */ | void memcpy_fromio(void *to, const volatile void __iomem *from, long count) | /* Copy data from IO memory space to "real" memory space. This needs to be optimized. */
void memcpy_fromio(void *to, const volatile void __iomem *from, long count) | {
char *dst = to;
while (count) {
count--;
*dst++ = readb(from++);
}
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* The length of the hash result is dependent on the algorithm that is selected with the */ | bool SHAMD5HMACProcess(uint32_t ui32Base, uint8_t *pui8DataSrc, uint32_t ui32DataLength, uint8_t *pui8HashResult) | /* The length of the hash result is dependent on the algorithm that is selected with the */
bool SHAMD5HMACProcess(uint32_t ui32Base, uint8_t *pui8DataSrc, uint32_t ui32DataLength, uint8_t *pui8HashResult) | {
ASSERT(ui32Base == SHAMD5_BASE);
while((HWREG(ui32Base + SHAMD5_O_IRQSTATUS) & SHAMD5_INT_CONTEXT_READY) ==
0)
{
}
SHAMD5DataLengthSet(ui32Base, ui32DataLength);
SHAMD5DataWriteMultiple(pui8DataSrc, ui32DataLength);
while((HWREG(ui32Base + SHAMD5_O_IRQSTATUS) & SHAMD5_INT_OUTPUT_... | micropython/micropython | C++ | Other | 18,334 |
/* Get the I2C time out flag of the specified I2C port.
The */ | xtBoolean I2CTimeoutFlagGet(unsigned long ulBase) | /* Get the I2C time out flag of the specified I2C port.
The */
xtBoolean I2CTimeoutFlagGet(unsigned long ulBase) | {
xASSERT((ulBase == I2C0_BASE));
return ((xHWREG(ulBase + I2C_O_TOC) & I2C_TOC_TIF) ? xtrue : xfalse);
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Read-ahead btree blocks, at the given level. Bits in lr are set from XFS_BTCUR_{LEFT,RIGHT}RA. */ | STATIC int xfs_btree_readahead(struct xfs_btree_cur *cur, int lev, int lr) | /* Read-ahead btree blocks, at the given level. Bits in lr are set from XFS_BTCUR_{LEFT,RIGHT}RA. */
STATIC int xfs_btree_readahead(struct xfs_btree_cur *cur, int lev, int lr) | {
struct xfs_btree_block *block;
if ((cur->bc_flags & XFS_BTREE_ROOT_IN_INODE) &&
(lev == cur->bc_nlevels - 1))
return 0;
if ((cur->bc_ra[lev] | lr) == cur->bc_ra[lev])
return 0;
cur->bc_ra[lev] |= lr;
block = XFS_BUF_TO_BLOCK(cur->bc_bufs[lev]);
if (cur->bc_flags & XFS_BTREE_LONG_PTRS)
return xfs_btre... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* psc_disable_domain() - Disable a power domain @domain_num: GPSC domain number */ | int psc_disable_domain(u32 domain_num) | /* psc_disable_domain() - Disable a power domain @domain_num: GPSC domain number */
int psc_disable_domain(u32 domain_num) | {
u32 pdctl;
u32 ptcmd;
pdctl = __raw_readl(KS2_PSC_BASE + PSC_REG_PDCTL(domain_num));
pdctl = PSC_REG_PDCTL_SET_NEXT(pdctl, PSC_REG_VAL_PDCTL_NEXT_OFF);
pdctl = PSC_REG_PDCTL_SET_PDMODE(pdctl, PSC_REG_VAL_PDCTL_PDMODE_SLEEP);
__raw_writel(pdctl, KS2_PSC_BASE + PSC_REG_PDCTL(domain_num));
ptcmd = __raw_readl(KS2... | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Convert bitstream data and load into the fpga */ | int __weak fpga_loadbitstream(int devnum, char *fpgadata, size_t size, bitstream_type bstype) | /* Convert bitstream data and load into the fpga */
int __weak fpga_loadbitstream(int devnum, char *fpgadata, size_t size, bitstream_type bstype) | {
printf("Bitstream support not implemented for this FPGA device\n");
return FPGA_FAIL;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Clear one bit of the runtime register while keeping other bits. */ | VOID XhcClearRuntimeRegBit(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Offset, IN UINT32 Bit) | /* Clear one bit of the runtime register while keeping other bits. */
VOID XhcClearRuntimeRegBit(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Offset, IN UINT32 Bit) | {
UINT32 Data;
Data = XhcReadRuntimeReg (Xhc, Offset);
Data &= ~Bit;
XhcWriteRuntimeReg (Xhc, Offset, Data);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Verify the new serial_struct (for TIOCSSERIAL). The only change we allow are to the flags and type, and even then only between PORT_IMX and PORT_UNKNOWN */ | static int imx_verify_port(struct uart_port *port, struct serial_struct *ser) | /* Verify the new serial_struct (for TIOCSSERIAL). The only change we allow are to the flags and type, and even then only between PORT_IMX and PORT_UNKNOWN */
static int imx_verify_port(struct uart_port *port, struct serial_struct *ser) | {
struct imx_port *sport = (struct imx_port *)port;
int ret = 0;
if (ser->type != PORT_UNKNOWN && ser->type != PORT_IMX)
ret = -EINVAL;
if (sport->port.irq != ser->irq)
ret = -EINVAL;
if (ser->io_type != UPIO_MEM)
ret = -EINVAL;
if (sport->port.uartclk / 16 != ser->baud_base)
ret = -EINVAL;
if ((void *)s... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* STUSB1602 checks the VDD_UVLO_Threshold State (EN or DIS) (bit0 0x2E */ | VDD_UVLO_Threshold_TypeDef STUSB1602_VDD_UVLO_Threshold_Get(uint8_t Addr) | /* STUSB1602 checks the VDD_UVLO_Threshold State (EN or DIS) (bit0 0x2E */
VDD_UVLO_Threshold_TypeDef STUSB1602_VDD_UVLO_Threshold_Get(uint8_t Addr) | {
STUSB1602_VBUS_MONITORING_CTRL_RegTypeDef reg;
STUSB1602_ReadReg(®.d8, Addr, STUSB1602_VBUS_MONITORING_CTRL_REG, 1);
return (VDD_UVLO_Threshold_TypeDef)(reg.b.VDD_UVLO_DISABLE);
} | st-one/X-CUBE-USB-PD | C++ | null | 110 |
/* VSCard protocol over chardev This code should not depend on the card type. */ | static void ccid_card_vscard_send_msg(PassthruState *s, VSCMsgType type, uint32_t reader_id, const uint8_t *payload, uint32_t length) | /* VSCard protocol over chardev This code should not depend on the card type. */
static void ccid_card_vscard_send_msg(PassthruState *s, VSCMsgType type, uint32_t reader_id, const uint8_t *payload, uint32_t length) | {
VSCMsgHeader scr_msg_header;
scr_msg_header.type = htonl(type);
scr_msg_header.reader_id = htonl(reader_id);
scr_msg_header.length = htonl(length);
qemu_chr_fe_write(s->cs, (uint8_t *)&scr_msg_header, sizeof(VSCMsgHeader));
qemu_chr_fe_write(s->cs, payload, length);
} | ve3wwg/teensy3_qemu | C++ | Other | 15 |
/* MDA could easily be classified as "pre-dinosaur hardware". */ | static void write_mda_b(unsigned int val, unsigned char reg) | /* MDA could easily be classified as "pre-dinosaur hardware". */
static void write_mda_b(unsigned int val, unsigned char reg) | {
unsigned long flags;
spin_lock_irqsave(&mda_lock, flags);
outb_p(reg, mda_index_port);
outb_p(val, mda_value_port);
spin_unlock_irqrestore(&mda_lock, flags);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Create channel program to perform SET PGID on a single path. */ | static void spid_build_cp(struct ccw_device *cdev, u8 fn) | /* Create channel program to perform SET PGID on a single path. */
static void spid_build_cp(struct ccw_device *cdev, u8 fn) | {
struct ccw_request *req = &cdev->private->req;
struct ccw1 *cp = cdev->private->iccws;
int i = 8 - ffs(req->lpm);
struct pgid *pgid = &cdev->private->pgid[i];
pgid->inf.fc = fn;
cp->cmd_code = CCW_CMD_SET_PGID;
cp->cda = (u32) (addr_t) pgid;
cp->count = sizeof(*pgid);
cp->flags = CCW_FLAG_SLI;
req->cp = c... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Writeback a page to clean the dirty state */ | static int writeout(struct address_space *mapping, struct page *page) | /* Writeback a page to clean the dirty state */
static int writeout(struct address_space *mapping, struct page *page) | {
struct writeback_control wbc = {
.sync_mode = WB_SYNC_NONE,
.nr_to_write = 1,
.range_start = 0,
.range_end = LLONG_MAX,
.nonblocking = 1,
.for_reclaim = 1
};
int rc;
if (!mapping->a_ops->writepage)
return -EINVAL;
if (!clear_page_dirty_for_io(page))
return -EAGAIN;
remove_migration_ptes(page, pa... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Service routine to read status register until ready, or timeout occurs. Returns non-zero if error. */ | static int spi_nor_wait_till_ready_with_timeout(struct spi_nor *nor, unsigned long timeout) | /* Service routine to read status register until ready, or timeout occurs. Returns non-zero if error. */
static int spi_nor_wait_till_ready_with_timeout(struct spi_nor *nor, unsigned long timeout) | {
unsigned long timebase;
int ret;
timebase = get_timer(0);
while (get_timer(timebase) < timeout) {
ret = spi_nor_ready(nor);
if (ret < 0)
return ret;
if (ret)
return 0;
}
dev_err(nor->dev, "flash operation timed out\n");
return -ETIMEDOUT;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Ioctl subroutines can safely be made inline, because they are called only from cosa_ioctl(). */ | static int cosa_reset(struct cosa_data *cosa) | /* Ioctl subroutines can safely be made inline, because they are called only from cosa_ioctl(). */
static int cosa_reset(struct cosa_data *cosa) | {
char idstring[COSA_MAX_ID_STRING];
if (cosa->usage > 1)
printk(KERN_INFO "cosa%d: WARNING: reset requested with cosa->usage > 1 (%d). Odd things may happen.\n",
cosa->num, cosa->usage);
cosa->firmware_status &= ~(COSA_FW_RESET|COSA_FW_START);
if (cosa_reset_and_read_id(cosa, idstring) < 0) {
printk(KERN_NO... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Obtain an accurate fraction of the BDI's portion. */ | static void bdi_writeout_fraction(struct backing_dev_info *bdi, long *numerator, long *denominator) | /* Obtain an accurate fraction of the BDI's portion. */
static void bdi_writeout_fraction(struct backing_dev_info *bdi, long *numerator, long *denominator) | {
if (bdi_cap_writeback_dirty(bdi)) {
prop_fraction_percpu(&vm_completions, &bdi->completions,
numerator, denominator);
} else {
*numerator = 0;
*denominator = 1;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* The size of the channel control table depends on the number of uDMA channels, and which transfer modes are used. Refer to the introductory text and the microcontroller datasheet for more information about the channel control table. */ | void uDMAControlBaseSet(void *pControlTable) | /* The size of the channel control table depends on the number of uDMA channels, and which transfer modes are used. Refer to the introductory text and the microcontroller datasheet for more information about the channel control table. */
void uDMAControlBaseSet(void *pControlTable) | {
ASSERT(((unsigned long)pControlTable & ~0x3FF) ==
(unsigned long)pControlTable);
ASSERT((unsigned long)pControlTable >= 0x20000000);
HWREG(UDMA_CTLBASE) = (unsigned long)pControlTable;
} | watterott/WebRadio | C++ | null | 71 |
/* Free a configuration descriptor with its interface descriptors. It may be initialized partially. */ | VOID UsbFreeConfigDesc(IN USB_CONFIG_DESC *Config) | /* Free a configuration descriptor with its interface descriptors. It may be initialized partially. */
VOID UsbFreeConfigDesc(IN USB_CONFIG_DESC *Config) | {
USB_INTERFACE_DESC *Interface;
UINTN Index;
UINTN SetIndex;
if (Config->Interfaces != NULL) {
for (Index = 0; Index < Config->Desc.NumInterfaces; Index++) {
Interface = Config->Interfaces[Index];
if (Interface == NULL) {
continue;
}
for (SetInde... | tianocore/edk2 | C++ | Other | 4,240 |
/* Perform a "final reduction" in field F256 (field for curve P-256). The source value must be less than twice the modulus. If the value is not lower than the modulus, then the modulus is subtracted and this function returns 1; otherwise, it leaves it untouched and it returns 0. */ | static uint32_t reduce_final_f256(uint32_t *d) | /* Perform a "final reduction" in field F256 (field for curve P-256). The source value must be less than twice the modulus. If the value is not lower than the modulus, then the modulus is subtracted and this function returns 1; otherwise, it leaves it untouched and it returns 0. */
static uint32_t reduce_final_f256(ui... | {
uint32_t t[9];
uint32_t cc;
int i;
cc = 0;
for (i = 0; i < 9; i ++) {
uint32_t w;
w = d[i] - F256[i] - cc;
cc = w >> 31;
t[i] = w & 0x3FFFFFFF;
}
cc ^= 1;
CCOPY(cc, d, t, sizeof t);
return cc;
} | RavenSystem/esp-homekit-devices | C++ | Other | 2,577 |
/* This function allows to choose between locked and overewrite mode of FIFOs. In locked mode, whenever FIFO is full and new frame arrives, which would normally been stored into given FIFO, then frame is dropped. If overwrite mode is active, then most recent message in FIFO is rewritten by frame just received. */ | void fdcan_set_fifo_locked_mode(uint32_t canport, bool locked) | /* This function allows to choose between locked and overewrite mode of FIFOs. In locked mode, whenever FIFO is full and new frame arrives, which would normally been stored into given FIFO, then frame is dropped. If overwrite mode is active, then most recent message in FIFO is rewritten by frame just received. */
void... | {
if (locked) {
FDCAN_RXGFC(canport) &= ~(FDCAN_RXGFC_F1OM | FDCAN_RXGFC_F0OM);
} else {
FDCAN_RXGFC(canport) |= FDCAN_RXGFC_F1OM | FDCAN_RXGFC_F0OM;
}
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* Return the section header specified by the range. */ | Elf32_Shdr* GetElf32SectionByRange(IN UINT8 *ImageBase, IN UINT32 Offset, IN UINT32 Size) | /* Return the section header specified by the range. */
Elf32_Shdr* GetElf32SectionByRange(IN UINT8 *ImageBase, IN UINT32 Offset, IN UINT32 Size) | {
UINT32 Index;
Elf32_Ehdr *Ehdr;
Elf32_Shdr *Shdr;
Ehdr = (Elf32_Ehdr *)ImageBase;
Shdr = (Elf32_Shdr *)(ImageBase + Ehdr->e_shoff);
for (Index = 0; Index < Ehdr->e_shnum; Index++) {
if ((Shdr->sh_offset == Offset) && (Shdr->sh_size == Size)) {
return Shdr;
}
Shdr = ELF_NEXT_ENTRY ... | tianocore/edk2 | C++ | Other | 4,240 |
/* Reads a line from the given file, ensuring is NUL terminated. The pointer must be freed by the caller. NULL is returned on an out of memory condition. */ | static char * my_get_line(FILE *fp) | /* Reads a line from the given file, ensuring is NUL terminated. The pointer must be freed by the caller. NULL is returned on an out of memory condition. */
static char * my_get_line(FILE *fp) | {
char buf[4096];
char *nl = NULL;
char *line = NULL;
do {
if(NULL == fgets(buf, sizeof(buf), fp))
break;
if(!line) {
line = strdup(buf);
if(!line)
return NULL;
}
else {
char *ptr;
size_t linelen = strlen(line);
ptr = realloc(line, linelen + strlen(buf... | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* USART pinmux initialization function.
Set each required pin to USART functionality */ | void TARGET_IO_PORT_init() | /* USART pinmux initialization function.
Set each required pin to USART functionality */
void TARGET_IO_PORT_init() | {
gpio_set_pin_function(PB10, PINMUX_PB10D_SERCOM4_PAD2);
gpio_set_pin_function(PB11, PINMUX_PB11D_SERCOM4_PAD3);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* pm8001_chip_intx_interrupt_disable- disable PM8001 chip interrupt @pm8001_ha: our hba card information */ | static void pm8001_chip_intx_interrupt_disable(struct pm8001_hba_info *pm8001_ha) | /* pm8001_chip_intx_interrupt_disable- disable PM8001 chip interrupt @pm8001_ha: our hba card information */
static void pm8001_chip_intx_interrupt_disable(struct pm8001_hba_info *pm8001_ha) | {
pm8001_cw32(pm8001_ha, 0, MSGU_ODMR, ODMR_MASK_ALL);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* A note about the "bias" calculations: when rounding fractional values to integer, we do not want to always round 0.5 up to the next integer. If we did that, we'd introduce a noticeable bias towards larger values. Instead, this code is arranged so that 0.5 will be rounded up or down at alternate pixel locations (a si... | h2v1_downsample_orig(j_compress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY output_data) | /* A note about the "bias" calculations: when rounding fractional values to integer, we do not want to always round 0.5 up to the next integer. If we did that, we'd introduce a noticeable bias towards larger values. Instead, this code is arranged so that 0.5 will be rounded up or down at alternate pixel locations (a si... | {
int outrow;
JDIMENSION outcol;
JDIMENSION output_cols = compptr->width_in_blocks * DCTSIZE;
register JSAMPROW inptr, outptr;
register int bias;
expand_right_edge(input_data, cinfo->max_v_samp_factor,
cinfo->image_width, output_cols * 2);
for (outrow = 0; outrow < compptr->v_samp_fa... | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* Add a reference to the sample data to the sample queue. The data is not copied. sample_queue_retain should be called before pkt->data is reused/freed. */ | static void sample_queue_push(HintSampleQueue *queue, AVPacket *pkt, int sample) | /* Add a reference to the sample data to the sample queue. The data is not copied. sample_queue_retain should be called before pkt->data is reused/freed. */
static void sample_queue_push(HintSampleQueue *queue, AVPacket *pkt, int sample) | {
if (pkt->size <= 14)
return;
if (!queue->samples || queue->len >= queue->size) {
HintSample* samples;
queue->size += 10;
samples = av_realloc(queue->samples, sizeof(HintSample)*queue->size);
if (!samples)
return;
queue->samples = samples;
}
q... | DC-SWAT/DreamShell | C++ | null | 404 |
/* Note that it is important that an implementation that allows this option to be turned on, have it off by default. Otherwise an unaware application using the one to many model may become confused and act incorrectly. */ | static int sctp_setsockopt_fragment_interleave(struct sock *sk, char __user *optval, unsigned int optlen) | /* Note that it is important that an implementation that allows this option to be turned on, have it off by default. Otherwise an unaware application using the one to many model may become confused and act incorrectly. */
static int sctp_setsockopt_fragment_interleave(struct sock *sk, char __user *optval, unsigned int... | {
int val;
if (optlen != sizeof(int))
return -EINVAL;
if (get_user(val, (int __user *)optval))
return -EFAULT;
sctp_sk(sk)->frag_interleave = (val == 0) ? 0 : 1;
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* mx3fb_set_fix() - set fixed framebuffer parameters from variable settings. @info: framebuffer information pointer */ | static int mx3fb_set_fix(struct fb_info *fbi) | /* mx3fb_set_fix() - set fixed framebuffer parameters from variable settings. @info: framebuffer information pointer */
static int mx3fb_set_fix(struct fb_info *fbi) | {
struct fb_fix_screeninfo *fix = &fbi->fix;
struct fb_var_screeninfo *var = &fbi->var;
strncpy(fix->id, "DISP3 BG", 8);
fix->line_length = var->xres_virtual * var->bits_per_pixel / 8;
fix->type = FB_TYPE_PACKED_PIXELS;
fix->accel = FB_ACCEL_NONE;
fix->visual = FB_VISUAL_TRUECOLOR;
fix->xpanstep = 1;
fix->ypan... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param i2cType Pointer to FLEXIO_I2C_Type structure param i2cHandle Pointer to flexio_i2c_master_transfer_t structure */ | void FLEXIO_I2C_MasterTransferHandleIRQ(void *i2cType, void *i2cHandle) | /* param i2cType Pointer to FLEXIO_I2C_Type structure param i2cHandle Pointer to flexio_i2c_master_transfer_t structure */
void FLEXIO_I2C_MasterTransferHandleIRQ(void *i2cType, void *i2cHandle) | {
FLEXIO_I2C_Type *base = (FLEXIO_I2C_Type *)i2cType;
flexio_i2c_master_handle_t *handle = (flexio_i2c_master_handle_t *)i2cHandle;
uint32_t statusFlags;
status_t result;
statusFlags = FLEXIO_I2C_MasterGetStatusFlags(base);
result = FLEXIO_I2C_MasterTransferRunStateMachine(base, handle, statusFl... | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* NULL is returned if there is no free memory. Although this function allocates memory it can be called from an interrupt. */ | struct sk_buff* dev_alloc_skb(unsigned int length) | /* NULL is returned if there is no free memory. Although this function allocates memory it can be called from an interrupt. */
struct sk_buff* dev_alloc_skb(unsigned int length) | {
return __dev_alloc_skb(length, GFP_ATOMIC);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Determines if the hardware module(s) are currently synchronizing to the bus.
Checks to see if the underlying hardware peripheral module(s) are currently synchronizing across multiple clock domains to the hardware bus, This function can be used to delay further operations on a module until such time that it is ready... | static bool system_gclk_is_syncing(const uint8_t generator) | /* Determines if the hardware module(s) are currently synchronizing to the bus.
Checks to see if the underlying hardware peripheral module(s) are currently synchronizing across multiple clock domains to the hardware bus, This function can be used to delay further operations on a module until such time that it is ready... | {
if (GCLK->SYNCBUSY.reg & GCLK_SYNCBUSY_GENCTRL(1 << generator )){
return true;
}
return false;
} | memfault/zero-to-main | C++ | null | 200 |
/* This function allocates an aligned buffer for the ATA device to perform ATA pass through operations. The alignment requirement is from ATA pass through interface. */ | VOID* AllocateAlignedBuffer(IN ATA_DEVICE *AtaDevice, IN UINTN BufferSize) | /* This function allocates an aligned buffer for the ATA device to perform ATA pass through operations. The alignment requirement is from ATA pass through interface. */
VOID* AllocateAlignedBuffer(IN ATA_DEVICE *AtaDevice, IN UINTN BufferSize) | {
return AllocateAlignedPages (EFI_SIZE_TO_PAGES (BufferSize), AtaDevice->AtaBusDriverData->AtaPassThru->Mode->IoAlign);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* NOTE! Only a kernel-only process(ie the swapper or direct descendants who haven't done an "execve()") should use this: it will work within a system call from a "real" process, but the process memory space will not be free'd until both the parent and the child have exited. */ | static void kernel_thread_helper(void *nouse, int(*fn)(void *), void *arg) | /* NOTE! Only a kernel-only process(ie the swapper or direct descendants who haven't done an "execve()") should use this: it will work within a system call from a "real" process, but the process memory space will not be free'd until both the parent and the child have exited. */
static void kernel_thread_helper(void *n... | {
fn(arg);
do_exit(-1);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Generate NEC data bit 0: positive 0.56ms + negative 0.56ms. */ | static void nec_fill_item_bit_zero(rmt_item32_t *item) | /* Generate NEC data bit 0: positive 0.56ms + negative 0.56ms. */
static void nec_fill_item_bit_zero(rmt_item32_t *item) | {
nec_fill_item_level(item, NEC_BIT_ZERO_HIGH_US, NEC_BIT_ZERO_LOW_US);
} | retro-esp32/RetroESP32 | C++ | Creative Commons Attribution Share Alike 4.0 International | 581 |
/* UBIFS is only interested in the "sync" option, so do not check for anything else. */ | static int parse_standard_option(const char *option) | /* UBIFS is only interested in the "sync" option, so do not check for anything else. */
static int parse_standard_option(const char *option) | {
pr_notice("UBIFS: parse %s\n", option);
if (!strcmp(option, "sync"))
return MS_SYNCHRONOUS;
return 0;
} | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* Type 3 protection has a 16-bit guard tag and 16 + 32 bits of opaque tag space. */ | static void sd_dif_type3_generate(struct blk_integrity_exchg *bix, csum_fn *fn) | /* Type 3 protection has a 16-bit guard tag and 16 + 32 bits of opaque tag space. */
static void sd_dif_type3_generate(struct blk_integrity_exchg *bix, csum_fn *fn) | {
void *buf = bix->data_buf;
struct sd_dif_tuple *sdt = bix->prot_buf;
unsigned int i;
for (i = 0 ; i < bix->data_size ; i += bix->sector_size, sdt++) {
sdt->guard_tag = fn(buf, bix->sector_size);
sdt->ref_tag = 0;
sdt->app_tag = 0;
buf += bix->sector_size;
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* (following author is not in any relation with this code, but his ideas were used when writing this driver) */ | void matroxfb_DAC_out(const struct matrox_fb_info *minfo, int reg, int val) | /* (following author is not in any relation with this code, but his ideas were used when writing this driver) */
void matroxfb_DAC_out(const struct matrox_fb_info *minfo, int reg, int val) | {
DBG_REG(__func__)
mga_outb(M_RAMDAC_BASE+M_X_INDEX, reg);
mga_outb(M_RAMDAC_BASE+M_X_DATAREG, val);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Read a byte from the given SERCOM USART instance. */ | uint8_t _usart_sync_read_byte(const struct _usart_sync_device *const device) | /* Read a byte from the given SERCOM USART instance. */
uint8_t _usart_sync_read_byte(const struct _usart_sync_device *const device) | {
return hri_sercomusart_read_DATA_reg(device->hw);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Resets DFU status and usb setup process callbacks. */ | static void udi_dfu_atmel_reset_protocol(void) | /* Resets DFU status and usb setup process callbacks. */
static void udi_dfu_atmel_reset_protocol(void) | {
udi_dfu_atmel_status.bStatus = DFU_STATUS_OK;
udi_dfu_atmel_status.bState = DFU_STATE_DFUIDLE;
udd_g_ctrlreq.over_under_run = NULL;
udd_g_ctrlreq.callback = NULL;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Flush all dirty pages, and check for write errors. */ | static int nfs_file_flush(struct file *, fl_owner_t id) | /* Flush all dirty pages, and check for write errors. */
static int nfs_file_flush(struct file *, fl_owner_t id) | {
struct nfs_open_context *ctx = nfs_file_open_context(file);
struct dentry *dentry = file->f_path.dentry;
struct inode *inode = dentry->d_inode;
dprintk("NFS: flush(%s/%s)\n",
dentry->d_parent->d_name.name,
dentry->d_name.name);
if ((file->f_mode & FMODE_WRITE) == 0)
return 0;
nfs_inc_stats(inode, NFSIOS... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param isMute true is mute, false is unmute. return kStatus_Success is success, else configure failed. */ | status_t HAL_CODEC_CS42888_SetMute(void *handle, uint32_t playChannel, bool isMute) | /* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param isMute true is mute, false is unmute. return kStatus_Success is success, else configure failed. */
status_t HAL_CODEC_CS42888_SetMute(void *handle, uint32_t playChannel, bool isMute) | {
assert(handle != NULL);
uint8_t i = 0U;
status_t ret = kStatus_Success;
for (i = 0U; i < (uint8_t)kCS42888_AOUT8; i++)
{
if ((playChannel & (1UL << i)) == 0U)
{
continue;
}
ret = CS42888_SetChannelMute((cs42888_handle_t *)((uint32_t)(((codec_handle_t ... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* This transformation can be assumed to be linear for region ranges. */ | void* mca_device_transform_memory(struct mca_device *mca_dev, void *mem) | /* This transformation can be assumed to be linear for region ranges. */
void* mca_device_transform_memory(struct mca_device *mca_dev, void *mem) | {
struct mca_bus *mca_bus = to_mca_bus(mca_dev->dev.parent);
return mca_bus->f.mca_transform_memory(mca_dev, mem);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enables wake-up frame filter to handle unicast packets. */ | void synopGMAC_pmt_unicast_enable(synopGMACdevice *gmacdev) | /* Enables wake-up frame filter to handle unicast packets. */
void synopGMAC_pmt_unicast_enable(synopGMACdevice *gmacdev) | {
synopGMACSetBits(gmacdev->MacBase, GmacPmtCtrlStatus, GmacPmtGlobalUnicast);
return;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Deletes the corresponding daemon for the given euid and pid, if it is the registered that is requesting the deletion. Returns zero after deleting the desired daemon; non-zero otherwise. */ | int ecryptfs_process_quit(uid_t euid, struct user_namespace *user_ns, struct pid *pid) | /* Deletes the corresponding daemon for the given euid and pid, if it is the registered that is requesting the deletion. Returns zero after deleting the desired daemon; non-zero otherwise. */
int ecryptfs_process_quit(uid_t euid, struct user_namespace *user_ns, struct pid *pid) | {
struct ecryptfs_daemon *daemon;
int rc;
mutex_lock(&ecryptfs_daemon_hash_mux);
rc = ecryptfs_find_daemon_by_euid(&daemon, euid, user_ns);
if (rc || !daemon) {
rc = -EINVAL;
printk(KERN_ERR "Received request from user [%d] to "
"unregister unrecognized daemon [0x%p]\n", euid, pid);
goto out_unlock;... | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function returns the size, in bytes, of the device path data structure specified by DevicePath including the end of device path node. If DevicePath is NULL or invalid, then 0 is returned. */ | UINTN EFIAPI GetDevicePathSize(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath) | /* This function returns the size, in bytes, of the device path data structure specified by DevicePath including the end of device path node. If DevicePath is NULL or invalid, then 0 is returned. */
UINTN EFIAPI GetDevicePathSize(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath) | {
return mDevicePathLibDevicePathUtilities->GetDevicePathSize (DevicePath);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* This function reset both transmit and receive FIFO of specified smartcard module. */ | void SC_ClearFIFO(SC_T *sc) | /* This function reset both transmit and receive FIFO of specified smartcard module. */
void SC_ClearFIFO(SC_T *sc) | {
while (sc->ALTCTL & SC_ALTCTL_SYNC_Msk)
{
;
}
sc->ALTCTL |= (SC_ALTCTL_TXRST_Msk | SC_ALTCTL_RXRST_Msk);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Read/write access functions for various sizes of values in config space. Return all 1's for disallowed accesses for a kludgy but adequate simulation of master aborts. */ | static int bcm1480ht_pcibios_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val) | /* Read/write access functions for various sizes of values in config space. Return all 1's for disallowed accesses for a kludgy but adequate simulation of master aborts. */
static int bcm1480ht_pcibios_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val) | {
u32 data = 0;
if ((size == 2) && (where & 1))
return PCIBIOS_BAD_REGISTER_NUMBER;
else if ((size == 4) && (where & 3))
return PCIBIOS_BAD_REGISTER_NUMBER;
if (bcm1480ht_can_access(bus, devfn))
data = READCFG32(CFGADDR(bus, devfn, where));
else
data = 0xFFFFFFFF;
if (size == 1)
*val = (data >> ((where ... | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* SPI nss pin low level in software mode. */ | void spi_nss_internal_low(uint32_t spi_periph) | /* SPI nss pin low level in software mode. */
void spi_nss_internal_low(uint32_t spi_periph) | {
SPI_CTL0(spi_periph) &= ~SPI_CTL0_SWNSS;
} | liuxuming/trochili | C++ | Apache License 2.0 | 132 |
/* Need to wait a few seconds after link up to get diagnostic information from the phy */ | static void e1000_update_phy_info(unsigned long data) | /* Need to wait a few seconds after link up to get diagnostic information from the phy */
static void e1000_update_phy_info(unsigned long data) | {
struct e1000_adapter *adapter = (struct e1000_adapter *) data;
schedule_work(&adapter->update_phy_task);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Checks if the Backup DRx registers values are correct or not. */ | uint32_t CheckBackupReg(uint16_t FirstBackupData) | /* Checks if the Backup DRx registers values are correct or not. */
uint32_t CheckBackupReg(uint16_t FirstBackupData) | {
uint32_t index = 0;
for (index = 0; index < BKP_DR_NUMBER; index++)
{
if (BKP_ReadBackupRegister(BKPDataReg[index]) != (FirstBackupData + (index * 0x5A)))
{
return (index + 1);
}
}
return 0;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* param base Pointer to the FLEXIO_CAMERA_Type. param handle Pointer to the flexio_camera_edma_handle_t structure. param count Number of bytes sent so far by the non-blocking transaction. retval kStatus_Success Succeed get the transfer count. retval kStatus_InvalidArgument The count parameter is invalid. */ | status_t FLEXIO_CAMERA_TransferGetReceiveCountEDMA(FLEXIO_CAMERA_Type *base, flexio_camera_edma_handle_t *handle, size_t *count) | /* param base Pointer to the FLEXIO_CAMERA_Type. param handle Pointer to the flexio_camera_edma_handle_t structure. param count Number of bytes sent so far by the non-blocking transaction. retval kStatus_Success Succeed get the transfer count. retval kStatus_InvalidArgument The count parameter is invalid. */
status_t ... | {
assert(handle->rxEdmaHandle != NULL);
if (NULL == count)
{
return kStatus_InvalidArgument;
}
if ((uint8_t)kFLEXIO_CAMERA_RxBusy == handle->rxState)
{
*count = (handle->rxSize -
(uint32_t)handle->nbytes *
EDMA_GetRemainingMajorLoopCount(ha... | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Message: SetMicroModeMessage Opcode: 0x0089 Type: CallControl Direction: pbx2dev VarLength: no */ | static void handle_SetMicroModeMessage(ptvcursor_t *cursor, packet_info *pinfo _U_) | /* Message: SetMicroModeMessage Opcode: 0x0089 Type: CallControl Direction: pbx2dev VarLength: no */
static void handle_SetMicroModeMessage(ptvcursor_t *cursor, packet_info *pinfo _U_) | {
ptvcursor_add(cursor, hf_skinny_micMode, 4, ENC_LITTLE_ENDIAN);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Fast write16 function without the probing check above */ | static void ixp4xx_write16(struct map_info *map, map_word d, unsigned long adr) | /* Fast write16 function without the probing check above */
static void ixp4xx_write16(struct map_info *map, map_word d, unsigned long adr) | {
flash_write16(d.x[0], map->virt + adr);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function performs a page erase on a flash instance. */ | int am_hal_flash_page_erase(uint32_t ui32Value, uint32_t ui32FlashInst, uint32_t ui32PageNum) | /* This function performs a page erase on a flash instance. */
int am_hal_flash_page_erase(uint32_t ui32Value, uint32_t ui32FlashInst, uint32_t ui32PageNum) | {
return g_am_hal_flash.flash_page_erase(ui32Value,
ui32FlashInst,
ui32PageNum);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The Timer 2 default IRQ, declared in start up code. */ | void TMR2_IRQHandler(void) | /* The Timer 2 default IRQ, declared in start up code. */
void TMR2_IRQHandler(void) | {
unsigned long ulBase = TIMER2_BASE;
unsigned long ulTemp0,ulTemp1;
ulTemp0 = (xHWREG(ulBase + TIMER_O_TISR) & TIMER_TISR_TIF);
xHWREG(ulBase + TIMER_O_TISR) = ulTemp0;
ulTemp1 = (xHWREG(ulBase + TIMER_O_TEISR) & TIMER_TISR_TIF);
xHWREG(ulBase + TIMER_O_TEISR) = ulTemp1;
if (g_pfnTimer... | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Convert decimal part of temperature to hexadecimal value. */ | static void mcp980x_temperature_to_hex_dec(uint32_t ul_decimal, uint8_t *p_hex) | /* Convert decimal part of temperature to hexadecimal value. */
static void mcp980x_temperature_to_hex_dec(uint32_t ul_decimal, uint8_t *p_hex) | {
*p_hex = (uint8_t) ((ul_decimal / MCP980X_DEC_UNIT) << 4);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Get the LPTIM registers update mode @rmtoll CFG PRELOAD LPTIM_GetUpdateMode. */ | uint32_t LPTIM_GetUpdateMode(LPTIM_Module *LPTIMx) | /* Get the LPTIM registers update mode @rmtoll CFG PRELOAD LPTIM_GetUpdateMode. */
uint32_t LPTIM_GetUpdateMode(LPTIM_Module *LPTIMx) | {
return (uint32_t)(READ_BIT(LPTIMx->CFG, LPTIM_CFG_RELOAD));
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Function for dispatching a SoftDevice event to all modules with a SoftDevice event handler.
This function is called from the SoftDevice event interrupt handler after a SoftDevice event has been received. */ | static void ble_evt_dispatch(ble_evt_t *p_ble_evt) | /* Function for dispatching a SoftDevice event to all modules with a SoftDevice event handler.
This function is called from the SoftDevice event interrupt handler after a SoftDevice event has been received. */
static void ble_evt_dispatch(ble_evt_t *p_ble_evt) | {
ble_conn_params_on_ble_evt(p_ble_evt);
ble_nus_on_ble_evt(&m_nus, p_ble_evt);
on_ble_evt(p_ble_evt);
ble_advertising_on_ble_evt(p_ble_evt);
bsp_btn_ble_on_ble_evt(p_ble_evt);
} | labapart/polymcu | C++ | null | 201 |
/* %-EROFS - Read only filesystem (for create mode) */ | int nilfs_mdt_get_block(struct inode *inode, unsigned long blkoff, int create, void(*init_block)(struct inode *, struct buffer_head *, void *), struct buffer_head **out_bh) | /* %-EROFS - Read only filesystem (for create mode) */
int nilfs_mdt_get_block(struct inode *inode, unsigned long blkoff, int create, void(*init_block)(struct inode *, struct buffer_head *, void *), struct buffer_head **out_bh) | {
int ret;
retry:
ret = nilfs_mdt_read_block(inode, blkoff, !create, out_bh);
if (!create || ret != -ENOENT)
return ret;
ret = nilfs_mdt_create_block(inode, blkoff, out_bh, init_block);
if (unlikely(ret == -EEXIST)) {
goto retry;
}
return ret;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Parse a device number and partition name string in the form of "device_num#partition_name", for example "0#misc". If the partition is found, sets dev_desc and part_info accordingly with the information of the partition with the given partition_name. */ | static int part_get_info_by_dev_and_name(const char *dev_iface, const char *dev_part_str, struct blk_desc **dev_desc, disk_partition_t *part_info) | /* Parse a device number and partition name string in the form of "device_num#partition_name", for example "0#misc". If the partition is found, sets dev_desc and part_info accordingly with the information of the partition with the given partition_name. */
static int part_get_info_by_dev_and_name(const char *dev_iface, ... | {
char *ep;
const char *part_str;
int dev_num;
part_str = strchr(dev_part_str, '#');
if (!part_str || part_str == dev_part_str)
return -EINVAL;
dev_num = simple_strtoul(dev_part_str, &ep, 16);
if (ep != part_str) {
return -EINVAL;
}
part_str++;
*dev_desc = blk_get_dev(dev_iface, dev_num);
if (!*dev_desc)... | 4ms/stm32mp1-baremetal | C++ | Other | 137 |
/* After stopping, the state is changed to SETUP. Unlike snd_pcm_stop(), this affects only the given stream. */ | int snd_pcm_drain_done(struct snd_pcm_substream *substream) | /* After stopping, the state is changed to SETUP. Unlike snd_pcm_stop(), this affects only the given stream. */
int snd_pcm_drain_done(struct snd_pcm_substream *substream) | {
return snd_pcm_action_single(&snd_pcm_action_stop, substream,
SNDRV_PCM_STATE_SETUP);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Find, remove and free answer from the scheduled packets. */ | static void _mdns_remove_scheduled_answer(tcpip_adapter_if_t tcpip_if, mdns_ip_protocol_t ip_protocol, uint16_t type, mdns_srv_item_t *service) | /* Find, remove and free answer from the scheduled packets. */
static void _mdns_remove_scheduled_answer(tcpip_adapter_if_t tcpip_if, mdns_ip_protocol_t ip_protocol, uint16_t type, mdns_srv_item_t *service) | {
mdns_srv_item_t s = {NULL, NULL};
if (!service) {
service = &s;
}
mdns_tx_packet_t * q = _mdns_server->tx_queue_head;
while (q) {
if (q->tcpip_if == tcpip_if && q->ip_protocol == ip_protocol && q->distributed) {
mdns_out_answer_t * a = q->answers;
if (a->typ... | retro-esp32/RetroESP32 | C++ | Creative Commons Attribution Share Alike 4.0 International | 581 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.