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
/* Send a master data receive request when the master have obtained control of the bus.(Write Step2) For this function returns immediately, it is always using in the interrupt hander. */
void I2CMasterReadRequestS2(unsigned long ulBase, xtBoolean bEndTransmition)
/* Send a master data receive request when the master have obtained control of the bus.(Write Step2) For this function returns immediately, it is always using in the interrupt hander. */ void I2CMasterReadRequestS2(unsigned long ulBase, xtBoolean bEndTransmition)
{ unsigned long ulStatus; xASSERT((ulBase == I2C1_BASE) || (ulBase == I2C2_BASE)); if(bEndTransmition) { do { ulStatus = I2CStatusGet(ulBase); if(xHWREG(ulBase + I2C_SR1) & 0x0F00) { return; } } while(!(ulStatus == I2C_EVENT_MASTER_BYTE_RECEIVED)); I2CStopSend(ulBase); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Initialize LVD config structure. Fill each pstcLvdInit with default value. */
int32_t PWC_LVD_StructInit(stc_pwc_lvd_init_t *pstcLvdInit)
/* Initialize LVD config structure. Fill each pstcLvdInit with default value. */ int32_t PWC_LVD_StructInit(stc_pwc_lvd_init_t *pstcLvdInit)
{ int32_t i32Ret = LL_OK; if (NULL == pstcLvdInit) { i32Ret = LL_ERR_INVD_PARAM; } else { pstcLvdInit->u32State = PWC_LVD_OFF; pstcLvdInit->u32CompareOutputState = PWC_LVD_CMP_OFF; pstcLvdInit->u32ExceptionType = PWC_LVD_EXP_TYPE_NONE; pstcLvdInit->u32Filter = PWC_LVD_FILTER_OFF; pstcLvdInit->u32FilterClock = PWC_LVD_FILTER_LRC_MUL2; pstcLvdInit->u32ThresholdVoltage = PWC_LVD_THRESHOLD_LVL0; } return i32Ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* __vxge_hw_vp_terminate - Terminate Virtual Path structure This routine closes all channels it opened and freeup memory */
void __vxge_hw_vp_terminate(struct __vxge_hw_device *hldev, u32 vp_id)
/* __vxge_hw_vp_terminate - Terminate Virtual Path structure This routine closes all channels it opened and freeup memory */ void __vxge_hw_vp_terminate(struct __vxge_hw_device *hldev, u32 vp_id)
{ struct __vxge_hw_virtualpath *vpath; vpath = &hldev->virtual_paths[vp_id]; if (vpath->vp_open == VXGE_HW_VP_NOT_OPEN) goto exit; VXGE_HW_DEVICE_TIM_INT_MASK_RESET(vpath->hldev->tim_int_mask0, vpath->hldev->tim_int_mask1, vpath->vp_id); hldev->stats.hw_dev_info_stats.vpath_info[vpath->vp_id] = NULL; memset(vpath, 0, sizeof(struct __vxge_hw_virtualpath)); exit: return; }
robutest/uclinux
C++
GPL-2.0
60
/* Checks whether the specified SPI/I2S interrupt has occurred or not. */
uint8_t SPI_I2S_ReadIntFlag(SPI_T *spi, SPI_I2S_INT_T flag)
/* Checks whether the specified SPI/I2S interrupt has occurred or not. */ uint8_t SPI_I2S_ReadIntFlag(SPI_T *spi, SPI_I2S_INT_T flag)
{ uint32_t intEnable; uint32_t intStatus; intEnable = (uint32_t)(spi->CTRL2 & (flag>>8)); intStatus = (uint32_t)(spi->STS & flag); if (intEnable && intStatus) { return SET; } return RESET; }
pikasTech/PikaPython
C++
MIT License
1,403
/* llist_move_tail - delete from one llist and add as another's tail @llist: the entry to move @head: the head that will follow our entry */
void llist_move_tail(llist_head *llist, llist_head *head)
/* llist_move_tail - delete from one llist and add as another's tail @llist: the entry to move @head: the head that will follow our entry */ void llist_move_tail(llist_head *llist, llist_head *head)
{ __llist_del(llist->prev, llist->next); llist_add_tail(llist, head); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Checks @sample against @expires to see if any field of @sample has expired. Returns true if any field of the former is greater than the corresponding field of the latter if the latter field is set. Otherwise returns false. */
static int task_cputime_expired(const struct task_cputime *sample, const struct task_cputime *expires)
/* Checks @sample against @expires to see if any field of @sample has expired. Returns true if any field of the former is greater than the corresponding field of the latter if the latter field is set. Otherwise returns false. */ static int task_cputime_expired(const struct task_cputime *sample, const struct task_cputime *expires)
{ if (!cputime_eq(expires->utime, cputime_zero) && cputime_ge(sample->utime, expires->utime)) return 1; if (!cputime_eq(expires->stime, cputime_zero) && cputime_ge(cputime_add(sample->utime, sample->stime), expires->stime)) return 1; if (expires->sum_exec_runtime != 0 && sample->sum_exec_runtime >= expires->sum_exec_runtime) return 1; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* disable EXTI interrupt for specific line specified by parameter encoded with MCHP_XEC_ECIA macro. */
int mchp_xec_ecia_info_disable(int ecia_info)
/* disable EXTI interrupt for specific line specified by parameter encoded with MCHP_XEC_ECIA macro. */ int mchp_xec_ecia_info_disable(int ecia_info)
{ uint8_t girq = (uint8_t)MCHP_XEC_ECIA_GIRQ(ecia_info); uint8_t src = (uint8_t)MCHP_XEC_ECIA_GIRQ_POS(ecia_info); return mchp_xec_ecia_disable(girq, src); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* function to write the bypass register which requires a poll of the busy bit */
static void cm_write_bypass(u32 val)
/* function to write the bypass register which requires a poll of the busy bit */ static void cm_write_bypass(u32 val)
{ writel(val, &clock_manager_base->bypass); cm_wait_for_fsm(); }
4ms/stm32mp1-baremetal
C++
Other
137
/* If mRandomInput is TRUE, the routine directly calls rand(). Otherwise, the routine returns the pre-generated numbers. */
UINTN Rand(VOID)
/* If mRandomInput is TRUE, the routine directly calls rand(). Otherwise, the routine returns the pre-generated numbers. */ UINTN Rand(VOID)
{ if (mRandomInput) { return rand (); } else { return mNumbers[mNumberIndex++ % (mNumberCount - 1)]; } }
tianocore/edk2
C++
Other
4,240
/* Return the value of a field in the internal directory structure. */
int TIFFGetField(TIFF *tif, uint32 tag,...)
/* Return the value of a field in the internal directory structure. */ int TIFFGetField(TIFF *tif, uint32 tag,...)
{ int status; va_list ap; va_start(ap, tag); status = TIFFVGetField(tif, tag, ap); va_end(ap); return (status); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This function checks and requests an I/O region, reporting an error if there is a conflict. */
static int pc236_request_region(unsigned minor, unsigned long from, unsigned long extent)
/* This function checks and requests an I/O region, reporting an error if there is a conflict. */ static int pc236_request_region(unsigned minor, unsigned long from, unsigned long extent)
{ if (!from || !request_region(from, extent, PC236_DRIVER_NAME)) { printk(KERN_ERR "comedi%d: I/O port conflict (%#lx,%lu)!\n", minor, from, extent); return -EIO; } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Allocates the number of 4KB pages of a certain memory type and returns a pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
VOID* InternalAllocatePages(IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages)
/* Allocates the number of 4KB pages of a certain memory type and returns a pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */ VOID* InternalAllocatePages(IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages)
{ EFI_STATUS Status; EFI_PHYSICAL_ADDRESS Memory; if (Pages == 0) { return NULL; } Status = CoreAllocatePages (AllocateAnyPages, MemoryType, Pages, &Memory); if (EFI_ERROR (Status)) { return NULL; } return (VOID *)(UINTN)Memory; }
tianocore/edk2
C++
Other
4,240
/* Get the correct pointers for the config_item and the attribute we're dealing with, then call the store() method for the attribute, passing the buffer that we acquired in fill_write_buffer(). */
static int flush_write_buffer(struct dentry *dentry, struct configfs_buffer *buffer, size_t count)
/* Get the correct pointers for the config_item and the attribute we're dealing with, then call the store() method for the attribute, passing the buffer that we acquired in fill_write_buffer(). */ static int flush_write_buffer(struct dentry *dentry, struct configfs_buffer *buffer, size_t count)
{ struct configfs_attribute * attr = to_attr(dentry); struct config_item * item = to_item(dentry->d_parent); struct configfs_item_operations * ops = buffer->ops; return ops->store_attribute(item,attr,buffer->page,count); }
robutest/uclinux
C++
GPL-2.0
60
/* Perform an asynchronous OSD operation. copied from exofs; move to libosd? */
static int osd_async_op(struct osd_request *or, osd_req_done_fn *async_done, void *caller_context, u8 *cred)
/* Perform an asynchronous OSD operation. copied from exofs; move to libosd? */ static int osd_async_op(struct osd_request *or, osd_req_done_fn *async_done, void *caller_context, u8 *cred)
{ int ret; ret = osd_finalize_request(or, 0, cred, NULL); if (ret) return ret; ret = osd_execute_request_async(or, async_done, caller_context); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Get the UART instance from peripheral base address. */
uint32_t UART_GetInstance(UART_Type *base)
/* Get the UART instance from peripheral base address. */ uint32_t UART_GetInstance(UART_Type *base)
{ uint32_t instance; uint32_t uartArrayCount = (sizeof(s_uartBases) / sizeof(s_uartBases[0])); for (instance = 0; instance < uartArrayCount; instance++) { if (s_uartBases[instance] == base) { break; } } assert(instance < uartArrayCount); return instance; }
labapart/polymcu
C++
null
201
/* Get the target bus width to be set on the bus. */
UINT8 EmmcGetTargetBusWidth(IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 SlotIndex, IN EMMC_EXT_CSD *ExtCsd, IN SD_MMC_BUS_MODE BusTiming)
/* Get the target bus width to be set on the bus. */ UINT8 EmmcGetTargetBusWidth(IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 SlotIndex, IN EMMC_EXT_CSD *ExtCsd, IN SD_MMC_BUS_MODE BusTiming)
{ UINT8 BusWidth; UINT8 PreferredBusWidth; PreferredBusWidth = Private->Slot[SlotIndex].OperatingParameters.BusWidth; if ((PreferredBusWidth != EDKII_SD_MMC_BUS_WIDTH_IGNORE) && EmmcIsBusWidthSupported (Private, SlotIndex, BusTiming, PreferredBusWidth)) { BusWidth = PreferredBusWidth; } else if (EmmcIsBusWidthSupported (Private, SlotIndex, BusTiming, 8)) { BusWidth = 8; } else if (EmmcIsBusWidthSupported (Private, SlotIndex, BusTiming, 4)) { BusWidth = 4; } else { BusWidth = 1; } return BusWidth; }
tianocore/edk2
C++
Other
4,240
/* Sets the data rate for the ADXL345 (controls power consumption) */
err_t adxl345SetDataRate(adxl345_dataRate_t dataRate)
/* Sets the data rate for the ADXL345 (controls power consumption) */ err_t adxl345SetDataRate(adxl345_dataRate_t dataRate)
{ ASSERT_STATUS(adxl345Write8(ADXL345_REG_BW_RATE, dataRate)); return ERROR_NONE; }
microbuilder/LPC11U_LPC13U_CodeBase
C++
Other
54
/* Any task being executed by the AP will be aborted and the AP will be waiting for a new task in Wait-For-SIPI state. */
VOID ResetProcessorToIdleState(IN UINTN ProcessorNumber)
/* Any task being executed by the AP will be aborted and the AP will be waiting for a new task in Wait-For-SIPI state. */ VOID ResetProcessorToIdleState(IN UINTN ProcessorNumber)
{ CPU_MP_DATA *CpuMpData; CpuMpData = GetCpuMpData (); CpuMpData->InitFlag = ApInitReconfig; WakeUpAP (CpuMpData, FALSE, ProcessorNumber, NULL, NULL, TRUE); while (CpuMpData->FinishedCount < 1) { CpuPause (); } CpuMpData->InitFlag = ApInitDone; SetApState (&CpuMpData->CpuData[ProcessorNumber], CpuStateIdle); }
tianocore/edk2
C++
Other
4,240
/* This function sets the status callback function, the status handler, which the driver calls when it encounters conditions that should be reported to the higher layer software. The handler executes in an interrupt context, so the amount of processing should be minimized. Refer to the xiicps.h file for a list of the Callback events. The events are defined to start with XIICPS_EVENT_*. */
void XIicPs_SetStatusHandler(XIicPs *InstancePtr, void *CallBackRef, XIicPs_IntrHandler FunctionPtr)
/* This function sets the status callback function, the status handler, which the driver calls when it encounters conditions that should be reported to the higher layer software. The handler executes in an interrupt context, so the amount of processing should be minimized. Refer to the xiicps.h file for a list of the Callback events. The events are defined to start with XIICPS_EVENT_*. */ void XIicPs_SetStatusHandler(XIicPs *InstancePtr, void *CallBackRef, XIicPs_IntrHandler FunctionPtr)
{ Xil_AssertVoid(InstancePtr != NULL); Xil_AssertVoid(FunctionPtr != NULL); Xil_AssertVoid(InstancePtr->IsReady == (u32)XIL_COMPONENT_IS_READY); InstancePtr->StatusHandler = FunctionPtr; InstancePtr->CallBackRef = CallBackRef; } /** @}
ua1arn/hftrx
C++
null
69
/* Open Synchronous mode on the specified UART. The */
void UARTSyncModeConfig(unsigned long ulBase, unsigned long ulBaud, unsigned long ulSYNConfig, unsigned long ulUARTConfig)
/* Open Synchronous mode on the specified UART. The */ void UARTSyncModeConfig(unsigned long ulBase, unsigned long ulBaud, unsigned long ulSYNConfig, unsigned long ulUARTConfig)
{ xASSERT(UARTBaseValid(ulBase)); UARTConfigSetExpClk(ulBase, ulBaud, ulUARTConfig); UARTModeSet(ulBase, USART_FUN_SEL_SYN_EN); xHWREG(ulBase + USART_SYNCR) |= ulSYNConfig; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Convert numeric value in Redfish format to HII value. */
EFI_STATUS RedfishNumericToHiiValue(IN EDKII_REDFISH_VALUE *RedfishValue, OUT HII_STATEMENT_VALUE *Value)
/* Convert numeric value in Redfish format to HII value. */ EFI_STATUS RedfishNumericToHiiValue(IN EDKII_REDFISH_VALUE *RedfishValue, OUT HII_STATEMENT_VALUE *Value)
{ if ((Value == NULL) || (RedfishValue == NULL)) { return EFI_INVALID_PARAMETER; } switch (RedfishValue->Type) { case RedfishValueTypeInteger: Value->Type = EFI_IFR_TYPE_NUM_SIZE_64; Value->Value.u64 = (UINT64)RedfishValue->Value.Integer; break; case RedfishValueTypeBoolean: Value->Type = EFI_IFR_TYPE_BOOLEAN; Value->Value.b = RedfishValue->Value.Boolean; break; default: Value->Type = EFI_IFR_TYPE_UNDEFINED; break; } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Inform application whether a valid edge on the selected external trigger input has occurred. @rmtoll ISR EXTTRIG LPTIM_IsActiveFlag_EXTTRIG. */
uint32_t LPTIM_IsActiveFlag_EXTTRIG(LPTIM_Module *LPTIMx)
/* Inform application whether a valid edge on the selected external trigger input has occurred. @rmtoll ISR EXTTRIG LPTIM_IsActiveFlag_EXTTRIG. */ uint32_t LPTIM_IsActiveFlag_EXTTRIG(LPTIM_Module *LPTIMx)
{ return (((READ_BIT(LPTIMx->INTSTS,LPTIM_INTSTS_EXTRIG) ==LPTIM_INTSTS_EXTRIG)? 1UL : 0UL)); }
pikasTech/PikaPython
C++
MIT License
1,403
/* transceiver_voodoo() enables the external UTP plug thingy. it's called voodoo as I stole this code and cannot cross-reference it with the specification. */
static void transceiver_voodoo(struct xircom_private *card)
/* transceiver_voodoo() enables the external UTP plug thingy. it's called voodoo as I stole this code and cannot cross-reference it with the specification. */ static void transceiver_voodoo(struct xircom_private *card)
{ unsigned long flags; enter("transceiver_voodoo"); pci_write_config_dword(card->pdev, PCI_POWERMGMT, 0x0000); setup_descriptors(card); spin_lock_irqsave(&card->lock, flags); outl(0x0008, card->io_port + CSR15); udelay(25); outl(0xa8050000, card->io_port + CSR15); udelay(25); outl(0xa00f0000, card->io_port + CSR15); udelay(25); spin_unlock_irqrestore(&card->lock, flags); netif_start_queue(card->dev); leave("transceiver_voodoo"); }
robutest/uclinux
C++
GPL-2.0
60
/* The idea of configure is simply to provide a point within the setup process to allow the transport class to extract information from a device after it has been setup. This is used in SCSI because we have to have a setup device to begin using the HBA, but after we send the initial inquiry, we use configure to extract the device parameters. The device need not have been added to be configured. */
void transport_configure_device(struct device *dev)
/* The idea of configure is simply to provide a point within the setup process to allow the transport class to extract information from a device after it has been setup. This is used in SCSI because we have to have a setup device to begin using the HBA, but after we send the initial inquiry, we use configure to extract the device parameters. The device need not have been added to be configured. */ void transport_configure_device(struct device *dev)
{ attribute_container_device_trigger(dev, transport_configure); }
robutest/uclinux
C++
GPL-2.0
60
/* The generic IDE core will have disabled the BMEN bit before this function is called. */
static void sl82c105_dma_start(ide_drive_t *drive)
/* The generic IDE core will have disabled the BMEN bit before this function is called. */ static void sl82c105_dma_start(ide_drive_t *drive)
{ ide_hwif_t *hwif = drive->hwif; struct pci_dev *dev = to_pci_dev(hwif->dev); int reg = 0x44 + drive->dn * 4; pci_write_config_word(dev, reg, (unsigned long)ide_get_drivedata(drive) >> 16); sl82c105_reset_host(dev); ide_dma_start(drive); }
robutest/uclinux
C++
GPL-2.0
60
/* Internal initialization function for CoAP library. Called by the network layer init procedure. Seeds the CoAP @message_id with a random number in accordance with recommendations in CoAP specification. */
void net_coap_init(void)
/* Internal initialization function for CoAP library. Called by the network layer init procedure. Seeds the CoAP @message_id with a random number in accordance with recommendations in CoAP specification. */ void net_coap_init(void)
{ message_id = (uint16_t)sys_rand32_get(); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Search the bits provided for the next set bit after the value provided, and reset the calendar. */
static unsigned int find_next(uint8_t *bits, unsigned int max, unsigned int value, struct tm *calendar, unsigned int field, unsigned int nextField, int *lower_orders, int *res_out)
/* Search the bits provided for the next set bit after the value provided, and reset the calendar. */ static unsigned int find_next(uint8_t *bits, unsigned int max, unsigned int value, struct tm *calendar, unsigned int field, unsigned int nextField, int *lower_orders, int *res_out)
{ err = add_to_field(calendar, nextField, 1); if (err) goto return_error; err = reset_min(calendar, field); if (err) goto return_error; notfound = 0; next_value = next_set_bit(bits, max, 0, &notfound); } if (notfound || next_value != value) { err = set_field(calendar, field, next_value); if (err) goto return_error; err = reset_all_min(calendar, lower_orders); if (err) goto return_error; } return next_value; return_error: *res_out = 1; return 0; }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* Look for a given device in the specified list of devices, and return the entry for it if we find it or NULL if we don't. */
pcap_if_t* find_dev(pcap_if_list_t *devlistp, const char *name)
/* Look for a given device in the specified list of devices, and return the entry for it if we find it or NULL if we don't. */ pcap_if_t* find_dev(pcap_if_list_t *devlistp, const char *name)
{ pcap_if_t *curdev; for (curdev = devlistp->beginning; curdev != NULL; curdev = curdev->next) { if (strcmp(name, curdev->name) == 0) { return (curdev); } } return (NULL); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* In the case of a PHY power down to save power, or to turn off link during a driver unload, or wake on lan is not enabled, restore the link to previous settings. */
void e1000_power_up_phy_copper(struct e1000_hw *hw)
/* In the case of a PHY power down to save power, or to turn off link during a driver unload, or wake on lan is not enabled, restore the link to previous settings. */ void e1000_power_up_phy_copper(struct e1000_hw *hw)
{ u16 mii_reg = 0; e1e_rphy(hw, PHY_CONTROL, &mii_reg); mii_reg &= ~MII_CR_POWER_DOWN; e1e_wphy(hw, PHY_CONTROL, mii_reg); }
robutest/uclinux
C++
GPL-2.0
60
/* st33zp24_i2c_cancel, cancel the current command execution or set STS to COMMAND READY. */
static void st33zp24_i2c_cancel(struct udevice *dev)
/* st33zp24_i2c_cancel, cancel the current command execution or set STS to COMMAND READY. */ static void st33zp24_i2c_cancel(struct udevice *dev)
{ u8 data; data = TPM_STS_COMMAND_READY; st33zp24_i2c_write(dev, TPM_STS, &data, 1); }
4ms/stm32mp1-baremetal
C++
Other
137
/* The underlying MTD device may cache data in hardware or in software. This function ensures the caches are flushed. Returns zero in case of success and a negative error code in case of failure. */
int ubi_sync(int ubi_num)
/* The underlying MTD device may cache data in hardware or in software. This function ensures the caches are flushed. Returns zero in case of success and a negative error code in case of failure. */ int ubi_sync(int ubi_num)
{ struct ubi_device *ubi; ubi = ubi_get_device(ubi_num); if (!ubi) return -ENODEV; mtd_sync(ubi->mtd); ubi_put_device(ubi); return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* LCD scrolls a text over the display, sort of "polled printf". */
void LCD_ScrollText(LCD_TypeDef *lcd, char *scrolltext)
/* LCD scrolls a text over the display, sort of "polled printf". */ void LCD_ScrollText(LCD_TypeDef *lcd, char *scrolltext)
{ int i, len; char buffer[8]; buffer[7] = 0x00; len = strlen(scrolltext); if (len < 7) return; for (i = 0; i < (len - 7); i++) { memcpy(buffer, scrolltext + i, 7); LCD_Write(lcd, buffer); vTaskDelay(100/portTICK_RATE_MS); } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Register the Service B.3 and all its Characteristics... */
void service_b_3_3_init(void)
/* Register the Service B.3 and all its Characteristics... */ void service_b_3_3_init(void)
{ bt_gatt_service_register(&service_b_3_3_svc); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function is used to config the tx retry count when detect err signal. */
void wm_sc_tx_retry_times(uint8_t count)
/* This function is used to config the tx retry count when detect err signal. */ void wm_sc_tx_retry_times(uint8_t count)
{ uint32_t reg; reg = tls_reg_read32(HR_UART2_LINE_CTRL); reg &= ~(0x7 << 16); tls_reg_write32(HR_UART2_LINE_CTRL, reg|(count<<16)); tls_bitband_write(HR_UART2_LINE_CTRL, 23, 1); }
Nicholas3388/LuaNode
C++
Other
1,055
/* Simple hash function. Needs to have a reasonable spread */
static Y_INLINE int yaffs_HashFunction(int n)
/* Simple hash function. Needs to have a reasonable spread */ static Y_INLINE int yaffs_HashFunction(int n)
{ if (n < 0) n = -n; return (n % YAFFS_NOBJECT_BUCKETS); }
EmcraftSystems/u-boot
C++
Other
181
/* iwl4965_txq_update_byte_cnt_tbl - Set up entry in Tx byte-count array */
static void iwl4965_txq_update_byte_cnt_tbl(struct iwl_priv *priv, struct iwl_tx_queue *txq, u16 byte_cnt)
/* iwl4965_txq_update_byte_cnt_tbl - Set up entry in Tx byte-count array */ static void iwl4965_txq_update_byte_cnt_tbl(struct iwl_priv *priv, struct iwl_tx_queue *txq, u16 byte_cnt)
{ struct iwl4965_scd_bc_tbl *scd_bc_tbl = priv->scd_bc_tbls.addr; int txq_id = txq->q.id; int write_ptr = txq->q.write_ptr; int len = byte_cnt + IWL_TX_CRC_SIZE + IWL_TX_DELIMITER_SIZE; __le16 bc_ent; WARN_ON(len > 0xFFF || write_ptr >= TFD_QUEUE_SIZE_MAX); bc_ent = cpu_to_le16(len & 0xFFF); scd_bc_tbl[txq_id].tfd_offset[write_ptr] = bc_ent; if (write_ptr < TFD_QUEUE_SIZE_BC_DUP) scd_bc_tbl[txq_id]. tfd_offset[TFD_QUEUE_SIZE_MAX + write_ptr] = bc_ent; }
robutest/uclinux
C++
GPL-2.0
60
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT16 EFIAPI PciBitFieldOr16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 OrData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT16 EFIAPI PciBitFieldOr16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 OrData)
{ return PciExpressBitFieldOr16 (Address, StartBit, EndBit, OrData); }
tianocore/edk2
C++
Other
4,240
/* This function displays a byte value using the Xplained LEDs. Support and FAQ: visit */
void led_display_number(uint8_t value)
/* This function displays a byte value using the Xplained LEDs. Support and FAQ: visit */ void led_display_number(uint8_t value)
{ int i; int shifter; int led[] = {LED0_GPIO, LED1_GPIO, LED2_GPIO, LED3_GPIO, LED4_GPIO, LED5_GPIO, LED6_GPIO, LED7_GPIO}; for (i = 0, shifter = 1; i < 8; i++, shifter <<= 1) { if (shifter & value) LED_On(led[i]); else LED_Off(led[i]); } }
remotemcu/remcu-chip-sdks
C++
null
436
/* 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 = i2cInstance; return HAL_I2cMasterInit((hal_i2c_master_handle_t *)handle, &masterConfig); }
eclipse-threadx/getting-started
C++
Other
310
/* Returns the pclk1 frequency of different on chip clocks. */
u32 RCC_GetPCLK1Freq(void)
/* Returns the pclk1 frequency of different on chip clocks. */ u32 RCC_GetPCLK1Freq(void)
{ return (RCC_GetHCLKFreq() >> tbPresc[(RCC->CFGR & RCC_CFGR_PPRE1) >> RCC_CFGR_PPRE1_Pos]); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT16 EFIAPI PciExpressBitFieldAnd16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 AndData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT16 EFIAPI PciExpressBitFieldAnd16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 AndData)
{ if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) { return (UINT16)-1; } return MmioBitFieldAnd16 ( GetPciExpressAddress (Address), StartBit, EndBit, AndData ); }
tianocore/edk2
C++
Other
4,240
/* To solve this we introduce l_pending_gen. A call to lockres_clear_pending() will only do so when it is passed a generation number that matches the lockres. lockres_set_pending() will return the current generation number. When ocfs2_cluster_lock() goes to clear PENDING, it passes the generation it got from set_pending(). In our example above, the generation numbers will */
static void __lockres_clear_pending(struct ocfs2_lock_res *lockres, unsigned int generation, struct ocfs2_super *osb)
/* To solve this we introduce l_pending_gen. A call to lockres_clear_pending() will only do so when it is passed a generation number that matches the lockres. lockres_set_pending() will return the current generation number. When ocfs2_cluster_lock() goes to clear PENDING, it passes the generation it got from set_pending(). In our example above, the generation numbers will */ static void __lockres_clear_pending(struct ocfs2_lock_res *lockres, unsigned int generation, struct ocfs2_super *osb)
{ assert_spin_locked(&lockres->l_lock); if (!(lockres->l_flags & OCFS2_LOCK_PENDING) || (lockres->l_pending_gen != generation)) return; lockres_clear_flags(lockres, OCFS2_LOCK_PENDING); lockres->l_pending_gen++; if (lockres->l_flags & OCFS2_LOCK_BLOCKED) ocfs2_wake_downconvert_thread(osb); }
robutest/uclinux
C++
GPL-2.0
60
/* System shutdown should not return, if it returns, it means the system does not support shut down reset. */
VOID EFIAPI ResetShutdown(VOID)
/* System shutdown should not return, if it returns, it means the system does not support shut down reset. */ VOID EFIAPI ResetShutdown(VOID)
{ UINTN PmCtrlReg; IoWrite16 ((UINTN)mAcpiBoardInfo.PmGpeEnBase, 0); IoWrite16 ((UINTN)mAcpiBoardInfo.PmEvtBase, BIT8); PmCtrlReg = (UINTN)mAcpiBoardInfo.PmCtrlRegBase; IoAndThenOr16 (PmCtrlReg, (UINT16) ~0x3c00, (UINT16)(7 << 10)); IoOr16 (PmCtrlReg, BIT13); CpuDeadLoop (); ASSERT (FALSE); }
tianocore/edk2
C++
Other
4,240
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciExpressOr32(IN UINTN Address, IN UINT32 OrData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ UINT32 EFIAPI PciExpressOr32(IN UINTN Address, IN UINT32 OrData)
{ ASSERT_INVALID_PCI_ADDRESS (Address); return MmioOr32 ((UINTN)GetPciExpressBaseAddress () + Address, OrData); }
tianocore/edk2
C++
Other
4,240
/* In some systems the periodic timer event may not poll the underlying communications device fast enough to transmit and/or receive all data packets without missing incoming packets or dropping outgoing packets. Drivers and applications that are experiencing packet loss should try calling the EFI_IP6_PROTOCOL.Poll() function more often. */
EFI_STATUS EFIAPI EfiIp6Poll(IN EFI_IP6_PROTOCOL *This)
/* In some systems the periodic timer event may not poll the underlying communications device fast enough to transmit and/or receive all data packets without missing incoming packets or dropping outgoing packets. Drivers and applications that are experiencing packet loss should try calling the EFI_IP6_PROTOCOL.Poll() function more often. */ EFI_STATUS EFIAPI EfiIp6Poll(IN EFI_IP6_PROTOCOL *This)
{ IP6_PROTOCOL *IpInstance; IP6_SERVICE *IpSb; EFI_MANAGED_NETWORK_PROTOCOL *Mnp; if (This == NULL) { return EFI_INVALID_PARAMETER; } IpInstance = IP6_INSTANCE_FROM_PROTOCOL (This); IpSb = IpInstance->Service; if (IpSb->LinkLocalDadFail) { return EFI_DEVICE_ERROR; } if (IpInstance->State == IP6_STATE_UNCONFIGED) { return EFI_NOT_STARTED; } Mnp = IpInstance->Service->Mnp; return Mnp->Poll (Mnp); }
tianocore/edk2
C++
Other
4,240
/* Create an "empty" timer. It needs to initialized with at least */
lv_timer_t* lv_timer_create_basic(void)
/* Create an "empty" timer. It needs to initialized with at least */ lv_timer_t* lv_timer_create_basic(void)
{ return lv_timer_create(NULL, DEF_PERIOD, NULL); }
pikasTech/PikaPython
C++
MIT License
1,403
/* param base DMA base address. param channel DMA channel. param descriptor configured DMA descriptor. */
void DMA_LoadChannelDescriptor(DMA_Type *base, uint32_t channel, dma_descriptor_t *descriptor)
/* param base DMA base address. param channel DMA channel. param descriptor configured DMA descriptor. */ void DMA_LoadChannelDescriptor(DMA_Type *base, uint32_t channel, dma_descriptor_t *descriptor)
{ assert(NULL != descriptor); assert(FSL_FEATURE_DMA_NUMBER_OF_CHANNELSn(base) != -1); assert(channel < (uint32_t)FSL_FEATURE_DMA_NUMBER_OF_CHANNELSn(base)); uint32_t instance = DMA_GetInstance(base); dma_descriptor_t *channelDescriptor = (dma_descriptor_t *)(&s_dma_descriptor_table[instance][channel]); channelDescriptor->xfercfg = descriptor->xfercfg; channelDescriptor->srcEndAddr = descriptor->srcEndAddr; channelDescriptor->dstEndAddr = descriptor->dstEndAddr; channelDescriptor->linkToNextDesc = descriptor->linkToNextDesc; base->CHANNEL[channel].XFERCFG = descriptor->xfercfg; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* "proto" is an Ethernet type value and for IPNET, if it is not IPv4 or IPv6 then we have an error. */
static struct block * gen_ipnet_linktype(compiler_state_t *, int)
/* "proto" is an Ethernet type value and for IPNET, if it is not IPv4 or IPv6 then we have an error. */ static struct block * gen_ipnet_linktype(compiler_state_t *, int)
{ switch (proto) { case ETHERTYPE_IP: return gen_cmp(cstate, OR_LINKTYPE, 0, BPF_B, (bpf_int32)IPH_AF_INET); case ETHERTYPE_IPV6: return gen_cmp(cstate, OR_LINKTYPE, 0, BPF_B, (bpf_int32)IPH_AF_INET6); default: break; } return gen_false(cstate); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Enables or disables the write protection of the desired sectors, for the first 1 Mb of the Flash */
void FLASH_OB_WRPConfig(uint32_t OB_WRP, FunctionalState NewState)
/* Enables or disables the write protection of the desired sectors, for the first 1 Mb of the Flash */ void FLASH_OB_WRPConfig(uint32_t OB_WRP, FunctionalState NewState)
{ FLASH_Status status = FLASH_COMPLETE; assert_param(IS_OB_WRP(OB_WRP)); assert_param(IS_FUNCTIONAL_STATE(NewState)); status = FLASH_WaitForLastOperation(); if(status == FLASH_COMPLETE) { if(NewState != DISABLE) { *(__IO uint16_t*)OPTCR_BYTE2_ADDRESS &= (~OB_WRP); } else { *(__IO uint16_t*)OPTCR_BYTE2_ADDRESS |= (uint16_t)OB_WRP; } } }
MaJerle/stm32f429
C++
null
2,036
/* Remove a previously configured PnP ATA port. Called only on module unload events as the core does not currently deal with ISAPnP docking. */
static void isapnp_remove_one(struct pnp_dev *idev)
/* Remove a previously configured PnP ATA port. Called only on module unload events as the core does not currently deal with ISAPnP docking. */ static void isapnp_remove_one(struct pnp_dev *idev)
{ struct device *dev = &idev->dev; struct ata_host *host = dev_get_drvdata(dev); ata_host_detach(host); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Window Size Used with the Base register to set the address window size and location. Must be programmed from LSB to MSB as sequence of ones followed by sequence of zeros. The number of ones specifies the size of the window in 64 KByte granularity (e.g., a value of 0x00FF specifies 256 = 16 MByte). NOTE: A value of 0x0 specifies 64-KByte size. */
unsigned int kw_winctrl_calcsize(unsigned int sizeval)
/* Window Size Used with the Base register to set the address window size and location. Must be programmed from LSB to MSB as sequence of ones followed by sequence of zeros. The number of ones specifies the size of the window in 64 KByte granularity (e.g., a value of 0x00FF specifies 256 = 16 MByte). NOTE: A value of 0x0 specifies 64-KByte size. */ unsigned int kw_winctrl_calcsize(unsigned int sizeval)
{ int i; unsigned int j = 0; u32 val = sizeval >> 1; for (i = 0; val > 0x10000; i++) { j |= (1 << i); val = val >> 1; } return (0x0000ffff & j); }
EmcraftSystems/u-boot
C++
Other
181
/* DAC Channel DMA Enable. Enable a digital to analog converter channel DMA mode (connected to DMA2 channel 3 for DAC channel 1 and DMA2 channel 4 for DAC channel 2). A DMA request is generated following an external trigger. */
void dac_dma_enable(data_channel dac_channel)
/* DAC Channel DMA Enable. Enable a digital to analog converter channel DMA mode (connected to DMA2 channel 3 for DAC channel 1 and DMA2 channel 4 for DAC channel 2). A DMA request is generated following an external trigger. */ void dac_dma_enable(data_channel dac_channel)
{ switch (dac_channel) { case CHANNEL_1: DAC_CR |= DAC_CR_DMAEN1; break; case CHANNEL_2: DAC_CR |= DAC_CR_DMAEN2; break; case CHANNEL_D: DAC_CR |= (DAC_CR_DMAEN1 | DAC_CR_DMAEN2); break; } }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Event handler for the library USB Connection event. */
void EVENT_USB_Device_Connect(void)
/* Event handler for the library USB Connection event. */ void EVENT_USB_Device_Connect(void)
{ LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Returns transpose type for CRC protocol reflect out parameter. This functions helps to set readTranspose member of crc_config_t structure. Reflect out is CRC protocol parameter. */
static crc_transpose_type_t crc_GetTransposeTypeFromReflectOut(bool enable)
/* Returns transpose type for CRC protocol reflect out parameter. This functions helps to set readTranspose member of crc_config_t structure. Reflect out is CRC protocol parameter. */ static crc_transpose_type_t crc_GetTransposeTypeFromReflectOut(bool enable)
{ return ((enable) ? kCrcTransposeBitsAndBytes : kCrcTransposeNone); }
labapart/polymcu
C++
null
201
/* Release a Mutex that was obtained with osMutexWait. */
osStatus svcMutexRelease(osMutexId mutex_id)
/* Release a Mutex that was obtained with osMutexWait. */ osStatus svcMutexRelease(osMutexId mutex_id)
{ return osErrorParameter; } if (((P_MUCB)mut)->cb_type != MUCB) { return osErrorParameter; } res = rt_mut_release(mut); if (res == OS_R_NOK) { return osErrorResource; } return osOK; }
labapart/polymcu
C++
null
201
/* Copy a bootloader version memory section to a RAM buffer. */
static void mem_bootloader_read(void *dst, isp_addr_t src, uint16_t nbytes)
/* Copy a bootloader version memory section to a RAM buffer. */ static void mem_bootloader_read(void *dst, isp_addr_t src, uint16_t nbytes)
{ memcpy(dst, &mem_bootloader + src, nbytes); }
memfault/zero-to-main
C++
null
200
/* Copy the RAM buffer values to fuse bits. */
static void mem_configuration_write(isp_addr_t dst, const void *src, uint16_t nbytes)
/* Copy the RAM buffer values to fuse bits. */ static void mem_configuration_write(isp_addr_t dst, const void *src, uint16_t nbytes)
{ const U8 *source = src; while (nbytes--) { flash_api_set_gp_fuse_bit(dst++, *source++); } }
memfault/zero-to-main
C++
null
200
/* Used for BSP to release all APs. Performs an atomic compare exchange operation to release semaphore for each AP. */
VOID ReleaseAllAPs(VOID)
/* Used for BSP to release all APs. Performs an atomic compare exchange operation to release semaphore for each AP. */ VOID ReleaseAllAPs(VOID)
{ UINTN Index; for (Index = 0; Index < mMaxNumberOfCpus; Index++) { if (IsPresentAp (Index)) { SmmCpuSyncReleaseOneAp (mSmmMpSyncData->SyncContext, Index, gSmmCpuPrivate->SmmCoreEntryContext.CurrentlyExecutingCpu); } } }
tianocore/edk2
C++
Other
4,240
/* Writes BufferSize bytes from Buffer into Offset. Writes may require a read modify write to support writes that are not aligned on sector boundaries. There are three cases: UnderRun - The first byte is not on a sector boundary or the write request is less than a sector in length. Read modify write is required. Aligned - A write of N contiguous sectors. OverRun - The last byte is not on a sector boundary. Read modified write required. */
EFI_STATUS EFIAPI DiskIoWriteDisk(IN EFI_DISK_IO_PROTOCOL *This, IN UINT32 MediaId, IN UINT64 Offset, IN UINTN BufferSize, IN VOID *Buffer)
/* Writes BufferSize bytes from Buffer into Offset. Writes may require a read modify write to support writes that are not aligned on sector boundaries. There are three cases: UnderRun - The first byte is not on a sector boundary or the write request is less than a sector in length. Read modify write is required. Aligned - A write of N contiguous sectors. OverRun - The last byte is not on a sector boundary. Read modified write required. */ EFI_STATUS EFIAPI DiskIoWriteDisk(IN EFI_DISK_IO_PROTOCOL *This, IN UINT32 MediaId, IN UINT64 Offset, IN UINTN BufferSize, IN VOID *Buffer)
{ return DiskIo2ReadWriteDisk ( DISK_IO_PRIVATE_DATA_FROM_DISK_IO (This), TRUE, MediaId, Offset, NULL, BufferSize, (UINT8 *)Buffer ); }
tianocore/edk2
C++
Other
4,240
/* Reads and returns the current value of MM1. This function is only available on IA-32 and x64. */
UINT64 EFIAPI AsmReadMm1(VOID)
/* Reads and returns the current value of MM1. This function is only available on IA-32 and x64. */ UINT64 EFIAPI AsmReadMm1(VOID)
{ _asm { push eax push eax movq [esp], mm1 pop eax pop edx emms } }
tianocore/edk2
C++
Other
4,240
/* Returns true if the task does not share ->mm with another thread/process. */
bool current_is_single_threaded(void)
/* Returns true if the task does not share ->mm with another thread/process. */ bool current_is_single_threaded(void)
{ struct task_struct *task = current; struct mm_struct *mm = task->mm; struct task_struct *p, *t; bool ret; if (atomic_read(&task->signal->live) != 1) return false; if (atomic_read(&mm->mm_users) == 1) return true; ret = false; rcu_read_lock(); for_each_process(p) { if (unlikely(p->flags & PF_KTHREAD)) continue; if (unlikely(p == task->group_leader)) continue; t = p; do { if (unlikely(t->mm == mm)) goto found; if (likely(t->mm)) break; smp_rmb(); } while_each_thread(p, t); } ret = true; found: rcu_read_unlock(); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Generate a key to describe an NFS inode in an NFS server's index */
static uint16_t nfs_fscache_inode_get_key(const void *cookie_netfs_data, void *buffer, uint16_t bufmax)
/* Generate a key to describe an NFS inode in an NFS server's index */ static uint16_t nfs_fscache_inode_get_key(const void *cookie_netfs_data, void *buffer, uint16_t bufmax)
{ const struct nfs_inode *nfsi = cookie_netfs_data; uint16_t nsize; nsize = nfsi->fh.size; memcpy(buffer, nfsi->fh.data, nsize); return nsize; }
robutest/uclinux
C++
GPL-2.0
60
/* I2C Set Bus Clock Frequency. Set the bus clock frequency. This is a 12 bit number (0...4095) calculated from the formulae given in the STM32F1 reference manual in the description of the CCR field. It is a divisor of the peripheral clock frequency */
void i2c_set_ccr(uint32_t i2c, uint16_t freq)
/* I2C Set Bus Clock Frequency. Set the bus clock frequency. This is a 12 bit number (0...4095) calculated from the formulae given in the STM32F1 reference manual in the description of the CCR field. It is a divisor of the peripheral clock frequency */ void i2c_set_ccr(uint32_t i2c, uint16_t freq)
{ uint16_t reg16; reg16 = I2C_CCR(i2c) & 0xf000; reg16 |= freq; I2C_CCR(i2c) = reg16; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Get OSTIMER status Flags. This returns the status flag. Currently, only match interrupt flag can be got. */
uint32_t OSTIMER_GetStatusFlags(OSTIMER_Type *base)
/* Get OSTIMER status Flags. This returns the status flag. Currently, only match interrupt flag can be got. */ uint32_t OSTIMER_GetStatusFlags(OSTIMER_Type *base)
{ return base->OSEVENT_CTRL & OSTIMER_OSEVENT_CTRL_OSTIMER_INTRFLAG_MASK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns: TRUE if the @mount can be unmounted. */
gboolean g_mount_can_unmount(GMount *mount)
/* Returns: TRUE if the @mount can be unmounted. */ gboolean g_mount_can_unmount(GMount *mount)
{ GMountIface *iface; g_return_val_if_fail (G_IS_MOUNT (mount), FALSE); iface = G_MOUNT_GET_IFACE (mount); return (* iface->can_unmount) (mount); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Initializes the GCLK driver. Initializes the Generic Clock module, disabling and resetting all active Generic Clock Generators and Channels to their power-on default values. */
void system_gclk_init(void)
/* Initializes the GCLK driver. Initializes the Generic Clock module, disabling and resetting all active Generic Clock Generators and Channels to their power-on default values. */ void system_gclk_init(void)
{ system_apb_clock_set_mask(SYSTEM_CLOCK_APB_APBA, PM_APBAMASK_GCLK); GCLK->CTRL.reg = GCLK_CTRL_SWRST; while (GCLK->CTRL.reg & GCLK_CTRL_SWRST) { } }
memfault/zero-to-main
C++
null
200
/* Allocate a mcast_address structure to hold the multicast address. Link it in. */
static int slic_mcast_add_list(struct adapter *adapter, char *address)
/* Allocate a mcast_address structure to hold the multicast address. Link it in. */ static int slic_mcast_add_list(struct adapter *adapter, char *address)
{ struct mcast_address *mcaddr, *mlist; bool equaladdr; mlist = adapter->mcastaddrs; while (mlist) { ETHER_EQ_ADDR(mlist->address, address, equaladdr); if (equaladdr) return STATUS_SUCCESS; mlist = mlist->next; } mcaddr = kmalloc(sizeof(struct mcast_address), GFP_ATOMIC); if (mcaddr == NULL) return 1; memcpy(mcaddr->address, address, 6); mcaddr->next = adapter->mcastaddrs; adapter->mcastaddrs = mcaddr; return STATUS_SUCCESS; }
robutest/uclinux
C++
GPL-2.0
60
/* This function will let current thread yield processor, and scheduler will choose a highest thread to run. After yield processor, the current thread is still in READY state. */
rt_err_t rt_thread_yield(void)
/* This function will let current thread yield processor, and scheduler will choose a highest thread to run. After yield processor, the current thread is still in READY state. */ rt_err_t rt_thread_yield(void)
{ register rt_base_t level; struct rt_thread *thread; level = rt_hw_interrupt_disable(); thread = rt_current_thread; if (thread->stat == RT_THREAD_READY && thread->tlist.next != thread->tlist.prev) { rt_list_remove(&(thread->tlist)); rt_list_insert_before(&(rt_thread_priority_table[thread->current_priority]), &(thread->tlist)); rt_hw_interrupt_enable(level); rt_schedule(); return RT_EOK; } rt_hw_interrupt_enable(level); return RT_EOK; }
armink/FreeModbus_Slave-Master-RTT-STM32
C++
Other
1,477
/* Try to copy last bytes and clear the rest if needed. Since protection fault in copy_from/to_user is not a normal situation, it is not necessary to optimize tail handling. */
unsigned long copy_user_handle_tail(char *to, char *from, unsigned len, unsigned zerorest)
/* Try to copy last bytes and clear the rest if needed. Since protection fault in copy_from/to_user is not a normal situation, it is not necessary to optimize tail handling. */ unsigned long copy_user_handle_tail(char *to, char *from, unsigned len, unsigned zerorest)
{ char c; unsigned zero_len; for (; len; --len) { if (__get_user_nocheck(c, from++, sizeof(char))) break; if (__put_user_nocheck(c, to++, sizeof(char))) break; } for (c = 0, zero_len = len; zerorest && zero_len; --zero_len) if (__put_user_nocheck(c, to++, sizeof(char))) break; return len; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Initializes the BEEP function according to the specified parameters. */
void BEEP_Init(BEEP_Frequency_TypeDef BEEP_Frequency)
/* Initializes the BEEP function according to the specified parameters. */ void BEEP_Init(BEEP_Frequency_TypeDef BEEP_Frequency)
{ assert_param(IS_BEEP_FREQUENCY(BEEP_Frequency)); if ((BEEP->CSR2 & BEEP_CSR2_BEEPDIV) == BEEP_CSR2_BEEPDIV) { BEEP->CSR2 &= (uint8_t)(~BEEP_CSR2_BEEPDIV); BEEP->CSR2 |= BEEP_CALIBRATION_DEFAULT; } BEEP->CSR2 &= (uint8_t)(~BEEP_CSR2_BEEPSEL); BEEP->CSR2 |= (uint8_t)(BEEP_Frequency); }
remotemcu/remcu-chip-sdks
C++
null
436
/* param base LDO SNVS DIG peripheral base address. param mode Used to control LDO power mode, please refer to pmu_ldo_operate_mode_t. */
void PMU_SnvsDigLdoInit(ANADIG_LDO_SNVS_DIG_Type *base, pmu_ldo_operate_mode_t mode)
/* param base LDO SNVS DIG peripheral base address. param mode Used to control LDO power mode, please refer to pmu_ldo_operate_mode_t. */ void PMU_SnvsDigLdoInit(ANADIG_LDO_SNVS_DIG_Type *base, pmu_ldo_operate_mode_t mode)
{ uint32_t temp32 = base->PMU_LDO_SNVS_DIG; temp32 &= ~(ANADIG_LDO_SNVS_DIG_PMU_LDO_SNVS_DIG_REG_LP_EN_MASK); temp32 |= (ANADIG_LDO_SNVS_DIG_PMU_LDO_SNVS_DIG_REG_LP_EN(mode) | ANADIG_LDO_SNVS_DIG_PMU_LDO_SNVS_DIG_REG_EN_MASK); base->PMU_LDO_SNVS_DIG = temp32; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This service is a wrapper for the PEI Service FfsFindByName(), except the pointer to the PEI Services Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface Specification for details. */
EFI_STATUS EFIAPI PeiServicesFfsFindFileByName(IN CONST EFI_GUID *FileName, IN CONST EFI_PEI_FV_HANDLE VolumeHandle, OUT EFI_PEI_FILE_HANDLE *FileHandle)
/* This service is a wrapper for the PEI Service FfsFindByName(), except the pointer to the PEI Services Table has been removed. See the Platform Initialization Pre-EFI Initialization Core Interface Specification for details. */ EFI_STATUS EFIAPI PeiServicesFfsFindFileByName(IN CONST EFI_GUID *FileName, IN CONST EFI_PEI_FV_HANDLE VolumeHandle, OUT EFI_PEI_FILE_HANDLE *FileHandle)
{ return (*GetPeiServicesTablePointer ())->FfsFindFileByName (FileName, VolumeHandle, FileHandle); }
tianocore/edk2
C++
Other
4,240
/* Enable the automatic slave select function of the specified SPI port. The */
void SPIAutoSSEnable(unsigned long ulBase, unsigned long ulSlaveSel)
/* Enable the automatic slave select function of the specified SPI port. The */ void SPIAutoSSEnable(unsigned long ulBase, unsigned long ulSlaveSel)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)); xASSERT((ulSlaveSel == SPI_SS_NONE) || (ulSlaveSel == SPI_SS0)); xHWREG(ulBase + SPI_SSR) |= SPI_AUTOSS; xHWREG(ulBase + SPI_SSR) &= ~0x00000001; xHWREG(ulBase + SPI_SSR) |= ulSlaveSel; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Write Data to TXD register to be sent. */
void i2c_send_data(uint32_t i2c, uint8_t data)
/* Write Data to TXD register to be sent. */ void i2c_send_data(uint32_t i2c, uint8_t data)
{ I2C_TXD(i2c) = data; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* For Td guest TDVMCALL_IO is invoked to read I/O port. */
UINT8 EFIAPI IoRead8(IN UINTN Port)
/* For Td guest TDVMCALL_IO is invoked to read I/O port. */ UINT8 EFIAPI IoRead8(IN UINTN Port)
{ UINT8 Value; BOOLEAN Flag; Flag = FilterBeforeIoRead (FilterWidth8, Port, &Value); if (Flag) { if (IsTdxGuest ()) { Value = TdIoRead8 (Port); } else { _ReadWriteBarrier (); Value = (UINT8)_inp ((UINT16)Port); _ReadWriteBarrier (); } } FilterAfterIoRead (FilterWidth8, Port, &Value); return Value; }
tianocore/edk2
C++
Other
4,240
/* Clears a Stall condition on an endpoint of the Low Level Driver. */
USBD_StatusTypeDef USBD_LL_ClearStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
/* Clears a Stall condition on an endpoint of the Low Level Driver. */ USBD_StatusTypeDef USBD_LL_ClearStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
{ HAL_PCD_EP_ClrStall(pdev->pData, ep_addr); return USBD_OK; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* get the last data output value of DAC0 */
uint16_t dac0_output_value_get(void)
/* get the last data output value of DAC0 */ uint16_t dac0_output_value_get(void)
{ uint16_t data = 0; data = DAC0_DO; return data; }
liuxuming/trochili
C++
Apache License 2.0
132
/* Read BMA222 temperature data. This function reads temperature data, where center temperature 24 C corresponds to a value 0x00 read from the temperature register with temperature slope 0.5 C/LSB. */
static bool bma222_get_temperature(sensor_hal_t *hal, sensor_data_t *data)
/* Read BMA222 temperature data. This function reads temperature data, where center temperature 24 C corresponds to a value 0x00 read from the temperature register with temperature slope 0.5 C/LSB. */ static bool bma222_get_temperature(sensor_hal_t *hal, sensor_data_t *data)
{ int8_t const temp_data = (int8_t)sensor_bus_get(hal, BMA222_TEMP); if (data->scaled) { data->temperature.value = BMA222_TEMP_OFFSET + (temp_data / 2); } else { data->temperature.value = temp_data; } return (STATUS_OK == hal->bus.status); }
memfault/zero-to-main
C++
null
200
/* Reads the RF Zone Security Status (defining the allowed RF accesses). */
int32_t BSP_NFCTAG_ReadRFZxSS(uint32_t Instance, const ST25DV_PROTECTION_ZONE Zone, ST25DV_RF_PROT_ZONE *const pRfprotZone)
/* Reads the RF Zone Security Status (defining the allowed RF accesses). */ int32_t BSP_NFCTAG_ReadRFZxSS(uint32_t Instance, const ST25DV_PROTECTION_ZONE Zone, ST25DV_RF_PROT_ZONE *const pRfprotZone)
{ UNUSED(Instance); return ST25DV_ReadRFZxSS(&NfcTagObj, Zone, pRfprotZone); }
eclipse-threadx/getting-started
C++
Other
310
/* Extract the port number from the given pin identifier. Isolating bits 10 to 13 of the port base addresses leads to unique port numbers. */
static int _port_num(gpio_t pin)
/* Extract the port number from the given pin identifier. Isolating bits 10 to 13 of the port base addresses leads to unique port numbers. */ static int _port_num(gpio_t pin)
{ return (((pin >> 10) & 0x0f) - 2); }
labapart/polymcu
C++
null
201
/* Return the number of blocks used by the superblock (primary or backup) in this group. Currently this will be only 0 or 1. */
int ext4_bg_has_super(struct super_block *sb, ext4_group_t group)
/* Return the number of blocks used by the superblock (primary or backup) in this group. Currently this will be only 0 or 1. */ int ext4_bg_has_super(struct super_block *sb, ext4_group_t group)
{ if (EXT4_HAS_RO_COMPAT_FEATURE(sb, EXT4_FEATURE_RO_COMPAT_SPARSE_SUPER) && !ext4_group_sparse(group)) return 0; return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Called by midlayer with host locked to queue a new request */
static int mesh_queue(struct scsi_cmnd *cmd, void(*done)(struct scsi_cmnd *))
/* Called by midlayer with host locked to queue a new request */ static int mesh_queue(struct scsi_cmnd *cmd, void(*done)(struct scsi_cmnd *))
{ struct mesh_state *ms; cmd->scsi_done = done; cmd->host_scribble = NULL; ms = (struct mesh_state *) cmd->device->host->hostdata; if (ms->request_q == NULL) ms->request_q = cmd; else ms->request_qtail->host_scribble = (void *) cmd; ms->request_qtail = cmd; if (ms->phase == idle) mesh_start(ms); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Load the current value of the hwmod OCP_SYSCONFIG register into the struct omap_hwmod for later use. Returns -EINVAL if the hwmod has no OCP_SYSCONFIG register or 0 upon success. */
static int _update_sysc_cache(struct omap_hwmod *oh)
/* Load the current value of the hwmod OCP_SYSCONFIG register into the struct omap_hwmod for later use. Returns -EINVAL if the hwmod has no OCP_SYSCONFIG register or 0 upon success. */ static int _update_sysc_cache(struct omap_hwmod *oh)
{ if (!oh->sysconfig) { WARN(!oh->sysconfig, "omap_hwmod: %s: cannot read " "OCP_SYSCONFIG: not defined on hwmod\n", oh->name); return -EINVAL; } oh->_sysc_cache = omap_hwmod_readl(oh, oh->sysconfig->sysc_offs); if (!(oh->sysconfig->sysc_flags & SYSC_NO_CACHE)) oh->_int_flags |= _HWMOD_SYSCONFIG_LOADED; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enable the floating point module. Call this function to enable the ARM hardware floating point module. */
void am_hal_sysctrl_fpu_enable(void)
/* Enable the floating point module. Call this function to enable the ARM hardware floating point module. */ void am_hal_sysctrl_fpu_enable(void)
{ AM_REG(SYSCTRL, CPACR) = (AM_REG_SYSCTRL_CPACR_CP11(0x3) | AM_REG_SYSCTRL_CPACR_CP10(0x3)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Turn the kernel object @in into a set of permissions descriptions for returning to userspace (@out). */
void kernel_to_ipc64_perm(struct kern_ipc_perm *in, struct ipc64_perm *out)
/* Turn the kernel object @in into a set of permissions descriptions for returning to userspace (@out). */ void kernel_to_ipc64_perm(struct kern_ipc_perm *in, struct ipc64_perm *out)
{ out->key = in->key; out->uid = in->uid; out->gid = in->gid; out->cuid = in->cuid; out->cgid = in->cgid; out->mode = in->mode; out->seq = in->seq; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Tells whether the FLASHCALW is ready to run a new command. */
bool flashcalw_is_ready(void)
/* Tells whether the FLASHCALW is ready to run a new command. */ bool flashcalw_is_ready(void)
{ return ((HFLASHC->FLASHCALW_FSR & FLASHCALW_FSR_FRDY) != 0); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Generic read/write functions that call the specific functions of the atttributes... */
static ssize_t efivar_attr_show(struct kobject *kobj, struct attribute *attr, char *buf)
/* Generic read/write functions that call the specific functions of the atttributes... */ static ssize_t efivar_attr_show(struct kobject *kobj, struct attribute *attr, char *buf)
{ struct efivar_entry *var = to_efivar_entry(kobj); struct efivar_attribute *efivar_attr = to_efivar_attr(attr); ssize_t ret = -EIO; if (!capable(CAP_SYS_ADMIN)) return -EACCES; if (efivar_attr->show) { ret = efivar_attr->show(var, buf); } return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* fcs_ns_public FCS nameserver public interfaces Functions called by port/fab. These will send relevant Events to the ns state machine. */
void bfa_fcs_port_ns_init(struct bfa_fcs_port_s *port)
/* fcs_ns_public FCS nameserver public interfaces Functions called by port/fab. These will send relevant Events to the ns state machine. */ void bfa_fcs_port_ns_init(struct bfa_fcs_port_s *port)
{ struct bfa_fcs_port_ns_s *ns = BFA_FCS_GET_NS_FROM_PORT(port); ns->port = port; bfa_sm_set_state(ns, bfa_fcs_port_ns_sm_offline); }
robutest/uclinux
C++
GPL-2.0
60
/* Setup the MAC address in the MAC itself, and in the uIP stack. */
static void prvSetMACAddress(void)
/* Setup the MAC address in the MAC itself, and in the uIP stack. */ static void prvSetMACAddress(void)
{ struct uip_eth_addr xAddr; xAddr.addr[ 0 ] = uipMAC_ADDR0; xAddr.addr[ 1 ] = uipMAC_ADDR1; xAddr.addr[ 2 ] = uipMAC_ADDR2; xAddr.addr[ 3 ] = uipMAC_ADDR3; xAddr.addr[ 4 ] = uipMAC_ADDR4; xAddr.addr[ 5 ] = uipMAC_ADDR5; uip_setethaddr( xAddr ); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Check whether need to enable the reset flag in form level. Also clean all ValueChanged flag in question. */
VOID UpdateFlagForForm(IN BOOLEAN SetFlag, IN FORM_BROWSER_FORMSET *FormSet, IN FORM_BROWSER_FORM *Form)
/* Check whether need to enable the reset flag in form level. Also clean all ValueChanged flag in question. */ VOID UpdateFlagForForm(IN BOOLEAN SetFlag, IN FORM_BROWSER_FORMSET *FormSet, IN FORM_BROWSER_FORM *Form)
{ LIST_ENTRY *Link; FORM_BROWSER_STATEMENT *Question; BOOLEAN OldValue; Link = GetFirstNode (&Form->StatementListHead); while (!IsNull (&Form->StatementListHead, Link)) { Question = FORM_BROWSER_STATEMENT_FROM_LINK (Link); Link = GetNextNode (&Form->StatementListHead, Link); if (!Question->ValueChanged) { continue; } OldValue = Question->ValueChanged; Question->ValueChanged = IsQuestionValueChanged (FormSet, Form, Question, GetSetValueWithBothBuffer); if (SetFlag && OldValue && !Question->ValueChanged) { if ((Question->QuestionFlags & EFI_IFR_FLAG_RESET_REQUIRED) != 0) { gResetRequiredFormLevel = TRUE; gResetRequiredSystemLevel = TRUE; } if ((Question->QuestionFlags & EFI_IFR_FLAG_RECONNECT_REQUIRED) != 0) { gFlagReconnect = TRUE; } } } }
tianocore/edk2
C++
Other
4,240
/* Sets or Resets the TIM peripheral Capture Compare Preload Control bit. */
void TIM_CCPreloadControl(TIM_TypeDef *tim, FunctionalState state)
/* Sets or Resets the TIM peripheral Capture Compare Preload Control bit. */ void TIM_CCPreloadControl(TIM_TypeDef *tim, FunctionalState state)
{ (state) ? SET_BIT(tim->CR2, TIM_CR2_CCPC) : CLEAR_BIT(tim->CR2, TIM_CR2_CCPC); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Read UART ID using the divisor method - set DLL and DLM to zero and the revision will be in DLL and device type in DLM. We preserve the device state across this. */
static unsigned int autoconfig_read_divisor_id(struct uart_8250_port *p)
/* Read UART ID using the divisor method - set DLL and DLM to zero and the revision will be in DLL and device type in DLM. We preserve the device state across this. */ static unsigned int autoconfig_read_divisor_id(struct uart_8250_port *p)
{ unsigned char old_dll, old_dlm, old_lcr; unsigned int id; old_lcr = serial_inp(p, UART_LCR); serial_outp(p, UART_LCR, UART_LCR_DLAB); old_dll = serial_inp(p, UART_DLL); old_dlm = serial_inp(p, UART_DLM); serial_outp(p, UART_DLL, 0); serial_outp(p, UART_DLM, 0); id = serial_inp(p, UART_DLL) | serial_inp(p, UART_DLM) << 8; serial_outp(p, UART_DLL, old_dll); serial_outp(p, UART_DLM, old_dlm); serial_outp(p, UART_LCR, old_lcr); return id; }
robutest/uclinux
C++
GPL-2.0
60
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
{ if(htim_base->Instance==TIM1) { __HAL_RCC_TIM1_CLK_ENABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns the subtraction of @nsec from @kt in ktime_t format */
ktime_t ktime_sub_ns(const ktime_t kt, u64 nsec)
/* Returns the subtraction of @nsec from @kt in ktime_t format */ ktime_t ktime_sub_ns(const ktime_t kt, u64 nsec)
{ ktime_t tmp; if (likely(nsec < NSEC_PER_SEC)) { tmp.tv64 = nsec; } else { unsigned long rem = do_div(nsec, NSEC_PER_SEC); tmp = ktime_set((long)nsec, rem); } return ktime_sub(kt, tmp); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Read data from Rx registers. This function replaces the original SSIDataNonBlockingGet() API and performs the same actions. A macro is provided in */
unsigned long SPIRxRegisterGet(unsigned long ulBase, unsigned long *pulData, unsigned long ulCount)
/* Read data from Rx registers. This function replaces the original SSIDataNonBlockingGet() API and performs the same actions. A macro is provided in */ unsigned long SPIRxRegisterGet(unsigned long ulBase, unsigned long *pulData, unsigned long ulCount)
{ unsigned long i; xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE) || (ulBase == SPI3_BASE)); xASSERT(ulCount < 2); for (i=0; i<ulCount; i++) { pulData[i] = xHWREG(ulBase + SPI_RX0 + 4*i); } return ulCount; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Toggle the state of the on board LED. */
static void prvToggleOnBoardLED(void)
/* Toggle the state of the on board LED. */ static void prvToggleOnBoardLED(void)
{ if( P1 & ucLED_BIT ) { P1 &= ~ucLED_BIT; } else { P1 |= ucLED_BIT; } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Under heavy swap load I've seen this lose in an ugly way. So do some extra sanity checking on the ranges we expect these pointers to be in so that we can fail gracefully. This is just for ps after all. */
unsigned long thread_saved_pc(struct task_struct *t)
/* Under heavy swap load I've seen this lose in an ugly way. So do some extra sanity checking on the ranges we expect these pointers to be in so that we can fail gracefully. This is just for ps after all. */ unsigned long thread_saved_pc(struct task_struct *t)
{ unsigned long base = (unsigned long)task_stack_page(t); unsigned long fp, sp = task_thread_info(t)->pcb.ksp; if (sp > base && sp+6*8 < base + 16*1024) { fp = ((unsigned long*)sp)[6]; if (fp > sp && fp < base + 16*1024) return *(unsigned long *)fp; } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Alert box, with optional "don't show this message again" variable and checkbox, and optional secondary text. */
void simple_message_box(ESD_TYPE_E type, gboolean *notagain, const char *secondary_msg, const char *msg_format,...)
/* Alert box, with optional "don't show this message again" variable and checkbox, and optional secondary text. */ void simple_message_box(ESD_TYPE_E type, gboolean *notagain, const char *secondary_msg, const char *msg_format,...)
{ va_list ap; va_start(ap, msg_format); do_simple_message_box(type, notagain, secondary_msg, msg_format, ap); va_end(ap); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Any value in the range translates to the ilog2(MMC_VDD_20_21). */
static int mmc_vdd_to_ocrbitnum(int vdd, bool low_bits)
/* Any value in the range translates to the ilog2(MMC_VDD_20_21). */ static int mmc_vdd_to_ocrbitnum(int vdd, bool low_bits)
{ const int max_bit = ilog2(MMC_VDD_35_36); int bit; if (vdd < 1650 || vdd > 3600) return -EINVAL; if (vdd >= 1650 && vdd <= 1950) return ilog2(MMC_VDD_165_195); if (low_bits) vdd -= 1; bit = (vdd - 2000) / 100 + 8; if (bit > max_bit) return max_bit; return bit; }
robutest/uclinux
C++
GPL-2.0
60
/* param base eDMA peripheral base address. param channel eDMA channel number. param mask The mask of channel status to be cleared. Users need to use the defined _edma_channel_status_flags type. */
void EDMA_ClearChannelStatusFlags(DMA_Type *base, uint32_t channel, uint32_t mask)
/* param base eDMA peripheral base address. param channel eDMA channel number. param mask The mask of channel status to be cleared. Users need to use the defined _edma_channel_status_flags type. */ void EDMA_ClearChannelStatusFlags(DMA_Type *base, uint32_t channel, uint32_t mask)
{ assert(channel < (uint32_t)FSL_FEATURE_EDMA_MODULE_CHANNEL); if (0U != (mask & (uint32_t)kEDMA_DoneFlag)) { base->CDNE = (uint8_t)channel; } if (0U != (mask & (uint32_t)kEDMA_ErrorFlag)) { base->CERR = (uint8_t)channel; } if (0U != (mask & (uint32_t)kEDMA_InterruptFlag)) { base->CINT = (uint8_t)channel; } }
eclipse-threadx/getting-started
C++
Other
310