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
|
|---|---|---|---|---|---|---|---|
/* Deinitializes all the resources used by the codec (those initialized by */
|
uint32_t EVAL_AUDIO_DeInit(void)
|
/* Deinitializes all the resources used by the codec (those initialized by */
uint32_t EVAL_AUDIO_DeInit(void)
|
{
Audio_MAL_DeInit();
Codec_DeInit();
return 0;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Valid help options are ]{?|h|help} with the h or help in any case combination */
|
int nsi_cmd_is_help_option(const char *arg)
|
/* Valid help options are ]{?|h|help} with the h or help in any case combination */
int nsi_cmd_is_help_option(const char *arg)
|
{
if (arg[0] == '-') {
arg++;
}
if (arg[0] == '-') {
arg++;
}
if ((strcasecmp(arg, "?") == 0) ||
(strcasecmp(arg, "h") == 0) ||
(strcasecmp(arg, "help") == 0)) {
return 1;
} else {
return 0;
}
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Check the status of the selected IO interrupt pending bit. */
|
uint32_t mfxstm32l152_IO_ITStatus(uint16_t DeviceAddr, uint32_t IO_Pin)
|
/* Check the status of the selected IO interrupt pending bit. */
uint32_t mfxstm32l152_IO_ITStatus(uint16_t DeviceAddr, uint32_t IO_Pin)
|
{
uint8_t tmp1 = 0;
uint16_t tmp2 = 0;
uint32_t tmp3 = 0;
if(IO_Pin & 0xFF)
{
tmp1 = MFX_IO_Read(DeviceAddr, MFXSTM32L152_REG_ADR_IRQ_GPI_PENDING1);
}
if(IO_Pin & 0xFFFF00)
{
tmp2 = (uint16_t) MFX_IO_Read(DeviceAddr, MFXSTM32L152_REG_ADR_IRQ_GPI_PENDING2);
}
if(IO_Pin & 0xFFFF0000)
{
tmp3 = (uint32_t) MFX_IO_Read(DeviceAddr, MFXSTM32L152_REG_ADR_IRQ_GPI_PENDING3);
}
tmp3 = tmp1 + (tmp2 << 8) + (tmp3 << 16);
return(tmp3 & IO_Pin);
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Check the status of the Rx buffer of the specified SPI port. */
|
xtBoolean SPIIsRxFull(unsigned long ulBase)
|
/* Check the status of the Rx buffer of the specified SPI port. */
xtBoolean SPIIsRxFull(unsigned long ulBase)
|
{
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE) );
return ((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_RX_FULL)? xtrue : xfalse);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Uses a critical section to determine if there is any data in a queue. */
|
static BaseType_t prvIsQueueEmpty(const Queue_t *pxQueue)
|
/* Uses a critical section to determine if there is any data in a queue. */
static BaseType_t prvIsQueueEmpty(const Queue_t *pxQueue)
|
{
BaseType_t xReturn;
taskENTER_CRITICAL();
{
if( pxQueue->uxMessagesWaiting == ( UBaseType_t ) 0 )
{
xReturn = pdTRUE;
}
else
{
xReturn = pdFALSE;
}
}
taskEXIT_CRITICAL();
return xReturn;
}
|
prusa3d/Prusa-Firmware-Buddy
|
C++
|
Other
| 1,019
|
/* USBH_AUDIO_Process The function is for managing state machine for Audio data transfers. */
|
static USBH_StatusTypeDef USBH_AUDIO_Process(USBH_HandleTypeDef *phost)
|
/* USBH_AUDIO_Process The function is for managing state machine for Audio data transfers. */
static USBH_StatusTypeDef USBH_AUDIO_Process(USBH_HandleTypeDef *phost)
|
{
USBH_StatusTypeDef status = USBH_BUSY;
AUDIO_HandleTypeDef *AUDIO_Handle = phost->pActiveClass->pData;
if(AUDIO_Handle->headphone.supported == 1)
{
USBH_AUDIO_OutputStream (phost);
}
if(AUDIO_Handle->microphone.supported == 1)
{
USBH_AUDIO_InputStream (phost);
}
return status;
}
|
micropython/micropython
|
C++
|
Other
| 18,334
|
/* To check if the CipherSuite is in supported CipherSuite list. */
|
BOOLEAN WifiMgrSupportCipherSuite(IN UINT16 SupportedCipherSuiteCount, IN UINT32 *SupportedCipherSuiteList, IN UINT32 *CipherSuite)
|
/* To check if the CipherSuite is in supported CipherSuite list. */
BOOLEAN WifiMgrSupportCipherSuite(IN UINT16 SupportedCipherSuiteCount, IN UINT32 *SupportedCipherSuiteList, IN UINT32 *CipherSuite)
|
{
UINT16 Index;
if ((CipherSuite == NULL) || (SupportedCipherSuiteCount == 0) ||
(SupportedCipherSuiteList == NULL))
{
return FALSE;
}
for (Index = 0; Index < SupportedCipherSuiteCount; Index++) {
if (SupportedCipherSuiteList[Index] == *CipherSuite) {
return TRUE;
}
}
return FALSE;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* If 32-bit I/O port operations are not supported, then ASSERT(). If Port is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
|
UINT32 EFIAPI IoBitFieldAnd32(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 AndData)
|
/* If 32-bit I/O port operations are not supported, then ASSERT(). If Port is not aligned on a 32-bit boundary, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT32 EFIAPI IoBitFieldAnd32(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 AndData)
|
{
return IoWrite32 (
Port,
BitFieldAnd32 (IoRead32 (Port), StartBit, EndBit, AndData)
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Quiet time is the time after the first detected tap in which there must not be any over threshold event. The default value of these bits is 00b which corresponds to 2*ODR_XL time. If the QUIET bits are set to a different value, 1LSB corresponds to 4*ODR_XL time.. */
|
int32_t lsm6dso_tap_quiet_get(lsm6dso_ctx_t *ctx, uint8_t *val)
|
/* Quiet time is the time after the first detected tap in which there must not be any over threshold event. The default value of these bits is 00b which corresponds to 2*ODR_XL time. If the QUIET bits are set to a different value, 1LSB corresponds to 4*ODR_XL time.. */
int32_t lsm6dso_tap_quiet_get(lsm6dso_ctx_t *ctx, uint8_t *val)
|
{
lsm6dso_int_dur2_t reg;
int32_t ret;
ret = lsm6dso_read_reg(ctx, LSM6DSO_INT_DUR2, (uint8_t*)®, 1);
*val = reg.quiet;
return ret;
}
|
alexander-g-dean/ESF
|
C++
| null | 41
|
/* USBD_CtlSendStatus send zero lzngth packet on the ctl pipe. */
|
USBD_Status USBD_CtlSendStatus(USB_OTG_CORE_HANDLE *pdev)
|
/* USBD_CtlSendStatus send zero lzngth packet on the ctl pipe. */
USBD_Status USBD_CtlSendStatus(USB_OTG_CORE_HANDLE *pdev)
|
{
USBD_Status ret = USBD_OK;
pdev->dev.device_state = USB_OTG_EP0_STATUS_IN;
DCD_EP_Tx (pdev,
0,
NULL,
0);
USB_OTG_EP0_OutStart(pdev);
return ret;
}
|
MaJerle/stm32f429
|
C++
| null | 2,036
|
/* This API call performs several different functions; these are described below. The functions are handle-specific unless otherwise noted; this means that they affect only the handle you pass to canIoCtl(), whereas other open handles will remain unaffected. The contents of buf after the call is dependent on the function code you specified. */
|
static canStatus LeafLightLibFuncIoCtl(const CanHandle hnd, uint32_t func, void *buf, uint32_t buflen)
|
/* This API call performs several different functions; these are described below. The functions are handle-specific unless otherwise noted; this means that they affect only the handle you pass to canIoCtl(), whereas other open handles will remain unaffected. The contents of buf after the call is dependent on the function code you specified. */
static canStatus LeafLightLibFuncIoCtl(const CanHandle hnd, uint32_t func, void *buf, uint32_t buflen)
|
{
canStatus result = canERR_NOTINITIALIZED;
assert(leafLightLibFuncIoCtlPtr != NULL);
assert(leafLightDllHandle != NULL);
if ((leafLightLibFuncIoCtlPtr != NULL) && (leafLightDllHandle != NULL))
{
result = leafLightLibFuncIoCtlPtr(hnd, func, buf, buflen);
}
return result;
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* The RESUME_RPI mailbox command is used to restart I/O to an RPI after a link event. */
|
void lpfc_resume_rpi(struct lpfcMboxq *mbox, struct lpfc_nodelist *ndlp)
|
/* The RESUME_RPI mailbox command is used to restart I/O to an RPI after a link event. */
void lpfc_resume_rpi(struct lpfcMboxq *mbox, struct lpfc_nodelist *ndlp)
|
{
struct lpfc_mbx_resume_rpi *resume_rpi;
memset(mbox, 0, sizeof(*mbox));
resume_rpi = &mbox->u.mqe.un.resume_rpi;
bf_set(lpfc_mqe_command, &mbox->u.mqe, MBX_RESUME_RPI);
bf_set(lpfc_resume_rpi_index, resume_rpi, ndlp->nlp_rpi);
bf_set(lpfc_resume_rpi_ii, resume_rpi, RESUME_INDEX_RPI);
resume_rpi->event_tag = ndlp->phba->fc_eventTag;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* set or clear transmit break condition break_state -1=set break condition, 0=clear */
|
static int set_break(struct tty_struct *tty, int break_state)
|
/* set or clear transmit break condition break_state -1=set break condition, 0=clear */
static int set_break(struct tty_struct *tty, int break_state)
|
{
struct slgt_info *info = tty->driver_data;
unsigned short value;
unsigned long flags;
if (sanity_check(info, tty->name, "set_break"))
return -EINVAL;
DBGINFO(("%s set_break(%d)\n", info->device_name, break_state));
spin_lock_irqsave(&info->lock,flags);
value = rd_reg16(info, TCR);
if (break_state == -1)
value |= BIT6;
else
value &= ~BIT6;
wr_reg16(info, TCR, value);
spin_unlock_irqrestore(&info->lock,flags);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* The LED timer callback function. This does nothing but switch off the LED defined by the mainTIMER_CONTROLLED_LED constant. */
|
static void vLEDTimerCallback(xTimerHandle xTimer)
|
/* The LED timer callback function. This does nothing but switch off the LED defined by the mainTIMER_CONTROLLED_LED constant. */
static void vLEDTimerCallback(xTimerHandle xTimer)
|
{
ucGPIOState &= ~mainTIMER_CONTROLLED_LED;
XGpio_DiscreteWrite( &xOutputGPIOInstance, ulGPIOOutputChannel, ucGPIOState );
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* config_group_init - initialize a group for use @k: group */
|
void config_group_init(struct config_group *group)
|
/* config_group_init - initialize a group for use @k: group */
void config_group_init(struct config_group *group)
|
{
config_item_init(&group->cg_item);
INIT_LIST_HEAD(&group->cg_children);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function also performs validation of the ACPI table fields. */
|
VOID EFIAPI ParseAcpiMcfg(IN BOOLEAN Trace, IN UINT8 *Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision)
|
/* This function also performs validation of the ACPI table fields. */
VOID EFIAPI ParseAcpiMcfg(IN BOOLEAN Trace, IN UINT8 *Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision)
|
{
UINT32 Offset;
UINT32 PciCfgOffset;
UINT8 *PciCfgSpacePtr;
if (!Trace) {
return;
}
Offset = ParseAcpi (
TRUE,
0,
"MCFG",
Ptr,
AcpiTableLength,
PARSER_PARAMS (McfgParser)
);
PciCfgSpacePtr = Ptr + Offset;
while (Offset < AcpiTableLength) {
PciCfgOffset = ParseAcpi (
TRUE,
2,
"PCI Configuration Space",
PciCfgSpacePtr,
(AcpiTableLength - Offset),
PARSER_PARAMS (PciCfgSpaceBaseAddrParser)
);
PciCfgSpacePtr += PciCfgOffset;
Offset += PciCfgOffset;
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Call PnP BIOS with function 0x41, "get ESCD info" */
|
static int __pnp_bios_escd_info(struct escd_info_struc *data)
|
/* Call PnP BIOS with function 0x41, "get ESCD info" */
static int __pnp_bios_escd_info(struct escd_info_struc *data)
|
{
u16 status;
if (!pnp_bios_present())
return ESCD_FUNCTION_NOT_SUPPORTED;
status = call_pnp_bios(PNP_GET_ESCD_INFO, 0, PNP_TS1, 2, PNP_TS1, 4,
PNP_TS1, PNP_DS, data,
sizeof(struct escd_info_struc), NULL, 0);
return status;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns the new list with the new statement prepended, or NULL in case of an error. */
|
CRStatement* cr_statement_prepend(CRStatement *a_this, CRStatement *a_new)
|
/* Returns the new list with the new statement prepended, or NULL in case of an error. */
CRStatement* cr_statement_prepend(CRStatement *a_this, CRStatement *a_new)
|
{
CRStatement *cur = NULL;
g_return_val_if_fail (a_new, NULL);
if (!a_this)
return a_new;
a_new->next = a_this;
a_this->prev = a_new;
for (cur = a_new; cur && cur->prev; cur = cur->prev) ;
return cur;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Check to see if the pool at the given address should be guarded or not. */
|
BOOLEAN IsPoolTypeToGuard(IN EFI_MEMORY_TYPE MemoryType)
|
/* Check to see if the pool at the given address should be guarded or not. */
BOOLEAN IsPoolTypeToGuard(IN EFI_MEMORY_TYPE MemoryType)
|
{
return IsMemoryTypeToGuard (
MemoryType,
AllocateAnyPages,
GUARD_HEAP_TYPE_POOL
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Get the I2C interrupt flag of the specified I2C port.
The */
|
unsigned long xI2CMasterIntFlagGet(unsigned long ulBase)
|
/* Get the I2C interrupt flag of the specified I2C port.
The */
unsigned long xI2CMasterIntFlagGet(unsigned long ulBase)
|
{
xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE));
return ((xHWREG(ulBase + I2C_CON) & I2C_CON_SI) ? xtrue : xfalse);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Configure and make an endpoint ready for use. This is called in the context of udc_ep_enable() or udc_ep_enable_internal(), the latter of which may be used by the driver to enable control endpoints. */
|
static int udc_skeleton_ep_enable(const struct device *dev, struct udc_ep_config *const cfg)
|
/* Configure and make an endpoint ready for use. This is called in the context of udc_ep_enable() or udc_ep_enable_internal(), the latter of which may be used by the driver to enable control endpoints. */
static int udc_skeleton_ep_enable(const struct device *dev, struct udc_ep_config *const cfg)
|
{
LOG_DBG("Enable ep 0x%02x", cfg->addr);
return 0;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Returns 0 if the device function can be reset or negative if the device doesn't support resetting a single function. */
|
int pci_probe_reset_function(struct pci_dev *dev)
|
/* Returns 0 if the device function can be reset or negative if the device doesn't support resetting a single function. */
int pci_probe_reset_function(struct pci_dev *dev)
|
{
return pci_dev_reset(dev, 1);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function can't be called from inside one of the #GMarkupParser functions or while a subparser is pushed. */
|
void g_markup_parse_context_free(GMarkupParseContext *context)
|
/* This function can't be called from inside one of the #GMarkupParser functions or while a subparser is pushed. */
void g_markup_parse_context_free(GMarkupParseContext *context)
|
{
g_return_if_fail (context != NULL);
g_return_if_fail (!context->parsing);
g_return_if_fail (!context->subparser_stack);
g_return_if_fail (!context->awaiting_pop);
if (context->dnotify)
(* context->dnotify) (context->user_data);
clear_attributes (context);
g_free (context->attr_names);
g_free (context->attr_values);
g_slist_free_full (context->tag_stack_gstr, string_full_free);
g_slist_free (context->tag_stack);
g_slist_free_full (context->spare_chunks, string_full_free);
g_slist_free (context->spare_list_nodes);
if (context->partial_chunk)
g_string_free (context->partial_chunk, TRUE);
g_free (context);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* get the highest address of the multi-segment block. */
|
static unsigned long dcssblk_find_highest_addr(struct dcssblk_dev_info *dev_info)
|
/* get the highest address of the multi-segment block. */
static unsigned long dcssblk_find_highest_addr(struct dcssblk_dev_info *dev_info)
|
{
unsigned long highest_addr;
struct segment_info *entry;
highest_addr = 0;
list_for_each_entry(entry, &dev_info->seg_list, lh) {
if (highest_addr < entry->end)
highest_addr = entry->end;
}
return highest_addr;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Initialises the iir_u16_t instance.
8-bit Alpha Float equivalent */
|
void iir_u16_init(iir_u16_t *iir, uint8_t alpha)
|
/* Initialises the iir_u16_t instance.
8-bit Alpha Float equivalent */
void iir_u16_init(iir_u16_t *iir, uint8_t alpha)
|
{
iir->k = 0;
iir->alpha = alpha;
iir->avg = 0;
}
|
microbuilder/LPC11U_LPC13U_CodeBase
|
C++
|
Other
| 54
|
/* Wait up to 1s for mask to be clear in given reg. */
|
static void await_bits_clear(u32 *reg, u32 mask)
|
/* Wait up to 1s for mask to be clear in given reg. */
static void await_bits_clear(u32 *reg, u32 mask)
|
{
mctl_await_completion(reg, mask, 0);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* We need the AIL lock in order to get a coherent read of the lsn of the last item in the AIL. */
|
xfs_lsn_t xfs_trans_ail_tail(struct xfs_ail *ailp)
|
/* We need the AIL lock in order to get a coherent read of the lsn of the last item in the AIL. */
xfs_lsn_t xfs_trans_ail_tail(struct xfs_ail *ailp)
|
{
xfs_lsn_t lsn;
xfs_log_item_t *lip;
spin_lock(&ailp->xa_lock);
lip = xfs_ail_min(ailp);
if (lip == NULL) {
lsn = (xfs_lsn_t)0;
} else {
lsn = lip->li_lsn;
}
spin_unlock(&ailp->xa_lock);
return lsn;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Causes a processor trigger for a sample sequence. */
|
void ADCProcessorTrigger(unsigned long ulBase, unsigned long ulSequenceNum)
|
/* Causes a processor trigger for a sample sequence. */
void ADCProcessorTrigger(unsigned long ulBase, unsigned long ulSequenceNum)
|
{
ASSERT((ulBase == ADC0_BASE) || (ulBase == ADC1_BASE));
ASSERT((ulSequenceNum & 0xf) < 4);
HWREG(ulBase + ADC_O_PSSI) |= ((ulSequenceNum & 0xffff0000) |
(1 << (ulSequenceNum & 0xf)));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Set default class of the htb qdisc to the specified value */
|
void rtnl_htb_set_defcls(struct rtnl_qdisc *qdisc, uint32_t defcls)
|
/* Set default class of the htb qdisc to the specified value */
void rtnl_htb_set_defcls(struct rtnl_qdisc *qdisc, uint32_t defcls)
|
{
struct rtnl_htb_qdisc *d = htb_qdisc(qdisc);
if (d == NULL)
return;
d->qh_defcls = defcls;
d->qh_mask |= SCH_HTB_HAS_DEFCLS;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* result: address where the result will be written returns: 0 on success -1 on fail; */
|
int16_t getTemp(int32_t *result)
|
/* result: address where the result will be written returns: 0 on success -1 on fail; */
int16_t getTemp(int32_t *result)
|
{
uint8_t buffer[3] = { 0 };
int16_t i = readBlock(DPS310__REG_ADR_TEMP, DPS310__REG_LEN_TEMP, buffer);
if (i != DPS310__REG_LEN_TEMP) {
return DPS310__FAIL_UNKNOWN;
}
int32_t temp = (uint32_t)buffer[0] << 16 | (uint32_t)buffer[1] << 8 |
(uint32_t)buffer[2];
if (temp & ((uint32_t)1 << 23)) {
temp -= (uint32_t)1 << 24;
}
*result = calcTemp(temp);
return DPS310__SUCCEEDED;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* This code is common to create, mkdir, and mknod. */
|
static int ncp_instantiate(struct inode *dir, struct dentry *dentry, struct ncp_entry_info *finfo)
|
/* This code is common to create, mkdir, and mknod. */
static int ncp_instantiate(struct inode *dir, struct dentry *dentry, struct ncp_entry_info *finfo)
|
{
struct inode *inode;
int error = -EINVAL;
finfo->ino = iunique(dir->i_sb, 2);
inode = ncp_iget(dir->i_sb, finfo);
if (!inode)
goto out_close;
d_instantiate(dentry,inode);
error = 0;
out:
return error;
out_close:
PPRINTK("ncp_instantiate: %s/%s failed, closing file\n",
dentry->d_parent->d_name.name, dentry->d_name.name);
ncp_close_file(NCP_SERVER(dir), finfo->file_handle);
goto out;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function will fill a formatted string to buffer */
|
rt_int32_t rt_sprintf(char *buf, const char *format,...)
|
/* This function will fill a formatted string to buffer */
rt_int32_t rt_sprintf(char *buf, const char *format,...)
|
{
rt_int32_t n;
va_list arg_ptr;
va_start(arg_ptr, format);
n = rt_vsprintf(buf ,format, arg_ptr);
va_end(arg_ptr);
return n;
}
|
armink/FreeModbus_Slave-Master-RTT-STM32
|
C++
|
Other
| 1,477
|
/* Prepare to and run C code.
This routine prepares for the execution of and runs C code. */
|
void z_prep_c(void)
|
/* Prepare to and run C code.
This routine prepares for the execution of and runs C code. */
void z_prep_c(void)
|
{
z_data_copy();
z_cstart();
CODE_UNREACHABLE;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Read the initial_length field of the entry and store the size of the entry in @len. We return the number of bytes read. Return a count of 0 on error. */
|
static int dwarf_entry_len(char *addr, unsigned long *len)
|
/* Read the initial_length field of the entry and store the size of the entry in @len. We return the number of bytes read. Return a count of 0 on error. */
static int dwarf_entry_len(char *addr, unsigned long *len)
|
{
u32 initial_len;
int count;
initial_len = get_unaligned((u32 *)addr);
count = 4;
if (initial_len >= DW_EXT_LO && initial_len <= DW_EXT_HI) {
if (initial_len == DW_EXT_DWARF64) {
*len = get_unaligned((u64 *)addr + 4);
count = 12;
} else {
printk(KERN_WARNING "Unknown DWARF extension\n");
count = 0;
}
} else
*len = initial_len;
return count;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Configures the number of bytes to be transmitted/received. */
|
void I2C_ConfigNumberOfBytes(I2C_T *i2c, uint8_t number)
|
/* Configures the number of bytes to be transmitted/received. */
void I2C_ConfigNumberOfBytes(I2C_T *i2c, uint8_t number)
|
{
i2c->CTRL2_B.NUMBYT = 0xFF;
i2c->CTRL2_B.NUMBYT &= (uint8_t) number ;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* audit_string_contains_control - does a string need to be logged in hex @string: string to be checked @len: max length of the string to check */
|
int audit_string_contains_control(const char *string, size_t len)
|
/* audit_string_contains_control - does a string need to be logged in hex @string: string to be checked @len: max length of the string to check */
int audit_string_contains_control(const char *string, size_t len)
|
{
const unsigned char *p;
for (p = string; p < (const unsigned char *)string + len; p++) {
if (*p == '"' || *p < 0x21 || *p > 0x7e)
return 1;
}
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* It looks like there is no input interrupts in the UART mode. Let's try polling. */
|
static void poll_uart6850(unsigned long dummy)
|
/* It looks like there is no input interrupts in the UART mode. Let's try polling. */
static void poll_uart6850(unsigned long dummy)
|
{
unsigned long flags;
if (!(uart6850_opened & OPEN_READ))
return;
spin_lock_irqsave(&lock,flags);
if (input_avail())
uart6850_input_loop();
uart6850_timer.expires = 1 + jiffies;
add_timer(&uart6850_timer);
spin_unlock_irqrestore(&lock,flags);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Helper function for calculating accelerometer ranges. Considers the current full-scale register config (i.e. +/-2g, +/-4g, etc...) */
|
static void icm42688_emul_get_accel_ranges(const struct emul *target, q31_t *lower, q31_t *upper, q31_t *epsilon, int8_t *shift)
|
/* Helper function for calculating accelerometer ranges. Considers the current full-scale register config (i.e. +/-2g, +/-4g, etc...) */
static void icm42688_emul_get_accel_ranges(const struct emul *target, q31_t *lower, q31_t *upper, q31_t *epsilon, int8_t *shift)
|
{
int fs_g;
int sensitivity;
icm42688_emul_get_accel_settings(target, &fs_g, &sensitivity, shift);
*epsilon = (3 * SENSOR_G * Q31_SCALE / sensitivity / 1000000LL / 2) >> *shift;
*upper = (fs_g * SENSOR_G * Q31_SCALE / 1000000LL) >> *shift;
*lower = -*upper;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Get EC point affine (x,y) coordinates. This function will set the provided Big Number objects to the corresponding values. The caller needs to make sure all the "out" BigNumber parameters are properly initialized. */
|
BOOLEAN EFIAPI CryptoServiceEcPointGetAffineCoordinates(IN CONST VOID *EcGroup, IN CONST VOID *EcPoint, OUT VOID *BnX, OUT VOID *BnY, IN VOID *BnCtx)
|
/* Get EC point affine (x,y) coordinates. This function will set the provided Big Number objects to the corresponding values. The caller needs to make sure all the "out" BigNumber parameters are properly initialized. */
BOOLEAN EFIAPI CryptoServiceEcPointGetAffineCoordinates(IN CONST VOID *EcGroup, IN CONST VOID *EcPoint, OUT VOID *BnX, OUT VOID *BnY, IN VOID *BnCtx)
|
{
return CALL_BASECRYPTLIB (Ec.Services.PointGetAffineCoordinates, EcPointGetAffineCoordinates, (EcGroup, EcPoint, BnX, BnY, BnCtx), FALSE);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Internal worker function that sets that active periodic SMI handler based on the DispatchHandle that was returned when the periodic SMI handler was enabled with */
|
PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT* SetActivePeriodicSmiLibraryHandler(IN EFI_HANDLE DispatchHandle OPTIONAL)
|
/* Internal worker function that sets that active periodic SMI handler based on the DispatchHandle that was returned when the periodic SMI handler was enabled with */
PERIODIC_SMI_LIBRARY_HANDLER_CONTEXT* SetActivePeriodicSmiLibraryHandler(IN EFI_HANDLE DispatchHandle OPTIONAL)
|
{
if (DispatchHandle == NULL) {
gActivePeriodicSmiLibraryHandler = NULL;
} else {
gActivePeriodicSmiLibraryHandler = LookupPeriodicSmiLibraryHandler (DispatchHandle);
}
return gActivePeriodicSmiLibraryHandler;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This API gets the Aux Mag write address from the sensor. Mag write address is where the Mag data will be written. */
|
uint16_t bma4_get_mag_write_addr(uint8_t *mag_write_addr, struct bma4_dev *dev)
|
/* This API gets the Aux Mag write address from the sensor. Mag write address is where the Mag data will be written. */
uint16_t bma4_get_mag_write_addr(uint8_t *mag_write_addr, struct bma4_dev *dev)
|
{
uint16_t rslt = 0;
uint8_t data = 0;
if (dev == NULL) {
rslt |= BMA4_E_NULL_PTR;
} else {
rslt |= bma4_read_regs(BMA4_AUX_WR_ADDR, &data, 1, dev);
if (rslt == BMA4_OK)
*mag_write_addr = BMA4_GET_BITS_POS_0(data, BMA4_WRITE_ADDR);
}
return rslt;
}
|
arendst/Tasmota
|
C++
|
GNU General Public License v3.0
| 21,318
|
/* Locking: the state_lock of the mpath structure must NOT be held when calling this function. */
|
void mesh_path_tx_pending(struct mesh_path *mpath)
|
/* Locking: the state_lock of the mpath structure must NOT be held when calling this function. */
void mesh_path_tx_pending(struct mesh_path *mpath)
|
{
if (mpath->flags & MESH_PATH_ACTIVE)
ieee80211_add_pending_skbs(mpath->sdata->local,
&mpath->frame_queue);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* adjust RTC second or subsecond value of current time */
|
ErrStatus rtc_second_adjust(uint32_t add, uint32_t minus)
|
/* adjust RTC second or subsecond value of current time */
ErrStatus rtc_second_adjust(uint32_t add, uint32_t minus)
|
{
volatile uint32_t time_index = RTC_SHIFTCTL_TIMEOUT;
ErrStatus error_status = ERROR;
uint32_t flag_status = RESET;
uint32_t temp = 0U;
RTC_WPK = RTC_UNLOCK_KEY1;
RTC_WPK = RTC_UNLOCK_KEY2;
do {
flag_status = RTC_STAT & RTC_STAT_SOPF;
} while((--time_index > 0U) && ((uint32_t)RESET != flag_status));
temp = RTC_CTL & RTC_CTL_REFEN;
if((RESET == flag_status) && (RESET == temp)) {
RTC_SHIFTCTL = (uint32_t)(add | SHIFTCTL_SFS(minus));
error_status = rtc_register_sync_wait();
}
RTC_WPK = RTC_LOCK_KEY;
return error_status;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Get the number of multi-dimensional axis controls on a joystick */
|
int SDL_JoystickNumAxes(SDL_Joystick *joystick)
|
/* Get the number of multi-dimensional axis controls on a joystick */
int SDL_JoystickNumAxes(SDL_Joystick *joystick)
|
{
if (!SDL_PrivateJoystickValid(joystick)) {
return -1;
}
return joystick->naxes;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Displays the code value as a character, not its ASCII value, as would be done by BASE_DEC and friends. */
|
static void format_reference_price_type(char *buf, guint32 value)
|
/* Displays the code value as a character, not its ASCII value, as would be done by BASE_DEC and friends. */
static void format_reference_price_type(char *buf, guint32 value)
|
{
g_snprintf(buf, ITEM_LABEL_LENGTH,
"%s (%c)",
val_to_str_const(value,
ouch_reference_price_type_val,
"Unknown"),
value);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* offset(s, n, ) -> index where n-th character counting from position 'i' starts; 0 means character at 'i'. */
|
static int byteoffset(lua_State *L)
|
/* offset(s, n, ) -> index where n-th character counting from position 'i' starts; 0 means character at 'i'. */
static int byteoffset(lua_State *L)
|
{
while (posi > 0 && iscont(s + posi)) posi--;
}
else {
if (iscont(s + posi))
return luaL_error(L, "initial position is a continuation byte");
if (n < 0) {
while (n < 0 && posi > 0) {
do {
posi--;
} while (posi > 0 && iscont(s + posi));
n++;
}
}
else {
n--;
while (n > 0 && posi < (lua_Integer)len) {
do {
posi++;
} while (iscont(s + posi));
n--;
}
}
}
if (n == 0)
lua_pushinteger(L, posi + 1);
else
lua_pushnil(L);
return 1;
}
|
nodemcu/nodemcu-firmware
|
C++
|
MIT License
| 7,566
|
/* tree_destroy - destroy an RB-tree. @ubi: UBI device description object @root: the root of the tree to destroy */
|
static void tree_destroy(struct ubi_device *ubi, struct rb_root *root)
|
/* tree_destroy - destroy an RB-tree. @ubi: UBI device description object @root: the root of the tree to destroy */
static void tree_destroy(struct ubi_device *ubi, struct rb_root *root)
|
{
struct rb_node *rb;
struct ubi_wl_entry *e;
rb = root->rb_node;
while (rb) {
if (rb->rb_left)
rb = rb->rb_left;
else if (rb->rb_right)
rb = rb->rb_right;
else {
e = rb_entry(rb, struct ubi_wl_entry, u.rb);
rb = rb_parent(rb);
if (rb) {
if (rb->rb_left == &e->u.rb)
rb->rb_left = NULL;
else
rb->rb_right = NULL;
}
wl_entry_destroy(ubi, e);
}
}
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Count and return the number of bits set to '1' in the given hamming code. */
|
static uint32_t count_bits_in_code256(uint8_t *code)
|
/* Count and return the number of bits set to '1' in the given hamming code. */
static uint32_t count_bits_in_code256(uint8_t *code)
|
{
return count_bits_in_byte(code[0]) + count_bits_in_byte(code[1]) +
count_bits_in_byte(code[2]);
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* If Sha256Context is NULL, then return FALSE. If NewSha256Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
|
BOOLEAN EFIAPI Sha256Duplicate(IN CONST VOID *Sha256Context, OUT VOID *NewSha256Context)
|
/* If Sha256Context is NULL, then return FALSE. If NewSha256Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI Sha256Duplicate(IN CONST VOID *Sha256Context, OUT VOID *NewSha256Context)
|
{
CALL_CRYPTO_SERVICE (Sha256Duplicate, (Sha256Context, NewSha256Context), FALSE);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* libc/string/memscan.c Find a character in an area of memory */
|
void* memscan(void *addr, int c, size_t size)
|
/* libc/string/memscan.c Find a character in an area of memory */
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;
}
|
xboot/xboot
|
C++
|
MIT License
| 779
|
/* On SMP it's slightly faster (but much more power-consuming!) to poll the ->work.need_resched flag instead of waiting for the cross-CPU IPI to arrive. Use this option with caution. */
|
static void poll_idle(void)
|
/* On SMP it's slightly faster (but much more power-consuming!) to poll the ->work.need_resched flag instead of waiting for the cross-CPU IPI to arrive. Use this option with caution. */
static void poll_idle(void)
|
{
local_irq_enable();
while (!need_resched())
cpu_relax();
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* internal function, which does common work of the device wake up process: */
|
static void __ll_do_awake(struct ll_struct *ll)
|
/* internal function, which does common work of the device wake up process: */
static void __ll_do_awake(struct ll_struct *ll)
|
{
struct sk_buff *skb = NULL;
while ((skb = skb_dequeue(&ll->tx_wait_q)))
skb_queue_tail(&ll->txq, skb);
ll->hcill_state = HCILL_AWAKE;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function swaps the bytes in a 64-bit unsigned value to switch the value from little endian to big endian or vice versa. The byte swapped value is returned. */
|
UINT64 EFIAPI InternalMathSwapBytes64(IN UINT64 Operand)
|
/* This function swaps the bytes in a 64-bit unsigned value to switch the value from little endian to big endian or vice versa. The byte swapped value is returned. */
UINT64 EFIAPI InternalMathSwapBytes64(IN UINT64 Operand)
|
{
UINT64 LowerBytes;
UINT64 HigherBytes;
LowerBytes = (UINT64)SwapBytes32 ((UINT32)Operand);
HigherBytes = (UINT64)SwapBytes32 ((UINT32)(Operand >> 32));
return (LowerBytes << 32 | HigherBytes);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* In TDX a serial of TdIoWrite32 is invoked to write data to the I/O port. */
|
VOID EFIAPI IoWriteFifo32(IN UINTN Port, IN UINTN Count, IN VOID *Buffer)
|
/* In TDX a serial of TdIoWrite32 is invoked to write data to the I/O port. */
VOID EFIAPI IoWriteFifo32(IN UINTN Port, IN UINTN Count, IN VOID *Buffer)
|
{
UINT32 *Buffer32;
Buffer32 = (UINT32 *)Buffer;
while (Count-- > 0) {
IoWrite32 (Port, *Buffer32++);
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* DAC960_DeallocateCommand deallocates Command, returning it to Controller's free list. */
|
static void DAC960_DeallocateCommand(DAC960_Command_T *Command)
|
/* DAC960_DeallocateCommand deallocates Command, returning it to Controller's free list. */
static void DAC960_DeallocateCommand(DAC960_Command_T *Command)
|
{
DAC960_Controller_T *Controller = Command->Controller;
Command->Request = NULL;
Command->Next = Controller->FreeCommands;
Controller->FreeCommands = Command;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Get Alert Level for the link loss service.
This funtions is used to get the most recent alert level. */
|
ADI_BLE_ALERT_LEVEL adi_ble_GetLinkLossAlertLevel(void)
|
/* Get Alert Level for the link loss service.
This funtions is used to get the most recent alert level. */
ADI_BLE_ALERT_LEVEL adi_ble_GetLinkLossAlertLevel(void)
|
{
return (pBLERadio->sLinkLossLevel.eAlertLevel);
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* Specifies the clock source for the specified TMR2 channel. */
|
void TMR2_SetClockSrc(CM_TMR2_TypeDef *TMR2x, uint32_t u32Ch, uint32_t u32Src)
|
/* Specifies the clock source for the specified TMR2 channel. */
void TMR2_SetClockSrc(CM_TMR2_TypeDef *TMR2x, uint32_t u32Ch, uint32_t u32Src)
|
{
DDL_ASSERT(IS_TMR2_UNIT(TMR2x));
DDL_ASSERT(IS_TMR2_CH(u32Ch));
DDL_ASSERT(IS_TMR2_CLK_SRC(u32Src));
u32Ch *= TMR2_CH_OFFSET;
MODIFY_REG32(TMR2x->BCONR, (TMR2_BCONR_CLK_CFG_MASK << u32Ch), (u32Src << u32Ch));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Register the Service D and all its Characteristics... */
|
void service_d_1_init(void)
|
/* Register the Service D and all its Characteristics... */
void service_d_1_init(void)
|
{
bt_gatt_service_register(&service_d_1_svc);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Gets an optional ending string position from argument 'arg', with default value 'def'. Negative means back from end: clip result to */
|
static size_t getendpos(lua_State *L, int arg, lua_Integer def, size_t len)
|
/* Gets an optional ending string position from argument 'arg', with default value 'def'. Negative means back from end: clip result to */
static size_t getendpos(lua_State *L, int arg, lua_Integer def, size_t len)
|
{
lua_Integer pos = luaL_optinteger(L, arg, def);
if (pos > (lua_Integer)len)
return len;
else if (pos >= 0)
return (size_t)pos;
else if (pos < -(lua_Integer)len)
return 0;
else return len + (size_t)pos + 1;
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* Returns non-zero if profiling data can be added, zero otherwise. */
|
int gcov_info_is_compatible(struct gcov_info *info1, struct gcov_info *info2)
|
/* Returns non-zero if profiling data can be added, zero otherwise. */
int gcov_info_is_compatible(struct gcov_info *info1, struct gcov_info *info2)
|
{
return (info1->stamp == info2->stamp);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This function provides minimum delay (in milliseconds) based on variable incremented. */
|
__weak void HAL_Delay(uint32_t Delay)
|
/* This function provides minimum delay (in milliseconds) based on variable incremented. */
__weak void HAL_Delay(uint32_t Delay)
|
{
uint32_t tickstart = HAL_GetTick();
uint32_t wait = Delay;
if (wait < HAL_MAX_DELAY)
{
wait += (uint32_t)(uwTickFreq);
}
while((HAL_GetTick() - tickstart) < wait)
{
}
}
|
ua1arn/hftrx
|
C++
| null | 69
|
/* This function logs the title of a SHA204 transaction. */
|
void log_sha204_title(char *title)
|
/* This function logs the title of a SHA204 transaction. */
void log_sha204_title(char *title)
|
{
usart_write_crlf();
usart_serial_write_packet(USART_SHA204, (uint8_t *) title, strlen(title));
usart_write_crlf();
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Notes: Some hosts automatically obtain this information, others require that we obtain it on our own. This function will */
|
static int scsi_request_sense(struct scsi_cmnd *scmd)
|
/* Notes: Some hosts automatically obtain this information, others require that we obtain it on our own. This function will */
static int scsi_request_sense(struct scsi_cmnd *scmd)
|
{
return scsi_send_eh_cmnd(scmd, NULL, 0, SENSE_TIMEOUT, ~0);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Configures the RTT to generate an alarm at the given time. */
|
void RTT_SetAlarm(AT91S_RTTC *pRtt, unsigned int time)
|
/* Configures the RTT to generate an alarm at the given time. */
void RTT_SetAlarm(AT91S_RTTC *pRtt, unsigned int time)
|
{
SANITY_CHECK(time > 0);
pRtt->RTTC_RTAR = time - 1;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Single function calculates SHA1 digest value for all raw data. It combines Sha1Init(), Sha1Update() and Sha1Final(). */
|
EFI_STATUS EFIAPI TpmCommHashAll(IN CONST UINT8 *Data, IN UINTN DataLen, OUT TPM_DIGEST *Digest)
|
/* Single function calculates SHA1 digest value for all raw data. It combines Sha1Init(), Sha1Update() and Sha1Final(). */
EFI_STATUS EFIAPI TpmCommHashAll(IN CONST UINT8 *Data, IN UINTN DataLen, OUT TPM_DIGEST *Digest)
|
{
VOID *Sha1Ctx;
UINTN CtxSize;
CtxSize = Sha1GetContextSize ();
Sha1Ctx = AllocatePool (CtxSize);
ASSERT (Sha1Ctx != NULL);
Sha1Init (Sha1Ctx);
Sha1Update (Sha1Ctx, Data, DataLen);
Sha1Final (Sha1Ctx, (UINT8 *)Digest);
FreePool (Sha1Ctx);
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Get free trigger duty interrupt flag of selected channel. */
|
uint32_t EPWM_GetFTDutyIntFlag(EPWM_T *epwm, uint32_t u32ChannelNum)
|
/* Get free trigger duty interrupt flag of selected channel. */
uint32_t EPWM_GetFTDutyIntFlag(EPWM_T *epwm, uint32_t u32ChannelNum)
|
{
return (((epwm)->FTCI & ((EPWM_FTCI_FTCMU0_Msk | EPWM_FTCI_FTCMD0_Msk) << (u32ChannelNum >> 1U))) ? 1UL : 0UL);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Returns: 0: transport successfully unregistered -ENOENT: transport never registered */
|
int xprt_unregister_transport(struct xprt_class *transport)
|
/* Returns: 0: transport successfully unregistered -ENOENT: transport never registered */
int xprt_unregister_transport(struct xprt_class *transport)
|
{
struct xprt_class *t;
int result;
result = 0;
spin_lock(&xprt_list_lock);
list_for_each_entry(t, &xprt_list, list) {
if (t == transport) {
printk(KERN_INFO
"RPC: Unregistered %s transport module.\n",
transport->name);
list_del_init(&transport->list);
goto out;
}
}
result = -ENOENT;
out:
spin_unlock(&xprt_list_lock);
return result;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* TIM_Base MSP De-Initialization This function freeze the hardware resources used in this example. */
|
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim_base)
|
/* TIM_Base MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim_base)
|
{
if(htim_base->Instance==TIM2)
{
__HAL_RCC_TIM2_CLK_DISABLE();
}
else if(htim_base->Instance==TIM4)
{
__HAL_RCC_TIM4_CLK_DISABLE();
}
else if(htim_base->Instance==TIM5)
{
__HAL_RCC_TIM5_CLK_DISABLE();
}
else if(htim_base->Instance==TIM8)
{
__HAL_RCC_TIM8_CLK_DISABLE();
}
else if(htim_base->Instance==TIM12)
{
__HAL_RCC_TIM12_CLK_DISABLE();
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* megasas_fire_cmd_skinny - Sends command to the FW @frame_phys_addr : Physical address of cmd @frame_count : Number of frames for the command @regs : MFI register set */
|
static void megasas_fire_cmd_skinny(struct megasas_instance *instance, dma_addr_t frame_phys_addr, u32 frame_count, struct megasas_register_set __iomem *regs)
|
/* megasas_fire_cmd_skinny - Sends command to the FW @frame_phys_addr : Physical address of cmd @frame_count : Number of frames for the command @regs : MFI register set */
static void megasas_fire_cmd_skinny(struct megasas_instance *instance, dma_addr_t frame_phys_addr, u32 frame_count, struct megasas_register_set __iomem *regs)
|
{
unsigned long flags;
spin_lock_irqsave(&instance->fire_lock, flags);
writel(0, &(regs)->inbound_high_queue_port);
writel((frame_phys_addr | (frame_count<<1))|1,
&(regs)->inbound_low_queue_port);
spin_unlock_irqrestore(&instance->fire_lock, flags);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Finalizes the flash driver operations. There could still be data in the currently active block that needs to be flashed. */
|
blt_bool FlashDone(void)
|
/* Finalizes the flash driver operations. There could still be data in the currently active block that needs to be flashed. */
blt_bool FlashDone(void)
|
{
blt_int8u cnt;
if (bootBlockInfo.base_addr != FLASH_INVALID_ADDRESS)
{
if (FlashWriteBlock(&bootBlockInfo) == BLT_FALSE)
{
return BLT_FALSE;
}
}
if (blockInfo.base_addr != FLASH_INVALID_ADDRESS)
{
if (FlashWriteBlock(&blockInfo) == BLT_FALSE)
{
return BLT_FALSE;
}
}
for (cnt=0; cnt<(sizeof(flashExecCmd)/sizeof(flashExecCmd[0])); cnt++)
{
flashExecCmdRam[cnt] = 0;
}
return BLT_TRUE;
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* By default, the TRNG runs for 200 clocks per sample; 1200 clocks per sample generates better entropy. */
|
static void kick_trng(int ent_delay, uint8_t sec_idx)
|
/* By default, the TRNG runs for 200 clocks per sample; 1200 clocks per sample generates better entropy. */
static void kick_trng(int ent_delay, uint8_t sec_idx)
|
{
ccsr_sec_t __iomem *sec = (ccsr_sec_t __iomem *)SEC_ADDR(sec_idx);
struct rng4tst __iomem *rng =
(struct rng4tst __iomem *)&sec->rng;
u32 val;
sec_setbits32(&rng->rtmctl, RTMCTL_PRGM);
val = sec_in32(&rng->rtsdctl);
val = (val & ~RTSDCTL_ENT_DLY_MASK) |
(ent_delay << RTSDCTL_ENT_DLY_SHIFT);
sec_out32(&rng->rtsdctl, val);
sec_out32(&rng->rtfreqmin, ent_delay >> 2);
sec_out32(&rng->rtfreqmax, RTFRQMAX_DISABLE);
sec_setbits32(&rng->rtmctl, RTMCTL_SAMP_MODE_RAW_ES_SC);
sec_clrbits32(&rng->rtmctl, RTMCTL_PRGM);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Writes the data to flash through a flash block manager. Note that this function also checks that no data is programmed outside the flash memory region, so the bootloader can never be overwritten. */
|
blt_bool FlashWrite(blt_addr addr, blt_int32u len, blt_int8u *data)
|
/* Writes the data to flash through a flash block manager. Note that this function also checks that no data is programmed outside the flash memory region, so the bootloader can never be overwritten. */
blt_bool FlashWrite(blt_addr addr, blt_int32u len, blt_int8u *data)
|
{
blt_addr base_addr;
blt_addr last_block_base_addr;
if ((len - 1) > (FLASH_END_ADDRESS - addr))
{
return BLT_FALSE;
}
if ((addr < FLASH_START_ADDRESS) || ((addr+len-1) > FLASH_END_ADDRESS))
{
return BLT_FALSE;
}
last_block_base_addr = flashLayout[FLASH_LAST_SECTOR_IDX].sector_start + \
flashLayout[FLASH_LAST_SECTOR_IDX].sector_size - \
FLASH_WRITE_BLOCK_SIZE;
base_addr = (addr/FLASH_WRITE_BLOCK_SIZE)*FLASH_WRITE_BLOCK_SIZE;
if (base_addr == last_block_base_addr)
{
return FlashAddToBlock(&bootBlockInfo, addr, data, len);
}
return FlashAddToBlock(&blockInfo, addr, data, len);
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* get a list of pages in an address range belonging to the specified process and indicate the VMA that covers each page */
|
int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, int nr_pages, int write, int force, struct page **pages, struct vm_area_struct **vmas)
|
/* get a list of pages in an address range belonging to the specified process and indicate the VMA that covers each page */
int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, int nr_pages, int write, int force, struct page **pages, struct vm_area_struct **vmas)
|
{
int flags = 0;
if (write)
flags |= FOLL_WRITE;
if (force)
flags |= FOLL_FORCE;
return __get_user_pages(tsk, mm, start, nr_pages, flags, pages, vmas);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* mv_xor_free_slots - flags descriptor slots for reuse @slot: Slot to free Caller must hold &mv_chan->lock while calling this function */
|
static void mv_xor_free_slots(struct mv_xor_chan *mv_chan, struct mv_xor_desc_slot *slot)
|
/* mv_xor_free_slots - flags descriptor slots for reuse @slot: Slot to free Caller must hold &mv_chan->lock while calling this function */
static void mv_xor_free_slots(struct mv_xor_chan *mv_chan, struct mv_xor_desc_slot *slot)
|
{
dev_dbg(mv_chan->device->common.dev, "%s %d slot %p\n",
__func__, __LINE__, slot);
slot->slots_per_op = 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* cl_wide_st_chg() - TRUE if the state change is a cluster wide one @mdev: DRBD device. @os: old (current) state. @ns: new (wanted) state. */
|
static int cl_wide_st_chg(struct drbd_conf *mdev, union drbd_state os, union drbd_state ns)
|
/* cl_wide_st_chg() - TRUE if the state change is a cluster wide one @mdev: DRBD device. @os: old (current) state. @ns: new (wanted) state. */
static int cl_wide_st_chg(struct drbd_conf *mdev, union drbd_state os, union drbd_state ns)
|
{
return (os.conn >= C_CONNECTED && ns.conn >= C_CONNECTED &&
((os.role != R_PRIMARY && ns.role == R_PRIMARY) ||
(os.conn != C_STARTING_SYNC_T && ns.conn == C_STARTING_SYNC_T) ||
(os.conn != C_STARTING_SYNC_S && ns.conn == C_STARTING_SYNC_S) ||
(os.disk != D_DISKLESS && ns.disk == D_DISKLESS))) ||
(os.conn >= C_CONNECTED && ns.conn == C_DISCONNECTING) ||
(os.conn == C_CONNECTED && ns.conn == C_VERIFY_S);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* sys_sched_setscheduler - set/change the scheduler policy and RT priority @pid: the pid in question. @policy: new policy. */
|
SYSCALL_DEFINE3(sched_setscheduler, pid_t, pid, int, policy, struct sched_param __user *, param)
|
/* sys_sched_setscheduler - set/change the scheduler policy and RT priority @pid: the pid in question. @policy: new policy. */
SYSCALL_DEFINE3(sched_setscheduler, pid_t, pid, int, policy, struct sched_param __user *, param)
|
{
if (policy < 0)
return -EINVAL;
return do_sched_setscheduler(pid, policy, param);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Each passed coefficient array must be the right size for that coefficient: width_in_blocks wide and height_in_blocks high, with unitheight at least v_samp_factor. */
|
transencode_coef_controller(j_compress_ptr cinfo, jvirt_barray_ptr *coef_arrays)
|
/* Each passed coefficient array must be the right size for that coefficient: width_in_blocks wide and height_in_blocks high, with unitheight at least v_samp_factor. */
transencode_coef_controller(j_compress_ptr cinfo, jvirt_barray_ptr *coef_arrays)
|
{
my_coef_ptr coef;
JBLOCKROW buffer;
int i;
coef = (my_coef_ptr)
(*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE,
SIZEOF(my_coef_controller));
cinfo->coef = (struct jpeg_c_coef_controller *) coef;
coef->pub.start_pass = start_pass_coef;
coef->pub.compress_data = compress_output;
coef->whole_image = coef_arrays;
buffer = (JBLOCKROW)
(*cinfo->mem->alloc_large) ((j_common_ptr) cinfo, JPOOL_IMAGE,
C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
FMEMZERO((void FAR *) buffer, C_MAX_BLOCKS_IN_MCU * SIZEOF(JBLOCK));
for (i = 0; i < C_MAX_BLOCKS_IN_MCU; i++) {
coef->dummy_buffer[i] = buffer + i;
}
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* RCC Turn on an Oscillator.
Enable an oscillator and power on. Each oscillator requires an amount of time to settle to a usable state. Refer to datasheets for time delay information. A status flag is available to indicate when the oscillator becomes ready (see */
|
void rcc_osc_on(enum rcc_osc osc)
|
/* RCC Turn on an Oscillator.
Enable an oscillator and power on. Each oscillator requires an amount of time to settle to a usable state. Refer to datasheets for time delay information. A status flag is available to indicate when the oscillator becomes ready (see */
void rcc_osc_on(enum rcc_osc osc)
|
{
switch (osc) {
case RCC_HSI48:
RCC_CR2 |= RCC_CR2_HSI48ON;
break;
case RCC_HSI14:
RCC_CR2 |= RCC_CR2_HSI14ON;
break;
case RCC_HSI:
RCC_CR |= RCC_CR_HSION;
break;
case RCC_HSE:
RCC_CR |= RCC_CR_HSEON;
break;
case RCC_LSE:
RCC_BDCR |= RCC_BDCR_LSEON;
break;
case RCC_LSI:
RCC_CSR |= RCC_CSR_LSION;
break;
case RCC_PLL:
RCC_CR |= RCC_CR_PLLON;
break;
}
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Returns: (transfer full) (array zero-terminated=1): a NULL-terminated array of strings containing kinds of identifiers. Use g_strfreev() to free. */
|
char** g_drive_enumerate_identifiers(GDrive *drive)
|
/* Returns: (transfer full) (array zero-terminated=1): a NULL-terminated array of strings containing kinds of identifiers. Use g_strfreev() to free. */
char** g_drive_enumerate_identifiers(GDrive *drive)
|
{
GDriveIface *iface;
g_return_val_if_fail (G_IS_DRIVE (drive), NULL);
iface = G_DRIVE_GET_IFACE (drive);
if (iface->enumerate_identifiers == NULL)
return NULL;
return (* iface->enumerate_identifiers) (drive);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* init and fill in the needed content of dhcp ack message. */
|
static void dhcps_send_ack(struct pbuf *packet_buffer)
|
/* init and fill in the needed content of dhcp ack message. */
static void dhcps_send_ack(struct pbuf *packet_buffer)
|
{
dhcp_message_repository = (struct dhcp_msg *)packet_buffer->payload;
dhcps_initialize_message(dhcp_message_repository);
if(add_offer_options(add_msg_type(&dhcp_message_repository->options[4], DHCP_MESSAGE_TYPE_ACK)) == 0)
udp_sendto_if(dhcps_pcb, packet_buffer, &dhcps_send_broadcast_address, DHCP_CLIENT_PORT, dhcps_netif);
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Compute BnA inverse modulo BnM. Please note, all "out" Big number arguments should be properly initialized by calling to */
|
BOOLEAN EFIAPI BigNumInverseMod(IN CONST VOID *BnA, IN CONST VOID *BnM, OUT VOID *BnRes)
|
/* Compute BnA inverse modulo BnM. Please note, all "out" Big number arguments should be properly initialized by calling to */
BOOLEAN EFIAPI BigNumInverseMod(IN CONST VOID *BnA, IN CONST VOID *BnM, OUT VOID *BnRes)
|
{
CALL_CRYPTO_SERVICE (BigNumInverseMod, (BnA, BnM, BnRes), FALSE);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Return 1 if a software reset command is being performed by the reset controller. The reset controller is busy. */
|
unsigned char RSTC_IsBusy(void)
|
/* Return 1 if a software reset command is being performed by the reset controller. The reset controller is busy. */
unsigned char RSTC_IsBusy(void)
|
{
if (AT91C_BASE_RSTC->RSTC_RSR & AT91C_RSTC_SRCMP) {
return 1;
}
return 0;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Show and set the bonding transmit hash method. The bond interface must be down to change the xmit hash policy. */
|
static ssize_t bonding_show_xmit_hash(struct device *d, struct device_attribute *attr, char *buf)
|
/* Show and set the bonding transmit hash method. The bond interface must be down to change the xmit hash policy. */
static ssize_t bonding_show_xmit_hash(struct device *d, struct device_attribute *attr, char *buf)
|
{
struct bonding *bond = to_bond(d);
return sprintf(buf, "%s %d\n",
xmit_hashtype_tbl[bond->params.xmit_policy].modename,
bond->params.xmit_policy);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* @cmd_parameter: Pointer to command parameter @response: Pointer to fastboot response buffer */
|
static void getvar(char *, char *)
|
/* @cmd_parameter: Pointer to command parameter @response: Pointer to fastboot response buffer */
static void getvar(char *, char *)
|
{
fastboot_getvar(cmd_parameter, response);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Function to continue SoftDevice update.
This function will be called after reset if there is a valid SoftDevice in Bank0 or Bank1 required to be relocated and activated through MBR commands. */
|
static uint32_t nrf_dfu_sd_continue(uint32_t src_addr, nrf_dfu_bank_t *p_bank)
|
/* Function to continue SoftDevice update.
This function will be called after reset if there is a valid SoftDevice in Bank0 or Bank1 required to be relocated and activated through MBR commands. */
static uint32_t nrf_dfu_sd_continue(uint32_t src_addr, nrf_dfu_bank_t *p_bank)
|
{
uint32_t ret_val;
ret_val = nrf_dfu_sd_continue_impl(src_addr, p_bank);
if (ret_val != NRF_SUCCESS)
{
NRF_LOG_INFO("SD update continuation failed\r\n");
return ret_val;
}
nrf_dfu_invalidate_bank(p_bank);
ret_val = nrf_dfu_settings_write(NULL);
return ret_val;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Allocate a shared buffer in host memory that can be used by both the kernel and also the hardware interface via DMA. */
|
static int sep_map_and_alloc_shared_area(struct sep_device *sep, unsigned long size)
|
/* Allocate a shared buffer in host memory that can be used by both the kernel and also the hardware interface via DMA. */
static int sep_map_and_alloc_shared_area(struct sep_device *sep, unsigned long size)
|
{
sep->shared_addr = dma_alloc_coherent(&sep->pdev->dev, size,
&sep->shared_bus, GFP_KERNEL);
if (!sep->shared_addr) {
edbg("sep_driver :shared memory dma_alloc_coherent failed\n");
return -ENOMEM;
}
edbg("sep: shared_addr %ld bytes @%p (bus %08llx)\n",
size, sep->shared_addr, (unsigned long long)sep->shared_bus);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* The software interrupt instruction (SWI) is used for entering Supervisor mode, usually to request a particular supervisor function. */
|
void rt_hw_trap_swi(struct rt_hw_register *regs)
|
/* The software interrupt instruction (SWI) is used for entering Supervisor mode, usually to request a particular supervisor function. */
void rt_hw_trap_swi(struct rt_hw_register *regs)
|
{
if (rt_exception_hook != RT_NULL)
{
rt_err_t result;
result = rt_exception_hook(regs);
if (result == RT_EOK) return;
}
rt_hw_show_register(regs);
rt_kprintf("software interrupt\n");
rt_hw_cpu_shutdown();
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Calls the generic get_speed_and_duplex to retrieve the current link information and then calls the Kumeran lock loss workaround for links at gigabit speeds. */
|
static s32 e1000_get_link_up_info_ich8lan(struct e1000_hw *hw, u16 *speed, u16 *duplex)
|
/* Calls the generic get_speed_and_duplex to retrieve the current link information and then calls the Kumeran lock loss workaround for links at gigabit speeds. */
static s32 e1000_get_link_up_info_ich8lan(struct e1000_hw *hw, u16 *speed, u16 *duplex)
|
{
s32 ret_val;
ret_val = e1000e_get_speed_and_duplex_copper(hw, speed, duplex);
if (ret_val)
return ret_val;
if ((hw->mac.type == e1000_ich8lan) &&
(hw->phy.type == e1000_phy_igp_3) &&
(*speed == SPEED_1000)) {
ret_val = e1000_kmrn_lock_loss_workaround_ich8lan(hw);
}
return ret_val;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Return 'true' if this is the case, else return 'false'. */
|
static int nfs_can_coalesce_requests(struct nfs_page *prev, struct nfs_page *req)
|
/* Return 'true' if this is the case, else return 'false'. */
static int nfs_can_coalesce_requests(struct nfs_page *prev, struct nfs_page *req)
|
{
if (req->wb_context->cred != prev->wb_context->cred)
return 0;
if (req->wb_context->lockowner != prev->wb_context->lockowner)
return 0;
if (req->wb_context->state != prev->wb_context->state)
return 0;
if (req->wb_index != (prev->wb_index + 1))
return 0;
if (req->wb_pgbase != 0)
return 0;
if (prev->wb_pgbase + prev->wb_bytes != PAGE_CACHE_SIZE)
return 0;
return 1;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Gets the current setting of the FIFO service request level. */
|
unsigned long I2SRxFIFOLimitGet(unsigned long ulBase)
|
/* Gets the current setting of the FIFO service request level. */
unsigned long I2SRxFIFOLimitGet(unsigned long ulBase)
|
{
ASSERT(ulBase == I2S0_BASE);
return(HWREG(ulBase + I2S_O_RXLIMIT) & 0xFFFE);
}
|
watterott/WebRadio
|
C++
| null | 71
|
/* Removes a sap to the LLC's station sap list. */
|
static void llc_del_sap(struct llc_sap *sap)
|
/* Removes a sap to the LLC's station sap list. */
static void llc_del_sap(struct llc_sap *sap)
|
{
write_lock_bh(&llc_sap_list_lock);
list_del(&sap->node);
write_unlock_bh(&llc_sap_list_lock);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Free and remove the hostinfo pointer bound to this @hl driver and @host. */
|
void hpsb_destroy_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host)
|
/* Free and remove the hostinfo pointer bound to this @hl driver and @host. */
void hpsb_destroy_hostinfo(struct hpsb_highlevel *hl, struct hpsb_host *host)
|
{
struct hl_host_info *hi;
hi = hl_get_hostinfo(hl, host);
if (hi) {
unsigned long flags;
write_lock_irqsave(&hl->host_info_lock, flags);
list_del(&hi->list);
write_unlock_irqrestore(&hl->host_info_lock, flags);
kfree(hi);
}
return;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Pat the watchdog whenever device is written to. */
|
static ssize_t at91_wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos)
|
/* Pat the watchdog whenever device is written to. */
static ssize_t at91_wdt_write(struct file *file, const char *data, size_t len, loff_t *ppos)
|
{
at91_wdt_reload();
return len;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* cpupri_cleanup - clean up the cpupri structure @cp: The cpupri context */
|
void cpupri_cleanup(struct cpupri *cp)
|
/* cpupri_cleanup - clean up the cpupri structure @cp: The cpupri context */
void cpupri_cleanup(struct cpupri *cp)
|
{
int i;
for (i = 0; i < CPUPRI_NR_PRIORITIES; i++)
free_cpumask_var(cp->pri_to_cpu[i].mask);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Set Baud Rate of FlexCAN.
This function set the baud rate of FlexCAN. */
|
static void FLEXCAN_SetBaudRate(CAN_Type *base, uint32_t sourceClock_Hz, uint32_t baudRate_Bps)
|
/* Set Baud Rate of FlexCAN.
This function set the baud rate of FlexCAN. */
static void FLEXCAN_SetBaudRate(CAN_Type *base, uint32_t sourceClock_Hz, uint32_t baudRate_Bps)
|
{
flexcan_timing_config_t timingConfig;
uint32_t priDiv = baudRate_Bps * FLEXCAN_TIME_QUANTA_NUM;
assert(baudRate_Bps <= 1000000U);
assert(priDiv <= sourceClock_Hz);
if (0 == priDiv)
{
priDiv = 1;
}
priDiv = (sourceClock_Hz / priDiv) - 1;
if (priDiv > 0xFF)
{
priDiv = 0xFF;
}
timingConfig.preDivider = priDiv;
timingConfig.phaseSeg1 = 3;
timingConfig.phaseSeg2 = 2;
timingConfig.propSeg = 1;
timingConfig.rJumpwidth = 1;
FLEXCAN_SetTimingConfig(base, &timingConfig);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Now all the various file operations that we export. */
|
static ssize_t cpustate_read(struct file *file, char *buf, size_t count, loff_t *ppos)
|
/* Now all the various file operations that we export. */
static ssize_t cpustate_read(struct file *file, char *buf, size_t count, loff_t *ppos)
|
{
unsigned char data;
if (count < 0)
return -EFAULT;
if (count == 0)
return 0;
data = cpustate_get_state();
if (copy_to_user(buf, &data, sizeof(unsigned char)))
return -EFAULT;
return sizeof(unsigned char);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* @cfg: driver private data for cfg80211 interface. @p2pdev_forced: create p2p device interface at attach. */
|
s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced)
|
/* @cfg: driver private data for cfg80211 interface. @p2pdev_forced: create p2p device interface at attach. */
s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced)
|
{
struct brcmf_p2p_info *p2p;
struct brcmf_if *pri_ifp;
s32 err = 0;
void *err_ptr;
p2p = &cfg->p2p;
p2p->cfg = cfg;
pri_ifp = brcmf_get_ifp(cfg->pub, 0);
p2p->bss_idx[P2PAPI_BSSCFG_PRIMARY].vif = pri_ifp->vif;
if (p2pdev_forced) {
err_ptr = brcmf_p2p_create_p2pdev(p2p, NULL, NULL);
if (IS_ERR(err_ptr)) {
brcmf_err("P2P device creation failed.\n");
err = PTR_ERR(err_ptr);
}
} else {
p2p->p2pdev_dynamically = true;
}
return err;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* The function is used to Get The Current Power Mode. */
|
unsigned long SysCtlPowerModeGet(void)
|
/* The function is used to Get The Current Power Mode. */
unsigned long SysCtlPowerModeGet(void)
|
{
return (xHWREGB(SMC_PMSTAT)&SMC_PMSTAT_PMSTAT_M);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Return value: 0 on success / other on failure */
|
static int ibmvfc_wait_while_resetting(struct ibmvfc_host *vhost)
|
/* Return value: 0 on success / other on failure */
static int ibmvfc_wait_while_resetting(struct ibmvfc_host *vhost)
|
{
long timeout = wait_event_timeout(vhost->init_wait_q,
((vhost->state == IBMVFC_ACTIVE ||
vhost->state == IBMVFC_HOST_OFFLINE ||
vhost->state == IBMVFC_LINK_DEAD) &&
vhost->action == IBMVFC_HOST_ACTION_NONE),
(init_timeout * HZ));
return timeout ? 0 : -EIO;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* NEVER try to get away with just a "blank" release function to try to be smarter than the kernel. Turns out, no one ever is... */
|
static void foo_release(struct kobject *kobj)
|
/* NEVER try to get away with just a "blank" release function to try to be smarter than the kernel. Turns out, no one ever is... */
static void foo_release(struct kobject *kobj)
|
{
struct foo_obj *foo;
foo = to_foo_obj(kobj);
kfree(foo);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.