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
/* Get the current Thread Flags of current running thread. */
static uint32_t svcRtxThreadFlagsGet(void)
/* Get the current Thread Flags of current running thread. */ static uint32_t svcRtxThreadFlagsGet(void)
{ EvrRtxThreadFlagsGet(0U); return 0U; } EvrRtxThreadFlagsGet(thread->thread_flags); return thread->thread_flags; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Checks whether the specified TIM flag is set or not. */
FlagStatus TIM_GetFlagStatus(TIM_TypeDef *TIMx, uint16_t TIM_FLAG)
/* Checks whether the specified TIM flag is set or not. */ FlagStatus TIM_GetFlagStatus(TIM_TypeDef *TIMx, uint16_t TIM_FLAG)
{ ITStatus bitstatus = RESET; assert_param(IS_TIM_ALL_PERIPH(TIMx)); assert_param(IS_TIM_GET_FLAG(TIM_FLAG)); if ((TIMx->SR & TIM_FLAG) != (uint16_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enable or disable the clock on a peripheral device (timers, UARTs, USB, etc) */
int kinetis_periph_enable(kinetis_clock_gate_t gate, int enable)
/* Enable or disable the clock on a peripheral device (timers, UARTs, USB, etc) */ int kinetis_periph_enable(kinetis_clock_gate_t gate, int enable)
{ volatile u32 *scgc; u32 mask; int rv; if (KINETIS_CG_REG(gate) >= KINETIS_SIM_CG_NUMREGS || KINETIS_CG_IDX(gate) >= KINETIS_SIM_CG_NUMBITS) { printk("%s: wrong gate = %x\n", __func__, gate); rv = -EINVAL; goto out; } scgc = &KINETIS_SIM->scgc[KINETIS_CG_REG(gate)]; mask = 1 << KINETIS_CG_IDX(gate); if (gate == KINETIS_CG_PORTF && enable) { mask |= (1 << KINETIS_CG_IDX(KINETIS_CG_PORTE)); } if (enable) *scgc |= mask; else *scgc &= ~mask; rv = 0; out: return rv; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Compute the hash value for two given address/port pairs if the match has a wildcard port 2. */
static guint conversation_hash_no_port2(gconstpointer v)
/* Compute the hash value for two given address/port pairs if the match has a wildcard port 2. */ static guint conversation_hash_no_port2(gconstpointer v)
{ const conversation_key *key = (const conversation_key *)v; guint hash_val; address tmp_addr; hash_val = 0; tmp_addr.len = 4; hash_val = add_address_to_hash(hash_val, &key->addr1); tmp_addr.data = &key->port1; hash_val = add_address_to_hash(hash_val, &tmp_addr); hash_val = add_address_to_hash(hash_val, &key->addr2); hash_val += ( hash_val << 3 ); hash_val ^= ( hash_val >> 11 ); hash_val += ( hash_val << 15 ); return hash_val; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Handle replies to the AFS Kerberos Authentication Service */
static void kauth_reply_print(netdissect_options *ndo, register const u_char *bp, int length, int32_t opcode)
/* Handle replies to the AFS Kerberos Authentication Service */ static void kauth_reply_print(netdissect_options *ndo, register const u_char *bp, int length, int32_t opcode)
{ const struct rx_header *rxh; if (length <= (int)sizeof(struct rx_header)) return; rxh = (const struct rx_header *) bp; ND_PRINT((ndo, " kauth")); if (is_ubik(opcode)) { ubik_reply_print(ndo, bp, length, opcode); return; } ND_PRINT((ndo, " reply %s", tok2str(kauth_req, "op#%d", opcode))); bp += sizeof(struct rx_header); if (rxh->type == RX_PACKET_TYPE_DATA) ; else { ND_PRINT((ndo, " errcode")); INTOUT(); } return; trunc: ND_PRINT((ndo, " [|kauth]")); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Enables or Disables the RTC TimeStamp functionality with the specified time stamp pin stimulating edge. */
void RTC_TimeStampCmd(uint32_t RTC_TimeStampEdge, FunctionalState NewState)
/* Enables or Disables the RTC TimeStamp functionality with the specified time stamp pin stimulating edge. */ void RTC_TimeStampCmd(uint32_t RTC_TimeStampEdge, FunctionalState NewState)
{ uint32_t tmpreg = 0; assert_param(IS_RTC_TIMESTAMP_EDGE(RTC_TimeStampEdge)); assert_param(IS_FUNCTIONAL_STATE(NewState)); tmpreg = (uint32_t)(RTC->CR & (uint32_t)~(RTC_CR_TSEDGE | RTC_CR_TSE)); if (NewState != DISABLE) { tmpreg |= (uint32_t)(RTC_TimeStampEdge | RTC_CR_TSE); } else { tmpreg |= (uint32_t)(RTC_TimeStampEdge); } RTC->WPR = 0xCA; RTC->WPR = 0x53; RTC->CR = (uint32_t)tmpreg; RTC->WPR = 0xFF; }
MaJerle/stm32f429
C++
null
2,036
/* Reads the PHY registers and stores the PHY ID and possibly the PHY revision in the hardware structure. */
s32 igb_get_phy_id(struct e1000_hw *hw)
/* Reads the PHY registers and stores the PHY ID and possibly the PHY revision in the hardware structure. */ s32 igb_get_phy_id(struct e1000_hw *hw)
{ struct e1000_phy_info *phy = &hw->phy; s32 ret_val = 0; u16 phy_id; ret_val = phy->ops.read_reg(hw, PHY_ID1, &phy_id); if (ret_val) goto out; phy->id = (u32)(phy_id << 16); udelay(20); ret_val = phy->ops.read_reg(hw, PHY_ID2, &phy_id); if (ret_val) goto out; phy->id |= (u32)(phy_id & PHY_REVISION_MASK); phy->revision = (u32)(phy_id & ~PHY_REVISION_MASK); out: return ret_val; }
robutest/uclinux
C++
GPL-2.0
60
/* Launch a slave into smp_bootstrap(). It doesn't take an argument, and we set sp to the kernel stack of the newly created idle process, gp to the proc struct so that current_thread_info() will work. */
static void __cpuinit ip27_boot_secondary(int cpu, struct task_struct *idle)
/* Launch a slave into smp_bootstrap(). It doesn't take an argument, and we set sp to the kernel stack of the newly created idle process, gp to the proc struct so that current_thread_info() will work. */ static void __cpuinit ip27_boot_secondary(int cpu, struct task_struct *idle)
{ unsigned long gp = (unsigned long)task_thread_info(idle); unsigned long sp = __KSTK_TOS(idle); LAUNCH_SLAVE(cputonasid(cpu), cputoslice(cpu), (launch_proc_t)MAPPED_KERN_RW_TO_K0(smp_bootstrap), 0, (void *) sp, (void *) gp); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Change Logs: Date Author Notes Bernard The first version */
int main(int argc, char **argv)
/* Change Logs: Date Author Notes Bernard The first version */ int main(int argc, char **argv)
{ rt_kprintf("Hello RT-Thread!\n"); return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This is also called after resume to bring the MFGPT into operation again. */
void disable_mfgpt0_counter(void)
/* This is also called after resume to bring the MFGPT into operation again. */ void disable_mfgpt0_counter(void)
{ outw(inw(MFGPT0_SETUP) & 0x7fff, MFGPT0_SETUP); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function returns %0 on success and a negative error code on failure. */
static int add_node(struct ubifs_info *c, void *buf, int *lnum, int *offs, void *node)
/* This function returns %0 on success and a negative error code on failure. */ static int add_node(struct ubifs_info *c, void *buf, int *lnum, int *offs, void *node)
{ struct ubifs_ch *ch = node; int len = le32_to_cpu(ch->len), remains = c->leb_size - *offs; if (len > remains) { int sz = ALIGN(*offs, c->min_io_size), err; ubifs_pad(c, buf + *offs, sz - *offs); err = ubifs_leb_change(c, *lnum, buf, sz, UBI_SHORTTERM); if (err) return err; *lnum = next_log_lnum(c, *lnum); *offs = 0; } memcpy(buf + *offs, node, len); *offs += ALIGN(len, 8); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Set a single pin in GPIO data out port register to 0. */
void GPIO_PinOutClear(GPIO_Port_TypeDef port, unsigned int pin)
/* Set a single pin in GPIO data out port register to 0. */ void GPIO_PinOutClear(GPIO_Port_TypeDef port, unsigned int pin)
{ EFM_ASSERT(GPIO_PORT_VALID(port) && GPIO_PIN_VALID(pin)); GPIO->P[port].DOUTCLR = 1 << pin; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Download code from the shared RAM of an IOP. */
void iop_download_code(uint iop_num, __u8 *code_start, uint code_len, __u16 shared_ram_start)
/* Download code from the shared RAM of an IOP. */ void iop_download_code(uint iop_num, __u8 *code_start, uint code_len, __u16 shared_ram_start)
{ if ((iop_num >= NUM_IOPS) || !iop_base[iop_num]) return; iop_loadaddr(iop_base[iop_num], shared_ram_start); while (code_len--) { *code_start++ = iop_base[iop_num]->ram_data; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function is called with hbalock held. This function allocates a new driver iocb object from the iocb pool. If the allocation is successful, it returns pointer to the newly allocated iocb object else it returns NULL. */
static struct lpfc_iocbq* __lpfc_sli_get_iocbq(struct lpfc_hba *phba)
/* This function is called with hbalock held. This function allocates a new driver iocb object from the iocb pool. If the allocation is successful, it returns pointer to the newly allocated iocb object else it returns NULL. */ static struct lpfc_iocbq* __lpfc_sli_get_iocbq(struct lpfc_hba *phba)
{ struct list_head *lpfc_iocb_list = &phba->lpfc_iocb_list; struct lpfc_iocbq * iocbq = NULL; list_remove_head(lpfc_iocb_list, iocbq, struct lpfc_iocbq, list); return iocbq; }
robutest/uclinux
C++
GPL-2.0
60
/* Notes: In the event that an upper level driver rejects a command, we must release resources allocated during the __init_io() function. Primarily this would involve the scatter-gather table, and potentially any bounce buffers. */
void scsi_release_buffers(struct scsi_cmnd *cmd)
/* Notes: In the event that an upper level driver rejects a command, we must release resources allocated during the __init_io() function. Primarily this would involve the scatter-gather table, and potentially any bounce buffers. */ void scsi_release_buffers(struct scsi_cmnd *cmd)
{ __scsi_release_buffers(cmd, 1); }
robutest/uclinux
C++
GPL-2.0
60
/* This function makes sure the amount of flash space used by closed buds ('c->bud_bytes' is correct). Returns zero in case of success and %-EINVAL in case of failure. */
static int dbg_check_bud_bytes(struct ubifs_info *c)
/* This function makes sure the amount of flash space used by closed buds ('c->bud_bytes' is correct). Returns zero in case of success and %-EINVAL in case of failure. */ static int dbg_check_bud_bytes(struct ubifs_info *c)
{ int i, err = 0; struct ubifs_bud *bud; long long bud_bytes = 0; if (!dbg_is_chk_gen(c)) return 0; spin_lock(&c->buds_lock); for (i = 0; i < c->jhead_cnt; i++) list_for_each_entry(bud, &c->jheads[i].buds_list, list) bud_bytes += c->leb_size - bud->start; if (c->bud_bytes != bud_bytes) { ubifs_err(c, "bad bud_bytes %lld, calculated %lld", c->bud_bytes, bud_bytes); err = -EINVAL; } spin_unlock(&c->buds_lock); return err; }
4ms/stm32mp1-baremetal
C++
Other
137
/* brief Setup rtc 1khz clock divider. param divided_by_value: Value to be divided return Nothing */
void CLOCK_SetRtc1khzClkDiv(uint32_t divided_by_value)
/* brief Setup rtc 1khz clock divider. param divided_by_value: Value to be divided return Nothing */ void CLOCK_SetRtc1khzClkDiv(uint32_t divided_by_value)
{ PMC->RTCOSC32K |= (((divided_by_value - 28U) << PMC_RTCOSC32K_CLK1KHZDIV_SHIFT) | PMC_RTCOSC32K_CLK1KHZDIV_MASK); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Set Stall for USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
void USBD_SetStallEP(U32 EPNum)
/* Set Stall for USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */ void USBD_SetStallEP(U32 EPNum)
{ EPNum &= EPNUM_MASK; if (EPNum == 0) { MXC_USB->ep[0] |= (MXC_F_USB_EP_ST_STALL | MXC_F_USB_EP_STALL); } else { MXC_USB->ep[EPNum] |= MXC_F_USB_EP_STALL; } }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Disable all interrupts on the CPU. The "interrupt disable state" is an attribute of a thread. Thus, if a fiber or task disables interrupts and subsequently invokes a kernel routine that causes the calling thread to block, the interrupt disable state will be restored when the thread is later rescheduled for execution. */
unsigned int posix_irq_lock(void)
/* Disable all interrupts on the CPU. The "interrupt disable state" is an attribute of a thread. Thus, if a fiber or task disables interrupts and subsequently invokes a kernel routine that causes the calling thread to block, the interrupt disable state will be restored when the thread is later rescheduled for execution. */ unsigned int posix_irq_lock(void)
{ return hw_irq_ctrl_change_lock(CONFIG_NATIVE_SIMULATOR_MCU_N, true); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* See mss_uart.h for details of how to use this function. */
void MSS_UART_disable_afclear(mss_uart_instance_t *this_uart)
/* See mss_uart.h for details of how to use this function. */ void MSS_UART_disable_afclear(mss_uart_instance_t *this_uart)
{ ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)); if((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) { clear_bit_reg8(&this_uart->hw_reg->MM2,EAFC); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Send a master receive request when the bus is idle.(Read Step1) For this function returns immediately, it is always using in the interrupt hander. */
void I2CMasterReadRequestS1(unsigned long ulBase, unsigned char ucSlaveAddr, xtBoolean bEndTransmition)
/* Send a master receive request when the bus is idle.(Read Step1) For this function returns immediately, it is always using in the interrupt hander. */ void I2CMasterReadRequestS1(unsigned long ulBase, unsigned char ucSlaveAddr, xtBoolean bEndTransmition)
{ unsigned long ulStatus; xASSERT((ulBase == I2C0_BASE)); xHWREG(ulBase + I2C_CR) |= I2C_CR_AA; xHWREG(ulBase + I2C_TAR) = ucSlaveAddr | (I2C_TAR_RWD); do { ulStatus = I2CStatusGet(ulBase); if(xHWREG(ulBase + I2C_CSR) & 0x0700) break; } while(!(ulStatus == I2C_MASTER_RECEIVER_MODE)); if(bEndTransmition) { xHWREG(ulBase + I2C_CR) &= ~I2C_CR_AA; do { ulStatus = I2CStatusGet(ulBase); if(xHWREG(ulBase + I2C_CSR) & 0x0700) break; } while(!(ulStatus == I2C_MASTER_RX_NOT_EMPTY)); I2CStopSend(ulBase); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Locking Note: The rport lock is expected to be held before calling this routine. */
static void fc_rport_enter_rtv(struct fc_rport_priv *)
/* Locking Note: The rport lock is expected to be held before calling this routine. */ static void fc_rport_enter_rtv(struct fc_rport_priv *)
{ struct fc_frame *fp; struct fc_lport *lport = rdata->local_port; FC_RPORT_DBG(rdata, "Port entered RTV state from %s state\n", fc_rport_state(rdata)); fc_rport_state_enter(rdata, RPORT_ST_RTV); fp = fc_frame_alloc(lport, sizeof(struct fc_els_rtv)); if (!fp) { fc_rport_error_retry(rdata, fp); return; } if (!lport->tt.elsct_send(lport, rdata->ids.port_id, fp, ELS_RTV, fc_rport_rtv_resp, rdata, 2 * lport->r_a_tov)) fc_rport_error_retry(rdata, NULL); else kref_get(&rdata->kref); }
robutest/uclinux
C++
GPL-2.0
60
/* Read a value of size @size from offset @offset within the configuration space of the device identified by the bus, device & function numbers in @bdf on the PCI bus @bus. */
static int pci_phytium_read_config(struct udevice *bus, pci_dev_t bdf, uint offset, ulong *valuep, enum pci_size_t size)
/* Read a value of size @size from offset @offset within the configuration space of the device identified by the bus, device & function numbers in @bdf on the PCI bus @bus. */ static int pci_phytium_read_config(struct udevice *bus, pci_dev_t bdf, uint offset, ulong *valuep, enum pci_size_t size)
{ return pci_generic_mmap_read_config(bus, pci_phytium_conf_address, bdf, offset, valuep, size); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Change Logs: Date Author Notes GuEe-GUI first version */
int fdt_add_subnode_possible(void *fdt, int parentoffset, const char *name)
/* Change Logs: Date Author Notes GuEe-GUI first version */ int fdt_add_subnode_possible(void *fdt, int parentoffset, const char *name)
{ int nodeoffset; if ((nodeoffset = fdt_add_subnode(fdt, parentoffset, name)) < 0) { fdt_open_into(fdt, fdt, fdt_totalsize(fdt) + FDT_PADDING_SIZE); nodeoffset = fdt_add_subnode(fdt, parentoffset, name); } return nodeoffset; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enable or disable a DMA channel (by index ch: 0..15) by setting a DMA_SxCR bit. */
int stm32_dma_ch_enable(int ch)
/* Enable or disable a DMA channel (by index ch: 0..15) by setting a DMA_SxCR bit. */ int stm32_dma_ch_enable(int ch)
{ return __stm32_dma_ch_enable(ch, 1); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* setup_pagelist_highmark() sets the high water mark for hot per_cpu_pagelist to the value high for the pageset p. */
static void setup_pagelist_highmark(struct per_cpu_pageset *p, unsigned long high)
/* setup_pagelist_highmark() sets the high water mark for hot per_cpu_pagelist to the value high for the pageset p. */ static void setup_pagelist_highmark(struct per_cpu_pageset *p, unsigned long high)
{ struct per_cpu_pages *pcp; pcp = &p->pcp; pcp->high = high; pcp->batch = max(1UL, high/4); if ((high/4) > (PAGE_SHIFT * 8)) pcp->batch = PAGE_SHIFT * 8; }
robutest/uclinux
C++
GPL-2.0
60
/* Write a specified value to a register of the OV7740 sensor. */
uint32_t ov_write_reg(Twihs *const p_twi, twihs_packet_t *const p_packet)
/* Write a specified value to a register of the OV7740 sensor. */ uint32_t ov_write_reg(Twihs *const p_twi, twihs_packet_t *const p_packet)
{ uint32_t ul_status; ul_status = twihs_master_write(p_twi, p_packet); return ul_status; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Invert byte order within each 32-bits of an array. */
FourByteSwap(unsigned char *buf, size_t nbytes)
/* Invert byte order within each 32-bits of an array. */ FourByteSwap(unsigned char *buf, size_t nbytes)
{ unsigned char c; for ( ; nbytes >= 4; nbytes -= 4, buf += 4 ) { c = buf[0]; buf[0] = buf[3]; buf[3] = c; c = buf[1]; buf[1] = buf[2]; buf[2] = c; } }
DC-SWAT/DreamShell
C++
null
404
/* Removes a data element corresponding to a string. Its destroy function is called if it has been set. */
void g_dataset_id_set_data_full(gconstpointer dataset_location, GQuark key_id, gpointer data, GDestroyNotify destroy_func)
/* Removes a data element corresponding to a string. Its destroy function is called if it has been set. */ void g_dataset_id_set_data_full(gconstpointer dataset_location, GQuark key_id, gpointer data, GDestroyNotify destroy_func)
{ GDataset *dataset; g_return_if_fail (dataset_location != NULL); if (!data) g_return_if_fail (destroy_func == NULL); if (!key_id) { if (data) g_return_if_fail (key_id > 0); else return; } G_LOCK (g_dataset_global); if (!g_dataset_location_ht) g_data_initialize (); dataset = g_dataset_lookup (dataset_location); if (!dataset) { dataset = g_slice_new (GDataset); dataset->location = dataset_location; g_datalist_init (&dataset->datalist); g_hash_table_insert (g_dataset_location_ht, (gpointer) dataset->location, dataset); } g_data_set_internal (&dataset->datalist, key_id, data, destroy_func, dataset); G_UNLOCK (g_dataset_global); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This comparator searches for the next Interface descriptor of the correct HID Class value. */
uint8_t DComp_NextHIDInterface(void *CurrentDescriptor)
/* This comparator searches for the next Interface descriptor of the correct HID Class value. */ uint8_t DComp_NextHIDInterface(void *CurrentDescriptor)
{ USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); if (Header->Type == DTYPE_Interface) { USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t); if (Interface->Class == HID_CSCP_HIDClass) { return DESCRIPTOR_SEARCH_Found; } } return DESCRIPTOR_SEARCH_NotFound; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Returns a boolean or a negative error code. */
int regulator_is_supported_voltage(struct regulator *regulator, int min_uV, int max_uV)
/* Returns a boolean or a negative error code. */ int regulator_is_supported_voltage(struct regulator *regulator, int min_uV, int max_uV)
{ int i, voltages, ret; ret = regulator_count_voltages(regulator); if (ret < 0) return ret; voltages = ret; for (i = 0; i < voltages; i++) { ret = regulator_list_voltage(regulator, i); if (ret >= min_uV && ret <= max_uV) return 1; } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Remap the ready status of priority queue from Assign sequence number. */
static void PrioRemap(OS_TID seqNum)
/* Remap the ready status of priority queue from Assign sequence number. */ static void PrioRemap(OS_TID seqNum)
{ U8 i,j; U32 tmp; tmp = j = 0; j = seqNum/32; for(i=0;i<seqNum%32;i++) { tmp |= 1<<i; } tmp &= RdyTaskPriInfo[j]; for(i=seqNum; i<PriNum; i++) { if((i%32==0)&&(i!=seqNum)) { RdyTaskPriInfo[j++] = tmp; tmp = 0; } if(RdyTaskPri[i] != INVALID_ID) { tmp = tmp | (1<<(i%32)); } } RdyTaskPriInfo[j++] = tmp; }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* Sends the 32-bit value specified by Value to a POST card, and returns Value. If Description is not NULL, then the ASCII string specified by Description is also passed to the handler that displays the POST card value. Some implementations of this library function may perform I/O operations directly to a POST card device. Other implementations may send Value to ReportStatusCode(), and the status code reporting mechanism will eventually display the 32-bit value on the status reporting device. */
UINT32 EFIAPI PostCodeWithDescription(IN UINT32 Value, IN CONST CHAR8 *Description OPTIONAL)
/* Sends the 32-bit value specified by Value to a POST card, and returns Value. If Description is not NULL, then the ASCII string specified by Description is also passed to the handler that displays the POST card value. Some implementations of this library function may perform I/O operations directly to a POST card device. Other implementations may send Value to ReportStatusCode(), and the status code reporting mechanism will eventually display the 32-bit value on the status reporting device. */ UINT32 EFIAPI PostCodeWithDescription(IN UINT32 Value, IN CONST CHAR8 *Description OPTIONAL)
{ if (Description == NULL) { REPORT_STATUS_CODE ( EFI_PROGRESS_CODE, POST_CODE_TO_STATUS_CODE_VALUE (Value) ); } else { REPORT_STATUS_CODE_WITH_EXTENDED_DATA ( EFI_PROGRESS_CODE, POST_CODE_TO_STATUS_CODE_VALUE (Value), Description, AsciiStrSize (Description) ); } return Value; }
tianocore/edk2
C++
Other
4,240
/* This function should be called on Event: ExitBootServices to free up memory, stop the driver and uninstall the protocols */
VOID LcdGraphicsExitBootServicesEvent(IN EFI_EVENT Event, IN VOID *Context)
/* This function should be called on Event: ExitBootServices to free up memory, stop the driver and uninstall the protocols */ VOID LcdGraphicsExitBootServicesEvent(IN EFI_EVENT Event, IN VOID *Context)
{ if (FeaturePcdGet (PcdGopDisableOnExitBootServices)) { LcdShutdown (); } }
tianocore/edk2
C++
Other
4,240
/* This function signals the named event specified by Name. The named event must have been created with */
EFI_STATUS EFIAPI EfiNamedEventSignal(IN CONST EFI_GUID *Name)
/* This function signals the named event specified by Name. The named event must have been created with */ EFI_STATUS EFIAPI EfiNamedEventSignal(IN CONST EFI_GUID *Name)
{ EFI_STATUS Status; EFI_HANDLE Handle; ASSERT (Name != NULL); Handle = NULL; Status = gBS->InstallProtocolInterface ( &Handle, (EFI_GUID *)Name, EFI_NATIVE_INTERFACE, NULL ); ASSERT_EFI_ERROR (Status); Status = gBS->UninstallProtocolInterface ( Handle, (EFI_GUID *)Name, NULL ); ASSERT_EFI_ERROR (Status); return Status; }
tianocore/edk2
C++
Other
4,240
/* USBH_CtlSendSetup Sends the Setup Packet to the Device. */
USBH_StatusTypeDef USBH_CtlSendSetup(USBH_HandleTypeDef *phost, uint8_t *buff, uint8_t pipe_num)
/* USBH_CtlSendSetup Sends the Setup Packet to the Device. */ USBH_StatusTypeDef USBH_CtlSendSetup(USBH_HandleTypeDef *phost, uint8_t *buff, uint8_t pipe_num)
{ (void)USBH_LL_SubmitURB(phost, pipe_num, 0U, USBH_EP_CONTROL, USBH_PID_SETUP, buff, USBH_SETUP_PKT_SIZE, 0U); return USBH_OK; }
ua1arn/hftrx
C++
null
69
/* Check if Execute Disable Bit (IA32_EFER.NXE) should be enabled or not. */
BOOLEAN IsEnableNonExecNeeded(VOID)
/* Check if Execute Disable Bit (IA32_EFER.NXE) should be enabled or not. */ BOOLEAN IsEnableNonExecNeeded(VOID)
{ if (!IsExecuteDisableBitAvailable ()) { return FALSE; } return (IsSetNxForStack () || FixedPcdGet64 (PcdDxeNxMemoryProtectionPolicy) != 0 || PcdGet32 (PcdImageProtectionPolicy) != 0); }
tianocore/edk2
C++
Other
4,240
/* configure the threshold of the flow control(deactive and active threshold) */
void enet_flowcontrol_threshold_config(uint32_t deactive, uint32_t active)
/* configure the threshold of the flow control(deactive and active threshold) */ void enet_flowcontrol_threshold_config(uint32_t deactive, uint32_t active)
{ ENET_MAC_FCTH = ((deactive | active) >> 8); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* TCP callback function if a connection (opened by tcp_connect/do_connect) has been established (or reset by the remote host). */
static err_t do_connected(void *arg, struct tcp_pcb *pcb, err_t err)
/* TCP callback function if a connection (opened by tcp_connect/do_connect) has been established (or reset by the remote host). */ static err_t do_connected(void *arg, struct tcp_pcb *pcb, err_t err)
{ lwIP_netconn *conn = arg; err = ERR_OK; lwIP_REQUIRE_ACTION(conn, exit, err = ESP_ARG); conn->state = NETCONN_STATE_ESTABLISHED; conn->readbuf = ringbuf_new(TCP_SND_BUF); lwIP_REQUIRE_ACTION(conn->readbuf, exit, err = ESP_MEM); espconn_mbedtls_parse_internal(find_socket(conn), ERR_OK); exit: return err; }
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* Returns: the data of the last element in the queue, or NULL if the queue is empty */
gpointer g_queue_peek_tail(GQueue *queue)
/* Returns: the data of the last element in the queue, or NULL if the queue is empty */ gpointer g_queue_peek_tail(GQueue *queue)
{ g_return_val_if_fail (queue != NULL, NULL); return queue->tail ? queue->tail->data : NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function attempts to retrieve and register all the devices firmware knows about via the SYSTEM_MAP PDC call. */
static void __init system_map_inventory(void)
/* This function attempts to retrieve and register all the devices firmware knows about via the SYSTEM_MAP PDC call. */ static void __init system_map_inventory(void)
{ int i; long status = PDC_OK; for (i = 0; i < 256; i++) { struct parisc_device *dev; struct pdc_system_map_mod_info module_result; struct pdc_module_path module_path; status = pdc_system_map_find_mods(&module_result, &module_path, i); if ((status == PDC_BAD_PROC) || (status == PDC_NE_MOD)) break; if (status != PDC_OK) continue; dev = alloc_pa_dev(module_result.mod_addr, &module_path.path); if (!dev) continue; register_parisc_device(dev); if (!module_result.add_addrs) continue; add_system_map_addresses(dev, module_result.add_addrs, i); } walk_central_bus(); return; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Called when an internally generated command times out */
static void ibmvfc_timeout(struct ibmvfc_event *evt)
/* Called when an internally generated command times out */ static void ibmvfc_timeout(struct ibmvfc_event *evt)
{ struct ibmvfc_host *vhost = evt->vhost; dev_err(vhost->dev, "Command timed out (%p). Resetting connection\n", evt); ibmvfc_reset_host(vhost); }
robutest/uclinux
C++
GPL-2.0
60
/* Handles an incoming ATT error response for the specified read-using-characteristic-uuid proc. */
static void ble_gattc_read_uuid_err(struct ble_gattc_proc *proc, int status, uint16_t att_handle)
/* Handles an incoming ATT error response for the specified read-using-characteristic-uuid proc. */ static void ble_gattc_read_uuid_err(struct ble_gattc_proc *proc, int status, uint16_t att_handle)
{ ble_gattc_dbg_assert_proc_not_inserted(proc); ble_gattc_read_uuid_cb(proc, status, att_handle, NULL); }
Nicholas3388/LuaNode
C++
Other
1,055
/* Dissect 802.11 with a variable-length link-layer header and a byte-swapped control field and with no FCS (some hardware sends out LWAPP-encapsulated 802.11 packets with the control field byte swapped). */
static int dissect_ieee80211_bsfc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
/* Dissect 802.11 with a variable-length link-layer header and a byte-swapped control field and with no FCS (some hardware sends out LWAPP-encapsulated 802.11 packets with the control field byte swapped). */ static int dissect_ieee80211_bsfc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
{ struct ieee_802_11_phdr phdr; memset(&phdr, 0, sizeof(phdr)); phdr.decrypted = FALSE; phdr.datapad = FALSE; phdr.phy = PHDR_802_11_PHY_UNKNOWN; dissect_ieee80211_common(tvb, pinfo, tree, IEEE80211_COMMON_OPT_BROKEN_FC|IEEE80211_COMMON_OPT_NORMAL_QOS, &phdr); return tvb_captured_length(tvb); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* param base CMC peripheral base address. param wake true - Flash will exit low power state during the flash memory accesses. false - No effect. param doze true - Flash is disabled while core is sleeping false - No effect. param disable true - Flash memory is placed in low power state. false - No effect. */
void CMC_ConfigFlashMode(CMC_Type *base, bool wake, bool doze, bool disable)
/* param base CMC peripheral base address. param wake true - Flash will exit low power state during the flash memory accesses. false - No effect. param doze true - Flash is disabled while core is sleeping false - No effect. param disable true - Flash memory is placed in low power state. false - No effect. */ void CMC_ConfigFlashMode(CMC_Type *base, bool wake, bool doze, bool disable)
{ uint32_t reg = 0UL; reg |= (disable ? CMC_FLASHCR_FLASHDIS(1U) : CMC_FLASHCR_FLASHDIS(0U)) | (doze ? CMC_FLASHCR_FLASHDOZE(1U) : CMC_FLASHCR_FLASHDOZE(0U)) | (wake ? CMC_FLASHCR_FLASHWAKE(1U) : CMC_FLASHCR_FLASHWAKE(0U)); base->FLASHCR = reg; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* EDMA callback function for FLEXIO SPI send transfer. */
static void FLEXIO_SPI_TxEDMACallback(edma_handle_t *handle, void *param, bool transferDone, uint32_t tcds)
/* EDMA callback function for FLEXIO SPI send transfer. */ static void FLEXIO_SPI_TxEDMACallback(edma_handle_t *handle, void *param, bool transferDone, uint32_t tcds)
{ tcds = tcds; flexio_spi_master_edma_private_handle_t *spiPrivateHandle = (flexio_spi_master_edma_private_handle_t *)param; if (transferDone) { FLEXIO_SPI_EnableDMA(spiPrivateHandle->base, kFLEXIO_SPI_TxDmaEnable, false); spiPrivateHandle->handle->txInProgress = false; if ((spiPrivateHandle->handle->txInProgress == false) && (spiPrivateHandle->handle->rxInProgress == false)) { if (spiPrivateHandle->handle->callback) { (spiPrivateHandle->handle->callback)(spiPrivateHandle->base, spiPrivateHandle->handle, kStatus_Success, spiPrivateHandle->handle->userData); } } } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Well, now we have the option CDS_MIXED: a mixed-type CD. User level programmers might feel the ioctl is not very useful. */
static int cdrom_ioctl_disc_status(struct cdrom_device_info *cdi)
/* Well, now we have the option CDS_MIXED: a mixed-type CD. User level programmers might feel the ioctl is not very useful. */ static int cdrom_ioctl_disc_status(struct cdrom_device_info *cdi)
{ tracktype tracks; cdinfo(CD_DO_IOCTL, "entering CDROM_DISC_STATUS\n"); cdrom_count_tracks(cdi, &tracks); if (tracks.error) return tracks.error; if (tracks.audio > 0) { if (!tracks.data && !tracks.cdi && !tracks.xa) return CDS_AUDIO; else return CDS_MIXED; } if (tracks.cdi > 0) return CDS_XA_2_2; if (tracks.xa > 0) return CDS_XA_2_1; if (tracks.data > 0) return CDS_DATA_1; cdinfo(CD_WARNING,"This disc doesn't have any tracks I recognize!\n"); return CDS_NO_INFO; }
robutest/uclinux
C++
GPL-2.0
60
/* Register the given set of PLLs with the system. */
int __init s3c_plltab_register(struct cpufreq_frequency_table *plls, unsigned int plls_no)
/* Register the given set of PLLs with the system. */ int __init s3c_plltab_register(struct cpufreq_frequency_table *plls, unsigned int plls_no)
{ struct cpufreq_frequency_table *vals; unsigned int size; size = sizeof(struct cpufreq_frequency_table) * (plls_no + 1); vals = kmalloc(size, GFP_KERNEL); if (vals) { memcpy(vals, plls, size); pll_reg = vals; vals += plls_no; vals->frequency = CPUFREQ_TABLE_END; printk(KERN_INFO "cpufreq: %d PLL entries\n", plls_no); } else printk(KERN_ERR "cpufreq: no memory for PLL tables\n"); return vals ? 0 : -ENOMEM; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* unmap is different from map that it can handle multiple pages */
void rt_hw_mmu_unmap(struct rt_aspace *aspace, void *v_addr, size_t size)
/* unmap is different from map that it can handle multiple pages */ void rt_hw_mmu_unmap(struct rt_aspace *aspace, void *v_addr, size_t size)
{ if (!aspace->page_table) { return; } size_t unmapped = 0; while (size > 0) { MM_PGTBL_LOCK(aspace); unmapped = _unmap_area(aspace, v_addr, size); MM_PGTBL_UNLOCK(aspace); if (!unmapped || unmapped > size) break; size -= unmapped; v_addr += unmapped; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return the BIOS address of the adapter at the specified I/O port and with the specified bus type. */
static unsigned short __devinit AscGetChipBiosAddress(PortAddr iop_base, unsigned short bus_type)
/* Return the BIOS address of the adapter at the specified I/O port and with the specified bus type. */ static unsigned short __devinit AscGetChipBiosAddress(PortAddr iop_base, unsigned short bus_type)
{ unsigned short cfg_lsw; unsigned short bios_addr; if (bus_type & ASC_IS_PCI) return 0; if ((bus_type & ASC_IS_EISA) != 0) { cfg_lsw = AscGetEisaChipCfg(iop_base); cfg_lsw &= 0x000F; bios_addr = ASC_BIOS_MIN_ADDR + cfg_lsw * ASC_BIOS_BANK_SIZE; return bios_addr; } cfg_lsw = AscGetChipCfgLsw(iop_base); if (bus_type == ASC_IS_ISAPNP) cfg_lsw &= 0x7FFF; bios_addr = ASC_BIOS_MIN_ADDR + (cfg_lsw >> 12) * ASC_BIOS_BANK_SIZE; return bios_addr; }
robutest/uclinux
C++
GPL-2.0
60
/* This function is called from the AP bus code after a crypto request "msg" has finished with the reply message "reply". It is called from tasklet context. @ap_dev: pointer to the AP device @msg: pointer to the AP message @reply: pointer to the AP reply message */
static void zcrypt_pcica_receive(struct ap_device *, struct ap_message *, struct ap_message *)
/* This function is called from the AP bus code after a crypto request "msg" has finished with the reply message "reply". It is called from tasklet context. @ap_dev: pointer to the AP device @msg: pointer to the AP message @reply: pointer to the AP reply message */ static void zcrypt_pcica_receive(struct ap_device *, struct ap_message *, struct ap_message *)
{ static struct error_hdr error_reply = { .type = TYPE82_RSP_CODE, .reply_code = REP82_ERROR_MACHINE_FAILURE, }; struct type84_hdr *t84h; int length; if (IS_ERR(reply)) { memcpy(msg->message, &error_reply, sizeof(error_reply)); goto out; } t84h = reply->message; if (t84h->code == TYPE84_RSP_CODE) { length = min(PCICA_MAX_RESPONSE_SIZE, (int) t84h->len); memcpy(msg->message, reply->message, length); } else memcpy(msg->message, reply->message, sizeof error_reply); out: complete((struct completion *) msg->private); }
robutest/uclinux
C++
GPL-2.0
60
/* Return all enabled IOS Access Interrupts. This function may be used to return all enabled IOS Access interrupts. */
uint32_t am_hal_ios_access_int_enable_get(void)
/* Return all enabled IOS Access Interrupts. This function may be used to return all enabled IOS Access interrupts. */ uint32_t am_hal_ios_access_int_enable_get(void)
{ return AM_REG(IOSLAVE, REGACCINTEN); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function allows the user to provide an iterator, which will be called for each stored value in the dictionary. */
void qdict_iter(const QDict *qdict, void(*iter)(const char *key, QObject *obj, void *opaque), void *opaque)
/* This function allows the user to provide an iterator, which will be called for each stored value in the dictionary. */ void qdict_iter(const QDict *qdict, void(*iter)(const char *key, QObject *obj, void *opaque), void *opaque)
{ int i; QDictEntry *entry; for (i = 0; i < QDICT_BUCKET_MAX; i++) { QLIST_FOREACH(entry, &qdict->table[i], next) iter(entry->key, entry->value, opaque); } }
ve3wwg/teensy3_qemu
C++
Other
15
/* This function parse the value got from TPM2_GetCapability and return the LockoutCounter. */
EFI_STATUS EFIAPI Tpm2GetCapabilityLockoutCounter(OUT UINT32 *LockoutCounter)
/* This function parse the value got from TPM2_GetCapability and return the LockoutCounter. */ EFI_STATUS EFIAPI Tpm2GetCapabilityLockoutCounter(OUT UINT32 *LockoutCounter)
{ TPMS_CAPABILITY_DATA TpmCap; TPMI_YES_NO MoreData; EFI_STATUS Status; Status = Tpm2GetCapability ( TPM_CAP_TPM_PROPERTIES, TPM_PT_LOCKOUT_COUNTER, 1, &MoreData, &TpmCap ); if (EFI_ERROR (Status)) { return Status; } *LockoutCounter = SwapBytes32 (TpmCap.data.tpmProperties.tpmProperty->value); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* This only works on machines with the VIA-based PRAM/RTC, which is basically any machine with Mac II-style ADB. */
static void via_write_time(long time)
/* This only works on machines with the VIA-based PRAM/RTC, which is basically any machine with Mac II-style ADB. */ static void via_write_time(long time)
{ union { __u8 cdata[4]; long idata; } data; __u8 temp; temp = 0x55; via_pram_command(0x35, &temp); data.idata = time + RTC_OFFSET; via_pram_command(0x01, &data.cdata[3]); via_pram_command(0x05, &data.cdata[2]); via_pram_command(0x09, &data.cdata[1]); via_pram_command(0x0D, &data.cdata[0]); temp = 0xD5; via_pram_command(0x35, &temp); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* It is useful for unserialized use of timers. */
int mod_timer_pending(struct timer_list *timer, unsigned long expires)
/* It is useful for unserialized use of timers. */ int mod_timer_pending(struct timer_list *timer, unsigned long expires)
{ return __mod_timer(timer, expires, true, TIMER_NOT_PINNED); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Get a field specified by a mask from a word. */
uint32_t field_get(uint32_t mask, uint32_t word)
/* Get a field specified by a mask from a word. */ uint32_t field_get(uint32_t mask, uint32_t word)
{ return (word & mask) >> find_first_set_bit(mask); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* This API finds the the null error of the device pointer structure. This internal API checks null pointer error. */
static uint16_t bma4_null_pointer_check(const struct bma4_dev *dev)
/* This API finds the the null error of the device pointer structure. This internal API checks null pointer error. */ static uint16_t bma4_null_pointer_check(const struct bma4_dev *dev)
{ uint16_t rslt = BMA4_OK; if ((dev == NULL) || (dev->bus_read == NULL) || (dev->bus_write == NULL)) rslt |= BMA4_E_NULL_PTR; else rslt = BMA4_OK; return rslt; }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* These are routines for dealing with the sb1250 smp capabilities independent of board/firmware Simple enough; everything is set up, so just poke the appropriate mailbox register, and we should be set */
static void sb1250_send_ipi_single(int cpu, unsigned int action)
/* These are routines for dealing with the sb1250 smp capabilities independent of board/firmware Simple enough; everything is set up, so just poke the appropriate mailbox register, and we should be set */ static void sb1250_send_ipi_single(int cpu, unsigned int action)
{ __raw_writeq((((u64)action) << 48), mailbox_set_regs[cpu]); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* @ohm: key value search is looking for @i_low: return Lower interval index value @i_high: return Higher interval index value */
static void ntc_lookup_comp(const struct ntc_type *type, unsigned int ohm, int *i_low, int *i_high)
/* @ohm: key value search is looking for @i_low: return Lower interval index value @i_high: return Higher interval index value */ static void ntc_lookup_comp(const struct ntc_type *type, unsigned int ohm, int *i_low, int *i_high)
{ int low = 0; int high = type->n_comp - 1; if (ohm > type->comp[low].ohm) { high = low; } else if (ohm < type->comp[high].ohm) { low = high; } while (high - low > 1) { int mid = (low + high) / 2; if (ohm > type->comp[mid].ohm) { high = mid; } else { low = mid; } } *i_low = low; *i_high = high; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Set Timer Output Idle States Low. This determines the value of the timer output compare when it enters idle state. */
void timer_reset_output_idle_state(uint32_t timer_peripheral, uint32_t outputs)
/* Set Timer Output Idle States Low. This determines the value of the timer output compare when it enters idle state. */ void timer_reset_output_idle_state(uint32_t timer_peripheral, uint32_t outputs)
{ TIM_CR2(timer_peripheral) &= ~(outputs & TIM_CR2_OIS_MASK); }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Plants a NUL-terminated string in @buf and returns the length of the string, excluding the NUL. Otherwise zero is returned. */
size_t rpc_ntop(const struct sockaddr *sap, char *buf, const size_t buflen)
/* Plants a NUL-terminated string in @buf and returns the length of the string, excluding the NUL. Otherwise zero is returned. */ size_t rpc_ntop(const struct sockaddr *sap, char *buf, const size_t buflen)
{ switch (sap->sa_family) { case AF_INET: return rpc_ntop4(sap, buf, buflen); case AF_INET6: return rpc_ntop6(sap, buf, buflen); } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Disable the DMA of the specified SPI port. The */
void SPIPDMADisable(unsigned long ulBase, unsigned long ulDmaMode)
/* Disable the DMA of the specified SPI port. The */ void SPIPDMADisable(unsigned long ulBase, unsigned long ulDmaMode)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE)||(ulBase == SPI3_BASE) ); xHWREG(ulBase + SPI_DMACTL) &= ~ulDmaMode; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* The workaround is only used for device discovery. */
static int lba_device_present(u8 bus, u8 dfn, struct lba_device *d)
/* The workaround is only used for device discovery. */ static int lba_device_present(u8 bus, u8 dfn, struct lba_device *d)
{ u8 first_bus = d->hba.hba_bus->secondary; u8 last_sub_bus = d->hba.hba_bus->subordinate; if ((bus < first_bus) || (bus > last_sub_bus) || ((bus - first_bus) >= LBA_MAX_NUM_BUSES)) { return 0; } return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param isMute true is mute, false is unmute. return kStatus_Success is success, else configure failed. */
status_t HAL_CODEC_SetMute(void *handle, uint32_t playChannel, bool isMute)
/* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param isMute true is mute, false is unmute. return kStatus_Success is success, else configure failed. */ status_t HAL_CODEC_SetMute(void *handle, uint32_t playChannel, bool isMute)
{ assert(handle != NULL); return WM8904_SetChannelMute((wm8904_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)), playChannel, isMute); }
eclipse-threadx/getting-started
C++
Other
310
/* Updates the internal state of the backlight in response to a hardware event, and generate a uevent to notify userspace */
void backlight_force_update(struct backlight_device *bd, enum backlight_update_reason reason)
/* Updates the internal state of the backlight in response to a hardware event, and generate a uevent to notify userspace */ void backlight_force_update(struct backlight_device *bd, enum backlight_update_reason reason)
{ mutex_lock(&bd->ops_lock); if (bd->ops && bd->ops->get_brightness) bd->props.brightness = bd->ops->get_brightness(bd); mutex_unlock(&bd->ops_lock); backlight_generate_event(bd, reason); }
robutest/uclinux
C++
GPL-2.0
60
/* Sends a Byte through the SPI interface and return the Byte received from the SPI bus. */
static uint8_t LIS302DL_SendByte(uint8_t byte)
/* Sends a Byte through the SPI interface and return the Byte received from the SPI bus. */ static uint8_t LIS302DL_SendByte(uint8_t byte)
{ LIS302DLTimeout = LIS302DL_FLAG_TIMEOUT; while (SPI_I2S_GetFlagStatus(LIS302DL_SPI, SPI_I2S_FLAG_TXE) == RESET) { printf("wait reset SPI_I2S_FLAG_TXE\n"); } SPI_I2S_SendData(LIS302DL_SPI, byte); LIS302DLTimeout = LIS302DL_FLAG_TIMEOUT; while (SPI_I2S_GetFlagStatus(LIS302DL_SPI, SPI_I2S_FLAG_RXNE) == RESET) { printf("wait reset SPI_I2S_FLAG_RXNE\n"); } return (uint8_t)SPI_I2S_ReceiveData(LIS302DL_SPI); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Checks whether the specified SPI interrupt has occurred or not. */
ITStatus SPI_GetITStatus(SPI_TypeDef *spi, SPI_IT_TypeDef interrupt)
/* Checks whether the specified SPI interrupt has occurred or not. */ ITStatus SPI_GetITStatus(SPI_TypeDef *spi, SPI_IT_TypeDef interrupt)
{ return (spi->ISR & interrupt) ? SET : RESET; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Setup timeout for a device. On timeout trigger an update. */
static void con3270_set_timer(struct con3270 *cp, int expires)
/* Setup timeout for a device. On timeout trigger an update. */ static void con3270_set_timer(struct con3270 *cp, int expires)
{ if (expires == 0) del_timer(&cp->timer); else mod_timer(&cp->timer, jiffies + expires); }
robutest/uclinux
C++
GPL-2.0
60
/* Sets the number of AC bias pin transitions per interrupt. */
void LCDRasterACBiasIntCountSet(uint32_t ui32Base, uint8_t ui8Count)
/* Sets the number of AC bias pin transitions per interrupt. */ void LCDRasterACBiasIntCountSet(uint32_t ui32Base, uint8_t ui8Count)
{ uint32_t ui32Val; ASSERT(ui32Base == LCD0_BASE); ASSERT(ui8Count < 16); ui32Val = HWREG(ui32Base + LCD_O_RASTRTIM2); ui32Val &= ~LCD_RASTRTIM2_ACBI_M; ui32Val |= ((ui8Count << LCD_RASTRTIM2_ACBI_S) & LCD_RASTRTIM2_ACBI_M); HWREG(ui32Base + LCD_O_RASTRTIM2) = ui32Val; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Function for configuring: PIN_IN pin for input, PIN_OUT pin for output, and configures GPIOTE to give an interrupt on pin change. */
static void gpio_init(void)
/* Function for configuring: PIN_IN pin for input, PIN_OUT pin for output, and configures GPIOTE to give an interrupt on pin change. */ static void gpio_init(void)
{ ret_code_t err_code; err_code = nrf_drv_gpiote_init(); APP_ERROR_CHECK(err_code); nrf_drv_gpiote_out_config_t out_config = GPIOTE_CONFIG_OUT_SIMPLE(false); err_code = nrf_drv_gpiote_out_init(PIN_OUT, &out_config); APP_ERROR_CHECK(err_code); nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(true); in_config.pull = NRF_GPIO_PIN_PULLUP; err_code = nrf_drv_gpiote_in_init(PIN_IN, &in_config, in_pin_handler); APP_ERROR_CHECK(err_code); nrf_drv_gpiote_in_event_enable(PIN_IN, true); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Deinitializes the CAN peripheral registers to their default reset values. */
void CAN_DeInit(CAN_Module *CANx)
/* Deinitializes the CAN peripheral registers to their default reset values. */ void CAN_DeInit(CAN_Module *CANx)
{ assert_param(IS_CAN_ALL_PERIPH(CANx)); RCC_EnableAPB1PeriphReset(RCC_APB1_PERIPH_CAN, ENABLE); RCC_EnableAPB1PeriphReset(RCC_APB1_PERIPH_CAN, DISABLE); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Output: void, but we will add to proto tree if !NULL. */
static void dissect_lsp_mt_reachable_IPv6_prefx_clv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int id_length _U_, int length)
/* Output: void, but we will add to proto tree if !NULL. */ static void dissect_lsp_mt_reachable_IPv6_prefx_clv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, int id_length _U_, int length)
{ if (length < 2) { proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_short_packet, tvb, offset, -1, "short lsp multi-topology reachable IPv6 prefixes(%d vs %d)", length, 2 ); return; } dissect_lsp_mt_id(tvb, tree, offset); dissect_lsp_ipv6_reachability_clv(tvb, pinfo, tree, offset+2, 0, length-2); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Clear the OWNER_MSK, to establish driver (instead of uCode running on embedded controller) as EEPROM reader; each read is a series of pulses to/from the EEPROM chip, not a single event, so even reads could conflict if they weren't arbitrated by some ownership mechanism. Here, the driver simply claims ownership, which should be safe when this function is called (i.e. before loading uCode!). */
static int iwl3945_eeprom_acquire_semaphore(struct iwl_priv *priv)
/* Clear the OWNER_MSK, to establish driver (instead of uCode running on embedded controller) as EEPROM reader; each read is a series of pulses to/from the EEPROM chip, not a single event, so even reads could conflict if they weren't arbitrated by some ownership mechanism. Here, the driver simply claims ownership, which should be safe when this function is called (i.e. before loading uCode!). */ static int iwl3945_eeprom_acquire_semaphore(struct iwl_priv *priv)
{ _iwl_clear_bit(priv, CSR_EEPROM_GP, CSR_EEPROM_GP_IF_OWNER_MSK); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This unregisters and releases a KS8695 ethernet device. */
static int __devexit ks8695_drv_remove(struct platform_device *pdev)
/* This unregisters and releases a KS8695 ethernet device. */ static int __devexit ks8695_drv_remove(struct platform_device *pdev)
{ struct net_device *ndev = platform_get_drvdata(pdev); struct ks8695_priv *ksp = netdev_priv(ndev); platform_set_drvdata(pdev, NULL); netif_napi_del(&ksp->napi); unregister_netdev(ndev); ks8695_release_device(ksp); free_netdev(ndev); dev_dbg(&pdev->dev, "released and freed device\n"); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Stop the interface. The interface is stopped when it is brought. */
static int dm9000_stop(struct net_device *ndev)
/* Stop the interface. The interface is stopped when it is brought. */ static int dm9000_stop(struct net_device *ndev)
{ board_info_t *db = netdev_priv(ndev); if (netif_msg_ifdown(db)) dev_dbg(db->dev, "shutting down %s\n", ndev->name); cancel_delayed_work_sync(&db->phy_poll); netif_stop_queue(ndev); netif_carrier_off(ndev); free_irq(ndev->irq, ndev); dm9000_shutdown(ndev); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Sets the prescaler value of the contrast control PWM. */
void LCD_SetContrastPrescaler(unsigned int prescaler)
/* Sets the prescaler value of the contrast control PWM. */ void LCD_SetContrastPrescaler(unsigned int prescaler)
{ ASSERT((prescaler & ~AT91C_LCDC_PS) == 0, "LCD_SetContrastPrescaler: Wrong prescaler value\n\r"); AT91C_BASE_LCDC->LCDC_CTRSTCON &= ~AT91C_LCDC_PS; AT91C_BASE_LCDC->LCDC_CTRSTCON |= prescaler; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Oversampling is only supported on the sample sequencers that are more than one sample in depth (that is, the fourth sample sequencer is not supported). Oversampling by 2x (for example) divides the depth of the sample sequencer by two; so 2x oversampling on the first sample sequencer can only provide four samples per trigger. This also means that 8x oversampling is only available on the first sample sequencer. */
void ADCSoftwareOversampleConfigure(uint32_t ui32Base, uint32_t ui32SequenceNum, uint32_t ui32Factor)
/* Oversampling is only supported on the sample sequencers that are more than one sample in depth (that is, the fourth sample sequencer is not supported). Oversampling by 2x (for example) divides the depth of the sample sequencer by two; so 2x oversampling on the first sample sequencer can only provide four samples per trigger. This also means that 8x oversampling is only available on the first sample sequencer. */ void ADCSoftwareOversampleConfigure(uint32_t ui32Base, uint32_t ui32SequenceNum, uint32_t ui32Factor)
{ uint32_t ui32Value; uint32_t ui32ADCInst; ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE)); ASSERT(ui32SequenceNum < 3); ASSERT(((ui32Factor == 2) || (ui32Factor == 4) || (ui32Factor == 8)) && ((ui32SequenceNum == 0) || (ui32Factor != 8))); for(ui32Value = 0, ui32Factor >>= 1; ui32Factor; ui32Value++, ui32Factor >>= 1) { } if(ui32Base == ADC0_BASE) { ui32ADCInst = 0; } else { ui32ADCInst = 1; } g_pui8OversampleFactor[ui32ADCInst][ui32SequenceNum] = ui32Value; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* PCI Regions: MEM 0xA0000000 - 0xBFFFFFFF IO 0x00000000 - 0x0000FFFF CONFIG - */
static void realview_pb_pcix_sync(void)
/* PCI Regions: MEM 0xA0000000 - 0xBFFFFFFF IO 0x00000000 - 0x0000FFFF CONFIG - */ static void realview_pb_pcix_sync(void)
{ readl(PCIX_UNIT_BASE + PCI_VENID); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* param base Pointer to FLEXIO_I2S_Type structure. param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state param xfer Pointer to flexio_i2s_transfer_t structure retval kStatus_Success Successfully start the data receive. retval kStatus_FLEXIO_I2S_RxBusy Previous receive still not finished. retval kStatus_InvalidArgument The input parameter is invalid. */
status_t FLEXIO_I2S_TransferReceiveNonBlocking(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, flexio_i2s_transfer_t *xfer)
/* param base Pointer to FLEXIO_I2S_Type structure. param handle Pointer to flexio_i2s_handle_t structure which stores the transfer state param xfer Pointer to flexio_i2s_transfer_t structure retval kStatus_Success Successfully start the data receive. retval kStatus_FLEXIO_I2S_RxBusy Previous receive still not finished. retval kStatus_InvalidArgument The input parameter is invalid. */ status_t FLEXIO_I2S_TransferReceiveNonBlocking(FLEXIO_I2S_Type *base, flexio_i2s_handle_t *handle, flexio_i2s_transfer_t *xfer)
{ assert(handle); if (handle->queue[handle->queueUser].data) { return kStatus_FLEXIO_I2S_QueueFull; } if ((xfer->dataSize == 0) || (xfer->data == NULL)) { return kStatus_InvalidArgument; } handle->queue[handle->queueUser].data = xfer->data; handle->queue[handle->queueUser].dataSize = xfer->dataSize; handle->transferSize[handle->queueUser] = xfer->dataSize; handle->queueUser = (handle->queueUser + 1) % FLEXIO_I2S_XFER_QUEUE_SIZE; handle->state = kFLEXIO_I2S_Busy; FLEXIO_I2S_EnableInterrupts(base, kFLEXIO_I2S_RxDataRegFullInterruptEnable); FLEXIO_I2S_Enable(base, true); return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function returns the current value of the sub second count for the RTC in 1/32768 of a second increments. The only value that can be used with the */
uint32_t HibernateRTCSSGet(void)
/* This function returns the current value of the sub second count for the RTC in 1/32768 of a second increments. The only value that can be used with the */ uint32_t HibernateRTCSSGet(void)
{ return (HWREG(HIB_RTCSS) & HIB_RTCSS_RTCSSC_M); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Error handler timeout function. Indicate that we timed out, and wake up any error handler process so it can continue. */
static void fas216_eh_timer(unsigned long data)
/* Error handler timeout function. Indicate that we timed out, and wake up any error handler process so it can continue. */ static void fas216_eh_timer(unsigned long data)
{ FAS216_Info *info = (FAS216_Info *)data; fas216_log(info, LOG_ERROR, "error handling timed out\n"); del_timer(&info->eh_timer); if (info->rst_bus_status == 0) info->rst_bus_status = -1; if (info->rst_dev_status == 0) info->rst_dev_status = -1; wake_up(&info->eh_wait); }
robutest/uclinux
C++
GPL-2.0
60
/* Set the fields of structure stc_ctc_ct_init_t to default values. */
int32_t CTC_CT_StructInit(stc_ctc_ct_init_t *pstcCtcInit)
/* Set the fields of structure stc_ctc_ct_init_t to default values. */ int32_t CTC_CT_StructInit(stc_ctc_ct_init_t *pstcCtcInit)
{ int32_t i32Ret = LL_ERR_INVD_PARAM; if (NULL != pstcCtcInit) { pstcCtcInit->u32RefClockFreq = 0UL; pstcCtcInit->u32RefClockSrc = CTC_REF_CLK_SRC_CTCREF; pstcCtcInit->u32RefClockDiv = CTC_REF_CLK_DIV8; pstcCtcInit->f32TolerantErrRate = 0.0F; pstcCtcInit->u8TrimValue = 0U; i32Ret = LL_OK; } return i32Ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Check the target status and re-interpret it in EFI_STATUS. */
EFI_STATUS CheckTargetStatus(IN UINT8 TargetStatus)
/* Check the target status and re-interpret it in EFI_STATUS. */ EFI_STATUS CheckTargetStatus(IN UINT8 TargetStatus)
{ switch (TargetStatus) { case EFI_EXT_SCSI_STATUS_TARGET_GOOD: case EFI_EXT_SCSI_STATUS_TARGET_CHECK_CONDITION: case EFI_EXT_SCSI_STATUS_TARGET_CONDITION_MET: return EFI_SUCCESS; case EFI_EXT_SCSI_STATUS_TARGET_INTERMEDIATE: case EFI_EXT_SCSI_STATUS_TARGET_INTERMEDIATE_CONDITION_MET: case EFI_EXT_SCSI_STATUS_TARGET_BUSY: case EFI_EXT_SCSI_STATUS_TARGET_TASK_SET_FULL: return EFI_NOT_READY; case EFI_EXT_SCSI_STATUS_TARGET_RESERVATION_CONFLICT: return EFI_DEVICE_ERROR; default: return EFI_SUCCESS; } }
tianocore/edk2
C++
Other
4,240
/* Returns: 0 when the timer was not active 1 when the timer was active */
int hrtimer_cancel(struct hrtimer *timer)
/* Returns: 0 when the timer was not active 1 when the timer was active */ int hrtimer_cancel(struct hrtimer *timer)
{ for (;;) { int ret = hrtimer_try_to_cancel(timer); if (ret >= 0) return ret; cpu_relax(); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function does not return until the protection has been saved. */
int32_t FlashProtectSave(void)
/* This function does not return until the protection has been saved. */ int32_t FlashProtectSave(void)
{ uint32_t ui32Temp; for(ui32Temp = 0; ui32Temp < 8; ui32Temp++) { HWREG(FLASH_FMA) = ui32Temp; HWREG(FLASH_FMC) = FLASH_FMC_WRKEY | FLASH_FMC_COMT; while(HWREG(FLASH_FMC) & FLASH_FMC_COMT) { } } return(0); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* returns SUCCESS if it successfully copied message into the buffer */
s32 igb_write_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id)
/* returns SUCCESS if it successfully copied message into the buffer */ s32 igb_write_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id)
{ struct e1000_mbx_info *mbx = &hw->mbx; s32 ret_val = 0; if (size > mbx->size) ret_val = -E1000_ERR_MBX; else if (mbx->ops.write) ret_val = mbx->ops.write(hw, msg, size, mbx_id); return ret_val; }
robutest/uclinux
C++
GPL-2.0
60
/* Configure waveform parameters according to the timing of LCD panel. */
static void setup_panel_params(lcdif_sync_waveform_t *syncWave)
/* Configure waveform parameters according to the timing of LCD panel. */ static void setup_panel_params(lcdif_sync_waveform_t *syncWave)
{ syncWave->frameWidth = WVGA_FW; syncWave->frameHeight = WVGA_FH; syncWave->enPresent = 1; syncWave->dotclkPol = 1; syncWave->hsyncPol = 0; syncWave->vSyncPol = 0; syncWave->enablePol = 1; syncWave->vSyncPeriodUnit = 1; syncWave->vSyncPulseUnit = 1; syncWave->vSyncPulseWidth = 10; syncWave->vSyncPeriod = 523; syncWave->hSyncPulseWidth = 10; syncWave->hSyncPeriod = 1063; syncWave->hWaitCount = 99; syncWave->vWaitCount = 33; syncWave->hValidDataCount = 800; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param handle codec handle. param module audio codec module. param powerOn true is power on, false is power down. return kStatus_Success is success, else configure failed. */
status_t CODEC_SetPower(codec_handle_t *handle, codec_module_t module, bool powerOn)
/* param handle codec handle. param module audio codec module. param powerOn true is power on, false is power down. return kStatus_Success is success, else configure failed. */ status_t CODEC_SetPower(codec_handle_t *handle, codec_module_t module, bool powerOn)
{ assert((handle != NULL) && (handle->codecConfig != NULL)); assert(handle->codecCapability != NULL); if ((handle->codecCapability->codecModuleCapability & (1UL << (uint32_t)module)) == 0U) { return kStatus_CODEC_NotSupport; } return HAL_CODEC_SetPower(handle, (uint32_t)module, powerOn); }
eclipse-threadx/getting-started
C++
Other
310
/* Check if the memory address will be mapped by 4KB-page. */
BOOLEAN IsAddressValid(IN EFI_PHYSICAL_ADDRESS Address, IN BOOLEAN *Nx)
/* Check if the memory address will be mapped by 4KB-page. */ BOOLEAN IsAddressValid(IN EFI_PHYSICAL_ADDRESS Address, IN BOOLEAN *Nx)
{ UINTN Index; if (FeaturePcdGet (PcdCpuSmmProfileEnable)) { for (Index = 0; Index < mProtectionMemRangeCount; Index++) { if ((Address >= mProtectionMemRange[Index].Range.Base) && (Address < mProtectionMemRange[Index].Range.Top)) { *Nx = mProtectionMemRange[Index].Nx; return mProtectionMemRange[Index].Present; } } *Nx = TRUE; return FALSE; } else { *Nx = TRUE; if (IsInSmmRanges (Address)) { *Nx = FALSE; } return TRUE; } }
tianocore/edk2
C++
Other
4,240
/* kmalloc only guarantees 8 byte alignment, but we need cmbe pointers to be naturally aligned. Make sure to allocate enough space for two cmbes. */
static struct cmbe* cmbe_align(struct cmbe *c)
/* kmalloc only guarantees 8 byte alignment, but we need cmbe pointers to be naturally aligned. Make sure to allocate enough space for two cmbes. */ static struct cmbe* cmbe_align(struct cmbe *c)
{ unsigned long addr; addr = ((unsigned long)c + sizeof (struct cmbe) - sizeof(long)) & ~(sizeof (struct cmbe) - sizeof(long)); return (struct cmbe*)addr; }
robutest/uclinux
C++
GPL-2.0
60
/* System global reset. Use this function to reset system global. */
void system_global_reset(void)
/* System global reset. Use this function to reset system global. */ void system_global_reset(void)
{ LPMCU_MISC_REGS0->LPMCU_GLOBAL_RESET_0.reg &= \ ~LPMCU_MISC_REGS_LPMCU_GLOBAL_RESET_0_GLOBAL_RSTN; LPMCU_MISC_REGS0->LPMCU_GLOBAL_RESET_0.reg |= \ LPMCU_MISC_REGS_LPMCU_GLOBAL_RESET_0_GLOBAL_RSTN; }
memfault/zero-to-main
C++
null
200
/* Check if a given GUID is defined by _WDG */
bool wmi_has_guid(const char *guid_string)
/* Check if a given GUID is defined by _WDG */ bool wmi_has_guid(const char *guid_string)
{ return find_guid(guid_string, NULL); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Retrieves the new value of a report from the host and saves it. */
static void HIDDJoystickDriver_SetReport(unsigned char type, unsigned short length)
/* Retrieves the new value of a report from the host and saves it. */ static void HIDDJoystickDriver_SetReport(unsigned char type, unsigned short length)
{ TRACE_INFO("sReport "); switch (type) { case HIDReportRequest_INPUT: USBD_Stall(0); break; default: USBD_Stall(0); } }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* Returns 1 if the given PCM format is unsigned linear, 0 if signed linear, and a negative error code for non-linear formats. */
int snd_pcm_format_unsigned(snd_pcm_format_t format)
/* Returns 1 if the given PCM format is unsigned linear, 0 if signed linear, and a negative error code for non-linear formats. */ int snd_pcm_format_unsigned(snd_pcm_format_t format)
{ int val; val = snd_pcm_format_signed(format); if (val < 0) return val; return !val; }
robutest/uclinux
C++
GPL-2.0
60
/* Convert a global physical to socket physical address. */
static unsigned long xp_socket_pa_uv(unsigned long gpa)
/* Convert a global physical to socket physical address. */ static unsigned long xp_socket_pa_uv(unsigned long gpa)
{ return uv_gpa_to_soc_phys_ram(gpa); }
robutest/uclinux
C++
GPL-2.0
60
/* Configures the TIMx Output Compare 5 Fast feature. */
void TIM_ConfigOc5Fast(TIM_Module *TIMx, uint16_t TIM_OCFast)
/* Configures the TIMx Output Compare 5 Fast feature. */ void TIM_ConfigOc5Fast(TIM_Module *TIMx, uint16_t TIM_OCFast)
{ uint16_t tmpccmr3 = 0; assert_param(IsTimList1Module(TIMx)); assert_param(IsTimOcFastState(TIM_OCFast)); tmpccmr3 = TIMx->CCMOD3; tmpccmr3 &= (uint16_t) ~((uint16_t)TIM_CCMOD3_OC5FEN); tmpccmr3 |= (uint16_t)(TIM_OCFast); TIMx->CCMOD3 = tmpccmr3; }
pikasTech/PikaPython
C++
MIT License
1,403
/* offset is updated for use by the caller. */
static void mcpe_dissect_detail_payload_0x40(tvbuff_t *tvb, proto_tree *mcpe_tree, gint *offset)
/* offset is updated for use by the caller. */ static void mcpe_dissect_detail_payload_0x40(tvbuff_t *tvb, proto_tree *mcpe_tree, gint *offset)
{ gint item_size; item_size = 2; proto_tree_add_item(mcpe_tree, hf_mcpe_general_packet_payload_length, tvb, *offset, item_size, ENC_BIG_ENDIAN); *offset += item_size; item_size = 3; proto_tree_add_item(mcpe_tree, hf_mcpe_general_packet_payload_count, tvb, *offset, item_size, ENC_BIG_ENDIAN); *offset += item_size; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This API is used to get the interrupt enable of orient ud_enable in the register 0x2D bit 6. */
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_orient_enable(u8 *orient_enable_u8)
/* This API is used to get the interrupt enable of orient ud_enable in the register 0x2D bit 6. */ BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_orient_enable(u8 *orient_enable_u8)
{ u8 data_u8 = BMA2x2_INIT_VALUE; BMA2x2_RETURN_FUNCTION_TYPE com_rslt = ERROR; if (p_bma2x2 == BMA2x2_NULL) { return E_BMA2x2_NULL_PTR; } else { com_rslt = p_bma2x2->BMA2x2_BUS_READ_FUNC (p_bma2x2->dev_addr, BMA2x2_ORIENT_UD_ENABLE_REG, &data_u8, BMA2x2_GEN_READ_WRITE_LENGTH); *orient_enable_u8 = BMA2x2_GET_BITSLICE (data_u8, BMA2x2_ORIENT_UD_ENABLE); } return com_rslt; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* context: the ds context qual: the buffer type */
static void ds_overflow(struct ds_context *context, enum ds_qualifier qual)
/* context: the ds context qual: the buffer type */ static void ds_overflow(struct ds_context *context, enum ds_qualifier qual)
{ switch (qual) { case ds_bts: if (context->bts_master && context->bts_master->ovfl) context->bts_master->ovfl(context->bts_master); break; case ds_pebs: if (context->pebs_master && context->pebs_master->ovfl) context->pebs_master->ovfl(context->pebs_master); break; } }
EmcraftSystems/linux-emcraft
C++
Other
266