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
/* Exchange data format to be used in this settings */
static int ircomm_param_data_format(void *instance, irda_param_t *param, int get)
/* Exchange data format to be used in this settings */ static int ircomm_param_data_format(void *instance, irda_param_t *param, int get)
{ struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); if (get) param->pv.i = self->settings.data_format; else self->settings.data_format = (__u8) param->pv.i; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Check the status of the Rx buffer of the specified SPI port. */
xtBoolean SPIIsRxEmpty(unsigned long ulBase)
/* Check the status of the Rx buffer of the specified SPI port. */ xtBoolean SPIIsRxEmpty(unsigned long ulBase)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)); return ((xHWREG(ulBase + SPI_SR) & SPI_SR_RXBNE)? xfalse : xtrue); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Find working or non-working DQS enable phase setting. */
static int sdr_find_phase(struct socfpga_sdrseq *seq, int working, const u32 grp, u32 *work, u32 *i, u32 *p)
/* Find working or non-working DQS enable phase setting. */ static int sdr_find_phase(struct socfpga_sdrseq *seq, int working, const u32 grp, u32 *work, u32 *i, u32 *p)
{ const u32 end = seq->misccfg->read_valid_fifo_size + (working ? 0 : 1); int ret; for (; *i < end; (*i)++) { if (working) *p = 0; ret = sdr_find_phase_delay(seq, working, 0, grp, work, seq->iocfg->delay_per_opa_tap, p); if (!ret) return 0; if (*p > seq->iocfg->dqs_en_phase_max) { rw_mgr_inc...
4ms/stm32mp1-baremetal
C++
Other
137
/* Output: PRT_RFD pRfd (pRfd->Status.TimeStampHigh is updated) (pRfd->Status.TimeStampLow is updated) Return: None */
void UpdateRxPktTimeStamp8190(struct net_device *dev, struct ieee80211_rx_stats *stats)
/* Output: PRT_RFD pRfd (pRfd->Status.TimeStampHigh is updated) (pRfd->Status.TimeStampLow is updated) Return: None */ void UpdateRxPktTimeStamp8190(struct net_device *dev, struct ieee80211_rx_stats *stats)
{ struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev); if(stats->bIsAMPDU && !stats->bFirstMPDU) { stats->mac_time[0] = priv->LastRxDescTSFLow; stats->mac_time[1] = priv->LastRxDescTSFHigh; } else { priv->LastRxDescTSFLow = stats->mac_time[0]; priv->LastRxDescTSFHigh = stats->mac_time[1]; } }
robutest/uclinux
C++
GPL-2.0
60
/* param base Pointer to the FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. param xfer FlexIO UART transfer structure. See #flexio_uart_transfer_t. retval kStatus_Success Successfully starts the data transmission. retval kStatus_UART_TxBusy Previous t...
status_t FLEXIO_UART_TransferSendNonBlocking(FLEXIO_UART_Type *base, flexio_uart_handle_t *handle, flexio_uart_transfer_t *xfer)
/* param base Pointer to the FLEXIO_UART_Type structure. param handle Pointer to the flexio_uart_handle_t structure to store the transfer state. param xfer FlexIO UART transfer structure. See #flexio_uart_transfer_t. retval kStatus_Success Successfully starts the data transmission. retval kStatus_UART_TxBusy Previous t...
{ status_t status; if ((0U == xfer->dataSize) || (NULL == xfer->data)) { return kStatus_InvalidArgument; } if (kFLEXIO_UART_TxBusy == handle->txState) { status = kStatus_FLEXIO_UART_TxBusy; } else { handle->txData = xfer->data; handle->txDataSize = xfe...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Check if Sink Request can be met by DPM. */
enum usbc_snk_req_reply_t policy_check_sink_request(const struct device *dev, const uint32_t request_msg)
/* Check if Sink Request can be met by DPM. */ enum usbc_snk_req_reply_t policy_check_sink_request(const struct device *dev, const uint32_t request_msg)
{ struct usbc_port_data *data = dev->data; __ASSERT(data->policy_cb_check_sink_request != NULL, "Callback pointer should not be NULL"); return data->policy_cb_check_sink_request(dev, request_msg); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Write to the DMP memory. This function prevents I2C writes past the bank boundaries. The DMP memory is only accessible when the chip is awake. */
int mpu_write_mem(unsigned short mem_addr, unsigned short length, unsigned char *data)
/* Write to the DMP memory. This function prevents I2C writes past the bank boundaries. The DMP memory is only accessible when the chip is awake. */ int mpu_write_mem(unsigned short mem_addr, unsigned short length, unsigned char *data)
{ unsigned char tmp[2]; if (!data) return -1; if (!st.chip_cfg.sensors) return -1; tmp[0] = (unsigned char)(mem_addr >> 8); tmp[1] = (unsigned char)(mem_addr & 0xFF); if (tmp[1] + length > st.hw->bank_size) return -1; if (i2c_write(st.hw->addr, st.reg->bank_sel, 2, tm...
Luos-io/luos_engine
C++
MIT License
496
/* This function handles EXTI line 2 to 3 interrupts. */
void EXTI2_3_IRQHandler(void)
/* This function handles EXTI line 2 to 3 interrupts. */ void EXTI2_3_IRQHandler(void)
{ HAL_GPIO_EXTI_IRQHandler(ALERT_GPIO_PIN(1)); }
st-one/X-CUBE-USB-PD
C++
null
110
/* Event handler for the USB device Start Of Frame event. */
void EVENT_USB_Device_StartOfFrame(void)
/* Event handler for the USB device Start Of Frame event. */ void EVENT_USB_Device_StartOfFrame(void)
{ HID_Device_MillisecondElapsed(&Joystick_HID_Interface); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Enable the resource. The function returns with error or the content of the register */
int twl4030_codec_enable_resource(enum twl4030_codec_res id)
/* Enable the resource. The function returns with error or the content of the register */ int twl4030_codec_enable_resource(enum twl4030_codec_res id)
{ struct twl4030_codec *codec = platform_get_drvdata(twl4030_codec_dev); int val; if (id >= TWL4030_CODEC_RES_MAX) { dev_err(&twl4030_codec_dev->dev, "Invalid resource ID (%u)\n", id); return -EINVAL; } mutex_lock(&codec->mutex); if (!codec->resource[id].request_count) val = twl4030_codec_set_resource(i...
robutest/uclinux
C++
GPL-2.0
60
/* Returns true if estimator is active, and false if not. */
bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats, const struct gnet_stats_rate_est *rate_est)
/* Returns true if estimator is active, and false if not. */ bool gen_estimator_active(const struct gnet_stats_basic_packed *bstats, const struct gnet_stats_rate_est *rate_est)
{ ASSERT_RTNL(); return gen_find_node(bstats, rate_est) != NULL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Resets the RCC clock configuration to the default reset state. */
void RCC_DeInit(void)
/* Resets the RCC clock configuration to the default reset state. */ void RCC_DeInit(void)
{ RCC->CR |= (uint32_t)0x00000001; RCC->CFGR &= (uint32_t)0xF8FF0000; RCC->CR &= (uint32_t)0xFEF6FFFF; RCC->CR &= (uint32_t)0xFFFBFFFF; RCC->CFGR &= (uint32_t)0xFF80FFFF; RCC->CIR = 0x00000000; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enables the RTC in the Hibernation module. The RTC can be used to wake the processor from hibernation at a certain time, or to generate interrupts at certain times. This function must be called before using any of the RTC features of the Hibernation module. */
void HibernateRTCEnable(void)
/* Enables the RTC in the Hibernation module. The RTC can be used to wake the processor from hibernation at a certain time, or to generate interrupts at certain times. This function must be called before using any of the RTC features of the Hibernation module. */ void HibernateRTCEnable(void)
{ HWREG(HIB_CTL) |= HIB_CTL_RTCEN; }
watterott/WebRadio
C++
null
71
/* Convert an eCryptfs page index into a lower byte offset */
static void ecryptfs_lower_offset_for_extent(loff_t *offset, loff_t extent_num, struct ecryptfs_crypt_stat *crypt_stat)
/* Convert an eCryptfs page index into a lower byte offset */ static void ecryptfs_lower_offset_for_extent(loff_t *offset, loff_t extent_num, struct ecryptfs_crypt_stat *crypt_stat)
{ (*offset) = (crypt_stat->num_header_bytes_at_front + (crypt_stat->extent_size * extent_num)); }
robutest/uclinux
C++
GPL-2.0
60
/* The std dev of the mean is related to the std dev by: */
static double stddev_stats(struct stats *stats)
/* The std dev of the mean is related to the std dev by: */ static double stddev_stats(struct stats *stats)
{ double variance = stats->M2 / (stats->n - 1); double variance_mean = variance / stats->n; return sqrt(variance_mean); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Checks whether the descriptor is owned by DMA. If descriptor is owned by DMA then the OWN bit is set to 1. This API is same for both ring and chain mode. */
bool synopGMAC_is_desc_owned_by_dma(DmaDesc *desc)
/* Checks whether the descriptor is owned by DMA. If descriptor is owned by DMA then the OWN bit is set to 1. This API is same for both ring and chain mode. */ bool synopGMAC_is_desc_owned_by_dma(DmaDesc *desc)
{ return ((desc->status & DescOwnByDma) == DescOwnByDma); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Written by Sven Verdoolaege, K.U.Leuven, Departement Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium */
int main(int argc, char **argv)
/* Written by Sven Verdoolaege, K.U.Leuven, Departement Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium */ int main(int argc, char **argv)
{ struct isl_ctx *ctx = isl_ctx_alloc(); struct isl_basic_set *bset; bset = isl_basic_set_read_from_file(ctx, stdin); bset = isl_basic_set_detect_equalities(bset); isl_basic_set_print(bset, stdout, 0, "", "", ISL_FORMAT_POLYLIB); isl_basic_set_free(bset); isl_ctx_free(ctx); return 0; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* signal remote device to throttle send data (our receive data) */
static void throttle(struct tty_struct *tty)
/* signal remote device to throttle send data (our receive data) */ static void throttle(struct tty_struct *tty)
{ struct slgt_info *info = tty->driver_data; unsigned long flags; if (sanity_check(info, tty->name, "throttle")) return; DBGINFO(("%s throttle\n", info->device_name)); if (I_IXOFF(tty)) send_xchar(tty, STOP_CHAR(tty)); if (tty->termios->c_cflag & CRTSCTS) { spin_lock_irqsave(&info->lock,flags); info->sig...
robutest/uclinux
C++
GPL-2.0
60
/* Lock POSIX mutex with timeout. See IEEE 1003.1 */
int pthread_mutex_timedlock(pthread_mutex_t *m, const struct timespec *abstime)
/* Lock POSIX mutex with timeout. See IEEE 1003.1 */ int pthread_mutex_timedlock(pthread_mutex_t *m, const struct timespec *abstime)
{ int32_t timeout = (int32_t)timespec_to_timeoutms(abstime); return acquire_mutex(m, K_MSEC(timeout)); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Returns the interface ID which was allocated; or -ENODEV if no more interface IDs can be allocated. */
int usb_interface_id(struct usb_configuration *config, struct usb_function *function)
/* Returns the interface ID which was allocated; or -ENODEV if no more interface IDs can be allocated. */ int usb_interface_id(struct usb_configuration *config, struct usb_function *function)
{ unsigned char id = config->next_interface_id; if (id < MAX_CONFIG_INTERFACES) { config->interface[id] = function; config->next_interface_id = id + 1; return id; } return -ENODEV; }
4ms/stm32mp1-baremetal
C++
Other
137
/* See mss_uart.h for details of how to use this function. */
uint8_t MSS_UART_get_modem_status(mss_uart_instance_t *this_uart)
/* See mss_uart.h for details of how to use this function. */ uint8_t MSS_UART_get_modem_status(mss_uart_instance_t *this_uart)
{ uint8_t status = MSS_UART_INVALID_PARAM; ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)); if((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) { status = this_uart->hw_reg->MSR; } return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Called by cgroup_scan_tasks() for each task in a cgroup. Return nonzero to stop the walk through the tasks. */
static void cpuset_do_move_task(struct task_struct *tsk, struct cgroup_scanner *scan)
/* Called by cgroup_scan_tasks() for each task in a cgroup. Return nonzero to stop the walk through the tasks. */ static void cpuset_do_move_task(struct task_struct *tsk, struct cgroup_scanner *scan)
{ struct cgroup *new_cgroup = scan->data; cgroup_attach_task(new_cgroup, tsk); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function calls callback against all memory range of "System RAM" which are marked as IORESOURCE_MEM and IORESOUCE_BUSY. Now, this function is only for "System RAM". */
int walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, void *arg, int(*func)(unsigned long, unsigned long, void *))
/* This function calls callback against all memory range of "System RAM" which are marked as IORESOURCE_MEM and IORESOUCE_BUSY. Now, this function is only for "System RAM". */ int walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, void *arg, int(*func)(unsigned long, unsigned long, void *))
{ struct resource res; unsigned long pfn, len; u64 orig_end; int ret = -1; res.start = (u64) start_pfn << PAGE_SHIFT; res.end = ((u64)(start_pfn + nr_pages) << PAGE_SHIFT) - 1; res.flags = IORESOURCE_MEM | IORESOURCE_BUSY; orig_end = res.end; while ((res.start < res.end) && (find_next_system_ram(&res, "Syste...
EmcraftSystems/linux-emcraft
C++
Other
266
/* 6.. FMS Initiate Upload Sequence (Confirmed Service Id = 12) 6..1. Request Message Parameters */
static void dissect_ff_msg_fms_init_upload_seq_req(tvbuff_t *tvb, gint offset, guint32 length, packet_info *pinfo, proto_tree *tree)
/* 6.. FMS Initiate Upload Sequence (Confirmed Service Id = 12) 6..1. Request Message Parameters */ static void dissect_ff_msg_fms_init_upload_seq_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 Upload Sequence Request"); if (!tree) { return; } sub_tree = proto_tree_add_subtree(tree, tvb, offset, length, ett_ff_fms_init_upload_seq_req, NULL, "FMS Initiate Upload Sequence Request"); proto_tree_add_i...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Execute a request and store result to the DAP_queue Parameters: queue - DAP queue, reqbuf = buffer with DAP request, len = of the request buffer, retbuf = buffer to peek on the result of the DAP operation Return Value: TRUE - Success, FALSE - Error */
BOOL DAP_queue_execute_buf(DAP_queue *queue, const uint8_t *reqbuf, int len, uint8_t **retbuf)
/* Execute a request and store result to the DAP_queue Parameters: queue - DAP queue, reqbuf = buffer with DAP request, len = of the request buffer, retbuf = buffer to peek on the result of the DAP operation Return Value: TRUE - Success, FALSE - Error */ BOOL DAP_queue_execute_buf(DAP_queue *queue, const uint8_t *reqb...
{ uint32_t rsize; if (queue->free_count > 0) { if (DAP_activity_blink(reqbuf)) { main_blink_hid_led(MAIN_LED_FLASH); } if (len > DAP_PACKET_SIZE) { len = DAP_PACKET_SIZE; } queue->free_count--; memcpy(queue->USB_Request[queue->recv_idx], re...
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Fill in the inode based on the ncp_entry_info structure. */
static void ncp_set_attr(struct inode *inode, struct ncp_entry_info *nwinfo)
/* Fill in the inode based on the ncp_entry_info structure. */ static void ncp_set_attr(struct inode *inode, struct ncp_entry_info *nwinfo)
{ struct ncp_server *server = NCP_SERVER(inode); NCP_FINFO(inode)->flags = 0; ncp_update_attrs(inode, nwinfo); DDPRINTK("ncp_read_inode: inode->i_mode = %u\n", inode->i_mode); inode->i_nlink = 1; inode->i_uid = server->m.uid; inode->i_gid = server->m.gid; ncp_update_dates(inode, &nwinfo->i); ncp_update_inode(i...
robutest/uclinux
C++
GPL-2.0
60
/* nametbl_header - print name table header into the given buffer */
static void nametbl_header(struct print_buf *buf, u32 depth)
/* nametbl_header - print name table header into the given buffer */ static void nametbl_header(struct print_buf *buf, u32 depth)
{ tipc_printf(buf, "Type "); if (depth > 1) tipc_printf(buf, "Lower Upper "); if (depth > 2) tipc_printf(buf, "Port Identity "); if (depth > 3) tipc_printf(buf, "Publication"); tipc_printf(buf, "\n-----------"); if (depth > 1) tipc_printf(buf, "--------------------- "); if (d...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Fills each SDIO_Config_T member with its default value. */
void SDIO_ConfigStructInit(SDIO_Config_T *sdioConfig)
/* Fills each SDIO_Config_T member with its default value. */ void SDIO_ConfigStructInit(SDIO_Config_T *sdioConfig)
{ sdioConfig->clockDiv = 0x00; sdioConfig->clockEdge = SDIO_CLOCK_EDGE_RISING; sdioConfig->clockBypass = SDIO_CLOCK_BYPASS_DISABLE; sdioConfig->clockPowerSave = SDIO_CLOCK_POWER_SAVE_DISABLE; sdioConfig->busWide = SDIO_BUSWIDE_1B; sdioConfig->hardwareFlowControl = SDIO_HARDWARE_FLOW_CONTROL_DISABLE; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* ADC Set the Sample Time for a Single Channel. The sampling time can be selected in ADC clock cycles, exact values depend on the device. */
void adc_set_sample_time(uint32_t adc, uint8_t channel, uint8_t time)
/* ADC Set the Sample Time for a Single Channel. The sampling time can be selected in ADC clock cycles, exact values depend on the device. */ void adc_set_sample_time(uint32_t adc, uint8_t channel, uint8_t time)
{ uint32_t reg32; if (channel < 10) { reg32 = ADC_SMPR1(adc); reg32 &= ~(0x7 << (channel * 3)); reg32 |= (time << (channel * 3)); ADC_SMPR1(adc) = reg32; } else { reg32 = ADC_SMPR2(adc); reg32 &= ~(0x7 << ((channel - 10) * 3)); reg32 |= (time << ((channel - 10) * 3)); ADC_SMPR2(adc) = reg32; } }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Init map with DMA pages. It is not problem if some allocations fail - the channels that will not get one DMA page will use standard PIO interface */
static void* diva_pci_alloc_consistent(struct pci_dev *hwdev, size_t size, dma_addr_t *dma_handle, void **addr_handle)
/* Init map with DMA pages. It is not problem if some allocations fail - the channels that will not get one DMA page will use standard PIO interface */ static void* diva_pci_alloc_consistent(struct pci_dev *hwdev, size_t size, dma_addr_t *dma_handle, void **addr_handle)
{ void *addr = pci_alloc_consistent(hwdev, size, dma_handle); *addr_handle = addr; return (addr); }
robutest/uclinux
C++
GPL-2.0
60
/* Instructs the I3C Target device to register itself to the I3C Controller. This routine instructs the I3C Target device to register itself to the I3C Controller via its parent controller's i3c_target_register() API. */
static int cdns_i3c_target_register(const struct device *dev, struct i3c_target_config *cfg)
/* Instructs the I3C Target device to register itself to the I3C Controller. This routine instructs the I3C Target device to register itself to the I3C Controller via its parent controller's i3c_target_register() API. */ static int cdns_i3c_target_register(const struct device *dev, struct i3c_target_config *cfg)
{ struct cdns_i3c_data *data = dev->data; data->target_config = cfg; return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* look for the node record for the given NID */
static struct hda_gnode* hda_get_node(struct hda_gspec *spec, hda_nid_t nid)
/* look for the node record for the given NID */ static struct hda_gnode* hda_get_node(struct hda_gspec *spec, hda_nid_t nid)
{ struct hda_gnode *node; list_for_each_entry(node, &spec->nid_list, list) { if (node->nid == nid) return node; } return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* e1000_sw_init initializes the Adapter private data structure. Fields are initialized based on PCI device information and OS network device settings (MTU size). */
static int __devinit e1000_sw_init(struct e1000_adapter *adapter)
/* e1000_sw_init initializes the Adapter private data structure. Fields are initialized based on PCI device information and OS network device settings (MTU size). */ static int __devinit e1000_sw_init(struct e1000_adapter *adapter)
{ struct net_device *netdev = adapter->netdev; adapter->rx_buffer_len = ETH_FRAME_LEN + VLAN_HLEN + ETH_FCS_LEN; adapter->rx_ps_bsize0 = 128; adapter->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN; adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN; e1000e_set_interrupt_capability(adapter); if (e1000_alloc...
robutest/uclinux
C++
GPL-2.0
60
/* Exactly like fs/open.c:sys_open(), except that it doesn't set the O_LARGEFILE flag. */
asmlinkage long compat_sys_open(const char __user *filename, int flags, int mode)
/* Exactly like fs/open.c:sys_open(), except that it doesn't set the O_LARGEFILE flag. */ asmlinkage long compat_sys_open(const char __user *filename, int flags, int mode)
{ return do_sys_open(AT_FDCWD, filename, flags, mode); }
robutest/uclinux
C++
GPL-2.0
60
/* Checks whether the FLASH Read Out Protection Status is set or not. */
FlagStatus FLASH_GetReadOutProtectionSTS(void)
/* Checks whether the FLASH Read Out Protection Status is set or not. */ FlagStatus FLASH_GetReadOutProtectionSTS(void)
{ FlagStatus readoutstatus = RESET; if ((FLASH->OB & RDPRTL1_MSK) != (uint32_t)RESET) { readoutstatus = SET; } else { readoutstatus = RESET; } return readoutstatus; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Enable the internal pull-up of a Group of Pins. Enable or disable the internal pull-up of one or more pins of GPIO. */
void syscon_pullup(uint16_t gpios, bool en)
/* Enable the internal pull-up of a Group of Pins. Enable or disable the internal pull-up of one or more pins of GPIO. */ void syscon_pullup(uint16_t gpios, bool en)
{ if (en) { SYSCON_PORTA_PULLUP |= gpios; } else { SYSCON_PORTA_PULLUP &= ~gpios; } }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* No special permissions are needed to list attributes except for trusted.* */
static int can_list(struct jfs_ea *ea)
/* No special permissions are needed to list attributes except for trusted.* */ static int can_list(struct jfs_ea *ea)
{ return (strncmp(ea->name, XATTR_TRUSTED_PREFIX, XATTR_TRUSTED_PREFIX_LEN) || capable(CAP_SYS_ADMIN)); }
robutest/uclinux
C++
GPL-2.0
60
/* If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT(). */
VOID* EFIAPI InvalidateDataCacheRange(IN VOID *Address, IN UINTN Length)
/* If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT(). */ VOID* EFIAPI InvalidateDataCacheRange(IN VOID *Address, IN UINTN Length)
{ AsmDataBarrierLoongArch (); return Address; }
tianocore/edk2
C++
Other
4,240
/* Enable the Overrun mode for the selected ADC channels. */
void ADC_OverrunModeCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
/* Enable the Overrun mode for the selected ADC channels. */ void ADC_OverrunModeCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
{ assert_param(IS_ADC_ALL_PERIPH(ADCx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { ADCx->CFGR1 |= (uint32_t)ADC_CFGR1_OVRMOD; } else { ADCx->CFGR1 &= (uint32_t)(~ADC_CFGR1_OVRMOD); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* See _g_freedesktop_dbus_call_add_match_sync() for the synchronous, blocking version of this method. */
void _g_freedesktop_dbus_call_add_match(_GFreedesktopDBus *proxy, const gchar *arg_rule, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
/* See _g_freedesktop_dbus_call_add_match_sync() for the synchronous, blocking version of this method. */ void _g_freedesktop_dbus_call_add_match(_GFreedesktopDBus *proxy, const gchar *arg_rule, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data)
{ g_dbus_proxy_call (G_DBUS_PROXY (proxy), "AddMatch", g_variant_new ("(s)", arg_rule), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, callback, user_data); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Receives data from the TCP/IP server in a blocking manner. */
bool NetAccessReceive(uint8_t *data, uint32_t *length, uint32_t timeout)
/* Receives data from the TCP/IP server in a blocking manner. */ bool NetAccessReceive(uint8_t *data, uint32_t *length, uint32_t timeout)
{ bool result = false; struct timeval tv; ssize_t receivedLen; assert(data != NULL); assert(length != NULL); assert(timeout > 0); if ( (data != NULL) && (length != NULL) && (timeout > 0) ) { if (netAccessSocket >= 0) { tv.tv_sec = (__time_t)(timeout / 1000u); tv.tv_usec = (timeout % ...
feaser/openblt
C++
GNU General Public License v3.0
601
/* Initializes and configures the Ambiant light Sensor and configures all necessary hardware resources (GPIOs, I2C, clocks..). */
int32_t BSP_LIGHT_SENSOR_Init(uint32_t Instance)
/* Initializes and configures the Ambiant light Sensor and configures all necessary hardware resources (GPIOs, I2C, clocks..). */ int32_t BSP_LIGHT_SENSOR_Init(uint32_t Instance)
{ int32_t status = BSP_ERROR_NONE; if (Instance >= LIGHT_SENSOR_INSTANCES_NBR) { status = BSP_ERROR_WRONG_PARAM; } else { if(VEML6030_Probe(Instance)!= BSP_ERROR_NONE) { status = BSP_ERROR_COMPONENT_FAILURE; } else { LIGHT_SENSOR_Ctx[Instance].Gain = VEML6030_CONF_GAIN_1 ...
eclipse-threadx/getting-started
C++
Other
310
/* this function does not check for built in alias'. */
EFI_STATUS InternalSetAlias(IN CONST CHAR16 *Command, IN CONST CHAR16 *Alias, IN BOOLEAN Volatile)
/* this function does not check for built in alias'. */ EFI_STATUS InternalSetAlias(IN CONST CHAR16 *Command, IN CONST CHAR16 *Alias, IN BOOLEAN Volatile)
{ EFI_STATUS Status; CHAR16 *AliasLower; BOOLEAN DeleteAlias; DeleteAlias = FALSE; if (Alias == NULL) { Alias = Command; DeleteAlias = TRUE; } ASSERT (Alias != NULL); AliasLower = AllocateCopyPool (StrSize (Alias), Alias); if (AliasLower == NULL) { return EFI_OUT_OF_RESOURC...
tianocore/edk2
C++
Other
4,240
/* Release resources when all the ports and offloading have been stopped. */
static void cxgb_down(struct adapter *adapter)
/* Release resources when all the ports and offloading have been stopped. */ static void cxgb_down(struct adapter *adapter)
{ t3_sge_stop(adapter); spin_lock_irq(&adapter->work_lock); t3_intr_disable(adapter); spin_unlock_irq(&adapter->work_lock); free_irq_resources(adapter); quiesce_rx(adapter); flush_workqueue(cxgb3_wq); }
robutest/uclinux
C++
GPL-2.0
60
/* If 32-bit MMIO register operations are not supported, then ASSERT(). */
UINT32 EFIAPI MmioWrite32(IN UINTN Address, IN UINT32 Value)
/* If 32-bit MMIO register operations are not supported, then ASSERT(). */ UINT32 EFIAPI MmioWrite32(IN UINTN Address, IN UINT32 Value)
{ ASSERT ((Address & 3) == 0); return (UINT32)MmioWriteWorker (Address, EfiCpuIoWidthUint32, Value); }
tianocore/edk2
C++
Other
4,240
/* Slave fill up the TX FIFO with data. This is not a public API. */
static void LPSPI_SlaveTransferFillUpTxFifo(LPSPI_Type *base, lpspi_slave_handle_t *handle)
/* Slave fill up the TX FIFO with data. This is not a public API. */ static void LPSPI_SlaveTransferFillUpTxFifo(LPSPI_Type *base, lpspi_slave_handle_t *handle)
{ assert(handle); uint32_t wordToSend = 0U; uint8_t bytesEachWrite = handle->bytesEachWrite; bool isByteSwap = handle->isByteSwap; while (LPSPI_GetTxFifoCount(base) < (handle->fifoSize)) { if (handle->txRemainingByteCount < (size_t)bytesEachWrite) { handle->...
eclipse-threadx/getting-started
C++
Other
310
/* Reads the firmware revision of the Si7021 chip. */
uint32_t SI7021_getFwRev(uint8_t *fwRev)
/* Reads the firmware revision of the Si7021 chip. */ uint32_t SI7021_getFwRev(uint8_t *fwRev)
{ uint32_t status; uint8_t cmdReadFwRev[2] = SI7021_CMD_READ_FW_REV; status = SI7021_cmdRead( cmdReadFwRev, 2, fwRev, 1 ); return status; }
remotemcu/remcu-chip-sdks
C++
null
436
/* If a directory had nlink == 1, then we should let it be 1. This indicates directory has >EXT4_LINK_MAX subdirs. */
static void ext4_dec_count(handle_t *handle, struct inode *inode)
/* If a directory had nlink == 1, then we should let it be 1. This indicates directory has >EXT4_LINK_MAX subdirs. */ static void ext4_dec_count(handle_t *handle, struct inode *inode)
{ drop_nlink(inode); if (S_ISDIR(inode->i_mode) && inode->i_nlink == 0) inc_nlink(inode); }
robutest/uclinux
C++
GPL-2.0
60
/* USART Disable RX pin active level inversion. @This bit field can only be written when the USART is disabled. */
void usart_disable_rx_inversion(uint32_t usart)
/* USART Disable RX pin active level inversion. @This bit field can only be written when the USART is disabled. */ void usart_disable_rx_inversion(uint32_t usart)
{ USART_CR2(usart) &= ~USART_CR2_RXINV; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* ic3_startup_local - Start up the serial port - returns >= 0 if no errors @the_port: Port to operate on */
static int ic3_startup_local(struct uart_port *the_port)
/* ic3_startup_local - Start up the serial port - returns >= 0 if no errors @the_port: Port to operate on */ static int ic3_startup_local(struct uart_port *the_port)
{ struct ioc3_port *port; if (!the_port) { NOT_PROGRESS(); return -1; } port = get_ioc3_port(the_port); if (!port) { NOT_PROGRESS(); return -1; } local_open(port); ioc3_set_proto(port, IS_RS232(the_port->line) ? PROTO_RS232 : PROTO_RS422); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This function also performs validation of the ACPI table fields. */
VOID EFIAPI ParseAcpiBgrt(IN BOOLEAN Trace, IN UINT8 *Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision)
/* This function also performs validation of the ACPI table fields. */ VOID EFIAPI ParseAcpiBgrt(IN BOOLEAN Trace, IN UINT8 *Ptr, IN UINT32 AcpiTableLength, IN UINT8 AcpiTableRevision)
{ if (!Trace) { return; } ParseAcpi ( Trace, 0, "BGRT", Ptr, AcpiTableLength, PARSER_PARAMS (BgrtParser) ); }
tianocore/edk2
C++
Other
4,240
/* ISR to manage the transmission of bits via the software UART. */
ISR(TIMER3_COMPA_vect, ISR_BLOCK)
/* ISR to manage the transmission of bits via the software UART. */ ISR(TIMER3_COMPA_vect, ISR_BLOCK)
{ if (TX_BitsRemaining) { if (TX_Data & (1 << 0)) STXPORT &= ~(1 << STX); else STXPORT |= (1 << STX); TX_Data >>= 1; TX_BitsRemaining--; } else if (!(RX_BitsRemaining) && !(RingBuffer_IsEmpty(&USBtoUART_Buffer))) { STXPORT &= ~(1 << STX); TX_Data = ~RingBuffer_Remove(&USBtoUART_Buffer...
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* This function tranfers 1 data sector from RAM to memory. */
Ctrl_status nand_flash_ram_2_mem(uint32_t addr, const void *ram)
/* This function tranfers 1 data sector from RAM to memory. */ Ctrl_status nand_flash_ram_2_mem(uint32_t addr, const void *ram)
{ if (nand_flash_status == NAND_FLASH_READY) { if (!nand_flash_write((addr * SECTOR_SIZE), ram, SECTOR_SIZE)) { return CTRL_GOOD; } return CTRL_FAIL; } return CTRL_BUSY; }
remotemcu/remcu-chip-sdks
C++
null
436
/* free_trial_cpuset - free the trial cpuset @trial: the trial cpuset to be freed */
static void free_trial_cpuset(struct cpuset *trial)
/* free_trial_cpuset - free the trial cpuset @trial: the trial cpuset to be freed */ static void free_trial_cpuset(struct cpuset *trial)
{ free_cpumask_var(trial->cpus_allowed); kfree(trial); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Check if there is data received by USART. */
bool _usart_sync_is_byte_received(const struct _usart_sync_device *const device)
/* Check if there is data received by USART. */ bool _usart_sync_is_byte_received(const struct _usart_sync_device *const device)
{ return hri_sercomusart_get_interrupt_RXC_bit(device->hw); }
eclipse-threadx/getting-started
C++
Other
310
/* Shrink a buffer toward the end of its previous space. Afterward, buffer_delete() remains the means of cleaning it up */
static void buffer_seek(struct buffer *b, size_t size)
/* Shrink a buffer toward the end of its previous space. Afterward, buffer_delete() remains the means of cleaning it up */ static void buffer_seek(struct buffer *b, size_t size)
{ b->offset += size; b->size -= size; b->data += size; }
4ms/stm32mp1-baremetal
C++
Other
137
/* sparc32_execve() executes a new program after the asm stub has set things up for us. This should basically do what I want it to. */
asmlinkage long sparc32_execve(struct pt_regs *regs)
/* sparc32_execve() executes a new program after the asm stub has set things up for us. This should basically do what I want it to. */ asmlinkage long sparc32_execve(struct pt_regs *regs)
{ int error, base = 0; char *filename; if ((u32)regs->u_regs[UREG_G1] == 0) base = 1; filename = getname(compat_ptr(regs->u_regs[base + UREG_I0])); error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; error = compat_do_execve(filename, compat_ptr(regs->u_regs[base + UREG_I1]), compat_ptr(regs...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Attribute read call back for the Descriptor V9D2 (128-bit UUID) attribute. */
static ssize_t read_des_v9d2__128_bit_uuid(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset)
/* Attribute read call back for the Descriptor V9D2 (128-bit UUID) attribute. */ static ssize_t read_des_v9d2__128_bit_uuid(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset)
{ const uint8_t *value = attr->user_data; return bt_gatt_attr_read(conn, attr, buf, len, offset, value, sizeof(des_v9d2__128_bit_uuid_value)); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Compute the # bytes in a row-aligned tile. */
uint64 TIFFTileSize64(TIFF *tif)
/* Compute the # bytes in a row-aligned tile. */ uint64 TIFFTileSize64(TIFF *tif)
{ return (TIFFVTileSize64(tif, tif->tif_dir.td_tilelength)); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Puts the SoundScape into "MIDI" mode, as compared to "host" mode */
static void set_midi_mode_unsafe(unsigned io_base)
/* Puts the SoundScape into "MIDI" mode, as compared to "host" mode */ static void set_midi_mode_unsafe(unsigned io_base)
{ outb(0x3, HOST_CTRL_IO(io_base)); }
robutest/uclinux
C++
GPL-2.0
60
/* Enables or disables the specified SRAM1/2 parity error reset. */
void RCC_ConfigSRAMParityErrorRESET(uint32_t SramErrorReset, FunctionalState Cmd)
/* Enables or disables the specified SRAM1/2 parity error reset. */ void RCC_ConfigSRAMParityErrorRESET(uint32_t SramErrorReset, FunctionalState Cmd)
{ assert_param(IS_RCC_SRAMERRORRESET(SramErrorReset)); assert_param(IS_FUNCTIONAL_STATE(Cmd)); if (Cmd != DISABLE) { RCC->SRAM_CTRLSTS |= SramErrorReset; } else { RCC->SRAM_CTRLSTS &= (~SramErrorReset); } }
pikasTech/PikaPython
C++
MIT License
1,403
/* Read and write a data element from and to the SPI interface. */
unsigned long SPISingleDataReadWrite(unsigned long ulBase, unsigned long ulWData)
/* Read and write a data element from and to the SPI interface. */ unsigned long SPISingleDataReadWrite(unsigned long ulBase, unsigned long ulWData)
{ unsigned long ulRData; xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)); while(!(xHWREGB(ulBase + SPI_S) & SPI_S_SPTEF)) { } xHWREGB(ulBase + SPI_D) = (unsigned char)ulWData; while(!(xHWREGB(ulBase + SPI_S) & SPI_S_SPRF)) { } ulRData = xHWREGB(ulBase + SPI_D); retur...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Returns: a pointer to the newly-allocated copy of the memory, or NULL if @mem is NULL. */
gpointer g_memdup(gconstpointer mem, guint byte_size)
/* Returns: a pointer to the newly-allocated copy of the memory, or NULL if @mem is NULL. */ gpointer g_memdup(gconstpointer mem, guint byte_size)
{ gpointer new_mem; if (mem) { new_mem = g_malloc (byte_size); memcpy (new_mem, mem, byte_size); } else new_mem = NULL; return new_mem; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Gets the baud clock source for the specified UART. */
uint32_t UARTClockSourceGet(uint32_t ui32Base)
/* Gets the baud clock source for the specified UART. */ uint32_t UARTClockSourceGet(uint32_t ui32Base)
{ ASSERT(_UARTBaseValid(ui32Base)); return (HWREG(ui32Base + UART_O_CC)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Calculate a checksum over a chain of pbufs (without pseudo-header, much like inet_chksum only pbufs are used). */
u16_t inet_chksum_pbuf(struct pbuf *p)
/* Calculate a checksum over a chain of pbufs (without pseudo-header, much like inet_chksum only pbufs are used). */ u16_t inet_chksum_pbuf(struct pbuf *p)
{ u32_t acc; struct pbuf *q; u8_t swapped; acc = 0; swapped = 0; for(q = p; q != NULL; q = q->next) { acc += LWIP_CHKSUM(q->payload, q->len); while ((acc >> 16) != 0) { acc = (acc & 0xffffUL) + (acc >> 16); } if (q->len % 2 != 0) { swapped = 1 - swapped; acc = (acc & 0x00ff...
apopple/Pandaboard-FreeRTOS
C++
null
25
/* This file is part of the Simba project. */
int mock_write_midi_note_to_frequency(int note, float res)
/* This file is part of the Simba project. */ int mock_write_midi_note_to_frequency(int note, float res)
{ harness_mock_write("midi_note_to_frequency(note)", &note, sizeof(note)); harness_mock_write("midi_note_to_frequency(): return (res)", &res, sizeof(res)); return (0); }
eerimoq/simba
C++
Other
337
/* This routine purges the input queue of those frames that have been acknowledged. This replaces the boxes labelled "V(a) <- N(r)" on the SDL diagram. */
void lapb_frames_acked(struct lapb_cb *lapb, unsigned short nr)
/* This routine purges the input queue of those frames that have been acknowledged. This replaces the boxes labelled "V(a) <- N(r)" on the SDL diagram. */ void lapb_frames_acked(struct lapb_cb *lapb, unsigned short nr)
{ struct sk_buff *skb; int modulus; modulus = (lapb->mode & LAPB_EXTENDED) ? LAPB_EMODULUS : LAPB_SMODULUS; if (lapb->va != nr) while (skb_peek(&lapb->ack_queue) && lapb->va != nr) { skb = skb_dequeue(&lapb->ack_queue); kfree_skb(skb); lapb->va = (lapb->va + 1) % modulus; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* User task that triggers measurements of sensor1 every 2 seconds and uses */
void user_task_sensor2(void *pvParameters)
/* User task that triggers measurements of sensor1 every 2 seconds and uses */ void user_task_sensor2(void *pvParameters)
{ bme680_values_float_t values; TickType_t last_wakeup = xTaskGetTickCount(); while (1) { if (bme680_force_measurement (sensor2)) { while (bme680_is_measuring (sensor2)) ; if (bme680_get_results_float (sensor2, &values)) printf("%.3f BME680 Sensor2...
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* Hash for the output device based upon layer 2 and layer 3 data. If the packet is not IP mimic bond_xmit_hash_policy_l2() */
static int bond_xmit_hash_policy_l23(struct sk_buff *skb, int count)
/* Hash for the output device based upon layer 2 and layer 3 data. If the packet is not IP mimic bond_xmit_hash_policy_l2() */ static int bond_xmit_hash_policy_l23(struct sk_buff *skb, int count)
{ struct ethhdr *data = (struct ethhdr *)skb->data; struct iphdr *iph = ip_hdr(skb); if (skb->protocol == htons(ETH_P_IP)) { return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^ (data->h_dest[5] ^ data->h_source[5])) % count; } return (data->h_dest[5] ^ data->h_source[5]) % count; }
robutest/uclinux
C++
GPL-2.0
60
/* verifies that source id is not taken by another client, calls device handler to send requests to the device */
int smsclient_sendrequest(struct smscore_client_t *client, void *buffer, size_t size)
/* verifies that source id is not taken by another client, calls device handler to send requests to the device */ int smsclient_sendrequest(struct smscore_client_t *client, void *buffer, size_t size)
{ struct smscore_device_t *coredev; struct SmsMsgHdr_ST *phdr = (struct SmsMsgHdr_ST *) buffer; int rc; if (client == NULL) { sms_err("Got NULL client"); return -EINVAL; } coredev = client->coredev; if (coredev == NULL) { sms_err("Got NULL coredev"); return -EINVAL; } rc = smscore_validate_client(clien...
robutest/uclinux
C++
GPL-2.0
60
/* Checks if this is a QLogic FAS 408 */
int qlogicfas408_detect(int qbase, int int_type)
/* Checks if this is a QLogic FAS 408 */ int qlogicfas408_detect(int qbase, int int_type)
{ REG1; return (((inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7) && ((inb(qbase + 0xe) ^ inb(qbase + 0xe)) == 7));}
robutest/uclinux
C++
GPL-2.0
60
/* Enable interrupts for a specified integrated USB DMA channel. */
void USBDMAChannelIntEnable(uint32_t ui32Base, uint32_t ui32Channel)
/* Enable interrupts for a specified integrated USB DMA channel. */ void USBDMAChannelIntEnable(uint32_t ui32Base, uint32_t ui32Channel)
{ ASSERT(ui32Base == USB0_BASE); ASSERT(ui32Channel < 8); HWREG(ui32Base + USB_O_DMACTL0 + (0x10 * ui32Channel)) |= USB_DMACTL0_IE; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns the number of bytes remaining from last DMA transfer. */
static size_t parport_ip32_dma_get_residue(void)
/* Returns the number of bytes remaining from last DMA transfer. */ static size_t parport_ip32_dma_get_residue(void)
{ return parport_ip32_dma.left; }
robutest/uclinux
C++
GPL-2.0
60
/* This routine is invoked to stop an SLI4 device port, it stops the device from generating interrupts and stops the device driver's timers for the device. */
static void lpfc_stop_port_s4(struct lpfc_hba *phba)
/* This routine is invoked to stop an SLI4 device port, it stops the device from generating interrupts and stops the device driver's timers for the device. */ static void lpfc_stop_port_s4(struct lpfc_hba *phba)
{ lpfc_stop_hba_timers(phba); phba->pport->work_port_events = 0; phba->sli4_hba.intr_enable = 0; phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE; }
robutest/uclinux
C++
GPL-2.0
60
/* Unregisters an interrupt handler for an Ethernet interrupt. */
void EthernetIntUnregister(unsigned long ulBase)
/* Unregisters an interrupt handler for an Ethernet interrupt. */ void EthernetIntUnregister(unsigned long ulBase)
{ ASSERT(ulBase == ETH_BASE); IntDisable(INT_ETH); IntUnregister(INT_ETH); }
watterott/WebRadio
C++
null
71
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT16 EFIAPI PciBitFieldRead16(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). If StartBit is greater than 15, then ASSERT(). If EndBit is greater than 15, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */ UINT16 EFIAPI PciBitFieldRead16(IN UINTN Address, IN UINTN StartBit, IN...
{ return mRunningOnQ35 ? PciExpressBitFieldRead16 (Address, StartBit, EndBit) : PciCf8BitFieldRead16 (Address, StartBit, EndBit); }
tianocore/edk2
C++
Other
4,240
/* The example of the function of read and write. */
void M24LCxxReadWrite(void)
/* The example of the function of read and write. */ void M24LCxxReadWrite(void)
{ unsigned long i; xSysCtlClockSet(72000000, xSYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ); UartInit(); M24LCxxInit(); M24LCxxWaitEepromStandbyState(); UartPrintfChar('\r'); UartPrintfChar('\n'); M24LCxxBufferWrite(ucWriteData, WriteAddress, Length); M24LCxxBufferRead(ucReadData, WriteAddr...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* SPI Set Unidirectional Mode. The SPI peripheral is set for unidirectional transfers. This is used in full duplex mode or when the SPI is placed in two-wire simplex mode that uses a clock wire and a unidirectional data wire. */
void spi_set_unidirectional_mode(uint32_t spi)
/* SPI Set Unidirectional Mode. The SPI peripheral is set for unidirectional transfers. This is used in full duplex mode or when the SPI is placed in two-wire simplex mode that uses a clock wire and a unidirectional data wire. */ void spi_set_unidirectional_mode(uint32_t spi)
{ SPI_CR1(spi) &= ~SPI_CR1_BIDIMODE; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* NOTE: When a valid device is found, its refcount is incremented, and must be decremented before the returned reference. */
struct amba_device* amba_find_device(const char *busid, struct device *parent, unsigned int id, unsigned int mask)
/* NOTE: When a valid device is found, its refcount is incremented, and must be decremented before the returned reference. */ struct amba_device* amba_find_device(const char *busid, struct device *parent, unsigned int id, unsigned int mask)
{ struct find_data data; data.dev = NULL; data.parent = parent; data.busid = busid; data.id = id; data.mask = mask; bus_for_each_dev(&amba_bustype, NULL, &data, amba_find_match); return data.dev; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* wait_for_cmd_complete - waits for a command to complete. @sp : private member of the device structure, which is a pointer to the s2io_nic structure. Description: Function that waits for a command to Write into RMAC ADDR DATA registers to be completed and returns either success or error depending on whether the comma...
static int wait_for_cmd_complete(void __iomem *addr, u64 busy_bit, int bit_state)
/* wait_for_cmd_complete - waits for a command to complete. @sp : private member of the device structure, which is a pointer to the s2io_nic structure. Description: Function that waits for a command to Write into RMAC ADDR DATA registers to be completed and returns either success or error depending on whether the comma...
{ int ret = FAILURE, cnt = 0, delay = 1; u64 val64; if ((bit_state != S2IO_BIT_RESET) && (bit_state != S2IO_BIT_SET)) return FAILURE; do { val64 = readq(addr); if (bit_state == S2IO_BIT_RESET) { if (!(val64 & busy_bit)) { ret = SUCCESS; break; } } else { if (val64 & busy_bit) { ret = SU...
robutest/uclinux
C++
GPL-2.0
60
/* Set when user wants to generate interrupt on count overflow event/every step.. */
int32_t lsm6dso_pedo_int_mode_get(stmdev_ctx_t *ctx, lsm6dso_carry_count_en_t *val)
/* Set when user wants to generate interrupt on count overflow event/every step.. */ int32_t lsm6dso_pedo_int_mode_get(stmdev_ctx_t *ctx, lsm6dso_carry_count_en_t *val)
{ lsm6dso_pedo_cmd_reg_t reg; int32_t ret; ret = lsm6dso_ln_pg_read_byte(ctx, LSM6DSO_PEDO_CMD_REG, (uint8_t *)&reg); switch (reg.carry_count_en) { case LSM6DSO_EVERY_STEP: *val = LSM6DSO_EVERY_STEP; break; case LSM6DSO_COUNT_OVERFLOW: *val = LSM6DSO_COU...
eclipse-threadx/getting-started
C++
Other
310
/* Gets the timer match value for a 64-bit timer. */
unsigned long long TimerMatchGet64(unsigned long ulBase)
/* Gets the timer match value for a 64-bit timer. */ unsigned long long TimerMatchGet64(unsigned long ulBase)
{ unsigned long ulHigh1, ulHigh2, ulLow; ASSERT(TimerBaseValid(ulBase)); do { ulHigh1 = HWREG(ulBase + TIMER_O_TBMATCHR); ulLow = HWREG(ulBase + TIMER_O_TAMATCHR); ulHigh2 = HWREG(ulBase + TIMER_O_TBMATCHR); } while(ulHigh1 != ulHigh2); return(((unsigned long long)ulH...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Checks if any Ipv4 header checksum error in the frame just transmitted. This serves as indication that error occureed in the IPv4 header checksum insertion. The sent out frame doesnot carry any ipv4 header checksum inserted by the hardware. */
bool synopGMAC_is_tx_ipv4header_checksum_error(synopGMACdevice *gmacdev, u32 status)
/* Checks if any Ipv4 header checksum error in the frame just transmitted. This serves as indication that error occureed in the IPv4 header checksum insertion. The sent out frame doesnot carry any ipv4 header checksum inserted by the hardware. */ bool synopGMAC_is_tx_ipv4header_checksum_error(synopGMACdevice *gmacdev,...
{ return ((status & DescTxIpv4ChkError) == DescTxIpv4ChkError); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The calling driver must be in VSTAT_DRIVER_OK state. */
VOID EFIAPI VirtioPrepare(IN OUT VRING *Ring, OUT DESC_INDICES *Indices)
/* The calling driver must be in VSTAT_DRIVER_OK state. */ VOID EFIAPI VirtioPrepare(IN OUT VRING *Ring, OUT DESC_INDICES *Indices)
{ *Ring->Avail.Flags = (UINT16)VRING_AVAIL_F_NO_INTERRUPT; Indices->HeadDescIdx = 0; Indices->NextDescIdx = Indices->HeadDescIdx; }
tianocore/edk2
C++
Other
4,240
/* Usb hub control transfer to get the port status. */
EFI_STATUS UsbHubCtrlGetPortStatus(IN USB_DEVICE *HubDev, IN UINT8 Port, OUT VOID *State)
/* Usb hub control transfer to get the port status. */ EFI_STATUS UsbHubCtrlGetPortStatus(IN USB_DEVICE *HubDev, IN UINT8 Port, OUT VOID *State)
{ EFI_STATUS Status; Status = UsbCtrlRequest ( HubDev, EfiUsbDataIn, USB_REQ_TYPE_CLASS, USB_HUB_TARGET_PORT, USB_HUB_REQ_GET_STATUS, 0, (UINT16)(Port + 1), State, 4 ); return Status;...
tianocore/edk2
C++
Other
4,240
/* Convert a hexadecimal characters to a number (0..15) */
static uint8_t hex_char_to_num(char hex)
/* Convert a hexadecimal characters to a number (0..15) */ static uint8_t hex_char_to_num(char hex)
{ if(hex >= '0' && hex <= '9') { return hex - '0'; } if(hex >= 'a') hex -= 'a' - 'A'; switch(hex) { case 'A': return 10; case 'B': return 11; case 'C': return 12; case 'D': return 13; case 'E': re...
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* Ascii internet address interpretation routine. The value returned is in network order. */
u32_t inet_addr(const char *cp)
/* Ascii internet address interpretation routine. The value returned is in network order. */ u32_t inet_addr(const char *cp)
{ struct in_addr val; if (inet_aton(cp, &val)) { return (val.s_addr); } return (INADDR_NONE); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* param behavior The behavior of 1MHz output clock, please refer to clock_1MHzOut_behavior_t for details. */
void CLOCK_OSC_Set1MHzOutputBehavior(clock_1MHzOut_behavior_t behavior)
/* param behavior The behavior of 1MHz output clock, please refer to clock_1MHzOut_behavior_t for details. */ void CLOCK_OSC_Set1MHzOutputBehavior(clock_1MHzOut_behavior_t behavior)
{ uint32_t tmp32; tmp32 = ANATOP_AI_Read(kAI_Itf_400m, kAI_RCOSC400M_CTRL3); tmp32 &= ~(AI_RCOSC400M_CTRL3_EN_1M_CLK_MASK | AI_RCOSC400M_CTRL3_MUX_1M_CLK_MASK); if (behavior == kCLOCK_1MHzOutDisable) { tmp32 |= AI_RCOSC400M_CTRL3_EN_1M_CLK_MASK; } else { if (behavior == k...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This API is used to move the data index ahead of the current_frame_length parameter when unnecessary FIFO data appears while extracting the user specified data. */
static void move_next_frame(uint16_t *data_index, uint8_t current_frame_length, const struct bma4_dev *dev)
/* This API is used to move the data index ahead of the current_frame_length parameter when unnecessary FIFO data appears while extracting the user specified data. */ static void move_next_frame(uint16_t *data_index, uint8_t current_frame_length, const struct bma4_dev *dev)
{ if ((*data_index + current_frame_length) > dev->fifo->length) { *data_index = dev->fifo->length; } else { *data_index = *data_index + current_frame_length; } }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* Utility to ready all the lists used by the scheduler. This is called automatically upon the creation of the first co-routine. */
static void prvInitialiseCoRoutineLists(void)
/* Utility to ready all the lists used by the scheduler. This is called automatically upon the creation of the first co-routine. */ static void prvInitialiseCoRoutineLists(void)
{ UBaseType_t uxPriority; for( uxPriority = 0; uxPriority < configMAX_CO_ROUTINE_PRIORITIES; uxPriority++ ) { vListInitialise( ( List_t * ) &( pxReadyCoRoutineLists[ uxPriority ] ) ); } vListInitialise( ( List_t * ) &xDelayedCoRoutineList1 ); vListInitialise( ( List_t * ) &xDelayedCoRoutineList2 ); vListInitial...
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* Enables or disables the Internal Low Speed oscillator (LSI). */
void RCC_LSICmd(FunctionalState NewState)
/* Enables or disables the Internal Low Speed oscillator (LSI). */ void RCC_LSICmd(FunctionalState NewState)
{ assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { RCC->CSR |= RCC_CSR_LSION; } else { RCC->CSR &= ~RCC_CSR_LSION; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Shut off the Flash and execute the _WFI(), then power up the Flash after wake-up event. */
void POWER_CycleCpuAndFlash(void)
/* Shut off the Flash and execute the _WFI(), then power up the Flash after wake-up event. */ void POWER_CycleCpuAndFlash(void)
{ (*(s_lowpowerDriver->power_cycle_cpu_and_flash))(); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Determines whether the UART transmitter is busy or not. */
bool UARTBusy(uint32_t ui32Base)
/* Determines whether the UART transmitter is busy or not. */ bool UARTBusy(uint32_t ui32Base)
{ ASSERT(_UARTBaseValid(ui32Base)); return ((HWREG(ui32Base + UART_O_FR) & UART_FR_BUSY) ? true : false); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Remove a multicast address from slave according to mode */
static void bond_mc_delete(struct bonding *bond, void *addr, int alen)
/* Remove a multicast address from slave according to mode */ static void bond_mc_delete(struct bonding *bond, void *addr, int alen)
{ if (USES_PRIMARY(bond->params.mode)) { if (bond->curr_active_slave) dev_mc_delete(bond->curr_active_slave->dev, addr, alen, 0); } else { struct slave *slave; int i; bond_for_each_slave(bond, slave, i) { dev_mc_delete(slave->dev, addr, alen, 0); } } }
robutest/uclinux
C++
GPL-2.0
60
/* find_listener - find a cm node listening on this addr-port pair */
static struct nes_cm_listener* find_listener(struct nes_cm_core *cm_core, nes_addr_t dst_addr, u16 dst_port, enum nes_cm_listener_state listener_state)
/* find_listener - find a cm node listening on this addr-port pair */ static struct nes_cm_listener* find_listener(struct nes_cm_core *cm_core, nes_addr_t dst_addr, u16 dst_port, enum nes_cm_listener_state listener_state)
{ unsigned long flags; struct nes_cm_listener *listen_node; spin_lock_irqsave(&cm_core->listen_list_lock, flags); list_for_each_entry(listen_node, &cm_core->listen_list.list, list) { if (((listen_node->loc_addr == dst_addr) || listen_node->loc_addr == 0x00000000) && (listen_node->loc_port == dst_port) && ...
robutest/uclinux
C++
GPL-2.0
60
/* Superblock locking. We really ought to get rid of these two. */
void lock_super(struct super_block *sb)
/* Superblock locking. We really ought to get rid of these two. */ void lock_super(struct super_block *sb)
{ get_fs_excl(); mutex_lock(&sb->s_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* This function parse the value got from TPM2_GetCapability and return the max command size and response size */
EFI_STATUS EFIAPI Tpm2GetCapabilityMaxCommandResponseSize(OUT UINT32 *MaxCommandSize, OUT UINT32 *MaxResponseSize)
/* This function parse the value got from TPM2_GetCapability and return the max command size and response size */ EFI_STATUS EFIAPI Tpm2GetCapabilityMaxCommandResponseSize(OUT UINT32 *MaxCommandSize, OUT UINT32 *MaxResponseSize)
{ TPMS_CAPABILITY_DATA TpmCap; TPMI_YES_NO MoreData; EFI_STATUS Status; Status = Tpm2GetCapability ( TPM_CAP_TPM_PROPERTIES, TPM_PT_MAX_COMMAND_SIZE, 1, &MoreData, &TpmCap ); if (EFI_ERROR (Status)) { retur...
tianocore/edk2
C++
Other
4,240
/* Link down indication handler. The function is invoked by HW when Titan indicates that the link is down. */
enum vxge_hw_status __vxge_hw_device_handle_link_down_ind(struct __vxge_hw_device *hldev)
/* Link down indication handler. The function is invoked by HW when Titan indicates that the link is down. */ enum vxge_hw_status __vxge_hw_device_handle_link_down_ind(struct __vxge_hw_device *hldev)
{ if (hldev->link_state == VXGE_HW_LINK_DOWN) goto exit; hldev->link_state = VXGE_HW_LINK_DOWN; if (hldev->uld_callbacks.link_down) hldev->uld_callbacks.link_down(hldev); exit: return VXGE_HW_OK; }
robutest/uclinux
C++
GPL-2.0
60
/* This function can be used by network drivers and applications to increase the rate that data packets are moved between the communications device and the transmit/receive queues. */
EFI_STATUS EFIAPI Udp6Poll(IN EFI_UDP6_PROTOCOL *This)
/* This function can be used by network drivers and applications to increase the rate that data packets are moved between the communications device and the transmit/receive queues. */ EFI_STATUS EFIAPI Udp6Poll(IN EFI_UDP6_PROTOCOL *This)
{ UDP6_INSTANCE_DATA *Instance; EFI_IP6_PROTOCOL *Ip; if (This == NULL) { return EFI_INVALID_PARAMETER; } Instance = UDP6_INSTANCE_DATA_FROM_THIS (This); Ip = Instance->IpInfo->Ip.Ip6; return Ip->Poll (Ip); }
tianocore/edk2
C++
Other
4,240
/* Format the last component of a canonical pathname into a caller-provided CHAR16 array. */
EFI_STATUS VirtioFsGetBasename(IN CHAR8 *Path, OUT CHAR16 *Basename OPTIONAL, IN OUT UINTN *BasenameSize)
/* Format the last component of a canonical pathname into a caller-provided CHAR16 array. */ EFI_STATUS VirtioFsGetBasename(IN CHAR8 *Path, OUT CHAR16 *Basename OPTIONAL, IN OUT UINTN *BasenameSize)
{ UINTN AllocSize; UINTN LastComponent; UINTN Idx; UINTN PathSize; AllocSize = *BasenameSize; LastComponent = MAX_UINTN; for (Idx = 0; Path[Idx] != '\0'; Idx++) { if (Path[Idx] == '/') { LastComponent = Idx; } } PathSize = Idx + 1; ASSERT (LastComponent < MAX_UINTN); LastComponen...
tianocore/edk2
C++
Other
4,240