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
/* param base PWM peripheral base address param subModule PWM submodule to configure param pwmSignal Signal (PWM A or PWM B) to update param currPwmMode The current PWM mode set during PWM setup param dutyCyclePercent New PWM pulse width, value should be between 0 to 100 0=inactive signal(0% duty cycle)... 100=active s...
void PWM_UpdatePwmDutycycle(PWM_Type *base, pwm_submodule_t subModule, pwm_channels_t pwmSignal, pwm_mode_t currPwmMode, uint8_t dutyCyclePercent)
/* param base PWM peripheral base address param subModule PWM submodule to configure param pwmSignal Signal (PWM A or PWM B) to update param currPwmMode The current PWM mode set during PWM setup param dutyCyclePercent New PWM pulse width, value should be between 0 to 100 0=inactive signal(0% duty cycle)... 100=active s...
{ assert(dutyCyclePercent <= 100U); assert(pwmSignal != kPWM_PwmX); uint16_t reloadValue = dutyCycleToReloadValue(dutyCyclePercent); PWM_UpdatePwmDutycycleHighAccuracy(base, subModule, pwmSignal, currPwmMode, reloadValue); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Find a free memory region large enough for storing the bootmem bitmap. */
static unsigned long __init find_bootmap_pfn(const struct resource *mem)
/* Find a free memory region large enough for storing the bootmem bitmap. */ static unsigned long __init find_bootmap_pfn(const struct resource *mem)
{ unsigned long bootmap_pages, bootmap_len; unsigned long node_pages = PFN_UP(mem->end - mem->start + 1); unsigned long bootmap_start; bootmap_pages = bootmem_bootmap_pages(node_pages); bootmap_len = bootmap_pages << PAGE_SHIFT; bootmap_start = find_free_region(mem, bootmap_len, PAGE_SIZE); return bootmap_start ...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Note that this function expects to be passed the complement of the original code word. This is in keeping with ISDN conventions. */
static int ulaw2linear(unsigned char u_val)
/* Note that this function expects to be passed the complement of the original code word. This is in keeping with ISDN conventions. */ static int ulaw2linear(unsigned char u_val)
{ int t; u_val = ~u_val; t = ((u_val & QUANT_MASK) << 3) + BIAS; t <<= ((unsigned)u_val & SEG_MASK) >> SEG_SHIFT; return ((u_val & SIGN_BIT) ? (BIAS - t) : (t - BIAS)); }
robutest/uclinux
C++
GPL-2.0
60
/* mipsmt_sys_sched_getaffinity - get the cpu affinity of a process */
asmlinkage long mipsmt_sys_sched_getaffinity(pid_t pid, unsigned int len, unsigned long __user *user_mask_ptr)
/* mipsmt_sys_sched_getaffinity - get the cpu affinity of a process */ asmlinkage long mipsmt_sys_sched_getaffinity(pid_t pid, unsigned int len, unsigned long __user *user_mask_ptr)
{ unsigned int real_len; cpumask_t mask; int retval; struct task_struct *p; real_len = sizeof(mask); if (len < real_len) return -EINVAL; get_online_cpus(); read_lock(&tasklist_lock); retval = -ESRCH; p = find_process_by_pid(pid); if (!p) goto out_unlock; retval = security_task_getscheduler(p); if (retv...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Worker function to let the caller enable or disable an AP from this point onward. This service may only be called from the BSP. */
EFI_STATUS EnableDisableApWorker(IN UINTN ProcessorNumber, IN BOOLEAN EnableAP, IN UINT32 *HealthFlag OPTIONAL)
/* Worker function to let the caller enable or disable an AP from this point onward. This service may only be called from the BSP. */ EFI_STATUS EnableDisableApWorker(IN UINTN ProcessorNumber, IN BOOLEAN EnableAP, IN UINT32 *HealthFlag OPTIONAL)
{ CPU_MP_DATA *CpuMpData; UINTN CallerNumber; CpuMpData = GetCpuMpData (); MpInitLibWhoAmI (&CallerNumber); if (CallerNumber != CpuMpData->BspNumber) { return EFI_DEVICE_ERROR; } if (ProcessorNumber == CpuMpData->BspNumber) { return EFI_INVALID_PARAMETER; } if (ProcessorNumber >= CpuMp...
tianocore/edk2
C++
Other
4,240
/* This function disables the Hibernation module. After this function is called, none of the Hibernation module features are available. */
void HibernateDisable(void)
/* This function disables the Hibernation module. After this function is called, none of the Hibernation module features are available. */ void HibernateDisable(void)
{ HWREG(HIB_CTL) &= ~HIB_CTL_CLK32EN; _HibernateWriteComplete(); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* configure the TLI prescaler factor from PLLTR clock */
void rcu_tli_clock_config(uint32_t tli_psc)
/* configure the TLI prescaler factor from PLLTR clock */ void rcu_tli_clock_config(uint32_t tli_psc)
{ uint32_t reg = 0U; reg = RCU_PLLTCFG; reg &= ~RCU_PLLTCFG_TLIPSC; RCU_PLLTCFG = (reg | tli_psc); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Puts the USB bus in a suspended state. */
void USBHostSuspend(unsigned long ulBase)
/* Puts the USB bus in a suspended state. */ void USBHostSuspend(unsigned long ulBase)
{ ASSERT(ulBase == USB0_BASE); HWREGB(ulBase + USB_O_POWER) |= USB_POWER_SUSPEND; }
watterott/WebRadio
C++
null
71
/* Dispatch a data abort to the relevant handler. */
asmlinkage void __exception do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
/* Dispatch a data abort to the relevant handler. */ asmlinkage void __exception do_DataAbort(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
{ const struct fsr_info *inf = fsr_info + fsr_fs(fsr); struct siginfo info; if (!inf->fn(addr, fsr & ~FSR_LNX_PF, regs)) return; printk(KERN_ALERT "Unhandled fault: %s (0x%03x) at 0x%08lx\n", inf->name, fsr, addr); info.si_signo = inf->sig; info.si_errno = 0; info.si_code = inf->code; info.si_addr = (void...
EmcraftSystems/linux-emcraft
C++
Other
266
/* The functions for insering/removing us as a module. */
static int __init sunkbd_init(void)
/* The functions for insering/removing us as a module. */ static int __init sunkbd_init(void)
{ return serio_register_driver(&sunkbd_drv); }
robutest/uclinux
C++
GPL-2.0
60
/* Start a ticker node. Creates a new user operation of type TICKER_USER_OP_TYPE_START and schedules the ticker_job. */
uint8_t ticker_start(uint8_t instance_index, uint8_t user_id, uint8_t ticker_id, uint32_t ticks_anchor, uint32_t ticks_first, uint32_t ticks_periodic, uint32_t remainder_periodic, uint16_t lazy, uint32_t ticks_slot, ticker_timeout_func fp_timeout_func, void *context, ticker_op_func fp_op_func, void *op_context)
/* Start a ticker node. Creates a new user operation of type TICKER_USER_OP_TYPE_START and schedules the ticker_job. */ uint8_t ticker_start(uint8_t instance_index, uint8_t user_id, uint8_t ticker_id, uint32_t ticks_anchor, uint32_t ticks_first, uint32_t ticks_periodic, uint32_t remainder_periodic, uint16_t lazy, uint...
{ return ticker_start_us(instance_index, user_id, ticker_id, ticks_anchor, ticks_first, 0U, ticks_periodic, remainder_periodic, lazy, ticks_slot, fp_timeout_func, context, fp_op_func, op_context); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Set up a descriptor entry for reserving IO space. */
STATIC VOID SetIoPadding(IN OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptor, IN UINTN SizeExponent)
/* Set up a descriptor entry for reserving IO space. */ STATIC VOID SetIoPadding(IN OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptor, IN UINTN SizeExponent)
{ Descriptor->ResType = ACPI_ADDRESS_SPACE_TYPE_IO; Descriptor->AddrLen = LShiftU64 (1, SizeExponent); Descriptor->AddrRangeMax = Descriptor->AddrLen - 1; }
tianocore/edk2
C++
Other
4,240
/* Load precompiled chunk to support standard LUA_API load functions. The extra LFS functionality is effectively NO-OPed out on this MODE_RAM path. */
LClosure* luaU_undump(lua_State *L, ZIO *Z, const char *name)
/* Load precompiled chunk to support standard LUA_API load functions. The extra LFS functionality is effectively NO-OPed out on this MODE_RAM path. */ LClosure* luaU_undump(lua_State *L, ZIO *Z, const char *name)
{0}; LClosure *cl; if (*name == '@' || *name == '=') S.name = name + 1; else if (*name == LUA_SIGNATURE[0]) S.name = "binary string"; else S.name = name; S.L = L; S.Z = Z; S.mode = MODE_RAM; S.fh = NULL; S.useStrRefs = 0; checkHeader(&S, LUAC_FORMAT); cl = luaF_newLclosure(L, LoadByte(...
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* Enables or disables the output of internal reference voltage (VREFINT). The VREFINT output can be routed to any I/O in group 3: CH8 (PB0) or CH9 (PB1). To correctly use this function, the SYSCFG_RIIOSwitchConfig() function should be called after. */
void COMP_VrefintOutputCmd(FunctionalState NewState)
/* Enables or disables the output of internal reference voltage (VREFINT). The VREFINT output can be routed to any I/O in group 3: CH8 (PB0) or CH9 (PB1). To correctly use this function, the SYSCFG_RIIOSwitchConfig() function should be called after. */ void COMP_VrefintOutputCmd(FunctionalState NewState)
{ assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { COMP->CSR |= (uint32_t) COMP_CSR_VREFOUTEN; } else { COMP->CSR &= (uint32_t) (~COMP_CSR_VREFOUTEN); } }
avem-labs/Avem
C++
MIT License
1,752
/* Reads and returns the current value of TR. This function is only available on IA-32 and X64. */
UINT16 EFIAPI AsmReadTr(VOID)
/* Reads and returns the current value of TR. This function is only available on IA-32 and X64. */ UINT16 EFIAPI AsmReadTr(VOID)
{ UINT16 Data; __asm__ __volatile__ ( "str %0" : "=a" (Data) ); return Data; }
tianocore/edk2
C++
Other
4,240
/* Should be called once before using any of the storage methods. Typically called first by inv_init_mpl(). */
void inv_init_storage_manager()
/* Should be called once before using any of the storage methods. Typically called first by inv_init_mpl(). */ void inv_init_storage_manager()
{ memset(&ds, 0, sizeof(ds)); ds.total_size = sizeof(struct data_header_t); }
Luos-io/luos_engine
C++
MIT License
496
/* IDL typedef struct { IDL char password; IDL } LM_OWF_PASSWORD; */
static int netlogon_dissect_LM_OWF_PASSWORD(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *parent_tree, dcerpc_info *di, guint8 *drep _U_)
/* IDL typedef struct { IDL char password; IDL } LM_OWF_PASSWORD; */ static int netlogon_dissect_LM_OWF_PASSWORD(tvbuff_t *tvb, int offset, packet_info *pinfo _U_, proto_tree *parent_tree, dcerpc_info *di, guint8 *drep _U_)
{ proto_item *item=NULL; proto_tree *tree=NULL; if(di->conformant_run){ return offset; } if(parent_tree){ tree = proto_tree_add_subtree(parent_tree, tvb, offset, 16, ett_LM_OWF_PASSWORD, &item, "LM_OWF_PASSWORD:"); } proto_tree_add_item(tree...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Initializes the DAC peripheral according to the specified parameters in the DAC_InitStruct. */
void DAC_Init(uint32_t DAC_Channel, DAC_InitTypeDef *DAC_InitStruct)
/* Initializes the DAC peripheral according to the specified parameters in the DAC_InitStruct. */ void DAC_Init(uint32_t DAC_Channel, DAC_InitTypeDef *DAC_InitStruct)
{ uint32_t tmpreg1 = 0, tmpreg2 = 0; assert_param(IS_DAC_TRIGGER(DAC_InitStruct->DAC_Trigger)); assert_param(IS_DAC_GENERATE_WAVE(DAC_InitStruct->DAC_WaveGeneration)); assert_param(IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(DAC_InitStruct->DAC_LFSRUnmask_TriangleAmplitude)); assert_param(IS_DAC_OUTPUT_BUFFER_STATE...
MaJerle/stm32f429
C++
null
2,036
/* Amount of free RAM allocatable within ZONE_DMA and ZONE_NORMAL */
unsigned int nr_free_buffer_pages(void)
/* Amount of free RAM allocatable within ZONE_DMA and ZONE_NORMAL */ unsigned int nr_free_buffer_pages(void)
{ return nr_free_zone_pages(gfp_zone(GFP_USER)); }
robutest/uclinux
C++
GPL-2.0
60
/* Default read function for 16bit buswith without endianess conversion */
static u16 nand_read_word(struct mtd_info *mtd)
/* Default read function for 16bit buswith without endianess conversion */ static u16 nand_read_word(struct mtd_info *mtd)
{ struct nand_chip *chip = mtd->priv; return readw(chip->IO_ADDR_R); }
EmcraftSystems/u-boot
C++
Other
181
/* assuming the pin is muxed as a gpio output, set its value. */
int at91_set_gpio_value(unsigned pin, int value)
/* assuming the pin is muxed as a gpio output, set its value. */ int at91_set_gpio_value(unsigned pin, int value)
{ void __iomem *pio = pin_to_controller(pin); unsigned mask = pin_to_mask(pin); if (!pio) return -EINVAL; __raw_writel(mask, pio + (value ? PIO_SODR : PIO_CODR)); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return the number of blocks used by the group descriptor table (primary or backup) in this group. In the future there may be a different number of descriptor blocks in each group. */
unsigned long ext2_bg_num_gdb(struct super_block *sb, int group)
/* Return the number of blocks used by the group descriptor table (primary or backup) in this group. In the future there may be a different number of descriptor blocks in each group. */ unsigned long ext2_bg_num_gdb(struct super_block *sb, int group)
{ return ext2_bg_has_super(sb, group) ? EXT2_SB(sb)->s_gdb_count : 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Execute FMC_ISPCMD_PAGE_ERASE command to erase SPROM. The page size is 4096 bytes. */
int32_t FMC_Erase_SPROM(void)
/* Execute FMC_ISPCMD_PAGE_ERASE command to erase SPROM. The page size is 4096 bytes. */ int32_t FMC_Erase_SPROM(void)
{ int32_t ret = 0; FMC->ISPCMD = FMC_ISPCMD_PAGE_ERASE; FMC->ISPADDR = FMC_SPROM_BASE; FMC->ISPDAT = 0x0055AA03UL; FMC->ISPTRG = FMC_ISPTRG_ISPGO_Msk; while (FMC->ISPTRG & FMC_ISPTRG_ISPGO_Msk) { } if (FMC->ISPCTL & FMC_ISPCTL_ISPFF_Msk) { FMC->ISPCTL |= FMC_ISPCTL_ISPFF_Msk; ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* SIS chipsets implement prefetch/postwrite bits for each device on both channels. This functionality is not ATAPI compatible and must be configured according to the class of device present */
static void sis_set_fifo(struct ata_port *ap, struct ata_device *adev)
/* SIS chipsets implement prefetch/postwrite bits for each device on both channels. This functionality is not ATAPI compatible and must be configured according to the class of device present */ static void sis_set_fifo(struct ata_port *ap, struct ata_device *adev)
{ struct pci_dev *pdev = to_pci_dev(ap->host->dev); u8 fifoctrl; u8 mask = 0x11; mask <<= (2 * ap->port_no); mask <<= adev->devno; pci_read_config_byte(pdev, 0x4B, &fifoctrl); fifoctrl &= ~mask; if (adev->class == ATA_DEV_ATA) fifoctrl |= mask; pci_write_config_byte(pdev, 0x4B, fifoctrl); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return whether the integer string is a hex string. */
BOOLEAN IsHexStr(IN CHAR16 *Str)
/* Return whether the integer string is a hex string. */ BOOLEAN IsHexStr(IN CHAR16 *Str)
{ while ((*Str != 0) && *Str == L' ') { Str++; } while ((*Str != 0) && *Str == L'0') { Str++; } return (BOOLEAN)(*Str == L'x' || *Str == L'X'); }
tianocore/edk2
C++
Other
4,240
/* This code gets the pointer to the variable guid. */
EFI_GUID* GetVendorGuidPtr(IN VARIABLE_HEADER *Variable, IN BOOLEAN AuthFormat)
/* This code gets the pointer to the variable guid. */ EFI_GUID* GetVendorGuidPtr(IN VARIABLE_HEADER *Variable, IN BOOLEAN AuthFormat)
{ AUTHENTICATED_VARIABLE_HEADER *AuthVariable; AuthVariable = (AUTHENTICATED_VARIABLE_HEADER *)Variable; if (AuthFormat) { return &AuthVariable->VendorGuid; } else { return &Variable->VendorGuid; } }
tianocore/edk2
C++
Other
4,240
/* Lock (save) inode in inode array for readback after recovery */
void iput(struct inode *inode)
/* Lock (save) inode in inode array for readback after recovery */ void iput(struct inode *inode)
{ int i; struct inode *ino; for (i = 0; i < INODE_LOCKED_MAX; i++) { if (inodes_locked_down[i] == NULL) break; } if (i >= INODE_LOCKED_MAX) { ubifs_err("Error, can't lock (save) more inodes while recovery!!!"); return; } ino = (struct inode *)malloc(sizeof(struct ubifs_inode)); memcpy(ino, inode, sizeo...
EmcraftSystems/u-boot
C++
Other
181
/* Enqueue a shared copy of the packet to the IP4 child if the packet is acceptable to it. Here the data of the packet is shared, but the net buffer isn't. */
EFI_STATUS Ip4InstanceEnquePacket(IN IP4_PROTOCOL *IpInstance, IN IP4_HEAD *Head, IN NET_BUF *Packet)
/* Enqueue a shared copy of the packet to the IP4 child if the packet is acceptable to it. Here the data of the packet is shared, but the net buffer isn't. */ EFI_STATUS Ip4InstanceEnquePacket(IN IP4_PROTOCOL *IpInstance, IN IP4_HEAD *Head, IN NET_BUF *Packet)
{ IP4_CLIP_INFO *Info; NET_BUF *Clone; if (IpInstance->State != IP4_STATE_CONFIGED) { return EFI_NOT_STARTED; } if (!Ip4InstanceFrameAcceptable (IpInstance, Head, Packet)) { return EFI_INVALID_PARAMETER; } Clone = NetbufClone (Packet); if (Clone == NULL) { return EFI_OUT_OF_RESOURCES...
tianocore/edk2
C++
Other
4,240
/* Release the dentry's inode, using the filesystem d_iput() operation if defined. */
static void dentry_iput(struct dentry *dentry) __releases(dentry -> d_lock) __releases(dcache_lock)
/* Release the dentry's inode, using the filesystem d_iput() operation if defined. */ static void dentry_iput(struct dentry *dentry) __releases(dentry -> d_lock) __releases(dcache_lock)
{ struct inode *inode = dentry->d_inode; if (inode) { dentry->d_inode = NULL; list_del_init(&dentry->d_alias); spin_unlock(&dentry->d_lock); spin_unlock(&dcache_lock); if (!inode->i_nlink) fsnotify_inoderemove(inode); if (dentry->d_op && dentry->d_op->d_iput) dentry->d_op->d_iput(dentry, inode); e...
robutest/uclinux
C++
GPL-2.0
60
/* zhenhua_process_packet() decodes packets the driver receives from the RC transmitter. It updates the data accordingly. */
static void zhenhua_process_packet(struct zhenhua *zhenhua)
/* zhenhua_process_packet() decodes packets the driver receives from the RC transmitter. It updates the data accordingly. */ static void zhenhua_process_packet(struct zhenhua *zhenhua)
{ struct input_dev *dev = zhenhua->dev; unsigned char *data = zhenhua->data; input_report_abs(dev, ABS_Y, data[1]); input_report_abs(dev, ABS_X, data[2]); input_report_abs(dev, ABS_RZ, data[3]); input_report_abs(dev, ABS_Z, data[4]); input_sync(dev); }
robutest/uclinux
C++
GPL-2.0
60
/* This routine should not be called by a driver after its disconnect method has returned. */
void usb_kill_urb(struct urb *urb)
/* This routine should not be called by a driver after its disconnect method has returned. */ void usb_kill_urb(struct urb *urb)
{ might_sleep(); if (!(urb && urb->dev && urb->ep)) return; atomic_inc(&urb->reject); usb_hcd_unlink_urb(urb, -ENOENT); wait_event(usb_kill_urb_queue, atomic_read(&urb->use_count) == 0); atomic_dec(&urb->reject); }
robutest/uclinux
C++
GPL-2.0
60
/* Locking: this function must be called holding sta->lock */
static void mesh_plink_fsm_restart(struct sta_info *sta)
/* Locking: this function must be called holding sta->lock */ static void mesh_plink_fsm_restart(struct sta_info *sta)
{ sta->plink_state = PLINK_LISTEN; sta->llid = sta->plid = sta->reason = 0; sta->plink_retries = 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enable Snapshot for messages relevant to Master. When enabled, snapshot is taken for messages relevant to master mode only, else snapshot is taken for messages relevant to slave node. Valid only for Ordinary clock and Boundary clock Reserved when "Advanced Time Stamp" is not selected */
void synopGMAC_TS_master_enable(synopGMACdevice *gmacdev)
/* Enable Snapshot for messages relevant to Master. When enabled, snapshot is taken for messages relevant to master mode only, else snapshot is taken for messages relevant to slave node. Valid only for Ordinary clock and Boundary clock Reserved when "Advanced Time Stamp" is not selected */ void synopGMAC_TS_master_ena...
{ synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSMSTRENA); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns the most recent received data by the SPIx peripheral. */
uint8_t SPI_ReceiveData8(SPI_TypeDef *SPIx)
/* Returns the most recent received data by the SPIx peripheral. */ uint8_t SPI_ReceiveData8(SPI_TypeDef *SPIx)
{ uint32_t spixbase = 0x00; assert_param(IS_SPI_ALL_PERIPH_EXT(SPIx)); spixbase = (uint32_t)SPIx; spixbase += 0x0C; return *(__IO uint8_t *) spixbase; }
ajhc/demo-cortex-m3
C++
null
38
/* HID class driver callback function for the creation of HID reports to the host. */
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t *const HIDInterfaceInfo, uint8_t *const ReportID, const uint8_t ReportType, void *ReportData, uint16_t *const ReportSize)
/* HID class driver callback function for the creation of HID reports to the host. */ bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t *const HIDInterfaceInfo, uint8_t *const ReportID, const uint8_t ReportType, void *ReportData, uint16_t *const ReportSize)
{ USB_MouseReport_Data_t* MouseReport = (USB_MouseReport_Data_t*)ReportData; uint8_t JoyStatus_LCL = Joystick_GetStatus(); uint8_t ButtonStatus_LCL = Buttons_GetStatus(); if (JoyStatus_LCL & JOY_UP) MouseReport->Y = -1; else if (JoyStatus_LCL & JOY_DOWN) MouseReport->Y = 1; if (JoyStatus_LCL & JOY_RIGHT...
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* fc_disc_timeout() - Handler for discovery timeouts @work: Structure holding discovery context that needs to retry discovery */
static void fc_disc_timeout(struct work_struct *)
/* fc_disc_timeout() - Handler for discovery timeouts @work: Structure holding discovery context that needs to retry discovery */ static void fc_disc_timeout(struct work_struct *)
{ struct fc_disc *disc = container_of(work, struct fc_disc, disc_work.work); mutex_lock(&disc->disc_mutex); fc_disc_gpn_ft_req(disc); mutex_unlock(&disc->disc_mutex); }
robutest/uclinux
C++
GPL-2.0
60
/* this function handles USART RBNE interrupt request and TBE interrupt request */
void USART0_IRQHandler(void)
/* this function handles USART RBNE interrupt request and TBE interrupt request */ void USART0_IRQHandler(void)
{ if(RESET != usart_interrupt_flag_get(EVAL_COM1, USART_STAT_RBNE,USART_INT_RBNEIE)){ receiver_buffer[rxcount++] = (usart_data_receive(EVAL_COM1) & 0x7F); if(rxcount == receivesize){ usart_interrupt_disable(EVAL_COM1, USART_INT_RBNEIE); } } if(RESET != usart_interrupt_fla...
liuxuming/trochili
C++
Apache License 2.0
132
/* Read data from serial device and save the datas in buffer. */
UINTN EFIAPI SerialPortRead(OUT UINT8 *Buffer, IN UINTN NumberOfBytes)
/* Read data from serial device and save the datas in buffer. */ UINTN EFIAPI SerialPortRead(OUT UINT8 *Buffer, IN UINTN NumberOfBytes)
{ *Buffer = SemihostReadCharacter (); return 1; }
tianocore/edk2
C++
Other
4,240
/* Fills each ADC_CommonInitStruct member with its default value. */
void ADC_CommonConfigStructInit(ADC_CommonConfig_T *adccommonconfig)
/* Fills each ADC_CommonInitStruct member with its default value. */ void ADC_CommonConfigStructInit(ADC_CommonConfig_T *adccommonconfig)
{ adccommonconfig->mode = ADC_MODE_INDEPENDENT; adccommonconfig->prescaler = ADC_PRESCALER_DIV2; adccommonconfig->accessMode = ADC_ACCESS_MODE_DISABLED; adccommonconfig->twoSampling = ADC_TWO_SAMPLING_5CYCLES; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enables 485 Function mode on the specified UART. */
void UARTEnable485(unsigned long ulBase)
/* Enables 485 Function mode on the specified UART. */ void UARTEnable485(unsigned long ulBase)
{ xASSERT(UARTBaseValid(ulBase)); xHWREG(ulBase + UART_FUN_SEL) = UART_FUN_SEL_RS485_EN; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Send SEND_CSD command to get CSD register content from Card. */
static status_t SD_SendCsd(sd_card_t *card)
/* Send SEND_CSD command to get CSD register content from Card. */ static status_t SD_SendCsd(sd_card_t *card)
{ assert(card); sdhc_transfer_t content = {0}; sdhc_command_t command = {0}; command.index = kSDMMC_SendCsd; command.argument = (card->relativeAddress << 16U); command.responseType = kSDHC_ResponseTypeR2; content.command = &command; content.data = NULL; if (kStatus_Success == card->h...
labapart/polymcu
C++
null
201
/* Unregisters an interrupt handler for the synchronous serial interface. */
void SSIIntUnregister(uint32_t ui32Base)
/* Unregisters an interrupt handler for the synchronous serial interface. */ void SSIIntUnregister(uint32_t ui32Base)
{ uint32_t ui32Int; ASSERT(_SSIBaseValid(ui32Base)); ui32Int = _SSIIntNumberGet(ui32Base); ASSERT(ui32Int != 0); IntDisable(ui32Int); IntUnregister(ui32Int); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* aux_pw_on_ctrl: OIS chain on aux interface power on mode */
int32_t lsm6dso_aux_pw_on_ctrl_get(stmdev_ctx_t *ctx, lsm6dso_ois_on_t *val)
/* aux_pw_on_ctrl: OIS chain on aux interface power on mode */ int32_t lsm6dso_aux_pw_on_ctrl_get(stmdev_ctx_t *ctx, lsm6dso_ois_on_t *val)
{ lsm6dso_ctrl7_g_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_CTRL7_G, (uint8_t *)&reg, 1); switch (reg.ois_on) { case LSM6DSO_AUX_ON: *val = LSM6DSO_AUX_ON; break; case LSM6DSO_AUX_ON_BY_AUX_INTERFACE: *val = LSM6DSO_AUX_ON_BY_AUX_INTERFACE; break; default: ...
eclipse-threadx/getting-started
C++
Other
310
/* Checks whether the specified TIM flag is set or not. */
FlagStatus TIM_GetCCENStatus(TIM_Module *TIMx, uint32_t TIM_CCEN)
/* Checks whether the specified TIM flag is set or not. */ FlagStatus TIM_GetCCENStatus(TIM_Module *TIMx, uint32_t TIM_CCEN)
{ INTStatus bitstatus = RESET; assert_param(IsTimList3Module(TIMx)); if(TIMx==TIM1 || TIMx==TIM8){ assert_param(IsAdvancedTimCCENFlag(TIM_CCEN)); if ((TIMx->CCEN & TIM_CCEN) != (uint32_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } }else if(TIMx==TIM2 || TIMx==TIM3...
pikasTech/PikaPython
C++
MIT License
1,403
/* The range must reside completely on the specified node. */
void __init free_bootmem_node(pg_data_t *pgdat, unsigned long physaddr, unsigned long size)
/* The range must reside completely on the specified node. */ void __init free_bootmem_node(pg_data_t *pgdat, unsigned long physaddr, unsigned long size)
{ unsigned long start, end; kmemleak_free_part(__va(physaddr), size); start = PFN_UP(physaddr); end = PFN_DOWN(physaddr + size); mark_bootmem_node(pgdat->bdata, start, end, 0, 0); }
robutest/uclinux
C++
GPL-2.0
60
/* Reads and returns the current value of TSC. This function is only available on IA-32 and X64. */
UINT64 EFIAPI AsmReadTsc(VOID)
/* Reads and returns the current value of TSC. This function is only available on IA-32 and X64. */ UINT64 EFIAPI AsmReadTsc(VOID)
{ UINT32 LowData; UINT32 HiData; __asm__ __volatile__ ( "rdtsc" : "=a" (LowData), "=d" (HiData) ); return (((UINT64)HiData) << 32) | LowData; }
tianocore/edk2
C++
Other
4,240
/* This function will be called to loop through the trailers buffer until no more data is available for sending. */
static size_t Curl_trailers_read(char *buffer, size_t size, size_t nitems, void *raw)
/* This function will be called to loop through the trailers buffer until no more data is available for sending. */ static size_t Curl_trailers_read(char *buffer, size_t size, size_t nitems, void *raw)
{ struct Curl_easy *data = (struct Curl_easy *)raw; Curl_send_buffer *trailers_buf = data->state.trailers_buf; size_t bytes_left = trailers_buf->size_used-data->state.trailers_bytes_sent; size_t to_copy = (size*nitems < bytes_left) ? size*nitems : bytes_left; if(to_copy) { memcpy(buffer, &trail...
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Set the default maximum message payload size for allocated messages */
void nlmsg_set_default_size(size_t max)
/* Set the default maximum message payload size for allocated messages */ void nlmsg_set_default_size(size_t max)
{ if (max < nlmsg_total_size(0)) max = nlmsg_total_size(0); default_msg_size = max; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Count the number of IP6 multicast groups that are mapped to the same MAC address. Several IP6 multicast address may be mapped to the same MAC address. */
INTN Ip6FindMac(IN IP6_MLD_SERVICE_DATA *MldCtrl, IN EFI_MAC_ADDRESS *Mac)
/* Count the number of IP6 multicast groups that are mapped to the same MAC address. Several IP6 multicast address may be mapped to the same MAC address. */ INTN Ip6FindMac(IN IP6_MLD_SERVICE_DATA *MldCtrl, IN EFI_MAC_ADDRESS *Mac)
{ LIST_ENTRY *Entry; IP6_MLD_GROUP *Group; INTN Count; Count = 0; NET_LIST_FOR_EACH (Entry, &MldCtrl->Groups) { Group = NET_LIST_USER_STRUCT (Entry, IP6_MLD_GROUP, Link); if (NET_MAC_EQUAL (&Group->Mac, Mac, sizeof (EFI_MAC_ADDRESS))) { Count++; } } return Count; }
tianocore/edk2
C++
Other
4,240
/* bootmem_bootmap_pages - calculate bitmap size in pages @pages: number of pages the bitmap has to represent */
unsigned long __init bootmem_bootmap_pages(unsigned long pages)
/* bootmem_bootmap_pages - calculate bitmap size in pages @pages: number of pages the bitmap has to represent */ unsigned long __init bootmem_bootmap_pages(unsigned long pages)
{ unsigned long bytes = bootmap_bytes(pages); return PAGE_ALIGN(bytes) >> PAGE_SHIFT; }
robutest/uclinux
C++
GPL-2.0
60
/* This searches for sas_device based on sas_address, then return sas_device object. */
static struct _sas_device* _scsih_sas_device_find_by_handle(struct MPT2SAS_ADAPTER *ioc, u16 handle)
/* This searches for sas_device based on sas_address, then return sas_device object. */ static struct _sas_device* _scsih_sas_device_find_by_handle(struct MPT2SAS_ADAPTER *ioc, u16 handle)
{ struct _sas_device *sas_device, *r; r = NULL; if (ioc->wait_for_port_enable_to_complete) { list_for_each_entry(sas_device, &ioc->sas_device_init_list, list) { if (sas_device->handle != handle) continue; r = sas_device; goto out; } } else { list_for_each_entry(sas_device, &ioc->sas_device_...
robutest/uclinux
C++
GPL-2.0
60
/* Apply pitch lag to obtain the sharpened fixed vector (section 6.1.2) */
static void pitch_sharpening(AMRContext *p, int subframe, enum Mode mode, AMRFixed *fixed_sparse)
/* Apply pitch lag to obtain the sharpened fixed vector (section 6.1.2) */ static void pitch_sharpening(AMRContext *p, int subframe, enum Mode mode, AMRFixed *fixed_sparse)
{ if (mode == MODE_12k2) p->beta = FFMIN(p->pitch_gain[4], 1.0); fixed_sparse->pitch_lag = p->pitch_lag_int; fixed_sparse->pitch_fac = p->beta; if (mode != MODE_4k75 || subframe & 1) p->beta = av_clipf(p->pitch_gain[4], 0.0, SHARP_MAX); }
DC-SWAT/DreamShell
C++
null
404
/* nilfs_clear_gcinode() - clear and free a gc inode */
void nilfs_clear_gcinode(struct inode *inode)
/* nilfs_clear_gcinode() - clear and free a gc inode */ void nilfs_clear_gcinode(struct inode *inode)
{ nilfs_mdt_destroy(inode); }
robutest/uclinux
C++
GPL-2.0
60
/* zfcp_erp_timeout_handler - Trigger ERP action from timed out ERP request @data: ERP action (from timer data) */
void zfcp_erp_timeout_handler(unsigned long data)
/* zfcp_erp_timeout_handler - Trigger ERP action from timed out ERP request @data: ERP action (from timer data) */ void zfcp_erp_timeout_handler(unsigned long data)
{ struct zfcp_erp_action *act = (struct zfcp_erp_action *) data; zfcp_erp_notify(act, ZFCP_STATUS_ERP_TIMEDOUT); }
robutest/uclinux
C++
GPL-2.0
60
/* Must run in process context (e.g. a work queue) with interrupts enabled and no spinlocks hold. */
void memory_failure(unsigned long pfn, int trapno)
/* Must run in process context (e.g. a work queue) with interrupts enabled and no spinlocks hold. */ void memory_failure(unsigned long pfn, int trapno)
{ __memory_failure(pfn, trapno, 0); }
robutest/uclinux
C++
GPL-2.0
60
/* Add a ARP/Link type selector to a mapping */
static int mapping_addarp(struct if_mapping *ifnode, int *active, char *pos, size_t len, struct add_extra *extra, int linenum)
/* Add a ARP/Link type selector to a mapping */ static int mapping_addarp(struct if_mapping *ifnode, int *active, char *pos, size_t len, struct add_extra *extra, int linenum)
{ size_t n; unsigned int type; extra = extra; n = strspn(string, "0123456789"); if((n < len) || (sscanf(string, "%d", &type) != 1)) { fprintf(stderr, "Error: Invalid ARP/Link Type `%s' at line %d\n", string, linenum); return(-1); } ifnode->hw_type = (unsigned short) type; ifnod...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Configures the high and low thresholds of the analog watchdog3. */
void ADC_AnalogWatchdog3ThresholdsConfig(ADC_TypeDef *ADCx, uint8_t HighThreshold, uint8_t LowThreshold)
/* Configures the high and low thresholds of the analog watchdog3. */ void ADC_AnalogWatchdog3ThresholdsConfig(ADC_TypeDef *ADCx, uint8_t HighThreshold, uint8_t LowThreshold)
{ assert_param(IS_ADC_ALL_PERIPH(ADCx)); ADCx->TR3 &= ~(uint32_t)ADC_TR3_HT3; ADCx->TR3 |= (uint32_t)((uint32_t)HighThreshold << 16); ADCx->TR3 &= ~(uint32_t)ADC_TR3_LT3; ADCx->TR3 |= LowThreshold; }
ajhc/demo-cortex-m3
C++
null
38
/* Even though the input is given in big-endian, the FDIRPORT registers expect the ports to be programmed in little-endian. Hence the need to swap endianness when retrieving the data. This can be confusing since the internal hash engine expects it to be big-endian. */
static s32 ixgbe_atr_get_src_port_82599(struct ixgbe_atr_input *input, u16 *src_port)
/* Even though the input is given in big-endian, the FDIRPORT registers expect the ports to be programmed in little-endian. Hence the need to swap endianness when retrieving the data. This can be confusing since the internal hash engine expects it to be big-endian. */ static s32 ixgbe_atr_get_src_port_82599(struct ixg...
{ *src_port = input->byte_stream[IXGBE_ATR_SRC_PORT_OFFSET] << 8; *src_port |= input->byte_stream[IXGBE_ATR_SRC_PORT_OFFSET + 1]; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* USB Device Remote Wakeup Function Called automatically on USB Device Remote Wakeup Return Value: None */
void USBD_WakeUp(void)
/* USB Device Remote Wakeup Function Called automatically on USB Device Remote Wakeup Return Value: None */ void USBD_WakeUp(void)
{ UDPHS->UDPHS_IEN |= UDPHS_IEN_UPSTR_RES; UDPHS->UDPHS_CTRL |= UDPHS_CTRL_REWAKEUP; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Get the computed CRC value of the subsequently received bytes of the specified SPI port. */
unsigned long SPIRxCRCGet(unsigned long ulBase)
/* Get the computed CRC value of the subsequently received bytes of the specified SPI port. */ unsigned long SPIRxCRCGet(unsigned long ulBase)
{ xASSERT((ulBase == SPI3_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE)); return xHWREG(ulBase + SPI_RXCRCR); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Open SIR (IrDA) mode on the specified UART. The */
void UARTIrDAConfig(unsigned long ulBase, unsigned long ulConfig)
/* Open SIR (IrDA) mode on the specified UART. The */ void UARTIrDAConfig(unsigned long ulBase, unsigned long ulConfig)
{ xASSERT(UARTBaseValid(ulBase)); xUARTIrDAEnable(ulBase); xHWREG(ulBase + UART_IRCR) = (ulConfig); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* userData handle LPUART handle pointer. return Length of received data in RX ring buffer. */
size_t LPUART_TransferGetRxRingBufferLength(LPUART_Type *base, lpuart_handle_t *handle)
/* userData handle LPUART handle pointer. return Length of received data in RX ring buffer. */ size_t LPUART_TransferGetRxRingBufferLength(LPUART_Type *base, lpuart_handle_t *handle)
{ assert(handle); size_t size; if (handle->rxRingBufferTail > handle->rxRingBufferHead) { size = (size_t)(handle->rxRingBufferHead + handle->rxRingBufferSize - handle->rxRingBufferTail); } else { size = (size_t)(handle->rxRingBufferHead - handle->rxRingBufferTail); } ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Read response on SPI from PC. return Status */
enum status_code adp_interface_read_response(uint8_t *rx_buf, uint16_t length)
/* Read response on SPI from PC. return Status */ enum status_code adp_interface_read_response(uint8_t *rx_buf, uint16_t length)
{ enum status_code status; adp_interface_send_start(); status = spi_read_packet(EDBG_SPI_MODULE, rx_buf, length); adp_interface_send_stop(); return status; }
memfault/zero-to-main
C++
null
200
/* Returns the index of the requested descriptor, given the corresponding GET_DESCRIPTOR request. */
unsigned char USBGetDescriptorRequest_GetDescriptorIndex(const USBGenericRequest *request)
/* Returns the index of the requested descriptor, given the corresponding GET_DESCRIPTOR request. */ unsigned char USBGetDescriptorRequest_GetDescriptorIndex(const USBGenericRequest *request)
{ return USBGenericRequest_GetValue(request) & 0xFF; }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* pm_runtime_init - Initialize run-time PM fields in given device object. @dev: Device object to initialize. */
void pm_runtime_init(struct device *dev)
/* pm_runtime_init - Initialize run-time PM fields in given device object. @dev: Device object to initialize. */ void pm_runtime_init(struct device *dev)
{ spin_lock_init(&dev->power.lock); dev->power.runtime_status = RPM_SUSPENDED; dev->power.idle_notification = false; dev->power.disable_depth = 1; atomic_set(&dev->power.usage_count, 0); dev->power.runtime_error = 0; atomic_set(&dev->power.child_count, 0); pm_suspend_ignore_children(dev, false); dev->power.req...
robutest/uclinux
C++
GPL-2.0
60
/* Computes the canonical ordering of a string in-place. */
void g_unicode_canonical_ordering(gunichar *string, gsize len)
/* Computes the canonical ordering of a string in-place. */ void g_unicode_canonical_ordering(gunichar *string, gsize len)
{ gsize i; int swap = 1; while (swap) { int last; swap = 0; last = COMBINING_CLASS (string[0]); for (i = 0; i < len - 1; ++i) { int next = COMBINING_CLASS (string[i + 1]); if (next != 0 && last > next) { gsize j; for (j = i + 1; j > 0; --j) { gunichar t;...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Caller should be responsible to free the returned key array reference using FreePool(). But contained keys are read only and must not be modified or freed. */
CHAR8** JsonObjectGetKeys(IN EDKII_JSON_OBJECT JsonObj, OUT UINTN *KeyCount)
/* Caller should be responsible to free the returned key array reference using FreePool(). But contained keys are read only and must not be modified or freed. */ CHAR8** JsonObjectGetKeys(IN EDKII_JSON_OBJECT JsonObj, OUT UINTN *KeyCount)
{ UINTN Index; CONST CHAR8 **KeyArray; CONST CHAR8 *Key; EDKII_JSON_VALUE Value; if ((JsonObj == NULL) || (KeyCount == NULL)) { return NULL; } Index = 0; json_object_foreach (JsonObj, Key, Value) { Index++; } if (Index == 0) { *KeyCount = 0; return NULL; } ...
tianocore/edk2
C++
Other
4,240
/* The function is synchronous and does not return until the erase operation has completed. */
uint32_t EEPROMMassErase(void)
/* The function is synchronous and does not return until the erase operation has completed. */ uint32_t EEPROMMassErase(void)
{ if(CLASS_IS_BLIZZARD && REVISION_IS_A0) { _EEPROMSectorMaskClear(); } HWREG(EEPROM_EEDBGME) = EEPROM_MASS_ERASE_KEY | EEPROM_EEDBGME_ME; _EEPROMWaitForDone(); SysCtlPeripheralReset(SYSCTL_PERIPH_EEPROM0); SysCtlDelay(2); _EEPROMWaitForDone(); return(HWREG(EEPROM_EEDONE)); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Set MAC Address function Loads the selected MAC Address in device's registers. */
void eth_cyclonev_set_mac_addr(uint8_t *address, uint32_t instance, uint32_t n, struct eth_cyclonev_priv *p)
/* Set MAC Address function Loads the selected MAC Address in device's registers. */ void eth_cyclonev_set_mac_addr(uint8_t *address, uint32_t instance, uint32_t n, struct eth_cyclonev_priv *p)
{ uint32_t tmpreg; if (instance > 1) { return; } if (n > 15) { LOG_ERR("Invalid index of MAC Address: %d", n); return; } tmpreg = ((uint32_t)address[5] << 8) | (uint32_t)address[4]; sys_write32(tmpreg, EMAC_GMAC_MAC_ADDR_HIGH_ADDR(p->base_addr, n)); tmpreg = ((uint32_t)address[3] << 24) | ((uint32_t)addre...
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Starts the desired oscillator(s) (OSC). Valid values for ui32OscFlags are: */
void am_hal_clkgen_osc_start(uint32_t ui32OscFlags)
/* Starts the desired oscillator(s) (OSC). Valid values for ui32OscFlags are: */ void am_hal_clkgen_osc_start(uint32_t ui32OscFlags)
{ if ( ui32OscFlags & (AM_HAL_CLKGEN_OSC_LFRC | AM_HAL_CLKGEN_OSC_XT) ) { AM_REG(CLKGEN, OCTRL) &= ~ui32OscFlags; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get the number of chip selects supported by this controller */
static int spi_a2f_hw_cs_max(struct spi_a2f *c)
/* Get the number of chip selects supported by this controller */ static int spi_a2f_hw_cs_max(struct spi_a2f *c)
{ int ret = 8; d_printk(2, "bus=%d,ret=%d\n", c->bus, ret); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Internal pixel drawing - fast, no blending, no locking RGB input. */
int fastPixelRGBANolock(SDL_Surface *dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
/* Internal pixel drawing - fast, no blending, no locking RGB input. */ int fastPixelRGBANolock(SDL_Surface *dst, Sint16 x, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{ Uint32 color; color = SDL_MapRGBA(dst->format, r, g, b, a); return (fastPixelColorNolock(dst, x, y, color)); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* determine the security context within which we access the cache from within the kernel */
int cachefiles_get_security_ID(struct cachefiles_cache *cache)
/* determine the security context within which we access the cache from within the kernel */ int cachefiles_get_security_ID(struct cachefiles_cache *cache)
{ struct cred *new; int ret; _enter("{%s}", cache->secctx); new = prepare_kernel_cred(current); if (!new) { ret = -ENOMEM; goto error; } if (cache->secctx) { ret = set_security_override_from_ctx(new, cache->secctx); if (ret < 0) { put_cred(new); printk(KERN_ERR "CacheFiles:" " Security de...
robutest/uclinux
C++
GPL-2.0
60
/* MSS_SPI_set_slave_tx_frame() See "mss_spi.h" for details of how to use this function. */
void MSS_SPI_set_slave_tx_frame(mss_spi_instance_t *this_spi, uint32_t frame_value)
/* MSS_SPI_set_slave_tx_frame() See "mss_spi.h" for details of how to use this function. */ void MSS_SPI_set_slave_tx_frame(mss_spi_instance_t *this_spi, uint32_t frame_value)
{ ASSERT( (this_spi == &g_mss_spi0) || (this_spi == &g_mss_spi1) ); ASSERT( this_spi->hw_reg_bit->CTRL_MASTER == MSS_SPI_MODE_SLAVE ); this_spi->slave_tx_buffer = 0U; this_spi->slave_tx_size = 0U; this_spi->slave_tx_idx = 0U; this_spi->slave_tx_frame = frame_value; this_spi->hw_reg->TX_DATA ...
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Retrieves the state of a gpio pin that is configured as an output. Reads the current logical output level of a gpio pin and returns the current level as a boolean value. */
bool gpio_pin_get_output_level(const uint8_t gpio_pin)
/* Retrieves the state of a gpio pin that is configured as an output. Reads the current logical output level of a gpio pin and returns the current level as a boolean value. */ bool gpio_pin_get_output_level(const uint8_t gpio_pin)
{ uint32_t regval = 0; if (gpio_pin < 16) { regval = GPIO0->DATAOUT.reg; regval &= (1 << gpio_pin); } else if (gpio_pin < 32) { regval = GPIO1->DATAOUT.reg; regval &= (1 << (gpio_pin % 16)); } else { regval = GPIO2->DATAOUT.reg; regval &= (1 << (gpio_pin % 16)); } return regval; }
memfault/zero-to-main
C++
null
200
/* Get the CRC polynomial register of the specified SPI port. */
unsigned long SPICRCPolGet(unsigned long ulBase)
/* Get the CRC polynomial register of the specified SPI port. */ unsigned long SPICRCPolGet(unsigned long ulBase)
{ xASSERT((ulBase == SPI3_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE)); return xHWREG(ulBase + SPI_CRCPR); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This function will initialize a timer normally this function is used to initialize a static timer object. */
void rt_timer_init(rt_timer_t timer, const char *name, void(*timeout)(void *parameter), void *parameter, rt_tick_t time, rt_uint8_t flag)
/* This function will initialize a timer normally this function is used to initialize a static timer object. */ void rt_timer_init(rt_timer_t timer, const char *name, void(*timeout)(void *parameter), void *parameter, rt_tick_t time, rt_uint8_t flag)
{ RT_ASSERT(timer != RT_NULL); RT_ASSERT(timeout != RT_NULL); RT_ASSERT(time < RT_TICK_MAX / 2); rt_object_init(&(timer->parent), RT_Object_Class_Timer, name); _timer_init(timer, timeout, parameter, time, flag); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns the RX filter by reading rx filter and phy error filter registers. RX filter is used to set the allowed frame types that PCU will accept and pass to the driver. For a list of frame types check out reg.h. */
u32 ath5k_hw_get_rx_filter(struct ath5k_hw *ah)
/* Returns the RX filter by reading rx filter and phy error filter registers. RX filter is used to set the allowed frame types that PCU will accept and pass to the driver. For a list of frame types check out reg.h. */ u32 ath5k_hw_get_rx_filter(struct ath5k_hw *ah)
{ u32 data, filter = 0; ATH5K_TRACE(ah->ah_sc); filter = ath5k_hw_reg_read(ah, AR5K_RX_FILTER); if (ah->ah_version == AR5K_AR5212) { data = ath5k_hw_reg_read(ah, AR5K_PHY_ERR_FIL); if (data & AR5K_PHY_ERR_FIL_RADAR) filter |= AR5K_RX_FILTER_RADARERR; if (data & (AR5K_PHY_ERR_FIL_OFDM | AR5K_PHY_ERR_FIL_CCK...
robutest/uclinux
C++
GPL-2.0
60
/* Processes v3 data message over IP, to then call process_l2tpv3_data from the common part (Session ID) */
static void process_l2tpv3_data_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, l2tpv3_conversation_t *l2tp_conv)
/* Processes v3 data message over IP, to then call process_l2tpv3_data from the common part (Session ID) */ static void process_l2tpv3_data_ip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, l2tpv3_conversation_t *l2tp_conv)
{ proto_tree *l2tp_tree; proto_item *l2tp_item; int idx = 0; int sid; sid = tvb_get_ntohl(tvb, idx); l2tp_item = proto_tree_add_item(tree, proto_l2tp, tvb, 0, -1, ENC_NA); l2tp_tree = proto_item_add_subtree(l2tp_item, ett_l2tp); proto_item_append_text(l2tp_item, " version 3"); proto_...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Return value: the user data previously attached or NULL. */
void* _cairo_user_data_array_get_data(cairo_user_data_array_t *array, const cairo_user_data_key_t *key)
/* Return value: the user data previously attached or NULL. */ void* _cairo_user_data_array_get_data(cairo_user_data_array_t *array, const cairo_user_data_key_t *key)
{ int i, num_slots; cairo_user_data_slot_t *slots; if (array == NULL) return NULL; num_slots = array->num_elements; slots = _cairo_array_index (array, 0); for (i = 0; i < num_slots; i++) { if (slots[i].key == key) return slots[i].user_data; } return NULL; }
xboot/xboot
C++
MIT License
779
/* Initial version only to support LAN access; some placeholder code from io_se.c left in with the expectation of later SuperIO and PCMCIA access. */
static volatile __u16* port2adr(unsigned int port)
/* Initial version only to support LAN access; some placeholder code from io_se.c left in with the expectation of later SuperIO and PCMCIA access. */ static volatile __u16* port2adr(unsigned int port)
{ maybebadio((unsigned long)port); return (volatile __u16*)port; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Application prompt wrapper used as API for layers above the application. */
int32_t ad7124_8pmdz_prompt(struct ad7124_8pmdz_dev *dev)
/* Application prompt wrapper used as API for layers above the application. */ int32_t ad7124_8pmdz_prompt(struct ad7124_8pmdz_dev *dev)
{ uint8_t app_name[] = { 'A', 'D', '7', '1', '2', '4', '_', '8', 'P', 'M', 'D', 'Z', '\0' }; return cli_cmd_prompt(dev->cli_handler, app_name); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Note: An alias node, having an AML_ALIAS_OP, can be resolved to a method definition. This function doesn't handle this case. */
BOOLEAN EFIAPI AmlIsMethodDefinitionNode(IN CONST AML_OBJECT_NODE *Node)
/* Note: An alias node, having an AML_ALIAS_OP, can be resolved to a method definition. This function doesn't handle this case. */ BOOLEAN EFIAPI AmlIsMethodDefinitionNode(IN CONST AML_OBJECT_NODE *Node)
{ AML_DATA_NODE *ObjectType; if (AmlNodeCompareOpCode (Node, AML_METHOD_OP, 0)) { return TRUE; } else if (AmlNodeCompareOpCode (Node, AML_EXTERNAL_OP, 0)) { ObjectType = (AML_DATA_NODE *)AmlGetFixedArgument ( (AML_OBJECT_NODE *)Node, ...
tianocore/edk2
C++
Other
4,240
/* brief Setup peripheral clock dividers. param Halt : Clock divider name return Nothing */
void CLOCK_HaltClkDiv(clock_div_name_t div_name)
/* brief Setup peripheral clock dividers. param Halt : Clock divider name return Nothing */ void CLOCK_HaltClkDiv(clock_div_name_t div_name)
{ volatile uint32_t *pClkDiv; pClkDiv = &(SYSCON->SYSTICKCLKDIV[0]); ((volatile uint32_t *)pClkDiv)[(uint32_t)div_name] = 1UL << 30U; return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Performs a soft PHY reset on those that apply. This is a function pointer entry point called by drivers. */
s32 e1000e_commit_phy(struct e1000_hw *hw)
/* Performs a soft PHY reset on those that apply. This is a function pointer entry point called by drivers. */ s32 e1000e_commit_phy(struct e1000_hw *hw)
{ if (hw->phy.ops.commit) return hw->phy.ops.commit(hw); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Configures the PLLI2S clock multiplication and division factors. */
void RCC_PLLI2SConfig(uint32_t PLLI2SN, uint32_t PLLI2SR)
/* Configures the PLLI2S clock multiplication and division factors. */ void RCC_PLLI2SConfig(uint32_t PLLI2SN, uint32_t PLLI2SR)
{ assert_param(IS_RCC_PLLI2SN_VALUE(PLLI2SN)); assert_param(IS_RCC_PLLI2SR_VALUE(PLLI2SR)); RCC->PLLI2SCFGR = (PLLI2SN << 6) | (PLLI2SR << 28); }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* Enable 32 Bit Programming Mode. This mode is a low power mode. It must be used at low frequencies and does not allow prefetch or wait states to be used. */
void flash_64bit_disable(void)
/* Enable 32 Bit Programming Mode. This mode is a low power mode. It must be used at low frequencies and does not allow prefetch or wait states to be used. */ void flash_64bit_disable(void)
{ FLASH_ACR &= ~FLASH_ACR_ACC64; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Receive a piece of data in non-blocking way. */
static void SAI_ReadNonBlocking(I2S_Type *base, uint32_t channel, uint32_t channelMask, uint32_t endChannel, uint8_t bitWidth, uint8_t *buffer, uint32_t size)
/* Receive a piece of data in non-blocking way. */ static void SAI_ReadNonBlocking(I2S_Type *base, uint32_t channel, uint32_t channelMask, uint32_t endChannel, uint8_t bitWidth, uint8_t *buffer, uint32_t size)
{ uint32_t i = 0, j = 0; uint8_t m = 0; uint8_t bytesPerWord = bitWidth / 8U; uint32_t data = 0; for (i = 0; i < size / bytesPerWord; i++) { for (j = channel; j <= endChannel; j++) { if (IS_SAI_FLAG_SET((1UL << j), channelMask)) { ...
eclipse-threadx/getting-started
C++
Other
310
/* This API reads the 8-bit data from the given register in the sensor. */
static uint16_t read_regs(uint8_t addr, uint8_t *data, uint8_t len, const struct bma4_dev *dev)
/* This API reads the 8-bit data from the given register in the sensor. */ static uint16_t read_regs(uint8_t addr, uint8_t *data, uint8_t len, const struct bma4_dev *dev)
{ uint16_t rslt = 0; uint16_t temp_len = len + dev->dummy_byte; uint16_t i; if (dev->interface == BMA4_SPI_INTERFACE) { addr = addr | BMA4_SPI_RD_MASK; } if (temp_len > BMA4_MAX_BUFFER_SIZE) { rslt |= BMA4_E_OUT_OF_RANGE; } if (rslt == BMA4_OK) { rslt |= dev->bus_...
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* change the request_key authorisation key on the current process */
static int keyctl_change_reqkey_auth(struct key *key)
/* change the request_key authorisation key on the current process */ static int keyctl_change_reqkey_auth(struct key *key)
{ struct cred *new; new = prepare_creds(); if (!new) return -ENOMEM; key_put(new->request_key_auth); new->request_key_auth = key_get(key); return commit_creds(new); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return the highest key that you could lookup from the n'th node on level l of the btree. */
static sector_t high(struct dm_table *t, unsigned int l, unsigned int n)
/* Return the highest key that you could lookup from the n'th node on level l of the btree. */ static sector_t high(struct dm_table *t, unsigned int l, unsigned int n)
{ for (; l < t->depth - 1; l++) n = get_child(n, CHILDREN_PER_NODE - 1); if (n >= t->counts[l]) return (sector_t) - 1; return get_node(t, l, n)[KEYS_PER_NODE - 1]; }
robutest/uclinux
C++
GPL-2.0
60
/* fc_exch_find() - Lookup and hold an exchange @mp: */
static struct fc_exch* fc_exch_find(struct fc_exch_mgr *mp, u16 xid)
/* fc_exch_find() - Lookup and hold an exchange @mp: */ static struct fc_exch* fc_exch_find(struct fc_exch_mgr *mp, u16 xid)
{ struct fc_exch_pool *pool; struct fc_exch *ep = NULL; if ((xid >= mp->min_xid) && (xid <= mp->max_xid)) { pool = per_cpu_ptr(mp->pool, xid & fc_cpu_mask); spin_lock_bh(&pool->lock); ep = fc_exch_ptr_get(pool, (xid - mp->min_xid) >> fc_cpu_order); if (ep) { fc_exch_hold(ep); WARN_ON(ep->xid != xid); ...
robutest/uclinux
C++
GPL-2.0
60
/* SPI Set the Software NSS Signal Low. In slave mode, and only when software slave management is used, this replaces the NSS signal with a slave select disable signal. */
void spi_set_nss_low(uint32_t spi)
/* SPI Set the Software NSS Signal Low. In slave mode, and only when software slave management is used, this replaces the NSS signal with a slave select disable signal. */ void spi_set_nss_low(uint32_t spi)
{ SPI_CR1(spi) &= ~SPI_CR1_SSI; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* scheduler run of queue, if there are requests pending and no one in the driver that will restart queueing */
static void cfq_schedule_dispatch(struct cfq_data *cfqd)
/* scheduler run of queue, if there are requests pending and no one in the driver that will restart queueing */ static void cfq_schedule_dispatch(struct cfq_data *cfqd)
{ if (cfqd->busy_queues) { cfq_log(cfqd, "schedule dispatch"); kblockd_schedule_work(cfqd->queue, &cfqd->unplug_work); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function turns off the backlight on the display. */
void Formike128x128x16BacklightOff(void)
/* This function turns off the backlight on the display. */ void Formike128x128x16BacklightOff(void)
{ HWREG(LCD_BL_BASE + GPIO_O_DATA + (LCD_BL_PIN << 2)) = 0; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does no...
EFI_STATUS EFIAPI EmuGopComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
/* This function retrieves the user readable name of a driver in the form of a Unicode string. If the driver specified by This has a user readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does no...
{ return LookupUnicodeString2 ( Language, This->SupportedLanguages, mEmuGopDriverNameTable, DriverName, (BOOLEAN)(This == &gEmuGopComponentName) ); }
tianocore/edk2
C++
Other
4,240
/* frame_after - is frame a after frame b */
static int frame_after(u16 a, u16 b)
/* frame_after - is frame a after frame b */ static int frame_after(u16 a, u16 b)
{ return ((HOST_FRAME_MASK + a - b) & HOST_FRAME_MASK) < (HOST_FRAME_MASK / 2); }
robutest/uclinux
C++
GPL-2.0
60
/* Enable USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
void USBD_EnableEP(U32 EPNum)
/* Enable USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */ void USBD_EnableEP(U32 EPNum)
{ U32 *ptr;; ptr = GetEpCmdStatPtr(EPNum); if (EPNum & 0x80) { EPNum &= ~0x80; *ptr &= ~EP_DISABLED; LPC_USB->INTSTAT = (1 << EP_IN_IDX(EPNum)); LPC_USB->INTEN |= (1 << EP_IN_IDX(EPNum)); } else { *ptr &= ~EP_DISABLED; *ptr |= BUF_ACTIVE; LPC...
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Disable pull-up resistors to precharge of the selected Tamper pin. */
void RTC_DisablePullUp(void)
/* Disable pull-up resistors to precharge of the selected Tamper pin. */ void RTC_DisablePullUp(void)
{ RTC->TACFG_B.TPPUDIS = BIT_SET; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* 6.. FMS Initiate Download Sequence (Confirmed Service Id = 9) 6..1. Request Message Parameters */
static void dissect_ff_msg_fms_init_download_sequence_req(tvbuff_t *tvb, gint offset, guint32 length, packet_info *pinfo, proto_tree *tree)
/* 6.. FMS Initiate Download Sequence (Confirmed Service Id = 9) 6..1. Request Message Parameters */ static void dissect_ff_msg_fms_init_download_sequence_req(tvbuff_t *tvb, gint offset, guint32 length, packet_info *pinfo, proto_tree *tree)
{ proto_tree *sub_tree; col_set_str(pinfo->cinfo, COL_INFO, "FMS Initiate Download Sequence Request"); if (!tree) { return; } sub_tree = proto_tree_add_subtree(tree, tvb, offset, length, ett_ff_fms_init_download_seq_req, NULL, "FMS Initiate Download Sequence Request"); proto_tree...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330