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 |
|---|---|---|---|---|---|---|---|
/* Entry point routine: all calls go through this function */ | static int palinfo_read_entry(char *page, char **start, off_t off, int count, int *eof, void *data) | /* Entry point routine: all calls go through this function */
static int palinfo_read_entry(char *page, char **start, off_t off, int count, int *eof, void *data) | {
int len=0;
pal_func_cpu_u_t *f = (pal_func_cpu_u_t *)&data;
if (f->req_cpu == get_cpu())
len = (*palinfo_entries[f->func_id].proc_read)(page);
else
len = palinfo_handle_smp(f, page);
put_cpu();
if (len <= off+count) *eof = 1;
*start = page + off;
len -= off;
if (len>count) len = count;
if (len<0) len = 0;
return len;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Prints out an ALERT message about I/O error. */ | void xfs_ioerror_alert(char *func, struct xfs_mount *mp, xfs_buf_t *bp, xfs_daddr_t blkno) | /* Prints out an ALERT message about I/O error. */
void xfs_ioerror_alert(char *func, struct xfs_mount *mp, xfs_buf_t *bp, xfs_daddr_t blkno) | {
cmn_err(CE_ALERT,
"I/O error in filesystem (\"%s\") meta-data dev %s block 0x%llx"
" (\"%s\") error %d buf count %zd",
(!mp || !mp->m_fsname) ? "(fs name not set)" : mp->m_fsname,
XFS_BUFTARG_NAME(XFS_BUF_TARGET(bp)),
(__uint64_t)blkno, func,
XFS_BUF_GETERROR(bp), XFS_BUF_COUNT(bp));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Configures the TIMER in Slave mode in interrupt mode. */ | ald_status_t ald_timer_slave_config_sync_by_it(ald_timer_handle_t *hperh, ald_timer_slave_config_t *config) | /* Configures the TIMER in Slave mode in interrupt mode. */
ald_status_t ald_timer_slave_config_sync_by_it(ald_timer_handle_t *hperh, ald_timer_slave_config_t *config) | {
assert_param(IS_TIMER_INSTANCE(hperh->perh));
assert_param(IS_TIMER_SLAVE_MODE(config->mode));
assert_param(IS_TIMER_TS(config->input));
assert_param(IS_TIMER_CLOCK_POLARITY(config->polarity));
assert_param(IS_TIMER_ETR_PSC(config->psc));
assert_param(IS_TIMER_IC_FILTER(config->filter));
__LOCK(hperh);
hperh->state = ALD_TIMER_STATE_BUSY;
timer_slave_set_config(hperh, config);
ald_timer_interrupt_config(hperh, ALD_TIMER_IT_TRIGGER, ENABLE);
ald_timer_dma_req_config(hperh, ALD_TIMER_DMA_TRIGGER, DISABLE);
hperh->state = ALD_TIMER_STATE_READY;
__UNLOCK(hperh);
return ALD_OK;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* System calibration set configuration.
Use this function to set system calibration configuration. */ | void system_calibration_set_config(struct system_calibration_config *config) | /* System calibration set configuration.
Use this function to set system calibration configuration. */
void system_calibration_set_config(struct system_calibration_config *config) | {
Assert(config);
LP_CLK_CAL_REGS0->CONFIG_REG.reg &= \
~(LP_CLK_CAL_REGS_CONFIG_REG_NUMBER_CALIB_CLKS_Msk | \
LP_CLK_CAL_REGS_CONFIG_REG_IRQ_CONTROL_Msk);
LP_CLK_CAL_REGS0->CONFIG_REG.reg |= \
LP_CLK_CAL_REGS_CONFIG_REG_NUMBER_CALIB_CLKS(config->clk_num) | \
LP_CLK_CAL_REGS_CONFIG_REG_IRQ_CONTROL(config->interrupt_control);
} | memfault/zero-to-main | C++ | null | 200 |
/* Do a run through all devices checking for timeouts */ | static void wusbhc_keep_alive_run(struct work_struct *ws) | /* Do a run through all devices checking for timeouts */
static void wusbhc_keep_alive_run(struct work_struct *ws) | {
struct delayed_work *dw = to_delayed_work(ws);
struct wusbhc *wusbhc = container_of(dw, struct wusbhc, keep_alive_timer);
mutex_lock(&wusbhc->mutex);
__wusbhc_keep_alive(wusbhc);
mutex_unlock(&wusbhc->mutex);
queue_delayed_work(wusbd, &wusbhc->keep_alive_timer,
msecs_to_jiffies(wusbhc->trust_timeout / 2));
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Disable access to DIL/NetPC's flash by mapping it into the SC4x0's MMS Window C. */ | static void dnpc_unmap_flash(void) | /* Disable access to DIL/NetPC's flash by mapping it into the SC4x0's MMS Window C. */
static void dnpc_unmap_flash(void) | {
setcsc(CSC_CR, getcsc(CSC_CR) | 0x2);
setpcc(PCC_AWER_B, getpcc(PCC_AWER_B) & ~0x02);
setcsc(CSC_CR, getcsc(CSC_CR) & ~0x2);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Enable Time-out Counter Function and support Long Time-out. */ | void I2C_EnableTimeout(I2C_T *i2c, uint8_t u8LongTimeout) | /* Enable Time-out Counter Function and support Long Time-out. */
void I2C_EnableTimeout(I2C_T *i2c, uint8_t u8LongTimeout) | {
if(u8LongTimeout)
{
i2c->TOCTL |= I2C_TOCTL_TOCDIV4_Msk;
}
else
{
i2c->TOCTL &= ~I2C_TOCTL_TOCDIV4_Msk;
}
i2c->TOCTL |= I2C_TOCTL_TOCEN_Msk;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enable the DMA of the specified SPI port.
The */ | void SPI3PDMAEnable(unsigned long ulBase, unsigned long ulDmaMode) | /* Enable the DMA of the specified SPI port.
The */
void SPI3PDMAEnable(unsigned long ulBase, unsigned long ulDmaMode) | {
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE) || (ulBase == SPI3_BASE));
xHWREG(ulBase + SPI_DMACTL) |= ulDmaMode;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* The open entry point is called when a network interface is made active by the system (IFF_UP). At this point all resources needed for transmit and receive operations are allocated, the interrupt handler is registered with the OS, the watchdog timer is started, and the stack is notified that the interface is ready. */ | static int ixgb_open(struct net_device *netdev) | /* The open entry point is called when a network interface is made active by the system (IFF_UP). At this point all resources needed for transmit and receive operations are allocated, the interrupt handler is registered with the OS, the watchdog timer is started, and the stack is notified that the interface is ready. */
static int ixgb_open(struct net_device *netdev) | {
struct ixgb_adapter *adapter = netdev_priv(netdev);
int err;
err = ixgb_setup_tx_resources(adapter);
if (err)
goto err_setup_tx;
netif_carrier_off(netdev);
err = ixgb_setup_rx_resources(adapter);
if (err)
goto err_setup_rx;
err = ixgb_up(adapter);
if (err)
goto err_up;
netif_start_queue(netdev);
return 0;
err_up:
ixgb_free_rx_resources(adapter);
err_setup_rx:
ixgb_free_tx_resources(adapter);
err_setup_tx:
ixgb_reset(adapter);
return err;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Returns: TRUE if @stream is closed. FALSE otherwise. */ | gboolean g_output_stream_is_closed(GOutputStream *stream) | /* Returns: TRUE if @stream is closed. FALSE otherwise. */
gboolean g_output_stream_is_closed(GOutputStream *stream) | {
g_return_val_if_fail (G_IS_OUTPUT_STREAM (stream), TRUE);
return stream->priv->closed;
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Clears the current value in @value (if any) and "unsets" the type, this releases all resources associated with this GValue. An unset value is the same as an uninitialized (zero-filled) #GValue structure. */ | void g_value_unset(GValue *value) | /* Clears the current value in @value (if any) and "unsets" the type, this releases all resources associated with this GValue. An unset value is the same as an uninitialized (zero-filled) #GValue structure. */
void g_value_unset(GValue *value) | {
GTypeValueTable *value_table;
if (value->g_type == 0)
return;
g_return_if_fail (G_IS_VALUE (value));
value_table = g_type_value_table_peek (G_VALUE_TYPE (value));
if (value_table->value_free)
value_table->value_free (value);
memset (value, 0, sizeof (*value));
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This comparator searches for the next Interface descriptor of the correct Mass Storage Class, Subclass and Protocol values. */ | uint8_t DComp_NextMSInterface(void *CurrentDescriptor) | /* This comparator searches for the next Interface descriptor of the correct Mass Storage Class, Subclass and Protocol values. */
uint8_t DComp_NextMSInterface(void *CurrentDescriptor) | {
USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t);
if (Header->Type == DTYPE_Interface)
{
USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t);
if ((Interface->Class == MASS_STORE_CLASS) &&
(Interface->SubClass == MASS_STORE_SUBCLASS) &&
(Interface->Protocol == MASS_STORE_PROTOCOL))
{
return DESCRIPTOR_SEARCH_Found;
}
}
return DESCRIPTOR_SEARCH_NotFound;
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Add an inode to the inode hash for this superblock. */ | void __insert_inode_hash(struct inode *inode, unsigned long hashval) | /* Add an inode to the inode hash for this superblock. */
void __insert_inode_hash(struct inode *inode, unsigned long hashval) | {
struct hlist_head *head = inode_hashtable + hash(inode->i_sb, hashval);
spin_lock(&inode_lock);
hlist_add_head(&inode->i_hash, head);
spin_unlock(&inode_lock);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Converts a parity enum value to a Mode Register bit mask.
It is assumed that the Mode Register contents that are being modified within this function come with the bits modified by this function already masked out by the caller. */ | static bool uart_xlnx_ps_cfg2ll_parity(uint32_t *mode_reg, enum uart_config_parity parity) | /* Converts a parity enum value to a Mode Register bit mask.
It is assumed that the Mode Register contents that are being modified within this function come with the bits modified by this function already masked out by the caller. */
static bool uart_xlnx_ps_cfg2ll_parity(uint32_t *mode_reg, enum uart_config_parity parity) | {
switch (parity) {
default:
case UART_CFG_PARITY_EVEN:
*mode_reg |= XUARTPS_MR_PARITY_EVEN;
break;
case UART_CFG_PARITY_ODD:
*mode_reg |= XUARTPS_MR_PARITY_ODD;
break;
case UART_CFG_PARITY_SPACE:
*mode_reg |= XUARTPS_MR_PARITY_SPACE;
break;
case UART_CFG_PARITY_MARK:
*mode_reg |= XUARTPS_MR_PARITY_MARK;
break;
case UART_CFG_PARITY_NONE:
*mode_reg |= XUARTPS_MR_PARITY_NONE;
break;
}
return true;
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Set the fields of structure stc_dvp_init_t to default values. */ | int32_t DVP_StructInit(stc_dvp_init_t *pstcDvpInit) | /* Set the fields of structure stc_dvp_init_t to default values. */
int32_t DVP_StructInit(stc_dvp_init_t *pstcDvpInit) | {
int32_t i32Ret = LL_ERR_INVD_PARAM;
if (NULL != pstcDvpInit) {
pstcDvpInit->u32SyncMode = DVP_SYNC_MD_HW;
pstcDvpInit->u32DataWidth = DVP_DATA_WIDTH_8BIT;
pstcDvpInit->u32CaptureMode = DVP_CAPT_MD_CONTINUOS_FRAME;
pstcDvpInit->u32CaptureFreq = DVP_CAPT_FREQ_ALL_FRAME;
pstcDvpInit->u32PIXCLKPolarity = DVP_PIXCLK_FALLING;
pstcDvpInit->u32HSYNCPolarity = DVP_HSYNC_LOW;
pstcDvpInit->u32VSYNCPolarity = DVP_VSYNC_LOW;
i32Ret = LL_OK;
}
return i32Ret;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* The scope will default to universe except for loopback addresses in which case a host scope is used if not specified otherwise. */ | int rtnl_addr_build_add_request(struct rtnl_addr *addr, int flags, struct nl_msg **result) | /* The scope will default to universe except for loopback addresses in which case a host scope is used if not specified otherwise. */
int rtnl_addr_build_add_request(struct rtnl_addr *addr, int flags, struct nl_msg **result) | {
int required = ADDR_ATTR_IFINDEX | ADDR_ATTR_FAMILY |
ADDR_ATTR_PREFIXLEN | ADDR_ATTR_LOCAL;
if ((addr->ce_mask & required) != required)
return -NLE_MISSING_ATTR;
return build_addr_msg(addr, RTM_NEWADDR, NLM_F_CREATE | flags, result);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* EFI_IFR_TYPE_REF, EFI_IFR_TYPE_DATE and EFI_IFR_TYPE_TIME are converted to EFI_IFR_TYPE_BUFFER when do the value compare. */ | VOID GetBufAndLenForValue(IN EFI_HII_VALUE *Value, OUT UINT8 **Buf, OUT UINT16 *BufLen) | /* EFI_IFR_TYPE_REF, EFI_IFR_TYPE_DATE and EFI_IFR_TYPE_TIME are converted to EFI_IFR_TYPE_BUFFER when do the value compare. */
VOID GetBufAndLenForValue(IN EFI_HII_VALUE *Value, OUT UINT8 **Buf, OUT UINT16 *BufLen) | {
switch (Value->Type) {
case EFI_IFR_TYPE_BUFFER:
*Buf = Value->Buffer;
*BufLen = Value->BufferLen;
break;
case EFI_IFR_TYPE_DATE:
*Buf = (UINT8 *)(&Value->Value.date);
*BufLen = (UINT16)sizeof (EFI_HII_DATE);
break;
case EFI_IFR_TYPE_TIME:
*Buf = (UINT8 *)(&Value->Value.time);
*BufLen = (UINT16)sizeof (EFI_HII_TIME);
break;
case EFI_IFR_TYPE_REF:
*Buf = (UINT8 *)(&Value->Value.ref);
*BufLen = (UINT16)sizeof (EFI_HII_REF);
break;
default:
*Buf = NULL;
*BufLen = 0;
}
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Reset the timer by placing the timer back into it's default reset configuration. */ | void TimerReset(void) | /* Reset the timer by placing the timer back into it's default reset configuration. */
void TimerReset(void) | {
LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_TIM2);
LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_TIM2);
LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_TIM2);
SysTick->CTRL = 0;
SysTick->LOAD = 0;
SysTick->VAL = 0;
} | feaser/openblt | C++ | GNU General Public License v3.0 | 601 |
/* parport_ip32_disable_irq - disable interrupts on the rising edge of nACK */ | static void parport_ip32_disable_irq(struct parport *p) | /* parport_ip32_disable_irq - disable interrupts on the rising edge of nACK */
static void parport_ip32_disable_irq(struct parport *p) | {
__parport_ip32_frob_control(p, DCR_IRQ, 0);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Fast approximation to the trigonometric sine function for Q31 data. */ | q31_t arm_sin_q31(q31_t x) | /* Fast approximation to the trigonometric sine function for Q31 data. */
q31_t arm_sin_q31(q31_t x) | {
q31_t sinVal;
int32_t index;
q31_t a, b;
q31_t fract;
index = (uint32_t)x >> FAST_MATH_Q31_SHIFT;
fract = (x - (index << FAST_MATH_Q31_SHIFT)) << 9;
a = sinTable_q31[index];
b = sinTable_q31[index+1];
sinVal = (q63_t) (0x80000000 - fract) * a >> 32;
sinVal = (q31_t) ((((q63_t) sinVal << 32) + ((q63_t) fract * b)) >> 32);
return (sinVal << 1);
} | pikasTech/PikaPython | C++ | MIT License | 1,403 |
/* Get/set the size of a physical counter to either 16 or 32 bits. */ | u32 cbe_get_ctr_size(u32 cpu, u32 phys_ctr) | /* Get/set the size of a physical counter to either 16 or 32 bits. */
u32 cbe_get_ctr_size(u32 cpu, u32 phys_ctr) | {
u32 pm_ctrl, size = 0;
if (phys_ctr < NR_PHYS_CTRS) {
pm_ctrl = cbe_read_pm(cpu, pm_control);
size = (pm_ctrl & CBE_PM_16BIT_CTR(phys_ctr)) ? 16 : 32;
}
return size;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Set shake rejection threshold. If the DMP detects a gyro sample larger than */ | int dmp_set_shake_reject_thresh(long sf, unsigned short thresh) | /* Set shake rejection threshold. If the DMP detects a gyro sample larger than */
int dmp_set_shake_reject_thresh(long sf, unsigned short thresh) | {
unsigned char tmp[4];
long thresh_scaled = sf / 1000 * thresh;
tmp[0] = (unsigned char)(((long)thresh_scaled >> 24) & 0xFF);
tmp[1] = (unsigned char)(((long)thresh_scaled >> 16) & 0xFF);
tmp[2] = (unsigned char)(((long)thresh_scaled >> 8) & 0xFF);
tmp[3] = (unsigned char)((long)thresh_scaled & 0xFF);
return mpu_write_mem(D_1_92, 4, tmp);
} | Luos-io/luos_engine | C++ | MIT License | 496 |
/* OsIf call to get the processor number of the core making the access. */ | uint8_t Sys_GetCoreID(void) | /* OsIf call to get the processor number of the core making the access. */
uint8_t Sys_GetCoreID(void) | {
return ((uint8_t)(IP_MSCM->CPXNUM & MSCM_CPXNUM_CPN_MASK));
} | zephyrproject-rtos/zephyr | C++ | Apache License 2.0 | 9,573 |
/* Convert the driver configuration data into the IFR data. */ | EFI_STATUS WifiMgrConvertConfigDataToIfrNvData(IN WIFI_MGR_PRIVATE_DATA *Private, OUT WIFI_MANAGER_IFR_NVDATA *IfrNvData) | /* Convert the driver configuration data into the IFR data. */
EFI_STATUS WifiMgrConvertConfigDataToIfrNvData(IN WIFI_MGR_PRIVATE_DATA *Private, OUT WIFI_MANAGER_IFR_NVDATA *IfrNvData) | {
ASSERT (Private != NULL);
if (Private->CurrentNic != NULL) {
IfrNvData->ProfileCount = Private->CurrentNic->AvailableCount;
} else {
IfrNvData->ProfileCount = 0;
}
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Wrapper function to return a ib_mad_port_private structure or NULL for a device/port */ | static struct ib_mad_port_private* ib_get_mad_port(struct ib_device *device, int port_num) | /* Wrapper function to return a ib_mad_port_private structure or NULL for a device/port */
static struct ib_mad_port_private* ib_get_mad_port(struct ib_device *device, int port_num) | {
struct ib_mad_port_private *entry;
unsigned long flags;
spin_lock_irqsave(&ib_mad_port_list_lock, flags);
entry = __ib_get_mad_port(device, port_num);
spin_unlock_irqrestore(&ib_mad_port_list_lock, flags);
return entry;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Writes data to the specified GPIO data port. */ | void GPIO_Write(GPIO_TypeDef *GPIOx, uint16_t PortVal) | /* Writes data to the specified GPIO data port. */
void GPIO_Write(GPIO_TypeDef *GPIOx, uint16_t PortVal) | {
assert_param(IS_GPIO_ALL_PERIPH(GPIOx));
GPIOx->ODR = PortVal;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Removes all cases of @attribute from @info if it exists. */ | void g_file_info_remove_attribute(GFileInfo *info, const char *attribute) | /* Removes all cases of @attribute from @info if it exists. */
void g_file_info_remove_attribute(GFileInfo *info, const char *attribute) | {
guint32 attr_id;
GFileAttribute *attrs;
int i;
g_return_if_fail (G_IS_FILE_INFO (info));
g_return_if_fail (attribute != NULL && *attribute != '\0');
attr_id = lookup_attribute (attribute);
i = g_file_info_find_place (info, attr_id);
attrs = (GFileAttribute *)info->attributes->data;
if (i < info->attributes->len &&
attrs[i].attribute == attr_id)
{
_g_file_attribute_value_clear (&attrs[i].value);
g_array_remove_index (info->attributes, i);
}
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* find_inode - resolve a user-given path to a specific inode */ | static int inotify_find_inode(const char __user *dirname, struct path *path, unsigned flags) | /* find_inode - resolve a user-given path to a specific inode */
static int inotify_find_inode(const char __user *dirname, struct path *path, unsigned flags) | {
int error;
error = user_path_at(AT_FDCWD, dirname, flags, path);
if (error)
return error;
error = inode_permission(path->dentry->d_inode, MAY_READ);
if (error)
path_put(path);
return error;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Given a port state, this function returns a value that would result in the port being in the same state, if the value was written to the port status control register. Save Read Only (RO) bits and save read/write bits where writing a 0 clears the bit and writing a 1 sets the bit (RWS). For all other types (RW1S, RW1CS, RW, and RZ), writing a '0' has no effect. */ | static u32 xhci_port_state_to_neutral(u32 state) | /* Given a port state, this function returns a value that would result in the port being in the same state, if the value was written to the port status control register. Save Read Only (RO) bits and save read/write bits where writing a 0 clears the bit and writing a 1 sets the bit (RWS). For all other types (RW1S, RW1CS, RW, and RZ), writing a '0' has no effect. */
static u32 xhci_port_state_to_neutral(u32 state) | {
return (state & XHCI_PORT_RO) | (state & XHCI_PORT_RWS);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param handle PDM eDMA handle pointer. param multiChannelInterleaveType Multi channel interleave type. */ | void PDM_TransferSetMultiChannelInterleaveType(pdm_edma_handle_t *handle, pdm_edma_multi_channel_interleave_t multiChannelInterleaveType) | /* param handle PDM eDMA handle pointer. param multiChannelInterleaveType Multi channel interleave type. */
void PDM_TransferSetMultiChannelInterleaveType(pdm_edma_handle_t *handle, pdm_edma_multi_channel_interleave_t multiChannelInterleaveType) | {
handle->interleaveType = multiChannelInterleaveType;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Fills each HASH_InitStruct member with its default value. */ | void HASH_StructInit(HASH_InitTypeDef *HASH_InitStruct) | /* Fills each HASH_InitStruct member with its default value. */
void HASH_StructInit(HASH_InitTypeDef *HASH_InitStruct) | {
HASH_InitStruct->HASH_AlgoSelection = HASH_AlgoSelection_SHA1;
HASH_InitStruct->HASH_AlgoMode = HASH_AlgoMode_HASH;
HASH_InitStruct->HASH_DataType = HASH_DataType_32b;
HASH_InitStruct->HASH_HMACKeyType = HASH_HMACKeyType_ShortKey;
} | MaJerle/stm32f429 | C++ | null | 2,036 |
/* param handle codec handle. param module audio codec module. param powerOn true is power on, false is power down. return kStatus_Success is success, else configure failed. */ | status_t HAL_CODEC_SetPower(void *handle, uint32_t module, bool powerOn) | /* param handle codec handle. param module audio codec module. param powerOn true is power on, false is power down. return kStatus_Success is success, else configure failed. */
status_t HAL_CODEC_SetPower(void *handle, uint32_t module, bool powerOn) | {
assert(handle != NULL);
return WM8960_SetModule((wm8960_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)),
HAL_WM8960_MAP_MODULE(module), powerOn);
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* The SoundScape can use two IRQs from a possible set of four. These IRQs are encoded as bit patterns so that they can be written to the control registers. */ | static unsigned __devinit get_irq_config(int sscape_type, int irq) | /* The SoundScape can use two IRQs from a possible set of four. These IRQs are encoded as bit patterns so that they can be written to the control registers. */
static unsigned __devinit get_irq_config(int sscape_type, int irq) | {
static const int valid_irq[] = { 9, 5, 7, 10 };
static const int old_irq[] = { 9, 7, 5, 15 };
unsigned cfg;
if (sscape_type == MEDIA_FX) {
for (cfg = 0; cfg < ARRAY_SIZE(old_irq); ++cfg)
if (irq == old_irq[cfg])
return cfg;
} else {
for (cfg = 0; cfg < ARRAY_SIZE(valid_irq); ++cfg)
if (irq == valid_irq[cfg])
return cfg;
}
return INVALID_IRQ;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This routine is invoked to free the driver's IOCB list and memory. */ | static void lpfc_free_iocb_list(struct lpfc_hba *phba) | /* This routine is invoked to free the driver's IOCB list and memory. */
static void lpfc_free_iocb_list(struct lpfc_hba *phba) | {
struct lpfc_iocbq *iocbq_entry = NULL, *iocbq_next = NULL;
spin_lock_irq(&phba->hbalock);
list_for_each_entry_safe(iocbq_entry, iocbq_next,
&phba->lpfc_iocb_list, list) {
list_del(&iocbq_entry->list);
kfree(iocbq_entry);
phba->total_iocbq_bufs--;
}
spin_unlock_irq(&phba->hbalock);
return;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function returns a list of InformationType GUIDs that are supported on an adapter with this instance of EFI_ADAPTER_INFORMATION_PROTOCOL. The list is returned in InfoTypesBuffer, and the number of GUID pointers in InfoTypesBuffer is returned in InfoTypesBufferCount. */ | EFI_STATUS EFIAPI HstiAipGetSupportedTypes(IN EFI_ADAPTER_INFORMATION_PROTOCOL *This, OUT EFI_GUID **InfoTypesBuffer, OUT UINTN *InfoTypesBufferCount) | /* This function returns a list of InformationType GUIDs that are supported on an adapter with this instance of EFI_ADAPTER_INFORMATION_PROTOCOL. The list is returned in InfoTypesBuffer, and the number of GUID pointers in InfoTypesBuffer is returned in InfoTypesBufferCount. */
EFI_STATUS EFIAPI HstiAipGetSupportedTypes(IN EFI_ADAPTER_INFORMATION_PROTOCOL *This, OUT EFI_GUID **InfoTypesBuffer, OUT UINTN *InfoTypesBufferCount) | {
if ((This == NULL) || (InfoTypesBuffer == NULL) || (InfoTypesBufferCount == NULL)) {
return EFI_INVALID_PARAMETER;
}
*InfoTypesBuffer = AllocateCopyPool (sizeof (gAdapterInfoPlatformSecurityGuid), &gAdapterInfoPlatformSecurityGuid);
if (*InfoTypesBuffer == NULL) {
return EFI_OUT_OF_RESOURCES;
}
*InfoTypesBufferCount = 1;
return EFI_SUCCESS;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* USART Get Stop Bit(s).
The stop bits are specified as 0.5, 1, 1.5 or 2. */ | uint32_t usart_get_stopbits(uint32_t usart) | /* USART Get Stop Bit(s).
The stop bits are specified as 0.5, 1, 1.5 or 2. */
uint32_t usart_get_stopbits(uint32_t usart) | {
const uint32_t reg32 = USART_CR2(usart);
return reg32 & USART_CR2_STOPBITS_MASK;
} | libopencm3/libopencm3 | C++ | GNU General Public License v3.0 | 2,931 |
/* Don't use this fix if you don't need to!!! */ | static void broken_bios_start(unsigned long acpibase) | /* Don't use this fix if you don't need to!!! */
static void broken_bios_start(unsigned long acpibase) | {
unsigned long val32;
val32 = inl(SMI_EN);
val32 &= 0xffffdffe;
outl(val32, SMI_EN);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Attach a specified sensor descriptor to a sensor device.
Applications invoke this routine to attach a */ | bool sensor_attach(sensor_t *sensor, sensor_type_t type, int num, void *aux) | /* Attach a specified sensor descriptor to a sensor device.
Applications invoke this routine to attach a */
bool sensor_attach(sensor_t *sensor, sensor_type_t type, int num, void *aux) | {
bool attached = false;
sensor_hal_t *hal = sensor_find(type);
sensor->hal = hal;
sensor->type = type;
sensor->aux = aux;
if ((hal != NULL) &&
((hal->sensor_init)(sensor, num))) {
sensor->mod = SENSOR_STATE_NORMAL;
sensor->err = SENSOR_ERR_NONE;
attached = true;
} else {
sensor->err = SENSOR_ERR_DRIVER;
}
return attached;
} | memfault/zero-to-main | C++ | null | 200 |
/* Set a file's attributes N.B. After this call resp->fh needs an fh_put */ | static __be32 nfsd_proc_setattr(struct svc_rqst *rqstp, struct nfsd_sattrargs *argp, struct nfsd_attrstat *resp) | /* Set a file's attributes N.B. After this call resp->fh needs an fh_put */
static __be32 nfsd_proc_setattr(struct svc_rqst *rqstp, struct nfsd_sattrargs *argp, struct nfsd_attrstat *resp) | {
__be32 nfserr;
dprintk("nfsd: SETATTR %s, valid=%x, size=%ld\n",
SVCFH_fmt(&argp->fh),
argp->attrs.ia_valid, (long) argp->attrs.ia_size);
fh_copy(&resp->fh, &argp->fh);
nfserr = nfsd_setattr(rqstp, &resp->fh, &argp->attrs,0, (time_t)0);
return nfsd_return_attrs(nfserr, resp);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* SDMMCHOST detect card insert status by host controller. */ | static void SDMMCHOST_DetectCardInsertByHost(SDMMCHOST_TYPE *base, void *userData) | /* SDMMCHOST detect card insert status by host controller. */
static void SDMMCHOST_DetectCardInsertByHost(SDMMCHOST_TYPE *base, void *userData) | {
(void)base;
s_sdInsertedFlag = true;
SDMMCEVENT_Notify(kSDMMCEVENT_CardDetect);
if (userData && ((sdmmchost_detect_card_t *)userData)->cardInserted)
{
((sdmmchost_detect_card_t *)userData)->cardInserted(true, ((sdmmchost_detect_card_t *)userData)->userData);
}
} | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* LPSCI DMA send finished callback function.
This function is called when LPSCI DMA send finished. It disables the LPSCI TX DMA request and sends kStatus_LPSCI_TxIdle to LPSCI callback. */ | static void LPSCI_TransferSendDMACallback(dma_handle_t *handle, void *param) | /* LPSCI DMA send finished callback function.
This function is called when LPSCI DMA send finished. It disables the LPSCI TX DMA request and sends kStatus_LPSCI_TxIdle to LPSCI callback. */
static void LPSCI_TransferSendDMACallback(dma_handle_t *handle, void *param) | {
assert(handle);
assert(param);
lpsci_dma_private_handle_t *lpsciPrivateHandle = (lpsci_dma_private_handle_t *)param;
LPSCI_EnableTxDMA(lpsciPrivateHandle->base, false);
DMA_DisableInterrupts(handle->base, handle->channel);
lpsciPrivateHandle->handle->txState = kLPSCI_TxIdle;
if (lpsciPrivateHandle->handle->callback)
{
lpsciPrivateHandle->handle->callback(lpsciPrivateHandle->base, lpsciPrivateHandle->handle, kStatus_LPSCI_TxIdle,
lpsciPrivateHandle->handle->userData);
}
} | labapart/polymcu | C++ | null | 201 |
/* Set the specified Thread Flags of a thread. */ | uint32_t osThreadFlagsSet(osThreadId_t thread_id, uint32_t flags) | /* Set the specified Thread Flags of a thread. */
uint32_t osThreadFlagsSet(osThreadId_t thread_id, uint32_t flags) | {
thread_flags = isrRtxThreadFlagsSet(thread_id, flags);
} else {
thread_flags = __svcThreadFlagsSet(thread_id, flags);
}
return thread_flags;
} | ARMmbed/DAPLink | C++ | Apache License 2.0 | 2,140 |
/* Probe for a maXTouch connected to a specific TWI line. */ | status_code_t mxt_probe_device(twi_master_t interface, uint8_t chip_adr) | /* Probe for a maXTouch connected to a specific TWI line. */
status_code_t mxt_probe_device(twi_master_t interface, uint8_t chip_adr) | {
struct mxt_info_object info;
uint8_t status;
twi_package_t packet = {
.addr[0] = MXT_MEM_ADDR,
.addr[1] = MXT_MEM_ADDR >> 8,
.addr_length = sizeof(mxt_memory_adr),
.chip = chip_adr,
.buffer = &info,
.length = sizeof(info)
};
status = twi_master_read(interface, &packet);
if (status != TWI_SUCCESS) {
return (status_code_t)status;
}
if ((info.family_ID != MXT_FAMILY_143E)
|| (info.variant_ID != MXT_VARIANT_143E)) {
return ERR_BAD_ADDRESS;
}
return STATUS_OK;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Allocate memory for the driver handler and initialize the physical layer. */ | int32_t cli_setup(struct cli_desc **device, struct cli_init_param *init_param) | /* Allocate memory for the driver handler and initialize the physical layer. */
int32_t cli_setup(struct cli_desc **device, struct cli_init_param *init_param) | {
int32_t ret;
struct cli_desc *dev;
dev = calloc(1, sizeof *dev);
if (!dev)
return -1;
ret = usr_uart_init(&dev->uart_device, &init_param->uart_init);
if(ret < 0)
goto error;
*device = dev;
return ret;
error:
free(dev);
return ret;
} | analogdevicesinc/EVAL-ADICUP3029 | C++ | Other | 36 |
/* Deinitializes the BKP peripheral registers to their default reset values. */ | void BKP_DeInit(void) | /* Deinitializes the BKP peripheral registers to their default reset values. */
void BKP_DeInit(void) | {
RCC_BackupResetCmd(ENABLE);
RCC_BackupResetCmd(DISABLE);
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* CAN MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_CAN_MspDeInit(CAN_HandleTypeDef *hcan) | /* CAN MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_CAN_MspDeInit(CAN_HandleTypeDef *hcan) | {
if(hcan->Instance==CAN1)
{
HAL_RCC_CAN1_CLK_ENABLED--;
if(HAL_RCC_CAN1_CLK_ENABLED==0){
__HAL_RCC_CAN1_CLK_DISABLE();
}
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_0|GPIO_PIN_1);
}
else if(hcan->Instance==CAN2)
{
__HAL_RCC_CAN2_CLK_DISABLE();
HAL_RCC_CAN1_CLK_ENABLED--;
if(HAL_RCC_CAN1_CLK_ENABLED==0){
__HAL_RCC_CAN1_CLK_DISABLE();
}
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_12|GPIO_PIN_13);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Any changes to the returned string will impact the original JSON value. */ | CONST CHAR8* EFIAPI JsonValueGetAsciiString(IN EDKII_JSON_VALUE Json) | /* Any changes to the returned string will impact the original JSON value. */
CONST CHAR8* EFIAPI JsonValueGetAsciiString(IN EDKII_JSON_VALUE Json) | {
CONST CHAR8 *AsciiStr;
UINTN Index;
AsciiStr = json_string_value ((json_t *)Json);
if (AsciiStr == NULL) {
return NULL;
}
Index = 0;
while (*(AsciiStr + Index) != '\0') {
if (((*(AsciiStr + Index)) & 0x80) != 0x00) {
return NULL;
}
Index++;
}
return AsciiStr;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* For DLT_IEEE802_11_RADIO_AVS; like DLT_IEEE802_11, but with an extra header, containing information such as radio information, which we currently ignore. */ | u_int ieee802_11_radio_avs_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) | /* For DLT_IEEE802_11_RADIO_AVS; like DLT_IEEE802_11, but with an extra header, containing information such as radio information, which we currently ignore. */
u_int ieee802_11_radio_avs_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_char *p) | {
return ieee802_11_radio_print(ndo, p, h->len, h->caplen);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* This code first checks the new way, and then the old way. */ | static unsigned int soc_info(unsigned int *rev_h, unsigned int *rev_l) | /* This code first checks the new way, and then the old way. */
static unsigned int soc_info(unsigned int *rev_h, unsigned int *rev_l) | {
struct device_node *np;
const char *soc_string;
unsigned int svr;
unsigned int soc;
np = of_find_node_by_type(NULL, "cpu");
if (!np)
return 0;
soc_string = of_get_property(np, "compatible", NULL);
if (!soc_string)
soc_string = np->name;
if ((sscanf(soc_string, "PowerPC,%u", &soc) != 1) || !soc)
return 0;
svr = mfspr(SPRN_SVR);
*rev_h = (svr >> 4) & 0xf;
*rev_l = svr & 0xf;
return soc;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Write to TX register using non-blocking method.
This function writes data to the TX register directly, upper layer must make sure the TX register is empty or TX FIFO has empty room before calling this function. */ | static void LPUART_WriteNonBlocking(LPUART_Type *base, const uint8_t *data, size_t length) | /* Write to TX register using non-blocking method.
This function writes data to the TX register directly, upper layer must make sure the TX register is empty or TX FIFO has empty room before calling this function. */
static void LPUART_WriteNonBlocking(LPUART_Type *base, const uint8_t *data, size_t length) | {
size_t i;
for (i = 0; i < length; i++)
{
base->DATA = data[i];
}
} | labapart/polymcu | C++ | null | 201 |
/* De-initialize GPIO pin handle. stops operation and releases the software resources used by the handle. */ | int32_t csi_gpio_pin_uninitialize(gpio_pin_handle_t handle) | /* De-initialize GPIO pin handle. stops operation and releases the software resources used by the handle. */
int32_t csi_gpio_pin_uninitialize(gpio_pin_handle_t handle) | {
if (handle == NULL) {
return ERR_GPIO(DRV_ERROR_PARAMETER);
}
dw_gpio_pin_priv_t *gpio_pin_priv = (dw_gpio_pin_priv_t *)handle;
gpio_pin_priv->cb = NULL;
gpio_irq_disable(handle);
return 0;
} | alibaba/AliOS-Things | C++ | Apache License 2.0 | 4,536 |
/* Forces the TIMx output 4 waveform to active or inactive level. */ | void TIM_ForcedOC4Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction) | /* Forces the TIMx output 4 waveform to active or inactive level. */
void TIM_ForcedOC4Config(TIM_TypeDef *TIMx, uint16_t TIM_ForcedAction) | {
uint16_t tmpccmr2 = 0;
assert_param(IS_TIM_LIST3_PERIPH(TIMx));
assert_param(IS_TIM_FORCED_ACTION(TIM_ForcedAction));
tmpccmr2 = TIMx->CCMR2;
tmpccmr2 &= (uint16_t)~((uint16_t)TIM_CCMR2_OC4M);
tmpccmr2 |= (uint16_t)(TIM_ForcedAction << 8);
TIMx->CCMR2 = tmpccmr2;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Shutdown and then release all the resources that the driver allocated on initialisation. */ | static int __devexit s3c_fb_remove(struct platform_device *pdev) | /* Shutdown and then release all the resources that the driver allocated on initialisation. */
static int __devexit s3c_fb_remove(struct platform_device *pdev) | {
struct s3c_fb *sfb = platform_get_drvdata(pdev);
int win;
for (win = 0; win < S3C_FB_MAX_WIN; win++)
if (sfb->windows[win])
s3c_fb_release_win(sfb, sfb->windows[win]);
iounmap(sfb->regs);
clk_disable(sfb->bus_clk);
clk_put(sfb->bus_clk);
release_resource(sfb->regs_res);
kfree(sfb->regs_res);
kfree(sfb);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Finalize the running hash to make digest.
This function empties the internal buffer, adds padding bits, and generates final digest. */ | static status_t dcp_hash_finalize(DCP_Type *base, dcp_hash_ctx_internal_t *ctxInternal) | /* Finalize the running hash to make digest.
This function empties the internal buffer, adds padding bits, and generates final digest. */
static status_t dcp_hash_finalize(DCP_Type *base, dcp_hash_ctx_internal_t *ctxInternal) | {
status_t status;
ctxInternal->ctrl0 |= (uint32_t)kDCP_CONTROL0_HASH_TERM;
status = dcp_hash_update(base, ctxInternal, &ctxInternal->blk.b[0], ctxInternal->blksz);
return status;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
/* Register the driver, console driver and ports with the serial core */ | static int __init pmz_register(void) | /* Register the driver, console driver and ports with the serial core */
static int __init pmz_register(void) | {
int i, rc;
pmz_uart_reg.nr = pmz_ports_count;
pmz_uart_reg.cons = PMACZILOG_CONSOLE;
rc = uart_register_driver(&pmz_uart_reg);
if (rc)
return rc;
for (i = 0; i < pmz_ports_count; i++) {
struct uart_pmac_port *uport = &pmz_ports[i];
if (uport->node != NULL)
rc = uart_add_one_port(&pmz_uart_reg, &uport->port);
if (rc)
goto err_out;
}
return 0;
err_out:
while (i-- > 0) {
struct uart_pmac_port *uport = &pmz_ports[i];
uart_remove_one_port(&pmz_uart_reg, &uport->port);
}
uart_unregister_driver(&pmz_uart_reg);
return rc;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Function for creating a message for writing to the CCCD. */ | static uint32_t cccd_configure(uint16_t conn_handle, uint16_t cccd_handle, bool enable) | /* Function for creating a message for writing to the CCCD. */
static uint32_t cccd_configure(uint16_t conn_handle, uint16_t cccd_handle, bool enable) | {
uint8_t buf[BLE_CCCD_VALUE_LEN];
buf[0] = enable ? BLE_GATT_HVX_NOTIFICATION : 0;
buf[1] = 0;
const ble_gattc_write_params_t write_params = {
.write_op = BLE_GATT_OP_WRITE_REQ,
.flags = BLE_GATT_EXEC_WRITE_FLAG_PREPARED_WRITE,
.handle = cccd_handle,
.offset = 0,
.len = sizeof(buf),
.p_value = buf
};
return sd_ble_gattc_write(conn_handle, &write_params);
} | labapart/polymcu | C++ | null | 201 |
/* This takes a lock forcibly and hands it to context. Should ONLY be used inside *_unlock to give lock to kernel before calling *_dma_schedule. */ | static int drm_lock_transfer(struct drm_lock_data *lock_data, unsigned int context) | /* This takes a lock forcibly and hands it to context. Should ONLY be used inside *_unlock to give lock to kernel before calling *_dma_schedule. */
static int drm_lock_transfer(struct drm_lock_data *lock_data, unsigned int context) | {
unsigned int old, new, prev;
volatile unsigned int *lock = &lock_data->hw_lock->lock;
lock_data->file_priv = NULL;
do {
old = *lock;
new = context | _DRM_LOCK_HELD;
prev = cmpxchg(lock, old, new);
} while (prev != old);
return 1;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This function handles USB OTG FS Wakeup IRQ Handler. */ | void OTG_FS_WKUP_IRQHandler(void) | /* This function handles USB OTG FS Wakeup IRQ Handler. */
void OTG_FS_WKUP_IRQHandler(void) | {
if((&hpcd)->Init.low_power_enable)
{
SCB->SCR &= (uint32_t)~((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk));
SystemClock_Config();
__HAL_PCD_UNGATE_PHYCLOCK((&hpcd));
}
__HAL_USB_OTG_FS_WAKEUP_EXTI_CLEAR_FLAG();
} | STMicroelectronics/STM32CubeF4 | C++ | Other | 789 |
/* Destination cache to speed up outgoing route lookup */ | static void __ip_vs_dst_set(struct ip_vs_dest *dest, u32 rtos, struct dst_entry *dst) | /* Destination cache to speed up outgoing route lookup */
static void __ip_vs_dst_set(struct ip_vs_dest *dest, u32 rtos, struct dst_entry *dst) | {
struct dst_entry *old_dst;
old_dst = dest->dst_cache;
dest->dst_cache = dst;
dest->dst_rtos = rtos;
dst_release(old_dst);
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Local variables: c-indent-level: 4 c-basic-offset: 4 tab-width: 8 End: */ | static void GCC_FMT_ATTR(2, 3) | /* Local variables: c-indent-level: 4 c-basic-offset: 4 tab-width: 8 End: */
static void GCC_FMT_ATTR(2, 3) | {
va_list ap;
va_start(ap, fmt);
monitor_vprintf((Monitor *)stream, fmt, ap);
va_end(ap);
return 0;
} | ve3wwg/teensy3_qemu | C | Other | 15 |
/* To compute the message digest of a chunk of bytes, declare an MD5Context structure, pass it to MD5Init, call MD5Update as needed on buffers full of bytes, and then call MD5Final, which will fill a supplied 16-byte array with the digest. */ | static void byteReverse(unsigned char *buf, unsigned longs) | /* To compute the message digest of a chunk of bytes, declare an MD5Context structure, pass it to MD5Init, call MD5Update as needed on buffers full of bytes, and then call MD5Final, which will fill a supplied 16-byte array with the digest. */
static void byteReverse(unsigned char *buf, unsigned longs) | {
uint32_t t;
do {
t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 |
((unsigned) buf[1] << 8 | buf[0]);
*(uint32_t *) buf = t;
buf += 4;
} while (--longs);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* The write routine is generic, it fills in a preallocated rbuffer to supply the data. */ | static ssize_t proc_write(struct file *file, const char __user *buffer, size_t len, loff_t *offset) | /* The write routine is generic, it fills in a preallocated rbuffer to supply the data. */
static ssize_t proc_write(struct file *file, const char __user *buffer, size_t len, loff_t *offset) | {
loff_t pos = *offset;
struct proc_data *priv = (struct proc_data*)file->private_data;
if (!priv->wbuffer)
return -EINVAL;
if (pos < 0)
return -EINVAL;
if (pos >= priv->maxwritelen)
return 0;
if (len > priv->maxwritelen - pos)
len = priv->maxwritelen - pos;
if (copy_from_user(priv->wbuffer + pos, buffer, len))
return -EFAULT;
if ( pos + len > priv->writelen )
priv->writelen = len + file->f_pos;
*offset = pos + len;
return len;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Request the DPM to setup the new power level. */ | USBPD_StatusTypeDef USBPD_DPM_SetupNewPower(uint8_t PortNum) | /* Request the DPM to setup the new power level. */
USBPD_StatusTypeDef USBPD_DPM_SetupNewPower(uint8_t PortNum) | {
USBPD_StatusTypeDef status;
uint8_t rdoposition, previous_rdoposition;
rdoposition = DPM_Ports[PortNum].DPM_RDOPosition;
previous_rdoposition = DPM_Ports[PortNum].DPM_RDOPositionPrevious;
if (rdoposition > 0)
{
status = USBPD_PWR_IF_SetProfile(PortNum, rdoposition-1, previous_rdoposition);
}
else
{
status = USBPD_PWR_IF_SetProfile(PortNum, 0, 0);
}
return status;
} | st-one/X-CUBE-USB-PD | C++ | null | 110 |
/* NOTE: there's no dissector here, just registration routines to set up the dissector table for the Cisco OUI. */ | void proto_register_cisco_oui(void) | /* NOTE: there's no dissector here, just registration routines to set up the dissector table for the Cisco OUI. */
void proto_register_cisco_oui(void) | {
static hf_register_info hf[] = {
{ &hf_llc_cisco_pid,
{ "PID", "llc.cisco_pid", FT_UINT16, BASE_HEX,
VALS(cisco_pid_vals), 0x0, "Protocol ID", HFILL }
}
};
llc_add_oui(OUI_CISCO, "llc.cisco_pid", "LLC Cisco OUI PID", hf, -1);
} | seemoo-lab/nexmon | C++ | GNU General Public License v3.0 | 2,330 |
/* Call a function (C or Lua). The function to be called is at *func. The arguments are on the stack, right after the function. When returns, all the results are on the stack, starting at the original function position. */ | void luaD_call(lua_State *L, StkId func, int nResults, int allowyield) | /* Call a function (C or Lua). The function to be called is at *func. The arguments are on the stack, right after the function. When returns, all the results are on the stack, starting at the original function position. */
void luaD_call(lua_State *L, StkId func, int nResults, int allowyield) | {
if (L->nCcalls == LUAI_MAXCCALLS)
luaG_runerror(L, "C stack overflow");
else if (L->nCcalls >= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS>>3)))
luaD_throw(L, LUA_ERRERR);
}
if (!allowyield) L->nny++;
if (!luaD_precall(L, func, nResults))
luaV_execute(L);
if (!allowyield) L->nny--;
L->nCcalls--;
} | opentx/opentx | C++ | GNU General Public License v2.0 | 2,025 |
/* Returns a pointer to the start of the value array of the node pointed to by the node header */ | static fs64 * befs_bt_valarray(befs_btree_node *node) | /* Returns a pointer to the start of the value array of the node pointed to by the node header */
static fs64 * befs_bt_valarray(befs_btree_node *node) | {
void *keylen_index_start = (void *) befs_bt_keylen_index(node);
size_t keylen_index_size = node->head.all_key_count * sizeof (fs16);
return (fs64 *) (keylen_index_start + keylen_index_size);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ | UINT16 EFIAPI PciOr16(IN UINTN Address, IN UINT16 OrData) | /* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI PciOr16(IN UINTN Address, IN UINT16 OrData) | {
return PciWrite16 (Address, (UINT16)(PciRead16 (Address) | OrData));
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Enables or disables the TIMx's Hall sensor interface. */ | void TIM_SelectHallSensor(TIM_TypeDef *TIMx, FunctionalState NewState) | /* Enables or disables the TIMx's Hall sensor interface. */
void TIM_SelectHallSensor(TIM_TypeDef *TIMx, FunctionalState NewState) | {
assert_param(IS_TIM_LIST6_PERIPH(TIMx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
TIMx->CR2 |= TIM_CR2_TI1S;
}
else
{
TIMx->CR2 &= (uint16_t)~((uint16_t)TIM_CR2_TI1S);
}
} | avem-labs/Avem | C++ | MIT License | 1,752 |
/* get the cycle number for group4 as soon as a charge-transfer sequence completes */ | uint16_t tsi_group4_cycle_get(void) | /* get the cycle number for group4 as soon as a charge-transfer sequence completes */
uint16_t tsi_group4_cycle_get(void) | {
return (uint16_t)TSI_G4CYCN;
} | liuxuming/trochili | C++ | Apache License 2.0 | 132 |
/* RETURNS: Resulting block_device on success, NULL on failure. */ | struct block_device* bdget_disk(struct gendisk *disk, int partno) | /* RETURNS: Resulting block_device on success, NULL on failure. */
struct block_device* bdget_disk(struct gendisk *disk, int partno) | {
struct hd_struct *part;
struct block_device *bdev = NULL;
part = disk_get_part(disk, partno);
if (part)
bdev = bdget(part_devt(part));
disk_put_part(part);
return bdev;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Determines whether the SSI transmitter is busy or not. */ | tBoolean SSIBusy(unsigned long ulBase) | /* Determines whether the SSI transmitter is busy or not. */
tBoolean SSIBusy(unsigned long ulBase) | {
ASSERT((ulBase == SSI0_BASE) || (ulBase == SSI1_BASE));
return((HWREG(ulBase + SSI_O_SR) & SSI_SR_BSY) ? true : false);
} | watterott/WebRadio | C++ | null | 71 |
/* Refer to EMMC Electrical Standard Spec 5.1 Section 6.4 for details. */ | EFI_STATUS EmmcPeimGetOcr(IN EMMC_PEIM_HC_SLOT *Slot, IN OUT UINT32 *Argument) | /* Refer to EMMC Electrical Standard Spec 5.1 Section 6.4 for details. */
EFI_STATUS EmmcPeimGetOcr(IN EMMC_PEIM_HC_SLOT *Slot, IN OUT UINT32 *Argument) | {
EMMC_COMMAND_BLOCK EmmcCmdBlk;
EMMC_STATUS_BLOCK EmmcStatusBlk;
EMMC_COMMAND_PACKET Packet;
EFI_STATUS Status;
ZeroMem (&EmmcCmdBlk, sizeof (EmmcCmdBlk));
ZeroMem (&EmmcStatusBlk, sizeof (EmmcStatusBlk));
ZeroMem (&Packet, sizeof (Packet));
Packet.EmmcCmdBlk = &EmmcCmdBlk;
Packet.EmmcStatusBlk = &EmmcStatusBlk;
Packet.Timeout = EMMC_TIMEOUT;
EmmcCmdBlk.CommandIndex = EMMC_SEND_OP_COND;
EmmcCmdBlk.CommandType = EmmcCommandTypeBcr;
EmmcCmdBlk.ResponseType = EmmcResponceTypeR3;
EmmcCmdBlk.CommandArgument = *Argument;
Status = EmmcPeimExecCmd (Slot, &Packet);
if (!EFI_ERROR (Status)) {
*Argument = EmmcStatusBlk.Resp0;
}
return Status;
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Find symbols before or equal addr and after addr - in the section sec. If we find two symbols with equal offset prefer one with a valid name. The ELF format may have a better way to detect what type of symbol it is, but this works for now. */ | static Elf_Sym* find_elf_symbol2(struct elf_info *elf, Elf_Addr addr, const char *sec) | /* Find symbols before or equal addr and after addr - in the section sec. If we find two symbols with equal offset prefer one with a valid name. The ELF format may have a better way to detect what type of symbol it is, but this works for now. */
static Elf_Sym* find_elf_symbol2(struct elf_info *elf, Elf_Addr addr, const char *sec) | {
Elf_Sym *sym;
Elf_Sym *near = NULL;
Elf_Addr distance = ~0;
for (sym = elf->symtab_start; sym < elf->symtab_stop; sym++) {
const char *symsec;
if (sym->st_shndx >= SHN_LORESERVE)
continue;
symsec = sec_name(elf, sym->st_shndx);
if (strcmp(symsec, sec) != 0)
continue;
if (!is_valid_name(elf, sym))
continue;
if (sym->st_value <= addr) {
if ((addr - sym->st_value) < distance) {
distance = addr - sym->st_value;
near = sym;
} else if ((addr - sym->st_value) == distance) {
near = sym;
}
}
}
return near;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Check whether this value represents an NEC data bit 0. */ | static bool nec_bit_zero_if(rmt_item32_t *item) | /* Check whether this value represents an NEC data bit 0. */
static bool nec_bit_zero_if(rmt_item32_t *item) | {
if((item->level0 == RMT_RX_ACTIVE_LEVEL && item->level1 != RMT_RX_ACTIVE_LEVEL)
&& nec_check_in_range(item->duration0, NEC_BIT_ZERO_HIGH_US, NEC_BIT_MARGIN)
&& nec_check_in_range(item->duration1, NEC_BIT_ZERO_LOW_US, NEC_BIT_MARGIN)) {
return true;
}
return false;
} | retro-esp32/RetroESP32 | C++ | Creative Commons Attribution Share Alike 4.0 International | 581 |
/* PCD MSP De-Initialization This function freeze the hardware resources used in this example. */ | void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd) | /* PCD MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd) | {
if(hpcd->Instance==USB_OTG_FS)
{
__HAL_RCC_USB_OTG_FS_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_11|GPIO_PIN_12);
HAL_NVIC_DisableIRQ(OTG_FS_IRQn);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enable/disable the FIFO mode of the specified SPI port.
The */ | void SPIFIFOModeSet(unsigned long ulBase, xtBoolean xtEnable, unsigned long ulInterval) | /* Enable/disable the FIFO mode of the specified SPI port.
The */
void SPIFIFOModeSet(unsigned long ulBase, xtBoolean xtEnable, unsigned long ulInterval) | {
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE) );
xASSERT((ulInterval == 0) ||((ulInterval >= 2) && (ulInterval <= 15)));
if (xtEnable)
{
xHWREG(ulBase + SPI_CNTRL) &= ~SPI_CNTRL_SP_CYCLE_M;
xHWREG(ulBase + SPI_CNTRL) |= (ulInterval << SPI_CNTRL_SP_CYCLE_S);
xHWREG(ulBase + SPI_CNTRL) |= SPI_CNTRL_FIFO;
}
else
{
xHWREG(ulBase + SPI_CNTRL) &= ~SPI_CNTRL_FIFO;
}
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* Per IrLMP 1.1, 4.3.3.2, strings are up to 256 chars - Jean II */ | struct ias_value* irias_new_string_value(char *string) | /* Per IrLMP 1.1, 4.3.3.2, strings are up to 256 chars - Jean II */
struct ias_value* irias_new_string_value(char *string) | {
struct ias_value *value;
value = kzalloc(sizeof(struct ias_value), GFP_ATOMIC);
if (value == NULL) {
IRDA_WARNING("%s: Unable to kmalloc!\n", __func__);
return NULL;
}
value->type = IAS_STRING;
value->charset = CS_ASCII;
value->t.string = kstrndup(string, IAS_MAX_STRING, GFP_ATOMIC);
if (!value->t.string) {
IRDA_WARNING("%s: Unable to kmalloc!\n", __func__);
kfree(value);
return NULL;
}
value->len = strlen(value->t.string);
return value;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Function for handling database discovery events.
This function is callback function to handle events from the database discovery module. Depending on the UUIDs that are discovered, this function should forward the events to their respective services. */ | static void db_disc_handler(ble_db_discovery_evt_t *p_evt) | /* Function for handling database discovery events.
This function is callback function to handle events from the database discovery module. Depending on the UUIDs that are discovered, this function should forward the events to their respective services. */
static void db_disc_handler(ble_db_discovery_evt_t *p_evt) | {
ble_hrs_on_db_disc_evt(&m_ble_hrs_c, p_evt);
ble_bas_on_db_disc_evt(&m_ble_bas_c, p_evt);
} | labapart/polymcu | C++ | null | 201 |
/* We're receiving Rx packet from the LMAC, and Rx ticket from the UMAC. To forward a target data packet upstream (i.e. to the kernel network stack), we must have received an Rx ticket that tells us we're allowed to release this packet (ticket action is IWM_RX_TICKET_RELEASE). The Rx ticket also indicates, among other things, where valid data actually starts in the Rx packet. */ | void iwm_rx_worker(struct work_struct *work) | /* We're receiving Rx packet from the LMAC, and Rx ticket from the UMAC. To forward a target data packet upstream (i.e. to the kernel network stack), we must have received an Rx ticket that tells us we're allowed to release this packet (ticket action is IWM_RX_TICKET_RELEASE). The Rx ticket also indicates, among other things, where valid data actually starts in the Rx packet. */
void iwm_rx_worker(struct work_struct *work) | {
struct iwm_priv *iwm;
struct iwm_rx_ticket_node *ticket, *next;
iwm = container_of(work, struct iwm_priv, rx_worker);
list_for_each_entry_safe(ticket, next, &iwm->rx_tickets, node) {
struct iwm_rx_packet *packet =
iwm_rx_packet_get(iwm, le16_to_cpu(ticket->ticket->id));
if (!packet) {
IWM_DBG_RX(iwm, DBG, "Skip rx_work: Wait for ticket %d "
"to be handled first\n",
le16_to_cpu(ticket->ticket->id));
return;
}
list_del(&ticket->node);
list_del(&packet->node);
iwm_rx_process_packet(iwm, packet, ticket);
}
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* (both clock/data low, clock high, data high while clock is high) */ | static void stop_cmd(struct ipath_devdata *dd) | /* (both clock/data low, clock high, data high while clock is high) */
static void stop_cmd(struct ipath_devdata *dd) | {
scl_out(dd, i2c_line_low);
sda_out(dd, i2c_line_low);
scl_out(dd, i2c_line_high);
sda_out(dd, i2c_line_high);
udelay(2);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Configures the TC to generate output events at the sample frequency.
Configures the TC in Frequency Generation mode, with an event output once each time the audio sample frequency period expires. */ | static void configure_tc(struct tc_module *tc_module) | /* Configures the TC to generate output events at the sample frequency.
Configures the TC in Frequency Generation mode, with an event output once each time the audio sample frequency period expires. */
static void configure_tc(struct tc_module *tc_module) | {
struct tc_config config;
tc_get_config_defaults(&config);
config.clock_source = GCLK_GENERATOR_0;
config.wave_generation = TC_WAVE_GENERATION_MATCH_FREQ;
tc_init(tc_module, TC3, &config);
struct tc_events events = { .generate_event_on_overflow = true };
tc_enable_events(tc_module, &events);
tc_set_top_value(tc_module,
system_gclk_gen_get_hz(GCLK_GENERATOR_0) / sample_rate);
tc_enable(tc_module);
} | memfault/zero-to-main | C++ | null | 200 |
/* Enables or disables the USART's one bit sampling method. */ | void USART_OneBitMethodCmd(USART_TypeDef *USARTx, FunctionalState NewState) | /* Enables or disables the USART's one bit sampling method. */
void USART_OneBitMethodCmd(USART_TypeDef *USARTx, FunctionalState NewState) | {
assert_param(IS_USART_ALL_PERIPH(USARTx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
USARTx->CR3 |= USART_CR3_ONEBIT;
}
else
{
USARTx->CR3 &= (uint32_t)~((uint32_t)USART_CR3_ONEBIT);
}
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Enable or disable the main counter in the HPET Timer. */ | VOID HpetEnable(IN BOOLEAN Enable) | /* Enable or disable the main counter in the HPET Timer. */
VOID HpetEnable(IN BOOLEAN Enable) | {
mHpetGeneralConfiguration.Bits.MainCounterEnable = Enable ? 1 : 0;
HpetWrite (HPET_GENERAL_CONFIGURATION_OFFSET, mHpetGeneralConfiguration.Uint64);
} | tianocore/edk2 | C++ | Other | 4,240 |
/* input/output open/close - protected by open_mutex in rawmidi.c */ | static int snd_msndmidi_input_open(struct snd_rawmidi_substream *substream) | /* input/output open/close - protected by open_mutex in rawmidi.c */
static int snd_msndmidi_input_open(struct snd_rawmidi_substream *substream) | {
struct snd_msndmidi *mpu;
snd_printdd("snd_msndmidi_input_open()\n");
mpu = substream->rmidi->private_data;
mpu->substream_input = substream;
snd_msnd_enable_irq(mpu->dev);
snd_msnd_send_dsp_cmd(mpu->dev, HDEX_MIDI_IN_START);
set_bit(MSNDMIDI_MODE_BIT_INPUT, &mpu->mode);
return 0;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* param pfd Which PFD clock to enable. param pfdFrac The PFD FRAC value. note It is recommended that PFD settings are kept between 12-35. */ | void CLOCK_InitUsb1Pfd(clock_pfd_t pfd, uint8_t pfdFrac) | /* param pfd Which PFD clock to enable. param pfdFrac The PFD FRAC value. note It is recommended that PFD settings are kept between 12-35. */
void CLOCK_InitUsb1Pfd(clock_pfd_t pfd, uint8_t pfdFrac) | {
uint32_t pfdIndex = (uint32_t)pfd;
uint32_t pfd480;
pfd480 = CCM_ANALOG->PFD_480 &
~((uint32_t)((uint32_t)CCM_ANALOG_PFD_480_PFD0_CLKGATE_MASK | (uint32_t)CCM_ANALOG_PFD_480_PFD0_FRAC_MASK)
<< (8UL * pfdIndex));
CCM_ANALOG->PFD_480 = pfd480 | ((uint32_t)CCM_ANALOG_PFD_480_PFD0_CLKGATE_MASK << (8UL * pfdIndex));
CCM_ANALOG->PFD_480 = pfd480 | (CCM_ANALOG_PFD_480_PFD0_FRAC(pfdFrac) << (8UL * pfdIndex));
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* Releases any memory currently being held by a memory mapping structure. */ | int dma_term_mem_map(DMA_MemMap_t *memMap) | /* Releases any memory currently being held by a memory mapping structure. */
int dma_term_mem_map(DMA_MemMap_t *memMap) | {
down(&memMap->lock);
up(&memMap->lock);
memset(memMap, 0, sizeof(*memMap));
return 0;
} | EmcraftSystems/linux-emcraft | C++ | Other | 266 |
/* Turn all segments on alpha characters in display off. */ | void SegmentLCD_AlphaNumberOff(void) | /* Turn all segments on alpha characters in display off. */
void SegmentLCD_AlphaNumberOff(void) | {
LCD_ALPHA_NUMBER_OFF();
return;
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. */ | VOID EFIAPI CpuFlushTlb(VOID) | /* Flushes all the Translation Lookaside Buffers(TLB) entries in a CPU. */
VOID EFIAPI CpuFlushTlb(VOID) | {
AsmWriteCr3 (AsmReadCr3 ());
} | tianocore/edk2 | C++ | Other | 4,240 |
/* Transmit interrupt vectors for a Z8530 that is in 'parked' mode. For machines with PCI Z85x30 cards, or level triggered interrupts (eg the MacII) we must clear the interrupt cause or die. */ | static void z8530_tx_clear(struct z8530_channel *c) | /* Transmit interrupt vectors for a Z8530 that is in 'parked' mode. For machines with PCI Z85x30 cards, or level triggered interrupts (eg the MacII) we must clear the interrupt cause or die. */
static void z8530_tx_clear(struct z8530_channel *c) | {
write_zsctrl(c, RES_Tx_P);
write_zsctrl(c, RES_H_IUS);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Disable the watch dog timer's function. This function is to disable the watch dog timer's function such as Interrupt reset. */ | void xWDTFunctionDisable(unsigned long ulBase, unsigned long ulFunction) | /* Disable the watch dog timer's function. This function is to disable the watch dog timer's function such as Interrupt reset. */
void xWDTFunctionDisable(unsigned long ulBase, unsigned long ulFunction) | {
(void) ulBase;
(void) ulFunction;
xASSERT(ulBase == xWDT_BASE);
xASSERT((ulFunction == xWDT_INT_FUNCTION) || (ulFunction == xWDT_RESET_FUNCTION));
xHWREG(WDT_BASE + WDT_MOD) = 0x00;
xHWREG(WDT_BASE + WDT_FEED) = (unsigned long) 0xAA;
xHWREG(WDT_BASE + WDT_FEED) = (unsigned long) 0x55;
} | coocox/cox | C++ | Berkeley Software Distribution (BSD) | 104 |
/* ADT7461 in "extended mode" operation uses unsigned integers offset by 64 (e.g., 0 -> -64 degC). The range is restricted to -64..191 degC. */ | static int temp_from_u8_adt7461(struct lm90_data *data, u8 val) | /* ADT7461 in "extended mode" operation uses unsigned integers offset by 64 (e.g., 0 -> -64 degC). The range is restricted to -64..191 degC. */
static int temp_from_u8_adt7461(struct lm90_data *data, u8 val) | {
if (data->flags & LM90_FLAG_ADT7461_EXT)
return (val - 64) * 1000;
else
return temp_from_s8(val);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* This API is used to get the awake Duration in the register 0x1C bit 6 and 7. */ | BMG160_RETURN_FUNCTION_TYPE bmg160_get_awake_durn(u8 *v_awake_durn_u8) | /* This API is used to get the awake Duration in the register 0x1C bit 6 and 7. */
BMG160_RETURN_FUNCTION_TYPE bmg160_get_awake_durn(u8 *v_awake_durn_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_TWO_ADDR_AWAKE_DURN__REG,
&v_data_u8, BMG160_GEN_READ_WRITE_DATA_LENGTH);
*v_awake_durn_u8 = BMG160_GET_BITSLICE(v_data_u8,
BMG160_INTR_TWO_ADDR_AWAKE_DURN);
}
return comres;
} | RT-Thread/rt-thread | C++ | Apache License 2.0 | 9,535 |
/* spider_net_enable_rxchtails sets the RX DMAC chain tail adresses in the chip by writing to the appropriate register. DMA is enabled in spider_net_enable_rxdmac. */ | static void spider_net_enable_rxchtails(struct spider_net_card *card) | /* spider_net_enable_rxchtails sets the RX DMAC chain tail adresses in the chip by writing to the appropriate register. DMA is enabled in spider_net_enable_rxdmac. */
static void spider_net_enable_rxchtails(struct spider_net_card *card) | {
spider_net_write_reg(card, SPIDER_NET_GDADCHA ,
card->rx_chain.tail->bus_addr);
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Write datastream header. This consists of an SOI and optional APPn markers. We recommend use of the JFIF marker, but not the Adobe marker, when using YCbCr or grayscale data. The JFIF marker should NOT be used for any other JPEG colorspace. The Adobe marker is helpful to distinguish RGB, CMYK, and YCCK colorspaces. Note that an application can write additional header markers after jpeg_start_compress returns. */ | write_file_header(j_compress_ptr cinfo) | /* Write datastream header. This consists of an SOI and optional APPn markers. We recommend use of the JFIF marker, but not the Adobe marker, when using YCbCr or grayscale data. The JFIF marker should NOT be used for any other JPEG colorspace. The Adobe marker is helpful to distinguish RGB, CMYK, and YCCK colorspaces. Note that an application can write additional header markers after jpeg_start_compress returns. */
write_file_header(j_compress_ptr cinfo) | {
my_marker_ptr marker = (my_marker_ptr)cinfo->marker;
emit_marker(cinfo, M_SOI);
marker->last_restart_interval = 0;
if (cinfo->write_JFIF_header)
emit_jfif_app0(cinfo);
if (cinfo->write_Adobe_marker)
emit_adobe_app14(cinfo);
} | nanoframework/nf-interpreter | C++ | MIT License | 293 |
/* Get hold of the chip and call nand_do_read */ | static int nand_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, uint8_t *buf) | /* Get hold of the chip and call nand_do_read */
static int nand_read(struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, uint8_t *buf) | {
struct nand_chip *chip = mtd->priv;
int ret;
if ((from + len) > mtd->size)
return -EINVAL;
if (!len)
return 0;
nand_get_device(chip, mtd, FL_READING);
chip->ops.len = len;
chip->ops.datbuf = buf;
chip->ops.oobbuf = NULL;
ret = nand_do_read_ops(mtd, from, &chip->ops);
*retlen = chip->ops.retlen;
nand_release_device(mtd);
return ret;
} | EmcraftSystems/u-boot | C++ | Other | 181 |
/* returns the address of the first occurrence of */ | void* memscan(void *addr, int c, size_t size) | /* returns the address of the first occurrence of */
void* memscan(void *addr, int c, size_t size) | {
unsigned char *p = addr;
while (size) {
if (*p == c)
return (void *)p;
p++;
size--;
}
return (void *)p;
} | robutest/uclinux | C++ | GPL-2.0 | 60 |
/* Event handler for the library USB Control Request reception event. */ | void EVENT_USB_Device_ControlRequest(void) | /* Event handler for the library USB Control Request reception event. */
void EVENT_USB_Device_ControlRequest(void) | {
Audio_Device_ProcessControlRequest(&Microphone_Audio_Interface);
} | prusa3d/Prusa-Firmware-Buddy | C++ | Other | 1,019 |
/* Stops the counter of a timer operating in basic time base mode. */ | void HRTIM_SimpleBaseStop(HRTIM_TypeDef *HRTIMx, uint32_t TimerIdx) | /* Stops the counter of a timer operating in basic time base mode. */
void HRTIM_SimpleBaseStop(HRTIM_TypeDef *HRTIMx, uint32_t TimerIdx) | {
assert_param(IS_HRTIM_TIMERINDEX(TimerIdx));
__HRTIM_DISABLE(HRTIMx, TimerIdxToTimerId[TimerIdx]);
} | remotemcu/remcu-chip-sdks | C++ | null | 436 |
/* Helper to get either ETH or STA if the other is provided Used when two interfaces are on the same subnet. */ | static tcpip_adapter_if_t _mdns_get_other_if(tcpip_adapter_if_t tcpip_if) | /* Helper to get either ETH or STA if the other is provided Used when two interfaces are on the same subnet. */
static tcpip_adapter_if_t _mdns_get_other_if(tcpip_adapter_if_t tcpip_if) | {
if (tcpip_if == TCPIP_ADAPTER_IF_STA) {
return TCPIP_ADAPTER_IF_ETH;
} else if (tcpip_if == TCPIP_ADAPTER_IF_ETH) {
return TCPIP_ADAPTER_IF_STA;
}
return TCPIP_ADAPTER_IF_MAX;
} | retro-esp32/RetroESP32 | C++ | Creative Commons Attribution Share Alike 4.0 International | 581 |
/* param base The LPI2C peripheral base address. param handle Pointer to the LPI2C slave driver handle. param callback User provided pointer to the asynchronous callback function. param userData User provided pointer to the application callback data. */ | void LPI2C_SlaveTransferCreateHandle(LPI2C_Type *base, lpi2c_slave_handle_t *handle, lpi2c_slave_transfer_callback_t callback, void *userData) | /* param base The LPI2C peripheral base address. param handle Pointer to the LPI2C slave driver handle. param callback User provided pointer to the asynchronous callback function. param userData User provided pointer to the application callback data. */
void LPI2C_SlaveTransferCreateHandle(LPI2C_Type *base, lpi2c_slave_handle_t *handle, lpi2c_slave_transfer_callback_t callback, void *userData) | {
uint32_t instance;
assert(NULL != handle);
(void)memset(handle, 0, sizeof(*handle));
instance = LPI2C_GetInstance(base);
handle->callback = callback;
handle->userData = userData;
s_lpi2cSlaveHandle[instance] = handle;
s_lpi2cSlaveIsr = LPI2C_SlaveTransferHandleIRQ;
LPI2C_SlaveDisableInterrupts(base, (uint32_t)kLPI2C_SlaveIrqFlags);
(void)EnableIRQ(kLpi2cIrqs[instance]);
base->STAR = LPI2C_STAR_TXNACK_MASK;
} | eclipse-threadx/getting-started | C++ | Other | 310 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.