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
/* Message: SpeedDialStatMessage Opcode: 0x0091 Type: RegistrationAndManagement Direction: pbx2dev VarLength: no */
static void handle_SpeedDialStatMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
/* Message: SpeedDialStatMessage Opcode: 0x0091 Type: RegistrationAndManagement Direction: pbx2dev VarLength: no */ static void handle_SpeedDialStatMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
{ ptvcursor_add(cursor, hf_skinny_speedDialNumber, 4, ENC_LITTLE_ENDIAN); ptvcursor_add(cursor, hf_skinny_speedDialDirNumber, 24, ENC_ASCII|ENC_NA); ptvcursor_add(cursor, hf_skinny_speedDialDisplayName, 40, ENC_ASCII|ENC_NA); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* asymmetric_match_key_ids - Search asymmetric key IDs @kids: The list of key IDs to check @match_id: The key ID we're looking for @match: The match function to use */
static bool asymmetric_match_key_ids(const struct asymmetric_key_ids *kids, const struct asymmetric_key_id *match_id, bool(*match)(const struct asymmetric_key_id *kid1, const struct asymmetric_key_id *kid2))
/* asymmetric_match_key_ids - Search asymmetric key IDs @kids: The list of key IDs to check @match_id: The key ID we're looking for @match: The match function to use */ static bool asymmetric_match_key_ids(const struct asymmetric_key_ids *kids, const struct asymmetric_key_id *match_id, bool(*match)(const struct asymmetric_key_id *kid1, const struct asymmetric_key_id *kid2))
{ int i; if (!kids || !match_id) return false; for (i = 0; i < ARRAY_SIZE(kids->id); i++) if (match(kids->id[i], match_id)) return true; return false; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Allocates the number bytes specified by AllocationSize of a certain pool type and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
VOID* InternalAllocatePool(IN EFI_MEMORY_TYPE MemoryType, IN UINTN AllocationSize)
/* Allocates the number bytes specified by AllocationSize of a certain pool type and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */ VOID* InternalAllocatePool(IN EFI_MEMORY_TYPE MemoryType, IN UINTN AllocationSize)
{ EFI_STATUS Status; VOID *Memory; Memory = NULL; Status = CoreAllocatePool (MemoryType, AllocationSize, &Memory); if (EFI_ERROR (Status)) { Memory = NULL; } return Memory; }
tianocore/edk2
C++
Other
4,240
/* When a uDMA transfer is completed, the channel will be automatically disabled by the uDMA controller. Therefore, this function should be called prior to starting up any new transfer. */
void uDMAChannelEnable(unsigned long ulChannelNum)
/* When a uDMA transfer is completed, the channel will be automatically disabled by the uDMA controller. Therefore, this function should be called prior to starting up any new transfer. */ void uDMAChannelEnable(unsigned long ulChannelNum)
{ ASSERT(ulChannelNum < 32); HWREG(UDMA_ENASET) = 1 << ulChannelNum; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* PCD MSP Initialization This function configures the hardware resources used in this example. */
void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
/* PCD MSP Initialization This function configures the hardware resources used in this example. */ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(hpcd->Instance==USB_OTG_FS) { __HAL_RCC_GPIOA_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_12|GPIO_PIN_11; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = GPIO_AF10_OTG1_FS; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); __HAL_RCC_USB_OTG_FS_CLK_ENABLE(); HAL_NVIC_SetPriority(OTG_FS_IRQn, 0, 0); HAL_NVIC_EnableIRQ(OTG_FS_IRQn); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Releases the mutex used while performing NVM operations. */
static void e1000_release_nvm_ich8lan(struct e1000_hw *hw)
/* Releases the mutex used while performing NVM operations. */ static void e1000_release_nvm_ich8lan(struct e1000_hw *hw)
{ mutex_unlock(&nvm_mutex); return; }
robutest/uclinux
C++
GPL-2.0
60
/* disable_main_link() - Switch off main link for a device @dev: The LogiCore DP TX device in question */
static void disable_main_link(struct udevice *dev)
/* disable_main_link() - Switch off main link for a device @dev: The LogiCore DP TX device in question */ static void disable_main_link(struct udevice *dev)
{ set_reg(dev, REG_FORCE_SCRAMBLER_RESET, 0x1); set_reg(dev, REG_ENABLE_MAIN_STREAM, 0x0); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Reads data from the specified address on the serial flash. */
uint8_t s25fl1xx_read(struct qspid_t *qspid, uint32_t *data, uint32_t size, uint32_t address)
/* Reads data from the specified address on the serial flash. */ uint8_t s25fl1xx_read(struct qspid_t *qspid, uint32_t *data, uint32_t size, uint32_t address)
{ uint8_t secure = 0; mem->inst_frame.bm.b_dummy_cycles = 8; s25fl1xx_memory_access(qspid, S25FL1XX_READ_ARRAY , address, 0, data, QSPI_READ_ACCESS, size, secure); return 0; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Cache the DHCPv4 proxy offer packet according to the received order. */
EFI_STATUS PxeBcCopyProxyOffer(IN PXEBC_PRIVATE_DATA *Private, IN UINT32 OfferIndex)
/* Cache the DHCPv4 proxy offer packet according to the received order. */ EFI_STATUS PxeBcCopyProxyOffer(IN PXEBC_PRIVATE_DATA *Private, IN UINT32 OfferIndex)
{ EFI_PXE_BASE_CODE_MODE *Mode; EFI_DHCP4_PACKET *Offer; EFI_STATUS Status; ASSERT (OfferIndex < Private->OfferNum); ASSERT (OfferIndex < PXEBC_OFFER_MAX_NUM); Mode = Private->PxeBc.Mode; Offer = &Private->OfferBuffer[OfferIndex].Dhcp4.Packet.Offer; Status = PxeBcCacheDhcp4Packet (&Private->ProxyOffer.Dhcp4.Packet.Offer, Offer); if (EFI_ERROR (Status)) { return Status; } PxeBcParseDhcp4Packet (&Private->ProxyOffer.Dhcp4); CopyMem (&Mode->ProxyOffer.Dhcpv4, &Offer->Dhcp4, Offer->Length); Mode->ProxyOfferReceived = TRUE; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* param base CDOG peripheral base address. param add Value to be added. */
void CDOG_Add(CDOG_Type *base, uint32_t add)
/* param base CDOG peripheral base address. param add Value to be added. */ void CDOG_Add(CDOG_Type *base, uint32_t add)
{ base->ADD = (secure_counter_t)add; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Call PnP BIOS with function 0x0a, "get statically allocated resource information" */
static int __pnp_bios_get_stat_res(char *info)
/* Call PnP BIOS with function 0x0a, "get statically allocated resource information" */ static int __pnp_bios_get_stat_res(char *info)
{ u16 status; if (!pnp_bios_present()) return PNP_FUNCTION_NOT_SUPPORTED; status = call_pnp_bios(PNP_GET_STATIC_ALLOCED_RES_INFO, 0, PNP_TS1, PNP_DS, 0, 0, 0, 0, info, 65536, NULL, 0); return status; }
robutest/uclinux
C++
GPL-2.0
60
/* When the final fd which refers to this character-special node is closed, we make its ->mapping point back at its own i_data. */
static int raw_release(struct inode *inode, struct file *filp)
/* When the final fd which refers to this character-special node is closed, we make its ->mapping point back at its own i_data. */ static int raw_release(struct inode *inode, struct file *filp)
{ const int minor= iminor(inode); struct block_device *bdev; mutex_lock(&raw_mutex); bdev = raw_devices[minor].binding; if (--raw_devices[minor].inuse == 0) { inode->i_mapping = &inode->i_data; inode->i_mapping->backing_dev_info = &default_backing_dev_info; } mutex_unlock(&raw_mutex); bd_release(bdev); blkdev_put(bdev, filp->f_mode); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This function retrieves the user-readable name of a driver in the form of a Unicode string. If the driver specified by This has a user-readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */
EFI_STATUS EFIAPI Udp6ComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
/* This function retrieves the user-readable name of a driver in the form of a Unicode string. If the driver specified by This has a user-readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */ EFI_STATUS EFIAPI Udp6ComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
{ return LookupUnicodeString2 ( Language, This->SupportedLanguages, mUdp6DriverNameTable, DriverName, (BOOLEAN)(This == &gUdp6ComponentName) ); }
tianocore/edk2
C++
Other
4,240
/* Get TC module count value. Retrieves the current count value of a TC module. The specified TC module may be started or stopped. */
uint32_t tc_get_count_value(const struct tc_module *const module_inst)
/* Get TC module count value. Retrieves the current count value of a TC module. The specified TC module may be started or stopped. */ uint32_t tc_get_count_value(const struct tc_module *const module_inst)
{ Assert(module_inst); Assert(module_inst->hw); tc_sync_read_count(module_inst); Tc *const tc_module = module_inst->hw; while (tc_is_syncing(module_inst)) { } switch (module_inst->counter_size) { case TC_COUNTER_SIZE_8BIT: return (uint32_t)tc_module->COUNT8.COUNT.reg; case TC_COUNTER_SIZE_16BIT: return (uint32_t)tc_module->COUNT16.COUNT.reg; case TC_COUNTER_SIZE_32BIT: return tc_module->COUNT32.COUNT.reg; } Assert(false); return 0; }
memfault/zero-to-main
C++
null
200
/* Enable the 3-wire SPI start interrupt of the specified SPI port. */
void SPI3WireStartIntEnable(unsigned long ulBase)
/* Enable the 3-wire SPI start interrupt of the specified SPI port. */ void SPI3WireStartIntEnable(unsigned long ulBase)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE)||(ulBase == SPI3_BASE) ); xHWREG(ulBase + SPI_CNTRL2) |= SPI_CNTRL2_SSTA_INTEN; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* If the device reset operation is completed, then EFI_SUCCESS is returned. */
EFI_STATUS EFIAPI AtaPassThruResetDevice(IN EFI_ATA_PASS_THRU_PROTOCOL *This, IN UINT16 Port, IN UINT16 PortMultiplierPort)
/* If the device reset operation is completed, then EFI_SUCCESS is returned. */ EFI_STATUS EFIAPI AtaPassThruResetDevice(IN EFI_ATA_PASS_THRU_PROTOCOL *This, IN UINT16 Port, IN UINT16 PortMultiplierPort)
{ ATA_ATAPI_PASS_THRU_INSTANCE *Instance; LIST_ENTRY *Node; Instance = ATA_PASS_THRU_PRIVATE_DATA_FROM_THIS (This); Node = SearchDeviceInfoList (Instance, Port, PortMultiplierPort, EfiIdeHarddisk); if (Node == NULL) { return EFI_INVALID_PARAMETER; } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Fills each ADC_InitStruct member with its default value. */
void ADC_StructInit(ADCInitType *ADC_InitStruct)
/* Fills each ADC_InitStruct member with its default value. */ void ADC_StructInit(ADCInitType *ADC_InitStruct)
{ ADC_InitStruct->ClockSource = ADC_CLKSRC_RCH; ADC_InitStruct->Channel = ADC_CHANNEL0; ADC_InitStruct->ClockDivider = ADC_CLKDIV_1; ADC_InitStruct->ConvMode = ADC_CONVMODE_SINGLECHANNEL; ADC_InitStruct->TrigMode = ADC_TRIGMODE_MANUAL; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Slave 0 write operation is performed only at the first sensor hub cycle.. */
int32_t lsm6dso_sh_write_mode_set(lsm6dso_ctx_t *ctx, lsm6dso_write_once_t val)
/* Slave 0 write operation is performed only at the first sensor hub cycle.. */ int32_t lsm6dso_sh_write_mode_set(lsm6dso_ctx_t *ctx, lsm6dso_write_once_t val)
{ lsm6dso_master_config_t reg; int32_t ret; ret = lsm6dso_mem_bank_set(ctx, LSM6DSO_SENSOR_HUB_BANK); if (ret == 0) { ret = lsm6dso_read_reg(ctx, LSM6DSO_MASTER_CONFIG, (uint8_t*)&reg, 1); } if (ret == 0) { reg.write_once = (uint8_t)val; ret = lsm6dso_write_reg(ctx, LSM6DSO_MASTER_CONFIG, (uint8_t*)&reg, 1); } if (ret == 0) { ret = lsm6dso_mem_bank_set(ctx, LSM6DSO_USER_BANK); } return ret; }
alexander-g-dean/ESF
C++
null
41
/* Get a Message from a Queue or timeout if Queue is empty. */
osStatus_t osMessageQueueGet(osMessageQueueId_t mq_id, void *msg_ptr, uint8_t *msg_prio, uint32_t timeout)
/* Get a Message from a Queue or timeout if Queue is empty. */ osStatus_t osMessageQueueGet(osMessageQueueId_t mq_id, void *msg_ptr, uint8_t *msg_prio, uint32_t timeout)
{ status = isrRtxMessageQueueGet(mq_id, msg_ptr, msg_prio, timeout); } else { status = __svcMessageQueueGet(mq_id, msg_ptr, msg_prio, timeout); } return status; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* If the conversion results in an overflow or an underflow condition, then Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeUintnToInt64(IN UINTN Operand, OUT INT64 *Result)
/* If the conversion results in an overflow or an underflow condition, then Result is set to INT64_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeUintnToInt64(IN UINTN Operand, OUT INT64 *Result)
{ return SafeUint64ToInt64 ((UINT64)Operand, Result); }
tianocore/edk2
C++
Other
4,240
/* The new MCI2 module isn't 100% compatible with the old MCI module, and it has a few nice features which we want to use... */
static bool atmci_is_mci2(void)
/* The new MCI2 module isn't 100% compatible with the old MCI module, and it has a few nice features which we want to use... */ static bool atmci_is_mci2(void)
{ if (cpu_is_at91sam9g45()) return true; return false; }
robutest/uclinux
C++
GPL-2.0
60
/* Gets the states of the RTS modem control signals. */
unsigned long UARTModemControlGet(unsigned long ulBase)
/* Gets the states of the RTS modem control signals. */ unsigned long UARTModemControlGet(unsigned long ulBase)
{ xASSERT((ulBase == UART0_BASE) ||(ulBase == UART1_BASE) ); return(xHWREG(ulBase + UART_MCR) & (UART_MCR_RTS_ST)); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Initializes the TIMx Time Base Unit peripheral according to the specified parameters in the TIM_TimeBaseInitStruct. */
void TIM_TimeBaseInit(TIM_TypeDef *TIMx, TIM_TimeBaseInitTypeDef *TIM_TimeBaseInitStruct)
/* Initializes the TIMx Time Base Unit peripheral according to the specified parameters in the TIM_TimeBaseInitStruct. */ void TIM_TimeBaseInit(TIM_TypeDef *TIMx, TIM_TimeBaseInitTypeDef *TIM_TimeBaseInitStruct)
{ assert_param(IS_TIM_123458_PERIPH(TIMx)); assert_param(IS_TIM_COUNTER_MODE(TIM_TimeBaseInitStruct->TIM_CounterMode)); assert_param(IS_TIM_CKD_DIV(TIM_TimeBaseInitStruct->TIM_ClockDivision)); TIMx->CR1 &= CR1_CKD_Mask & CR1_CounterMode_Mask; TIMx->CR1 |= (uint32_t)TIM_TimeBaseInitStruct->TIM_ClockDivision | TIM_TimeBaseInitStruct->TIM_CounterMode; TIMx->ARR = TIM_TimeBaseInitStruct->TIM_Period ; TIMx->PSC = TIM_TimeBaseInitStruct->TIM_Prescaler; if(*(uint32_t*)&TIMx == TIM1_BASE) { TIMx->RCR = TIM_TimeBaseInitStruct->TIM_RepetitionCounter; } TIMx->EGR = TIM_PSCReloadMode_Immediate; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return the next unused link number for a given sap. */
static u16 llc_ui_next_link_no(int sap)
/* Return the next unused link number for a given sap. */ static u16 llc_ui_next_link_no(int sap)
{ return llc_ui_sap_link_no_max[sap]++; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function returns %0 on success and a negative error code on failure. */
int ubifs_calc_lpt_geom(struct ubifs_info *c)
/* This function returns %0 on success and a negative error code on failure. */ int ubifs_calc_lpt_geom(struct ubifs_info *c)
{ int lebs_needed; long long sz; do_calc_lpt_geom(c); sz = c->lpt_sz * 2; lebs_needed = div_u64(sz + c->leb_size - 1, c->leb_size); if (lebs_needed > c->lpt_lebs) { ubifs_err("too few LPT LEBs"); return -EINVAL; } if (c->ltab_sz > c->leb_size) { ubifs_err("LPT ltab too big"); return -EINVAL; } c->check_lpt_free = c->big_lpt; return 0; }
EmcraftSystems/u-boot
C++
Other
181
/* Perform basic hardware initialization at boot. This needs to be run from the very beginning. So the init priority has to be 0 (zero). */
static int st_stm32f7_init(void)
/* Perform basic hardware initialization at boot. This needs to be run from the very beginning. So the init priority has to be 0 (zero). */ static int st_stm32f7_init(void)
{ LL_FLASH_EnableART(); sys_cache_instr_enable(); sys_cache_data_enable(); SystemCoreClock = 16000000; return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Only disabling plugging for non-rotational devices if it does tagging as well, otherwise we do need the proper merging */
static bool queue_should_plug(struct request_queue *q)
/* Only disabling plugging for non-rotational devices if it does tagging as well, otherwise we do need the proper merging */ static bool queue_should_plug(struct request_queue *q)
{ return !(blk_queue_nonrot(q) && blk_queue_tagged(q)); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enables or Disables the Precharge of Tamper pin. */
void RTC_TamperPullUpCmd(FunctionalState NewState)
/* Enables or Disables the Precharge of Tamper pin. */ void RTC_TamperPullUpCmd(FunctionalState NewState)
{ assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { RTC->TAFCR &= (uint32_t)~RTC_TAFCR_TAMPPUDIS; } else { RTC->TAFCR |= (uint32_t)RTC_TAFCR_TAMPPUDIS; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Function for disabling the use of whitelist for scanning. */
static void whitelist_disable(void)
/* Function for disabling the use of whitelist for scanning. */ static void whitelist_disable(void)
{ uint32_t err_code; if ((m_scan_mode == BLE_WHITELIST_SCAN) && !m_whitelist_temporarily_disabled) { m_whitelist_temporarily_disabled = true; err_code = sd_ble_gap_scan_stop(); if (err_code == NRF_SUCCESS) { scan_start(); } else if (err_code != NRF_ERROR_INVALID_STATE) { APP_ERROR_CHECK(err_code); } } m_whitelist_temporarily_disabled = true; }
labapart/polymcu
C++
null
201
/* Function for sending acknowledgement to SPI Master. This function will send an acknowledgement byte 's' to the master to indicate the master that it has received and programmed the data. */
static void send_ack(void)
/* Function for sending acknowledgement to SPI Master. This function will send an acknowledgement byte 's' to the master to indicate the master that it has received and programmed the data. */ static void send_ack(void)
{ uint8_t ack = 's'; spi_write_buffer_wait(&slave, &ack, 1); }
memfault/zero-to-main
C++
null
200
/* Disable I2C interrupt of the specified I2C port. The */
void xI2CMasterIntDisable(unsigned long ulBase, unsigned long ulIntType)
/* Disable I2C interrupt of the specified I2C port. The */ void xI2CMasterIntDisable(unsigned long ulBase, unsigned long ulIntType)
{ xASSERT((ulBase == I2C0_BASE)); xHWREG(ulBase + I2C_CON) &= ~I2C_CON_EI; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Reads and returns the current value of MM2. This function is only available on IA-32 and X64. */
UINT64 EFIAPI AsmReadMm2(VOID)
/* Reads and returns the current value of MM2. This function is only available on IA-32 and X64. */ UINT64 EFIAPI AsmReadMm2(VOID)
{ UINT64 Data; __asm__ __volatile__ ( "movd %%mm2, %0 \n\t" : "=r" (Data) ); return Data; }
tianocore/edk2
C++
Other
4,240
/* param handle i2c master handle. param i2CInstance instance number of the i2c bus, such as 0 is corresponding to I2C0. param i2cBaudrate i2c baudrate. param i2cSourceClockHz i2c source clock frequency. return kStatus_HAL_I2cSuccess is success, else initial failed. */
status_t CODEC_I2C_Init(void *handle, uint32_t i2cInstance, uint32_t i2cBaudrate, uint32_t i2cSourceClockHz)
/* param handle i2c master handle. param i2CInstance instance number of the i2c bus, such as 0 is corresponding to I2C0. param i2cBaudrate i2c baudrate. param i2cSourceClockHz i2c source clock frequency. return kStatus_HAL_I2cSuccess is success, else initial failed. */ status_t CODEC_I2C_Init(void *handle, uint32_t i2cInstance, uint32_t i2cBaudrate, uint32_t i2cSourceClockHz)
{ hal_i2c_master_config_t masterConfig; masterConfig.enableMaster = true; masterConfig.baudRate_Bps = i2cBaudrate; masterConfig.srcClock_Hz = i2cSourceClockHz; masterConfig.instance = (uint8_t)i2cInstance; return (status_t)HAL_I2cMasterInit((hal_i2c_master_handle_t *)handle, &masterConfig); }
eclipse-threadx/getting-started
C++
Other
310
/* This Function handle Slave events to perform a transmission process. */
void Handle_I2C_Slave(void)
/* This Function handle Slave events to perform a transmission process. */ void Handle_I2C_Slave(void)
{ LL_I2C_AcknowledgeNextData(I2C1, LL_I2C_ACK); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Get the state of an input GPIO pin. Using this function on a gpio pin which is set to output mode will return an undefined value. */
int32_t hal_gpio_input_get(gpio_dev_t *gpio, uint32_t *value)
/* Get the state of an input GPIO pin. Using this function on a gpio pin which is set to output mode will return an undefined value. */ int32_t hal_gpio_input_get(gpio_dev_t *gpio, uint32_t *value)
{ int32_t ret = -1; if(NULL != gpio && NULL != value) { hal_gpio_pin_set_dir(gpio->port, HAL_GPIO_DIR_IN, 0); *value = hal_gpio_pin_get_val(gpio->port); ret = 0; } return ret; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* do_error handles the Error exception. Errors are more likely to be processor specific, it is defined with weak attribute and can be redefined in processor specific code. */
void __weak do_error(struct pt_regs *pt_regs, unsigned int esr)
/* do_error handles the Error exception. Errors are more likely to be processor specific, it is defined with weak attribute and can be redefined in processor specific code. */ void __weak do_error(struct pt_regs *pt_regs, unsigned int esr)
{ efi_restore_gd(); printf("\"Error\" handler, esr 0x%08x\n", esr); show_regs(pt_regs); show_efi_loaded_images(pt_regs); panic("Resetting CPU ...\n"); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Send SEND_CSD command to get CSD from card. */
static status_t MMC_SendCsd(mmc_card_t *card)
/* Send SEND_CSD command to get CSD from card. */ static status_t MMC_SendCsd(mmc_card_t *card)
{ assert(card); assert(card->host.transfer); sdhc_command_t command = {0}; sdhc_transfer_t content = {0}; command.index = kSDMMC_SendCsd; command.argument = (card->relativeAddress << 16U); command.responseType = kSDHC_ResponseTypeR2; content.command = &command; content.data = 0U; if (kStatus_Success == card->host.transfer(card->host.base, &content)) { memcpy(card->rawCsd, command.response, sizeof(card->rawCsd)); MMC_DecodeCsd(card, card->rawCsd); return kStatus_Success; } return kStatus_SDMMC_TransferFailed; }
labapart/polymcu
C++
null
201
/* Disable the analogue monitoring on VDDA Power source. */
FMC_STATE_T FMC_DisableOptionByteVDDA(void)
/* Disable the analogue monitoring on VDDA Power source. */ FMC_STATE_T FMC_DisableOptionByteVDDA(void)
{ FMC_STATE_T state; state = FMC_WaitForReady(FMC_DELAY_ERASE); if (state == FMC_STATE_COMPLETE) { FMC->CTRL2_B.OBP = BIT_SET; OB->USER_B.VDDAMON = BIT_RESET; state = FMC_WaitForReady(FMC_DELAY_ERASE); if (state != FMC_STATE_TIMEOUT) { FMC->CTRL2_B.OBP = BIT_RESET; } } return state; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Send a reset sequence consisting of 9 clocks with the data signal high to clock any confused device back into an idle state. Also send a <stop> at the end of the sequence for belts & suspenders. */
static void i2c_gpio_send_reset(struct gpio_desc *scl, struct gpio_desc *sda, int delay)
/* Send a reset sequence consisting of 9 clocks with the data signal high to clock any confused device back into an idle state. Also send a <stop> at the end of the sequence for belts & suspenders. */ static void i2c_gpio_send_reset(struct gpio_desc *scl, struct gpio_desc *sda, int delay)
{ int j; for (j = 0; j < 9; j++) i2c_gpio_write_bit(scl, sda, delay, 1); i2c_gpio_send_stop(scl, sda, delay); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Draws a string located in program memory to the display. Using program memory for constant strings will reduce the applications need for RAM, and thus lower the overall size footprint. */
void gfx_draw_progmem_string(char PROGMEM_PTR_T str, gfx_coord_t x, gfx_coord_t y, const struct font *font, const gfx_color_t bg_color, const gfx_color_t text_color)
/* Draws a string located in program memory to the display. Using program memory for constant strings will reduce the applications need for RAM, and thus lower the overall size footprint. */ void gfx_draw_progmem_string(char PROGMEM_PTR_T str, gfx_coord_t x, gfx_coord_t y, const struct font *font, const gfx_color_t bg_color, const gfx_color_t text_color)
{ gfx_draw_progmem_string_aligned(str, x, y, font, bg_color, text_color, TEXT_POS_LEFT, TEXT_ALIGN_LEFT); }
memfault/zero-to-main
C++
null
200
/* ADC Set DMA to Continue. This must be set to allow DMA to continue to operate after the last conversion in the DMA sequence. This allows DMA to be used in continuous circular mode. */
void adc_set_dma_continue(uint32_t adc)
/* ADC Set DMA to Continue. This must be set to allow DMA to continue to operate after the last conversion in the DMA sequence. This allows DMA to be used in continuous circular mode. */ void adc_set_dma_continue(uint32_t adc)
{ ADC_CR2(adc) |= ADC_CR2_DDS; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* called with domain->lock held Used to reserve address ranges in the aperture (e.g. for exclusion ranges. */
static void dma_ops_reserve_addresses(struct dma_ops_domain *dom, unsigned long start_page, unsigned int pages)
/* called with domain->lock held Used to reserve address ranges in the aperture (e.g. for exclusion ranges. */ static void dma_ops_reserve_addresses(struct dma_ops_domain *dom, unsigned long start_page, unsigned int pages)
{ unsigned int i, last_page = dom->aperture_size >> PAGE_SHIFT; if (start_page + pages > last_page) pages = last_page - start_page; for (i = start_page; i < start_page + pages; ++i) { int index = i / APERTURE_RANGE_PAGES; int page = i % APERTURE_RANGE_PAGES; __set_bit(page, dom->aperture[index]->bitmap); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* configure the direction of data transfer on the channel */
void dma_transfer_direction_config(uint32_t dma_periph, dma_channel_enum channelx, uint8_t direction)
/* configure the direction of data transfer on the channel */ void dma_transfer_direction_config(uint32_t dma_periph, dma_channel_enum channelx, uint8_t direction)
{ uint32_t ctl; ctl = DMA_CHCTL(dma_periph, channelx); ctl &= ~DMA_CHXCTL_TM; ctl |= direction; DMA_CHCTL(dma_periph, channelx) = ctl; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If parent mtime has changed, we revalidate, else we wait for a period corresponding to the parent's attribute cache timeout value. */
static int nfs_neg_need_reval(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
/* If parent mtime has changed, we revalidate, else we wait for a period corresponding to the parent's attribute cache timeout value. */ static int nfs_neg_need_reval(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
{ if (nd != NULL && nfs_lookup_check_intent(nd, LOOKUP_CREATE) != 0) return 0; if (NFS_SERVER(dir)->flags & NFS_MOUNT_LOOKUP_CACHE_NONEG) return 1; return !nfs_check_verifier(dir, dentry); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns 1 if new_dentry is a subdirectory of the parent (at any depth). Returns 0 otherwise. Caller must ensure that "new_dentry" is pinned before calling is_subdir() */
int is_subdir(struct dentry *new_dentry, struct dentry *old_dentry)
/* Returns 1 if new_dentry is a subdirectory of the parent (at any depth). Returns 0 otherwise. Caller must ensure that "new_dentry" is pinned before calling is_subdir() */ int is_subdir(struct dentry *new_dentry, struct dentry *old_dentry)
{ int result; unsigned long seq; if (new_dentry == old_dentry) return 1; rcu_read_lock(); do { seq = read_seqbegin(&rename_lock); if (d_ancestor(old_dentry, new_dentry)) result = 1; else result = 0; } while (read_seqretry(&rename_lock, seq)); rcu_read_unlock(); return result; }
robutest/uclinux
C++
GPL-2.0
60
/* Disables a GPIO pin as a trigger to start a DMA transaction. */
void GPIODMATriggerDisable(uint32_t ui32Port, uint8_t ui8Pins)
/* Disables a GPIO pin as a trigger to start a DMA transaction. */ void GPIODMATriggerDisable(uint32_t ui32Port, uint8_t ui8Pins)
{ ASSERT(_GPIOBaseValid(ui32Port)); HWREGB(ui32Port + GPIO_O_DMACTL) &= (~ui8Pins); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Frees a set of BDs that had been previously retrieved with XEmacPs_BdRingFromHw(). */
LONG XEmacPs_BdRingFree(XEmacPs_BdRing *RingPtr, u32 NumBd, XEmacPs_Bd *BdSetPtr)
/* Frees a set of BDs that had been previously retrieved with XEmacPs_BdRingFromHw(). */ LONG XEmacPs_BdRingFree(XEmacPs_BdRing *RingPtr, u32 NumBd, XEmacPs_Bd *BdSetPtr)
{ LONG Status; if (0x00000000U == NumBd){ Status = (LONG)(XST_SUCCESS); } else { if ((RingPtr->PostCnt < NumBd) || (RingPtr->PostHead != BdSetPtr)) { Status = (LONG)(XST_DMA_SG_LIST_ERROR); } else { RingPtr->FreeCnt += NumBd; RingPtr->PostCnt -= NumBd; XEMACPS_RING_SEEKAHEAD(RingPtr, RingPtr->PostHead, NumBd); Status = (LONG)(XST_SUCCESS); } } return Status; }
ua1arn/hftrx
C++
null
69
/* Disables and restores interrupts for mp_io(), which does the actual I/O. */
static int multiport_io(struct gameport *gameport, int sendflags, int sendcode, u32 *packet)
/* Disables and restores interrupts for mp_io(), which does the actual I/O. */ static int multiport_io(struct gameport *gameport, int sendflags, int sendcode, u32 *packet)
{ int status; unsigned long flags; local_irq_save(flags); status = mp_io(gameport, sendflags, sendcode, packet); local_irq_restore(flags); return status; }
robutest/uclinux
C++
GPL-2.0
60
/* XXX VME bridges could be available on buses other than PCI. At the momment this framework only supports PCI devices. */
void* vme_alloc_consistent(struct vme_resource *resource, size_t size, dma_addr_t *dma)
/* XXX VME bridges could be available on buses other than PCI. At the momment this framework only supports PCI devices. */ void* vme_alloc_consistent(struct vme_resource *resource, size_t size, dma_addr_t *dma)
{ struct vme_bridge *bridge; struct pci_dev *pdev; if(resource == NULL) { printk("No resource\n"); return NULL; } bridge = find_bridge(resource); if(bridge == NULL) { printk("Can't find bridge\n"); return NULL; } if (bridge->parent == NULL) { printk("Dev entry NULL\n"); return NULL; } pdev = container_of(bridge->parent, struct pci_dev, dev); return pci_alloc_consistent(pdev, size, dma); }
robutest/uclinux
C++
GPL-2.0
60
/* Setup any additional SG pages needed.Inline SG element is setup at queuing time. */
static bfa_boolean_t bfa_ioim_sge_setup(struct bfa_ioim_s *ioim)
/* Setup any additional SG pages needed.Inline SG element is setup at queuing time. */ static bfa_boolean_t bfa_ioim_sge_setup(struct bfa_ioim_s *ioim)
{ u16 nsgpgs; bfa_assert(ioim->nsges > BFI_SGE_INLINE); nsgpgs = BFA_SGPG_NPAGE(ioim->nsges); if (!nsgpgs) return BFA_TRUE; if (bfa_sgpg_malloc(ioim->bfa, &ioim->sgpg_q, nsgpgs) != BFA_STATUS_OK) { bfa_sgpg_wait(ioim->bfa, &ioim->iosp->sgpg_wqe, nsgpgs); return BFA_FALSE; } ioim->nsgpgs = nsgpgs; bfa_ioim_sgpg_setup(ioim); return BFA_TRUE; }
robutest/uclinux
C++
GPL-2.0
60
/* ubi_sysfs_close - close sysfs for an UBI device. @ubi: UBI device description object */
static void ubi_sysfs_close(struct ubi_device *ubi)
/* ubi_sysfs_close - close sysfs for an UBI device. @ubi: UBI device description object */ static void ubi_sysfs_close(struct ubi_device *ubi)
{ device_remove_file(&ubi->dev, &dev_mtd_num); device_remove_file(&ubi->dev, &dev_bgt_enabled); device_remove_file(&ubi->dev, &dev_min_io_size); device_remove_file(&ubi->dev, &dev_max_vol_count); device_remove_file(&ubi->dev, &dev_bad_peb_count); device_remove_file(&ubi->dev, &dev_reserved_for_bad); device_remove_file(&ubi->dev, &dev_max_ec); device_remove_file(&ubi->dev, &dev_volumes_count); device_remove_file(&ubi->dev, &dev_total_eraseblocks); device_remove_file(&ubi->dev, &dev_avail_eraseblocks); device_remove_file(&ubi->dev, &dev_eraseblock_size); device_unregister(&ubi->dev); }
robutest/uclinux
C++
GPL-2.0
60
/* Parameter: buf = pointer to buffer. len = number of bytes to read. user = flag, 1: called from userlevel 0: called from kernel. card = pointer to card struct. Return: number of bytes actually transferred. */
static int isdnloop_readstatus(u_char __user *buf, int len, isdnloop_card *card)
/* Parameter: buf = pointer to buffer. len = number of bytes to read. user = flag, 1: called from userlevel 0: called from kernel. card = pointer to card struct. Return: number of bytes actually transferred. */ static int isdnloop_readstatus(u_char __user *buf, int len, isdnloop_card *card)
{ int count; u_char __user *p; for (p = buf, count = 0; count < len; p++, count++) { if (card->msg_buf_read == card->msg_buf_write) return count; if (put_user(*card->msg_buf_read++, p)) return -EFAULT; if (card->msg_buf_read > card->msg_buf_end) card->msg_buf_read = card->msg_buf; } return count; }
robutest/uclinux
C++
GPL-2.0
60
/* get the status of SDRAM device0 or device1 */
uint32_t exmc_sdram_bankstatus_get(uint32_t exmc_sdram_device)
/* get the status of SDRAM device0 or device1 */ uint32_t exmc_sdram_bankstatus_get(uint32_t exmc_sdram_device)
{ uint32_t sdstat = 0U; if(EXMC_SDRAM_DEVICE0 == exmc_sdram_device){ sdstat = ((uint32_t)(EXMC_SDSTAT & EXMC_SDSDAT_STA0) >> SDSTAT_STA0_OFFSET); }else{ sdstat = ((uint32_t)(EXMC_SDSTAT & EXMC_SDSDAT_STA1) >> SDSTAT_STA1_OFFSET); } return sdstat; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* omap_nand_hwcontrol - Set the address pointers corretly for the following address/data/command operation */
static void omap_nand_hwcontrol(struct mtd_info *mtd, int32_t cmd, uint32_t ctrl)
/* omap_nand_hwcontrol - Set the address pointers corretly for the following address/data/command operation */ static void omap_nand_hwcontrol(struct mtd_info *mtd, int32_t cmd, uint32_t ctrl)
{ register struct nand_chip *this = mtd_to_nand(mtd); struct omap_nand_info *info = nand_get_controller_data(this); int cs = info->cs; switch (ctrl) { case NAND_CTRL_CHANGE | NAND_CTRL_CLE: this->IO_ADDR_W = (void __iomem *)&gpmc_cfg->cs[cs].nand_cmd; break; case NAND_CTRL_CHANGE | NAND_CTRL_ALE: this->IO_ADDR_W = (void __iomem *)&gpmc_cfg->cs[cs].nand_adr; break; case NAND_CTRL_CHANGE | NAND_NCE: this->IO_ADDR_W = (void __iomem *)&gpmc_cfg->cs[cs].nand_dat; break; } if (cmd != NAND_CMD_NONE) writeb(cmd, this->IO_ADDR_W); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Register a subtree that will have modules under it. Specify the module under which to register it or NULL to register it at the top level and the title used in the tab for it in a preferences dialog box. */
module_t* prefs_register_subtree(module_t *parent, const char *title, const char *description, void(*apply_cb)(void))
/* Register a subtree that will have modules under it. Specify the module under which to register it or NULL to register it at the top level and the title used in the tab for it in a preferences dialog box. */ module_t* prefs_register_subtree(module_t *parent, const char *title, const char *description, void(*apply_cb)(void))
{ return prefs_register_module_or_subtree(parent, NULL, title, description, TRUE, apply_cb, parent ? parent->use_gui : FALSE); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Function to determine whether a string is decimal or hex representation of a number and return the number converted from the string. Spaces are always skipped. */
UINTN EFIAPI ShellStrToUintn(IN CONST CHAR16 *String)
/* Function to determine whether a string is decimal or hex representation of a number and return the number converted from the string. Spaces are always skipped. */ UINTN EFIAPI ShellStrToUintn(IN CONST CHAR16 *String)
{ UINT64 RetVal; BOOLEAN Hex; Hex = FALSE; if (!InternalShellIsHexOrDecimalNumber (String, Hex, TRUE, FALSE)) { Hex = TRUE; } if (!EFI_ERROR (ShellConvertStringToUint64 (String, &RetVal, Hex, TRUE))) { return ((UINTN)RetVal); } return ((UINTN)(-1)); }
tianocore/edk2
C++
Other
4,240
/* This function adds an entry in specified register table, with given register type, register index, bit section and value. */
VOID EFIAPI CpuRegisterTableTestThenWrite(IN UINTN ProcessorNumber, IN REGISTER_TYPE RegisterType, IN UINT64 Index, IN UINT64 ValueMask, IN UINT64 Value)
/* This function adds an entry in specified register table, with given register type, register index, bit section and value. */ VOID EFIAPI CpuRegisterTableTestThenWrite(IN UINTN ProcessorNumber, IN REGISTER_TYPE RegisterType, IN UINT64 Index, IN UINT64 ValueMask, IN UINT64 Value)
{ UINT8 Start; UINT8 End; UINT8 Length; Start = (UINT8)LowBitSet64 (ValueMask); End = (UINT8)HighBitSet64 (ValueMask); Length = End - Start + 1; CpuRegisterTableWriteWorker (FALSE, ProcessorNumber, RegisterType, Index, Start, Length, Value, TRUE); }
tianocore/edk2
C++
Other
4,240
/* This function allocates space for a new copy of the device path specified by DevicePath. If DevicePath is NULL, then NULL is returned. If the memory is successfully allocated, then the contents of DevicePath are copied to the newly allocated buffer, and a pointer to that buffer is returned. Otherwise, NULL is returned. The memory for the new device path is allocated from EFI boot services memory. It is the responsibility of the caller to free the memory allocated. */
EFI_DEVICE_PATH_PROTOCOL* EFIAPI DuplicateDevicePath(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
/* This function allocates space for a new copy of the device path specified by DevicePath. If DevicePath is NULL, then NULL is returned. If the memory is successfully allocated, then the contents of DevicePath are copied to the newly allocated buffer, and a pointer to that buffer is returned. Otherwise, NULL is returned. The memory for the new device path is allocated from EFI boot services memory. It is the responsibility of the caller to free the memory allocated. */ EFI_DEVICE_PATH_PROTOCOL* EFIAPI DuplicateDevicePath(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath)
{ return UefiDevicePathLibDuplicateDevicePath (DevicePath); }
tianocore/edk2
C++
Other
4,240
/* Display a short tutorial for using the 'ao' command in case of mistake. */
static void aiodio_analog_out_prompt(struct aiodio_dev *dev)
/* Display a short tutorial for using the 'ao' command in case of mistake. */ static void aiodio_analog_out_prompt(struct aiodio_dev *dev)
{ usr_uart_write_string(dev->board_cli->uart_device, (uint8_t*)"Analog Output command model:\n"); usr_uart_write_string(dev->board_cli->uart_device, (uint8_t*)"ao x yyyy\n"); usr_uart_write_string(dev->board_cli->uart_device, (uint8_t*)"Where:\n"); usr_uart_write_string(dev->board_cli->uart_device, (uint8_t*)"\tx = channel number (0-7);\n"); usr_uart_write_string(dev->board_cli->uart_device, (uint8_t*)"\tyyyy = DAC code in decimal integer format (0-4095).\n"); usr_uart_write_string(dev->board_cli->uart_device, (uint8_t*)"The spaces <' '> are mandatory.\n"); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Initializes the CRYP Initialization Vectors(IV) according to the specified parameters in the CRYP_IVInitStruct. */
void CRYP_IVInit(CRYP_IVInitTypeDef *CRYP_IVInitStruct)
/* Initializes the CRYP Initialization Vectors(IV) according to the specified parameters in the CRYP_IVInitStruct. */ void CRYP_IVInit(CRYP_IVInitTypeDef *CRYP_IVInitStruct)
{ CRYP->IV0LR = CRYP_IVInitStruct->CRYP_IV0Left; CRYP->IV0RR = CRYP_IVInitStruct->CRYP_IV0Right; CRYP->IV1LR = CRYP_IVInitStruct->CRYP_IV1Left; CRYP->IV1RR = CRYP_IVInitStruct->CRYP_IV1Right; }
MaJerle/stm32f429
C++
null
2,036
/* Setup timer 1 compare match A to generate a tick interrupt. */
static void prvSetupTimerInterrupt(void)
/* Setup timer 1 compare match A to generate a tick interrupt. */ static void prvSetupTimerInterrupt(void)
{ unsigned long ulCompareMatch; unsigned char ucHighByte, ucLowByte; ulCompareMatch = configCPU_CLOCK_HZ / configTICK_RATE_HZ; ulCompareMatch /= portCLOCK_PRESCALER; ulCompareMatch -= ( unsigned long ) 1; ucLowByte = ( unsigned char ) ( ulCompareMatch & ( unsigned long ) 0xff ); ulCompareMatch >>= 8; ucHighByte = ( unsigned char ) ( ulCompareMatch & ( unsigned long ) 0xff ); OCR1AH = ucHighByte; OCR1AL = ucLowByte; ucLowByte = portCLEAR_COUNTER_ON_MATCH | portPRESCALE_64; TCCR1B = ucLowByte; ucLowByte = TIMSK; ucLowByte |= portCOMPARE_MATCH_A_INTERRUPT_ENABLE; TIMSK = ucLowByte; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Add a Base Address selector to a mapping */
static int mapping_addbaseaddr(struct if_mapping *ifnode, int *active, char *pos, size_t len, struct add_extra *extra, int linenum)
/* Add a Base Address selector to a mapping */ static int mapping_addbaseaddr(struct if_mapping *ifnode, int *active, char *pos, size_t len, struct add_extra *extra, int linenum)
{ size_t n; unsigned int address; extra = extra; n = strspn(string, "0123456789ABCDEFabcdefx"); if((n < len) || (sscanf(string, "0x%X", &address) != 1)) { fprintf(stderr, "Error: Invalid Base Address `%s' at line %d\n", string, linenum); return(-1); } ifnode->base_addr = (unsigned short) address; ifnode->active[SELECT_BASEADDR] = 1; active[SELECT_BASEADDR] = 1; if(verbose) fprintf(stderr, "Parsing : Added Base Address `0x%X' from line %d.\n", ifnode->base_addr, linenum); return(0); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Checks whether the specified USART flag is set or not. */
FlagStatus USART_GetFlagStatus(USART_TypeDef *USARTx, uint32_t USART_FLAG)
/* Checks whether the specified USART flag is set or not. */ FlagStatus USART_GetFlagStatus(USART_TypeDef *USARTx, uint32_t USART_FLAG)
{ FlagStatus bitstatus = RESET; assert_param(IS_USART_ALL_PERIPH(USARTx)); assert_param(IS_USART_FLAG(USART_FLAG)); if ((USARTx->ISR & USART_FLAG) != (uint16_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This service enables PEIMs to discover additional firmware files. */
EFI_STATUS EFIAPI PeiServicesFfsFindNextFile(IN EFI_FV_FILETYPE SearchType, IN EFI_PEI_FV_HANDLE VolumeHandle, IN OUT EFI_PEI_FILE_HANDLE *FileHandle)
/* This service enables PEIMs to discover additional firmware files. */ EFI_STATUS EFIAPI PeiServicesFfsFindNextFile(IN EFI_FV_FILETYPE SearchType, IN EFI_PEI_FV_HANDLE VolumeHandle, IN OUT EFI_PEI_FILE_HANDLE *FileHandle)
{ CONST EFI_PEI_SERVICES **PeiServices; PeiServices = GetPeiServicesTablePointer (); return (*PeiServices)->FfsFindNextFile (PeiServices, SearchType, VolumeHandle, FileHandle); }
tianocore/edk2
C++
Other
4,240
/* Vitual COM Port initialization. The function inititalizes the hardware resources of the port used as the Virtual COM Port. */
int32_t USBD_CDC_ACM_PortInitialize(void)
/* Vitual COM Port initialization. The function inititalizes the hardware resources of the port used as the Virtual COM Port. */ int32_t USBD_CDC_ACM_PortInitialize(void)
{ uart_initialize(); main_cdc_send_event(); return 1; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* 'mxml_real_cb()' - Default callback for real number values. */
mxml_type_t mxml_real_cb(mxml_node_t *node)
/* 'mxml_real_cb()' - Default callback for real number values. */ mxml_type_t mxml_real_cb(mxml_node_t *node)
{ (void)node; return (MXML_REAL); }
DC-SWAT/DreamShell
C++
null
404
/* This is ruthless, it doesn't care what state the card is in it will completely reset the adapter. */
static void xl_reset(struct net_device *dev)
/* This is ruthless, it doesn't care what state the card is in it will completely reset the adapter. */ static void xl_reset(struct net_device *dev)
{ struct xl_private *xl_priv=netdev_priv(dev); u8 __iomem * xl_mmio = xl_priv->xl_mmio ; unsigned long t; writew( GLOBAL_RESET, xl_mmio + MMIO_COMMAND ) ; t=jiffies; while (readw(xl_mmio + MMIO_INTSTATUS) & INTSTAT_CMD_IN_PROGRESS) { if (time_after(jiffies, t + 40 * HZ)) { printk(KERN_ERR "3COM 3C359 Velocity XL card not responding.\n"); break ; } } }
robutest/uclinux
C++
GPL-2.0
60
/* Chips that have the MRM/reserved bit quirk and the burst quirk. That is the DM910X and the on chip ULi devices */
static int tulip_uli_dm_quirk(struct pci_dev *pdev)
/* Chips that have the MRM/reserved bit quirk and the burst quirk. That is the DM910X and the on chip ULi devices */ static int tulip_uli_dm_quirk(struct pci_dev *pdev)
{ if (pdev->vendor == 0x1282 && pdev->device == 0x9102) return 1; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Kill all bound sockets on a dropped device. */
static void ax25_kill_by_device(struct net_device *dev)
/* Kill all bound sockets on a dropped device. */ static void ax25_kill_by_device(struct net_device *dev)
{ ax25_dev *ax25_dev; ax25_cb *s; struct hlist_node *node; if ((ax25_dev = ax25_dev_ax25dev(dev)) == NULL) return; spin_lock_bh(&ax25_list_lock); again: ax25_for_each(s, node, &ax25_list) { if (s->ax25_dev == ax25_dev) { s->ax25_dev = NULL; spin_unlock_bh(&ax25_list_lock); ax25_disconnect(s, ENETUNREACH); spin_lock_bh(&ax25_list_lock); goto again; } } spin_unlock_bh(&ax25_list_lock); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Event handler for the library USB Control Request reception event. */
void EVENT_USB_Device_ControlRequest(void)
/* Event handler for the library USB Control Request reception event. */ void EVENT_USB_Device_ControlRequest(void)
{ HID_Device_ProcessControlRequest(&Keyboard_HID_Interface); HID_Device_ProcessControlRequest(&Mouse_HID_Interface); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* ADC MSP De-Initialization This function frees the hardware resources used in this example: */
void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
/* ADC MSP De-Initialization This function frees the hardware resources used in this example: */ void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
{ ADCx_FORCE_RESET(); ADCx_RELEASE_RESET(); HAL_GPIO_DeInit(ADCx_CHANNEL_GPIO_PORT, ADCx_CHANNEL_PIN); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Function for parsing the id of an iOS attribute. Used in the parse_get_notif_attrs_response state machine. We only request attributes that are registered with ble_ancs_c_attr_add once they have been reveiced we stop parsing. */
static ble_ancs_c_parse_state_t attr_id_parse(ble_ancs_c_t *p_ancs, const uint8_t *p_data_src, uint32_t *index)
/* Function for parsing the id of an iOS attribute. Used in the parse_get_notif_attrs_response state machine. We only request attributes that are registered with ble_ancs_c_attr_add once they have been reveiced we stop parsing. */ static ble_ancs_c_parse_state_t attr_id_parse(ble_ancs_c_t *p_ancs, const uint8_t *p_data_src, uint32_t *index)
{ p_ancs->evt.attr.attr_id = (ble_ancs_c_notif_attr_id_values_t) p_data_src[(*index)++]; p_ancs->evt.attr.p_attr_data = p_ancs->ancs_attr_list[p_ancs->evt.attr.attr_id].p_attr_data; if (p_ancs->expected_number_of_attrs == 0) { ANCS_LOG("[ANCS]: All requested attributes received\n\r"); return DONE; } else if (p_ancs->ancs_attr_list[p_ancs->evt.attr.attr_id].get == true) { ANCS_LOG("[ANCS]: Attribute ID %i \n\r", p_ancs->evt.attr.attr_id); return ATTR_LEN1; } else { p_ancs->expected_number_of_attrs--; return ATTR_ID; } }
labapart/polymcu
C++
null
201
/* Handler for new data events when using NAPI. */
static int napi_rx_handler(struct napi_struct *napi, int budget)
/* Handler for new data events when using NAPI. */ static int napi_rx_handler(struct napi_struct *napi, int budget)
{ struct sge_qset *qs = container_of(napi, struct sge_qset, napi); struct adapter *adap = qs->adap; int work_done = process_responses(adap, qs, budget); if (likely(work_done < budget)) { napi_complete(napi); t3_write_reg(adap, A_SG_GTS, V_RSPQ(qs->rspq.cntxt_id) | V_NEWTIMER(qs->rspq.next_holdoff) | V_NEWINDEX(qs->rspq.cidx)); } return work_done; }
robutest/uclinux
C++
GPL-2.0
60
/* One major difference with the PCMCIA hardware (except the port mapping) is that we have to keep the state of the Host Control Register because of the interrupt enable & bus size flags. Read from card's Host Adaptor Status Register. */
static u16 hasr_read(unsigned long ioaddr)
/* One major difference with the PCMCIA hardware (except the port mapping) is that we have to keep the state of the Host Control Register because of the interrupt enable & bus size flags. Read from card's Host Adaptor Status Register. */ static u16 hasr_read(unsigned long ioaddr)
{ return (inw(HASR(ioaddr))); }
robutest/uclinux
C++
GPL-2.0
60
/* Return pointers to the transfer negotiation information for the specified our_id/remote_id pair. */
struct ahd_initiator_tinfo* ahd_fetch_transinfo(struct ahd_softc *ahd, char channel, u_int our_id, u_int remote_id, struct ahd_tmode_tstate **tstate)
/* Return pointers to the transfer negotiation information for the specified our_id/remote_id pair. */ struct ahd_initiator_tinfo* ahd_fetch_transinfo(struct ahd_softc *ahd, char channel, u_int our_id, u_int remote_id, struct ahd_tmode_tstate **tstate)
{ if (channel == 'B') our_id += 8; *tstate = ahd->enabled_targets[our_id]; return (&(*tstate)->transinfo[remote_id]); }
robutest/uclinux
C++
GPL-2.0
60
/* The transfer end interrupt must read the chcr register to end the hardware interrupt active condition. Besides that it needs to waken any waiting process, which should handle setting up the next transfer. */
static irqreturn_t dma_tei(int irq, void *dev_id)
/* The transfer end interrupt must read the chcr register to end the hardware interrupt active condition. Besides that it needs to waken any waiting process, which should handle setting up the next transfer. */ static irqreturn_t dma_tei(int irq, void *dev_id)
{ struct dma_channel *chan = dev_id; u32 chcr; chcr = ctrl_inl(dma_base_addr[chan->chan] + CHCR); if (!(chcr & CHCR_TE)) return IRQ_NONE; chcr &= ~(CHCR_IE | CHCR_DE); ctrl_outl(chcr, (dma_base_addr[chan->chan] + CHCR)); wake_up(&chan->wait_queue); return IRQ_HANDLED; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* get the cycle number for group1 as soon as a charge-transfer sequence completes */
uint16_t tsi_group1_cycle_get(void)
/* get the cycle number for group1 as soon as a charge-transfer sequence completes */ uint16_t tsi_group1_cycle_get(void)
{ return (uint16_t)TSI_G1CYCN; }
liuxuming/trochili
C++
Apache License 2.0
132
/* Returns the appropriate secid if there is one, otherwise 0 */
u32 smack_to_secid(const char *smack)
/* Returns the appropriate secid if there is one, otherwise 0 */ u32 smack_to_secid(const char *smack)
{ struct smack_known *skp; rcu_read_lock(); list_for_each_entry_rcu(skp, &smack_known_list, list) { if (strncmp(skp->smk_known, smack, SMK_MAXLEN) == 0) { rcu_read_unlock(); return skp->smk_secid; } } rcu_read_unlock(); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Traits of this clock: prepare - clk_(un)prepare only ensures parents are prepared enable - clk_enable only ensures parents are enabled rate - rate is always a fixed value. No clk_set_rate support parent - fixed parent. No clk_set_parent support */
static unsigned long clk_fixed_rate_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
/* Traits of this clock: prepare - clk_(un)prepare only ensures parents are prepared enable - clk_enable only ensures parents are enabled rate - rate is always a fixed value. No clk_set_rate support parent - fixed parent. No clk_set_parent support */ static unsigned long clk_fixed_rate_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
{ return to_clk_fixed_rate(hw)->fixed_rate; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Converts a media text device path node to media device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextMediaPath(IN CHAR16 *TextDeviceNode)
/* Converts a media text device path node to media device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextMediaPath(IN CHAR16 *TextDeviceNode)
{ return DevPathFromTextGenericPath (MEDIA_DEVICE_PATH, TextDeviceNode); }
tianocore/edk2
C++
Other
4,240
/* Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. */
GDBusInterfaceInfo* _g_freedesktop_dbus_interface_info(void)
/* Returns: (transfer none): A #GDBusInterfaceInfo. Do not free. */ GDBusInterfaceInfo* _g_freedesktop_dbus_interface_info(void)
{ return (GDBusInterfaceInfo *) &__g_freedesktop_dbus_interface_info.parent_struct; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Truncate file to 'offset' bytes (needed only for file protocols) */
int bdrv_truncate(BlockDriverState *bs, int64_t offset)
/* Truncate file to 'offset' bytes (needed only for file protocols) */ int bdrv_truncate(BlockDriverState *bs, int64_t offset)
{ BlockDriver *drv = bs->drv; int ret; if (!drv) return -ENOMEDIUM; if (!drv->bdrv_truncate) return -ENOTSUP; if (bs->read_only) return -EACCES; if (bdrv_in_use(bs)) return -EBUSY; ret = drv->bdrv_truncate(bs, offset); if (ret == 0) { ret = refresh_total_sectors(bs, offset >> BDRV_SECTOR_BITS); bdrv_dev_resize_cb(bs); } return ret; }
ve3wwg/teensy3_qemu
C
Other
15
/* The LCD is written two by more than one task so is controlled by a 'gatekeeper' task. This is the only task that is actually permitted to access the LCD directly. Other tasks wanting to display a message send the message to the gatekeeper. */
void vLCDTask(void *pvParameters)
/* The LCD is written two by more than one task so is controlled by a 'gatekeeper' task. This is the only task that is actually permitted to access the LCD directly. Other tasks wanting to display a message send the message to the gatekeeper. */ void vLCDTask(void *pvParameters)
{ xLCDMessage xMessage; LCD_init(); LCD_cur_off(); LCD_cls(); LCD_gotoxy( 1, 1 ); LCD_puts( "www.FreeRTOS.org" ); for( ;; ) { while( xQueueReceive( xLCDQueue, &xMessage, portMAX_DELAY ) != pdPASS ); LCD_cls(); LCD_gotoxy( ( xMessage.xColumn & 0x07 ) + 1, ( xMessage.xColumn & 0x01 ) + 1 ); LCD_puts( xMessage.pcMessage ); } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* this function is a POSIX compliant version, which will rename old file name to new file name. */
int rename(const char *old_file, const char *new_file)
/* this function is a POSIX compliant version, which will rename old file name to new file name. */ int rename(const char *old_file, const char *new_file)
{ int result; if (old_file == NULL || new_file == NULL) { rt_set_errno(-EBADF); return -1; } result = dfs_file_rename(old_file, new_file); if (result < 0) { rt_set_errno(result); return -1; } return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function will initialize hardware interrupt Called by the primary cpu(cpu0) */
void rt_hw_interrupt_init(void)
/* This function will initialize hardware interrupt Called by the primary cpu(cpu0) */ void rt_hw_interrupt_init(void)
{ rt_uint32_t gic_dist_base; rt_uint32_t gic_irq_start; rt_hw_vector_init(); rt_memset(isr_table, 0x00, sizeof(isr_table)); gic_dist_base = platform_get_gic_dist_base(); gic_irq_start = GIC_IRQ_START; arm_gic_dist_init(0, gic_dist_base, gic_irq_start); arm_gic_cpu_init(0); arm_gic_redist_init(0); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Fills each TIM_TimeBaseInitStruct member with its default value. */
void TIM_TimeBaseStructInit(TIM_TimeBaseInitTypeDef *TIM_TimeBaseInitStruct)
/* Fills each TIM_TimeBaseInitStruct member with its default value. */ void TIM_TimeBaseStructInit(TIM_TimeBaseInitTypeDef *TIM_TimeBaseInitStruct)
{ TIM_TimeBaseInitStruct->TIM_Period = 0xFFFF; TIM_TimeBaseInitStruct->TIM_Prescaler = 0x0000; TIM_TimeBaseInitStruct->TIM_ClockDivision = TIM_CKD_DIV1; TIM_TimeBaseInitStruct->TIM_CounterMode = TIM_CounterMode_Up; TIM_TimeBaseInitStruct->TIM_RepetitionCounter = 0x0000; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Attribute write call back for the Value V2 attribute. */
static ssize_t write_value_v2_4(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
/* Attribute write call back for the Value V2 attribute. */ static ssize_t write_value_v2_4(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
{ char *value = attr->user_data; if (offset >= sizeof(value_v2_4_value)) return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET); if (offset + len > sizeof(value_v2_4_value)) return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN); memcpy(value + offset, buf, len); return len; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* RTC MSP Initialization This function configures the hardware resources used in this example. */
void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc)
/* RTC MSP Initialization This function configures the hardware resources used in this example. */ void HAL_RTC_MspInit(RTC_HandleTypeDef *hrtc)
{ RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; if(hrtc->Instance==RTC) { PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_RTC; PeriphClkInit.RTCClockSelection = RCC_RTCCLKSOURCE_LSE; if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) { Error_Handler(); } __HAL_RCC_RTC_ENABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Waits for 'usecs' microseconds using the TOD clock comparator. */
void __udelay(unsigned long long usecs)
/* Waits for 'usecs' microseconds using the TOD clock comparator. */ void __udelay(unsigned long long usecs)
{ unsigned long flags; preempt_disable(); local_irq_save(flags); if (in_irq()) { __udelay_disabled(usecs); goto out; } if (in_softirq()) { if (raw_irqs_disabled_flags(flags)) __udelay_disabled(usecs); else __udelay_enabled(usecs); goto out; } if (raw_irqs_disabled_flags(flags)) { local_bh_disable(); __udelay_disabled(usecs); _local_bh_enable(); goto out; } __udelay_enabled(usecs); out: local_irq_restore(flags); preempt_enable(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Determine if action frame is p2p gas action type */
static bool brcmf_p2p_is_gas_action(void *frame, u32 frame_len)
/* Determine if action frame is p2p gas action type */ static bool brcmf_p2p_is_gas_action(void *frame, u32 frame_len)
{ struct brcmf_p2psd_gas_pub_act_frame *sd_act_frm; if (frame == NULL) return false; sd_act_frm = (struct brcmf_p2psd_gas_pub_act_frame *)frame; if (frame_len < sizeof(struct brcmf_p2psd_gas_pub_act_frame) - 1) return false; if (sd_act_frm->category != P2PSD_ACTION_CATEGORY) return false; if (sd_act_frm->action == P2PSD_ACTION_ID_GAS_IREQ || sd_act_frm->action == P2PSD_ACTION_ID_GAS_IRESP || sd_act_frm->action == P2PSD_ACTION_ID_GAS_CREQ || sd_act_frm->action == P2PSD_ACTION_ID_GAS_CRESP) return true; return false; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function is called if a commit is required but cannot be done from the calling function, so it is just flagged instead. */
void ubifs_commit_required(struct ubifs_info *c)
/* This function is called if a commit is required but cannot be done from the calling function, so it is just flagged instead. */ void ubifs_commit_required(struct ubifs_info *c)
{ spin_lock(&c->cs_lock); switch (c->cmt_state) { case COMMIT_RESTING: case COMMIT_BACKGROUND: dbg_cmt("old: %s, new: %s", dbg_cstate(c->cmt_state), dbg_cstate(COMMIT_REQUIRED)); c->cmt_state = COMMIT_REQUIRED; break; case COMMIT_RUNNING_BACKGROUND: dbg_cmt("old: %s, new: %s", dbg_cstate(c->cmt_state), dbg_cstate(COMMIT_RUNNING_REQUIRED)); c->cmt_state = COMMIT_RUNNING_REQUIRED; break; case COMMIT_REQUIRED: case COMMIT_RUNNING_REQUIRED: case COMMIT_BROKEN: break; } spin_unlock(&c->cs_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* The function is used to read/write UFS flag descriptors. The consumer of this API is responsible for allocating the buffer pointed by Flag. The buffer size is 1 byte as UFS flag descriptor is just a single Boolean value that represents a TRUE or FALSE, '0' or '1', ON or OFF type of value. */
EFI_STATUS EFIAPI UfsRwUfsFlag(IN EFI_UFS_DEVICE_CONFIG_PROTOCOL *This, IN BOOLEAN Read, IN UINT8 FlagId, IN OUT UINT8 *Flag)
/* The function is used to read/write UFS flag descriptors. The consumer of this API is responsible for allocating the buffer pointed by Flag. The buffer size is 1 byte as UFS flag descriptor is just a single Boolean value that represents a TRUE or FALSE, '0' or '1', ON or OFF type of value. */ EFI_STATUS EFIAPI UfsRwUfsFlag(IN EFI_UFS_DEVICE_CONFIG_PROTOCOL *This, IN BOOLEAN Read, IN UINT8 FlagId, IN OUT UINT8 *Flag)
{ EFI_STATUS Status; UFS_PASS_THRU_PRIVATE_DATA *Private; Private = UFS_PASS_THRU_PRIVATE_DATA_FROM_DEV_CONFIG (This); if ((This == NULL) || (Flag == NULL)) { return EFI_INVALID_PARAMETER; } Status = UfsRwFlags (Private, Read, FlagId, Flag); if (Status == EFI_TIMEOUT) { Status = EFI_DEVICE_ERROR; } return Status; }
tianocore/edk2
C++
Other
4,240
/* Retrieve the serial number of the specified ISDN controller or (for @contr == 0) the driver itself. Return value: CAPI result code */
u16 capi20_get_serial(u32 contr, u8 *serial)
/* Retrieve the serial number of the specified ISDN controller or (for @contr == 0) the driver itself. Return value: CAPI result code */ u16 capi20_get_serial(u32 contr, u8 *serial)
{ struct capi_ctr *card; if (contr == 0) { strlcpy(serial, driver_serial, CAPI_SERIAL_LEN); return CAPI_NOERROR; } card = get_capi_ctr_by_nr(contr); if (!card || card->cardstate != CARD_RUNNING) return CAPI_REGNOTINSTALLED; strlcpy((void *) serial, card->serial, CAPI_SERIAL_LEN); return CAPI_NOERROR; }
robutest/uclinux
C++
GPL-2.0
60
/* Set function to write firmware to device's persistent memory */
static ssize_t if_usb_firmware_set(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
/* Set function to write firmware to device's persistent memory */ static ssize_t if_usb_firmware_set(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
{ struct lbs_private *priv = to_net_dev(dev)->ml_priv; struct if_usb_card *cardp = priv->card; int ret; ret = if_usb_prog_firmware(cardp, buf, BOOT_CMD_UPDATE_FW); if (ret == 0) return count; return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Registers an interrupt handler for the I2C module. */
void I2CIntRegister(uint32_t ui32Base, void(*pfnHandler)(void))
/* Registers an interrupt handler for the I2C module. */ void I2CIntRegister(uint32_t ui32Base, void(*pfnHandler)(void))
{ uint32_t ui32Int; ASSERT(_I2CBaseValid(ui32Base)); ui32Int = _I2CIntNumberGet(ui32Base); ASSERT(ui32Int != 0); IntRegister(ui32Int, pfnHandler); IntEnable(ui32Int); }
micropython/micropython
C++
Other
18,334
/* Note that currently this is an internal only function: it will be exposed to machine drivers after further backporting of ASoC v2 registration APIs. */
static int snd_soc_unregister_card(struct snd_soc_card *card)
/* Note that currently this is an internal only function: it will be exposed to machine drivers after further backporting of ASoC v2 registration APIs. */ static int snd_soc_unregister_card(struct snd_soc_card *card)
{ mutex_lock(&client_mutex); list_del(&card->list); mutex_unlock(&client_mutex); dev_dbg(card->dev, "Unregistered card '%s'\n", card->name); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* If this function returns, it means that the system does not support cold reset. */
VOID EFIAPI ResetCold(VOID)
/* If this function returns, it means that the system does not support cold reset. */ VOID EFIAPI ResetCold(VOID)
{ ArmCallSmc0 (ARM_SMC_ID_PSCI_SYSTEM_RESET, NULL, NULL, NULL); }
tianocore/edk2
C++
Other
4,240
/* If Buffer is NULL, then ASSERT(). If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */
VOID* EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
/* If Buffer is NULL, then ASSERT(). If AllocationSize is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */ VOID* EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
{ VOID *Memory; Memory = malloc (AllocationSize); if (Memory == NULL) { return NULL; } memcpy (Memory, Buffer, AllocationSize); return Memory; }
tianocore/edk2
C++
Other
4,240
/* Free a server TID and return it to the free pool. */
void cxgb3_free_stid(struct t3cdev *tdev, int stid)
/* Free a server TID and return it to the free pool. */ void cxgb3_free_stid(struct t3cdev *tdev, int stid)
{ struct tid_info *t = &(T3C_DATA(tdev))->tid_maps; union listen_entry *p = stid2entry(t, stid); spin_lock_bh(&t->stid_lock); p->next = t->sfree; t->sfree = p; t->stids_in_use--; spin_unlock_bh(&t->stid_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* For licensing information, see the file 'LICENCE' in this directory. */
static int jffs2_flash_setup(struct jffs2_sb_info *c)
/* For licensing information, see the file 'LICENCE' in this directory. */ static int jffs2_flash_setup(struct jffs2_sb_info *c)
{ ret = jffs2_nand_flash_setup(c); if (ret) return ret; } if (jffs2_dataflash(c)) { ret = jffs2_dataflash_setup(c); if (ret) return ret; } if (jffs2_nor_wbuf_flash(c)) { ret = jffs2_nor_wbuf_flash_setup(c); if (ret) return ret; } if (jffs2_ubivol(c)) { ret = jffs2_ubivol_setup(c); if (ret) return ret; } return ret; }
robutest/uclinux
C++
GPL-2.0
60