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
/* Query io scheduler to see if the current process issuing bio may be merged with rq. */
static int elv_iosched_allow_merge(struct request *rq, struct bio *bio)
/* Query io scheduler to see if the current process issuing bio may be merged with rq. */ static int elv_iosched_allow_merge(struct request *rq, struct bio *bio)
{ struct request_queue *q = rq->q; struct elevator_queue *e = q->elevator; if (e->ops->elevator_allow_merge_fn) return e->ops->elevator_allow_merge_fn(q, rq, bio); return 1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Check to see if the provided DMA channel is busy. */
static int tsi148_dma_busy(int channel)
/* Check to see if the provided DMA channel is busy. */ static int tsi148_dma_busy(int channel)
{ u32 tmp; tmp = ioread32be(tsi148_bridge->base + TSI148_LCSR_DMA[channel] + TSI148_LCSR_OFFSET_DSTA); if (tmp & TSI148_LCSR_DSTA_BSY) return 0; else return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* When the Enhanced Descriptor is enabled then the bit 0 of RDES0 indicates whether the Extended Status is available (RDES4). Time Stamp feature and the Checksum Offload Engine2 makes use of this extended status to provide the status of the received packet. */
bool synopGMAC_is_ext_status(synopGMACdevice *gmacdev, u32 status)
/* When the Enhanced Descriptor is enabled then the bit 0 of RDES0 indicates whether the Extended Status is available (RDES4). Time Stamp feature and the Checksum Offload Engine2 makes use of this extended status to provide the status of the received packet. */ bool synopGMAC_is_ext_status(synopGMACdevice *gmacdev, u3...
{ return ((status & DescRxEXTsts) != 0); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Check if the input buffer is long enough to enable us to decode 'nbytes' more bytes of data starting at the current position. If so return the current pointer, then update the current pointer position. */
__be32* xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes)
/* Check if the input buffer is long enough to enable us to decode 'nbytes' more bytes of data starting at the current position. If so return the current pointer, then update the current pointer position. */ __be32* xdr_inline_decode(struct xdr_stream *xdr, size_t nbytes)
{ __be32 *p = xdr->p; __be32 *q = p + XDR_QUADLEN(nbytes); if (unlikely(q > xdr->end || q < p)) return NULL; xdr->p = q; return p; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enables or disables the specified DMA Tx Desc Transmit interrupt. */
void ETH_EnableDmaTxDescTransmitInt(ETH_DMADescType *DMATxDesc, FunctionalState Cmd)
/* Enables or disables the specified DMA Tx Desc Transmit interrupt. */ void ETH_EnableDmaTxDescTransmitInt(ETH_DMADescType *DMATxDesc, FunctionalState Cmd)
{ assert_param(IS_FUNCTIONAL_STATE(Cmd)); if (Cmd != DISABLE) { DMATxDesc->CtrlOrBufSize |= ETH_DMA_TX_DESC_IC; } else { DMATxDesc->CtrlOrBufSize &= (~(uint32_t)ETH_DMA_TX_DESC_IC); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Register the Kinetis-specific ESDHC devices with the kernel */
void __init kinetis_esdhc_init(void)
/* Register the Kinetis-specific ESDHC devices with the kernel */ void __init kinetis_esdhc_init(void)
{ kinetis_esdhc_register(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Writes and returns a new value to DR2. This function is only available on IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. */
UINTN EFIAPI AsmWriteDr2(UINTN Dr2)
/* Writes and returns a new value to DR2. This function is only available on IA-32 and X64. This writes a 32-bit value on IA-32 and a 64-bit value on X64. */ UINTN EFIAPI AsmWriteDr2(UINTN Dr2)
{ __asm__ __volatile__ ( "movl %0, %%dr2" : : "r" (Dr2) ); return Dr2; }
tianocore/edk2
C++
Other
4,240
/* configure counter reload value, and prescaler divider value */
ErrStatus fwdgt_config(uint16_t reload_value, uint8_t prescaler_div)
/* configure counter reload value, and prescaler divider value */ ErrStatus fwdgt_config(uint16_t reload_value, uint8_t prescaler_div)
{ uint32_t time = FWDGT_PSC_TIMEOUT; uint32_t flag_status = RESET; FWDGT_CTL = FWDGT_WRITEACCESS_ENABLE; do{ flag_status = FWDGT_STAT & FWDGT_STAT_PUD; }while((--time > 0) && ((uint32_t)RESET != flag_status)); if ((uint32_t)RESET != flag_status) return ERROR; FWDGT_PSC = (uint...
liuxuming/trochili
C++
Apache License 2.0
132
/* uwb_dev_get_by_macaddr - get a UWB device with a specific EUI-48 @rc: the radio controller that saw the device @devaddr: EUI-48 of the UWB device to find */
struct uwb_dev* uwb_dev_get_by_macaddr(struct uwb_rc *rc, const struct uwb_mac_addr *macaddr)
/* uwb_dev_get_by_macaddr - get a UWB device with a specific EUI-48 @rc: the radio controller that saw the device @devaddr: EUI-48 of the UWB device to find */ struct uwb_dev* uwb_dev_get_by_macaddr(struct uwb_rc *rc, const struct uwb_mac_addr *macaddr)
{ struct uwb_dev *found = NULL; struct uwb_beca_e *bce; mutex_lock(&rc->uwb_beca.mutex); bce = __uwb_beca_find_bymac(rc, macaddr); if (bce) found = uwb_dev_try_get(rc, bce->uwb_dev); mutex_unlock(&rc->uwb_beca.mutex); return found; }
robutest/uclinux
C++
GPL-2.0
60
/* Get the target clock frequency to be set on the bus. */
UINT32 EmmcGetTargetClockFreq(IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 SlotIndex, IN EMMC_EXT_CSD *ExtCsd, IN SD_MMC_BUS_MODE BusTiming)
/* Get the target clock frequency to be set on the bus. */ UINT32 EmmcGetTargetClockFreq(IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 SlotIndex, IN EMMC_EXT_CSD *ExtCsd, IN SD_MMC_BUS_MODE BusTiming)
{ UINT32 PreferredClockFreq; UINT32 MaxClockFreq; PreferredClockFreq = Private->Slot[SlotIndex].OperatingParameters.ClockFreq; switch (BusTiming) { case SdMmcMmcHs400: case SdMmcMmcHs200: MaxClockFreq = 200; break; case SdMmcMmcHsSdr: case SdMmcMmcHsDdr: MaxClockFreq = 52; ...
tianocore/edk2
C++
Other
4,240
/* USBH_MTP_SelectStorage Select the storage Unit to be used. */
USBH_StatusTypeDef USBH_MTP_SelectStorage(USBH_HandleTypeDef *phost, uint8_t storage_idx)
/* USBH_MTP_SelectStorage Select the storage Unit to be used. */ USBH_StatusTypeDef USBH_MTP_SelectStorage(USBH_HandleTypeDef *phost, uint8_t storage_idx)
{ USBH_StatusTypeDef status = USBH_FAIL; MTP_HandleTypeDef *MTP_Handle = (MTP_HandleTypeDef *)phost->pActiveClass->pData; if((storage_idx < MTP_Handle->info.storids.n) && (MTP_Handle->is_ready)) { MTP_Handle->params.CurrentStorageId = MTP_Handle->info.storids.Storage[storage_idx]; status = USBH_OK...
labapart/polymcu
C++
null
201
/* This method will free @invocation, you cannot use it afterwards. */
void _g_freedesktop_dbus_complete_name_has_owner(_GFreedesktopDBus *object, GDBusMethodInvocation *invocation, gboolean has_owner)
/* This method will free @invocation, you cannot use it afterwards. */ void _g_freedesktop_dbus_complete_name_has_owner(_GFreedesktopDBus *object, GDBusMethodInvocation *invocation, gboolean has_owner)
{ g_dbus_method_invocation_return_value (invocation, g_variant_new ("(b)", has_owner)); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Logic for a wm8731 as connected on a Sharp SL-C7x0 Device */
static int poodle_wm8731_init(struct snd_soc_codec *codec)
/* Logic for a wm8731 as connected on a Sharp SL-C7x0 Device */ static int poodle_wm8731_init(struct snd_soc_codec *codec)
{ int err; snd_soc_dapm_nc_pin(codec, "LLINEIN"); snd_soc_dapm_nc_pin(codec, "RLINEIN"); snd_soc_dapm_enable_pin(codec, "MICIN"); err = snd_soc_add_controls(codec, wm8731_poodle_controls, ARRAY_SIZE(wm8731_poodle_controls)); if (err < 0) return err; snd_soc_dapm_new_controls(codec, wm8731_dapm_widgets, ...
robutest/uclinux
C++
GPL-2.0
60
/* This is the declaration of an EFI image entry point. This entry point is the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including both device drivers and bus drivers. */
EFI_STATUS EFIAPI RedfishRestExDriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* This is the declaration of an EFI image entry point. This entry point is the same for UEFI Applications, UEFI OS Loaders, and UEFI Drivers including both device drivers and bus drivers. */ EFI_STATUS EFIAPI RedfishRestExDriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; Status = EFI_SUCCESS; Status = EfiLibInstallDriverBindingComponentName2 ( ImageHandle, SystemTable, &gRedfishRestExDriverBinding, ImageHandle, &gRedfishRestExComponentName, &gRedfishRestExComponentName2 ...
tianocore/edk2
C++
Other
4,240
/* Enables or disables the Low Speed APB (APB1) peripheral clock. */
void RCC_APB1PeriphClockCmd(uint32_t RCC_APB1Periph, FunctionalState NewState)
/* Enables or disables the Low Speed APB (APB1) peripheral clock. */ void RCC_APB1PeriphClockCmd(uint32_t RCC_APB1Periph, FunctionalState NewState)
{ assert_param(IS_RCC_APB1_PERIPH(RCC_APB1Periph)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { RCC->APB1ENR |= RCC_APB1Periph; } else { RCC->APB1ENR &= ~RCC_APB1Periph; } }
MaJerle/stm32f429
C++
null
2,036
/* Description: Looks up the scsi_device with the specified @channel, @id, @lun for a given host. The returned scsi_device has an additional reference that needs to be released with scsi_device_put once you're done with it. */
struct scsi_device* scsi_device_lookup(struct Scsi_Host *shost, uint channel, uint id, uint lun)
/* Description: Looks up the scsi_device with the specified @channel, @id, @lun for a given host. The returned scsi_device has an additional reference that needs to be released with scsi_device_put once you're done with it. */ struct scsi_device* scsi_device_lookup(struct Scsi_Host *shost, uint channel, uint id, uint ...
{ struct scsi_device *sdev; unsigned long flags; spin_lock_irqsave(shost->host_lock, flags); sdev = __scsi_device_lookup(shost, channel, id, lun); if (sdev && scsi_device_get(sdev)) sdev = NULL; spin_unlock_irqrestore(shost->host_lock, flags); return sdev; }
robutest/uclinux
C++
GPL-2.0
60
/* Generic routines for handling agp_memory structures - They use the basic page allocation routines to do the brunt of the work. */
void agp_free_key(int key)
/* Generic routines for handling agp_memory structures - They use the basic page allocation routines to do the brunt of the work. */ void agp_free_key(int key)
{ if (key < 0) return; if (key < MAXKEY) clear_bit(key, agp_bridge->key_list); }
robutest/uclinux
C++
GPL-2.0
60
/* Enables or disables the selected DAC channel wave generation. */
void DAC_WaveGenerationEnable(uint32_t DAC_Wave, FunctionalState Cmd)
/* Enables or disables the selected DAC channel wave generation. */ void DAC_WaveGenerationEnable(uint32_t DAC_Wave, FunctionalState Cmd)
{ __IO uint32_t tmp = 0; assert_param(IS_DAC_WAVE(DAC_Wave)); assert_param(IS_FUNCTIONAL_STATE(Cmd)); tmp=DAC->CTRL; tmp&=~(3<<6); if (Cmd != DISABLE) { tmp |= DAC_Wave; } else { tmp&=~(3<<6); } DAC->CTRL =tmp; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Retrieves a Unicode string that is the user-readable name of the EFI Driver. */
EFI_STATUS EFIAPI RedfishDiscoverComponentNameGetDriverName(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 RedfishDiscoverComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
{ return LookupUnicodeString2 ( Language, This->SupportedLanguages, mRedfishDiscoverDriverNameTable, DriverName, (BOOLEAN)(This == &gRedfishDiscoverComponentName) ); }
tianocore/edk2
C++
Other
4,240
/* Write a single byte to the current I2C address, the the I2C link must be running or this returns -EIO */
static int i2c_algo_dp_aux_put_byte(struct i2c_adapter *adapter, u8 byte)
/* Write a single byte to the current I2C address, the the I2C link must be running or this returns -EIO */ static int i2c_algo_dp_aux_put_byte(struct i2c_adapter *adapter, u8 byte)
{ struct i2c_algo_dp_aux_data *algo_data = adapter->algo_data; int ret; if (!algo_data->running) return -EIO; ret = i2c_algo_dp_aux_transaction(adapter, MODE_I2C_WRITE, byte, NULL); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Deserializes the supplied (wire) buffer into publish data */
int MQTTDeserialize_publish(unsigned char *dup, int *qos, unsigned char *retained, unsigned short *packetid, MQTTString *topicName, unsigned char **payload, int *payloadlen, unsigned char *buf, int buflen)
/* Deserializes the supplied (wire) buffer into publish data */ int MQTTDeserialize_publish(unsigned char *dup, int *qos, unsigned char *retained, unsigned short *packetid, MQTTString *topicName, unsigned char **payload, int *payloadlen, unsigned char *buf, int buflen)
{ MQTTHeader header = {0}; unsigned char* curdata = buf; unsigned char* enddata = NULL; int rc = 0; int mylen = 0; FUNC_ENTRY; header.byte = readChar(&curdata); if (header.bits.type != PUBLISH) goto exit; *dup = header.bits.dup; *qos = header.bits.qos; *retained = hea...
pikasTech/PikaPython
C++
MIT License
1,403
/* Sets the drive mode for a GPIO port. */
void GPIO_DriveModeSet(GPIO_Port_TypeDef port, GPIO_DriveMode_TypeDef mode)
/* Sets the drive mode for a GPIO port. */ void GPIO_DriveModeSet(GPIO_Port_TypeDef port, GPIO_DriveMode_TypeDef mode)
{ EFM_ASSERT(GPIO_PORT_VALID(port) && GPIO_DRIVEMODE_VALID(mode)); GPIO->P[port].CTRL = (GPIO->P[port].CTRL & ~(_GPIO_P_CTRL_DRIVEMODE_MASK)) | (mode << _GPIO_P_CTRL_DRIVEMODE_SHIFT); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* v9fs_put_trans - put trans @m: transport to put */
void v9fs_put_trans(struct p9_trans_module *m)
/* v9fs_put_trans - put trans @m: transport to put */ void v9fs_put_trans(struct p9_trans_module *m)
{ if (m) module_put(m->owner); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* zfcp_dbf_san_els_response - trace event for completed ELS @fsf_req: request containing ELS response */
void zfcp_dbf_san_els_response(struct zfcp_fsf_req *fsf_req)
/* zfcp_dbf_san_els_response - trace event for completed ELS @fsf_req: request containing ELS response */ void zfcp_dbf_san_els_response(struct zfcp_fsf_req *fsf_req)
{ struct zfcp_fsf_ct_els *els = (struct zfcp_fsf_ct_els *)fsf_req->data; u32 d_id = ntoh24(fsf_req->qtcb->bottom.support.d_id); zfcp_dbf_san_els("rels", 2, fsf_req, d_id, sg_virt(els->resp), els->resp->length); }
robutest/uclinux
C++
GPL-2.0
60
/* This can store 16 bytes of OS-Dependent data. We use a byte-by-byte write approach. It's up to userspace to deal with it when constructing its input buffer. */
static ssize_t pdcs_osdep1_write(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count)
/* This can store 16 bytes of OS-Dependent data. We use a byte-by-byte write approach. It's up to userspace to deal with it when constructing its input buffer. */ static ssize_t pdcs_osdep1_write(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count)
{ u8 in[16]; if (!capable(CAP_SYS_ADMIN)) return -EACCES; if (!buf || !count) return -EINVAL; if (unlikely(pdcs_osid != OS_ID_LINUX)) return -EPERM; if (count > 16) return -EMSGSIZE; memset(in, 0, 16); memcpy(in, buf, count); if (pdc_stable_write(PDCS_ADDR_OSD1, &in, sizeof(in)) != PDC_OK) return -EIO...
robutest/uclinux
C++
GPL-2.0
60
/* qerror_destroy_obj(): Free all memory allocated by a QError */
static void qerror_destroy_obj(QObject *obj)
/* qerror_destroy_obj(): Free all memory allocated by a QError */ static void qerror_destroy_obj(QObject *obj)
{ QError *qerr; assert(obj != NULL); qerr = qobject_to_qerror(obj); g_free(qerr->err_msg); g_free(qerr); }
ve3wwg/teensy3_qemu
C++
Other
15
/* If this function returns, it means that the system does not support warm reset. */
VOID EFIAPI ResetWarm(VOID)
/* If this function returns, it means that the system does not support warm reset. */ VOID EFIAPI ResetWarm(VOID)
{ PeiServicesResetSystem2 (EfiResetWarm, EFI_SUCCESS, 0, NULL); }
tianocore/edk2
C++
Other
4,240
/* The software interrupt instruction (SWI) is used for entering Supervisor mode, usually to request a particular supervisor function. */
void rt_hw_trap_swi(struct rt_hw_register *regs)
/* The software interrupt instruction (SWI) is used for entering Supervisor mode, usually to request a particular supervisor function. */ void rt_hw_trap_swi(struct rt_hw_register *regs)
{ rt_kprintf("software interrupt\n"); rt_hw_show_register(regs); rt_hw_cpu_shutdown(); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Enables or disables the specified I2C dual addressing mode. */
void I2C_DualAddressCmd(I2C_TypeDef *I2Cx, FunctionalState NewState)
/* Enables or disables the specified I2C dual addressing mode. */ void I2C_DualAddressCmd(I2C_TypeDef *I2Cx, FunctionalState NewState)
{ assert_param(IS_I2C_ALL_PERIPH(I2Cx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { I2Cx->OAR2 |= I2C_OAR2_ENDUAL; } else { I2Cx->OAR2 &= (uint16_t)~((uint16_t)I2C_OAR2_ENDUAL); } }
MaJerle/stm32f429
C++
null
2,036
/* See mss_uart.h for details of how to use this function. */
void MSS_UART_set_address(mss_uart_instance_t *this_uart, uint8_t address)
/* See mss_uart.h for details of how to use this function. */ void MSS_UART_set_address(mss_uart_instance_t *this_uart, uint8_t address)
{ ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)); if((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) { this_uart->hw_reg->ADR = address; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Scan the objects already referenced (gray objects). More objects will be referenced and, if there are no memory leaks, all the objects are scanned. */
static void scan_gray_list(void)
/* Scan the objects already referenced (gray objects). More objects will be referenced and, if there are no memory leaks, all the objects are scanned. */ static void scan_gray_list(void)
{ struct kmemleak_object *object, *tmp; object = list_entry(gray_list.next, typeof(*object), gray_list); while (&object->gray_list != &gray_list) { cond_resched(); if (!scan_should_stop()) scan_object(object); tmp = list_entry(object->gray_list.next, typeof(*object), gray_list); list_del(&object->gra...
robutest/uclinux
C++
GPL-2.0
60
/* This function extracts the file size info from the FileHandle's EFI_FILE_INFO data. */
EFI_STATUS EFIAPI FileHandleGetSize(IN EFI_FILE_HANDLE FileHandle, OUT UINT64 *Size)
/* This function extracts the file size info from the FileHandle's EFI_FILE_INFO data. */ EFI_STATUS EFIAPI FileHandleGetSize(IN EFI_FILE_HANDLE FileHandle, OUT UINT64 *Size)
{ EFI_FILE_INFO *FileInfo; if ((FileHandle == NULL) || (Size == NULL)) { return (EFI_INVALID_PARAMETER); } FileInfo = FileHandleGetInfo (FileHandle); if (FileInfo == NULL) { return (EFI_DEVICE_ERROR); } *Size = FileInfo->FileSize; FreePool (FileInfo); return (EFI_SUCCESS); }
tianocore/edk2
C++
Other
4,240
/* Validates a new CPUFreq policy. This function has to be called with cpufreq_driver locked. */
static int longrun_verify_policy(struct cpufreq_policy *policy)
/* Validates a new CPUFreq policy. This function has to be called with cpufreq_driver locked. */ static int longrun_verify_policy(struct cpufreq_policy *policy)
{ if (!policy) return -EINVAL; policy->cpu = 0; cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq, policy->cpuinfo.max_freq); if ((policy->policy != CPUFREQ_POLICY_POWERSAVE) && (policy->policy != CPUFREQ_POLICY_PERFORMANCE)) return -EINVAL; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function is called from the videobuf layer to free memory allocated to the buffers */
static void vpif_buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb)
/* This function is called from the videobuf layer to free memory allocated to the buffers */ static void vpif_buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb)
{ struct vpif_fh *fh = q->priv_data; struct channel_obj *ch = fh->channel; struct common_obj *common; common = &ch->common[VPIF_VIDEO_INDEX]; videobuf_dma_contig_free(q, vb); vb->state = VIDEOBUF_NEEDS_INIT; }
robutest/uclinux
C++
GPL-2.0
60
/* Send a master transmit request when the bus is idle.(Write Step1) For this function returns immediately, it is always using in the interrupt hander. */
void xI2CMasterWriteRequestS1(unsigned long ulBase, unsigned char ucSlaveAddr, unsigned char ucData, xtBoolean bEndTransmition)
/* Send a master transmit request when the bus is idle.(Write Step1) For this function returns immediately, it is always using in the interrupt hander. */ void xI2CMasterWriteRequestS1(unsigned long ulBase, unsigned char ucSlaveAddr, unsigned char ucData, xtBoolean bEndTransmition)
{ unsigned long ulStatus; xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE)); xASSERT(!(ucSlaveAddr & 0x80)); ulStatus = I2CStartSend(ulBase); if(!(ulStatus == I2C_I2STAT_M_TX_START)) { I2CStopSend(ulBase); return; } ulStatus = I2CByteSend(ulBase, (ucSlaveAddr << 1))...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Helper function for the cn0415_status_pid(). Display the Ki constant for the PID controller. */
static void cn0415_status_pid_ki(struct cn0415_dev *dev)
/* Helper function for the cn0415_status_pid(). Display the Ki constant for the PID controller. */ static void cn0415_status_pid_ki(struct cn0415_dev *dev)
{ uint8_t buffer[20]; cn0415_ftoa((uint8_t*)buffer, dev->controller->ki); usr_uart_write_string(dev->aducm3029_uart_desc, (uint8_t*)" PID Ki: "); usr_uart_write_string(dev->aducm3029_uart_desc, (uint8_t*)buffer); usr_uart_write_string(dev->aducm3029_uart_desc, (uint8_t*)"\n"); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* returns true if one of the ssids in the request matches the P2P wildcard ssid; otherwise returns false. */
static bool brcmf_p2p_scan_is_p2p_request(struct cfg80211_scan_request *request)
/* returns true if one of the ssids in the request matches the P2P wildcard ssid; otherwise returns false. */ static bool brcmf_p2p_scan_is_p2p_request(struct cfg80211_scan_request *request)
{ struct cfg80211_ssid *ssids = request->ssids; int i; for (i = 0; i < request->n_ssids; i++) { if (ssids[i].ssid_len != BRCMF_P2P_WILDCARD_SSID_LEN) continue; brcmf_dbg(INFO, "comparing ssid \"%s\"", ssids[i].ssid); if (!memcmp(BRCMF_P2P_WILDCARD_SSID, ssids[i].ssid, BRCMF_P2P_WILDCARD_SSID_LEN)) ...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* get the data stored in data register of I2C module */
u8 tls_i2c_read_byte(u8 ifack, u8 ifstop)
/* get the data stored in data register of I2C module */ u8 tls_i2c_read_byte(u8 ifack, u8 ifstop)
{ u8 data; u32 value = I2C_CR_RD; if(!ifack) value |= I2C_CR_NAK; if(ifstop) value |= I2C_CR_STO; tls_reg_write32(HR_I2C_CR_SR, value); while(tls_reg_read32(HR_I2C_CR_SR) & I2C_SR_TIP); data = tls_reg_read32(HR_I2C_TX_RX); return data; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Locking Note: This functions should not be called with the lport lock held. */
int fc_lport_reset(struct fc_lport *lport)
/* Locking Note: This functions should not be called with the lport lock held. */ int fc_lport_reset(struct fc_lport *lport)
{ cancel_delayed_work_sync(&lport->retry_work); mutex_lock(&lport->lp_mutex); fc_lport_enter_reset(lport); mutex_unlock(&lport->lp_mutex); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Enables or disables the ADC Analog Watchdog Single Channel. */
void ADC_AnalogWatchdogSingleChannelCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
/* Enables or disables the ADC Analog Watchdog Single Channel. */ void ADC_AnalogWatchdogSingleChannelCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
{ assert_param(IS_ADC_ALL_PERIPH(ADCx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { ADCx->CFGR1 |= ADC_CFGR1_AWDSGL; } else { ADCx->CFGR1 &= (uint32_t)~ADC_CFGR1_AWDSGL; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* give up write locks. the i/o lock cannot be held nested if it is being demoted. */
void xfs_ilock_demote(xfs_inode_t *ip, uint lock_flags)
/* give up write locks. the i/o lock cannot be held nested if it is being demoted. */ void xfs_ilock_demote(xfs_inode_t *ip, uint lock_flags)
{ ASSERT(lock_flags & (XFS_IOLOCK_EXCL|XFS_ILOCK_EXCL)); ASSERT((lock_flags & ~(XFS_IOLOCK_EXCL|XFS_ILOCK_EXCL)) == 0); if (lock_flags & XFS_ILOCK_EXCL) mrdemote(&ip->i_lock); if (lock_flags & XFS_IOLOCK_EXCL) mrdemote(&ip->i_iolock); trace_xfs_ilock_demote(ip, lock_flags, _RET_IP_); }
robutest/uclinux
C++
GPL-2.0
60
/* Thread function performing automatic memory scanning. Unreferenced objects at the end of a memory scan are reported but only the first time. */
static int kmemleak_scan_thread(void *arg)
/* Thread function performing automatic memory scanning. Unreferenced objects at the end of a memory scan are reported but only the first time. */ static int kmemleak_scan_thread(void *arg)
{ static int first_run = 1; pr_info("Automatic memory scanning thread started\n"); set_user_nice(current, 10); if (first_run) { first_run = 0; ssleep(SECS_FIRST_SCAN); } while (!kthread_should_stop()) { signed long timeout = jiffies_scan_wait; mutex_lock(&scan_mutex); kmemleak_scan(); mutex_unlock(&sc...
robutest/uclinux
C++
GPL-2.0
60
/* Flushes the CPU write domain for the object if it's dirty. */
static void i915_gem_object_flush_cpu_write_domain(struct drm_gem_object *obj)
/* Flushes the CPU write domain for the object if it's dirty. */ static void i915_gem_object_flush_cpu_write_domain(struct drm_gem_object *obj)
{ struct drm_device *dev = obj->dev; uint32_t old_write_domain; if (obj->write_domain != I915_GEM_DOMAIN_CPU) return; i915_gem_clflush_object(obj); drm_agp_chipset_flush(dev); old_write_domain = obj->write_domain; obj->write_domain = 0; trace_i915_gem_object_change_domain(obj, obj->read_domains, ...
robutest/uclinux
C++
GPL-2.0
60
/* This is invoked by child/client driver that sits above vmbus */
void vmbus_get_interface(struct vmbus_channel_interface *interface)
/* This is invoked by child/client driver that sits above vmbus */ void vmbus_get_interface(struct vmbus_channel_interface *interface)
{ struct vmbus_driver *vmbus_drv_obj = &g_vmbus_drv.drv_obj; vmbus_drv_obj->GetChannelInterface(interface); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns the number of USB endpoint pairs on the device. */
uint32_t USBNumEndpointsGet(uint32_t ui32Base)
/* Returns the number of USB endpoint pairs on the device. */ uint32_t USBNumEndpointsGet(uint32_t ui32Base)
{ return(HWREGB(ui32Base + USB_O_EPINFO) & USB_EPINFO_TXEP_M); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Calculate a 32-bit CRC for a given data word (16 bits) */
uint32_t CRC_CalculateCRC16bits(uint16_t data)
/* Calculate a 32-bit CRC for a given data word (16 bits) */ uint32_t CRC_CalculateCRC16bits(uint16_t data)
{ *(uint16_t*)(CRC_BASE) = (uint16_t) data; return (CRC->DATA); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return the number of data frames saved so far for the specified stream. */
static guint spdy_get_num_data_frames(spdy_conv_t *conv_data, guint32 stream_id)
/* Return the number of data frames saved so far for the specified stream. */ static guint spdy_get_num_data_frames(spdy_conv_t *conv_data, guint32 stream_id)
{ spdy_stream_info_t *si = spdy_get_stream_info(conv_data, stream_id); return si == NULL ? 0 : si->num_data_frames; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Checks whether the specified RTC interrupt has occurred or not. */
ITStatus RTC_GetITStatus(uint32_t RTC_IT)
/* Checks whether the specified RTC interrupt has occurred or not. */ ITStatus RTC_GetITStatus(uint32_t RTC_IT)
{ ITStatus bitstatus = RESET; uint32_t tmpreg = 0, enablestatus = 0; assert_param(IS_RTC_GET_IT(RTC_IT)); tmpreg = (uint32_t)(RTC->TAFCR & (RTC_TAFCR_TAMPIE)); enablestatus = (uint32_t)((RTC->CR & RTC_IT) | (tmpreg & ((RTC_IT >> (RTC_IT >> 18)) >> 15))); tmpreg = (uint32_t)((RTC->ISR & (uint32_t)(RTC_IT >> ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Internal function to add IO poll opcode node to the table */
EFI_STATUS BootScriptWriteIoPoll(IN VA_LIST Marker)
/* Internal function to add IO poll opcode node to the table */ EFI_STATUS BootScriptWriteIoPoll(IN VA_LIST Marker)
{ S3_BOOT_SCRIPT_LIB_WIDTH Width; UINT64 Address; VOID *Data; VOID *DataMask; UINT64 Delay; Width = VA_ARG (Marker, S3_BOOT_SCRIPT_LIB_WIDTH); Address = VA_ARG (Marker, UINT64); Data = VA_ARG (Marker, VOID *); Dat...
tianocore/edk2
C++
Other
4,240
/* Return the number of parameters that follow the command name. */
static signed char prvGetNumberOfParameters(const signed char *pcCommandString)
/* Return the number of parameters that follow the command name. */ static signed char prvGetNumberOfParameters(const signed char *pcCommandString)
{ signed char cParameters = 0; portBASE_TYPE xLastCharacterWasSpace = pdFALSE; while( *pcCommandString != 0x00 ) { if( ( *pcCommandString ) == ' ' ) { if( xLastCharacterWasSpace != pdTRUE ) { cParameters++; xLastCharacterWasSpace = pdTRUE; } } else { xLastCharacterWasSpace = pdFALSE; }...
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Suspend the thread and chain it into the end of the list. */
rt_inline rt_err_t rt_channel_list_suspend(rt_list_t *list, struct rt_thread *thread)
/* Suspend the thread and chain it into the end of the list. */ rt_inline rt_err_t rt_channel_list_suspend(rt_list_t *list, struct rt_thread *thread)
{ rt_err_t ret = rt_thread_suspend_with_flag(thread, RT_INTERRUPTIBLE); if (ret == RT_EOK) { rt_list_insert_before(list, &(thread->tlist)); } return ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Registered in the pci_driver structure, this function is called when the PCI subsystem detects that a PCI device which matches the information contained in the pci_device_id table has been removed. */
static void __devexit et131x_pci_remove(struct pci_dev *pdev)
/* Registered in the pci_driver structure, this function is called when the PCI subsystem detects that a PCI device which matches the information contained in the pci_device_id table has been removed. */ static void __devexit et131x_pci_remove(struct pci_dev *pdev)
{ struct net_device *netdev; struct et131x_adapter *adapter; netdev = (struct net_device *) pci_get_drvdata(pdev); adapter = netdev_priv(netdev); unregister_netdev(netdev); et131x_adapter_memory_free(adapter); iounmap(adapter->regs); pci_dev_put(adapter->pdev); free_netdev(netdev); pci_release_regions(pdev); ...
robutest/uclinux
C++
GPL-2.0
60
/* Returns: the new address of the allocated memory */
gpointer g_realloc(gpointer mem, gsize n_bytes)
/* Returns: the new address of the allocated memory */ gpointer g_realloc(gpointer mem, gsize n_bytes)
{ gpointer newmem; if (G_LIKELY (n_bytes)) { newmem = realloc (mem, n_bytes); TRACE (GLIB_MEM_REALLOC((void*) newmem, (void*)mem, (unsigned int) n_bytes, 0)); if (newmem) return newmem; g_error ("%s: failed to allocate %"G_GSIZE_FORMAT" bytes", G_STRLOC, n_bytes); } ...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If any errors occur, such as a corrupted compressed stream, an error is printed an the platform's exit() function is called. */
int gunzip_finish(struct gunzip_state *state, void *dst, int dstlen)
/* If any errors occur, such as a corrupted compressed stream, an error is printed an the platform's exit() function is called. */ int gunzip_finish(struct gunzip_state *state, void *dst, int dstlen)
{ int len; len = gunzip_partial(state, dst, dstlen); if (state->s.workspace) { zlib_inflateEnd(&state->s); } return len; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Convert SPLIT_TIMEOUT to jiffies. The default and minimum as per 1394a-2000 clause 8.3.2.2.6 is 100ms. */
static void calculate_expire(struct csr_control *csr)
/* Convert SPLIT_TIMEOUT to jiffies. The default and minimum as per 1394a-2000 clause 8.3.2.2.6 is 100ms. */ static void calculate_expire(struct csr_control *csr)
{ unsigned int usecs = (csr->split_timeout_hi & 7) * 1000000 + (csr->split_timeout_lo >> 19) * 125; csr->expire = usecs_to_jiffies(usecs > 100000 ? usecs : 100000); HPSB_VERBOSE("CSR: setting expire to %lu, HZ=%u", csr->expire, HZ); }
robutest/uclinux
C++
GPL-2.0
60
/* BusLogic_DeallocateCCB deallocates a CCB, returning it to the Host Adapter's free list. The Host Adapter's Lock should already have been acquired by the caller. */
static void BusLogic_DeallocateCCB(struct BusLogic_CCB *CCB)
/* BusLogic_DeallocateCCB deallocates a CCB, returning it to the Host Adapter's free list. The Host Adapter's Lock should already have been acquired by the caller. */ static void BusLogic_DeallocateCCB(struct BusLogic_CCB *CCB)
{ struct BusLogic_HostAdapter *HostAdapter = CCB->HostAdapter; scsi_dma_unmap(CCB->Command); pci_unmap_single(HostAdapter->PCI_Device, CCB->SenseDataPointer, CCB->SenseDataLength, PCI_DMA_FROMDEVICE); CCB->Command = NULL; CCB->Status = BusLogic_CCB_Free; CCB->Next = HostAdapter->Free_CCBs; HostAdapter->Free_...
robutest/uclinux
C++
GPL-2.0
60
/* Read, classify, and fill other details about the next option. 'psize' is filled with option's size, 'notoalign' with its alignment requirements. Local variable 'size' gets the size to be aligned. (Kpadal option always gets its full alignment, other options are limited by the maximum alignment ('maxalign'). Kchar opt...
static KOption getdetails(Header *h, size_t totalsize, const char **fmt, int *psize, int *ntoalign)
/* Read, classify, and fill other details about the next option. 'psize' is filled with option's size, 'notoalign' with its alignment requirements. Local variable 'size' gets the size to be aligned. (Kpadal option always gets its full alignment, other options are limited by the maximum alignment ('maxalign'). Kchar opt...
{ KOption opt = getoption(h, fmt, psize); int align = *psize; if (opt == Kpaddalign) { if (**fmt == '\0' || getoption(h, fmt, &align) == Kchar || align == 0) luaL_argerror(h->L, 1, "invalid next option for option 'X'"); } if (align <= 1 || opt == Kchar) *ntoalign = 0; else { if (align > h-...
Nicholas3388/LuaNode
C++
Other
1,055
/* Find the available free space for EAs. This also returns the total number of bytes used by EA entries. */
static size_t ext4_xattr_free_space(struct ext4_xattr_entry *last, size_t *min_offs, void *base, int *total)
/* Find the available free space for EAs. This also returns the total number of bytes used by EA entries. */ static size_t ext4_xattr_free_space(struct ext4_xattr_entry *last, size_t *min_offs, void *base, int *total)
{ for (; !IS_LAST_ENTRY(last); last = EXT4_XATTR_NEXT(last)) { *total += EXT4_XATTR_LEN(last->e_name_len); if (!last->e_value_block && last->e_value_size) { size_t offs = le16_to_cpu(last->e_value_offs); if (offs < *min_offs) *min_offs = offs; } } return (*min_offs - ((void *)last - base) - sizeof(__...
robutest/uclinux
C++
GPL-2.0
60
/* Reads in and discards the next report from the attached device. */
void DiscardNextReport(void)
/* Reads in and discards the next report from the attached device. */ void DiscardNextReport(void)
{ if (USB_HostState != HOST_STATE_Configured) return; Pipe_SelectPipe(HID_DATA_IN_PIPE); Pipe_Unfreeze(); if (!(Pipe_IsINReceived())) { Pipe_Freeze(); return; } Pipe_ClearIN(); Pipe_Freeze(); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Generic cleanup handling data allocated during init. Used when the module is unloaded or if an error occurs during initialization */
static void ace_init_cleanup(struct net_device *dev)
/* Generic cleanup handling data allocated during init. Used when the module is unloaded or if an error occurs during initialization */ static void ace_init_cleanup(struct net_device *dev)
{ struct ace_private *ap; ap = netdev_priv(dev); ace_free_descriptors(dev); if (ap->info) pci_free_consistent(ap->pdev, sizeof(struct ace_info), ap->info, ap->info_dma); kfree(ap->skb); kfree(ap->trace_buf); if (dev->irq) free_irq(dev->irq, dev); iounmap(ap->regs); }
robutest/uclinux
C++
GPL-2.0
60
/* This function will transform @tc into a local index within the returned #CPUMIPSState. */
static CPUMIPSState* mips_cpu_map_tc(CPUMIPSState *env, int *tc)
/* This function will transform @tc into a local index within the returned #CPUMIPSState. */ static CPUMIPSState* mips_cpu_map_tc(CPUMIPSState *env, int *tc)
{ MIPSCPU *cpu; CPUState *cs; CPUState *other_cs; int vpe_idx; int tc_idx = *tc; if (!(env->CP0_VPEConf0 & (1 << CP0VPEC0_MVP))) { *tc = env->current_tc; return env; } cs = CPU(mips_env_get_cpu(env)); vpe_idx = tc_idx / cs->nr_threads; *tc = tc_idx % cs->nr_thread...
ve3wwg/teensy3_qemu
C++
Other
15
/* Disable the SPI interrupt of the specified SPI port. */
void SPIIntDisable(unsigned long ulBase)
/* Disable the SPI interrupt of the specified SPI port. */ void SPIIntDisable(unsigned long ulBase)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE) || (ulBase == SPI3_BASE)); xHWREG(ulBase + SPI_CNTRL) &= ~SPI_CNTRL_IE; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Description: Determines whether bio_integrity_prep() can be called on this bio or not. bio data direction and target device must be set prior to calling. The functions honors the write_generate and read_verify flags in sysfs. */
int bio_integrity_enabled(struct bio *bio)
/* Description: Determines whether bio_integrity_prep() can be called on this bio or not. bio data direction and target device must be set prior to calling. The functions honors the write_generate and read_verify flags in sysfs. */ int bio_integrity_enabled(struct bio *bio)
{ if (bio_integrity(bio)) return 0; return bdev_integrity_enabled(bio->bi_bdev, bio_data_dir(bio)); }
robutest/uclinux
C++
GPL-2.0
60
/* When GPIO is in output mode, puts the corresponding GPO in High (1) or Low (0) level. */
int32_t MFXSTM32L152_IO_WritePin(MFXSTM32L152_Object_t *pObj, uint32_t IO_Pin, uint8_t PinState)
/* When GPIO is in output mode, puts the corresponding GPO in High (1) or Low (0) level. */ int32_t MFXSTM32L152_IO_WritePin(MFXSTM32L152_Object_t *pObj, uint32_t IO_Pin, uint8_t PinState)
{ int32_t ret = MFXSTM32L152_OK; if (PinState != 0U) { if (MFXSTM32L152_reg24_setPinValue(pObj, MFXSTM32L152_REG_ADR_GPO_SET1, IO_Pin, 1) != MFXSTM32L152_OK) { ret = MFXSTM32L152_ERROR; } } else { if (MFXSTM32L152_reg24_setPinValue(pObj, MFXSTM32L152_REG_ADR_GPO_CLR1, IO_Pin, 1) != MFX...
eclipse-threadx/getting-started
C++
Other
310
/* @rong This function is to use black spot avoidance scheme @para g2d_image_enh *p_dst_image, g2d_image_enh *p_src_image */
static void modify_premul(g2d_image_enh *p_dst_image, g2d_image_enh *p_src_image)
/* @rong This function is to use black spot avoidance scheme @para g2d_image_enh *p_dst_image, g2d_image_enh *p_src_image */ static void modify_premul(g2d_image_enh *p_dst_image, g2d_image_enh *p_src_image)
{ p_dst_image->bpremul = 1; p_src_image->bpremul = 1; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Converts a generic text device path node to device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextPath(IN CHAR16 *TextDeviceNode)
/* Converts a generic text device path node to device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextPath(IN CHAR16 *TextDeviceNode)
{ CHAR16 *TypeStr; TypeStr = GetNextParamStr (&TextDeviceNode); return DevPathFromTextGenericPath ((UINT8)Strtoi (TypeStr), TextDeviceNode); }
tianocore/edk2
C++
Other
4,240
/* Open a pipe of the low level driver. */
USBH_StatusTypeDef USBH_LL_OpenPipe(USBH_HandleTypeDef *phost, uint8_t pipe_num, uint8_t epnum, uint8_t dev_address, uint8_t speed, uint8_t ep_type, uint16_t mps)
/* Open a pipe of the low level driver. */ USBH_StatusTypeDef USBH_LL_OpenPipe(USBH_HandleTypeDef *phost, uint8_t pipe_num, uint8_t epnum, uint8_t dev_address, uint8_t speed, uint8_t ep_type, uint16_t mps)
{ HAL_StatusTypeDef hal_status = HAL_OK; USBH_StatusTypeDef usb_status = USBH_OK; hal_status = HAL_HCD_HC_Init(static_cast<HCD_HandleTypeDef *>(phost->pData), pipe_num, epnum, dev_address, speed, ep_type, mps); usb_status = USBH_Get_USB_Status(hal_status); return usb_status; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Maintain the counters used in the SNMP statistics for outgoing ICMP */
void icmp_out_count(struct net *net, unsigned char type)
/* Maintain the counters used in the SNMP statistics for outgoing ICMP */ void icmp_out_count(struct net *net, unsigned char type)
{ ICMPMSGOUT_INC_STATS(net, type); ICMP_INC_STATS(net, ICMP_MIB_OUTMSGS); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Read data from Serial Flash device. This function reads data from the Serial Flash device, into a buffer. */
enum status_code mx25v_read_buffer(uint32_t address, void *data, uint32_t length)
/* Read data from Serial Flash device. This function reads data from the Serial Flash device, into a buffer. */ enum status_code mx25v_read_buffer(uint32_t address, void *data, uint32_t length)
{ enum status_code status; uint8_t tx_buf[4] = { MX25V_CMD_READ, (uint8_t)(address >> 16), (uint8_t)(address >> 8), (uint8_t)(address) }; Assert(data); if ((address + length) > MX25V_FLASH_SIZE) { return STATUS_ERR_INVALID_ARG; } _mx25v_chip_select(); status = spi_write_buffer_wait(&_mx25v_spi, tx_buf...
memfault/zero-to-main
C++
null
200
/* unlock the FMC bank0 operation this function can be used for all GD32F10x devices. for GD32F10x_MD and GD32F10x_HD, this function unlocks bank0. for GD32F10x_XD and GD32F10x_CL with flash no more than 512KB, it is equivalent to fmc_unlock function. */
void fmc_bank0_unlock(void)
/* unlock the FMC bank0 operation this function can be used for all GD32F10x devices. for GD32F10x_MD and GD32F10x_HD, this function unlocks bank0. for GD32F10x_XD and GD32F10x_CL with flash no more than 512KB, it is equivalent to fmc_unlock function. */ void fmc_bank0_unlock(void)
{ if((RESET != (FMC_CTL0 & FMC_CTL0_LK))){ FMC_KEY0 = UNLOCK_KEY0; FMC_KEY0 = UNLOCK_KEY1; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Starts a new thread with priority "prio" that will begin its execution in the function "thread()". The "arg" argument will be passed as an argument to the thread() function. The id of the new thread is returned. Both the id and the priority are system dependent. */
sys_thread_t sys_thread_new(void(*thread)(void *arg), void *arg, int prio)
/* Starts a new thread with priority "prio" that will begin its execution in the function "thread()". The "arg" argument will be passed as an argument to the thread() function. The id of the new thread is returned. Both the id and the priority are system dependent. */ sys_thread_t sys_thread_new(void(*thread)(void *ar...
{ xTaskHandle CreatedTask; int result; result = xTaskCreate(thread, ( signed char * ) s_sys_arch_state.cTaskName, s_sys_arch_state.nStackDepth, arg, prio, &CreatedTask ); timeoutlist[nextthread++].pid = CreatedTask; if(result == pdPASS) { ++s_sys_arch_state.nTaskCount; return CreatedTask; } else { return N...
apopple/Pandaboard-FreeRTOS
C++
null
25
/* If 32-bit MMIO register operations are not supported, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT32 EFIAPI S3MmioBitFieldRead32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
/* If 32-bit MMIO register operations are not supported, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */ UINT32 EFIAPI S3MmioBitFieldRead32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
{ return InternalSaveMmioWrite32ValueToBootScript (Address, MmioBitFieldRead32 (Address, StartBit, EndBit)); }
tianocore/edk2
C++
Other
4,240
/* calculate the CRC value of an array of 32-bit values */
uint32_t crc_block_data_calculate(uint32_t array[], uint32_t size)
/* calculate the CRC value of an array of 32-bit values */ uint32_t crc_block_data_calculate(uint32_t array[], uint32_t size)
{ uint32_t index; for(index = 0U; index < size; index++) { CRC_DATA = array[index]; } return (CRC_DATA); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* iwl_txq_ctx_stop - Stop all Tx DMA channels, free Tx queue memory */
void iwl_txq_ctx_stop(struct iwl_priv *priv)
/* iwl_txq_ctx_stop - Stop all Tx DMA channels, free Tx queue memory */ void iwl_txq_ctx_stop(struct iwl_priv *priv)
{ int ch; unsigned long flags; spin_lock_irqsave(&priv->lock, flags); priv->cfg->ops->lib->txq_set_sched(priv, 0); for (ch = 0; ch < priv->hw_params.dma_chnl_num; ch++) { iwl_write_direct32(priv, FH_TCSR_CHNL_TX_CONFIG_REG(ch), 0x0); iwl_poll_direct_bit(priv, FH_TSSR_TX_STATUS_REG, FH_TSSR_TX_STATUS_RE...
robutest/uclinux
C++
GPL-2.0
60
/* Auxiliary function for getting event state on right bit possition. This function calls nrf_twis_event_get function but the the result is shifted to match INTEN register scheme. */
static uint32_t nrf_drv_twis_event_bit_get(NRF_TWIS_Type *const p_reg, nrf_twis_event_t ev)
/* Auxiliary function for getting event state on right bit possition. This function calls nrf_twis_event_get function but the the result is shifted to match INTEN register scheme. */ static uint32_t nrf_drv_twis_event_bit_get(NRF_TWIS_Type *const p_reg, nrf_twis_event_t ev)
{ return (uint32_t)nrf_twis_event_get_and_clear(p_reg, ev) << nrf_drv_event_to_bitpos(ev); }
labapart/polymcu
C++
null
201
/* Wake up duration event. 1LSb = 1 / ODR. */
int32_t lsm6dso_wkup_dur_get(lsm6dso_ctx_t *ctx, uint8_t *val)
/* Wake up duration event. 1LSb = 1 / ODR. */ int32_t lsm6dso_wkup_dur_get(lsm6dso_ctx_t *ctx, uint8_t *val)
{ lsm6dso_wake_up_dur_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_WAKE_UP_DUR, (uint8_t*)&reg, 1); *val = reg.wake_dur; return ret; }
alexander-g-dean/ESF
C++
null
41
/* Description: Removes any and all CIPSO options from the given packet. Returns zero on success, negative values on failure. */
int cipso_v4_skbuff_delattr(struct sk_buff *skb)
/* Description: Removes any and all CIPSO options from the given packet. Returns zero on success, negative values on failure. */ int cipso_v4_skbuff_delattr(struct sk_buff *skb)
{ int ret_val; struct iphdr *iph; struct ip_options *opt = &IPCB(skb)->opt; unsigned char *cipso_ptr; if (opt->cipso == 0) return 0; ret_val = skb_cow(skb, skb_headroom(skb)); if (ret_val < 0) return ret_val; iph = ip_hdr(skb); cipso_ptr = (unsigned char *)iph + opt->cipso; memset(cipso_ptr, IPOPT_NOOP, c...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set each stc_can_ttc_config_t field to a default value. */
int32_t CAN_TTC_StructInit(stc_can_ttc_config_t *pstcCanTtc)
/* Set each stc_can_ttc_config_t field to a default value. */ int32_t CAN_TTC_StructInit(stc_can_ttc_config_t *pstcCanTtc)
{ int32_t i32Ret = LL_ERR_INVD_PARAM; if (pstcCanTtc != NULL) { pstcCanTtc->u8NTUPrescaler = CAN_TTC_NTU_PRESCALER1; pstcCanTtc->u32RefMsgID = 0x0UL; pstcCanTtc->u32RefMsgIDE = 0U; pstcCanTtc->u8TxBufMode = CAN_TTC_TX_BUF_MD_TTCAN; pstcCanTtc->...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function performs a software reset of the entire device. The processor and all peripherals are reset and all device registers are returned to their default values (with the exception of the reset cause register, which maintains its current value but has the software reset bit set as well). */
void SysCtlReset(void)
/* This function performs a software reset of the entire device. The processor and all peripherals are reset and all device registers are returned to their default values (with the exception of the reset cause register, which maintains its current value but has the software reset bit set as well). */ void SysCtlReset(v...
{ HWREG(NVIC_APINT) = NVIC_APINT_VECTKEY | NVIC_APINT_SYSRESETREQ; while (1) { } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function optionally returns the signature, length and revision of the ACPI table. */
UINT32 EFIAPI ParseAcpiHeader(IN UINT8 *Ptr, OUT CONST UINT32 **Signature, OUT CONST UINT32 **Length, OUT CONST UINT8 **Revision)
/* This function optionally returns the signature, length and revision of the ACPI table. */ UINT32 EFIAPI ParseAcpiHeader(IN UINT8 *Ptr, OUT CONST UINT32 **Signature, OUT CONST UINT32 **Length, OUT CONST UINT8 **Revision)
{ UINT32 BytesParsed; BytesParsed = ParseAcpi ( FALSE, 0, NULL, Ptr, sizeof (EFI_ACPI_DESCRIPTION_HEADER), PARSER_PARAMS (AcpiHeaderParser) ); *Signature = AcpiHdrInfo.Signature; *Lengt...
tianocore/edk2
C++
Other
4,240
/* TRUE if p is a lookaside memory allocation from db */
static int isLookaside(sqlite3 *db, void *p)
/* TRUE if p is a lookaside memory allocation from db */ static int isLookaside(sqlite3 *db, void *p)
{ return p && p>=db->lookaside.pStart && p<db->lookaside.pEnd; }
DC-SWAT/DreamShell
C++
null
404
/* Initialize the boards on-board LEDs. The LEDs initialization is hard-coded in this function. As the LED is soldered onto the board it is fixed to its CPU pins. */
static void leds_init(void)
/* Initialize the boards on-board LEDs. The LEDs initialization is hard-coded in this function. As the LED is soldered onto the board it is fixed to its CPU pins. */ static void leds_init(void)
{ RCC->APB2ENR |= RCC_APB2ENR_IOPAEN; LED_PORT->CR[1] &= ~(0xf << (4*(LED_RED_PIN - 8)) | 0xf << (4*(LED_GREEN_PIN - 8)) | 0xf << (4*(LED_BLUE_PIN - 8)) | 0xf << (4*(LED_WHITE_PIN - 8))); LED_PORT->CR[1] |= (0x3 << (4*(LED_RED_PIN - 8)) | ...
labapart/polymcu
C++
null
201
/* Search the most top object which fully covers an area */
static lv_obj_t * lv_refr_get_top_obj(const lv_area_t *area_p, lv_obj_t *obj)
/* Search the most top object which fully covers an area */ static lv_obj_t * lv_refr_get_top_obj(const lv_area_t *area_p, lv_obj_t *obj)
{ lv_obj_t * found_p = NULL; if(lv_area_is_in(area_p, &obj->coords) && obj->hidden == 0) { lv_obj_t * i; LV_LL_READ(obj->child_ll, i) { found_p = lv_refr_get_top_obj(area_p, i); if(found_p != NULL) { break; } } if(found_...
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* NVIC Clear Pending Interrupt. Force remove a user interrupt from a pending state. This has no effect if the interrupt is actively being serviced. */
void nvic_clear_pending_irq(uint8_t irqn)
/* NVIC Clear Pending Interrupt. Force remove a user interrupt from a pending state. This has no effect if the interrupt is actively being serviced. */ void nvic_clear_pending_irq(uint8_t irqn)
{ NVIC_ICPR(irqn / 32) = (1 << (irqn % 32)); }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* pcie_device_init - allocate and initialize PCI Express port service device @pdev: PCI Express port to associate the service device with @service: Type of service to associate with the service device @irq: Interrupt vector to associate with the service device */
static int pcie_device_init(struct pci_dev *pdev, int service, int irq)
/* pcie_device_init - allocate and initialize PCI Express port service device @pdev: PCI Express port to associate the service device with @service: Type of service to associate with the service device @irq: Interrupt vector to associate with the service device */ static int pcie_device_init(struct pci_dev *pdev, int ...
{ int retval; struct pcie_device *pcie; struct device *device; pcie = kzalloc(sizeof(*pcie), GFP_KERNEL); if (!pcie) return -ENOMEM; pcie->port = pdev; pcie->irq = irq; pcie->service = service; device = &pcie->device; device->bus = &pcie_port_bus_type; device->release = release_pcie_device; dev_set_name(d...
robutest/uclinux
C++
GPL-2.0
60
/* Returns 0 if the action string was recognized. */
int kobject_action_type(const char *buf, size_t count, enum kobject_action *type)
/* Returns 0 if the action string was recognized. */ int kobject_action_type(const char *buf, size_t count, enum kobject_action *type)
{ enum kobject_action action; int ret = -EINVAL; if (count && (buf[count-1] == '\n' || buf[count-1] == '\0')) count--; if (!count) goto out; for (action = 0; action < ARRAY_SIZE(kobject_actions); action++) { if (strncmp(kobject_actions[action], buf, count) != 0) continue; if (kobject_actions[action][cou...
robutest/uclinux
C++
GPL-2.0
60
/* i5400_put_devices 'put' all the devices that we have reserved via 'get' */
static void i5400_put_devices(struct mem_ctl_info *mci)
/* i5400_put_devices 'put' all the devices that we have reserved via 'get' */ static void i5400_put_devices(struct mem_ctl_info *mci)
{ struct i5400_pvt *pvt; pvt = mci->pvt_info; pci_dev_put(pvt->branch_1); pci_dev_put(pvt->branch_0); pci_dev_put(pvt->fsb_error_regs); pci_dev_put(pvt->branchmap_werrors); }
robutest/uclinux
C++
GPL-2.0
60
/* This function will get network interface device in network interface device list by netdev name. */
struct netdev* netdev_get_by_name(const char *name)
/* This function will get network interface device in network interface device list by netdev name. */ struct netdev* netdev_get_by_name(const char *name)
{ rt_base_t level; rt_slist_t *node = RT_NULL; struct netdev *netdev = RT_NULL; if (netdev_list == RT_NULL) { return RT_NULL; } level = rt_hw_interrupt_disable(); for (node = &(netdev_list->list); node; node = rt_slist_next(node)) { netdev = rt_slist_entry(node, struc...
pikasTech/PikaPython
C++
MIT License
1,403
/* Checks the selected Global interrupt source pending bit. */
FlagStatus IOE_GetGITStatus(uint8_t DeviceAddr, uint8_t Global_IT)
/* Checks the selected Global interrupt source pending bit. */ FlagStatus IOE_GetGITStatus(uint8_t DeviceAddr, uint8_t Global_IT)
{ __IO uint8_t tmp = 0; tmp = I2C_ReadDeviceRegister(DeviceAddr, IOE_REG_INT_STA); if ((tmp & (uint8_t)Global_IT) != 0) { return SET; } else { return RESET; } }
remotemcu/remcu-chip-sdks
C++
null
436
/* Check that ns is within the receive window. */
int nr_in_rx_window(struct sock *sk, unsigned short ns)
/* Check that ns is within the receive window. */ int nr_in_rx_window(struct sock *sk, unsigned short ns)
{ struct nr_sock *nr = nr_sk(sk); unsigned short vc = nr->vr; unsigned short vt = (nr->vl + nr->window) % NR_MODULUS; while (vc != vt) { if (ns == vc) return 1; vc = (vc + 1) % NR_MODULUS; } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set the power saving mode for the WINC1500. */
NMI_API sint8 m2m_wifi_set_sleep_mode(uint8 PsTyp, uint8 BcastEn)
/* Set the power saving mode for the WINC1500. */ NMI_API sint8 m2m_wifi_set_sleep_mode(uint8 PsTyp, uint8 BcastEn)
{ sint8 ret = M2M_SUCCESS; tstrM2mPsType strPs; strPs.u8PsType = PsTyp; strPs.u8BcastEn = BcastEn; ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_SLEEP, (uint8*) &strPs,sizeof(tstrM2mPsType), NULL, 0, 0); M2M_INFO("POWER SAVE %d\n",PsTyp); hif_set_sleep_mode(PsTyp); return ret; }
remotemcu/remcu-chip-sdks
C++
null
436
/* RETURNS: ata_port pointer on success / NULL on failure. */
struct ata_port* ata_sas_port_alloc(struct ata_host *host, struct ata_port_info *port_info, struct Scsi_Host *shost)
/* RETURNS: ata_port pointer on success / NULL on failure. */ struct ata_port* ata_sas_port_alloc(struct ata_host *host, struct ata_port_info *port_info, struct Scsi_Host *shost)
{ struct ata_port *ap; ap = ata_port_alloc(host); if (!ap) return NULL; ap->port_no = 0; ap->lock = shost->host_lock; ap->pio_mask = port_info->pio_mask; ap->mwdma_mask = port_info->mwdma_mask; ap->udma_mask = port_info->udma_mask; ap->flags |= port_info->flags; ap->ops = port_info->port_ops; ap->cbl = ATA...
EmcraftSystems/linux-emcraft
C++
Other
266
/* client descriptor found handler invoked by ble manager */
void csc_prf_descriptor_found_handler(at_ble_descriptor_found_t *params)
/* client descriptor found handler invoked by ble manager */ void csc_prf_descriptor_found_handler(at_ble_descriptor_found_t *params)
{ memcpy((uint8_t *)&app_csc_info.csc_desc, params, sizeof(at_ble_descriptor_found_t)); app_csc_info.discover_role = DISCOVER_IDLE; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Write a single byte to the text display. */
int RETARGET_WriteChar(char c)
/* Write a single byte to the text display. */ int RETARGET_WriteChar(char c)
{ if (textDisplayHandle) { TEXTDISPLAY_WriteChar(textDisplayHandle, c); return c; } else return -1; }
remotemcu/remcu-chip-sdks
C++
null
436
/* For path name based fid we don't block. So we can directly call the fs driver ops. */
int v9fs_co_name_to_path(V9fsPDU *pdu, V9fsPath *dirpath, const char *name, V9fsPath *path)
/* For path name based fid we don't block. So we can directly call the fs driver ops. */ int v9fs_co_name_to_path(V9fsPDU *pdu, V9fsPath *dirpath, const char *name, V9fsPath *path)
{ int err; V9fsState *s = pdu->s; if (s->ctx.export_flags & V9FS_PATHNAME_FSCONTEXT) { err = s->ops->name_to_path(&s->ctx, dirpath, name, path); if (err < 0) { err = -errno; } } else { if (v9fs_request_cancelled(pdu)) { return -EINTR; } ...
ve3wwg/teensy3_qemu
C++
Other
15
/* Returns the gain of the ambiant light sensor. */
int32_t BSP_LIGHT_SENSOR_GetGain(uint32_t Instance, uint8_t Channel, uint32_t *pGain)
/* Returns the gain of the ambiant light sensor. */ int32_t BSP_LIGHT_SENSOR_GetGain(uint32_t Instance, uint8_t Channel, uint32_t *pGain)
{ int32_t status = BSP_ERROR_NONE; if (Instance >= LIGHT_SENSOR_INSTANCES_NBR) { status = BSP_ERROR_WRONG_PARAM; } else { if (VEML6030_LIGHT_SENSOR_Drv[Instance]->GetGain(VEML6030_LIGHT_SENSOR_CompObj[Instance],Channel,pGain) < 0) { status = BSP_ERROR_COMPONENT_FAILURE; } } return ...
eclipse-threadx/getting-started
C++
Other
310
/* 10.28 Cell Identity List coded as the value part of the Cell Identity List IE defined in 3GPP TS 48.071. */
static guint16 be_measured_cell_identity(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
/* 10.28 Cell Identity List coded as the value part of the Cell Identity List IE defined in 3GPP TS 48.071. */ static guint16 be_measured_cell_identity(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
{ proto_tree_add_expert(tree, pinfo, &ei_gsm_a_bssmap_le_not_decoded_yet, tvb, offset, len); return len; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* @twsi: The MVTWSI register structure to use. @chip: The chip address to probe. @tick: The duration of a clock cycle at the current I2C speed. */
static int __twsi_i2c_probe_chip(struct mvtwsi_registers *twsi, uchar chip, uint tick)
/* @twsi: The MVTWSI register structure to use. @chip: The chip address to probe. @tick: The duration of a clock cycle at the current I2C speed. */ static int __twsi_i2c_probe_chip(struct mvtwsi_registers *twsi, uchar chip, uint tick)
{ u8 dummy_byte; int status; status = i2c_begin(twsi, MVTWSI_STATUS_START, (chip << 1) | 1, tick); if (status == 0) status = twsi_recv(twsi, &dummy_byte, MVTWSI_READ_NAK, tick); twsi_stop(twsi, tick); return status; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Note: This function will release the descriptor memory for any current descriptor ring associated with this device. */
int dma_set_device_descriptor_ring(DMA_Device_t device, DMA_DescriptorRing_t *ring)
/* Note: This function will release the descriptor memory for any current descriptor ring associated with this device. */ int dma_set_device_descriptor_ring(DMA_Device_t device, DMA_DescriptorRing_t *ring)
{ DMA_DeviceAttribute_t *devAttr; if (!IsDeviceValid(device)) { return -ENODEV; } devAttr = &DMA_gDeviceAttribute[device]; dma_free_descriptor_ring(&devAttr->ring); if (ring != NULL) { devAttr->ring = *ring; } devAttr->prevSrcData = 0; devAttr->prevDstData = 0; devAttr->prevNumBytes = 0; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* ZigBee Device Profile dissector for the remove node cache */
void dissect_zbee_zdp_req_remove_node_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* ZigBee Device Profile dissector for the remove node cache */ void dissect_zbee_zdp_req_remove_node_cache(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{ guint offset = 0; guint64 ext_addr; zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (int)sizeof(guint64), NULL); zbee_append_info(tree, pinfo, ", Device: %s", eui64_to_display(wmem_packet_sco...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330