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
/* Stores data in the battery-backed memory of the Hibernation module. */
void HibernateDataSet(uint32_t *pui32Data, uint32_t ui32Count)
/* Stores data in the battery-backed memory of the Hibernation module. */ void HibernateDataSet(uint32_t *pui32Data, uint32_t ui32Count)
{ uint32_t ui32Idx; ASSERT(ui32Count <= 64); ASSERT(pui32Data != 0); for(ui32Idx = 0; ui32Idx < ui32Count; ui32Idx++) { HWREG(HIB_DATA + (ui32Idx * 4)) = pui32Data[ui32Idx]; _HibernateWriteComplete(); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* param base USART peripheral base address. param baudRate_Bps USART baudrate to be set.. param enableMode32k true is 32k mode, false is normal mode. param srcClock_Hz USART clock source frequency in HZ. retval kStatus_USART_BaudrateNotSupport Baudrate is not support in current clock source. retval kStatus_Success Set...
status_t USART_Enable32kMode(USART_Type *base, uint32_t baudRate_Bps, bool enableMode32k, uint32_t srcClock_Hz)
/* param base USART peripheral base address. param baudRate_Bps USART baudrate to be set.. param enableMode32k true is 32k mode, false is normal mode. param srcClock_Hz USART clock source frequency in HZ. retval kStatus_USART_BaudrateNotSupport Baudrate is not support in current clock source. retval kStatus_Success Set...
{ status_t result = kStatus_Success; base->CFG &= ~(USART_CFG_ENABLE_MASK); if (enableMode32k) { base->CFG |= USART_CFG_MODE32K_MASK; if ((9600U % baudRate_Bps) == 0U) { base->BRG = 9600U / baudRate_Bps - 1U; } else { return kStatus...
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Routines to overload "/" and "%" operator in C using ROM based divider library. */
int __aeabi_idiv(int numerator, int denominator)
/* Routines to overload "/" and "%" operator in C using ROM based divider library. */ int __aeabi_idiv(int numerator, int denominator)
{ ROM_DIV_API_T const *pROMDiv = LPC_ROM_API->divApiBase; return pROMDiv->sidiv(numerator, denominator); }
labapart/polymcu
C++
null
201
/* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param volume volume value, support 0 ~ 100, 0 is mute, 100 is the maximum volume value. return kStatus_Success is success, else configure failed. */
status_t HAL_CODEC_DA7212_SetVolume(void *handle, uint32_t playChannel, uint32_t volume)
/* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param volume volume value, support 0 ~ 100, 0 is mute, 100 is the maximum volume value. return kStatus_Success is success, else configure failed. */ status_t HAL_CODEC_DA7212_SetVolume(void *ha...
{ assert(handle != NULL); uint32_t mappedVolume = 0; status_t ret = kStatus_Success; if (volume == 0U) { return DA7212_SetChannelMute((da7212_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)), playChannel, true); } mappe...
eclipse-threadx/getting-started
C++
Other
310
/* Return: 0 in case of success, a negative error code otherwise. */
int nanddev_mtd_erase(struct mtd_info *mtd, struct erase_info *einfo)
/* Return: 0 in case of success, a negative error code otherwise. */ int nanddev_mtd_erase(struct mtd_info *mtd, struct erase_info *einfo)
{ struct nand_device *nand = mtd_to_nanddev(mtd); struct nand_pos pos, last; int ret; nanddev_offs_to_pos(nand, einfo->addr, &pos); nanddev_offs_to_pos(nand, einfo->addr + einfo->len - 1, &last); while (nanddev_pos_cmp(&pos, &last) <= 0) { ret = nanddev_erase(nand, &pos); if (ret) { einfo->fail_addr = nand...
4ms/stm32mp1-baremetal
C++
Other
137
/* The found FSD will contain the extent (LogicalVolumeContentsUse) where our root directory is. */
EFI_STATUS FindFileSetDescriptor(IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN UDF_VOLUME_INFO *Volume)
/* The found FSD will contain the extent (LogicalVolumeContentsUse) where our root directory is. */ EFI_STATUS FindFileSetDescriptor(IN EFI_BLOCK_IO_PROTOCOL *BlockIo, IN EFI_DISK_IO_PROTOCOL *DiskIo, IN UDF_VOLUME_INFO *Volume)
{ EFI_STATUS Status; UINT64 Lsn; UDF_LOGICAL_VOLUME_DESCRIPTOR *LogicalVolDesc; UDF_DESCRIPTOR_TAG *DescriptorTag; LogicalVolDesc = &Volume->LogicalVolDesc; Status = GetLongAdLsn (Volume, &LogicalVolDesc->LogicalVolumeContentsUse, &Lsn); if ...
tianocore/edk2
C++
Other
4,240
/* RETURNS: MV_OK - for success MV_BAD_PARAM - for fail */
int hws_serdes_pex_ref_clock_satr_get(enum serdes_type serdes_type, u32 *pex_satr)
/* RETURNS: MV_OK - for success MV_BAD_PARAM - for fail */ int hws_serdes_pex_ref_clock_satr_get(enum serdes_type serdes_type, u32 *pex_satr)
{ u32 data, reg_satr1; reg_satr1 = reg_read(DEVICE_SAMPLE_AT_RESET1_REG); switch (serdes_type) { case PEX0: data = REF_CLK_SELECTOR_VAL_PEX0(reg_satr1); break; case PEX1: data = REF_CLK_SELECTOR_VAL_PEX1(reg_satr1); break; case PEX2: data = REF_CLK_SELECTOR_VAL_PEX2(reg_satr1); break; case PEX3: da...
4ms/stm32mp1-baremetal
C++
Other
137
/* Process a new point from LV_INDEV_TYPE_BUTTON input device */
static void indev_proc_reset_query_handler(lv_indev_t *indev)
/* Process a new point from LV_INDEV_TYPE_BUTTON input device */ static void indev_proc_reset_query_handler(lv_indev_t *indev)
{ if(indev->reset_query) { indev->pointer.act_obj = NULL; indev->pointer.last_obj = NULL; indev->pointer.scroll_obj = NULL; indev->long_pr_sent = 0; indev->pr_timestamp = 0; indev->longpr_rep_timestamp ...
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* Change Logs: Date Author Notes balanceTWK the first version */
static rt_err_t rt_pulse_encoder_init(struct rt_device *dev)
/* Change Logs: Date Author Notes balanceTWK the first version */ static rt_err_t rt_pulse_encoder_init(struct rt_device *dev)
{ struct rt_pulse_encoder_device *pulse_encoder; pulse_encoder = (struct rt_pulse_encoder_device *)dev; if (pulse_encoder->ops->init) { return pulse_encoder->ops->init(pulse_encoder); } else { return -RT_ENOSYS; } }
pikasTech/PikaPython
C++
MIT License
1,403
/* Normalizes the angle ( -PI < angle <= PI ) */
void IMU_normalizeAngle(float *a)
/* Normalizes the angle ( -PI < angle <= PI ) */ void IMU_normalizeAngle(float *a)
{ while( *a >= IMU_PI ) { *a -= 2 * IMU_PI; } while( *a < -IMU_PI ) { *a += 2 * IMU_PI; } return; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Currently always returns zero, as blocking_notifier_chain_register() always returns zero. */
int register_reboot_notifier(struct notifier_block *nb)
/* Currently always returns zero, as blocking_notifier_chain_register() always returns zero. */ int register_reboot_notifier(struct notifier_block *nb)
{ return blocking_notifier_chain_register(&reboot_notifier_list, nb); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* MCU send an amount of data bytes to TEL0026. */
void BTSendBytes(unsigned long ulLength, unsigned char *pData)
/* MCU send an amount of data bytes to TEL0026. */ void BTSendBytes(unsigned long ulLength, unsigned char *pData)
{ while(ulLength > 0) { xUARTCharPut(TEL0026_UART_BASE, *pData++); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Set the 8x8 mono pattern for following BitBLT functions. */
void ge2dInitMonoPattern(int opt, int fore_color, int back_color)
/* Set the 8x8 mono pattern for following BitBLT functions. */ void ge2dInitMonoPattern(int opt, int fore_color, int back_color)
{ UINT32 color32; outpw(REG_GE2D_PTNA, MonoPatternData[opt].PatternA); outpw(REG_GE2D_PTNB, MonoPatternData[opt].PatternB); color32 = make_color(fore_color); outpw(REG_GE2D_FGCOLR, color32); color32 = make_color(back_color); outpw(REG_GE2D_BGCOLR, color32); _PatternType = TYPE_MONO; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enables LIN Function mode on the specified UART. */
void UARTEnableLIN(unsigned long ulBase)
/* Enables LIN Function mode on the specified UART. */ void UARTEnableLIN(unsigned long ulBase)
{ xASSERT(UARTBaseValid(ulBase)); xHWREG(ulBase + USART_CR2) &= ~(USART_CR2_CLKEN | USART_CR2_STOP_M); xHWREG(ulBase + USART_CR3) &= ~(USART_CR3_HDSEL | USART_CR3_SCEN | USART_CR3_IREN); xHWREG(ulBase + USART_CR2) |= (USART_CR2_LINEN); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Description: vxfs_instino is a helper function to fill in all relevant fields in @ip from @vip. */
static void vxfs_iinit(struct inode *ip, struct vxfs_inode_info *vip)
/* Description: vxfs_instino is a helper function to fill in all relevant fields in @ip from @vip. */ static void vxfs_iinit(struct inode *ip, struct vxfs_inode_info *vip)
{ ip->i_mode = vxfs_transmod(vip); ip->i_uid = (uid_t)vip->vii_uid; ip->i_gid = (gid_t)vip->vii_gid; ip->i_nlink = vip->vii_nlink; ip->i_size = vip->vii_size; ip->i_atime.tv_sec = vip->vii_atime; ip->i_ctime.tv_sec = vip->vii_ctime; ip->i_mtime.tv_sec = vip->vii_mtime; ip->i_atime.tv_nsec = 0; ip->i_ctime.tv_...
robutest/uclinux
C++
GPL-2.0
60
/* @mydata: data to be written @clustnum: cluster to be written to @buffer: data to be written @size: bytes to be written (but not more than the size of a cluster) Return: 0 on success, -1 otherwise */
static int set_cluster(fsdata *mydata, u32 clustnum, u8 *buffer, u32 size)
/* @mydata: data to be written @clustnum: cluster to be written to @buffer: data to be written @size: bytes to be written (but not more than the size of a cluster) Return: 0 on success, -1 otherwise */ static int set_cluster(fsdata *mydata, u32 clustnum, u8 *buffer, u32 size)
{ return set_sectors(mydata, clust_to_sect(mydata, clustnum), buffer, size); }
4ms/stm32mp1-baremetal
C++
Other
137
/* If MenuNumber is great or equal to the number of Menu Entry in the list, then ASSERT. */
BM_MENU_ENTRY* BOpt_GetMenuEntry(BM_MENU_OPTION *MenuOption, UINTN MenuNumber)
/* If MenuNumber is great or equal to the number of Menu Entry in the list, then ASSERT. */ BM_MENU_ENTRY* BOpt_GetMenuEntry(BM_MENU_OPTION *MenuOption, UINTN MenuNumber)
{ BM_MENU_ENTRY *NewMenuEntry; UINTN Index; LIST_ENTRY *List; ASSERT (MenuNumber < MenuOption->MenuNumber); List = MenuOption->Head.ForwardLink; for (Index = 0; Index < MenuNumber; Index++) { List = List->ForwardLink; } NewMenuEntry = CR (List, BM_MENU_ENTRY, Link, BM_MENU_ENTRY_SIGNAT...
tianocore/edk2
C++
Other
4,240
/* Returns: the GObject from the attribute, or NULL. */
GObject* _g_file_attribute_value_get_object(const GFileAttributeValue *attr)
/* Returns: the GObject from the attribute, or NULL. */ GObject* _g_file_attribute_value_get_object(const GFileAttributeValue *attr)
{ if (attr == NULL) return NULL; g_return_val_if_fail (attr->type == G_FILE_ATTRIBUTE_TYPE_OBJECT, NULL); return attr->u.obj; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Request that the sequencer stop and wait, indefinitely, for it to stop. The sequencer will only acknowledge that it is paused once it has reached an instruction boundary and PAUSEDIS is cleared in the SEQCTL register. The sequencer may use PAUSEDIS for critical sections. */
void ahd_pause(struct ahd_softc *ahd)
/* Request that the sequencer stop and wait, indefinitely, for it to stop. The sequencer will only acknowledge that it is paused once it has reached an instruction boundary and PAUSEDIS is cleared in the SEQCTL register. The sequencer may use PAUSEDIS for critical sections. */ void ahd_pause(struct ahd_softc *ahd)
{ ahd_outb(ahd, HCNTRL, ahd->pause); while (ahd_is_paused(ahd) == 0) ; }
robutest/uclinux
C++
GPL-2.0
60
/* This is a notification function registered on EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event. It convers pointer to new virtual address. */
VOID EFIAPI VariableAddressChangeEvent(IN EFI_EVENT Event, IN VOID *Context)
/* This is a notification function registered on EVT_SIGNAL_VIRTUAL_ADDRESS_CHANGE event. It convers pointer to new virtual address. */ VOID EFIAPI VariableAddressChangeEvent(IN EFI_EVENT Event, IN VOID *Context)
{ EfiConvertPointer (0x0, (VOID **)&mVariableBuffer); EfiConvertPointer (0x0, (VOID **)&mMmCommunication2); EfiConvertPointer (EFI_OPTIONAL_PTR, (VOID **)&mVariableRuntimeHobCacheBuffer); EfiConvertPointer (EFI_OPTIONAL_PTR, (VOID **)&mVariableRuntimeNvCacheBuffer); EfiConvertPointer (EFI_OPTIONAL_PTR, (VOID ...
tianocore/edk2
C++
Other
4,240
/* If any reserved bits in Address are set, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger th...
UINT16 EFIAPI PciSegmentBitFieldAndThenOr16(IN UINT64 Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT16 AndData, IN UINT16 OrData)
/* If any reserved bits in Address are set, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If AndData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). If OrData is larger th...
{ UINTN Count; PCI_SEGMENT_INFO *SegmentInfo; SegmentInfo = GetPciSegmentInfo (&Count); return MmioBitFieldAndThenOr16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), StartBit, EndBit, AndData, OrData); }
tianocore/edk2
C++
Other
4,240
/* Enable the use of SYSCTL_RCC2 register for clock control. Enables the USERCC2 bit in SYSCTTL_RCC2. Settings in SYSCTL_RCC2 will override settings in SYSCTL_RCC. This function must be called before other calls to manipulate the clock, as unicore-mx uses the SYSCTL_RCC2 register. */
void rcc_enable_rcc2(void)
/* Enable the use of SYSCTL_RCC2 register for clock control. Enables the USERCC2 bit in SYSCTTL_RCC2. Settings in SYSCTL_RCC2 will override settings in SYSCTL_RCC. This function must be called before other calls to manipulate the clock, as unicore-mx uses the SYSCTL_RCC2 register. */ void rcc_enable_rcc2(void)
{ SYSCTL_RCC2 |= SYSCTL_RCC2_USERCC2; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* pmcraid_open -char node "open" entry, allowed only users with admin access */
static int pmcraid_chr_open(struct inode *inode, struct file *filep)
/* pmcraid_open -char node "open" entry, allowed only users with admin access */ static int pmcraid_chr_open(struct inode *inode, struct file *filep)
{ struct pmcraid_instance *pinstance; if (!capable(CAP_SYS_ADMIN)) return -EACCES; pinstance = container_of(inode->i_cdev, struct pmcraid_instance, cdev); filep->private_data = pinstance; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* @ops: AvbOps, contains AVB ops handlers @public_key_data: public key for verifying vbmeta partition signature @public_key_length: length of public key @public_key_metadata: @public_key_metadata_length: @out_key_is_trusted: */
static AvbIOResult validate_vbmeta_public_key(AvbOps *ops, const u8 *public_key_data, size_t public_key_length, const u8 *public_key_metadata, size_t public_key_metadata_length, bool *out_key_is_trusted)
/* @ops: AvbOps, contains AVB ops handlers @public_key_data: public key for verifying vbmeta partition signature @public_key_length: length of public key @public_key_metadata: @public_key_metadata_length: @out_key_is_trusted: */ static AvbIOResult validate_vbmeta_public_key(AvbOps *ops, const u8 *public_key_data, size_...
{ if (!public_key_length || !public_key_data || !out_key_is_trusted) return AVB_IO_RESULT_ERROR_IO; *out_key_is_trusted = false; if (public_key_length != sizeof(avb_root_pub)) return AVB_IO_RESULT_ERROR_IO; if (memcmp(avb_root_pub, public_key_data, public_key_length) == 0) *out_key_is_trusted = true; return ...
4ms/stm32mp1-baremetal
C++
Other
137
/* Convert an UINT32 value into HEX string specified by Buffer. */
VOID FillHex(UINTN Value, CHAR8 *Buffer)
/* Convert an UINT32 value into HEX string specified by Buffer. */ VOID FillHex(UINTN Value, CHAR8 *Buffer)
{ INTN Idx; for (Idx = (sizeof (UINTN) * 2) - 1; Idx >= 0; Idx--) { Buffer[Idx] = mHexTable[Value & 0x0F]; Value >>= 4; } }
tianocore/edk2
C++
Other
4,240
/* The following mode transitions are valid (other transitions produce undefined results): */
void SSIAdvModeSet(uint32_t ui32Base, uint32_t ui32Mode)
/* The following mode transitions are valid (other transitions produce undefined results): */ void SSIAdvModeSet(uint32_t ui32Base, uint32_t ui32Mode)
{ ASSERT(_SSIBaseValid(ui32Base)); ASSERT((ui32Mode == SSI_ADV_MODE_LEGACY) || (ui32Mode == SSI_ADV_MODE_WRITE) || (ui32Mode == SSI_ADV_MODE_READ_WRITE) || (ui32Mode == SSI_ADV_MODE_BI_READ) || (ui32Mode == SSI_ADV_MODE_BI_WRITE) || (ui32Mode == SSI_ADV_MOD...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Yenta (at least) probes interrupts before registering the socket and starting the handler thread. */
void pcmcia_parse_events(struct pcmcia_socket *s, u_int events)
/* Yenta (at least) probes interrupts before registering the socket and starting the handler thread. */ void pcmcia_parse_events(struct pcmcia_socket *s, u_int events)
{ unsigned long flags; dev_dbg(&s->dev, "parse_events: events %08x\n", events); if (s->thread) { spin_lock_irqsave(&s->thread_lock, flags); s->thread_events |= events; spin_unlock_irqrestore(&s->thread_lock, flags); wake_up_process(s->thread); } }
robutest/uclinux
C++
GPL-2.0
60
/* serial core request to stop rx, called before port shutdown */
static void bcm_uart_stop_rx(struct uart_port *port)
/* serial core request to stop rx, called before port shutdown */ static void bcm_uart_stop_rx(struct uart_port *port)
{ unsigned int val; val = bcm_uart_readl(port, UART_IR_REG); val &= ~UART_RX_INT_MASK; bcm_uart_writel(port, val, UART_IR_REG); }
robutest/uclinux
C++
GPL-2.0
60
/* Virtual address change notification call back. It converts global pointer to virtual address. */
VOID EFIAPI VirtualAddressChangeCallBack(IN EFI_EVENT Event, IN VOID *Context)
/* Virtual address change notification call back. It converts global pointer to virtual address. */ VOID EFIAPI VirtualAddressChangeCallBack(IN EFI_EVENT Event, IN VOID *Context)
{ EFI_STATUS Status; LIST_ENTRY *Link; RSC_HANDLER_CALLBACK_ENTRY *CallbackEntry; for (Link = GetFirstNode (&mCallbackListHead); !IsNull (&mCallbackListHead, Link); Link = GetNextNode (&mCallbackListHead, Link)) { CallbackEntry = CR (Link, RSC_HANDLER_CALLBACK_ENTRY, Node,...
tianocore/edk2
C++
Other
4,240
/* Leave the group for this filesystem. This is executed by a userspace program (stored in ocfs2_hb_ctl_path). */
static void ocfs2_leave_group(const char *group)
/* Leave the group for this filesystem. This is executed by a userspace program (stored in ocfs2_hb_ctl_path). */ static void ocfs2_leave_group(const char *group)
{ int ret; char *argv[5], *envp[3]; argv[0] = ocfs2_hb_ctl_path; argv[1] = "-K"; argv[2] = "-u"; argv[3] = (char *)group; argv[4] = NULL; envp[0] = "HOME=/"; envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin"; envp[2] = NULL; ret = call_usermodehelper(argv[0], argv, envp, UMH_WAIT_PROC); if (ret < 0) { printk...
robutest/uclinux
C++
GPL-2.0
60
/* We handle cardbus via a fake Cardbus bridge, memory and io spaces have to be clearly separated from PCI one since we have different memory decoder. */
static u32 bcm63xx_int_cfg_readl(u32 reg)
/* We handle cardbus via a fake Cardbus bridge, memory and io spaces have to be clearly separated from PCI one since we have different memory decoder. */ static u32 bcm63xx_int_cfg_readl(u32 reg)
{ u32 tmp; tmp = reg & MPI_PCICFGCTL_CFGADDR_MASK; tmp |= MPI_PCICFGCTL_WRITEEN_MASK; bcm_mpi_writel(tmp, MPI_PCICFGCTL_REG); iob(); return bcm_mpi_readl(MPI_PCICFGDATA_REG); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Specifies the tim Counter Mode to be used. */
void TIM_CounterModeConfig(TIM_TypeDef *tim, TIMCOUNTMODE_Typedef counter_mode)
/* Specifies the tim Counter Mode to be used. */ void TIM_CounterModeConfig(TIM_TypeDef *tim, TIMCOUNTMODE_Typedef counter_mode)
{ MODIFY_REG(tim->CR1, TIM_CR1_CMS | TIM_CR1_DIR, counter_mode); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enumerate sensor bandwidth settings. This routine returns the address of a table, if any, holding device-specific sensor bandwidth settings. The use and context of the settings are specific to the device and typically documented in the manufacturer's data sheets for the device. */
bool sensor_enum_bandwidth(sensor_t *sensor, const sensor_band_t **table, size_t *count)
/* Enumerate sensor bandwidth settings. This routine returns the address of a table, if any, holding device-specific sensor bandwidth settings. The use and context of the settings are specific to the device and typically documented in the manufacturer's data sheets for the device. */ bool sensor_enum_bandwidth(sensor_...
{ *table = sensor->drv->caps.band_table; *count = sensor->drv->caps.band_count; return (*count) ? true : false; }
memfault/zero-to-main
C++
null
200
/* Start transfering (flags or data) on the B channel, since FIFO counters has been set to a non-zero value. */
static void st5481B_start_xfer(void *context)
/* Start transfering (flags or data) on the B channel, since FIFO counters has been set to a non-zero value. */ static void st5481B_start_xfer(void *context)
{ struct st5481_bcs *bcs = context; DBG(4,"B%d",bcs->channel+1); usb_b_out(bcs,0); usb_b_out(bcs,1); }
robutest/uclinux
C++
GPL-2.0
60
/* Enable Time Stamp for All frames When set the timestamp snap shot is enabled for all frames received by the core. Reserved when "Advanced Time Stamp" is not selected */
void synopGMAC_TS_all_frames_enable(synopGMACdevice *gmacdev)
/* Enable Time Stamp for All frames When set the timestamp snap shot is enabled for all frames received by the core. Reserved when "Advanced Time Stamp" is not selected */ void synopGMAC_TS_all_frames_enable(synopGMACdevice *gmacdev)
{ synopGMACSetBits(gmacdev->MacBase, GmacTSControl, GmacTSENALL); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Change Logs: Date Author Notes Bernard first version. */
static void _rt_pipe_resume_writer(struct rt_audio_pipe *pipe)
/* Change Logs: Date Author Notes Bernard first version. */ static void _rt_pipe_resume_writer(struct rt_audio_pipe *pipe)
{ if (!rt_list_isempty(&pipe->suspended_write_list)) { rt_thread_t thread; RT_ASSERT(pipe->flag & RT_PIPE_FLAG_BLOCK_WR); thread = rt_list_entry(pipe->suspended_write_list.next, struct rt_thread, tlist); rt_thread_resu...
pikasTech/PikaPython
C++
MIT License
1,403
/* Unregisters an interrupt handler for the quadrature encoder interrupt. */
void QEIIntUnregister(uint32_t ui32Base)
/* Unregisters an interrupt handler for the quadrature encoder interrupt. */ void QEIIntUnregister(uint32_t ui32Base)
{ uint32_t ui32Int; ASSERT(ui32Base == QEI0_BASE); ui32Int = _QEIIntNumberGet(ui32Base); ASSERT(ui32Int != 0); IntDisable(ui32Int); IntUnregister(ui32Int); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Initializes the HASH MSP. This function configures the hardware resources used in this example: */
void HAL_HASH_MspInit(HASH_HandleTypeDef *hhash)
/* Initializes the HASH MSP. This function configures the hardware resources used in this example: */ void HAL_HASH_MspInit(HASH_HandleTypeDef *hhash)
{ __HAL_RCC_HASH_CLK_ENABLE(); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Arch-specific wrapper function for memory mapping at run-time Maps memory according to the parameters provided by the caller at run-time. This function wraps the ARMv7 MMU specific implementation #__arch_mem_map() for the upper layers of the memory management. If the map operation fails, a kernel panic will be trigg...
void arch_mem_map(void *virt, uintptr_t phys, size_t size, uint32_t flags)
/* Arch-specific wrapper function for memory mapping at run-time Maps memory according to the parameters provided by the caller at run-time. This function wraps the ARMv7 MMU specific implementation #__arch_mem_map() for the upper layers of the memory management. If the map operation fails, a kernel panic will be trigg...
{ int ret = __arch_mem_map(virt, phys, size, flags); if (ret) { LOG_ERR("__arch_mem_map() returned %d", ret); k_panic(); } else { invalidate_tlb_all(); } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function replaces the original CANGetBitTiming() API and performs the same actions. A macro is provided in */
void CANBitTimingGet(unsigned long ulBase, tCANBitClkParms *pClkParms)
/* This function replaces the original CANGetBitTiming() API and performs the same actions. A macro is provided in */ void CANBitTimingGet(unsigned long ulBase, tCANBitClkParms *pClkParms)
{ unsigned long ulBitReg; ASSERT(CANBaseValid(ulBase)); ASSERT(pClkParms != 0); ulBitReg = CANRegRead(ulBase + CAN_O_BIT); pClkParms->ulPhase2Seg = ((ulBitReg & CAN_BIT_TSEG2_M) >> CAN_BIT_TSEG2_S) + 1; pClkParms->ulSyncPropPhase1Seg = ((ulBitReg & CAN_BIT_TSEG1_M) >> CAN_BIT_TSE...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* s e t u p A u x i l i a r y Q P s o l u t i o n */
returnValue QProblemB_setupAuxiliaryQPsolution(QProblemB *_THIS, const real_t *const xOpt, const real_t *const yOpt)
/* s e t u p A u x i l i a r y Q P s o l u t i o n */ returnValue QProblemB_setupAuxiliaryQPsolution(QProblemB *_THIS, const real_t *const xOpt, const real_t *const yOpt)
{ int i; int nV = QProblemB_getNV( _THIS ); if ( xOpt != 0 ) { if ( xOpt != _THIS->x ) for( i=0; i<nV; ++i ) _THIS->x[i] = xOpt[i]; } else { for( i=0; i<nV; ++i ) _THIS->x[i] = 0.0; } if ( yOpt != 0 ) { if ( yOpt != _THIS->y ) for( i=0; i<nV; ++i ) _THIS->y[i] = yOpt[i]; } else { f...
DanielMartensson/EmbeddedLapack
C++
MIT License
129
/* Waits for a FLASH operation to complete or a TIMEOUT to occur. */
FLASH_Status FLASH_WaitForLastOperation(uint32_t Timeout)
/* Waits for a FLASH operation to complete or a TIMEOUT to occur. */ FLASH_Status FLASH_WaitForLastOperation(uint32_t Timeout)
{ FLASH_Status status = FLASH_COMPLETE; status = FLASH_GetStatus(); while ((status == FLASH_BUSY) && (Timeout != 0x00)) { status = FLASH_GetStatus(); Timeout--; } if (Timeout == 0x00) { status = FLASH_TIMEOUT; } return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return with the pointer of the next node after 'n_act' */
void* lv_ll_get_next(const lv_ll_t *ll_p, const void *n_act)
/* Return with the pointer of the next node after 'n_act' */ void* lv_ll_get_next(const lv_ll_t *ll_p, const void *n_act)
{ void * next = NULL; if(ll_p != NULL) { const lv_ll_node_t * n_act_d = n_act; memcpy(&next, n_act_d + LL_NEXT_P_OFFSET(ll_p), sizeof(void *)); } return next; }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* Returns: a #GOutputStream with an internal buffer set to @size. */
GOutputStream* g_buffered_output_stream_new_sized(GOutputStream *base_stream, gsize size)
/* Returns: a #GOutputStream with an internal buffer set to @size. */ GOutputStream* g_buffered_output_stream_new_sized(GOutputStream *base_stream, gsize size)
{ GOutputStream *stream; g_return_val_if_fail (G_IS_OUTPUT_STREAM (base_stream), NULL); stream = g_object_new (G_TYPE_BUFFERED_OUTPUT_STREAM, "base-stream", base_stream, "buffer-size", size, NULL); return stream; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Handle an unknown service id by sending a negative response. */
static int handle_unknown_service_id(struct upgrade_uds_t *self_p, int length, uint8_t service_id)
/* Handle an unknown service id by sending a negative response. */ static int handle_unknown_service_id(struct upgrade_uds_t *self_p, int length, uint8_t service_id)
{ ignore_and_write_negative_response(self_p, length, service_id, SERVICE_NOT_SUPPORTED); return (0); }
eerimoq/simba
C++
Other
337
/* Check to see if the scheduling-clock interrupt came from an extended quiescent state, and, if so, tell RCU about it. */
void rcu_check_callbacks(int cpu, int user)
/* Check to see if the scheduling-clock interrupt came from an extended quiescent state, and, if so, tell RCU about it. */ void rcu_check_callbacks(int cpu, int user)
{ if (user || (idle_cpu(cpu) && !in_softirq() && hardirq_count() <= (1 << HARDIRQ_SHIFT))) rcu_sched_qs(cpu); else if (!in_softirq()) rcu_bh_qs(cpu); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */
void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
/* TIM_Base MSP Initialization This function configures the hardware resources used in this example. */ void HAL_TIM_Base_MspInit(TIM_HandleTypeDef *htim_base)
{ if(htim_base->Instance==TIM10) { __HAL_RCC_TIM10_CLK_ENABLE(); } else if(htim_base->Instance==TIM11) { __HAL_RCC_TIM11_CLK_ENABLE(); } else if(htim_base->Instance==TIM13) { __HAL_RCC_TIM13_CLK_ENABLE(); } else if(htim_base->Instance==TIM14) { __HAL_RCC_TIM14_CLK_ENABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Read the captured value from Capture Compare unit. */
uint32_t ald_timer_read_capture_value(ald_timer_handle_t *hperh, ald_timer_channel_t ch)
/* Read the captured value from Capture Compare unit. */ uint32_t ald_timer_read_capture_value(ald_timer_handle_t *hperh, ald_timer_channel_t ch)
{ uint32_t tmp; __LOCK(hperh); hperh->state = ALD_TIMER_STATE_BUSY; switch (ch) { case ALD_TIMER_CHANNEL_1: tmp = hperh->perh->CCVAL1; break; case ALD_TIMER_CHANNEL_2: tmp = hperh->perh->CCVAL2; break; case ALD_TIMER_CHANNEL_3: tmp = hperh->perh->CCVAL...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* user call this function to disable receive data from device */
void usb_host_cdc_disable_receive(usb_core_instance *pdev)
/* user call this function to disable receive data from device */ void usb_host_cdc_disable_receive(usb_core_instance *pdev)
{ RX_Enabled = 0; usb_hchstop(&pdev->regs, CDC_Machine.CDC_DataItf.hc_num_in); (void)usb_host_freech(pdev, CDC_Machine.CDC_DataItf.hc_num_in); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* handle a request by calling one of the installed request handlers Local function to handle a request by calling one of the installed request handlers. In case of data going from host to device, the data is at *ppbData. In case of data going from device to host, the handler can either choose to write its data at *pp...
static bool usb_handle_request(struct usb_setup_packet *setup, int32_t *len, uint8_t **data)
/* handle a request by calling one of the installed request handlers Local function to handle a request by calling one of the installed request handlers. In case of data going from host to device, the data is at *ppbData. In case of data going from device to host, the handler can either choose to write its data at *pp...
{ uint32_t type = setup->RequestType.type; usb_request_handler handler; if (type >= MAX_NUM_REQ_HANDLERS) { LOG_DBG("Error Incorrect iType %d", type); return false; } handler = usb_dev.req_handlers[type]; if (handler == NULL) { LOG_DBG("No handler for reqtype %d", type); return false; } if ((*handler)(s...
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Log the bests entries indicated from a leaf1 block. */
static void xfs_dir2_leaf_log_bests(xfs_trans_t *tp, xfs_dabuf_t *bp, int first, int last)
/* Log the bests entries indicated from a leaf1 block. */ static void xfs_dir2_leaf_log_bests(xfs_trans_t *tp, xfs_dabuf_t *bp, int first, int last)
{ __be16 *firstb; __be16 *lastb; xfs_dir2_leaf_t *leaf; xfs_dir2_leaf_tail_t *ltp; leaf = bp->data; ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAF1_MAGIC); ltp = xfs_dir2_leaf_tail_p(tp->t_mountp, leaf); firstb = xfs_dir2_leaf_bests_p(ltp) + first; lastb = xfs_dir2_leaf_bests_p(ltp) + last; xf...
robutest/uclinux
C++
GPL-2.0
60
/* Execute the next scheduled HW event (advancing time until that event would trigger) */
void nsi_hws_one_event(void)
/* Execute the next scheduled HW event (advancing time until that event would trigger) */ void nsi_hws_one_event(void)
{ nsi_hws_sleep_until_next_event(); if (next_timer_index < number_of_events) { __nsi_hw_events_start[next_timer_index].callback(); } else { nsi_print_error_and_exit("next_timer_index corrupted\n"); } nsi_hws_find_next_event(); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Enable Single Conversion Mode In this mode the ADC performs a conversion of one channel or a channel group and stops. */
void adc_set_single_conversion_mode(uint32_t adc)
/* Enable Single Conversion Mode In this mode the ADC performs a conversion of one channel or a channel group and stops. */ void adc_set_single_conversion_mode(uint32_t adc)
{ ADC_CFGR1(adc) &= ~ADC_CFGR1_CONT; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* xfs_filestream_unmount() is called when a file system that was mounted with the filestream option is unmounted. It drains the data structures created to track the file system's file streams and frees all the memory that was allocated. */
void xfs_filestream_unmount(xfs_mount_t *mp)
/* xfs_filestream_unmount() is called when a file system that was mounted with the filestream option is unmounted. It drains the data structures created to track the file system's file streams and frees all the memory that was allocated. */ void xfs_filestream_unmount(xfs_mount_t *mp)
{ xfs_mru_cache_destroy(mp->m_filestream); }
robutest/uclinux
C++
GPL-2.0
60
/* b a c k s o l v e R */
returnValue QProblemB_backsolveR(QProblemB *_THIS, const real_t *const b, BooleanType transposed, real_t *const a)
/* b a c k s o l v e R */ returnValue QProblemB_backsolveR(QProblemB *_THIS, const real_t *const b, BooleanType transposed, real_t *const a)
{ return QProblemB_backsolveRrem( _THIS,b,transposed,BT_FALSE,a ); }
DanielMartensson/EmbeddedLapack
C++
MIT License
129
/* Check whether the addresses are all included by the configured Ia. */
EFI_STATUS Dhcp6CheckAddress(IN EFI_DHCP6_IA *Ia, IN UINT32 AddressCount, IN EFI_IPv6_ADDRESS *Addresses)
/* Check whether the addresses are all included by the configured Ia. */ EFI_STATUS Dhcp6CheckAddress(IN EFI_DHCP6_IA *Ia, IN UINT32 AddressCount, IN EFI_IPv6_ADDRESS *Addresses)
{ UINTN Index1; UINTN Index2; BOOLEAN Found; for (Index1 = 0; Index1 < AddressCount; Index1++) { Found = FALSE; for (Index2 = 0; Index2 < Ia->IaAddressCount; Index2++) { if (CompareMem ( &Addresses[Index1], &Ia->IaAddress[Index2], sizeof (EFI_IPv6_ADDRESS...
tianocore/edk2
C++
Other
4,240
/* PCR peripheral sleep enable allows the clocks to a specific peripheral to be gated off if the peripheral is not requesting a clock. slp_idx = zero based index into 32-bit PCR sleep enable registers. slp_pos = bit position in the register slp_en if non-zero set the bit else clear the bit */
int z_mchp_xec_pcr_periph_sleep(uint8_t slp_idx, uint8_t slp_pos, uint8_t slp_en)
/* PCR peripheral sleep enable allows the clocks to a specific peripheral to be gated off if the peripheral is not requesting a clock. slp_idx = zero based index into 32-bit PCR sleep enable registers. slp_pos = bit position in the register slp_en if non-zero set the bit else clear the bit */ int z_mchp_xec_pcr_periph...
{ struct pcr_hw_regs *const pcr = (struct pcr_hw_regs *)DT_INST_REG_ADDR_BY_IDX(0, 0); if ((slp_idx >= MCHP_MAX_PCR_SCR_REGS) || (slp_pos >= 32)) { return -EINVAL; } if (slp_en) { pcr->SLP_EN[slp_idx] |= BIT(slp_pos); } else { pcr->SLP_EN[slp_idx] &= ~BIT(slp_pos); } return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Adds a subscription to the missing files list. */
void _km_add_missing(kqueue_sub *sub)
/* Adds a subscription to the missing files list. */ void _km_add_missing(kqueue_sub *sub)
{ G_LOCK (missing_lock); if (g_slist_find (missing_subs_list, sub)) { KM_W ("asked to add %s to missing list but it's already on the list!\n", sub->filename); G_UNLOCK (missing_lock); return; } KM_W ("adding %s to missing list\n", sub->filename); missing_subs_list = g_slist_prepend (mi...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* @handle: handle of the loaded image @systable: system table */
static int setup(const efi_handle_t img_handle, const struct efi_system_table *systable)
/* @handle: handle of the loaded image @systable: system table */ static int setup(const efi_handle_t img_handle, const struct efi_system_table *systable)
{ efi_status_t ret; boottime = systable->boottime; ret = boottime->install_protocol_interface(&handle1, &guid1, EFI_NATIVE_INTERFACE, &interface1); if (ret != EFI_SUCCESS) { efi_st_error("InstallProtocolInterface failed\n"); return EFI_ST_FAILURE; } if (!handle1) { efi_st_error ("Instal...
4ms/stm32mp1-baremetal
C++
Other
137
/* Assign code to each symbol based on the code length array */
STATIC VOID MakeCode(IN INT32 n, IN UINT8 Len[], OUT UINT16 Code[])
/* Assign code to each symbol based on the code length array */ STATIC VOID MakeCode(IN INT32 n, IN UINT8 Len[], OUT UINT16 Code[])
{ INT32 i; UINT16 Start[18]; Start[1] = 0; for (i = 1; i <= 16; i++) { Start[i + 1] = (UINT16)((Start[i] + mLenCnt[i]) << 1); } for (i = 0; i < n; i++) { Code[i] = Start[Len[i]]++; } }
tianocore/edk2
C++
Other
4,240
/* This action resets ack_must_be_send flag of given connection, this flag indicates if there is any PDU which has not been acknowledged yet. Returns 0 for success, 1 otherwise. */
int llc_conn_ac_rst_sendack_flag(struct sock *sk, struct sk_buff *skb)
/* This action resets ack_must_be_send flag of given connection, this flag indicates if there is any PDU which has not been acknowledged yet. Returns 0 for success, 1 otherwise. */ int llc_conn_ac_rst_sendack_flag(struct sock *sk, struct sk_buff *skb)
{ llc_sk(sk)->ack_must_be_send = llc_sk(sk)->ack_pf = 0; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Unescapes the given URL escaped string of given length. Returns a pointer to a malloced string with length given in *olen. If length == 0, the length is assumed to be strlen(string). If olen == NULL, no output length is stored. */
char* curl_easy_unescape(struct Curl_easy *data, const char *string, int length, int *olen)
/* Unescapes the given URL escaped string of given length. Returns a pointer to a malloced string with length given in *olen. If length == 0, the length is assumed to be strlen(string). If olen == NULL, no output length is stored. */ char* curl_easy_unescape(struct Curl_easy *data, const char *string, int length, int ...
{ char *str = NULL; if(length >= 0) { size_t inputlen = length; size_t outputlen; CURLcode res = Curl_urldecode(data, string, inputlen, &str, &outputlen, FALSE); if(res) return NULL; if(olen) { if(outputlen <= (size_t) INT_MAX) *olen = curlx_...
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Enables or disables the selected DAC channel software trigger. */
void DAC_SoftwareTriggerCmd(uint32_t DAC_Channel, FunctionalState NewState)
/* Enables or disables the selected DAC channel software trigger. */ void DAC_SoftwareTriggerCmd(uint32_t DAC_Channel, FunctionalState NewState)
{ assert_param(IS_DAC_CHANNEL(DAC_Channel)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { DAC->SWTRIGR |= (uint32_t)DAC_SWTRIGR_SWTRIG1 << (DAC_Channel >> 4); } else { DAC->SWTRIGR &= ~((uint32_t)DAC_SWTRIGR_SWTRIG1 << (DAC_Channel >> 4)); } }
gcallipo/RadioDSP-Stm32f103
C++
Common Creative - Attribution 3.0
51
/* USB Device Request - Data Out Stage Parameters: None Return Value: None */
void USBD_DataOutStage(void)
/* USB Device Request - Data Out Stage Parameters: None Return Value: None */ void USBD_DataOutStage(void)
{ U32 cnt; cnt = USBD_ReadEP(0x00, USBD_EP0Data.pData, USBD_EP0Data.Count); USBD_EP0Data.pData += cnt; USBD_EP0Data.Count -= cnt; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* A variant of g_type_class_unref() for use in #GTypeClassCacheFunc implementations. It unreferences a class without consulting the chain of #GTypeClassCacheFuncs, avoiding the recursion which would occur otherwise. */
void g_type_class_unref_uncached(gpointer g_class)
/* A variant of g_type_class_unref() for use in #GTypeClassCacheFunc implementations. It unreferences a class without consulting the chain of #GTypeClassCacheFuncs, avoiding the recursion which would occur otherwise. */ void g_type_class_unref_uncached(gpointer g_class)
{ TypeNode *node; GTypeClass *class = g_class; g_return_if_fail (g_class != NULL); node = lookup_type_node_I (class->g_type); if (node && node->is_classed && NODE_REFCOUNT (node)) type_data_unref_U (node, TRUE); else g_warning ("cannot unreference class of invalid (unclassed) type '%s'", typ...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Scanning routines to add standard types (byte, int, string...) to the protocol tree. */
static void smpp_handle_string(proto_tree *tree, tvbuff_t *tvb, int field, int *offset)
/* Scanning routines to add standard types (byte, int, string...) to the protocol tree. */ static void smpp_handle_string(proto_tree *tree, tvbuff_t *tvb, int field, int *offset)
{ guint len; len = tvb_strsize(tvb, *offset); if (len > 1) { proto_tree_add_item(tree, field, tvb, *offset, len, ENC_NA); } (*offset) += len; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Update the form base on the input file path info. */
BOOLEAN EFIAPI UpdateCAFromFile(IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
/* Update the form base on the input file path info. */ BOOLEAN EFIAPI UpdateCAFromFile(IN EFI_DEVICE_PATH_PROTOCOL *FilePath)
{ return UpdatePage (FilePath, TLS_AUTH_CONFIG_FORMID4_FORM); }
tianocore/edk2
C++
Other
4,240
/* Read available data from the read FIFO, as 32-bit data items. */
uint32_t EPINonBlockingReadGet32(uint32_t ui32Base, uint32_t ui32Count, uint32_t *pui32Buf)
/* Read available data from the read FIFO, as 32-bit data items. */ uint32_t EPINonBlockingReadGet32(uint32_t ui32Base, uint32_t ui32Count, uint32_t *pui32Buf)
{ uint32_t ui32CountRead = 0; ASSERT(ui32Base == EPI0_BASE); ASSERT(ui32Count < 4096); ASSERT(pui32Buf); while (HWREG(ui32Base + EPI_O_RFIFOCNT) && ui32Count--) { *pui32Buf = HWREG(ui32Base + EPI_O_READFIFO0); pui32Buf++; ui32CountRead++; } return (ui32CountRead);...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* brief Return Frequency of Usb0 Clock return Frequency of Usb0 Clock. */
uint32_t CLOCK_GetUsb0ClkFreq(void)
/* brief Return Frequency of Usb0 Clock return Frequency of Usb0 Clock. */ uint32_t CLOCK_GetUsb0ClkFreq(void)
{ uint32_t freq = 0U; switch (SYSCON->USB0CLKSEL) { case 1U: freq = CLOCK_GetPll0OutFreq(); break; case 3U: freq = CLOCK_GetFroHfFreq(); break; case 4U: freq = CLOCK_GetExtClkFreq(); break; case 5U: ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Server wants to send the data back. We just store them in between and pass them to the client. */
int server_raw_cb(const int iface, const struct modbus_adu *adu, void *user_data)
/* Server wants to send the data back. We just store them in between and pass them to the client. */ int server_raw_cb(const int iface, const struct modbus_adu *adu, void *user_data)
{ LOG_DBG("Server raw callback from interface %d", iface); tmp_adu.trans_id = adu->trans_id; tmp_adu.proto_id = adu->proto_id; tmp_adu.length = adu->length; tmp_adu.unit_id = adu->unit_id; tmp_adu.fc = adu->fc; memcpy(tmp_adu.data, adu->data, MIN(adu->length, sizeof(tmp_adu.data))); LOG_HEXDUMP_DBG(tmp_...
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* param config Pointer to the eLCDIF configuration structure. */
void ELCDIF_RgbModeGetDefaultConfig(elcdif_rgb_mode_config_t *config)
/* param config Pointer to the eLCDIF configuration structure. */ void ELCDIF_RgbModeGetDefaultConfig(elcdif_rgb_mode_config_t *config)
{ assert(config); memset(config, 0, sizeof(*config)); config->panelWidth = 480U; config->panelHeight = 272U; config->hsw = 41; config->hfp = 4; config->hbp = 8; config->vsw = 10; config->vfp = 4; config->vbp = 2; config->polarityFlags = kELCDIF_VsyncActiveLow | kELCDIF_HsyncA...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Change Logs: Date Author Notes Bernard the first version */
int pthread_rwlockattr_init(pthread_rwlockattr_t *attr)
/* Change Logs: Date Author Notes Bernard the first version */ int pthread_rwlockattr_init(pthread_rwlockattr_t *attr)
{ if (!attr) return EINVAL; *attr = PTHREAD_PROCESS_PRIVATE; return 0; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Function to get the category of the block of size 'size' or block number 'block_index'. */
static __INLINE uint32_t get_block_cat(uint32_t size, uint32_t block_index)
/* Function to get the category of the block of size 'size' or block number 'block_index'. */ static __INLINE uint32_t get_block_cat(uint32_t size, uint32_t block_index)
{ for (uint32_t block_cat = 0; block_cat < BLOCK_CAT_COUNT; block_cat++) { if (((size != 0) && (size <= m_block_size[block_cat]) && (m_block_end[block_cat] != m_block_start[block_cat])) || (block_index < m_block_end[block_cat])) { return block_cat; } ...
labapart/polymcu
C++
null
201
/* Command response callback function for sd_ecb_block_encrypt BLE command. Callback for decoding the output parameters and the command response return code. */
static uint32_t mw_ecb_block_encrypt_rsp_dec(const uint8_t *p_buffer, uint16_t length)
/* Command response callback function for sd_ecb_block_encrypt BLE command. Callback for decoding the output parameters and the command response return code. */ static uint32_t mw_ecb_block_encrypt_rsp_dec(const uint8_t *p_buffer, uint16_t length)
{ uint32_t result_code; const uint32_t err_code = ecb_block_encrypt_rsp_dec(p_buffer, length, (nrf_ecb_hal_data_t *)mp_out_param, &result_code); APP_ERROR_CHECK(err_co...
labapart/polymcu
C++
null
201
/* 3. MSISDN Octets 3-12 contain the digits of an MSISDN, coded as in 3GPP TS 24.008, Calling party BCD number, octets 4 - 13. */
static guint16 be_msisdn(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
/* 3. MSISDN Octets 3-12 contain the digits of an MSISDN, coded as in 3GPP TS 24.008, Calling party BCD number, octets 4 - 13. */ static guint16 be_msisdn(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, guint32 offset, guint len, gchar *add_string _U_, int string_len _U_)
{ tvbuff_t *new_tvb; new_tvb = tvb_new_subset_length(tvb, offset, len); if (new_tvb) { dissect_gsm_map_msisdn(new_tvb, pinfo , tree); } return len; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Deinitializes the DVP peripheral registers to their default reset values. */
void DVP_ResetReg(void)
/* Deinitializes the DVP peripheral registers to their default reset values. */ void DVP_ResetReg(void)
{ RCC_EnableAPB2PeriphReset(RCC_APB2_PERIPH_DVP, ENABLE); RCC_EnableAPB2PeriphReset(RCC_APB2_PERIPH_DVP, DISABLE); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Configure the selected source to generate a global interrupt or not. */
void mfxstm32l152_TS_DisableIT(uint16_t DeviceAddr)
/* Configure the selected source to generate a global interrupt or not. */ void mfxstm32l152_TS_DisableIT(uint16_t DeviceAddr)
{ mfxstm32l152_DisableITSource(DeviceAddr, MFXSTM32L152_IRQ_TS_DET); }
eclipse-threadx/getting-started
C++
Other
310
/* Local CPU Acknowledges Remote to Local IPC Flag. */
void IPCRtoLFlagAcknowledge(uint32_t ulFlags)
/* Local CPU Acknowledges Remote to Local IPC Flag. */ void IPCRtoLFlagAcknowledge(uint32_t ulFlags)
{ IpcRegs.IPCACK.all |= ulFlags; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Allocates a new netlink message without any further payload. The maximum payload size defaults to PAGESIZE or as otherwise specified with */
struct nl_msg* nlmsg_alloc(void)
/* Allocates a new netlink message without any further payload. The maximum payload size defaults to PAGESIZE or as otherwise specified with */ struct nl_msg* nlmsg_alloc(void)
{ return __nlmsg_alloc(default_msg_size); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* retval kStatus_Success retval kStatus_I2S_Busy if all queue slots are occupied with buffers which are not full. */
status_t I2S_RxTransferReceiveDMA(I2S_Type *base, i2s_dma_handle_t *handle, i2s_transfer_t transfer)
/* retval kStatus_Success retval kStatus_I2S_Busy if all queue slots are occupied with buffers which are not full. */ status_t I2S_RxTransferReceiveDMA(I2S_Type *base, i2s_dma_handle_t *handle, i2s_transfer_t transfer)
{ status_t status; I2S_DisableDMAInterrupts(handle); status = I2S_EnqueueUserBuffer(base, handle, transfer); if (status != kStatus_Success) { I2S_EnableDMAInterrupts(handle); return status; } if (handle->state == (uint32_t)kI2S_DmaStateIdle) { handle->state = (uin...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param handle DMA handle pointer. The DMA handle stores callback function and parameters. param base DMA peripheral base address. param channel DMA channel number. */
void DMA_CreateHandle(dma_handle_t *handle, DMA_Type *base, uint32_t channel)
/* param handle DMA handle pointer. The DMA handle stores callback function and parameters. param base DMA peripheral base address. param channel DMA channel number. */ void DMA_CreateHandle(dma_handle_t *handle, DMA_Type *base, uint32_t channel)
{ assert(FSL_FEATURE_DMA_NUMBER_OF_CHANNELSn(base) != -1); assert((NULL != handle) && (channel < (uint32_t)FSL_FEATURE_DMA_NUMBER_OF_CHANNELSn(base))); uint32_t dmaInstance; uint32_t startChannel = 0; dmaInstance = DMA_GetInstance(base); startChannel = DMA_GetVirtualStartChannel(base); (voi...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get the I2C time out flag of the specified I2C port. The */
xtBoolean I2CTimeoutFlagGet(unsigned long ulBase)
/* Get the I2C time out flag of the specified I2C port. The */ xtBoolean I2CTimeoutFlagGet(unsigned long ulBase)
{ xASSERT((ulBase == I2C0_BASE) || (ulBase == I2C1_BASE)); return ((xHWREG(ulBase + I2C_TOC) & I2C_TOC_TIF) ? xtrue : xfalse); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Selects Batching Data Rate (writing frequency in FIFO) for accelerometer data.. */
int32_t lsm6dso_fifo_xl_batch_set(lsm6dso_ctx_t *ctx, lsm6dso_bdr_xl_t val)
/* Selects Batching Data Rate (writing frequency in FIFO) for accelerometer data.. */ int32_t lsm6dso_fifo_xl_batch_set(lsm6dso_ctx_t *ctx, lsm6dso_bdr_xl_t val)
{ lsm6dso_fifo_ctrl3_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_FIFO_CTRL3, (uint8_t*)&reg, 1); if (ret == 0) { reg.bdr_xl = (uint8_t)val; ret = lsm6dso_write_reg(ctx, LSM6DSO_FIFO_CTRL3, (uint8_t*)&reg, 1); } return ret; }
alexander-g-dean/ESF
C++
null
41
/* cdns3_hw_reset_eps_config - reset endpoints configuration kept by controller. @priv_dev: extended gadget object */
void cdns3_hw_reset_eps_config(struct cdns3_device *priv_dev)
/* cdns3_hw_reset_eps_config - reset endpoints configuration kept by controller. @priv_dev: extended gadget object */ void cdns3_hw_reset_eps_config(struct cdns3_device *priv_dev)
{ writel(USB_CONF_CFGRST, &priv_dev->regs->usb_conf); cdns3_allow_enable_l1(priv_dev, 0); priv_dev->hw_configured_flag = 0; priv_dev->onchip_used_size = 0; priv_dev->out_mem_is_allocated = 0; priv_dev->wait_for_setup = 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Move snapshot to correct place in list according to chunk size. */
static void reregister_snapshot(struct dm_snapshot *s)
/* Move snapshot to correct place in list according to chunk size. */ static void reregister_snapshot(struct dm_snapshot *s)
{ struct block_device *bdev = s->origin->bdev; down_write(&_origins_lock); list_del(&s->list); __insert_snapshot(__lookup_origin(bdev), s); up_write(&_origins_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* This function unregisters and destroy all slave MTD objects which are attached to the given master MTD object. */
int del_mtd_partitions(struct mtd_info *master)
/* This function unregisters and destroy all slave MTD objects which are attached to the given master MTD object. */ int del_mtd_partitions(struct mtd_info *master)
{ struct mtd_part *slave, *next; list_for_each_entry_safe(slave, next, &mtd_partitions, list) if (slave->master == master) { list_del(&slave->list); del_mtd_device(&slave->mtd); kfree(slave); } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Called at the last iput() if i_nlink is zero. */
void ext2_delete_inode(struct inode *inode)
/* Called at the last iput() if i_nlink is zero. */ void ext2_delete_inode(struct inode *inode)
{ truncate_inode_pages(&inode->i_data, 0); if (is_bad_inode(inode)) goto no_delete; EXT2_I(inode)->i_dtime = get_seconds(); mark_inode_dirty(inode); ext2_write_inode(inode, inode_needs_sync(inode)); inode->i_size = 0; if (inode->i_blocks) ext2_truncate (inode); ext2_free_inode (inode); return; no_delete: ...
robutest/uclinux
C++
GPL-2.0
60
/* This routine waits for the command to be returned by the Firmware for some max time. */
static int qla4xxx_eh_wait_on_command(struct scsi_qla_host *ha, struct scsi_cmnd *cmd)
/* This routine waits for the command to be returned by the Firmware for some max time. */ static int qla4xxx_eh_wait_on_command(struct scsi_qla_host *ha, struct scsi_cmnd *cmd)
{ int done = 0; struct srb *rp; uint32_t max_wait_time = EH_WAIT_CMD_TOV; do { rp = (struct srb *) cmd->SCp.ptr; if (rp == NULL) { done++; break; } msleep(2000); } while (max_wait_time--); return done; }
robutest/uclinux
C++
GPL-2.0
60
/* Read Depex and pre-process the Depex for Before and After. If Section Extraction protocol returns an error via ReadSection defer the reading of the Depex. */
EFI_STATUS CoreGetDepexSectionAndPreProccess(IN EFI_CORE_DRIVER_ENTRY *DriverEntry)
/* Read Depex and pre-process the Depex for Before and After. If Section Extraction protocol returns an error via ReadSection defer the reading of the Depex. */ EFI_STATUS CoreGetDepexSectionAndPreProccess(IN EFI_CORE_DRIVER_ENTRY *DriverEntry)
{ EFI_STATUS Status; EFI_SECTION_TYPE SectionType; UINT32 AuthenticationStatus; EFI_FIRMWARE_VOLUME2_PROTOCOL *Fv; Fv = DriverEntry->Fv; SectionType = EFI_SECTION_DXE_DEPEX; Status = Fv->ReadSection ( DriverEntry->Fv, ...
tianocore/edk2
C++
Other
4,240
/* Enable the automatic slave select function of the specified SPI port. The */
void SPIAutoSSEnable(unsigned long ulBase, unsigned long ulSlaveSel)
/* Enable the automatic slave select function of the specified SPI port. The */ void SPIAutoSSEnable(unsigned long ulBase, unsigned long ulSlaveSel)
{ xASSERT(ulBase == SPI0_BASE); xASSERT((ulSlaveSel == SPI_SS_NONE) || (ulSlaveSel == SPI_SS0)); xHWREG(ulBase + SPI_SSR) |= SPI_AUTOSS; xHWREG(ulBase + SPI_SSR) &= ~0x00000001; xHWREG(ulBase + SPI_SSR) |= ulSlaveSel; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* If 32-bit MMIO register operations are not supported, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT32 EFIAPI S3MmioBitFieldOr32(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 OrData)
/* If 32-bit MMIO register operations are not supported, then ASSERT(). If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If OrData is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT32 ...
{ return InternalSaveMmioWrite32ValueToBootScript (Address, MmioBitFieldOr32 (Address, StartBit, EndBit, OrData)); }
tianocore/edk2
C++
Other
4,240
/* Copy iovec from kernel. Returns -EFAULT on error. */
int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov, int offset, int len)
/* Copy iovec from kernel. Returns -EFAULT on error. */ int memcpy_fromiovecend(unsigned char *kdata, const struct iovec *iov, int offset, int len)
{ while (offset >= iov->iov_len) { offset -= iov->iov_len; iov++; } while (len > 0) { u8 __user *base = iov->iov_base + offset; int copy = min_t(unsigned int, len, iov->iov_len - offset); offset = 0; if (copy_from_user(kdata, base, copy)) return -EFAULT; len -= copy; kdata += copy; iov++; } re...
EmcraftSystems/linux-emcraft
C++
Other
266
/* set rx threshold.when RX FIFO depth > threshold value, trigger interrupt */
void IR_SetRxThreshold(IR_TypeDef *IRx, uint8_t thd)
/* set rx threshold.when RX FIFO depth > threshold value, trigger interrupt */ void IR_SetRxThreshold(IR_TypeDef *IRx, uint8_t thd)
{ u32 Rx_config; assert_param(IS_IR_ALL_PERIPH(IRx)); assert_param(IS_IR_RX_FIFO_THRESHOLD(thd)); Rx_config = IRx->IR_RX_CONFIG; Rx_config &= ~IR_RX_FIFO_THRESHOLD_MASK; Rx_config |= IR_RX_FIFO_THRESHOLD(thd); IRx->IR_RX_CONFIG = Rx_config; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* UART MSP Initialization This function configures the hardware resources used in this example. */
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
/* UART MSP Initialization This function configures the hardware resources used in this example. */ void HAL_UART_MspInit(UART_HandleTypeDef *huart)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(huart->Instance==USART2) { __HAL_RCC_USART2_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_F...
feaser/openblt
C++
GNU General Public License v3.0
601
/* Put a custom pool element back into its pool. */
void memp_free_pool(const struct memp_desc *desc, void *mem)
/* Put a custom pool element back into its pool. */ void memp_free_pool(const struct memp_desc *desc, void *mem)
{ LWIP_ASSERT("invalid pool desc", desc != NULL); if ((desc == NULL) || (mem == NULL)) { return; } do_memp_free_pool(desc, mem); }
ua1arn/hftrx
C++
null
69
/* For licensing information, see the file 'LICENCE' in this directory. */
static size_t jffs2_acl_size(int count)
/* For licensing information, see the file 'LICENCE' in this directory. */ static size_t jffs2_acl_size(int count)
{ if (count <= 4) { return sizeof(struct jffs2_acl_header) + count * sizeof(struct jffs2_acl_entry_short); } else { return sizeof(struct jffs2_acl_header) + 4 * sizeof(struct jffs2_acl_entry_short) + (count - 4) * sizeof(struct jffs2_acl_entry); } }
robutest/uclinux
C++
GPL-2.0
60
/* Returns true if the address consists of all zeros */
int nl_addr_iszero(struct nl_addr *addr)
/* Returns true if the address consists of all zeros */ int nl_addr_iszero(struct nl_addr *addr)
{ int i; for (i = 0; i < addr->a_len; i++) if (addr->a_addr[i]) return 0; return 1; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Return 0 in almost all cases; non-zero value in extreme hard failure only */
int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev)
/* Return 0 in almost all cases; non-zero value in extreme hard failure only */ int et131x_send_packets(struct sk_buff *skb, struct net_device *netdev)
{ int status = 0; struct et131x_adapter *etdev = NULL; etdev = netdev_priv(netdev); if (etdev->tx_ring.used >= NUM_TCB) { status = -ENOMEM; } else { if ((etdev->Flags & fMP_ADAPTER_FAIL_SEND_MASK) || !netif_carrier_ok(netdev)) { dev_kfree_skb_any(skb); skb = NULL; etdev->net_stats.tx_dropped++; ...
robutest/uclinux
C++
GPL-2.0
60
/* Function for printing speed or cadence page3 data. */
static void page3_data_log(ant_bsc_page3_data_t const *p_page_data)
/* Function for printing speed or cadence page3 data. */ static void page3_data_log(ant_bsc_page3_data_t const *p_page_data)
{ LOG_PAGE3("%-30s %u\n\r", "Hardware Rev ID:", (unsigned int)p_page_data->hw_version); LOG_PAGE3("%-30s %u\n\r", "Model:", (unsigned int)p_page_data->model_num); LOG_PAGE3("%-30s %u\n\r", "Software Ver ID:", (unsigned int)p_page_data->sw_version); }
labapart/polymcu
C++
null
201
/* Perform a calibration cycle on the HPT3xN DPLL. Returns 1 if this succeeds */
static int hpt3xn_calibrate_dpll(struct pci_dev *dev)
/* Perform a calibration cycle on the HPT3xN DPLL. Returns 1 if this succeeds */ static int hpt3xn_calibrate_dpll(struct pci_dev *dev)
{ u8 reg5b; u32 reg5c; int tries; for(tries = 0; tries < 0x5000; tries++) { udelay(50); pci_read_config_byte(dev, 0x5b, &reg5b); if (reg5b & 0x80) { for(tries = 0; tries < 0x1000; tries ++) { pci_read_config_byte(dev, 0x5b, &reg5b); if ((reg5b & 0x80) == 0) return 0; } pci_read_config_dw...
EmcraftSystems/linux-emcraft
C++
Other
266