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
/* FC transport template entry, get SCSI host active fc4s. */
static void bfad_im_get_host_active_fc4s(struct Scsi_Host *shost)
/* FC transport template entry, get SCSI host active fc4s. */ static void bfad_im_get_host_active_fc4s(struct Scsi_Host *shost)
{ struct bfad_im_port_s *im_port = (struct bfad_im_port_s *) shost->hostdata[0]; struct bfad_port_s *port = im_port->port; memset(fc_host_active_fc4s(shost), 0, sizeof(fc_host_active_fc4s(shost))); if (port->supported_fc4s & (BFA_PORT_ROLE_FCP_IM | BFA_PORT_ROLE_FCP_TM)) fc_host_active_fc4s(shost)[2] = 1; if (port->supported_fc4s & BFA_PORT_ROLE_FCP_IPFC) fc_host_active_fc4s(shost)[3] = 0x20; fc_host_active_fc4s(shost)[7] = 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Try to "constant-fold" an operation; return 1 iff successful. (In this case, 'e1' has the final result.) */
static int constfolding(FuncState *fs, int op, expdesc *e1, const expdesc *e2)
/* Try to "constant-fold" an operation; return 1 iff successful. (In this case, 'e1' has the final result.) */ static int constfolding(FuncState *fs, int op, expdesc *e1, const expdesc *e2)
{ TValue v1, v2, res; if (!tonumeral(e1, &v1) || !tonumeral(e2, &v2) || !validop(op, &v1, &v2)) return 0; luaO_arith(fs->ls->L, op, &v1, &v2, &res); if (ttisinteger(&res)) { e1->k = VKINT; e1->u.ival = ivalue(&res); } else { lua_Number n = fltvalue(&res); if (luai_numisnan(n) || n == 0) return 0; e1->k = VKFLT; e1->u.nval = n; } return 1; }
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* Read and write, they both share the same lock. We do this to serialize reads and writes on Atheros 802.11n PCI devices only. This is required as the FIFO on these devices can only accept sanely 2 requests. After that the device goes bananas. Serializing the reads/writes prevents this from happening. */
static void ath9k_iowrite32(void *hw_priv, u32 val, u32 reg_offset)
/* Read and write, they both share the same lock. We do this to serialize reads and writes on Atheros 802.11n PCI devices only. This is required as the FIFO on these devices can only accept sanely 2 requests. After that the device goes bananas. Serializing the reads/writes prevents this from happening. */ static void ath9k_iowrite32(void *hw_priv, u32 val, u32 reg_offset)
{ struct ath_hw *ah = (struct ath_hw *) hw_priv; struct ath_common *common = ath9k_hw_common(ah); struct ath_softc *sc = (struct ath_softc *) common->priv; if (ah->config.serialize_regmode == SER_REG_MODE_ON) { unsigned long flags; spin_lock_irqsave(&sc->sc_serial_rw, flags); iowrite32(val, sc->mem + reg_offset); spin_unlock_irqrestore(&sc->sc_serial_rw, flags); } else iowrite32(val, sc->mem + reg_offset); }
robutest/uclinux
C++
GPL-2.0
60
/* EP Bulk IN handler, used to send data to the Host. */
static void mass_storage_bulk_in(uint8_t ep, enum usb_dc_ep_cb_status_code ep_status)
/* EP Bulk IN handler, used to send data to the Host. */ static void mass_storage_bulk_in(uint8_t ep, enum usb_dc_ep_cb_status_code ep_status)
{ ARG_UNUSED(ep_status); ARG_UNUSED(ep); switch (stage) { case MSC_PROCESS_CBW: switch (cbw.CB[0]) { case READ10: case READ12: memoryRead(); break; default: LOG_ERR("< BI-PROC_CBW default <<ERROR!!>>"); break; } break; case MSC_SEND_CSW: LOG_DBG("< BI - MSC_SEND_CSW"); sendCSW(); break; case MSC_WAIT_CSW: LOG_DBG("< BI - MSC_WAIT_CSW"); stage = MSC_READ_CBW; break; default: LOG_WRN("Stall IN endpoint, stage: %d", stage); usb_ep_set_stall(mass_ep_data[MSD_IN_EP_IDX].ep_addr); sendCSW(); break; } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Pointer to image @size: Size of image in bytes */
static void set_em100_mode(char *image, int size)
/* Pointer to image @size: Size of image in bytes */ static void set_em100_mode(char *image, int size)
{ struct fdbar_t *fdb = find_fd(image, size); struct fcba_t *fcba; fcba = (struct fcba_t *)(image + (((fdb->flmap0) & 0xff) << 4)); fcba->flcomp &= ~(1 << 30); set_spi_frequency(image, size, SPI_FREQUENCY_20MHZ); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Set the fields of structure stc_crc_init_t to default values. */
int32_t CRC_StructInit(stc_crc_init_t *pstcCrcInit)
/* Set the fields of structure stc_crc_init_t to default values. */ int32_t CRC_StructInit(stc_crc_init_t *pstcCrcInit)
{ int32_t i32Ret = LL_ERR_INVD_PARAM; if (NULL != pstcCrcInit) { pstcCrcInit->u32Protocol = CRC_CRC16; pstcCrcInit->u32InitValue = CRC_INIT_VALUE_DEFAULT; pstcCrcInit->u32RefIn = CRC_REFIN_ENABLE; pstcCrcInit->u32RefOut = CRC_REFOUT_ENABLE; pstcCrcInit->u32XorOut = CRC_XOROUT_ENABLE; i32Ret = LL_OK; } return i32Ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get the 3-wire SPI start interrupt flag of the specified SPI port. */
unsigned long SPI3WireStartIntFlagGet(unsigned long ulBase)
/* Get the 3-wire SPI start interrupt flag of the specified SPI port. */ unsigned long SPI3WireStartIntFlagGet(unsigned long ulBase)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE) ); return (xHWREG(ulBase + SPI_CNTRL2) & SPI_CNTRL2_SLV_START_INTSTS); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Scheduler clock - returns current time in nanosec units. */
unsigned long long sched_clock(void)
/* Scheduler clock - returns current time in nanosec units. */ unsigned long long sched_clock(void)
{ return jiffies_64 * (1000000000 / HZ); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Clear transfer complete flag @rmtoll ICR CTCF LL_SWPMI_ClearFlag_TC. */
void LL_SWPMI_ClearFlag_TC(SWPMI_TypeDef *SWPMIx)
/* Clear transfer complete flag @rmtoll ICR CTCF LL_SWPMI_ClearFlag_TC. */ void LL_SWPMI_ClearFlag_TC(SWPMI_TypeDef *SWPMIx)
{ WRITE_REG(SWPMIx->ICR, SWPMI_ICR_CTCF); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Write the data to the XHCI runtime register. */
VOID XhcPeiWriteRuntimeReg(IN PEI_XHC_DEV *Xhc, IN UINT32 Offset, IN UINT32 Data)
/* Write the data to the XHCI runtime register. */ VOID XhcPeiWriteRuntimeReg(IN PEI_XHC_DEV *Xhc, IN UINT32 Offset, IN UINT32 Data)
{ ASSERT (Xhc->RTSOff != 0); MmioWrite32 (Xhc->UsbHostControllerBaseAddress + Xhc->RTSOff + Offset, Data); }
tianocore/edk2
C++
Other
4,240
/* This function takes a pointer to MAC address string (i.e."XX:XX:XX:XX:XX:XX", where "XX" is a two-digit hex number) and stores it in one of the MAC address fields of the EEPROM local copy. */
static void set_mac_address(unsigned int index, const char *string)
/* This function takes a pointer to MAC address string (i.e."XX:XX:XX:XX:XX:XX", where "XX" is a two-digit hex number) and stores it in one of the MAC address fields of the EEPROM local copy. */ static void set_mac_address(unsigned int index, const char *string)
{ char *p = (char *) string; unsigned int i; if (!string) { printf("Usage: mac <n> XX:XX:XX:XX:XX:XX\n"); return; } for (i = 0; *p && (i < 6); i++) { e.mac[index][i] = simple_strtoul(p, &p, 16); if (*p == ':') p++; } update_crc(); }
EmcraftSystems/u-boot
C++
Other
181
/* If BaseAddress is not aligned on a 4KB boundary, then ASSERT(). */
VOID EFIAPI SetLocalApicBaseAddress(IN UINTN BaseAddress)
/* If BaseAddress is not aligned on a 4KB boundary, then ASSERT(). */ VOID EFIAPI SetLocalApicBaseAddress(IN UINTN BaseAddress)
{ MSR_IA32_APIC_BASE_REGISTER ApicBaseMsr; ASSERT ((BaseAddress & (SIZE_4KB - 1)) == 0); if (!LocalApicBaseAddressMsrSupported ()) { return; } ApicBaseMsr.Uint64 = LocalApicReadMsrReg64 (MSR_IA32_APIC_BASE); ApicBaseMsr.Bits.ApicBase = (UINT32)(BaseAddress >> 12); ApicBaseMsr.Bits.ApicBaseHi = (UINT32)(RShiftU64 ((UINT64)BaseAddress, 32)); LocalApicWriteMsrReg64 (MSR_IA32_APIC_BASE, ApicBaseMsr.Uint64); }
tianocore/edk2
C++
Other
4,240
/* Queries the controller about the given volume. The volume information is updated in the struct fsa_dev_info structure rather than returned. */
static int aac_probe_container_callback1(struct scsi_cmnd *scsicmd)
/* Queries the controller about the given volume. The volume information is updated in the struct fsa_dev_info structure rather than returned. */ static int aac_probe_container_callback1(struct scsi_cmnd *scsicmd)
{ scsicmd->device = NULL; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Set the RSA key is read from key store. */
int32_t RSA_SetKey_KS(CRPT_T *crpt, uint32_t u32KeyNum, uint32_t u32KSMemType, uint32_t u32BlindKeyNum)
/* Set the RSA key is read from key store. */ int32_t RSA_SetKey_KS(CRPT_T *crpt, uint32_t u32KeyNum, uint32_t u32KSMemType, uint32_t u32BlindKeyNum)
{ if(s_u32RsaOpMode & CRPT_RSA_CTL_SCAP_Msk) { crpt->RSA_KSCTL = (u32BlindKeyNum << 8) | (u32KSMemType << CRPT_RSA_KSCTL_RSSRC_Pos) | CRPT_RSA_KSCTL_RSRC_Msk | u32KeyNum; } else { crpt->RSA_KSCTL = (u32KSMemType << CRPT_RSA_KSCTL_RSSRC_Pos) | CRPT_RSA_KSCTL_RSRC_Msk | u32KeyNum; } return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function will return the first occurrence of a string. */
char* rt_strstr(const char *s1, const char *s2)
/* This function will return the first occurrence of a string. */ char* rt_strstr(const char *s1, const char *s2)
{ int l1, l2; l2 = rt_strlen(s2); if (!l2) return (char *)s1; l1 = rt_strlen(s1); while (l1 >= l2) { l1 --; if (!rt_memcmp(s1, s2, l2)) return (char *)s1; s1 ++; } return RT_NULL; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Reads and returns the status register of the serial flash. */
static uint8_t s25fl1xx_read_status3(struct qspid_t *qspid)
/* Reads and returns the status register of the serial flash. */ static uint8_t s25fl1xx_read_status3(struct qspid_t *qspid)
{ uint8_t status; s25fl1xx_exec_command(qspid, S25FL1XX_READ_STATUS_3, 0, (uint32_t *)&status, QSPI_READ_ACCESS, 1); return status; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Get a buffer for the block, return it with no data read. Short-form addressing. */
xfs_buf_t* xfs_btree_get_bufs(xfs_mount_t *mp, xfs_trans_t *tp, xfs_agnumber_t agno, xfs_agblock_t agbno, uint lock)
/* Get a buffer for the block, return it with no data read. Short-form addressing. */ xfs_buf_t* xfs_btree_get_bufs(xfs_mount_t *mp, xfs_trans_t *tp, xfs_agnumber_t agno, xfs_agblock_t agbno, uint lock)
{ xfs_buf_t *bp; xfs_daddr_t d; ASSERT(agno != NULLAGNUMBER); ASSERT(agbno != NULLAGBLOCK); d = XFS_AGB_TO_DADDR(mp, agno, agbno); bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, d, mp->m_bsize, lock); ASSERT(bp); ASSERT(!XFS_BUF_GETERROR(bp)); return bp; }
robutest/uclinux
C++
GPL-2.0
60
/* Determine whether this operation needs a physical present user. */
BOOLEAN NeedPhysicallyPresent(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid)
/* Determine whether this operation needs a physical present user. */ BOOLEAN NeedPhysicallyPresent(IN CHAR16 *VariableName, IN EFI_GUID *VendorGuid)
{ if (IsVariablePolicyEnabled ()) { if ( (CompareGuid (VendorGuid, &gEfiSecureBootEnableDisableGuid) && (StrCmp (VariableName, EFI_SECURE_BOOT_ENABLE_NAME) == 0)) || (CompareGuid (VendorGuid, &gEfiCustomModeEnableGuid) && (StrCmp (VariableName, EFI_CUSTOM_MODE_NAME) == 0))) { return TRUE; } } return FALSE; }
tianocore/edk2
C++
Other
4,240
/* Disables the timer/counter for a PWM generator block. */
void PWMGenDisable(unsigned long ulBase, unsigned long ulGen)
/* Disables the timer/counter for a PWM generator block. */ void PWMGenDisable(unsigned long ulBase, unsigned long ulGen)
{ ASSERT((ulBase == PWM0_BASE) || (ulBase == PWM1_BASE)); ASSERT(PWMGenValid(ulGen)); HWREG(PWM_GEN_BADDR(ulBase, + ulGen) + PWM_O_X_CTL) &= ~(PWM_X_CTL_ENABLE); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This file contains various random system calls that have a non-standard calling sequence on the Linux/m68k platform. */
asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long fd, unsigned long pgoff)
/* This file contains various random system calls that have a non-standard calling sequence on the Linux/m68k platform. */ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long fd, unsigned long pgoff)
{ return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function checks if the UBIFS volume is empty by looking if its LEBs are mapped or not. The result of checking is stored in the */
static int check_volume_empty(struct ubifs_info *c)
/* This function checks if the UBIFS volume is empty by looking if its LEBs are mapped or not. The result of checking is stored in the */ static int check_volume_empty(struct ubifs_info *c)
{ int lnum, err; c->empty = 1; for (lnum = 0; lnum < c->leb_cnt; lnum++) { err = ubi_is_mapped(c->ubi, lnum); if (unlikely(err < 0)) return err; if (err == 1) { c->empty = 0; break; } cond_resched(); } return 0; }
EmcraftSystems/u-boot
C++
Other
181
/* The interrupt handler. This is called on every event. Just call the poller directly to log any events. This could in theory increase the threshold under high load, but doesn't for now. */
static void intel_threshold_interrupt(void)
/* The interrupt handler. This is called on every event. Just call the poller directly to log any events. This could in theory increase the threshold under high load, but doesn't for now. */ static void intel_threshold_interrupt(void)
{ machine_check_poll(MCP_TIMESTAMP, &__get_cpu_var(mce_banks_owned)); mce_notify_irq(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* memory_less_node_alloc - * attempt to allocate memory on the best NUMA slit node but fall back to any other node when __alloc_bootmem_node fails for best. @nid: node id @pernodesize: size of this node's pernode data */
static void __init* memory_less_node_alloc(int nid, unsigned long pernodesize)
/* memory_less_node_alloc - * attempt to allocate memory on the best NUMA slit node but fall back to any other node when __alloc_bootmem_node fails for best. @nid: node id @pernodesize: size of this node's pernode data */ static void __init* memory_less_node_alloc(int nid, unsigned long pernodesize)
{ void *ptr = NULL; u8 best = 0xff; int bestnode = -1, node, anynode = 0; for_each_online_node(node) { if (node_isset(node, memory_less_mask)) continue; else if (node_distance(nid, node) < best) { best = node_distance(nid, node); bestnode = node; } anynode = node; } if (bestnode == -1) bestnode = anynode; ptr = __alloc_bootmem_node(pgdat_list[bestnode], pernodesize, PERCPU_PAGE_SIZE, __pa(MAX_DMA_ADDRESS)); return ptr; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function will initialize a thread, normally it's used to initialize a static thread object. */
rt_err_t rt_thread_init(struct rt_thread *thread, const char *name, void(*entry)(void *parameter), void *parameter, void *stack_start, rt_uint32_t stack_size, rt_uint8_t priority, rt_uint32_t tick)
/* This function will initialize a thread, normally it's used to initialize a static thread object. */ rt_err_t rt_thread_init(struct rt_thread *thread, const char *name, void(*entry)(void *parameter), void *parameter, void *stack_start, rt_uint32_t stack_size, rt_uint8_t priority, rt_uint32_t tick)
{ RT_ASSERT(thread != RT_NULL); RT_ASSERT(stack_start != RT_NULL); rt_object_init((rt_object_t)thread, RT_Object_Class_Thread, name); return _rt_thread_init(thread, name, entry, parameter, stack_start, stack_size, priority, tick); }
armink/FreeModbus_Slave-Master-RTT-STM32
C++
Other
1,477
/* Event notification that initialize CPU features when gEfiSmmConfigurationProtocol installs. */
VOID EFIAPI SmmConfigurationEventNotify(IN EFI_EVENT Event, IN VOID *Context)
/* Event notification that initialize CPU features when gEfiSmmConfigurationProtocol installs. */ VOID EFIAPI SmmConfigurationEventNotify(IN EFI_EVENT Event, IN VOID *Context)
{ EFI_STATUS Status; EFI_SMM_CONFIGURATION_PROTOCOL *SmmConfiguration; Status = gBS->LocateProtocol (&gEfiSmmConfigurationProtocolGuid, NULL, (VOID **)&SmmConfiguration); if (EFI_ERROR (Status)) { return; } CpuFeaturesInitializeWorker (); }
tianocore/edk2
C++
Other
4,240
/* The open question is, is this worth doing? I'm leaving it in, because it's written, but... */
static void ad1843_set_resample_mode(lithium_t *lith, int onoff)
/* The open question is, is this worth doing? I'm leaving it in, because it's written, but... */ static void ad1843_set_resample_mode(lithium_t *lith, int onoff)
{ int save_da1 = li_read_ad1843_reg(lith, 9); ad1843_write_multi(lith, 4, &ad1843_DA1EN, 0, &ad1843_DA2EN, 0, &ad1843_ADLEN, 0, &ad1843_ADREN, 0); ASSERT(onoff == 0 || onoff == 1); ad1843_write_bits(lith, &ad1843_DRSFLT, onoff); ad1843_write_multi(lith, 3, &ad1843_DA1EN, 1, &ad1843_ADLEN, 1, &ad1843_ADREN, 1); li_write_ad1843_reg(lith, 9, save_da1); }
robutest/uclinux
C++
GPL-2.0
60
/* Submit reading buffer to the UART driver. Buffer is used until bytes_number bytes are read. */
int32_t uart_read_nonblocking(struct uart_desc *desc, uint8_t *data, uint32_t bytes_number)
/* Submit reading buffer to the UART driver. Buffer is used until bytes_number bytes are read. */ int32_t uart_read_nonblocking(struct uart_desc *desc, uint8_t *data, uint32_t bytes_number)
{ struct aducm_uart_desc *extra; uint32_t to_read; if (!desc || !data || !bytes_number) return FAILURE; extra = desc->extra; if (extra->read_desc.is_nonblocking) return FAILURE; extra->read_desc.is_nonblocking = true; to_read = min(bytes_number, MAX_BYTES); extra->read_desc.pending = bytes_number - to_read; extra->read_desc.buff = data + to_read; adi_uart_SubmitRxBuffer( (ADI_UART_HANDLE const)extra->uart_handler, (void *const)data, (uint32_t const)to_read, to_read > 4 ? true : false); return SUCCESS; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Configures the tim Output Compare 4 Fast feature. */
void TIM_OC4FastConfig(TIM_TypeDef *tim, TIMOCFE_Typedef fast)
/* Configures the tim Output Compare 4 Fast feature. */ void TIM_OC4FastConfig(TIM_TypeDef *tim, TIMOCFE_Typedef fast)
{ MODIFY_REG(tim->CCMR2, TIM_CCMR2_OC4FEN, fast << 8); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns: TRUE if the base stream will be closed. */
gboolean g_filter_input_stream_get_close_base_stream(GFilterInputStream *stream)
/* Returns: TRUE if the base stream will be closed. */ gboolean g_filter_input_stream_get_close_base_stream(GFilterInputStream *stream)
{ GFilterInputStreamPrivate *priv; g_return_val_if_fail (G_IS_FILTER_INPUT_STREAM (stream), FALSE); priv = g_filter_input_stream_get_instance_private (stream); return priv->close_base; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* atl1c_exit_module is called just before the driver is removed from memory. */
static void __exit atl1c_exit_module(void)
/* atl1c_exit_module is called just before the driver is removed from memory. */ static void __exit atl1c_exit_module(void)
{ pci_unregister_driver(&atl1c_driver); }
robutest/uclinux
C++
GPL-2.0
60
/* Writes a byte of EEPROM out to the EEPROM memory space. */
static void WriteEEPROMByte(uint8_t *const Address, const uint8_t Data)
/* Writes a byte of EEPROM out to the EEPROM memory space. */ static void WriteEEPROMByte(uint8_t *const Address, const uint8_t Data)
{ eeprom_update_byte(Address, Data); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Local function to send a command + data to the USB protocol engine */
static void USBHwCmdWrite(unsigned char bCmd, unsigned short bData)
/* Local function to send a command + data to the USB protocol engine */ static void USBHwCmdWrite(unsigned char bCmd, unsigned short bData)
{ USBHwCmd(bCmd); USB->USBCmdCode = 0x00000100 | (bData << 16); Wait4DevInt(CCEMTY); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* param base FlexIO I2S peripheral base address. param handle FlexIO I2S eDMA handle pointer param format Pointer to FlexIO I2S audio data format structure. param srcClock_Hz FlexIO I2S clock source frequency in Hz, it should be 0 while in slave mode. retval kStatus_Success Audio format set successfully. retval kStatus_InvalidArgument The input arguments is invalid. */
void FLEXIO_I2S_TransferSetFormatEDMA(FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle, flexio_i2s_format_t *format, uint32_t srcClock_Hz)
/* param base FlexIO I2S peripheral base address. param handle FlexIO I2S eDMA handle pointer param format Pointer to FlexIO I2S audio data format structure. param srcClock_Hz FlexIO I2S clock source frequency in Hz, it should be 0 while in slave mode. retval kStatus_Success Audio format set successfully. retval kStatus_InvalidArgument The input arguments is invalid. */ void FLEXIO_I2S_TransferSetFormatEDMA(FLEXIO_I2S_Type *base, flexio_i2s_edma_handle_t *handle, flexio_i2s_format_t *format, uint32_t srcClock_Hz)
{ assert(handle && format); if (srcClock_Hz != 0) { FLEXIO_I2S_MasterSetFormat(base, format, srcClock_Hz); } else { FLEXIO_I2S_SlaveSetFormat(base, format); } handle->bytesPerFrame = format->bitWidth / 8U; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get factory calibration value for a given peripheral register. */
bool SYSTEM_GetCalibrationValue(volatile uint32_t *regAddress)
/* Get factory calibration value for a given peripheral register. */ bool SYSTEM_GetCalibrationValue(volatile uint32_t *regAddress)
{ SYSTEM_CalAddrVal_TypeDef * p, * end; p = (SYSTEM_CalAddrVal_TypeDef *)(DEVINFO_BASE & 0xFFFFF000); end = (SYSTEM_CalAddrVal_TypeDef *)DEVINFO_BASE; for ( ; p < end; p++) { if (p->address == 0xFFFFFFFF) { return false; } if (p->address == (uint32_t)regAddress) { *regAddress = p->calValue; return true; } } return false; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Some OMAP modules on OMAP3 ES2+ chips have both initiator and target IDLEST bits. For our purposes, we are concerned with the target IDLEST bits, which exist at a different bit position than the *CLKEN bit position for these modules (DSS and USBHOST) (The default find_idlest code assumes that they are at the same position.) No return value. */
static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk *clk, void __iomem **idlest_reg, u8 *idlest_bit)
/* Some OMAP modules on OMAP3 ES2+ chips have both initiator and target IDLEST bits. For our purposes, we are concerned with the target IDLEST bits, which exist at a different bit position than the *CLKEN bit position for these modules (DSS and USBHOST) (The default find_idlest code assumes that they are at the same position.) No return value. */ static void omap3430es2_clk_dss_usbhost_find_idlest(struct clk *clk, void __iomem **idlest_reg, u8 *idlest_bit)
{ u32 r; r = (((__force u32)clk->enable_reg & ~0xf0) | 0x20); *idlest_reg = (__force void __iomem *)r; *idlest_bit = OMAP3430ES2_ST_DSS_IDLE_SHIFT; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Reads the value from a PHY register hw - Struct containing variables accessed by shared code reg_addr - address of the PHY register to read */
int atl1e_read_phy_reg(struct atl1e_hw *hw, u16 reg_addr, u16 *phy_data)
/* Reads the value from a PHY register hw - Struct containing variables accessed by shared code reg_addr - address of the PHY register to read */ int atl1e_read_phy_reg(struct atl1e_hw *hw, u16 reg_addr, u16 *phy_data)
{ u32 val; int i; val = ((u32)(reg_addr & MDIO_REG_ADDR_MASK)) << MDIO_REG_ADDR_SHIFT | MDIO_START | MDIO_SUP_PREAMBLE | MDIO_RW | MDIO_CLK_25_4 << MDIO_CLK_SEL_SHIFT; AT_WRITE_REG(hw, REG_MDIO_CTRL, val); wmb(); for (i = 0; i < MDIO_WAIT_TIMES; i++) { udelay(2); val = AT_READ_REG(hw, REG_MDIO_CTRL); if (!(val & (MDIO_START | MDIO_BUSY))) break; wmb(); } if (!(val & (MDIO_START | MDIO_BUSY))) { *phy_data = (u16)val; return 0; } return AT_ERR_PHY; }
robutest/uclinux
C++
GPL-2.0
60
/* Setup the microcontroller system. Initialize the System and update the SystemFrequency variable. */
void SystemInit(void)
/* Setup the microcontroller system. Initialize the System and update the SystemFrequency variable. */ void SystemInit(void)
{ EFC->EEFC_FMR = EEFC_FMR_FWS(2)|EEFC_FMR_CLOE; PMC->CKGR_PLLAR = SYS_BOARD_PLLAR; while (!(PMC->PMC_SR & PMC_SR_LOCKA)) { } PMC->PMC_MCKR = SYS_BOARD_MCKR; while (!(PMC->PMC_SR & PMC_SR_MCKRDY)) { } SystemCoreClock = CHIP_FREQ_CPU_MAX; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Write does nothing. (we receive packet from ppp_generic through ppp_irnet_send()) */
static ssize_t dev_irnet_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
/* Write does nothing. (we receive packet from ppp_generic through ppp_irnet_send()) */ static ssize_t dev_irnet_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{ irnet_socket * ap = (struct irnet_socket *) file->private_data; DPASS(FS_TRACE, "(file=0x%p, ap=0x%p, count=%Zd)\n", file, ap, count); DABORT(ap == NULL, -ENXIO, FS_ERROR, "ap is NULL !!!\n"); if(ap->ppp_open) return -EAGAIN; else return irnet_ctrl_write(ap, buf, count); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enable the debounce function of the specified GPIO pin(s). The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinDebounceEnable(unsigned long ulPort, unsigned long ulPins)
/* Enable the debounce function of the specified GPIO pin(s). The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ void GPIOPinDebounceEnable(unsigned long ulPort, unsigned long ulPins)
{ xASSERT(GPIOBaseValid(ulPort)); xHWREG(ulPort + GPIO_DBEN) |= ulPins; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Initialize the context related info for a new mm_struct instance. */
int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
/* Initialize the context related info for a new mm_struct instance. */ int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
{ mm->context.page_id = NO_CONTEXT; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Internal pixel drawing - fast, no blending, locking, clipping. */
int fastPixelColor(SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color)
/* Internal pixel drawing - fast, no blending, locking, clipping. */ int fastPixelColor(SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color)
{ int result; if (SDL_MUSTLOCK(dst)) { if (SDL_LockSurface(dst) < 0) { return (-1); } } result = fastPixelColorNolock(dst, x, y, color); if (SDL_MUSTLOCK(dst)) { SDL_UnlockSurface(dst); } return (result); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Start receiving data from UART receiver.transmits the default value as specified by csi_usart_set_default_tx_value. */
int32_t csi_usart_receive(usart_handle_t handle, void *data, uint32_t num)
/* Start receiving data from UART receiver.transmits the default value as specified by csi_usart_set_default_tx_value. */ int32_t csi_usart_receive(usart_handle_t handle, void *data, uint32_t num)
{ USART_NULL_PARAM_CHK(handle); USART_NULL_PARAM_CHK(data); uint8_t *dest = NULL; dw_usart_priv_t *usart_priv = handle; dest = (uint8_t *)data; usart_priv->rx_buf = (uint8_t *)data; usart_priv->rx_total_num = num; usart_priv->rx_cnt = 0; usart_priv->rx_busy = 1; return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Read and write a data element from and to the SPI interface. */
unsigned long SPISingleDataReadWrite(unsigned long ulBase, unsigned long ulWData)
/* Read and write a data element from and to the SPI interface. */ unsigned long SPISingleDataReadWrite(unsigned long ulBase, unsigned long ulWData)
{ unsigned long ulReadTemp; xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)); while((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_GO_BUSY)) { } xHWREG(ulBase + SPI_TX0) = ulWData; xHWREG(ulBase + SPI_CNTRL) |= SPI_CNTRL_GO_BUSY; while((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_GO_BUSY)) { } ulReadTemp = xHWREG(ulBase + SPI_RX0); return ulReadTemp; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* The object that handles DNS resolution. Use g_resolver_get_default() to get */
G_DEFINE_TYPE_WITH_CODE(GResolver, g_resolver, G_TYPE_OBJECT, g_networking_init();)
/* The object that handles DNS resolution. Use g_resolver_get_default() to get */ G_DEFINE_TYPE_WITH_CODE(GResolver, g_resolver, G_TYPE_OBJECT, g_networking_init();)
{ const gchar *hostname; guint16 port, priority, weight; GSrvTarget *target; GList *l; for (l = records; l != NULL; l = g_list_next (l)) { g_variant_get (l->data, "(qqq&s)", &priority, &weight, &port, &hostname); target = g_srv_target_new (hostname, port, priority, weight); g_variant_unref (l->data); l->data = target; } return g_srv_target_list_sort (records); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* brief Disables PLL LDO via AI interface in Static/Software mode. */
void PMU_StaticDisablePllLdo(void)
/* brief Disables PLL LDO via AI interface in Static/Software mode. */ void PMU_StaticDisablePllLdo(void)
{ ANATOP_AI_Write(kAI_Itf_Ldo, kAI_PHY_LDO_CTRL0, 0UL); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* permit the bootmem allocator to evade page validation on high-order frees */
void __meminit __free_pages_bootmem(struct page *page, unsigned int order)
/* permit the bootmem allocator to evade page validation on high-order frees */ void __meminit __free_pages_bootmem(struct page *page, unsigned int order)
{ if (order == 0) { __ClearPageReserved(page); set_page_count(page, 0); set_page_refcounted(page); __free_page(page); } else { int loop; prefetchw(page); for (loop = 0; loop < BITS_PER_LONG; loop++) { struct page *p = &page[loop]; if (loop + 1 < BITS_PER_LONG) prefetchw(p + 1); __ClearPageReserved(p); set_page_count(p, 0); } set_page_refcounted(page); __free_pages(page, order); } }
robutest/uclinux
C++
GPL-2.0
60
/* Checks whether the descriptor is valid if no errors such as CRC/Receive Error/Watchdog Timeout/Late collision/Giant Frame/Overflow/Descriptor error the descritpor is said to be a valid descriptor. */
bool synopGMAC_is_desc_valid(u32 status)
/* Checks whether the descriptor is valid if no errors such as CRC/Receive Error/Watchdog Timeout/Late collision/Giant Frame/Overflow/Descriptor error the descritpor is said to be a valid descriptor. */ bool synopGMAC_is_desc_valid(u32 status)
{ return ((status & DescError) == 0); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Executes a INVD instruction. This function is only available on IA-32 and X64. */
VOID EFIAPI AsmInvd(VOID)
/* Executes a INVD instruction. This function is only available on IA-32 and X64. */ VOID EFIAPI AsmInvd(VOID)
{ __asm__ __volatile__ ("invd":::"memory"); }
tianocore/edk2
C++
Other
4,240
/* This function is used to display a string on console, normally, it's invoked by rt_kprintf */
void rt_hw_console_output(const char *str)
/* This function is used to display a string on console, normally, it's invoked by rt_kprintf */ void rt_hw_console_output(const char *str)
{ while (*str) { if (*str=='\n') { davinci_uart_putc('\r'); } davinci_uart_putc(*str++); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Init interrupts callback for the specified SPI Port. */
void SPIIntCallbackInit(unsigned long ulBase, xtEventCallback xtSPICallback)
/* Init interrupts callback for the specified SPI Port. */ void SPIIntCallbackInit(unsigned long ulBase, xtEventCallback xtSPICallback)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)); g_pfnSPIHandlerCallbacks[0] = xtSPICallback; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* The entry point for SD host controller driver, used to install this driver on the ImageHandle. */
EFI_STATUS EFIAPI InitializeSdMmcPciHcDxe(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The entry point for SD host controller driver, used to install this driver on the ImageHandle. */ EFI_STATUS EFIAPI InitializeSdMmcPciHcDxe(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; Status = EfiLibInstallDriverBindingComponentName2 ( ImageHandle, SystemTable, &gSdMmcPciHcDriverBinding, ImageHandle, &gSdMmcPciHcComponentName, &gSdMmcPciHcComponentName2 ); ASSERT_EFI_ERROR (Status); return Status; }
tianocore/edk2
C++
Other
4,240
/* Check to see if the page at the given address is a Guard page or not. */
BOOLEAN EFIAPI IsGuardPage(IN EFI_PHYSICAL_ADDRESS Address)
/* Check to see if the page at the given address is a Guard page or not. */ BOOLEAN EFIAPI IsGuardPage(IN EFI_PHYSICAL_ADDRESS Address)
{ UINT64 BitMap; BitMap = GetGuardedMemoryBits (Address - EFI_PAGE_SIZE, 3); return ((BitMap == BIT0) || (BitMap == BIT2) || (BitMap == (BIT2 | BIT0))); }
tianocore/edk2
C++
Other
4,240
/* These functions are just like the above two, except they access the Guest page tables. Hence they return a Guest address. */
static unsigned long gpgd_addr(struct lg_cpu *cpu, unsigned long vaddr)
/* These functions are just like the above two, except they access the Guest page tables. Hence they return a Guest address. */ static unsigned long gpgd_addr(struct lg_cpu *cpu, unsigned long vaddr)
{ unsigned int index = vaddr >> (PGDIR_SHIFT); return cpu->lg->pgdirs[cpu->cpu_pgd].gpgdir + index * sizeof(pgd_t); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns cb_idx, or zero means it wasn't found */
static u8 mpt_get_cb_idx(MPT_DRIVER_CLASS dclass)
/* Returns cb_idx, or zero means it wasn't found */ static u8 mpt_get_cb_idx(MPT_DRIVER_CLASS dclass)
{ u8 cb_idx; for (cb_idx = MPT_MAX_PROTOCOL_DRIVERS-1; cb_idx; cb_idx--) if (MptDriverClass[cb_idx] == dclass) return cb_idx; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This API reads the pressure, temperature and humidity data from the sensor, compensates the data and store it in the bme280_data structure instance passed by the user. */
int8_t bme280_get_sensor_data(uint8_t sensor_comp, struct bme280_data *comp_data, struct bme280_dev *dev)
/* This API reads the pressure, temperature and humidity data from the sensor, compensates the data and store it in the bme280_data structure instance passed by the user. */ int8_t bme280_get_sensor_data(uint8_t sensor_comp, struct bme280_data *comp_data, struct bme280_dev *dev)
{ int8_t rslt; uint8_t reg_data[BME280_P_T_H_DATA_LEN] = { 0 }; struct bme280_uncomp_data uncomp_data = { 0 }; rslt = null_ptr_check(dev); if ((rslt == BME280_OK) && (comp_data != NULL)) { rslt = bme280_get_regs(BME280_DATA_ADDR, reg_data, BME280_P_T_H_DATA_LEN, dev); if (rslt == BME280_OK) { bme280_parse_sensor_data(reg_data, &uncomp_data); rslt = bme280_compensate_data(sensor_comp, &uncomp_data, comp_data, &dev->calib_data); } } else { rslt = BME280_E_NULL_PTR; } return rslt; }
eclipse-threadx/getting-started
C++
Other
310
/* This routine is invoked to walk through the array of active sglq entries and free all of the resources. This is just a place holder for now. */
static void lpfc_free_active_sgl(struct lpfc_hba *)
/* This routine is invoked to walk through the array of active sglq entries and free all of the resources. This is just a place holder for now. */ static void lpfc_free_active_sgl(struct lpfc_hba *)
{ kfree(phba->sli4_hba.lpfc_sglq_active_list); }
robutest/uclinux
C++
GPL-2.0
60
/* Converts a 32-bit long to a big endian byte stream */
unsigned char* inv_int32_to_big8(long x, unsigned char *big8)
/* Converts a 32-bit long to a big endian byte stream */ unsigned char* inv_int32_to_big8(long x, unsigned char *big8)
{ big8[0] = (unsigned char)((x >> 24) & 0xff); big8[1] = (unsigned char)((x >> 16) & 0xff); big8[2] = (unsigned char)((x >> 8) & 0xff); big8[3] = (unsigned char)(x & 0xff); return big8; }
Luos-io/luos_engine
C++
MIT License
496
/* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
/* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
{ if(hadc->Instance==ADC1) { HAL_RCC_ADC12_CLK_ENABLED--; if(HAL_RCC_ADC12_CLK_ENABLED==0){ __HAL_RCC_ADC12_CLK_DISABLE(); } HAL_GPIO_DeInit(GPIOC, GPIO_PIN_0|GPIO_PIN_1); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_0|GPIO_PIN_1); HAL_GPIO_DeInit(GPIOB, GPIO_PIN_0); } else if(hadc->Instance==ADC2) { HAL_RCC_ADC12_CLK_ENABLED--; if(HAL_RCC_ADC12_CLK_ENABLED==0){ __HAL_RCC_ADC12_CLK_DISABLE(); } HAL_GPIO_DeInit(GPIOA, GPIO_PIN_4); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function is executed in case of error occurrence. */
void Error_Handler(void)
/* This function is executed in case of error occurrence. */ void Error_Handler(void)
{ while(1) { BSP_LED_Toggle(LED2); HAL_Delay(100); } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* The next function tells whether a key or value can be cleared from a weak table. Non-collectable objects are never removed from weak tables. Strings behave as */
static int iscleared(const TValue *o, int iskey)
/* The next function tells whether a key or value can be cleared from a weak table. Non-collectable objects are never removed from weak tables. Strings behave as */ static int iscleared(const TValue *o, int iskey)
{ stringmark(rawtsvalue(o)); return 0; } return iswhite(gcvalue(o)) || (ttisuserdata(o) && (!iskey && isfinalized(uvalue(o)))); }
Nicholas3388/LuaNode
C++
Other
1,055
/* Return: Pointer to the newly allocated completion-queue event if successful NULL otherwise. */
struct lpfc_cq_event* __lpfc_sli4_cq_event_alloc(struct lpfc_hba *phba)
/* Return: Pointer to the newly allocated completion-queue event if successful NULL otherwise. */ struct lpfc_cq_event* __lpfc_sli4_cq_event_alloc(struct lpfc_hba *phba)
{ struct lpfc_cq_event *cq_event = NULL; list_remove_head(&phba->sli4_hba.sp_cqe_event_pool, cq_event, struct lpfc_cq_event, list); return cq_event; }
robutest/uclinux
C++
GPL-2.0
60
/* fi An instance of a channel statemachine. event The event, just happened. arg Generic pointer, casted from channel * upon call. */
static void ctcm_chx_txiniterr(fsm_instance *fi, int event, void *arg)
/* fi An instance of a channel statemachine. event The event, just happened. arg Generic pointer, casted from channel * upon call. */ static void ctcm_chx_txiniterr(fsm_instance *fi, int event, void *arg)
{ struct channel *ch = arg; struct net_device *dev = ch->netdev; struct ctcm_priv *priv = dev->ml_priv; if (event == CTC_EVENT_TIMER) { fsm_deltimer(&ch->timer); if (ch->retry++ < 3) ctcm_chx_restart(fi, event, arg); else { fsm_newstate(fi, CTC_STATE_TXERR); fsm_event(priv->fsm, DEV_EVENT_TXDOWN, dev); } } else { CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, "%s(%s): %s in %s", CTCM_FUNTAIL, ch->id, ctc_ch_event_names[event], fsm_getstate_str(fi)); dev_warn(&dev->dev, "Initialization failed with RX/TX init handshake " "error %s\n", ctc_ch_event_names[event]); } }
robutest/uclinux
C++
GPL-2.0
60
/* Called when a joystick device file is closed */
static void grip_close(struct input_dev *dev)
/* Called when a joystick device file is closed */ static void grip_close(struct input_dev *dev)
{ struct grip_mp *grip = input_get_drvdata(dev); gameport_stop_polling(grip->gameport); }
robutest/uclinux
C++
GPL-2.0
60
/* Return: 0 on success or a negative error code on failure. */
int mipi_dsi_set_maximum_return_packet_size(struct mipi_dsi_device *dsi, u16 value)
/* Return: 0 on success or a negative error code on failure. */ int mipi_dsi_set_maximum_return_packet_size(struct mipi_dsi_device *dsi, u16 value)
{ u8 tx[2] = { value & 0xff, value >> 8 }; struct mipi_dsi_msg msg = { .channel = dsi->channel, .type = MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE, .tx_len = sizeof(tx), .tx_buf = tx, }; int ret = mipi_dsi_device_transfer(dsi, &msg); return (ret < 0) ? ret : 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* converts an msr to an appropriate reservation bit returns the bit offset of the event selection register */
static unsigned int nmi_evntsel_msr_to_bit(unsigned int msr)
/* converts an msr to an appropriate reservation bit returns the bit offset of the event selection register */ static unsigned int nmi_evntsel_msr_to_bit(unsigned int msr)
{ switch (boot_cpu_data.x86_vendor) { case X86_VENDOR_AMD: return msr - MSR_K7_EVNTSEL0; case X86_VENDOR_INTEL: if (cpu_has(&boot_cpu_data, X86_FEATURE_ARCH_PERFMON)) return msr - MSR_ARCH_PERFMON_EVENTSEL0; switch (boot_cpu_data.x86) { case 6: return msr - MSR_P6_EVNTSEL0; case 15: return msr - MSR_P4_BSU_ESCR0; } } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set OSD display window, including start position, width and height. */
void vpostOSDSetWindow(uint32_t u32XStart, uint32_t u32YStart, uint32_t u32Width, uint32_t u32Height)
/* Set OSD display window, including start position, width and height. */ void vpostOSDSetWindow(uint32_t u32XStart, uint32_t u32YStart, uint32_t u32Width, uint32_t u32Height)
{ outpw(REG_LCM_OSD_WINS, ((u32YStart + 1) << 16) | (u32XStart + 1)); outpw(REG_LCM_OSD_WINE, ((u32YStart + u32Height) << 16) | (u32XStart + u32Width)); curOSDDev.nOSDWidth = u32Width; curOSDDev.nOSDHeight = u32Height; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns request or NULL if no requests in list */
struct cdns3_request* cdns3_next_priv_request(struct list_head *list)
/* Returns request or NULL if no requests in list */ struct cdns3_request* cdns3_next_priv_request(struct list_head *list)
{ return list_first_entry_or_null(list, struct cdns3_request, list); }
4ms/stm32mp1-baremetal
C++
Other
137
/* brief Return Frequency of MClk Clock return Frequency of MClk Clock. */
uint32_t CLOCK_GetMclkClkFreq(void)
/* brief Return Frequency of MClk Clock return Frequency of MClk Clock. */ uint32_t CLOCK_GetMclkClkFreq(void)
{ uint32_t freq = 0U; switch (SYSCON->MCLKCLKSEL) { case 0U: freq = CLOCK_GetFroHfFreq(); break; case 1U: freq = CLOCK_GetPll0OutFreq(); break; case 7U: freq = 0U; break; default: freq = 0U; break; } return freq / ((SYSCON->MCLKDIV & 0xffU) + 1U); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Flush delayed allocate data, attempting to free up reserved space from existing allocations. At this point a new allocation attempt has failed with ENOSPC and we are in the process of scratching our heads, looking about for more room... */
STATIC void xfs_flush_inodes_work(struct xfs_mount *mp, void *arg)
/* Flush delayed allocate data, attempting to free up reserved space from existing allocations. At this point a new allocation attempt has failed with ENOSPC and we are in the process of scratching our heads, looking about for more room... */ STATIC void xfs_flush_inodes_work(struct xfs_mount *mp, void *arg)
{ struct inode *inode = arg; xfs_sync_data(mp, SYNC_TRYLOCK); xfs_sync_data(mp, SYNC_TRYLOCK | SYNC_WAIT); iput(inode); }
robutest/uclinux
C++
GPL-2.0
60
/* fat_subdirs counts the number of sub-directories of dir. It can be run on directories being created. */
int fat_subdirs(struct inode *dir)
/* fat_subdirs counts the number of sub-directories of dir. It can be run on directories being created. */ int fat_subdirs(struct inode *dir)
{ struct buffer_head *bh; struct msdos_dir_entry *de; loff_t cpos; int count = 0; bh = NULL; cpos = 0; while (fat_get_short_entry(dir, &cpos, &bh, &de) >= 0) { if (de->attr & ATTR_DIR) count++; } brelse(bh); return count; }
robutest/uclinux
C++
GPL-2.0
60
/* Get the status of the specified HASH flag. */
en_flag_status_t HASH_GetStatus(uint32_t u32Flag)
/* Get the status of the specified HASH flag. */ en_flag_status_t HASH_GetStatus(uint32_t u32Flag)
{ en_flag_status_t enStatus = RESET; DDL_ASSERT(IS_HASH_FLAG(u32Flag)); if (READ_REG32_BIT(CM_HASH->CR, u32Flag) != 0UL) { enStatus = SET; } return enStatus; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Host Reset is the highest level of error recovery. If this fails, then host is offlined by SCSI. */
int fnic_host_reset(struct scsi_cmnd *sc)
/* Host Reset is the highest level of error recovery. If this fails, then host is offlined by SCSI. */ int fnic_host_reset(struct scsi_cmnd *sc)
{ int ret; unsigned long wait_host_tmo; struct Scsi_Host *shost = sc->device->host; struct fc_lport *lp = shost_priv(shost); ret = fnic_reset(shost); if (ret == SUCCESS) { wait_host_tmo = jiffies + FNIC_HOST_RESET_SETTLE_TIME * HZ; ret = FAILED; while (time_before(jiffies, wait_host_tmo)) { if ((lp->state == LPORT_ST_READY) && (lp->link_up)) { ret = SUCCESS; break; } ssleep(1); } } return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Allows specifying size of transmit event block (in term of allocated events and block base address within CAN message RAM. Note, that there are no limitations nor checking on address provided. */
void fdcan_init_tx_event_ram(uint32_t canport, uint32_t tesa, uint8_t tes)
/* Allows specifying size of transmit event block (in term of allocated events and block base address within CAN message RAM. Note, that there are no limitations nor checking on address provided. */ void fdcan_init_tx_event_ram(uint32_t canport, uint32_t tesa, uint8_t tes)
{ FDCAN_TXEFC(canport) = (FDCAN_TXEFC(canport) & ~( (FDCAN_TXEFC_EFS_MASK << FDCAN_TXEFC_EFS_SHIFT) | (FDCAN_TXEFC_EFSA_MASK << FDCAN_TXEFC_EFSA_SHIFT) )) | (tes << FDCAN_TXEFC_EFS_SHIFT) | (tesa & (FDCAN_TXEFC_EFSA_MASK << FDCAN_TXEFC_EFSA_SHIFT)); }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Get the time-base counter reached its maximum value flag of selected channel. */
uint32_t BPWM_GetWrapAroundFlag(BPWM_T *bpwm, uint32_t u32ChannelNum)
/* Get the time-base counter reached its maximum value flag of selected channel. */ uint32_t BPWM_GetWrapAroundFlag(BPWM_T *bpwm, uint32_t u32ChannelNum)
{ (void)u32ChannelNum; return (((bpwm)->STATUS & BPWM_STATUS_CNTMAX0_Msk) ? 1UL : 0UL); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If ConfigRequest is NULL, then ASSERT(). If Block is NULL, then ASSERT(). */
EFI_STRING EFIAPI InternalHiiBlockToConfig(IN CONST EFI_STRING ConfigRequest, IN CONST UINT8 *Block, IN UINTN BlockSize)
/* If ConfigRequest is NULL, then ASSERT(). If Block is NULL, then ASSERT(). */ EFI_STRING EFIAPI InternalHiiBlockToConfig(IN CONST EFI_STRING ConfigRequest, IN CONST UINT8 *Block, IN UINTN BlockSize)
{ EFI_STATUS Status; EFI_STRING ConfigResp; CHAR16 *Progress; ASSERT (ConfigRequest != NULL); ASSERT (Block != NULL); Status = gHiiConfigRouting->BlockToConfig ( gHiiConfigRouting, ConfigRequest, Block, BlockSize, &ConfigResp, &Progress ); if (EFI_ERROR (Status)) { return NULL; } return ConfigResp; }
tianocore/edk2
C++
Other
4,240
/* Hands off the ZCL Thermostat User Interface Configuration dissector. */
void proto_reg_handoff_zbee_zcl_thermostat_ui_config(void)
/* Hands off the ZCL Thermostat User Interface Configuration dissector. */ void proto_reg_handoff_zbee_zcl_thermostat_ui_config(void)
{ dissector_handle_t thermostat_ui_config_handle; thermostat_ui_config_handle = find_dissector(ZBEE_PROTOABBREV_ZCL_THERMOSTAT_UI_CONFIG); dissector_add_uint("zbee.zcl.cluster", ZBEE_ZCL_CID_THERMOSTAT_UI_CONFIG, thermostat_ui_config_handle); zbee_zcl_init_cluster( proto_zbee_zcl_thermostat_ui_config, ett_zbee_zcl_thermostat_ui_config, ZBEE_ZCL_CID_THERMOSTAT_UI_CONFIG, hf_zbee_zcl_thermostat_ui_config_attr_id, -1, -1, (zbee_zcl_fn_attr_data)dissect_zcl_thermostat_ui_config_attr_data ); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* nand_markbad_bbt - Mark a block bad in the BBT @mtd: MTD device structure @offs: offset of the bad block */
int nand_markbad_bbt(struct mtd_info *mtd, loff_t offs)
/* nand_markbad_bbt - Mark a block bad in the BBT @mtd: MTD device structure @offs: offset of the bad block */ int nand_markbad_bbt(struct mtd_info *mtd, loff_t offs)
{ struct nand_chip *this = mtd_to_nand(mtd); int block, ret = 0; block = (int)(offs >> this->bbt_erase_shift); bbt_mark_entry(this, block, BBT_BLOCK_WORN); if (this->bbt_options & NAND_BBT_USE_FLASH) ret = nand_update_bbt(mtd, offs); return ret; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Return FALSE to indicate this interface is not supported. */
BOOLEAN EFIAPI LocalRandomBytes(OUT UINT8 *Output, IN UINTN Size)
/* Return FALSE to indicate this interface is not supported. */ BOOLEAN EFIAPI LocalRandomBytes(OUT UINT8 *Output, IN UINTN Size)
{ if (mRandomOption & USE_RANDOM_ARRAY) { return RandomBytesUsingArray (Output, Size); } else { return RandomBytes (Output, Size); } }
tianocore/edk2
C++
Other
4,240
/* mr: Measure rate for temperature or pressure osr: Oversampling rate for temperature or pressure returns: time that the DPS310 needs for this measurement a value of 10000 equals 1 second NOTE! The measurement time for temperature and pressure in sum must not be more than 1 second! Timing behavior of pressure and temperature sensors can be considered as equal. */
uint16_t calcBusyTime(uint16_t mr, uint16_t osr)
/* mr: Measure rate for temperature or pressure osr: Oversampling rate for temperature or pressure returns: time that the DPS310 needs for this measurement a value of 10000 equals 1 second NOTE! The measurement time for temperature and pressure in sum must not be more than 1 second! Timing behavior of pressure and temperature sensors can be considered as equal. */ uint16_t calcBusyTime(uint16_t mr, uint16_t osr)
{ mr &= DPS310__REG_MASK_TEMP_MR >> DPS310__REG_SHIFT_TEMP_MR; osr &= DPS310__REG_MASK_TEMP_OSR >> DPS310__REG_SHIFT_TEMP_OSR; return ((uint32_t)20U << mr) + ((uint32_t)16U << (osr + mr)); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Get the current count value of the running Watchdog Timer. Get the current count value of the running Watchdog Timer. */
void wdt_get_current_count(struct wdt_module *const module, uint32_t *count_value)
/* Get the current count value of the running Watchdog Timer. Get the current count value of the running Watchdog Timer. */ void wdt_get_current_count(struct wdt_module *const module, uint32_t *count_value)
{ *count_value = module->hw->WDOGVALUE.reg; }
memfault/zero-to-main
C++
null
200
/* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ` */
void proto_register_udpencap(void)
/* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ` */ void proto_register_udpencap(void)
{ static hf_register_info hf[] = { { &hf_nat_keepalive, { "NAT-keepalive packet", "udpencap.nat_keepalive", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_non_esp_marker, { "Non-ESP Marker", "udpencap.non_esp_marker", FT_NONE, BASE_NONE, NULL, 0, NULL, HFILL }}, }; static gint *ett[] = { &ett_udpencap, }; proto_udpencap = proto_register_protocol( "UDP Encapsulation of IPsec Packets", "UDPENCAP", "udpencap"); proto_register_field_array(proto_udpencap, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Check whether current IP is EBC CALL instruction (NOTE: CALLEX is exclusive) */
BOOLEAN IsEBCCALL(IN UINTN Address)
/* Check whether current IP is EBC CALL instruction (NOTE: CALLEX is exclusive) */ BOOLEAN IsEBCCALL(IN UINTN Address)
{ if (GET_OPCODE (Address) != OPCODE_CALL) { return FALSE; } if (GET_OPERANDS (Address) & OPERAND_M_NATIVE_CALL) { return FALSE; } else { return TRUE; } }
tianocore/edk2
C++
Other
4,240
/* param base Pointer to the FLEXIO_CAMERA_Type. param handle Pointer to the flexio_camera_edma_handle_t structure. param xfer Camera eDMA transfer structure, see #flexio_camera_transfer_t. retval kStatus_Success if succeeded, others failed. retval kStatus_CAMERA_RxBusy Previous transfer on going. */
status_t FLEXIO_CAMERA_TransferReceiveEDMA(FLEXIO_CAMERA_Type *base, flexio_camera_edma_handle_t *handle, flexio_camera_transfer_t *xfer)
/* param base Pointer to the FLEXIO_CAMERA_Type. param handle Pointer to the flexio_camera_edma_handle_t structure. param xfer Camera eDMA transfer structure, see #flexio_camera_transfer_t. retval kStatus_Success if succeeded, others failed. retval kStatus_CAMERA_RxBusy Previous transfer on going. */ status_t FLEXIO_CAMERA_TransferReceiveEDMA(FLEXIO_CAMERA_Type *base, flexio_camera_edma_handle_t *handle, flexio_camera_transfer_t *xfer)
{ assert(handle->rxEdmaHandle != NULL); edma_transfer_config_t xferConfig; status_t status; if ((uint8_t)kFLEXIO_CAMERA_RxBusy == handle->rxState) { status = kStatus_FLEXIO_CAMERA_RxBusy; } else { handle->rxState = (uint8_t)kFLEXIO_CAMERA_RxBusy; EDMA_PrepareTransfer(&xferConfig, (uint32_t *)FLEXIO_CAMERA_GetRxBufferAddress(base), 32, (uint32_t *)xfer->dataAddress, 32, 32, xfer->dataNum, kEDMA_PeripheralToMemory); handle->nbytes = 32; (void)EDMA_SubmitTransfer(handle->rxEdmaHandle, &xferConfig); EDMA_StartTransfer(handle->rxEdmaHandle); FLEXIO_CAMERA_EnableRxDMA(base, true); status = kStatus_Success; } return status; }
eclipse-threadx/getting-started
C++
Other
310
/* param base LPSPI peripheral base address. param handle LPSPI handle pointer to lpspi_master_edma_handle_t. param callback LPSPI callback. param userData callback function parameter. param edmaRxRegToRxDataHandle edmaRxRegToRxDataHandle pointer to edma_handle_t. param edmaTxDataToTxRegHandle edmaTxDataToTxRegHandle pointer to edma_handle_t. */
void LPSPI_MasterTransferCreateHandleEDMA(LPSPI_Type *base, lpspi_master_edma_handle_t *handle, lpspi_master_edma_transfer_callback_t callback, void *userData, edma_handle_t *edmaRxRegToRxDataHandle, edma_handle_t *edmaTxDataToTxRegHandle)
/* param base LPSPI peripheral base address. param handle LPSPI handle pointer to lpspi_master_edma_handle_t. param callback LPSPI callback. param userData callback function parameter. param edmaRxRegToRxDataHandle edmaRxRegToRxDataHandle pointer to edma_handle_t. param edmaTxDataToTxRegHandle edmaTxDataToTxRegHandle pointer to edma_handle_t. */ void LPSPI_MasterTransferCreateHandleEDMA(LPSPI_Type *base, lpspi_master_edma_handle_t *handle, lpspi_master_edma_transfer_callback_t callback, void *userData, edma_handle_t *edmaRxRegToRxDataHandle, edma_handle_t *edmaTxDataToTxRegHandle)
{ assert(handle); assert(edmaRxRegToRxDataHandle); assert(edmaTxDataToTxRegHandle); memset(handle, 0, sizeof(*handle)); uint32_t instance = LPSPI_GetInstance(base); s_lpspiMasterEdmaPrivateHandle[instance].base = base; s_lpspiMasterEdmaPrivateHandle[instance].handle = handle; handle->callback = callback; handle->userData = userData; handle->edmaRxRegToRxDataHandle = edmaRxRegToRxDataHandle; handle->edmaTxDataToTxRegHandle = edmaTxDataToTxRegHandle; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Sets the timer match value for a 64-bit timer. */
void TimerMatchSet64(uint32_t ui32Base, uint64_t ui64Value)
/* Sets the timer match value for a 64-bit timer. */ void TimerMatchSet64(uint32_t ui32Base, uint64_t ui64Value)
{ ASSERT(_TimerBaseValid(ui32Base)); HWREG(ui32Base + TIMER_O_TBMATCHR) = ui64Value >> 32; HWREG(ui32Base + TIMER_O_TAMATCHR) = ui64Value & 0xffffffff; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Square root operation. Run the square root operation and return the results. */
uint32_t divas_sqrt(uint32_t radicand)
/* Square root operation. Run the square root operation and return the results. */ uint32_t divas_sqrt(uint32_t radicand)
{ cpu_irq_enter_critical(); DIVAS->SQRNUM.reg = radicand; while(DIVAS->STATUS.bit.BUSY){ } uint32_t result_sqrt = DIVAS->RESULT.reg; cpu_irq_leave_critical(); return result_sqrt; }
memfault/zero-to-main
C++
null
200
/* Set open file's clientdata, and return previous value. */
thandle_t TIFFSetClientdata(TIFF *tif, thandle_t newvalue)
/* Set open file's clientdata, and return previous value. */ thandle_t TIFFSetClientdata(TIFF *tif, thandle_t newvalue)
{ thandle_t m = tif->tif_clientdata; tif->tif_clientdata = newvalue; return m; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* If Output is NULL, then return FALSE. If this interface is not supported, then return FALSE. */
BOOLEAN EFIAPI RandomBytes(OUT UINT8 *Output, IN UINTN Size)
/* If Output is NULL, then return FALSE. If this interface is not supported, then return FALSE. */ BOOLEAN EFIAPI RandomBytes(OUT UINT8 *Output, IN UINTN Size)
{ CALL_CRYPTO_SERVICE (RandomBytes, (Output, Size), FALSE); }
tianocore/edk2
C++
Other
4,240
/* ubi_wl_close - close the wear-leveling unit. @ubi: UBI device description object */
void ubi_wl_close(struct ubi_device *ubi)
/* ubi_wl_close - close the wear-leveling unit. @ubi: UBI device description object */ void ubi_wl_close(struct ubi_device *ubi)
{ dbg_wl("close the UBI wear-leveling unit"); cancel_pending(ubi); protection_trees_destroy(ubi); tree_destroy(&ubi->used); tree_destroy(&ubi->free); tree_destroy(&ubi->scrub); kfree(ubi->lookuptbl); }
EmcraftSystems/u-boot
C++
Other
181
/* \method pulse_width_percent() Get or set the pulse width percentage associated with a channel. The value is a number between 0 and 100 and sets the percentage of the timer period for which the pulse is active. The value can be an integer or floating-point number for more accuracy. For example, a value of 25 gives a duty cycle of 25%. */
STATIC mp_obj_t pyb_timer_channel_pulse_width_percent(size_t n_args, const mp_obj_t *args)
/* \method pulse_width_percent() Get or set the pulse width percentage associated with a channel. The value is a number between 0 and 100 and sets the percentage of the timer period for which the pulse is active. The value can be an integer or floating-point number for more accuracy. For example, a value of 25 gives a duty cycle of 25%. */ STATIC mp_obj_t pyb_timer_channel_pulse_width_percent(size_t n_args, const mp_obj_t *args)
{ uint32_t cmp = __HAL_TIM_GET_COMPARE(&self->timer->tim, TIMER_CHANNEL(self)) & TIMER_CNT_MASK(self->timer); return compute_percent_from_pwm_value(period, cmp); } else { uint32_t cmp = compute_pwm_value_from_percent(period, args[1]); __HAL_TIM_SET_COMPARE(&self->timer->tim, TIMER_CHANNEL(self), cmp & TIMER_CNT_MASK(self->timer)); return mp_const_none; } }
micropython/micropython
C++
Other
18,334
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */
int main(void)
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */ int main(void)
{ SetupHardware(); puts_P(PSTR(ESC_FG_CYAN "Mouse HID Parser Host Demo running.\r\n" ESC_FG_WHITE)); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); GlobalInterruptEnable(); for (;;) { MouseHost_Task(); USB_USBTask(); } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Locks the CCile to prevent any RF write access. Needs the I2C Password presentation to be effective. */
int32_t ST25DV_WriteLockCCFile(ST25DV_Object_t *pObj, const ST25DV_CCFILE_BLOCK NbBlockCCFile, const ST25DV_LOCK_STATUS LockCCFile)
/* Locks the CCile to prevent any RF write access. Needs the I2C Password presentation to be effective. */ int32_t ST25DV_WriteLockCCFile(ST25DV_Object_t *pObj, const ST25DV_CCFILE_BLOCK NbBlockCCFile, const ST25DV_LOCK_STATUS LockCCFile)
{ uint8_t reg_value; if( NbBlockCCFile == ST25DV_CCFILE_1BLCK ) { if( LockCCFile == ST25DV_LOCKED ) { reg_value = ST25DV_LOCKCCFILE_BLCK0_MASK; } else { reg_value = 0x00; } } else { if( LockCCFile == ST25DV_LOCKED ) { reg_value = ST25DV_LOCKCCFILE_BLCK0_MASK | ST25DV_LOCKCCFILE_BLCK1_MASK; } else { reg_value = 0x00; } } return st25dv_set_lockccfile_all( &(pObj->Ctx), &reg_value); }
eclipse-threadx/getting-started
C++
Other
310
/* param base MCAN peripheral base address. param idx The MCAN Tx Buffer index. */
uint32_t MCAN_IsTransmitOccurred(CAN_Type *base, uint8_t idx)
/* param base MCAN peripheral base address. param idx The MCAN Tx Buffer index. */ uint32_t MCAN_IsTransmitOccurred(CAN_Type *base, uint8_t idx)
{ return (base->TXBTO & ((uint32_t)1U << idx)) >> (uint32_t)idx; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Helper function to obtain the first memory address of the firmware data that is present in the linked list with segments. */
static uint32_t FirmwareGetFirstAddress(void)
/* Helper function to obtain the first memory address of the firmware data that is present in the linked list with segments. */ static uint32_t FirmwareGetFirstAddress(void)
{ uint32_t result = 0; tFirmwareSegment * firstSegment; firstSegment = FirmwareGetSegment(0u); assert(firstSegment != NULL); if (firstSegment != NULL) { result = firstSegment->base; } return result; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Table of functions for each board to handle memory. Mantaining parallelism is a */
static void memwinon(struct board_info *b, unsigned int win)
/* Table of functions for each board to handle memory. Mantaining parallelism is a */ static void memwinon(struct board_info *b, unsigned int win)
{ b->memwinon(b, win); }
robutest/uclinux
C++
GPL-2.0
60
/* This routine is called to allocate a quotaoff log item. */
xfs_qoff_logitem_t* xfs_trans_get_qoff_item(xfs_trans_t *tp, xfs_qoff_logitem_t *startqoff, uint flags)
/* This routine is called to allocate a quotaoff log item. */ xfs_qoff_logitem_t* xfs_trans_get_qoff_item(xfs_trans_t *tp, xfs_qoff_logitem_t *startqoff, uint flags)
{ xfs_qoff_logitem_t *q; ASSERT(tp != NULL); q = xfs_qm_qoff_logitem_init(tp->t_mountp, startqoff, flags); ASSERT(q != NULL); (void) xfs_trans_add_item(tp, (xfs_log_item_t*)q); return (q); }
robutest/uclinux
C++
GPL-2.0
60
/* Check that the given (port, pin) pair is a valid Kinetis GPIO pin. Returns 0 on success, -EINVAL otherwise. */
static int kinetis_validate_gpio(const struct kinetis_gpio_dsc *dsc)
/* Check that the given (port, pin) pair is a valid Kinetis GPIO pin. Returns 0 on success, -EINVAL otherwise. */ static int kinetis_validate_gpio(const struct kinetis_gpio_dsc *dsc)
{ int rv; rv = 0; if (!dsc || dsc->port >= KINETIS_GPIO_PORTS || dsc->pin >= KINETIS_GPIO_PORT_PINS) { printk(KERN_ERR "%s: incorrect params %d.%d.\n", __func__, dsc ? dsc->port : -1, dsc ? dsc->pin : -1); rv = -EINVAL; } return rv; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If OpCodeHandle is NULL, then ASSERT(). If Type is invalid, then ASSERT(). */
UINT8* EFIAPI HiiCreateDefaultOpCode(IN VOID *OpCodeHandle, IN UINT16 DefaultId, IN UINT8 Type, IN UINT64 Value)
/* If OpCodeHandle is NULL, then ASSERT(). If Type is invalid, then ASSERT(). */ UINT8* EFIAPI HiiCreateDefaultOpCode(IN VOID *OpCodeHandle, IN UINT16 DefaultId, IN UINT8 Type, IN UINT64 Value)
{ EFI_IFR_DEFAULT OpCode; ASSERT (Type < EFI_IFR_TYPE_OTHER); ZeroMem (&OpCode, sizeof (OpCode)); OpCode.Type = Type; OpCode.DefaultId = DefaultId; CopyMem (&OpCode.Value, &Value, mHiiDefaultTypeToWidth[Type]); return InternalHiiCreateOpCode (OpCodeHandle, &OpCode, EFI_IFR_DEFAULT_OP, OFFSET_OF (EFI_IFR_DEFAULT, Value) + mHiiDefaultTypeToWidth[Type]); }
tianocore/edk2
C++
Other
4,240
/* Read the current value of the RTT timer value. */
uint32_t rtt_read_timer_value(Rtt *p_rtt)
/* Read the current value of the RTT timer value. */ uint32_t rtt_read_timer_value(Rtt *p_rtt)
{ uint32_t rtt_val = p_rtt->RTT_VR; while (rtt_val != p_rtt->RTT_VR) { rtt_val = p_rtt->RTT_VR; } return rtt_val; }
remotemcu/remcu-chip-sdks
C++
null
436
/* State machine for state 4, Awaiting Reset Confirmation State. The handling of the timer(s) is in file rose_timer.c Handling of state 0 and connection release is in af_rose.c. */
static int rose_state4_machine(struct sock *sk, struct sk_buff *skb, int frametype)
/* State machine for state 4, Awaiting Reset Confirmation State. The handling of the timer(s) is in file rose_timer.c Handling of state 0 and connection release is in af_rose.c. */ static int rose_state4_machine(struct sock *sk, struct sk_buff *skb, int frametype)
{ struct rose_sock *rose = rose_sk(sk); switch (frametype) { case ROSE_RESET_REQUEST: rose_write_internal(sk, ROSE_RESET_CONFIRMATION); case ROSE_RESET_CONFIRMATION: rose_stop_timer(sk); rose_start_idletimer(sk); rose->condition = 0x00; rose->va = 0; rose->vr = 0; rose->vs = 0; rose->vl = 0; rose->state = ROSE_STATE_3; rose_requeue_frames(sk); break; case ROSE_CLEAR_REQUEST: rose_write_internal(sk, ROSE_CLEAR_CONFIRMATION); rose_disconnect(sk, 0, skb->data[3], skb->data[4]); rose->neighbour->use--; break; default: break; } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266