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
|
|---|---|---|---|---|---|---|---|
/* Check if 1-GByte pages is supported by processor or not. */
|
BOOLEAN Is1GPageSupport(VOID)
|
/* Check if 1-GByte pages is supported by processor or not. */
BOOLEAN Is1GPageSupport(VOID)
|
{
UINT32 RegEax;
UINT32 RegEdx;
AsmCpuid (0x80000000, &RegEax, NULL, NULL, NULL);
if (RegEax >= 0x80000001) {
AsmCpuid (0x80000001, NULL, NULL, NULL, &RegEdx);
if ((RegEdx & BIT26) != 0) {
return TRUE;
}
}
return FALSE;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Changing the baud clock source changes the data rate generated by the SSI. Therefore, the data rate should be reconfigured after any change to the SSI clock source. */
|
void SSIClockSourceSet(uint32_t ui32Base, uint32_t ui32Source)
|
/* Changing the baud clock source changes the data rate generated by the SSI. Therefore, the data rate should be reconfigured after any change to the SSI clock source. */
void SSIClockSourceSet(uint32_t ui32Base, uint32_t ui32Source)
|
{
ASSERT(_SSIBaseValid(ui32Base));
ASSERT((ui32Source == SSI_CLOCK_SYSTEM) ||
(ui32Source == SSI_CLOCK_ALTCLK));
HWREG(ui32Base + SSI_O_CC) = ui32Source;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Attribute counts pre object type... Increase these values if you add attributes */
|
fc_bitfield_name_search(port_roles, fc_port_role_names)
|
/* Attribute counts pre object type... Increase these values if you add attributes */
fc_bitfield_name_search(port_roles, fc_port_role_names)
|
{
struct scsi_transport_template t;
struct fc_function_template *f;
struct device_attribute private_starget_attrs[
FC_STARGET_NUM_ATTRS];
struct device_attribute *starget_attrs[FC_STARGET_NUM_ATTRS + 1];
struct device_attribute private_host_attrs[FC_HOST_NUM_ATTRS];
struct device_attribute *host_attrs[FC_HOST_NUM_ATTRS + 1];
struct transport_container rport_attr_cont;
struct device_attribute private_rport_attrs[FC_RPORT_NUM_ATTRS];
struct device_attribute *rport_attrs[FC_RPORT_NUM_ATTRS + 1];
struct transport_container vport_attr_cont;
struct device_attribute private_vport_attrs[FC_VPORT_NUM_ATTRS];
struct device_attribute *vport_attrs[FC_VPORT_NUM_ATTRS + 1];
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* DMA Channel Reset.
The channel is disabled and configuration registers are cleared. */
|
void dma_channel_reset(uint32_t dma, uint8_t channel)
|
/* DMA Channel Reset.
The channel is disabled and configuration registers are cleared. */
void dma_channel_reset(uint32_t dma, uint8_t channel)
|
{
DMA_CCR(dma, channel) = 0;
DMA_CNDTR(dma, channel) = 0;
DMA_CPAR(dma, channel) = 0;
DMA_CMAR(dma, channel) = 0;
DMA_IFCR(dma) |= DMA_IFCR_CIF(channel);
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* This function is required to be called in order for the file to be removed. No automatic cleanup of files will happen when a module is removed; you are responsible here. */
|
void securityfs_remove(struct dentry *dentry)
|
/* This function is required to be called in order for the file to be removed. No automatic cleanup of files will happen when a module is removed; you are responsible here. */
void securityfs_remove(struct dentry *dentry)
|
{
struct dentry *parent;
if (!dentry || IS_ERR(dentry))
return;
parent = dentry->d_parent;
if (!parent || !parent->d_inode)
return;
mutex_lock(&parent->d_inode->i_mutex);
if (positive(dentry)) {
if (dentry->d_inode) {
if (S_ISDIR(dentry->d_inode->i_mode))
simple_rmdir(parent->d_inode, dentry);
else
simple_unlink(parent->d_inode, dentry);
dput(dentry);
}
}
mutex_unlock(&parent->d_inode->i_mutex);
simple_release_fs(&mount, &mount_count);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Verifies the RSA signature with RSASSA-PSS signature scheme defined in RFC 8017. Implementation determines salt length automatically from the signature encoding. Mask generation function is the same as the message digest algorithm. Salt length should be equal to digest length. */
|
BOOLEAN EFIAPI CryptoServiceRsaPssVerify(IN VOID *RsaContext, IN CONST UINT8 *Message, IN UINTN MsgSize, IN CONST UINT8 *Signature, IN UINTN SigSize, IN UINT16 DigestLen, IN UINT16 SaltLen)
|
/* Verifies the RSA signature with RSASSA-PSS signature scheme defined in RFC 8017. Implementation determines salt length automatically from the signature encoding. Mask generation function is the same as the message digest algorithm. Salt length should be equal to digest length. */
BOOLEAN EFIAPI CryptoServiceRsaPssVerify(IN VOID *RsaContext, IN CONST UINT8 *Message, IN UINTN MsgSize, IN CONST UINT8 *Signature, IN UINTN SigSize, IN UINT16 DigestLen, IN UINT16 SaltLen)
|
{
return CALL_BASECRYPTLIB (RsaPss.Services.Verify, RsaPssVerify, (RsaContext, Message, MsgSize, Signature, SigSize, DigestLen, SaltLen), FALSE);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Validate behavior of multiple calls to k_thread_start()
Call k_thread_start() on an already terminated thread */
|
ZTEST(threads_lifecycle, test_thread_start)
|
/* Validate behavior of multiple calls to k_thread_start()
Call k_thread_start() on an already terminated thread */
ZTEST(threads_lifecycle, test_thread_start)
|
{
tp2 = 5;
k_tid_t tid = k_thread_create(&tdata, tstack, STACK_SIZE,
thread_entry_delay, NULL, NULL, NULL,
K_HIGHEST_THREAD_PRIO,
K_USER, K_FOREVER);
k_thread_start(tid);
k_yield();
zassert_true(tp2 == 100);
tp2 = 50;
k_thread_start(tid);
k_yield();
zassert_false(tp2 == 100);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Resets the CRC peripheral registers to their default reset values. */
|
void CRC_Reset(void)
|
/* Resets the CRC peripheral registers to their default reset values. */
void CRC_Reset(void)
|
{
CRC->DATA = 0xFFFFFFFF;
CRC->INDATA = 0x00;
CRC->INITVAL = 0xFFFFFFFF;
CRC->CTRL = 0x00000000;
CRC->POL = 0x04C11DB7;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Call this function to state that the given lock manager is ready to resume regular locking. The grace period will not end until all lock managers that called locks_start_grace() also call locks_end_grace(). Note that callers count on it being safe to call this more than once, and the second call should be a no-op. */
|
void locks_end_grace(struct lock_manager *lm)
|
/* Call this function to state that the given lock manager is ready to resume regular locking. The grace period will not end until all lock managers that called locks_start_grace() also call locks_end_grace(). Note that callers count on it being safe to call this more than once, and the second call should be a no-op. */
void locks_end_grace(struct lock_manager *lm)
|
{
spin_lock(&grace_lock);
list_del_init(&lm->list);
spin_unlock(&grace_lock);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* check if the SSL context can read as many as data */
|
long SSL_CTX_get_default_read_ahead(SSL_CTX *ctx)
|
/* check if the SSL context can read as many as data */
long SSL_CTX_get_default_read_ahead(SSL_CTX *ctx)
|
{
SSL_ASSERT1(ctx);
return ctx->read_ahead;
}
|
retro-esp32/RetroESP32
|
C++
|
Creative Commons Attribution Share Alike 4.0 International
| 581
|
/* fc_exch_mgr_free() - Free all exchange managers on a local port @lport: */
|
void fc_exch_mgr_free(struct fc_lport *lport)
|
/* fc_exch_mgr_free() - Free all exchange managers on a local port @lport: */
void fc_exch_mgr_free(struct fc_lport *lport)
|
{
struct fc_exch_mgr_anchor *ema, *next;
flush_workqueue(fc_exch_workqueue);
list_for_each_entry_safe(ema, next, &lport->ema_list, ema_list)
fc_exch_mgr_del(ema);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* eeh_enable_irq - enable interrupt for the recovering device */
|
static void eeh_enable_irq(struct pci_dev *dev)
|
/* eeh_enable_irq - enable interrupt for the recovering device */
static void eeh_enable_irq(struct pci_dev *dev)
|
{
struct device_node *dn = pci_device_to_OF_node(dev);
if ((PCI_DN(dn)->eeh_mode) & EEH_MODE_IRQ_DISABLED) {
PCI_DN(dn)->eeh_mode &= ~EEH_MODE_IRQ_DISABLED;
enable_irq(dev->irq);
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Write a value to an indexed register. The caller must hold the lock to honour the irritating delay rules. We know about register 0 being fast to access. */
|
static void write_zsreg(struct z8530_channel *c, u8 reg, u8 val)
|
/* Write a value to an indexed register. The caller must hold the lock to honour the irritating delay rules. We know about register 0 being fast to access. */
static void write_zsreg(struct z8530_channel *c, u8 reg, u8 val)
|
{
if(reg)
z8530_write_port(c->ctrlio, reg);
z8530_write_port(c->ctrlio, val);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* initialize higher level parts of CPU like time base and timers */
|
int cpu_init_r(void)
|
/* initialize higher level parts of CPU like time base and timers */
int cpu_init_r(void)
|
{
ambapp_apbdev apbdev;
ambapp_apb_first(VENDOR_GAISLER, GAISLER_IRQMP, &apbdev);
irqmp = (ambapp_dev_irqmp *) apbdev.address;
if (ambapp_apb_first(VENDOR_GAISLER, GAISLER_GPTIMER, &apbdev) != 1) {
printf("cpu_init_r: gptimer not found!\n");
return 1;
}
gptimer = (ambapp_dev_gptimer *) apbdev.address;
gptimer_irq = apbdev.irq;
gptimer->scalar = gptimer->scalar_reload =
(((CONFIG_SYS_CLK_FREQ / 1000) + 500) / 1000) - 1;
return (0);
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Get one byte from the specified position in a pbuf */
|
int pbuf_try_get_at(const struct pbuf *p, u16_t offset)
|
/* Get one byte from the specified position in a pbuf */
int pbuf_try_get_at(const struct pbuf *p, u16_t offset)
|
{
u16_t q_idx;
const struct pbuf* q = pbuf_skip_const(p, offset, &q_idx);
if ((q != NULL) && (q->len > q_idx)) {
return ((u8_t*)q->payload)[q_idx];
}
return -1;
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* The problem is that nUnits does not include this end-marker. It's quite difficult to discriminate whether the following 0xFFFF comes from the end-marker or some next data. */
|
static void gxv_LookupTable_fmt2_skip_endmarkers(FT_Bytes table, FT_UShort unitSize, GXV_Validator gxvalid)
|
/* The problem is that nUnits does not include this end-marker. It's quite difficult to discriminate whether the following 0xFFFF comes from the end-marker or some next data. */
static void gxv_LookupTable_fmt2_skip_endmarkers(FT_Bytes table, FT_UShort unitSize, GXV_Validator gxvalid)
|
{
FT_Bytes p = table;
while ( ( p + 4 ) < gxvalid->root->limit )
{
if ( p[0] != 0xFF || p[1] != 0xFF ||
p[2] != 0xFF || p[3] != 0xFF )
break;
p += unitSize;
}
gxvalid->subtable_length = (FT_ULong)( p - table );
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Return the oui_info_t for the PID for a particular OUI value, or NULL if there isn't one. */
|
oui_info_t* get_snap_oui_info(guint32 oui)
|
/* Return the oui_info_t for the PID for a particular OUI value, or NULL if there isn't one. */
oui_info_t* get_snap_oui_info(guint32 oui)
|
{
if (oui_info_table != NULL) {
return (oui_info_t *)g_hash_table_lookup(oui_info_table,
GUINT_TO_POINTER(oui));
} else
return NULL;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* __get_active_agg - get the current active aggregator @aggregator: the aggregator we're looking at */
|
static struct aggregator* __get_active_agg(struct aggregator *aggregator)
|
/* __get_active_agg - get the current active aggregator @aggregator: the aggregator we're looking at */
static struct aggregator* __get_active_agg(struct aggregator *aggregator)
|
{
struct aggregator *retval = NULL;
for (; aggregator; aggregator = __get_next_agg(aggregator)) {
if (aggregator->is_active) {
retval = aggregator;
break;
}
}
return retval;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* this function will fetch directory entries from a directory descriptor. */
|
int dfs_file_getdents(struct dfs_fd *fd, struct dirent *dirp, size_t nbytes)
|
/* this function will fetch directory entries from a directory descriptor. */
int dfs_file_getdents(struct dfs_fd *fd, struct dirent *dirp, size_t nbytes)
|
{
if (fd == NULL || fd->type != FT_DIRECTORY)
return -EINVAL;
if (fd->fops->getdents != NULL)
return fd->fops->getdents(fd, dirp, nbytes);
return -ENOSYS;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* "write" request on "raw" special file. Generic destructor. */
|
static void line6_destruct(struct usb_interface *interface)
|
/* "write" request on "raw" special file. Generic destructor. */
static void line6_destruct(struct usb_interface *interface)
|
{
struct usb_line6 *line6;
if (interface == NULL)
return;
line6 = usb_get_intfdata(interface);
if (line6 == NULL)
return;
kfree(line6->buffer_message);
kfree(line6->buffer_listen);
usb_free_urb(line6->urb_listen);
usb_set_intfdata(interface, NULL);
kfree(line6);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Creating event object for PCI Hot Plug controller. */
|
EFI_STATUS CreateEventForHpc(IN UINTN HpIndex, OUT EFI_EVENT *Event)
|
/* Creating event object for PCI Hot Plug controller. */
EFI_STATUS CreateEventForHpc(IN UINTN HpIndex, OUT EFI_EVENT *Event)
|
{
EFI_STATUS Status;
Status = gBS->CreateEvent (
EVT_NOTIFY_SIGNAL,
TPL_CALLBACK,
PciHPCInitialized,
gPciRootHpcData + HpIndex,
&((gPciRootHpcData + HpIndex)->Event)
);
if (!EFI_ERROR (Status)) {
*Event = (gPciRootHpcData + HpIndex)->Event;
}
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Disables the USART.
Ensures that nothing is transferred while setting up buffers. */
|
void usart_spi_disable(USART_t *usart)
|
/* Disables the USART.
Ensures that nothing is transferred while setting up buffers. */
void usart_spi_disable(USART_t *usart)
|
{
usart_tx_disable(usart);
usart_rx_disable(usart);
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Fills each ADC_Config_T member with its default value. */
|
void ADC_ConfigStructInit(ADC_Config_T *adcConfig)
|
/* Fills each ADC_Config_T member with its default value. */
void ADC_ConfigStructInit(ADC_Config_T *adcConfig)
|
{
adcConfig->resolution = ADC_RESOLUTION_12BIT;
adcConfig->scanConvMode = DISABLE;
adcConfig->continuousConvMode = DISABLE;
adcConfig->extTrigEdge = ADC_EXT_TRIG_EDGE_NONE;
adcConfig->extTrigConv = ADC_EXT_TRIG_CONV_TMR1_CC1;
adcConfig->dataAlign = ADC_DATA_ALIGN_RIGHT;
adcConfig->nbrOfChannel = 1;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* fix_settings - reset any boot parameters which are out of range back to the default values. */
|
static void __devinit fix_settings(void)
|
/* fix_settings - reset any boot parameters which are out of range back to the default values. */
static void __devinit fix_settings(void)
|
{
int i;
dprintkdbg(DBG_1,
"setup: AdapterId=%08x MaxSpeed=%08x DevMode=%08x "
"AdapterMode=%08x Tags=%08x ResetDelay=%08x\n",
cfg_data[CFG_ADAPTER_ID].value,
cfg_data[CFG_MAX_SPEED].value,
cfg_data[CFG_DEV_MODE].value,
cfg_data[CFG_ADAPTER_MODE].value,
cfg_data[CFG_TAGS].value,
cfg_data[CFG_RESET_DELAY].value);
for (i = 0; i < CFG_NUM; i++)
{
if (cfg_data[i].value < cfg_data[i].min
|| cfg_data[i].value > cfg_data[i].max)
cfg_data[i].value = cfg_data[i].def;
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Get the biggest dependence type. PackageDepType > CoreDepType > ThreadDepType > NoneDepType. */
|
CPU_FEATURE_DEPENDENCE_TYPE BiggestDep(IN CPU_FEATURE_DEPENDENCE_TYPE BeforeDep, IN CPU_FEATURE_DEPENDENCE_TYPE AfterDep, IN CPU_FEATURE_DEPENDENCE_TYPE NoneNeibBeforeDep, IN CPU_FEATURE_DEPENDENCE_TYPE NoneNeibAfterDep)
|
/* Get the biggest dependence type. PackageDepType > CoreDepType > ThreadDepType > NoneDepType. */
CPU_FEATURE_DEPENDENCE_TYPE BiggestDep(IN CPU_FEATURE_DEPENDENCE_TYPE BeforeDep, IN CPU_FEATURE_DEPENDENCE_TYPE AfterDep, IN CPU_FEATURE_DEPENDENCE_TYPE NoneNeibBeforeDep, IN CPU_FEATURE_DEPENDENCE_TYPE NoneNeibAfterDep)
|
{
CPU_FEATURE_DEPENDENCE_TYPE Bigger;
Bigger = MAX (BeforeDep, AfterDep);
Bigger = MAX (Bigger, NoneNeibBeforeDep);
return MAX (Bigger, NoneNeibAfterDep);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Performs checks and sets PT_PTRACED. Should be used by all ptrace implementations for PTRACE_TRACEME. */
|
int ptrace_traceme(void)
|
/* Performs checks and sets PT_PTRACED. Should be used by all ptrace implementations for PTRACE_TRACEME. */
int ptrace_traceme(void)
|
{
int ret = -EPERM;
write_lock_irq(&tasklist_lock);
if (!current->ptrace) {
ret = security_ptrace_traceme(current->parent);
if (!ret && !(current->real_parent->flags & PF_EXITING)) {
current->ptrace = PT_PTRACED;
__ptrace_link(current, current->real_parent);
}
}
write_unlock_irq(&tasklist_lock);
return ret;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
|
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
|
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
|
{
if(huart->Instance==UART5)
{
__HAL_RCC_UART5_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_12);
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_2);
}
else if(huart->Instance==USART1)
{
__HAL_RCC_USART1_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_10|GPIO_PIN_9);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* The function is used to enable LVD interrupt or Wakeup LDO function. */
|
void SysCtlLVDIntEnable(xtBoolean bEnable)
|
/* The function is used to enable LVD interrupt or Wakeup LDO function. */
void SysCtlLVDIntEnable(xtBoolean bEnable)
|
{
if(bEnable)
{
xHWREG(PWRCU_LVDCSR) |= PWRCU_LVDCSR_LVDIWEN;
}
else
{
xHWREG(PWRCU_LVDCSR) &= ~PWRCU_LVDCSR_LVDIWEN;
}
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Reads an 8-bit register. If UseMmio is TRUE, then the value is read from MMIO space. If UseMmio is FALSE, then the value is read from I/O space. The parameter Offset is added to the base address of the register. */
|
UINT8 SerialPortReadRegister(UINTN Base, UINTN Offset, BOOLEAN UseMmio, UINT8 RegisterStride)
|
/* Reads an 8-bit register. If UseMmio is TRUE, then the value is read from MMIO space. If UseMmio is FALSE, then the value is read from I/O space. The parameter Offset is added to the base address of the register. */
UINT8 SerialPortReadRegister(UINTN Base, UINTN Offset, BOOLEAN UseMmio, UINT8 RegisterStride)
|
{
if (UseMmio) {
return MmioRead8 (Base + Offset * RegisterStride);
} else {
return IoRead8 (Base + Offset * RegisterStride);
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Request the memory region(s) being used by 'port'. */
|
static int imx_request_port(struct uart_port *port)
|
/* Request the memory region(s) being used by 'port'. */
static int imx_request_port(struct uart_port *port)
|
{
struct platform_device *pdev = to_platform_device(port->dev);
struct resource *mmres;
void *ret;
mmres = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!mmres)
return -ENODEV;
ret = request_mem_region(mmres->start, mmres->end - mmres->start + 1,
"imx-uart");
return ret ? 0 : -EBUSY;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Change Logs: Date Author Notes flyingcys The first version */
|
int main(void)
|
/* Change Logs: Date Author Notes flyingcys The first version */
int main(void)
|
{
rt_kprintf("Hello, RISC-V!\n");
return 0;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* param targetCount The desired target for the fast clock, should be the number of clock cycles of the fast_clk per divided ref_clk. */
|
void CLOCK_OSC_SetOscRc400MFastClkCount(uint16_t targetCount)
|
/* param targetCount The desired target for the fast clock, should be the number of clock cycles of the fast_clk per divided ref_clk. */
void CLOCK_OSC_SetOscRc400MFastClkCount(uint16_t targetCount)
|
{
uint32_t tmp32;
tmp32 = ANATOP_AI_Read(kAI_Itf_400m, kAI_RCOSC400M_CTRL1);
tmp32 = ((tmp32 & ~AI_RCOSC400M_CTRL1_TARGET_COUNT_MASK) | AI_RCOSC400M_CTRL1_TARGET_COUNT(targetCount));
ANATOP_AI_Write(kAI_Itf_400m, kAI_RCOSC400M_CTRL1, tmp32);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Determines the current status of a message channel as well as the current settings and the current status of the controller that is connected to the channel. */
|
static HRESULT IxxatVciLibFuncCanChannelGetStatus(HANDLE hCanChn, PCANCHANSTATUS pStatus)
|
/* Determines the current status of a message channel as well as the current settings and the current status of the controller that is connected to the channel. */
static HRESULT IxxatVciLibFuncCanChannelGetStatus(HANDLE hCanChn, PCANCHANSTATUS pStatus)
|
{
HRESULT result = VCI_E_UNEXPECTED;
assert(ixxatVciLibFuncCanChannelGetStatusPtr != NULL);
assert(ixxatVciDllHandle != NULL);
if ((ixxatVciLibFuncCanChannelGetStatusPtr != NULL) && (ixxatVciDllHandle != NULL))
{
result = ixxatVciLibFuncCanChannelGetStatusPtr(hCanChn, pStatus);
}
return result;
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* This is the second or subsequent kprobe at the address - handle the intricacies */
|
static int __kprobes register_aggr_kprobe(struct kprobe *old_p, struct kprobe *p)
|
/* This is the second or subsequent kprobe at the address - handle the intricacies */
static int __kprobes register_aggr_kprobe(struct kprobe *old_p, struct kprobe *p)
|
{
int ret = 0;
struct kprobe *ap = old_p;
if (old_p->pre_handler != aggr_pre_handler) {
ap = kzalloc(sizeof(struct kprobe), GFP_KERNEL);
if (!ap)
return -ENOMEM;
add_aggr_kprobe(ap, old_p);
}
if (kprobe_gone(ap)) {
ret = arch_prepare_kprobe(ap);
if (ret)
return ret;
ap->flags = (ap->flags & ~KPROBE_FLAG_GONE)
| KPROBE_FLAG_DISABLED;
}
copy_kprobe(ap, p);
return add_new_kprobe(ap, p);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* iwl_add_bcast_station - add broadcast station into station table. */
|
void iwl_add_bcast_station(struct iwl_priv *priv)
|
/* iwl_add_bcast_station - add broadcast station into station table. */
void iwl_add_bcast_station(struct iwl_priv *priv)
|
{
iwl_add_station(priv, iwl_bcast_addr, false, CMD_SYNC, NULL);
iwl_sta_init_bcast_lq(priv);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Task function for blinking the LED as a fixed timer interval. */
|
void LedBlinkTask(void)
|
/* Task function for blinking the LED as a fixed timer interval. */
void LedBlinkTask(void)
|
{
static blt_bool ledOn = BLT_FALSE;
static blt_int32u nextBlinkEvent = 0;
if (TimerGet() >= nextBlinkEvent)
{
if (ledOn == BLT_FALSE)
{
ledOn = BLT_TRUE;
PORTB_BIT0 = 1;
}
else
{
ledOn = BLT_FALSE;
PORTB_BIT0 = 0;
}
nextBlinkEvent = TimerGet() + ledBlinkIntervalMs;
}
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* xprt_update_rtt - update an RPC client's RTT state after receiving a reply @task: RPC request that recently completed */
|
void xprt_update_rtt(struct rpc_task *task)
|
/* xprt_update_rtt - update an RPC client's RTT state after receiving a reply @task: RPC request that recently completed */
void xprt_update_rtt(struct rpc_task *task)
|
{
struct rpc_rqst *req = task->tk_rqstp;
struct rpc_rtt *rtt = task->tk_client->cl_rtt;
unsigned timer = task->tk_msg.rpc_proc->p_timer;
if (timer) {
if (req->rq_ntrans == 1)
rpc_update_rtt(rtt, timer,
(long)jiffies - req->rq_xtime);
rpc_set_timeo(rtt, timer, req->rq_ntrans - 1);
}
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Free what has been allocated by avcodec_thread_init(). Must be called after decoding has finished, especially do not call while avcodec_thread_execute() is running. */
|
void avcodec_thread_free(AVCodecContext *s)
|
/* Free what has been allocated by avcodec_thread_init(). Must be called after decoding has finished, especially do not call while avcodec_thread_execute() is running. */
void avcodec_thread_free(AVCodecContext *s)
|
{
c[i].func= NULL;
c[i].func2= NULL;
}
ReleaseSemaphore(c[0].work_sem, s->thread_count, 0);
for(i=0; i<s->thread_count; i++){
WaitForSingleObject(c[i].thread, INFINITE);
if(c[i].thread) CloseHandle(c[i].thread);
}
if(c[0].work_sem) CloseHandle(c[0].work_sem);
if(c[0].job_sem) CloseHandle(c[0].job_sem);
if(c[0].done_sem) CloseHandle(c[0].done_sem);
av_freep(&s->thread_opaque);
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* Send data with special length in master mode through the I2Cx peripheral. */
|
void I2C_MasterWrite(I2C_TypeDef *I2Cx, u8 *pBuf, u8 len)
|
/* Send data with special length in master mode through the I2Cx peripheral. */
void I2C_MasterWrite(I2C_TypeDef *I2Cx, u8 *pBuf, u8 len)
|
{
u8 cnt = 0;
assert_param(IS_I2C_ALL_PERIPH(I2Cx));
for(cnt = 0; cnt < len; cnt++)
{
while((I2C_CheckFlagState(I2Cx, BIT_IC_STATUS_TFNF)) == 0);
if(cnt >= len - 1)
{
I2Cx->IC_DATA_CMD = (*pBuf++) | (1 << 9);
}
else
{
I2Cx->IC_DATA_CMD = (*pBuf++);
}
}
while((I2C_CheckFlagState(I2Cx, BIT_IC_STATUS_TFE)) == 0);
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Returns TRUE if the user has marked this column as visible */
|
gboolean prefs_capture_options_dialog_column_is_visible(const gchar *column)
|
/* Returns TRUE if the user has marked this column as visible */
gboolean prefs_capture_options_dialog_column_is_visible(const gchar *column)
|
{
GList *curr;
gchar *col;
for (curr = g_list_first(prefs.capture_columns); curr; curr = g_list_next(curr)) {
col = (gchar *)curr->data;
if (col && (g_ascii_strcasecmp(col, column) == 0)) {
return TRUE;
}
}
return FALSE;
}
|
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 getPressure(int32_t *result)
|
/* result: address where the result will be written returns: 0 on success -1 on fail; */
int16_t getPressure(int32_t *result)
|
{
uint8_t buffer[3] = { 0 };
int16_t i = readBlock(DPS310__REG_ADR_PRS, DPS310__REG_LEN_PRS, buffer);
if (i != DPS310__REG_LEN_PRS) {
return DPS310__FAIL_UNKNOWN;
}
int32_t prs = (uint32_t)buffer[0] << 16 | (uint32_t)buffer[1] << 8 |
(uint32_t)buffer[2];
if (prs & ((uint32_t)1 << 23)) {
prs -= (uint32_t)1 << 24;
}
*result = calcPressure(prs);
return DPS310__SUCCEEDED;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Returns: A newly-allocated buffer containing the converted string, or NULL on an error, and error will be set. */
|
gchar* g_locale_from_utf8(const gchar *utf8string, gssize len, gsize *bytes_read, gsize *bytes_written, GError **error)
|
/* Returns: A newly-allocated buffer containing the converted string, or NULL on an error, and error will be set. */
gchar* g_locale_from_utf8(const gchar *utf8string, gssize len, gsize *bytes_read, gsize *bytes_written, GError **error)
|
{
const gchar *charset;
if (g_get_charset (&charset))
return strdup_len (utf8string, len, bytes_read, bytes_written, error);
else
return g_convert (utf8string, len,
charset, "UTF-8", bytes_read, bytes_written, error);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* This function writes a stream dictionary for a PDF stream to output. */
|
tsize_t t2p_write_pdf_stream_dict(tsize_t, uint32, TIFF *)
|
/* This function writes a stream dictionary for a PDF stream to output. */
tsize_t t2p_write_pdf_stream_dict(tsize_t, uint32, TIFF *)
|
{
written += t2p_write_pdf_stream_length(len, output);
} else {
buflen=snprintf(buffer, sizeof(buffer), "%lu", (unsigned long)number);
check_snprintf_ret((T2P*)NULL, buflen, buffer);
written += t2pWriteFile(output, (tdata_t) buffer, buflen);
written += t2pWriteFile(output, (tdata_t) " 0 R \n", 6);
}
return(written);
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Return 1 if corrected (or delivered a signal). Return 0 if there is nothing we can do. */
|
static int recover_mce(struct pt_regs *regs, struct rtas_error_log *err)
|
/* Return 1 if corrected (or delivered a signal). Return 0 if there is nothing we can do. */
static int recover_mce(struct pt_regs *regs, struct rtas_error_log *err)
|
{
int nonfatal = 0;
if (err->disposition == RTAS_DISP_FULLY_RECOVERED) {
nonfatal = 1;
} else if ((regs->msr & MSR_RI) &&
user_mode(regs) &&
err->severity == RTAS_SEVERITY_ERROR_SYNC &&
err->disposition == RTAS_DISP_NOT_RECOVERED &&
err->target == RTAS_TARGET_MEMORY &&
err->type == RTAS_TYPE_ECC_UNCORR &&
!(current->pid == 0 || is_global_init(current))) {
printk(KERN_ERR "MCE: uncorrectable ecc error for pid %d\n",
current->pid);
_exception(SIGBUS, regs, BUS_ADRERR, regs->nip);
nonfatal = 1;
}
log_error((char *)err, ERR_TYPE_RTAS_LOG, !nonfatal);
return nonfatal;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Called by bport/vport to notify SCN for the remote port */
|
void bfa_fcs_rport_scn(struct bfa_fcs_rport_s *rport)
|
/* Called by bport/vport to notify SCN for the remote port */
void bfa_fcs_rport_scn(struct bfa_fcs_rport_s *rport)
|
{
rport->stats.rscns++;
bfa_sm_send_event(rport, RPSM_EVENT_SCN);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns the size of the hash which results from a specific algorithm. */
|
EFI_STATUS EFIAPI BaseCrypto2GetHashSize(IN CONST EFI_HASH2_PROTOCOL *This, IN CONST EFI_GUID *HashAlgorithm, OUT UINTN *HashSize)
|
/* Returns the size of the hash which results from a specific algorithm. */
EFI_STATUS EFIAPI BaseCrypto2GetHashSize(IN CONST EFI_HASH2_PROTOCOL *This, IN CONST EFI_GUID *HashAlgorithm, OUT UINTN *HashSize)
|
{
EFI_HASH_INFO *HashInfo;
if ((This == NULL) || (HashSize == NULL)) {
return EFI_INVALID_PARAMETER;
}
if (HashAlgorithm == NULL) {
return EFI_UNSUPPORTED;
}
HashInfo = GetHashInfo (HashAlgorithm);
if (HashInfo == NULL) {
return EFI_UNSUPPORTED;
}
*HashSize = HashInfo->HashSize;
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Called to get the version of the interpreter. */
|
EFI_STATUS EFIAPI EbcGetVersion(IN EFI_EBC_PROTOCOL *This, IN OUT UINT64 *Version)
|
/* Called to get the version of the interpreter. */
EFI_STATUS EFIAPI EbcGetVersion(IN EFI_EBC_PROTOCOL *This, IN OUT UINT64 *Version)
|
{
if (Version == NULL) {
return EFI_INVALID_PARAMETER;
}
*Version = GetVmVersion ();
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* param base ASRC base pointer. param handle ASRC eDMA handle pointer. */
|
void ASRC_TransferInTerminalEDMA(ASRC_Type *base, asrc_edma_handle_t *handle)
|
/* param base ASRC base pointer. param handle ASRC eDMA handle pointer. */
void ASRC_TransferInTerminalEDMA(ASRC_Type *base, asrc_edma_handle_t *handle)
|
{
assert(handle != NULL);
ASRC_TransferInAbortEDMA(base, handle);
if ((handle->in.peripheralConfig != NULL) && (handle->in.peripheralConfig->startPeripheral != NULL))
{
handle->in.peripheralConfig->startPeripheral(false);
}
(void)memset(handle->in.tcd, 0, sizeof(handle->in.tcd));
(void)memset(handle->in.asrcQueue, 0, sizeof(handle->in.asrcQueue));
(void)memset(handle->in.transferSize, 0, sizeof(handle->in.transferSize));
handle->in.queueUser = 0U;
handle->in.queueDriver = 0U;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Failing a resume leaves the device resumed but closed. */
|
static int bcm5974_open(struct input_dev *input)
|
/* Failing a resume leaves the device resumed but closed. */
static int bcm5974_open(struct input_dev *input)
|
{
struct bcm5974 *dev = input_get_drvdata(input);
int error;
error = usb_autopm_get_interface(dev->intf);
if (error)
return error;
mutex_lock(&dev->pm_mutex);
error = bcm5974_start_traffic(dev);
if (!error)
dev->opened = 1;
mutex_unlock(&dev->pm_mutex);
if (error)
usb_autopm_put_interface(dev->intf);
return error;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Reads data coming from a SSC peripheral receiver and stores it into the provided buffer. Returns true if the buffer has been queued for reception; otherwise returns false. */
|
unsigned char SSC_ReadBuffer(AT91S_SSC *ssc, void *buffer, unsigned int length)
|
/* Reads data coming from a SSC peripheral receiver and stores it into the provided buffer. Returns true if the buffer has been queued for reception; otherwise returns false. */
unsigned char SSC_ReadBuffer(AT91S_SSC *ssc, void *buffer, unsigned int length)
|
{
if (ssc->SSC_RCR == 0) {
ssc->SSC_RPR = (unsigned int) buffer;
ssc->SSC_RCR = length;
ssc->SSC_PTCR = AT91C_PDC_RXTEN;
return 1;
}
else if (ssc->SSC_RNCR == 0) {
ssc->SSC_RNPR = (unsigned int) buffer;
ssc->SSC_RNCR = length;
return 1;
}
return 0;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Convert an unsigned long integer to a string representation with a specified radix. */
|
char* ultoa(unsigned long value, char *string, int radix)
|
/* Convert an unsigned long integer to a string representation with a specified radix. */
char* ultoa(unsigned long value, char *string, int radix)
|
{
char tmp[33];
char *tp = tmp;
long i;
unsigned long v = value;
char *sp;
if (string == NULL)
{
return 0;
}
if (radix > 36 || radix <= 1)
{
return 0;
}
while (v || tp == tmp)
{
i = v % radix;
v = v / radix;
if (i < 10)
*tp++ = (char)(i + '0');
else
*tp++ = (char)(i + 'a' - 10);
}
sp = string;
while (tp > tmp)
*sp++ = *--tp;
*sp = 0;
return string;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* IDL long ClientRequest( IDL void *element_6, IDL char element_7, IDL long element_8 IDL ); */
|
static int dissect_tapi_TYPE_1(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
|
/* IDL long ClientRequest( IDL void *element_6, IDL char element_7, IDL long element_8 IDL ); */
static int dissect_tapi_TYPE_1(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
|
{
if(di->conformant_run){
offset =dissect_ndr_ucvarray(tvb, offset, pinfo, tree, di, drep, NULL);
return offset;
}
proto_tree_add_item(tree, hf_tapi_unknown_bytes, tvb, offset,
di->array_actual_count, ENC_NA);
offset += di->array_actual_count;
return offset;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Note: Should never be called with the spinlock held! */
|
static void nfs_free_request(struct kref *kref)
|
/* Note: Should never be called with the spinlock held! */
static void nfs_free_request(struct kref *kref)
|
{
struct nfs_page *req = container_of(kref, struct nfs_page, wb_kref);
nfs_clear_request(req);
put_nfs_open_context(req->wb_context);
nfs_page_free(req);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* We don't actually need to cache the rpc and session headers, so we can allocate a little less for each slot: */
|
static int slot_bytes(struct nfsd4_channel_attrs *ca)
|
/* We don't actually need to cache the rpc and session headers, so we can allocate a little less for each slot: */
static int slot_bytes(struct nfsd4_channel_attrs *ca)
|
{
return ca->maxresp_cached - NFSD_MIN_HDR_SEQ_SZ;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This element is encoded exactly as the Frequency List information element, except that it has a fixed length instead of a variable length and does not contain a length indicator and that it shall not be encoded in bitmap 0 format. */
|
static guint16 de_rr_freq_short_list2(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
|
/* This element is encoded exactly as the Frequency List information element, except that it has a fixed length instead of a variable length and does not contain a length indicator and that it shall not be encoded in bitmap 0 format. */
static guint16 de_rr_freq_short_list2(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
|
{
return dissect_arfcn_list(tvb, tree, pinfo, offset, 8, add_string, string_len);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Executes an SMBUS write data byte command on the SMBUS device specified by SmBusAddress. The 8-bit value specified by Value is written. Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. Value is returned. If Status is not NULL, then the status of the executed command is returned in Status. If Length in SmBusAddress is not zero, then ASSERT(). If any reserved bits of SmBusAddress are set, then ASSERT(). */
|
UINT8 EFIAPI SmBusWriteDataByte(IN UINTN SmBusAddress, IN UINT8 Value, OUT RETURN_STATUS *Status OPTIONAL)
|
/* Executes an SMBUS write data byte command on the SMBUS device specified by SmBusAddress. The 8-bit value specified by Value is written. Only the SMBUS slave address and SMBUS command fields of SmBusAddress are required. Value is returned. If Status is not NULL, then the status of the executed command is returned in Status. If Length in SmBusAddress is not zero, then ASSERT(). If any reserved bits of SmBusAddress are set, then ASSERT(). */
UINT8 EFIAPI SmBusWriteDataByte(IN UINTN SmBusAddress, IN UINT8 Value, OUT RETURN_STATUS *Status OPTIONAL)
|
{
ASSERT (SMBUS_LIB_LENGTH (SmBusAddress) == 0);
ASSERT (SMBUS_LIB_RESERVED (SmBusAddress) == 0);
if (Status != NULL) {
*Status = RETURN_UNSUPPORTED;
}
return 0;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Configure the smart card mode according to the specified parameters in the uart_scard_config_t. */
|
void ald_uart_scard_config(ald_uart_handle_t *hperh, ald_uart_scard_config_t *config)
|
/* Configure the smart card mode according to the specified parameters in the uart_scard_config_t. */
void ald_uart_scard_config(ald_uart_handle_t *hperh, ald_uart_scard_config_t *config)
|
{
assert_param(IS_UART_ENHANCE(hperh->perh));
assert_param(IS_UART_SCARD_CLK(config->clk_div));
MODIFY_REG(hperh->perh->SCARD, UART_SCARD_BLEN_MSK, config->block_len << UART_SCARD_BLEN_POSS);
MODIFY_REG(hperh->perh->SCARD, UART_SCARD_GT_MSK, config->pt << UART_SCARD_GT_POSS);
MODIFY_REG(hperh->perh->SCARD, UART_SCARD_SCCNT_MSK, config->retry << UART_SCARD_SCCNT_POSS);
MODIFY_REG(hperh->perh->SCARD, UART_SCARD_PSC_MSK, config->clk_div << UART_SCARD_PSC_POSS);
MODIFY_REG(hperh->perh->SCARD, UART_SCARD_SCLKEN_MSK, config->clk_out << UART_SCARD_SCLKEN_POS);
return;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Called from the IRQ interrupts, which are generated on button pushes. Send ucCommand to the task on the button command queue if lcdMIN_TIME_BETWEEN_INTERRUPTS_MS milliseconds have passed since the button was last pushed (for debouncing). */
|
static portBASE_TYPE prvSendCommandOnDebouncedInput(portTickType *pxTimeLastInterrupt, unsigned char ucCommand)
|
/* Called from the IRQ interrupts, which are generated on button pushes. Send ucCommand to the task on the button command queue if lcdMIN_TIME_BETWEEN_INTERRUPTS_MS milliseconds have passed since the button was last pushed (for debouncing). */
static portBASE_TYPE prvSendCommandOnDebouncedInput(portTickType *pxTimeLastInterrupt, unsigned char ucCommand)
|
{
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
portTickType xCurrentTickCount;
xCurrentTickCount = xTaskGetTickCountFromISR();
if( ( xCurrentTickCount - *pxTimeLastInterrupt ) > lcdMIN_TIME_BETWEEN_INTERRUPTS_MS )
{
xQueueSendToBackFromISR( xButtonCommandQueue, &ucCommand, &xHigherPriorityTaskWoken );
} *pxTimeLastInterrupt = xCurrentTickCount;
return xHigherPriorityTaskWoken;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Free the iommu virtually contiguous memory area starting at @da, which was returned by 'iommu_vmap()'. */
|
struct sg_table* iommu_vunmap(struct iommu *obj, u32 da)
|
/* Free the iommu virtually contiguous memory area starting at @da, which was returned by 'iommu_vmap()'. */
struct sg_table* iommu_vunmap(struct iommu *obj, u32 da)
|
{
struct sg_table *sgt;
sgt = unmap_vm_area(obj, da, vunmap_sg, IOVMF_DISCONT | IOVMF_MMIO);
if (!sgt)
dev_dbg(obj->dev, "%s: No sgt\n", __func__);
return sgt;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Configure TC for timer, waveform generation, or capture. */
|
void tc_init(Tc *p_tc, uint32_t ul_channel, uint32_t ul_mode)
|
/* Configure TC for timer, waveform generation, or capture. */
void tc_init(Tc *p_tc, uint32_t ul_channel, uint32_t ul_mode)
|
{
TcChannel *tc_channel;
Assert(p_tc);
Assert(ul_channel <
(sizeof(p_tc->TC_CHANNEL) / sizeof(p_tc->TC_CHANNEL[0])));
tc_channel = p_tc->TC_CHANNEL + ul_channel;
tc_channel->TC_CCR = TC_CCR_CLKDIS;
tc_channel->TC_IDR = 0xFFFFFFFF;
tc_channel->TC_SR;
tc_channel->TC_CMR = ul_mode;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Functions for accessing PCI configuration space with type 1 accesses */
|
static int sh4_pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val)
|
/* Functions for accessing PCI configuration space with type 1 accesses */
static int sh4_pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val)
|
{
struct pci_channel *chan = bus->sysdata;
unsigned long flags;
u32 data;
spin_lock_irqsave(&sh4_pci_lock, flags);
pci_write_reg(chan, CONFIG_CMD(bus, devfn, where), SH4_PCIPAR);
data = pci_read_reg(chan, SH4_PCIPDR);
spin_unlock_irqrestore(&sh4_pci_lock, flags);
switch (size) {
case 1:
*val = (data >> ((where & 3) << 3)) & 0xff;
break;
case 2:
*val = (data >> ((where & 2) << 3)) & 0xffff;
break;
case 4:
*val = data;
break;
default:
return PCIBIOS_FUNC_NOT_SUPPORTED;
}
return PCIBIOS_SUCCESSFUL;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Cleans up the LED blink driver. This is intended to be used upon program exit. */
|
void LedBlinkExit(void)
|
/* Cleans up the LED blink driver. This is intended to be used upon program exit. */
void LedBlinkExit(void)
|
{
XMC_GPIO_SetOutputLevel(P4_0, XMC_GPIO_OUTPUT_LEVEL_HIGH);
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Create a new Connection object and push it on top of the stack. */
|
static int create_connection(lua_State *L, int env, sqlite3 *sql_conn)
|
/* Create a new Connection object and push it on top of the stack. */
static int create_connection(lua_State *L, int env, sqlite3 *sql_conn)
|
{
conn_data *conn = (conn_data*)lua_newuserdata(L, sizeof(conn_data));
luasql_setmeta(L, LUASQL_CONNECTION_SQLITE);
conn->closed = 0;
conn->env = LUA_NOREF;
conn->auto_commit = 1;
conn->sql_conn = sql_conn;
conn->cur_counter = 0;
lua_pushvalue (L, env);
conn->env = luaL_ref (L, LUA_REGISTRYINDEX);
return 1;
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* Aborts an ongoing job.
Aborts an ongoing job. */
|
void dac_chan_abort_job(struct dac_module *module_inst, const enum dac_channel channel)
|
/* Aborts an ongoing job.
Aborts an ongoing job. */
void dac_chan_abort_job(struct dac_module *module_inst, const enum dac_channel channel)
|
{
Assert(module_inst);
UNUSED(channel);
module_inst->hw->INTFLAG.reg = DAC_INTFLAG_UNDERRUN | DAC_INTFLAG_EMPTY;
module_inst->hw->INTENCLR.reg = DAC_INTENCLR_UNDERRUN | DAC_INTENCLR_EMPTY;
module_inst->job_status = STATUS_ABORTED;
module_inst->remaining_conversions = 0;
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Enable HART reception by enabling the demultiplexer that routes the AD5700 to the circuit inputs. To enable these multipliers the AD4111 GPIO0 must be driven high. */
|
int32_t cn0414_hart_enable(struct cn0414_dev *dev, uint8_t *arg)
|
/* Enable HART reception by enabling the demultiplexer that routes the AD5700 to the circuit inputs. To enable these multipliers the AD4111 GPIO0 must be driven high. */
int32_t cn0414_hart_enable(struct cn0414_dev *dev, uint8_t *arg)
|
{
int32_t ret;
ad717x_st_reg *preg;
NVIC_DisableIRQ(TMR0_INT);
NVIC_DisableIRQ(HART_CD_INT);
preg = AD717X_GetReg(dev->ad4111_device, AD717X_GPIOCON_REG);
preg->value |= AD4111_GPIOCON_REG_DATA0;
ret = AD717X_WriteRegister(dev->ad4111_device, AD717X_GPIOCON_REG);
mdelay(5);
modem_rec_flag = false;
NVIC_EnableIRQ(TMR0_INT);
NVIC_EnableIRQ(HART_CD_INT);
return ret;
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* This function is called from the AP bus code after a crypto request "msg" has finished with the reply message "reply". It is called from tasklet context. @ap_dev: pointer to the AP device @msg: pointer to the AP message @reply: pointer to the AP reply message */
|
static void zcrypt_cex2a_receive(struct ap_device *, struct ap_message *, struct ap_message *)
|
/* This function is called from the AP bus code after a crypto request "msg" has finished with the reply message "reply". It is called from tasklet context. @ap_dev: pointer to the AP device @msg: pointer to the AP message @reply: pointer to the AP reply message */
static void zcrypt_cex2a_receive(struct ap_device *, struct ap_message *, struct ap_message *)
|
{
static struct error_hdr error_reply = {
.type = TYPE82_RSP_CODE,
.reply_code = REP82_ERROR_MACHINE_FAILURE,
};
struct type80_hdr *t80h;
int length;
if (IS_ERR(reply)) {
memcpy(msg->message, &error_reply, sizeof(error_reply));
goto out;
}
t80h = reply->message;
if (t80h->type == TYPE80_RSP_CODE) {
length = min(CEX2A_MAX_RESPONSE_SIZE, (int) t80h->len);
memcpy(msg->message, reply->message, length);
} else
memcpy(msg->message, reply->message, sizeof error_reply);
out:
complete((struct completion *) msg->private);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* These are the only things you should do on a core-file: use only these macros to write out all the necessary info. */
|
static int dump_write(struct file *file, const void *addr, int nr)
|
/* These are the only things you should do on a core-file: use only these macros to write out all the necessary info. */
static int dump_write(struct file *file, const void *addr, int nr)
|
{
return file->f_op->write(file, addr, nr, &file->f_pos) == nr;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This routine is called from the scheduler tqueue when the interrupt routine has signalled that a hangup has occurred. The path of hangup processing is: */
|
static void do_serial_hangup(void *private_)
|
/* This routine is called from the scheduler tqueue when the interrupt routine has signalled that a hangup has occurred. The path of hangup processing is: */
static void do_serial_hangup(void *private_)
|
{
struct async_struct *info = (struct async_struct *) private_;
struct tty_struct *tty;
tty = info->port.tty;
if (!tty)
return;
tty_hangup(tty);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Managed underflow event of IN packet on control endpoint. */
|
static void udd_ctrl_underflow(void)
|
/* Managed underflow event of IN packet on control endpoint. */
static void udd_ctrl_underflow(void)
|
{
if (Is_udd_out_received(0))
return;
if (UDD_EPCTRL_DATA_OUT == udd_ep_control_state) {
udd_ctrl_send_zlp_in();
} else if (UDD_EPCTRL_HANDSHAKE_WAIT_OUT_ZLP == udd_ep_control_state) {
udd_enable_stall_handshake(0);
}
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: */
|
int SDL_SetClipboardText(const char *text)
|
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: */
int SDL_SetClipboardText(const char *text)
|
{
SDL_VideoDevice *_this = SDL_GetVideoDevice();
if (!_this) {
return SDL_SetError("Video subsystem must be initialized to set clipboard text");
}
if (!text) {
text = "";
}
if (_this->SetClipboardText) {
return _this->SetClipboardText(_this, text);
} else {
SDL_free(_this->clipboard_text);
_this->clipboard_text = SDL_strdup(text);
return 0;
}
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Configures the output amplifier, DAC coding, SDO state and the linearity error compensation. */
|
int32_t ad5791_setup(struct ad5791_dev *dev, uint32_t setup_word)
|
/* Configures the output amplifier, DAC coding, SDO state and the linearity error compensation. */
int32_t ad5791_setup(struct ad5791_dev *dev, uint32_t setup_word)
|
{
uint32_t old_ctrl = 0;
uint32_t new_ctrl = 0;
int32_t status = 0;
status = ad5791_get_register_value(dev,
AD5791_REG_CTRL);
if(status < 0) {
return status;
}
old_ctrl = status;
old_ctrl = old_ctrl & ~(AD5791_CTRL_LINCOMP(-1) |
AD5791_CTRL_SDODIS |
AD5791_CTRL_BIN2SC |
AD5791_CTRL_RBUF);
new_ctrl = old_ctrl | setup_word;
status = ad5791_set_register_value(dev,
AD5791_REG_CTRL,
new_ctrl);
return status;
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* Function to take the destination path and target file name to generate the full destination path. */
|
EFI_STATUS CreateFullDestPath(IN CONST CHAR16 **DestPath, OUT CHAR16 **FullDestPath, IN CONST CHAR16 *FileName)
|
/* Function to take the destination path and target file name to generate the full destination path. */
EFI_STATUS CreateFullDestPath(IN CONST CHAR16 **DestPath, OUT CHAR16 **FullDestPath, IN CONST CHAR16 *FileName)
|
{
UINTN Size;
if ((FullDestPath == NULL) || (FileName == NULL) || (DestPath == NULL) || (*DestPath == NULL)) {
return (EFI_INVALID_PARAMETER);
}
Size = StrSize (*DestPath) + StrSize (FileName);
*FullDestPath = AllocateZeroPool (Size);
if (*FullDestPath == NULL) {
return (EFI_OUT_OF_RESOURCES);
}
StrCpyS (*FullDestPath, Size / sizeof (CHAR16), *DestPath);
if (((*FullDestPath)[StrLen (*FullDestPath)-1] != L'\\') && (FileName[0] != L'\\')) {
StrCatS (*FullDestPath, Size / sizeof (CHAR16), L"\\");
}
StrCatS (*FullDestPath, Size / sizeof (CHAR16), FileName);
return (EFI_SUCCESS);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Check whether the input range is in memory map. */
|
BOOLEAN InMemMap(IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN NumberOfPages)
|
/* Check whether the input range is in memory map. */
BOOLEAN InMemMap(IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN NumberOfPages)
|
{
LIST_ENTRY *Link;
MEMORY_MAP *Entry;
EFI_PHYSICAL_ADDRESS Last;
Last = Memory + EFI_PAGES_TO_SIZE (NumberOfPages) - 1;
Link = gMemoryMap.ForwardLink;
while (Link != &gMemoryMap) {
Entry = CR (Link, MEMORY_MAP, Link, MEMORY_MAP_SIGNATURE);
Link = Link->ForwardLink;
if ((Entry->Start <= Memory) && (Entry->End >= Last)) {
return TRUE;
}
}
return FALSE;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* pcie_port_service_register - register PCI Express port service driver @new: PCI Express port service driver to register */
|
int pcie_port_service_register(struct pcie_port_service_driver *new)
|
/* pcie_port_service_register - register PCI Express port service driver @new: PCI Express port service driver to register */
int pcie_port_service_register(struct pcie_port_service_driver *new)
|
{
new->driver.name = (char *)new->name;
new->driver.bus = &pcie_port_bus_type;
new->driver.probe = pcie_port_probe_service;
new->driver.remove = pcie_port_remove_service;
new->driver.shutdown = pcie_port_shutdown_service;
return driver_register(&new->driver);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* 3. Source RNC to target RNC transparent information (UMTS) */
|
static guint16 be_src_rnc_to_tar_rnc_umts(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
|
/* 3. Source RNC to target RNC transparent information (UMTS) */
static guint16 be_src_rnc_to_tar_rnc_umts(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
|
{
tvbuff_t *container_tvb;
guint32 curr_offset;
curr_offset = offset;
container_tvb = tvb_new_subset_length(tvb, curr_offset, len);
dissect_ranap_SourceRNC_ToTargetRNC_TransparentContainer_PDU(container_tvb, pinfo, tree, NULL);
return(len);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Please refer to your PHY manual for registers and their meanings. mii_write() polls for the FEC's MII interrupt event and clears it. If after a suitable amount of time the event isn't triggered, a value of 0 is returned. */
|
static int fec_mii_write(int phy_addr, int reg_addr, int data)
|
/* Please refer to your PHY manual for registers and their meanings. mii_write() polls for the FEC's MII interrupt event and clears it. If after a suitable amount of time the event isn't triggered, a value of 0 is returned. */
static int fec_mii_write(int phy_addr, int reg_addr, int data)
|
{
int timeout;
unsigned long eimr;
EIR = EIR_MII;
eimr = EIMR;
EIMR &= ~EIMR_MII;
MMFR = ( unsigned long ) ( FEC_MMFR_ST_01 | FEC_MMFR_OP_WRITE | FEC_MMFR_PA(phy_addr) | FEC_MMFR_RA(reg_addr) | FEC_MMFR_TA_10 | FEC_MMFR_DATA( data ) );
for (timeout = 0; timeout < FEC_MII_TIMEOUT; timeout++)
{
if( EIR & EIR_MII)
{
break;
}
}
if( timeout == FEC_MII_TIMEOUT )
{
return 0;
}
EIR = EIR_MII;
EIMR = eimr;
return 1;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Disable a GPIO pin as a trigger to start an ADC capture. */
|
void GPIOADCTriggerDisable(uint32_t ui32Port, uint8_t ui8Pins)
|
/* Disable a GPIO pin as a trigger to start an ADC capture. */
void GPIOADCTriggerDisable(uint32_t ui32Port, uint8_t ui8Pins)
|
{
ASSERT(_GPIOBaseValid(ui32Port));
HWREGB(ui32Port + GPIO_O_ADCCTL) &= (~ui8Pins);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* set command register This api include polling the status of the bit START_COMMAND, if 0 used as timeout value, then this function will return directly without polling the START_CMD status. */
|
static status_t SDIF_SetCommandRegister(SDIF_Type *base, uint32_t cmdIndex, uint32_t argument, uint32_t timeout)
|
/* set command register This api include polling the status of the bit START_COMMAND, if 0 used as timeout value, then this function will return directly without polling the START_CMD status. */
static status_t SDIF_SetCommandRegister(SDIF_Type *base, uint32_t cmdIndex, uint32_t argument, uint32_t timeout)
|
{
uint32_t syncTimeout = timeout;
base->CMDARG = argument;
base->CMD = cmdIndex | SDIF_CMD_START_CMD_MASK;
while ((base->CMD & SDIF_CMD_START_CMD_MASK) == SDIF_CMD_START_CMD_MASK)
{
if (timeout == 0U)
{
break;
}
if (0UL == syncTimeout)
{
return kStatus_SDIF_SyncCmdTimeout;
}
--syncTimeout;
}
return kStatus_Success;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* param tcd A pointer to the TCD structure. param srcModulo A source modulo value. param destModulo A destination modulo value. */
|
void EDMA_TcdSetModulo(edma_tcd_t *tcd, edma_modulo_t srcModulo, edma_modulo_t destModulo)
|
/* param tcd A pointer to the TCD structure. param srcModulo A source modulo value. param destModulo A destination modulo value. */
void EDMA_TcdSetModulo(edma_tcd_t *tcd, edma_modulo_t srcModulo, edma_modulo_t destModulo)
|
{
assert(tcd != NULL);
assert(((uint32_t)tcd & 0x1FU) == 0);
uint32_t tmpreg;
tmpreg = tcd->ATTR & (~(DMA_ATTR_SMOD_MASK | DMA_ATTR_DMOD_MASK));
tcd->ATTR = tmpreg | DMA_ATTR_DMOD(destModulo) | DMA_ATTR_SMOD(srcModulo);
}
|
nanoframework/nf-interpreter
|
C++
|
MIT License
| 293
|
/* Searches the FFS file for a section by its type */
|
EFI_STATUS FvBufUnifyBlockSizes(IN OUT VOID *Fv, IN UINTN BlockSize)
|
/* Searches the FFS file for a section by its type */
EFI_STATUS FvBufUnifyBlockSizes(IN OUT VOID *Fv, IN UINTN BlockSize)
|
{
EFI_FIRMWARE_VOLUME_HEADER *hdr = (EFI_FIRMWARE_VOLUME_HEADER*)Fv;
EFI_FV_BLOCK_MAP_ENTRY *blk = hdr->BlockMap;
UINT32 Size;
Size = 0;
while( blk->Length != 0 ||
blk->NumBlocks != 0
) {
Size = Size + (blk->Length * blk->NumBlocks);
blk++;
if ((UINT8*)blk > ((UINT8*)hdr + hdr->HeaderLength)) {
return EFI_VOLUME_CORRUPTED;
}
}
if ((Size % BlockSize) != 0) {
return EFI_INVALID_PARAMETER;
}
CommonLibBinderSetMem (
&hdr->BlockMap,
(UINTN)blk - (UINTN)&hdr->BlockMap,
0
);
hdr->BlockMap[0].Length = (UINT32)BlockSize;
hdr->BlockMap[0].NumBlocks = Size / (UINT32)BlockSize;
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function tries to read a node and returns %1 if the node is read, %0 if the node is not present, and a negative error code in the case of error. */
|
static int fallible_read_node(struct ubifs_info *c, const union ubifs_key *key, struct ubifs_zbranch *zbr, void *node)
|
/* This function tries to read a node and returns %1 if the node is read, %0 if the node is not present, and a negative error code in the case of error. */
static int fallible_read_node(struct ubifs_info *c, const union ubifs_key *key, struct ubifs_zbranch *zbr, void *node)
|
{
int ret;
dbg_tnc("LEB %d:%d, key %s", zbr->lnum, zbr->offs, DBGKEY(key));
ret = try_read_node(c, node, key_type(c, key), zbr->len, zbr->lnum,
zbr->offs);
if (ret == 1) {
union ubifs_key node_key;
struct ubifs_dent_node *dent = node;
key_read(c, &dent->key, &node_key);
if (keys_cmp(c, key, &node_key) != 0)
ret = 0;
}
if (ret == 0 && c->replaying)
dbg_mnt("dangling branch LEB %d:%d len %d, key %s",
zbr->lnum, zbr->offs, zbr->len, DBGKEY(key));
return ret;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* The Timer 3 default IRQ, declared in start up code. */
|
void TIMER3IntHandler(void)
|
/* The Timer 3 default IRQ, declared in start up code. */
void TIMER3IntHandler(void)
|
{
unsigned long ulBase = TIMER3_BASE;
unsigned long ulTemp0,ulTemp1;
ulTemp0 = (xHWREG(ulBase + TIMER_O_TISR) & TIMER_TISR_TIF);
xHWREG(ulBase + TIMER_O_TISR) = ulTemp0;
ulTemp1 = (xHWREG(ulBase + TIMER_O_TEISR) & TIMER_TISR_TIF);
xHWREG(ulBase + TIMER_O_TEISR) = ulTemp1;
if (g_pfnTimerHandlerCallbacks[3] != 0)
{
g_pfnTimerHandlerCallbacks[3](0, 0, ulTemp0 | ulTemp1, 0);
}
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
|
UINT8 EFIAPI PciBitFieldAndThenOr8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData, IN UINT8 OrData)
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT8 EFIAPI PciBitFieldAndThenOr8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData, IN UINT8 OrData)
|
{
return PciExpressBitFieldAndThenOr8 (Address, StartBit, EndBit, AndData, OrData);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Delete the timer that was created by osTimerCreate. */
|
osStatus_t osTimerDelete(osTimerId_t timer_id)
|
/* Delete the timer that was created by osTimerCreate. */
osStatus_t osTimerDelete(osTimerId_t timer_id)
|
{
struct cv2_timer *timer = (struct cv2_timer *) timer_id;
if (timer == NULL) {
return osErrorParameter;
}
if (k_is_in_isr()) {
return osErrorISR;
}
if (timer->status == ACTIVE) {
k_timer_stop(&timer->z_timer);
timer->status = NOT_ACTIVE;
}
k_mem_slab_free(&cv2_timer_slab, (void *)timer);
return osOK;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Queries the current Ethernet MAC remote wake-up status. */
|
uint32_t EMACPowerManagementStatusGet(uint32_t ui32Base)
|
/* Queries the current Ethernet MAC remote wake-up status. */
uint32_t EMACPowerManagementStatusGet(uint32_t ui32Base)
|
{
ASSERT(ui32Base == EMAC0_BASE);
return(HWREG(ui32Base + EMAC_O_PMTCTLSTAT) &
(EMAC_PMTCTLSTAT_WUPRX | EMAC_PMTCTLSTAT_MGKPRX |
EMAC_PMTCTLSTAT_PWRDWN));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Returns: the time difference in number of milliseconds. */
|
long tvdiff(struct timeval newer, struct timeval older)
|
/* Returns: the time difference in number of milliseconds. */
long tvdiff(struct timeval newer, struct timeval older)
|
{
return (long)(newer.tv_sec-older.tv_sec)*1000+
(long)(newer.tv_usec-older.tv_usec)/1000;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Function pointer for sending a byte through the UART module. */
|
static uint32_t send_tx_byte_default(void)
|
/* Function pointer for sending a byte through the UART module. */
static uint32_t send_tx_byte_default(void)
|
{
uint32_t err_code = app_uart_put(mp_tx_buffer[m_tx_buffer_index]);
if (err_code == NRF_SUCCESS)
{
m_tx_buffer_index++;
}
return err_code;
}
|
labapart/polymcu
|
C++
| null | 201
|
/* (A short description of the protocol including links to specifications, detailed documentation, etc.) */
|
void proto_reg_handoff_PROTOABBREV(void)
|
/* (A short description of the protocol including links to specifications, detailed documentation, etc.) */
void proto_reg_handoff_PROTOABBREV(void)
|
{
static gboolean initialized = FALSE;
static dissector_handle_t PROTOABBREV_handle;
static int current_port;
if (!initialized) {
PROTOABBREV_handle = create_dissector_handle(dissect_PROTOABBREV,
proto_PROTOABBREV);
initialized = TRUE;
} else {
dissector_delete_uint("tcp.port", current_port, PROTOABBREV_handle);
}
current_port = tcp_port_pref;
dissector_add_uint("tcp.port", current_port, PROTOABBREV_handle);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Write contents of register REGNO in task TASK. */
|
static int put_reg(struct task_struct *task, int regno, unsigned long data)
|
/* Write contents of register REGNO in task TASK. */
static int put_reg(struct task_struct *task, int regno, unsigned long data)
|
{
char *reg_ptr;
struct pt_regs *regs =
(struct pt_regs *)((unsigned long)task_stack_page(task) +
(THREAD_SIZE - sizeof(struct pt_regs)));
reg_ptr = (char *)regs;
switch (regno) {
case PT_PC:
regs->retx = data;
regs->pc = data;
break;
case PT_RETX:
break;
case PT_USP:
regs->usp = data;
task->thread.usp = data;
break;
default:
if (regno <= 216)
*(long *)(reg_ptr + regno) = data;
}
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Check whether this value represents an NEC header. */
|
static bool nec_header_if(rmt_item32_t *item)
|
/* Check whether this value represents an NEC header. */
static bool nec_header_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_HEADER_HIGH_US, NEC_BIT_MARGIN)
&& nec_check_in_range(item->duration1, NEC_HEADER_LOW_US, NEC_BIT_MARGIN)) {
return true;
}
return false;
}
|
retro-esp32/RetroESP32
|
C++
|
Creative Commons Attribution Share Alike 4.0 International
| 581
|
/* If HmacMdContext is NULL, then return FALSE. If NewHmacMdContext is NULL, then return FALSE. */
|
STATIC BOOLEAN HmacMdDuplicate(IN CONST VOID *HmacMdContext, OUT VOID *NewHmacMdContext)
|
/* If HmacMdContext is NULL, then return FALSE. If NewHmacMdContext is NULL, then return FALSE. */
STATIC BOOLEAN HmacMdDuplicate(IN CONST VOID *HmacMdContext, OUT VOID *NewHmacMdContext)
|
{
if ((HmacMdContext == NULL) || (NewHmacMdContext == NULL)) {
return FALSE;
}
if (HMAC_CTX_copy ((HMAC_CTX *)NewHmacMdContext, (HMAC_CTX *)HmacMdContext) != 1) {
return FALSE;
}
return TRUE;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Specifies the TIMx Counter Mode to be used. */
|
void TIM_CounterModeConfig(TIM_TypeDef *TIMx, uint16_t TIM_CounterMode)
|
/* Specifies the TIMx Counter Mode to be used. */
void TIM_CounterModeConfig(TIM_TypeDef *TIMx, uint16_t TIM_CounterMode)
|
{
uint16_t tmpcr1 = 0;
assert_param(IS_TIM_123458_PERIPH(TIMx));
assert_param(IS_TIM_COUNTER_MODE(TIM_CounterMode));
tmpcr1 = TIMx->CR1;
tmpcr1 &= CR1_CounterMode_Mask;
tmpcr1 |= TIM_CounterMode;
TIMx->CR1 = tmpcr1;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Secure Non-Secure-Callable function to return the current SystemCoreClock value after SystemCoreClock update. The SystemCoreClock variable contains the core clock (HCLK), it can be used by the user application to setup the SysTick timer or configure other parameters. */
|
CMSE_NS_ENTRY uint32_t SECURE_SystemCoreClockUpdate(void)
|
/* Secure Non-Secure-Callable function to return the current SystemCoreClock value after SystemCoreClock update. The SystemCoreClock variable contains the core clock (HCLK), it can be used by the user application to setup the SysTick timer or configure other parameters. */
CMSE_NS_ENTRY uint32_t SECURE_SystemCoreClockUpdate(void)
|
{
SystemCoreClockUpdate();
return SystemCoreClock;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
|
RETURN_STATUS EFIAPI SafeUint64ToUintn(IN UINT64 Operand, OUT UINTN *Result)
|
/* If the conversion results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeUint64ToUintn(IN UINT64 Operand, OUT UINTN *Result)
|
{
if (Result == NULL) {
return RETURN_INVALID_PARAMETER;
}
if (sizeof (UINTN) == sizeof (UINT32)) {
return SafeUint64ToUint32 ((UINT64)Operand, (UINT32 *)Result);
}
*Result = Operand;
return RETURN_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* param base FlexCAN peripheral base address. param handle FlexCAN handle pointer. */
|
void FLEXCAN_TransferAbortReceiveFifo(CAN_Type *base, flexcan_handle_t *handle)
|
/* param base FlexCAN peripheral base address. param handle FlexCAN handle pointer. */
void FLEXCAN_TransferAbortReceiveFifo(CAN_Type *base, flexcan_handle_t *handle)
|
{
assert(NULL != handle);
if (0U != (base->MCR & CAN_MCR_RFEN_MASK))
{
FLEXCAN_DisableMbInterrupts(base, (uint32_t)kFLEXCAN_RxFifoOverflowFlag | (uint32_t)kFLEXCAN_RxFifoWarningFlag |
(uint32_t)kFLEXCAN_RxFifoFrameAvlFlag);
handle->rxFifoFrameBuf = NULL;
handle->rxFifoFrameNum = 0U;
handle->rxFifoTransferTotalNum = 0U;
}
handle->rxFifoState = (uint8_t)kFLEXCAN_StateIdle;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Grant access to the given @ring_mfn to the peer of the given device. Return 0 on success, or -errno on error. On error, the device will switch to XenbusStateClosing, and the error will be saved in the store. */
|
int xenbus_grant_ring(struct xenbus_device *dev, unsigned long ring_mfn)
|
/* Grant access to the given @ring_mfn to the peer of the given device. Return 0 on success, or -errno on error. On error, the device will switch to XenbusStateClosing, and the error will be saved in the store. */
int xenbus_grant_ring(struct xenbus_device *dev, unsigned long ring_mfn)
|
{
int err = gnttab_grant_foreign_access(dev->otherend_id, ring_mfn, 0);
if (err < 0)
xenbus_dev_fatal(dev, err, "granting access to ring page");
return err;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Waits a data until a value different from SD_DUMMY_BITE. */
|
uint8_t SD_ReadData(void)
|
/* Waits a data until a value different from SD_DUMMY_BITE. */
uint8_t SD_ReadData(void)
|
{
uint8_t timeout = 0x08;
uint8_t readvalue;
do {
readvalue = SD_IO_WriteByte(SD_DUMMY_BYTE);
timeout--;
}while ((readvalue == SD_DUMMY_BYTE) && timeout);
return readvalue;
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Update the dcache to reflect the move of a file name. Negative dcache entries should not be moved in this way. */
|
void d_move(struct dentry *dentry, struct dentry *target)
|
/* Update the dcache to reflect the move of a file name. Negative dcache entries should not be moved in this way. */
void d_move(struct dentry *dentry, struct dentry *target)
|
{
spin_lock(&dcache_lock);
d_move_locked(dentry, target);
spin_unlock(&dcache_lock);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* The idle hook is just used to stream data to the USB port. */
|
void vApplicationIdleHook(void)
|
/* The idle hook is just used to stream data to the USB port. */
void vApplicationIdleHook(void)
|
{
static portTickType xLastTx = 0;
char cTxByte;
if( ( xTaskGetTickCount() - xLastTx ) > mainUSB_TX_FREQUENCY )
{
xLastTx = xTaskGetTickCount();
for( cTxByte = mainFIRST_TX_CHAR; cTxByte <= mainLAST_TX_CHAR; cTxByte++ )
{
vUSBSendByte( cTxByte );
} }
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Supply EMMC card with lowest clock frequency at initialization. */
|
EFI_STATUS EmmcPeimHcInitClockFreq(IN UINTN Bar)
|
/* Supply EMMC card with lowest clock frequency at initialization. */
EFI_STATUS EmmcPeimHcInitClockFreq(IN UINTN Bar)
|
{
EFI_STATUS Status;
EMMC_HC_SLOT_CAP Capability;
UINT32 InitFreq;
Status = EmmcPeimHcGetCapability (Bar, &Capability);
if (EFI_ERROR (Status)) {
return Status;
}
if (Capability.BaseClkFreq == 0) {
return EFI_UNSUPPORTED;
}
InitFreq = 400;
Status = EmmcPeimHcClockSupply (Bar, InitFreq);
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.