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
/* This function must not be called if the LIDD interface is currently configured to expect DMA transactions. If DMA was previously used to write to the panel, */
void LCDIDDDataWrite(uint32_t ui32Base, uint32_t ui32CS, uint16_t ui16Data)
/* This function must not be called if the LIDD interface is currently configured to expect DMA transactions. If DMA was previously used to write to the panel, */ void LCDIDDDataWrite(uint32_t ui32Base, uint32_t ui32CS, uint16_t ui16Data)
{ uint32_t ui32Reg; ASSERT(ui32Base == LCD0_BASE); ASSERT((ui32CS == 0) || (ui32CS == 1)); ui32Reg = ui32CS ? LCD_O_LIDDCS1DATA : LCD_O_LIDDCS0DATA; HWREG(ui32Base + ui32Reg) = ui16Data; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* convert a Linux ADFS directory entry to a disk-based directory entry */
static void adfs_obj2dir(struct adfs_direntry *de, struct object_info *obj)
/* convert a Linux ADFS directory entry to a disk-based directory entry */ static void adfs_obj2dir(struct adfs_direntry *de, struct object_info *obj)
{ adfs_writeval(de->dirinddiscadd, 3, obj->file_id); adfs_writeval(de->dirload, 4, obj->loadaddr); adfs_writeval(de->direxec, 4, obj->execaddr); adfs_writeval(de->dirlen, 4, obj->size); de->newdiratts = obj->attr; }
robutest/uclinux
C++
GPL-2.0
60
/* Disable the PWM interrupt of the PWM module. The */
void xPWMIntDisable(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
/* Disable the PWM interrupt of the PWM module. The */ void xPWMIntDisable(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
{ PWMIntDisable(ulBase, ulChannel, ulIntType); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* During system-wide suspend or hibernation device drivers need to be prevented from receiving interrupts and this function is provided for this purpose. It marks all interrupt lines in use, except for the timer ones, as disabled and sets the IRQ_SUSPENDED flag for each of them. */
void suspend_device_irqs(void)
/* During system-wide suspend or hibernation device drivers need to be prevented from receiving interrupts and this function is provided for this purpose. It marks all interrupt lines in use, except for the timer ones, as disabled and sets the IRQ_SUSPENDED flag for each of them. */ void suspend_device_irqs(void)
{ struct irq_desc *desc; int irq; for_each_irq_desc(irq, desc) { unsigned long flags; raw_spin_lock_irqsave(&desc->lock, flags); __disable_irq(desc, irq, true); raw_spin_unlock_irqrestore(&desc->lock, flags); } for_each_irq_desc(irq, desc) if (desc->status & IRQ_SUSPENDED) synchronize_irq(irq); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Lock the Flash Program and Erase Controller Used to prevent spurious writes to FLASH. */
void flash_lock(void)
/* Lock the Flash Program and Erase Controller Used to prevent spurious writes to FLASH. */ void flash_lock(void)
{ FLASH_CR |= FLASH_CR_LOCK; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* This call resets the key, as much as possible, to its default value. That might the value specified in the schema or the one set by the administrator. */
void g_settings_reset(GSettings *settings, const gchar *key)
/* This call resets the key, as much as possible, to its default value. That might the value specified in the schema or the one set by the administrator. */ void g_settings_reset(GSettings *settings, const gchar *key)
{ gchar *path; path = g_strconcat (settings->priv->path, key, NULL); g_settings_backend_reset (settings->priv->backend, path, NULL); g_free (path); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* The toupper function converts a lowercase letter to a corresponding uppercase letter. */
int toupper(IN int c)
/* The toupper function converts a lowercase letter to a corresponding uppercase letter. */ int toupper(IN int c)
{ if ((c >= 'a') && (c <= 'z')) { c = c - ('a' - 'A'); } return c; }
tianocore/edk2
C++
Other
4,240
/* SPI MSP Initialization This function configures the hardware resources used in this example. */
void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
/* SPI MSP Initialization This function configures the hardware resources used in this example. */ void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(hspi->Instance==SPI3) { __HAL_RCC_SPI3_CLK_ENABLE(); __HAL_RCC_GPIOC_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_10|GPIO_PIN_11|GPIO_PIN_12; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = GPIO_AF6_SPI3; HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* little helper function to check whether a given protection domain is a dma_ops domain */
static bool dma_ops_domain(struct protection_domain *domain)
/* little helper function to check whether a given protection domain is a dma_ops domain */ static bool dma_ops_domain(struct protection_domain *domain)
{ return domain->flags & PD_DMA_OPS_MASK; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* In other cases, the page should be locked before running set_page_dirty(). */
int set_page_dirty_lock(struct page *page)
/* In other cases, the page should be locked before running set_page_dirty(). */ int set_page_dirty_lock(struct page *page)
{ int ret; lock_page_nosync(page); ret = set_page_dirty(page); unlock_page(page); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Timer event handler: read a series of scancodes from 8042 and put them into memory scancode buffer. it read as much scancodes to either fill the memory buffer or empty the keyboard buffer. It is registered as running under TPL_NOTIFY */
VOID EFIAPI KeyboardTimerHandler(IN EFI_EVENT Event, IN VOID *Context)
/* Timer event handler: read a series of scancodes from 8042 and put them into memory scancode buffer. it read as much scancodes to either fill the memory buffer or empty the keyboard buffer. It is registered as running under TPL_NOTIFY */ VOID EFIAPI KeyboardTimerHandler(IN EFI_EVENT Event, IN VOID *Context)
{ UINT8 Data; EFI_TPL OldTpl; KEYBOARD_CONSOLE_IN_DEV *ConsoleIn; ConsoleIn = (KEYBOARD_CONSOLE_IN_DEV *)Context; OldTpl = gBS->RaiseTPL (TPL_NOTIFY); if (((KEYBOARD_CONSOLE_IN_DEV *)Context)->KeyboardErr) { gBS->RestoreTPL (OldTpl); return; } while ((KeyReadStatusRegister (ConsoleIn) & (KEYBOARD_STATUS_REGISTER_TRANSMIT_TIMEOUT|KEYBOARD_STATUS_REGISTER_HAS_OUTPUT_DATA)) == KEYBOARD_STATUS_REGISTER_HAS_OUTPUT_DATA ) { Data = KeyReadDataRegister (ConsoleIn); PushScancodeBufTail (&ConsoleIn->ScancodeQueue, Data); } KeyGetchar (ConsoleIn); gBS->RestoreTPL (OldTpl); }
tianocore/edk2
C++
Other
4,240
/* NFS encode functions Encode file handle argument GETATTR, READLINK, STATFS */
static int nfs_xdr_fhandle(struct rpc_rqst *req, __be32 *p, struct nfs_fh *fh)
/* NFS encode functions Encode file handle argument GETATTR, READLINK, STATFS */ static int nfs_xdr_fhandle(struct rpc_rqst *req, __be32 *p, struct nfs_fh *fh)
{ p = xdr_encode_fhandle(p, fh); req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Execute a SET PGID channel program on @cdev to disband a previously established pathgroup. When finished, call ccw_device_disband_done with a return code specifying the result. */
void ccw_device_disband_start(struct ccw_device *cdev)
/* Execute a SET PGID channel program on @cdev to disband a previously established pathgroup. When finished, call ccw_device_disband_done with a return code specifying the result. */ void ccw_device_disband_start(struct ccw_device *cdev)
{ struct subchannel *sch = to_subchannel(cdev->dev.parent); struct ccw_request *req = &cdev->private->req; u8 fn; CIO_TRACE_EVENT(4, "disb"); CIO_HEX_EVENT(4, &cdev->private->dev_id, sizeof(cdev->private->dev_id)); memset(req, 0, sizeof(*req)); req->timeout = PGID_TIMEOUT; req->maxretries = PGID_RETRIES; req->lpm = sch->schib.pmcw.pam & sch->opm; req->callback = disband_callback; fn = SPID_FUNC_DISBAND; if (cdev->private->flags.mpath) fn |= SPID_FUNC_MULTI_PATH; spid_build_cp(cdev, fn); ccw_request_start(cdev); }
robutest/uclinux
C++
GPL-2.0
60
/* Clears any DMA state so the DMA engine is ready to restart with new buffers through omap_start_dma(). Any buffers in flight are discarded. */
void omap_clear_dma(int lch)
/* Clears any DMA state so the DMA engine is ready to restart with new buffers through omap_start_dma(). Any buffers in flight are discarded. */ void omap_clear_dma(int lch)
{ unsigned long flags; local_irq_save(flags); if (cpu_class_is_omap1()) { u32 l; l = dma_read(CCR(lch)); l &= ~OMAP_DMA_CCR_EN; dma_write(l, CCR(lch)); l = dma_read(CSR(lch)); } if (cpu_class_is_omap2()) { int i; void __iomem *lch_base = omap_dma_base + OMAP_DMA4_CH_BASE(lch); for (i = 0; i < 0x44; i += 4) __raw_writel(0, lch_base + i); } local_irq_restore(flags); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* USB port enable callback function from the interrupt. */
static uint8_t usbh_port_enabled(usbh_host *puhost)
/* USB port enable callback function from the interrupt. */ static uint8_t usbh_port_enabled(usbh_host *puhost)
{ usbh_core.host.port_enabled = 1U; return 0U; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Fills each DMA_InitStruct member with its default value. */
void DMA_StructInit(DMA_InitTypeDef *DMA_InitStruct)
/* Fills each DMA_InitStruct member with its default value. */ void DMA_StructInit(DMA_InitTypeDef *DMA_InitStruct)
{ DMA_InitStruct->DMA_Channel = 0; DMA_InitStruct->DMA_PeripheralBaseAddr = 0; DMA_InitStruct->DMA_Memory0BaseAddr = 0; DMA_InitStruct->DMA_DIR = DMA_DIR_PeripheralToMemory; DMA_InitStruct->DMA_BufferSize = 0; DMA_InitStruct->DMA_PeripheralInc = DMA_PeripheralInc_Disable; DMA_InitStruct->DMA_MemoryInc = DMA_MemoryInc_Disable; DMA_InitStruct->DMA_PeripheralDataSize = DMA_PeripheralDataSize_Byte; DMA_InitStruct->DMA_MemoryDataSize = DMA_MemoryDataSize_Byte; DMA_InitStruct->DMA_Mode = DMA_Mode_Normal; DMA_InitStruct->DMA_Priority = DMA_Priority_Low; DMA_InitStruct->DMA_FIFOMode = DMA_FIFOMode_Disable; DMA_InitStruct->DMA_FIFOThreshold = DMA_FIFOThreshold_1QuarterFull; DMA_InitStruct->DMA_MemoryBurst = DMA_MemoryBurst_Single; DMA_InitStruct->DMA_PeripheralBurst = DMA_PeripheralBurst_Single; }
MaJerle/stm32f429
C++
null
2,036
/* Get Guid form the type of non-discoverable device. */
STATIC CONST EFI_GUID* GetGuidFromType(IN NON_DISCOVERABLE_DEVICE_TYPE Type)
/* Get Guid form the type of non-discoverable device. */ STATIC CONST EFI_GUID* GetGuidFromType(IN NON_DISCOVERABLE_DEVICE_TYPE Type)
{ switch (Type) { case NonDiscoverableDeviceTypeAhci: return &gEdkiiNonDiscoverableAhciDeviceGuid; case NonDiscoverableDeviceTypeAmba: return &gEdkiiNonDiscoverableAmbaDeviceGuid; case NonDiscoverableDeviceTypeEhci: return &gEdkiiNonDiscoverableEhciDeviceGuid; case NonDiscoverableDeviceTypeNvme: return &gEdkiiNonDiscoverableNvmeDeviceGuid; case NonDiscoverableDeviceTypeOhci: return &gEdkiiNonDiscoverableOhciDeviceGuid; case NonDiscoverableDeviceTypeSdhci: return &gEdkiiNonDiscoverableSdhciDeviceGuid; case NonDiscoverableDeviceTypeUfs: return &gEdkiiNonDiscoverableUfsDeviceGuid; case NonDiscoverableDeviceTypeUhci: return &gEdkiiNonDiscoverableUhciDeviceGuid; case NonDiscoverableDeviceTypeXhci: return &gEdkiiNonDiscoverableXhciDeviceGuid; default: return NULL; } }
tianocore/edk2
C++
Other
4,240
/* Entry point function initializes global variables and installs notifications. */
EFI_STATUS EFIAPI LoadFileOnFv2Intialize(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* Entry point function initializes global variables and installs notifications. */ EFI_STATUS EFIAPI LoadFileOnFv2Intialize(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ InitializeListHead (&mPrivateDataList); EfiCreateProtocolNotifyEvent ( &gEfiFirmwareVolume2ProtocolGuid, TPL_CALLBACK, FvNotificationEvent, NULL, &mFvRegistration ); EfiCreateProtocolNotifyEvent ( &gLzmaCustomDecompressGuid, TPL_CALLBACK, FvNotificationEvent, NULL, &mFvRegistration ); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Enables or disables the FSMC NAND ECC feature. */
void FSMC_NANDECCCmd(uint32_t FSMC_Bank, FunctionalState NewState)
/* Enables or disables the FSMC NAND ECC feature. */ void FSMC_NANDECCCmd(uint32_t FSMC_Bank, FunctionalState NewState)
{ assert_param(IS_FSMC_NAND_BANK(FSMC_Bank)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { if(FSMC_Bank == FSMC_Bank2_NAND) { FSMC_Bank2->PCR2 |= PCR_ECCEN_SET; } else { FSMC_Bank3->PCR3 |= PCR_ECCEN_SET; } } else { if(FSMC_Bank == FSMC_Bank2_NAND) { FSMC_Bank2->PCR2 &= PCR_ECCEN_RESET; } else { FSMC_Bank3->PCR3 &= PCR_ECCEN_RESET; } } }
MaJerle/stm32f429
C++
null
2,036
/* Get the know the Tx FIFO is Empty or not from the specified port. */
xtBoolean xUARTSpaceAvail(unsigned long ulBase)
/* Get the know the Tx FIFO is Empty or not from the specified port. */ xtBoolean xUARTSpaceAvail(unsigned long ulBase)
{ xASSERT(UARTBaseValid(ulBase)); return((xHWREG(ulBase + UART_FSR) & UART_FSR_TX_EF) ? xtrue : xfalse); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Note, the calculation is pessimistic, which means that most of the time UBIFS reports less space than it actually has. */
long long ubifs_reported_space(const struct ubifs_info *c, long long free)
/* Note, the calculation is pessimistic, which means that most of the time UBIFS reports less space than it actually has. */ long long ubifs_reported_space(const struct ubifs_info *c, long long free)
{ int divisor, factor, f; f = c->fanout > 3 ? c->fanout >> 1 : 2; factor = UBIFS_BLOCK_SIZE; divisor = UBIFS_MAX_DATA_NODE_SZ; divisor += (c->max_idx_node_sz * 3) / (f - 1); free *= factor; return div_u64(free, divisor); }
EmcraftSystems/u-boot
C++
Other
181
/* Deserializes the supplied (wire) buffer into subscribe data */
int MQTTDeserialize_subscribe(unsigned char *dup, unsigned short *packetid, int maxcount, int *count, MQTTString topicFilters[], int requestedQoSs[], unsigned char *buf, int buflen)
/* Deserializes the supplied (wire) buffer into subscribe data */ int MQTTDeserialize_subscribe(unsigned char *dup, unsigned short *packetid, int maxcount, int *count, MQTTString topicFilters[], int requestedQoSs[], unsigned char *buf, int buflen)
{ MQTTHeader header = {0}; unsigned char* curdata = buf; unsigned char* enddata = NULL; int rc = -1; int mylen = 0; FUNC_ENTRY; header.byte = readChar(&curdata); if (header.bits.type != SUBSCRIBE) goto exit; *dup = header.bits.dup; curdata += (rc = MQTTPacket_decodeBuf(curdata, &mylen)); enddata = curdata + mylen; *packetid = readInt(&curdata); *count = 0; while (curdata < enddata) { if (!readMQTTLenString(&topicFilters[*count], &curdata, enddata)) goto exit; if (curdata >= enddata) goto exit; requestedQoSs[*count] = readChar(&curdata); (*count)++; } rc = 1; exit: FUNC_EXIT_RC(rc); return rc; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Parameters: ch FEC channel pa Physical (Hardware) Address for the selected FEC */
static void fec_set_address(const unsigned char *pa)
/* Parameters: ch FEC channel pa Physical (Hardware) Address for the selected FEC */ static void fec_set_address(const unsigned char *pa)
{ unsigned char crc; PALR = (unsigned long)((pa[0]<<24) | (pa[1]<<16) | (pa[2]<<8) | pa[3]); PAUR = (unsigned long)((pa[4]<<24) | (pa[5]<<16)); crc = fec_hash_address(pa); if(crc >= 32) { IAUR |= (unsigned long)(1 << (crc - 32)); } else { IALR |= (unsigned long)(1 << crc); } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Callback indicating the status of a listen() operation */
void btgattc_listen_callback(int status, int server_if)
/* Callback indicating the status of a listen() operation */ void btgattc_listen_callback(int status, int server_if)
{ int index = -1; TLS_BT_APPL_TRACE_VERBOSE("%s, server_if=%d\r\n", __FUNCTION__, server_if); index = get_app_env_index_by_client_if(server_if); if(index<0) { TLS_BT_APPL_TRACE_ERROR("%s, status=%d, server_if=%d\r\n", __FUNCTION__, status, server_if); return; } TLS_HAL_CBACK(app_env[index].ps_callbak, listen_cb, status, server_if); }
Nicholas3388/LuaNode
C++
Other
1,055
/* Worker function to retrieve the number of logical processor in the platform. */
VOID GetNumberOfProcessor(OUT UINTN *NumberOfCpus, OUT UINTN *NumberOfEnabledProcessors)
/* Worker function to retrieve the number of logical processor in the platform. */ VOID GetNumberOfProcessor(OUT UINTN *NumberOfCpus, OUT UINTN *NumberOfEnabledProcessors)
{ EFI_STATUS Status; EFI_MP_SERVICES_PROTOCOL *MpServices; CPU_FEATURES_DATA *CpuFeaturesData; CpuFeaturesData = GetCpuFeaturesData (); MpServices = CpuFeaturesData->MpService.Protocol; Status = MpServices->GetNumberOfProcessors ( MpServices, NumberOfCpus, NumberOfEnabledProcessors ); ASSERT_EFI_ERROR (Status); }
tianocore/edk2
C++
Other
4,240
/* This function is expected to be called in a loop until the entire mbuf chain has been consumed. For example: */
struct os_mbuf* mem_split_frag(struct os_mbuf **om, uint16_t max_frag_sz, mem_frag_alloc_fn *alloc_cb, void *cb_arg)
/* This function is expected to be called in a loop until the entire mbuf chain has been consumed. For example: */ struct os_mbuf* mem_split_frag(struct os_mbuf **om, uint16_t max_frag_sz, mem_frag_alloc_fn *alloc_cb, void *cb_arg)
{ struct os_mbuf *frag; int rc; if (OS_MBUF_PKTLEN(*om) <= max_frag_sz) { frag = *om; *om = NULL; return frag; } frag = alloc_cb(max_frag_sz, cb_arg); if (frag == NULL) { goto err; } rc = os_mbuf_appendfrom(frag, *om, 0, max_frag_sz); if (rc != 0) { goto err; } os_mbuf_adj(*om, max_frag_sz); *om = os_mbuf_trim_front(*om); return frag; err: os_mbuf_free_chain(frag); return NULL; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Unless required by applicable law or agreed to in writing, this software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
static void bt_app_task_handler(void *arg)
/* Unless required by applicable law or agreed to in writing, this software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ static void bt_app_task_handler(void *arg)
{ bt_app_msg_t msg; for (;;) { if (pdTRUE == xQueueReceive(bt_app_task_queue, &msg, (portTickType)portMAX_DELAY)) { ESP_LOGD(BT_APP_CORE_TAG, "%s, sig 0x%x, 0x%x", __func__, msg.sig, msg.event); switch (msg.sig) { case BT_APP_SIG_WORK_DISPATCH: bt_app_work_dispatched(&msg); break; default: ESP_LOGW(BT_APP_CORE_TAG, "%s, unhandled sig: 0x%x", __func__, msg.sig); break; } if (msg.param) { free(msg.param); } } } }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* s3c2410_set_fvco - set the PLL value @cfg: The frequency configuration */
void s3c2410_set_fvco(struct s3c_cpufreq_config *cfg)
/* s3c2410_set_fvco - set the PLL value @cfg: The frequency configuration */ void s3c2410_set_fvco(struct s3c_cpufreq_config *cfg)
{ __raw_writel(cfg->pll.index, S3C2410_MPLLCON); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Do not use memset() to access IO space, use memset_io() instead. */
void* memset(void *s, int c, size_t count)
/* Do not use memset() to access IO space, use memset_io() instead. */ void* memset(void *s, int c, size_t count)
{ char *xs = s; while (count--) *xs++ = c; return s; }
robutest/uclinux
C++
GPL-2.0
60
/* This function sets bus clock frequency of USCI_I2C module. */
uint32_t UI2C_SetBusClockFreq(UI2C_T *ui2c, uint32_t u32BusClock)
/* This function sets bus clock frequency of USCI_I2C module. */ uint32_t UI2C_SetBusClockFreq(UI2C_T *ui2c, uint32_t u32BusClock)
{ uint32_t u32ClkDiv; uint32_t u32Pclk; if( ui2c == UI2C0 ) { u32Pclk = CLK_GetPCLK0Freq(); } else { u32Pclk = CLK_GetPCLK1Freq(); } u32ClkDiv = (uint32_t) ((((((u32Pclk/2U)*10U)/(u32BusClock))+5U)/10U)-1U); ui2c->BRGEN &= ~UI2C_BRGEN_CLKDIV_Msk; ui2c->BRGEN |= (u32ClkDiv << UI2C_BRGEN_CLKDIV_Pos); return ( u32Pclk / ((u32ClkDiv+1U)<<1U) ); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Switch to X plate resistance mode. Set MX to ground, PX to supply. Measure current. */
static unsigned int ucb1400_ts_read_xres(struct ucb1400_ts *ucb)
/* Switch to X plate resistance mode. Set MX to ground, PX to supply. Measure current. */ static unsigned int ucb1400_ts_read_xres(struct ucb1400_ts *ucb)
{ ucb1400_reg_write(ucb->ac97, UCB_TS_CR, UCB_TS_CR_TSMX_GND | UCB_TS_CR_TSPX_POW | UCB_TS_CR_MODE_PRES | UCB_TS_CR_BIAS_ENA); return ucb1400_adc_read(ucb->ac97, 0, adcsync); }
robutest/uclinux
C++
GPL-2.0
60
/* Type 1 and Type 2 protection use the same format: 16 bit guard tag, 16 bit app tag, 32 bit reference tag. */
static void sd_dif_type1_generate(struct blk_integrity_exchg *bix, csum_fn *fn)
/* Type 1 and Type 2 protection use the same format: 16 bit guard tag, 16 bit app tag, 32 bit reference tag. */ static void sd_dif_type1_generate(struct blk_integrity_exchg *bix, csum_fn *fn)
{ void *buf = bix->data_buf; struct sd_dif_tuple *sdt = bix->prot_buf; sector_t sector = bix->sector; unsigned int i; for (i = 0 ; i < bix->data_size ; i += bix->sector_size, sdt++) { sdt->guard_tag = fn(buf, bix->sector_size); sdt->ref_tag = cpu_to_be32(sector & 0xffffffff); sdt->app_tag = 0; buf += bix->sector_size; sector++; } }
robutest/uclinux
C++
GPL-2.0
60
/* configure RCU function , V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */
void rcu_config(void)
/* configure RCU function , V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */ void rcu_config(void)
{ rcu_periph_clock_enable(RCU_GPIOA); rcu_periph_clock_enable(RCU_DAC); }
liuxuming/trochili
C++
Apache License 2.0
132
/* reserve & remap memory space shared between all macs */
static int __devinit bcm_enet_shared_probe(struct platform_device *pdev)
/* reserve & remap memory space shared between all macs */ static int __devinit bcm_enet_shared_probe(struct platform_device *pdev)
{ struct resource *res; unsigned int iomem_size; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) return -ENODEV; iomem_size = res->end - res->start + 1; if (!request_mem_region(res->start, iomem_size, "bcm63xx_enet_dma")) return -EBUSY; bcm_enet_shared_base = ioremap(res->start, iomem_size); if (!bcm_enet_shared_base) { release_mem_region(res->start, iomem_size); return -ENOMEM; } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* If Length > 0 and Buffer is NULL, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). If Buffer is not aligned on a 16-bit boundary, then ASSERT(). If Length is not aligned on a 16-bit boundary, then ASSERT(). */
VOID* EFIAPI SetMem16(OUT VOID *Buffer, IN UINTN Length, IN UINT16 Value)
/* If Length > 0 and Buffer is NULL, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). If Buffer is not aligned on a 16-bit boundary, then ASSERT(). If Length is not aligned on a 16-bit boundary, then ASSERT(). */ VOID* EFIAPI SetMem16(OUT VOID *Buffer, IN UINTN Length, IN UINT16 Value)
{ if (Length == 0) { return Buffer; } ASSERT (Buffer != NULL); ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); ASSERT ((((UINTN)Buffer) & (sizeof (Value) - 1)) == 0); ASSERT ((Length & (sizeof (Value) - 1)) == 0); return InternalMemSetMem16 (Buffer, Length / sizeof (Value), Value); }
tianocore/edk2
C++
Other
4,240
/* Return the UTC offset in seconds west of UTC, adjusted for extra time offset, for a local time value. If ut = lt + LocTimeDiff(lt), then lt = ut - TimeDiff(ut), but the converse does not necessarily hold near daylight savings transitions because some local times are ambiguous. LocTimeDiff(t) equals TimeDiff(t) except near daylight savings transitions. */
static int LocTimeDiff(time_t lt)
/* Return the UTC offset in seconds west of UTC, adjusted for extra time offset, for a local time value. If ut = lt + LocTimeDiff(lt), then lt = ut - TimeDiff(ut), but the converse does not necessarily hold near daylight savings transitions because some local times are ambiguous. LocTimeDiff(t) equals TimeDiff(t) except near daylight savings transitions. */ static int LocTimeDiff(time_t lt)
{ int d = TimeZoneFaster(lt); time_t t = lt + d; if (((t < lt) ^ (d < 0))) t = lt; return TimeZoneFaster(t); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Make sure the single step bit is not set. */
static void singlestep_disable(struct task_struct *child)
/* Make sure the single step bit is not set. */ static void singlestep_disable(struct task_struct *child)
{ unsigned long tmp = get_reg(child, PT_SR) & ~TRACE_BITS; put_reg(child, PT_SR, tmp); clear_tsk_thread_flag(child, TIF_DELAYED_TRACE); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* get_idx_gc_leb - try to get a LEB number from trivial GC. */
static int get_idx_gc_leb(struct ubifs_info *c)
/* get_idx_gc_leb - try to get a LEB number from trivial GC. */ static int get_idx_gc_leb(struct ubifs_info *c)
{ const struct ubifs_lprops *lp; int err, lnum; err = ubifs_get_idx_gc_leb(c); if (err < 0) return err; lnum = err; lp = ubifs_lpt_lookup_dirty(c, lnum); if (IS_ERR(lp)) return PTR_ERR(lp); lp = ubifs_change_lp(c, lp, LPROPS_NC, LPROPS_NC, lp->flags | LPROPS_INDEX, -1); if (IS_ERR(lp)) return PTR_ERR(lp); dbg_find("LEB %d, dirty %d and free %d flags %#x", lp->lnum, lp->dirty, lp->free, lp->flags); return lnum; }
robutest/uclinux
C++
GPL-2.0
60
/* Resets the target leaving it in either download (program) mode or run mode. */
void ResetTarget(ISP_ENVIRONMENT *IspEnvironment, TARGET_MODE mode)
/* Resets the target leaving it in either download (program) mode or run mode. */ void ResetTarget(ISP_ENVIRONMENT *IspEnvironment, TARGET_MODE mode)
{ if (IspEnvironment->ControlLines) { switch (mode) { case PROGRAM_MODE: ControlModemLines(IspEnvironment, 1, 1); Sleep(100); ClearSerialPortBuffers(IspEnvironment); Sleep(100); ControlModemLines(IspEnvironment, 0, 1); Sleep(500); ControlModemLines(IspEnvironment, 0, 0); break; case RUN_MODE: ControlModemLines(IspEnvironment, 1, 0); Sleep(100); ClearSerialPortBuffers(IspEnvironment); Sleep(100); ControlModemLines(IspEnvironment, 0, 0); Sleep(100); break; } } }
microbuilder/LPC11U_LPC13U_CodeBase
C++
Other
54
/* Allocates the number bytes specified by AllocationSize of type EfiBootServicesData and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
VOID* EFIAPI AllocatePool(IN UINTN AllocationSize)
/* Allocates the number bytes specified by AllocationSize of type EfiBootServicesData and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */ VOID* EFIAPI AllocatePool(IN UINTN AllocationSize)
{ VOID *Buffer; Buffer = InternalAllocatePool (EfiBootServicesData, AllocationSize); if (Buffer != NULL) { MemoryProfileLibRecord ( (PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0), MEMORY_PROFILE_ACTION_LIB_ALLOCATE_POOL, EfiBootServicesData, Buffer, AllocationSize, NULL ); } return Buffer; }
tianocore/edk2
C++
Other
4,240
/* The only special thing we need to do here is to make sure that all journal_stop calls result in the superblock being marked dirty, so that sync() will call the filesystem's write_super callback if appropriate. */
int __ext3_journal_stop(const char *where, handle_t *handle)
/* The only special thing we need to do here is to make sure that all journal_stop calls result in the superblock being marked dirty, so that sync() will call the filesystem's write_super callback if appropriate. */ int __ext3_journal_stop(const char *where, handle_t *handle)
{ struct super_block *sb; int err; int rc; sb = handle->h_transaction->t_journal->j_private; err = handle->h_err; rc = journal_stop(handle); if (!err) err = rc; if (err) __ext3_std_error(sb, where, err); return err; }
robutest/uclinux
C++
GPL-2.0
60
/* Check, if the block is bad. Either by reading the bad block table or calling of the scan function. */
static int nand_block_checkbad(struct mtd_info *mtd, loff_t ofs, int getchip, int allowbbt)
/* Check, if the block is bad. Either by reading the bad block table or calling of the scan function. */ static int nand_block_checkbad(struct mtd_info *mtd, loff_t ofs, int getchip, int allowbbt)
{ struct nand_chip *chip = mtd->priv; if (!chip->bbt) return chip->block_bad(mtd, ofs, getchip); return nand_isbad_bbt(mtd, ofs, allowbbt); }
robutest/uclinux
C++
GPL-2.0
60
/* Setup the timer in duty cycle capture mode. */
void timer_duty_cycle_capture_setup(uint32_t timer, bool timer_int_en, enum timer_edge_modes edge_mode, enum timer_loop_modes loop_mode)
/* Setup the timer in duty cycle capture mode. */ void timer_duty_cycle_capture_setup(uint32_t timer, bool timer_int_en, enum timer_edge_modes edge_mode, enum timer_loop_modes loop_mode)
{ timer_setup_internal(timer, timer_int_en, TIMER_MODE_DUTY_CYCLE_CAPTURE, edge_mode, loop_mode, TIMER_CLK_INTERNAL, TIMER_OUTPUT_NONE, TIMER_LEVEL_LOW); }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Enable Snapshot for Event messages. When enabled, snapshot is taken for event messages only (SYNC, Delay_Req, Pdelay_Req or Pdelay_Resp) When disabled, snapshot is taken for all messages except Announce, Management and Signaling. Reserved when "Advanced Time Stamp" is not selected */
void synopGMAC_TS_event_enable(synopGMACdevice *gmacdev)
/* Enable Snapshot for Event messages. When enabled, snapshot is taken for event messages only (SYNC, Delay_Req, Pdelay_Req or Pdelay_Resp) When disabled, snapshot is taken for all messages except Announce, Management and Signaling. Reserved when "Advanced Time Stamp" is not selected */ void synopGMAC_TS_event_enable(synopGMACdevice *gmacdev)
{ synopGMACSetBits(gmacdev->MacBase, GmacTSControl, GmacTSEVNTENA); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Send a request to read or write a GPIO. */
sl_status_t sl_wfx_control_gpio(uint8_t gpio_label, uint8_t gpio_mode, uint32_t *value)
/* Send a request to read or write a GPIO. */ sl_status_t sl_wfx_control_gpio(uint8_t gpio_label, uint8_t gpio_mode, uint32_t *value)
{ sl_status_t result; sl_wfx_control_gpio_cnf_t *reply = NULL; sl_wfx_control_gpio_req_body_t payload; payload.gpio_label = gpio_label; payload.gpio_mode = gpio_mode; result = sl_wfx_send_command(SL_WFX_CONTROL_GPIO_REQ_ID, &payload, sizeof(payload), SL_WFX_STA_INTERFACE, (sl_wfx_generic_confirmation_t **)&reply); if (result == SL_STATUS_OK) { result = sl_wfx_get_status_code(sl_wfx_htole32(reply->body.status), SL_WFX_CONTROL_GPIO_REQ_ID); *value = sl_wfx_htole32(reply->body.value); } return result; }
eclipse-threadx/getting-started
C++
Other
310
/* Note this run in the runner context, and therefore this file should therefore only be built once for all CPUs. */
static uint8_t main_clean_up_trace_wrap(void)
/* Note this run in the runner context, and therefore this file should therefore only be built once for all CPUs. */ static uint8_t main_clean_up_trace_wrap(void)
{ return nsi_exit_inner(0); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* SF Ctrl disable iahb to flash wrap access for XTS mode. */
__WEAK void ATTR_TCM_SECTION bflb_sf_ctrl_disable_wrap_access(uint8_t disable)
/* SF Ctrl disable iahb to flash wrap access for XTS mode. */ __WEAK void ATTR_TCM_SECTION bflb_sf_ctrl_disable_wrap_access(uint8_t disable)
{ uint32_t reg_base = 0; uint32_t regval = 0; reg_base = BFLB_SF_CTRL_BASE; regval = getreg32(reg_base + SF_CTRL_1_OFFSET); if (disable) { regval &= ~SF_CTRL_SF_AHB2SIF_DISWRAP; } else { regval |= SF_CTRL_SF_AHB2SIF_DISWRAP; } putreg32(regval, reg_base+SF_CTRL_1_OFFSET); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* phy_disconnect - disable interrupts, stop state machine, and detach a */
void phy_disconnect(struct phy_device *phydev)
/* phy_disconnect - disable interrupts, stop state machine, and detach a */ void phy_disconnect(struct phy_device *phydev)
{ if (phydev->irq > 0) phy_stop_interrupts(phydev); phy_stop_machine(phydev); phydev->adjust_link = NULL; phy_detach(phydev); }
robutest/uclinux
C++
GPL-2.0
60
/* Determine if the passed address is usable for the ethernet DMA controller. */
static s32_t lpc_packet_addr_notsafe(void *addr)
/* Determine if the passed address is usable for the ethernet DMA controller. */ static s32_t lpc_packet_addr_notsafe(void *addr)
{ return 0; } return 1; }
ajhc/demo-cortex-m3
C++
null
38
/* Disable The VBat Sensor. Disabling this will reduce power consumption from the battery voltage measurement. */
void adc_disable_vbat_sensor(void)
/* Disable The VBat Sensor. Disabling this will reduce power consumption from the battery voltage measurement. */ void adc_disable_vbat_sensor(void)
{ ADC_CCR &= ~ADC_CCR_VBATE; }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Sends one packet of data through the specified USART peripheral. This function operates synchronously, so it only returns when the data has been actually sent. */
void USART_Write(AT91S_USART *usart, unsigned short data, volatile unsigned int timeOut)
/* Sends one packet of data through the specified USART peripheral. This function operates synchronously, so it only returns when the data has been actually sent. */ void USART_Write(AT91S_USART *usart, unsigned short data, volatile unsigned int timeOut)
{ if (timeOut == 0) { while ((usart->US_CSR & AT91C_US_TXEMPTY) == 0); } else { while ((usart->US_CSR & AT91C_US_TXEMPTY) == 0) { if (timeOut == 0) { TRACE_ERROR("USART_Write: Timed out.\n\r"); return; } timeOut--; } } usart->US_THR = data; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* This is used to atomically remove a wait queue entry from the eventfd wait queue head, and read/reset the counter value. */
int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_t *wait, __u64 *cnt)
/* This is used to atomically remove a wait queue entry from the eventfd wait queue head, and read/reset the counter value. */ int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_t *wait, __u64 *cnt)
{ unsigned long flags; spin_lock_irqsave(&ctx->wqh.lock, flags); eventfd_ctx_do_read(ctx, cnt); __remove_wait_queue(&ctx->wqh, wait); if (*cnt != 0 && waitqueue_active(&ctx->wqh)) wake_up_locked_poll(&ctx->wqh, POLLOUT); spin_unlock_irqrestore(&ctx->wqh.lock, flags); return *cnt != 0 ? 0 : -EAGAIN; }
robutest/uclinux
C++
GPL-2.0
60
/* to set the RX FIFO level to trigger RX interrupt/RTS de-assert */
void USI_UARTSetRxLevel(USI_TypeDef *USIx, u32 FifoLv)
/* to set the RX FIFO level to trigger RX interrupt/RTS de-assert */ void USI_UARTSetRxLevel(USI_TypeDef *USIx, u32 FifoLv)
{ assert_param(IS_ALL_USI_PERIPH(USIx)); USIx->RX_FIFO_CTRL &= (~USI_RXFIFO_ALMOST_FULL_TH); USIx->RX_FIFO_CTRL |= FifoLv; USIx->UART_FLOW_CTRL &=(~USI_UART_RX_HOLD_THRD); USIx->UART_FLOW_CTRL |= (FifoLv<<8); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Set the status of a codec GPIO pin */
void wm97xx_set_gpio(struct wm97xx *wm, u32 gpio, enum wm97xx_gpio_status status)
/* Set the status of a codec GPIO pin */ void wm97xx_set_gpio(struct wm97xx *wm, u32 gpio, enum wm97xx_gpio_status status)
{ u16 reg; mutex_lock(&wm->codec_mutex); reg = wm97xx_reg_read(wm, AC97_GPIO_STATUS); if (status & WM97XX_GPIO_HIGH) reg |= gpio; else reg &= ~gpio; if (wm->id == WM9712_ID2 && wm->variant != WM97xx_WM1613) wm97xx_reg_write(wm, AC97_GPIO_STATUS, reg << 1); else wm97xx_reg_write(wm, AC97_GPIO_STATUS, reg); mutex_unlock(&wm->codec_mutex); }
robutest/uclinux
C++
GPL-2.0
60
/* Process the status bits for the received packet and determine if the checksum was computed and verified by the hardware */
static void velocity_rx_csum(struct rx_desc *rd, struct sk_buff *skb)
/* Process the status bits for the received packet and determine if the checksum was computed and verified by the hardware */ static void velocity_rx_csum(struct rx_desc *rd, struct sk_buff *skb)
{ skb->ip_summed = CHECKSUM_NONE; if (rd->rdesc1.CSM & CSM_IPKT) { if (rd->rdesc1.CSM & CSM_IPOK) { if ((rd->rdesc1.CSM & CSM_TCPKT) || (rd->rdesc1.CSM & CSM_UDPKT)) { if (!(rd->rdesc1.CSM & CSM_TUPOK)) return; } skb->ip_summed = CHECKSUM_UNNECESSARY; } } }
robutest/uclinux
C++
GPL-2.0
60
/* This file is part of the uIP TCP/IP stack. */
int int ssystem(const char *fmt,...) __attribute__((__format__(__printf__
/* This file is part of the uIP TCP/IP stack. */ int int ssystem(const char *fmt,...) __attribute__((__format__(__printf__
{ char cmd[128]; va_list ap; va_start(ap, fmt); vsnprintf(cmd, sizeof(cmd), fmt, ap); va_end(ap); printf("%s\n", cmd); fflush(stdout); return system(cmd); }
labapart/polymcu
C++
null
201
/* Disable the PWM interrupt of the PWM module. //! The */
void xPWMIntDisable(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
/* Disable the PWM interrupt of the PWM module. //! The */ void xPWMIntDisable(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
{ xASSERT(ulBase == PWMA_BASE); xASSERT(((ulChannel >= 0) || (ulChannel <= 3))); xASSERT((ulIntType == PWM_INT_CAP_BOTH) || (ulIntType == PWM_INT_CAP_FALL) || (ulIntType == PWM_INT_CAP_RISE) || (ulIntType == PWM_INT_PWM)); if (ulIntType == PWM_INT_PWM) { xHWREG(ulBase + PWM_PIER) &= ~(PWM_PIER_PWMIE0 << ulChannel); } else { xHWREG(ulBase + PWM_CCR0 + (ulChannel >> 1)*4) &= ~(ulIntType << ((ulChannel % 2) ? 16 : 0)); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Read protocol attribute for mutex. See IEEE 1003.1 */
int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *attr, int *protocol)
/* Read protocol attribute for mutex. See IEEE 1003.1 */ int pthread_mutexattr_getprotocol(const pthread_mutexattr_t *attr, int *protocol)
{ *protocol = PTHREAD_PRIO_NONE; return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Description: Returns the cpumask_var_t cpus_allowed of the cpuset attached to the specified @tsk. Guaranteed to return some non-empty subset of cpu_online_map, even if this means going outside the tasks cpuset. */
void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask)
/* Description: Returns the cpumask_var_t cpus_allowed of the cpuset attached to the specified @tsk. Guaranteed to return some non-empty subset of cpu_online_map, even if this means going outside the tasks cpuset. */ void cpuset_cpus_allowed(struct task_struct *tsk, struct cpumask *pmask)
{ mutex_lock(&callback_mutex); cpuset_cpus_allowed_locked(tsk, pmask); mutex_unlock(&callback_mutex); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Register a @watch on the given path, using the given xenbus_watch structure for storage, and the given @callback function as the callback. Return 0 on success, or -errno on error. On success, the given @path will be saved as @watch->node, and remains the caller's to free. On error, @watch->node will be NULL, the device will switch to XenbusStateClosing, and the error will be saved in the store. */
int xenbus_watch_path(struct xenbus_device *dev, const char *path, struct xenbus_watch *watch, void(*callback)(struct xenbus_watch *, const char **, unsigned int))
/* Register a @watch on the given path, using the given xenbus_watch structure for storage, and the given @callback function as the callback. Return 0 on success, or -errno on error. On success, the given @path will be saved as @watch->node, and remains the caller's to free. On error, @watch->node will be NULL, the device will switch to XenbusStateClosing, and the error will be saved in the store. */ int xenbus_watch_path(struct xenbus_device *dev, const char *path, struct xenbus_watch *watch, void(*callback)(struct xenbus_watch *, const char **, unsigned int))
{ int err; watch->node = path; watch->callback = callback; err = register_xenbus_watch(watch); if (err) { watch->node = NULL; watch->callback = NULL; xenbus_dev_fatal(dev, err, "adding watch on %s", path); } return err; }
robutest/uclinux
C++
GPL-2.0
60
/* Advance the current position (read in new data if needed). Delete outdated string info. Find a match string for current position. */
STATIC VOID GetNextMatch(VOID)
/* Advance the current position (read in new data if needed). Delete outdated string info. Find a match string for current position. */ STATIC VOID GetNextMatch(VOID)
{ INT32 Number; mRemainder--; mPos++; if (mPos == WNDSIZ * 2) { memmove (&mText[0], &mText[WNDSIZ], WNDSIZ + MAXMATCH); Number = FreadCrc (&mText[WNDSIZ + MAXMATCH], WNDSIZ); mRemainder += Number; mPos = WNDSIZ; } DeleteNode (); InsertNode (); }
tianocore/edk2
C++
Other
4,240
/* Return: 0 if no error, else returns appropriate error value. */
static int do_rproc_init(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
/* Return: 0 if no error, else returns appropriate error value. */ static int do_rproc_init(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
{ int id; if (rproc_is_initialized()) { printf("\tRemote Processors are already initialized\n"); return CMD_RET_FAILURE; } if (argc == 1) { if (!rproc_init()) return 0; printf("Few Remote Processors failed to be initialized\n"); } else if (argc == 2) { id = (int)simple_strtoul(argv[1], NULL, 10); if (!rproc_dev_init(id)) return 0; printf("Remote Processor %d failed to be initialized\n", id); } return CMD_RET_FAILURE; }
4ms/stm32mp1-baremetal
C++
Other
137
/* set the core to be host mode or device mode through the second input parameter. */
void usb_modeset(LL_USB_TypeDef *USBx, uint8_t mode)
/* set the core to be host mode or device mode through the second input parameter. */ void usb_modeset(LL_USB_TypeDef *USBx, uint8_t mode)
{ if (mode == HOST_MODE) { MODIFY_REG32(USBx->GREGS->GUSBCFG, USBFS_GUSBCFG_FHMOD | USBFS_GUSBCFG_FDMOD, USBFS_GUSBCFG_FHMOD); } else { MODIFY_REG32(USBx->GREGS->GUSBCFG, USBFS_GUSBCFG_FHMOD | USBFS_GUSBCFG_FDMOD, USBFS_GUSBCFG_FDMOD); } usb_mdelay(50UL); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Duplicate implementation of CLOCK_SetMux() provided by SDK. This function must be linked to ITCM, as it will be used to change the clocks of the FLEXSPI and SEMC peripherals. Any function called from this function must also reside in ITCM */
static void clock_set_mux(clock_mux_t mux, uint32_t value)
/* Duplicate implementation of CLOCK_SetMux() provided by SDK. This function must be linked to ITCM, as it will be used to change the clocks of the FLEXSPI and SEMC peripherals. Any function called from this function must also reside in ITCM */ static void clock_set_mux(clock_mux_t mux, uint32_t value)
{ uint32_t busy_shift; busy_shift = (uint32_t)CCM_TUPLE_BUSY_SHIFT(mux); CCM_TUPLE_REG(CCM, mux) = (CCM_TUPLE_REG(CCM, mux) & (~CCM_TUPLE_MASK(mux))) | (((uint32_t)((value) << CCM_TUPLE_SHIFT(mux))) & CCM_TUPLE_MASK(mux)); if (busy_shift != CCM_NO_BUSY_WAIT) { while ((CCM->CDHIPR & ((1UL << busy_shift))) != 0UL) { } } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Copy a page from "oldmem". For this page, there is no pte mapped in the current kernel. We stitch up a pte, similar to kmap_atomic. */
ssize_t copy_oldmem_page(unsigned long pfn, char *buf, size_t csize, unsigned long offset, int userbuf)
/* Copy a page from "oldmem". For this page, there is no pte mapped in the current kernel. We stitch up a pte, similar to kmap_atomic. */ ssize_t copy_oldmem_page(unsigned long pfn, char *buf, size_t csize, unsigned long offset, int userbuf)
{ void *vaddr; if (!csize) return 0; vaddr = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE); if (!vaddr) return -ENOMEM; if (userbuf) { if (copy_to_user(buf, vaddr + offset, csize)) { iounmap(vaddr); return -EFAULT; } } else memcpy(buf, vaddr + offset, csize); iounmap(vaddr); return csize; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* param base TDET peripheral base address param mask Bit mask for the tamper enable bits to be set. return kStatus_Fail when Tamper Enable Register writing is not allowed return kStatus_Success when mask is written to the Tamper Enable Register */
status_t TDET_EnableTampers(DIGTMP_Type *base, uint32_t mask)
/* param base TDET peripheral base address param mask Bit mask for the tamper enable bits to be set. return kStatus_Fail when Tamper Enable Register writing is not allowed return kStatus_Success when mask is written to the Tamper Enable Register */ status_t TDET_EnableTampers(DIGTMP_Type *base, uint32_t mask)
{ status_t status; mask = mask & TDET_ALL_TER_MASK; if (tdet_IsRegisterWriteAllowed(base, DIGTMP_LR_TEL_MASK)) { base->TER |= mask; status = kStatus_Success; } else { status = kStatus_Fail; } return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If Address > 0x0FFFFFFF, then ASSERT(). If the register specified by Address >= 0x100, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, 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(). */
UINT8 EFIAPI PciCf8BitFieldWrite8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 Value)
/* If Address > 0x0FFFFFFF, then ASSERT(). If the register specified by Address >= 0x100, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, 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(). */ UINT8 EFIAPI PciCf8BitFieldWrite8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 Value)
{ BOOLEAN InterruptState; UINT32 AddressPort; UINT8 Result; ASSERT_INVALID_PCI_ADDRESS (Address, 0); InterruptState = SaveAndDisableInterrupts (); AddressPort = IoRead32 (PCI_CONFIGURATION_ADDRESS_PORT); IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, PCI_TO_CF8_ADDRESS (Address)); Result = IoBitFieldWrite8 ( PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 3), StartBit, EndBit, Value ); IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); SetInterruptState (InterruptState); return Result; }
tianocore/edk2
C++
Other
4,240
/* downgrade a write lock into a read lock */
asmregparm struct rw_semaphore* rwsem_downgrade_wake(struct rw_semaphore *sem)
/* downgrade a write lock into a read lock */ asmregparm struct rw_semaphore* rwsem_downgrade_wake(struct rw_semaphore *sem)
{ unsigned long flags; spin_lock_irqsave(&sem->wait_lock, flags); if (!list_empty(&sem->wait_list)) sem = __rwsem_do_wake(sem, 1); spin_unlock_irqrestore(&sem->wait_lock, flags); return sem; }
robutest/uclinux
C++
GPL-2.0
60
/* Reads the GPIO input data(status) for bit. @method GPIO_ReadInputDataBit */
uint8_t GPIO_ReadInputDataBit(GPIO_TypeDef GPIOx, GPIO_Pin_TypeDef GPIO_Pin)
/* Reads the GPIO input data(status) for bit. @method GPIO_ReadInputDataBit */ uint8_t GPIO_ReadInputDataBit(GPIO_TypeDef GPIOx, GPIO_Pin_TypeDef GPIO_Pin)
{ _ASSERT(IS_GPIO_PORT(GPIOx)); _ASSERT(IS_GPIO_PIN_SINGLE(GPIO_Pin)); if (((MGPIO->IN_LEVEL.reg[GPIOx]) & GPIO_Pin) != (uint32_t)Bit_RESET) { return (uint8_t)Bit_SET; } return (uint8_t)Bit_RESET; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Contig tiles -> contig tiles (tile dimension change). */
DECLAREcpFunc(cpContigTiles2ContigStrips)
/* Contig tiles -> contig tiles (tile dimension change). */ DECLAREcpFunc(cpContigTiles2ContigStrips)
{ return cpImage(in, out, readContigTilesIntoBuffer, writeBufferToContigStrips, imagelength, imagewidth, spp); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This routine should be called with the mq_lock held. */
static struct ipc_namespace* __get_ns_from_inode(struct inode *inode)
/* This routine should be called with the mq_lock held. */ static struct ipc_namespace* __get_ns_from_inode(struct inode *inode)
{ return get_ipc_ns(inode->i_sb->s_fs_info); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This constructs a pipe, and sets the read end to be the stdin of the subprocess, and returns the write-end in *@filp. */
int call_usermodehelper_stdinpipe(struct subprocess_info *sub_info, struct file **filp)
/* This constructs a pipe, and sets the read end to be the stdin of the subprocess, and returns the write-end in *@filp. */ int call_usermodehelper_stdinpipe(struct subprocess_info *sub_info, struct file **filp)
{ struct file *f; f = create_write_pipe(0); if (IS_ERR(f)) return PTR_ERR(f); *filp = f; f = create_read_pipe(f, 0); if (IS_ERR(f)) { free_write_pipe(*filp); return PTR_ERR(f); } sub_info->stdin = f; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Write buf to the IFC NAND Controller Data Buffer */
static void fsl_ifc_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
/* Write buf to the IFC NAND Controller Data Buffer */ static void fsl_ifc_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
{ struct nand_chip *chip = mtd_to_nand(mtd); struct fsl_ifc_mtd *priv = nand_get_controller_data(chip); struct fsl_ifc_ctrl *ctrl = priv->ctrl; unsigned int bufsize = mtd->writesize + mtd->oobsize; if (len <= 0) { printf("%s of %d bytes", __func__, len); ctrl->status = 0; return; } if ((unsigned int)len > bufsize - ctrl->index) { printf("%s beyond end of buffer " "(%d requested, %u available)\n", __func__, len, bufsize - ctrl->index); len = bufsize - ctrl->index; } memcpy_toio(ctrl->addr + ctrl->index, buf, len); ctrl->index += len; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Un-Register the Service B.5 and all its Characteristics... */
void service_b_5_1_remove(void)
/* Un-Register the Service B.5 and all its Characteristics... */ void service_b_5_1_remove(void)
{ bt_gatt_service_unregister(&service_b_5_1_svc); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* When a custom interrupt controller is used (i.e. CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER is enabled), the architecture interrupt control functions are mapped to the SoC layer in */
void arch_irq_enable(unsigned int irq)
/* When a custom interrupt controller is used (i.e. CONFIG_ARM_CUSTOM_INTERRUPT_CONTROLLER is enabled), the architecture interrupt control functions are mapped to the SoC layer in */ void arch_irq_enable(unsigned int irq)
{ arm_gic_irq_enable(irq); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This is only a psuedo I2C interface. We can't use the standard kernel routines as the interface is write only. We just assume the data is acked... */
static void lcdtg_ssp_i2c_send(u8 data)
/* This is only a psuedo I2C interface. We can't use the standard kernel routines as the interface is write only. We just assume the data is acked... */ static void lcdtg_ssp_i2c_send(u8 data)
{ corgi_ssp_lcdtg_send(POWERREG0_ADRS, data); udelay(10); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Flushes an endpoint of the Low Level Driver. */
USBD_StatusTypeDef USBD_LL_FlushEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
/* Flushes an endpoint of the Low Level Driver. */ USBD_StatusTypeDef USBD_LL_FlushEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
{ HAL_StatusTypeDef hal_status = HAL_OK; USBD_StatusTypeDef usb_status = USBD_OK; hal_status = HAL_PCD_EP_Flush(pdev->pData, ep_addr); usb_status = USBD_Get_USB_Status(hal_status); return usb_status; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* See mss_uart.h for details of how to use this function. */
void MSS_UART_disable_half_duplex(mss_uart_instance_t *this_uart)
/* See mss_uart.h for details of how to use this function. */ void MSS_UART_disable_half_duplex(mss_uart_instance_t *this_uart)
{ ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)); if((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) { clear_bit_reg8(&this_uart->hw_reg->MM2,ESWM); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Find a client by IP address and protocol version */
struct nfs_client* nfs_find_client_next(struct nfs_client *clp)
/* Find a client by IP address and protocol version */ struct nfs_client* nfs_find_client_next(struct nfs_client *clp)
{ struct sockaddr *sap = (struct sockaddr *)&clp->cl_addr; u32 nfsvers = clp->rpc_ops->version; spin_lock(&nfs_client_lock); list_for_each_entry_continue(clp, &nfs_client_list, cl_share_link) { struct sockaddr *clap = (struct sockaddr *)&clp->cl_addr; if (clp->cl_cons_state != NFS_CS_READY) continue; if (clp->rpc_ops->version != nfsvers) continue; if (!nfs_sockaddr_match_ipaddr(sap, clap)) continue; atomic_inc(&clp->cl_count); spin_unlock(&nfs_client_lock); return clp; } spin_unlock(&nfs_client_lock); return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Lock the volume. If the lock is already in the acquired state, then EFI_ACCESS_DENIED is returned. Otherwise, EFI_SUCCESS is returned. */
EFI_STATUS FatAcquireLockOrFail(VOID)
/* Lock the volume. If the lock is already in the acquired state, then EFI_ACCESS_DENIED is returned. Otherwise, EFI_SUCCESS is returned. */ EFI_STATUS FatAcquireLockOrFail(VOID)
{ return EfiAcquireLockOrFail (&FatFsLock); }
tianocore/edk2
C++
Other
4,240
/* The constructor function enables ACPI IO space, and caches PerformanceCounterFrequency. */
EFI_STATUS CommonAcpiTimerLibConstructor(VOID)
/* The constructor function enables ACPI IO space, and caches PerformanceCounterFrequency. */ EFI_STATUS CommonAcpiTimerLibConstructor(VOID)
{ EFI_HOB_GUID_TYPE *GuidHob; AcpiTimerLibConstructor (); GuidHob = GetFirstGuidHob (&mFrequencyHobGuid); if (GuidHob != NULL) { mAcpiTimerLibTscFrequency = *(UINT64 *)GET_GUID_HOB_DATA (GuidHob); } else { mAcpiTimerLibTscFrequency = InternalCalculateTscFrequency (); } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* param base MU peripheral base address. param regIndex RX register index. return The received message. */
uint32_t MU_ReceiveMsg(MU_Type *base, uint32_t regIndex)
/* param base MU peripheral base address. param regIndex RX register index. return The received message. */ uint32_t MU_ReceiveMsg(MU_Type *base, uint32_t regIndex)
{ assert(regIndex < MU_TR_COUNT); while (0U == (base->SR & (((uint32_t)kMU_Rx0FullFlag) >> regIndex))) { ; } return base->RR[regIndex]; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The asyncronous methods have a default fallback that uses threads to implement asynchronicity, so they are optional for inheriting classes. However, if you override one you must override all. */
void g_output_stream_close_async(GOutputStream *stream, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
/* The asyncronous methods have a default fallback that uses threads to implement asynchronicity, so they are optional for inheriting classes. However, if you override one you must override all. */ void g_output_stream_close_async(GOutputStream *stream, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
{ GTask *task; GError *error = NULL; g_return_if_fail (G_IS_OUTPUT_STREAM (stream)); task = g_task_new (stream, cancellable, callback, user_data); g_task_set_source_tag (task, g_output_stream_close_async); g_task_set_priority (task, io_priority); if (!g_output_stream_set_pending (stream, &error)) { g_task_return_error (task, error); g_object_unref (task); return; } g_output_stream_internal_close_async (stream, io_priority, cancellable, real_close_async_cb, task); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Retrieves a Unicode string that is the user-readable name of the EFI Driver. */
EFI_STATUS EFIAPI RedfishRestExComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
/* Retrieves a Unicode string that is the user-readable name of the EFI Driver. */ EFI_STATUS EFIAPI RedfishRestExComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
{ return LookupUnicodeString2 ( Language, This->SupportedLanguages, mRedfishRestExDriverNameTable, DriverName, (BOOLEAN)(This == &gRedfishRestExComponentName) ); }
tianocore/edk2
C++
Other
4,240
/* Get the computed CRC value of the subsequently transmitted bytes of the specified SPI port. */
unsigned long SPITXCRCGet(unsigned long ulBase)
/* Get the computed CRC value of the subsequently transmitted bytes of the specified SPI port. */ unsigned long SPITXCRCGet(unsigned long ulBase)
{ xASSERT((ulBase == SPI3_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE)); return xHWREG(ulBase + SPI_TXCRCR); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* fix_mac_address - Fix for Mac addr problem on Alpha platforms @sp: Pointer to device specifc structure Description : New procedure to clear mac address reading problems on Alpha platforms */
static void fix_mac_address(struct s2io_nic *sp)
/* fix_mac_address - Fix for Mac addr problem on Alpha platforms @sp: Pointer to device specifc structure Description : New procedure to clear mac address reading problems on Alpha platforms */ static void fix_mac_address(struct s2io_nic *sp)
{ struct XENA_dev_config __iomem *bar0 = sp->bar0; u64 val64; int i = 0; while (fix_mac[i] != END_SIGN) { writeq(fix_mac[i++], &bar0->gpio_control); udelay(10); val64 = readq(&bar0->gpio_control); } }
robutest/uclinux
C++
GPL-2.0
60
/* The resulting QEMUIOVector has heap-allocated iovecs and must be cleaned up with qemu_iovec_destroy(). */
static void v9fs_init_qiov_from_pdu(QEMUIOVector *qiov, V9fsPDU *pdu, size_t skip, size_t size, bool is_write)
/* The resulting QEMUIOVector has heap-allocated iovecs and must be cleaned up with qemu_iovec_destroy(). */ static void v9fs_init_qiov_from_pdu(QEMUIOVector *qiov, V9fsPDU *pdu, size_t skip, size_t size, bool is_write)
{ QEMUIOVector elem; struct iovec *iov; unsigned int niov; if (is_write) { iov = pdu->elem.out_sg; niov = pdu->elem.out_num; } else { iov = pdu->elem.in_sg; niov = pdu->elem.in_num; } qemu_iovec_init_external(&elem, iov, niov); qemu_iovec_init(qiov, niov); qemu_iovec_concat(qiov, &elem, skip, size); }
ve3wwg/teensy3_qemu
C++
Other
15
/* Initialize the marker reader module. This is called only once, when the decompression object is created. */
jinit_marker_reader(j_decompress_ptr cinfo)
/* Initialize the marker reader module. This is called only once, when the decompression object is created. */ jinit_marker_reader(j_decompress_ptr cinfo)
{ my_marker_ptr marker; int i; marker = (my_marker_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, SIZEOF(my_marker_reader)); cinfo->marker = &marker->pub; marker->pub.reset_marker_reader = reset_marker_reader; marker->pub.read_markers = read_markers; marker->pub.read_restart_marker = read_restart_marker; marker->process_COM = skip_variable; marker->length_limit_COM = 0; for (i = 0; i < 16; i++) { marker->process_APPn[i] = skip_variable; marker->length_limit_APPn[i] = 0; } marker->process_APPn[0] = get_interesting_appn; marker->process_APPn[14] = get_interesting_appn; reset_marker_reader(cinfo); }
xboot/xboot
C++
MIT License
779
/* UART 3 interrupt handler. This function is the UART interrupt handler, it simple execute the callback function if there be one. */
void UART3IntHandler(void)
/* UART 3 interrupt handler. This function is the UART interrupt handler, it simple execute the callback function if there be one. */ void UART3IntHandler(void)
{ if(g_pfnWDTHandlerCallbacks != 0) { g_pfnWDTHandlerCallbacks[3](0, 0, 0, 0); } else { while(1); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* The destructor function frees any allocated buffers and closes the Set Virtual Address Map event. */
EFI_STATUS EFIAPI DxeRuntimePciExpressLibDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The destructor function frees any allocated buffers and closes the Set Virtual Address Map event. */ EFI_STATUS EFIAPI DxeRuntimePciExpressLibDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; if (mDxeRuntimePciExpressLibRegistrationTable != NULL) { FreePool (mDxeRuntimePciExpressLibRegistrationTable); } Status = gBS->CloseEvent (mDxeRuntimePciExpressLibVirtualNotifyEvent); ASSERT_EFI_ERROR (Status); return Status; }
tianocore/edk2
C++
Other
4,240
/* ISR to manage timeouts whilst processing a V2Protocol command */
ISR(TIMER0_COMPA_vect, ISR_NOBLOCK)
/* ISR to manage timeouts whilst processing a V2Protocol command */ ISR(TIMER0_COMPA_vect, ISR_NOBLOCK)
{ if (TimeoutTicksRemaining) TimeoutTicksRemaining--; else TCCR0B = 0; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Programs a half word at a specified address. */
FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data)
/* Programs a half word at a specified address. */ FLASH_Status FLASH_ProgramHalfWord(uint32_t Address, uint16_t Data)
{ FLASH_Status status = FLASH_COMPLETE; assert_param(IS_FLASH_PROGRAM_ADDRESS(Address)); status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT); if(status == FLASH_COMPLETE) { FLASH->CR |= FLASH_CR_PG; *(__IO uint16_t*)Address = Data; status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT); FLASH->CR &= ~FLASH_CR_PG; } return status; }
ajhc/demo-cortex-m3
C++
null
38
/* Resets a network adapter and re-initializes it with the parameters that were provided in the previous call to Initialize(). */
EFI_STATUS EFIAPI EmuSnpReset(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
/* Resets a network adapter and re-initializes it with the parameters that were provided in the previous call to Initialize(). */ EFI_STATUS EFIAPI EmuSnpReset(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
{ EFI_STATUS Status; EMU_SNP_PRIVATE_DATA *Private; Private = EMU_SNP_PRIVATE_DATA_FROM_SNP_THIS (This); Status = Private->Io->Reset (Private->Io, ExtendedVerification); return Status; }
tianocore/edk2
C++
Other
4,240
/* Writes a data byte to the I2C transmit FIFO. */
void I2CFIFODataPut(uint32_t ui32Base, uint8_t ui8Data)
/* Writes a data byte to the I2C transmit FIFO. */ void I2CFIFODataPut(uint32_t ui32Base, uint8_t ui8Data)
{ ASSERT(_I2CBaseValid(ui32Base)); while(HWREG(ui32Base + I2C_O_FIFOSTATUS) & I2C_FIFOSTATUS_TXFF) { } HWREG(ui32Base + I2C_O_FIFODATA) = ui8Data; }
micropython/micropython
C++
Other
18,334
/* This function get filter structure by SMBIOS type. */
SMBIOS_FILTER_STRUCT* GetFilterStructByType(IN UINT8 Type)
/* This function get filter structure by SMBIOS type. */ SMBIOS_FILTER_STRUCT* GetFilterStructByType(IN UINT8 Type)
{ UINTN Index; for (Index = 0; Index < sizeof (mSmbiosFilterStandardTableBlackList)/sizeof (mSmbiosFilterStandardTableBlackList[0]); Index++) { if (mSmbiosFilterStandardTableBlackList[Index].Type == Type) { return &mSmbiosFilterStandardTableBlackList[Index]; } } return NULL; }
tianocore/edk2
C++
Other
4,240
/* Sets the color of the RGB LEDs. The brightness of the LEDs is almost linear to the color value. */
void BOARD_rgbledSetColor(uint8_t red, uint8_t green, uint8_t blue)
/* Sets the color of the RGB LEDs. The brightness of the LEDs is almost linear to the color value. */ void BOARD_rgbledSetColor(uint8_t red, uint8_t green, uint8_t blue)
{ BOARD_rgbledSetRawColor( 256 * (uint16_t)lightLevels[red], 256 * (uint16_t)lightLevels[green], 256 * (uint16_t)lightLevels[blue] ); return; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Only first 64MB of memory can be accessed via PCI. We use GFP_DMA to allocate safe buffers to do map/unmap. This is really ugly and we need a better way of specifying DMA-capable regions of memory. */
void __init ixp4xx_adjust_zones(int node, unsigned long *zone_size, unsigned long *zhole_size)
/* Only first 64MB of memory can be accessed via PCI. We use GFP_DMA to allocate safe buffers to do map/unmap. This is really ugly and we need a better way of specifying DMA-capable regions of memory. */ void __init ixp4xx_adjust_zones(int node, unsigned long *zone_size, unsigned long *zhole_size)
{ unsigned int sz = SZ_64M >> PAGE_SHIFT; if (node || (zone_size[0] <= sz)) return; zone_size[1] = zone_size[0] - sz; zone_size[0] = sz; zhole_size[1] = zhole_size[0]; zhole_size[0] = 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* convert gpio offset to gpio index taking into account gpio holes into gpio bank */
int stm32_offset_to_index(struct udevice *dev, unsigned int offset)
/* convert gpio offset to gpio index taking into account gpio holes into gpio bank */ int stm32_offset_to_index(struct udevice *dev, unsigned int offset)
{ struct stm32_gpio_priv *priv = dev_get_priv(dev); unsigned int idx = 0; int i; for (i = 0; i < STM32_GPIOS_PER_BANK; i++) { if (priv->gpio_range & BIT(i)) { if (idx == offset) return idx; idx++; } } return -EINVAL; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Master command code used for stamping for sensor sync.. */
int32_t lsm6dsl_sh_cmd_sens_sync_get(stmdev_ctx_t *ctx, uint8_t *val)
/* Master command code used for stamping for sensor sync.. */ int32_t lsm6dsl_sh_cmd_sens_sync_get(stmdev_ctx_t *ctx, uint8_t *val)
{ lsm6dsl_master_cmd_code_t master_cmd_code; int32_t ret; ret = lsm6dsl_read_reg(ctx, LSM6DSL_MASTER_CMD_CODE, (uint8_t*)&master_cmd_code, 1); *val = master_cmd_code.master_cmd_code; return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Memory Initialization Driver. This function is called to perform Memory initialization of selected RAM's. */
void memoryInit(uint32 ram)
/* Memory Initialization Driver. This function is called to perform Memory initialization of selected RAM's. */ void memoryInit(uint32 ram)
{ systemREG1->MINITGCR = 0xAU; systemREG1->MSINENA = ram; while((systemREG1->MSTCGSTAT & 0x00000100U) != 0x00000100U) { } systemREG1->MINITGCR = 0x5U; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535