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
|
|---|---|---|---|---|---|---|---|
/* And this will not need be used when (and if) we'll add support to the host SKAS patch. */
|
int arch_switch_tls(struct task_struct *to)
|
/* And this will not need be used when (and if) we'll add support to the host SKAS patch. */
int arch_switch_tls(struct task_struct *to)
|
{
if (!host_supports_tls)
return 0;
if (likely(to->mm))
return load_TLS(O_FORCE, to);
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* let's be hotplug friendly. in case of multiple core processors, the first core always takes ownership of shared sysfs dir/files, and rest of the cores will be symlinked to it. */
|
static void deallocate_threshold_block(unsigned int cpu, unsigned int bank)
|
/* let's be hotplug friendly. in case of multiple core processors, the first core always takes ownership of shared sysfs dir/files, and rest of the cores will be symlinked to it. */
static void deallocate_threshold_block(unsigned int cpu, unsigned int bank)
|
{
struct threshold_block *pos = NULL;
struct threshold_block *tmp = NULL;
struct threshold_bank *head = per_cpu(threshold_banks, cpu)[bank];
if (!head)
return;
list_for_each_entry_safe(pos, tmp, &head->blocks->miscj, miscj) {
kobject_put(&pos->kobj);
list_del(&pos->miscj);
kfree(pos);
}
kfree(per_cpu(threshold_banks, cpu)[bank]->blocks);
per_cpu(threshold_banks, cpu)[bank]->blocks = NULL;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Returns CR_OK upon successful completion or, CR_BAD_PARAM_ERROR if at least one of the parameters is invalid; CR_OUT_OF_BOUNDS_ERROR if the indexed byte is out of bounds. */
|
enum CRStatus cr_input_peek_byte(CRInput *a_this, enum CRSeekPos a_origin, gulong a_offset, guchar *a_byte)
|
/* Returns CR_OK upon successful completion or, CR_BAD_PARAM_ERROR if at least one of the parameters is invalid; CR_OUT_OF_BOUNDS_ERROR if the indexed byte is out of bounds. */
enum CRStatus cr_input_peek_byte(CRInput *a_this, enum CRSeekPos a_origin, gulong a_offset, guchar *a_byte)
|
{
gulong abs_offset = 0;
g_return_val_if_fail (a_this && PRIVATE (a_this)
&& a_byte, CR_BAD_PARAM_ERROR);
switch (a_origin) {
case CR_SEEK_CUR:
abs_offset = PRIVATE (a_this)->next_byte_index - 1 + a_offset;
break;
case CR_SEEK_BEGIN:
abs_offset = a_offset;
break;
case CR_SEEK_END:
abs_offset = PRIVATE (a_this)->in_buf_size - 1 - a_offset;
break;
default:
return CR_BAD_PARAM_ERROR;
}
if (abs_offset < PRIVATE (a_this)->in_buf_size) {
*a_byte = PRIVATE (a_this)->in_buf[abs_offset];
return CR_OK;
} else {
return CR_END_OF_INPUT_ERROR;
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Sanitize the service_lines in *fmt per the video std, and return 1 if any service_line is left as valid after santization */
|
static int check_service_set(struct v4l2_sliced_vbi_format *fmt, int is_pal)
|
/* Sanitize the service_lines in *fmt per the video std, and return 1 if any service_line is left as valid after santization */
static int check_service_set(struct v4l2_sliced_vbi_format *fmt, int is_pal)
|
{
int f, l;
u16 set = 0;
for (f = 0; f < 2; f++) {
for (l = 0; l < 24; l++) {
fmt->service_lines[f][l] = select_service_from_set(f, l, fmt->service_lines[f][l], is_pal);
set |= fmt->service_lines[f][l];
}
}
return set != 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Get clock source for an '8254' counter subdevice channel. */
|
static int dio200_get_clock_src(struct dio200_subdev_8254 *subpriv, unsigned int counter_number, unsigned int *period_ns)
|
/* Get clock source for an '8254' counter subdevice channel. */
static int dio200_get_clock_src(struct dio200_subdev_8254 *subpriv, unsigned int counter_number, unsigned int *period_ns)
|
{
unsigned clock_src;
if (!subpriv->has_clk_gat_sce)
return -1;
if (counter_number > 2)
return -1;
clock_src = subpriv->clock_src[counter_number];
*period_ns = clock_period[clock_src];
return clock_src;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Returns the width in pixels of a string when it is rendered.
This function only applied to bitmap fonts (which can have variable widths). All smallfonts (if available) are fixed width and can easily have their width calculated without costly functions like this one. */
|
uint16_t fontsGetStringWidth(const FONT_INFO *fontInfo, char *str)
|
/* Returns the width in pixels of a string when it is rendered.
This function only applied to bitmap fonts (which can have variable widths). All smallfonts (if available) are fixed width and can easily have their width calculated without costly functions like this one. */
uint16_t fontsGetStringWidth(const FONT_INFO *fontInfo, char *str)
|
{
uint16_t width = 0;
uint32_t currChar;
uint32_t startChar = fontInfo->startChar;
for (currChar = *str; currChar; currChar = *(++str))
{
if (fontInfo->charInfo != NULL)
{
width += fontInfo->charInfo[currChar - startChar].widthBits + 1;
}
else
{
width += 5 + 1;
}
}
return width > 0 ? width - 1 : width;
}
|
microbuilder/LPC1343CodeBase
|
C++
|
Other
| 73
|
/* If OpCodeHandle is NULL, then ASSERT(). If Type is invalid, then ASSERT(). If Flags is invalid, then ASSERT(). */
|
UINT8* EFIAPI HiiCreateOneOfOptionOpCode(IN VOID *OpCodeHandle, IN UINT16 StringId, IN UINT8 Flags, IN UINT8 Type, IN UINT64 Value)
|
/* If OpCodeHandle is NULL, then ASSERT(). If Type is invalid, then ASSERT(). If Flags is invalid, then ASSERT(). */
UINT8* EFIAPI HiiCreateOneOfOptionOpCode(IN VOID *OpCodeHandle, IN UINT16 StringId, IN UINT8 Flags, IN UINT8 Type, IN UINT64 Value)
|
{
EFI_IFR_ONE_OF_OPTION OpCode;
ASSERT (Type < EFI_IFR_TYPE_OTHER);
ZeroMem (&OpCode, sizeof (OpCode));
OpCode.Option = StringId;
OpCode.Flags = (UINT8)(Flags & (EFI_IFR_OPTION_DEFAULT | EFI_IFR_OPTION_DEFAULT_MFG));
OpCode.Type = Type;
CopyMem (&OpCode.Value, &Value, mHiiDefaultTypeToWidth[Type]);
return InternalHiiCreateOpCode (OpCodeHandle, &OpCode, EFI_IFR_ONE_OF_OPTION_OP, OFFSET_OF (EFI_IFR_ONE_OF_OPTION, Value) + mHiiDefaultTypeToWidth[Type]);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Release any resources in case of a failure */
|
static void dio_cleanup(struct dio *dio)
|
/* Release any resources in case of a failure */
static void dio_cleanup(struct dio *dio)
|
{
while (dio_pages_present(dio))
page_cache_release(dio_get_page(dio));
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Configures the voltage threshold detected by the Power Voltage Detector(PVD). */
|
void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel)
|
/* Configures the voltage threshold detected by the Power Voltage Detector(PVD). */
void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel)
|
{
uint32_t tmpregister = 0;
assert_param(IS_PWR_PVD_LEVEL(PWR_PVDLevel));
tmpregister = PWR->CTRL2;
tmpregister &= (~PWR_CTRL2_PLSMASK);
tmpregister |= PWR_PVDLevel;
PWR->CTRL2 = tmpregister;
}
|
pikasTech/PikaPython
|
C++
|
MIT License
| 1,403
|
/* Checks whether the specified LCD flag is set or not. */
|
FlagStatus LCD_GetFlagStatus(uint32_t LCD_FLAG)
|
/* Checks whether the specified LCD flag is set or not. */
FlagStatus LCD_GetFlagStatus(uint32_t LCD_FLAG)
|
{
FlagStatus bitstatus = RESET;
assert_param(IS_LCD_GET_FLAG(LCD_FLAG));
if ((LCD->SR & LCD_FLAG) != (uint32_t)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
}
|
avem-labs/Avem
|
C++
|
MIT License
| 1,752
|
/* Returns the number of bits used by the data bus of a NAND Flash device. */
|
uint32_t nand_flash_model_get_data_bus_width(const struct nand_flash_model *model)
|
/* Returns the number of bits used by the data bus of a NAND Flash device. */
uint32_t nand_flash_model_get_data_bus_width(const struct nand_flash_model *model)
|
{
return (model->options & NAND_FLASH_MODEL_DATA_BUS_16) ? 16 : 8;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* This should be called from the @destroy method of an I2C slave encoder driver once I2C access is no longer needed. */
|
void drm_i2c_encoder_destroy(struct drm_encoder *drm_encoder)
|
/* This should be called from the @destroy method of an I2C slave encoder driver once I2C access is no longer needed. */
void drm_i2c_encoder_destroy(struct drm_encoder *drm_encoder)
|
{
struct drm_encoder_slave *encoder = to_encoder_slave(drm_encoder);
struct i2c_client *client = drm_i2c_encoder_get_client(drm_encoder);
struct module *module = client->driver->driver.owner;
i2c_unregister_device(client);
encoder->bus_priv = NULL;
module_put(module);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Stop Absolute Pointer protocol ConSplitter on ControllerHandle by closing Absolute Pointer protocol. */
|
EFI_STATUS EFIAPI ConSplitterAbsolutePointerDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
|
/* Stop Absolute Pointer protocol ConSplitter on ControllerHandle by closing Absolute Pointer protocol. */
EFI_STATUS EFIAPI ConSplitterAbsolutePointerDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
|
{
EFI_STATUS Status;
EFI_ABSOLUTE_POINTER_PROTOCOL *AbsolutePointer;
if (NumberOfChildren == 0) {
return EFI_SUCCESS;
}
Status = ConSplitterStop (
This,
ControllerHandle,
mConIn.VirtualHandle,
&gEfiAbsolutePointerProtocolGuid,
&gEfiAbsolutePointerProtocolGuid,
(VOID **)&AbsolutePointer
);
if (EFI_ERROR (Status)) {
return Status;
}
return ConSplitterAbsolutePointerDeleteDevice (&mConIn, AbsolutePointer);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Get Reception buffering mode @rmtoll CR RXMODE LL_SWPMI_GetReceptionMode. */
|
uint32_t LL_SWPMI_GetReceptionMode(SWPMI_TypeDef *SWPMIx)
|
/* Get Reception buffering mode @rmtoll CR RXMODE LL_SWPMI_GetReceptionMode. */
uint32_t LL_SWPMI_GetReceptionMode(SWPMI_TypeDef *SWPMIx)
|
{
return (uint32_t)(READ_BIT(SWPMIx->CR, SWPMI_CR_RXMODE));
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Setup the PC, SP, and GP of a secondary processor and start it running! smp_bootstrap is the place to resume from __KSTK_TOS(idle) is apparently the stack pointer (unsigned long)idle->thread_info the gp */
|
void __cpuinit smtc_boot_secondary(int cpu, struct task_struct *idle)
|
/* Setup the PC, SP, and GP of a secondary processor and start it running! smp_bootstrap is the place to resume from __KSTK_TOS(idle) is apparently the stack pointer (unsigned long)idle->thread_info the gp */
void __cpuinit smtc_boot_secondary(int cpu, struct task_struct *idle)
|
{
extern u32 kernelsp[NR_CPUS];
unsigned long flags;
int mtflags;
LOCK_MT_PRA();
if (cpu_data[cpu].vpe_id != cpu_data[smp_processor_id()].vpe_id) {
dvpe();
}
settc(cpu_data[cpu].tc_id);
write_tc_c0_tcrestart((unsigned long)&smp_bootstrap);
kernelsp[cpu] = __KSTK_TOS(idle);
write_tc_gpr_sp(__KSTK_TOS(idle));
write_tc_gpr_gp((unsigned long)task_thread_info(idle));
smtc_status |= SMTC_MTC_ACTIVE;
write_tc_c0_tchalt(0);
if (cpu_data[cpu].vpe_id != cpu_data[smp_processor_id()].vpe_id) {
evpe(EVPE_ENABLE);
}
UNLOCK_MT_PRA();
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* This routine should set everything up anew at each open, even registers that "should" only need to be set once at boot, so that there is non-reboot way to recover if something goes wrong. */
|
static int tc35815_open(struct net_device *dev)
|
/* This routine should set everything up anew at each open, even registers that "should" only need to be set once at boot, so that there is non-reboot way to recover if something goes wrong. */
static int tc35815_open(struct net_device *dev)
|
{
struct tc35815_local *lp = netdev_priv(dev);
if (request_irq(dev->irq, tc35815_interrupt, IRQF_SHARED,
dev->name, dev))
return -EAGAIN;
tc35815_chip_reset(dev);
if (tc35815_init_queues(dev) != 0) {
free_irq(dev->irq, dev);
return -EAGAIN;
}
napi_enable(&lp->napi);
spin_lock_irq(&lp->lock);
tc35815_chip_init(dev);
spin_unlock_irq(&lp->lock);
netif_carrier_off(dev);
phy_start(lp->phy_dev);
netif_start_queue(dev);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Called whenever the timer says to check the free space. */
|
static void acct_timeout(unsigned long x)
|
/* Called whenever the timer says to check the free space. */
static void acct_timeout(unsigned long x)
|
{
struct bsd_acct_struct *acct = (struct bsd_acct_struct *)x;
acct->needcheck = 1;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Retrieves the new idle rate of the input report from the USB host. */
|
static void HIDDJoystickDriver_SetIdle(unsigned char idleRate)
|
/* Retrieves the new idle rate of the input report from the USB host. */
static void HIDDJoystickDriver_SetIdle(unsigned char idleRate)
|
{
TRACE_INFO("sIdle(%d) ", idleRate);
hiddJoystickDriver.inputReportIdleRate = idleRate;
USBD_Write(0, 0, 0, 0, 0);
}
|
opentx/opentx
|
C++
|
GNU General Public License v2.0
| 2,025
|
/* Dispatch the correct update page function to call based on the UpdatePageId. */
|
VOID UpdatePageBody(IN UINT16 UpdatePageId, IN BMM_CALLBACK_DATA *CallbackData)
|
/* Dispatch the correct update page function to call based on the UpdatePageId. */
VOID UpdatePageBody(IN UINT16 UpdatePageId, IN BMM_CALLBACK_DATA *CallbackData)
|
{
CleanUpPage (UpdatePageId, CallbackData);
switch (UpdatePageId) {
case FORM_CON_IN_ID:
UpdateConsolePage (UpdatePageId, &ConsoleInpMenu, CallbackData);
break;
case FORM_CON_OUT_ID:
UpdateConsolePage (UpdatePageId, &ConsoleOutMenu, CallbackData);
break;
case FORM_CON_ERR_ID:
UpdateConsolePage (UpdatePageId, &ConsoleErrMenu, CallbackData);
break;
case FORM_BOOT_CHG_ID:
UpdateOrderPage (UpdatePageId, &BootOptionMenu, CallbackData);
break;
case FORM_DRV_CHG_ID:
UpdateOrderPage (UpdatePageId, &DriverOptionMenu, CallbackData);
break;
default:
break;
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* This function is called in interrupt context, so the cdev lock for device is already locked! */
|
static void _stop_all_devices_on_lcu(struct alias_lcu *lcu, struct dasd_device *device)
|
/* This function is called in interrupt context, so the cdev lock for device is already locked! */
static void _stop_all_devices_on_lcu(struct alias_lcu *lcu, struct dasd_device *device)
|
{
struct alias_pav_group *pavgroup;
struct dasd_device *pos;
list_for_each_entry(pos, &lcu->active_devices, alias_list)
__stop_device_on_lcu(device, pos);
list_for_each_entry(pos, &lcu->inactive_devices, alias_list)
__stop_device_on_lcu(device, pos);
list_for_each_entry(pavgroup, &lcu->grouplist, group) {
list_for_each_entry(pos, &pavgroup->baselist, alias_list)
__stop_device_on_lcu(device, pos);
list_for_each_entry(pos, &pavgroup->aliaslist, alias_list)
__stop_device_on_lcu(device, pos);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Decodes the scsi sense code after a scsi READ CAPACITY command failed. */
|
static void uhi_msc_scsi_read_capacity_sense(void)
|
/* Decodes the scsi sense code after a scsi READ CAPACITY command failed. */
static void uhi_msc_scsi_read_capacity_sense(void)
|
{
uhi_msc_scsi_callback(false);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned. */
|
UINTN EFIAPI UnicodeBSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString, IN BASE_LIST Marker)
|
/* If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned. */
UINTN EFIAPI UnicodeBSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString, IN BASE_LIST Marker)
|
{
ASSERT_UNICODE_BUFFER (StartOfBuffer);
ASSERT_UNICODE_BUFFER (FormatString);
return mPrint2SProtocol->UnicodeBSPrint (StartOfBuffer, BufferSize, FormatString, Marker);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* param base Pointer to FLEXIO_I2S_Type structure. param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state */
|
void FLEXIO_I2S_TransferAbortReceive(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle)
|
/* param base Pointer to FLEXIO_I2S_Type structure. param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state */
void FLEXIO_I2S_TransferAbortReceive(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle)
|
{
assert(handle);
FLEXIO_I2S_DisableInterrupts(base, kFLEXIO_I2S_RxDataRegFullInterruptEnable);
handle->state = kFLEXIO_I2S_Idle;
memset(handle->queue, 0, sizeof(flexio_i2s_transfer_t) * FLEXIO_I2S_XFER_QUEUE_SIZE);
handle->queueDriver = 0;
handle->queueUser = 0;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Deinitializes the Global MSP. This function is called from HAL_DeInit() function to perform system level Deinitialization (GPIOs, clock, DMA, interrupt). */
|
void HAL_MspDeInit(void)
|
/* Deinitializes the Global MSP. This function is called from HAL_DeInit() function to perform system level Deinitialization (GPIOs, clock, DMA, interrupt). */
void HAL_MspDeInit(void)
|
{
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_8, GPIO_PIN_RESET);
HAL_GPIO_DeInit(GPIOE, GPIO_PIN_8);
__HAL_RCC_GPIOA_CLK_DISABLE();
__HAL_RCC_GPIOE_CLK_DISABLE();
__HAL_RCC_GPIOF_CLK_DISABLE();
__HAL_RCC_SYSCFG_CLK_DISABLE();
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* ADC Enable Automatic Injected Conversions.
The ADC converts a defined injected group of channels immediately after the regular channels have been converted. The external trigger on the injected channels is disabled as required. */
|
void adc_enable_automatic_injected_group_conversion(uint32_t adc)
|
/* ADC Enable Automatic Injected Conversions.
The ADC converts a defined injected group of channels immediately after the regular channels have been converted. The external trigger on the injected channels is disabled as required. */
void adc_enable_automatic_injected_group_conversion(uint32_t adc)
|
{
adc_disable_external_trigger_injected(adc);
ADC_CR1(adc) |= ADC_CR1_JAUTO;
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* Called to send an abort and then wait for abort completion */
|
static int fc_fcp_pkt_abort(struct fc_fcp_pkt *fsp)
|
/* Called to send an abort and then wait for abort completion */
static int fc_fcp_pkt_abort(struct fc_fcp_pkt *fsp)
|
{
int rc = FAILED;
if (fc_fcp_send_abort(fsp))
return FAILED;
init_completion(&fsp->tm_done);
fsp->wait_for_comp = 1;
spin_unlock_bh(&fsp->scsi_pkt_lock);
rc = wait_for_completion_timeout(&fsp->tm_done, FC_SCSI_TM_TOV);
spin_lock_bh(&fsp->scsi_pkt_lock);
fsp->wait_for_comp = 0;
if (!rc) {
FC_FCP_DBG(fsp, "target abort cmd failed\n");
rc = FAILED;
} else if (fsp->state & FC_SRB_ABORTED) {
FC_FCP_DBG(fsp, "target abort cmd passed\n");
rc = SUCCESS;
fc_fcp_complete_locked(fsp);
}
return rc;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* 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==TIM4)
{
__HAL_RCC_TIM4_CLK_ENABLE();
}
else if(htim_base->Instance==TIM14)
{
__HAL_RCC_TIM14_CLK_ENABLE();
}
else if(htim_base->Instance==TIM16)
{
__HAL_RCC_TIM16_CLK_ENABLE();
}
else if(htim_base->Instance==TIM17)
{
__HAL_RCC_TIM17_CLK_ENABLE();
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* efx_mdio_set_settings - Set (some of) the PHY settings over MDIO. @efx: Efx NIC @ecmd: New settings */
|
int efx_mdio_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
|
/* efx_mdio_set_settings - Set (some of) the PHY settings over MDIO. @efx: Efx NIC @ecmd: New settings */
int efx_mdio_set_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd)
|
{
struct ethtool_cmd prev;
efx->phy_op->get_settings(efx, &prev);
if (ecmd->advertising == prev.advertising &&
ecmd->speed == prev.speed &&
ecmd->duplex == prev.duplex &&
ecmd->port == prev.port &&
ecmd->autoneg == prev.autoneg)
return 0;
if (prev.port != PORT_TP || ecmd->port != PORT_TP)
return -EINVAL;
if (!ecmd->autoneg ||
(ecmd->advertising | SUPPORTED_Autoneg) & ~prev.supported)
return -EINVAL;
efx_link_set_advertising(efx, ecmd->advertising | ADVERTISED_Autoneg);
efx_mdio_an_reconfigure(efx);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* @scsi_device: The new scsi device that we need to handle. */
|
static int dc395x_slave_alloc(struct scsi_device *scsi_device)
|
/* @scsi_device: The new scsi device that we need to handle. */
static int dc395x_slave_alloc(struct scsi_device *scsi_device)
|
{
struct AdapterCtlBlk *acb = (struct AdapterCtlBlk *)scsi_device->host->hostdata;
struct DeviceCtlBlk *dcb;
dcb = device_alloc(acb, scsi_device->id, scsi_device->lun);
if (!dcb)
return -ENOMEM;
adapter_add_device(acb, dcb);
return 0;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* STOPs do not generate an interrupt or set the SI flag, since the part returns the idle state (0xf8). Hence we don't need to pca_wait here. */
|
static void pca_stop(struct i2c_algo_pca_data *adap)
|
/* STOPs do not generate an interrupt or set the SI flag, since the part returns the idle state (0xf8). Hence we don't need to pca_wait here. */
static void pca_stop(struct i2c_algo_pca_data *adap)
|
{
int sta = pca_get_con(adap);
DEB2("=== STOP\n");
sta |= I2C_PCA_CON_STO;
sta &= ~(I2C_PCA_CON_STA|I2C_PCA_CON_SI);
pca_set_con(adap, sta);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Deinitializes the DMA Channeln registers to their default reset values. */
|
void DMA_DeInit(DMA_Channel_TypeDef *channel)
|
/* Deinitializes the DMA Channeln registers to their default reset values. */
void DMA_DeInit(DMA_Channel_TypeDef *channel)
|
{
channel->CCR &= ~DMA_CCR_EN;
channel->CCR = 0;
channel->CNDTR = 0;
channel->CPAR = 0;
channel->CMAR = 0;
if((*(vu32*)&channel) >= (*(vu32*)DMA2_Channel1_BASE)) {
DMA2->IFCR |= (u32)0x0F << (((*(vu32*)&channel & (u32)0xff) - 8) / 5);
}
else {
DMA1->IFCR |= (u32)0x0F << (((*(vu32*)&channel & (u32)0xff) - 8) / 5);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Disable I2C interrupt of the specified I2C port.
The */
|
void I2CIntDisable(unsigned long ulBase, unsigned long ulIntType)
|
/* Disable I2C interrupt of the specified I2C port.
The */
void I2CIntDisable(unsigned long ulBase, unsigned long ulIntType)
|
{
xASSERT((ulBase == I2C0_BASE) || ((ulBase == I2C1_BASE)));
if(ulIntType & I2C_INT_FUNCTION)
{
xHWREGB(ulBase + I2C_CON1) &= ~I2C_CON1_IE;
}
if(ulIntType & I2C_INT_BUS_STOP)
{
xHWREGB(ulBase + I2C_FLT) &= ~I2C_FLT_STOPIE;
}
if(ulIntType & I2C_INT_TIMEOUT)
{
xHWREGB(ulBase + I2C_SMB) &= ~I2C_SMB_SHTF2IE;
}
xIntDisable(INT_I2C0);
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Lookup the mii_dev struct by the registered device name. */
|
struct mii_dev* miiphy_get_dev_by_name(const char *devname)
|
/* Lookup the mii_dev struct by the registered device name. */
struct mii_dev* miiphy_get_dev_by_name(const char *devname)
|
{
struct list_head *entry;
struct mii_dev *dev;
if (!devname) {
printf("NULL device name!\n");
return NULL;
}
list_for_each(entry, &mii_devs) {
dev = list_entry(entry, struct mii_dev, link);
if (strcmp(dev->name, devname) == 0)
return dev;
}
return NULL;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Returns: the #GList element at the head of the queue, or NULL if the queue is empty */
|
GList* g_queue_pop_head_link(GQueue *queue)
|
/* Returns: the #GList element at the head of the queue, or NULL if the queue is empty */
GList* g_queue_pop_head_link(GQueue *queue)
|
{
g_return_val_if_fail (queue != NULL, NULL);
if (queue->head)
{
GList *node = queue->head;
queue->head = node->next;
if (queue->head)
{
queue->head->prev = NULL;
node->next = NULL;
}
else
queue->tail = NULL;
queue->length--;
return node;
}
return NULL;
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Free RX free list and response queue resources. */
|
static void free_rx_resources(struct sge *sge)
|
/* Free RX free list and response queue resources. */
static void free_rx_resources(struct sge *sge)
|
{
struct pci_dev *pdev = sge->adapter->pdev;
unsigned int size, i;
if (sge->respQ.entries) {
size = sizeof(struct respQ_e) * sge->respQ.size;
pci_free_consistent(pdev, size, sge->respQ.entries,
sge->respQ.dma_addr);
}
for (i = 0; i < SGE_FREELQ_N; i++) {
struct freelQ *q = &sge->freelQ[i];
if (q->centries) {
free_freelQ_buffers(pdev, q);
kfree(q->centries);
}
if (q->entries) {
size = sizeof(struct freelQ_e) * q->size;
pci_free_consistent(pdev, size, q->entries,
q->dma_addr);
}
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* ppc440spe_desc_init_interrupt - initialize the descriptor for INTERRUPT pseudo operation */
|
static void ppc440spe_desc_init_interrupt(struct ppc440spe_adma_desc_slot *desc, struct ppc440spe_adma_chan *chan)
|
/* ppc440spe_desc_init_interrupt - initialize the descriptor for INTERRUPT pseudo operation */
static void ppc440spe_desc_init_interrupt(struct ppc440spe_adma_desc_slot *desc, struct ppc440spe_adma_chan *chan)
|
{
struct xor_cb *p;
switch (chan->device->id) {
case PPC440SPE_XOR_ID:
p = desc->hw_desc;
memset(desc->hw_desc, 0, sizeof(struct xor_cb));
p->cbc = XOR_CBCR_CBCE_BIT;
break;
case PPC440SPE_DMA0_ID:
case PPC440SPE_DMA1_ID:
memset(desc->hw_desc, 0, sizeof(struct dma_cdb));
set_bit(PPC440SPE_DESC_INT, &desc->flags);
break;
default:
printk(KERN_ERR "Unsupported id %d in %s\n", chan->device->id,
__func__);
break;
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Handle unplugging of the device. We call video_unregister_device in any case. The last function called in this procedure is usb_dsbr100_video_device_release */
|
static void usb_dsbr100_disconnect(struct usb_interface *intf)
|
/* Handle unplugging of the device. We call video_unregister_device in any case. The last function called in this procedure is usb_dsbr100_video_device_release */
static void usb_dsbr100_disconnect(struct usb_interface *intf)
|
{
struct dsbr100_device *radio = usb_get_intfdata(intf);
usb_set_intfdata (intf, NULL);
mutex_lock(&radio->lock);
radio->removed = 1;
mutex_unlock(&radio->lock);
video_unregister_device(&radio->videodev);
v4l2_device_disconnect(&radio->v4l2_dev);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* inserts a new key into a hash table; first, check whether key's main position is free. If not, check whether colliding node is in its main position or not: if it is not, move colliding node to an empty place and put new key in its main position; otherwise (colliding node is in its main position), new key goes to an empty position. */
|
static TValue* newkey(lua_State *L, Table *t, const TValue *key)
|
/* inserts a new key into a hash table; first, check whether key's main position is free. If not, check whether colliding node is in its main position or not: if it is not, move colliding node to an empty place and put new key in its main position; otherwise (colliding node is in its main position), new key goes to an empty position. */
static TValue* newkey(lua_State *L, Table *t, const TValue *key)
|
{
Node *othern;
Node *n = getfreepos(t);
if (n == NULL) {
rehash(L, t, key);
return luaH_set(L, t, key);
}
lua_assert(n != dummynode);
othern = mainposition(t, key2tval(mp));
if (othern != mp) {
while (gnext(othern) != mp) othern = gnext(othern);
gnext(othern) = n;
*n = *mp;
gnext(mp) = NULL;
setnilvalue(gval(mp));
}
else {
gnext(n) = gnext(mp);
gnext(mp) = n;
mp = n;
}
}
gkey(mp)->value = key->value; gkey(mp)->tt = key->tt;
luaC_barriert(L, t, key);
lua_assert(ttisnil(gval(mp)));
return gval(mp);
}
|
DC-SWAT/DreamShell
|
C++
| null | 404
|
/* link changed callback (if phylib is not used) */
|
static void bcm_enet_adjust_link(struct net_device *dev)
|
/* link changed callback (if phylib is not used) */
static void bcm_enet_adjust_link(struct net_device *dev)
|
{
struct bcm_enet_priv *priv;
priv = netdev_priv(dev);
bcm_enet_set_duplex(priv, priv->force_duplex_full);
bcm_enet_set_flow(priv, priv->pause_rx, priv->pause_tx);
netif_carrier_on(dev);
pr_info("%s: link forced UP - %d/%s - flow control %s/%s\n",
dev->name,
priv->force_speed_100 ? 100 : 10,
priv->force_duplex_full ? "full" : "half",
priv->pause_rx ? "rx" : "off",
priv->pause_tx ? "tx" : "off");
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* DevicePathNode must be 1394 type and this will populate the MappingItem. */
|
EFI_STATUS DevPathSerial1394(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
|
/* DevicePathNode must be 1394 type and this will populate the MappingItem. */
EFI_STATUS DevPathSerial1394(IN EFI_DEVICE_PATH_PROTOCOL *DevicePathNode, IN DEVICE_CONSIST_MAPPING_INFO *MappingItem, IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
|
{
F1394_DEVICE_PATH *DevicePath_F1394;
CHAR16 Buffer[20];
ASSERT (DevicePathNode != NULL);
ASSERT (MappingItem != NULL);
DevicePath_F1394 = (F1394_DEVICE_PATH *)DevicePathNode;
UnicodeSPrint (Buffer, 0, L"%lx", DevicePath_F1394->Guid);
return AppendCSDStr (MappingItem, Buffer);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Update the progress information of the progress bar box. */
|
void update_progress_dlg(progdlg_t *dlg, gfloat percentage, const gchar *)
|
/* Update the progress information of the progress bar box. */
void update_progress_dlg(progdlg_t *dlg, gfloat percentage, const gchar *)
|
{
if (!dlg) return;
dlg->progress_frame->setValue(percentage * 100);
WiresharkApplication::processEvents();
dlg->progress_frame->update();
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* This file is part of the Simba project. */
|
static uint32_t rotateleft(uint32_t value, int positions)
|
/* This file is part of the Simba project. */
static uint32_t rotateleft(uint32_t value, int positions)
|
{
return ((value << positions) | (value >> (32 - positions)));
}
|
eerimoq/simba
|
C++
|
Other
| 337
|
/* Get the width of a glyph with kerning */
|
uint16_t lv_font_get_glyph_width(const lv_font_t *font, uint32_t letter, uint32_t letter_next)
|
/* Get the width of a glyph with kerning */
uint16_t lv_font_get_glyph_width(const lv_font_t *font, uint32_t letter, uint32_t letter_next)
|
{
lv_font_glyph_dsc_t g;
bool ret;
ret = lv_font_get_glyph_dsc(font, &g, letter, letter_next);
if(ret) return g.adv_w;
else return 0;
}
|
alibaba/AliOS-Things
|
C++
|
Apache License 2.0
| 4,536
|
/* The "Mult" field in the endpoint context is only set for SuperSpeed isoc eps. High speed endpoint descriptors can define "the number of additional
transaction opportunities per microframe", but that goes in the Max Burst endpoint context field. */
|
static u32 xhci_get_endpoint_mult(struct usb_device *udev, struct usb_endpoint_descriptor *endpt_desc, struct usb_ss_ep_comp_descriptor *ss_ep_comp_desc)
|
/* The "Mult" field in the endpoint context is only set for SuperSpeed isoc eps. High speed endpoint descriptors can define "the number of additional
transaction opportunities per microframe", but that goes in the Max Burst endpoint context field. */
static u32 xhci_get_endpoint_mult(struct usb_device *udev, struct usb_endpoint_descriptor *endpt_desc, struct usb_ss_ep_comp_descriptor *ss_ep_comp_desc)
|
{
if (udev->speed < USB_SPEED_SUPER ||
!usb_endpoint_xfer_isoc(endpt_desc))
return 0;
return ss_ep_comp_desc->bmAttributes;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Function for reading an element from "parameters data base" in non volatile (NV) memory. An element is GZP_PARAMS_ELEMENT_SYSTEM_ADDRESS bytes long, holding the "system address" and "host ID". */
|
static void gzp_params_db_read(uint8_t *dst_element, uint8_t index)
|
/* Function for reading an element from "parameters data base" in non volatile (NV) memory. An element is GZP_PARAMS_ELEMENT_SYSTEM_ADDRESS bytes long, holding the "system address" and "host ID". */
static void gzp_params_db_read(uint8_t *dst_element, uint8_t index)
|
{
memcpy(dst_element,(uint8_t*)(GZP_PARAMS_DB_ADR + (index * GZP_PARAMS_DB_ELEMENT_SIZE)), GZP_PARAMS_DB_ELEMENT_SIZE);
}
|
labapart/polymcu
|
C++
| null | 201
|
/* Enables or disables the Pin(s) active level inversion. */
|
void USART_InvPinCmd(USART_TypeDef *USARTx, uint32_t USART_InvPin, FunctionalState NewState)
|
/* Enables or disables the Pin(s) active level inversion. */
void USART_InvPinCmd(USART_TypeDef *USARTx, uint32_t USART_InvPin, FunctionalState NewState)
|
{
assert_param(IS_USART_ALL_PERIPH(USARTx));
assert_param(IS_USART_INVERSTION_PIN(USART_InvPin));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
USARTx->CR2 |= USART_InvPin;
}
else
{
USARTx->CR2 &= (uint32_t)~USART_InvPin;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* 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);
}
else if(huart->Instance==USART2)
{
__HAL_RCC_USART2_CLK_DISABLE();
HAL_GPIO_DeInit(GPIOA, USART_TX_Pin|USART_RX_Pin);
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Set number of active data lanes for MIPI-CSI2 controller. */
|
static int32_t mipi_csi2_set_lanes(uint32_t lanes)
|
/* Set number of active data lanes for MIPI-CSI2 controller. */
static int32_t mipi_csi2_set_lanes(uint32_t lanes)
|
{
if (lanes > 4 || lanes < 1)
return FALSE;
BW_MIPI_CSI_N_LANES_N_LANES(lanes - 1);
return TRUE;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Send BlockSid request through TPM physical presence module. */
|
EFI_STATUS HiiSetBlockSidAction(IN UINT32 PpRequest)
|
/* Send BlockSid request through TPM physical presence module. */
EFI_STATUS HiiSetBlockSidAction(IN UINT32 PpRequest)
|
{
UINT32 ReturnCode;
EFI_STATUS Status;
ReturnCode = Tcg2PhysicalPresenceLibSubmitRequestToPreOSFunction (PpRequest, 0);
if (ReturnCode == TCG_PP_SUBMIT_REQUEST_TO_PREOS_SUCCESS) {
Status = EFI_SUCCESS;
} else if (ReturnCode == TCG_PP_SUBMIT_REQUEST_TO_PREOS_GENERAL_FAILURE) {
Status = EFI_OUT_OF_RESOURCES;
} else if (ReturnCode == TCG_PP_SUBMIT_REQUEST_TO_PREOS_NOT_IMPLEMENTED) {
Status = EFI_UNSUPPORTED;
} else {
Status = EFI_DEVICE_ERROR;
}
return Status;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Set preset parameters for fluorescence decay. Helper function for cn0503_fluo_decay_measure/calibrate. */
|
void cn0503_fluo_set_presets(struct cn0503_impulse_response *impresp, uint8_t preset)
|
/* Set preset parameters for fluorescence decay. Helper function for cn0503_fluo_decay_measure/calibrate. */
void cn0503_fluo_set_presets(struct cn0503_impulse_response *impresp, uint8_t preset)
|
{
if (preset == IMPPRESET) {
impresp->sample_period = 2;
impresp->method = IMP;
} else if (preset == TIAPRESET) {
impresp->sample_period = 1;
impresp->method = TIA;
} else if (preset == SSIPRESET) {
impresp->sample_period = 0.25;
impresp->method = SSI;
} else if (preset == MAXRESPRESET) {
impresp->sample_period = 0.03125;
impresp->average_length = 25;
impresp->method = SSI;
}
impresp->first_sample_offset = 0;
}
|
analogdevicesinc/EVAL-ADICUP3029
|
C++
|
Other
| 36
|
/* Change Logs: Date Author Notes Meco Man first version */
|
static int init(void)
|
/* Change Logs: Date Author Notes Meco Man first version */
static int init(void)
|
{
sfud_dev = rt_sfud_flash_find_by_dev_name("W25Q128");
if (RT_NULL == sfud_dev)
{
return -1;
}
w25q128.blk_size = sfud_dev->chip.erase_gran;
w25q128.len = sfud_dev->chip.capacity;
return 0;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Release a MMC host, allowing others to claim the host for their operations. */
|
void mmc_release_host(struct mmc_host *host)
|
/* Release a MMC host, allowing others to claim the host for their operations. */
void mmc_release_host(struct mmc_host *host)
|
{
WARN_ON(!host->claimed);
mmc_host_lazy_disable(host);
mmc_do_release_host(host);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* In this case, we are reading the DVID (Read-only Device Identification) value of the Neo card. */
|
static void neo_pci_posting_flush(struct jsm_board *bd)
|
/* In this case, we are reading the DVID (Read-only Device Identification) value of the Neo card. */
static void neo_pci_posting_flush(struct jsm_board *bd)
|
{
readb(bd->re_map_membase + 0x8D);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Event notification function for SIMPLE_POINTER.WaitForInput event. Signal the event if there is input from mouse. */
|
VOID EFIAPI MouseWaitForInput(IN EFI_EVENT Event, IN VOID *Context)
|
/* Event notification function for SIMPLE_POINTER.WaitForInput event. Signal the event if there is input from mouse. */
VOID EFIAPI MouseWaitForInput(IN EFI_EVENT Event, IN VOID *Context)
|
{
PS2_MOUSE_DEV *MouseDev;
MouseDev = (PS2_MOUSE_DEV *)Context;
if (MouseDev->StateChanged) {
gBS->SignalEvent (Event);
}
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Select the source of Microcontroller Clock Output.
@parame mcosrc the unshifted source bits */
|
void rcc_set_mco(uint32_t mcosrc)
|
/* Select the source of Microcontroller Clock Output.
@parame mcosrc the unshifted source bits */
void rcc_set_mco(uint32_t mcosrc)
|
{
RCC_CFGR = (RCC_CFGR & ~(RCC_CFGR_MCO_MASK << RCC_CFGR_MCO_SHIFT)) |
(mcosrc << RCC_CFGR_MCO_SHIFT);
}
|
insane-adding-machines/unicore-mx
|
C++
|
GNU General Public License v3.0
| 50
|
/* This is guaranteed to be a stable sort since version 2.32. */
|
void g_ptr_array_sort(GPtrArray *array, GCompareFunc compare_func)
|
/* This is guaranteed to be a stable sort since version 2.32. */
void g_ptr_array_sort(GPtrArray *array, GCompareFunc compare_func)
|
{
g_return_if_fail (array != NULL);
g_qsort_with_data (array->pdata,
array->len,
sizeof (gpointer),
(GCompareDataFunc)compare_func,
NULL);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Clear Timer Interrupt Flag. This function is used to clear special timer interrupt flag. */
|
void TimerIntStatusClear(unsigned long ulBase, unsigned long ulIntFlags)
|
/* Clear Timer Interrupt Flag. This function is used to clear special timer interrupt flag. */
void TimerIntStatusClear(unsigned long ulBase, unsigned long ulIntFlags)
|
{
xASSERT((ulBase == TIMER0_BASE) || (ulBase == TIMER1_BASE) ||
(ulBase == TIMER2_BASE) || (ulBase == TIMER3_BASE) );
xHWREG(ulBase + TIMER_IR) |= ulIntFlags;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* Puts a data element into the SPI transmit FIFO. */
|
void SPIDataPut(unsigned long ulBase, unsigned long ulData)
|
/* Puts a data element into the SPI transmit FIFO. */
void SPIDataPut(unsigned long ulBase, unsigned long ulData)
|
{
xASSERT((ulBase == SPI3_BASE) || (ulBase == SPI1_BASE)||
(ulBase == SPI2_BASE));
while(!(xHWREG(ulBase + SPI_SR) & SPI_SR_TXE))
{
}
xHWREG(ulBase + SPI_DR) = ulData;
}
|
coocox/cox
|
C++
|
Berkeley Software Distribution (BSD)
| 104
|
/* All-zero MAC addresses are rejected, because those could be properties that exist in the device tree, but were not set by U-Boot. For example, the DTS could define 'mac-address' and 'local-mac-address', with zero MAC addresses. Some older U-Boots only initialized 'local-mac-address'. In this case, the real MAC is in 'local-mac-address', and 'mac-address' exists but is all zeros. */
|
const void* of_get_mac_address(struct device_node *np)
|
/* All-zero MAC addresses are rejected, because those could be properties that exist in the device tree, but were not set by U-Boot. For example, the DTS could define 'mac-address' and 'local-mac-address', with zero MAC addresses. Some older U-Boots only initialized 'local-mac-address'. In this case, the real MAC is in 'local-mac-address', and 'mac-address' exists but is all zeros. */
const void* of_get_mac_address(struct device_node *np)
|
{
struct property *pp;
pp = of_find_property(np, "mac-address", NULL);
if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value))
return pp->value;
pp = of_find_property(np, "local-mac-address", NULL);
if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value))
return pp->value;
pp = of_find_property(np, "address", NULL);
if (pp && (pp->length == 6) && is_valid_ether_addr(pp->value))
return pp->value;
return NULL;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Check whether if UART is busy or not. */
|
FlagStatus UART_CheckBusy(LPC_UART_TypeDef *UARTx)
|
/* Check whether if UART is busy or not. */
FlagStatus UART_CheckBusy(LPC_UART_TypeDef *UARTx)
|
{
if (UARTx->LSR & UART_LSR_TEMT)
{
return RESET;
}
else
{
return SET;
}
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Checks whether the specified HRTIM common interrupt has occurred or not. */
|
ITStatus HRTIM_GetCommonITStatus(HRTIM_TypeDef *HRTIMx, uint32_t HRTIM_CommonIT)
|
/* Checks whether the specified HRTIM common interrupt has occurred or not. */
ITStatus HRTIM_GetCommonITStatus(HRTIM_TypeDef *HRTIMx, uint32_t HRTIM_CommonIT)
|
{
ITStatus bitstatus = RESET;
uint16_t itstatus = 0x0, itenable = 0x0;
itstatus = HRTIMx->HRTIM_COMMON.ISR & HRTIM_CommonIT;
itenable = HRTIMx->HRTIM_COMMON.IER & HRTIM_CommonIT;
if ((itstatus != (uint16_t)RESET) && (itenable != (uint16_t)RESET))
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Free a report and all registered fields. The field->usage and field->value table's are allocated behind the field, so we need only to free(field) itself. */
|
static void hid_free_report(struct hid_report *report)
|
/* Free a report and all registered fields. The field->usage and field->value table's are allocated behind the field, so we need only to free(field) itself. */
static void hid_free_report(struct hid_report *report)
|
{
unsigned n;
for (n = 0; n < report->maxfield; n++)
kfree(report->field[n]);
kfree(report);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Copy data from "real" memory space to IO memory space. */
|
void memcpy_toio(volatile void __iomem *to, const void *from, unsigned long count)
|
/* Copy data from "real" memory space to IO memory space. */
void memcpy_toio(volatile void __iomem *to, const void *from, unsigned long count)
|
{
if ((((u32)to | (u32)from) & 0x3) == 0) {
for ( ; count > 3; count -= 4) {
*(volatile u32 *)to = *(u32 *)from;
to += 4;
from += 4;
}
}
for (; count > 0; count--) {
*(volatile u8 *)to = *(u8 *)from;
to++;
from++;
}
mb();
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Returns: either @list or the new start of the #GList if @list was NULL */
|
GList* g_list_append(GList *list, gpointer data)
|
/* Returns: either @list or the new start of the #GList if @list was NULL */
GList* g_list_append(GList *list, gpointer data)
|
{
GList *new_list;
GList *last;
new_list = _g_list_alloc ();
new_list->data = data;
new_list->next = NULL;
if (list)
{
last = g_list_last (list);
last->next = new_list;
new_list->prev = last;
return list;
}
else
{
new_list->prev = NULL;
return new_list;
}
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
/* Initialise the allocation maps for this device. If the device is not quiescent the caller must hold the allocation lock */
|
static void init_alloc_map(struct orc_host *host)
|
/* Initialise the allocation maps for this device. If the device is not quiescent the caller must hold the allocation lock */
static void init_alloc_map(struct orc_host *host)
|
{
u8 i, j;
for (i = 0; i < MAX_CHANNELS; i++) {
for (j = 0; j < 8; j++) {
host->allocation_map[i][j] = 0xffffffff;
}
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Shutdown of the Kinetis on-chip RTC @dev RTC platform device */
|
static int __devexit kinetis_rtc_remove(struct platform_device *pdev)
|
/* Shutdown of the Kinetis on-chip RTC @dev RTC platform device */
static int __devexit kinetis_rtc_remove(struct platform_device *pdev)
|
{
struct kinetis_rtc *rtc = platform_get_drvdata(pdev);
free_irq(rtc->irq, rtc);
rtc_device_unregister(rtc->rtc_dev);
kinetis_rtc_hw_shutdown(rtc);
clk_disable(rtc->clk);
clk_put(rtc->clk);
iounmap(rtc->regs);
platform_set_drvdata(pdev, NULL);
kfree(rtc);
d_printk(1, "dev=%s\n", dev_name(&pdev->dev));
return 0;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Compares two buffers in 24 bits data format. */
|
TestStatus Buffercmp24bits(uint16_t *pBuffer1, uint16_t *pBuffer2, uint16_t BufferLength)
|
/* Compares two buffers in 24 bits data format. */
TestStatus Buffercmp24bits(uint16_t *pBuffer1, uint16_t *pBuffer2, uint16_t BufferLength)
|
{
while (BufferLength--)
{
if (*pBuffer1 != *pBuffer2)
{
if (*pBuffer1 != (*pBuffer2 & 0xFF00))
{
return FAILED;
}
}
pBuffer1++;
pBuffer2++;
}
return PASSED;
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* Free the Service and all its related resources. */
|
VOID EFIAPI RedfishCleanupService(IN REDFISH_SERVICE RedfishService)
|
/* Free the Service and all its related resources. */
VOID EFIAPI RedfishCleanupService(IN REDFISH_SERVICE RedfishService)
|
{
if (RedfishService == NULL) {
return;
}
cleanupServiceEnumerator (RedfishService);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Reset all EMs associated with a given local port. Release all sequences and exchanges. If sid is non-zero then reset only the exchanges sent from the local port's FID. If did is non-zero then reset only exchanges destined for the local port's FID. */
|
void fc_exch_mgr_reset(struct fc_lport *lport, u32 sid, u32 did)
|
/* Reset all EMs associated with a given local port. Release all sequences and exchanges. If sid is non-zero then reset only the exchanges sent from the local port's FID. If did is non-zero then reset only exchanges destined for the local port's FID. */
void fc_exch_mgr_reset(struct fc_lport *lport, u32 sid, u32 did)
|
{
struct fc_exch_mgr_anchor *ema;
unsigned int cpu;
list_for_each_entry(ema, &lport->ema_list, ema_list) {
for_each_possible_cpu(cpu)
fc_exch_pool_reset(lport,
per_cpu_ptr(ema->mp->pool, cpu),
sid, did);
}
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Determine if Block Io & Block Io2 should be produced. */
|
BOOLEAN DetermineInstallBlockIo(IN EFI_HANDLE ChildHandle)
|
/* Determine if Block Io & Block Io2 should be produced. */
BOOLEAN DetermineInstallBlockIo(IN EFI_HANDLE ChildHandle)
|
{
EFI_SCSI_PASS_THRU_PROTOCOL *ScsiPassThru;
EFI_EXT_SCSI_PASS_THRU_PROTOCOL *ExtScsiPassThru;
ExtScsiPassThru = (EFI_EXT_SCSI_PASS_THRU_PROTOCOL *)GetParentProtocol (&gEfiExtScsiPassThruProtocolGuid, ChildHandle);
if (ExtScsiPassThru != NULL) {
if ((ExtScsiPassThru->Mode->Attributes & EFI_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL) != 0) {
return TRUE;
}
}
ScsiPassThru = (EFI_SCSI_PASS_THRU_PROTOCOL *)GetParentProtocol (&gEfiScsiPassThruProtocolGuid, ChildHandle);
if (ScsiPassThru != NULL) {
if ((ScsiPassThru->Mode->Attributes & EFI_SCSI_PASS_THRU_ATTRIBUTES_LOGICAL) != 0) {
return TRUE;
}
}
return FALSE;
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Description: Storage devices may report a granularity or preferred minimum I/O size which is the smallest request the device can perform without incurring a performance penalty. For disk drives this is often the physical block size. For RAID arrays it is often the stripe chunk size. A properly aligned multiple of minimum_io_size is the preferred request size for workloads where a high number of I/O operations is desired. */
|
void blk_queue_io_min(struct request_queue *q, unsigned int min)
|
/* Description: Storage devices may report a granularity or preferred minimum I/O size which is the smallest request the device can perform without incurring a performance penalty. For disk drives this is often the physical block size. For RAID arrays it is often the stripe chunk size. A properly aligned multiple of minimum_io_size is the preferred request size for workloads where a high number of I/O operations is desired. */
void blk_queue_io_min(struct request_queue *q, unsigned int min)
|
{
blk_limits_io_min(&q->limits, min);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* require "wmgpio" ret=wmgpio.init(PORTB, 8, GPIO_OUT, FLOATING) if ret==0 then wmgpio.out(PORTB, 8, HIGH) wmgpio.out(PORTB, 8, LOW) else print("GPIO init failed") end val=wmgpio.in(PORTB, 8) // read io print(val) */
|
static int get_pin_index(char *port, int offset)
|
/* require "wmgpio" ret=wmgpio.init(PORTB, 8, GPIO_OUT, FLOATING) if ret==0 then wmgpio.out(PORTB, 8, HIGH) wmgpio.out(PORTB, 8, LOW) else print("GPIO init failed") end val=wmgpio.in(PORTB, 8) // read io print(val) */
static int get_pin_index(char *port, int offset)
|
{
int pin_index = 0;
if (strstr(port, "PA") != NULL) {
pin_index = 0;
} else if (strstr(port, "PB") != NULL) {
pin_index = 16;
} else {
return -1;
}
return pin_index+offset;
}
|
Nicholas3388/LuaNode
|
C++
|
Other
| 1,055
|
/* This function will initialize a timer, normally this function is used to initialize a static timer object. */
|
void rt_timer_init(rt_timer_t timer, const char *name, void(*timeout)(void *parameter), void *parameter, rt_tick_t time, rt_uint8_t flag)
|
/* This function will initialize a timer, normally this function is used to initialize a static timer object. */
void rt_timer_init(rt_timer_t timer, const char *name, void(*timeout)(void *parameter), void *parameter, rt_tick_t time, rt_uint8_t flag)
|
{
RT_ASSERT(timer != RT_NULL);
rt_object_init((rt_object_t)timer, RT_Object_Class_Timer, name);
_rt_timer_init(timer, timeout, parameter, time, flag);
}
|
armink/FreeModbus_Slave-Master-RTT-STM32
|
C++
|
Other
| 1,477
|
/* The return value is the number of characters which would be generated for the given input, excluding the trailing '\0', as per ISO C99. */
|
int bitmap_scnlistprintf(char *buf, unsigned int buflen, const unsigned long *maskp, int nmaskbits)
|
/* The return value is the number of characters which would be generated for the given input, excluding the trailing '\0', as per ISO C99. */
int bitmap_scnlistprintf(char *buf, unsigned int buflen, const unsigned long *maskp, int nmaskbits)
|
{
int len = 0;
int cur, rbot, rtop;
if (buflen == 0)
return 0;
buf[0] = 0;
rbot = cur = find_first_bit(maskp, nmaskbits);
while (cur < nmaskbits) {
rtop = cur;
cur = find_next_bit(maskp, nmaskbits, cur+1);
if (cur >= nmaskbits || cur > rtop + 1) {
len = bscnl_emit(buf, buflen, rbot, rtop, len);
rbot = cur;
}
}
return len;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* The signal handle of IP4's recycle event. It is called back when the upper layer release the packet. */
|
VOID EFIAPI Ip4OnRecyclePacket(IN EFI_EVENT Event, IN VOID *Context)
|
/* The signal handle of IP4's recycle event. It is called back when the upper layer release the packet. */
VOID EFIAPI Ip4OnRecyclePacket(IN EFI_EVENT Event, IN VOID *Context)
|
{
IP4_RXDATA_WRAP *Wrap;
Wrap = (IP4_RXDATA_WRAP *)Context;
EfiAcquireLockOrFail (&Wrap->IpInstance->RecycleLock);
RemoveEntryList (&Wrap->Link);
EfiReleaseLock (&Wrap->IpInstance->RecycleLock);
ASSERT (!NET_BUF_SHARED (Wrap->Packet));
NetbufFree (Wrap->Packet);
gBS->CloseEvent (Wrap->RxData.RecycleSignal);
FreePool (Wrap);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Verify that invalid bound ifaces are treated as though they are not bound at all. */
|
ZTEST(conn_mgr_conn, test_invalid_ignored)
|
/* Verify that invalid bound ifaces are treated as though they are not bound at all. */
ZTEST(conn_mgr_conn, test_invalid_ignored)
|
{
zassert_is_null(conn_mgr_if_get_binding(ifnull));
zassert_is_null(conn_mgr_if_get_binding(ifnone));
zassert_false(conn_mgr_if_is_bound(ifnull));
zassert_false(conn_mgr_if_is_bound(ifnone));
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* onenand_block_markbad - Mark the block at the given offset as bad */
|
int onenand_block_markbad(struct mtd_info *mtd, loff_t ofs)
|
/* onenand_block_markbad - Mark the block at the given offset as bad */
int onenand_block_markbad(struct mtd_info *mtd, loff_t ofs)
|
{
struct onenand_chip *this = mtd->priv;
int ret;
ret = onenand_block_isbad(mtd, ofs);
if (ret) {
if (ret > 0)
return 0;
return ret;
}
onenand_get_device(mtd, FL_WRITING);
ret = this->block_markbad(mtd, ofs);
onenand_release_device(mtd);
return ret;
}
|
4ms/stm32mp1-baremetal
|
C++
|
Other
| 137
|
/* Add a trace buffer entry for arguments, for one integer arg. */
|
void xfs_btree_trace_argi(const char *func, struct xfs_btree_cur *cur, int i, int line)
|
/* Add a trace buffer entry for arguments, for one integer arg. */
void xfs_btree_trace_argi(const char *func, struct xfs_btree_cur *cur, int i, int line)
|
{
cur->bc_ops->trace_enter(cur, func, XBT_ARGS, XFS_BTREE_KTRACE_ARGI,
line, i, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Invalidate data & instruction caches. All APs execute this function in parallel. The BSP executes the function separately. */
|
STATIC VOID EFIAPI ClearCache(IN OUT VOID *WorkSpace)
|
/* Invalidate data & instruction caches. All APs execute this function in parallel. The BSP executes the function separately. */
STATIC VOID EFIAPI ClearCache(IN OUT VOID *WorkSpace)
|
{
WriteBackInvalidateDataCache ();
InvalidateInstructionCache ();
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* Returns number of ms since last clock interrupt. Note that interrupts will have been disabled by do_gettimeoffset() */
|
unsigned long integrator_gettimeoffset(void)
|
/* Returns number of ms since last clock interrupt. Note that interrupts will have been disabled by do_gettimeoffset() */
unsigned long integrator_gettimeoffset(void)
|
{
unsigned long ticks1, ticks2, status;
ticks2 = readl(TIMER1_VA_BASE + TIMER_VALUE) & 0xffff;
do {
ticks1 = ticks2;
status = __raw_readl(VA_IC_BASE + IRQ_RAW_STATUS);
ticks2 = readl(TIMER1_VA_BASE + TIMER_VALUE) & 0xffff;
} while (ticks2 > ticks1);
ticks1 = timer_reload - ticks2;
if (status & (1 << IRQ_TIMERINT1))
ticks1 += timer_reload;
return TICKS2USECS(ticks1);
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Assumption: old_sigset_t and compat_old_sigset_t are both types that can be passed to put_user()/get_user(). */
|
asmlinkage long compat_sys_sigpending(compat_old_sigset_t __user *set)
|
/* Assumption: old_sigset_t and compat_old_sigset_t are both types that can be passed to put_user()/get_user(). */
asmlinkage long compat_sys_sigpending(compat_old_sigset_t __user *set)
|
{
old_sigset_t s;
long ret;
mm_segment_t old_fs = get_fs();
set_fs(KERNEL_DS);
ret = sys_sigpending((old_sigset_t __user *) &s);
set_fs(old_fs);
if (ret == 0)
ret = put_user(s, set);
return ret;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Set Stall for USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
|
void USBD_SetStallEP(uint32_t EPNum)
|
/* Set Stall for USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
void USBD_SetStallEP(uint32_t EPNum)
|
{
return;
}
if (ep_num == 0U) {
NRF_USBD->TASKS_EP0STALL = USBD_TASKS_EP0STALL_TASKS_EP0STALL_Trigger;
} else {
if (ep_dir != 0U) {
NRF_USBD->EPSTALL = USBD_EPSTALL_STALL_Msk | ep_num | USBD_EPSTALL_IO_Msk;
} else {
NRF_USBD->EPSTALL = USBD_EPSTALL_STALL_Msk | ep_num;
}
}
}
|
ARMmbed/DAPLink
|
C++
|
Apache License 2.0
| 2,140
|
/* Set the fields of structure stc_tmr0_init_t to default values. */
|
int32_t TMR0_StructInit(stc_tmr0_init_t *pstcTmr0Init)
|
/* Set the fields of structure stc_tmr0_init_t to default values. */
int32_t TMR0_StructInit(stc_tmr0_init_t *pstcTmr0Init)
|
{
int32_t i32Ret = LL_OK;
if (NULL == pstcTmr0Init) {
i32Ret = LL_ERR_INVD_PARAM;
} else {
pstcTmr0Init->u32ClockSrc = TMR0_CLK_SRC_INTERN_CLK;
pstcTmr0Init->u32ClockDiv = TMR0_CLK_DIV1;
pstcTmr0Init->u32Func = TMR0_FUNC_CMP;
pstcTmr0Init->u16CompareValue = 0xFFFFU;
}
return i32Ret;
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* Ends a transmission of an ethernet frame to the ethernet controller.
This will make sure that data is correctly padded. And will not return until the packet is sent. */
|
void KSZ8851SNL_TransmitEnd(uint16_t length)
|
/* Ends a transmission of an ethernet frame to the ethernet controller.
This will make sure that data is correctly padded. And will not return until the packet is sent. */
void KSZ8851SNL_TransmitEnd(uint16_t length)
|
{
uint16_t data;
uint16_t padding;
uint8_t dummy[4] = {0x00};
if (length % 4)
{
padding = 4 - (length % 4);
KSZ8851SNL_SPI_WriteFifo(padding, dummy);
}
KSZ8851SNL_SPI_WriteFifoEnd();
data = KSZ8851SNL_SPI_ReadRegister(RXQCR) & (~RXQ_START_DMA);
KSZ8851SNL_SPI_WriteRegister(RXQCR, data);
data = KSZ8851SNL_SPI_ReadRegister(TXQCR) | TXQ_ENQUEUE;
KSZ8851SNL_SPI_WriteRegister(TXQCR, data);
}
|
remotemcu/remcu-chip-sdks
|
C++
| null | 436
|
/* On Idle callback is available here as an example even if actual use is very limited. In contrast to report_event_handler(), report value is not incremented here. */
|
static void on_idle_cb(const struct device *dev, uint16_t report_id)
|
/* On Idle callback is available here as an example even if actual use is very limited. In contrast to report_event_handler(), report value is not incremented here. */
static void on_idle_cb(const struct device *dev, uint16_t report_id)
|
{
LOG_DBG("On idle callback");
k_work_submit(&report_send);
}
|
zephyrproject-rtos/zephyr
|
C++
|
Apache License 2.0
| 9,573
|
/* Enables or disables the TIMx peripheral Preload register on CCR1. */
|
void TIM_OC1PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload)
|
/* Enables or disables the TIMx peripheral Preload register on CCR1. */
void TIM_OC1PreloadConfig(TIM_TypeDef *TIMx, uint16_t TIM_OCPreload)
|
{
uint16_t tmpccmr1 = 0;
assert_param(IS_TIM_LIST1_PERIPH(TIMx));
assert_param(IS_TIM_OCPRELOAD_STATE(TIM_OCPreload));
tmpccmr1 = TIMx->CCMR1;
tmpccmr1 &= (uint16_t)(~TIM_CCMR1_OC1PE);
tmpccmr1 |= TIM_OCPreload;
TIMx->CCMR1 = tmpccmr1;
}
|
MaJerle/stm32f429
|
C++
| null | 2,036
|
/* param base Pointer to FLEXIO_I2S_Type structure return Status flag, which are ORed by the enumerators in the _flexio_i2s_status_flags. */
|
uint32_t FLEXIO_I2S_GetStatusFlags(FLEXIO_I2S_Type *base)
|
/* param base Pointer to FLEXIO_I2S_Type structure return Status flag, which are ORed by the enumerators in the _flexio_i2s_status_flags. */
uint32_t FLEXIO_I2S_GetStatusFlags(FLEXIO_I2S_Type *base)
|
{
uint32_t status = 0;
status = ((FLEXIO_GetShifterStatusFlags(base->flexioBase) & (1UL << base->txShifterIndex)) >> base->txShifterIndex);
status |=
(((FLEXIO_GetShifterStatusFlags(base->flexioBase) & (1UL << base->rxShifterIndex)) >> (base->rxShifterIndex))
<< 1U);
return status;
}
|
eclipse-threadx/getting-started
|
C++
|
Other
| 310
|
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
|
UINT32 EFIAPI PciSegmentWrite32(IN UINT64 Address, IN UINT32 Value)
|
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciSegmentWrite32(IN UINT64 Address, IN UINT32 Value)
|
{
ASSERT_INVALID_PCI_SEGMENT_ADDRESS (Address, 3);
return DxePciSegmentLibPciRootBridgeIoWriteWorker (Address, EfiPciWidthUint32, Value);
}
|
tianocore/edk2
|
C++
|
Other
| 4,240
|
/* irq_udc_suspend - Handle IRQ "UDC Suspend" @udc: udc device */
|
static void irq_udc_suspend(struct pxa_udc *udc)
|
/* irq_udc_suspend - Handle IRQ "UDC Suspend" @udc: udc device */
static void irq_udc_suspend(struct pxa_udc *udc)
|
{
udc_writel(udc, UDCISR1, UDCISR1_IRSU);
udc->stats.irqs_suspend++;
if (udc->gadget.speed != USB_SPEED_UNKNOWN
&& udc->driver && udc->driver->suspend)
udc->driver->suspend(&udc->gadget);
ep0_idle(udc);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* This routine looks up the ndlp lists for the given WWPN. If WWPN found it returns the node element list pointer else return NULL. */
|
struct lpfc_nodelist* lpfc_findnode_wwpn(struct lpfc_vport *vport, struct lpfc_name *wwpn)
|
/* This routine looks up the ndlp lists for the given WWPN. If WWPN found it returns the node element list pointer else return NULL. */
struct lpfc_nodelist* lpfc_findnode_wwpn(struct lpfc_vport *vport, struct lpfc_name *wwpn)
|
{
struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
struct lpfc_nodelist *ndlp;
spin_lock_irq(shost->host_lock);
ndlp = __lpfc_find_node(vport, lpfc_filter_by_wwpn, wwpn);
spin_unlock_irq(shost->host_lock);
return ndlp;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* checks whether this descriptor contains end of frame. This function is to check whether the descriptor's data buffer contains end of ethernet frame? */
|
bool synopGMAC_is_eof_in_rx_desc(DmaDesc *desc)
|
/* checks whether this descriptor contains end of frame. This function is to check whether the descriptor's data buffer contains end of ethernet frame? */
bool synopGMAC_is_eof_in_rx_desc(DmaDesc *desc)
|
{
return ((desc -> status & DescRxLast) == DescRxLast);
}
|
RT-Thread/rt-thread
|
C++
|
Apache License 2.0
| 9,535
|
/* zfcp_fsf_req_free - free memory used by fsf request @fsf_req: pointer to struct zfcp_fsf_req */
|
void zfcp_fsf_req_free(struct zfcp_fsf_req *req)
|
/* zfcp_fsf_req_free - free memory used by fsf request @fsf_req: pointer to struct zfcp_fsf_req */
void zfcp_fsf_req_free(struct zfcp_fsf_req *req)
|
{
if (likely(req->pool)) {
if (likely(req->qtcb))
mempool_free(req->qtcb, req->adapter->pool.qtcb_pool);
mempool_free(req, req->pool);
return;
}
if (likely(req->qtcb))
kmem_cache_free(zfcp_data.qtcb_cache, req->qtcb);
kfree(req);
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* writes a WiFi gateway header conversion record in NPE linear format */
|
IX_ETH_DB_PUBLIC void ixEthDBNPEGatewayNodeWrite(void *address, MacTreeNode *node)
|
/* writes a WiFi gateway header conversion record in NPE linear format */
IX_ETH_DB_PUBLIC void ixEthDBNPEGatewayNodeWrite(void *address, MacTreeNode *node)
|
{
memcpy(address, node->descriptor->recordData.wifiData.gwMacAddress, IX_IEEE803_MAC_ADDRESS_SIZE);
NPE_NODE_BYTE(address, IX_EDB_NPE_NODE_FW_RESERVED_OFFSET) = 0;
NPE_NODE_BYTE(address, IX_EDB_NPE_NODE_FW_RESERVED_OFFSET + 1) = 0;
}
|
EmcraftSystems/u-boot
|
C++
|
Other
| 181
|
/* remove an ordered extent from the tree. No references are dropped but any waiters are woken. */
|
int btrfs_remove_ordered_extent(struct inode *inode, struct btrfs_ordered_extent *entry)
|
/* remove an ordered extent from the tree. No references are dropped but any waiters are woken. */
int btrfs_remove_ordered_extent(struct inode *inode, struct btrfs_ordered_extent *entry)
|
{
struct btrfs_ordered_inode_tree *tree;
int ret;
tree = &BTRFS_I(inode)->ordered_tree;
mutex_lock(&tree->mutex);
ret = __btrfs_remove_ordered_extent(inode, entry);
mutex_unlock(&tree->mutex);
wake_up(&entry->wait);
return ret;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Starts the firmware update session. This is were the library attempts to activate and connect with the bootloader running on the target, through the transport layer that was specified during the session's initialization. */
|
LIBOPENBLT_EXPORT uint32_t BltSessionStart(void)
|
/* Starts the firmware update session. This is were the library attempts to activate and connect with the bootloader running on the target, through the transport layer that was specified during the session's initialization. */
LIBOPENBLT_EXPORT uint32_t BltSessionStart(void)
|
{
uint32_t result = BLT_RESULT_ERROR_GENERIC;
if (SessionStart())
{
result = BLT_RESULT_OK;
}
return result;
}
|
feaser/openblt
|
C++
|
GNU General Public License v3.0
| 601
|
/* This is done in three separate functions so that the most expensive calculations are done last, in case a "simple match" can be found earlier. */
|
static unsigned int localtime_1(struct xtm *r, time_t time)
|
/* This is done in three separate functions so that the most expensive calculations are done last, in case a "simple match" can be found earlier. */
static unsigned int localtime_1(struct xtm *r, time_t time)
|
{
unsigned int v, w;
v = time % 86400;
r->second = v % 60;
w = v / 60;
r->minute = w % 60;
r->hour = w / 60;
return v;
}
|
EmcraftSystems/linux-emcraft
|
C++
|
Other
| 266
|
/* Unregisters a callback.
Unregisters a callback function implemented by the user. The callback should be disabled before it is unregistered. */
|
enum status_code trng_unregister_callback(struct trng_module *const module, const enum trng_callback callback_type)
|
/* Unregisters a callback.
Unregisters a callback function implemented by the user. The callback should be disabled before it is unregistered. */
enum status_code trng_unregister_callback(struct trng_module *const module, const enum trng_callback callback_type)
|
{
Assert(module);
module->callback[callback_type] = NULL;
module->register_callback_mask &= ~(1 << callback_type);
if (module->register_callback_mask == 0) {
system_interrupt_disable(SYSTEM_INTERRUPT_MODULE_TRNG);
}
return STATUS_OK;
}
|
memfault/zero-to-main
|
C++
| null | 200
|
/* s e t u p A l l L o w e r */
|
returnValue Bounds_setupAllLower(Bounds *_THIS)
|
/* s e t u p A l l L o w e r */
returnValue Bounds_setupAllLower(Bounds *_THIS)
|
{
return Bounds_setupAll( _THIS,ST_LOWER );
}
|
DanielMartensson/EmbeddedLapack
|
C++
|
MIT License
| 129
|
/* Inform NAPI that packet reception needs to be scheduled */
|
static irqreturn_t ks8695_rx_irq(int irq, void *dev_id)
|
/* Inform NAPI that packet reception needs to be scheduled */
static irqreturn_t ks8695_rx_irq(int irq, void *dev_id)
|
{
struct net_device *ndev = (struct net_device *)dev_id;
struct ks8695_priv *ksp = netdev_priv(ndev);
spin_lock(&ksp->rx_lock);
if (napi_schedule_prep(&ksp->napi)) {
unsigned long status = readl(KS8695_IRQ_VA + KS8695_INTEN);
unsigned long mask_bit = 1 << ks8695_get_rx_enable_bit(ksp);
status &= ~mask_bit;
writel(status , KS8695_IRQ_VA + KS8695_INTEN);
__napi_schedule(&ksp->napi);
}
spin_unlock(&ksp->rx_lock);
return IRQ_HANDLED;
}
|
robutest/uclinux
|
C++
|
GPL-2.0
| 60
|
/* Message: SoftKeyEventMessage Opcode: 0x0026 Type: RegistrationAndManagement Direction: dev2pbx VarLength: no */
|
static void handle_SoftKeyEventMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
|
/* Message: SoftKeyEventMessage Opcode: 0x0026 Type: RegistrationAndManagement Direction: dev2pbx VarLength: no */
static void handle_SoftKeyEventMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
|
{
ptvcursor_add(cursor, hf_skinny_softKeyEvent, 4, ENC_LITTLE_ENDIAN);
si->lineId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor));
ptvcursor_add(cursor, hf_skinny_lineInstance, 4, ENC_LITTLE_ENDIAN);
si->callId = tvb_get_letohl(ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor));
ptvcursor_add(cursor, hf_skinny_callReference, 4, ENC_LITTLE_ENDIAN);
}
|
seemoo-lab/nexmon
|
C++
|
GNU General Public License v3.0
| 2,330
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.