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
/* This routine is called by the EBC execute functions to read EBC immediate values from the code stream. Since we can't assume alignment, each tries to read in the biggest chunks size available, but will revert to smaller reads if necessary. */
INT32 VmReadImmed32(IN VM_CONTEXT *VmPtr, IN UINT32 Offset)
/* This routine is called by the EBC execute functions to read EBC immediate values from the code stream. Since we can't assume alignment, each tries to read in the biggest chunks size available, but will revert to smaller reads if necessary. */ INT32 VmReadImmed32(IN VM_CONTEXT *VmPtr, IN UINT32 Offset)
{ UINT32 Data; if (ADDRESS_IS_ALIGNED ((UINTN)VmPtr->Ip + Offset, sizeof (UINT32))) { return *(INT32 *)(VmPtr->Ip + Offset); } Data = (UINT32)VmReadCode16 (VmPtr, Offset); Data |= (UINT32)(VmReadCode16 (VmPtr, Offset + 2) << 16); return Data; }
tianocore/edk2
C++
Other
4,240
/* This function will return if this variable is already measured. */
BOOLEAN IsDataMeasured(IN CHAR16 *VarName, IN EFI_GUID *VendorGuid, IN VOID *Data, IN UINTN Size)
/* This function will return if this variable is already measured. */ BOOLEAN IsDataMeasured(IN CHAR16 *VarName, IN EFI_GUID *VendorGuid, IN VOID *Data, IN UINTN Size)
{ UINTN Index; for (Index = 0; Index < mMeasuredAuthorityCount; Index++) { if ((StrCmp (VarName, mMeasuredAuthorityList[Index].VariableName) == 0) && (CompareGuid (VendorGuid, mMeasuredAuthorityList[Index].VendorGuid)) && (CompareMem (Data, mMeasuredAuthorityList[Index].Data, Size) == 0) && ...
tianocore/edk2
C++
Other
4,240
/* Writes key 3 configuration registers, which are used for encryption or decryption. */
void AESKey3Set(uint32_t ui32Base, uint8_t *pui8Key)
/* Writes key 3 configuration registers, which are used for encryption or decryption. */ void AESKey3Set(uint32_t ui32Base, uint8_t *pui8Key)
{ ASSERT(ui32Base == AES_BASE); HWREG(ui32Base + AES_O_KEY2_4) = * ((uint32_t *)(pui8Key + 0)); HWREG(ui32Base + AES_O_KEY2_5) = * ((uint32_t *)(pui8Key + 4)); HWREG(ui32Base + AES_O_KEY2_6) = * ((uint32_t *)(pui8Key + 8)); HWREG(ui32Base + AES_O_KEY2_7) = * ((uint32_t *)(pui8Key + 12)); }
micropython/micropython
C++
Other
18,334
/* __vxge_hw_ring_first_block_address_get - Returns the dma address of the first block Returns the dma address of the first RxD block */
u64 __vxge_hw_ring_first_block_address_get(struct __vxge_hw_ring *ring)
/* __vxge_hw_ring_first_block_address_get - Returns the dma address of the first block Returns the dma address of the first RxD block */ u64 __vxge_hw_ring_first_block_address_get(struct __vxge_hw_ring *ring)
{ struct vxge_hw_mempool_dma *dma_object; dma_object = ring->mempool->memblocks_dma_arr; vxge_assert(dma_object != NULL); return dma_object->addr; }
robutest/uclinux
C++
GPL-2.0
60
/* If InputSection is NULL, then ASSERT(). If OutputBuffer is NULL, then ASSERT(). If ScratchBuffer is NULL and this decode operation requires a scratch buffer, then ASSERT(). If AuthenticationStatus is NULL, then ASSERT(). */
RETURN_STATUS EFIAPI ExtractGuidedSectionDecode(IN CONST VOID *InputSection, OUT VOID **OutputBuffer, IN VOID *ScratchBuffer OPTIONAL, OUT UINT32 *AuthenticationStatus)
/* If InputSection is NULL, then ASSERT(). If OutputBuffer is NULL, then ASSERT(). If ScratchBuffer is NULL and this decode operation requires a scratch buffer, then ASSERT(). If AuthenticationStatus is NULL, then ASSERT(). */ RETURN_STATUS EFIAPI ExtractGuidedSectionDecode(IN CONST VOID *InputSection, OUT VOID **Outpu...
{ UINT32 Index; EFI_STATUS Status; PEI_EXTRACT_GUIDED_SECTION_HANDLER_INFO *HandlerInfo; EFI_GUID *SectionDefinitionGuid; ASSERT (InputSection != NULL); ASSERT (OutputBuffer != NULL); ASSERT (AuthenticationSta...
tianocore/edk2
C++
Other
4,240
/* register the console at a more appropriate time handle character reception on GDB serial port */
asmlinkage void gdbstub_rx_irq(struct pt_regs *regs, enum exception_code excep)
/* register the console at a more appropriate time handle character reception on GDB serial port */ asmlinkage void gdbstub_rx_irq(struct pt_regs *regs, enum exception_code excep)
{ char ch; int ret; gdbstub_entry("--> gdbstub_rx_irq\n"); do { ret = gdbstub_io_rx_char(&ch, 1); if (ret != -EIO && ret != -EAGAIN) { if (ret != -EINTR) gdbstub_rx_unget = ch; gdbstub(regs, excep); } } while (ret != -EAGAIN); gdbstub_entry("<-- gdbstub_rx_irq\n"); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Send a keepalive ping to the watchdog This is done by simply re-writing the timeout to reg. 0xF2 */
static int wdt977_keepalive(void)
/* Send a keepalive ping to the watchdog This is done by simply re-writing the timeout to reg. 0xF2 */ static int wdt977_keepalive(void)
{ unsigned long flags; spin_lock_irqsave(&spinlock, flags); outb_p(UNLOCK_DATA, IO_INDEX_PORT); outb_p(UNLOCK_DATA, IO_INDEX_PORT); outb_p(DEVICE_REGISTER, IO_INDEX_PORT); outb_p(0x08, IO_DATA_PORT); outb_p(0xF2, IO_INDEX_PORT); outb_p(timeoutM, IO_DATA_PORT); outb_p(LOCK_DATA, IO_INDEX_PORT); spin_unlock_irq...
robutest/uclinux
C++
GPL-2.0
60
/* Configures User push-button in GPIO or EXTI Line Mode. */
__STATIC_INLINE void UserButton_Init(void)
/* Configures User push-button in GPIO or EXTI Line Mode. */ __STATIC_INLINE void UserButton_Init(void)
{ USER_BUTTON_GPIO_CLK_ENABLE(); LL_GPIO_SetPinMode(USER_BUTTON_GPIO_PORT, USER_BUTTON_PIN, LL_GPIO_MODE_INPUT); LL_GPIO_SetPinPull(USER_BUTTON_GPIO_PORT, USER_BUTTON_PIN, LL_GPIO_PULL_NO); USER_BUTTON_SYSCFG_SET_EXTI(); USER_BUTTON_EXTI_LINE_ENABLE(); USER_BUTTON_EXTI_FALLING_TRIG_ENABLE(); NVIC_EnableIR...
STMicroelectronics/STM32CubeF4
C++
Other
789
/* returns 1: locks held by lockowner 0: no locks held by lockowner */
static int check_for_locks(struct file *filp, struct nfs4_stateowner *lowner)
/* returns 1: locks held by lockowner 0: no locks held by lockowner */ static int check_for_locks(struct file *filp, struct nfs4_stateowner *lowner)
{ struct file_lock **flpp; struct inode *inode = filp->f_path.dentry->d_inode; int status = 0; lock_kernel(); for (flpp = &inode->i_flock; *flpp != NULL; flpp = &(*flpp)->fl_next) { if ((*flpp)->fl_owner == (fl_owner_t)lowner) { status = 1; goto out; } } out: unlock_kernel(); return status; }
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_set(lsm6dso_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_set(lsm6dso_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); if (ret == 0) { reg.carry_count_en = (uint8_t)val; ret = lsm6dso_ln_pg_write_byte(ctx, LSM6DSO_PEDO_CMD_REG, (uint8_t*)&reg); } return ret; }
alexander-g-dean/ESF
C++
null
41
/* Help command helper function. Display help function prompt. */
static int32_t cn0503_help_prompt(struct cn0503_dev *dev)
/* Help command helper function. Display help function prompt. */ static int32_t cn0503_help_prompt(struct cn0503_dev *dev)
{ int32_t ret; ret = cli_write_string(dev->cli_handler, (uint8_t*)"\tCN0503 application.\n"); if(ret != SUCCESS) return ret; ret = cli_write_string(dev->cli_handler, (uint8_t*) "Type a command and press 'Enter'. The commands are not case sensitive.\n"); if(ret != SUCCESS) return r...
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Enable Write Protect on pages marked as read-only. */
VOID EnableReadOnlyPageWriteProtect(VOID)
/* Enable Write Protect on pages marked as read-only. */ VOID EnableReadOnlyPageWriteProtect(VOID)
{ AsmWriteCr0 (AsmReadCr0 () | BIT16); }
tianocore/edk2
C++
Other
4,240
/* This function validates that the RMR memory range descriptor count. */
STATIC VOID EFIAPI ValidateRmrMemDescCount(IN UINT8 *Ptr, IN VOID *Context)
/* This function validates that the RMR memory range descriptor count. */ STATIC VOID EFIAPI ValidateRmrMemDescCount(IN UINT8 *Ptr, IN VOID *Context)
{ if (*(UINT32 *)Ptr == 0) { IncrementErrorCount (); Print (L"\nERROR: Memory Range Descriptor count must be >=1."); } }
tianocore/edk2
C++
Other
4,240
/* Initialize an already allocated assemble table. This is generally the assemble table embedded in the IP4 service instance. */
VOID Ip4InitAssembleTable(IN OUT IP4_ASSEMBLE_TABLE *Table)
/* Initialize an already allocated assemble table. This is generally the assemble table embedded in the IP4 service instance. */ VOID Ip4InitAssembleTable(IN OUT IP4_ASSEMBLE_TABLE *Table)
{ UINT32 Index; for (Index = 0; Index < IP4_ASSEMLE_HASH_SIZE; Index++) { InitializeListHead (&Table->Bucket[Index]); } }
tianocore/edk2
C++
Other
4,240
/* This API sets the power mode of the sensor. */
int8_t bme280_set_sensor_mode(uint8_t sensor_mode, struct bme280_dev *dev)
/* This API sets the power mode of the sensor. */ int8_t bme280_set_sensor_mode(uint8_t sensor_mode, struct bme280_dev *dev)
{ int8_t rslt; uint8_t last_set_mode; rslt = null_ptr_check(dev); if (rslt == BME280_OK) { rslt = bme280_get_sensor_mode(&last_set_mode, dev); if ((rslt == BME280_OK) && (last_set_mode != BME280_SLEEP_MODE)) { rslt = put_device_to_sleep(dev); } if ...
eclipse-threadx/getting-started
C++
Other
310
/* void si_swdenable_hook(uint32 r0, uint32 r1) { printf("%s %08x %08x\n", */
void si_kattach_hook(uint32 r0, uint32 r1)
/* void si_swdenable_hook(uint32 r0, uint32 r1) { printf("%s %08x %08x\n", */ void si_kattach_hook(uint32 r0, uint32 r1)
{ printf("%s %08x %08x\n", __FUNCTION__, r0, r1); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Get the CLI commands and correlate them to functions. */
void cli_find_command(struct cli_desc *dev, uint8_t *command, cmd_func *function)
/* Get the CLI commands and correlate them to functions. */ void cli_find_command(struct cli_desc *dev, uint8_t *command, cmd_func *function)
{ uint8_t i = 0; while (command[i] != 0) { command[i] = tolower(command[i]); i++; } i = 0; while (dev->v_cmd_fun[i] != NULL) { if(strncmp((char *)command, (char *)dev->cmd_commands[i], dev->command_size[i]) == 0) { if(dev->command_size == 0) { break; } *function = dev->v_cmd_fun[i]; ...
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Write USB Device Endpoint Data Parameters: EPNum: Endpoint Number EPNum.0..3: Address EPNum.7: Dir pData: Pointer to Data Buffer cnt: Number of bytes to write Return Value: Number of bytes written */
uint32_t USBD_WriteEP(uint32_t EPNum, uint8_t *pData, uint32_t cnt)
/* Write USB Device Endpoint Data Parameters: EPNum: Endpoint Number EPNum.0..3: Address EPNum.7: Dir pData: Pointer to Data Buffer cnt: Number of bytes to write Return Value: Number of bytes written */ uint32_t USBD_WriteEP(uint32_t EPNum, uint8_t *pData, uint32_t cnt)
{ uint32_t i; EPNum &= 0x7f; for (i = 0; i < cnt; i++) { Ep[EP_IN_IDX(EPNum)].buf[i] = pData[i]; } USBD_PrimeEp(EPNum | 0x80, cnt); return (cnt); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* LSM hook implementation that authorizes that a state matches the given policy, flow combo. */
int selinux_xfrm_state_pol_flow_match(struct xfrm_state *x, struct xfrm_policy *xp, struct flowi *fl)
/* LSM hook implementation that authorizes that a state matches the given policy, flow combo. */ int selinux_xfrm_state_pol_flow_match(struct xfrm_state *x, struct xfrm_policy *xp, struct flowi *fl)
{ u32 state_sid; int rc; if (!xp->security) if (x->security) return 0; else return 1; else if (!x->security) return 0; else if (!selinux_authorizable_xfrm(x)) return 0; state_sid = x->security->ctx_sid; if (fl->secid != state_sid) return 0; rc = avc_has_perm(fl->secid, state_sid, SECCLA...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Remember that EFIs, EFDs, and IUNLINKs are handled later. */
STATIC void xlog_recover_free_trans(xlog_recover_t *trans)
/* Remember that EFIs, EFDs, and IUNLINKs are handled later. */ STATIC void xlog_recover_free_trans(xlog_recover_t *trans)
{ xlog_recover_item_t *first_item, *item, *free_item; int i; item = first_item = trans->r_itemq; do { free_item = item; item = item->ri_next; for (i = 0; i < free_item->ri_cnt; i++) { kmem_free(free_item->ri_buf[i].i_addr); } kmem_free(free_item->ri_buf); kmem_free(free_item); } while (first_item ...
robutest/uclinux
C++
GPL-2.0
60
/* Get the PWM interrupt flag of the PWM module. The */
xtBoolean xPWMIntFlagGet(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
/* Get the PWM interrupt flag of the PWM module. The */ xtBoolean xPWMIntFlagGet(unsigned long ulBase, unsigned long ulChannel, unsigned long ulIntType)
{ return PWMIntFlagGet(ulBase, ulChannel, ulIntType); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Cleans up the ROM API context. After this call, the */
status_t kb_deinit(kb_session_ref_t *session)
/* Cleans up the ROM API context. After this call, the */ status_t kb_deinit(kb_session_ref_t *session)
{ assert(BOOTLOADER_API_TREE_POINTER); return BOOTLOADER_API_TREE_POINTER->kbApi->kb_deinit_function(session); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Fetches the chassis security status when last booted. */
MISC_CHASSIS_SECURITY_STATE EFIAPI OemGetChassisSecurityStatus(VOID)
/* Fetches the chassis security status when last booted. */ MISC_CHASSIS_SECURITY_STATE EFIAPI OemGetChassisSecurityStatus(VOID)
{ ASSERT (FALSE); return ChassisSecurityStatusNone; }
tianocore/edk2
C++
Other
4,240
/* Implementation of handler named in startup code. Passes 0 to generic PWM IRQ handler. */
void PWMA_CMP3_IRQHandler(void)
/* Implementation of handler named in startup code. Passes 0 to generic PWM IRQ handler. */ void PWMA_CMP3_IRQHandler(void)
{ PWM_HAL_ClearCmpFlags(g_pwmBase[0], 3U, 0x3fU); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Update the ODR setting of the flash buffer. */
static int32_t cn0503_flash_write_odr(struct cn0503_dev *dev, uint8_t *arg, uint8_t *buff)
/* Update the ODR setting of the flash buffer. */ static int32_t cn0503_flash_write_odr(struct cn0503_dev *dev, uint8_t *arg, uint8_t *buff)
{ uint8_t *error, odr_thresh; float check_val, temp; check_val = strtod((char *)arg, (char **)&error); if(error == arg) return FAILURE; odr_thresh = (float)(CN0503_CODE_ODR_DEFAULT / CN0503_BLOCK_FILT_SIZE) / check_val; do { temp = (float)(CN0503_CODE_ODR_DEFAULT / CN0503_BLOCK_FILT_SIZE) / od...
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* This function is similar to 'ubi_open_volume()', but opens a volume the path to its character device node. */
struct ubi_volume_desc* ubi_open_volume_path(const char *pathname, int mode)
/* This function is similar to 'ubi_open_volume()', but opens a volume the path to its character device node. */ struct ubi_volume_desc* ubi_open_volume_path(const char *pathname, int mode)
{ int error, ubi_num, vol_id, mod; struct inode *inode; struct path path; dbg_gen("open volume %s, mode %d", pathname, mode); if (!pathname || !*pathname) return ERR_PTR(-EINVAL); error = kern_path(pathname, LOOKUP_FOLLOW, &path); if (error) return ERR_PTR(error); inode = path.dentry->d_inode; mod = inode-...
robutest/uclinux
C++
GPL-2.0
60
/* DM9000 interrupt handler receive the packet to upper layer, free the transmitted packet */
static void dm9000_tx_done(struct net_device *dev, board_info_t *db)
/* DM9000 interrupt handler receive the packet to upper layer, free the transmitted packet */ static void dm9000_tx_done(struct net_device *dev, board_info_t *db)
{ int tx_status = ior(db, DM9000_NSR); if (tx_status & (NSR_TX2END | NSR_TX1END)) { db->tx_pkt_cnt--; dev->stats.tx_packets++; if (netif_msg_tx_done(db)) dev_dbg(db->dev, "tx done, NSR %02x\n", tx_status); if (db->tx_pkt_cnt > 0) dm9000_send_packet(dev, db->queue_ip_summed, db->queue_pkt_len); ...
robutest/uclinux
C++
GPL-2.0
60
/* Use this function to detect that the ADC is finished sampling data before putting the device into deep sleep. Before using this function, it is highly recommended that the event trigger is changed to */
bool ADCBusy(uint32_t ui32Base)
/* Use this function to detect that the ADC is finished sampling data before putting the device into deep sleep. Before using this function, it is highly recommended that the event trigger is changed to */ bool ADCBusy(uint32_t ui32Base)
{ ASSERT((ui32Base == ADC0_BASE) || (ui32Base == ADC1_BASE)); return ((HWREG(ui32Base + ADC_O_ACTSS) & ADC_ACTSS_BUSY) ? true : false); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function forces all errors to -EIO for consistency with its predecessor, ocfs2_bread(). We haven't audited what returning the real error codes would do to callers. We log the real codes with mlog_errno() before we squash them. */
static int ocfs2_read_dir_block(struct inode *inode, u64 v_block, struct buffer_head **bh, int flags)
/* This function forces all errors to -EIO for consistency with its predecessor, ocfs2_bread(). We haven't audited what returning the real error codes would do to callers. We log the real codes with mlog_errno() before we squash them. */ static int ocfs2_read_dir_block(struct inode *inode, u64 v_block, struct buffer_h...
{ int rc = 0; struct buffer_head *tmp = *bh; rc = ocfs2_read_virt_blocks(inode, v_block, 1, &tmp, flags, ocfs2_validate_dir_block); if (rc) { mlog_errno(rc); goto out; } if (!(flags & OCFS2_BH_READAHEAD) && ocfs2_supports_dir_trailer(inode)) { rc = ocfs2_check_dir_trailer(inode, tmp); if (rc)...
robutest/uclinux
C++
GPL-2.0
60
/* Description: vxfs_transmod returns a Linux mode_t for a given VxFS inode structure. */
static __inline__ mode_t vxfs_transmod(struct vxfs_inode_info *vip)
/* Description: vxfs_transmod returns a Linux mode_t for a given VxFS inode structure. */ static __inline__ mode_t vxfs_transmod(struct vxfs_inode_info *vip)
{ mode_t ret = vip->vii_mode & ~VXFS_TYPE_MASK; if (VXFS_ISFIFO(vip)) ret |= S_IFIFO; if (VXFS_ISCHR(vip)) ret |= S_IFCHR; if (VXFS_ISDIR(vip)) ret |= S_IFDIR; if (VXFS_ISBLK(vip)) ret |= S_IFBLK; if (VXFS_ISLNK(vip)) ret |= S_IFLNK; if (VXFS_ISREG(vip)) ret |= S_IFREG; if (VXFS_ISSOC(vip)) ret ...
robutest/uclinux
C++
GPL-2.0
60
/* Configure each regulator with it's suspend operating parameters for state. This will usually be called by machine suspend code prior to supending. */
int regulator_suspend_prepare(suspend_state_t state)
/* Configure each regulator with it's suspend operating parameters for state. This will usually be called by machine suspend code prior to supending. */ int regulator_suspend_prepare(suspend_state_t state)
{ struct regulator_dev *rdev; int ret = 0; if (state == PM_SUSPEND_ON) return -EINVAL; mutex_lock(&regulator_list_mutex); list_for_each_entry(rdev, &regulator_list, list) { mutex_lock(&rdev->mutex); ret = suspend_prepare(rdev, state); mutex_unlock(&rdev->mutex); if (ret < 0) { printk(KERN_ERR "%s: fai...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enables or disables the power to the Smartcard. */
void SC_PowerCmd(FunctionalState NewState)
/* Enables or disables the power to the Smartcard. */ void SC_PowerCmd(FunctionalState NewState)
{ if(NewState != DISABLE) { HAL_GPIO_WritePin(SC_CMDVCC_GPIO_PORT, SC_CMDVCC_PIN, GPIO_PIN_RESET); } else { HAL_GPIO_WritePin(SC_CMDVCC_GPIO_PORT, SC_CMDVCC_PIN, GPIO_PIN_SET); } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: */
int IMG_InitJPG()
/* Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: */ int IMG_InitJPG()
{ IMG_SetError("JPEG images are not supported"); return(-1); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Sets the control parameters for a DMA channel. Choose the destination address increment from one of */
void xDMAChannelControlSet(unsigned long ulChannelID, unsigned long ulControl)
/* Sets the control parameters for a DMA channel. Choose the destination address increment from one of */ void xDMAChannelControlSet(unsigned long ulChannelID, unsigned long ulControl)
{ xASSERT(xDMAChannelIDValid(ulChannelID)); xHWREG(g_psDMAChannelAddress[ulChannelID] + DMA_CTRL) &= ~(DMA_CTRL_SAR_INC_M | DMA_CTRL_DAR_INC_M | DMA_CTRL_TWS_M); xHWREG(g_psDMAChannelAddress[ulChannelID] + DMA_CTRL) |= ulControl; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Checks whether the packet received is a magic packet?. */
bool synopGMAC_is_magic_packet_received(synopGMACdevice *gmacdev)
/* Checks whether the packet received is a magic packet?. */ bool synopGMAC_is_magic_packet_received(synopGMACdevice *gmacdev)
{ u32 data; data = synopGMACReadReg(gmacdev->MacBase, GmacPmtCtrlStatus); return ((data & GmacPmtMagicPktReceived) == GmacPmtMagicPktReceived); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function must be called while holding the @queue's lock. */
void g_async_queue_push_unlocked(GAsyncQueue *queue, gpointer data)
/* This function must be called while holding the @queue's lock. */ void g_async_queue_push_unlocked(GAsyncQueue *queue, gpointer data)
{ g_return_if_fail (queue); g_return_if_fail (data); g_queue_push_head (&queue->queue, data); if (queue->waiting_threads > 0) g_cond_signal (&queue->cond); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* do_QDIO - process input or output buffers @cdev: associated ccw_device for the qdio subchannel @callflags: input or output and special flags from the program @q_nr: queue number @bufnr: buffer number @count: how many buffers to process */
int do_QDIO(struct ccw_device *cdev, unsigned int callflags, int q_nr, unsigned int bufnr, unsigned int count)
/* do_QDIO - process input or output buffers @cdev: associated ccw_device for the qdio subchannel @callflags: input or output and special flags from the program @q_nr: queue number @bufnr: buffer number @count: how many buffers to process */ int do_QDIO(struct ccw_device *cdev, unsigned int callflags, int q_nr, unsign...
{ struct qdio_irq *irq_ptr; if (bufnr >= QDIO_MAX_BUFFERS_PER_Q || count > QDIO_MAX_BUFFERS_PER_Q) return -EINVAL; irq_ptr = cdev->private->qdio_data; if (!irq_ptr) return -ENODEV; DBF_DEV_EVENT(DBF_INFO, irq_ptr, "do%02x b:%02x c:%02x", callflags, bufnr, count); if (irq_ptr->state != QDIO_IRQ_STATE_A...
robutest/uclinux
C++
GPL-2.0
60
/* read a type flag from tvb and add it to tree */
static guint8 read_type(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree)
/* read a type flag from tvb and add it to tree */ static guint8 read_type(unsigned int *offset, tvbuff_t *tvb, proto_tree *etch_tree)
{ guint32 type_code; type_code = tvb_get_guint8(tvb, *offset); proto_tree_add_item(etch_tree, hf_etch_typecode, tvb, *offset, 1, ENC_BIG_ENDIAN); (*offset)++; return type_code; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Managed iounmap(). @addr must have been mapped using devm_ioremap*(). */
void devm_iounmap(struct device *dev, void __iomem *addr)
/* Managed iounmap(). @addr must have been mapped using devm_ioremap*(). */ void devm_iounmap(struct device *dev, void __iomem *addr)
{ iounmap(addr); WARN_ON(devres_destroy(dev, devm_ioremap_release, devm_ioremap_match, (void *)addr)); }
robutest/uclinux
C++
GPL-2.0
60
/* ZigBee helper function. extracts an integer and displays it to the tree. */
guint zbee_parse_uint(proto_tree *tree, int hfindex, tvbuff_t *tvb, guint *offset, guint length, proto_item **ti)
/* ZigBee helper function. extracts an integer and displays it to the tree. */ guint zbee_parse_uint(proto_tree *tree, int hfindex, tvbuff_t *tvb, guint *offset, guint length, proto_item **ti)
{ proto_item *item = NULL; guint value = 0; if (length == 0) { return 0; } else if (length == 1) { value = tvb_get_guint8(tvb, *offset); } else if (length == 2) { value = tvb_get_letohs(tvb, *offset); } else if (length == 3) { va...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Load a name from the auxiliary data. Since this extracts undocumented strings from the font file, we need to be careful here. */
static FT_Error pfr_aux_name_load(FT_Byte *p, FT_UInt len, FT_Memory memory, FT_String **astring)
/* Load a name from the auxiliary data. Since this extracts undocumented strings from the font file, we need to be careful here. */ static FT_Error pfr_aux_name_load(FT_Byte *p, FT_UInt len, FT_Memory memory, FT_String **astring)
{ FT_Error error = FT_Err_Ok; FT_String* result = NULL; FT_UInt n, ok; if ( *astring ) FT_FREE( *astring ); if ( len > 0 && p[len - 1] == 0 ) len--; ok = ( len > 0 ); for ( n = 0; n < len; n++ ) if ( p[n] < 32 || p[n] > 127 ) { ok = 0; break; ...
pikasTech/PikaPython
C++
MIT License
1,403
/* Put the dcp into rst mode and gate off its clock. @para none */
int dcp_deinit(void)
/* Put the dcp into rst mode and gate off its clock. @para none */ int dcp_deinit(void)
{ HW_DCP_CTRL_SET(BF_DCP_CTRL_SFTRST(1)); HW_DCP_CTRL_CLR(BF_DCP_CTRL_CLKGATE(1)); return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The complex nature of the setting of the nuber of bytes per datum is due to this driver currently ensuring that the timestamp is stored at an 8 byte boundary. */
static int max1363_ring_preenable(struct iio_dev *indio_dev)
/* The complex nature of the setting of the nuber of bytes per datum is due to this driver currently ensuring that the timestamp is stored at an 8 byte boundary. */ static int max1363_ring_preenable(struct iio_dev *indio_dev)
{ struct max1363_state *st = indio_dev->dev_data; size_t d_size; if (indio_dev->ring->access.set_bpd) { d_size = st->current_mode->numvals*2 + sizeof(s64); if (d_size % 8) d_size += 8 - (d_size % 8); indio_dev->ring->access.set_bpd(indio_dev->ring, d_size); } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns 0 if no error, -ENODEV, -EINVAL otherwise */
int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
/* Returns 0 if no error, -ENODEV, -EINVAL otherwise */ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
{ struct pxa_udc *udc = the_controller; if (!udc) return -ENODEV; if (!driver || driver != udc->driver || !driver->unbind) return -EINVAL; stop_activity(udc, driver); udc_disable(udc); dplus_pullup(udc, 0); driver->unbind(&udc->gadget); udc->driver = NULL; device_del(&udc->gadget.dev); dev_info(udc->dev, ...
robutest/uclinux
C++
GPL-2.0
60
/* Don't call this function unless you are bound to one of the interfaces on this device or you have locked the device! */
struct usb_interface* usb_ifnum_to_if(const struct usb_device *dev, unsigned ifnum)
/* Don't call this function unless you are bound to one of the interfaces on this device or you have locked the device! */ struct usb_interface* usb_ifnum_to_if(const struct usb_device *dev, unsigned ifnum)
{ struct usb_host_config *config = dev->actconfig; int i; if (!config) return NULL; for (i = 0; i < config->desc.bNumInterfaces; i++) if (config->interface[i]->altsetting[0] .desc.bInterfaceNumber == ifnum) return config->interface[i]; return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Low pass filter 2 on 6D function selection.. */
int32_t lsm6dso_xl_lp2_on_6d_set(stmdev_ctx_t *ctx, uint8_t val)
/* Low pass filter 2 on 6D function selection.. */ int32_t lsm6dso_xl_lp2_on_6d_set(stmdev_ctx_t *ctx, uint8_t val)
{ lsm6dso_ctrl8_xl_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_CTRL8_XL, (uint8_t *)&reg, 1); if (ret == 0) { reg.low_pass_on_6d = val; ret = lsm6dso_write_reg(ctx, LSM6DSO_CTRL8_XL, (uint8_t *)&reg, 1); } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* sweep a list until a live object (or end of list) */
static GCObject** sweeptolive(lua_State *L, GCObject **p)
/* sweep a list until a live object (or end of list) */ static GCObject** sweeptolive(lua_State *L, GCObject **p)
{ p = sweeplist(L, p, 1); } while (p == old); return p; }
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* set partition table temporarily This setting will modify the partition table temporarily, the setting will be lost after restart. */
void fal_set_partition_table_temp(struct fal_partition *table, size_t len)
/* set partition table temporarily This setting will modify the partition table temporarily, the setting will be lost after restart. */ void fal_set_partition_table_temp(struct fal_partition *table, size_t len)
{ assert(table); if (!init_ok) { log_e("FAL NOT initialized"); return; } check_and_update_part_cache(table, len); partition_table_len = len; partition_table = table; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function enables interrupt processing by the processor. */
EFI_STATUS EFIAPI CpuEnableInterrupt(IN EFI_CPU_ARCH_PROTOCOL *This)
/* This function enables interrupt processing by the processor. */ EFI_STATUS EFIAPI CpuEnableInterrupt(IN EFI_CPU_ARCH_PROTOCOL *This)
{ ArmEnableInterrupts (); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Reinitialise the device. This usually stops stream of empty packets coming from it. */
static void atp_reinit(struct work_struct *work)
/* Reinitialise the device. This usually stops stream of empty packets coming from it. */ static void atp_reinit(struct work_struct *work)
{ struct atp *dev = container_of(work, struct atp, work); struct usb_device *udev = dev->udev; int retval; dprintk("appletouch: putting appletouch to sleep (reinit)\n"); atp_geyser_init(udev); retval = usb_submit_urb(dev->urb, GFP_ATOMIC); if (retval) err("atp_reinit: usb_submit_urb failed with error %d", ...
robutest/uclinux
C++
GPL-2.0
60
/* Return codes PCI_ERS_RESULT_NEED_RESET - need to reset before recovery PCI_ERS_RESULT_DISCONNECT - device could not be recovered */
static pci_ers_result_t lpfc_io_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
/* Return codes PCI_ERS_RESULT_NEED_RESET - need to reset before recovery PCI_ERS_RESULT_DISCONNECT - device could not be recovered */ static pci_ers_result_t lpfc_io_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
{ struct Scsi_Host *shost = pci_get_drvdata(pdev); struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba; pci_ers_result_t rc = PCI_ERS_RESULT_DISCONNECT; switch (phba->pci_dev_grp) { case LPFC_PCI_DEV_LP: rc = lpfc_io_error_detected_s3(pdev, state); break; case LPFC_PCI_DEV_OC: rc = lpfc_io_...
robutest/uclinux
C++
GPL-2.0
60
/* Clears or safeguards the OCREF1 signal on an external event. */
void TIM_ClearOC1Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear)
/* Clears or safeguards the OCREF1 signal on an external event. */ void TIM_ClearOC1Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear)
{ uint16_t tmpccmr1 = 0; assert_param(IS_TIM_LIST4_PERIPH(TIMx)); assert_param(IS_TIM_OCCLEAR_STATE(TIM_OCClear)); tmpccmr1 = TIMx->CCMR1; tmpccmr1 &= (uint16_t)~((uint16_t)TIM_CCMR1_OC1CE); tmpccmr1 |= TIM_OCClear; TIMx->CCMR1 = tmpccmr1; }
ajhc/demo-cortex-m3
C++
null
38
/* disable_intrs - disable interrupts @port: port to enable @mask: mask to use */
static void disable_intrs(struct ioc3_port *port, uint32_t mask)
/* disable_intrs - disable interrupts @port: port to enable @mask: mask to use */ static void disable_intrs(struct ioc3_port *port, uint32_t mask)
{ if (port->ip_card->ic_enable & mask) { ioc3_disable(port->ip_is, port->ip_idd, mask); port->ip_card->ic_enable &= ~mask; } }
robutest/uclinux
C++
GPL-2.0
60
/* BusLogic_CreateInitialCCBs allocates the initial CCBs for Host Adapter. */
static bool __init BusLogic_CreateInitialCCBs(struct BusLogic_HostAdapter *HostAdapter)
/* BusLogic_CreateInitialCCBs allocates the initial CCBs for Host Adapter. */ static bool __init BusLogic_CreateInitialCCBs(struct BusLogic_HostAdapter *HostAdapter)
{ int BlockSize = BusLogic_CCB_AllocationGroupSize * sizeof(struct BusLogic_CCB); void *BlockPointer; dma_addr_t BlockPointerHandle; while (HostAdapter->AllocatedCCBs < HostAdapter->InitialCCBs) { BlockPointer = pci_alloc_consistent(HostAdapter->PCI_Device, BlockSize, &BlockPointerHandle); if (BlockPointer == N...
robutest/uclinux
C++
GPL-2.0
60
/* Read the uncompressed fragment lookup table indexes off disk into memory */
__le64* squashfs_read_fragment_index_table(struct super_block *sb, u64 fragment_table_start, unsigned int fragments)
/* Read the uncompressed fragment lookup table indexes off disk into memory */ __le64* squashfs_read_fragment_index_table(struct super_block *sb, u64 fragment_table_start, unsigned int fragments)
{ unsigned int length = SQUASHFS_FRAGMENT_INDEX_BYTES(fragments); __le64 *fragment_index; int err; fragment_index = kmalloc(length, GFP_KERNEL); if (fragment_index == NULL) { ERROR("Failed to allocate fragment index table\n"); return ERR_PTR(-ENOMEM); } err = squashfs_read_table(sb, fragment_index, fragment_...
robutest/uclinux
C++
GPL-2.0
60
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */
gboolean _g_freedesktop_dbus_call_reload_config_sync(_GFreedesktopDBus *proxy, GCancellable *cancellable, GError **error)
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */ gboolean _g_freedesktop_dbus_call_reload_config_sync(_GFreedesktopDBus *proxy, GCancellable *cancellable, GError **error)
{ GVariant *_ret; _ret = g_dbus_proxy_call_sync (G_DBUS_PROXY (proxy), "ReloadConfig", g_variant_new ("()"), G_DBUS_CALL_FLAGS_NONE, -1, cancellable, error); if (_ret == NULL) goto _out; g_variant_get (_ret, "()"); g_variant_unref (_ret); _out: return _ret != NUL...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Disables an External Interrupt event output. Disables one or more output events from the External Interrupt module. See here for a list of events this module supports. */
void extint_disable_events(struct extint_events *const events)
/* Disables an External Interrupt event output. Disables one or more output events from the External Interrupt module. See here for a list of events this module supports. */ void extint_disable_events(struct extint_events *const events)
{ Assert(events); Eic *const eics[EIC_INST_NUM] = EIC_INSTS; for (uint32_t i = 0; i < EIC_INST_NUM; i++) { uint32_t event_mask = 0; for (uint32_t j = 0; j < 32; j++) { if (events->generate_event_on_detect[(32 * i) + j]) { event_mask |= (1UL << j); } } eics[i]->EVCTRL.reg &= ~event_mask; } }
memfault/zero-to-main
C++
null
200
/* Reads and returns the current value of CR4. This function is only available on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on x64. */
UINTN EFIAPI AsmReadCr4(VOID)
/* Reads and returns the current value of CR4. This function is only available on IA-32 and x64. This returns a 32-bit value on IA-32 and a 64-bit value on x64. */ UINTN EFIAPI AsmReadCr4(VOID)
{ __asm { _emit 0x0f _emit 0x20 _emit 0xE0 } }
tianocore/edk2
C++
Other
4,240
/* Awaiting h/w semaphore to continue with version check. */
static void bfa_ioc_sm_fwcheck(struct bfa_ioc_s *ioc, enum ioc_event event)
/* Awaiting h/w semaphore to continue with version check. */ static void bfa_ioc_sm_fwcheck(struct bfa_ioc_s *ioc, enum ioc_event event)
{ bfa_trc(ioc, event); switch (event) { case IOC_E_SEMLOCKED: if (bfa_ioc_firmware_lock(ioc)) { ioc->retry_count = 0; bfa_fsm_set_state(ioc, bfa_ioc_sm_hwinit); } else { bfa_ioc_hw_sem_release(ioc); bfa_fsm_set_state(ioc, bfa_ioc_sm_mismatch); } break; case IOC_E_DISABLE: bfa_ioc_disable_comp(...
robutest/uclinux
C++
GPL-2.0
60
/* Drives the SMBusAlert pin high or low for the specified I2C. */
void I2C_ConfigSmbusAlert(I2C_Module *I2Cx, uint16_t I2C_SMBusAlert)
/* Drives the SMBusAlert pin high or low for the specified I2C. */ void I2C_ConfigSmbusAlert(I2C_Module *I2Cx, uint16_t I2C_SMBusAlert)
{ assert_param(IS_I2C_PERIPH(I2Cx)); assert_param(IS_I2C_SMB_ALERT(I2C_SMBusAlert)); if (I2C_SMBusAlert == I2C_SMBALERT_LOW) { I2Cx->CTRL1 |= I2C_SMBALERT_LOW; } else { I2Cx->CTRL1 &= I2C_SMBALERT_HIGH; } }
pikasTech/PikaPython
C++
MIT License
1,403
/* Build a fragment table to contain the fragments in the net buffer. This is the opposite operation of the NetbufFromExt. */
EFI_STATUS EFIAPI NetbufBuildExt(IN NET_BUF *Nbuf, IN OUT NET_FRAGMENT *ExtFragment, IN OUT UINT32 *ExtNum)
/* Build a fragment table to contain the fragments in the net buffer. This is the opposite operation of the NetbufFromExt. */ EFI_STATUS EFIAPI NetbufBuildExt(IN NET_BUF *Nbuf, IN OUT NET_FRAGMENT *ExtFragment, IN OUT UINT32 *ExtNum)
{ UINT32 Index; UINT32 Current; Current = 0; for (Index = 0; (Index < Nbuf->BlockOpNum); Index++) { if (Nbuf->BlockOp[Index].Size == 0) { continue; } if (Current < *ExtNum) { ExtFragment[Current].Bulk = Nbuf->BlockOp[Index].Head; ExtFragment[Current].Len = Nbuf->BlockOp[Index].S...
tianocore/edk2
C++
Other
4,240
/* If 32-bit MMIO register operations are not supported, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI MmioAnd32(IN UINTN Address, IN UINT32 AndData)
/* If 32-bit MMIO register operations are not supported, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ UINT32 EFIAPI MmioAnd32(IN UINTN Address, IN UINT32 AndData)
{ return MmioWrite32 (Address, MmioRead32 (Address) & AndData); }
tianocore/edk2
C++
Other
4,240
/* Wait for the On-Board Processor to return its start-up acknowledgement sequence. This wait is too long for us to perform "busy-waiting", and so we must sleep. This in turn means that we must not be holding any spinlocks when we call this function. */
static int obp_startup_ack(struct soundscape *s, unsigned timeout)
/* Wait for the On-Board Processor to return its start-up acknowledgement sequence. This wait is too long for us to perform "busy-waiting", and so we must sleep. This in turn means that we must not be holding any spinlocks when we call this function. */ static int obp_startup_ack(struct soundscape *s, unsigned timeout...
{ unsigned long end_time = jiffies + msecs_to_jiffies(timeout); do { unsigned long flags; int x; spin_lock_irqsave(&s->lock, flags); x = host_read_unsafe(s->io_base); spin_unlock_irqrestore(&s->lock, flags); if (x == 0xfe || x == 0xff) return 1; msleep(10); } while (time_before(jiffies, end_time)); ...
robutest/uclinux
C++
GPL-2.0
60
/* Read an integer value for ASN.1 data Note: This function allocates memory which must be freed by the user. */
int ICACHE_FLASH_ATTR asn1_get_int(const uint8_t *buf, int *offset, uint8_t **object)
/* Read an integer value for ASN.1 data Note: This function allocates memory which must be freed by the user. */ int ICACHE_FLASH_ATTR asn1_get_int(const uint8_t *buf, int *offset, uint8_t **object)
{ int len; if ((len = asn1_next_obj(buf, offset, ASN1_INTEGER)) < 0) goto end_int_array; if (len > 1 && buf[*offset] == 0x00) { len--; (*offset)++; } *object = (uint8_t *)malloc(len); memcpy(*object, &buf[*offset], len); *offset += len; end_int_array: return l...
eerimoq/simba
C++
Other
337
/* This is not in any way a standard or condoned UUID function; it just something that's needed for user-level file handles. */
void uuid_getnodeuniq(uuid_t *uuid, int fsid[2])
/* This is not in any way a standard or condoned UUID function; it just something that's needed for user-level file handles. */ void uuid_getnodeuniq(uuid_t *uuid, int fsid[2])
{ xfs_uu_t *uup = (xfs_uu_t *)uuid; fsid[0] = (be16_to_cpu(uup->uu_clockseq) << 16) | be16_to_cpu(uup->uu_timemid); fsid[1] = be32_to_cpu(uup->uu_timelow); }
robutest/uclinux
C++
GPL-2.0
60
/* Processor specific hook point each time a CPU exits System Management Mode. */
VOID EFIAPI SmmCpuFeaturesRendezvousExit(IN UINTN CpuIndex)
/* Processor specific hook point each time a CPU exits System Management Mode. */ VOID EFIAPI SmmCpuFeaturesRendezvousExit(IN UINTN CpuIndex)
{ if (mCpuHotEjectData != NULL) { CPU_HOT_EJECT_HANDLER Handler; MemoryFence (); Handler = mCpuHotEjectData->Handler; if (Handler != NULL) { Handler (CpuIndex); } } }
tianocore/edk2
C++
Other
4,240
/* Clear FeaturesVerified in published HSTI table. This API will update the HSTI table with indicated Role and ImplementationID, NULL ImplementationID means to find the first HSTI table with indicated Role. */
EFI_STATUS EFIAPI HstiLibClearFeaturesVerified(IN UINT32 Role, IN CHAR16 *ImplementationID OPTIONAL, IN UINT32 ByteIndex, IN UINT8 BitMask)
/* Clear FeaturesVerified in published HSTI table. This API will update the HSTI table with indicated Role and ImplementationID, NULL ImplementationID means to find the first HSTI table with indicated Role. */ EFI_STATUS EFIAPI HstiLibClearFeaturesVerified(IN UINT32 Role, IN CHAR16 *ImplementationID OPTIONAL, IN UINT32...
{ return InternalHstiRecordFeaturesVerified ( Role, ImplementationID, ByteIndex, BitMask, FALSE ); }
tianocore/edk2
C++
Other
4,240
/* pnp_remove_card - removes a PnP card from the PnP Layer @card: pointer to the card to remove */
void pnp_remove_card(struct pnp_card *card)
/* pnp_remove_card - removes a PnP card from the PnP Layer @card: pointer to the card to remove */ void pnp_remove_card(struct pnp_card *card)
{ struct list_head *pos, *temp; device_unregister(&card->dev); spin_lock(&pnp_lock); list_del(&card->global_list); list_del(&card->protocol_list); spin_unlock(&pnp_lock); list_for_each_safe(pos, temp, &card->devices) { struct pnp_dev *dev = card_to_pnp_dev(pos); pnp_remove_card_device(dev); } }
robutest/uclinux
C++
GPL-2.0
60
/* ADC Power On. If the ADC is in power-down mode then it is powered up. The application needs to wait a time of about 3 microseconds for stabilization before using the ADC. If the ADC is already on this function call will have no effect. NOTE Common with L1 and F2 */
void adc_power_on(uint32_t adc)
/* ADC Power On. If the ADC is in power-down mode then it is powered up. The application needs to wait a time of about 3 microseconds for stabilization before using the ADC. If the ADC is already on this function call will have no effect. NOTE Common with L1 and F2 */ void adc_power_on(uint32_t adc)
{ ADC_CR2(adc) |= ADC_CR2_ADON; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* This is the the 40-bits of eventx counter. The value in this register increments each time the event selected in PMCRx occurs. */
uint64_t SYSPM_GetEventCounter(SYSPM_Type *base, syspm_monitor_t monitor, syspm_event_t event)
/* This is the the 40-bits of eventx counter. The value in this register increments each time the event selected in PMCRx occurs. */ uint64_t SYSPM_GetEventCounter(SYSPM_Type *base, syspm_monitor_t monitor, syspm_event_t event)
{ uint32_t highOld; uint32_t high; uint32_t low; highOld = base->PMCR[(uint8_t)monitor].PMECTR[(uint8_t)event].HI; while (true) { low = base->PMCR[(uint8_t)monitor].PMECTR[(uint8_t)event].LO; high = base->PMCR[(uint8_t)monitor].PMECTR[(uint8_t)event].HI; if (high == high...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Function for turning off LEDs. Sets the pin low state according to active_high parameter. */
__STATIC_INLINE void led_off(low_power_pwm_t *p_pwm_instance)
/* Function for turning off LEDs. Sets the pin low state according to active_high parameter. */ __STATIC_INLINE void led_off(low_power_pwm_t *p_pwm_instance)
{ if (p_pwm_instance->active_high) { nrf_gpio_pins_clear(p_pwm_instance->bit_mask_toggle); } else { nrf_gpio_pins_set(p_pwm_instance->bit_mask_toggle); } p_pwm_instance->led_is_on = false; }
labapart/polymcu
C++
null
201
/* To use these functions, you must explicitly include the "glib-unix.h" header. */
static gboolean g_unix_set_error_from_errno(GError **error, gint saved_errno)
/* To use these functions, you must explicitly include the "glib-unix.h" header. */ static gboolean g_unix_set_error_from_errno(GError **error, gint saved_errno)
{ g_set_error_literal (error, G_UNIX_ERROR, 0, g_strerror (saved_errno)); errno = saved_errno; return FALSE; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Now we can finally start doing some real work.. */
static void __init do_basic_setup(void)
/* Now we can finally start doing some real work.. */ static void __init do_basic_setup(void)
{ init_workqueues(); cpuset_init_smp(); usermodehelper_init(); init_tmpfs(); driver_init(); init_irq_proc(); do_ctors(); do_initcalls(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Frees memory that was allocated in function CoherentPciIoAllocateBuffer (). */
STATIC EFI_STATUS EFIAPI CoherentPciIoFreeBuffer(IN EFI_PCI_IO_PROTOCOL *This, IN UINTN Pages, IN VOID *HostAddress)
/* Frees memory that was allocated in function CoherentPciIoAllocateBuffer (). */ STATIC EFI_STATUS EFIAPI CoherentPciIoFreeBuffer(IN EFI_PCI_IO_PROTOCOL *This, IN UINTN Pages, IN VOID *HostAddress)
{ FreePages (HostAddress, Pages); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Hardware initialisation to generate the RTOS tick. This uses timer 0 but could alternatively use the watchdog timer or timer 1. */
void vPortSetupTimerInterrupt(void)
/* Hardware initialisation to generate the RTOS tick. This uses timer 0 but could alternatively use the watchdog timer or timer 1. */ void vPortSetupTimerInterrupt(void)
{ TACTL = 0; TACTL = TASSEL_1; TACTL |= TACLR; TACCR0 = portACLK_FREQUENCY_HZ / configTICK_RATE_HZ; TACCTL0 = CCIE; TACTL |= TACLR; TACTL |= MC_1; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Enable all the periph clock via PMC (Becareful of the last 2 bits, it is not periph clock) */
void PMC_EnableAllPeripherals(void)
/* Enable all the periph clock via PMC (Becareful of the last 2 bits, it is not periph clock) */ void PMC_EnableAllPeripherals(void)
{ AT91C_BASE_PMC->PMC_PCER = MASK_STATUS; while( (AT91C_BASE_PMC->PMC_PCSR & MASK_STATUS) != MASK_STATUS); TRACE_INFO("Enable all periph clocks\n\r"); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* If the major numbers are different, they are incompatible. If the current minor is greater than the request, they are incompatible. If the current minor is less than or equal to the request, they are compatible, and the requester should run at the current minor version. */
static int fs_protocol_compare(struct ocfs2_protocol_version *existing, struct ocfs2_protocol_version *request)
/* If the major numbers are different, they are incompatible. If the current minor is greater than the request, they are incompatible. If the current minor is less than or equal to the request, they are compatible, and the requester should run at the current minor version. */ static int fs_protocol_compare(struct ocfs...
{ if (existing->pv_major != request->pv_major) return 1; if (existing->pv_minor > request->pv_minor) return 1; if (existing->pv_minor < request->pv_minor) request->pv_minor = existing->pv_minor; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* check if the usb-packet in buf contains an abort-transfer command. (if yes, all queued data will be dropped) */
static int isAbortTrfCmnd(const unsigned char *buf)
/* check if the usb-packet in buf contains an abort-transfer command. (if yes, all queued data will be dropped) */ static int isAbortTrfCmnd(const unsigned char *buf)
{ if (0 == memcmp(buf, GARMIN_STOP_TRANSFER_REQ, sizeof(GARMIN_STOP_TRANSFER_REQ)) || 0 == memcmp(buf, GARMIN_STOP_TRANSFER_REQ_V2, sizeof(GARMIN_STOP_TRANSFER_REQ_V2))) return 1; else return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* wait for construction of a key to complete */
int wait_for_key_construction(struct key *key, bool intr)
/* wait for construction of a key to complete */ int wait_for_key_construction(struct key *key, bool intr)
{ int ret; ret = wait_on_bit(&key->flags, KEY_FLAG_USER_CONSTRUCT, intr ? key_wait_bit_intr : key_wait_bit, intr ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE); if (ret < 0) return ret; return key_validate(key); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Reset WINC1500 SoC by setting CHIP_EN and RESET_N signals low, CHIP_EN high then RESET_N high. */
nm_bsp_reset(void)
/* Reset WINC1500 SoC by setting CHIP_EN and RESET_N signals low, CHIP_EN high then RESET_N high. */ nm_bsp_reset(void)
{ ioport_set_pin_level(CONF_WILC_PIN_CHIP_ENABLE, IOPORT_PIN_LEVEL_LOW); ioport_set_pin_level(CONF_WILC_PIN_RESET, IOPORT_PIN_LEVEL_LOW); nm_bsp_sleep(100); ioport_set_pin_level(CONF_WILC_PIN_CHIP_ENABLE, IOPORT_PIN_LEVEL_HIGH); nm_bsp_sleep(100); ioport_set_pin_level(CONF_WILC_PIN_RESET, IOPORT_PIN_LEVEL_HIGH); ...
remotemcu/remcu-chip-sdks
C++
null
436
/* Starts the message padding and calculation of the final message */
void HASH_StartDigest(void)
/* Starts the message padding and calculation of the final message */ void HASH_StartDigest(void)
{ HASH->STR |= HASH_STR_DCAL; }
MaJerle/stm32f429
C++
null
2,036
/* In this representation, the octets are transmitted from left to right, with the */
void EthernetMACAddrSet(unsigned long ulBase, unsigned char *pucMACAddr)
/* In this representation, the octets are transmitted from left to right, with the */ void EthernetMACAddrSet(unsigned long ulBase, unsigned char *pucMACAddr)
{ unsigned long ulTemp; unsigned char *pucTemp = (unsigned char *)&ulTemp; ASSERT(ulBase == ETH_BASE); ASSERT(pucMACAddr != 0); pucTemp[0] = pucMACAddr[0]; pucTemp[1] = pucMACAddr[1]; pucTemp[2] = pucMACAddr[2]; pucTemp[3] = pucMACAddr[3]; HWREG(ulBase + MAC_O_IA0) = ulTemp; ulTe...
watterott/WebRadio
C++
null
71
/* This function compares two positions in the boot script table and returns their relative positions. If Position1 is before Position2, then -1 is returned. If Position1 is equal to Position2, then 0 is returned. If Position1 is after Position2, then 1 is returned. */
EFI_STATUS EFIAPI BootScriptCompare(IN CONST EFI_S3_SAVE_STATE_PROTOCOL *This, IN EFI_S3_BOOT_SCRIPT_POSITION Position1, IN EFI_S3_BOOT_SCRIPT_POSITION Position2, OUT UINTN *RelativePosition)
/* This function compares two positions in the boot script table and returns their relative positions. If Position1 is before Position2, then -1 is returned. If Position1 is equal to Position2, then 0 is returned. If Position1 is after Position2, then 1 is returned. */ EFI_STATUS EFIAPI BootScriptCompare(IN CONST EFI_S...
{ return S3BootScriptCompare (Position1, Position2, RelativePosition); }
tianocore/edk2
C++
Other
4,240
/* Forces the TIMx output 6 waveform to active or inactive level. */
void TIM_ConfigForcedOc6(TIM_Module *TIMx, uint16_t TIM_ForcedAction)
/* Forces the TIMx output 6 waveform to active or inactive level. */ void TIM_ConfigForcedOc6(TIM_Module *TIMx, uint16_t TIM_ForcedAction)
{ uint16_t tmpccmr3 = 0; assert_param(IsTimList1Module(TIMx)); assert_param(IsTimForceActive(TIM_ForcedAction)); tmpccmr3 = TIMx->CCMOD3; tmpccmr3 &= (uint16_t) ~((uint16_t)TIM_CCMOD3_OC6MD); tmpccmr3 |= (uint16_t)(TIM_ForcedAction << 8); TIMx->CCMOD3 = tmpccmr3; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Note: This is in section 7.5.2.3 of the IEEE 802.15.4-2006 document, with 7.3.8 describing coordinator realignment. */
static int fake_start_req(struct net_device *dev, struct ieee802154_addr *addr, u8 channel, u8 page, u8 bcn_ord, u8 sf_ord, u8 pan_coord, u8 blx, u8 coord_realign)
/* Note: This is in section 7.5.2.3 of the IEEE 802.15.4-2006 document, with 7.3.8 describing coordinator realignment. */ static int fake_start_req(struct net_device *dev, struct ieee802154_addr *addr, u8 channel, u8 page, u8 bcn_ord, u8 sf_ord, u8 pan_coord, u8 blx, u8 coord_realign)
{ struct wpan_phy *phy = fake_to_phy(dev); mutex_lock(&phy->pib_lock); phy->current_channel = channel; phy->current_page = page; mutex_unlock(&phy->pib_lock); ieee802154_nl_start_confirm(dev, IEEE802154_INVALID_PARAMETER); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* DMAMUX Reset DMA Channel. Reset DMA Request configuration and interrupt flags for given DMA channel. */
void dmamux_reset_dma_channel(uint32_t dmamux, uint8_t channel)
/* DMAMUX Reset DMA Channel. Reset DMA Request configuration and interrupt flags for given DMA channel. */ void dmamux_reset_dma_channel(uint32_t dmamux, uint8_t channel)
{ DMAMUX_CxCR(dmamux, channel) = 0; dmamux_clear_dma_request_sync_overrun(dmamux, channel); }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Terminates the current command by inverting the EEPROM's chip select pin. */
static void e1000_stop_nvm(struct e1000_hw *hw)
/* Terminates the current command by inverting the EEPROM's chip select pin. */ static void e1000_stop_nvm(struct e1000_hw *hw)
{ u32 eecd; eecd = rd32(E1000_EECD); if (hw->nvm.type == e1000_nvm_eeprom_spi) { eecd |= E1000_EECD_CS; igb_lower_eec_clk(hw, &eecd); } }
robutest/uclinux
C++
GPL-2.0
60
/* DMA2D MSP Initialization This function configures the hardware resources used in this example: */
void HAL_DMA2D_MspInit(DMA2D_HandleTypeDef *hdma2d)
/* DMA2D MSP Initialization This function configures the hardware resources used in this example: */ void HAL_DMA2D_MspInit(DMA2D_HandleTypeDef *hdma2d)
{ __HAL_RCC_DMA2D_CLK_ENABLE(); HAL_NVIC_SetPriority(DMA2D_IRQn, 0, 0); HAL_NVIC_EnableIRQ(DMA2D_IRQn); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* srp_release_transport - release SRP transport template instance @t: transport template instance */
void srp_release_transport(struct scsi_transport_template *t)
/* srp_release_transport - release SRP transport template instance @t: transport template instance */ void srp_release_transport(struct scsi_transport_template *t)
{ struct srp_internal *i = to_srp_internal(t); transport_container_unregister(&i->t.host_attrs); transport_container_unregister(&i->rport_attr_cont); kfree(i); }
robutest/uclinux
C++
GPL-2.0
60
/* Disables the device (putting it in lower power sleep mode) */
err_t tcs34725Disable(void)
/* Disables the device (putting it in lower power sleep mode) */ err_t tcs34725Disable(void)
{ uint8_t reg = 0; ASSERT_STATUS(tcs34725Read8(TCS34725_ENABLE, &reg)); ASSERT_STATUS(tcs34725Write8(TCS34725_ENABLE, reg & ~(TCS34725_ENABLE_PON | TCS34725_ENABLE_AEN))); return ERROR_NONE; }
microbuilder/LPC11U_LPC13U_CodeBase
C++
Other
54
/* ADC Calibration mode. Serial console prints the ADC input voltage after calibration done. */
void adc_calibration(void)
/* ADC Calibration mode. Serial console prints the ADC input voltage after calibration done. */ void adc_calibration(void)
{ uint8_t key; printf("\x0C\n-- Start of ADC Calibration Example --\n"); configure_adc(); printf("Commands:\n"); printf("- key 'c' to enable correction\n"); printf("- key 'd' to disable correction\n"); key = getchar(); delay_ms(500); if (key == 'c') { adc_correction_start(); } if (key == 'd') { adc_correc...
memfault/zero-to-main
C++
null
200
/* Functions associated with SGI_XPC_ACTIVATE IRQ. Notify the heartbeat check thread that an activate IRQ has been received. */
static irqreturn_t xpc_handle_activate_IRQ_sn2(int irq, void *dev_id)
/* Functions associated with SGI_XPC_ACTIVATE IRQ. Notify the heartbeat check thread that an activate IRQ has been received. */ static irqreturn_t xpc_handle_activate_IRQ_sn2(int irq, void *dev_id)
{ unsigned long irq_flags; spin_lock_irqsave(&xpc_activate_IRQ_rcvd_lock, irq_flags); xpc_activate_IRQ_rcvd++; spin_unlock_irqrestore(&xpc_activate_IRQ_rcvd_lock, irq_flags); wake_up_interruptible(&xpc_activate_IRQ_wq); return IRQ_HANDLED; }
robutest/uclinux
C++
GPL-2.0
60
/* получить число герц - тон CW сигнала (в десятках герц). Для телеграфа отображается частота сигнала при частоте cwpitch, при SSB - при нулевых биениях */
static int_least16_t gettone_bymode(uint_fast8_t mode)
/* получить число герц - тон CW сигнала (в десятках герц). Для телеграфа отображается частота сигнала при частоте cwpitch, при SSB - при нулевых биениях */ static int_least16_t gettone_bymode(uint_fast8_t mode)
{ if (mode != MODE_CW) return 0; return gcwpitch10 * CWPITCHSCALE; }
ua1arn/hftrx
C++
null
69
/* edma_write_slot - write parameter RAM data for slot @slot: number of parameter RAM slot being modified */
void edma_write_slot(unsigned slot, const struct edmacc_param *param)
/* edma_write_slot - write parameter RAM data for slot @slot: number of parameter RAM slot being modified */ void edma_write_slot(unsigned slot, const struct edmacc_param *param)
{ unsigned ctlr; ctlr = EDMA_CTLR(slot); slot = EDMA_CHAN_SLOT(slot); if (slot >= edma_cc[ctlr]->num_slots) return; rt_memcpy((void *)(edmacc_regs_base[ctlr] + PARM_OFFSET(slot)), param, PARM_SIZE); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Function to check if the clock is in sync. */
static int check_sync_clock(void)
/* Function to check if the clock is in sync. */ static int check_sync_clock(void)
{ atomic_t *sw_ptr; int rc; sw_ptr = &get_cpu_var(clock_sync_word); rc = (atomic_read(sw_ptr) & 0x80000000U) != 0; put_cpu_var(clock_sync_word); return rc; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Procedures for generating reports and tables in the LEMON parser generator. */
PRIVATE char* file_makename(struct lemon *lemp, const char *suffix)
/* Procedures for generating reports and tables in the LEMON parser generator. */ PRIVATE char* file_makename(struct lemon *lemp, const char *suffix)
{ char *name; char *cp; name = (char*)malloc( lemonStrlen(lemp->filename) + lemonStrlen(suffix) + 5 ); if( name==0 ){ fprintf(stderr,"Can't allocate space for a filename.\n"); exit(1); } lemon_strcpy(name,lemp->filename); cp = strrchr(name,'.'); if( cp ) *cp = 0; lemon_strcat(name,suffix); r...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Converts a text device path node to Logic Unit device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUnit(CHAR16 *TextDeviceNode)
/* Converts a text device path node to Logic Unit device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUnit(CHAR16 *TextDeviceNode)
{ CHAR16 *LunStr; DEVICE_LOGICAL_UNIT_DEVICE_PATH *LogicalUnit; LunStr = GetNextParamStr (&TextDeviceNode); LogicalUnit = (DEVICE_LOGICAL_UNIT_DEVICE_PATH *) CreateDeviceNode ( MESSAGING_DEVICE_PATH, ...
tianocore/edk2
C++
Other
4,240
/* Calibrate for too-slow or too-fast oscillator. If no correction is needed, set value to zero. */
enum status_code rtc_count_frequency_correction(struct rtc_module *const module, const int8_t value)
/* Calibrate for too-slow or too-fast oscillator. If no correction is needed, set value to zero. */ enum status_code rtc_count_frequency_correction(struct rtc_module *const module, const int8_t value)
{ Assert(module); Assert(module->hw); Rtc *const rtc_module = module->hw; if (abs(value) > 0x7F) { return STATUS_ERR_INVALID_ARG; } uint32_t new_correction_value; new_correction_value = abs(value); if (value < 0) { new_correction_value |= RTC_FREQCORR_SIGN; } while (rtc_count_is_syncing(module)) { } rtc...
memfault/zero-to-main
C++
null
200
/* \method isconnected() Return True if connected to an AP and an IP address has been assigned, false otherwise. */
STATIC mp_obj_t esp_isconnected(mp_obj_t self_in)
/* \method isconnected() Return True if connected to an AP and an IP address has been assigned, false otherwise. */ STATIC mp_obj_t esp_isconnected(mp_obj_t self_in)
{ if (wifi_station_get_connect_status() == STATION_GOT_IP) { return mp_const_true; } } else { if (wifi_softap_get_station_num() > 0) { return mp_const_true; } } return mp_const_false; }
micropython/micropython
C++
Other
18,334
/* GCC version not support t-head cache flush, so we use fixed code to achieve. The following function cannot be optimized. */
static void dcache_wb_range(unsigned long start, unsigned long end) __attribute__((optimize("O0")))
/* GCC version not support t-head cache flush, so we use fixed code to achieve. The following function cannot be optimized. */ static void dcache_wb_range(unsigned long start, unsigned long end) __attribute__((optimize("O0")))
{ CACHE_OP_RANGE(OPC_DCACHE_CVA(CACHE_OP_RS1)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535