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
/* The discovery of one neighbor does not affect the other, but if the discovery of a neighbor fails it is removed from the neighborhood cache. */
static int wlp_discover_all_neighbors(struct wlp *wlp)
/* The discovery of one neighbor does not affect the other, but if the discovery of a neighbor fails it is removed from the neighborhood cache. */ static int wlp_discover_all_neighbors(struct wlp *wlp)
{ int result = 0; struct device *dev = &wlp->rc->uwb_dev.dev; struct wlp_neighbor_e *neighbor, *next; list_for_each_entry_safe(neighbor, next, &wlp->neighbors, node) { result = wlp_discover_neighbor(wlp, neighbor); if (result < 0) { dev_err(dev, "WLP: Unable to discover neighbor " "%02x:%02x, removing from neighborhood. \n", neighbor->uwb_dev->dev_addr.data[1], neighbor->uwb_dev->dev_addr.data[0]); __wlp_neighbor_release(neighbor); } } return result; }
robutest/uclinux
C++
GPL-2.0
60
/* Converts a UINT32 from host byte order to network byte order. Then copy it to the byte stream. */
VOID EFIAPI NetPutUint32(IN OUT UINT8 *Buf, IN UINT32 Data)
/* Converts a UINT32 from host byte order to network byte order. Then copy it to the byte stream. */ VOID EFIAPI NetPutUint32(IN OUT UINT8 *Buf, IN UINT32 Data)
{ ASSERT (Buf != NULL); Data = HTONL (Data); CopyMem (Buf, &Data, sizeof (UINT32)); }
tianocore/edk2
C++
Other
4,240
/* Sets the value of the RTC predivider trim register. */
void HibernateRTCTrimSet(unsigned long ulTrim)
/* Sets the value of the RTC predivider trim register. */ void HibernateRTCTrimSet(unsigned long ulTrim)
{ ASSERT(ulTrim < 0x10000); HWREG(HIB_RTCT) = ulTrim; if(CLASS_IS_FURY) { SysCtlDelay(g_ulWriteDelay); } else { HibernateWriteComplete(); } }
watterott/WebRadio
C++
null
71
/* If Address > 0x0FFFFFFF, then ASSERT(). If the register specified by Address >= 0x100, then ASSERT(). */
UINT8 EFIAPI PciCf8And8(IN UINTN Address, IN UINT8 AndData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If the register specified by Address >= 0x100, then ASSERT(). */ UINT8 EFIAPI PciCf8And8(IN UINTN Address, IN UINT8 AndData)
{ 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 = IoAnd8 ( PCI_CONFIGURATION_DATA_PORT + (UINT16)(Address & 3), AndData ); IoWrite32 (PCI_CONFIGURATION_ADDRESS_PORT, AddressPort); SetInterruptState (InterruptState); return Result; }
tianocore/edk2
C++
Other
4,240
/* Clears or safeguards the OCREF2 signal on an external event. */
void TIM_ClrOc2Ref(TIM_Module *TIMx, uint16_t TIM_OCClear)
/* Clears or safeguards the OCREF2 signal on an external event. */ void TIM_ClrOc2Ref(TIM_Module *TIMx, uint16_t TIM_OCClear)
{ uint16_t tmpccmr1 = 0; assert_param(IsTimList3Module(TIMx)); assert_param(IsTimOcClrState(TIM_OCClear)); tmpccmr1 = TIMx->CCMOD1; tmpccmr1 &= (uint16_t) ~((uint16_t)TIM_CCMOD1_OC2CEN); tmpccmr1 |= (uint16_t)(TIM_OCClear << 8); TIMx->CCMOD1 = tmpccmr1; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Sets or resets the update interrupt flag (UIF)status bit Remapping. when sets, reading TIMx_CNT register returns UIF bit instead of CNT */
void TIM_UIFRemap(TIM_TypeDef *TIMx, FunctionalState NewState)
/* Sets or resets the update interrupt flag (UIF)status bit Remapping. when sets, reading TIMx_CNT register returns UIF bit instead of CNT */ void TIM_UIFRemap(TIM_TypeDef *TIMx, FunctionalState NewState)
{ assert_param(IS_TIM_ALL_PERIPH(TIMx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { TIMx->CR1 |= TIM_CR1_UIFREMAP; } else { TIMx->CR1 &= (uint16_t)~TIM_CR1_UIFREMAP; } }
ajhc/demo-cortex-m3
C++
null
38
/* The phy may be powered down to save power and turn off link when the driver is unloaded and wake on lan is not enabled (among others) *** this routine MUST be followed by a call to e1000e_reset *** */
void e1000e_power_up_phy(struct e1000_adapter *adapter)
/* The phy may be powered down to save power and turn off link when the driver is unloaded and wake on lan is not enabled (among others) *** this routine MUST be followed by a call to e1000e_reset *** */ void e1000e_power_up_phy(struct e1000_adapter *adapter)
{ if (adapter->hw.phy.ops.power_up) adapter->hw.phy.ops.power_up(&adapter->hw); adapter->hw.mac.ops.setup_link(&adapter->hw); }
robutest/uclinux
C++
GPL-2.0
60
/* Get the current statistics. This may be called with the device open or closed. */
static struct net_device_stats* sonic_get_stats(struct net_device *dev)
/* Get the current statistics. This may be called with the device open or closed. */ static struct net_device_stats* sonic_get_stats(struct net_device *dev)
{ struct sonic_local *lp = netdev_priv(dev); lp->stats.rx_crc_errors += SONIC_READ(SONIC_CRCT); SONIC_WRITE(SONIC_CRCT, 0xffff); lp->stats.rx_frame_errors += SONIC_READ(SONIC_FAET); SONIC_WRITE(SONIC_FAET, 0xffff); lp->stats.rx_missed_errors += SONIC_READ(SONIC_MPT); SONIC_WRITE(SONIC_MPT, 0xffff); return &lp->stats; }
robutest/uclinux
C++
GPL-2.0
60
/* Adjust number of segments and amount of bytes to write (nr_segs should be properly initialized first). Returns appropriate error code that caller should return or zero in case that write should be allowed. */
int generic_segment_checks(const struct iovec *iov, unsigned long *nr_segs, size_t *count, int access_flags)
/* Adjust number of segments and amount of bytes to write (nr_segs should be properly initialized first). Returns appropriate error code that caller should return or zero in case that write should be allowed. */ int generic_segment_checks(const struct iovec *iov, unsigned long *nr_segs, size_t *count, int access_flags)
{ unsigned long seg; size_t cnt = 0; for (seg = 0; seg < *nr_segs; seg++) { const struct iovec *iv = &iov[seg]; cnt += iv->iov_len; if (unlikely((ssize_t)(cnt|iv->iov_len) < 0)) return -EINVAL; if (access_ok(access_flags, iv->iov_base, iv->iov_len)) continue; if (seg == 0) return -EFAULT; *nr_segs = seg; cnt -= iv->iov_len; break; } *count = cnt; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Enables or disables the TIM Capture Compare Channel x. */
void TIM_CCxCmd(TIM_TypeDef *tim, TIMCHx_Typedef channel, TIMCCxE_Typedef ccx_en)
/* Enables or disables the TIM Capture Compare Channel x. */ void TIM_CCxCmd(TIM_TypeDef *tim, TIMCHx_Typedef channel, TIMCCxE_Typedef ccx_en)
{ MODIFY_REG(tim->CCER, TIM_CCER_CC1EN << channel, ccx_en << channel); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* megasas_clear_interrupt_gen2 - Check & clear interrupt @regs: MFI register set */
static int megasas_clear_intr_gen2(struct megasas_register_set __iomem *regs)
/* megasas_clear_interrupt_gen2 - Check & clear interrupt @regs: MFI register set */ static int megasas_clear_intr_gen2(struct megasas_register_set __iomem *regs)
{ u32 status; status = readl(&regs->outbound_intr_status); if (!(status & MFI_GEN2_ENABLE_INTERRUPT_MASK)) return 1; writel(status, &regs->outbound_doorbell_clear); readl(&regs->outbound_intr_status); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns : 0 on success, non zero on a failure such as a watchdog timeout. */
static int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, int len)
/* Returns : 0 on success, non zero on a failure such as a watchdog timeout. */ static int NCR5380_pwrite(struct Scsi_Host *instance, unsigned char *src, int len)
{ register unsigned char *s = src; register unsigned short reg = (instance->io_port + P_DATA_REG_OFFSET); register int i = len; int ii = 0; while ( !((inb(instance->io_port + P_STATUS_REG_OFFSET)) & P_ST_RDY) ) ++ii; outsb( reg, s, i ); if (inb(instance->io_port + P_TIMEOUT_STATUS_REG_OFFSET) & P_TS_TIM) { outb( P_TS_CT, instance->io_port + P_TIMEOUT_STATUS_REG_OFFSET); printk("scsi%d : watchdog timer fired in NCR5380_pwrite()\n", instance->host_no); return -1; } if (ii > pas_maxi) pas_wmaxi = ii; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Enable or disable automatically clear data register. The automatic clearing function is mainly used to detect whether the data register is updated. */
void ADC_DataRegAutoClearCmd(CM_ADC_TypeDef *ADCx, en_functional_state_t enNewState)
/* Enable or disable automatically clear data register. The automatic clearing function is mainly used to detect whether the data register is updated. */ void ADC_DataRegAutoClearCmd(CM_ADC_TypeDef *ADCx, en_functional_state_t enNewState)
{ DDL_ASSERT(IS_ADC_UNIT(ADCx)); DDL_ASSERT(IS_FUNCTIONAL_STATE(enNewState)); if (enNewState == ENABLE) { SET_REG16_BIT(ADCx->CR0, ADC_CR0_CLREN); } else { CLR_REG16_BIT(ADCx->CR0, ADC_CR0_CLREN); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* ======== dmaErrorFxn ======== This is the handler for the uDMA error interrupt. */
static void dmaErrorFxn(uintptr_t arg)
/* ======== dmaErrorFxn ======== This is the handler for the uDMA error interrupt. */ static void dmaErrorFxn(uintptr_t arg)
{ int status = MAP_uDMAErrorStatusGet(); MAP_uDMAErrorStatusClear(); (void)status; while (1) ; }
nanoframework/nf-interpreter
C++
MIT License
293
/* De-initialize RSA Interface. stops operation and releases the software resources used by the interface. */
int32_t csi_rsa_uninitialize(rsa_handle_t handle)
/* De-initialize RSA Interface. stops operation and releases the software resources used by the interface. */ int32_t csi_rsa_uninitialize(rsa_handle_t handle)
{ RSA_NULL_PARAM_CHK(handle); ck_rsa_priv_t *rsa_priv = handle; rsa_priv->cb = NULL; return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Configure the compare data of an ADC digital comparator. */
void ADCCompDataSet(unsigned long ulBase, unsigned long ulComp, unsigned long ulCompData, unsigned long ulMatchCnt)
/* Configure the compare data of an ADC digital comparator. */ void ADCCompDataSet(unsigned long ulBase, unsigned long ulComp, unsigned long ulCompData, unsigned long ulMatchCnt)
{ unsigned long ulCompRegAddr; unsigned long ulConfig; xASSERT(ulBase == ADC0_BASE); xASSERT((ulComp >= 0) && (ulComp < 2)); xASSERT(ulCompData < 0x1000); xASSERT(ulMatchCnt < 16); ulCompRegAddr = ulBase + ADC_CMPR0 + (4 * ulComp); ulConfig = ((ulCompData << ADC_CMPRX_CMPD_S) | (ulMatchCnt << ADC_CMPRX_CMPMATCNT_S)); xHWREG(ulCompRegAddr) &= ~(ADC_CMPRX_CMPD_M | ADC_CMPRX_CMPMATCNT_M); xHWREG(ulCompRegAddr) |= ulConfig; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This function stop a smartcard timer of specified smartcard module. */
void SC_StopTimer(SC_T *sc, uint32_t u32TimerNum)
/* This function stop a smartcard timer of specified smartcard module. */ void SC_StopTimer(SC_T *sc, uint32_t u32TimerNum)
{ while(sc->ALTCTL & SC_ALTCTL_SYNC_Msk) { ; } if(u32TimerNum == 0UL) { sc->ALTCTL &= ~SC_ALTCTL_CNTEN0_Msk; } else if(u32TimerNum == 1UL) { sc->ALTCTL &= ~SC_ALTCTL_CNTEN1_Msk; } else { sc->ALTCTL &= ~SC_ALTCTL_CNTEN2_Msk; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* @rceb: event for which we compute the size, it contains a variable length field. @core_size: size of the "non variable" part of the event @offset: place in event where the length of the variable part is stored @buf_size: total length of buffer in which event arrived - we need to make sure we read the offset in memory that is still part of the event */
static ssize_t hwarc_get_event_size(struct uwb_rc *rc, const struct uwb_rceb *rceb, size_t core_size, size_t offset, const size_t buf_size)
/* @rceb: event for which we compute the size, it contains a variable length field. @core_size: size of the "non variable" part of the event @offset: place in event where the length of the variable part is stored @buf_size: total length of buffer in which event arrived - we need to make sure we read the offset in memory that is still part of the event */ static ssize_t hwarc_get_event_size(struct uwb_rc *rc, const struct uwb_rceb *rceb, size_t core_size, size_t offset, const size_t buf_size)
{ ssize_t size = -ENOSPC; const void *ptr = rceb; size_t type_size = sizeof(__le16); struct device *dev = &rc->uwb_dev.dev; if (offset + type_size >= buf_size) { dev_err(dev, "Not enough data to read extra size of event " "0x%02x/%04x/%02x, only got %zu bytes.\n", rceb->bEventType, le16_to_cpu(rceb->wEvent), rceb->bEventContext, buf_size); goto out; } ptr += offset; size = core_size + le16_to_cpu(*(__le16 *)ptr); out: return size; }
robutest/uclinux
C++
GPL-2.0
60
/* Start receiving data from UART receiver.transmits the default value as specified by csi_usart_set_default_tx_value. */
int32_t csi_usart_receive(usart_handle_t handle, void *data, uint32_t num)
/* Start receiving data from UART receiver.transmits the default value as specified by csi_usart_set_default_tx_value. */ int32_t csi_usart_receive(usart_handle_t handle, void *data, uint32_t num)
{ USART_NULL_PARAM_CHK(handle); USART_NULL_PARAM_CHK(data); ck_usart_priv_t *usart_priv = handle; usart_priv->rx_buf = (uint8_t *)data; usart_priv->rx_total_num = num; usart_priv->rx_cnt = 0; usart_priv->rx_busy = 1; usart_priv->last_rx_num = 0; return 0; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Get the PWM frequency of the PWM module. This function is to get the PWM frequency of the PWM module. */
unsigned long xPWMFrequencyGet(unsigned long ulBase, unsigned long ulChannel)
/* Get the PWM frequency of the PWM module. This function is to get the PWM frequency of the PWM module. */ unsigned long xPWMFrequencyGet(unsigned long ulBase, unsigned long ulChannel)
{ (void) ulBase; (void) ulChannel; xASSERT(ulBase == xPWM1_BASE); xASSERT( (ulChannel == xPWM_CHANNEL0) || (ulChannel == xPWM_CHANNEL1) || (ulChannel == xPWM_CHANNEL2) || (ulChannel == xPWM_CHANNEL3) || (ulChannel == xPWM_CHANNEL4) || (ulChannel == xPWM_CHANNEL5) || (ulChannel == xPWM_CHANNEL6) ); return (_PWMFrequency); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
{ if(huart->Instance==USART2) { __HAL_RCC_USART2_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOA, USART_TX_Pin|USART_RX_Pin); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function handles I2C Communication timeout for Master addressing phase. */
static ald_status_t i2c_wait_master_addr_to_timeout(ald_i2c_handle_t *hperh, uint32_t flag, uint32_t timeout)
/* This function handles I2C Communication timeout for Master addressing phase. */ static ald_status_t i2c_wait_master_addr_to_timeout(ald_i2c_handle_t *hperh, uint32_t flag, uint32_t timeout)
{ uint32_t tickstart = ald_get_tick(); while (ALD_I2C_GET_IT_FLAG(hperh, flag) == RESET) { if ((timeout == 0) || ((ald_get_tick() - tickstart ) > timeout)) { hperh->error_code = ALD_I2C_ERROR_TIMEOUT; return ALD_ERROR; } } return ALD_OK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Creates a new binary semaphore object with an initial count of 0, meaning that it's taken. */
tTbxMbOsalSem TbxMbOsalSemCreate(void)
/* Creates a new binary semaphore object with an initial count of 0, meaning that it's taken. */ tTbxMbOsalSem TbxMbOsalSemCreate(void)
{ tTbxMbOsalSem result = NULL; tTbxMbOsalSemCtx * newSemCtx = TbxMemPoolAllocate(sizeof(tTbxMbOsalSemCtx)); if (newSemCtx == NULL) { (void)TbxMemPoolCreate(1U, sizeof(tTbxMbOsalSemCtx)); newSemCtx = TbxMemPoolAllocate(sizeof(tTbxMbOsalSemCtx)); } TBX_ASSERT(newSemCtx != NULL); if (newSemCtx != NULL) { newSemCtx->type = TBX_MB_OSAL_SEM_CONTEXT_TYPE; newSemCtx->count = 0U; result = newSemCtx; } return result; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* ks8695_nwayreset - Restart the autonegotiation on the port. @ndev: The network device to restart autoneotiation on */
static int ks8695_nwayreset(struct net_device *ndev)
/* ks8695_nwayreset - Restart the autonegotiation on the port. @ndev: The network device to restart autoneotiation on */ static int ks8695_nwayreset(struct net_device *ndev)
{ struct ks8695_priv *ksp = netdev_priv(ndev); u32 ctrl; switch (ksp->dtype) { case KS8695_DTYPE_HPNA: return -EINVAL; case KS8695_DTYPE_WAN: ctrl = readl(ksp->phyiface_regs + KS8695_WMC); if ((ctrl & WMC_WAND) == 0) writel(ctrl | WMC_WANR, ksp->phyiface_regs + KS8695_WMC); else return -EINVAL; break; case KS8695_DTYPE_LAN: return -EOPNOTSUPP; } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Check the input question related to EFI variable */
UINTN IsEfiVarStoreQuestion(EFI_IFR_QUESTION_HEADER *IfrQuestionHdr, EFI_IFR_VARSTORE_EFI **EfiVarStoreList, UINTN EfiVarStoreNumber)
/* Check the input question related to EFI variable */ UINTN IsEfiVarStoreQuestion(EFI_IFR_QUESTION_HEADER *IfrQuestionHdr, EFI_IFR_VARSTORE_EFI **EfiVarStoreList, UINTN EfiVarStoreNumber)
{ UINTN Index; for (Index = 0; Index < EfiVarStoreNumber; Index++) { if (IfrQuestionHdr->VarStoreId == EfiVarStoreList[Index]->VarStoreId) { return Index; } } return EfiVarStoreNumber; }
tianocore/edk2
C++
Other
4,240
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */
int main(void)
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */ int main(void)
{ SetupHardware(); puts_P(PSTR(ESC_FG_CYAN "Audio Input Host Demo running.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); GlobalInterruptEnable(); for (;;) { USB_USBTask(); } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Four stage 3 varieties: _request_lock(), _convert_lock(), _unlock_lock(), _cancel_lock() */
static int _request_lock(struct dlm_rsb *r, struct dlm_lkb *lkb)
/* Four stage 3 varieties: _request_lock(), _convert_lock(), _unlock_lock(), _cancel_lock() */ static int _request_lock(struct dlm_rsb *r, struct dlm_lkb *lkb)
{ int error; error = set_master(r, lkb); if (error < 0) goto out; if (error) { error = 0; goto out; } if (is_remote(r)) error = send_request(r, lkb); else error = do_request(r, lkb); out: return error; }
robutest/uclinux
C++
GPL-2.0
60
/* If Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 16-byte boundary, then ASSERT(). If Buffer was not saved with AsmFxSave(), then ASSERT(). */
VOID EFIAPI AsmFxRestore(IN CONST IA32_FX_BUFFER *Buffer)
/* If Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 16-byte boundary, then ASSERT(). If Buffer was not saved with AsmFxSave(), then ASSERT(). */ VOID EFIAPI AsmFxRestore(IN CONST IA32_FX_BUFFER *Buffer)
{ ASSERT (Buffer != NULL); ASSERT (0 == ((UINTN)Buffer & 0xf)); ASSERT (0xAA5555AA == *(UINT32 *)(&Buffer->Buffer[sizeof (Buffer->Buffer) - 4])); InternalX86FxRestore (Buffer); }
tianocore/edk2
C++
Other
4,240
/* Write some auxiliary information about the created AAC file. */
static void put_bitstream_info(AVCodecContext *avctx, AACEncContext *s, const char *name)
/* Write some auxiliary information about the created AAC file. */ static void put_bitstream_info(AVCodecContext *avctx, AACEncContext *s, const char *name)
{ int i, namelen, padbits; namelen = strlen(name) + 2; put_bits(&s->pb, 3, TYPE_FIL); put_bits(&s->pb, 4, FFMIN(namelen, 15)); if (namelen >= 15) put_bits(&s->pb, 8, namelen - 16); put_bits(&s->pb, 4, 0); padbits = 8 - (put_bits_count(&s->pb) & 7); align_put_bits(&s->pb); for (i = 0; i < namelen - 2; i++) put_bits(&s->pb, 8, name[i]); put_bits(&s->pb, 12 - padbits, 0); }
DC-SWAT/DreamShell
C++
null
404
/* Stops audio Codec playing. It powers down the codec. */
uint32_t wm8994_Stop(uint16_t DeviceAddr, uint32_t CodecPdwnMode)
/* Stops audio Codec playing. It powers down the codec. */ uint32_t wm8994_Stop(uint16_t DeviceAddr, uint32_t CodecPdwnMode)
{ uint32_t counter = 0; if (outputEnabled != 0) { counter += wm8994_SetMute(DeviceAddr, AUDIO_MUTE_ON); if (CodecPdwnMode == CODEC_PDWN_SW) { } else { counter += CODEC_IO_Write(DeviceAddr, 0x420, 0x0200); counter += CODEC_IO_Write(DeviceAddr, 0x422, 0x0200); counter += CODEC_IO_Write(DeviceAddr, 0x2D, 0x0000); counter += CODEC_IO_Write(DeviceAddr, 0x2E, 0x0000); counter += CODEC_IO_Write(DeviceAddr, 0x05, 0x0000); counter += CODEC_IO_Write(DeviceAddr, 0x0000, 0x0000); outputEnabled = 0; } } return counter; }
eclipse-threadx/getting-started
C++
Other
310
/* Close the watchdog device. If CONFIG_WATCHDOG_NOWAYOUT is NOT defined then the watchdog is also disabled. */
static int ks8695_wdt_close(struct inode *inode, struct file *file)
/* Close the watchdog device. If CONFIG_WATCHDOG_NOWAYOUT is NOT defined then the watchdog is also disabled. */ static int ks8695_wdt_close(struct inode *inode, struct file *file)
{ if (!nowayout) ks8695_wdt_stop(); clear_bit(0, &ks8695wdt_busy); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* LOGO is sent to fabric. Vport delete is in progress. Lport delete cleanup is done. */
static void bfa_fcs_vport_sm_logo(struct bfa_fcs_vport_s *vport, enum bfa_fcs_vport_event event)
/* LOGO is sent to fabric. Vport delete is in progress. Lport delete cleanup is done. */ static void bfa_fcs_vport_sm_logo(struct bfa_fcs_vport_s *vport, enum bfa_fcs_vport_event event)
{ bfa_trc(__vport_fcs(vport), __vport_pwwn(vport)); bfa_trc(__vport_fcs(vport), event); switch (event) { case BFA_FCS_VPORT_SM_OFFLINE: bfa_lps_discard(vport->lps); case BFA_FCS_VPORT_SM_RSP_OK: case BFA_FCS_VPORT_SM_RSP_ERROR: bfa_sm_set_state(vport, bfa_fcs_vport_sm_uninit); bfa_fcs_vport_free(vport); break; case BFA_FCS_VPORT_SM_DELETE: break; default: bfa_assert(0); } }
robutest/uclinux
C++
GPL-2.0
60
/* must be called with the lock held and interrupts disabled. */
static void disable_all_interrupts(struct xircom_private *card)
/* must be called with the lock held and interrupts disabled. */ static void disable_all_interrupts(struct xircom_private *card)
{ unsigned int val; enter("enable_all_interrupts"); val = 0; outl(val, card->io_port + CSR7); leave("disable_all_interrupts"); }
robutest/uclinux
C++
GPL-2.0
60
/* If Name is NULL, then ASSERT(). If Value is NULL, then ASSERT(). */
EFI_STATUS EFIAPI GetEfiGlobalVariable2(IN CONST CHAR16 *Name, OUT VOID **Value, OUT UINTN *Size OPTIONAL)
/* If Name is NULL, then ASSERT(). If Value is NULL, then ASSERT(). */ EFI_STATUS EFIAPI GetEfiGlobalVariable2(IN CONST CHAR16 *Name, OUT VOID **Value, OUT UINTN *Size OPTIONAL)
{ return GetVariable2 (Name, &gEfiGlobalVariableGuid, Value, Size); }
tianocore/edk2
C++
Other
4,240
/* Set the clock rate of the specified I2C port. The */
void I2CSlaveInit(unsigned long ulBase, unsigned char ucSlaveAddr, unsigned long ulGeneralCall)
/* Set the clock rate of the specified I2C port. The */ void I2CSlaveInit(unsigned long ulBase, unsigned char ucSlaveAddr, unsigned long ulGeneralCall)
{ xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE)); if (ulBase == I2C0_BASE) { SysCtlPeripheralReset(SYSCTL_PERIPH_I2C0); } else { SysCtlPeripheralReset(SYSCTL_PERIPH_I2C1); } xHWREG(ulBase + I2C_O_CON) = I2C_CON_ENS1; xHWREG(ulBase + I2C_O_CON) = 0; xHWREG(ulBase + I2C_O_ADDR0) = (ucSlaveAddr << 1) | ulGeneralCall; xHWREG(ulBase + I2C_O_CON) = I2C_CON_ENS1; xHWREG(ulBase + I2C_O_CON) |= I2C_CON_AA; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* BusLogic_AllocateCCB allocates a CCB from Host Adapter's free list, allocating more memory from the Kernel if necessary. The Host Adapter's Lock should already have been acquired by the caller. */
static struct BusLogic_CCB* BusLogic_AllocateCCB(struct BusLogic_HostAdapter *HostAdapter)
/* BusLogic_AllocateCCB allocates a CCB from Host Adapter's free list, allocating more memory from the Kernel if necessary. The Host Adapter's Lock should already have been acquired by the caller. */ static struct BusLogic_CCB* BusLogic_AllocateCCB(struct BusLogic_HostAdapter *HostAdapter)
{ static unsigned long SerialNumber = 0; struct BusLogic_CCB *CCB; CCB = HostAdapter->Free_CCBs; if (CCB != NULL) { CCB->SerialNumber = ++SerialNumber; HostAdapter->Free_CCBs = CCB->Next; CCB->Next = NULL; if (HostAdapter->Free_CCBs == NULL) BusLogic_CreateAdditionalCCBs(HostAdapter, HostAdapter->IncrementalCCBs, true); return CCB; } BusLogic_CreateAdditionalCCBs(HostAdapter, HostAdapter->IncrementalCCBs, true); CCB = HostAdapter->Free_CCBs; if (CCB == NULL) return NULL; CCB->SerialNumber = ++SerialNumber; HostAdapter->Free_CCBs = CCB->Next; CCB->Next = NULL; return CCB; }
robutest/uclinux
C++
GPL-2.0
60
/* Enable the output direction of the specified GPIO. */
int32_t gpio_direction_output(struct gpio_desc *desc, uint8_t value)
/* Enable the output direction of the specified GPIO. */ int32_t gpio_direction_output(struct gpio_desc *desc, uint8_t value)
{ int32_t ret; uint16_t pin; uint8_t port; gpio_get_portpin(desc, &pin, &port); ret = adi_gpio_OutputEnable(port, pin, true); if(ret != SUCCESS) return ret; if(value == 1) return adi_gpio_SetHigh(port, pin); else return adi_gpio_SetLow(port, pin); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Green-field mode is valid if the station supports it and there are no non-GF stations present in the BSS. */
static u8 rs_use_green(struct ieee80211_sta *sta, struct iwl_ht_config *ht_conf)
/* Green-field mode is valid if the station supports it and there are no non-GF stations present in the BSS. */ static u8 rs_use_green(struct ieee80211_sta *sta, struct iwl_ht_config *ht_conf)
{ return (sta->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD) && !(ht_conf->non_GF_STA_present); }
robutest/uclinux
C++
GPL-2.0
60
/* ib_find_pkey - Returns the PKey table index where a specified PKey value occurs. @device: The device to query. @port_num: The port number of the device to search for the PKey. @pkey: The PKey value to search for. @index: The index into the PKey table where the PKey was found. */
int ib_find_pkey(struct ib_device *device, u8 port_num, u16 pkey, u16 *index)
/* ib_find_pkey - Returns the PKey table index where a specified PKey value occurs. @device: The device to query. @port_num: The port number of the device to search for the PKey. @pkey: The PKey value to search for. @index: The index into the PKey table where the PKey was found. */ int ib_find_pkey(struct ib_device *device, u8 port_num, u16 pkey, u16 *index)
{ int ret, i; u16 tmp_pkey; for (i = 0; i < device->pkey_tbl_len[port_num - start_port(device)]; ++i) { ret = ib_query_pkey(device, port_num, i, &tmp_pkey); if (ret) return ret; if ((pkey & 0x7fff) == (tmp_pkey & 0x7fff)) { *index = i; return 0; } } return -ENOENT; }
robutest/uclinux
C++
GPL-2.0
60
/* If 16-bit I/O port operations are not supported, then ASSERT(). */
UINT16 EFIAPI S3IoAnd16(IN UINTN Port, IN UINT16 AndData)
/* If 16-bit I/O port operations are not supported, then ASSERT(). */ UINT16 EFIAPI S3IoAnd16(IN UINTN Port, IN UINT16 AndData)
{ return InternalSaveIoWrite16ValueToBootScript (Port, IoAnd16 (Port, AndData)); }
tianocore/edk2
C++
Other
4,240
/* Reset the system. This routine resets the processor. */
void __weak sys_arch_reboot(int type)
/* Reset the system. This routine resets the processor. */ void __weak sys_arch_reboot(int type)
{ ARG_UNUSED(type); NVIC_SystemReset(); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Returns a positive number of bitflips less than or equal to bitflips_threshold, or -ERROR_CODE for bitflips in excess of the threshold. */
static int nand_check_erased_buf(void *buf, int len, int bitflips_threshold)
/* Returns a positive number of bitflips less than or equal to bitflips_threshold, or -ERROR_CODE for bitflips in excess of the threshold. */ static int nand_check_erased_buf(void *buf, int len, int bitflips_threshold)
{ const unsigned char *bitmap = buf; int bitflips = 0; int weight; for (; len && ((uintptr_t)bitmap) % sizeof(long); len--, bitmap++) { weight = hweight8(*bitmap); bitflips += BITS_PER_BYTE - weight; if (unlikely(bitflips > bitflips_threshold)) return -EBADMSG; } for (; len >= 4; len -= 4, bitmap += 4) { weight = hweight32(*((u32 *)bitmap)); bitflips += 32 - weight; if (unlikely(bitflips > bitflips_threshold)) return -EBADMSG; } for (; len > 0; len--, bitmap++) { weight = hweight8(*bitmap); bitflips += BITS_PER_BYTE - weight; if (unlikely(bitflips > bitflips_threshold)) return -EBADMSG; } return bitflips; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Calls a write-long-characteristic-value proc's callback with the specified parameters. If the proc has no callback, this function is a no-op. */
static int ble_gattc_write_reliable_cb(struct ble_gattc_proc *proc, int status, uint16_t att_handle)
/* Calls a write-long-characteristic-value proc's callback with the specified parameters. If the proc has no callback, this function is a no-op. */ static int ble_gattc_write_reliable_cb(struct ble_gattc_proc *proc, int status, uint16_t att_handle)
{ int rc; BLE_HS_DBG_ASSERT(!ble_hs_locked_by_cur_task()); ble_gattc_dbg_assert_proc_not_inserted(proc); if (status != 0 && status != BLE_HS_EDONE) { STATS_INC(ble_gattc_stats, write_reliable_fail); } if (proc->write_reliable.cb == NULL) { rc = 0; } else { rc = proc->write_reliable.cb(proc->conn_handle, ble_gattc_error(status, att_handle), proc->write_reliable.attrs, proc->write_reliable.num_attrs, proc->write_reliable.cb_arg); } return rc; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Returns the measurement values for all the channels. */
int32_t VEML6030_GetValues(VEML6030_Object_t *pObj, uint32_t *Values)
/* Returns the measurement values for all the channels. */ int32_t VEML6030_GetValues(VEML6030_Object_t *pObj, uint32_t *Values)
{ int32_t ret = VEML6030_OK; if (pObj == NULL) { ret = VEML6030_INVALID_PARAM; } else if(veml6030_read_reg(&pObj->Ctx, VEML6030_REG_ALS, (uint16_t *)&Values[0], 2)!=0) { ret = VEML6030_ERROR ; } else if(veml6030_read_reg(&pObj->Ctx, VEML6030_REG_WHITE,(uint16_t *)&Values[1], 2)!=0) { ret = VEML6030_ERROR ; } else { } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Returns the number of characters generated on success; otherwise, < 0 on error. */
static int ppc4xx_edac_generate_ecc_message(const struct mem_ctl_info *mci, const struct ppc4xx_ecc_status *status, char *buffer, size_t size)
/* Returns the number of characters generated on success; otherwise, < 0 on error. */ static int ppc4xx_edac_generate_ecc_message(const struct mem_ctl_info *mci, const struct ppc4xx_ecc_status *status, char *buffer, size_t size)
{ int n, total = 0; n = ppc4xx_edac_generate_bank_message(mci, status, buffer, size); if (n < 0 || n >= size) goto fail; buffer += n; size -= n; total += n; n = ppc4xx_edac_generate_checkbit_message(mci, status, buffer, size); if (n < 0 || n >= size) goto fail; buffer += n; size -= n; total += n; n = ppc4xx_edac_generate_lane_message(mci, status, buffer, size); if (n < 0 || n >= size) goto fail; buffer += n; size -= n; total += n; fail: return total; }
robutest/uclinux
C++
GPL-2.0
60
/* Append the version of AirPcap with which we we're running to a GString. */
void get_runtime_airpcap_version(GString *str)
/* Append the version of AirPcap with which we we're running to a GString. */ void get_runtime_airpcap_version(GString *str)
{ guint vmaj, vmin, vrev, build; if (AirpcapLoaded == FALSE) { g_string_append(str, "without AirPcap"); return; } g_PAirpcapGetVersion(&vmaj, &vmin, &vrev, &build); g_string_append_printf(str, "with AirPcap %d.%d.%d build %d", vmaj, vmin, vrev, build); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* ECC interrupt service routine. User application must invoke this function in his CRYPTO_IRQHandler() to let Crypto driver know ECC processing was done. */
void ECC_Complete(CRPT_T *crpt)
/* ECC interrupt service routine. User application must invoke this function in his CRYPTO_IRQHandler() to let Crypto driver know ECC processing was done. */ void ECC_Complete(CRPT_T *crpt)
{ if (crpt->INTSTS & CRPT_INTSTS_ECCIF_Msk) { g_ECC_done = 1UL; crpt->INTSTS = CRPT_INTSTS_ECCIF_Msk; } if (crpt->INTSTS & CRPT_INTSTS_ECCEIF_Msk) { g_ECCERR_done = 1UL; crpt->INTSTS = CRPT_INTSTS_ECCEIF_Msk; printf("ECCEIF flag is set!!\n"); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* RequestKey-Request ::= SEQUENCE { requestingDeviceIdentifier BACnetObjectIdentifier, requestingDeviceAddress BACnetAddress, remoteDeviceIdentifier BACnetObjectIdentifier, remoteDeviceAddress BACnetAddress } */
static guint fRequestKeyRequest(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset)
/* RequestKey-Request ::= SEQUENCE { requestingDeviceIdentifier BACnetObjectIdentifier, requestingDeviceAddress BACnetAddress, remoteDeviceIdentifier BACnetObjectIdentifier, remoteDeviceAddress BACnetAddress } */ static guint fRequestKeyRequest(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset)
{ offset = fObjectIdentifier(tvb, pinfo, tree, offset); offset = fAddress(tvb, pinfo, tree, offset); offset = fObjectIdentifier(tvb, pinfo, tree, offset); return fAddress(tvb, pinfo, tree, offset); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Enables the backup SRAM power supply, so its data is saved while the device is in backup mode. */
void SUPC_EnableSram(void)
/* Enables the backup SRAM power supply, so its data is saved while the device is in backup mode. */ void SUPC_EnableSram(void)
{ AT91C_BASE_SUPC->SUPC_MR = SUPC_KEY | AT91C_BASE_SUPC->SUPC_MR | AT91C_SUPC_SRAMON; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Updates a FAT12 cluster entry in the FAT file table with the specified next chain index. If the cluster is the last in the file chain, the magic value */
static void UpdateFAT12ClusterEntry(uint8_t *const FATTable, const uint16_t Index, const uint16_t ChainEntry)
/* Updates a FAT12 cluster entry in the FAT file table with the specified next chain index. If the cluster is the last in the file chain, the magic value */ static void UpdateFAT12ClusterEntry(uint8_t *const FATTable, const uint16_t Index, const uint16_t ChainEntry)
{ uint8_t FATOffset = (Index + (Index >> 1)); bool UpperNibble = ((Index & 1) != 0); if (UpperNibble) { FATTable[FATOffset] = (FATTable[FATOffset] & 0x0F) | ((ChainEntry & 0x0F) << 4); FATTable[FATOffset + 1] = (ChainEntry >> 4); } else { FATTable[FATOffset] = ChainEntry; FATTable[FATOffset + 1] = (FATTable[FATOffset + 1] & 0xF0) | (ChainEntry >> 8); } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Use this routine when releasing the only device lock you hold; to release inner nested locks call up(&udev->serialize) directly. This is necessary for proper interaction with usb_lock_all_devices(). */
void usb_unlock_device(struct usb_host_virt_dev *virt_dev)
/* Use this routine when releasing the only device lock you hold; to release inner nested locks call up(&udev->serialize) directly. This is necessary for proper interaction with usb_lock_all_devices(). */ void usb_unlock_device(struct usb_host_virt_dev *virt_dev)
{ hal_sem_post(virt_dev->usb_virt_dev_semi); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param base Pointer to the FLEXIO_SPI_Type structure. return status flag; Use the status flag to AND the following flag mask and get the status. arg kFLEXIO_SPI_TxEmptyFlag arg kFLEXIO_SPI_RxEmptyFlag */
uint32_t FLEXIO_SPI_GetStatusFlags(FLEXIO_SPI_Type *base)
/* param base Pointer to the FLEXIO_SPI_Type structure. return status flag; Use the status flag to AND the following flag mask and get the status. arg kFLEXIO_SPI_TxEmptyFlag arg kFLEXIO_SPI_RxEmptyFlag */ uint32_t FLEXIO_SPI_GetStatusFlags(FLEXIO_SPI_Type *base)
{ uint32_t shifterStatus = FLEXIO_GetShifterStatusFlags(base->flexioBase); uint32_t status = 0; status = ((shifterStatus & (1U << base->shifterIndex[0])) >> base->shifterIndex[0]); status |= (((shifterStatus & (1U << base->shifterIndex[1])) >> (base->shifterIndex[1])) << 1U); return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Output a character in polled mode. If the hardware flow control is enabled then the handshake signal CTS has to be asserted in order to send a character. */
static void uart_xec_poll_out(const struct device *dev, unsigned char c)
/* Output a character in polled mode. If the hardware flow control is enabled then the handshake signal CTS has to be asserted in order to send a character. */ static void uart_xec_poll_out(const struct device *dev, unsigned char c)
{ const struct uart_xec_device_config * const dev_cfg = dev->config; struct uart_xec_dev_data *dev_data = dev->data; struct uart_regs *regs = dev_cfg->regs; k_spinlock_key_t key = k_spin_lock(&dev_data->lock); while ((regs->LSR & LSR_THRE) == 0) { ; } regs->RTXB = c; k_spin_unlock(&dev_data->lock, key); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Adds a &struct rio_driver to the list of registered drivers. Returns a negative value on error, otherwise 0. If no error occurred, the driver remains registered even if no device was claimed during registration. */
int rio_register_driver(struct rio_driver *rdrv)
/* Adds a &struct rio_driver to the list of registered drivers. Returns a negative value on error, otherwise 0. If no error occurred, the driver remains registered even if no device was claimed during registration. */ int rio_register_driver(struct rio_driver *rdrv)
{ rdrv->driver.name = rdrv->name; rdrv->driver.bus = &rio_bus_type; return driver_register(&rdrv->driver); }
robutest/uclinux
C++
GPL-2.0
60
/* Finish current tx buffer and make it ready for transmit. */
static void __lcs_emit_txbuffer(struct lcs_card *card)
/* Finish current tx buffer and make it ready for transmit. */ static void __lcs_emit_txbuffer(struct lcs_card *card)
{ LCS_DBF_TEXT(5, trace, "emittx"); *(__u16 *)(card->tx_buffer->data + card->tx_buffer->count) = 0; card->tx_buffer->count += 2; lcs_ready_buffer(&card->write, card->tx_buffer); card->tx_buffer = NULL; card->tx_emitted++; }
robutest/uclinux
C++
GPL-2.0
60
/* Helper function for set_page_dirty family. NOTE: This relies on being atomic wrt interrupts. */
void account_page_dirtied(struct page *page, struct address_space *mapping)
/* Helper function for set_page_dirty family. NOTE: This relies on being atomic wrt interrupts. */ void account_page_dirtied(struct page *page, struct address_space *mapping)
{ if (mapping_cap_account_dirty(mapping)) { __inc_zone_page_state(page, NR_FILE_DIRTY); __inc_bdi_stat(mapping->backing_dev_info, BDI_RECLAIMABLE); task_dirty_inc(current); task_io_account_write(PAGE_CACHE_SIZE); } }
robutest/uclinux
C++
GPL-2.0
60
/* Writes the data to flash through a flash block manager. Note that this function also checks that no data is programmed outside the flash memory region, so the bootloader can never be overwritten. */
blt_bool FlashWrite(blt_addr addr, blt_int32u len, blt_int8u *data)
/* Writes the data to flash through a flash block manager. Note that this function also checks that no data is programmed outside the flash memory region, so the bootloader can never be overwritten. */ blt_bool FlashWrite(blt_addr addr, blt_int32u len, blt_int8u *data)
{ blt_bool result = BLT_TRUE; blt_addr base_addr; addr = FlashTranslateToNonCachedAddress(addr); if ((len - 1) > (FLASH_END_ADDRESS - addr)) { result = BLT_FALSE; } if (result == BLT_TRUE) { if ((FlashGetSectorIdx(addr) == FLASH_INVALID_SECTOR_IDX) || \ (FlashGetSectorIdx(addr+len-1) == FLASH_INVALID_SECTOR_IDX)) { result = BLT_FALSE; } } if (result == BLT_TRUE) { base_addr = (addr/FLASH_WRITE_BLOCK_SIZE)*FLASH_WRITE_BLOCK_SIZE; if (base_addr == flashLayout[0].sector_start) { result = FlashAddToBlock(&bootBlockInfo, addr, data, len); } else { result = FlashAddToBlock(&blockInfo, addr, data, len); } } return result; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Return Value: ADV_TRUE(1) - All requests are purged and SCSI Bus is reset. ADV_FALSE(0) - Microcode command failed. ADV_ERROR(-1) - Microcode command timed-out. Microcode or IC may be hung which requires driver recovery. */
static int AdvResetSB(ADV_DVC_VAR *asc_dvc)
/* Return Value: ADV_TRUE(1) - All requests are purged and SCSI Bus is reset. ADV_FALSE(0) - Microcode command failed. ADV_ERROR(-1) - Microcode command timed-out. Microcode or IC may be hung which requires driver recovery. */ static int AdvResetSB(ADV_DVC_VAR *asc_dvc)
{ int status; status = AdvSendIdleCmd(asc_dvc, (ushort)IDLE_CMD_SCSI_RESET_START, 0L); if (status != ADV_TRUE) { return status; } udelay(ASC_SCSI_RESET_HOLD_TIME_US); status = AdvSendIdleCmd(asc_dvc, (ushort)IDLE_CMD_SCSI_RESET_END, 0L); if (status != ADV_TRUE) { return status; } mdelay(asc_dvc->scsi_reset_wait * 1000); return status; }
robutest/uclinux
C++
GPL-2.0
60
/* Set one RGB to black (when used as indicator) */
void ws2812_off(uint8_t gpio_num)
/* Set one RGB to black (when used as indicator) */ void ws2812_off(uint8_t gpio_num)
{ ws2812_set(gpio_num, 0x000000); }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* For example, class closures for signals (see g_signal_type_cclosure_new()) retrieve the callback function from a fixed offset in the class structure. The meta marshaller retrieves the right callback and passes it to the marshaller as the @marshal_data argument. */
void g_closure_set_meta_marshal(GClosure *closure, gpointer marshal_data, GClosureMarshal meta_marshal)
/* For example, class closures for signals (see g_signal_type_cclosure_new()) retrieve the callback function from a fixed offset in the class structure. The meta marshaller retrieves the right callback and passes it to the marshaller as the @marshal_data argument. */ void g_closure_set_meta_marshal(GClosure *closure, gpointer marshal_data, GClosureMarshal meta_marshal)
{ GRealClosure *real_closure; g_return_if_fail (closure != NULL); g_return_if_fail (meta_marshal != NULL); g_return_if_fail (closure->is_invalid == FALSE); g_return_if_fail (closure->in_marshal == FALSE); real_closure = G_REAL_CLOSURE (closure); g_return_if_fail (real_closure->meta_marshal == NULL); real_closure->meta_marshal = meta_marshal; real_closure->meta_marshal_data = marshal_data; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function expects to be called with @entry->rw_lock write-hold. */
static int pdcspath_fetch(struct pdcspath_entry *entry)
/* This function expects to be called with @entry->rw_lock write-hold. */ static int pdcspath_fetch(struct pdcspath_entry *entry)
{ struct device_path *devpath; if (!entry) return -EINVAL; devpath = &entry->devpath; DPRINTK("%s: fetch: 0x%p, 0x%p, addr: 0x%lx\n", __func__, entry, devpath, entry->addr); if (pdc_stable_read(entry->addr, devpath, sizeof(*devpath)) != PDC_OK) return -EIO; entry->dev = hwpath_to_device((struct hardware_path *)devpath); entry->ready = 1; DPRINTK("%s: device: 0x%p\n", __func__, entry->dev); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This function should only be called from object system implementations. */
void g_object_run_dispose(GObject *object)
/* This function should only be called from object system implementations. */ void g_object_run_dispose(GObject *object)
{ g_return_if_fail (G_IS_OBJECT (object)); g_return_if_fail (object->ref_count > 0); g_object_ref (object); TRACE (GOBJECT_OBJECT_DISPOSE(object,G_TYPE_FROM_INSTANCE(object), 0)); G_OBJECT_GET_CLASS (object)->dispose (object); TRACE (GOBJECT_OBJECT_DISPOSE_END(object,G_TYPE_FROM_INSTANCE(object), 0)); g_object_unref (object); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Note that the first trailing whitespace is replaced with a NUL-terminator in the given string @s. Returns a pointer to the first non-whitespace character in @s. */
char* strim(char *s)
/* Note that the first trailing whitespace is replaced with a NUL-terminator in the given string @s. Returns a pointer to the first non-whitespace character in @s. */ char* strim(char *s)
{ size_t size; char *end; s = skip_spaces(s); size = strlen(s); if (!size) return s; end = s + size - 1; while (end >= s && isspace(*end)) end--; *(end + 1) = '\0'; return s; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Toggles the LED at a fixed time interval. */
void LedToggle(void)
/* Toggles the LED at a fixed time interval. */ void LedToggle(void)
{ static unsigned char led_toggle_state = 0; static unsigned long timer_counter_last = 0; unsigned long timer_counter_now; timer_counter_now = TimerGet(); if ( (timer_counter_now - timer_counter_last) < LED_TOGGLE_MS) { return; } if (led_toggle_state == 0) { led_toggle_state = 1; PORTB_BIT0 = 1; } else { led_toggle_state = 0; PORTB_BIT0 = 0; } timer_counter_last = timer_counter_now; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Read AMP value. The volume is between 0 to 0x7f, 0x80 = mute bit. */
int snd_hda_codec_amp_read(struct hda_codec *codec, hda_nid_t nid, int ch, int direction, int index)
/* Read AMP value. The volume is between 0 to 0x7f, 0x80 = mute bit. */ int snd_hda_codec_amp_read(struct hda_codec *codec, hda_nid_t nid, int ch, int direction, int index)
{ struct hda_amp_info *info; info = get_alloc_amp_hash(codec, HDA_HASH_KEY(nid, direction, index)); if (!info) return 0; return get_vol_mute(codec, info, nid, ch, direction, index); }
robutest/uclinux
C++
GPL-2.0
60
/* Find string ID of option if its value equals to given value. */
EFI_STRING_ID OrderedListOptionValueToStringId(IN HII_STATEMENT *HiiStatement, IN UINT64 Value)
/* Find string ID of option if its value equals to given value. */ EFI_STRING_ID OrderedListOptionValueToStringId(IN HII_STATEMENT *HiiStatement, IN UINT64 Value)
{ LIST_ENTRY *Link; HII_QUESTION_OPTION *Option; UINT64 CurrentValue; if (HiiStatement == NULL) { return 0; } if (HiiStatement->Operand != EFI_IFR_ORDERED_LIST_OP) { return 0; } if (IsListEmpty (&HiiStatement->OptionListHead)) { return 0; } Link = GetFirstNode (&HiiStatement->OptionListHead); while (!IsNull (&HiiStatement->OptionListHead, Link)) { Option = HII_QUESTION_OPTION_FROM_LINK (Link); CurrentValue = ExtendHiiValueToU64 (&Option->Value); if (Value == CurrentValue) { return Option->Text; } Link = GetNextNode (&HiiStatement->OptionListHead, Link); } return 0; }
tianocore/edk2
C++
Other
4,240
/* Unbind cp from application incarnation (called by cp destructor) */
void ip_vs_unbind_app(struct ip_vs_conn *cp)
/* Unbind cp from application incarnation (called by cp destructor) */ void ip_vs_unbind_app(struct ip_vs_conn *cp)
{ struct ip_vs_app *inc = cp->app; if (!inc) return; if (inc->unbind_conn) inc->unbind_conn(inc, cp); if (inc->done_conn) inc->done_conn(inc, cp); ip_vs_app_inc_put(inc); cp->app = NULL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* These are the routines invoked by sep_upsample to upsample pixel values of a single component. One row group is processed per call. For full-size components, we just make color_buf point at the input buffer, and thus avoid copying any data. Note that this is safe only because sep_upsample doesn't declare the input row group "consumed" until we are done color converting and emitting it. */
fullsize_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
/* These are the routines invoked by sep_upsample to upsample pixel values of a single component. One row group is processed per call. For full-size components, we just make color_buf point at the input buffer, and thus avoid copying any data. Note that this is safe only because sep_upsample doesn't declare the input row group "consumed" until we are done color converting and emitting it. */ fullsize_upsample(j_decompress_ptr cinfo, jpeg_component_info *compptr, JSAMPARRAY input_data, JSAMPARRAY *output_data_ptr)
{ *output_data_ptr = input_data; }
nanoframework/nf-interpreter
C++
MIT License
293
/* Poll the device for input. When connected to its own pseudo terminal, it may also auto attach a terminal emulator to it, if set so from command line. */
static int np_uart_stdin_poll_in(const struct device *dev, unsigned char *p_char)
/* Poll the device for input. When connected to its own pseudo terminal, it may also auto attach a terminal emulator to it, if set so from command line. */ static int np_uart_stdin_poll_in(const struct device *dev, unsigned char *p_char)
{ int in_f = ((struct native_uart_status *)dev->data)->in_fd; static bool disconnected; int rc; if (disconnected == true) { return -1; } rc = np_uart_stdin_poll_in_bottom(in_f, p_char); if (rc == -2) { disconnected = true; return -1; } return rc; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function is the entrypoint of USB Mass Storage Driver. It installs Driver Binding Protocol together with Component Name Protocols. */
EFI_STATUS EFIAPI USBMassStorageEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* This function is the entrypoint of USB Mass Storage Driver. It installs Driver Binding Protocol together with Component Name Protocols. */ EFI_STATUS EFIAPI USBMassStorageEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; Status = EfiLibInstallDriverBindingComponentName2 ( ImageHandle, SystemTable, &gUSBMassDriverBinding, ImageHandle, &gUsbMassStorageComponentName, &gUsbMassStorageComponentName2 ); ASSERT_EFI_ERROR (Status); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Flush kernel TLB entries in the given range */
void flush_tlb_kernel_range(unsigned long start, unsigned long end)
/* Flush kernel TLB entries in the given range */ void flush_tlb_kernel_range(unsigned long start, unsigned long end)
{ flush_range(&init_mm, start, end); FINISH_FLUSH; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If 8-bit MMIO register operations are not supported, 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 OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT8 EFIAPI S3MmioBitFieldOr8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 OrData)
/* If 8-bit MMIO register operations are not supported, 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 OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT8 EFIAPI S3MmioBitFieldOr8(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 OrData)
{ return InternalSaveMmioWrite8ValueToBootScript (Address, MmioBitFieldOr8 (Address, StartBit, EndBit, OrData)); }
tianocore/edk2
C++
Other
4,240
/* This function tags the current thread as not essential to system operation. Exceptions raised by this thread may be recoverable. (This is the default tag for a thread.) */
void z_thread_essential_clear(void)
/* This function tags the current thread as not essential to system operation. Exceptions raised by this thread may be recoverable. (This is the default tag for a thread.) */ void z_thread_essential_clear(void)
{ _current->base.user_options &= ~K_ESSENTIAL; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Set pulse period for when the solenoid needs to pulse before reaching hold value. */
int32_t cn0415_pulse_set_period(struct cn0415_dev *dev, uint8_t *args)
/* Set pulse period for when the solenoid needs to pulse before reaching hold value. */ int32_t cn0415_pulse_set_period(struct cn0415_dev *dev, uint8_t *args)
{ dev->pulse_t = atoi((char *)args); dev->param_array[T_PULSE] = dev->pulse_t; return flash_write(dev->param_array, FLASH_PARAM_SIZE); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Construction function for DMAST instruction. This function fills the program buffer with the constructed instruction. */
static INLINE int XDmaPs_Instr_DMAST(char *DmaProg)
/* Construction function for DMAST instruction. This function fills the program buffer with the constructed instruction. */ static INLINE int XDmaPs_Instr_DMAST(char *DmaProg)
{ *DmaProg = 0x08; return 1; }
ua1arn/hftrx
C++
null
69
/* Reposition the children of an object. (Called recursively) */
static void refresh_children_position(lv_obj_t *obj, lv_coord_t x_diff, lv_coord_t y_diff)
/* Reposition the children of an object. (Called recursively) */ static void refresh_children_position(lv_obj_t *obj, lv_coord_t x_diff, lv_coord_t y_diff)
{ lv_obj_t * i; LV_LL_READ(obj->child_ll, i) { i->coords.x1 += x_diff; i->coords.y1 += y_diff; i->coords.x2 += x_diff; i->coords.y2 += y_diff; refresh_children_position(i, x_diff, y_diff); } }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* disable the SD I/O suspend operation(SD I/O only) */
void sdio_suspend_disable(void)
/* disable the SD I/O suspend operation(SD I/O only) */ void sdio_suspend_disable(void)
{ SDIO_CMDCTL &= ~SDIO_CMDCTL_SUSPEND; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns 0 on success, or -ENOMEM if no memory could be allocated. */
int __init firmware_map_add_early(u64 start, u64 end, const char *type)
/* Returns 0 on success, or -ENOMEM if no memory could be allocated. */ int __init firmware_map_add_early(u64 start, u64 end, const char *type)
{ struct firmware_map_entry *entry; entry = alloc_bootmem(sizeof(struct firmware_map_entry)); if (WARN_ON(!entry)) return -ENOMEM; return firmware_map_add_entry(start, end, type, entry); }
robutest/uclinux
C++
GPL-2.0
60
/* 9.4.5 IMEISV See subclause 18.4.9 in 3GPP TS 29.018 . The IMEISV is coded as a sequence of BCD digits, compressed two into each octet. The IMEISV consists of 16 digits (see 3GPP TS 23.003). */
static guint16 de_sgsap_imeisv(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
/* 9.4.5 IMEISV See subclause 18.4.9 in 3GPP TS 29.018 . The IMEISV is coded as a sequence of BCD digits, compressed two into each octet. The IMEISV consists of 16 digits (see 3GPP TS 23.003). */ static guint16 de_sgsap_imeisv(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo _U_, guint32 offset, guint len _U_, gchar *add_string _U_, int string_len _U_)
{ const char *imeisv_str; guint32 curr_offset; curr_offset = offset; imeisv_str = tvb_bcd_dig_to_wmem_packet_str( tvb, curr_offset, len, NULL, FALSE); proto_tree_add_string(tree, hf_sgsap_imeisv, tvb, curr_offset, len, imeisv_str); if (add_string) { g_snprintf(add_string, (len<<2)+4, " - %s", imeisv_str); } return(len); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Fills each UART_InitStruct member with its default value. */
void UART_StructInit(UART_InitTypeDef *UART_InitStruct)
/* Fills each UART_InitStruct member with its default value. */ void UART_StructInit(UART_InitTypeDef *UART_InitStruct)
{ UART_InitStruct->UART_BaudRate = 9600; UART_InitStruct->UART_WordLength = UART_WordLength_8b; UART_InitStruct->UART_StopBits = UART_StopBits_1; UART_InitStruct->UART_Parity = UART_Parity_No ; UART_InitStruct->UART_Mode = UART_Mode_Rx | UART_Mode_Tx; UART_InitStruct->UART_HardwareFlowControl = UART_HardwareFlowControl_None; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Clears the button GPIO settings, disables the buttons. */
void halButtonsShutDown()
/* Clears the button GPIO settings, disables the buttons. */ void halButtonsShutDown()
{ BUTTON_PORT_OUT &= ~(BUTTON_ALL); BUTTON_PORT_DIR |= BUTTON_ALL; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Function for marking a connection as disconnected. See BLE_CONN_STATUS_DISCONNECTED. */
static void record_set_disconnected(uint16_t conn_handle)
/* Function for marking a connection as disconnected. See BLE_CONN_STATUS_DISCONNECTED. */ static void record_set_disconnected(uint16_t conn_handle)
{ sdk_mapped_flags_update_by_key(m_bcs.valid_conn_handles, &m_bcs.flags.connected_flags, conn_handle, 0); }
labapart/polymcu
C++
null
201
/* Get the index at which the name of the node is stored. */
EFI_STATUS AmlNodeGetNameIndex(IN CONST AML_OBJECT_NODE *ObjectNode, OUT EAML_PARSE_INDEX *Index)
/* Get the index at which the name of the node is stored. */ EFI_STATUS AmlNodeGetNameIndex(IN CONST AML_OBJECT_NODE *ObjectNode, OUT EAML_PARSE_INDEX *Index)
{ EAML_PARSE_INDEX NameIndex; if (!AmlNodeHasAttribute (ObjectNode, AML_IN_NAMESPACE) || (ObjectNode->AmlByteEncoding == NULL) || (Index == NULL)) { ASSERT (0); return EFI_INVALID_PARAMETER; } NameIndex = ObjectNode->AmlByteEncoding->NameIndex; if ((NameIndex > ObjectNode->AmlByteEncoding->MaxIndex) || (ObjectNode->AmlByteEncoding->Format[NameIndex] != EAmlName)) { ASSERT (0); return EFI_INVALID_PARAMETER; } *Index = NameIndex; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* This is a wrapper function for Memory allocation routine. In linux Kernel it it kmalloc function */
void* plat_alloc_memory(u32 bytes)
/* This is a wrapper function for Memory allocation routine. In linux Kernel it it kmalloc function */ void* plat_alloc_memory(u32 bytes)
{ void *buf = (void *)rt_malloc((u32)bytes); flush_cache((unsigned long)buf, bytes); return buf; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* brief Initialize the ENET TX CLK to given frequency. return Nothing */
void CLOCK_SetupEnetTxClk(uint32_t iFreq)
/* brief Initialize the ENET TX CLK to given frequency. return Nothing */ void CLOCK_SetupEnetTxClk(uint32_t iFreq)
{ s_Enet_Tx_Clk_Freq = iFreq; return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If 8-bit I/O port operations are not supported, 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 AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT8 EFIAPI S3IoBitFieldAndThenOr8(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData, IN UINT8 OrData)
/* If 8-bit I/O port operations are not supported, 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 AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT8 EFIAPI S3IoBitFieldAndThenOr8(IN UINTN Port, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 AndData, IN UINT8 OrData)
{ return InternalSaveIoWrite8ValueToBootScript (Port, IoBitFieldAndThenOr8 (Port, StartBit, EndBit, AndData, OrData)); }
tianocore/edk2
C++
Other
4,240
/* Read the device ID (can be used to check connection) */
adxl345Error_t adxl345GetDeviceID(uint8_t *id)
/* Read the device ID (can be used to check connection) */ adxl345Error_t adxl345GetDeviceID(uint8_t *id)
{ adxl345Error_t error = ADXL345_ERROR_OK; error = adxl345Read8(ADXL345_REG_DEVID, id); return error; }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Deinitializes ADC1 peripheral registers to their default reset values. */
void ADC_DeInit(ADC_TypeDef *ADCx)
/* Deinitializes ADC1 peripheral registers to their default reset values. */ void ADC_DeInit(ADC_TypeDef *ADCx)
{ assert_param(IS_ADC_ALL_PERIPH(ADCx)); if (ADCx == ADC1) { RCC_APB2PeriphResetCmd(RCC_APB2Periph_ADC1, ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_ADC1, DISABLE); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Alert box for a failed attempt to read a file. "err" is assumed to be a UNIX-style errno. */
void read_failure_alert_box(const char *filename, int err)
/* Alert box for a failed attempt to read a file. "err" is assumed to be a UNIX-style errno. */ void read_failure_alert_box(const char *filename, int err)
{ gchar *display_basename; display_basename = g_filename_display_basename(filename); simple_message_box(ESD_TYPE_ERROR, NULL, NULL, "An error occurred while reading from the file \"%s\": %s.", display_basename, g_strerror(err)); g_free(display_basename); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Get the number of CPU cores from the SCU configuration */
unsigned int __init scu_get_core_count(void __iomem *scu_base)
/* Get the number of CPU cores from the SCU configuration */ unsigned int __init scu_get_core_count(void __iomem *scu_base)
{ unsigned int ncores = __raw_readl(scu_base + SCU_CONFIG); return (ncores & 0x03) + 1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return the thread ID of the current running thread. */
osThreadId_t osThreadGetId(void)
/* Return the thread ID of the current running thread. */ osThreadId_t osThreadGetId(void)
{ k_tid_t tid = k_current_get(); return get_cmsis_thread_id(tid); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinTypeWakeHigh(uint32_t ui32Port, uint8_t ui8Pins)
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ void GPIOPinTypeWakeHigh(uint32_t ui32Port, uint8_t ui8Pins)
{ ASSERT(_GPIOBaseValid(ui32Port)); GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_IN); GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_WAKE_HIGH); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns 0 on success, errno on failure (as defined in errno.h) */
int et131x_ioctl(struct net_device *netdev, struct ifreq *reqbuf, int cmd)
/* Returns 0 on success, errno on failure (as defined in errno.h) */ int et131x_ioctl(struct net_device *netdev, struct ifreq *reqbuf, int cmd)
{ int status = 0; switch (cmd) { case SIOCGMIIPHY: case SIOCGMIIREG: case SIOCSMIIREG: status = et131x_ioctl_mii(netdev, reqbuf, cmd); break; default: status = -EOPNOTSUPP; } return status; }
robutest/uclinux
C++
GPL-2.0
60
/* Prototype: int acornscsi_getperiod(unsigned char syncxfer) Purpose : period for the synchronous transfer setting Params : syncxfer SYNCXFER register value Returns : period in ns. */
static int acornscsi_getperiod(unsigned char syncxfer)
/* Prototype: int acornscsi_getperiod(unsigned char syncxfer) Purpose : period for the synchronous transfer setting Params : syncxfer SYNCXFER register value Returns : period in ns. */ static int acornscsi_getperiod(unsigned char syncxfer)
{ int i; syncxfer &= 0xf0; if (syncxfer == 0x10) syncxfer = 0; for (i = 1; sync_xfer_table[i].period_ns; i++) if (syncxfer == sync_xfer_table[i].reg_value) return sync_xfer_table[i].period_ns; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Function for tracing page 3 and common data. */
static void page3_data_log(ant_hrm_page3_data_t const *p_page_data)
/* Function for tracing page 3 and common data. */ static void page3_data_log(ant_hrm_page3_data_t const *p_page_data)
{ LOG_PAGE3("Hardware Rev ID %u\n\r", (unsigned int)p_page_data->hw_version); LOG_PAGE3("Model %u\n\r", (unsigned int)p_page_data->model_num); LOG_PAGE3("Software Ver ID %u\n\r", (unsigned int)p_page_data->sw_version); }
labapart/polymcu
C++
null
201
/* Writes one pixel to the LCD controller. DMDIF_prepareDataAccess() needs to be called before writing data using this function. */
EMSTATUS DMDIF_writeData(uint32_t data)
/* Writes one pixel to the LCD controller. DMDIF_prepareDataAccess() needs to be called before writing data using this function. */ EMSTATUS DMDIF_writeData(uint32_t data)
{ *data_register = (data & 0x0000FFFF); return DMD_OK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* generate a short spike on the CAN tx line to bring the couplers in sync */
void init_coupler(u32 addr)
/* generate a short spike on the CAN tx line to bring the couplers in sync */ void init_coupler(u32 addr)
{ struct sja1000_basic_s *ctrl = (struct sja1000_basic_s *)addr; out_8(&ctrl->cr, CR_RR); out_8(&ctrl->btr0, 0x00); out_8(&ctrl->btr1, 0x14); out_8(&ctrl->oc, OC_TP1 | OC_TN1 | OC_POL1 | OC_TP0 | OC_TN0 | OC_POL0 | OC_MODE1); out_8(&ctrl->cr, 0x00); in_8(&ctrl->cr); in_8(&ctrl->cr); in_8(&ctrl->cr); in_8(&ctrl->cr); out_8(&ctrl->cr, CR_RR); }
EmcraftSystems/u-boot
C++
Other
181
/* This routine computes the total memory space available for allocation. */
jpeg_mem_available(j_common_ptr cinfo, long min_bytes_needed, long max_bytes_needed, long already_allocated)
/* This routine computes the total memory space available for allocation. */ jpeg_mem_available(j_common_ptr cinfo, long min_bytes_needed, long max_bytes_needed, long already_allocated)
{ if (cinfo->mem->max_memory_to_use) return cinfo->mem->max_memory_to_use - already_allocated; return max_bytes_needed; }
xboot/xboot
C++
MIT License
779
/* Call g_ascii_strncasecmp after checking if enough chars left, returning 0 if it returns 0 (meaning "equal") and -1 otherwise, otherwise return -1. */
gint tvb_strncaseeql(tvbuff_t *tvb, const gint offset, const gchar *str, const size_t size)
/* Call g_ascii_strncasecmp after checking if enough chars left, returning 0 if it returns 0 (meaning "equal") and -1 otherwise, otherwise return -1. */ gint tvb_strncaseeql(tvbuff_t *tvb, const gint offset, const gchar *str, const size_t size)
{ const guint8 *ptr; ptr = ensure_contiguous_no_exception(tvb, offset, (gint)size, NULL); if (ptr) { int cmp = g_ascii_strncasecmp((const char *)ptr, str, size); return (cmp == 0 ? 0 : -1); } else { return -1; } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Read data from the specified page in AT24MACXX. */
uint32_t at24macxx_read_page(uint32_t u32_page_address, uint32_t u32_page_size, uint8_t *p_rd_buffer)
/* Read data from the specified page in AT24MACXX. */ uint32_t at24macxx_read_page(uint32_t u32_page_address, uint32_t u32_page_size, uint8_t *p_rd_buffer)
{ twihs_package_t twihs_package; uint32_t start_address = (u32_page_address * u32_page_size) & 0xFFFF; twihs_package.chip = BOARD_AT24MAC_ADDRESS; at24mac_build_word_address(twihs_package.addr, start_address); twihs_package.addr_length = AT24MAC_MEM_ADDR_LEN; twihs_package.buffer = p_rd_buffer; twihs_package.length = u32_page_size; if (twihs_master_read(BOARD_AT24MAC_TWIHS_INSTANCE, &twihs_package) != TWIHS_SUCCESS) { return AT24MAC_READ_FAIL; } return AT24MAC_READ_SUCCESS; }
remotemcu/remcu-chip-sdks
C++
null
436