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
|
|---|---|---|---|---|---|---|---|
/* The user Entry Point for module FvSimpleFileSystem. The user code starts with this function. */
|
EFI_STATUS EFIAPI FvSimpleFileSystemEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
|
/* The user Entry Point for module FvSimpleFileSystem. The user code starts with this function. */
EFI_STATUS EFIAPI FvSimpleFileSystemEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
|
{
EFI_STATUS Status;
Status = EfiLibInstallDriverBindingComponentName2 (
ImageHandle,
SystemTable,
&mDriverBinding,
ImageHandle,
&gFvSimpleFileSystemComponentName,
&gFvSimpleFileSystemComponentName2
);
ASSERT_EFI_ERROR (Status);
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This file is released under the GNU GPL v2. */
|
static void umc_device_release(struct device *dev)
|
/* This file is released under the GNU GPL v2. */
static void umc_device_release(struct device *dev)
|
{
struct umc_dev *umc = to_umc_dev(dev);
kfree(umc);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* s3c_pm_resume_gpio() - restore gpio chip data after suspend @ourchip: The suspended chip. */
|
static void s3c_pm_resume_gpio(struct s3c_gpio_chip *ourchip)
|
/* s3c_pm_resume_gpio() - restore gpio chip data after suspend @ourchip: The suspended chip. */
static void s3c_pm_resume_gpio(struct s3c_gpio_chip *ourchip)
|
{
struct s3c_gpio_pm *pm = ourchip->pm;
if (pm == NULL || pm->resume == NULL)
S3C_PMDBG("%s: no pm for %s\n", __func__, ourchip->chip.label);
else
pm->resume(ourchip);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Atomic bitwise NAND primitive.
is atomically bitwise NAND'ed with the value at <target>, placing the result at <target>, and the previous value at <target> is returned. */
|
atomic_val_t z_impl_atomic_nand(atomic_t *target, atomic_val_t value)
|
/* Atomic bitwise NAND primitive.
is atomically bitwise NAND'ed with the value at <target>, placing the result at <target>, and the previous value at <target> is returned. */
atomic_val_t z_impl_atomic_nand(atomic_t *target, atomic_val_t value)
|
{
k_spinlock_key_t key;
atomic_val_t ret;
key = k_spin_lock(&lock);
ret = *target;
*target = ~(*target & value);
k_spin_unlock(&lock, key);
return ret;
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Setup the NVIC, LED outputs, and button inputs. */
|
static void prvSetupHardware(void)
|
/* Setup the NVIC, LED outputs, and button inputs. */
static void prvSetupHardware(void)
|
{
PORTE_PCR26 = PORT_PCR_MUX( 1 ) | PORT_PCR_IRQC( 0xA ) | PORT_PCR_PE_MASK | PORT_PCR_PS_MASK;
enable_irq( mainGPIO_E_VECTOR );
set_irq_priority( mainGPIO_E_VECTOR, configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY );
PORTA_PCR10 = ( 0 | PORT_PCR_MUX( 1 ) );
PORTA_PCR11 = ( 0 | PORT_PCR_MUX( 1 ) );
PORTA_PCR28 = ( 0 | PORT_PCR_MUX( 1 ) );
PORTA_PCR29 = ( 0 | PORT_PCR_MUX( 1 ) );
GPIOA_PDDR=GPIO_PDDR_PDD( mainTASK_CONTROLLED_LED | mainTIMER_CONTROLLED_LED );
GPIOA_PTOR = ~0U;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Returns: (transfer none): the #GParamSpec for the property of the interface with the name @property_name, or NULL if no such property exists. */
|
GParamSpec* g_object_interface_find_property(gpointer g_iface, const gchar *property_name)
|
/* Returns: (transfer none): the #GParamSpec for the property of the interface with the name @property_name, or NULL if no such property exists. */
GParamSpec* g_object_interface_find_property(gpointer g_iface, const gchar *property_name)
|
{
GTypeInterface *iface_class = g_iface;
g_return_val_if_fail (G_TYPE_IS_INTERFACE (iface_class->g_type), NULL);
g_return_val_if_fail (property_name != NULL, NULL);
return g_param_spec_pool_lookup (pspec_pool,
property_name,
iface_class->g_type,
FALSE);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* The Reference pressure value is a 16-bit data expressed as 2’s complement. The value is used when AUTOZERO or AUTORIFP function is enabled.. */
|
int32_t lps22hh_pressure_ref_set(stmdev_ctx_t *ctx, int16_t val)
|
/* The Reference pressure value is a 16-bit data expressed as 2’s complement. The value is used when AUTOZERO or AUTORIFP function is enabled.. */
int32_t lps22hh_pressure_ref_set(stmdev_ctx_t *ctx, int16_t val)
|
{
uint8_t buff[2];
int32_t ret;
buff[1] = (uint8_t) ((uint16_t)val / 256U);
buff[0] = (uint8_t) ((uint16_t)val - (buff[1] * 256U));
ret = lps22hh_write_reg(ctx, LPS22HH_REF_P_L, buff, 2);
return ret;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Returns: (transfer none): the filename of the module */
|
const gchar* g_module_name(GModule *module)
|
/* Returns: (transfer none): the filename of the module */
const gchar* g_module_name(GModule *module)
|
{
g_return_val_if_fail (module != NULL, NULL);
if (module == main_module)
return "main";
return module->file_name;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Get the CRC16 check result with the expected value. */
|
en_flag_status_t CRC_CRC16_GetCheckResult(uint16_t u16ExpectValue)
|
/* Get the CRC16 check result with the expected value. */
en_flag_status_t CRC_CRC16_GetCheckResult(uint16_t u16ExpectValue)
|
{
__IO uint32_t u32Count = CRC_CALC_CLK_COUNT;
en_flag_status_t enStatus;
uint32_t u32Expect_Value = u16ExpectValue;
u32Expect_Value = CRC_ConvertCrcValue(u32Expect_Value);
(void)CRC_WriteData16((uint16_t *)((void *)&u32Expect_Value), 1UL);
while (u32Count-- != 0UL) {
__NOP();
}
enStatus = CRC_GetResultStatus();
return enStatus;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* param handle The ENET handler pointer. This is the same handler pointer used in the ENET_Init. param isEnable Enable or disable flag. param ringId The ring index or ring number. retval kStatus_Success Succeed to enable/disable Tx reclaim. retval kStatus_Fail Fail to enable/disable Tx reclaim. */
|
status_t ENET_SetTxReclaim(enet_handle_t *handle, bool isEnable, uint8_t ringId)
|
/* param handle The ENET handler pointer. This is the same handler pointer used in the ENET_Init. param isEnable Enable or disable flag. param ringId The ring index or ring number. retval kStatus_Success Succeed to enable/disable Tx reclaim. retval kStatus_Fail Fail to enable/disable Tx reclaim. */
status_t ENET_SetTxReclaim(enet_handle_t *handle, bool isEnable, uint8_t ringId)
|
{
assert(handle != NULL);
assert(ringId < (uint8_t)FSL_FEATURE_ENET_QUEUE);
enet_tx_bd_ring_t *txBdRing = &handle->txBdRing[ringId];
enet_tx_dirty_ring_t *txDirtyRing = &handle->txDirtyRing[ringId];
status_t result = kStatus_Success;
if ((txDirtyRing->txGenIdx == txDirtyRing->txConsumIdx) && ENET_TxDirtyRingAvailable(txDirtyRing))
{
if (isEnable)
{
handle->txReclaimEnable[ringId] = true;
txBdRing->txConsumIdx = txBdRing->txGenIdx;
}
else
{
handle->txReclaimEnable[ringId] = false;
}
}
else
{
result = kStatus_Fail;
}
return result;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Returns if the channel number is in the valid range (0..31). */
|
static int kinetis_dma_ch_valid(int ch)
|
/* Returns if the channel number is in the valid range (0..31). */
static int kinetis_dma_ch_valid(int ch)
|
{
return ch >= 0 && ch < KINETIS_DMA_CH_NUM;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Selects the reverse operation to be performed on input data. */
|
void CRC_ReverseInputDataSelect(uint32_t CRC_ReverseInputData)
|
/* Selects the reverse operation to be performed on input data. */
void CRC_ReverseInputDataSelect(uint32_t CRC_ReverseInputData)
|
{
uint32_t tmpcr = 0;
assert_param(IS_CRC_REVERSE_INPUT_DATA(CRC_ReverseInputData));
tmpcr = CRC->CR;
tmpcr &= (uint32_t)~((uint32_t)CRC_CR_REV_IN);
tmpcr |= (uint32_t)CRC_ReverseInputData;
CRC->CR = (uint32_t)tmpcr;
}
|
ajhc/demo-cortex-m3
|
C++
| null | 38
|
/* Fills each RTC_InitStruct member with its default value. */
|
void RTC_StructInit(RTC_InitTypeDef *RTC_InitStruct)
|
/* Fills each RTC_InitStruct member with its default value. */
void RTC_StructInit(RTC_InitTypeDef *RTC_InitStruct)
|
{
RTC_InitStruct->RTC_HourFormat = RTC_HourFormat_24;
RTC_InitStruct->RTC_AsynchPrediv = (uint32_t)0x7F;
RTC_InitStruct->RTC_SynchPrediv = (uint32_t)0xFF;
}
|
ajhc/demo-cortex-m3
|
C++
| null | 38
|
/* Wait for the ready pin, after a command The timeout is catched later. */
|
void nand_wait_ready(struct mtd_info *mtd)
|
/* Wait for the ready pin, after a command The timeout is catched later. */
void nand_wait_ready(struct mtd_info *mtd)
|
{
struct nand_chip *chip = mtd->priv;
unsigned long timeo = jiffies + 2;
if (in_interrupt() || oops_in_progress)
return panic_nand_wait_ready(mtd, 400);
led_trigger_event(nand_led_trigger, LED_FULL);
do {
if (chip->dev_ready(mtd))
break;
touch_softlockup_watchdog();
} while (time_before(jiffies, timeo));
led_trigger_event(nand_led_trigger, LED_OFF);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* The total size of the config page used by this device (incl. desc) */
|
static unsigned desc_size(const struct kvm_device_desc *desc)
|
/* The total size of the config page used by this device (incl. desc) */
static unsigned desc_size(const struct kvm_device_desc *desc)
|
{
return sizeof(*desc)
+ desc->num_vq * sizeof(struct kvm_vqconfig)
+ desc->feature_len * 2
+ desc->config_len;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* retval kStatus_Success Enable Core Low Voltage Detect successfully. */
|
status_t SPC_EnableActiveModeCoreLowVoltageDetect(SPC_Type *base, bool enable)
|
/* retval kStatus_Success Enable Core Low Voltage Detect successfully. */
status_t SPC_EnableActiveModeCoreLowVoltageDetect(SPC_Type *base, bool enable)
|
{
status_t status = kStatus_Success;
if (enable)
{
base->ACTIVE_CFG |= SPC_ACTIVE_CFG_CORE_LVDE_MASK;
}
else
{
base->ACTIVE_CFG &= ~SPC_ACTIVE_CFG_CORE_LVDE_MASK;
}
return status;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* this function handles external lines 4 to 15 interrupt request */
|
void EXTI4_15_IRQHandler(void)
|
/* this function handles external lines 4 to 15 interrupt request */
void EXTI4_15_IRQHandler(void)
|
{
if (RESET != exti_interrupt_flag_get(TAMPER_KEY_EXTI_LINE)) {
gd_eval_ledtoggle(LED2);
exti_interrupt_flag_clear(TAMPER_KEY_EXTI_LINE);
}
}
|
liuxuming/trochili
|
C++
|
Apache License 2.0
| 132
|
/* Covert the input memory size to internal register set value. */
|
static status_t SEMC_CovertMemorySize(SEMC_Type *base, uint32_t size_kbytes, uint8_t *sizeConverted)
|
/* Covert the input memory size to internal register set value. */
static status_t SEMC_CovertMemorySize(SEMC_Type *base, uint32_t size_kbytes, uint8_t *sizeConverted)
|
{
assert(sizeConverted != NULL);
uint32_t memsize;
status_t status = kStatus_Success;
if ((size_kbytes < SEMC_BR_MEMSIZE_MIN) || (size_kbytes > SEMC_BR_MEMSIZE_MAX))
{
status = kStatus_SEMC_InvalidMemorySize;
}
else
{
*sizeConverted = 0U;
memsize = size_kbytes / 8U;
while (memsize != 0x00U)
{
memsize >>= 1U;
(*sizeConverted)++;
}
}
return status;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* Change Logs: Date Author Notes Jonas first version System Clock Configuration */
|
void SystemClock_Config(void)
|
/* Change Logs: Date Author Notes Jonas first version System Clock Configuration */
void SystemClock_Config(void)
|
{
SystemCoreClockUpdate();
SysTick_Config(SystemCoreClock / RT_TICK_PER_SECOND);
NVIC_SetPriority(SysTick_IRQn, 0);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Calculates and updates the day of the week to weekDay field of the supplied rtcTime_t object based on the other values (year, day, etc.) */
|
err_t rtcAssignWeekday(rtcTime_t *t)
|
/* Calculates and updates the day of the week to weekDay field of the supplied rtcTime_t object based on the other values (year, day, etc.) */
err_t rtcAssignWeekday(rtcTime_t *t)
|
{
uint32_t NrOfDay;
NrOfDay = rtcGetEpochDate(t->years, t->months, t->days);
t->weekdays = (NrOfDay + 3) % 7;
return ERROR_NONE;
}
|
microbuilder/LPC11U_LPC13U_CodeBase
|
C++
|
Other
| 54
|
/* Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the extended control register. */
|
void e1000e_reload_nvm(struct e1000_hw *hw)
|
/* Reloads the EEPROM by setting the "Reinitialize from EEPROM" bit in the extended control register. */
void e1000e_reload_nvm(struct e1000_hw *hw)
|
{
u32 ctrl_ext;
udelay(10);
ctrl_ext = er32(CTRL_EXT);
ctrl_ext |= E1000_CTRL_EXT_EE_RST;
ew32(CTRL_EXT, ctrl_ext);
e1e_flush();
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Disables CPU interrupts and returns the interrupt state prior to the disable operation. */
|
BOOLEAN EFIAPI SaveAndDisableInterrupts(VOID)
|
/* Disables CPU interrupts and returns the interrupt state prior to the disable operation. */
BOOLEAN EFIAPI SaveAndDisableInterrupts(VOID)
|
{
BOOLEAN InterruptState;
InterruptState = GetInterruptState ();
DisableInterrupts ();
return InterruptState;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* If 64-bit MMIO register operations are not supported, then ASSERT(). */
|
UINT64 EFIAPI S3MmioRead64(IN UINTN Address)
|
/* If 64-bit MMIO register operations are not supported, then ASSERT(). */
UINT64 EFIAPI S3MmioRead64(IN UINTN Address)
|
{
return InternalSaveMmioWrite64ValueToBootScript (Address, MmioRead64 (Address));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* if ack == I2C_ACK, ACK the byte so can continue reading, else send I2C_NOACK to end the read. */
|
static uchar i2c_gpio_read_byte(struct gpio_desc *scl, struct gpio_desc *sda, int delay, int ack)
|
/* if ack == I2C_ACK, ACK the byte so can continue reading, else send I2C_NOACK to end the read. */
static uchar i2c_gpio_read_byte(struct gpio_desc *scl, struct gpio_desc *sda, int delay, int ack)
|
{
int data;
int j;
i2c_gpio_sda_high(scl, sda, delay);
data = 0;
for (j = 0; j < 8; j++) {
data <<= 1;
data |= i2c_gpio_read_bit(scl, sda, delay);
}
i2c_gpio_send_ack(scl, sda, delay, ack);
return data;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Output: void, will modify proto_tree if not null. */
|
static void dissect_hello_ip_int_addr_clv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int id_length _U_, int length)
|
/* Output: void, will modify proto_tree if not null. */
static void dissect_hello_ip_int_addr_clv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int id_length _U_, int length)
|
{
isis_dissect_ip_int_clv(tree, pinfo, tvb, &ei_isis_hello_short_packet,
offset, length, hf_isis_hello_clv_ipv4_int_addr );
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Initializes the GPIO ports to act as buttons. */
|
void halButtonsInit(unsigned char buttonsMask)
|
/* Initializes the GPIO ports to act as buttons. */
void halButtonsInit(unsigned char buttonsMask)
|
{
BUTTON_PORT_OUT |= buttonsMask;
BUTTON_PORT_DIR &= ~buttonsMask;
BUTTON_PORT_REN |= buttonsMask;
BUTTON_PORT_SEL &= ~buttonsMask;
}
|
apopple/Pandaboard-FreeRTOS
|
C++
| null | 25
|
/* Puts a data element into the SPI transmit . */
|
void SPIDataPut(unsigned long ulBase, unsigned long ulData)
|
/* Puts a data element into the SPI transmit . */
void SPIDataPut(unsigned long ulBase, unsigned long ulData)
|
{
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE));
xASSERT(ulData < 256);
while(!(xHWREGB(ulBase + SPI_S) & SPI_S_SPTEF))
{
}
xHWREGB(ulBase + SPI_D) = (unsigned char)ulData;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Shutdown WAN device. o delete all not opened logical channels for this device o call driver's shutdown() entry point */
|
static int wanrouter_device_shutdown(struct wan_device *wandev)
|
/* Shutdown WAN device. o delete all not opened logical channels for this device o call driver's shutdown() entry point */
static int wanrouter_device_shutdown(struct wan_device *wandev)
|
{
struct net_device *dev;
int err=0;
if (wandev->state == WAN_UNCONFIGURED)
return 0;
printk(KERN_INFO "\n%s: Shutting Down!\n",wandev->name);
for (dev = wandev->dev; dev;) {
err = wanrouter_delete_interface(wandev, dev->name);
if (err)
return err;
dev = wandev->dev;
}
if (wandev->ndev)
return -EBUSY;
if (wandev->shutdown)
err=wandev->shutdown(wandev);
return err;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* param pfd PFD control name return PFD bypass status. */
|
bool CLOCK_IsSysPfdEnabled(clock_pfd_t pfd)
|
/* param pfd PFD control name return PFD bypass status. */
bool CLOCK_IsSysPfdEnabled(clock_pfd_t pfd)
|
{
return ((CCM_ANALOG->PFD_528 & (uint32_t)CCM_ANALOG_PFD_528_PFD0_CLKGATE_MASK << (8UL * (uint32_t)pfd)) == 0U);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* iucv_sock_wake_msglim() - Wake up thread waiting on msg limit */
|
static void iucv_sock_wake_msglim(struct sock *sk)
|
/* iucv_sock_wake_msglim() - Wake up thread waiting on msg limit */
static void iucv_sock_wake_msglim(struct sock *sk)
|
{
read_lock(&sk->sk_callback_lock);
if (sk_has_sleeper(sk))
wake_up_interruptible_all(sk->sk_sleep);
sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT);
read_unlock(&sk->sk_callback_lock);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* The low power link up (lplu) state is set to the power management level D0 and SmartSpeed is disabled when active is true, else clear lplu for D0 and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU is used during Dx states where the power conservation is most important. During driver activity, SmartSpeed should be enabled so performance is maintained. This is a function pointer entry point called by drivers. */
|
static s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active)
|
/* The low power link up (lplu) state is set to the power management level D0 and SmartSpeed is disabled when active is true, else clear lplu for D0 and enable Smartspeed. LPLU and Smartspeed are mutually exclusive. LPLU is used during Dx states where the power conservation is most important. During driver activity, SmartSpeed should be enabled so performance is maintained. This is a function pointer entry point called by drivers. */
static s32 e1000_set_d0_lplu_state(struct e1000_hw *hw, bool active)
|
{
if (hw->phy.ops.set_d0_lplu_state)
return hw->phy.ops.set_d0_lplu_state(hw, active);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Free local map (context should be freed before) if any */
|
void diva_free_dma_mapping(struct _diva_dma_map_entry *pmap)
|
/* Free local map (context should be freed before) if any */
void diva_free_dma_mapping(struct _diva_dma_map_entry *pmap)
|
{
diva_os_free (0, pmap);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Config the ADCs peripherals according to the specified parameters in the adcCommonConfig. */
|
void ADC_CommonConfig(ADC_CommonConfig_T *adcCommonConfig)
|
/* Config the ADCs peripherals according to the specified parameters in the adcCommonConfig. */
void ADC_CommonConfig(ADC_CommonConfig_T *adcCommonConfig)
|
{
ADC->CCTRL_B.ADCMSEL = adcCommonConfig->mode;
ADC->CCTRL_B.ADCPRE = adcCommonConfig->prescaler;
ADC->CCTRL_B.DMAMODE = adcCommonConfig->accessMode;
ADC->CCTRL_B.SMPDEL2 = adcCommonConfig->twoSampling;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Gives the transmission collision count. returns the transmission collision count indicating number of collisions occured before the frame was transmitted. Make sure to check excessive collision didnot happen to ensure the count is valid. */
|
u32 synopGMAC_get_tx_collision_count(u32 status)
|
/* Gives the transmission collision count. returns the transmission collision count indicating number of collisions occured before the frame was transmitted. Make sure to check excessive collision didnot happen to ensure the count is valid. */
u32 synopGMAC_get_tx_collision_count(u32 status)
|
{
return ((status & DescTxCollMask) >> DescTxCollShift);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Check the status of the Rx buffer of the specified SPI port. */
|
xtBoolean SPIIsRxEmpty(unsigned long ulBase)
|
/* Check the status of the Rx buffer of the specified SPI port. */
xtBoolean SPIIsRxEmpty(unsigned long ulBase)
|
{
xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE) );
return ((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_RX_EMPTY)? xtrue : xfalse);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* If Sha512Context is NULL, then return FALSE. If NewSha512Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
|
BOOLEAN EFIAPI Sha512Duplicate(IN CONST VOID *Sha512Context, OUT VOID *NewSha512Context)
|
/* If Sha512Context is NULL, then return FALSE. If NewSha512Context is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI Sha512Duplicate(IN CONST VOID *Sha512Context, OUT VOID *NewSha512Context)
|
{
if ((Sha512Context == NULL) || (NewSha512Context == NULL)) {
return FALSE;
}
mbedtls_sha512_clone (NewSha512Context, Sha512Context);
return TRUE;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* param base ENC peripheral base address param enable Enables or disables the watchdog */
|
void ENC_EnableWatchdog(ENC_Type *base, bool enable)
|
/* param base ENC peripheral base address param enable Enables or disables the watchdog */
void ENC_EnableWatchdog(ENC_Type *base, bool enable)
|
{
uint16_t tmp16 = base->CTRL & (uint16_t)(~(ENC_CTRL_W1C_FLAGS | ENC_CTRL_WDE_MASK));
if (enable)
{
tmp16 |= ENC_CTRL_WDE_MASK;
}
base->CTRL = tmp16;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* If any reserved bits in Address are set, then ASSERT(). */
|
UINT8 EFIAPI S3PciSegmentOr8(IN UINT64 Address, IN UINT8 OrData)
|
/* If any reserved bits in Address are set, then ASSERT(). */
UINT8 EFIAPI S3PciSegmentOr8(IN UINT64 Address, IN UINT8 OrData)
|
{
return InternalSavePciSegmentWrite8ValueToBootScript (Address, PciSegmentOr8 (Address, OrData));
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */
|
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
|
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
|
{
if(htim_base->Instance==TIM1)
{
__HAL_RCC_TIM1_CLK_ENABLE();
}
else if(htim_base->Instance==TIM3)
{
__HAL_RCC_TIM3_CLK_ENABLE();
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Gets the height in pixels of the LCD screen (varies depending on the current screen orientation) */
|
uint16_t lcdGetHeight(void)
|
/* Gets the height in pixels of the LCD screen (varies depending on the current screen orientation) */
uint16_t lcdGetHeight(void)
|
{
return hx8347gProperties.height;
}
|
microbuilder/LPC11U_LPC13U_CodeBase
|
C++
|
Other
| 54
|
/* Configures system clock after wake-up from STOP: enable HSI, PLL and select PLL as system clock source. */
|
static void SYSCLKConfig_STOP(void)
|
/* Configures system clock after wake-up from STOP: enable HSI, PLL and select PLL as system clock source. */
static void SYSCLKConfig_STOP(void)
|
{
RCC_ClkInitTypeDef RCC_ClkInitStruct;
RCC_OscInitTypeDef RCC_OscInitStruct;
uint32_t pFLatency = 0;
HAL_RCC_GetOscConfig(&RCC_OscInitStruct);
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
if(HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
HAL_RCC_GetClockConfig(&RCC_ClkInitStruct, &pFLatency);
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
if(HAL_RCC_ClockConfig(&RCC_ClkInitStruct, pFLatency) != HAL_OK)
{
Error_Handler();
}
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Configure a set of MCU pins using the given configuration table. Returns 0 on success. */
|
int lpc18xx_pin_config_table(const struct lpc18xx_pin_config *table, unsigned int len)
|
/* Configure a set of MCU pins using the given configuration table. Returns 0 on success. */
int lpc18xx_pin_config_table(const struct lpc18xx_pin_config *table, unsigned int len)
|
{
unsigned int i;
int rv;
for (i = 0; i < len; i ++) {
rv = lpc18xx_pin_config(&table[i].dsc, table[i].regval);
if (rv != 0)
goto out;
}
rv = 0;
out:
return rv;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* Reset the SGPIO Multiple Timer and Multiple Prescale Timer. */
|
void SGPIO_MULTmr_Reset(SGPIO_TypeDef *SGPIOx)
|
/* Reset the SGPIO Multiple Timer and Multiple Prescale Timer. */
void SGPIO_MULTmr_Reset(SGPIO_TypeDef *SGPIOx)
|
{
assert_param(IS_SGPIO_ALL_PERIPH(SGPIOx));
SGPIOx->SGPIO_MULTMR_CTRL |= BIT_SGPIO_MULTMR_CRST;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* Exit deep power down mode.
The Release from RDP instruction is putting the device in the Stand-by Power mode. */
|
enum status_code mx25l_exit_deep_powerdown(void)
|
/* Exit deep power down mode.
The Release from RDP instruction is putting the device in the Stand-by Power mode. */
enum status_code mx25l_exit_deep_powerdown(void)
|
{
enum status_code status;
uint8_t tx_buf[1] = {MX25L_CMD_RDP};
_mx25l_chip_select();
status = spi_write_buffer_wait(&_mx25l_spi, tx_buf, 1);
if (status != STATUS_OK) {
return STATUS_ERR_IO;
}
_mx25l_chip_deselect();
return STATUS_OK;
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* If no initialization is required, then return RETURN_SUCCESS. If the serial device was successfully initialized, then return RETURN_SUCCESS. If the serial device could not be initialized, then return RETURN_DEVICE_ERROR. */
|
RETURN_STATUS EFIAPI SerialPortInitialize(VOID)
|
/* If no initialization is required, then return RETURN_SUCCESS. If the serial device was successfully initialized, then return RETURN_SUCCESS. If the serial device could not be initialized, then return RETURN_DEVICE_ERROR. */
RETURN_STATUS EFIAPI SerialPortInitialize(VOID)
|
{
if (SbiImplementsDbcn ()) {
mHaveDbcn = TRUE;
return RETURN_SUCCESS;
}
if (SbiImplementsLegacyPutchar ()) {
mHaveLegacyPutchar = TRUE;
}
if (SbiImplementsLegacyGetchar ()) {
mHaveLegacyGetchar = TRUE;
}
return (mHaveLegacyGetchar && mHaveLegacyPutchar) ?
RETURN_SUCCESS :
RETURN_DEVICE_ERROR;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Scroll up/down for the number of specified lines. */
|
void ili9488_scroll(uint16_t ul_tfa, uint16_t ul_vsa, uint16_t ul_bfa)
|
/* Scroll up/down for the number of specified lines. */
void ili9488_scroll(uint16_t ul_tfa, uint16_t ul_vsa, uint16_t ul_bfa)
|
{
uint32_t cnt = 0;
ili9488_color_t buf[6];
cnt = sizeof(buf)/sizeof(ili9488_color_t);
buf[0] = get_8b_to_16b(ul_tfa);
buf[1] = get_0b_to_8b(ul_tfa);
buf[2] = get_8b_to_16b(ul_vsa);
buf[3] = get_0b_to_8b(ul_vsa);
buf[4] = get_8b_to_16b(ul_bfa);
buf[5] = get_0b_to_8b(ul_bfa);
ili9488_write_register(ILI9488_CMD_VERT_SCROLL_DEFINITION, buf, cnt);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Start the scope for the last 'nvars' created variables. */
|
static void adjustlocalvars(LexState *ls, int nvars)
|
/* Start the scope for the last 'nvars' created variables. */
static void adjustlocalvars(LexState *ls, int nvars)
|
{
int vidx = fs->nactvar++;
Vardesc *var = getlocalvardesc(fs, vidx);
var->vd.ridx = reglevel++;
var->vd.pidx = registerlocalvar(ls, fs, var->vd.name);
}
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* This is the OS-dependent handler for PHY module changes. It is invoked when a PHY module is removed or inserted for any OS-specific processing. */
|
void t3_os_phymod_changed(struct adapter *adap, int port_id)
|
/* This is the OS-dependent handler for PHY module changes. It is invoked when a PHY module is removed or inserted for any OS-specific processing. */
void t3_os_phymod_changed(struct adapter *adap, int port_id)
|
{
static const char *mod_str[] = {
NULL, "SR", "LR", "LRM", "TWINAX", "TWINAX", "unknown"
};
const struct net_device *dev = adap->port[port_id];
const struct port_info *pi = netdev_priv(dev);
if (pi->phy.modtype == phy_modtype_none)
printk(KERN_INFO "%s: PHY module unplugged\n", dev->name);
else
printk(KERN_INFO "%s: %s PHY module inserted\n", dev->name,
mod_str[pi->phy.modtype]);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* IDL long NetrLogonUasLogoff( IDL wchar_t *ServerName, IDL wchar_t *UserName, IDL wchar_t *Workstation, IDL LOGOFF_UAS_INFO *info IDL ); */
|
static int netlogon_dissect_netrlogonuaslogoff_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
|
/* IDL long NetrLogonUasLogoff( IDL wchar_t *ServerName, IDL wchar_t *UserName, IDL wchar_t *Workstation, IDL LOGOFF_UAS_INFO *info IDL ); */
static int netlogon_dissect_netrlogonuaslogoff_rqst(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
|
{
offset = netlogon_dissect_LOGONSRV_HANDLE(tvb, offset,
pinfo, tree, di, drep);
offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, di, drep,
NDR_POINTER_REF, "Account", hf_netlogon_acct_name, CB_STR_COL_INFO);
offset = dissect_ndr_str_pointer_item(tvb, offset, pinfo, tree, di, drep,
NDR_POINTER_REF, "Workstation", hf_netlogon_workstation, 0);
return offset;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* This function copies a message from the mailbox buffer to the caller's memory buffer. The presumption is that the caller knows that there was a message due to a VF request so no polling for message is needed. */
|
static s32 igb_read_mbx_pf(struct e1000_hw *hw, u32 *msg, u16 size, u16 vf_number)
|
/* This function copies a message from the mailbox buffer to the caller's memory buffer. The presumption is that the caller knows that there was a message due to a VF request so no polling for message is needed. */
static s32 igb_read_mbx_pf(struct e1000_hw *hw, u32 *msg, u16 size, u16 vf_number)
|
{
s32 ret_val;
u16 i;
ret_val = igb_obtain_mbx_lock_pf(hw, vf_number);
if (ret_val)
goto out_no_read;
for (i = 0; i < size; i++)
msg[i] = array_rd32(E1000_VMBMEM(vf_number), i);
wr32(E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_ACK);
hw->mbx.stats.msgs_rx++;
out_no_read:
return ret_val;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns the storage size of the first 'len' characters of ARRAY */
|
int xmlUTF8Strsize(const xmlChar *utf, int len)
|
/* Returns the storage size of the first 'len' characters of ARRAY */
int xmlUTF8Strsize(const xmlChar *utf, int len)
|
{
if ( !*ptr )
break;
if ( (ch = *ptr++) & 0x80)
while ((ch<<=1) & 0x80 ) {
ptr++;
if (*ptr == 0) break;
}
}
return (ptr - utf);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Created on: 12 feb. 2019 Author: Daniel Mårtensson Turn a array A with the size 1 x length, into an matrix B with size length x length */
|
void toeplitz(double *A, double *B, int length)
|
/* Created on: 12 feb. 2019 Author: Daniel Mårtensson Turn a array A with the size 1 x length, into an matrix B with size length x length */
void toeplitz(double *A, double *B, int length)
|
{
for (int j = 0; j < length; j++) {
if(i-j < 0)
*((B + i * length) + j) = A[j-i];
else
*((B + i * length) + j) = A[i-j];
}
}
}
|
DanielMartensson/EmbeddedLapack
|
C++
|
MIT License
| 129
|
/* Erases the effect if the requester is also the effect owner. The mutex should already be locked before calling this function. */
|
static int erase_effect(struct input_dev *dev, int effect_id, struct file *file)
|
/* Erases the effect if the requester is also the effect owner. The mutex should already be locked before calling this function. */
static int erase_effect(struct input_dev *dev, int effect_id, struct file *file)
|
{
struct ff_device *ff = dev->ff;
int error;
error = check_effect_access(ff, effect_id, file);
if (error)
return error;
spin_lock_irq(&dev->event_lock);
ff->playback(dev, effect_id, 0);
ff->effect_owners[effect_id] = NULL;
spin_unlock_irq(&dev->event_lock);
if (ff->erase) {
error = ff->erase(dev, effect_id);
if (error) {
spin_lock_irq(&dev->event_lock);
ff->effect_owners[effect_id] = file;
spin_unlock_irq(&dev->event_lock);
return error;
}
}
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Converts a Bluetooth device path structure to its string representative. */
|
VOID DevPathToTextBluetooth(IN OUT POOL_PRINT *Str, IN VOID *DevPath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
|
/* Converts a Bluetooth device path structure to its string representative. */
VOID DevPathToTextBluetooth(IN OUT POOL_PRINT *Str, IN VOID *DevPath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
|
{
BLUETOOTH_DEVICE_PATH *Bluetooth;
Bluetooth = DevPath;
UefiDevicePathLibCatPrint (
Str,
L"Bluetooth(%02x%02x%02x%02x%02x%02x)",
Bluetooth->BD_ADDR.Address[0],
Bluetooth->BD_ADDR.Address[1],
Bluetooth->BD_ADDR.Address[2],
Bluetooth->BD_ADDR.Address[3],
Bluetooth->BD_ADDR.Address[4],
Bluetooth->BD_ADDR.Address[5]
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Creates and connects to an unsecure socket to be used for SMTP. */
|
static int8_t smtpConnect(void)
|
/* Creates and connects to an unsecure socket to be used for SMTP. */
static int8_t smtpConnect(void)
|
{
struct sockaddr_in addr_in;
addr_in.sin_family = AF_INET;
addr_in.sin_port = _htons(MAIN_GMAIL_HOST_PORT);
addr_in.sin_addr.s_addr = gu32HostIp;
if (tcp_client_socket < 0) {
tcp_client_socket = socket(AF_INET, SOCK_STREAM, SOCKET_FLAGS_SSL);
}
if (tcp_client_socket == -1) {
printf("socket error.\r\n");
close(tcp_client_socket);
return -1;
}
if (connect(tcp_client_socket, (struct sockaddr *)&addr_in, sizeof(struct sockaddr_in)) != SOCK_ERR_NO_ERROR) {
printf("connect error.\r\n");
return SOCK_ERR_INVALID;
}
return SOCK_ERR_NO_ERROR;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* returns zero on success, an error code otherwise */
|
static int smack_socket_getpeersec_stream(struct socket *sock, char __user *optval, int __user *optlen, unsigned len)
|
/* returns zero on success, an error code otherwise */
static int smack_socket_getpeersec_stream(struct socket *sock, char __user *optval, int __user *optlen, unsigned len)
|
{
struct socket_smack *ssp;
int slen;
int rc = 0;
ssp = sock->sk->sk_security;
slen = strlen(ssp->smk_packet) + 1;
if (slen > len)
rc = -ERANGE;
else if (copy_to_user(optval, ssp->smk_packet, slen) != 0)
rc = -EFAULT;
if (put_user(slen, optlen) != 0)
rc = -EFAULT;
return rc;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* If PcdMaximumUnicodeStringLength is not zero, and String contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then ASSERT(). */
|
UINT64 EFIAPI StrDecimalToUint64(IN CONST CHAR16 *String)
|
/* If PcdMaximumUnicodeStringLength is not zero, and String contains more than PcdMaximumUnicodeStringLength Unicode characters, not including the Null-terminator, then ASSERT(). */
UINT64 EFIAPI StrDecimalToUint64(IN CONST CHAR16 *String)
|
{
UINT64 Result;
if (RETURN_ERROR (StrDecimalToUint64S (String, (CHAR16 **)NULL, &Result))) {
return MAX_UINT64;
}
return Result;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Set up the MPU protections region from the context of the specified process (in preparation to re-starting it). */
|
static void mpu_page_copyall(struct mm_struct *mm)
|
/* Set up the MPU protections region from the context of the specified process (in preparation to re-starting it). */
static void mpu_page_copyall(struct mm_struct *mm)
|
{
int i;
mpu_context_t *p = mpu_context_p(mm);
for (i = mpu_hw_reg_indx; i < 8; i ++) {
mpu_region_write(i, p->mpu_regs[i].base, p->mpu_regs[i].attr);
}}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* PTP_GetStorageIDs Gets Storage Ids and fills stor_ids structure. */
|
static void PTP_GetStorageIDs(USBH_HandleTypeDef *phost, PTP_StorageIDsTypedef *stor_ids)
|
/* PTP_GetStorageIDs Gets Storage Ids and fills stor_ids structure. */
static void PTP_GetStorageIDs(USBH_HandleTypeDef *phost, PTP_StorageIDsTypedef *stor_ids)
|
{
MTP_HandleTypeDef *MTP_Handle = phost->pActiveClass->pData;
uint8_t *data = MTP_Handle->ptp.data_container.payload.data;
stor_ids->n = PTP_GetArray32 (stor_ids->Storage, data, 0);
}
|
micropython/micropython
|
C++
|
Other
| 18,334
|
/* Add the dependent device to the dock's hotplug device list */
|
static void dock_add_hotplug_device(struct dock_station *ds, struct dock_dependent_device *dd)
|
/* Add the dependent device to the dock's hotplug device list */
static void dock_add_hotplug_device(struct dock_station *ds, struct dock_dependent_device *dd)
|
{
mutex_lock(&ds->hp_lock);
list_add_tail(&dd->hotplug_list, &ds->hotplug_devices);
mutex_unlock(&ds->hp_lock);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* protection_queue_destroy - destroy the protection queue. @ubi: UBI device description object */
|
static void protection_queue_destroy(struct ubi_device *ubi)
|
/* protection_queue_destroy - destroy the protection queue. @ubi: UBI device description object */
static void protection_queue_destroy(struct ubi_device *ubi)
|
{
int i;
struct ubi_wl_entry *e, *tmp;
for (i = 0; i < UBI_PROT_QUEUE_LEN; ++i) {
list_for_each_entry_safe(e, tmp, &ubi->pq[i], u.list) {
list_del(&e->u.list);
kmem_cache_free(ubi_wl_entry_slab, e);
}
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns the expected transfer length and direction (IN, OUT or don't care) from the host point-of-view. */
|
static void MSDD_GetCommandInformation(MSCbw *cbw, unsigned int *length, unsigned char *type)
|
/* Returns the expected transfer length and direction (IN, OUT or don't care) from the host point-of-view. */
static void MSDD_GetCommandInformation(MSCbw *cbw, unsigned int *length, unsigned char *type)
|
{
(*length) = cbw->dCBWDataTransferLength;
if (*length == 0) {
(*type) = MSDD_NO_TRANSFER;
}
else if ((cbw->bmCBWFlags & MSD_CBW_DEVICE_TO_HOST) != 0) {
(*type) = MSDD_DEVICE_TO_HOST;
}
else {
(*type) = MSDD_HOST_TO_DEVICE;
}
}
|
opentx/opentx
|
C++
|
GNU General Public License v2.0
| 2,025
|
/* Function for dispatching outbound events to all registered event handlers. */
|
static void pdb_evt_send(pdb_evt_t *p_event)
|
/* Function for dispatching outbound events to all registered event handlers. */
static void pdb_evt_send(pdb_evt_t *p_event)
|
{
for (uint32_t i = 0; i < m_pdb.n_registrants; i++)
{
m_pdb.evt_handlers[i](p_event);
}
}
|
labapart/polymcu
|
C++
| null | 201
|
/* If DhContext is NULL, then return FALSE. If PublicKeySize is NULL, then return FALSE. If PublicKeySize is large enough but PublicKey is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
|
BOOLEAN EFIAPI CryptoServiceDhGenerateKey(IN OUT VOID *DhContext, OUT UINT8 *PublicKey, IN OUT UINTN *PublicKeySize)
|
/* If DhContext is NULL, then return FALSE. If PublicKeySize is NULL, then return FALSE. If PublicKeySize is large enough but PublicKey is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI CryptoServiceDhGenerateKey(IN OUT VOID *DhContext, OUT UINT8 *PublicKey, IN OUT UINTN *PublicKeySize)
|
{
return CALL_BASECRYPTLIB (Dh.Services.GenerateKey, DhGenerateKey, (DhContext, PublicKey, PublicKeySize), FALSE);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Get the wakeup Module flag of the specified index. */
|
xtBoolean SysCtlWakeupModuleFlagGet(unsigned long ulModuleIndex)
|
/* Get the wakeup Module flag of the specified index. */
xtBoolean SysCtlWakeupModuleFlagGet(unsigned long ulModuleIndex)
|
{
xtBoolean xtFlag = 0;
xASSERT((ulModuleIndex >= 0 && ulModuleIndex <= 7));
xtFlag = (xHWREGB(LLWU_F3) & (LLWU_F3_MWUF0 << ulModuleIndex));
if(xtFlag)
{
return xtrue;
}
else
{
return xfalse;
}
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* i5000_put_devices 'put' all the devices that we have reserved via 'get' */
|
static void i5000_put_devices(struct mem_ctl_info *mci)
|
/* i5000_put_devices 'put' all the devices that we have reserved via 'get' */
static void i5000_put_devices(struct mem_ctl_info *mci)
|
{
struct i5000_pvt *pvt;
pvt = mci->pvt_info;
pci_dev_put(pvt->branchmap_werrors);
pci_dev_put(pvt->fsb_error_regs);
pci_dev_put(pvt->branch_0);
if (pvt->maxch >= CHANNELS_PER_BRANCH)
pci_dev_put(pvt->branch_1);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* NOTE: ocfs2_block_extent_contig(), ocfs2_extents_adjacent() and ocfs2_extent_rec_contig only work properly against leaf nodes! */
|
static int ocfs2_block_extent_contig(struct super_block *sb, struct ocfs2_extent_rec *ext, u64 blkno)
|
/* NOTE: ocfs2_block_extent_contig(), ocfs2_extents_adjacent() and ocfs2_extent_rec_contig only work properly against leaf nodes! */
static int ocfs2_block_extent_contig(struct super_block *sb, struct ocfs2_extent_rec *ext, u64 blkno)
|
{
u64 blk_end = le64_to_cpu(ext->e_blkno);
blk_end += ocfs2_clusters_to_blocks(sb,
le16_to_cpu(ext->e_leaf_clusters));
return blkno == blk_end;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Closes a pipe of the Low Level Driver. */
|
USBH_StatusTypeDef USBH_LL_ClosePipe(USBH_HandleTypeDef *phost, uint8_t pipe)
|
/* Closes a pipe of the Low Level Driver. */
USBH_StatusTypeDef USBH_LL_ClosePipe(USBH_HandleTypeDef *phost, uint8_t pipe)
|
{
HAL_HCD_HC_Halt(phost->pData, pipe);
return USBH_OK;
}
|
STMicroelectronics/STM32CubeF4
|
C++
|
Other
| 789
|
/* Checks whether the specified UART flag is set or not. */
|
FlagStatus UART_GetFlagStatus(UART_TypeDef *UARTx, uint16_t UART_FLAG)
|
/* Checks whether the specified UART flag is set or not. */
FlagStatus UART_GetFlagStatus(UART_TypeDef *UARTx, uint16_t UART_FLAG)
|
{
FlagStatus bitstatus = RESET;
assert_param(IS_UART_ALL_PERIPH(UARTx));
assert_param(IS_UART_FLAG(UART_FLAG));
if ((UARTx->CSR & UART_FLAG) != (uint16_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Turn the new style permissions object @in into a compatibility object and store it into the @out pointer. */
|
void ipc64_perm_to_ipc_perm(struct ipc64_perm *in, struct ipc_perm *out)
|
/* Turn the new style permissions object @in into a compatibility object and store it into the @out pointer. */
void ipc64_perm_to_ipc_perm(struct ipc64_perm *in, struct ipc_perm *out)
|
{
out->key = in->key;
SET_UID(out->uid, in->uid);
SET_GID(out->gid, in->gid);
SET_UID(out->cuid, in->cuid);
SET_GID(out->cgid, in->cgid);
out->mode = in->mode;
out->seq = in->seq;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Disable interrupts on specified GPIO pins.
Note that the NVIC must be enabled and properly configured for the interrupt to be routed to the CPU. */
|
void gpio_disable_interrupts(uint32_t gpioport, uint8_t gpios)
|
/* Disable interrupts on specified GPIO pins.
Note that the NVIC must be enabled and properly configured for the interrupt to be routed to the CPU. */
void gpio_disable_interrupts(uint32_t gpioport, uint8_t gpios)
|
{
GPIO_IM(gpioport) |= gpios;
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* 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: */
|
SDL_Window* SDL_CreateShapedWindow(const char *title, unsigned int x, unsigned int y, unsigned int w, unsigned int h, Uint32 flags)
|
/* 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: */
SDL_Window* SDL_CreateShapedWindow(const char *title, unsigned int x, unsigned int y, unsigned int w, unsigned int h, Uint32 flags)
|
{
SDL_Window *result = NULL;
result = SDL_CreateWindow(title,-1000,-1000,w,h,(flags | SDL_WINDOW_BORDERLESS) & (~SDL_WINDOW_FULLSCREEN) & (~SDL_WINDOW_RESIZABLE));
if(result != NULL) {
if (SDL_GetVideoDevice()->shape_driver.CreateShaper == NULL) {
SDL_DestroyWindow(result);
return NULL;
}
result->shaper = SDL_GetVideoDevice()->shape_driver.CreateShaper(result);
if(result->shaper != NULL) {
result->shaper->userx = x;
result->shaper->usery = y;
result->shaper->mode.mode = ShapeModeDefault;
result->shaper->mode.parameters.binarizationCutoff = 1;
result->shaper->hasshape = SDL_FALSE;
return result;
}
else {
SDL_DestroyWindow(result);
return NULL;
}
}
else
return NULL;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* This function read a character from serial without interrupt enable mode */
|
char rt_serial_getc(void)
|
/* This function read a character from serial without interrupt enable mode */
char rt_serial_getc(void)
|
{
while(!(inb(COM1+COMSTATUS) & COMDATA));
return inb(COM1+COMREAD);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* atl1_phy_config - Timer Call-back @data: pointer to netdev cast into an unsigned long */
|
static void atl1_phy_config(unsigned long data)
|
/* atl1_phy_config - Timer Call-back @data: pointer to netdev cast into an unsigned long */
static void atl1_phy_config(unsigned long data)
|
{
struct atl1_adapter *adapter = (struct atl1_adapter *)data;
struct atl1_hw *hw = &adapter->hw;
unsigned long flags;
spin_lock_irqsave(&adapter->lock, flags);
adapter->phy_timer_pending = false;
atl1_write_phy_reg(hw, MII_ADVERTISE, hw->mii_autoneg_adv_reg);
atl1_write_phy_reg(hw, MII_ATLX_CR, hw->mii_1000t_ctrl_reg);
atl1_write_phy_reg(hw, MII_BMCR, MII_CR_RESET | MII_CR_AUTO_NEG_EN);
spin_unlock_irqrestore(&adapter->lock, flags);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Stop this driver on ControllerHandle. This service is called by the EFI boot service DisconnectController(). In order to make drivers as small as possible, there are a few calling restrictions for this service. DisconnectController() must follow these calling restrictions. If any other agent wishes to call Stop() it must also follow these calling restrictions. */
|
EFI_STATUS EFIAPI PxeBcIp6DriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
|
/* Stop this driver on ControllerHandle. This service is called by the EFI boot service DisconnectController(). In order to make drivers as small as possible, there are a few calling restrictions for this service. DisconnectController() must follow these calling restrictions. If any other agent wishes to call Stop() it must also follow these calling restrictions. */
EFI_STATUS EFIAPI PxeBcIp6DriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
|
{
return PxeBcStop (
This,
ControllerHandle,
NumberOfChildren,
ChildHandleBuffer,
IP_VERSION_6
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Erase line, 3 different cases: Esc [ 0 K Erase from current position to end of line inclusive Esc [ 1 K Erase from beginning of line to current position inclusive Esc [ 2 K Erase entire line (without moving cursor) */
|
static void tty3270_erase_line(struct tty3270 *tp, int mode)
|
/* Erase line, 3 different cases: Esc [ 0 K Erase from current position to end of line inclusive Esc [ 1 K Erase from beginning of line to current position inclusive Esc [ 2 K Erase entire line (without moving cursor) */
static void tty3270_erase_line(struct tty3270 *tp, int mode)
|
{
struct tty3270_line *line;
struct tty3270_cell *cell;
int i;
line = tp->screen + tp->cy;
if (mode == 0)
line->len = tp->cx;
else if (mode == 1) {
for (i = 0; i < tp->cx; i++) {
cell = line->cells + i;
cell->character = ' ';
cell->highlight = TAX_RESET;
cell->f_color = TAC_RESET;
}
if (line->len <= tp->cx)
line->len = tp->cx + 1;
} else if (mode == 2)
line->len = 0;
tty3270_convert_line(tp, tp->cy);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Stop the PWM of the PWM module.
The */
|
void PWMStop(unsigned long ulBase, unsigned long ulChannel)
|
/* Stop the PWM of the PWM module.
The */
void PWMStop(unsigned long ulBase, unsigned long ulChannel)
|
{
unsigned long ulChannelTemp;
ulChannelTemp = ulChannel;
xASSERT(ulBase == PWMA_BASE);
xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 5)));
xHWREG(ulBase + PWM_PCR) &= ~(PWM_PCR_CH0EN << (ulChannelTemp << 2));
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Allocate a memory block from a memory pool and set it to zero. */
|
void* osPoolCAlloc(osPoolId pool_id)
|
/* Allocate a memory block from a memory pool and set it to zero. */
void* osPoolCAlloc(osPoolId pool_id)
|
{
osPoolDef_t *osPool = (osPoolDef_t *)pool_id;
void *ptr;
if (k_mem_slab_alloc((struct k_mem_slab *)(osPool->pool),
&ptr, TIME_OUT) == 0) {
(void)memset(ptr, 0, osPool->item_sz);
return ptr;
} else {
return NULL;
}
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Copy Length of Src buffer to Dest buffer, add a NULL termination to Dest buffer. */
|
VOID MemToString(IN OUT VOID *Dest, IN VOID *Src, IN UINTN Length)
|
/* Copy Length of Src buffer to Dest buffer, add a NULL termination to Dest buffer. */
VOID MemToString(IN OUT VOID *Dest, IN VOID *Src, IN UINTN Length)
|
{
UINT8 *SrcBuffer;
UINT8 *DestBuffer;
SrcBuffer = (UINT8 *)Src;
DestBuffer = (UINT8 *)Dest;
while ((Length--) != 0) {
*DestBuffer++ = *SrcBuffer++;
}
*DestBuffer = '\0';
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* If the file was opened with ASCII mode the data will be processed through AsciiSPrint before writing. */
|
EFI_STATUS EFIAPI FileInterfaceFileWrite(IN EFI_FILE_PROTOCOL *This, IN OUT UINTN *BufferSize, IN VOID *Buffer)
|
/* If the file was opened with ASCII mode the data will be processed through AsciiSPrint before writing. */
EFI_STATUS EFIAPI FileInterfaceFileWrite(IN EFI_FILE_PROTOCOL *This, IN OUT UINTN *BufferSize, IN VOID *Buffer)
|
{
CHAR8 *AsciiBuffer;
UINTN Size;
EFI_STATUS Status;
if (((EFI_FILE_PROTOCOL_FILE *)This)->Unicode) {
return (((EFI_FILE_PROTOCOL_FILE *)This)->Orig->Write (((EFI_FILE_PROTOCOL_FILE *)This)->Orig, BufferSize, Buffer));
} else {
AsciiBuffer = AllocateZeroPool (*BufferSize);
AsciiSPrint (AsciiBuffer, *BufferSize, "%S", Buffer);
Size = AsciiStrSize (AsciiBuffer) - 1;
Status = (((EFI_FILE_PROTOCOL_FILE *)This)->Orig->Write (((EFI_FILE_PROTOCOL_FILE *)This)->Orig, &Size, AsciiBuffer));
FreePool (AsciiBuffer);
return (Status);
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Start sending data to UART transmitter,(received data is ignored). The function is non-blocking,UART_EVENT_TRANSFER_COMPLETE is signaled when transfer completes. csi_usart_get_status can indicates if transmission is still in progress or pending. */
|
int32_t csi_usart_send(usart_handle_t handle, const void *data, uint32_t num)
|
/* Start sending data to UART transmitter,(received data is ignored). The function is non-blocking,UART_EVENT_TRANSFER_COMPLETE is signaled when transfer completes. csi_usart_get_status can indicates if transmission is still in progress or pending. */
int32_t csi_usart_send(usart_handle_t handle, const void *data, uint32_t num)
|
{
USART_NULL_PARAM_CHK(handle);
USART_NULL_PARAM_CHK(data);
if (num == 0)
{
return ERR_USART(DRV_ERROR_PARAMETER);
}
ck_usart_priv_t *usart_priv = handle;
usart_priv->tx_buf = (uint8_t *)data;
usart_priv->tx_total_num = num;
usart_priv->tx_cnt = 0;
usart_priv->tx_busy = 1;
usart_priv->last_tx_num = 0;
ck_usart_reg_t *addr = (ck_usart_reg_t *)(usart_priv->base);
ck_usart_intr_threshold_empty(usart_priv->idx, usart_priv);
addr->IER |= IER_THRE_INT_ENABLE;
return 0;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Some commands, specifically certain initialisation sequences, require a commit operation. */
|
static int rj54n1_commit(struct i2c_client *client)
|
/* Some commands, specifically certain initialisation sequences, require a commit operation. */
static int rj54n1_commit(struct i2c_client *client)
|
{
int ret = reg_write(client, RJ54N1_INIT_START, 1);
msleep(10);
if (!ret)
ret = reg_write(client, RJ54N1_INIT_START, 0);
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This software is provided 'as is' with no explicit or implied warranties in respect of its properties, including, but not limited to, correctness */
|
static void encr_data(unsigned char data[], unsigned long d_len, fcrypt_ctx cx[1])
|
/* This software is provided 'as is' with no explicit or implied warranties in respect of its properties, including, but not limited to, correctness */
static void encr_data(unsigned char data[], unsigned long d_len, fcrypt_ctx cx[1])
|
{ unsigned long i = 0, pos = cx->encr_pos;
while(i < d_len)
{
if(pos == AES_BLOCK_SIZE)
{ unsigned int j = 0;
while(j < 8 && !++cx->nonce[j])
++j;
aes_encrypt(cx->nonce, cx->encr_bfr, cx->encr_ctx);
pos = 0;
}
data[i++] ^= cx->encr_bfr[pos++];
}
cx->encr_pos = pos;
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* LPC5410X Pin Interrupt and Pattern Match Registers and driver. */
|
void Chip_PININT_SetPatternMatchSrc(LPC_PIN_INT_T *pPININT, Chip_PININT_SELECT_T channelNum, Chip_PININT_BITSLICE_T sliceNum)
|
/* LPC5410X Pin Interrupt and Pattern Match Registers and driver. */
void Chip_PININT_SetPatternMatchSrc(LPC_PIN_INT_T *pPININT, Chip_PININT_SELECT_T channelNum, Chip_PININT_BITSLICE_T sliceNum)
|
{
uint32_t pmsrc_reg;
pmsrc_reg = pPININT->PMSRC & ~(PININT_SRC_BITSOURCE_MASK << (PININT_SRC_BITSOURCE_START + (sliceNum * 3)));
pPININT->PMSRC = pmsrc_reg | (channelNum << (PININT_SRC_BITSOURCE_START + (sliceNum * 3)));
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* For text based NFSv2/v3 mounts, the mount protocol transport default settings should depend upon the specified NFS transport. */
|
static void nfs_set_mount_transport_protocol(struct nfs_parsed_mount_data *mnt)
|
/* For text based NFSv2/v3 mounts, the mount protocol transport default settings should depend upon the specified NFS transport. */
static void nfs_set_mount_transport_protocol(struct nfs_parsed_mount_data *mnt)
|
{
nfs_validate_transport_protocol(mnt);
if (mnt->mount_server.protocol == XPRT_TRANSPORT_UDP ||
mnt->mount_server.protocol == XPRT_TRANSPORT_TCP)
return;
switch (mnt->nfs_server.protocol) {
case XPRT_TRANSPORT_UDP:
mnt->mount_server.protocol = XPRT_TRANSPORT_UDP;
break;
case XPRT_TRANSPORT_TCP:
case XPRT_TRANSPORT_RDMA:
mnt->mount_server.protocol = XPRT_TRANSPORT_TCP;
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Method to access the protection register area, present in some flash devices. The user data is one time programmable but the factory data is read only. */
|
int mtd_get_fact_prot_info(struct mtd_info *mtd, size_t len, size_t *retlen, struct otp_info *buf)
|
/* Method to access the protection register area, present in some flash devices. The user data is one time programmable but the factory data is read only. */
int mtd_get_fact_prot_info(struct mtd_info *mtd, size_t len, size_t *retlen, struct otp_info *buf)
|
{
if (!mtd->_get_fact_prot_info)
return -EOPNOTSUPP;
if (!len)
return 0;
return mtd->_get_fact_prot_info(mtd, len, retlen, buf);
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Returns a new struct ubi_vid_hdr on success. NULL indicates out of memory. */
|
static struct ubi_vid_hdr* new_fm_vhdr(struct ubi_device *ubi, int vol_id)
|
/* Returns a new struct ubi_vid_hdr on success. NULL indicates out of memory. */
static struct ubi_vid_hdr* new_fm_vhdr(struct ubi_device *ubi, int vol_id)
|
{
struct ubi_vid_hdr *new;
new = ubi_zalloc_vid_hdr(ubi, GFP_KERNEL);
if (!new)
goto out;
new->vol_type = UBI_VID_DYNAMIC;
new->vol_id = cpu_to_be32(vol_id);
new->compat = UBI_COMPAT_DELETE;
out:
return new;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Worker function to execute a caller provided function on all enabled APs. */
|
VOID StartupAllAPsWorker(IN EFI_AP_PROCEDURE Procedure, IN EFI_EVENT MpEvent)
|
/* Worker function to execute a caller provided function on all enabled APs. */
VOID StartupAllAPsWorker(IN EFI_AP_PROCEDURE Procedure, IN EFI_EVENT MpEvent)
|
{
EFI_STATUS Status;
EDKII_PEI_MP_SERVICES2_PPI *CpuMp2Ppi;
CPU_FEATURES_DATA *CpuFeaturesData;
CpuFeaturesData = GetCpuFeaturesData ();
CpuMp2Ppi = CpuFeaturesData->MpService.Ppi;
Status = CpuMp2Ppi->StartupAllAPs (
CpuMp2Ppi,
Procedure,
FALSE,
0,
CpuFeaturesData
);
ASSERT_EFI_ERROR (Status);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Get the size of the uncompressed buffer by parsing EncodeData header. */
|
UINT64 BrGetDecodedSizeOfBuf(IN UINT8 *EncodedData, IN UINT8 StartOffset, IN UINT8 EndOffset)
|
/* Get the size of the uncompressed buffer by parsing EncodeData header. */
UINT64 BrGetDecodedSizeOfBuf(IN UINT8 *EncodedData, IN UINT8 StartOffset, IN UINT8 EndOffset)
|
{
UINT64 DecodedSize;
INTN Index;
DecodedSize = 0;
for (Index = EndOffset - 1; Index >= StartOffset; Index--) {
DecodedSize = LShiftU64 (DecodedSize, 8) + EncodedData[Index];
}
return DecodedSize;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* loadLFS)() is protected called from luaL_lfsreload() so that it can recover from out of memory and other thrown errors. loadLFSgc() GCs any resources. */
|
static int loadLFS(lua_State *L)
|
/* loadLFS)() is protected called from luaL_lfsreload() so that it can recover from out of memory and other thrown errors. loadLFSgc() GCs any resources. */
static int loadLFS(lua_State *L)
|
{
const char *err[] = {"Data_error during decompression",
"Chksum_error during decompression",
"Dictionary error during decompression",
"Memory_error during decompression"};
flash_error(err[UZLIB_DATA_ERROR - res]);
}
return 0;
}
|
nodemcu/nodemcu-firmware
|
C++
|
MIT License
| 7,566
|
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */
|
int main(void)
|
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */
int main(void)
|
{
SetupHardware();
puts_P(PSTR(ESC_FG_CYAN "Printer Host Demo running.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
GlobalInterruptEnable();
for (;;)
{
PrinterHost_Task();
USB_USBTask();
}
}
|
prusa3d/Prusa-Firmware-Buddy
|
C++
|
Other
| 1,019
|
/* Enable the PDM module.
This function enables the PDM module in the mode previously defined by */
|
void am_hal_pdm_enable(void)
|
/* Enable the PDM module.
This function enables the PDM module in the mode previously defined by */
void am_hal_pdm_enable(void)
|
{
AM_REG(PDM, PCFG) |= AM_REG_PDM_PCFG_PDMCORE_EN;
AM_REG(PDM, VCFG) |= ( AM_REG_PDM_VCFG_IOCLKEN_EN |
AM_REG_PDM_VCFG_PDMCLK_EN |
AM_REG_PDM_VCFG_RSTB_NORM );
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Read a character through UART in a blocking call. */
|
static int32_t usr_uart_read_block(struct uart_desc *desc, uint8_t *data)
|
/* Read a character through UART in a blocking call. */
static int32_t usr_uart_read_block(struct uart_desc *desc, uint8_t *data)
|
{
const uint32_t buf_size = 1;
uint32_t error;
if(!desc->has_callback) {
if(uart_ping_flag == 0 && uart_pong_flag == 0)
adi_uart_SubmitRxBuffer((ADI_UART_HANDLE const)h_uart_device,
data, buf_size, DMA_NOT_USE);
return adi_uart_GetRxBuffer((ADI_UART_HANDLE const)h_uart_device,
(void **)&data, &error);
} else {
while(uart_ping_flag != 2 && uart_pong_flag != 2);
if(uart_ping_flag == 2) {
*data = *ping_ptr;
uart_ping_flag = 0;
}
if(uart_pong_flag == 2) {
*data = *pong_ptr;
uart_pong_flag = 0;
}
return 0;
}
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* Full-Speed Bandwidth Reclamation (FSBR). We turn on FSBR whenever a queue that wants it is advancing, and leave it on for a short time thereafter. */
|
static void uhci_fsbr_on(struct uhci_hcd *uhci)
|
/* Full-Speed Bandwidth Reclamation (FSBR). We turn on FSBR whenever a queue that wants it is advancing, and leave it on for a short time thereafter. */
static void uhci_fsbr_on(struct uhci_hcd *uhci)
|
{
struct uhci_qh *lqh;
uhci->fsbr_is_on = 1;
lqh = list_entry(uhci->skel_async_qh->node.prev,
struct uhci_qh, node);
lqh->link = LINK_TO_QH(uhci->skel_term_qh);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Change the card address of an already open memory window. */
|
static int pcmcia_get_mem_page(struct pcmcia_socket *skt, window_handle_t wh, memreq_t *req)
|
/* Change the card address of an already open memory window. */
static int pcmcia_get_mem_page(struct pcmcia_socket *skt, window_handle_t wh, memreq_t *req)
|
{
wh--;
if (wh >= MAX_WIN)
return -EINVAL;
req->Page = 0;
req->CardOffset = skt->win[wh].card_start;
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Enables a PCI driver to access PCI controller registers in the PCI root bridge I/O space. */
|
EFI_STATUS EFIAPI RootBridgeIoIoRead(IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width, IN UINT64 Address, IN UINTN Count, OUT VOID *Buffer)
|
/* Enables a PCI driver to access PCI controller registers in the PCI root bridge I/O space. */
EFI_STATUS EFIAPI RootBridgeIoIoRead(IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width, IN UINT64 Address, IN UINTN Count, OUT VOID *Buffer)
|
{
EFI_STATUS Status;
PCI_ROOT_BRIDGE_INSTANCE *RootBridge;
Status = RootBridgeIoCheckParameter (
This,
IoOperation,
Width,
Address,
Count,
Buffer
);
if (EFI_ERROR (Status)) {
return Status;
}
RootBridge = ROOT_BRIDGE_FROM_THIS (This);
return mCpuIo->Io.Read (
mCpuIo,
(EFI_CPU_IO_PROTOCOL_WIDTH)Width,
TO_HOST_ADDRESS (Address, RootBridge->Io.Translation),
Count,
Buffer
);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Returns the current time and date information, and the time-keeping capabilities of the hardware platform. */
|
EFI_STATUS EFIAPI LibGetTime(OUT EFI_TIME *Time, OUT EFI_TIME_CAPABILITIES *Capabilities)
|
/* Returns the current time and date information, and the time-keeping capabilities of the hardware platform. */
EFI_STATUS EFIAPI LibGetTime(OUT EFI_TIME *Time, OUT EFI_TIME_CAPABILITIES *Capabilities)
|
{
ASSERT (Time != NULL);
EpochToEfiTime (1421770011, Time);
return EFI_SUCCESS;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Add a trace buffer entry for arguments, for a buffer & 2 integer args. */
|
void xfs_btree_trace_argbii(const char *func, struct xfs_btree_cur *cur, struct xfs_buf *b, int i0, int i1, int line)
|
/* Add a trace buffer entry for arguments, for a buffer & 2 integer args. */
void xfs_btree_trace_argbii(const char *func, struct xfs_btree_cur *cur, struct xfs_buf *b, int i0, int i1, int line)
|
{
cur->bc_ops->trace_enter(cur, func, XBT_ARGS, XFS_BTREE_KTRACE_ARGBII,
line, (__psunsigned_t)b, i0, i1, 0, 0, 0, 0,
0, 0, 0, 0);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Finds a pattern in the skb data according to the specified textsearch configuration. Use textsearch_next() to retrieve subsequent occurrences of the pattern. Returns the offset to the first occurrence or UINT_MAX if no match was found. */
|
unsigned int skb_find_text(struct sk_buff *skb, unsigned int from, unsigned int to, struct ts_config *config, struct ts_state *state)
|
/* Finds a pattern in the skb data according to the specified textsearch configuration. Use textsearch_next() to retrieve subsequent occurrences of the pattern. Returns the offset to the first occurrence or UINT_MAX if no match was found. */
unsigned int skb_find_text(struct sk_buff *skb, unsigned int from, unsigned int to, struct ts_config *config, struct ts_state *state)
|
{
unsigned int ret;
config->get_next_block = skb_ts_get_next_block;
config->finish = skb_ts_finish;
skb_prepare_seq_read(skb, from, to, TS_SKB_CB(state));
ret = textsearch_find(config, state);
return (ret <= to - from ? ret : UINT_MAX);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This function replaces the original EthernetPacketNonBlockingGet() API and performs the same actions. A macro is provided in */
|
long EthernetPacketGetNonBlocking(unsigned long ulBase, unsigned char *pucBuf, long lBufLen)
|
/* This function replaces the original EthernetPacketNonBlockingGet() API and performs the same actions. A macro is provided in */
long EthernetPacketGetNonBlocking(unsigned long ulBase, unsigned char *pucBuf, long lBufLen)
|
{
ASSERT(ulBase == ETH_BASE);
ASSERT(pucBuf != 0);
ASSERT(lBufLen > 0);
if((HWREG(ulBase + MAC_O_NP) & MAC_NP_NPR_M) == 0)
{
return(0);
}
return(EthernetPacketGetInternal(ulBase, pucBuf, lBufLen));
}
|
watterott/WebRadio
|
C++
| null | 71
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.