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
|
|---|---|---|---|---|---|---|---|
/* Command that dumps registers of one or all of the PPCs. */
|
static int cmd_ppc_dump(const struct shell *sh, size_t argc, char **argv)
|
/* Command that dumps registers of one or all of the PPCs. */
static int cmd_ppc_dump(const struct shell *sh, size_t argc, char **argv)
|
{
int ret = 0;
if (argc <= 1) {
DT_FOREACH_STATUS_OKAY_VARGS(usb_c_connector, CALL_IF_HAS_PPC, ppc_dump_regs);
} else {
const struct device *dev = device_get_binding(argv[1]);
ret = ppc_dump_regs(dev);
}
return ret;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Function for disabling all interrupts before jumping from bootloader to application. */
|
static void interrupts_disable(void)
|
/* Function for disabling all interrupts before jumping from bootloader to application. */
static void interrupts_disable(void)
|
{
uint32_t interrupt_setting_mask;
uint32_t irq;
interrupt_setting_mask = NVIC->ISER[0];
for (irq = 0; irq < MAX_NUMBER_INTERRUPTS; irq++)
{
if (interrupt_setting_mask & (IRQ_ENABLED << irq))
{
NVIC_DisableIRQ((IRQn_Type)irq);
}
}
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Once a read transaction is completed and the FIFO drained, another transaction can be started from the next address by calling this function again. */
|
void EPINonBlockingReadStart(unsigned long ulBase, unsigned long ulChannel, unsigned long ulCount)
|
/* Once a read transaction is completed and the FIFO drained, another transaction can be started from the next address by calling this function again. */
void EPINonBlockingReadStart(unsigned long ulBase, unsigned long ulChannel, unsigned long ulCount)
|
{
unsigned long ulOffset;
ASSERT(ulBase == EPI0_BASE);
ASSERT(ulChannel < 2);
ASSERT(ulCount < 4096);
ulOffset = ulChannel * (EPI_O_RPSTD1 - EPI_O_RPSTD0);
HWREG(ulBase + EPI_O_RPSTD0 + ulOffset) = ulCount;
}
|
watterott/WebRadio
|
C++
| null | 71
|
/* In command mode and transport mode we need to look for sense data in different places. The sense data itself is allways an array of 32 bytes, so we can unify the sense data access for both modes. */
|
char* dasd_get_sense(struct irb *irb)
|
/* In command mode and transport mode we need to look for sense data in different places. The sense data itself is allways an array of 32 bytes, so we can unify the sense data access for both modes. */
char* dasd_get_sense(struct irb *irb)
|
{
struct tsb *tsb = NULL;
char *sense = NULL;
if (scsw_is_tm(&irb->scsw) && (irb->scsw.tm.fcxs == 0x01)) {
if (irb->scsw.tm.tcw)
tsb = tcw_get_tsb((struct tcw *)(unsigned long)
irb->scsw.tm.tcw);
if (tsb && tsb->length == 64 && tsb->flags)
switch (tsb->flags & 0x07) {
case 1:
sense = tsb->tsa.iostat.sense;
break;
case 2:
sense = tsb->tsa.ddpc.sense;
break;
default:
break;
}
} else if (irb->esw.esw0.erw.cons) {
sense = irb->ecw;
}
return sense;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* __vxge_hw_device_pci_e_init Initialize certain PCI/PCI-X configuration registers with recommended values. Save config space for future hw resets. */
|
void __vxge_hw_device_pci_e_init(struct __vxge_hw_device *hldev)
|
/* __vxge_hw_device_pci_e_init Initialize certain PCI/PCI-X configuration registers with recommended values. Save config space for future hw resets. */
void __vxge_hw_device_pci_e_init(struct __vxge_hw_device *hldev)
|
{
u16 cmd = 0;
pci_read_config_word(hldev->pdev, PCI_COMMAND, &cmd);
cmd |= 0x140;
pci_write_config_word(hldev->pdev, PCI_COMMAND, cmd);
pci_save_state(hldev->pdev);
return;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Fills each GPIO_InitStruct member with its default value. */
|
void GPIO_StructInit(GPIO_InitTypeDef *GPIO_InitStruct)
|
/* Fills each GPIO_InitStruct member with its default value. */
void GPIO_StructInit(GPIO_InitTypeDef *GPIO_InitStruct)
|
{
GPIO_InitStruct->GPIO_Pin = GPIO_Pin_All;
GPIO_InitStruct->GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStruct->GPIO_Speed = GPIO_Speed_Level_2;
GPIO_InitStruct->GPIO_OType = GPIO_OType_PP;
GPIO_InitStruct->GPIO_PuPd = GPIO_PuPd_NOPULL;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Return the count of scancode in the queue. */
|
UINTN GetScancodeBufCount(IN SCAN_CODE_QUEUE *Queue)
|
/* Return the count of scancode in the queue. */
UINTN GetScancodeBufCount(IN SCAN_CODE_QUEUE *Queue)
|
{
if (Queue->Head <= Queue->Tail) {
return Queue->Tail - Queue->Head;
} else {
return Queue->Tail + KEYBOARD_SCAN_CODE_MAX_COUNT - Queue->Head;
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Clear Stall for USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
|
void USBD_ClrStallEP(uint32_t EPNum)
|
/* Clear Stall for USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
void USBD_ClrStallEP(uint32_t EPNum)
|
{
return;
}
if (ep_dir != 0U) {
NRF_USBD->EPSTALL = ep_num | USBD_EPSTALL_IO_Msk;
} else {
NRF_USBD->EPSTALL = ep_num;
}
USBD_ResetEP(EPNum);
}
|
ARMmbed/DAPLink
|
C++
|
Apache License 2.0
| 2,140
|
/* XXX: Should we check if rx is enabled before setting rxdp ? */
|
void ath5k_hw_set_rxdp(struct ath5k_hw *ah, u32 phys_addr)
|
/* XXX: Should we check if rx is enabled before setting rxdp ? */
void ath5k_hw_set_rxdp(struct ath5k_hw *ah, u32 phys_addr)
|
{
ATH5K_TRACE(ah->ah_sc);
ath5k_hw_reg_write(ah, phys_addr, AR5K_RXDP);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* i2o_pci_exit - unregisters I2O PCI driver from PCI subsystem */
|
void __exit i2o_pci_exit(void)
|
/* i2o_pci_exit - unregisters I2O PCI driver from PCI subsystem */
void __exit i2o_pci_exit(void)
|
{
pci_unregister_driver(&i2o_pci_driver);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* UART MSP Initialization This function configures the hardware resources used in this example. */
|
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
|
/* UART MSP Initialization This function configures the hardware resources used in this example. */
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
|
{
GPIO_InitTypeDef GPIO_InitStruct = {0};
if(huart->Instance==USART2)
{
__HAL_RCC_USART2_CLK_ENABLE();
__HAL_RCC_GPIOA_CLK_ENABLE();
GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3;
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
GPIO_InitStruct.Alternate = GPIO_AF1_USART2;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
}
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Restart the responder on all services without instance. */
|
static void _mdns_restart_all_pcbs_no_instance()
|
/* Restart the responder on all services without instance. */
static void _mdns_restart_all_pcbs_no_instance()
|
{
size_t srv_count = 0;
mdns_srv_item_t * a = _mdns_server->services;
while (a) {
if (!a->service->instance) {
srv_count++;
}
a = a->next;
}
if (!srv_count) {
return;
}
mdns_srv_item_t * services[srv_count];
size_t i = 0;
a = _mdns_server->services;
while (a) {
if (!a->service->instance) {
services[i++] = a;
}
a = a->next;
}
_mdns_probe_all_pcbs(services, srv_count, false, true);
}
|
retro-esp32/RetroESP32
|
C++
|
Creative Commons Attribution Share Alike 4.0 International
| 581
|
/* Initialize the RTC. Enable pre-scaler to scale RTC clock to 1Hz and clear interrupt/status registers. */
|
static void bfin_rtc_reset(struct device *dev, u16 rtc_ictl)
|
/* Initialize the RTC. Enable pre-scaler to scale RTC clock to 1Hz and clear interrupt/status registers. */
static void bfin_rtc_reset(struct device *dev, u16 rtc_ictl)
|
{
struct bfin_rtc *rtc = dev_get_drvdata(dev);
dev_dbg_stamp(dev);
bfin_rtc_sync_pending(dev);
bfin_write_RTC_PREN(0x1);
bfin_write_RTC_ICTL(rtc_ictl);
bfin_write_RTC_ALARM(0);
bfin_write_RTC_ISTAT(0xFFFF);
rtc->rtc_wrote_regs = 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Reads and returns the current value of CR2. This function is only available on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on x64. */
|
UINTN EFIAPI AsmReadCr2(VOID)
|
/* Reads and returns the current value of CR2. This function is only available on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on x64. */
UINTN EFIAPI AsmReadCr2(VOID)
|
{
__asm {
mov eax, cr2
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Change Logs: Date Author Notes Meco Man implement exit() and abort() Meco Man add system() */
|
void __exit(int status)
|
/* Change Logs: Date Author Notes Meco Man implement exit() and abort() Meco Man add system() */
void __exit(int status)
|
{
extern void __rt_libc_exit(int status);
__rt_libc_exit(status);
while(1);
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Implementations are responsible to call this method from the of the thread that the monitor was created in. */
|
void g_file_monitor_emit_event(GFileMonitor *monitor, GFile *child, GFile *other_file, GFileMonitorEvent event_type)
|
/* Implementations are responsible to call this method from the of the thread that the monitor was created in. */
void g_file_monitor_emit_event(GFileMonitor *monitor, GFile *child, GFile *other_file, GFileMonitorEvent event_type)
|
{
g_return_if_fail (G_IS_FILE_MONITOR (monitor));
g_return_if_fail (G_IS_FILE (child));
g_return_if_fail (!other_file || G_IS_FILE (other_file));
if (monitor->priv->cancelled)
return;
g_signal_emit (monitor, g_file_monitor_changed_signal, 0, child, other_file, event_type);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Returns: one of the enum vxge_hw_status{} enumerated types. VXGE_HW_OK - for success. VXGE_HW_ERR_CRITICAL - when encounters critical error. */
|
enum vxge_hw_status vxge_hw_ring_handle_tcode(struct __vxge_hw_ring *ring, void *rxdh, u8 t_code)
|
/* Returns: one of the enum vxge_hw_status{} enumerated types. VXGE_HW_OK - for success. VXGE_HW_ERR_CRITICAL - when encounters critical error. */
enum vxge_hw_status vxge_hw_ring_handle_tcode(struct __vxge_hw_ring *ring, void *rxdh, u8 t_code)
|
{
struct __vxge_hw_channel *channel;
enum vxge_hw_status status = VXGE_HW_OK;
channel = &ring->channel;
if (t_code == 0 || t_code == 5) {
status = VXGE_HW_OK;
goto exit;
}
if (t_code > 0xF) {
status = VXGE_HW_ERR_INVALID_TCODE;
goto exit;
}
ring->stats->rxd_t_code_err_cnt[t_code]++;
exit:
return status;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* s3c2410fb_set_par - Alters the hardware state. @info: frame buffer structure that represents a single frame buffer */
|
static int s3c2410fb_set_par(struct fb_info *info)
|
/* s3c2410fb_set_par - Alters the hardware state. @info: frame buffer structure that represents a single frame buffer */
static int s3c2410fb_set_par(struct fb_info *info)
|
{
struct fb_var_screeninfo *var = &info->var;
switch (var->bits_per_pixel) {
case 32:
case 16:
case 12:
info->fix.visual = FB_VISUAL_TRUECOLOR;
break;
case 1:
info->fix.visual = FB_VISUAL_MONO01;
break;
default:
info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
break;
}
info->fix.line_length = (var->xres_virtual * var->bits_per_pixel) / 8;
s3c2410fb_activate_var(info);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Read and write a data element from and to the SPI interface. */
|
unsigned long SPISingleDataReadWrite(unsigned long ulBase, unsigned long ulWData)
|
/* Read and write a data element from and to the SPI interface. */
unsigned long SPISingleDataReadWrite(unsigned long ulBase, unsigned long ulWData)
|
{
unsigned long ulFlag, ulReadTemp;
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE));
ulFlag = xHWREG(ulBase + SPI_FCR) & SPI_FCR_FIFOEN;
if(ulFlag != SPI_FCR_FIFOEN)
{
while(!(xHWREG(ulBase + SPI_SR) & SPI_SR_TXE))
{
}
}
else
{
while(!(xHWREG(ulBase + SPI_SR) & SPI_SR_TXBE))
{
}
}
xHWREG(ulBase + SPI_DR) = ulWData;
while(!(xHWREG(ulBase + SPI_SR) & SPI_SR_RXBNE))
{
}
ulReadTemp = xHWREG(ulBase + SPI_DR);
return ulReadTemp;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Get the processor signature and platform ID for current processor. */
|
VOID EFIAPI GetProcessorMicrocodeCpuId(EDKII_PEI_MICROCODE_CPU_ID *MicrocodeCpuId)
|
/* Get the processor signature and platform ID for current processor. */
VOID EFIAPI GetProcessorMicrocodeCpuId(EDKII_PEI_MICROCODE_CPU_ID *MicrocodeCpuId)
|
{
MSR_IA32_PLATFORM_ID_REGISTER PlatformIdMsr;
ASSERT (MicrocodeCpuId != NULL);
PlatformIdMsr.Uint64 = AsmReadMsr64 (MSR_IA32_PLATFORM_ID);
MicrocodeCpuId->PlatformId = (UINT8)PlatformIdMsr.Bits.PlatformId;
AsmCpuid (CPUID_VERSION_INFO, &MicrocodeCpuId->ProcessorSignature, NULL, NULL, NULL);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Note that you have to return all objects to the mempool again before calling i2o_pool_free(). */
|
void i2o_pool_free(struct i2o_pool *pool)
|
/* Note that you have to return all objects to the mempool again before calling i2o_pool_free(). */
void i2o_pool_free(struct i2o_pool *pool)
|
{
mempool_destroy(pool->mempool);
kmem_cache_destroy(pool->slab);
kfree(pool->name);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* PE calls this function to check if the Power Supply is at the requested level. */
|
static bool port0_policy_cb_is_ps_ready(const struct device *dev)
|
/* PE calls this function to check if the Power Supply is at the requested level. */
static bool port0_policy_cb_is_ps_ready(const struct device *dev)
|
{
struct port0_data_t *dpm_data = usbc_get_dpm_data(dev);
return dpm_data->ps_ready;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Fills each UART_FIFOInitStruct member with its default value: */
|
void UART_FIFOConfigStructInit(UART_FIFO_CFG_Type *UART_FIFOInitStruct)
|
/* Fills each UART_FIFOInitStruct member with its default value: */
void UART_FIFOConfigStructInit(UART_FIFO_CFG_Type *UART_FIFOInitStruct)
|
{
UART_FIFOInitStruct->FIFO_DMAMode = DISABLE;
UART_FIFOInitStruct->FIFO_Level = UART_FIFO_TRGLEV0;
UART_FIFOInitStruct->FIFO_ResetRxBuf = ENABLE;
UART_FIFOInitStruct->FIFO_ResetTxBuf = ENABLE;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Register busses defined in command line but that are not registered with omap_register_i2c_bus from board initialization code. */
|
static int __init omap_register_i2c_bus_cmdline(void)
|
/* Register busses defined in command line but that are not registered with omap_register_i2c_bus from board initialization code. */
static int __init omap_register_i2c_bus_cmdline(void)
|
{
int i, err = 0;
for (i = 0; i < ARRAY_SIZE(i2c_rate); i++)
if (i2c_rate[i] & OMAP_I2C_CMDLINE_SETUP) {
i2c_rate[i] &= ~OMAP_I2C_CMDLINE_SETUP;
err = omap_i2c_add_bus(i + 1);
if (err)
goto out;
}
out:
return err;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* nilfs_forget_buffer - discard dirty state @inode: owner inode of the buffer @bh: buffer head of the buffer to be discarded */
|
void nilfs_forget_buffer(struct buffer_head *bh)
|
/* nilfs_forget_buffer - discard dirty state @inode: owner inode of the buffer @bh: buffer head of the buffer to be discarded */
void nilfs_forget_buffer(struct buffer_head *bh)
|
{
struct page *page = bh->b_page;
lock_buffer(bh);
clear_buffer_nilfs_volatile(bh);
clear_buffer_dirty(bh);
if (nilfs_page_buffers_clean(page))
__nilfs_clear_page_dirty(page);
clear_buffer_uptodate(bh);
clear_buffer_mapped(bh);
bh->b_blocknr = -1;
ClearPageUptodate(page);
ClearPageMappedToDisk(page);
unlock_buffer(bh);
brelse(bh);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Just figures out what the actual struct drm_device associated with @dev is and calls its resume hook, if present. */
|
static int drm_class_resume(struct device *dev)
|
/* Just figures out what the actual struct drm_device associated with @dev is and calls its resume hook, if present. */
static int drm_class_resume(struct device *dev)
|
{
if (dev->type == &drm_sysfs_device_minor) {
struct drm_minor *drm_minor = to_drm_minor(dev);
struct drm_device *drm_dev = drm_minor->dev;
if (drm_minor->type == DRM_MINOR_LEGACY &&
!drm_core_check_feature(drm_dev, DRIVER_MODESET) &&
drm_dev->driver->resume)
return drm_dev->driver->resume(drm_dev);
}
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Read BMA222 acceleration data.
Along with the actual sensor data, the LSB byte contains a "new" flag indicating if the data for this axis has been updated since the last time the axis data was read. Reading either LSB or MSB data will clear this flag. */
|
static bool bma222_get_accel(sensor_hal_t *hal, sensor_data_t *data)
|
/* Read BMA222 acceleration data.
Along with the actual sensor data, the LSB byte contains a "new" flag indicating if the data for this axis has been updated since the last time the axis data was read. Reading either LSB or MSB data will clear this flag. */
static bool bma222_get_accel(sensor_hal_t *hal, sensor_data_t *data)
|
{
size_t const count = sensor_bus_read(hal, hal->burst_addr,
event_regs.acc, sizeof(event_regs.acc));
format_axis_data(hal, event_regs.acc, data);
return (count == sizeof(event_regs.acc));
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* Enables a device specific interrupt in the NVIC interrupt controller. */
|
void CORTEX_NVIC_EnableIRQ(IRQn_Type IRQn)
|
/* Enables a device specific interrupt in the NVIC interrupt controller. */
void CORTEX_NVIC_EnableIRQ(IRQn_Type IRQn)
|
{
assert_parameters(IS_CORTEX_NVIC_DEVICE_IRQ(IRQn));
NVIC_EnableIRQ(IRQn);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Helper for event waits. Used to implement the legacy event waiting ioctls in terms of events */
|
int vt_waitactive(int n)
|
/* Helper for event waits. Used to implement the legacy event waiting ioctls in terms of events */
int vt_waitactive(int n)
|
{
struct vt_event_wait vw;
do {
if (n == fg_console + 1)
break;
vw.event.event = VT_EVENT_SWITCH;
vt_event_wait(&vw);
if (vw.done == 0)
return -EINTR;
} while (vw.event.newev != n);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Configure Tx Descriptor Arbiter and credits for each traffic class. */
|
s32 ixgbe_dcb_config_tx_desc_arbiter(struct ixgbe_hw *hw, struct ixgbe_dcb_config *dcb_config)
|
/* Configure Tx Descriptor Arbiter and credits for each traffic class. */
s32 ixgbe_dcb_config_tx_desc_arbiter(struct ixgbe_hw *hw, struct ixgbe_dcb_config *dcb_config)
|
{
s32 ret = 0;
if (hw->mac.type == ixgbe_mac_82598EB)
ret = ixgbe_dcb_config_tx_desc_arbiter_82598(hw, dcb_config);
else if (hw->mac.type == ixgbe_mac_82599EB)
ret = ixgbe_dcb_config_tx_desc_arbiter_82599(hw, dcb_config);
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Clears a message object so that it is no longer used. */
|
void CANMessageClear(uint32_t ui32Base, uint32_t ui32ObjID)
|
/* Clears a message object so that it is no longer used. */
void CANMessageClear(uint32_t ui32Base, uint32_t ui32ObjID)
|
{
ASSERT(_CANBaseValid(ui32Base));
ASSERT((ui32ObjID >= 1) && (ui32ObjID <= 32));
while(HWREG(ui32Base + CAN_O_IF1CRQ) & CAN_IF1CRQ_BUSY)
{
}
HWREG(ui32Base + CAN_O_IF1CMSK) = CAN_IF1CMSK_WRNRD | CAN_IF1CMSK_ARB;
HWREG(ui32Base + CAN_O_IF1ARB1) = 0;
HWREG(ui32Base + CAN_O_IF1ARB2) = 0;
HWREG(ui32Base + CAN_O_IF1CRQ) = ui32ObjID & CAN_IF1CRQ_MNUM_M;
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Get the Mac address in to the address specified. The mac register contents are read and written to buffer passed. */
|
s32 synopGMAC_get_mac_addr(synopGMACdevice *gmacdev, u32 MacHigh, u32 MacLow, u8 *MacAddr)
|
/* Get the Mac address in to the address specified. The mac register contents are read and written to buffer passed. */
s32 synopGMAC_get_mac_addr(synopGMACdevice *gmacdev, u32 MacHigh, u32 MacLow, u8 *MacAddr)
|
{
u32 data;
data = synopGMACReadReg(gmacdev->MacBase, MacHigh);
MacAddr[5] = (data >> 8) & 0xff;
MacAddr[4] = (data) & 0xff;
data = synopGMACReadReg(gmacdev->MacBase, MacLow);
MacAddr[3] = (data >> 24) & 0xff;
MacAddr[2] = (data >> 16) & 0xff;
MacAddr[1] = (data >> 8) & 0xff;
MacAddr[0] = (data) & 0xff;
return 0;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* If the value falls outside this range, it will be converted to LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL. */
|
EFI_STATUS EFIAPI FmpDeviceSetImageWithStatus(IN CONST VOID *Image, IN UINTN ImageSize, IN CONST VOID *VendorCode OPTIONAL, IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS Progress OPTIONAL, IN UINT32 CapsuleFwVersion, OUT CHAR16 **AbortReason, OUT UINT32 *LastAttemptStatus)
|
/* If the value falls outside this range, it will be converted to LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL. */
EFI_STATUS EFIAPI FmpDeviceSetImageWithStatus(IN CONST VOID *Image, IN UINTN ImageSize, IN CONST VOID *VendorCode OPTIONAL, IN EFI_FIRMWARE_MANAGEMENT_UPDATE_IMAGE_PROGRESS Progress OPTIONAL, IN UINT32 CapsuleFwVersion, OUT CHAR16 **AbortReason, OUT UINT32 *LastAttemptStatus)
|
{
*LastAttemptStatus = LAST_ATTEMPT_STATUS_SUCCESS;
return EFI_UNSUPPORTED;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* resync the stream on the next media packet with specified properties */
|
static int64_t gxf_resync_media(AVFormatContext *s, uint64_t max_interval, int track, int timestamp)
|
/* resync the stream on the next media packet with specified properties */
static int64_t gxf_resync_media(AVFormatContext *s, uint64_t max_interval, int track, int timestamp)
|
{
url_fseek(pb, last_pos, SEEK_SET);
goto start;
}
get_byte(pb);
cur_track = get_byte(pb);
cur_timestamp = get_be32(pb);
last_found_pos = url_ftell(pb) - 16 - 6;
if ((track >= 0 && track != cur_track) || (timestamp >= 0 && timestamp > cur_timestamp)) {
url_fseek(pb, last_pos, SEEK_SET);
goto start;
}
out:
if (last_found_pos)
url_fseek(pb, last_found_pos, SEEK_SET);
return cur_timestamp;
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* Fills each spiConfig member with its default value. */
|
void SPI_ConfigStructInit(SPI_Config_T *spiConfig)
|
/* Fills each spiConfig member with its default value. */
void SPI_ConfigStructInit(SPI_Config_T *spiConfig)
|
{
spiConfig->mode = SPI_MODE_SLAVE;
spiConfig->length = SPI_DATA_LENGTH_8B;
spiConfig->phase = SPI_CLKPHA_1EDGE;
spiConfig->polarity = SPI_CLKPOL_HIGH;
spiConfig->slaveSelect = SPI_SSC_DISABLE;
spiConfig->firstBit = SPI_FIRST_BIT_MSB;
spiConfig->direction = SPI_DIRECTION_2LINES_FULLDUPLEX;
spiConfig->baudrateDiv = SPI_BAUDRATE_DIV_2;
spiConfig->crcPolynomial = 7;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Note that the current set of intents only apply to the very last component of the path. We check for this using LOOKUP_CONTINUE and LOOKUP_PARENT. */
|
static unsigned int nfs_lookup_check_intent(struct nameidata *nd, unsigned int mask)
|
/* Note that the current set of intents only apply to the very last component of the path. We check for this using LOOKUP_CONTINUE and LOOKUP_PARENT. */
static unsigned int nfs_lookup_check_intent(struct nameidata *nd, unsigned int mask)
|
{
if (nd->flags & (LOOKUP_CONTINUE|LOOKUP_PARENT))
return 0;
return nd->flags & mask;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* 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==USART1)
{
__HAL_RCC_USART1_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_9|GPIO_PIN_10);
HAL_NVIC_DisableIRQ(USART1_IRQn);
}
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* z_decomp_free - Free the memory used by a decompressor. */
|
static void z_decomp_free(void *state)
|
/* z_decomp_free - Free the memory used by a decompressor. */
static void z_decomp_free(void *state)
|
{
struct ppp_deflate_state *state = (struct ppp_deflate_state *) arg;
if (state) {
zlib_inflateEnd(&state->strm);
kfree(state->strm.workspace);
kfree(state);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function makes @surface release the reference to its device. The function is intended to be used for avoiding cycling references for surfaces that are owned by their device, for example cache surfaces. Note that the @surface will still assume that the device is available. So it is the caller's responsibility to ensure the device stays around until the @surface is destroyed. Just calling cairo_surface_finish() is not enough. */
|
void _cairo_surface_release_device_reference(cairo_surface_t *surface)
|
/* This function makes @surface release the reference to its device. The function is intended to be used for avoiding cycling references for surfaces that are owned by their device, for example cache surfaces. Note that the @surface will still assume that the device is available. So it is the caller's responsibility to ensure the device stays around until the @surface is destroyed. Just calling cairo_surface_finish() is not enough. */
void _cairo_surface_release_device_reference(cairo_surface_t *surface)
|
{
assert (surface->owns_device);
cairo_device_destroy (surface->device);
surface->owns_device = FALSE;
}
|
xboot/xboot
|
C++
|
MIT License
| 779
|
/* USB Device Request - Setup Stage Parameters: None Return Value: None */
|
void USBD_SetupStage(void)
|
/* USB Device Request - Setup Stage Parameters: None Return Value: None */
void USBD_SetupStage(void)
|
{
USBD_ReadEP(0x00, (U8 *)&USBD_SetupPacket, sizeof(USBD_SetupPacket));
}
|
ARMmbed/DAPLink
|
C++
|
Apache License 2.0
| 2,140
|
/* Get the touch screen X and Y positions values. */
|
void mfxstm32l152_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y)
|
/* Get the touch screen X and Y positions values. */
void mfxstm32l152_TS_GetXY(uint16_t DeviceAddr, uint16_t *X, uint16_t *Y)
|
{
uint8_t data_xy[3];
MFX_IO_ReadMultiple(DeviceAddr, MFXSTM32L152_TS_XY_DATA, data_xy, sizeof(data_xy)) ;
*X = (data_xy[1]<<4) + (data_xy[0]>>4);
*Y = (data_xy[2]<<4) + (data_xy[0]&4);
MFX_IO_Write(DeviceAddr, MFXSTM32L152_TS_FIFO_TH, MFXSTM32L152_TS_CLEAR_FIFO);
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Caution: This function may receive untrusted input. PE/COFF image is external input, so this function will make sure the PE/COFF image content read is within the image buffer. */
|
EFI_STATUS EFIAPI DxeTpmMeasureBootLibImageRead(IN VOID *FileHandle, IN UINTN FileOffset, IN OUT UINTN *ReadSize, OUT VOID *Buffer)
|
/* Caution: This function may receive untrusted input. PE/COFF image is external input, so this function will make sure the PE/COFF image content read is within the image buffer. */
EFI_STATUS EFIAPI DxeTpmMeasureBootLibImageRead(IN VOID *FileHandle, IN UINTN FileOffset, IN OUT UINTN *ReadSize, OUT VOID *Buffer)
|
{
UINTN EndPosition;
if ((FileHandle == NULL) || (ReadSize == NULL) || (Buffer == NULL)) {
return EFI_INVALID_PARAMETER;
}
if (MAX_ADDRESS - FileOffset < *ReadSize) {
return EFI_INVALID_PARAMETER;
}
EndPosition = FileOffset + *ReadSize;
if (EndPosition > mTpmImageSize) {
*ReadSize = (UINT32)(mTpmImageSize - FileOffset);
}
if (FileOffset >= mTpmImageSize) {
*ReadSize = 0;
}
CopyMem (Buffer, (UINT8 *)((UINTN)FileHandle + FileOffset), *ReadSize);
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Change Logs: Date Author Notes RT-Thread First version xqyjlj perf rt_hw_interrupt_disable/enable */
|
void resource_id_init(resource_id_t *mgr, int size, void **res)
|
/* Change Logs: Date Author Notes RT-Thread First version xqyjlj perf rt_hw_interrupt_disable/enable */
void resource_id_init(resource_id_t *mgr, int size, void **res)
|
{
if (mgr)
{
mgr->size = size;
mgr->_res = res;
mgr->noused = 0;
mgr->_free = RT_NULL;
rt_spin_lock_init(&(mgr->spinlock));
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This service enables PEIMs to create various types of HOBs. */
|
EFI_STATUS EFIAPI PeiServicesCreateHob(IN UINT16 Type, IN UINT16 Length, OUT VOID **Hob)
|
/* This service enables PEIMs to create various types of HOBs. */
EFI_STATUS EFIAPI PeiServicesCreateHob(IN UINT16 Type, IN UINT16 Length, OUT VOID **Hob)
|
{
ASSERT (FALSE);
return EFI_OUT_OF_RESOURCES;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Enables or disables the USART's Smart Card mode. */
|
void USART_SmartCardCmd(USART_TypeDef *USARTx, FunctionalState NewState)
|
/* Enables or disables the USART's Smart Card mode. */
void USART_SmartCardCmd(USART_TypeDef *USARTx, FunctionalState NewState)
|
{
assert_param(IS_USART_1_PERIPH(USARTx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
USARTx->CR3 |= USART_CR3_SCEN;
}
else
{
USARTx->CR3 &= (uint32_t)~((uint32_t)USART_CR3_SCEN);
}
}
|
ajhc/demo-cortex-m3
|
C++
| null | 38
|
/* Initialize re200b sensor in order to detect motion. */
|
void re200b_motion_detect_init(uint32_t ul_acc_minus, uint32_t ul_acc_plus)
|
/* Initialize re200b sensor in order to detect motion. */
void re200b_motion_detect_init(uint32_t ul_acc_minus, uint32_t ul_acc_plus)
|
{
pmc_enable_periph_clk(ID_ACC);
acc_init(ACC, ul_acc_plus, ul_acc_minus, ACC_MR_EDGETYP_ANY, ACC_MR_INV_DIS);
acc_get_interrupt_status(ACC);
g_compare_result = CMP_EQUAL;
g_ul_compare_event_flag = false;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Draws a square HSB (hue, saturation, brightness) chart. */
|
void hsbchartRender(uint16_t x, uint16_t y, uint16_t size, uint16_t baseColor, theme_t theme)
|
/* Draws a square HSB (hue, saturation, brightness) chart. */
void hsbchartRender(uint16_t x, uint16_t y, uint16_t size, uint16_t baseColor, theme_t theme)
|
{
uint32_t delta;
uint16_t colorS;
uint16_t color;
uint32_t b;
uint32_t s;
drawRectangle(x, y, x+size, y+size, theme.colorBorderDarker);
if (size > 2)
{
delta = 10000/(size-2);
for (b = 0; b<size-1; b++)
{
colorS = colorsAlphaBlend(COLOR_WHITE, baseColor, 100 - (b*delta) / 100);
for (s = 0; s<size-1; s++)
{
color = colorsAlphaBlend(colorS, COLOR_BLACK, 100 - (s*delta) / 100);
drawPixel(x+b+1, y+s+1, color);
}
}
}
}
|
microbuilder/LPC1343CodeBase
|
C++
|
Other
| 73
|
/* Populate a TID_RELEASE WR. The skb must be already propely sized. */
|
static void mk_tid_release(struct sk_buff *skb, unsigned int tid)
|
/* Populate a TID_RELEASE WR. The skb must be already propely sized. */
static void mk_tid_release(struct sk_buff *skb, unsigned int tid)
|
{
struct cpl_tid_release *req;
skb->priority = CPL_PRIORITY_SETUP;
req = (struct cpl_tid_release *)__skb_put(skb, sizeof(*req));
req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD));
OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_TID_RELEASE, tid));
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function will silently fail if the fifo is full. */
|
static void fifo_icap_fifo_write(struct hwicap_drvdata *drvdata, u32 data)
|
/* This function will silently fail if the fifo is full. */
static void fifo_icap_fifo_write(struct hwicap_drvdata *drvdata, u32 data)
|
{
dev_dbg(drvdata->dev, "fifo_write: %x\n", data);
out_be32(drvdata->base_address + XHI_WF_OFFSET, data);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Set the EEPROM access request bit and wait for EEPROM access grant bit. Return successful if access grant bit set, else clear the request for EEPROM access and return -E1000_ERR_NVM (-1). */
|
s32 e1000e_acquire_nvm(struct e1000_hw *hw)
|
/* Set the EEPROM access request bit and wait for EEPROM access grant bit. Return successful if access grant bit set, else clear the request for EEPROM access and return -E1000_ERR_NVM (-1). */
s32 e1000e_acquire_nvm(struct e1000_hw *hw)
|
{
u32 eecd = er32(EECD);
s32 timeout = E1000_NVM_GRANT_ATTEMPTS;
ew32(EECD, eecd | E1000_EECD_REQ);
eecd = er32(EECD);
while (timeout) {
if (eecd & E1000_EECD_GNT)
break;
udelay(5);
eecd = er32(EECD);
timeout--;
}
if (!timeout) {
eecd &= ~E1000_EECD_REQ;
ew32(EECD, eecd);
e_dbg("Could not acquire NVM grant\n");
return -E1000_ERR_NVM;
}
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* The status line is the last line of the screen. It shows the string "console view" in the lower left corner and "Running"/"More..."/"Holding" in the lower right corner of the screen. */
|
static void con3270_update_status(struct con3270 *cp)
|
/* The status line is the last line of the screen. It shows the string "console view" in the lower left corner and "Running"/"More..."/"Holding" in the lower right corner of the screen. */
static void con3270_update_status(struct con3270 *cp)
|
{
char *str;
str = (cp->nr_up != 0) ? "History" : "Running";
memcpy(cp->status->string + 24, str, 7);
codepage_convert(cp->view.ascebc, cp->status->string + 24, 7);
cp->update_flags |= CON_UPDATE_STATUS;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* this function will flush buffer on a file descriptor. */
|
int dfs_file_flush(struct dfs_file *fd)
|
/* this function will flush buffer on a file descriptor. */
int dfs_file_flush(struct dfs_file *fd)
|
{
if (fd == NULL)
return -EINVAL;
if (fd->vnode->fops->flush == NULL)
return -ENOSYS;
return fd->vnode->fops->flush(fd);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* This internal function retrieves Smbus PPI from PPI database. */
|
EFI_PEI_SMBUS2_PPI* InternalGetSmbusPpi(VOID)
|
/* This internal function retrieves Smbus PPI from PPI database. */
EFI_PEI_SMBUS2_PPI* InternalGetSmbusPpi(VOID)
|
{
EFI_STATUS Status;
EFI_PEI_SMBUS2_PPI *SmbusPpi;
Status = PeiServicesLocatePpi (&gEfiPeiSmbus2PpiGuid, 0, NULL, (VOID **)&SmbusPpi);
ASSERT_EFI_ERROR (Status);
ASSERT (SmbusPpi != NULL);
return SmbusPpi;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* I2C MSP De-Initialization This function frees the hardware resources used in this example: */
|
void HAL_I2C_MspDeInit(I2C_HandleTypeDef *hi2c)
|
/* I2C MSP De-Initialization This function frees the hardware resources used in this example: */
void HAL_I2C_MspDeInit(I2C_HandleTypeDef *hi2c)
|
{
static DMA_HandleTypeDef hdma_tx;
static DMA_HandleTypeDef hdma_rx;
I2Cx_FORCE_RESET();
I2Cx_RELEASE_RESET();
HAL_GPIO_DeInit(I2Cx_SCL_GPIO_PORT, I2Cx_SCL_PIN);
HAL_GPIO_DeInit(I2Cx_SDA_GPIO_PORT, I2Cx_SDA_PIN);
HAL_DMA_DeInit(&hdma_tx);
HAL_DMA_DeInit(&hdma_rx);
HAL_NVIC_DisableIRQ(I2Cx_DMA_TX_IRQn);
HAL_NVIC_DisableIRQ(I2Cx_DMA_RX_IRQn);
HAL_NVIC_DisableIRQ(I2Cx_ER_IRQn);
HAL_NVIC_DisableIRQ(I2Cx_EV_IRQn);
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Find the timer_user block for this owner. This just returns a pointer to the block, or NULL. */
|
static timer_user* ICACHE_RAM_ATTR find_tu(os_param_t owner)
|
/* Find the timer_user block for this owner. This just returns a pointer to the block, or NULL. */
static timer_user* ICACHE_RAM_ATTR find_tu(os_param_t owner)
|
{
if ((*p)->owner == owner) {
timer_user *result = *p;
UNLOCK();
return result;
}
}
for (p = &active; *p; p = &((*p)->next)) {
if ((*p)->owner == owner) {
timer_user *result = *p;
UNLOCK();
return result;
}
}
UNLOCK();
return NULL;
}
|
nodemcu/nodemcu-firmware
|
C++
|
MIT License
| 7,566
|
/* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */
|
void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
|
/* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
|
{
if(hadc->Instance==ADC1)
{
__HAL_RCC_ADC1_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_0|GPIO_PIN_3);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Read the bad block marker inside a spare area buffer using the given scheme. */
|
void nand_flash_spare_scheme_read_bad_block_marker(const struct nand_flash_spare_scheme *scheme, const uint8_t *spare, uint8_t *marker)
|
/* Read the bad block marker inside a spare area buffer using the given scheme. */
void nand_flash_spare_scheme_read_bad_block_marker(const struct nand_flash_spare_scheme *scheme, const uint8_t *spare, uint8_t *marker)
|
{
*marker = spare[scheme->bad_block_marker_position];
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Initialize kernel memory slab subsystem.
Perform any initialization of memory slabs that wasn't done at build time. Currently this just involves creating the list of free blocks for each slab. */
|
static int create_free_list(struct k_mem_slab *slab)
|
/* Initialize kernel memory slab subsystem.
Perform any initialization of memory slabs that wasn't done at build time. Currently this just involves creating the list of free blocks for each slab. */
static int create_free_list(struct k_mem_slab *slab)
|
{
uint32_t j;
char *p;
CHECKIF(((slab->info.block_size | (uintptr_t)slab->buffer) &
(sizeof(void *) - 1)) != 0U) {
return -EINVAL;
}
slab->free_list = NULL;
p = slab->buffer;
for (j = 0U; j < slab->info.num_blocks; j++) {
*(char **)p = slab->free_list;
slab->free_list = p;
p += slab->info.block_size;
}
return 0;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* param base eLCDIF peripheral base address. param config Pointer to the configuration structure. */
|
void ELCDIF_SetAlphaSurfaceBufferConfig(LCDIF_Type *base, const elcdif_as_buffer_config_t *config)
|
/* param base eLCDIF peripheral base address. param config Pointer to the configuration structure. */
void ELCDIF_SetAlphaSurfaceBufferConfig(LCDIF_Type *base, const elcdif_as_buffer_config_t *config)
|
{
assert(NULL != config);
base->AS_CTRL = (base->AS_CTRL & ~LCDIF_AS_CTRL_FORMAT_MASK) | LCDIF_AS_CTRL_FORMAT(config->pixelFormat);
base->AS_BUF = ELCDIF_ADDR_CPU_2_IP(config->bufferAddr);
base->AS_NEXT_BUF = ELCDIF_ADDR_CPU_2_IP(config->bufferAddr);
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* We could optimize the case where the cache argument is not BCACHE but that seems very atypical use ... */
|
SYSCALL_DEFINE3(cacheflush, unsigned long, addr, unsigned long, bytes, unsigned int, cache)
|
/* We could optimize the case where the cache argument is not BCACHE but that seems very atypical use ... */
SYSCALL_DEFINE3(cacheflush, unsigned long, addr, unsigned long, bytes, unsigned int, cache)
|
{
if (bytes == 0)
return 0;
if (!access_ok(VERIFY_WRITE, (void __user *) addr, bytes))
return -EFAULT;
flush_icache_range(addr, addr + bytes);
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* megasas_read_fw_status_reg_ppc - returns the current FW status value @regs: MFI register set */
|
static u32 megasas_read_fw_status_reg_ppc(struct megasas_register_set __iomem *regs)
|
/* megasas_read_fw_status_reg_ppc - returns the current FW status value @regs: MFI register set */
static u32 megasas_read_fw_status_reg_ppc(struct megasas_register_set __iomem *regs)
|
{
return readl(&(regs)->outbound_scratch_pad);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* wdrtas_timer_start starts the watchdog by calling the RTAS function set-interval (surveillance) */
|
static void wdrtas_timer_start(void)
|
/* wdrtas_timer_start starts the watchdog by calling the RTAS function set-interval (surveillance) */
static void wdrtas_timer_start(void)
|
{
wdrtas_set_interval(wdrtas_interval);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* process a list of expirable mountpoints with the intent of discarding any submounts of a specific parent mountpoint */
|
static void shrink_submounts(struct vfsmount *mnt, struct list_head *umounts)
|
/* process a list of expirable mountpoints with the intent of discarding any submounts of a specific parent mountpoint */
static void shrink_submounts(struct vfsmount *mnt, struct list_head *umounts)
|
{
LIST_HEAD(graveyard);
struct vfsmount *m;
while (select_submounts(mnt, &graveyard)) {
while (!list_empty(&graveyard)) {
m = list_first_entry(&graveyard, struct vfsmount,
mnt_expire);
touch_mnt_namespace(m->mnt_ns);
umount_tree(m, 1, umounts);
}
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* create an endpoint for communication The socket function creates a socket that is bound to a specific transport service provider. This function is called by the application layer to obtain a socket handle.
socket */
|
INT16 CC3000_EXPORT() socket(INT32 domain, INT32 type, INT32 protocol)
|
/* create an endpoint for communication The socket function creates a socket that is bound to a specific transport service provider. This function is called by the application layer to obtain a socket handle.
socket */
INT16 CC3000_EXPORT() socket(INT32 domain, INT32 type, INT32 protocol)
|
{
INT32 ret;
UINT8 *ptr, *args;
ret = EFAIL;
ptr = tSLInformation.pucTxCommandBuffer;
args = (ptr + HEADERS_SIZE_CMD);
args = UINT32_TO_STREAM(args, domain);
args = UINT32_TO_STREAM(args, type);
args = UINT32_TO_STREAM(args, protocol);
hci_command_send(HCI_CMND_SOCKET, ptr, SOCKET_OPEN_PARAMS_LEN);
SimpleLinkWaitEvent(HCI_CMND_SOCKET, &ret);
CC3000_EXPORT(errno) = ret;
set_socket_active_status(ret, SOCKET_STATUS_ACTIVE);
return(ret);
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* The pin is specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
|
void GPIOPinTypePECIRx(unsigned long ulPort, unsigned char ucPins)
|
/* The pin is specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinTypePECIRx(unsigned long ulPort, unsigned char ucPins)
|
{
ASSERT(GPIOBaseValid(ulPort));
GPIODirModeSet(ulPort, ucPins, GPIO_DIR_MODE_IN);
GPIOPadConfigSet(ulPort, ucPins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_ANALOG);
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* Disable the write protection of the desired sectors, for the first 1 Mb of the FMC. */
|
void FMC_OPT_DisableWriteProtect(FMC_OPT_WRP_T wrp)
|
/* Disable the write protection of the desired sectors, for the first 1 Mb of the FMC. */
void FMC_OPT_DisableWriteProtect(FMC_OPT_WRP_T wrp)
|
{
FMC_STATUS_T status = FMC_COMPLETE;
status = FMC_WaitForLastOperation();
if (status == FMC_COMPLETE)
{
*(__IO uint16_t *)(OPTCTRL_BYTE2_ADDRESS) |= (uint16_t)wrp;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Sets the specified data holding register value for DAC channel1. */
|
void DAC_ConfigChannel1Data(DAC_DATA_ALIGN_T dataAlign, uint16_t data)
|
/* Sets the specified data holding register value for DAC channel1. */
void DAC_ConfigChannel1Data(DAC_DATA_ALIGN_T dataAlign, uint16_t data)
|
{
__IO uint32_t tmp = 0;
tmp = (uint32_t)DAC_BASE;
tmp += DH12RCH1_OFFSET + dataAlign;
*(__IO uint32_t*) tmp = data;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Called by hardware driver to signal that the controller is down and unavailable for use. */
|
void capi_ctr_down(struct capi_ctr *card)
|
/* Called by hardware driver to signal that the controller is down and unavailable for use. */
void capi_ctr_down(struct capi_ctr *card)
|
{
u16 appl;
DBG("");
if (card->cardstate == CARD_DETECTED)
return;
card->cardstate = CARD_DETECTED;
memset(card->manu, 0, sizeof(card->manu));
memset(&card->version, 0, sizeof(card->version));
memset(&card->profile, 0, sizeof(card->profile));
memset(card->serial, 0, sizeof(card->serial));
for (appl = 1; appl <= CAPI_MAXAPPL; appl++) {
struct capi20_appl *ap = get_capi_appl_by_nr(appl);
if (!ap || ap->release_in_progress)
continue;
capi_ctr_put(card);
}
printk(KERN_NOTICE "kcapi: card [%03d] down.\n", card->cnr);
notify_push(KCI_CONTRDOWN, card->cnr, 0, 0);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Flush all other CPU's tlb and then mine. Do this with on_each_cpu() as we want to ensure all TLB's flushed before proceeding. */
|
void smp_flush_tlb_all(void)
|
/* Flush all other CPU's tlb and then mine. Do this with on_each_cpu() as we want to ensure all TLB's flushed before proceeding. */
void smp_flush_tlb_all(void)
|
{
on_each_cpu(flush_tlb_all_local, NULL, 1);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* 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 PciExpressBitFieldAndThenOr8(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 PciExpressBitFieldAndThenOr8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData, IN UINT8 OrData)
|
{
ASSERT_INVALID_PCI_ADDRESS (Address);
return MmioBitFieldAndThenOr8 (
(UINTN)GetPciExpressBaseAddress () + Address,
StartBit,
EndBit,
AndData,
OrData
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Event handler for the library USB Connection event. */
|
void EVENT_USB_Device_Connect(void)
|
/* Event handler for the library USB Connection event. */
void EVENT_USB_Device_Connect(void)
|
{
PulseMSRemaining.PingPongLEDPulse = PING_PONG_LED_PULSE_MS;
LEDs_SetAllLEDs(LEDMASK_TX);
}
|
prusa3d/Prusa-Firmware-Buddy
|
C++
|
Other
| 1,019
|
/* applesmc_write_key - writes len bytes from buffer to a given key. Returns zero on success or a negative error on failure. Callers must hold applesmc_lock. */
|
static int applesmc_write_key(const char *key, u8 *buffer, u8 len)
|
/* applesmc_write_key - writes len bytes from buffer to a given key. Returns zero on success or a negative error on failure. Callers must hold applesmc_lock. */
static int applesmc_write_key(const char *key, u8 *buffer, u8 len)
|
{
int i;
if (len > APPLESMC_MAX_DATA_LENGTH) {
printk(KERN_ERR "applesmc_write_key: cannot write more than "
"%d bytes\n", APPLESMC_MAX_DATA_LENGTH);
return -EINVAL;
}
if (send_command(APPLESMC_WRITE_CMD))
return -EIO;
for (i = 0; i < 4; i++) {
outb(key[i], APPLESMC_DATA_PORT);
if (__wait_status(0x04))
return -EIO;
}
outb(len, APPLESMC_DATA_PORT);
for (i = 0; i < len; i++) {
if (__wait_status(0x04))
return -EIO;
outb(buffer[i], APPLESMC_DATA_PORT);
}
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Each protocol-specific driver should call this routine when it does not (or can no longer) handle events, or when its module is unloaded. */
|
void mpt_event_deregister(u8 cb_idx)
|
/* Each protocol-specific driver should call this routine when it does not (or can no longer) handle events, or when its module is unloaded. */
void mpt_event_deregister(u8 cb_idx)
|
{
if (!cb_idx || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS)
return;
MptEvHandlers[cb_idx] = NULL;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* The function is used to check JPEG engine not busy. */
|
static BOOL _jpegIsReady(void)
|
/* The function is used to check JPEG engine not busy. */
static BOOL _jpegIsReady(void)
|
{
if (g_bWait == FALSE)
return TRUE;
else
return FALSE;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Function to convert an nRF51 error code to a DFU Response Value.
This function will convert a given nRF51 error code to a DFU Response Value. The result of this function depends on the current DFU procedure in progress, given as input in current_dfu_proc parameter. */
|
static ble_dfu_resp_val_t nrf_err_code_translate(uint32_t err_code, const ble_dfu_procedure_t current_dfu_proc)
|
/* Function to convert an nRF51 error code to a DFU Response Value.
This function will convert a given nRF51 error code to a DFU Response Value. The result of this function depends on the current DFU procedure in progress, given as input in current_dfu_proc parameter. */
static ble_dfu_resp_val_t nrf_err_code_translate(uint32_t err_code, const ble_dfu_procedure_t current_dfu_proc)
|
{
switch (err_code)
{
case NRF_SUCCESS:
return BLE_DFU_RESP_VAL_SUCCESS;
case NRF_ERROR_INVALID_STATE:
return BLE_DFU_RESP_VAL_INVALID_STATE;
case NRF_ERROR_NOT_SUPPORTED:
return BLE_DFU_RESP_VAL_NOT_SUPPORTED;
case NRF_ERROR_DATA_SIZE:
return BLE_DFU_RESP_VAL_DATA_SIZE;
case NRF_ERROR_INVALID_DATA:
if (current_dfu_proc == BLE_DFU_VALIDATE_PROCEDURE)
{
return BLE_DFU_RESP_VAL_CRC_ERROR;
}
return BLE_DFU_RESP_VAL_OPER_FAILED;
default:
return BLE_DFU_RESP_VAL_OPER_FAILED;
}
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Gets the states of the RTS modem control signals and trigger level.
The */
|
unsigned long UARTModemControlGet(unsigned long ulBase)
|
/* Gets the states of the RTS modem control signals and trigger level.
The */
unsigned long UARTModemControlGet(unsigned long ulBase)
|
{
unsigned long ulRal = 0;
xASSERT(UARTBaseValid(ulBase));
ulRal = xHWREG(ulBase + USART_MCR) & (~USART_MCR_HFC_EN);
return ulRal;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Allow READ/WRITE during grace period on recovered state only for files that are not able to provide mandatory locking. */
|
static int grace_disallows_io(struct inode *inode)
|
/* Allow READ/WRITE during grace period on recovered state only for files that are not able to provide mandatory locking. */
static int grace_disallows_io(struct inode *inode)
|
{
return locks_in_grace() && mandatory_lock(inode);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This function adds the local private key (DER-encoded or PEM-encoded or PKCS#8 private key) into the specified TLS object for TLS negotiation. */
|
EFI_STATUS EFIAPI TlsSetHostPrivateKey(IN VOID *Tls, IN VOID *Data, IN UINTN DataSize)
|
/* This function adds the local private key (DER-encoded or PEM-encoded or PKCS#8 private key) into the specified TLS object for TLS negotiation. */
EFI_STATUS EFIAPI TlsSetHostPrivateKey(IN VOID *Tls, IN VOID *Data, IN UINTN DataSize)
|
{
CALL_CRYPTO_SERVICE (TlsSetHostPrivateKey, (Tls, Data, DataSize), EFI_UNSUPPORTED);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
|
UINT16 EFIAPI PciExpressBitFieldOr16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 OrData)
|
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT16 EFIAPI PciExpressBitFieldOr16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 OrData)
|
{
if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) {
return (UINT16)-1;
}
return MmioBitFieldOr16 (
GetPciExpressAddress (Address),
StartBit,
EndBit,
OrData
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Enables the control endpoint STALL after a SETUP packet reception. */
|
static void main_usb_stall_after_setup_packet(void)
|
/* Enables the control endpoint STALL after a SETUP packet reception. */
static void main_usb_stall_after_setup_packet(void)
|
{
udd_enable_stall_handshake(0);
udd_ack_setup_received(0);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* The call to cgroup_lock() in the freezer.state write method prevents a write to that file racing against an attach, and hence the can_attach() result will remain valid until the attach completes. */
|
static int freezer_can_attach(struct cgroup_subsys *ss, struct cgroup *new_cgroup, struct task_struct *task, bool threadgroup)
|
/* The call to cgroup_lock() in the freezer.state write method prevents a write to that file racing against an attach, and hence the can_attach() result will remain valid until the attach completes. */
static int freezer_can_attach(struct cgroup_subsys *ss, struct cgroup *new_cgroup, struct task_struct *task, bool threadgroup)
|
{
struct freezer *freezer;
if (is_task_frozen_enough(task))
return -EBUSY;
freezer = cgroup_freezer(new_cgroup);
if (freezer->state == CGROUP_FROZEN)
return -EBUSY;
if (threadgroup) {
struct task_struct *c;
rcu_read_lock();
list_for_each_entry_rcu(c, &task->thread_group, thread_group) {
if (is_task_frozen_enough(c)) {
rcu_read_unlock();
return -EBUSY;
}
}
rcu_read_unlock();
}
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Proper method for turning of LCD module. It must be used, otherwise we might damage LCD crystals in the long run! */
|
void lcdOff()
|
/* Proper method for turning of LCD module. It must be used, otherwise we might damage LCD crystals in the long run! */
void lcdOff()
|
{
WAIT_FOR_DMA_END();
lcdWriteCommand(0xAE);
delay_ms(3);
}
|
opentx/opentx
|
C++
|
GNU General Public License v2.0
| 2,025
|
/* NOTE: Please use ioremap + __raw_read/write where possible instead of these */
|
u8 omap_readb(u32 pa)
|
/* NOTE: Please use ioremap + __raw_read/write where possible instead of these */
u8 omap_readb(u32 pa)
|
{
if (cpu_class_is_omap1())
return __raw_readb(OMAP1_IO_ADDRESS(pa));
else
return __raw_readb(OMAP2_L4_IO_ADDRESS(pa));
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Enable rng. The random number generator is enabled. */
|
void rng_enable(void)
|
/* Enable rng. The random number generator is enabled. */
void rng_enable(void)
|
{
RNG_CR |= RNG_CR_RNGEN;
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Stops the radio if no other PAL is making use of it. */
|
void uwb_radio_stop(struct uwb_pal *pal)
|
/* Stops the radio if no other PAL is making use of it. */
void uwb_radio_stop(struct uwb_pal *pal)
|
{
struct uwb_rc *rc = pal->rc;
mutex_lock(&rc->uwb_dev.mutex);
if (pal->channel) {
rc->active_pals--;
uwb_radio_change_channel(rc, uwb_radio_select_channel(rc));
pal->channel = 0;
}
mutex_unlock(&rc->uwb_dev.mutex);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* initialize the runtime service curve with the given internal service curve starting at (x, y). */
|
static void rtsc_init(struct runtime_sc *rtsc, struct internal_sc *isc, u64 x, u64 y)
|
/* initialize the runtime service curve with the given internal service curve starting at (x, y). */
static void rtsc_init(struct runtime_sc *rtsc, struct internal_sc *isc, u64 x, u64 y)
|
{
rtsc->x = x;
rtsc->y = y;
rtsc->sm1 = isc->sm1;
rtsc->ism1 = isc->ism1;
rtsc->dx = isc->dx;
rtsc->dy = isc->dy;
rtsc->sm2 = isc->sm2;
rtsc->ism2 = isc->ism2;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This function send the RNDIS command through the device's Data endpoint */
|
EFI_STATUS RndisTransmitDataMsg(IN USB_RNDIS_DEVICE *UsbRndisDevice, IN REMOTE_NDIS_MSG_HEADER *RndisMsg, IN OUT UINTN *TransferLength)
|
/* This function send the RNDIS command through the device's Data endpoint */
EFI_STATUS RndisTransmitDataMsg(IN USB_RNDIS_DEVICE *UsbRndisDevice, IN REMOTE_NDIS_MSG_HEADER *RndisMsg, IN OUT UINTN *TransferLength)
|
{
EFI_STATUS Status;
UINT32 UsbStatus;
if (UsbRndisDevice->BulkInEndpoint == 0) {
GetEndpoint (UsbRndisDevice->UsbIoCdcData, UsbRndisDevice);
}
PrintRndisMsg (RndisMsg);
Status = UsbRndisDevice->UsbIoCdcData->UsbBulkTransfer (
UsbRndisDevice->UsbIoCdcData,
UsbRndisDevice->BulkOutEndpoint,
RndisMsg,
TransferLength,
USB_TX_ETHERNET_BULK_TIMEOUT,
&UsbStatus
);
if (Status == EFI_SUCCESS) {
gStopBulkInCnt = MAXIMUM_STOPBULKIN_CNT;
}
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Returns the newly built instance of #CRSelEng of NULL if an error occurs. */
|
CRSelEng* cr_sel_eng_new(void)
|
/* Returns the newly built instance of #CRSelEng of NULL if an error occurs. */
CRSelEng* cr_sel_eng_new(void)
|
{
CRSelEng *result = NULL;
result = g_try_malloc (sizeof (CRSelEng));
if (!result) {
cr_utils_trace_info ("Out of memory");
return NULL;
}
memset (result, 0, sizeof (CRSelEng));
PRIVATE (result) = g_try_malloc (sizeof (CRSelEngPriv));
if (!PRIVATE (result)) {
cr_utils_trace_info ("Out of memory");
g_free (result);
return NULL;
}
memset (PRIVATE (result), 0, sizeof (CRSelEngPriv));
cr_sel_eng_register_pseudo_class_sel_handler
(result, (guchar *) "first-child",
IDENT_PSEUDO, (CRPseudoClassSelectorHandler)
first_child_pseudo_class_handler);
cr_sel_eng_register_pseudo_class_sel_handler
(result, (guchar *) "lang",
FUNCTION_PSEUDO, (CRPseudoClassSelectorHandler)
lang_pseudo_class_handler);
return result;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* virtqueue_add_consumed_buffer - Returns consumed buffer back to VirtIO queue */
|
int virtqueue_add_consumed_buffer(struct virtqueue *vq, uint16_t head_idx, uint32_t len)
|
/* virtqueue_add_consumed_buffer - Returns consumed buffer back to VirtIO queue */
int virtqueue_add_consumed_buffer(struct virtqueue *vq, uint16_t head_idx, uint32_t len)
|
{
struct vring_used_elem *used_desc = NULL;
uint16_t used_idx;
if (head_idx > vq->vq_nentries) {
return ERROR_VRING_NO_BUFF;
}
VQUEUE_BUSY(vq);
used_idx = vq->vq_ring.used->idx & (vq->vq_nentries - 1);
used_desc = &vq->vq_ring.used->ring[used_idx];
used_desc->id = head_idx;
used_desc->len = len;
atomic_thread_fence(memory_order_seq_cst);
vq->vq_ring.used->idx++;
VQUEUE_IDLE(vq);
return VQUEUE_SUCCESS;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Src and Dst are in network byte order, and Len is in host byte order. */
|
UINT16 EFIAPI NetPseudoHeadChecksum(IN IP4_ADDR Src, IN IP4_ADDR Dst, IN UINT8 Proto, IN UINT16 Len)
|
/* Src and Dst are in network byte order, and Len is in host byte order. */
UINT16 EFIAPI NetPseudoHeadChecksum(IN IP4_ADDR Src, IN IP4_ADDR Dst, IN UINT8 Proto, IN UINT16 Len)
|
{
NET_PSEUDO_HDR Hdr;
ZeroMem (&Hdr, sizeof (Hdr));
Hdr.SrcIp = Src;
Hdr.DstIp = Dst;
Hdr.Protocol = Proto;
Hdr.Len = HTONS (Len);
return NetblockChecksum ((UINT8 *)&Hdr, sizeof (Hdr));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This file is part of the Simba project. */
|
int mock_write_log_module_init(int res)
|
/* This file is part of the Simba project. */
int mock_write_log_module_init(int res)
|
{
harness_mock_write("log_module_init()",
NULL,
0);
harness_mock_write("log_module_init(): return (res)",
&res,
sizeof(res));
return (0);
}
|
eerimoq/simba
|
C++
|
Other
| 337
|
/* Separate data from status in case they are read together. */
|
static int32_t cn0414_filter_status(struct cn0414_dev *dev, uint32_t data_status, uint32_t *data_only)
|
/* Separate data from status in case they are read together. */
static int32_t cn0414_filter_status(struct cn0414_dev *dev, uint32_t data_status, uint32_t *data_only)
|
{
ad717x_st_reg *reg;
AD717X_ReadRegister(dev->ad4111_device, AD717X_IFMODE_REG);
reg = AD717X_GetReg(dev->ad4111_device, AD717X_IFMODE_REG);
if(!reg)
return -1;
*data_only = data_status >> 8;
if(reg->value & AD717X_IFMODE_REG_DATA_WL16)
*data_only &= 0xffff;
else
*data_only &= 0xffffff;
return 0;
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* LZ4F_createDecompressionContext() : Create a decompressionContext object, which will track all decompression operations. Provides a pointer to a fully allocated and initialized LZ4F_decompressionContext object. Object can later be released using LZ4F_freeDecompressionContext(). */
|
LZ4F_errorCode_t LZ4F_createDecompressionContext(LZ4F_dctx **LZ4F_decompressionContextPtr, unsigned versionNumber)
|
/* LZ4F_createDecompressionContext() : Create a decompressionContext object, which will track all decompression operations. Provides a pointer to a fully allocated and initialized LZ4F_decompressionContext object. Object can later be released using LZ4F_freeDecompressionContext(). */
LZ4F_errorCode_t LZ4F_createDecompressionContext(LZ4F_dctx **LZ4F_decompressionContextPtr, unsigned versionNumber)
|
{
LZ4F_dctx* const dctx = (LZ4F_dctx*)ALLOC_AND_ZERO(sizeof(LZ4F_dctx));
if (dctx==NULL) return err0r(LZ4F_ERROR_GENERIC);
dctx->version = versionNumber;
*LZ4F_decompressionContextPtr = dctx;
return LZ4F_OK_NoError;
}
|
xboot/xboot
|
C++
|
MIT License
| 779
|
/* Returns a property with the given name from the given node. */
|
CONST struct fdt_property* EFIAPI FdtGetProperty(IN CONST VOID *Fdt, IN INT32 NodeOffset, IN CONST CHAR8 *Name, IN INT32 *Length)
|
/* Returns a property with the given name from the given node. */
CONST struct fdt_property* EFIAPI FdtGetProperty(IN CONST VOID *Fdt, IN INT32 NodeOffset, IN CONST CHAR8 *Name, IN INT32 *Length)
|
{
return fdt_get_property (Fdt, NodeOffset, Name, Length);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Do what every setup is needed on image and the reboot code buffer to allow us to avoid allocations later. */
|
int machine_kexec_prepare(struct kimage *image)
|
/* Do what every setup is needed on image and the reboot code buffer to allow us to avoid allocations later. */
int machine_kexec_prepare(struct kimage *image)
|
{
if (ppc_md.machine_kexec_prepare)
return ppc_md.machine_kexec_prepare(image);
else
return default_machine_kexec_prepare(image);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This function attach isr for the channel to SDMA lib. The isr will be called */
|
int32_t sdma_channel_isr_attach(uint32_t channel, sdma_channel_isr isr)
|
/* This function attach isr for the channel to SDMA lib. The isr will be called */
int32_t sdma_channel_isr_attach(uint32_t channel, sdma_channel_isr isr)
|
{
if (channel >= SDMA_NUM_CHANNELS) {
return SDMA_RETV_FAIL;
}
if (NULL == isr) {
return SDMA_RETV_NULLP;
}
sdma_channel_isr_list[channel] = isr;
return SDMA_RETV_SUCCESS;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Read data from Rx registers.
This function replaces the original SSIDataNonBlockingGet() API and performs the same actions. A macro is provided in */
|
unsigned long SPIRxRegisterGet(unsigned long ulBase, unsigned long *pulData, unsigned long ulCount)
|
/* Read data from Rx registers.
This function replaces the original SSIDataNonBlockingGet() API and performs the same actions. A macro is provided in */
unsigned long SPIRxRegisterGet(unsigned long ulBase, unsigned long *pulData, unsigned long ulCount)
|
{
unsigned long i;
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE)||(ulBase == SPI3_BASE) );
xASSERT(ulCount < 2);
for (i=0; i<ulCount; i++)
{
pulData[i] = xHWREG(ulBase + SPI_RX0 + 4*i);
}
return ulCount;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* hdaps_readb_one - reads a byte from a single I/O port, placing the value in the given pointer. Returns zero on success or a negative error on failure. Can sleep. */
|
static int hdaps_readb_one(unsigned int port, u8 *val)
|
/* hdaps_readb_one - reads a byte from a single I/O port, placing the value in the given pointer. Returns zero on success or a negative error on failure. Can sleep. */
static int hdaps_readb_one(unsigned int port, u8 *val)
|
{
int ret;
mutex_lock(&hdaps_mtx);
ret = __device_refresh_sync();
if (ret)
goto out;
*val = inb(port);
__device_complete();
out:
mutex_unlock(&hdaps_mtx);
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Enable the PWM interrupt of the PWM module.
The */
|
void PWMIntEnable(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
|
/* Enable the PWM interrupt of the PWM module.
The */
void PWMIntEnable(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
|
{
xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE) ||
(ulBase == PWMC_BASE));
if(ulBase == PWMA_BASE)
{
xASSERT((ulChannel >= 0) && (ulChannel <= 5));
}
else
{
xASSERT((ulChannel >= 0) && (ulChannel <= 1));
}
xASSERT((ulIntType == PWM_INT_CHXF) || (ulIntType == PWM_INT_TOF));
if (ulIntType == PWM_INT_TOF)
{
xHWREG(ulBase + TPM_SC) |= TPM_SC_TOIE;
}
else
{
xHWREG(ulBase + TPM_C0SC + 8 * ulChannel) |= TPM_CNSC_CHIE;
}
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* A buffer cannot be placed on two lists at the same time. */
|
void skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk)
|
/* A buffer cannot be placed on two lists at the same time. */
void skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk)
|
{
unsigned long flags;
spin_lock_irqsave(&list->lock, flags);
__skb_queue_head(list, newsk);
spin_unlock_irqrestore(&list->lock, flags);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.