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
/* In TDX a serial of TdIoRead16 is invoked to read data from the I/O port. */
VOID EFIAPI IoReadFifo16(IN UINTN Port, IN UINTN Count, OUT VOID *Buffer)
/* In TDX a serial of TdIoRead16 is invoked to read data from the I/O port. */ VOID EFIAPI IoReadFifo16(IN UINTN Port, IN UINTN Count, OUT VOID *Buffer)
{ if (IsTdxGuest ()) { TdIoReadFifo16 (Port, Count, Buffer); } else { SevIoReadFifo16 (Port, Count, Buffer); } }
tianocore/edk2
C++
Other
4,240
/* Source register rounding function on WAKE_UP_SRC (1Bh), TAP_SRC (1Ch), D6D_SRC (1Dh), STATUS_REG (1Eh) and FUNC_SRC1 (53h) registers in the primary interface.. */
int32_t lsm6dsl_rounding_on_status_get(stmdev_ctx_t *ctx, lsm6dsl_rounding_status_t *val)
/* Source register rounding function on WAKE_UP_SRC (1Bh), TAP_SRC (1Ch), D6D_SRC (1Dh), STATUS_REG (1Eh) and FUNC_SRC1 (53h) registers in the primary interface.. */ int32_t lsm6dsl_rounding_on_status_get(stmdev_ctx_t *ctx, lsm6dsl_rounding_status_t *val)
{ lsm6dsl_ctrl7_g_t ctrl7_g; int32_t ret; ret = lsm6dsl_read_reg(ctx, LSM6DSL_CTRL7_G, (uint8_t*)&ctrl7_g, 1); switch (ctrl7_g.rounding_status) { case LSM6DSL_STAT_RND_DISABLE: *val = LSM6DSL_STAT_RND_DISABLE; break; case LSM6DSL_STAT_RND_ENABLE: *val = LSM6DSL_STAT_RND_ENABLE; break; default: *val = LSM6DSL_STAT_RND_ND; break; } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* This file was originally written by Seiji Kihara */
void nilfs_btnode_cache_init_once(struct address_space *btnc)
/* This file was originally written by Seiji Kihara */ void nilfs_btnode_cache_init_once(struct address_space *btnc)
{ memset(btnc, 0, sizeof(*btnc)); INIT_RADIX_TREE(&btnc->page_tree, GFP_ATOMIC); spin_lock_init(&btnc->tree_lock); INIT_LIST_HEAD(&btnc->private_list); spin_lock_init(&btnc->private_lock); spin_lock_init(&btnc->i_mmap_lock); INIT_RAW_PRIO_TREE_ROOT(&btnc->i_mmap); INIT_LIST_HEAD(&btnc->i_mmap_nonlinear); }
robutest/uclinux
C++
GPL-2.0
60
/* ibmvfc_dev_cancel_all_abts - Device iterated cancel all function @sdev: scsi device struct @data: return code */
static void ibmvfc_dev_cancel_all_abts(struct scsi_device *sdev, void *data)
/* ibmvfc_dev_cancel_all_abts - Device iterated cancel all function @sdev: scsi device struct @data: return code */ static void ibmvfc_dev_cancel_all_abts(struct scsi_device *sdev, void *data)
{ unsigned long *rc = data; *rc |= ibmvfc_cancel_all(sdev, IBMVFC_TMF_ABORT_TASK_SET); }
robutest/uclinux
C++
GPL-2.0
60
/* Attribute write call back for the Long descriptor V2D3 attribute. */
static ssize_t write_long_des_v2d3(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
/* Attribute write call back for the Long descriptor V2D3 attribute. */ static ssize_t write_long_des_v2d3(struct bt_conn *conn, const struct bt_gatt_attr *attr, const void *buf, uint16_t len, uint16_t offset, uint8_t flags)
{ uint8_t *value = attr->user_data; if (offset >= sizeof(long_des_v2d3_value)) return BT_GATT_ERR(BT_ATT_ERR_INVALID_OFFSET); if (offset + len > sizeof(long_des_v2d3_value)) return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN); memcpy(value + offset, buf, len); return len; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Resume the specified DMA Channel from an automatic stall state. */
void dmac_channel_keep(Dmac *p_dmac, uint32_t ul_num)
/* Resume the specified DMA Channel from an automatic stall state. */ void dmac_channel_keep(Dmac *p_dmac, uint32_t ul_num)
{ Assert(p_dmac); Assert(ul_num<=3); p_dmac->DMAC_CHER = DMAC_CHER_KEEP0 << ul_num; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Read the measurement data result. Reads the measurement data result. */
enum freqm_status freqm_get_result_value(struct freqm_module *const module_inst, uint32_t *result)
/* Read the measurement data result. Reads the measurement data result. */ enum freqm_status freqm_get_result_value(struct freqm_module *const module_inst, uint32_t *result)
{ Assert(module_inst); Assert(module_inst->hw); Assert(result); Freqm *const freqm_hw = module_inst->hw; uint32_t result_cal; *result = result_cal= 0; if (freqm_hw->STATUS.reg & FREQM_STATUS_BUSY) { return FREQM_STATUS_MEASURE_BUSY; } else { if (freqm_hw->STATUS.reg & FREQM_STATUS_OVF) { return FREQM_STATUS_CNT_OVERFLOW; } else { result_cal = freqm_hw->VALUE.reg; freqm_hw->INTFLAG.reg = FREQM_INTFLAG_DONE; *result = result_cal * module_inst->ref_clock_freq / freqm_hw->CFGA.reg; return FREQM_STATUS_MEASURE_DONE; } } }
memfault/zero-to-main
C++
null
200
/* Remove the QP from the table so it can't be found asynchronously by the receive interrupt routine. */
static void ipath_free_qp(struct ipath_qp_table *qpt, struct ipath_qp *qp)
/* Remove the QP from the table so it can't be found asynchronously by the receive interrupt routine. */ static void ipath_free_qp(struct ipath_qp_table *qpt, struct ipath_qp *qp)
{ struct ipath_qp *q, **qpp; unsigned long flags; spin_lock_irqsave(&qpt->lock, flags); qpp = &qpt->table[qp->ibqp.qp_num % qpt->max]; for (; (q = *qpp) != NULL; qpp = &q->next) { if (q == qp) { *qpp = qp->next; qp->next = NULL; atomic_dec(&qp->refcount); break; } } spin_unlock_irqrestore(&qpt->lock, flags); }
robutest/uclinux
C++
GPL-2.0
60
/* This is a comparios function for 'list_sort()' which compares 2 replay entries */
static int replay_entries_cmp(void *priv, struct list_head *a, struct list_head *b)
/* This is a comparios function for 'list_sort()' which compares 2 replay entries */ static int replay_entries_cmp(void *priv, struct list_head *a, struct list_head *b)
{ struct replay_entry *ra, *rb; cond_resched(); if (a == b) return 0; ra = list_entry(a, struct replay_entry, list); rb = list_entry(b, struct replay_entry, list); ubifs_assert(ra->sqnum != rb->sqnum); if (ra->sqnum > rb->sqnum) return 1; return -1; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Configures the specified ADC external trigger for injected channels conversion. */
void ADC_ConfigExternalTrigInjectedConv(ADC_T *adc, ADC_EXT_TRIG_INJEC_CONV_T extTrigInjecConv)
/* Configures the specified ADC external trigger for injected channels conversion. */ void ADC_ConfigExternalTrigInjectedConv(ADC_T *adc, ADC_EXT_TRIG_INJEC_CONV_T extTrigInjecConv)
{ adc->CTRL2_B.INJGEXTTRGSEL = RESET; adc->CTRL2_B.INJGEXTTRGSEL |= extTrigInjecConv; }
pikasTech/PikaPython
C++
MIT License
1,403
/* ZigBee Device Profile dissector for the complex descriptor */
void dissect_zbee_zdp_req_complex_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* ZigBee Device Profile dissector for the complex descriptor */ void dissect_zbee_zdp_req_complex_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{ guint offset = 0; guint16 device; device = zbee_parse_uint(tree, hf_zbee_zdp_device, tvb, &offset, (int)sizeof(guint16), NULL); zbee_append_info(tree, pinfo, ", Device: 0x%04x", device); zdp_dump_excess(tvb, offset, pinfo, tree); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function is used by the driver entity to get inquiry data. Data format of Identify data is defined by the Interface GUID. */
EFI_STATUS EFIAPI EmmcDiskInfoInquiry(IN EFI_DISK_INFO_PROTOCOL *This, IN OUT VOID *InquiryData, IN OUT UINT32 *InquiryDataSize)
/* This function is used by the driver entity to get inquiry data. Data format of Identify data is defined by the Interface GUID. */ EFI_STATUS EFIAPI EmmcDiskInfoInquiry(IN EFI_DISK_INFO_PROTOCOL *This, IN OUT VOID *InquiryData, IN OUT UINT32 *InquiryDataSize)
{ EFI_STATUS Status; EMMC_PARTITION *Partition; EMMC_DEVICE *Device; Partition = EMMC_PARTITION_DATA_FROM_DISKINFO (This); Device = Partition->Device; if (*InquiryDataSize >= sizeof (Device->Cid)) { Status = EFI_SUCCESS; CopyMem (InquiryData, &Device->Cid, sizeof (Device->Cid)); } else { Status = EFI_BUFFER_TOO_SMALL; } *InquiryDataSize = sizeof (Device->Cid); return Status; }
tianocore/edk2
C++
Other
4,240
/* Move all the modes from @head to @new. */
void drm_mode_list_concat(struct list_head *head, struct list_head *new)
/* Move all the modes from @head to @new. */ void drm_mode_list_concat(struct list_head *head, struct list_head *new)
{ struct list_head *entry, *tmp; list_for_each_safe(entry, tmp, head) { list_move_tail(entry, new); } }
robutest/uclinux
C++
GPL-2.0
60
/* Checks whether the specified SPI flag is set or not. */
FlagStatus SPI_GetFlagStatus(SPI_TypeDef *SPIx, SPI_FLAG_TypeDef SPI_FLAG)
/* Checks whether the specified SPI flag is set or not. */ FlagStatus SPI_GetFlagStatus(SPI_TypeDef *SPIx, SPI_FLAG_TypeDef SPI_FLAG)
{ FlagStatus status = RESET; assert_param(IS_SPI_FLAG(SPI_FLAG)); if ((SPIx->SR & (uint8_t)SPI_FLAG) != (uint8_t)RESET) { status = SET; } else { status = RESET; } return status; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Releases all memory associated with a crypt_stat struct. */
void ecryptfs_destroy_crypt_stat(struct ecryptfs_crypt_stat *crypt_stat)
/* Releases all memory associated with a crypt_stat struct. */ void ecryptfs_destroy_crypt_stat(struct ecryptfs_crypt_stat *crypt_stat)
{ struct ecryptfs_key_sig *key_sig, *key_sig_tmp; if (crypt_stat->tfm) crypto_free_blkcipher(crypt_stat->tfm); if (crypt_stat->hash_tfm) crypto_free_hash(crypt_stat->hash_tfm); list_for_each_entry_safe(key_sig, key_sig_tmp, &crypt_stat->keysig_list, crypt_stat_list) { list_del(&key_sig->crypt_stat_list); kmem_cache_free(ecryptfs_key_sig_cache, key_sig); } memset(crypt_stat, 0, sizeof(struct ecryptfs_crypt_stat)); }
robutest/uclinux
C++
GPL-2.0
60
/* Stop WLAN device by putting it into reset state. wlan_stop */
void wlan_stop(void)
/* Stop WLAN device by putting it into reset state. wlan_stop */ void wlan_stop(void)
{ tSLInformation.WriteWlanPin( WLAN_DISABLE ); while(tSLInformation.ReadWlanInterruptPin() == 0) { } if (tSLInformation.pucTxCommandBuffer) { tSLInformation.pucTxCommandBuffer = 0; } SpiClose(); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* If the requested operation results in an overflow or an underflow condition, then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeIntnSub(IN INTN Minuend, IN INTN Subtrahend, OUT INTN *Result)
/* If the requested operation results in an overflow or an underflow condition, then Result is set to INTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeIntnSub(IN INTN Minuend, IN INTN Subtrahend, OUT INTN *Result)
{ return SafeInt64Sub ((INT64)Minuend, (INT64)Subtrahend, (INT64 *)Result); }
tianocore/edk2
C++
Other
4,240
/* Returns CR_OK upon successful completion, an error code otherwise. */
enum CRStatus cr_input_get_cur_index(CRInput *a_this, glong *a_index)
/* Returns CR_OK upon successful completion, an error code otherwise. */ enum CRStatus cr_input_get_cur_index(CRInput *a_this, glong *a_index)
{ g_return_val_if_fail (a_this && PRIVATE (a_this) && a_index, CR_BAD_PARAM_ERROR); *a_index = PRIVATE (a_this)->next_byte_index; return CR_OK; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Return an identifying string at @buffer, if @buffer is non-NULL, filling to the length stored at * (int *) @buffer. */
static int ioctl_probe(struct Scsi_Host *host, void __user *buffer)
/* Return an identifying string at @buffer, if @buffer is non-NULL, filling to the length stored at * (int *) @buffer. */ static int ioctl_probe(struct Scsi_Host *host, void __user *buffer)
{ unsigned int len, slen; const char *string; if (buffer) { if (get_user(len, (unsigned int __user *) buffer)) return -EFAULT; if (host->hostt->info) string = host->hostt->info(host); else string = host->hostt->name; if (string) { slen = strlen(string); if (len > slen) len = slen + 1; if (copy_to_user(buffer, string, len)) return -EFAULT; } } return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Attribute read call back for the Value V16 attribute. */
static ssize_t read_value_v16(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset)
/* Attribute read call back for the Value V16 attribute. */ static ssize_t read_value_v16(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset)
{ const struct value_v16_t *value = attr->user_data; struct value_v16_t value_v16_conv; value_v16_conv.field_a = value->field_a; value_v16_conv.field_b = sys_cpu_to_le16(value->field_b); value_v16_conv.field_c = sys_cpu_to_le32(value->field_c); return bt_gatt_attr_read(conn, attr, buf, len, offset, &value_v16_conv, sizeof(value_v16_conv)); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Accelerometer Z-axis user offset correction expressed in two’s complement, weight depends on USR_OFF_W in CTRL6_C (15h). The value must be in the range .. */
int32_t lsm6dso_xl_usr_offset_z_get(stmdev_ctx_t *ctx, uint8_t *buff)
/* Accelerometer Z-axis user offset correction expressed in two’s complement, weight depends on USR_OFF_W in CTRL6_C (15h). The value must be in the range .. */ int32_t lsm6dso_xl_usr_offset_z_get(stmdev_ctx_t *ctx, uint8_t *buff)
{ int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_Z_OFS_USR, buff, 1); return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Call event handler. Function that calls event handler. The event handler would be only called if its value is != NULL. */
static void nrf_drv_call_event_handler(uint8_t instNr, nrf_drv_twis_evt_t const *const pev)
/* Call event handler. Function that calls event handler. The event handler would be only called if its value is != NULL. */ static void nrf_drv_call_event_handler(uint8_t instNr, nrf_drv_twis_evt_t const *const pev)
{ nrf_drv_twis_event_handler_t evh = m_var_inst[instNr].ev_handler; if(NULL != evh) { evh(pev); } }
labapart/polymcu
C++
null
201
/* Determine if the huge page at addr within the vma has an associated reservation. Where it does not we will need to logically increase reservation and actually increase quota before an allocation can occur. Where any new reservation would be required the reservation change is prepared, but not committed. Once the page has been quota'd allocated an instantiated the change should be committed via vma_commit_reservation. No action is required on failure. */
static long vma_needs_reservation(struct hstate *h, struct vm_area_struct *vma, unsigned long addr)
/* Determine if the huge page at addr within the vma has an associated reservation. Where it does not we will need to logically increase reservation and actually increase quota before an allocation can occur. Where any new reservation would be required the reservation change is prepared, but not committed. Once the page has been quota'd allocated an instantiated the change should be committed via vma_commit_reservation. No action is required on failure. */ static long vma_needs_reservation(struct hstate *h, struct vm_area_struct *vma, unsigned long addr)
{ struct address_space *mapping = vma->vm_file->f_mapping; struct inode *inode = mapping->host; if (vma->vm_flags & VM_MAYSHARE) { pgoff_t idx = vma_hugecache_offset(h, vma, addr); return region_chg(&inode->i_mapping->private_list, idx, idx + 1); } else if (!is_vma_resv_set(vma, HPAGE_RESV_OWNER)) { return 1; } else { long err; pgoff_t idx = vma_hugecache_offset(h, vma, addr); struct resv_map *reservations = vma_resv_map(vma); err = region_chg(&reservations->regions, idx, idx + 1); if (err < 0) return err; return 0; } }
robutest/uclinux
C++
GPL-2.0
60
/* eeprom_layout_setup() - setup layout struct with the layout data and metadata as dictated by layout_version @layout: A pointer to an existing struct layout. @buf: A buffer initialized with the eeprom data. @buf_size: Size of buf in bytes. @layout version: The version number of the layout. */
void eeprom_layout_setup(struct eeprom_layout *layout, unsigned char *buf, unsigned int buf_size, int layout_version)
/* eeprom_layout_setup() - setup layout struct with the layout data and metadata as dictated by layout_version @layout: A pointer to an existing struct layout. @buf: A buffer initialized with the eeprom data. @buf_size: Size of buf in bytes. @layout version: The version number of the layout. */ void eeprom_layout_setup(struct eeprom_layout *layout, unsigned char *buf, unsigned int buf_size, int layout_version)
{ int i; if (layout_version == LAYOUT_VERSION_AUTODETECT) layout->layout_version = eeprom_layout_detect(buf); else layout->layout_version = layout_version; eeprom_layout_assign(layout, layout_version); layout->data = buf; for (i = 0; i < layout->num_of_fields; i++) { layout->fields[i].buf = buf; buf += layout->fields[i].size; } layout->data_size = buf_size; layout->print = eeprom_layout_print; layout->update = eeprom_layout_update_field; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Sets the priority of @notification to @priority. See #GNotificationPriority for possible values. */
void g_notification_set_priority(GNotification *notification, GNotificationPriority priority)
/* Sets the priority of @notification to @priority. See #GNotificationPriority for possible values. */ void g_notification_set_priority(GNotification *notification, GNotificationPriority priority)
{ g_return_if_fail (G_IS_NOTIFICATION (notification)); notification->priority = priority; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If the request is asynchronous, then the end function needs to be called after waiting for the request to be unlocked (if it was locked). */
static void end_io_requests(struct fuse_conn *fc) __releases(&fc -> lock) __acquires(&fc->lock)
/* If the request is asynchronous, then the end function needs to be called after waiting for the request to be unlocked (if it was locked). */ static void end_io_requests(struct fuse_conn *fc) __releases(&fc -> lock) __acquires(&fc->lock)
{ while (!list_empty(&fc->io)) { struct fuse_req *req = list_entry(fc->io.next, struct fuse_req, list); void (*end) (struct fuse_conn *, struct fuse_req *) = req->end; req->aborted = 1; req->out.h.error = -ECONNABORTED; req->state = FUSE_REQ_FINISHED; list_del_init(&req->list); wake_up(&req->waitq); if (end) { req->end = NULL; __fuse_get_request(req); spin_unlock(&fc->lock); wait_event(req->waitq, !req->locked); end(fc, req); fuse_put_request(fc, req); spin_lock(&fc->lock); } } }
robutest/uclinux
C++
GPL-2.0
60
/* checks whether source address filter failed in the rx frame. */
bool synopGMAC_is_sa_filter_failed(DmaDesc *desc)
/* checks whether source address filter failed in the rx frame. */ bool synopGMAC_is_sa_filter_failed(DmaDesc *desc)
{ return ((desc -> status & DescSAFilterFail) == DescSAFilterFail); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* int posix_memalign(void** pp, size_t alignment, size_t n); Allocates a chunk of n bytes, aligned in accord with the alignment argument. Differs from memalign only in that it (1) assigns the allocated memory to *pp rather than returning it, (2) fails and returns EINVAL if the alignment is not a power of two (3) fails and returns ENOMEM if memory cannot be allocated. */
int dlposix_memalign(void **, size_t, size_t)
/* int posix_memalign(void** pp, size_t alignment, size_t n); Allocates a chunk of n bytes, aligned in accord with the alignment argument. Differs from memalign only in that it (1) assigns the allocated memory to *pp rather than returning it, (2) fails and returns EINVAL if the alignment is not a power of two (3) fails and returns ENOMEM if memory cannot be allocated. */ int dlposix_memalign(void **, size_t, size_t)
{ size_t d = alignment / sizeof(void*); size_t r = alignment % sizeof(void*); if (r != 0 || d == 0 || (d & (d-SIZE_T_ONE)) != 0) return EINVAL; else if (bytes <= MAX_REQUEST - alignment) { if (alignment < MIN_CHUNK_SIZE) alignment = MIN_CHUNK_SIZE; mem = internal_memalign(gm, alignment, bytes); } } if (mem == 0) return ENOMEM; else { *pp = mem; return 0; } }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* sam9x5_periph_clk_bind() - for the periph clock driver Recursively bind its children as clk devices. */
static int sam9x5_periph_clk_bind(struct udevice *dev)
/* sam9x5_periph_clk_bind() - for the periph clock driver Recursively bind its children as clk devices. */ static int sam9x5_periph_clk_bind(struct udevice *dev)
{ return at91_clk_sub_device_bind(dev, "periph-clk"); }
4ms/stm32mp1-baremetal
C++
Other
137
/* This is the end of set of functions & definitions specific to xscale (deviceid : 1064R, PERC5) controllers The following functions are defined for ppc (deviceid : 0x60) controllers megasas_enable_intr_ppc - Enables interrupts @regs: MFI register set */
static void megasas_enable_intr_ppc(struct megasas_register_set __iomem *regs)
/* This is the end of set of functions & definitions specific to xscale (deviceid : 1064R, PERC5) controllers The following functions are defined for ppc (deviceid : 0x60) controllers megasas_enable_intr_ppc - Enables interrupts @regs: MFI register set */ static void megasas_enable_intr_ppc(struct megasas_register_set __iomem *regs)
{ writel(0xFFFFFFFF, &(regs)->outbound_doorbell_clear); writel(~0x80000004, &(regs)->outbound_intr_mask); readl(&regs->outbound_intr_mask); }
robutest/uclinux
C++
GPL-2.0
60
/* Pause btcoex timer and bt duty cycle timer */
static void ath9k_btcoex_timer_pause(struct ath_softc *sc)
/* Pause btcoex timer and bt duty cycle timer */ static void ath9k_btcoex_timer_pause(struct ath_softc *sc)
{ struct ath_btcoex *btcoex = &sc->btcoex; struct ath_hw *ah = sc->sc_ah; del_timer_sync(&btcoex->period_timer); if (btcoex->hw_timer_enabled) ath9k_gen_timer_stop(ah, btcoex->no_stomp_timer); btcoex->hw_timer_enabled = false; }
robutest/uclinux
C++
GPL-2.0
60
/* Function for setting the state of a flag to false. */
static __INLINE void sdk_mapped_flags_clear_by_index(sdk_mapped_flags_t *p_flags, uint16_t index)
/* Function for setting the state of a flag to false. */ static __INLINE void sdk_mapped_flags_clear_by_index(sdk_mapped_flags_t *p_flags, uint16_t index)
{ *p_flags &= ~(1U << index); }
labapart/polymcu
C++
null
201
/* Finish the table access 'val = t'. if 'slot' is NULL, 't' is not a table; otherwise, 'slot' points to t entry (which must be empty). */
void luaV_finishget(lua_State *L, const TValue *t, TValue *key, StkId val, const TValue *slot)
/* Finish the table access 'val = t'. if 'slot' is NULL, 't' is not a table; otherwise, 'slot' points to t entry (which must be empty). */ void luaV_finishget(lua_State *L, const TValue *t, TValue *key, StkId val, const TValue *slot)
{ int loop; const TValue *tm; for (loop = 0; loop < MAXTAGLOOP; loop++) { if (slot == NULL) { lua_assert(!ttistable(t)); tm = luaT_gettmbyobj(L, t, TM_INDEX); if (l_unlikely(notm(tm))) luaG_typeerror(L, t, "index"); } else { lua_assert(isempty(slot)); tm = fasttm(L, hvalue(t)->metatable, TM_INDEX); if (tm == NULL) { setnilvalue(s2v(val)); return; } } if (ttisfunction(tm)) { luaT_callTMres(L, tm, t, key, val); return; } t = tm; if (luaV_fastget(L, t, key, slot, luaH_get)) { setobj2s(L, val, slot); return; } } luaG_runerror(L, "'__index' chain too long; possible loop"); }
Nicholas3388/LuaNode
C++
Other
1,055
/* Only Special Function Registers (SFRs) can be written at byte level. */
int32_t can_ctrl_sfr_byte_write(struct can_ctrl_dev *dev, uint16_t address, uint8_t data)
/* Only Special Function Registers (SFRs) can be written at byte level. */ int32_t can_ctrl_sfr_byte_write(struct can_ctrl_dev *dev, uint16_t address, uint8_t data)
{ uint8_t spi_msg[] = {0, 0, 0}; spi_msg[0] = CAN_CTRL_CMD_MODE(CAN_CTRL_CMD_WRITE) | CAN_CTRL_ADDR_UP_NIBBLE_MODE(address); spi_msg[1] |= CAN_CTRL_ADDR_DW_BYTE_MODE(address); spi_msg[2] |= data; return spi_write_and_read(dev->can_ctrl_spi, spi_msg, 3); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* snd_hda_ch_mode_get - Get callback helper for the channel mode enum */
int snd_hda_ch_mode_get(struct hda_codec *codec, struct snd_ctl_elem_value *ucontrol, const struct hda_channel_mode *chmode, int num_chmodes, int max_channels)
/* snd_hda_ch_mode_get - Get callback helper for the channel mode enum */ int snd_hda_ch_mode_get(struct hda_codec *codec, struct snd_ctl_elem_value *ucontrol, const struct hda_channel_mode *chmode, int num_chmodes, int max_channels)
{ int i; for (i = 0; i < num_chmodes; i++) { if (max_channels == chmode[i].channels) { ucontrol->value.enumerated.item[0] = i; break; } } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* CAN MSP De-Initialization This function frees the hardware resources used in this example: */
void HAL_CAN_MspDeInit(CAN_HandleTypeDef *hcan)
/* CAN MSP De-Initialization This function frees the hardware resources used in this example: */ void HAL_CAN_MspDeInit(CAN_HandleTypeDef *hcan)
{ CANx_FORCE_RESET(); CANx_RELEASE_RESET(); HAL_GPIO_DeInit(CANx_TX_GPIO_PORT, CANx_TX_PIN); HAL_GPIO_DeInit(CANx_RX_GPIO_PORT, CANx_RX_PIN); HAL_NVIC_DisableIRQ(CANx_RX_IRQn); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Disable the PWM output of the PWM module. The */
void PWMOutputDisable(unsigned long ulBase, unsigned long ulChannel)
/* Disable the PWM output of the PWM module. The */ void PWMOutputDisable(unsigned long ulBase, unsigned long ulChannel)
{ unsigned long ulChannelTemp; ulChannelTemp = (ulBase == PWMA_BASE) ? ulChannel : (ulChannel - 4); xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE)); xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 3))); xHWREG(ulBase + PWM_POE) &= ~(PWM_POE_PWM0 << (ulChannelTemp)); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Note: The returned array/buffer is owned by callee. */
PCI_SEGMENT_INFO* EFIAPI GetPciSegmentInfo(UINTN *Count)
/* Note: The returned array/buffer is owned by callee. */ PCI_SEGMENT_INFO* EFIAPI GetPciSegmentInfo(UINTN *Count)
{ ASSERT (FALSE); *Count = 0; return NULL; }
tianocore/edk2
C++
Other
4,240
/* Sends the next HID report to the host, via the keyboard data endpoint. */
void SendNextReport(void)
/* Sends the next HID report to the host, via the keyboard data endpoint. */ void SendNextReport(void)
{ static USB_KeyboardReport_Data_t PrevKeyboardReportData; USB_KeyboardReport_Data_t KeyboardReportData; bool SendReport = false; CreateKeyboardReport(&KeyboardReportData); if (IdleCount && (!(IdleMSRemaining))) { IdleMSRemaining = IdleCount; SendReport = true; } else { SendReport = (memcmp(&PrevKeyboardReportData, &KeyboardReportData, sizeof(USB_KeyboardReport_Data_t)) != 0); } Endpoint_SelectEndpoint(KEYBOARD_IN_EPADDR); if (Endpoint_IsReadWriteAllowed() && SendReport) { PrevKeyboardReportData = KeyboardReportData; Endpoint_Write_Stream_LE(&KeyboardReportData, sizeof(KeyboardReportData), NULL); Endpoint_ClearIN(); } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Reset QDec state machine and all other functions . */
void QDEC_RstALL(QDEC_TypeDef *QDec)
/* Reset QDec state machine and all other functions . */ void QDEC_RstALL(QDEC_TypeDef *QDec)
{ u32 reg_ctrl; assert_param(IS_QDEC_ALL_PERIPH(QDec)); reg_ctrl = QDec->QDEC_CTRL; QDec->QDEC_CTRL &= ~QD_AXIS_EN; QDec->QDEC_CTRL |= QD_ALL_RST; QDec->QDEC_CTRL &= ~QD_ALL_RST; QDec->QDEC_CTRL = reg_ctrl; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Airpcap wrapper, used to get the supported channels of an airpcap adapter */
gboolean airpcap_if_get_device_supported_channels(PAirpcapHandle ah, AirpcapChannelInfo **cInfo, guint *nInfo)
/* Airpcap wrapper, used to get the supported channels of an airpcap adapter */ gboolean airpcap_if_get_device_supported_channels(PAirpcapHandle ah, AirpcapChannelInfo **cInfo, guint *nInfo)
{ if (!AirpcapLoaded) return FALSE; if (airpcap_get_dll_state() == AIRPCAP_DLL_OLD) { *nInfo = num_legacy_channels; *cInfo = (AirpcapChannelInfo*)&LegacyChannels; return TRUE; } else if (airpcap_get_dll_state() == AIRPCAP_DLL_OK) { return g_PAirpcapGetDeviceSupportedChannels(ah, cInfo, nInfo); } return FALSE; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Determines whether the UART transmitter is busy or not. */
xtBoolean UARTBusy(unsigned long ulBase)
/* Determines whether the UART transmitter is busy or not. */ xtBoolean UARTBusy(unsigned long ulBase)
{ xASSERT(UARTBaseValid(ulBase)); return (!(xHWREG(ulBase + USART_SR) & USART_SR_TC)); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This file is part of the Simba project. */
int mock_write_mqtt_client_init(const char *name_p, struct log_object_t *log_object_p, void *chout_p, void *chin_p, mqtt_on_publish_t on_publish, mqtt_on_error_t on_error, int res)
/* This file is part of the Simba project. */ int mock_write_mqtt_client_init(const char *name_p, struct log_object_t *log_object_p, void *chout_p, void *chin_p, mqtt_on_publish_t on_publish, mqtt_on_error_t on_error, int res)
{ harness_mock_write("mqtt_client_init(name_p)", name_p, strlen(name_p) + 1); harness_mock_write("mqtt_client_init(log_object_p)", log_object_p, sizeof(*log_object_p)); harness_mock_write("mqtt_client_init(chout_p)", chout_p, sizeof(chout_p)); harness_mock_write("mqtt_client_init(chin_p)", chin_p, sizeof(chin_p)); harness_mock_write("mqtt_client_init(on_publish)", &on_publish, sizeof(on_publish)); harness_mock_write("mqtt_client_init(on_error)", &on_error, sizeof(on_error)); harness_mock_write("mqtt_client_init(): return (res)", &res, sizeof(res)); return (0); }
eerimoq/simba
C++
Other
337
/* This call will set the mode for the @gpio to input. */
static int msp71xx_exd_direction_input(struct gpio_chip *chip, unsigned offset)
/* This call will set the mode for the @gpio to input. */ static int msp71xx_exd_direction_input(struct gpio_chip *chip, unsigned offset)
{ struct msp71xx_exd_gpio_chip *msp71xx_chip = to_msp71xx_exd_gpio_chip(chip); __raw_writel(1 << MSP71XX_CFG_IN_OFFSET(offset), msp71xx_chip->reg); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Creates a 128bit random value that is fully forward and backward prediction resistant, suitable for seeding a NIST SP800-90 Compliant, FIPS 1402-2 certifiable SW DRBG. This function takes multiple random numbers through RDRAND without intervening delays to ensure reseeding and performs AES-CBC-MAC over the data to compute the seed value. */
EFI_STATUS EFIAPI RdRandGetSeed128(OUT UINT8 *SeedBuffer)
/* Creates a 128bit random value that is fully forward and backward prediction resistant, suitable for seeding a NIST SP800-90 Compliant, FIPS 1402-2 certifiable SW DRBG. This function takes multiple random numbers through RDRAND without intervening delays to ensure reseeding and performs AES-CBC-MAC over the data to compute the seed value. */ EFI_STATUS EFIAPI RdRandGetSeed128(OUT UINT8 *SeedBuffer)
{ EFI_STATUS Status; UINT8 RandByte[16]; UINT8 Key[16]; UINT8 Ffv[16]; UINT8 Xored[16]; UINT32 Index; UINT32 Index2; for (Index = 0; Index < 16; Index++) { Key[Index] = (UINT8)Index; Ffv[Index] = 0; } for (Index = 0; Index < 32; Index++) { MicroSecondDelay (10); Status = RngGetBytes (16, RandByte); if (EFI_ERROR (Status)) { return Status; } for (Index2 = 0; Index2 < 16; Index2++) { Xored[Index2] = RandByte[Index2] ^ Ffv[Index2]; } AesEncrypt (Key, Xored, Ffv); } for (Index = 0; Index < 16; Index++) { SeedBuffer[Index] = Ffv[Index]; } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Returns: TRUE if @mount_point is deemed to be ejectable. */
gboolean g_unix_mount_point_guess_can_eject(GUnixMountPoint *mount_point)
/* Returns: TRUE if @mount_point is deemed to be ejectable. */ gboolean g_unix_mount_point_guess_can_eject(GUnixMountPoint *mount_point)
{ GUnixMountType guessed_type; guessed_type = g_unix_mount_point_guess_type (mount_point); if (guessed_type == G_UNIX_MOUNT_TYPE_IPOD || guessed_type == G_UNIX_MOUNT_TYPE_CDROM) return TRUE; return FALSE; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Description: Look through the domain hash table searching for an entry to match @domain, return a pointer to a copy of the entry or NULL. The caller is responsibile for ensuring that rcu_read_lock() is called. */
struct netlbl_dom_map* netlbl_domhsh_getentry(const char *domain)
/* Description: Look through the domain hash table searching for an entry to match @domain, return a pointer to a copy of the entry or NULL. The caller is responsibile for ensuring that rcu_read_lock() is called. */ struct netlbl_dom_map* netlbl_domhsh_getentry(const char *domain)
{ return netlbl_domhsh_search_def(domain); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Initialize the address to name translation machinery. We map all non-local IP addresses to numeric addresses if ndo->ndo_fflag is true (i.e., to prevent blocking on the nameserver). localnet is the IP address of the local network. mask is its subnet mask. */
void init_addrtoname(netdissect_options *ndo, uint32_t localnet, uint32_t mask)
/* Initialize the address to name translation machinery. We map all non-local IP addresses to numeric addresses if ndo->ndo_fflag is true (i.e., to prevent blocking on the nameserver). localnet is the IP address of the local network. mask is its subnet mask. */ void init_addrtoname(netdissect_options *ndo, uint32_t localnet, uint32_t mask)
{ if (ndo->ndo_fflag) { f_localnet = localnet; f_netmask = mask; } if (ndo->ndo_nflag) return; init_etherarray(ndo); init_servarray(ndo); init_eprotoarray(ndo); init_protoidarray(ndo); init_ipxsaparray(ndo); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* PC_to_RDR_GetSlotStatus Provides the Slot status to the host. */
uint8_t PC_to_RDR_GetSlotStatus(USBD_HandleTypeDef *pdev)
/* PC_to_RDR_GetSlotStatus Provides the Slot status to the host. */ uint8_t PC_to_RDR_GetSlotStatus(USBD_HandleTypeDef *pdev)
{ uint8_t error; error = CCID_CheckCommandParams(pdev, CHK_PARAM_SLOT | CHK_PARAM_DWLENGTH | CHK_PARAM_CARD_PRESENT | CHK_PARAM_ABRFU3); if (error != 0U) { return error; } CCID_UpdateCommandStatus(pdev, (BM_COMMAND_STATUS_NO_ERROR), (BM_ICC_PRESENT_ACTIVE)); return SLOT_NO_ERROR; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Report Boot Perforamnce table address as report status code. */
VOID EFIAPI ReportFpdtRecordBuffer(IN EFI_EVENT Event, IN VOID *Context)
/* Report Boot Perforamnce table address as report status code. */ VOID EFIAPI ReportFpdtRecordBuffer(IN EFI_EVENT Event, IN VOID *Context)
{ EFI_STATUS Status; UINT64 BPDTAddr; if (!mFpdtBufferIsReported) { Status = AllocateBootPerformanceTable (); if (!EFI_ERROR (Status)) { BPDTAddr = (UINT64)(UINTN)mAcpiBootPerformanceTable; REPORT_STATUS_CODE_EX ( EFI_PROGRESS_CODE, EFI_SOFTWARE_DXE_BS_DRIVER, 0, NULL, &gEdkiiFpdtExtendedFirmwarePerformanceGuid, &BPDTAddr, sizeof (UINT64) ); Status = gBS->InstallConfigurationTable (&gEdkiiFpdtExtendedFirmwarePerformanceGuid, (VOID *)(UINTN)BPDTAddr); ASSERT_EFI_ERROR (Status); } mFpdtBufferIsReported = TRUE; } }
tianocore/edk2
C++
Other
4,240
/* Stop conversion of insert channels. Disable ADC peripheral if no normal conversion is on going. */
ald_status_t ald_adc_insert_stop(ald_adc_handle_t *hperh)
/* Stop conversion of insert channels. Disable ADC peripheral if no normal conversion is on going. */ ald_status_t ald_adc_insert_stop(ald_adc_handle_t *hperh)
{ assert_param(IS_ADC_TYPE(hperh->perh)); ALD_ADC_DISABLE(hperh); hperh->state = ALD_ADC_STATE_READY; return ALD_OK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* check if there is data in rx fifo. */
int serial_readable(serial_t *obj)
/* check if there is data in rx fifo. */ int serial_readable(serial_t *obj)
{ PMBED_UART_ADAPTER puart_adapter=&(uart_adapter[obj->uart_idx]); if (UART_Readable(puart_adapter->UARTx)) { return 1; } else { return 0; } }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This function sets bus clock frequency of USCI_I2C module. */
uint32_t UI2C_SetBusClockFreq(UI2C_T *ui2c, uint32_t u32BusClock)
/* This function sets bus clock frequency of USCI_I2C module. */ uint32_t UI2C_SetBusClockFreq(UI2C_T *ui2c, uint32_t u32BusClock)
{ uint32_t u32ClkDiv; uint32_t u32Pclk; if (ui2c == UI2C0) { u32Pclk = CLK_GetPCLK0Freq(); } else { u32Pclk = CLK_GetPCLK1Freq(); } u32ClkDiv = (uint32_t)((((((u32Pclk / 2U) * 10U) / (u32BusClock)) + 5U) / 10U) - 1U); ui2c->BRGEN &= ~UI2C_BRGEN_CLKDIV_Msk; ui2c->BRGEN |= (u32ClkDiv << UI2C_BRGEN_CLKDIV_Pos); return (u32Pclk / ((u32ClkDiv + 1U) << 1U)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If the card responds to CMD8, the response of ACMD41 includes the CCS field information. CCS is valid when the card returns ready (the busy bit is set to 1). CCS=0 means that the card is SDSC. CCS=1 means that the card is SDHC or SDXC. */
DSTATUS disk_initialize(BYTE drv)
/* If the card responds to CMD8, the response of ACMD41 includes the CCS field information. CCS is valid when the card returns ready (the busy bit is set to 1). CCS=0 means that the card is SDSC. CCS=1 means that the card is SDHC or SDXC. */ DSTATUS disk_initialize(BYTE drv)
{ if (drv < (sizeof drvfuncs / sizeof drvfuncs [0])) return drvfuncs [drv]->Initialize(drv); return STA_NODISK; }
ua1arn/hftrx
C++
null
69
/* Minimum Checksum Coverage is located at the RX side (9.2.1). This means that */
static int dccp_hdlr_min_cscov(struct sock *sk, u64 cscov, bool rx)
/* Minimum Checksum Coverage is located at the RX side (9.2.1). This means that */ static int dccp_hdlr_min_cscov(struct sock *sk, u64 cscov, bool rx)
{ struct dccp_sock *dp = dccp_sk(sk); if (rx) dp->dccps_pcrlen = cscov; else { if (dp->dccps_pcslen == 0) dp->dccps_pcslen = cscov; else if (cscov > dp->dccps_pcslen) DCCP_WARN("CsCov %u too small, peer requires >= %u\n", dp->dccps_pcslen, (u8)cscov); } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Determines if the USART is in mute mode or not. */
void USART_ReceiverWakeUpCmd(USART_TypeDef *USARTx, FunctionalState NewState)
/* Determines if the USART is in mute mode or not. */ void USART_ReceiverWakeUpCmd(USART_TypeDef *USARTx, FunctionalState NewState)
{ assert_param(IS_USART_ALL_PERIPH(USARTx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { USARTx->CR1 |= USART_CR1_RWU; } else { USARTx->CR1 &= (uint16_t)~((uint16_t)USART_CR1_RWU); } }
MaJerle/stm32f429
C++
null
2,036
/* platform_finish - switch the machine to the normal mode of operation using the platform driver (must be called after platform_prepare()) */
static void platform_finish(int platform_mode)
/* platform_finish - switch the machine to the normal mode of operation using the platform driver (must be called after platform_prepare()) */ static void platform_finish(int platform_mode)
{ if (platform_mode && hibernation_ops) hibernation_ops->finish(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If there are less @dstlen bytes available in the data stream, or if any other errors occur, such as a corrupted compressed stream, an error is printed an the platform's exit() function is called. */
void gunzip_exactly(struct gunzip_state *state, void *dst, int dstlen)
/* If there are less @dstlen bytes available in the data stream, or if any other errors occur, such as a corrupted compressed stream, an error is printed an the platform's exit() function is called. */ void gunzip_exactly(struct gunzip_state *state, void *dst, int dstlen)
{ int len; len = gunzip_partial(state, dst, dstlen); if (len < dstlen) fatal("\n\rgunzip_exactly: ran out of data!" " Wanted %d, got %d.\n\r", dstlen, len); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Sets the Hibernation module's date and time match value in calendar mode. */
void HibernateCalendarMatchSet(uint32_t ui32Index, struct tm *psTime)
/* Sets the Hibernation module's date and time match value in calendar mode. */ void HibernateCalendarMatchSet(uint32_t ui32Index, struct tm *psTime)
{ _HibernateCalendarSet(HIB_CALM0, psTime); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* PLL rate = 14.7456 MHz * (X1FBD + 1) * (X2FBD + 1) / (X2IPD + 1) / 2^PS */
static unsigned long calc_pll_rate(u32 config_word)
/* PLL rate = 14.7456 MHz * (X1FBD + 1) * (X2FBD + 1) / (X2IPD + 1) / 2^PS */ static unsigned long calc_pll_rate(u32 config_word)
{ unsigned long long rate; int i; rate = clk_xtali.rate; rate *= ((config_word >> 11) & 0x1f) + 1; rate *= ((config_word >> 5) & 0x3f) + 1; do_div(rate, (config_word & 0x1f) + 1); for (i = 0; i < ((config_word >> 16) & 3); i++) rate >>= 1; return (unsigned long)rate; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Bitbang an instruction out to the serial E2Prom */
static void initio_se2_instr(unsigned long base, u8 instr)
/* Bitbang an instruction out to the serial E2Prom */ static void initio_se2_instr(unsigned long base, u8 instr)
{ int i; u8 b; outb(SE2CS | SE2DO, base + TUL_NVRAM); udelay(30); outb(SE2CS | SE2CLK | SE2DO, base + TUL_NVRAM); udelay(30); for (i = 0; i < 8; i++) { if (instr & 0x80) b = SE2CS | SE2DO; else b = SE2CS; outb(b, base + TUL_NVRAM); udelay(30); outb(b | SE2CLK, base + TUL_NVRAM); udelay(30); instr <<= 1; } outb(SE2CS, base + TUL_NVRAM); udelay(30); }
robutest/uclinux
C++
GPL-2.0
60
/* Add a trace buffer entry for arguments, for a buffer & 1 integer arg. */
void xfs_btree_trace_argbi(const char *func, struct xfs_btree_cur *cur, struct xfs_buf *b, int i, int line)
/* Add a trace buffer entry for arguments, for a buffer & 1 integer arg. */ void xfs_btree_trace_argbi(const char *func, struct xfs_btree_cur *cur, struct xfs_buf *b, int i, int line)
{ cur->bc_ops->trace_enter(cur, func, XBT_ARGS, XFS_BTREE_KTRACE_ARGBI, line, (__psunsigned_t)b, i, 0, 0, 0, 0, 0, 0, 0, 0, 0); }
robutest/uclinux
C++
GPL-2.0
60
/* Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
/* Configures the board hardware and chip peripherals for the demo's functionality. */ void SetupHardware(void)
{ MCUSR &= ~(1 << WDRF); wdt_disable(); clock_prescale_set(clock_div_1); USB_Init(USB_MODE_Host, USB_DEVICE_OPT_FULLSPEED | USB_OPT_AUTO_PLL); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* task_curr - is this task currently executing on a CPU? */
int task_curr(const struct task_struct *p)
/* task_curr - is this task currently executing on a CPU? */ int task_curr(const struct task_struct *p)
{ return cpu_curr(task_cpu(p)) == p; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | Reserved | Address Length| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | */
static void dissect_pmip6_opt_mag_ipv6(const mip6_opt *optp _U_, tvbuff_t *tvb, int offset, guint optlen _U_, packet_info *pinfo _U_, proto_tree *opt_tree, proto_item *hdr_item _U_)
/* 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Type | Length | Reserved | Address Length| +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | | */ static void dissect_pmip6_opt_mag_ipv6(const mip6_opt *optp _U_, tvbuff_t *tvb, int offset, guint optlen _U_, packet_info *pinfo _U_, proto_tree *opt_tree, proto_item *hdr_item _U_)
{ offset++; proto_tree_add_item(opt_tree, hf_mip6_opt_len, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(opt_tree, hf_mip6_opt_mag_ipv6_reserved, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(opt_tree, hf_mip6_opt_mag_ipv6_address_length, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(opt_tree, hf_mip6_opt_mag_ipv6_address, tvb, offset, 16, ENC_NA); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* The constructor function checks whether or not RDRAND instruction is supported. It will ASSERT() if RDRAND instruction is not supported. It will always return EFI_SUCCESS. */
EFI_STATUS EFIAPI BaseRngLibConstructor(VOID)
/* The constructor function checks whether or not RDRAND instruction is supported. It will ASSERT() if RDRAND instruction is not supported. It will always return EFI_SUCCESS. */ EFI_STATUS EFIAPI BaseRngLibConstructor(VOID)
{ UINT32 RegEcx; AsmCpuid (1, 0, 0, &RegEcx, 0); ASSERT ((RegEcx & RDRAND_MASK) == RDRAND_MASK); mRdRandSupported = ((RegEcx & RDRAND_MASK) == RDRAND_MASK); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Return value: the associated value, or NULL if the key is not found. */
gpointer g_hash_table_lookup(GHashTable *hash_table, gconstpointer key)
/* Return value: the associated value, or NULL if the key is not found. */ gpointer g_hash_table_lookup(GHashTable *hash_table, gconstpointer key)
{ GHashNode *node; g_return_val_if_fail (hash_table != NULL, NULL); node = *g_hash_table_lookup_node (hash_table, key); return node ? node->value : NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Set the current write offset. This should only be used to set the offset to a known previous location (very carefully), or to 0 so that the next write gets appended to the end of the file. */
void TIFFSetWriteOffset(TIFF *tif, toff_t off)
/* Set the current write offset. This should only be used to set the offset to a known previous location (very carefully), or to 0 so that the next write gets appended to the end of the file. */ void TIFFSetWriteOffset(TIFF *tif, toff_t off)
{ tif->tif_curoff = off; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* If PDC used the usb controller, the usb controller is still running and will crash the machines during iommu setup, because of still running DMA. This PDC call stops the USB controller. Normally called after calling pdc_io_reset(). */
void pdc_io_reset_devices(void)
/* If PDC used the usb controller, the usb controller is still running and will crash the machines during iommu setup, because of still running DMA. This PDC call stops the USB controller. Normally called after calling pdc_io_reset(). */ void pdc_io_reset_devices(void)
{ unsigned long flags; spin_lock_irqsave(&pdc_lock, flags); mem_pdc_call(PDC_IO, PDC_IO_RESET_DEVICES, 0); spin_unlock_irqrestore(&pdc_lock, flags); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Writes the specified register reg with the reg_value passed. */
void at30tse_write_register(uint8_t reg, uint8_t reg_type, uint8_t reg_size, uint16_t reg_value)
/* Writes the specified register reg with the reg_value passed. */ void at30tse_write_register(uint8_t reg, uint8_t reg_type, uint8_t reg_size, uint16_t reg_value)
{ uint8_t data[3]; data[0] = reg | reg_type; data[1] = 0x00FF & (reg_value >> 8); data[2] = 0x00FF & reg_value; struct i2c_master_packet transfer = { .address = AT30TSE_TEMPERATURE_TWI_ADDR, .data_length = 1 + reg_size, .data = data, }; i2c_master_write_packet_wait(&dev_inst_at30tse75x, &transfer); }
memfault/zero-to-main
C++
null
200
/* The function relies on the restriction that a */
STATIC BOOLEAN SubstringEq(IN SUBSTRING Substring, IN CONST CHAR8 *String)
/* The function relies on the restriction that a */ STATIC BOOLEAN SubstringEq(IN SUBSTRING Substring, IN CONST CHAR8 *String)
{ UINTN Pos; CONST CHAR8 *Chr; Pos = 0; Chr = String; while (Pos < Substring.Len && Substring.Ptr[Pos] == *Chr) { ++Pos; ++Chr; } return (BOOLEAN)(Pos == Substring.Len && *Chr == '\0'); }
tianocore/edk2
C++
Other
4,240
/* Remove divs that don't occur in any of the constraints or other divs. These can arise when dropping some of the variables in a quast returned by piplib. */
static struct isl_basic_map* remove_redundant_divs(struct isl_basic_map *bmap)
/* Remove divs that don't occur in any of the constraints or other divs. These can arise when dropping some of the variables in a quast returned by piplib. */ static struct isl_basic_map* remove_redundant_divs(struct isl_basic_map *bmap)
{ int i; if (!bmap) return NULL; for (i = bmap->n_div-1; i >= 0; --i) { if (!div_is_redundant(bmap, i)) continue; bmap = isl_basic_map_drop_div(bmap, i); } return bmap; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Disallow use of floating point capabilities. This routine sets CR0 to 1, which disallows the use of FP instructions by the currently executing thread. */
static void z_FpAccessDisable(void)
/* Disallow use of floating point capabilities. This routine sets CR0 to 1, which disallows the use of FP instructions by the currently executing thread. */ static void z_FpAccessDisable(void)
{ void *tempReg; __asm__ volatile( "movl %%cr0, %0;\n\t" "orl $0x8, %0;\n\t" "movl %0, %%cr0;\n\t" : "=r"(tempReg) : : "memory"); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Event handler for the library USB Configuration Changed event. */
void EVENT_USB_Device_ConfigurationChanged(void)
/* Event handler for the library USB Configuration Changed event. */ void EVENT_USB_Device_ConfigurationChanged(void)
{ bool ConfigSuccess = true; ConfigSuccess &= CDC_Device_ConfigureEndpoints(&VirtualSerial1_CDC_Interface); ConfigSuccess &= CDC_Device_ConfigureEndpoints(&VirtualSerial2_CDC_Interface); LEDs_SetAllLEDs(ConfigSuccess ? LEDMASK_USB_READY : LEDMASK_USB_ERROR); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Return the total length of the parsed instruction. */
UINT64 CcInstructionLength(IN CC_INSTRUCTION_DATA *InstructionData)
/* Return the total length of the parsed instruction. */ UINT64 CcInstructionLength(IN CC_INSTRUCTION_DATA *InstructionData)
{ return (UINT64)(InstructionData->End - InstructionData->Begin); }
tianocore/edk2
C++
Other
4,240
/* Returns 0 if no, 1 if yes and -1 in case of error */
int xmlBufIsEmpty(const xmlBufPtr buf)
/* Returns 0 if no, 1 if yes and -1 in case of error */ int xmlBufIsEmpty(const xmlBufPtr buf)
{ if ((!buf) || (buf->error)) return(-1); CHECK_COMPAT(buf) return(buf->use == 0); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Call this is you want to be sure all an anchor's URBs have finished */
int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor, unsigned int timeout)
/* Call this is you want to be sure all an anchor's URBs have finished */ int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor, unsigned int timeout)
{ return wait_event_timeout(anchor->wait, list_empty(&anchor->urb_list), msecs_to_jiffies(timeout)); }
robutest/uclinux
C++
GPL-2.0
60
/* Change Logs: Date Author Notes Meco Man the first version */
void rt_delayed_work_init(struct rt_delayed_work *work, void(*work_func)(struct rt_work *work, void *work_data), void *work_data)
/* Change Logs: Date Author Notes Meco Man the first version */ void rt_delayed_work_init(struct rt_delayed_work *work, void(*work_func)(struct rt_work *work, void *work_data), void *work_data)
{ rt_work_init(&work->work, work_func, work_data); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* [map->phys_addr, map->phys_addr + map->length) and [phys_addr, phys_addr + length) have intersection? */
static bool mapping_have_same_region(MemoryMapping *map, hwaddr phys_addr, ram_addr_t length)
/* [map->phys_addr, map->phys_addr + map->length) and [phys_addr, phys_addr + length) have intersection? */ static bool mapping_have_same_region(MemoryMapping *map, hwaddr phys_addr, ram_addr_t length)
{ return !(phys_addr + length < map->phys_addr || phys_addr >= map->phys_addr + map->length); }
ve3wwg/teensy3_qemu
C
Other
15
/* Get different information available in the MCU (Device ID, Revision ID & UID) */
void GetMCUInfo(void)
/* Get different information available in the MCU (Device ID, Revision ID & UID) */ void GetMCUInfo(void)
{ register uint32_t size_string = 0, read_info = 0, read_info2 = 0; sprintf((char*)aShowDeviceID,"Device ID = 0x%lX", LL_DBGMCU_GetDeviceID()); sprintf((char*)aShowRevisionID,"Revision ID = 0x%lX", LL_DBGMCU_GetRevisionID()); sprintf((char*)aShowCoordinate,"X and Y coordinates = 0x%lX", LL_GetUID_Word0()); read_info = LL_GetUID_Word1(); read_info2 = LL_GetUID_Word2(); sprintf((char*)aShowWaferNumber,"Wafer NB = 0x%X", (uint8_t)read_info); size_string = sprintf((char*)aShowLotNumber,"Lot NB = 0x%lX", read_info2); sprintf((char*)aShowLotNumber+size_string,"%lX", (read_info >> 8)); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Callback for notifying upper layer that a packet was succesfully transmitted. */
static __INLINE void callback_packet_sent(void)
/* Callback for notifying upper layer that a packet was succesfully transmitted. */ static __INLINE void callback_packet_sent(void)
{ mp_tx_stream = NULL; m_tx_stream_length = 0; m_tx_stream_index = 0; m_ser_phy_tx_event.evt_type = SER_PHY_EVT_TX_PKT_SENT; callback_ser_phy_event(m_ser_phy_tx_event); }
labapart/polymcu
C++
null
201
/* Cleans interrupts and HV resources. Must be called with vuart_bus_priv.probe_mutex held. Used by ps3_vuart_remove and ps3_vuart_shutdown. After this call, polled reading will still work. */
static int ps3_vuart_cleanup(struct ps3_system_bus_device *dev)
/* Cleans interrupts and HV resources. Must be called with vuart_bus_priv.probe_mutex held. Used by ps3_vuart_remove and ps3_vuart_shutdown. After this call, polled reading will still work. */ static int ps3_vuart_cleanup(struct ps3_system_bus_device *dev)
{ dev_dbg(&dev->core, "%s:%d\n", __func__, __LINE__); ps3_vuart_cancel_async(dev); ps3_vuart_set_interrupt_mask(dev, 0); ps3_vuart_bus_interrupt_put(); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Read a string of bytes through the software UART. */
int32_t swuart_read_string(struct swuart_dev *dev, uint8_t *string, uint32_t size)
/* Read a string of bytes through the software UART. */ int32_t swuart_read_string(struct swuart_dev *dev, uint8_t *string, uint32_t size)
{ uint32_t i; int32_t check = 0; for(i = 0; i < size; i++) { check = swuart_read_char(dev, &string[i]); if(check != 0) return check; } return check; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* the first prototypes used 0x2c as the page code for the mrw mode page, subsequently this was changed to 0x03. probe the one used by this drive */
static int cdrom_mrw_probe_pc(struct cdrom_device_info *cdi)
/* the first prototypes used 0x2c as the page code for the mrw mode page, subsequently this was changed to 0x03. probe the one used by this drive */ static int cdrom_mrw_probe_pc(struct cdrom_device_info *cdi)
{ struct packet_command cgc; char buffer[16]; init_cdrom_command(&cgc, buffer, sizeof(buffer), CGC_DATA_READ); cgc.timeout = HZ; cgc.quiet = 1; if (!cdrom_mode_sense(cdi, &cgc, MRW_MODE_PC, 0)) { cdi->mrw_mode_page = MRW_MODE_PC; return 0; } else if (!cdrom_mode_sense(cdi, &cgc, MRW_MODE_PC_PRE1, 0)) { cdi->mrw_mode_page = MRW_MODE_PC_PRE1; return 0; } return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* as a general rule, heartbeat events are no longer needed by the mle once an "answer" regarding the lock master has been received. */
static void __dlm_mle_attach_hb_events(struct dlm_ctxt *dlm, struct dlm_master_list_entry *mle)
/* as a general rule, heartbeat events are no longer needed by the mle once an "answer" regarding the lock master has been received. */ static void __dlm_mle_attach_hb_events(struct dlm_ctxt *dlm, struct dlm_master_list_entry *mle)
{ assert_spin_locked(&dlm->spinlock); list_add_tail(&mle->hb_events, &dlm->mle_hb_events); }
robutest/uclinux
C++
GPL-2.0
60
/* Most drivers don't need their own mmap function */
static int vfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
/* Most drivers don't need their own mmap function */ static int vfb_mmap(struct fb_info *info, struct vm_area_struct *vma)
{ unsigned long start = vma->vm_start; unsigned long size = vma->vm_end - vma->vm_start; unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; unsigned long page, pos; if (offset + size > info->fix.smem_len) { return -EINVAL; } pos = (unsigned long)info->fix.smem_start + offset; while (size > 0) { page = vmalloc_to_pfn((void *)pos); if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) { return -EAGAIN; } start += PAGE_SIZE; pos += PAGE_SIZE; if (size > PAGE_SIZE) size -= PAGE_SIZE; else size = 0; } vma->vm_flags |= VM_RESERVED; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* The constructor function caches the pointer of SMM Services Table. */
EFI_STATUS EFIAPI SmmServicesTableLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The constructor function caches the pointer of SMM Services Table. */ EFI_STATUS EFIAPI SmmServicesTableLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; EFI_SMM_BASE2_PROTOCOL *InternalSmmBase2; InternalSmmBase2 = NULL; Status = SystemTable->BootServices->LocateProtocol ( &gEfiSmmBase2ProtocolGuid, NULL, (VOID **)&InternalSmmBase2 ); ASSERT_EFI_ERROR (Status); ASSERT (InternalSmmBase2 != NULL); InternalSmmBase2->GetSmstLocation (InternalSmmBase2, &gSmst); ASSERT (gSmst != NULL); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Compute the window scale value according to the given buffer size. */
UINT8 TcpComputeScale(IN TCP_CB *Tcb)
/* Compute the window scale value according to the given buffer size. */ UINT8 TcpComputeScale(IN TCP_CB *Tcb)
{ UINT8 Scale; UINT32 BufSize; ASSERT ((Tcb != NULL) && (Tcb->Sk != NULL)); BufSize = GET_RCV_BUFFSIZE (Tcb->Sk); Scale = 0; while ((Scale < TCP_OPTION_MAX_WS) && ((UINT32)(TCP_OPTION_MAX_WIN << Scale) < BufSize)) { Scale++; } return Scale; }
tianocore/edk2
C++
Other
4,240
/* Disable the DAC module. Disables the DAC interface and the output buffer. */
void dac_disable(struct dac_module *const module_inst)
/* Disable the DAC module. Disables the DAC interface and the output buffer. */ void dac_disable(struct dac_module *const module_inst)
{ Assert(module_inst); Assert(module_inst->hw); Dac *const dac_module = module_inst->hw; while (dac_is_syncing(module_inst)) { } dac_module->INTENCLR.reg = DAC_INTENCLR_MASK; dac_module->INTFLAG.reg = DAC_INTFLAG_MASK; dac_module->CTRLA.reg &= ~DAC_CTRLA_ENABLE; }
memfault/zero-to-main
C++
null
200
/* Enables asynchronous callback generation for a given channel and type. Enables asynchronous callbacks for a given logical DAC channel and type. This must be called before a DAC channel will generate callback events. */
enum status_code dac_chan_enable_callback(struct dac_module *const module_inst, const enum dac_channel channel, const enum dac_callback type)
/* Enables asynchronous callback generation for a given channel and type. Enables asynchronous callbacks for a given logical DAC channel and type. This must be called before a DAC channel will generate callback events. */ enum status_code dac_chan_enable_callback(struct dac_module *const module_inst, const enum dac_channel channel, const enum dac_callback type)
{ Assert(module_inst); UNUSED(channel); if (module_inst->start_on_event == false) { return STATUS_ERR_UNSUPPORTED_DEV; } module_inst->callback_enable[type] = true; return STATUS_OK; }
memfault/zero-to-main
C++
null
200
/* This is not complete - we should be able to fake an edge even if it isn't on the 8259A... */
static unsigned int startup_ioapic_irq(unsigned int irq)
/* This is not complete - we should be able to fake an edge even if it isn't on the 8259A... */ static unsigned int startup_ioapic_irq(unsigned int irq)
{ int was_pending = 0; unsigned long flags; struct irq_cfg *cfg; spin_lock_irqsave(&ioapic_lock, flags); if (irq < nr_legacy_irqs) { disable_8259A_irq(irq); if (i8259A_irq_pending(irq)) was_pending = 1; } cfg = irq_cfg(irq); __unmask_IO_APIC_irq(cfg); spin_unlock_irqrestore(&ioapic_lock, flags); return was_pending; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function determines the size of the SRAM on the Tiva device. */
uint32_t SysCtlSRAMSizeGet(void)
/* This function determines the size of the SRAM on the Tiva device. */ uint32_t SysCtlSRAMSizeGet(void)
{ return((HWREG(FLASH_SSIZE) + 1) * 256); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Resume console: If there are cached messages, emit them. */
static void sclp_console_resume(void)
/* Resume console: If there are cached messages, emit them. */ static void sclp_console_resume(void)
{ unsigned long flags; spin_lock_irqsave(&sclp_con_lock, flags); sclp_con_suspended = 0; spin_unlock_irqrestore(&sclp_con_lock, flags); sclp_conbuf_emit(); }
robutest/uclinux
C++
GPL-2.0
60
/* this does a simple search for the head node for a given extent. It must be called with the delayed ref spinlock held, and it returns the head node if any where found, or NULL if not. */
struct btrfs_delayed_ref_head* btrfs_find_delayed_ref_head(struct btrfs_trans_handle *trans, u64 bytenr)
/* this does a simple search for the head node for a given extent. It must be called with the delayed ref spinlock held, and it returns the head node if any where found, or NULL if not. */ struct btrfs_delayed_ref_head* btrfs_find_delayed_ref_head(struct btrfs_trans_handle *trans, u64 bytenr)
{ struct btrfs_delayed_ref_node *ref; struct btrfs_delayed_ref_root *delayed_refs; delayed_refs = &trans->transaction->delayed_refs; ref = find_ref_head(&delayed_refs->root, bytenr, NULL); if (ref) return btrfs_delayed_node_to_head(ref); return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Enables the clock out signal. e.g. AM_HAL_CLKGEN_CLKOUT_CKSEL_HFRC AM_HAL_CLKGEN_CLKOUT_CKSEL_HFRC_DIV4 AM_HAL_CLKGEN_CLKOUT_CKSEL_LFRC */
void am_hal_clkgen_clkout_enable(uint32_t ui32Signal)
/* Enables the clock out signal. e.g. AM_HAL_CLKGEN_CLKOUT_CKSEL_HFRC AM_HAL_CLKGEN_CLKOUT_CKSEL_HFRC_DIV4 AM_HAL_CLKGEN_CLKOUT_CKSEL_LFRC */ void am_hal_clkgen_clkout_enable(uint32_t ui32Signal)
{ AM_REG(CLKGEN, CLKOUT) = AM_REG_CLKGEN_CLKOUT_CKEN_M | ui32Signal; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Prepares for the data used by CPU feature detection and initialization. */
VOID* EFIAPI PpinGetConfigData(IN UINTN NumberOfProcessors)
/* Prepares for the data used by CPU feature detection and initialization. */ VOID* EFIAPI PpinGetConfigData(IN UINTN NumberOfProcessors)
{ VOID *ConfigData; ConfigData = AllocateZeroPool (sizeof (MSR_IVY_BRIDGE_PPIN_CTL_REGISTER) * NumberOfProcessors); ASSERT (ConfigData != NULL); return ConfigData; }
tianocore/edk2
C++
Other
4,240
/* Disable the Capture input of the PWM module. The */
void PWMCAPInputDisable(unsigned long ulBase, unsigned long ulChannel)
/* Disable the Capture input of the PWM module. The */ void PWMCAPInputDisable(unsigned long ulBase, unsigned long ulChannel)
{ xASSERT(ulBase == PWMA_BASE); xASSERT(((ulChannel >= 0) || (ulChannel <= 3))); xHWREG(ulBase + PWM_CAPENR) &= ~(PWM_CAPENR_CAPIE_0 << (ulChannel)); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* %-ENOENT - A record associated with @key does not exist. */
int nilfs_bmap_lookup_at_level(struct nilfs_bmap *bmap, __u64 key, int level, __u64 *ptrp)
/* %-ENOENT - A record associated with @key does not exist. */ int nilfs_bmap_lookup_at_level(struct nilfs_bmap *bmap, __u64 key, int level, __u64 *ptrp)
{ sector_t blocknr; int ret; down_read(&bmap->b_sem); ret = bmap->b_ops->bop_lookup(bmap, key, level, ptrp); if (ret < 0) goto out; if (NILFS_BMAP_USE_VBN(bmap)) { ret = nilfs_dat_translate(nilfs_bmap_get_dat(bmap), *ptrp, &blocknr); if (!ret) *ptrp = blocknr; } out: up_read(&bmap->b_sem); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Note that this uses usb_stor_bulk_transfer_buf() and usb_stor_bulk_transfer_sglist() to achieve its goals */
int usb_stor_bulk_transfer_sg(struct us_data *us, unsigned int pipe, void *buf, unsigned int length_left, int use_sg, int *residual)
/* Note that this uses usb_stor_bulk_transfer_buf() and usb_stor_bulk_transfer_sglist() to achieve its goals */ int usb_stor_bulk_transfer_sg(struct us_data *us, unsigned int pipe, void *buf, unsigned int length_left, int use_sg, int *residual)
{ int result; unsigned int partial; if (use_sg) { result = usb_stor_bulk_transfer_sglist(us, pipe, (struct scatterlist *) buf, use_sg, length_left, &partial); length_left -= partial; } else { result = usb_stor_bulk_transfer_buf(us, pipe, buf, length_left, &partial); length_left -= partial; } if (residual) *residual = length_left; return result; }
robutest/uclinux
C++
GPL-2.0
60
/* Sends data contained in a buffer over the SPI bus. */
void spi_cc_send_data(const uint8 *data, uint16 len)
/* Sends data contained in a buffer over the SPI bus. */ void spi_cc_send_data(const uint8 *data, uint16 len)
{ spi_cc_sr_byte(*data++); } while(--len); }
DC-SWAT/DreamShell
C++
null
404