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
/* brief Return Frequency of Core System return Frequency of Core System */
uint32_t CLOCK_GetCoreSysClkFreq(void)
/* brief Return Frequency of Core System return Frequency of Core System */ uint32_t CLOCK_GetCoreSysClkFreq(void)
{ uint32_t freq = 0U; switch ((SCG0->CSR & SCG_CSR_SCS_MASK) >> SCG_CSR_SCS_SHIFT) { case 1U: freq = CLOCK_GetExtClkFreq(); break; case 2U: freq = CLOCK_GetFro12MFreq(); break; case 3U: freq = CLOCK_GetFroHfFreq(); ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* write data from user FIFO to USB RAM */
static void usbd_ep_data_write(uint8_t *user_fifo, uint8_t ep_num, uint16_t bytes)
/* write data from user FIFO to USB RAM */ static void usbd_ep_data_write(uint8_t *user_fifo, uint8_t ep_num, uint16_t bytes)
{ if (0U != bytes) { uint32_t n; uint32_t *write_addr = (uint32_t *)(btable_ep[ep_num].tx_addr * 2U + USBD_RAM); for (n = 0U; n < (bytes + 1U) / 2U; n++) { *write_addr++ = *((uint16_t*)user_fifo); user_fifo += 2U; } } btable_ep[ep_num].tx_count = bytes...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Wait until Busy bit is off, or timeout (in ms) Return last status */
static uchar ide_wait(int dev, ulong t)
/* Wait until Busy bit is off, or timeout (in ms) Return last status */ static uchar ide_wait(int dev, ulong t)
{ ulong delay = 10 * t; uchar c; while ((c = ide_inb(dev, ATA_STATUS)) & ATA_STAT_BUSY) { udelay(100); if (delay-- == 0) break; } return c; }
4ms/stm32mp1-baremetal
C++
Other
137
/* User processing time, it is recommended to avoid blocking task for long time. */
void USBPD_DPM_UserExecute(void const *argument)
/* User processing time, it is recommended to avoid blocking task for long time. */ void USBPD_DPM_UserExecute(void const *argument)
{ uint32_t _timing = osWaitForever; osMessageQId queue = *(osMessageQId *)argument; do{ osEvent event = osMessageGet(queue, _timing); switch (((DPM_USER_EVENT)event.value.v & 0xF)) { case DPM_USER_EVENT_TIMER: if (DPM_TIMER_ENABLE_MSK == DPM_Ports[USBPD_PORT_0].DPM_TimerAME) { ...
st-one/X-CUBE-USB-PD
C++
null
110
/* Writes the Mailbox watchdog coefficient delay. Needs the I2C Password presentation to be effective. */
int32_t ST25DV_WriteMBWDG(ST25DV_Object_t *pObj, const uint8_t WdgDelay)
/* Writes the Mailbox watchdog coefficient delay. Needs the I2C Password presentation to be effective. */ int32_t ST25DV_WriteMBWDG(ST25DV_Object_t *pObj, const uint8_t WdgDelay)
{ return st25dv_set_mb_wdg_delay(&(pObj->Ctx), &WdgDelay); }
eclipse-threadx/getting-started
C++
Other
310
/* Enable the throwing of an object after is is dragged */
void lv_obj_set_drag_throw(lv_obj_t *obj, bool en)
/* Enable the throwing of an object after is is dragged */ void lv_obj_set_drag_throw(lv_obj_t *obj, bool en)
{ obj->drag_throw = (en == true ? 1 : 0); }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* Enable or disable the TMR4 PWM main output function. */
void TMR4_PWM_MainOutputCmd(CM_TMR4_TypeDef *TMR4x, en_functional_state_t enNewState)
/* Enable or disable the TMR4 PWM main output function. */ void TMR4_PWM_MainOutputCmd(CM_TMR4_TypeDef *TMR4x, en_functional_state_t enNewState)
{ DDL_ASSERT(IS_TMR4_UNIT(TMR4x)); DDL_ASSERT(IS_FUNCTIONAL_STATE(enNewState)); if (ENABLE == enNewState) { SET_REG32_BIT(TMR4x->PSCR, TMR4_PSCR_MOE); } else { CLR_REG32_BIT(TMR4x->PSCR, TMR4_PSCR_MOE); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Setup the input buffer state to scan the given bytes. The next call to zconflex() will scan from a */
YY_BUFFER_STATE zconf_scan_bytes(yyconst char *bytes, int len)
/* Setup the input buffer state to scan the given bytes. The next call to zconflex() will scan from a */ YY_BUFFER_STATE zconf_scan_bytes(yyconst char *bytes, int len)
{ YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; n = _yybytes_len + 2; buf = (char *) zconfalloc(n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; ...
Nicholas3388/LuaNode
C++
Other
1,055
/* set the SDMMC state Power-on: the card is clocked manage the SDMMC state control: Reset => Power-Cycle => Power-Off => Power PWRCTRL=10 PWCTRL=00 PWCTRL=11 */
static void stm32_sdmmc2_pwron(struct stm32_sdmmc2_priv *priv)
/* set the SDMMC state Power-on: the card is clocked manage the SDMMC state control: Reset => Power-Cycle => Power-Off => Power PWRCTRL=10 PWCTRL=00 PWCTRL=11 */ static void stm32_sdmmc2_pwron(struct stm32_sdmmc2_priv *priv)
{ u32 pwrctrl = readl(priv->base + SDMMC_POWER) & SDMMC_POWER_PWRCTRL_MASK; if (pwrctrl == SDMMC_POWER_PWRCTRL_ON) return; if (pwrctrl == SDMMC_POWER_PWRCTRL_OFF) { writel(SDMMC_POWER_PWRCTRL_CYCLE | priv->pwr_reg_msk, priv->base + SDMMC_POWER); } writel(SDMMC_POWER_PWRCTRL_OFF | priv->pwr_reg_msk,...
4ms/stm32mp1-baremetal
C++
Other
137
/* Register the Service C.2 and all its Characteristics... */
void service_c_2_3_init(void)
/* Register the Service C.2 and all its Characteristics... */ void service_c_2_3_init(void)
{ bt_gatt_service_register(&service_c_2_3_svc); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* vmbus_msg_dpc - Tasklet routine to handle hypervisor events */
static void vmbus_event_dpc(unsigned long data)
/* vmbus_msg_dpc - Tasklet routine to handle hypervisor events */ static void vmbus_event_dpc(unsigned long data)
{ struct vmbus_driver *vmbus_drv_obj = (struct vmbus_driver *)data; DPRINT_ENTER(VMBUS_DRV); ASSERT(vmbus_drv_obj->OnEventDpc != NULL); vmbus_drv_obj->OnEventDpc(&vmbus_drv_obj->Base); DPRINT_EXIT(VMBUS_DRV); }
robutest/uclinux
C++
GPL-2.0
60
/* Build a netlink message to add a new classifier */
int rtnl_cls_build_add_request(struct rtnl_cls *cls, int flags, struct nl_msg **result)
/* Build a netlink message to add a new classifier */ int rtnl_cls_build_add_request(struct rtnl_cls *cls, int flags, struct nl_msg **result)
{ return cls_build(cls, RTM_NEWTFILTER, NLM_F_CREATE | flags, result); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Calculate wlan 802.11 packet MAX size from pkt_attrib This function doesn't consider fragment case */
u32 rtw_calculate_wlan_pkt_size_by_attribue(struct pkt_attrib *pattrib)
/* Calculate wlan 802.11 packet MAX size from pkt_attrib This function doesn't consider fragment case */ u32 rtw_calculate_wlan_pkt_size_by_attribue(struct pkt_attrib *pattrib)
{ u32 len = 0; len = pattrib->hdrlen + pattrib->iv_len; len += SNAP_SIZE + sizeof(u16); len += pattrib->pktlen; if (pattrib->encrypt == _TKIP_) len += 8; len += ((pattrib->bswenc) ? pattrib->icv_len : 0); return len; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Configures the TIMx Output Compare 1 Fast feature. */
void TIM_ConfigOc1Fast(TIM_Module *TIMx, uint16_t TIM_OCFast)
/* Configures the TIMx Output Compare 1 Fast feature. */ void TIM_ConfigOc1Fast(TIM_Module *TIMx, uint16_t TIM_OCFast)
{ uint16_t tmpccmr1 = 0; assert_param(IsTimList8Module(TIMx)); assert_param(IsTimOcFastState(TIM_OCFast)); tmpccmr1 = TIMx->CCMOD1; tmpccmr1 &= (uint16_t) ~((uint16_t)TIM_CCMOD1_OC1FEN); tmpccmr1 |= TIM_OCFast; TIMx->CCMOD1 = tmpccmr1; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Perform the initial setup needed for each device that is chip special. In our case we need to lock the sector count to avoid blowing the brains out of the firmware with large LBA48 requests */
static void it821x_dev_config(struct ata_device *adev)
/* Perform the initial setup needed for each device that is chip special. In our case we need to lock the sector count to avoid blowing the brains out of the firmware with large LBA48 requests */ static void it821x_dev_config(struct ata_device *adev)
{ unsigned char model_num[ATA_ID_PROD_LEN + 1]; ata_id_c_string(adev->id, model_num, ATA_ID_PROD, sizeof(model_num)); if (adev->max_sectors > 255) adev->max_sectors = 255; if (strstr(model_num, "Integrated Technology Express")) { ata_dev_printk(adev, KERN_INFO, "%sRAID%d volume", adev->id[147]?"Bootable ":""...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Start a peripheral to memory ping-pong DMA transfer. */
Ecode_t DMADRV_PeripheralMemoryPingPong(unsigned int channelId, DMADRV_PeripheralSignal_t peripheralSignal, void *dst0, void *dst1, void *src, bool dstInc, int len, DMADRV_DataSize_t size, DMADRV_Callback_t callback, void *cbUserParam)
/* Start a peripheral to memory ping-pong DMA transfer. */ Ecode_t DMADRV_PeripheralMemoryPingPong(unsigned int channelId, DMADRV_PeripheralSignal_t peripheralSignal, void *dst0, void *dst1, void *src, bool dstInc, int len, DMADRV_DataSize_t size, DMADRV_Callback_t callback, void *cbUserParam)
{ return StartTransfer(dmaModePingPong, dmaDirectionPeripheralToMem, channelId, peripheralSignal, dst0, dst1, src, dstInc, len, ...
eclipse-threadx/getting-started
C++
Other
310
/* Returns the size of the spare area of a page in bytes. */
uint16_t nand_flash_model_get_page_spare_size(const struct nand_flash_model *model)
/* Returns the size of the spare area of a page in bytes. */ uint16_t nand_flash_model_get_page_spare_size(const struct nand_flash_model *model)
{ return (model->page_size_in_bytes >> 5); }
remotemcu/remcu-chip-sdks
C++
null
436
/* if suid or (sgid and xgrp) remove privs */
int should_remove_suid(struct dentry *dentry)
/* if suid or (sgid and xgrp) remove privs */ int should_remove_suid(struct dentry *dentry)
{ mode_t mode = dentry->d_inode->i_mode; int kill = 0; if (unlikely(mode & S_ISUID)) kill = ATTR_KILL_SUID; if (unlikely((mode & S_ISGID) && (mode & S_IXGRP))) kill |= ATTR_KILL_SGID; if (unlikely(kill && !capable(CAP_FSETID) && S_ISREG(mode))) return kill; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Saves the Initial Vector (IV) registers to a user-defined location. */
void AESIVRead(uint32_t ui32Base, uint32_t *pui32IVData)
/* Saves the Initial Vector (IV) registers to a user-defined location. */ void AESIVRead(uint32_t ui32Base, uint32_t *pui32IVData)
{ ASSERT(ui32Base == AES_BASE); while ((AES_CTRL_SVCTXTRDY & (HWREG(ui32Base + AES_O_CTRL))) == 0) { } pui32IVData[0] = HWREG((ui32Base + AES_O_IV_IN_0)); pui32IVData[1] = HWREG((ui32Base + AES_O_IV_IN_1)); pui32IVData[2] = HWREG((ui32Base + AES_O_IV_IN_2)); pui32IVData[3] = HWREG((ui32B...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Fast approximation to the trigonometric sine function for Q31 data. */
q31_t arm_sin_q31(q31_t x)
/* Fast approximation to the trigonometric sine function for Q31 data. */ q31_t arm_sin_q31(q31_t x)
{ q31_t sinVal; int32_t index; q31_t a, b; q31_t fract; if (x < 0) { x = (uint32_t)x + 0x80000000; } index = (uint32_t)x >> FAST_MATH_Q31_SHIFT; fract = (x - (index << FAST_MATH_Q31_SHIFT)) << 9; a = sinTable_q31[index]; b = sinTable_q31[index+1]; sinVal = (q63_t) (0x80000000 - fract) * a >>...
STMicroelectronics/STM32CubeF4
C++
Other
789
/* mux the pin to the "D" internal peripheral role. */
int at91_pio3_set_d_periph(unsigned port, unsigned pin, int use_pullup)
/* mux the pin to the "D" internal peripheral role. */ int at91_pio3_set_d_periph(unsigned port, unsigned pin, int use_pullup)
{ struct at91_port *at91_port = at91_pio_get_port(port); u32 mask; if (at91_port && (pin < GPIO_PER_BANK)) { mask = 1 << pin; writel(mask, &at91_port->idr); at91_set_pio_pullup(port, pin, use_pullup); writel(readl(&at91_port->mux.pio3.abcdsr1) | mask, &at91_port->mux.pio3.abcdsr1); writel(readl(&a...
4ms/stm32mp1-baremetal
C++
Other
137
/* If 32-bit MMIO register operations are not supported, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT32 EFIAPI S3MmioBitFieldWrite32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 Value)
/* If 32-bit MMIO register operations are not supported, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT32 E...
{ return InternalSaveMmioWrite32ValueToBootScript (Address, MmioBitFieldWrite32 (Address, StartBit, EndBit, Value)); }
tianocore/edk2
C++
Other
4,240
/* Function for configuring all peripherals used in this example. */
static void init(void)
/* Function for configuring all peripherals used in this example. */ static void init(void)
{ NRF_RNG->TASKS_START = 1; NRF_CLOCK->EVENTS_HFCLKSTARTED = 0; NRF_CLOCK->TASKS_HFCLKSTART = 1; while (NRF_CLOCK->EVENTS_HFCLKSTARTED == 0) { } }
remotemcu/remcu-chip-sdks
C++
null
436
/* Index = (epnum * 2) + direction - 1, where direction = 0 for OUT, 1 for IN. For control endpoints, the IN index is used (OUT index is unused), so index = (epnum * 2) + direction - 1 = (epnum * 2) + 1 - 1 = (epnum * 2) */
static unsigned int xhci_get_ep_index(struct usb_endpoint_descriptor *desc)
/* Index = (epnum * 2) + direction - 1, where direction = 0 for OUT, 1 for IN. For control endpoints, the IN index is used (OUT index is unused), so index = (epnum * 2) + direction - 1 = (epnum * 2) + 1 - 1 = (epnum * 2) */ static unsigned int xhci_get_ep_index(struct usb_endpoint_descriptor *desc)
{ unsigned int index; if (usb_endpoint_xfer_control(desc)) index = (unsigned int)(usb_endpoint_num(desc) * 2); else index = (unsigned int)((usb_endpoint_num(desc) * 2) - (usb_endpoint_dir_in(desc) ? 0 : 1)); return index; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This function returns a pointer to the volume description or NULL if there are no data about this volume in the scanning information. */
struct ubi_scan_volume* ubi_scan_find_sv(const struct ubi_scan_info *si, int vol_id)
/* This function returns a pointer to the volume description or NULL if there are no data about this volume in the scanning information. */ struct ubi_scan_volume* ubi_scan_find_sv(const struct ubi_scan_info *si, int vol_id)
{ struct ubi_scan_volume *sv; struct rb_node *p = si->volumes.rb_node; while (p) { sv = rb_entry(p, struct ubi_scan_volume, rb); if (vol_id == sv->vol_id) return sv; if (vol_id > sv->vol_id) p = p->rb_left; else p = p->rb_right; } return NULL; }
EmcraftSystems/u-boot
C++
Other
181
/* For non-flyback memory architecture - where one have a single DDR3 x16 memory - it is NOT necessary to perform "Write Leveling" 'Vybrid DDR3 write leveling' */
int ddrmc_calibration(struct ddrmr_regs *ddrmr)
/* For non-flyback memory architecture - where one have a single DDR3 x16 memory - it is NOT necessary to perform "Write Leveling" 'Vybrid DDR3 write leveling' */ int ddrmc_calibration(struct ddrmr_regs *ddrmr)
{ ddrmc_cal_dqs_to_dq(ddrmr); return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* This function save the raw SNR/NF to our internel buffer. */
static void lbs_save_rawSNRNF(struct lbs_private *priv, struct rxpd *p_rx_pd)
/* This function save the raw SNR/NF to our internel buffer. */ static void lbs_save_rawSNRNF(struct lbs_private *priv, struct rxpd *p_rx_pd)
{ if (priv->numSNRNF < DEFAULT_DATA_AVG_FACTOR) priv->numSNRNF++; priv->rawSNR[priv->nextSNRNF] = p_rx_pd->snr; priv->rawNF[priv->nextSNRNF] = p_rx_pd->nf; priv->nextSNRNF++; if (priv->nextSNRNF >= DEFAULT_DATA_AVG_FACTOR) priv->nextSNRNF = 0; return; }
robutest/uclinux
C++
GPL-2.0
60
/* memstick_free_host - free memstick host @host - host to use */
void memstick_free_host(struct memstick_host *host)
/* memstick_free_host - free memstick host @host - host to use */ void memstick_free_host(struct memstick_host *host)
{ mutex_destroy(&host->lock); put_device(&host->dev); }
robutest/uclinux
C++
GPL-2.0
60
/* The range must reside completely on the specified node. */
int __init reserve_bootmem_node(pg_data_t *pgdat, unsigned long physaddr, unsigned long size, int flags)
/* The range must reside completely on the specified node. */ int __init reserve_bootmem_node(pg_data_t *pgdat, unsigned long physaddr, unsigned long size, int flags)
{ unsigned long start, end; start = PFN_DOWN(physaddr); end = PFN_UP(physaddr + size); return mark_bootmem_node(pgdat->bdata, start, end, 1, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* This function must be called before smc_open() if you want to override the default mac address. */
static void smc_set_mac_addr(const unsigned char *addr)
/* This function must be called before smc_open() if you want to override the default mac address. */ static void smc_set_mac_addr(const unsigned char *addr)
{ int i; for (i = 0; i < sizeof (smc_mac_addr); i++) { smc_mac_addr[i] = addr[i]; } }
EmcraftSystems/u-boot
C++
Other
181
/* This is the same as round_jiffies() except that it will never round down. This is useful for timeouts for which the exact time of firing does not matter too much, as long as they don't fire too early. */
unsigned long round_jiffies_up(unsigned long j)
/* This is the same as round_jiffies() except that it will never round down. This is useful for timeouts for which the exact time of firing does not matter too much, as long as they don't fire too early. */ unsigned long round_jiffies_up(unsigned long j)
{ return round_jiffies_common(j, raw_smp_processor_id(), true); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* retval kStatus_Success Started successfully. retval kStatus_CSI_NoFullBuffer There is no full frame buffer in queue. */
status_t CSI_TransferGetFullBuffer(CSI_Type *base, csi_handle_t *handle, uint32_t *frameBuffer)
/* retval kStatus_Success Started successfully. retval kStatus_CSI_NoFullBuffer There is no full frame buffer in queue. */ status_t CSI_TransferGetFullBuffer(CSI_Type *base, csi_handle_t *handle, uint32_t *frameBuffer)
{ uint32_t csicr1; status_t status; uint8_t queueReadIdx; uint8_t queueWriteIdx; queueReadIdx = handle->queueReadIdx; queueWriteIdx = handle->queueWriteIdx; if (queueReadIdx == queueWriteIdx) { status = kStatus_CSI_NoFullBuffer; } else { csicr1 = CSI_REG_CR1(...
eclipse-threadx/getting-started
C++
Other
310
/* Override the weak default implementation and return the last PCIe slot number (max number - 1). */
int board_pcie_last(void)
/* Override the weak default implementation and return the last PCIe slot number (max number - 1). */ int board_pcie_last(void)
{ if (is_405exr()) return 1 - 1; else return 2 - 1; }
EmcraftSystems/u-boot
C++
Other
181
/* Get the element's address when read receive fifo 0. */
static uint32_t MCAN_GetRxFifo0ElementAddress(CAN_Type *base)
/* Get the element's address when read receive fifo 0. */ static uint32_t MCAN_GetRxFifo0ElementAddress(CAN_Type *base)
{ uint32_t eSize; eSize = (base->RXESC & CAN_RXESC_F0DS_MASK) >> CAN_RXESC_F0DS_SHIFT; if (eSize < 5U) { eSize += 4U; } else { eSize = eSize * 4U - 10U; } return (base->RXF0C & CAN_RXF0C_F0SA_MASK) + ((base->RXF0S & CAN_RXF0S_F0GI_MASK) >> CAN_RXF0S_F0GI_SH...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Print the decimal QWORD immediate data to instruction content. */
UINTN EdbPrintImmData64n(IN UINT64 Data64)
/* Print the decimal QWORD immediate data to instruction content. */ UINTN EdbPrintImmData64n(IN UINT64 Data64)
{ EDBSPrintWithOffset ( mInstructionString.Content, EDB_INSTRUCTION_CONTENT_MAX_SIZE, mInstructionContentOffset, L"(%ld)", Data64 ); mInstructionContentOffset = mInstructionContentOffset + 2 + EdbGetBitWidth (Data64); return mInstructionContentOffset; }
tianocore/edk2
C++
Other
4,240
/* appends single string to a packet, incrementing the index */
static uint8_t _mdns_append_string(uint8_t *packet, uint16_t *index, const char *string)
/* appends single string to a packet, incrementing the index */ static uint8_t _mdns_append_string(uint8_t *packet, uint16_t *index, const char *string)
{ uint8_t len = strlen(string); if ((*index + len + 1) >= MDNS_MAX_PACKET_SIZE) { return 0; } _mdns_append_u8(packet, index, len); memcpy(packet + *index, string, len); *index += len; return len + 1; }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* Enables or disables write protection to the specified FMC SDRAM Bank. */
void FMC_SDRAMWriteProtectionConfig(uint32_t SDRAM_Bank, FunctionalState NewState)
/* Enables or disables write protection to the specified FMC SDRAM Bank. */ void FMC_SDRAMWriteProtectionConfig(uint32_t SDRAM_Bank, FunctionalState NewState)
{ assert_param(IS_FUNCTIONAL_STATE(NewState)); assert_param(IS_FMC_SDRAM_BANK(SDRAM_Bank)); if (NewState != DISABLE) { FMC_Bank5_6->SDCR[SDRAM_Bank] |= FMC_Write_Protection_Enable; } else { FMC_Bank5_6->SDCR[SDRAM_Bank] &= SDCR_WriteProtection_RESET; } }
MaJerle/stm32f429
C++
null
2,036
/* Returns: TRUE if the stream was closed successfully. */
gboolean g_input_stream_close_finish(GInputStream *stream, GAsyncResult *result, GError **error)
/* Returns: TRUE if the stream was closed successfully. */ gboolean g_input_stream_close_finish(GInputStream *stream, GAsyncResult *result, GError **error)
{ GInputStreamClass *class; g_return_val_if_fail (G_IS_INPUT_STREAM (stream), FALSE); g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE); if (g_async_result_legacy_propagate_error (result, error)) return FALSE; else if (g_async_result_is_tagged (result, g_input_stream_close_async)) return g_task...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* The region is added if there is space, but in any case we increment the count. If permitted, and the new region overlaps the last one, we merge them. */
static int fdt_add_region(struct fdt_region_state *info, int offset, int size)
/* The region is added if there is space, but in any case we increment the count. If permitted, and the new region overlaps the last one, we merge them. */ static int fdt_add_region(struct fdt_region_state *info, int offset, int size)
{ struct fdt_region *reg; reg = info->region ? &info->region[info->count - 1] : NULL; if (info->can_merge && info->count && info->count <= info->max_regions && reg && offset <= reg->offset + reg->size) { reg->size = offset + size - reg->offset; } else if (info->count++ < info->max_regions) { if (reg) ...
4ms/stm32mp1-baremetal
C++
Other
137
/* Find the best match for a requested image capture size. The best match is chosen as the nearest match that has the same number or fewer pixels as the requested size, or the smallest image size if the requested size has fewer pixels than the smallest image. */
static enum image_size tcm825x_find_size(struct v4l2_int_device *s, unsigned int width, unsigned int height)
/* Find the best match for a requested image capture size. The best match is chosen as the nearest match that has the same number or fewer pixels as the requested size, or the smallest image size if the requested size has fewer pixels than the smallest image. */ static enum image_size tcm825x_find_size(struct v4l2_int...
{ enum image_size isize; unsigned long pixels = width * height; struct tcm825x_sensor *sensor = s->priv; for (isize = subQCIF; isize < VGA; isize++) { if (tcm825x_sizes[isize + 1].height * tcm825x_sizes[isize + 1].width > pixels) { dev_dbg(&sensor->i2c_client->dev, "size %d\n", isize); return isize; ...
robutest/uclinux
C++
GPL-2.0
60
/* Command response callback function for sd_ble_gap_lesc_dhkey_reply BLE command. Callback for decoding the output parameters and the command response return code. */
static uint32_t gap_lesc_dhkey_reply_rsp_dec(const uint8_t *p_buffer, uint16_t length)
/* Command response callback function for sd_ble_gap_lesc_dhkey_reply BLE command. Callback for decoding the output parameters and the command response return code. */ static uint32_t gap_lesc_dhkey_reply_rsp_dec(const uint8_t *p_buffer, uint16_t length)
{ uint32_t result_code = 0; const uint32_t err_code = ble_gap_lesc_dhkey_reply_rsp_dec(p_buffer, length, &result_code); APP_ERROR_CHECK(err_code); return result_code; }
labapart/polymcu
C++
null
201
/* This is called to unpin the inode associated with the inode log item which was previously pinned with a call to xfs_inode_item_pin(). Just call xfs_iunpin() on the inode to do this. */
STATIC void xfs_inode_item_unpin(xfs_inode_log_item_t *iip, int stale)
/* This is called to unpin the inode associated with the inode log item which was previously pinned with a call to xfs_inode_item_pin(). Just call xfs_iunpin() on the inode to do this. */ STATIC void xfs_inode_item_unpin(xfs_inode_log_item_t *iip, int stale)
{ xfs_iunpin(iip->ili_inode); }
robutest/uclinux
C++
GPL-2.0
60
/* wusbhc_pal_register - register the WUSB HC as a UWB PAL @wusbhc: the WUSB HC */
int wusbhc_pal_register(struct wusbhc *wusbhc)
/* wusbhc_pal_register - register the WUSB HC as a UWB PAL @wusbhc: the WUSB HC */ int wusbhc_pal_register(struct wusbhc *wusbhc)
{ uwb_pal_init(&wusbhc->pal); wusbhc->pal.name = "wusbhc"; wusbhc->pal.device = wusbhc->usb_hcd.self.controller; wusbhc->pal.rc = wusbhc->uwb_rc; wusbhc->pal.channel_changed = wusbhc_channel_changed; return uwb_pal_register(&wusbhc->pal); }
robutest/uclinux
C++
GPL-2.0
60
/* This function provides accurate delay (in microseconds) based on variable incremented. */
__weak void ald_delay_us(__IO uint32_t delay)
/* This function provides accurate delay (in microseconds) based on variable incremented. */ __weak void ald_delay_us(__IO uint32_t delay)
{ uint32_t start, now, delta, reload, us_tick; start = SysTick->VAL; reload = SysTick->LOAD; us_tick = ald_cmu_get_sys_clock() / 1000000UL; do { now = SysTick->VAL; delta = (start > now) ? (start - now) : (reload + start - now); } while (delta < (us_tick * delay)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If there is an error, it is returned in @call.err. */
static int apm_bios_call(struct apm_bios_call *call)
/* If there is an error, it is returned in @call.err. */ static int apm_bios_call(struct apm_bios_call *call)
{ return on_cpu0(__apm_bios_call, call); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Cause a processor trigger for a sample sequence of Injected channel. */
void ADCProcessorInjectedTrigger(unsigned long ulBase)
/* Cause a processor trigger for a sample sequence of Injected channel. */ void ADCProcessorInjectedTrigger(unsigned long ulBase)
{ xASSERT((ulBase == ADC1_BASE) || (ulBase == ADC2_BASE) || (ulBase == ADC3_BASE)); xHWREG(ulBase + ADC_CR2) |= ADC_CR2_JSWSTART; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* SCSI_SenseCode Load the last error code in the error list. */
void SCSI_SenseCode(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t sKey, uint8_t ASC)
/* SCSI_SenseCode Load the last error code in the error list. */ void SCSI_SenseCode(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t sKey, uint8_t ASC)
{ UNUSED(lun); USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef *)pdev->pClassData; if (hmsc == NULL) { return; } hmsc->scsi_sense[hmsc->scsi_sense_tail].Skey = sKey; hmsc->scsi_sense[hmsc->scsi_sense_tail].w.b.ASC = ASC; hmsc->scsi_sense[hmsc->scsi_sense_tail].w.b.ASCQ = 0U; hmsc->s...
4ms/stm32mp1-baremetal
C++
Other
137
/* Program a Half Word to FLASH. Status bit polling is used to detect end of operation. */
void flash_program_half_word(uint32_t address, uint16_t data)
/* Program a Half Word to FLASH. Status bit polling is used to detect end of operation. */ void flash_program_half_word(uint32_t address, uint16_t data)
{ flash_wait_for_last_operation(); FLASH_CR |= FLASH_CR_PG; MMIO16(address) = data; flash_wait_for_last_operation(); FLASH_CR &= ~FLASH_CR_PG; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* The time (1 LSB = 1/ODR) interval that starts after the first click detection where the click-detection procedure is disabled, in cases where the device is configured for double-click detection.. */
int32_t lis2dh12_quiet_dur_get(stmdev_ctx_t *ctx, uint8_t *val)
/* The time (1 LSB = 1/ODR) interval that starts after the first click detection where the click-detection procedure is disabled, in cases where the device is configured for double-click detection.. */ int32_t lis2dh12_quiet_dur_get(stmdev_ctx_t *ctx, uint8_t *val)
{ lis2dh12_time_latency_t time_latency; int32_t ret; ret = lis2dh12_read_reg(ctx, LIS2DH12_TIME_LATENCY, (uint8_t *)&time_latency, 1); *val = (uint8_t)time_latency.tla; return ret; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* ADC Read the End-of-Sequence Flag for Injected Conversions. This flag is set after all channels of an injected group have been converted. */
bool adc_eos_injected(uint32_t adc)
/* ADC Read the End-of-Sequence Flag for Injected Conversions. This flag is set after all channels of an injected group have been converted. */ bool adc_eos_injected(uint32_t adc)
{ return ADC_ISR(adc) & ADC_ISR_JEOS; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* DMAMUX Enable DMA Request Synchronization. Enable DMAMUX request synchronization for a given DMA channel, propagating DMA request when configured event edge (DMAREQ_CxCR_SPOL) is detected on previously selected synchronization trigger input id. */
void dmamux_enable_dma_request_sync(uint32_t dmamux, uint8_t channel)
/* DMAMUX Enable DMA Request Synchronization. Enable DMAMUX request synchronization for a given DMA channel, propagating DMA request when configured event edge (DMAREQ_CxCR_SPOL) is detected on previously selected synchronization trigger input id. */ void dmamux_enable_dma_request_sync(uint32_t dmamux, uint8_t channel...
{ DMAMUX_CxCR(dmamux, channel) |= DMAMUX_CxCR_SE; }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Fills each GPIO_InitStruct member with its default value. */
void GPIO_StructInit(GPIO_InitTypeDef *GPIO_InitStruct)
/* Fills each GPIO_InitStruct member with its default value. */ void GPIO_StructInit(GPIO_InitTypeDef *GPIO_InitStruct)
{ GPIO_InitStruct->GPIO_Pin = GPIO_Pin_All; GPIO_InitStruct->GPIO_Mode = GPIO_Mode_IN; GPIO_InitStruct->GPIO_Speed = GPIO_Speed_2MHz; GPIO_InitStruct->GPIO_OType = GPIO_OType_PP; GPIO_InitStruct->GPIO_PuPd = GPIO_PuPd_NOPULL; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* IDL typedef struct { IDL char password; IDL } NT_OWF_PASSWORD; */
static int netlogon_dissect_NT_OWF_PASSWORD(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *parent_tree, dcerpc_info *di, guint8 *drep _U_)
/* IDL typedef struct { IDL char password; IDL } NT_OWF_PASSWORD; */ static int netlogon_dissect_NT_OWF_PASSWORD(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *parent_tree, dcerpc_info *di, guint8 *drep _U_)
{ proto_item *item=NULL; proto_tree *tree=NULL; if(di->conformant_run){ return offset; } if(parent_tree){ tree = proto_tree_add_subtree(parent_tree, tvb, offset, 16, ett_NT_OWF_PASSWORD, &item, "NT_OWF_PASSWORD:"); } proto_tree_add_item(tree...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Function called from I2C IRQ Handler when TXE flag is set Function is in charge of transmit a byte on I2C lines. */
void Slave_Ready_To_Transmit_Callback(void)
/* Function called from I2C IRQ Handler when TXE flag is set Function is in charge of transmit a byte on I2C lines. */ void Slave_Ready_To_Transmit_Callback(void)
{ if(ubSlaveNbDataToTransmit > 0) { LL_I2C_TransmitData8(I2C1, (uint8_t)(*pSlaveTransmitBuffer++)); ubSlaveNbDataToTransmit--; } else { LL_I2C_TransmitData8(I2C1, 0x00); } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Parse out a DHCPv6 option by OptTag, and find the position in buffer. */
EFI_DHCP6_PACKET_OPTION* PxeBcParseDhcp6Options(IN UINT8 *Buffer, IN UINT32 Length, IN UINT16 OptTag)
/* Parse out a DHCPv6 option by OptTag, and find the position in buffer. */ EFI_DHCP6_PACKET_OPTION* PxeBcParseDhcp6Options(IN UINT8 *Buffer, IN UINT32 Length, IN UINT16 OptTag)
{ EFI_DHCP6_PACKET_OPTION *Option; UINT32 Offset; Option = (EFI_DHCP6_PACKET_OPTION *)Buffer; Offset = 0; while (Offset < Length) { if (NTOHS (Option->OpCode) == OptTag) { return Option; } Offset += (NTOHS (Option->OpLen) + 4); Option = (EFI_DHCP6_PACKET_OPTION *)(Buf...
tianocore/edk2
C++
Other
4,240
/* This function computes the value of the highest bit set in the 64-bit value specified by Operand. If Operand is zero, then zero is returned. */
UINT64 EFIAPI GetPowerOfTwo64(IN UINT64 Operand)
/* This function computes the value of the highest bit set in the 64-bit value specified by Operand. If Operand is zero, then zero is returned. */ UINT64 EFIAPI GetPowerOfTwo64(IN UINT64 Operand)
{ if (Operand == 0) { return 0; } return LShiftU64 (1, (UINTN)HighBitSet64 (Operand)); }
tianocore/edk2
C++
Other
4,240
/* Free a list returned by wtap_get_file_extension_type_extensions(), wtap_get_all_file_extensions_list, or wtap_get_file_extensions_list(). */
void wtap_free_extensions_list(GSList *extensions)
/* Free a list returned by wtap_get_file_extension_type_extensions(), wtap_get_all_file_extensions_list, or wtap_get_file_extensions_list(). */ void wtap_free_extensions_list(GSList *extensions)
{ GSList *extension; for (extension = extensions; extension != NULL; extension = g_slist_next(extension)) { g_free(extension->data); } g_slist_free(extensions); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Append the Request element to the Config Request. */
VOID AppendConfigRequest(IN OUT CHAR16 **ConfigRequest, IN OUT UINTN *SpareStrLen, IN CHAR16 *RequestElement)
/* Append the Request element to the Config Request. */ VOID AppendConfigRequest(IN OUT CHAR16 **ConfigRequest, IN OUT UINTN *SpareStrLen, IN CHAR16 *RequestElement)
{ CHAR16 *NewStr; UINTN StringSize; UINTN StrLength; UINTN MaxLen; StrLength = StrLen (RequestElement); StringSize = (*ConfigRequest != NULL) ? StrSize (*ConfigRequest) : sizeof (CHAR16); MaxLen = StringSize / sizeof (CHAR16) + *SpareStrLen; if (StrLength > *SpareStrLen) { MaxLen = Strin...
tianocore/edk2
C++
Other
4,240
/* a3d_adc_open() is the gameport open routine. It refuses to serve any but cooked data. */
static int a3d_adc_open(struct gameport *gameport, int mode)
/* a3d_adc_open() is the gameport open routine. It refuses to serve any but cooked data. */ static int a3d_adc_open(struct gameport *gameport, int mode)
{ struct a3d *a3d = gameport->port_data; if (mode != GAMEPORT_MODE_COOKED) return -1; gameport_start_polling(a3d->gameport); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Initialize the PCI device as required. For the ICH this turns out to be nice and simple. */
static int init_chipset_ich(struct pci_dev *dev)
/* Initialize the PCI device as required. For the ICH this turns out to be nice and simple. */ static int init_chipset_ich(struct pci_dev *dev)
{ u32 extra = 0; pci_read_config_dword(dev, 0x54, &extra); pci_write_config_dword(dev, 0x54, extra | 0x400); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Function for initialiasing the connection instance identified by 'index'. */
static __INLINE void connection_instance_init(uint32_t index)
/* Function for initialiasing the connection instance identified by 'index'. */ static __INLINE void connection_instance_init(uint32_t index)
{ DM_TRC("[DM]: Initializing Connection Instance 0x%08X.\r\n", index); m_connection_table[index].state = STATE_IDLE; m_connection_table[index].conn_handle = BLE_CONN_HANDLE_INVALID; m_connection_table[index].bonded_dev_id = DM_INVALID_ID; memset(&m_connection_table[index].peer_addr, 0, siz...
labapart/polymcu
C++
null
201
/* If id is EDMA_CONT_PARAMS_FIXED_NOT_EXACT then the API initially tries starts looking for a set of contiguous parameter RAMs from the "slot" that is passed as an argument to the API. On failure the API will try to find a set of contiguous Parameter RAM slots from the remaining Parameter RAM slots */
int edma_alloc_cont_slots(unsigned ctlr, unsigned int id, int slot, int count)
/* If id is EDMA_CONT_PARAMS_FIXED_NOT_EXACT then the API initially tries starts looking for a set of contiguous parameter RAMs from the "slot" that is passed as an argument to the API. On failure the API will try to find a set of contiguous Parameter RAM slots from the remaining Parameter RAM slots */ int edma_alloc_...
{ if ((id != EDMA_CONT_PARAMS_ANY) && (slot < edma_cc[ctlr]->num_channels || slot >= edma_cc[ctlr]->num_slots)) return -RT_ERROR; if (count < 1 || count > (edma_cc[ctlr]->num_slots - edma_cc[ctlr]->num_channels)) return -RT_ERROR; switch (id) { case EDMA_CONT_PARA...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This routine does path mtu discovery as defined in RFC1191. */
static void do_pmtu_discovery(struct sock *sk, struct iphdr *iph, u32 mtu)
/* This routine does path mtu discovery as defined in RFC1191. */ static void do_pmtu_discovery(struct sock *sk, struct iphdr *iph, u32 mtu)
{ struct dst_entry *dst; struct inet_sock *inet = inet_sk(sk); if (sk->sk_state == TCP_LISTEN) return; if ((dst = __sk_dst_check(sk, 0)) == NULL) return; dst->ops->update_pmtu(dst, mtu); if (mtu < dst_mtu(dst) && ip_dont_fragment(sk, dst)) sk->sk_err_soft = EMSGSIZE; mtu = dst_mtu(dst); if (inet->pmtudisc...
EmcraftSystems/linux-emcraft
C++
Other
266
/* The callback argument specifies a function that returns a whitespace string or NULL before and after each element. If MXML_NO_CALLBACK is specified, whitespace will only be added before MXML_TEXT nodes with leading whitespace and before attribute names inside opening element tags. */
int mxmlSaveFd(mxml_node_t *node, int fd, mxml_save_cb_t cb)
/* The callback argument specifies a function that returns a whitespace string or NULL before and after each element. If MXML_NO_CALLBACK is specified, whitespace will only be added before MXML_TEXT nodes with leading whitespace and before attribute names inside opening element tags. */ int mxmlSaveFd(mxml_node_t *nod...
{ int col; _mxml_fdbuf_t buf; _mxml_global_t *global = _mxml_global(); buf.fd = fd; buf.current = buf.buffer; buf.end = buf.buffer + sizeof(buf.buffer); if ((col = mxml_write_node(node, &buf, cb, 0, mxml_fd_putc, global)) < 0) return (-1); if (col > 0) if (mxml_fd_putc('\n', &buf) < 0)...
DC-SWAT/DreamShell
C++
null
404
/* Send init stream sequence to card before sending IDLE command */
static void send_init_stream(struct omap_hsmmc_host *host)
/* Send init stream sequence to card before sending IDLE command */ static void send_init_stream(struct omap_hsmmc_host *host)
{ int reg = 0; unsigned long timeout; if (host->protect_card) return; disable_irq(host->irq); OMAP_HSMMC_WRITE(host->base, CON, OMAP_HSMMC_READ(host->base, CON) | INIT_STREAM); OMAP_HSMMC_WRITE(host->base, CMD, INIT_STREAM_CMD); timeout = jiffies + msecs_to_jiffies(MMC_TIMEOUT_MS); while ((reg != CC) && tim...
robutest/uclinux
C++
GPL-2.0
60
/* SPI0 Interrupt Handler. If users want to user the SPI0 Callback feature, Users should promise that the SPI0 Handle in the vector table is SPI0IntHandler. */
void SPI0IntHandler(void)
/* SPI0 Interrupt Handler. If users want to user the SPI0 Callback feature, Users should promise that the SPI0 Handle in the vector table is SPI0IntHandler. */ void SPI0IntHandler(void)
{ unsigned long ulEventFlags; unsigned long ulBase = SPI0_BASE; ulEventFlags = xHWREGB(ulBase + SPI_S); xHWREGB(ulBase + SPI_S) |= (unsigned char)ulEventFlags & 0x40; if(g_pfnSPIHandlerCallbacks[0]) { g_pfnSPIHandlerCallbacks[0](0, 0, ulEventFlags, 0); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Does the counter have nsecs as a unit? */
static int nsec_counter(int counter)
/* Does the counter have nsecs as a unit? */ static int nsec_counter(int counter)
{ if (MATCH_EVENT(SOFTWARE, SW_CPU_CLOCK, counter) || MATCH_EVENT(SOFTWARE, SW_TASK_CLOCK, counter)) return 1; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* @div_m: 1 2 4 8 16 32 64 128 256 */
void hal_pwm_clk_div_m(uint32_t channel_in, uint32_t div_m)
/* @div_m: 1 2 4 8 16 32 64 128 256 */ void hal_pwm_clk_div_m(uint32_t channel_in, uint32_t div_m)
{ unsigned long reg_addr = PWM_BASE + PWM_PCCR_BASE; uint32_t reg_val; uint32_t channel = channel_in / 2; reg_addr += 4 * channel; reg_val = hal_readl(reg_addr); reg_val = SET_REG_VAL(reg_val, PWM_DIV_M_SHIFT, PWM_DIV_M_WIDTH, div_m); hal_writel(reg_val, reg_addr); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Destroys the native window associated with the given SDL window. */
static void destroyWindow(_THIS, SDL_Window *window)
/* Destroys the native window associated with the given SDL window. */ static void destroyWindow(_THIS, SDL_Window *window)
{ window_impl_t *impl = (window_impl_t *)window->driverdata; if (impl) { screen_destroy_window(impl->window); window->driverdata = NULL; } }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This function will add an interface to a function. */
rt_err_t rt_usbd_function_add_interface(ufunction_t func, uintf_t intf)
/* This function will add an interface to a function. */ rt_err_t rt_usbd_function_add_interface(ufunction_t func, uintf_t intf)
{ LOG_D("rt_usbd_function_add_interface"); RT_ASSERT(func != RT_NULL); RT_ASSERT(intf != RT_NULL); rt_list_insert_before(&func->intf_list, &intf->list); return RT_EOK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* brief Enables and sets LDO for High Frequency crystal oscillator. return none Sets Enables and sets LDO for High Frequency crystal oscillator. */
void CLOCK_SetXtalHfLdo(void)
/* brief Enables and sets LDO for High Frequency crystal oscillator. return none Sets Enables and sets LDO for High Frequency crystal oscillator. */ void CLOCK_SetXtalHfLdo(void)
{ uint32_t temp; const uint32_t u32Mask = (ANACTRL_LDO_XO32M_VOUT_MASK | ANACTRL_LDO_XO32M_IBIAS_MASK | ANACTRL_LDO_XO32M_STABMODE_MASK); const uint32_t u32Value = (ANACTRL_LDO_XO32M_VOUT(0x5) | ANACTRL_LDO_XO32M_IBIAS(0x2) | ANACTRL_LDO_XO32M_STABMODE(0x1)); temp = ANACTRL->LDO_XO32M; ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Converts a text device path node to USB CDC data device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbCDCData(CHAR16 *TextDeviceNode)
/* Converts a text device path node to USB CDC data device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbCDCData(CHAR16 *TextDeviceNode)
{ USB_CLASS_TEXT UsbClassText; UsbClassText.ClassExist = FALSE; UsbClassText.Class = USB_CLASS_CDCDATA; UsbClassText.SubClassExist = TRUE; return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); }
tianocore/edk2
C++
Other
4,240
/* param config Pointer to the structure pmu_snvs_dig_config_t. Please refer to pmu_snvs_dig_config_t. */
void PMU_GetSnvsDigLdoDefaultConfig(pmu_snvs_dig_config_t *config)
/* param config Pointer to the structure pmu_snvs_dig_config_t. Please refer to pmu_snvs_dig_config_t. */ void PMU_GetSnvsDigLdoDefaultConfig(pmu_snvs_dig_config_t *config)
{ assert(config != NULL); (void)memset(config, 0, sizeof(*config)); config->mode = kPMU_LowPowerMode; config->chargePumpCurrent = kPMU_SnvsDigChargePump12P5nA; config->dischargeResistorValue = kPMU_SnvsDigDischargeResistor15K; config->trimValue = 0U; confi...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* DxeIpl may have enabled Execute Disable for BSP, APs need to get the status and sync up the settings. If BSP's CR0.Paging is not set, BSP execute Disble feature is not working actually. */
BOOLEAN IsBspExecuteDisableEnabled(VOID)
/* DxeIpl may have enabled Execute Disable for BSP, APs need to get the status and sync up the settings. If BSP's CR0.Paging is not set, BSP execute Disble feature is not working actually. */ BOOLEAN IsBspExecuteDisableEnabled(VOID)
{ UINT32 Eax; CPUID_EXTENDED_CPU_SIG_EDX Edx; MSR_IA32_EFER_REGISTER EferMsr; BOOLEAN Enabled; IA32_CR0 Cr0; Enabled = FALSE; Cr0.UintN = AsmReadCr0 (); if (Cr0.Bits.PG != 0) { AsmCpuid (CPUID_EXTENDED_FUNCTION, &Eax, NULL, NULL, NU...
tianocore/edk2
C++
Other
4,240
/* If @clk has the DELAYED_APP flag set, meaning that parent/rate changes don't take effect until the VALID_CONFIG bit is written, write the VALID_CONFIG bit and wait for the write to complete. No return value. */
static void _omap2xxx_clk_commit(struct clk *clk)
/* If @clk has the DELAYED_APP flag set, meaning that parent/rate changes don't take effect until the VALID_CONFIG bit is written, write the VALID_CONFIG bit and wait for the write to complete. No return value. */ static void _omap2xxx_clk_commit(struct clk *clk)
{ if (!cpu_is_omap24xx()) return; if (!(clk->flags & DELAYED_APP)) return; prm_write_mod_reg(OMAP24XX_VALID_CONFIG, OMAP24XX_GR_MOD, OMAP2_PRCM_CLKCFG_CTRL_OFFSET); prm_read_mod_reg(OMAP24XX_GR_MOD, OMAP2_PRCM_CLKCFG_CTRL_OFFSET); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Note, this read requires the address be aligned to 4 bytes. */
static unsigned ks8851_rdreg32(struct ks8851_net *ks, unsigned reg)
/* Note, this read requires the address be aligned to 4 bytes. */ static unsigned ks8851_rdreg32(struct ks8851_net *ks, unsigned reg)
{ __le32 rx = 0; WARN_ON(reg & 3); ks8851_rdreg(ks, MK_OP(0xf, reg), (u8 *)&rx, 4); return le32_to_cpu(rx); }
robutest/uclinux
C++
GPL-2.0
60
/* Initializes the CEC peripheral according to the specified parameters in the CEC_InitStruct. */
void CEC_Init(CEC_InitTypeDef *CEC_InitStruct)
/* Initializes the CEC peripheral according to the specified parameters in the CEC_InitStruct. */ void CEC_Init(CEC_InitTypeDef *CEC_InitStruct)
{ uint16_t tmpreg = 0; assert_param(IS_CEC_BIT_TIMING_ERROR_MODE(CEC_InitStruct->CEC_BitTimingMode)); assert_param(IS_CEC_BIT_PERIOD_ERROR_MODE(CEC_InitStruct->CEC_BitPeriodMode)); tmpreg = CEC->CFGR; tmpreg &= CFGR_CLEAR_Mask; tmpreg |= (uint16_t)(CEC_InitStruct->CEC_BitTimingMode | CEC_InitStruct->CEC_Bi...
gcallipo/RadioDSP-Stm32f103
C++
Common Creative - Attribution 3.0
51
/* maple_add_packet - add a single instruction to the maple bus queue @mdev: maple device @function: function on device being queried @command: maple command to add @length: length of command string (in 32 bit words) @data: remainder of command string */
int maple_add_packet(struct maple_device *mdev, u32 function, u32 command, size_t length, void *data)
/* maple_add_packet - add a single instruction to the maple bus queue @mdev: maple device @function: function on device being queried @command: maple command to add @length: length of command string (in 32 bit words) @data: remainder of command string */ int maple_add_packet(struct maple_device *mdev, u32 function, u3...
{ int ret = 0; void *sendbuf = NULL; if (length) { sendbuf = kzalloc(length * 4, GFP_KERNEL); if (!sendbuf) { ret = -ENOMEM; goto out; } ((__be32 *)sendbuf)[0] = cpu_to_be32(function); } mdev->mq->command = command; mdev->mq->length = length; if (length > 1) memcpy(sendbuf + 4, data, (length - 1)...
robutest/uclinux
C++
GPL-2.0
60
/* Returns count to indicate the number of pins configured for the given @periph. */
int zynq_slcr_get_mio_pin_status(const char *periph)
/* Returns count to indicate the number of pins configured for the given @periph. */ int zynq_slcr_get_mio_pin_status(const char *periph)
{ const struct zynq_slcr_mio_get_status *mio_ptr; int val, j; int mio = 0; u32 i; for (i = 0; i < ARRAY_SIZE(mio_periphs); i++) { if (strcmp(periph, mio_periphs[i].peri_name) == 0) { mio_ptr = &mio_periphs[i]; for (j = 0; j < mio_ptr->num_pins; j++) { val = readl(&slcr_base->mio_pin [mio_ptr->get...
4ms/stm32mp1-baremetal
C++
Other
137
/* Starts the Low Level portion of the Device driver. */
USBD_StatusTypeDef USBD_LL_Start(USBD_HandleTypeDef *pdev)
/* Starts the Low Level portion of the Device driver. */ USBD_StatusTypeDef USBD_LL_Start(USBD_HandleTypeDef *pdev)
{ HAL_PCD_Start(pdev->pData); return USBD_OK; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* If 64-bit MMIO register operations are not supported, then ASSERT(). If Address is not aligned on a 64-bit boundary, then ASSERT(). If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value ran...
UINT64 EFIAPI MmioBitFieldWrite64(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT64 Value)
/* If 64-bit MMIO register operations are not supported, then ASSERT(). If Address is not aligned on a 64-bit boundary, then ASSERT(). If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value ran...
{ return MmioWrite64 ( Address, BitFieldWrite64 (MmioRead64 (Address), StartBit, EndBit, Value) ); }
tianocore/edk2
C++
Other
4,240
/* Read data from Serial Flash device. This function reads data from the Serial Flash device, into a buffer. */
enum status_code mx25l_read_buffer(uint32_t address, void *data, uint32_t length)
/* Read data from Serial Flash device. This function reads data from the Serial Flash device, into a buffer. */ enum status_code mx25l_read_buffer(uint32_t address, void *data, uint32_t length)
{ enum status_code status; uint8_t tx_buf[4] = { MX25L_CMD_READ, (uint8_t)(address >> 16), (uint8_t)(address >> 8), (uint8_t)(address) }; Assert(data); if ((address + length) > MX25L_FLASH_SIZE) { return STATUS_ERR_INVALID_ARG; } _mx25l_chip_select(); status = spi_write_buffer_wait(&_mx25l_spi, tx_buf...
memfault/zero-to-main
C++
null
200
/* XXX: sfr & willy disagree over whether F_INPROGRESS should be returned to userspace. */
int fcntl_getlease(struct file *filp)
/* XXX: sfr & willy disagree over whether F_INPROGRESS should be returned to userspace. */ int fcntl_getlease(struct file *filp)
{ struct file_lock *fl; int type = F_UNLCK; lock_kernel(); time_out_leases(filp->f_path.dentry->d_inode); for (fl = filp->f_path.dentry->d_inode->i_flock; fl && IS_LEASE(fl); fl = fl->fl_next) { if (fl->fl_file == filp) { type = fl->fl_type & ~F_INPROGRESS; break; } } unlock_kernel(); return type; ...
robutest/uclinux
C++
GPL-2.0
60
/* We use grey instead of black to ensure we can do future scans on the same objects. If we did not do future scans these black objects could potentially contain references to newly allocated objects in the future and we'd end up with false positives. */
static void kmemleak_clear(void)
/* We use grey instead of black to ensure we can do future scans on the same objects. If we did not do future scans these black objects could potentially contain references to newly allocated objects in the future and we'd end up with false positives. */ static void kmemleak_clear(void)
{ struct kmemleak_object *object; unsigned long flags; rcu_read_lock(); list_for_each_entry_rcu(object, &object_list, object_list) { spin_lock_irqsave(&object->lock, flags); if ((object->flags & OBJECT_REPORTED) && unreferenced_object(object)) __paint_it(object, KMEMLEAK_GREY); spin_unlock_irqrestore...
robutest/uclinux
C++
GPL-2.0
60
/* This function is mainly a wrapper around driver_register(). */
int ccwgroup_driver_register(struct ccwgroup_driver *cdriver)
/* This function is mainly a wrapper around driver_register(). */ int ccwgroup_driver_register(struct ccwgroup_driver *cdriver)
{ cdriver->driver.bus = &ccwgroup_bus_type; cdriver->driver.name = cdriver->name; cdriver->driver.owner = cdriver->owner; return driver_register(&cdriver->driver); }
robutest/uclinux
C++
GPL-2.0
60
/* Parse for the next instance of one string within another string. Can optionally make sure that the string was not escaped (^ character) per the shell specification. */
CHAR16* FindNextInstance(IN CONST CHAR16 *SourceString, IN CONST CHAR16 *FindString, IN CONST BOOLEAN CheckForEscapeCharacter)
/* Parse for the next instance of one string within another string. Can optionally make sure that the string was not escaped (^ character) per the shell specification. */ CHAR16* FindNextInstance(IN CONST CHAR16 *SourceString, IN CONST CHAR16 *FindString, IN CONST BOOLEAN CheckForEscapeCharacter)
{ CHAR16 *Temp; if (SourceString == NULL) { return (NULL); } Temp = StrStr (SourceString, FindString); if ((Temp == NULL) || !CheckForEscapeCharacter) { return (Temp); } if ((Temp > (SourceString)) && (*(Temp-1) == L'^')) { return FindNextInstance (Temp+1, FindString, CheckForEscapeCharacter)...
tianocore/edk2
C++
Other
4,240
/* Check if the M24LR64 EEPROM component is ready. */
int32_t M24LR64_IsReady(M24LR64_Object_t *pObj, uint32_t Trials)
/* Check if the M24LR64 EEPROM component is ready. */ int32_t M24LR64_IsReady(M24LR64_Object_t *pObj, uint32_t Trials)
{ return pObj->Ctx.IsReady(pObj->Ctx.handle, Trials); }
eclipse-threadx/getting-started
C++
Other
310
/* sends a piece of data in non-blocking way. */
static void SAI_WriteNonBlocking(I2S_Type *base, uint32_t channel, uint32_t channelMask, uint32_t endChannel, uint32_t bitWidth, uint8_t *buffer, uint32_t size)
/* sends a piece of data in non-blocking way. */ static void SAI_WriteNonBlocking(I2S_Type *base, uint32_t channel, uint32_t channelMask, uint32_t endChannel, uint32_t bitWidth, uint8_t *buffer, uint32_t size)
{ uint32_t i = 0; uint8_t j = 0, m = 0; uint8_t bytesPerWord = bitWidth / 8U; uint32_t data = 0; uint32_t temp = 0; for (i = 0; i < size / bytesPerWord; i++) { for (j = channel; j <= endChannel; j++) { if ((1U << j) & channelMask) { ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Clears the Own Address of the CEC device. */
void CEC_ClearQwnAddress(void)
/* Clears the Own Address of the CEC device. */ void CEC_ClearQwnAddress(void)
{ CEC->CFG = 0x00; }
pikasTech/PikaPython
C++
MIT License
1,403
/* An error must be cleared or Acked to take a FS out of readonly mode. */
void journal_ack_err(journal_t *journal)
/* An error must be cleared or Acked to take a FS out of readonly mode. */ void journal_ack_err(journal_t *journal)
{ spin_lock(&journal->j_state_lock); if (journal->j_errno) journal->j_flags |= JFS_ACK_ERR; spin_unlock(&journal->j_state_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* given a list of ordered sums record them in the inode. This happens at IO completion time based on sums calculated at bio submission time. */
static noinline int add_pending_csums(struct btrfs_trans_handle *trans, struct inode *inode, u64 file_offset, struct list_head *list)
/* given a list of ordered sums record them in the inode. This happens at IO completion time based on sums calculated at bio submission time. */ static noinline int add_pending_csums(struct btrfs_trans_handle *trans, struct inode *inode, u64 file_offset, struct list_head *list)
{ struct btrfs_ordered_sum *sum; btrfs_set_trans_block_group(trans, inode); list_for_each_entry(sum, list, list) { btrfs_csum_file_blocks(trans, BTRFS_I(inode)->root->fs_info->csum_root, sum); } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Configures the number of bytes to be transmitted/received. */
void I2C_ConfigNumberOfBytes(I2C_T *i2c, uint8_t number)
/* Configures the number of bytes to be transmitted/received. */ void I2C_ConfigNumberOfBytes(I2C_T *i2c, uint8_t number)
{ i2c->CTRL2_B.NUMBYT = 0xFF; i2c->CTRL2_B.NUMBYT &= (uint8_t) number ; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Reads the specified ADC conversion result data in dual mode. */
uint32_t ADC_ReadDualModeConversionValue(ADC_T *adc)
/* Reads the specified ADC conversion result data in dual mode. */ uint32_t ADC_ReadDualModeConversionValue(ADC_T *adc)
{ return (*(__IOM uint32_t*) RDG_ADDRESS); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function calculates and returns the nnode number based on the parent's nnode number and the index in parent. */
static int calc_nnode_num_from_parent(const struct ubifs_info *c, struct ubifs_nnode *parent, int iip)
/* This function calculates and returns the nnode number based on the parent's nnode number and the index in parent. */ static int calc_nnode_num_from_parent(const struct ubifs_info *c, struct ubifs_nnode *parent, int iip)
{ int num, shft; if (!parent) return 1; shft = (c->lpt_hght - parent->level) * UBIFS_LPT_FANOUT_SHIFT; num = parent->num ^ (1 << shft); num |= (UBIFS_LPT_FANOUT + iip) << shft; return num; }
EmcraftSystems/u-boot
C++
Other
181
/* helper function for defrag to decide if two blocks pointed to by a node are actually close by */
static int close_blocks(u64 blocknr, u64 other, u32 blocksize)
/* helper function for defrag to decide if two blocks pointed to by a node are actually close by */ static int close_blocks(u64 blocknr, u64 other, u32 blocksize)
{ if (blocknr < other && other - (blocknr + blocksize) < 32768) return 1; if (blocknr > other && blocknr - (other + blocksize) < 32768) return 1; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Reads a CAN message from given mailbox, and put into linux network RX queue, does all housekeeping chores (stats, ...) */
static void at91_read_msg(struct net_device *dev, unsigned int mb)
/* Reads a CAN message from given mailbox, and put into linux network RX queue, does all housekeeping chores (stats, ...) */ static void at91_read_msg(struct net_device *dev, unsigned int mb)
{ struct net_device_stats *stats = &dev->stats; struct can_frame *cf; struct sk_buff *skb; skb = alloc_can_skb(dev, &cf); if (unlikely(!skb)) { stats->rx_dropped++; return; } at91_read_mb(dev, mb, cf); netif_receive_skb(skb); stats->rx_packets++; stats->rx_bytes += cf->can_dlc; }
robutest/uclinux
C++
GPL-2.0
60
/* Return the battery Voltage in milivolts Or < 0 if something fails. */
static int bq27x00_battery_voltage(struct bq27x00_device_info *di)
/* Return the battery Voltage in milivolts Or < 0 if something fails. */ static int bq27x00_battery_voltage(struct bq27x00_device_info *di)
{ int ret; int volt = 0; ret = bq27x00_read(BQ27x00_REG_VOLT, &volt, 0, di); if (ret) { dev_err(di->dev, "error reading voltage\n"); return ret; } return volt; }
robutest/uclinux
C++
GPL-2.0
60
/* Writes a data buffer in flash (data are 32-bit aligned). */
uint32_t FLASH_If_Write(uint32_t Address, uint32_t Data)
/* Writes a data buffer in flash (data are 32-bit aligned). */ uint32_t FLASH_If_Write(uint32_t Address, uint32_t Data)
{ if(Address <= (uint32_t) USER_FLASH_LAST_PAGE_ADDRESS) { if(HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, Address, Data)!= HAL_OK) return (1); } else { return (1); } return (0); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Update CSR register with the measured LSI frequency. */
void BEEP_LSICalibrationConfig(uint32_t LSIFreqHz)
/* Update CSR register with the measured LSI frequency. */ void BEEP_LSICalibrationConfig(uint32_t LSIFreqHz)
{ uint16_t lsifreqkhz; uint16_t A; assert_param(IS_LSI_FREQUENCY(LSIFreqHz)); lsifreqkhz = (uint16_t)(LSIFreqHz / 1000); BEEP->CSR2 &= (uint8_t)(~BEEP_CSR2_BEEPDIV); A = (uint16_t)(lsifreqkhz >> 3U); if ((8U * A) >= ((lsifreqkhz - (8U * A)) * (1U + (2U * A)))) { BEEP->CSR2 |= (uint8_t)(A - 2U); } ...
remotemcu/remcu-chip-sdks
C++
null
436
/* Routine: dram_init Description: sets uboots idea of sdram size */
int dram_init(void)
/* Routine: dram_init Description: sets uboots idea of sdram size */ int dram_init(void)
{ sdram_init(); gd->ram_size = omap_sdram_size(); return 0; }
4ms/stm32mp1-baremetal
C++
Other
137