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
/* Copies the string from line to the buffer at param, unquoting backslash-quoted characters and NUL-terminating the output string. Stops at the first non-backslash-quoted double quote character or the end of the input string. param must be at least as long as the input string. Returns the pointer after the last handled input character. */
static const char * unslashquote(const char *line, char *param)
/* Copies the string from line to the buffer at param, unquoting backslash-quoted characters and NUL-terminating the output string. Stops at the first non-backslash-quoted double quote character or the end of the input string. param must be at least as long as the input string. Returns the pointer after the last handled input character. */ static const char * unslashquote(const char *line, char *param)
{ while(*line && (*line != '\"')) { if(*line == '\\') { char out; line++; switch(out = *line) { case '\0': continue; case 't': out = '\t'; break; case 'n': out = '\n'; break; case 'r': out = '\r'; break; case 'v': out = '\v'; break; } *param++ = out; line++; } else *param++ = *line++; } *param = '\0'; return line; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Read TC72 temperature value and handle data in decimal. */
short TC72TemperReadDec(void)
/* Read TC72 temperature value and handle data in decimal. */ short TC72TemperReadDec(void)
{ short sTempValue; sTempValue = TC72TemperRead(); sTempValue = sTempValue * 0.25; return sTempValue; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* cpuset_cpus_allowed_locked - return cpus_allowed mask from a tasks cpuset. Must be called with callback_mutex held. */
void cpuset_cpus_allowed_locked(struct task_struct *tsk, struct cpumask *pmask)
/* cpuset_cpus_allowed_locked - return cpus_allowed mask from a tasks cpuset. Must be called with callback_mutex held. */ void cpuset_cpus_allowed_locked(struct task_struct *tsk, struct cpumask *pmask)
{ task_lock(tsk); guarantee_online_cpus(task_cs(tsk), pmask); task_unlock(tsk); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Message: UnregisterMessage Opcode: 0x0027 Type: RegistrationAndManagement Direction: dev2pbx VarLength: no */
static void handle_UnregisterMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
/* Message: UnregisterMessage Opcode: 0x0027 Type: RegistrationAndManagement Direction: dev2pbx VarLength: no */ static void handle_UnregisterMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
{ guint32 hdr_data_length = tvb_get_letohl(ptvcursor_tvbuff(cursor), 0); if (hdr_data_length > 12) { ptvcursor_add(cursor, hf_skinny_unRegReasonCode, 4, ENC_LITTLE_ENDIAN); } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function returns volume table contents in case of success and a negative error code in case of failure. */
static struct ubi_vtbl_record* create_empty_lvol(struct ubi_device *ubi, struct ubi_attach_info *ai)
/* This function returns volume table contents in case of success and a negative error code in case of failure. */ static struct ubi_vtbl_record* create_empty_lvol(struct ubi_device *ubi, struct ubi_attach_info *ai)
{ int i; struct ubi_vtbl_record *vtbl; vtbl = vzalloc(ubi->vtbl_size); if (!vtbl) return ERR_PTR(-ENOMEM); for (i = 0; i < ubi->vtbl_slots; i++) memcpy(&vtbl[i], &empty_vtbl_record, UBI_VTBL_RECORD_SIZE); for (i = 0; i < UBI_LAYOUT_VOLUME_EBS; i++) { int err; err = create_vtbl(ubi, ai, i, vtbl); if (err) { vfree(vtbl); return ERR_PTR(err); } } return vtbl; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Get the state of ALL GPIOs from the DATA OUTPUT REGISTER. This function retrieves the state of ALL GPIOs from the DATA OUTPUT REGISTER. */
uint64_t am_hal_gpio_out_read(void)
/* Get the state of ALL GPIOs from the DATA OUTPUT REGISTER. This function retrieves the state of ALL GPIOs from the DATA OUTPUT REGISTER. */ uint64_t am_hal_gpio_out_read(void)
{ uint64_t ui64RetVal; ui64RetVal = ((uint64_t) AM_REGn(GPIO, 0, WTB)) << 32; ui64RetVal |= ((uint64_t) AM_REGn(GPIO, 0, WTA)) << 0; return ui64RetVal; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If AuthData is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI CryptoServiceImageTimestampVerify(IN CONST UINT8 *AuthData, IN UINTN DataSize, IN CONST UINT8 *TsaCert, IN UINTN CertSize, OUT EFI_TIME *SigningTime)
/* If AuthData is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ BOOLEAN EFIAPI CryptoServiceImageTimestampVerify(IN CONST UINT8 *AuthData, IN UINTN DataSize, IN CONST UINT8 *TsaCert, IN UINTN CertSize, OUT EFI_TIME *SigningTime)
{ return CALL_BASECRYPTLIB (Pkcs.Services.ImageTimestampVerify, ImageTimestampVerify, (AuthData, DataSize, TsaCert, CertSize, SigningTime), FALSE); }
tianocore/edk2
C++
Other
4,240
/* check if the given pointer is valid for pages */
static int is_valid_page(unsigned long ptr)
/* check if the given pointer is valid for pages */ static int is_valid_page(unsigned long ptr)
{ if (ptr & ~0x3fffffffUL) { snd_printk(KERN_ERR "max memory size is 1GB!!\n"); return 0; } if (ptr & (SNDRV_TRIDENT_PAGE_SIZE-1)) { snd_printk(KERN_ERR "page is not aligned\n"); return 0; } return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* param base The LPI2C peripheral base address. param handle Pointer to the LPI2C master driver handle. param callback User provided pointer to the asynchronous callback function. param userData User provided pointer to the application callback data. */
void LPI2C_MasterTransferCreateHandle(LPI2C_Type *base, lpi2c_master_handle_t *handle, lpi2c_master_transfer_callback_t callback, void *userData)
/* param base The LPI2C peripheral base address. param handle Pointer to the LPI2C master driver handle. param callback User provided pointer to the asynchronous callback function. param userData User provided pointer to the application callback data. */ void LPI2C_MasterTransferCreateHandle(LPI2C_Type *base, lpi2c_master_handle_t *handle, lpi2c_master_transfer_callback_t callback, void *userData)
{ uint32_t instance; assert(handle); memset(handle, 0, sizeof(*handle)); instance = LPI2C_GetInstance(base); handle->completionCallback = callback; handle->userData = userData; s_lpi2cMasterHandle[instance] = handle; s_lpi2cMasterIsr = LPI2C_MasterTransferHandleIRQ; LPI2C_MasterDisableInterrupts(base, kMasterIrqFlags); EnableIRQ(kLpi2cIrqs[instance]); }
nanoframework/nf-interpreter
C++
MIT License
293
/* Remove all allocated DMA memory and unmap memory IO regions. If MTRR is enabled, also remove it again. */
static void i2o_pci_free(struct i2o_controller *c)
/* Remove all allocated DMA memory and unmap memory IO regions. If MTRR is enabled, also remove it again. */ static void i2o_pci_free(struct i2o_controller *c)
{ struct device *dev; dev = &c->pdev->dev; i2o_dma_free(dev, &c->out_queue); i2o_dma_free(dev, &c->status_block); kfree(c->lct); i2o_dma_free(dev, &c->dlct); i2o_dma_free(dev, &c->hrt); i2o_dma_free(dev, &c->status); if (c->raptor && c->in_queue.virt) iounmap(c->in_queue.virt); if (c->base.virt) iounmap(c->base.virt); pci_release_regions(c->pdev); }
robutest/uclinux
C++
GPL-2.0
60
/* Reads the current Z/pressure level using the ADC. */
void tsReadZ(uint32_t *z1, uint32_t *z2)
/* Reads the current Z/pressure level using the ADC. */ void tsReadZ(uint32_t *z1, uint32_t *z2)
{ if (!_tsInitialised) tsInit(); TS_XM_FUNC_GPIO; TS_YP_FUNC_GPIO; TS_YM_FUNC_GPIO; gpioSetDir (TS_XM_PORT, TS_XM_PIN, 1); gpioSetDir (TS_YP_PORT, TS_YP_PIN, 1); gpioSetDir (TS_YM_PORT, TS_YM_PIN, 0); gpioSetValue(TS_XM_PORT, TS_XM_PIN, 0); gpioSetValue(TS_YP_PORT, TS_YP_PIN, 1); TS_XP_FUNC_ADC; *z1 = adcRead(TS_XP_ADC_CHANNEL); TS_XP_FUNC_GPIO; gpioSetDir (TS_YM_PORT, TS_YM_PIN, 0); TS_YM_FUNC_ADC; *z2 = adcRead(TS_YM_ADC_CHANNEL); }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Shifting left (multiplying) means moving bits in the LS -> MS direction. Zeros are fed into the vacated LS bit positions and those MS bits shifted off the top are lost. */
void __bitmap_shift_left(unsigned long *dst, const unsigned long *src, int shift, int bits)
/* Shifting left (multiplying) means moving bits in the LS -> MS direction. Zeros are fed into the vacated LS bit positions and those MS bits shifted off the top are lost. */ void __bitmap_shift_left(unsigned long *dst, const unsigned long *src, int shift, int bits)
{ int k, lim = BITS_TO_LONGS(bits), left = bits % BITS_PER_LONG; int off = shift/BITS_PER_LONG, rem = shift % BITS_PER_LONG; for (k = lim - off - 1; k >= 0; --k) { unsigned long upper, lower; if (rem && k > 0) lower = src[k - 1]; else lower = 0; upper = src[k]; if (left && k == lim - 1) upper &= (1UL << left) - 1; dst[k + off] = lower >> (BITS_PER_LONG - rem) | upper << rem; if (left && k + off == lim - 1) dst[k + off] &= (1UL << left) - 1; } if (off) memset(dst, 0, off*sizeof(unsigned long)); }
robutest/uclinux
C++
GPL-2.0
60
/* PE calls this function to check if the Present Contract is still valid. */
static bool port0_policy_cb_present_contract_is_valid(const struct device *dev, const uint32_t present_contract)
/* PE calls this function to check if the Present Contract is still valid. */ static bool port0_policy_cb_present_contract_is_valid(const struct device *dev, const uint32_t present_contract)
{ struct port0_data_t *dpm_data = usbc_get_dpm_data(dev); union pd_fixed_supply_pdo_source pdo; union pd_rdo request; uint32_t obj_pos; uint32_t op_current; request.raw_value = present_contract; obj_pos = request.fixed.object_pos; op_current = PD_CONVERT_FIXED_PDO_CURRENT_TO_MA(request.fixed.operating_current); if (obj_pos == 0 || obj_pos > dpm_data->src_cap_cnt) { return false; } pdo.raw_value = dpm_data->src_caps[obj_pos - 1]; if (request.fixed.operating_current > pdo.max_current) { return false; } return true; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Function for enabling or disabling events for pins used by the user. Function will enable pin events only if they are not yet enabled. Function will disable pin events only if there is no other enabled user that is using them. */
static uint32_t user_enable(app_gpiote_user_id_t user_id, bool enable)
/* Function for enabling or disabling events for pins used by the user. Function will enable pin events only if they are not yet enabled. Function will disable pin events only if there is no other enabled user that is using them. */ static uint32_t user_enable(app_gpiote_user_id_t user_id, bool enable)
{ uint32_t ret_code = error_check(user_id); if (ret_code == NRF_SUCCESS) { uint32_t i; uint32_t mask = 1UL; for (i = 0; i < 32; i++) { if (mp_users[user_id].pins_mask & mask) { pin_event_enable(i, enable); } mask <<= 1; } } return ret_code; }
labapart/polymcu
C++
null
201
/* Release a Mutex that was obtained by osMutexWait. */
osStatus osMutexRelease(osMutexId mutex_id)
/* Release a Mutex that was obtained by osMutexWait. */ osStatus osMutexRelease(osMutexId mutex_id)
{ BaseType_t pxHigherPriorityTaskWoken; xSemaphoreGiveFromISR(mutex->mutex, &pxHigherPriorityTaskWoken); } else { xSemaphoreGive(mutex->mutex); } return osOK; }
labapart/polymcu
C++
null
201
/* Create thunks for an EBC image entry point, or an EBC protocol service. */
EFI_STATUS EbcCreateThunks(IN EFI_HANDLE ImageHandle, IN VOID *EbcEntryPoint, OUT VOID **Thunk, IN UINT32 Flags)
/* Create thunks for an EBC image entry point, or an EBC protocol service. */ EFI_STATUS EbcCreateThunks(IN EFI_HANDLE ImageHandle, IN VOID *EbcEntryPoint, OUT VOID **Thunk, IN UINT32 Flags)
{ EBC_INSTRUCTION_BUFFER *InstructionBuffer; if ((UINT32)(UINTN)EbcEntryPoint & 0x01) { return EFI_INVALID_PARAMETER; } InstructionBuffer = EbcAllocatePoolForThunk (sizeof (EBC_INSTRUCTION_BUFFER)); if (InstructionBuffer == NULL) { return EFI_OUT_OF_RESOURCES; } *Thunk = InstructionBuffer; CopyMem ( InstructionBuffer, &mEbcInstructionBufferTemplate, sizeof (EBC_INSTRUCTION_BUFFER) ); InstructionBuffer->EbcEntryPoint = (UINT64)EbcEntryPoint; if ((Flags & FLAG_THUNK_ENTRY_POINT) != 0) { InstructionBuffer->EbcLlEntryPoint = (UINT64)EbcLLExecuteEbcImageEntryPoint; } else { InstructionBuffer->EbcLlEntryPoint = (UINT64)EbcLLEbcInterpret; } EbcAddImageThunk ( ImageHandle, InstructionBuffer, sizeof (EBC_INSTRUCTION_BUFFER) ); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* This function returns the real bus clock of USCI_I2C module. */
uint32_t UI2C_GetBusClockFreq(UI2C_T *ui2c)
/* This function returns the real bus clock of USCI_I2C module. */ uint32_t UI2C_GetBusClockFreq(UI2C_T *ui2c)
{ uint32_t u32Divider; uint32_t u32Pclk; u32Pclk = CLK_GetPCLK0Freq(); u32Divider = (ui2c->BRGEN & UI2C_BRGEN_CLKDIV_Msk) >> UI2C_BRGEN_CLKDIV_Pos; return (u32Pclk / ((u32Divider + 1U) << 1U)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns the Null-terminated Unicode string that is used to fill in the VersionName field of the EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImageInfo() service of the Firmware Management Protocol. The returned string must be allocated using EFI_BOOT_SERVICES.AllocatePool(). */
EFI_STATUS EFIAPI FmpDeviceGetVersionString(OUT CHAR16 **VersionString)
/* Returns the Null-terminated Unicode string that is used to fill in the VersionName field of the EFI_FIRMWARE_IMAGE_DESCRIPTOR structure that is returned by the GetImageInfo() service of the Firmware Management Protocol. The returned string must be allocated using EFI_BOOT_SERVICES.AllocatePool(). */ EFI_STATUS EFIAPI FmpDeviceGetVersionString(OUT CHAR16 **VersionString)
{ if (VersionString == NULL) { return EFI_INVALID_PARAMETER; } *VersionString = NULL; return EFI_UNSUPPORTED; }
tianocore/edk2
C++
Other
4,240
/* param handle codec handle. param mclk master clock frequency in HZ. param sampleRate sample rate in HZ. param bitWidth bit width. return kStatus_Success is success, else configure failed. */
status_t HAL_CODEC_SetFormat(void *handle, uint32_t mclk, uint32_t sampleRate, uint32_t bitWidth)
/* param handle codec handle. param mclk master clock frequency in HZ. param sampleRate sample rate in HZ. param bitWidth bit width. return kStatus_Success is success, else configure failed. */ status_t HAL_CODEC_SetFormat(void *handle, uint32_t mclk, uint32_t sampleRate, uint32_t bitWidth)
{ assert(handle != NULL); return CS42888_ConfigDataFormat((cs42888_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)), mclk, sampleRate, bitWidth); }
eclipse-threadx/getting-started
C++
Other
310
/* It is being called in three cases: ext2_release_file(): last writer closes the file ext2_clear_inode(): last iput(), when nobody links to this file. ext2_truncate(): when the block indirect map is about to change. */
void ext2_discard_reservation(struct inode *inode)
/* It is being called in three cases: ext2_release_file(): last writer closes the file ext2_clear_inode(): last iput(), when nobody links to this file. ext2_truncate(): when the block indirect map is about to change. */ void ext2_discard_reservation(struct inode *inode)
{ struct ext2_inode_info *ei = EXT2_I(inode); struct ext2_block_alloc_info *block_i = ei->i_block_alloc_info; struct ext2_reserve_window_node *rsv; spinlock_t *rsv_lock = &EXT2_SB(inode->i_sb)->s_rsv_window_lock; if (!block_i) return; rsv = &block_i->rsv_window_node; if (!rsv_is_empty(&rsv->rsv_window)) { spin_lock(rsv_lock); if (!rsv_is_empty(&rsv->rsv_window)) rsv_window_remove(inode->i_sb, rsv); spin_unlock(rsv_lock); } }
robutest/uclinux
C++
GPL-2.0
60
/* One notified function to stop the Host Controller at the end of PEI */
EFI_STATUS EFIAPI XhcEndOfPei(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, IN VOID *Ppi)
/* One notified function to stop the Host Controller at the end of PEI */ EFI_STATUS EFIAPI XhcEndOfPei(IN EFI_PEI_SERVICES **PeiServices, IN EFI_PEI_NOTIFY_DESCRIPTOR *NotifyDescriptor, IN VOID *Ppi)
{ PEI_XHC_DEV *Xhc; Xhc = PEI_RECOVERY_USB_XHC_DEV_FROM_THIS_NOTIFY (NotifyDescriptor); XhcPeiHaltHC (Xhc, XHC_GENERIC_TIMEOUT); XhcPeiFreeSched (Xhc); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Copies the data of one whole block of a NAND Flash device to another block. */
uint32_t nand_flash_raw_copy_block(const struct nand_flash_raw *raw, uint16_t source_block, uint16_t dest_block)
/* Copies the data of one whole block of a NAND Flash device to another block. */ uint32_t nand_flash_raw_copy_block(const struct nand_flash_raw *raw, uint16_t source_block, uint16_t dest_block)
{ uint16_t num_page = nand_flash_model_get_block_size_in_pages(MODEL(raw)); uint32_t i; Assert(source_block != dest_block); for (i = 0; i < num_page; i++) { if (nand_flash_raw_copy_page(raw, source_block, i, dest_block, i)) { return NAND_COMMON_ERROR_BADBLOCK; } } return 0; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Transmit one 4-9 bit frame with extended control. Notice that possible parity/stop bits in asynchronous mode are not considered part of specified frame bit length. */
void USART_TxExt(USART_TypeDef *usart, uint16_t data)
/* Transmit one 4-9 bit frame with extended control. Notice that possible parity/stop bits in asynchronous mode are not considered part of specified frame bit length. */ void USART_TxExt(USART_TypeDef *usart, uint16_t data)
{ while (!(usart->STATUS & USART_STATUS_TXBL)) ; usart->TXDATAX = (uint32_t)data; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Checks whether the FLASH Prefetch Buffer status is set or not. */
FlagStatus FLASH_GetPrefetchBufferStatus(void)
/* Checks whether the FLASH Prefetch Buffer status is set or not. */ FlagStatus FLASH_GetPrefetchBufferStatus(void)
{ FlagStatus bitstatus = RESET; if ((FLASH->ACR & FLASH_ACR_PRFTBS) != (uint32_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
/* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
{ if(hadc->Instance==ADC3) { __HAL_RCC_ADC3_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOF, GPIO_PIN_3|GPIO_PIN_8); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* clk_disable - inform the system when the clock source is no longer required */
void clk_disable(struct clk *clk)
/* clk_disable - inform the system when the clock source is no longer required */ void clk_disable(struct clk *clk)
{ unsigned long flags; WARN_ON(clk->enabled == 0); spin_lock_irqsave(&clocks_lock, flags); if (--clk->enabled == 0) local_clk_disable(clk); spin_unlock_irqrestore(&clocks_lock, flags); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Used by a driver to check whether a */
static int pci_bus_match(struct device *dev, struct device_driver *drv)
/* Used by a driver to check whether a */ static int pci_bus_match(struct device *dev, struct device_driver *drv)
{ struct pci_dev *pci_dev = to_pci_dev(dev); struct pci_driver *pci_drv = to_pci_driver(drv); const struct pci_device_id *found_id; found_id = pci_match_device(pci_drv, pci_dev); if (found_id) return 1; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Encode a WPA or RSN information element as a custom element using the hostap format. */
u32 encode_ie(void *buf, u32 bufsize, const u8 *ie, u32 ielen, const u8 *leader, u32 leader_len)
/* Encode a WPA or RSN information element as a custom element using the hostap format. */ u32 encode_ie(void *buf, u32 bufsize, const u8 *ie, u32 ielen, const u8 *leader, u32 leader_len)
{ u8 *p; u32 i; if (bufsize < leader_len) return 0; p = buf; memcpy(p, leader, leader_len); bufsize -= leader_len; p += leader_len; for (i = 0; i < ielen && bufsize > 2; i++) p += sprintf(p, "%02x", ie[i]); return (i == ielen ? p - (u8 *)buf:0); }
robutest/uclinux
C++
GPL-2.0
60
/* Initialize the controller. Used to initialize the ILI9341 display controller by setting up the hardware interface, and setting up the controller according to the manufacturer's description. It also set up the screen orientation to the default state (portrait). */
void ili9341_init(void)
/* Initialize the controller. Used to initialize the ILI9341 display controller by setting up the hardware interface, and setting up the controller according to the manufacturer's description. It also set up the screen orientation to the default state (portrait). */ void ili9341_init(void)
{ ili9341_interface_init(); ili9341_reset_display(); ili9341_exit_standby(); ili9341_controller_init_registers(); }
remotemcu/remcu-chip-sdks
C++
null
436
/* 09Apr2002 Andrew Morton Initial version. Initialise a struct file's readahead state. Assumes that the caller has memset *ra to zero. */
void file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping)
/* 09Apr2002 Andrew Morton Initial version. Initialise a struct file's readahead state. Assumes that the caller has memset *ra to zero. */ void file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping)
{ ra->ra_pages = mapping->backing_dev_info->ra_pages; ra->prev_pos = -1; }
robutest/uclinux
C++
GPL-2.0
60
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
void Vector60_handler(void)
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */ void Vector60_handler(void)
{ asm { LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (60 * 2)) JMP 0,X } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Registers an interrupt handler for the comparator interrupt. */
void ComparatorIntRegister(uint32_t ui32Base, uint32_t ui32Comp, void(*pfnHandler)(void))
/* Registers an interrupt handler for the comparator interrupt. */ void ComparatorIntRegister(uint32_t ui32Base, uint32_t ui32Comp, void(*pfnHandler)(void))
{ ASSERT(ui32Base == COMP_BASE); ASSERT(ui32Comp < 3); IntRegister(INT_COMP0_BLIZZARD + ui32Comp, pfnHandler); IntEnable(INT_COMP0_BLIZZARD + ui32Comp); HWREG(ui32Base + COMP_O_ACINTEN) |= 1 << ui32Comp; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* GMAC tries only one transmission (Only in Half Duplex mode). If collision occurs on the GMII/MII, GMAC will ignore the current frami transmission and report a frame abort with excessive collision in tranmit frame status. */
void synopGMAC_retry_disable(synopGMACdevice *gmacdev)
/* GMAC tries only one transmission (Only in Half Duplex mode). If collision occurs on the GMII/MII, GMAC will ignore the current frami transmission and report a frame abort with excessive collision in tranmit frame status. */ void synopGMAC_retry_disable(synopGMACdevice *gmacdev)
{ synopGMACSetBits(gmacdev->MacBase, GmacConfig, GmacRetry); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns: data from the queue or NULL, when no data is available immediately. */
gpointer g_async_queue_try_pop_unlocked(GAsyncQueue *queue)
/* Returns: data from the queue or NULL, when no data is available immediately. */ gpointer g_async_queue_try_pop_unlocked(GAsyncQueue *queue)
{ g_return_val_if_fail (queue, NULL); return g_async_queue_pop_intern_unlocked (queue, FALSE, -1); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Checks to see if the scanner is enabled. */
int ble_ll_scan_enabled(void)
/* Checks to see if the scanner is enabled. */ int ble_ll_scan_enabled(void)
{ return (int)g_ble_ll_scan_sm.scan_enabled; }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* If a I2O device is removed, we catch the notification to remove the corresponding SCSI device. */
static void i2o_scsi_notify_device_remove(struct i2o_device *i2o_dev)
/* If a I2O device is removed, we catch the notification to remove the corresponding SCSI device. */ static void i2o_scsi_notify_device_remove(struct i2o_device *i2o_dev)
{ switch (i2o_dev->lct_data.class_id) { case I2O_CLASS_EXECUTIVE: case I2O_CLASS_RANDOM_BLOCK_STORAGE: i2o_scsi_remove(&i2o_dev->device); break; default: break; } }
robutest/uclinux
C++
GPL-2.0
60
/* If the conversion results in an overflow or an underflow condition, then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeIntnToInt32(IN INTN Operand, OUT INT32 *Result)
/* If the conversion results in an overflow or an underflow condition, then Result is set to INT32_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeIntnToInt32(IN INTN Operand, OUT INT32 *Result)
{ return SafeInt64ToInt32 ((INT64)Operand, Result); }
tianocore/edk2
C++
Other
4,240
/* Initialise the serial port with the given baudrate. The settings are always 8 data bits, no parity, 1 stop bit, no start bits. */
int serial_init(void)
/* Initialise the serial port with the given baudrate. The settings are always 8 data bits, no parity, 1 stop bit, no start bits. */ int serial_init(void)
{ serial_setbrg (); return (0); }
EmcraftSystems/u-boot
C++
Other
181
/* Function to preload the payload for the next ACK. */
static void gzp_preload_ack(uint8_t *src, uint8_t length, uint8_t pipe)
/* Function to preload the payload for the next ACK. */ static void gzp_preload_ack(uint8_t *src, uint8_t length, uint8_t pipe)
{ gzll_goto_idle(); gzll_tx_fifo_flush(); (void)nrf_gzll_add_packet_to_tx_fifo(pipe, src, length); gzll_rx_start(); }
labapart/polymcu
C++
null
201
/* Enables or disables the specified SPI peripheral (in I2S mode). */
void I2S_Enable(SPI_Module *SPIx, FunctionalState Cmd)
/* Enables or disables the specified SPI peripheral (in I2S mode). */ void I2S_Enable(SPI_Module *SPIx, FunctionalState Cmd)
{ assert_param(IS_SPI_2OR3_PERIPH(SPIx)); assert_param(IS_FUNCTIONAL_STATE(Cmd)); if (Cmd != DISABLE) { SPIx->I2SCFG |= I2SCFG_I2SEN_ENABLE; } else { SPIx->I2SCFG &= I2SCFG_I2SEN_DISABLE; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function disables the timestamping. When disabled timestamp is not added to tx and receive frames and timestamp generator is suspended. */
void synopGMAC_TS_disable(synopGMACdevice *gmacdev)
/* This function disables the timestamping. When disabled timestamp is not added to tx and receive frames and timestamp generator is suspended. */ void synopGMAC_TS_disable(synopGMACdevice *gmacdev)
{ synopGMACClearBits(gmacdev->MacBase, GmacTSControl, GmacTSENA); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Decode given GSA sentence by validating and splitting the source string into values. */
static ssize_t decode_gsa(struct nmea_sentence_t *dst_p, char *src_p)
/* Decode given GSA sentence by validating and splitting the source string into values. */ static ssize_t decode_gsa(struct nmea_sentence_t *dst_p, char *src_p)
{ int i; dst_p->type = nmea_sentence_type_gsa_t; dst_p->gsa.selection_p = strsep(&src_p, ","); dst_p->gsa.fix_p = strsep(&src_p, ","); for (i = 0; i < membersof(dst_p->gsa.prns); i++) { dst_p->gsa.prns[i] = strsep(&src_p, ","); } dst_p->gsa.pdop_p = strsep(&src_p, ","); dst_p->gsa.hdop_p = strsep(&src_p, ","); dst_p->gsa.vdop_p = strsep(&src_p, "*"); if (src_p == NULL) { return (-EPROTO); } return (0); }
eerimoq/simba
C++
Other
337
/* Previous comments suggested that turning off the interrupt by clearing OIER would prevent the watchdog timing out but this does not appear to be true (at least on the PXA255). */
static int sa1100dog_release(struct inode *inode, struct file *file)
/* Previous comments suggested that turning off the interrupt by clearing OIER would prevent the watchdog timing out but this does not appear to be true (at least on the PXA255). */ static int sa1100dog_release(struct inode *inode, struct file *file)
{ printk(KERN_CRIT "WATCHDOG: Device closed - timer will not stop\n"); clear_bit(1, &sa1100wdt_users); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Disables callback. Disables the callback specified by the callback_type. */
void rtc_count_disable_callback(struct rtc_module *const module, enum rtc_count_callback callback_type)
/* Disables callback. Disables the callback specified by the callback_type. */ void rtc_count_disable_callback(struct rtc_module *const module, enum rtc_count_callback callback_type)
{ Assert(module); Assert(module->hw); Rtc *const rtc_module = module->hw; if (callback_type == RTC_COUNT_CALLBACK_OVERFLOW) { rtc_module->MODE0.INTENCLR.reg = RTC_MODE0_INTFLAG_OVF; } else { rtc_module->MODE0.INTENCLR.reg = RTC_MODE1_INTFLAG_CMP(1 << callback_type); } module->enabled_callback &= ~(1 << callback_type); }
memfault/zero-to-main
C++
null
200
/* Take ownership of all the rx Descriptors. This function is called when there is fatal error in DMA transmission. When called it takes the ownership of all the rx descriptor in rx descriptor pool/queue from DMA. The function is same for both the ring mode and the chain mode DMA structures. */
void synopGMAC_take_desc_ownership_rx(synopGMACdevice *gmacdev)
/* Take ownership of all the rx Descriptors. This function is called when there is fatal error in DMA transmission. When called it takes the ownership of all the rx descriptor in rx descriptor pool/queue from DMA. The function is same for both the ring mode and the chain mode DMA structures. */ void synopGMAC_take_desc_ownership_rx(synopGMACdevice *gmacdev)
{ s32 i; DmaDesc *desc; desc = gmacdev->RxDesc; for (i = 0; i < gmacdev->RxDescCount; i++) { if (synopGMAC_is_rx_desc_chained(desc)) { synopGMAC_take_desc_ownership(desc); desc = (DmaDesc *)desc->data2; } else { synopGMAC_take_desc_ownership(desc + i); } } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Initializes the DAC peripheral according to the specified parameters in the DAC_InitStruct. */
void DAC_Init(uint32_t DAC_Channel, DAC_InitTypeDef *DAC_InitStruct)
/* Initializes the DAC peripheral according to the specified parameters in the DAC_InitStruct. */ void DAC_Init(uint32_t DAC_Channel, DAC_InitTypeDef *DAC_InitStruct)
{ uint32_t tmpreg1 = 0, tmpreg2 = 0; assert_param(IS_DAC_TRIGGER(DAC_InitStruct->DAC_Trigger)); assert_param(IS_DAC_GENERATE_WAVE(DAC_InitStruct->DAC_WaveGeneration)); assert_param(IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(DAC_InitStruct->DAC_LFSRUnmask_TriangleAmplitude)); assert_param(IS_DAC_OUTPUT_BUFFER_STATE(DAC_InitStruct->DAC_OutputBuffer)); tmpreg1 = DAC->CR; tmpreg1 &= ~(CR_CLEAR_MASK << DAC_Channel); tmpreg2 = (DAC_InitStruct->DAC_Trigger | DAC_InitStruct->DAC_WaveGeneration | DAC_InitStruct->DAC_LFSRUnmask_TriangleAmplitude | DAC_InitStruct->DAC_OutputBuffer); tmpreg1 |= tmpreg2 << DAC_Channel; DAC->CR = tmpreg1; }
gcallipo/RadioDSP-Stm32f103
C++
Common Creative - Attribution 3.0
51
/* The function will check if page table should be setup or not. */
BOOLEAN ToBuildPageTable(VOID)
/* The function will check if page table should be setup or not. */ BOOLEAN ToBuildPageTable(VOID)
{ if (!IsIa32PaeSupport ()) { return FALSE; } if (IsNullDetectionEnabled ()) { return TRUE; } if (PcdGet8 (PcdHeapGuardPropertyMask) != 0) { return TRUE; } if (PcdGetBool (PcdCpuStackGuard)) { return TRUE; } if (IsEnableNonExecNeeded ()) { return TRUE; } return FALSE; }
tianocore/edk2
C++
Other
4,240
/* Transform the provided matrix using the H.264 modified DCT. */
static void h264_dct_c(DCTELEM block[4][4])
/* Transform the provided matrix using the H.264 modified DCT. */ static void h264_dct_c(DCTELEM block[4][4])
{ DCTELEM pieces[4][4]; DCTELEM a, b, c, d; H264_DCT_PART1(0); H264_DCT_PART1(1); H264_DCT_PART1(2); H264_DCT_PART1(3); H264_DCT_PART2(0); H264_DCT_PART2(1); H264_DCT_PART2(2); H264_DCT_PART2(3); }
DC-SWAT/DreamShell
C++
null
404
/* FUSE caches dentries and attributes with separate timeout. The time in jiffies until the dentry/attributes are valid is stored in dentry->d_time and fuse_inode->i_time respectively. Calculate the time in jiffies until a dentry/attributes are valid */
static u64 time_to_jiffies(unsigned long sec, unsigned long nsec)
/* FUSE caches dentries and attributes with separate timeout. The time in jiffies until the dentry/attributes are valid is stored in dentry->d_time and fuse_inode->i_time respectively. Calculate the time in jiffies until a dentry/attributes are valid */ static u64 time_to_jiffies(unsigned long sec, unsigned long nsec)
{ if (sec || nsec) { struct timespec ts = {sec, nsec}; return get_jiffies_64() + timespec_to_jiffies(&ts); } else return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Setup and initialize Central sequencers. Initialiaze the mode independent and dependent scratch page to the default settings. */
static void asd_init_cseq_scratch(struct asd_ha_struct *asd_ha)
/* Setup and initialize Central sequencers. Initialiaze the mode independent and dependent scratch page to the default settings. */ static void asd_init_cseq_scratch(struct asd_ha_struct *asd_ha)
{ asd_init_cseq_mip(asd_ha); asd_init_cseq_mdp(asd_ha); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns pointer to the head of the SMBIOS tables (or NULL). */
static void __iomem* detect_SMBIOS_pointer(void __iomem *begin, void __iomem *end)
/* Returns pointer to the head of the SMBIOS tables (or NULL). */ static void __iomem* detect_SMBIOS_pointer(void __iomem *begin, void __iomem *end)
{ void __iomem *fp; void __iomem *endp; u8 temp1, temp2, temp3, temp4; int status = 0; endp = (end - sizeof(u32) + 1); for (fp = begin; fp <= endp; fp += 16) { temp1 = readb(fp); temp2 = readb(fp+1); temp3 = readb(fp+2); temp4 = readb(fp+3); if (temp1 == '_' && temp2 == 'S' && temp3 == 'M' && temp4 == '_') { status = 1; break; } } if (!status) fp = NULL; dbg("Discovered SMBIOS Entry point at %p\n", fp); return fp; }
robutest/uclinux
C++
GPL-2.0
60
/* lowlevel functions update the bits of the given register. return 1 if the bits changed. */
static int snd_atiixp_update_bits(struct atiixp *chip, unsigned int reg, unsigned int mask, unsigned int value)
/* lowlevel functions update the bits of the given register. return 1 if the bits changed. */ static int snd_atiixp_update_bits(struct atiixp *chip, unsigned int reg, unsigned int mask, unsigned int value)
{ void __iomem *addr = chip->remap_addr + reg; unsigned int data, old_data; old_data = data = readl(addr); data &= ~mask; data |= value; if (old_data == data) return 0; writel(data, addr); return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* This function is a standard USB function called when the USB device is disconnected. We will get rid of the URV, de-register the input device, and free up allocated memory */
static void gtco_disconnect(struct usb_interface *interface)
/* This function is a standard USB function called when the USB device is disconnected. We will get rid of the URV, de-register the input device, and free up allocated memory */ static void gtco_disconnect(struct usb_interface *interface)
{ struct gtco *gtco = usb_get_intfdata(interface); if (gtco) { input_unregister_device(gtco->inputdevice); usb_kill_urb(gtco->urbinfo); usb_free_urb(gtco->urbinfo); usb_buffer_free(gtco->usbdev, REPORT_MAX_SIZE, gtco->buffer, gtco->buf_dma); kfree(gtco); } dev_info(&interface->dev, "gtco driver disconnected\n"); }
robutest/uclinux
C++
GPL-2.0
60
/* cpuidle_unregister_device - unregisters a CPU's idle PM feature @dev: the cpu */
void cpuidle_unregister_device(struct cpuidle_device *dev)
/* cpuidle_unregister_device - unregisters a CPU's idle PM feature @dev: the cpu */ void cpuidle_unregister_device(struct cpuidle_device *dev)
{ struct sys_device *sys_dev = get_cpu_sysdev((unsigned long)dev->cpu); if (dev->registered == 0) return; cpuidle_pause_and_lock(); cpuidle_disable_device(dev); cpuidle_remove_sysfs(sys_dev); list_del(&dev->device_list); wait_for_completion(&dev->kobj_unregister); per_cpu(cpuidle_devices, dev->cpu) = NULL; cpuidle_resume_and_unlock(); module_put(cpuidle_curr_driver->owner); }
robutest/uclinux
C++
GPL-2.0
60
/* Do not allocate memory (or fail in any way) in machine_kexec(). We are past the point of no return, committed to rebooting now. */
void machine_kexec(struct kimage *image)
/* Do not allocate memory (or fail in any way) in machine_kexec(). We are past the point of no return, committed to rebooting now. */ void machine_kexec(struct kimage *image)
{ if (ppc_md.machine_kexec) ppc_md.machine_kexec(image); else default_machine_kexec(image); machine_restart(NULL); for(;;); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Unsigned division operation. Run the unsigned division operation and return the results. */
uint32_t divas_uidiv(uint32_t numerator, uint32_t denominator)
/* Unsigned division operation. Run the unsigned division operation and return the results. */ uint32_t divas_uidiv(uint32_t numerator, uint32_t denominator)
{ cpu_irq_enter_critical(); DIVAS->CTRLA.reg &= ~DIVAS_CTRLA_SIGNED; DIVAS->DIVIDEND.reg = numerator; DIVAS->DIVISOR.reg = denominator; while(DIVAS->STATUS.bit.BUSY){ } uint32_t quotient = DIVAS->RESULT.reg; cpu_irq_leave_critical(); return quotient; }
memfault/zero-to-main
C++
null
200
/* This is the priority value as seen by users in /proc. RT tasks are offset by -200. Normal tasks are centered around 0, value goes from -16 to +15. */
int task_prio(const struct task_struct *p)
/* This is the priority value as seen by users in /proc. RT tasks are offset by -200. Normal tasks are centered around 0, value goes from -16 to +15. */ int task_prio(const struct task_struct *p)
{ return p->prio - MAX_RT_PRIO; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Interrupt handler for the TRNG. Display the random value on the terminal. */
void TRNG_Handler(void)
/* Interrupt handler for the TRNG. Display the random value on the terminal. */ void TRNG_Handler(void)
{ uint32_t status; status = trng_get_interrupt_status(TRNG); if ((status & TRNG_ISR_DATRDY) == TRNG_ISR_DATRDY) { printf("-- Random Value: %lx --\n\r", trng_read_output_data(TRNG)); } }
remotemcu/remcu-chip-sdks
C++
null
436
/* Converts a text device path node to USB device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsb(IN CHAR16 *TextDeviceNode)
/* Converts a text device path node to USB device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsb(IN CHAR16 *TextDeviceNode)
{ CHAR16 *PortStr; CHAR16 *InterfaceStr; USB_DEVICE_PATH *Usb; PortStr = GetNextParamStr (&TextDeviceNode); InterfaceStr = GetNextParamStr (&TextDeviceNode); Usb = (USB_DEVICE_PATH *)CreateDeviceNode ( MESSAGING_DEVICE_PATH, MSG_USB_DP, (UINT16)sizeof (USB_DEVICE_PATH) ); Usb->ParentPortNumber = (UINT8)Strtoi (PortStr); Usb->InterfaceNumber = (UINT8)Strtoi (InterfaceStr); return (EFI_DEVICE_PATH_PROTOCOL *)Usb; }
tianocore/edk2
C++
Other
4,240
/* Read SlotInfo register from SD/MMC host controller pci config space. */
EFI_STATUS EFIAPI SdMmcHcGetSlotInfo(IN EFI_PCI_IO_PROTOCOL *PciIo, OUT UINT8 *FirstBar, OUT UINT8 *SlotNum)
/* Read SlotInfo register from SD/MMC host controller pci config space. */ EFI_STATUS EFIAPI SdMmcHcGetSlotInfo(IN EFI_PCI_IO_PROTOCOL *PciIo, OUT UINT8 *FirstBar, OUT UINT8 *SlotNum)
{ EFI_STATUS Status; SD_MMC_HC_SLOT_INFO SlotInfo; Status = PciIo->Pci.Read ( PciIo, EfiPciIoWidthUint8, SD_MMC_HC_SLOT_OFFSET, sizeof (SlotInfo), &SlotInfo ); if (EFI_ERROR (Status)) { return Status; } *FirstBar = SlotInfo.FirstBar; *SlotNum = SlotInfo.SlotNum + 1; ASSERT ((*FirstBar + *SlotNum) < SD_MMC_HC_MAX_SLOT); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Returns the next nibble in sequence, consuming a new byte on the input only if necessary. */
static uint8_t yop_get_next_nibble(YopDecContext *s)
/* Returns the next nibble in sequence, consuming a new byte on the input only if necessary. */ static uint8_t yop_get_next_nibble(YopDecContext *s)
{ int ret; if (s->low_nibble) { ret = *s->low_nibble & 0xf; s->low_nibble = NULL; }else { s->low_nibble = s->srcptr++; ret = *s->low_nibble >> 4; } return ret; }
DC-SWAT/DreamShell
C++
null
404
/* fsl_dma_update_completed_cookie - Update the completed cookie. @fsl_chan : Freescale DMA channel */
static void fsl_dma_update_completed_cookie(struct fsl_dma_chan *fsl_chan)
/* fsl_dma_update_completed_cookie - Update the completed cookie. @fsl_chan : Freescale DMA channel */ static void fsl_dma_update_completed_cookie(struct fsl_dma_chan *fsl_chan)
{ struct fsl_desc_sw *cur_desc, *desc; dma_addr_t ld_phy; ld_phy = get_cdar(fsl_chan) & FSL_DMA_NLDA_MASK; if (ld_phy) { cur_desc = NULL; list_for_each_entry(desc, &fsl_chan->ld_queue, node) if (desc->async_tx.phys == ld_phy) { cur_desc = desc; break; } if (cur_desc && cur_desc->async_tx.cookie) { if (dma_is_idle(fsl_chan)) fsl_chan->completed_cookie = cur_desc->async_tx.cookie; else fsl_chan->completed_cookie = cur_desc->async_tx.cookie - 1; } } }
robutest/uclinux
C++
GPL-2.0
60
/* Read a single byte from the serial port. Returns 1 on success, 0 otherwise. When the function is succesfull, the character read is written into its argument c. */
int serial_getc(void)
/* Read a single byte from the serial port. Returns 1 on success, 0 otherwise. When the function is succesfull, the character read is written into its argument c. */ int serial_getc(void)
{ while (IO_SYSFLG1 & SYSFLG1_URXFE); return IO_UARTDR1 & 0xff; }
EmcraftSystems/u-boot
C++
Other
181
/* Resets the Host Port of the Low Level Driver. */
USBH_StatusTypeDef USBH_LL_ResetPort(USBH_HandleTypeDef *phost)
/* Resets the Host Port of the Low Level Driver. */ USBH_StatusTypeDef USBH_LL_ResetPort(USBH_HandleTypeDef *phost)
{ HAL_HCD_ResetPort(phost->pData); return USBH_OK; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* ADC MSP Initialization This function configures the hardware resources used in this example. */
void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)
/* ADC MSP Initialization This function configures the hardware resources used in this example. */ void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(hadc->Instance==ADC1) { __HAL_RCC_ADC1_CLK_ENABLE(); __HAL_RCC_GPIOB_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_1; GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; GPIO_InitStruct.Pull = GPIO_NOPULL; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Disable polarity inversion of the selected IO pins. */
void stmpe1600_IO_PolarityInv_Disable(uint16_t DeviceAddr, uint32_t IO_Pin)
/* Disable polarity inversion of the selected IO pins. */ void stmpe1600_IO_PolarityInv_Disable(uint16_t DeviceAddr, uint32_t IO_Pin)
{ uint8_t tmpData[2] = {0 , 0}; IOE_ReadMultiple(DeviceAddr, STMPE1600_REG_GPPIR, tmpData, 2); tmp = ((uint16_t)tmpData[0] | (((uint16_t)tmpData[1]) << 8)); tmp &= ~ (uint16_t)IO_Pin; IOE_WriteMultiple(DeviceAddr, STMPE1600_REG_GPPIR, (uint8_t *)&tmp, 2); }
eclipse-threadx/getting-started
C++
Other
310
/* Draws an array of consecutive RGB565 pixels (much faster than addressing each pixel individually) */
void lcdDrawPixels(uint16_t x, uint16_t y, uint16_t *data, uint32_t len)
/* Draws an array of consecutive RGB565 pixels (much faster than addressing each pixel individually) */ void lcdDrawPixels(uint16_t x, uint16_t y, uint16_t *data, uint32_t len)
{ lcd_area(x, y, x + len, y); int i; lcd_drawstart(); for(i = 0; i < len; i++) { lcd_draw(*data); data++; } lcd_drawstop(); }
microbuilder/LPC1343CodeBase
C++
Other
73
/* RETURNS: @plba: the LBA @plen: the transfer length */
static void scsi_10_lba_len(const u8 *cdb, u64 *plba, u32 *plen)
/* RETURNS: @plba: the LBA @plen: the transfer length */ static void scsi_10_lba_len(const u8 *cdb, u64 *plba, u32 *plen)
{ u64 lba = 0; u32 len = 0; VPRINTK("ten-byte command\n"); lba |= ((u64)cdb[2]) << 24; lba |= ((u64)cdb[3]) << 16; lba |= ((u64)cdb[4]) << 8; lba |= ((u64)cdb[5]); len |= ((u32)cdb[7]) << 8; len |= ((u32)cdb[8]); *plba = lba; *plen = len; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Clean out excess bytes from the input buffer. */
static void read_excess_bytes(uint16_t size)
/* Clean out excess bytes from the input buffer. */ static void read_excess_bytes(uint16_t size)
{ if (size > 0) { uint8_t buffer[size]; edtt_read((uint8_t *)buffer, size, EDTTT_BLOCK); printk("command size wrong! (%u extra bytes removed)", size); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Increase the offset of the firmware configuration item without transferring bytes between the item and a caller-provided buffer. Subsequent read, write or skip operations will commence at the increased offset. */
VOID EFIAPI QemuFwCfgSkipBytes(IN UINTN Size)
/* Increase the offset of the firmware configuration item without transferring bytes between the item and a caller-provided buffer. Subsequent read, write or skip operations will commence at the increased offset. */ VOID EFIAPI QemuFwCfgSkipBytes(IN UINTN Size)
{ UINTN ChunkSize; UINT8 SkipBuffer[256]; if (!InternalQemuFwCfgIsAvailable ()) { return; } if (InternalQemuFwCfgDmaIsAvailable () && (Size <= MAX_UINT32)) { InternalQemuFwCfgDmaBytes ((UINT32)Size, NULL, FW_CFG_DMA_CTL_SKIP); return; } while (Size > 0) { ChunkSize = MIN (Size, sizeof SkipBuffer); IoReadFifo8 (FW_CFG_IO_DATA, ChunkSize, SkipBuffer); Size -= ChunkSize; } }
tianocore/edk2
C++
Other
4,240
/* Thread (LED_Thread2) used to toggle a LED when getting the appropriate signal. */
static void LED_Thread2(void const *argument)
/* Thread (LED_Thread2) used to toggle a LED when getting the appropriate signal. */ static void LED_Thread2(void const *argument)
{ (void) argument; osEvent event; for(;;) { event = osSignalWait( BIT_1 | BIT_2, osWaitForever); if(event.value.signals == (BIT_1 | BIT_2)) { BSP_LED_Toggle(LED2); } } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Searches the main proc list for an "expecting" entry whose connection handle and op code match those specified. If a matching entry is found, it is removed from the list and returned. */
static struct ble_l2cap_sig_proc* ble_l2cap_sig_proc_extract(uint16_t conn_handle, uint8_t op, uint8_t identifier)
/* Searches the main proc list for an "expecting" entry whose connection handle and op code match those specified. If a matching entry is found, it is removed from the list and returned. */ static struct ble_l2cap_sig_proc* ble_l2cap_sig_proc_extract(uint16_t conn_handle, uint8_t op, uint8_t identifier)
{ struct ble_l2cap_sig_proc *proc; struct ble_l2cap_sig_proc *prev; ble_hs_lock(); prev = NULL; STAILQ_FOREACH(proc, &ble_l2cap_sig_procs, next) { if (ble_l2cap_sig_proc_matches(proc, conn_handle, op, identifier)) { if (prev == NULL) { STAILQ_REMOVE_HEAD(&ble_l2cap_sig_procs, next); } else { STAILQ_REMOVE_AFTER(&ble_l2cap_sig_procs, prev, next); } break; } prev = proc; } ble_hs_unlock(); return proc; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Enables or disables the temperature sensor and Vrefint channel. */
void ADC_TempSensorCmd(FunctionalState NewState)
/* Enables or disables the temperature sensor and Vrefint channel. */ void ADC_TempSensorCmd(FunctionalState NewState)
{ assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { ADC1->ADCFG|=ADCFG_TSEN_Set; ADC1->ADCHS |= ADCHS_TSVREFE_Set ; } else { ADC1->ADCFG&=~ADCFG_TSEN_Set; ADC1->ADCHS &= ADCHS_TSVREFE_Reset; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* fills the memblock of <size> bytes from <startaddr> with "random" pattern */
void RAM_MemTest_WriteRandomPattern(unsigned long startaddr, unsigned long size, unsigned long *pat)
/* fills the memblock of <size> bytes from <startaddr> with "random" pattern */ void RAM_MemTest_WriteRandomPattern(unsigned long startaddr, unsigned long size, unsigned long *pat)
{ unsigned long i, p; p = *pat; for (i = 0; i < (size / 4); i++) { *(unsigned long *) (startaddr + i * 4) = p; if ((p % 2) > 0) { p ^= i; p >>= 1; p |= 0x80000000; } else { p ^= ~i; p >>= 1; } } *pat = p; }
EmcraftSystems/u-boot
C++
Other
181
/* Sends a Sync Packet. Sends a sync packet. This can be useful for external software should it become out of sync with the ITM stream. */
void am_hal_itm_sync_send(void)
/* Sends a Sync Packet. Sends a sync packet. This can be useful for external software should it become out of sync with the ITM stream. */ void am_hal_itm_sync_send(void)
{ am_hal_itm_stimulus_reg_word_write(AM_HAL_ITM_SYNC_REG, AM_HAL_ITM_SYNC_VAL); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* N.B. We get the timeout wrong here, but then we always did get it wrong before and this is another step along the road to correcting it. It ought to get updated each time we pass through the routine, but in practise it probably doesn't matter too much for now. */
static struct sk_buff* dn_alloc_send_pskb(struct sock *sk, unsigned long datalen, int noblock, int *errcode)
/* N.B. We get the timeout wrong here, but then we always did get it wrong before and this is another step along the road to correcting it. It ought to get updated each time we pass through the routine, but in practise it probably doesn't matter too much for now. */ static struct sk_buff* dn_alloc_send_pskb(struct sock *sk, unsigned long datalen, int noblock, int *errcode)
{ struct sk_buff *skb = sock_alloc_send_skb(sk, datalen, noblock, errcode); if (skb) { skb->protocol = htons(ETH_P_DNA_RT); skb->pkt_type = PACKET_OUTGOING; } return skb; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function gets controller name from Component Name 2 protocol interface and Component Name protocol interface in turn. It first tries UEFI 2.0 Component Name 2 protocol interface and try to get the controller name. If the attempt fails, it then gets the controller name from EFI 1.1 Component Name protocol for backward compatibility support. */
CHAR16* DriverHealthManagerGetControllerName(IN EFI_HANDLE DriverBindingHandle, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ChildHandle)
/* This function gets controller name from Component Name 2 protocol interface and Component Name protocol interface in turn. It first tries UEFI 2.0 Component Name 2 protocol interface and try to get the controller name. If the attempt fails, it then gets the controller name from EFI 1.1 Component Name protocol for backward compatibility support. */ CHAR16* DriverHealthManagerGetControllerName(IN EFI_HANDLE DriverBindingHandle, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ChildHandle)
{ EFI_STATUS Status; CHAR16 *ControllerName; Status = DriverHealthManagerGetControllerNameWorker ( &gEfiComponentName2ProtocolGuid, DriverBindingHandle, ControllerHandle, ChildHandle, &ControllerName ); if (EFI_ERROR (Status)) { Status = DriverHealthManagerGetControllerNameWorker ( &gEfiComponentNameProtocolGuid, DriverBindingHandle, ControllerHandle, ChildHandle, &ControllerName ); } if (!EFI_ERROR (Status)) { return AllocateCopyPool (StrSize (ControllerName), ControllerName); } else { return ConvertDevicePathToText (DevicePathFromHandle (ChildHandle != NULL ? ChildHandle : ControllerHandle), FALSE, TRUE); } }
tianocore/edk2
C++
Other
4,240
/* Enable Slave resume interrupt @rmtoll IER SRIE LL_SWPMI_EnableIT_SR. */
void LL_SWPMI_EnableIT_SR(SWPMI_TypeDef *SWPMIx)
/* Enable Slave resume interrupt @rmtoll IER SRIE LL_SWPMI_EnableIT_SR. */ void LL_SWPMI_EnableIT_SR(SWPMI_TypeDef *SWPMIx)
{ SET_BIT(SWPMIx->IER, SWPMI_IER_SRIE); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Renders a single AA4 character on the screen. This text rendering method used a lookup table of pre-calculated colors, and doesn't require any reads from the LCD (not all displays support reading pixels back). This offers the best performance and high-quality text, but can only be used on solid backgrounds where the bgcolor is known. */
void aafontsDrawCharAA4(uint16_t x, uint16_t y, uint16_t height, aafontsCharInfo_t character, const uint16_t *colorTable)
/* Renders a single AA4 character on the screen. This text rendering method used a lookup table of pre-calculated colors, and doesn't require any reads from the LCD (not all displays support reading pixels back). This offers the best performance and high-quality text, but can only be used on solid backgrounds where the bgcolor is known. */ void aafontsDrawCharAA4(uint16_t x, uint16_t y, uint16_t height, aafontsCharInfo_t character, const uint16_t *colorTable)
{ uint16_t w, h; uint8_t color; for (h = 0; h < height; h++) { for (w = 0; w < character.width; w++) { color = character.charData[h*character.bytesPerRow + w/2]; if (!(w % 2)) color = (color >> 4); if (color) lcdDrawPixel(x+w, y+h, colorTable[color & 0xF]); } } }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Enables or disables the discontinuous mode for injected group channel for the specified ADC. */
void ADC_EnableInjectedDiscMode(ADC_Module *ADCx, FunctionalState Cmd)
/* Enables or disables the discontinuous mode for injected group channel for the specified ADC. */ void ADC_EnableInjectedDiscMode(ADC_Module *ADCx, FunctionalState Cmd)
{ assert_param(IsAdcModule(ADCx)); assert_param(IS_FUNCTIONAL_STATE(Cmd)); if (Cmd != DISABLE) { ADCx->CTRL1 |= CTRL1_INJ_DISC_EN_SET; } else { ADCx->CTRL1 &= CTRL1_INJ_DISC_EN_RESET; } }
pikasTech/PikaPython
C++
MIT License
1,403
/* set the list of available values for the given parameter */
static int val_compar(const void *ap, const void *bp)
/* set the list of available values for the given parameter */ static int val_compar(const void *ap, const void *bp)
{ return *(const unsigned int *)ap - *(const unsigned int *)bp; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Convert 'nvar', a compiler index level, to its corresponding register. For that, search for the highest variable below that level that is in a register and uses its register index ('ridx') plus one. */
static int reglevel(FuncState *fs, int nvar)
/* Convert 'nvar', a compiler index level, to its corresponding register. For that, search for the highest variable below that level that is in a register and uses its register index ('ridx') plus one. */ static int reglevel(FuncState *fs, int nvar)
{ Vardesc *vd = getlocalvardesc(fs, nvar); if (vd->vd.kind != RDKCTC) return vd->vd.ridx + 1; } return 0; }
Nicholas3388/LuaNode
C++
Other
1,055
/* This is the entry point for the bootloader application and is called by the reset interrupt vector after the C-startup routines executed. */
void main(void)
/* This is the entry point for the bootloader application and is called by the reset interrupt vector after the C-startup routines executed. */ void main(void)
{ Init(); BootComInit(); while (1) { LedToggle(); BootComCheckActivationRequest(); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* This routine is the lock free version of the API invoked to release a completion-queue event back into the free pool. */
void __lpfc_sli4_cq_event_release(struct lpfc_hba *phba, struct lpfc_cq_event *cq_event)
/* This routine is the lock free version of the API invoked to release a completion-queue event back into the free pool. */ void __lpfc_sli4_cq_event_release(struct lpfc_hba *phba, struct lpfc_cq_event *cq_event)
{ list_add_tail(&cq_event->list, &phba->sli4_hba.sp_cqe_event_pool); }
robutest/uclinux
C++
GPL-2.0
60
/* @event_type: path event type enum @ti: pointer to a dm_target @path: string containing pathname @nr_valid_paths: number of valid paths remaining */
void dm_path_uevent(enum dm_uevent_type event_type, struct dm_target *ti, const char *path, unsigned nr_valid_paths)
/* @event_type: path event type enum @ti: pointer to a dm_target @path: string containing pathname @nr_valid_paths: number of valid paths remaining */ void dm_path_uevent(enum dm_uevent_type event_type, struct dm_target *ti, const char *path, unsigned nr_valid_paths)
{ struct mapped_device *md = dm_table_get_md(ti->table); struct dm_uevent *event; if (event_type >= ARRAY_SIZE(_dm_uevent_type_names)) { DMERR("%s: Invalid event_type %d", __func__, event_type); goto out; } event = dm_build_path_uevent(md, ti, _dm_uevent_type_names[event_type].action, _dm_uevent_type_names[event_type].name, path, nr_valid_paths); if (IS_ERR(event)) goto out; dm_uevent_add(md, &event->elist); out: dm_put(md); }
robutest/uclinux
C++
GPL-2.0
60
/* Allocate and store an event in the event queue. */
static struct net_buf* queue_event(struct net_buf *buf)
/* Allocate and store an event in the event queue. */ static struct net_buf* queue_event(struct net_buf *buf)
{ struct net_buf *evt; evt = net_buf_alloc(&event_pool, K_NO_WAIT); if (evt) { bt_buf_set_type(evt, BT_BUF_EVT); net_buf_add_le32(evt, sys_cpu_to_le32(k_uptime_get())); net_buf_add_mem(evt, buf->data, buf->len); net_buf_put(&event_queue, evt); m_events++; } return evt; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* while (1) { buflen = sizeof(buffer); type = rds_message_next_extension(hdr, &pos, buffer, &buflen); if (type == RDS_EXTHDR_NONE) break; ... } */
int rds_message_next_extension(struct rds_header *hdr, unsigned int *pos, void *buf, unsigned int *buflen)
/* while (1) { buflen = sizeof(buffer); type = rds_message_next_extension(hdr, &pos, buffer, &buflen); if (type == RDS_EXTHDR_NONE) break; ... } */ int rds_message_next_extension(struct rds_header *hdr, unsigned int *pos, void *buf, unsigned int *buflen)
{ unsigned int offset, ext_type, ext_len; u8 *src = hdr->h_exthdr; offset = *pos; if (offset >= RDS_HEADER_EXT_SPACE) goto none; ext_type = src[offset++]; if (ext_type == RDS_EXTHDR_NONE || ext_type >= __RDS_EXTHDR_MAX) goto none; ext_len = rds_exthdr_size[ext_type]; if (offset + ext_len > RDS_HEADER_EXT_SPACE) goto none; *pos = offset + ext_len; if (ext_len < *buflen) *buflen = ext_len; memcpy(buf, src + offset, *buflen); return ext_type; none: *pos = RDS_HEADER_EXT_SPACE; *buflen = 0; return RDS_EXTHDR_NONE; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns: a newly-allocated string containing all of the strings joined together, with @separator between them */
gchar* g_strjoinv(const gchar *separator, gchar **str_array)
/* Returns: a newly-allocated string containing all of the strings joined together, with @separator between them */ gchar* g_strjoinv(const gchar *separator, gchar **str_array)
{ gchar *string; gchar *ptr; g_return_val_if_fail (str_array != NULL, NULL); if (separator == NULL) separator = ""; if (*str_array) { gint i; gsize len; gsize separator_len; separator_len = strlen (separator); len = 1 + strlen (str_array[0]); for (i = 1; str_array[i] != NULL; i++) len += strlen (str_array[i]); len += separator_len * (i - 1); string = g_new (gchar, len); ptr = g_stpcpy (string, *str_array); for (i = 1; str_array[i] != NULL; i++) { ptr = g_stpcpy (ptr, separator); ptr = g_stpcpy (ptr, str_array[i]); } } else string = g_strdup (""); return string; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Return codes 0 - successful other values - error */
static int lpfc_sli_enable_msi(struct lpfc_hba *phba)
/* Return codes 0 - successful other values - error */ static int lpfc_sli_enable_msi(struct lpfc_hba *phba)
{ int rc; rc = pci_enable_msi(phba->pcidev); if (!rc) lpfc_printf_log(phba, KERN_INFO, LOG_INIT, "0462 PCI enable MSI mode success.\n"); else { lpfc_printf_log(phba, KERN_INFO, LOG_INIT, "0471 PCI enable MSI mode failed (%d)\n", rc); return rc; } rc = request_irq(phba->pcidev->irq, lpfc_sli_intr_handler, IRQF_SHARED, LPFC_DRIVER_NAME, phba); if (rc) { pci_disable_msi(phba->pcidev); lpfc_printf_log(phba, KERN_WARNING, LOG_INIT, "0478 MSI request_irq failed (%d)\n", rc); } return rc; }
robutest/uclinux
C++
GPL-2.0
60
/* Also account for superblock, inode, quota and xattr blocks */
int ext4_meta_trans_blocks(struct inode *inode, int nrblocks, int chunk)
/* Also account for superblock, inode, quota and xattr blocks */ int ext4_meta_trans_blocks(struct inode *inode, int nrblocks, int chunk)
{ ext4_group_t groups, ngroups = ext4_get_groups_count(inode->i_sb); int gdpblocks; int idxblocks; int ret = 0; idxblocks = ext4_index_trans_blocks(inode, nrblocks, chunk); ret = idxblocks; groups = idxblocks; if (chunk) groups += 1; else groups += nrblocks; gdpblocks = groups; if (groups > ngroups) groups = ngroups; if (groups > EXT4_SB(inode->i_sb)->s_gdb_count) gdpblocks = EXT4_SB(inode->i_sb)->s_gdb_count; ret += groups + gdpblocks; ret += EXT4_META_TRANS_BLOCKS(inode->i_sb); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* param base LPUART peripheral base address. param handle LPUART handle pointer. param count Receive bytes count. retval kStatus_NoTransferInProgress No receive in progress. retval kStatus_InvalidArgument Parameter is invalid. retval kStatus_Success Get successfully through the parameter */
status_t LPUART_TransferGetReceiveCountEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle, uint32_t *count)
/* param base LPUART peripheral base address. param handle LPUART handle pointer. param count Receive bytes count. retval kStatus_NoTransferInProgress No receive in progress. retval kStatus_InvalidArgument Parameter is invalid. retval kStatus_Success Get successfully through the parameter */ status_t LPUART_TransferGetReceiveCountEDMA(LPUART_Type *base, lpuart_edma_handle_t *handle, uint32_t *count)
{ assert(handle); assert(handle->rxEdmaHandle); assert(count); if (kLPUART_RxIdle == handle->rxState) { return kStatus_NoTransferInProgress; } *count = handle->rxDataSizeAll - (uint32_t)handle->nbytes * EDMA_GetRemainingMajorLoopCount(handle->rxEdmaHandle->base, handle->rxEdmaHandle->channel); return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Create master emulated EEPROM management page. Creates a new master page in emulated EEPROM, giving information on the emulator used to store the EEPROM data. */
static void _eeprom_emulator_create_master_page(void)
/* Create master emulated EEPROM management page. Creates a new master page in emulated EEPROM, giving information on the emulator used to store the EEPROM data. */ static void _eeprom_emulator_create_master_page(void)
{ const uint32_t magic_key[] = EEPROM_MAGIC_KEY; struct _eeprom_master_page master_page; memset(&master_page, 0xFF, sizeof(master_page)); for (uint8_t c = 0; c < EEPROM_MAGIC_KEY_COUNT; c++) { master_page.magic_key[c] = magic_key[c]; } master_page.emulator_id = EEPROM_EMULATOR_ID; master_page.major_version = EEPROM_MAJOR_VERSION; master_page.minor_version = EEPROM_MINOR_VERSION; master_page.revision = EEPROM_REVISION; _eeprom_emulator_nvm_erase_row( EEPROM_MASTER_PAGE_NUMBER / NVMCTRL_ROW_PAGES); _eeprom_emulator_nvm_fill_cache(EEPROM_MASTER_PAGE_NUMBER, &master_page); _eeprom_emulator_nvm_commit_cache(EEPROM_MASTER_PAGE_NUMBER); }
memfault/zero-to-main
C++
null
200
/* Returns a fully allocated command with sense buffer and protection data buffer (where applicable) or NULL on failure */
static struct scsi_cmnd* scsi_host_alloc_command(struct Scsi_Host *shost, gfp_t gfp_mask)
/* Returns a fully allocated command with sense buffer and protection data buffer (where applicable) or NULL on failure */ static struct scsi_cmnd* scsi_host_alloc_command(struct Scsi_Host *shost, gfp_t gfp_mask)
{ struct scsi_cmnd *cmd; cmd = scsi_pool_alloc_command(shost->cmd_pool, gfp_mask); if (!cmd) return NULL; if (scsi_host_get_prot(shost) >= SHOST_DIX_TYPE0_PROTECTION) { cmd->prot_sdb = kmem_cache_zalloc(scsi_sdb_cache, gfp_mask); if (!cmd->prot_sdb) { scsi_pool_free_command(shost->cmd_pool, cmd); return NULL; } } return cmd; }
robutest/uclinux
C++
GPL-2.0
60
/* Start in offline state - awaiting MS to send start. */
static void bfa_fcs_port_fdmi_sm_offline(struct bfa_fcs_port_fdmi_s *fdmi, enum port_fdmi_event event)
/* Start in offline state - awaiting MS to send start. */ static void bfa_fcs_port_fdmi_sm_offline(struct bfa_fcs_port_fdmi_s *fdmi, enum port_fdmi_event event)
{ struct bfa_fcs_port_s *port = fdmi->ms->port; bfa_trc(port->fcs, port->port_cfg.pwwn); bfa_trc(port->fcs, event); fdmi->retry_cnt = 0; switch (event) { case FDMISM_EVENT_PORT_ONLINE: if (port->vport) { bfa_sm_set_state(fdmi, bfa_fcs_port_fdmi_sm_sending_rprt); bfa_fcs_port_fdmi_send_rprt(fdmi, NULL); } else { bfa_sm_set_state(fdmi, bfa_fcs_port_fdmi_sm_sending_rhba); bfa_fcs_port_fdmi_send_rhba(fdmi, NULL); } break; case FDMISM_EVENT_PORT_OFFLINE: break; default: bfa_assert(0); } }
robutest/uclinux
C++
GPL-2.0
60
/* ic3_stop_rx - stop the receiver @port: Port to operate on */
static void ic3_stop_rx(struct uart_port *the_port)
/* ic3_stop_rx - stop the receiver @port: Port to operate on */ static void ic3_stop_rx(struct uart_port *the_port)
{ struct ioc3_port *port = get_ioc3_port(the_port); if (port) port->ip_flags &= ~INPUT_ENABLE; }
robutest/uclinux
C++
GPL-2.0
60
/* @pc: program counter (use NULL to suppress offset output) */
void efi_print_image_infos(void *pc)
/* @pc: program counter (use NULL to suppress offset output) */ void efi_print_image_infos(void *pc)
{ struct efi_object *efiobj; struct efi_handler *handler; list_for_each_entry(efiobj, &efi_obj_list, link) { list_for_each_entry(handler, &efiobj->protocols, link) { if (!guidcmp(handler->guid, &efi_guid_loaded_image)) { efi_print_image_info( (struct efi_loaded_image_obj *)efiobj, handler->protocol_interface, pc); } } } }
4ms/stm32mp1-baremetal
C++
Other
137
/* The rest of the time, it simply returns the ATA status register. */
static u8 mv_sff_check_status(struct ata_port *ap)
/* The rest of the time, it simply returns the ATA status register. */ static u8 mv_sff_check_status(struct ata_port *ap)
{ u8 stat = ioread8(ap->ioaddr.status_addr); struct mv_port_priv *pp = ap->private_data; if (pp->pp_flags & MV_PP_FLAG_FAKE_ATA_BUSY) { if (stat & (ATA_BUSY | ATA_DRQ | ATA_ERR)) pp->pp_flags &= ~MV_PP_FLAG_FAKE_ATA_BUSY; else stat = ATA_BUSY; } return stat; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Starts the watchdog timer. Enables the watchdog timer tick using the 'enable' bit in the watchdog configuration register. This function does not perform any locking of the watchdog timer, so it can be disabled or reconfigured later. */
void am_hal_wdt_start(void)
/* Starts the watchdog timer. Enables the watchdog timer tick using the 'enable' bit in the watchdog configuration register. This function does not perform any locking of the watchdog timer, so it can be disabled or reconfigured later. */ void am_hal_wdt_start(void)
{ AM_REGn(WDT, 0, CFG) |= AM_REG_WDT_CFG_WDTEN_M; AM_REGn(WDT, 0, RSTRT) |= AM_REG_WDT_RSTRT_RSTRT_KEYVALUE; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Message: DisplayPromptStatusV2Message Opcode: 0x0145 Type: CallControl Direction: pbx2dev VarLength: yes */
static void handle_DisplayPromptStatusV2Message(ptvcursor_t *cursor, packet_info *pinfo _U_)
/* Message: DisplayPromptStatusV2Message Opcode: 0x0145 Type: CallControl Direction: pbx2dev VarLength: yes */ static void handle_DisplayPromptStatusV2Message(ptvcursor_t *cursor, packet_info *pinfo _U_)
{ ptvcursor_add(cursor, hf_skinny_timeOutValue, 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); dissect_skinny_displayLabel(cursor, hf_skinny_promptStatus, 0); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function returns true if the radio button is the one currently selected within its radio button group. */
bool wtk_radio_button_is_selected(struct wtk_radio_button const *radio_button)
/* This function returns true if the radio button is the one currently selected within its radio button group. */ bool wtk_radio_button_is_selected(struct wtk_radio_button const *radio_button)
{ Assert(radio_button); return (radio_button->group->selected == radio_button); }
memfault/zero-to-main
C++
null
200