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
/* "new' here refers to the point at which we're creating a new directory via "mkdir()", but also when we're expanding an inline directory. In either case, we don't yet have the indexing bit set on the directory, so the standard checks will fail in when metaecc is turned off. Only directory-initialization type function...
static int ocfs2_new_dir_wants_trailer(struct inode *dir)
/* "new' here refers to the point at which we're creating a new directory via "mkdir()", but also when we're expanding an inline directory. In either case, we don't yet have the indexing bit set on the directory, so the standard checks will fail in when metaecc is turned off. Only directory-initialization type function...
{ struct ocfs2_super *osb = OCFS2_SB(dir->i_sb); return ocfs2_meta_ecc(osb) || ocfs2_supports_indexed_dirs(osb); }
robutest/uclinux
C++
GPL-2.0
60
/* Searches the Fv for a file by its name */
EFI_STATUS FvBufFindFileByName(IN VOID *Fv, IN EFI_GUID *Name, OUT VOID **File)
/* Searches the Fv for a file by its name */ EFI_STATUS FvBufFindFileByName(IN VOID *Fv, IN EFI_GUID *Name, OUT VOID **File)
{ EFI_STATUS Status; UINTN Key; EFI_FFS_FILE_HEADER *NextFile; Key = 0; while (TRUE) { Status = FvBufFindNextFile (Fv, &Key, (VOID **)&NextFile); if (EFI_ERROR (Status)) { return Status; } if (CommonLibBinderCompareGuid (Name, &NextFile->Name)) { if (File != NULL) { *File =...
tianocore/edk2
C++
Other
4,240
/* Write a buffer of data to a selected endpoint. */
void USBD_WriteDataToEP(USBD_EP_T ep, uint8_t *wBuf, uint32_t wLen)
/* Write a buffer of data to a selected endpoint. */ void USBD_WriteDataToEP(USBD_EP_T ep, uint8_t *wBuf, uint32_t wLen)
{ uint32_t i; uint32_t *addrEP; uint32_t tmp; wLen = (wLen + 1) >> 1; addrEP = (uint32_t *)USBD_ReadEPTxAddr(ep); addrEP = (uint32_t *)(((uint32_t)addrEP << 1) + USBD_PMA_ADDR); for(i = 0; i < wLen; i++) { tmp = *wBuf++; tmp = ((*wBuf++) << 8) | tmp; *addrEP++ = t...
pikasTech/PikaPython
C++
MIT License
1,403
/* Called to create a rport for which only the wwn is known. */
struct bfa_fcs_rport_s* bfa_fcs_rport_create_by_wwn(struct bfa_fcs_port_s *port, wwn_t rpwwn)
/* Called to create a rport for which only the wwn is known. */ struct bfa_fcs_rport_s* bfa_fcs_rport_create_by_wwn(struct bfa_fcs_port_s *port, wwn_t rpwwn)
{ struct bfa_fcs_rport_s *rport; bfa_trc(port->fcs, rpwwn); rport = bfa_fcs_rport_alloc(port, rpwwn, 0); if (!rport) return NULL; bfa_sm_send_event(rport, RPSM_EVENT_ADDRESS_DISC); return rport; }
robutest/uclinux
C++
GPL-2.0
60
/* Generates a write-0 or write-1 cycle and samples the level. */
static u8 w1_touch_bit(struct w1_master *dev, int bit)
/* Generates a write-0 or write-1 cycle and samples the level. */ static u8 w1_touch_bit(struct w1_master *dev, int bit)
{ if (dev->bus_master->touch_bit) return dev->bus_master->touch_bit(dev->bus_master->data, bit); else if (bit) return w1_read_bit(dev); else { w1_write_bit(dev, 0); return 0; } }
robutest/uclinux
C++
GPL-2.0
60
/* Do 0-length transaction using bit-banging through IIC_DIRECTCNTL register. */
static int iic_dc_wait(volatile struct iic_regs __iomem *iic, u8 mask)
/* Do 0-length transaction using bit-banging through IIC_DIRECTCNTL register. */ static int iic_dc_wait(volatile struct iic_regs __iomem *iic, u8 mask)
{ unsigned long x = jiffies + HZ / 28 + 2; while ((in_8(&iic->directcntl) & mask) != mask){ if (unlikely(time_after(jiffies, x))) return -1; cond_resched(); } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns number of bytes that could not be copied. On success, this will be zero. */
unsigned long copy_to_user(void __user *to, const void *from, unsigned long n)
/* Returns number of bytes that could not be copied. On success, this will be zero. */ unsigned long copy_to_user(void __user *to, const void *from, unsigned long n)
{ if (access_ok(VERIFY_WRITE, to, n)) n = __copy_to_user(to, from, n); return n; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function is used to enable the capture mode. */
int tls_pwm_capture_mode_config(u8 channel)
/* This function is used to enable the capture mode. */ int tls_pwm_capture_mode_config(u8 channel)
{ if (channel != 0 && channel != 4) return WM_FAILED; if (channel == 0) { tls_reg_write32(HR_PWM_CTL, tls_reg_read32(HR_PWM_CTL) | BIT(24)); } else { tls_reg_write32(HR_PWM_CAP2CTL, tls_reg_read32(HR_PWM_CAP2CTL) | BIT(1)); } return WM_SUCCESS; }
Nicholas3388/LuaNode
C++
Other
1,055
/* Dissects a generic trailer (contains just the payload type) */
static gint dissect_extra_chunk_info(proto_tree *gvsp_tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
/* Dissects a generic trailer (contains just the payload type) */ static gint dissect_extra_chunk_info(proto_tree *gvsp_tree, tvbuff_t *tvb, packet_info *pinfo _U_, gint offset)
{ proto_tree_add_item(gvsp_tree, hf_gvsp_chunkdatapayloadlengthex, tvb, offset, 4, ENC_BIG_ENDIAN); proto_tree_add_item(gvsp_tree, hf_gvsp_chunklayoutidex, tvb, offset + 4, 4, ENC_BIG_ENDIAN); return 8; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Disables the LCD controller, after waiting for the specified number of frames. */
void LCD_Disable(unsigned int frames)
/* Disables the LCD controller, after waiting for the specified number of frames. */ void LCD_Disable(unsigned int frames)
{ ASSERT((frames & 0xFFFFFF80) == 0, "LCD_Disable: Wrong frames value.\n\r"); AT91C_BASE_LCDC->LCDC_PWRCON = frames << 1; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* nsm_release - Release an NSM handle @nsm: pointer to handle to be released */
void nsm_release(struct nsm_handle *nsm)
/* nsm_release - Release an NSM handle @nsm: pointer to handle to be released */ void nsm_release(struct nsm_handle *nsm)
{ if (atomic_dec_and_lock(&nsm->sm_count, &nsm_lock)) { list_del(&nsm->sm_link); spin_unlock(&nsm_lock); dprintk("lockd: destroyed nsm_handle for %s (%s)\n", nsm->sm_name, nsm->sm_addrbuf); kfree(nsm); } }
robutest/uclinux
C++
GPL-2.0
60
/* Record the parameter values for the Actor carried in a received lacpdu as the current partner operational parameter values and sets actor_oper_port_state.defaulted to FALSE. */
static void __record_pdu(struct lacpdu *lacpdu, struct port *port)
/* Record the parameter values for the Actor carried in a received lacpdu as the current partner operational parameter values and sets actor_oper_port_state.defaulted to FALSE. */ static void __record_pdu(struct lacpdu *lacpdu, struct port *port)
{ if (lacpdu && port) { struct port_params *partner = &port->partner_oper; __choose_matched(lacpdu, port); partner->port_number = ntohs(lacpdu->actor_port); partner->port_priority = ntohs(lacpdu->actor_port_priority); partner->system = lacpdu->actor_system; partner->system_priority = ntohs(lacpdu->actor_sy...
robutest/uclinux
C++
GPL-2.0
60
/* The module Entry Point of the Firmware Performance Data Table MM driver. */
EFI_STATUS FirmwarePerformanceCommonEntryPoint(VOID)
/* The module Entry Point of the Firmware Performance Data Table MM driver. */ EFI_STATUS FirmwarePerformanceCommonEntryPoint(VOID)
{ EFI_STATUS Status; Status = gMmst->MmLocateProtocol ( &gEfiMmRscHandlerProtocolGuid, NULL, (VOID **)&mRscHandlerProtocol ); ASSERT_EFI_ERROR (Status); Status = mRscHandlerProtocol->Register (FpdtStatusCodeListenerMm); ASSERT_EF...
tianocore/edk2
C++
Other
4,240
/* Read a whole strip off data from the file, and convert to RGBA form. If this is the last strip, then it will only contain the portion of the strip that is actually within the image space. The result is organized in bottom to top form. */
int TIFFReadRGBAStrip(TIFF *tif, uint32 row, uint32 *raster)
/* Read a whole strip off data from the file, and convert to RGBA form. If this is the last strip, then it will only contain the portion of the strip that is actually within the image space. The result is organized in bottom to top form. */ int TIFFReadRGBAStrip(TIFF *tif, uint32 row, uint32 *raster)
{ return TIFFReadRGBAStripExt(tif, row, raster, 0 ); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Once a read transaction is completed and the FIFO drained, another transaction can be started from the next address by calling this function again. */
void EPINonBlockingReadStart(uint32_t ui32Base, uint32_t ui32Channel, uint32_t ui32Count)
/* Once a read transaction is completed and the FIFO drained, another transaction can be started from the next address by calling this function again. */ void EPINonBlockingReadStart(uint32_t ui32Base, uint32_t ui32Channel, uint32_t ui32Count)
{ uint32_t ui32Offset; ASSERT(ui32Base == EPI0_BASE); ASSERT(ui32Channel < 2); ASSERT(ui32Count < 4096); ui32Offset = ui32Channel * (EPI_O_RPSTD1 - EPI_O_RPSTD0); HWREG(ui32Base + EPI_O_RPSTD0 + ui32Offset) = ui32Count; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* @disp: Display structure, holding info about our options @headp: Pointer to header pointer of list @type: Type of this value (FDT_IS_...) 1 if we want to include matches, 0 to exclude @str: String value to match */
static int value_add(struct display_info *disp, struct value_node **headp, int type, int include, const char *str)
/* @disp: Display structure, holding info about our options @headp: Pointer to header pointer of list @type: Type of this value (FDT_IS_...) 1 if we want to include matches, 0 to exclude @str: String value to match */ static int value_add(struct display_info *disp, struct value_node **headp, int type, int include, co...
{ struct value_node *node; if (include) disp->types_inc |= type; else disp->types_exc |= type; if (disp->types_inc & disp->types_exc & type) { fprintf(stderr, "Cannot use both include and exclude for '%s'\n", str); return -1; } str = strdup(str); if (!str) goto err_mem; node = malloc(sizeof(*node))...
4ms/stm32mp1-baremetal
C++
Other
137
/* This function will write a character to serial without interrupt enable mode */
void rt_serial_putc(const char c)
/* This function will write a character to serial without interrupt enable mode */ void rt_serial_putc(const char c)
{ int val; while(1) { if ((val = inb(COM1+COMSTATUS)) & THRE) break; } outb(COM1+COMWRITE, c&0xff); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* sysfs_remove_file_from_group - remove an attribute file from a group. @kobj: object we're acting for. @attr: attribute descriptor. @group: group name. */
void sysfs_remove_file_from_group(struct kobject *kobj, const struct attribute *attr, const char *group)
/* sysfs_remove_file_from_group - remove an attribute file from a group. @kobj: object we're acting for. @attr: attribute descriptor. @group: group name. */ void sysfs_remove_file_from_group(struct kobject *kobj, const struct attribute *attr, const char *group)
{ struct sysfs_dirent *dir_sd; if (group) dir_sd = sysfs_get_dirent(kobj->sd, group); else dir_sd = sysfs_get(kobj->sd); if (dir_sd) { sysfs_hash_and_remove(dir_sd, attr->name); sysfs_put(dir_sd); } }
robutest/uclinux
C++
GPL-2.0
60
/* Update the "BSD Compress" dictionary on the receiver for incompressible data by pretending to compress the incoming data. */
static void bsd_incomp(void *state, unsigned char *ibuf, int icnt)
/* Update the "BSD Compress" dictionary on the receiver for incompressible data by pretending to compress the incoming data. */ static void bsd_incomp(void *state, unsigned char *ibuf, int icnt)
{ (void) bsd_compress (state, ibuf, (char *) 0, icnt, 0); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns negative errno on error, or zero on success. */
int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp)
/* Returns negative errno on error, or zero on success. */ int fb_alloc_cmap(struct fb_cmap *cmap, int len, int transp)
{ int size = len*sizeof(u16); if (cmap->len != len) { fb_dealloc_cmap(cmap); if (!len) return 0; if (!(cmap->red = kmalloc(size, GFP_ATOMIC))) goto fail; if (!(cmap->green = kmalloc(size, GFP_ATOMIC))) goto fail; if (!(cmap->blue = kmalloc(size, GFP_ATOMIC))) goto fail; if (transp) { ...
robutest/uclinux
C++
GPL-2.0
60
/* Creates an event for each entry in a table that is fired everytime a Protocol of a specific type is installed. */
VOID CoreNotifyOnProtocolEntryTable(EFI_CORE_PROTOCOL_NOTIFY_ENTRY *Entry)
/* Creates an event for each entry in a table that is fired everytime a Protocol of a specific type is installed. */ VOID CoreNotifyOnProtocolEntryTable(EFI_CORE_PROTOCOL_NOTIFY_ENTRY *Entry)
{ EFI_STATUS Status; for ( ; Entry->ProtocolGuid != NULL; Entry++) { Status = CoreCreateEvent ( EVT_NOTIFY_SIGNAL, TPL_CALLBACK, GenericProtocolNotify, Entry, &Entry->Event ); ASSERT_EFI_ERROR (Status); Status = C...
tianocore/edk2
C++
Other
4,240
/* The function checks the "linux,pci-domain" property of the host-pci node. Either all host-pci nodes must have this property, or none of them. If the property is available, read it. Otherwise dynamically assign the Ids. */
STATIC EFI_STATUS EFIAPI GetPciSegGroup(IN CONST VOID *Fdt, IN INT32 HostPciNode, OUT INT32 *SegGroup)
/* The function checks the "linux,pci-domain" property of the host-pci node. Either all host-pci nodes must have this property, or none of them. If the property is available, read it. Otherwise dynamically assign the Ids. */ STATIC EFI_STATUS EFIAPI GetPciSegGroup(IN CONST VOID *Fdt, IN INT32 HostPciNode, OUT INT32 *Se...
{ CONST UINT8 *Data; INT32 DataSize; STATIC INT32 LocalSegGroup = 0; if ((Fdt == NULL) || (SegGroup == NULL)) { ASSERT (0); return EFI_INVALID_PARAMETER; } Data = fdt_getprop (Fdt, HostPciNode, "linux,pci-domain", &DataSize); if ((Data == NULL) || (DataSize < 0)) { if (Local...
tianocore/edk2
C++
Other
4,240
/* Get current baudrate for USART/UART. This function returns the actual baudrate (not considering oscillator inaccuracies) used by a USART/UART peripheral. */
uint32_t USART_BaudrateGet(USART_TypeDef *usart)
/* Get current baudrate for USART/UART. This function returns the actual baudrate (not considering oscillator inaccuracies) used by a USART/UART peripheral. */ uint32_t USART_BaudrateGet(USART_TypeDef *usart)
{ uint32_t freq; USART_OVS_TypeDef ovs; bool syncmode; if (usart->CTRL & USART_CTRL_SYNC) { syncmode = true; } else { syncmode = false; } freq = CMU_ClockFreqGet(cmuClock_HFPER); ovs = (USART_OVS_TypeDef)(usart->CTRL & _USART_CTRL_OVS_MASK); return USART_BaudrateCa...
feaser/openblt
C++
GNU General Public License v3.0
601
/* Returns pointer to next entry in queue, or NULL if there are no new entried in the CRQ. */
static struct viosrp_crq* crq_queue_next_crq(struct crq_queue *queue)
/* Returns pointer to next entry in queue, or NULL if there are no new entried in the CRQ. */ static struct viosrp_crq* crq_queue_next_crq(struct crq_queue *queue)
{ struct viosrp_crq *crq; unsigned long flags; spin_lock_irqsave(&queue->lock, flags); crq = &queue->msgs[queue->cur]; if (crq->valid & 0x80) { if (++queue->cur == queue->size) queue->cur = 0; } else crq = NULL; spin_unlock_irqrestore(&queue->lock, flags); return crq; }
robutest/uclinux
C++
GPL-2.0
60
/* Prevent the memory pages used for page table from been overwritten. */
VOID EnablePageTableProtection(IN UINTN PageTableBase, IN BOOLEAN Level4Paging)
/* Prevent the memory pages used for page table from been overwritten. */ VOID EnablePageTableProtection(IN UINTN PageTableBase, IN BOOLEAN Level4Paging)
{ PAGE_TABLE_POOL *HeadPool; PAGE_TABLE_POOL *Pool; UINT64 PoolSize; EFI_PHYSICAL_ADDRESS Address; if (mPageTablePool == NULL) { return; } HeadPool = mPageTablePool; Pool = HeadPool; do { Address = (EFI_PHYSICAL_ADDRESS)(UINTN)Pool; PoolSize = Pool->Offset ...
tianocore/edk2
C++
Other
4,240
/* Disable Broadcast frames. When disabled Address filtering module filters all incoming broadcast frames. */
void synopGMAC_broadcast_disable(synopGMACdevice *gmacdev)
/* Disable Broadcast frames. When disabled Address filtering module filters all incoming broadcast frames. */ void synopGMAC_broadcast_disable(synopGMACdevice *gmacdev)
{ synopGMACSetBits(gmacdev->MacBase, GmacFrameFilter, GmacBroadcast); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Sends the 32-bit value specified by Value to a POST card, and returns Value. Some implementations of this library function may perform I/O operations directly to a POST card device. Other implementations may send Value to ReportStatusCode(), and the status code reporting mechanism will eventually display the 32-bit ...
UINT32 EFIAPI PostCode(IN UINT32 Value)
/* Sends the 32-bit value specified by Value to a POST card, and returns Value. Some implementations of this library function may perform I/O operations directly to a POST card device. Other implementations may send Value to ReportStatusCode(), and the status code reporting mechanism will eventually display the 32-bit ...
{ REPORT_STATUS_CODE (EFI_PROGRESS_CODE, POST_CODE_TO_STATUS_CODE_VALUE (Value)); return Value; }
tianocore/edk2
C++
Other
4,240
/* WWDG MSP Initialization This function configures the hardware resources used in this example: */
void HAL_WWDG_MspInit(WWDG_HandleTypeDef *hwwdg)
/* WWDG MSP Initialization This function configures the hardware resources used in this example: */ void HAL_WWDG_MspInit(WWDG_HandleTypeDef *hwwdg)
{ __HAL_RCC_WWDG_CLK_ENABLE(); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* DCMI MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_DCMI_MspDeInit(DCMI_HandleTypeDef *hdcmi)
/* DCMI MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_DCMI_MspDeInit(DCMI_HandleTypeDef *hdcmi)
{ if(hdcmi->Instance==DCMI) { __HAL_RCC_DCMI_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOE, GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6); HAL_GPIO_DeInit(GPIOB, GPIO_PIN_7|GPIO_PIN_6); HAL_GPIO_DeInit(GPIOG, GPIO_PIN_11|GPIO_PIN_10); HAL_GPIO_DeInit(GPIOC, GPIO_PIN_7|GPIO_PIN_6); HAL_GPIO_DeInit(GPIOA, GPIO_PIN...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* NOTE: it is a must to set ND_RUN first, then write command buffer, otherwise, it does not work. We enable all the interrupt at the same time, and let pxa3xx_nand_irq to handle all logic. */
static void pxa3xx_nand_start(struct pxa3xx_nand_info *info)
/* NOTE: it is a must to set ND_RUN first, then write command buffer, otherwise, it does not work. We enable all the interrupt at the same time, and let pxa3xx_nand_irq to handle all logic. */ static void pxa3xx_nand_start(struct pxa3xx_nand_info *info)
{ uint32_t ndcr; ndcr = info->reg_ndcr; if (info->use_ecc) { ndcr |= NDCR_ECC_EN; if (info->ecc_bch) nand_writel(info, NDECCCTRL, 0x1); } else { ndcr &= ~NDCR_ECC_EN; if (info->ecc_bch) nand_writel(info, NDECCCTRL, 0x0); } ndcr &= ~NDCR_DMA_EN; if (info->use_spare) ndcr |= NDCR_SPARE_EN; else ...
4ms/stm32mp1-baremetal
C++
Other
137
/* named_prepare_buf - allocate & initialize a publication message */
static struct sk_buff* named_prepare_buf(u32 type, u32 size, u32 dest)
/* named_prepare_buf - allocate & initialize a publication message */ static struct sk_buff* named_prepare_buf(u32 type, u32 size, u32 dest)
{ struct sk_buff *buf = buf_acquire(LONG_H_SIZE + size); struct tipc_msg *msg; if (buf != NULL) { msg = buf_msg(buf); msg_init(msg, NAME_DISTRIBUTOR, type, LONG_H_SIZE, dest); msg_set_size(msg, LONG_H_SIZE + size); } return buf; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* EFI_IFR_TYPE_REF, EFI_IFR_TYPE_DATE and EFI_IFR_TYPE_TIME are converted to EFI_IFR_TYPE_BUFFER when do the value compare. */
UINT16 GetLengthForValue(IN EFI_HII_VALUE *Value)
/* EFI_IFR_TYPE_REF, EFI_IFR_TYPE_DATE and EFI_IFR_TYPE_TIME are converted to EFI_IFR_TYPE_BUFFER when do the value compare. */ UINT16 GetLengthForValue(IN EFI_HII_VALUE *Value)
{ if (Value == NULL) { return 0; } switch (Value->Type) { case EFI_IFR_TYPE_BUFFER: return Value->BufferLen; case EFI_IFR_TYPE_DATE: return (UINT16)sizeof (EFI_HII_DATE); case EFI_IFR_TYPE_TIME: return (UINT16)sizeof (EFI_HII_TIME); case EFI_IFR_TYPE_REF: return (UINT16...
tianocore/edk2
C++
Other
4,240
/* Resets the iterator, so that it will start from the beginning again. */
void ring_buffer_iter_reset(struct ring_buffer_iter *iter)
/* Resets the iterator, so that it will start from the beginning again. */ void ring_buffer_iter_reset(struct ring_buffer_iter *iter)
{ struct ring_buffer_per_cpu *cpu_buffer; unsigned long flags; if (!iter) return; cpu_buffer = iter->cpu_buffer; spin_lock_irqsave(&cpu_buffer->reader_lock, flags); rb_iter_reset(iter); spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This API sets the any-motion interrupt of the sensor. This interrupt occurs when accel values exceeds preset threshold for a certain period of time. */
static int8_t set_accel_any_motion_int(struct bmi160_int_settg *int_config, struct bmi160_dev *dev)
/* This API sets the any-motion interrupt of the sensor. This interrupt occurs when accel values exceeds preset threshold for a certain period of time. */ static int8_t set_accel_any_motion_int(struct bmi160_int_settg *int_config, struct bmi160_dev *dev)
{ int8_t rslt; rslt = null_ptr_check(dev); if ((rslt != BMI160_OK) || (int_config == NULL)) { rslt = BMI160_E_NULL_PTR; } else { struct bmi160_acc_any_mot_int_cfg *any_motion_int_cfg = &(int_config->int_type_cfg.acc_any_motion_int); rslt = enable_accel_any_motion_int(...
eclipse-threadx/getting-started
C++
Other
310
/* If the requested operation results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeUintnAdd(IN UINTN Augend, IN UINTN Addend, OUT UINTN *Result)
/* If the requested operation results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeUintnAdd(IN UINTN Augend, IN UINTN Addend, OUT UINTN *Result)
{ RETURN_STATUS Status; if (Result == NULL) { return RETURN_INVALID_PARAMETER; } if (sizeof (UINTN) == sizeof (UINT32)) { if ((UINT32)(Augend + Addend) >= Augend) { *Result = (Augend + Addend); Status = RETURN_SUCCESS; } else { *Result = UINTN_ERROR; Status = RETURN_BUFFER...
tianocore/edk2
C++
Other
4,240
/* \classmethod af_list() Returns an array of alternate functions available for this pin. */
STATIC mp_obj_t pin_af_list(mp_obj_t self_in)
/* \classmethod af_list() Returns an array of alternate functions available for this pin. */ STATIC mp_obj_t pin_af_list(mp_obj_t self_in)
{ mp_obj_list_append(result, (mp_obj_t)af); } return result; }
micropython/micropython
C++
Other
18,334
/* The BCM1250, etc. PCI/HT bridge reports as a host bridge. */
static void __init quirk_sb1250_ht(struct pci_dev *dev)
/* The BCM1250, etc. PCI/HT bridge reports as a host bridge. */ static void __init quirk_sb1250_ht(struct pci_dev *dev)
{ dev->class = PCI_CLASS_BRIDGE_PCI << 8; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Give the length of a text with a given font */
lv_coord_t lv_txt_get_width(const char *txt, uint16_t length, const lv_font_t *font, lv_coord_t letter_space, lv_txt_flag_t flag)
/* Give the length of a text with a given font */ lv_coord_t lv_txt_get_width(const char *txt, uint16_t length, const lv_font_t *font, lv_coord_t letter_space, lv_txt_flag_t flag)
{ if(txt == NULL) return 0; if(font == NULL) return 0; uint32_t i = 0; lv_coord_t width = 0; lv_txt_cmd_state_t cmd_state = LV_TXT_CMD_STATE_WAIT; uint32_t letter; if(length != 0) { while(i < length) { letter = lv_txt_encoded_next(txt, &i); if((flag & LV_TXT_F...
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* Compare two msdos names. If either of the names are invalid, we fall back to doing the standard name comparison. */
static int msdos_cmp(struct dentry *dentry, struct qstr *a, struct qstr *b)
/* Compare two msdos names. If either of the names are invalid, we fall back to doing the standard name comparison. */ static int msdos_cmp(struct dentry *dentry, struct qstr *a, struct qstr *b)
{ struct fat_mount_options *options = &MSDOS_SB(dentry->d_sb)->options; unsigned char a_msdos_name[MSDOS_NAME], b_msdos_name[MSDOS_NAME]; int error; error = msdos_format_name(a->name, a->len, a_msdos_name, options); if (error) goto old_compare; error = msdos_format_name(b->name, b->len, b_msdos_name, options); ...
robutest/uclinux
C++
GPL-2.0
60
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, 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 PciExpressBitFieldRead32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, 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 PciExpressBitFieldRead32(IN UINTN Address, IN UINTN Start...
{ if (Address >= mDxeRuntimePciExpressLibPciExpressBaseSize) { return (UINT32)-1; } return MmioBitFieldRead32 ( GetPciExpressAddress (Address), StartBit, EndBit ); }
tianocore/edk2
C++
Other
4,240
/* Generate a key to describe a superblock key in the main NFS index */
static uint16_t nfs_super_get_key(const void *cookie_netfs_data, void *buffer, uint16_t bufmax)
/* Generate a key to describe a superblock key in the main NFS index */ static uint16_t nfs_super_get_key(const void *cookie_netfs_data, void *buffer, uint16_t bufmax)
{ const struct nfs_fscache_key *key; const struct nfs_server *nfss = cookie_netfs_data; uint16_t len; key = nfss->fscache_key; len = sizeof(key->key) + key->key.uniq_len; if (len > bufmax) { len = 0; } else { memcpy(buffer, &key->key, sizeof(key->key)); memcpy(buffer + sizeof(key->key), key->key.u...
robutest/uclinux
C++
GPL-2.0
60
/* Takes an array of register address/register value pairs and writes each value to the corresponding register. Register addresses are adjusted by the supplied offset. */
void t3_write_regs(struct adapter *adapter, const struct addr_val_pair *p, int n, unsigned int offset)
/* Takes an array of register address/register value pairs and writes each value to the corresponding register. Register addresses are adjusted by the supplied offset. */ void t3_write_regs(struct adapter *adapter, const struct addr_val_pair *p, int n, unsigned int offset)
{ while (n--) { t3_write_reg(adapter, p->reg_addr + offset, p->val); p++; } }
robutest/uclinux
C++
GPL-2.0
60
/* Set packet delay correlation probability of netem qdisc. */
int rtnl_netem_set_delay_correlation(struct rtnl_qdisc *qdisc, int prob)
/* Set packet delay correlation probability of netem qdisc. */ int rtnl_netem_set_delay_correlation(struct rtnl_qdisc *qdisc, int prob)
{ struct rtnl_netem *netem; netem = netem_alloc(qdisc); if (!netem) return -NLE_NOMEM; netem->qnm_corr.nmc_delay = prob; netem->qnm_mask |= SCH_NETEM_ATTR_DELAY_CORR; return 0; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function disables glitch filters and active tampers This function disables the TDET clock and prescaler in TDET Control Register. param base TDET peripheral base address */
void TDET_Deinit(DIGTMP_Type *base)
/* This function disables glitch filters and active tampers This function disables the TDET clock and prescaler in TDET Control Register. param base TDET peripheral base address */ void TDET_Deinit(DIGTMP_Type *base)
{ uint32_t i, j, k; j = ARRAY_SIZE(base->PGFR); k = ARRAY_SIZE(base->ATR); for (i = 0; i < j; i++) { base->PGFR[i] = 0; } for (i = 0; i < k; i++) { base->ATR[i] = 0; } base->CR &= ~DIGTMP_CR_DEN_MASK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This helper will allocate a kmalloced buffer and use it to transmit (then free it). Reason for this is that the SDIO host controller expects alignment (unknown exactly which) which the stack won't really provide and certain arches/host-controller combinations cannot use stack/vmalloc/text areas for DMA transfers. *...
static int __i2400ms_send_barker(struct i2400ms *i2400ms, const __le32 *barker, size_t barker_size)
/* This helper will allocate a kmalloced buffer and use it to transmit (then free it). Reason for this is that the SDIO host controller expects alignment (unknown exactly which) which the stack won't really provide and certain arches/host-controller combinations cannot use stack/vmalloc/text areas for DMA transfers. *...
{ int ret; struct sdio_func *func = i2400ms->func; struct device *dev = &func->dev; void *buffer; ret = -ENOMEM; buffer = kmalloc(I2400MS_BLK_SIZE, GFP_KERNEL); if (buffer == NULL) goto error_kzalloc; memcpy(buffer, barker, barker_size); sdio_claim_host(func); ret = sdio_memcpy_toio(func, 0, buffer, I2400M...
robutest/uclinux
C++
GPL-2.0
60
/* e1000_irq_disable - Mask off interrupt generation on the NIC */
static void e1000_irq_disable(struct e1000_adapter *adapter)
/* e1000_irq_disable - Mask off interrupt generation on the NIC */ static void e1000_irq_disable(struct e1000_adapter *adapter)
{ struct e1000_hw *hw = &adapter->hw; ew32(IMC, ~0); if (adapter->msix_entries) ew32(EIAC_82574, 0); e1e_flush(); synchronize_irq(adapter->pdev->irq); }
robutest/uclinux
C++
GPL-2.0
60
/* Format: PCI: Bus 0, Device 26, Vendor 0x12AE Frame 1, Card C10 Ethernet controller */
static void __init iseries_device_information(struct pci_dev *pdev, u16 bus, HvSubBusNumber subbus)
/* Format: PCI: Bus 0, Device 26, Vendor 0x12AE Frame 1, Card C10 Ethernet controller */ static void __init iseries_device_information(struct pci_dev *pdev, u16 bus, HvSubBusNumber subbus)
{ u8 frame = 0; char card[4]; HvAgentId agent; agent = ISERIES_PCI_AGENTID(ISERIES_GET_DEVICE_FROM_SUBBUS(subbus), ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus)); if (iseries_get_location_code(bus, agent, &frame, card)) { printk(KERN_INFO "PCI: %s, Vendor %04X Frame%3d, " "Card %4s 0x%04X\n", pci_name(pd...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enables IWDG (write access to IWDG_PR and IWDG_RLR registers disabled). */
void IWDG_Enable(void)
/* Enables IWDG (write access to IWDG_PR and IWDG_RLR registers disabled). */ void IWDG_Enable(void)
{ IWDG->KR = KR_KEY_ENABLE; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If PrevNode is not NULL, return the previous node. */
STATIC EFI_STATUS EFIAPI AmlIteratorGetPreviousBranch(IN AML_TREE_ITERATOR *Iterator, OUT AML_NODE_HEADER **PrevNode)
/* If PrevNode is not NULL, return the previous node. */ STATIC EFI_STATUS EFIAPI AmlIteratorGetPreviousBranch(IN AML_TREE_ITERATOR *Iterator, OUT AML_NODE_HEADER **PrevNode)
{ AML_TREE_ITERATOR_INTERNAL *InternalIterator; AML_NODE_HEADER *Node; InternalIterator = (AML_TREE_ITERATOR_INTERNAL *)Iterator; if ((InternalIterator == NULL) || (InternalIterator->Mode != EAmlIteratorBranch) || !IS_AML_NODE_VALID (InternalIterato...
tianocore/edk2
C++
Other
4,240
/* Ensure minimum value for first item, maximum value for last value, proper spacing between each value and proper ordering. */
static void stabilize_lsps(double *lsps, int num)
/* Ensure minimum value for first item, maximum value for last value, proper spacing between each value and proper ordering. */ static void stabilize_lsps(double *lsps, int num)
{ int n, m, l; lsps[0] = FFMAX(lsps[0], 0.0015 * M_PI); for (n = 1; n < num; n++) lsps[n] = FFMAX(lsps[n], lsps[n - 1] + 0.0125 * M_PI); lsps[num - 1] = FFMIN(lsps[num - 1], 0.9985 * M_PI); for (n = 1; n < num; n++) { if (lsps[n] < lsps[n - 1]) { for (...
DC-SWAT/DreamShell
C++
null
404
/* pmcraid_get_minor - returns unused minor number from minor number bitmap */
static unsigned short pmcraid_get_minor(void)
/* pmcraid_get_minor - returns unused minor number from minor number bitmap */ static unsigned short pmcraid_get_minor(void)
{ int minor; minor = find_first_zero_bit(pmcraid_minor, sizeof(pmcraid_minor)); __set_bit(minor, pmcraid_minor); return minor; }
robutest/uclinux
C++
GPL-2.0
60
/* This function will clear the handler to be called when a system control interrupt occurs. This will also mask off the interrupt in the interrupt controller so that the interrupt handler no longer is called. */
void SysCtlIntUnregister(void)
/* This function will clear the handler to be called when a system control interrupt occurs. This will also mask off the interrupt in the interrupt controller so that the interrupt handler no longer is called. */ void SysCtlIntUnregister(void)
{ IntDisable(INT_SYSCTL); IntUnregister(INT_SYSCTL); }
watterott/WebRadio
C++
null
71
/* This implementation differs from the standard library version of this function in a number of ways: */
int hmatch_r(const char *match, int last_idx, struct env_entry **retval, struct hsearch_data *htab)
/* This implementation differs from the standard library version of this function in a number of ways: */ int hmatch_r(const char *match, int last_idx, struct env_entry **retval, struct hsearch_data *htab)
{ unsigned int idx; size_t key_len = strlen(match); for (idx = last_idx + 1; idx < htab->size; ++idx) { if (htab->table[idx].used <= 0) continue; if (!strncmp(match, htab->table[idx].entry.key, key_len)) { *retval = &htab->table[idx].entry; return idx; } } __set_errno(ESRCH); *retval = NULL; retur...
4ms/stm32mp1-baremetal
C++
Other
137
/* Internal Function:Trigger function to poll and Ack IRQs */
static uint32_t lpddr4_pollandackirq(const lpddr4_privatedata *pd)
/* Internal Function:Trigger function to poll and Ack IRQs */ static uint32_t lpddr4_pollandackirq(const lpddr4_privatedata *pd)
{ uint32_t result = 0U; result = lpddr4_pollphyindepirq(pd, LPDDR4_PHY_INDEP_INIT_DONE_BIT, LPDDR4_CUSTOM_TIMEOUT_DELAY); if (result == (uint32_t) CDN_EOK) { result = lpddr4_ackphyindepinterrupt(pd, LPDDR4_PHY_INDEP_INIT_DONE_BIT); } if (result == (uint32_t) CDN_EOK) { result = lp...
4ms/stm32mp1-baremetal
C++
Other
137
/* Sets the rgb to the "transparent" value (or not) Returns CR_OK upon successfull completion, an error code otherwise. */
enum CRStatus cr_rgb_set_to_transparent(CRRgb *a_this, gboolean a_is_transparent)
/* Sets the rgb to the "transparent" value (or not) Returns CR_OK upon successfull completion, an error code otherwise. */ enum CRStatus cr_rgb_set_to_transparent(CRRgb *a_this, gboolean a_is_transparent)
{ g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR) ; a_this->is_transparent = a_is_transparent ; return CR_OK ; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* codepoint(s, ]) -> returns codepoints for all characters that start in the range */
static int codepoint(lua_State *L)
/* codepoint(s, ]) -> returns codepoints for all characters that start in the range */ static int codepoint(lua_State *L)
{ int code; s = utf8_decode(s, &code); if (s == NULL) return luaL_error(L, "invalid UTF-8 code"); lua_pushinteger(L, code); n++; } return n; }
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* Symbol param # default allowed param values M_TRIM_THRESHOLD -1 2*1024*1024 any (MAX_SIZE_T disables) M_GRANULARITY -2 page size any power of 2 >= page size M_MMAP_THRESHOLD -3 256*1024 any (or 0 if no MMAP support) */
int dlmallopt(int, int)
/* Symbol param # default allowed param values M_TRIM_THRESHOLD -1 2*1024*1024 any (MAX_SIZE_T disables) M_GRANULARITY -2 page size any power of 2 >= page size M_MMAP_THRESHOLD -3 256*1024 any (or 0 if no MMAP support) */ int dlmallopt(int, int)
{ return change_mparam(param_number, value); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Gets the baud clock source for the specified UART. */
unsigned long UARTClockSourceGet(unsigned long ulBase)
/* Gets the baud clock source for the specified UART. */ unsigned long UARTClockSourceGet(unsigned long ulBase)
{ ASSERT(UARTBaseValid(ulBase)); return(HWREG(ulBase + UART_O_CC)); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* This is a helper function for ext3_dx_readdir. It calls filldir for all entres on the fname linked list. (Normally there is only one entry on the linked list, unless there are 62 bit hash collisions.) */
static int call_filldir(struct file *filp, void *dirent, filldir_t filldir, struct fname *fname)
/* This is a helper function for ext3_dx_readdir. It calls filldir for all entres on the fname linked list. (Normally there is only one entry on the linked list, unless there are 62 bit hash collisions.) */ static int call_filldir(struct file *filp, void *dirent, filldir_t filldir, struct fname *fname)
{ struct dir_private_info *info = filp->private_data; loff_t curr_pos; struct inode *inode = filp->f_path.dentry->d_inode; struct super_block * sb; int error; sb = inode->i_sb; if (!fname) { printk("call_filldir: called with null fname?!?\n"); return 0; } curr_pos = hash2pos(fname->hash, fname->minor_hash)...
robutest/uclinux
C++
GPL-2.0
60
/* This function sets the value of the PHY registers through the MII interface. */
int imx_fec_mii_write(volatile hw_fec_t *fec_reg, unsigned char phy_addr, unsigned char reg_addr, unsigned short int value)
/* This function sets the value of the PHY registers through the MII interface. */ int imx_fec_mii_write(volatile hw_fec_t *fec_reg, unsigned char phy_addr, unsigned char reg_addr, unsigned short int value)
{ unsigned long waiting = FEC_MII_TIMEOUT; if (fec_reg->EIR.U & FEC_EVENT_MII) { fec_reg->EIR.U = FEC_EVENT_MII; } fec_reg->MMFR.U = FEC_MII_WRITE(phy_addr, reg_addr, value); while (1) { if (fec_reg->EIR.U & FEC_EVENT_MII) { fec_reg->EIR.U = FEC_EVENT_MII; bre...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* When comes across an instruction which it cannot handle, it takes the undefined instruction trap. */
void rt_hw_trap_udef(struct rt_hw_exp_stack *regs)
/* When comes across an instruction which it cannot handle, it takes the undefined instruction trap. */ void rt_hw_trap_udef(struct rt_hw_exp_stack *regs)
{ rt_kprintf("undefined instruction\n"); rt_hw_show_register(regs); if (rt_thread_self() != RT_NULL) rt_kprintf("Current Thread: %s\n", rt_thread_self()->name); rt_hw_cpu_shutdown(); }
armink/FreeModbus_Slave-Master-RTT-STM32
C++
Other
1,477
/* Reads the next byte from the parser input stream. */
enum CRStatus cr_tknzr_read_byte(CRTknzr *a_this, guchar *a_byte)
/* Reads the next byte from the parser input stream. */ enum CRStatus cr_tknzr_read_byte(CRTknzr *a_this, guchar *a_byte)
{ g_return_val_if_fail (a_this && PRIVATE (a_this), CR_BAD_PARAM_ERROR); return cr_input_read_byte (PRIVATE (a_this)->input, a_byte); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* These devices are always present and don't need any board-specific setup. */
static int __init at91_add_standard_devices(void)
/* These devices are always present and don't need any board-specific setup. */ static int __init at91_add_standard_devices(void)
{ at91_add_device_rtc(); at91_add_device_watchdog(); at91_add_device_tc(); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If a I2O device is added we catch the notification, because I2O classes other than SCSI peripheral will not be received through i2o_scsi_probe(). */
static void i2o_scsi_notify_device_add(struct i2o_device *i2o_dev)
/* If a I2O device is added we catch the notification, because I2O classes other than SCSI peripheral will not be received through i2o_scsi_probe(). */ static void i2o_scsi_notify_device_add(struct i2o_device *i2o_dev)
{ switch (i2o_dev->lct_data.class_id) { case I2O_CLASS_EXECUTIVE: case I2O_CLASS_RANDOM_BLOCK_STORAGE: i2o_scsi_probe(&i2o_dev->device); break; default: break; } }
robutest/uclinux
C++
GPL-2.0
60
/* Returns: For historical reasons, this function always returns TRUE */
gboolean g_source_remove(guint tag)
/* Returns: For historical reasons, this function always returns TRUE */ gboolean g_source_remove(guint tag)
{ GSource *source; g_return_val_if_fail (tag > 0, FALSE); source = g_main_context_find_source_by_id (NULL, tag); if (source) g_source_destroy (source); else g_critical ("Source ID %u was not found when attempting to remove it", tag); return source != NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* param base pointer to FLEXIO_MCULCD_Type structure. param xfer pointer to flexio_mculcd_transfer_t structure. */
void FLEXIO_MCULCD_TransferBlocking(FLEXIO_MCULCD_Type *base, flexio_mculcd_transfer_t *xfer)
/* param base pointer to FLEXIO_MCULCD_Type structure. param xfer pointer to flexio_mculcd_transfer_t structure. */ void FLEXIO_MCULCD_TransferBlocking(FLEXIO_MCULCD_Type *base, flexio_mculcd_transfer_t *xfer)
{ FLEXIO_MCULCD_StartTransfer(base); FLEXIO_MCULCD_WriteCommandBlocking(base, xfer->command); if (xfer->dataSize > 0) { if (kFLEXIO_MCULCD_ReadArray == xfer->mode) { FLEXIO_MCULCD_ReadDataArrayBlocking(base, (void *)(xfer->dataAddrOrSameValue), xfer->dataSize); } ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If the EXT3_FEATURE_COMPAT_EXT_ATTR feature of this file system is not set, set it. */
static void ext3_xattr_update_super_block(handle_t *handle, struct super_block *sb)
/* If the EXT3_FEATURE_COMPAT_EXT_ATTR feature of this file system is not set, set it. */ static void ext3_xattr_update_super_block(handle_t *handle, struct super_block *sb)
{ if (EXT3_HAS_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_EXT_ATTR)) return; if (ext3_journal_get_write_access(handle, EXT3_SB(sb)->s_sbh) == 0) { EXT3_SET_COMPAT_FEATURE(sb, EXT3_FEATURE_COMPAT_EXT_ATTR); ext3_journal_dirty_metadata(handle, EXT3_SB(sb)->s_sbh); } }
robutest/uclinux
C++
GPL-2.0
60
/* This function returns the current value of the sub second count for the RTC in 1/32768 of a second increments. The only value that can be used with the */
uint32_t HibernateRTCSSGet(void)
/* This function returns the current value of the sub second count for the RTC in 1/32768 of a second increments. The only value that can be used with the */ uint32_t HibernateRTCSSGet(void)
{ return(HWREG(HIB_RTCSS) & HIB_RTCSS_RTCSSC_M); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* @discussion This function Get the solid fill color of an evo object. */
BOOL ElmGetColor(ElmGroupObj handle, uint32_t *color)
/* @discussion This function Get the solid fill color of an evo object. */ BOOL ElmGetColor(ElmGroupObj handle, uint32_t *color)
{ elm_tls_t* elm_tls; el_Obj_EVO *evo; elm_tls = (elm_tls_t *) elm_os_get_tls(); if (elm_tls == NULL) return FALSE; el_Obj_Group *ego = (el_Obj_Group*) get_object(handle); evo = _get_evo(ego, elm_tls->gContext.vector_id); *color = evo->attribute.paint.color; return TRUE; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* IDL typedef struct { IDL CREDENTIAL cred; IDL long timestamp; IDL } AUTHENTICATOR; */
static int netlogon_dissect_AUTHENTICATOR(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
/* IDL typedef struct { IDL CREDENTIAL cred; IDL long timestamp; IDL } AUTHENTICATOR; */ static int netlogon_dissect_AUTHENTICATOR(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep)
{ nstime_t ts; if(di->conformant_run){ return offset; } offset = netlogon_dissect_CREDENTIAL(tvb, offset, pinfo, tree, di, drep); ALIGN_TO_4_BYTES; ts.secs = tvb_get_letohl(tvb, offset); ts.nsecs = 0; proto_tree_add_time(tree, hf_netlogon_...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Selects the clock source to output on MCO pin. */
void RCC_MCOConfig(uint8_t RCC_MCOSource, uint8_t RCC_MCODiv)
/* Selects the clock source to output on MCO pin. */ void RCC_MCOConfig(uint8_t RCC_MCOSource, uint8_t RCC_MCODiv)
{ assert_param(IS_RCC_MCO_SOURCE(RCC_MCOSource)); assert_param(IS_RCC_MCO_DIV(RCC_MCODiv)); *(__IO uint8_t *) CFGR_BYTE4_ADDRESS = RCC_MCOSource | RCC_MCODiv; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* param base Pointer to the FLEXIO_CAMERA_Type. param handle Pointer to the flexio_camera_edma_handle_t structure. param count Number of bytes sent so far by the non-blocking transaction. retval kStatus_Success Succeed get the transfer count. retval kStatus_InvalidArgument The count parameter is invalid. */
status_t FLEXIO_CAMERA_TransferGetReceiveCountEDMA(FLEXIO_CAMERA_Type *base, flexio_camera_edma_handle_t *handle, size_t *count)
/* param base Pointer to the FLEXIO_CAMERA_Type. param handle Pointer to the flexio_camera_edma_handle_t structure. param count Number of bytes sent so far by the non-blocking transaction. retval kStatus_Success Succeed get the transfer count. retval kStatus_InvalidArgument The count parameter is invalid. */ status_t ...
{ assert(handle->rxEdmaHandle); if (!count) { return kStatus_InvalidArgument; } if (kFLEXIO_CAMERA_RxBusy == handle->rxState) { *count = (handle->rxSize - (uint32_t)handle->nbytes * EDMA_GetRemainingMajorLoopCount(handle->rxEdmaHandle->base...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set the polarity of the CC line, which is the active CC line used for power delivery. */
static int ucpd_cc_set_polarity(const struct device *dev, enum tc_cc_polarity polarity)
/* Set the polarity of the CC line, which is the active CC line used for power delivery. */ static int ucpd_cc_set_polarity(const struct device *dev, enum tc_cc_polarity polarity)
{ const struct tcpc_config *const config = dev->config; uint32_t cr; cr = LL_UCPD_ReadReg(config->ucpd_port, CR); if (polarity == TC_POLARITY_CC1) { cr &= ~UCPD_CR_PHYCCSEL; } else if (polarity == TC_POLARITY_CC2) { cr |= UCPD_CR_PHYCCSEL; } else { return -ENOTSUP; } LL_UCPD_WriteReg(config->ucpd_port, CR...
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This is done by clearing the EN bit of the LG_CONTROL register. */
STATIC VOID LayerGraphicsDisable(VOID)
/* This is done by clearing the EN bit of the LG_CONTROL register. */ STATIC VOID LayerGraphicsDisable(VOID)
{ MmioAnd32 (DP_BASE + DP_DE_LG_CONTROL, ~DP_DE_LG_ENABLE); }
tianocore/edk2
C++
Other
4,240
/* 10.17 (void) 10.18 Location Type 10.19 Network Element Identity 10.20 Positioning Data */
static guint16 de_bmaple_pos_dta(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
/* 10.17 (void) 10.18 Location Type 10.19 Network Element Identity 10.20 Positioning Data */ static guint16 de_bmaple_pos_dta(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
{ tvbuff_t *data_tvb; guint32 curr_offset; curr_offset = offset; data_tvb = tvb_new_subset_length(tvb, curr_offset, len); dissect_geographical_description(data_tvb, pinfo, tree); return(len); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Exit function. Deletes all hosts associated with this driver. */
static void __exit BusLogic_exit(void)
/* Exit function. Deletes all hosts associated with this driver. */ static void __exit BusLogic_exit(void)
{ struct BusLogic_HostAdapter *ha, *next; list_for_each_entry_safe(ha, next, &BusLogic_host_list, host_list) BusLogic_ReleaseHostAdapter(ha); }
robutest/uclinux
C++
GPL-2.0
60
/* Cause the LED to blink once per second using a blocking delay */
int main(void)
/* Cause the LED to blink once per second using a blocking delay */ int main(void)
{ systemInit(); while (1) { systickDelay(1000); if (gpioGetValue(CFG_LED_PORT, CFG_LED_PIN) == CFG_LED_OFF) { gpioSetValue (CFG_LED_PORT, CFG_LED_PIN, CFG_LED_ON); } else { gpioSetValue (CFG_LED_PORT, CFG_LED_PIN, CFG_LED_OFF); } } return 0; }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Searches for the next matching section within the specified file. */
EFI_STATUS EFIAPI PeiFfsFindSectionData(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_SECTION_TYPE SectionType, IN EFI_PEI_FILE_HANDLE FileHandle, OUT VOID **SectionData)
/* Searches for the next matching section within the specified file. */ EFI_STATUS EFIAPI PeiFfsFindSectionData(IN CONST EFI_PEI_SERVICES **PeiServices, IN EFI_SECTION_TYPE SectionType, IN EFI_PEI_FILE_HANDLE FileHandle, OUT VOID **SectionData)
{ PEI_CORE_FV_HANDLE *CoreFvHandle; CoreFvHandle = FileHandleToVolume (FileHandle); if ((CoreFvHandle == NULL) || (CoreFvHandle->FvPpi == NULL)) { return EFI_NOT_FOUND; } return CoreFvHandle->FvPpi->FindSectionByType (CoreFvHandle->FvPpi, SectionType, FileHandle, SectionData); }
tianocore/edk2
C++
Other
4,240
/* I2C MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_I2C_MspDeInit(I2C_HandleTypeDef *hi2c)
/* I2C MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_I2C_MspDeInit(I2C_HandleTypeDef *hi2c)
{ if(hi2c->Instance==I2C1) { __HAL_RCC_I2C1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOB, GPIO_PIN_6|GPIO_PIN_7); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set the keyboard repeat rate to maximum. Unclear why this is done here; this might be possible to kill off as stale code. */
static void keyboard_set_repeat(void)
/* Set the keyboard repeat rate to maximum. Unclear why this is done here; this might be possible to kill off as stale code. */ static void keyboard_set_repeat(void)
{ struct biosregs ireg; initregs(&ireg); ireg.ax = 0x0305; intcall(0x16, &ireg, NULL); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Worker function to switch the requested AP to be the BSP from that point onward. */
VOID SwitchNewBsp(IN UINTN ProcessorNumber)
/* Worker function to switch the requested AP to be the BSP from that point onward. */ VOID SwitchNewBsp(IN UINTN ProcessorNumber)
{ EFI_STATUS Status; EDKII_PEI_MP_SERVICES2_PPI *CpuMp2Ppi; CPU_FEATURES_DATA *CpuFeaturesData; CpuFeaturesData = GetCpuFeaturesData (); CpuMp2Ppi = CpuFeaturesData->MpService.Ppi; Status = CpuMp2Ppi->SwitchBSP ( CpuMp2Ppi, Pr...
tianocore/edk2
C++
Other
4,240
/* This function is used to poll for the BSY bit clear in the Status Register. BSY is clear when the device is not busy. Every command must be sent after device is not busy. */
EFI_STATUS EFIAPI WaitForBSYClear(IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_IDE_REGISTERS *IdeRegisters, IN UINT64 Timeout)
/* This function is used to poll for the BSY bit clear in the Status Register. BSY is clear when the device is not busy. Every command must be sent after device is not busy. */ EFI_STATUS EFIAPI WaitForBSYClear(IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_IDE_REGISTERS *IdeRegisters, IN UINT64 Timeout)
{ UINT64 Delay; UINT8 StatusRegister; BOOLEAN InfiniteWait; ASSERT (PciIo != NULL); ASSERT (IdeRegisters != NULL); if (Timeout == 0) { InfiniteWait = TRUE; } else { InfiniteWait = FALSE; } Delay = DivU64x32 (Timeout, 1000) + 1; do { StatusRegister = IdeReadPortB (PciIo, IdeRegister...
tianocore/edk2
C++
Other
4,240
/* Clear one bit of the operational register while keeping other bits. */
VOID XhcPeiClearOpRegBit(IN PEI_XHC_DEV *Xhc, IN UINT32 Offset, IN UINT32 Bit)
/* Clear one bit of the operational register while keeping other bits. */ VOID XhcPeiClearOpRegBit(IN PEI_XHC_DEV *Xhc, IN UINT32 Offset, IN UINT32 Bit)
{ UINT32 Data; Data = XhcPeiReadOpReg (Xhc, Offset); Data &= ~Bit; XhcPeiWriteOpReg (Xhc, Offset, Data); }
tianocore/edk2
C++
Other
4,240
/* Fills the LCD with the specified 16-bit color. */
void lcdFillRGB(uint16_t data)
/* Fills the LCD with the specified 16-bit color. */ void lcdFillRGB(uint16_t data)
{ unsigned int i; ili9328Home(); uint32_t pixels = 320*240; for ( i=0; i < pixels; i++ ) { ili9328WriteData(data); } }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Writes N bytes to the specified mailbox register. */
int32_t BSP_NFCTAG_WriteMailboxRegister(uint32_t Instance, const uint8_t *const pData, const uint16_t TarAddr, const uint16_t NbByte)
/* Writes N bytes to the specified mailbox register. */ int32_t BSP_NFCTAG_WriteMailboxRegister(uint32_t Instance, const uint8_t *const pData, const uint16_t TarAddr, const uint16_t NbByte)
{ UNUSED(Instance); return ST25DV_WriteMailboxRegister(&NfcTagObj, pData, TarAddr, NbByte); }
eclipse-threadx/getting-started
C++
Other
310
/* Return a new incore dquot. Depending on the number of dquots in the system, we either allocate a new one on the kernel heap, or reclaim a free one. Return value is B_TRUE if we allocated a new dquot, B_FALSE if we managed to reclaim an existing one from the freelist. */
boolean_t xfs_qm_dqalloc_incore(xfs_dquot_t **O_dqpp)
/* Return a new incore dquot. Depending on the number of dquots in the system, we either allocate a new one on the kernel heap, or reclaim a free one. Return value is B_TRUE if we allocated a new dquot, B_FALSE if we managed to reclaim an existing one from the freelist. */ boolean_t xfs_qm_dqalloc_incore(xfs_dquot_t *...
{ xfs_dquot_t *dqp; if (atomic_read(&xfs_Gqm->qm_totaldquots) >= ndquot) { if ((dqp = xfs_qm_dqreclaim_one())) { XQM_STATS_INC(xqmstats.xs_qm_dqreclaims); memset(&dqp->q_core, 0, sizeof(dqp->q_core)); *O_dqpp = dqp; return B_FALSE; } XQM_STATS_INC(xqmstats.xs_qm_dqreclaim_misses); } ASSERT(xfs_Gqm...
robutest/uclinux
C++
GPL-2.0
60
/* rpc_alloc_iostats - allocate an rpc_iostats structure @clnt: RPC program, version, and xprt */
struct rpc_iostats* rpc_alloc_iostats(struct rpc_clnt *clnt)
/* rpc_alloc_iostats - allocate an rpc_iostats structure @clnt: RPC program, version, and xprt */ struct rpc_iostats* rpc_alloc_iostats(struct rpc_clnt *clnt)
{ struct rpc_iostats *new; new = kcalloc(clnt->cl_maxproc, sizeof(struct rpc_iostats), GFP_KERNEL); return new; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Check if PS2 mode is supported by the part. Support and FAQ: visit */
static bool is_ps2_mode_supported_by_the_part(void)
/* Check if PS2 mode is supported by the part. Support and FAQ: visit */ static bool is_ps2_mode_supported_by_the_part(void)
{ uint32_t cal_ver = *((uint32_t *)0x0080020C); return (cal_ver & 0xF0); }
remotemcu/remcu-chip-sdks
C++
null
436
/* All interrupt signals become available on INT1 pin.. */
int32_t lsm6dso_all_on_int1_get(lsm6dso_ctx_t *ctx, uint8_t *val)
/* All interrupt signals become available on INT1 pin.. */ int32_t lsm6dso_all_on_int1_get(lsm6dso_ctx_t *ctx, uint8_t *val)
{ lsm6dso_ctrl4_c_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_CTRL4_C, (uint8_t*)&reg, 1); *val = reg.int2_on_int1; return ret; }
alexander-g-dean/ESF
C++
null
41
/* Fills each OPAMP_InitStruct member with its default value. */
void OPAMP_StructInit(OPAMP_InitTypeDef *OPAMP_InitStruct)
/* Fills each OPAMP_InitStruct member with its default value. */ void OPAMP_StructInit(OPAMP_InitTypeDef *OPAMP_InitStruct)
{ OPAMP_InitStruct->OPAMP_NonInvertingInput = OPAMP_NonInvertingInput_IO1; OPAMP_InitStruct->OPAMP_InvertingInput = OPAMP_InvertingInput_IO1; }
ajhc/demo-cortex-m3
C++
null
38
/* param handle Pointer to DMA handle. param xferCfg xfer configuration, user can reference DMA_CHANNEL_XFER about to how to get xferCfg value. param srcStartAddr source start address. param dstStartAddr destination start address. param nextDesc address of next descriptor. */
void DMA_SubmitChannelTransferParameter(dma_handle_t *handle, uint32_t xferCfg, void *srcStartAddr, void *dstStartAddr, void *nextDesc)
/* param handle Pointer to DMA handle. param xferCfg xfer configuration, user can reference DMA_CHANNEL_XFER about to how to get xferCfg value. param srcStartAddr source start address. param dstStartAddr destination start address. param nextDesc address of next descriptor. */ void DMA_SubmitChannelTransferParameter(dm...
{ assert((NULL != srcStartAddr) && (NULL != dstStartAddr)); assert(handle->channel < (uint8_t)FSL_FEATURE_DMA_NUMBER_OF_CHANNELSn(handle->base)); uint32_t instance = DMA_GetInstance(handle->base); dma_descriptor_t *descriptor = (dma_descriptor_t *)(&s_dma_descriptor_table[instance][handle->ch...
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Reads a byte from the TWI bus. The read operation must have been started using TWI_StartRead() and a byte must be available (check with TWI_ByteReceived()). Returns the byte read. */
unsigned char TWI_ReadByte(AT91S_TWI *pTwi)
/* Reads a byte from the TWI bus. The read operation must have been started using TWI_StartRead() and a byte must be available (check with TWI_ByteReceived()). Returns the byte read. */ unsigned char TWI_ReadByte(AT91S_TWI *pTwi)
{ SANITY_CHECK(pTwi); return pTwi->TWI_RHR; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Clear XPRO_LCD LCD glass alphanumeric field. This function will clear the alphanumeric field of the LCD glass. */
void xpro_lcd_clear_text(void)
/* Clear XPRO_LCD LCD glass alphanumeric field. This function will clear the alphanumeric field of the LCD glass. */ void xpro_lcd_clear_text(void)
{ slcd_character_map_set(SLCD_AUTOMATED_CHAR_START_FROM_BOTTOM_RIGHT, XPRO_LCD_MAX_NUM-2); for (uint32_t i = 0; i < XPRO_LCD_MAX_CHAR; i++) { slcd_character_write_data(0,XPRO_LCD_TXT_SEG_INDEX_S + i * (XPRO_LCD_MAX_NUM-1), 0, 0x4002); } }
memfault/zero-to-main
C++
null
200
/* Get a Thread with Highest Priority from specified Object list and remove it. */
os_thread_t* osRtxThreadListGet(os_object_t *object)
/* Get a Thread with Highest Priority from specified Object list and remove it. */ os_thread_t* osRtxThreadListGet(os_object_t *object)
{ thread->thread_next->thread_prev = osRtxThreadObject(object); } thread->thread_prev = NULL; return thread; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Create code length array for a Huffman tree */
STATIC VOID MakeLen(IN INT32 Root)
/* Create code length array for a Huffman tree */ STATIC VOID MakeLen(IN INT32 Root)
{ INT32 i, k; UINT32 Cum; for (i = 0; i <= 16; i++) { mLenCnt[i] = 0; } CountLen(Root); Cum = 0; for (i = 16; i > 0; i--) { Cum += mLenCnt[i] << (16 - i); } while (Cum != (1U << 16)) { mLenCnt[16]--; for (i = 15; i > 0; i--) { if (mLenCnt[i] != 0) { mLenCnt[i]--; ...
tianocore/edk2
C++
Other
4,240
/* param base Pointer to FLEXIO_I2C_Type structure. param mask Interrupt source. Currently only one interrupt request source: arg kFLEXIO_I2C_TransferCompleteInterruptEnable */
void FLEXIO_I2C_MasterEnableInterrupts(FLEXIO_I2C_Type *base, uint32_t mask)
/* param base Pointer to FLEXIO_I2C_Type structure. param mask Interrupt source. Currently only one interrupt request source: arg kFLEXIO_I2C_TransferCompleteInterruptEnable */ void FLEXIO_I2C_MasterEnableInterrupts(FLEXIO_I2C_Type *base, uint32_t mask)
{ if (mask & kFLEXIO_I2C_TxEmptyInterruptEnable) { FLEXIO_EnableShifterStatusInterrupts(base->flexioBase, 1U << base->shifterIndex[0]); } if (mask & kFLEXIO_I2C_RxFullInterruptEnable) { FLEXIO_EnableShifterStatusInterrupts(base->flexioBase, 1U << base->shifterIndex[1]); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set the fields of structure stc_tmr6_zmask_config_t to default values. */
int32_t TMR6_ZMaskConfigStructInit(stc_tmr6_zmask_config_t *pstcZMaskConfig)
/* Set the fields of structure stc_tmr6_zmask_config_t to default values. */ int32_t TMR6_ZMaskConfigStructInit(stc_tmr6_zmask_config_t *pstcZMaskConfig)
{ int32_t i32Ret = LL_ERR_INVD_PARAM; if (NULL != pstcZMaskConfig) { pstcZMaskConfig->u32ZMaskCycle = TMR6_ZMASK_FUNC_INVD; pstcZMaskConfig->u32PosCountMaskFunc = TMR6_POS_CLR_ZMASK_FUNC_OFF; pstcZMaskConfig->u32RevoCountMaskFunc = TMR6_REVO_CNT_ZMASK_FUNC_OFF; i32Ret = LL_OK; ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Check if the specified DMA Channel is enabled. */
uint32_t dmac_channel_is_enable(Dmac *p_dmac, uint32_t ul_num)
/* Check if the specified DMA Channel is enabled. */ uint32_t dmac_channel_is_enable(Dmac *p_dmac, uint32_t ul_num)
{ Assert(p_dmac); Assert(ul_num<=3); if (p_dmac->DMAC_CHSR & (DMAC_CHSR_ENA0 << ul_num)) { return 1; } else { return 0; } }
remotemcu/remcu-chip-sdks
C++
null
436
/* Specifies the analog input source of extended channel. */
void ADC_SetExtChSrc(CM_ADC_TypeDef *ADCx, uint8_t u8ExtChSrc)
/* Specifies the analog input source of extended channel. */ void ADC_SetExtChSrc(CM_ADC_TypeDef *ADCx, uint8_t u8ExtChSrc)
{ DDL_ASSERT(IS_ADC_UNIT(ADCx)); DDL_ASSERT(IS_ADC_EXTCH_SRC(u8ExtChSrc)); WRITE_REG8(ADCx->EXCHSELR, u8ExtChSrc); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Main loop of the firmware Proposed architecture checkMsgs(); if(msg is command){ activate command handling } else if(msg is query){ format response to query } StepCurrentCommand(); StepMotors(); StepLED(); StepWhateverElseNeedsStepping(); The idea behind the Step* routines is to keep each automaton non-blocking allo...
void loop()
/* Main loop of the firmware Proposed architecture checkMsgs(); if(msg is command){ activate command handling } else if(msg is query){ format response to query } StepCurrentCommand(); StepMotors(); StepLED(); StepWhateverElseNeedsStepping(); The idea behind the Step* routines is to keep each automaton non-blocking allo...
{ mf::finda.Step(); mfs::fsensor.Step(); mi::idler.Step(); ms::selector.Step(); mpu::pulley.Step(); mui::userInput.Step(); } hal::cpu::Step(); mu::cdc.Step(); RuntimeHWChecks(); application.Step(); hal::watchdog::Reset(); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019