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
/* @cont: The container to register. This must be allocated by the callee and should also be zeroed by it. */
int attribute_container_register(struct attribute_container *cont)
/* @cont: The container to register. This must be allocated by the callee and should also be zeroed by it. */ int attribute_container_register(struct attribute_container *cont)
{ INIT_LIST_HEAD(&cont->node); klist_init(&cont->containers,internal_container_klist_get, internal_container_klist_put); mutex_lock(&attribute_container_mutex); list_add_tail(&cont->node, &attribute_container_list); mutex_unlock(&attribute_container_mutex); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Because we pretend to be an ethernet device, this packet comes with an ethernet header. Pull it and push our header. */
static void i2400m_tx_prep_header(struct sk_buff *skb)
/* Because we pretend to be an ethernet device, this packet comes with an ethernet header. Pull it and push our header. */ static void i2400m_tx_prep_header(struct sk_buff *skb)
{ struct i2400m_pl_data_hdr *pl_hdr; skb_pull(skb, ETH_HLEN); pl_hdr = (struct i2400m_pl_data_hdr *) skb_push(skb, sizeof(*pl_hdr)); pl_hdr->reserved = 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This function returns a pointer to the nnode on success or a negative error code on failure. */
struct ubifs_nnode* ubifs_get_nnode(struct ubifs_info *c, struct ubifs_nnode *parent, int iip)
/* This function returns a pointer to the nnode on success or a negative error code on failure. */ struct ubifs_nnode* ubifs_get_nnode(struct ubifs_info *c, struct ubifs_nnode *parent, int iip)
{ struct ubifs_nbranch *branch; struct ubifs_nnode *nnode; int err; branch = &parent->nbranch[iip]; nnode = branch->nnode; if (nnode) return nnode; err = ubifs_read_nnode(c, parent, iip); if (err) return ERR_PTR(err); return branch->nnode; }
EmcraftSystems/u-boot
C++
Other
181
/* Check if the external 32k Xtal is ready. */
uint32_t pmc_osc_is_ready_32kxtal(void)
/* Check if the external 32k Xtal is ready. */ uint32_t pmc_osc_is_ready_32kxtal(void)
{ return ((SUPC->SUPC_SR & SUPC_SR_OSCSEL) && (PMC->PMC_SR & PMC_SR_OSCSELS)); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Change Logs: Date Author Notes 勤为本 first version */
void reg_set_one_bit(volatile unsigned int *reg, unsigned int bit)
/* Change Logs: Date Author Notes 勤为本 first version */ void reg_set_one_bit(volatile unsigned int *reg, unsigned int bit)
{ unsigned int temp, mask; mask = 1 << bit; temp = *reg; temp |= mask; *reg = temp; return ; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Delete a text display device. Delete a text display device and release all resources associataed with the text display device. */
EMSTATUS TEXTDISPLAY_Delete(TEXTDISPLAY_Handle_t handle)
/* Delete a text display device. Delete a text display device and release all resources associataed with the text display device. */ EMSTATUS TEXTDISPLAY_Delete(TEXTDISPLAY_Handle_t handle)
{ TEXTDISPLAY_Device_t* textdisplay = (TEXTDISPLAY_Device_t*) handle; if (textdisplay->initialized) { textdisplay->charBuffer = NULL; textdisplay->charArray = NULL; if (textdisplay->lineBuffer) { textdisplay->displayDevice.pPixelMatrixFree (&textdisplay->displayDevice, ...
remotemcu/remcu-chip-sdks
C++
null
436
/* If the cached PEI Services Table pointer is NULL, then ASSERT(). */
CONST EFI_PEI_SERVICES** EFIAPI GetPeiServicesTablePointer(VOID)
/* If the cached PEI Services Table pointer is NULL, then ASSERT(). */ CONST EFI_PEI_SERVICES** EFIAPI GetPeiServicesTablePointer(VOID)
{ CONST EFI_PEI_SERVICES **PeiServicesTablePointer; PeiServicesTablePointer = EMU_MAGIC_PAGE ()->PeiServicesTablePointer; ASSERT (PeiServicesTablePointer != NULL); ASSERT (*PeiServicesTablePointer != NULL); return PeiServicesTablePointer; }
tianocore/edk2
C++
Other
4,240
/* If Expression is TRUE, then TRUE is returned. If Expression is FALSE, then an assert is triggered and the location of the assert provided by FunctionName, LineNumber, FileName, and Description are recorded and FALSE is returned. */
BOOLEAN EFIAPI UnitTestAssertTrue(IN BOOLEAN Expression, IN CONST CHAR8 *FunctionName, IN UINTN LineNumber, IN CONST CHAR8 *FileName, IN CONST CHAR8 *Description)
/* If Expression is TRUE, then TRUE is returned. If Expression is FALSE, then an assert is triggered and the location of the assert provided by FunctionName, LineNumber, FileName, and Description are recorded and FALSE is returned. */ BOOLEAN EFIAPI UnitTestAssertTrue(IN BOOLEAN Expression, IN CONST CHAR8 *FunctionName...
{ CHAR8 TempStr[MAX_STRING_SIZE]; snprintf (TempStr, sizeof (TempStr), "UT_ASSERT_TRUE(%s:%x)", Description, Expression); _assert_true (Expression, TempStr, FileName, (INT32)LineNumber); return Expression; }
tianocore/edk2
C++
Other
4,240
/* Set head Guard and tail Guard for the given memory range. */
VOID SetGuardForMemory(IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN NumberOfPages)
/* Set head Guard and tail Guard for the given memory range. */ VOID SetGuardForMemory(IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN NumberOfPages)
{ EFI_PHYSICAL_ADDRESS GuardPage; GuardPage = Memory + EFI_PAGES_TO_SIZE (NumberOfPages); if (!IsGuardPage (GuardPage)) { SetGuardPage (GuardPage); } GuardPage = Memory - EFI_PAGES_TO_SIZE (1); if (!IsGuardPage (GuardPage)) { SetGuardPage (GuardPage); } SetGuardedMemoryBits (Memory, NumberOfPag...
tianocore/edk2
C++
Other
4,240
/* Handler for SD card detect rising edge interrupt. */
static void sd_detect_handler(uint32_t id, uint32_t mask)
/* Handler for SD card detect rising edge interrupt. */ static void sd_detect_handler(uint32_t id, uint32_t mask)
{ if ((SD_MMC_0_CD_ID == id) && (SD_MMC_0_CD_MASK == mask)) { sd_listing_pos = 0; sd_num_files = 0; sd_fs_found = 0; sd_update = 1; } }
remotemcu/remcu-chip-sdks
C++
null
436
/* param base The I2C peripheral base address. param handle Pointer to the I2C master driver handle. param callback User provided pointer to the asynchronous callback function. param userData User provided pointer to the application callback data. */
void I2C_MasterTransferCreateHandle(I2C_Type *base, i2c_master_handle_t *handle, i2c_master_transfer_callback_t callback, void *userData)
/* param base The I2C peripheral base address. param handle Pointer to the I2C master driver handle. param callback User provided pointer to the asynchronous callback function. param userData User provided pointer to the application callback data. */ void I2C_MasterTransferCreateHandle(I2C_Type *base, i2c_master_handl...
{ assert(handle != NULL); uint32_t instance; i2c_to_flexcomm_t handler; handler.i2c_master_handler = I2C_MasterTransferHandleIRQ; (void)memset(handle, 0, sizeof(*handle)); instance = I2C_GetInstance(base); handle->completionCallback = callback; handle->userData = userData; ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Walk the EFI memory map and call CALLBACK once for each EFI memory descriptor that has memory that is available for uncached allocator. */
void efi_memmap_walk_uc(efi_freemem_callback_t callback, void *arg)
/* Walk the EFI memory map and call CALLBACK once for each EFI memory descriptor that has memory that is available for uncached allocator. */ void efi_memmap_walk_uc(efi_freemem_callback_t callback, void *arg)
{ walk(callback, arg, EFI_MEMORY_UC); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* yaffs_skip_rest_of_block() skips over the rest of the allocation block if we don't want to write to it. */
void yaffs_skip_rest_of_block(struct yaffs_dev *dev)
/* yaffs_skip_rest_of_block() skips over the rest of the allocation block if we don't want to write to it. */ void yaffs_skip_rest_of_block(struct yaffs_dev *dev)
{ struct yaffs_block_info *bi; if (dev->alloc_block > 0) { bi = yaffs_get_block_info(dev, dev->alloc_block); if (bi->block_state == YAFFS_BLOCK_STATE_ALLOCATING) { bi->block_state = YAFFS_BLOCK_STATE_FULL; dev->alloc_block = -1; } } }
4ms/stm32mp1-baremetal
C++
Other
137
/* This file is part of the Simba project. */
int mock_write_configfile_init(char *buf_p, size_t size, int res)
/* This file is part of the Simba project. */ int mock_write_configfile_init(char *buf_p, size_t size, int res)
{ harness_mock_write("configfile_init(buf_p)", buf_p, strlen(buf_p) + 1); harness_mock_write("configfile_init(size)", &size, sizeof(size)); harness_mock_write("configfile_init(): return (res)", ...
eerimoq/simba
C++
Other
337
/* Kill all tasks for the given client. XXX: kill their descendants as well? */
void rpc_killall_tasks(struct rpc_clnt *clnt)
/* Kill all tasks for the given client. XXX: kill their descendants as well? */ void rpc_killall_tasks(struct rpc_clnt *clnt)
{ struct rpc_task *rovr; if (list_empty(&clnt->cl_tasks)) return; dprintk("RPC: killing all tasks for client %p\n", clnt); spin_lock(&clnt->cl_lock); list_for_each_entry(rovr, &clnt->cl_tasks, tk_task) { if (! RPC_IS_ACTIVATED(rovr)) continue; if (!(rovr->tk_flags & RPC_TASK_KILLED)) { rovr->tk_f...
EmcraftSystems/linux-emcraft
C++
Other
266
/* 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==ADC2) { __HAL_RCC_ADC12_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOF, GPIO_PIN_14); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This map driver is used to allocate "placeholder" MTD devices on systems that have socketed/removable media. Use of this driver as a fallback preserves the expected registration of MTD device nodes regardless of probe outcome. A usage example is as follows: */
static int map_absent_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *)
/* This map driver is used to allocate "placeholder" MTD devices on systems that have socketed/removable media. Use of this driver as a fallback preserves the expected registration of MTD device nodes regardless of probe outcome. A usage example is as follows: */ static int map_absent_read(struct mtd_info *, loff_t, s...
{ *retlen = 0; return -ENODEV; }
robutest/uclinux
C++
GPL-2.0
60
/* Input : pointer to ethernet interface network device structure Output : N/A */
static void update_hash_table_mac_address(struct armdfec_device *darmdfec, u8 *oaddr, u8 *addr)
/* Input : pointer to ethernet interface network device structure Output : N/A */ static void update_hash_table_mac_address(struct armdfec_device *darmdfec, u8 *oaddr, u8 *addr)
{ u32 mach; u32 macl; if (oaddr) { mach = (oaddr[0] << 8) | oaddr[1]; macl = (oaddr[2] << 24) | (oaddr[3] << 16) | (oaddr[4] << 8) | oaddr[5]; add_del_hash_entry(darmdfec, mach, macl, 1, 0, HASH_DELETE); } mach = (addr[0] << 8) | addr[1]; macl = (addr[2] << 24) | (addr[3] << 16) | (addr[4] << 8) | addr[5...
4ms/stm32mp1-baremetal
C++
Other
137
/* Set the specified data holding register value for dual DAC channel. */
void DAC_ConfigDualChannelData(DAC_ALIGN_T align, uint16_t data2, uint16_t data1)
/* Set the specified data holding register value for dual DAC channel. */ void DAC_ConfigDualChannelData(DAC_ALIGN_T align, uint16_t data2, uint16_t data1)
{ uint32_t data = 0, tmp = 0; if (align == DAC_ALIGN_8BIT_R) { data = ((uint32_t)data2 << 8) | data1; } else { data = ((uint32_t)data2 << 16) | data1; } tmp = (uint32_t)DAC_BASE; tmp += 0x00000020 + align; *(__IO uint32_t*)tmp = data; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If 32-bit I/O port operations are not supported, then ASSERT(). */
VOID EFIAPI IoReadFifo32(IN UINTN Port, IN UINTN Count, OUT VOID *Buffer)
/* If 32-bit I/O port operations are not supported, then ASSERT(). */ VOID EFIAPI IoReadFifo32(IN UINTN Port, IN UINTN Count, OUT VOID *Buffer)
{ ASSERT ((Port & 3) == 0); IoReadFifoWorker (Port, EfiPeiCpuIoWidthFifoUint32, Count, Buffer); }
tianocore/edk2
C++
Other
4,240
/* Allow the sequencer to continue program execution. We check here to ensure that no additional interrupt sources that would cause the sequencer to halt have been asserted. If, for example, a SCSI bus reset is detected while we are fielding a different, pausing, interrupt type, we don't want to release the sequencer b...
void ahc_unpause(struct ahc_softc *ahc)
/* Allow the sequencer to continue program execution. We check here to ensure that no additional interrupt sources that would cause the sequencer to halt have been asserted. If, for example, a SCSI bus reset is detected while we are fielding a different, pausing, interrupt type, we don't want to release the sequencer b...
{ if ((ahc_inb(ahc, INTSTAT) & (SCSIINT | SEQINT | BRKADRINT)) == 0) ahc_outb(ahc, HCNTRL, ahc->unpause); }
robutest/uclinux
C++
GPL-2.0
60
/* Modifies or resets the current station address, if supported. */
EFI_STATUS EFIAPI EmuSnpStationAddress(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN BOOLEAN Reset, IN EFI_MAC_ADDRESS *NewMacAddr OPTIONAL)
/* Modifies or resets the current station address, if supported. */ EFI_STATUS EFIAPI EmuSnpStationAddress(IN EFI_SIMPLE_NETWORK_PROTOCOL *This, IN BOOLEAN Reset, IN EFI_MAC_ADDRESS *NewMacAddr OPTIONAL)
{ EFI_STATUS Status; EMU_SNP_PRIVATE_DATA *Private; Private = EMU_SNP_PRIVATE_DATA_FROM_SNP_THIS (This); Status = Private->Io->StationAddress (Private->Io, Reset, NewMacAddr); return Status; }
tianocore/edk2
C++
Other
4,240
/* Note that this filter uses CRC16 rather than CRC32 as used in frame checksums. The required CRC uses a direct algorithm with polynomial 0x8005, initial seed value 0xFFFF, no final XOR and reversed data order. CRCs for use in this function may be determined using the online calculator found at */
void EMACRemoteWakeUpFrameFilterSet(uint32_t ui32Base, const tEMACWakeUpFrameFilter *pFilter)
/* Note that this filter uses CRC16 rather than CRC32 as used in frame checksums. The required CRC uses a direct algorithm with polynomial 0x8005, initial seed value 0xFFFF, no final XOR and reversed data order. CRCs for use in this function may be determined using the online calculator found at */ void EMACRemoteWake...
{ uint32_t *pui32Data; uint32_t ui32Loop; ASSERT(ui32Base == EMAC0_BASE); ASSERT(pFilter); HWREG(ui32Base + EMAC_O_PMTCTLSTAT) |= EMAC_PMTCTLSTAT_WUPFRRST; pui32Data = (uint32_t *)pFilter; for (ui32Loop = 0; ui32Loop < 8; ui32Loop++) { HWREG(ui32Base + EMAC_O_RWUFF) = pui32Data[u...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function runs garbage collector to make some more free space. Returns zero if a free LEB has been produced, %-EAGAIN if commit is required, and a negative error code in case of failure. */
static int run_gc(struct ubifs_info *c)
/* This function runs garbage collector to make some more free space. Returns zero if a free LEB has been produced, %-EAGAIN if commit is required, and a negative error code in case of failure. */ static int run_gc(struct ubifs_info *c)
{ int err, lnum; down_read(&c->commit_sem); lnum = ubifs_garbage_collect(c, 1); up_read(&c->commit_sem); if (lnum < 0) return lnum; dbg_budg("GC freed LEB %d", lnum); err = ubifs_return_leb(c, lnum); if (err) return err; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* clean up after reading from the cells list */
static void afs_proc_cell_volumes_stop(struct seq_file *p, void *v)
/* clean up after reading from the cells list */ static void afs_proc_cell_volumes_stop(struct seq_file *p, void *v)
{ struct afs_cell *cell = p->private; up_read(&cell->vl_sem); }
robutest/uclinux
C++
GPL-2.0
60
/* @cmd_parameter: Pointer to command parameter @response: Pointer to fastboot response buffer */
static void reboot_bootloader(char *, char *)
/* @cmd_parameter: Pointer to command parameter @response: Pointer to fastboot response buffer */ static void reboot_bootloader(char *, char *)
{ if (fastboot_set_reboot_flag()) fastboot_fail("Cannot set reboot flag", response); else fastboot_okay(NULL, response); }
4ms/stm32mp1-baremetal
C++
Other
137
/* param base LPUART peripheral base address. param lpuartEdmaHandle LPUART handle pointer. */
void LPUART_TransferEdmaHandleIRQ(uint32_t instance, void *lpuartEdmaHandle)
/* param base LPUART peripheral base address. param lpuartEdmaHandle LPUART handle pointer. */ void LPUART_TransferEdmaHandleIRQ(uint32_t instance, void *lpuartEdmaHandle)
{ assert(lpuartEdmaHandle != NULL); assert(instance < ARRAY_SIZE(s_lpuartBases)); LPUART_Type *base = s_lpuartBases[instance]; if (((uint32_t)kLPUART_TransmissionCompleteFlag & LPUART_GetStatusFlags(base)) != 0U) { lpuart_edma_handle_t *handle = (lpuart_edma_handle_t *)lpuartEdmaHandle; ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This service enables a PEIM to ascertain the address of the list of HOBs in memory. */
EFI_STATUS EFIAPI PeiServicesGetHobList(OUT VOID **HobList)
/* This service enables a PEIM to ascertain the address of the list of HOBs in memory. */ EFI_STATUS EFIAPI PeiServicesGetHobList(OUT VOID **HobList)
{ ASSERT (FALSE); return EFI_OUT_OF_RESOURCES; }
tianocore/edk2
C++
Other
4,240
/* The tq handling here is a little racy - tty->SAK_work may already be queued. Fortunately we don't need to worry, because if ->SAK_work is already queued, the values which we write to it will be identical to the values which it already has. */
void do_SAK(struct tty_struct *tty)
/* The tq handling here is a little racy - tty->SAK_work may already be queued. Fortunately we don't need to worry, because if ->SAK_work is already queued, the values which we write to it will be identical to the values which it already has. */ void do_SAK(struct tty_struct *tty)
{ if (!tty) return; schedule_work(&tty->SAK_work); }
robutest/uclinux
C++
GPL-2.0
60
/* This function is executed in case of error occurrence. */
void _Error_Handler(char *s, int num)
/* This function is executed in case of error occurrence. */ void _Error_Handler(char *s, int num)
{ LOG_E("Error_Handler at file:%s num:%d", s, num); while (1) { } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enable or disable TTCAN of the specified CAN unit. */
void CAN_TTC_Cmd(CM_CAN_TypeDef *CANx, en_functional_state_t enNewState)
/* Enable or disable TTCAN of the specified CAN unit. */ void CAN_TTC_Cmd(CM_CAN_TypeDef *CANx, en_functional_state_t enNewState)
{ uint32_t u32Addr; DDL_ASSERT(IS_CAN_UNIT(CANx)); DDL_ASSERT(IS_FUNCTIONAL_STATE(enNewState)); u32Addr = (uint32_t)&CANx->TTCFG; WRITE_REG32(PERIPH_BIT_BAND(u32Addr, CAN_TTCFG_TTEN_POS), enNewState); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns transpose type for CRC protocol reflect in parameter. This functions helps to set writeTranspose member of crc_config_t structure. Reflect in is CRC protocol parameter. */
static crc_transpose_type_t crc_GetTransposeTypeFromReflectIn(bool enable)
/* Returns transpose type for CRC protocol reflect in parameter. This functions helps to set writeTranspose member of crc_config_t structure. Reflect in is CRC protocol parameter. */ static crc_transpose_type_t crc_GetTransposeTypeFromReflectIn(bool enable)
{ return ((enable) ? kCrcTransposeBitsAndBytes : kCrcTransposeBytes); }
labapart/polymcu
C++
null
201
/* This function will set feature for an usb device. */
rt_err_t rt_usbd_set_feature(udevice_t device, rt_uint16_t value, rt_uint16_t index)
/* This function will set feature for an usb device. */ rt_err_t rt_usbd_set_feature(udevice_t device, rt_uint16_t value, rt_uint16_t index)
{ RT_ASSERT(device != RT_NULL); if (value == USB_FEATURE_DEV_REMOTE_WAKEUP) { LOG_D("set feature remote wakeup"); } else if (value == USB_FEATURE_ENDPOINT_HALT) { LOG_D("set feature stall"); dcd_ep_set_stall(device->dcd, (rt_uint32_t)(index & 0xFF)); } return RT_E...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Allocate IRQs for a device with the MSI capability. This function returns a negative errno if an error occurs. If it is unable to allocate the number of interrupts requested, it returns the number of interrupts it might be able to allocate. If it successfully allocates at least the number of interrupts requested, it...
int pci_enable_msi_block(struct pci_dev *dev, unsigned int nvec)
/* Allocate IRQs for a device with the MSI capability. This function returns a negative errno if an error occurs. If it is unable to allocate the number of interrupts requested, it returns the number of interrupts it might be able to allocate. If it successfully allocates at least the number of interrupts requested, it...
{ int status, pos, maxvec; u16 msgctl; pos = pci_find_capability(dev, PCI_CAP_ID_MSI); if (!pos) return -EINVAL; pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &msgctl); maxvec = 1 << ((msgctl & PCI_MSI_FLAGS_QMASK) >> 1); if (nvec > maxvec) return maxvec; status = pci_msi_check_device(dev, nvec, PCI_CAP_ID...
robutest/uclinux
C++
GPL-2.0
60
/* This will determine if the command line represents an internal shell command or dispatch an external application. */
EFI_STATUS RunCommand(IN CONST CHAR16 *CmdLine)
/* This will determine if the command line represents an internal shell command or dispatch an external application. */ EFI_STATUS RunCommand(IN CONST CHAR16 *CmdLine)
{ return (RunShellCommand (CmdLine, NULL)); }
tianocore/edk2
C++
Other
4,240
/* Initialize the XPRO_LCD LCD Glass component. This function initializes the LCD driver to control the LCD glass. It perform LCD module initialization according to the XPRO_LCD characteristics. */
void xpro_lcd_init(void)
/* Initialize the XPRO_LCD LCD Glass component. This function initializes the LCD driver to control the LCD glass. It perform LCD module initialization according to the XPRO_LCD characteristics. */ void xpro_lcd_init(void)
{ struct slcd_config config; slcd_get_config_defaults(&config); config.waveform_mode = SLCD_LOW_POWER_WAVEFORM_MODE; slcd_init(&config); slcd_set_frame_counter(SLCD_FRAME_COUNTER_0, false, CONF_XPRO_LCD_FC0); slcd_set_frame_counter(SLCD_FRAME_COUNTER_1, false, CONF_XPRO_LCD_FC1); slcd_set_frame_counter(SLCD_FRAM...
memfault/zero-to-main
C++
null
200
/* Sets i2s channel number, sample rate, word length. */
void i2s_set_param(i2s_t *obj, int channel_num, int rate, int word_len)
/* Sets i2s channel number, sample rate, word length. */ void i2s_set_param(i2s_t *obj, int channel_num, int rate, int word_len)
{ obj->channel_num = channel_num; obj->sampling_rate = rate; obj->word_length = word_len; I2SInitStruct.I2S_ChNum = channel_num; I2SInitStruct.I2S_Rate = rate; I2SInitStruct.I2S_WordLen = word_len; I2S_SetChNum(I2S_DEV, I2SInitStruct.I2S_ChNum); I2S_SetRate(I2S_DEV, rate); I2S_SetWordLen(I2S_DEV, I2SInitStruct...
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Under some conditions, a driver may wish to reset the entire device. Called from omap_device code. Returns -EINVAL on error or passes along the return value from _reset()/_enable(). */
int omap_hwmod_reset(struct omap_hwmod *oh)
/* Under some conditions, a driver may wish to reset the entire device. Called from omap_device code. Returns -EINVAL on error or passes along the return value from _reset()/_enable(). */ int omap_hwmod_reset(struct omap_hwmod *oh)
{ int r; if (!oh || !(oh->_state & _HWMOD_STATE_ENABLED)) return -EINVAL; mutex_lock(&omap_hwmod_mutex); r = _reset(oh); if (!r) r = _enable(oh); mutex_unlock(&omap_hwmod_mutex); return r; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* param base ENC peripheral base address param value Positive initial value */
void ENC_SetInitialPositionValue(ENC_Type *base, uint32_t value)
/* param base ENC peripheral base address param value Positive initial value */ void ENC_SetInitialPositionValue(ENC_Type *base, uint32_t value)
{ base->UINIT = (uint16_t)(value >> 16U); base->LINIT = (uint16_t)(value); }
eclipse-threadx/getting-started
C++
Other
310
/* 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 MmioOr32(IN UINTN Address, IN UINT32 OrData)
/* 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 MmioOr32(IN UINTN Address, IN UINT32 OrData)
{ return MmioWrite32 (Address, MmioRead32 (Address) | OrData); }
tianocore/edk2
C++
Other
4,240
/* Perform the initial bus rather than driver ordered scan of the PCI drivers. After this all IDE pci handling becomes standard module ordering not traditionally ordered. */
static int __init ide_scan_pcibus(void)
/* Perform the initial bus rather than driver ordered scan of the PCI drivers. After this all IDE pci handling becomes standard module ordering not traditionally ordered. */ static int __init ide_scan_pcibus(void)
{ struct pci_dev *dev = NULL; struct pci_driver *d; struct list_head *l, *n; pre_init = 0; while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev))) ide_scan_pcidev(dev); list_for_each_safe(l, n, &ide_pci_drivers) { list_del(l); d = list_entry(l, struct pci_driver, node); if (__pci_register_driver(d, d-...
robutest/uclinux
C++
GPL-2.0
60
/* get ccw_device matching the busid, but only if owned by cdrv */
static int __ccwdev_check_busid(struct device *dev, void *id)
/* get ccw_device matching the busid, but only if owned by cdrv */ static int __ccwdev_check_busid(struct device *dev, void *id)
{ char *bus_id; bus_id = id; return (strcmp(bus_id, dev_name(dev)) == 0); }
robutest/uclinux
C++
GPL-2.0
60
/* pacpi_set_dmamode - set initial DMA mode data @ap: ATA interface @adev: ATA device */
static void pacpi_set_dmamode(struct ata_port *ap, struct ata_device *adev)
/* pacpi_set_dmamode - set initial DMA mode data @ap: ATA interface @adev: ATA device */ static void pacpi_set_dmamode(struct ata_port *ap, struct ata_device *adev)
{ int unit = adev->devno; struct pata_acpi *acpi = ap->private_data; const struct ata_timing *t; if (!(acpi->gtm.flags & 0x10)) unit = 0; t = ata_timing_find_mode(adev->dma_mode); if (adev->dma_mode >= XFER_UDMA_0) { acpi->gtm.drive[unit].dma = t->udma; acpi->gtm.flags |= (1 << (2 * unit)); } else { acpi...
EmcraftSystems/linux-emcraft
C++
Other
266
/* The function implements the ReadDevice protocol member of VIRTIO_DEVICE_PROTOCOL. */
EFI_STATUS EFIAPI VirtioPciDeviceRead(IN VIRTIO_DEVICE_PROTOCOL *This, IN UINTN FieldOffset, IN UINTN FieldSize, IN UINTN BufferSize, OUT VOID *Buffer)
/* The function implements the ReadDevice protocol member of VIRTIO_DEVICE_PROTOCOL. */ EFI_STATUS EFIAPI VirtioPciDeviceRead(IN VIRTIO_DEVICE_PROTOCOL *This, IN UINTN FieldOffset, IN UINTN FieldSize, IN UINTN BufferSize, OUT VOID *Buffer)
{ VIRTIO_PCI_DEVICE *Dev; Dev = VIRTIO_PCI_DEVICE_FROM_VIRTIO_DEVICE (This); return VirtioPciIoRead ( Dev, Dev->DeviceSpecificConfigurationOffset + FieldOffset, FieldSize, BufferSize, Buffer ); }
tianocore/edk2
C++
Other
4,240
/* mpc52xx_spi_fsm_process - Finite State Machine iteration function @irq: irq number that triggered the FSM or 0 for polling @ms: pointer to */
static void mpc52xx_spi_fsm_process(int irq, struct mpc52xx_spi *ms)
/* mpc52xx_spi_fsm_process - Finite State Machine iteration function @irq: irq number that triggered the FSM or 0 for polling @ms: pointer to */ static void mpc52xx_spi_fsm_process(int irq, struct mpc52xx_spi *ms)
{ int rc = FSM_CONTINUE; u8 status, data; while (rc == FSM_CONTINUE) { status = in_8(ms->regs + SPI_STATUS); data = in_8(ms->regs + SPI_DATA); rc = ms->state(irq, ms, status, data); } if (rc == FSM_POLL) schedule_work(&ms->work); }
robutest/uclinux
C++
GPL-2.0
60
/* Write all capture filter values to the recent file. */
static void cfilter_recent_write_all(FILE *rf)
/* Write all capture filter values to the recent file. */ static void cfilter_recent_write_all(FILE *rf)
{ cfilter_recent_write_all_list(rf, NULL, recent_cfilter_list); if (per_interface_cfilter_lists_hash != NULL) { g_hash_table_foreach(per_interface_cfilter_lists_hash, cfilter_recent_write_all_hash_callback, (gpointer)rf); } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function prints user info on PC com port and initiates RX transfer. */
void StartReception(void)
/* This function prints user info on PC com port and initiates RX transfer. */ void StartReception(void)
{ pBufferReadyForReception = aRXBufferA; pBufferReadyForUser = aRXBufferB; uwNbReceivedChars = 0; PrintInfo(&huart2, aTextInfoStart, COUNTOF(aTextInfoStart)); if (HAL_OK != HAL_UARTEx_ReceiveToIdle_DMA(&huart2, aRXBufferUser, RX_BUFFER_SIZE)) { Error_Handler(); } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Used to authenticate blocks of data by generating a hash tag. */
bool AESDataAuth(uint32_t ui32Base, uint32_t *pui32Src, uint32_t ui32Length, uint32_t *pui32Tag)
/* Used to authenticate blocks of data by generating a hash tag. */ bool AESDataAuth(uint32_t ui32Base, uint32_t *pui32Src, uint32_t ui32Length, uint32_t *pui32Tag)
{ uint32_t ui32Count; ASSERT(ui32Base == AES_BASE); AESLengthSet(ui32Base, (uint64_t)ui32Length); for (ui32Count = 0; ui32Count < ui32Length; ui32Count += 16) { AESDataWrite(ui32Base, pui32Src + (ui32Count / 4)); } AESTagRead(ui32Base, pui32Tag); return (true); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Cancel an active channel-path deconfiguration request if it has not yet been performed. */
void chp_cfg_cancel_deconfigure(struct chp_id chpid)
/* Cancel an active channel-path deconfiguration request if it has not yet been performed. */ void chp_cfg_cancel_deconfigure(struct chp_id chpid)
{ CIO_MSG_EVENT(2, "chp_cfg_cancel:%x.%02x\n", chpid.cssid, chpid.id); mutex_lock(&cfg_lock); if (cfg_get_task(chpid) == cfg_deconfigure) cfg_set_task(chpid, cfg_none); mutex_unlock(&cfg_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* Function for handling the UART module event. It parses events from the UART when bytes are received/transmitted. */
static void slip_uart_eventhandler(app_uart_evt_t *uart_event)
/* Function for handling the UART module event. It parses events from the UART when bytes are received/transmitted. */ static void slip_uart_eventhandler(app_uart_evt_t *uart_event)
{ if (uart_event->evt_type == APP_UART_TX_EMPTY && m_current_state == SLIP_TRANSMITTING) { transmit_buffer(); } if ((uart_event->evt_type == APP_UART_DATA) && (!rx_buffer_overflowed())) { handle_rx_byte(uart_event->data.value); } }
labapart/polymcu
C++
null
201
/* RB-tree support functions for inserting/lookup/removal of requests in a sorted RB tree. */
struct request* elv_rb_add(struct rb_root *root, struct request *rq)
/* RB-tree support functions for inserting/lookup/removal of requests in a sorted RB tree. */ struct request* elv_rb_add(struct rb_root *root, struct request *rq)
{ struct rb_node **p = &root->rb_node; struct rb_node *parent = NULL; struct request *__rq; while (*p) { parent = *p; __rq = rb_entry(parent, struct request, rb_node); if (blk_rq_pos(rq) < blk_rq_pos(__rq)) p = &(*p)->rb_left; else if (blk_rq_pos(rq) > blk_rq_pos(__rq)) p = &(*p)->rb_right; else ...
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function implements EFI_BLOCK_IO_PROTOCOL.Reset(). It resets the block device hardware. ExtendedVerification is ignored in this implementation. */
EFI_STATUS EFIAPI UsbMassReset(IN EFI_BLOCK_IO_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
/* This function implements EFI_BLOCK_IO_PROTOCOL.Reset(). It resets the block device hardware. ExtendedVerification is ignored in this implementation. */ EFI_STATUS EFIAPI UsbMassReset(IN EFI_BLOCK_IO_PROTOCOL *This, IN BOOLEAN ExtendedVerification)
{ USB_MASS_DEVICE *UsbMass; EFI_TPL OldTpl; EFI_STATUS Status; OldTpl = gBS->RaiseTPL (TPL_CALLBACK); UsbMass = USB_MASS_DEVICE_FROM_BLOCK_IO (This); Status = UsbMass->Transport->Reset (UsbMass->Context, ExtendedVerification); gBS->RestoreTPL (OldTpl); return Status; }
tianocore/edk2
C++
Other
4,240
/* Success happens when the "mask" bits have the specified value (hardware handshake done). There are two failure modes: "usec" have passed (major hardware flakeout), or the register reads as all-ones (hardware removed). */
static int handshake(struct xhci_hcd *xhci, void __iomem *ptr, u32 mask, u32 done, int usec)
/* Success happens when the "mask" bits have the specified value (hardware handshake done). There are two failure modes: "usec" have passed (major hardware flakeout), or the register reads as all-ones (hardware removed). */ static int handshake(struct xhci_hcd *xhci, void __iomem *ptr, u32 mask, u32 done, int usec)
{ u32 result; do { result = xhci_readl(xhci, ptr); if (result == ~(u32)0) return -ENODEV; result &= mask; if (result == done) return 0; udelay(1); usec--; } while (usec > 0); return -ETIMEDOUT; }
robutest/uclinux
C++
GPL-2.0
60
/* Load the pointer to the list of recognized CLI commands. */
void cli_load_command_calls(struct cli_desc *dev, char **command_calls)
/* Load the pointer to the list of recognized CLI commands. */ void cli_load_command_calls(struct cli_desc *dev, char **command_calls)
{ dev->cmd_commands = command_calls; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Waits a USB start of frame (or 1ms for USB low speed) */
static void main_usb_wait_sof(void)
/* Waits a USB start of frame (or 1ms for USB low speed) */ static void main_usb_wait_sof(void)
{ if (Is_udd_low_speed_enable()) { delay_ms(1); return; } udd_ack_sof(); while (!Is_udd_sof()) { } udd_ack_sof(); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Rx flow control disable. When disabled GMAC will not decode pause frame. */
void synopGMAC_rx_flow_control_disable(synopGMACdevice *gmacdev)
/* Rx flow control disable. When disabled GMAC will not decode pause frame. */ void synopGMAC_rx_flow_control_disable(synopGMACdevice *gmacdev)
{ synopGMACClearBits(gmacdev -> MacBase, GmacFlowControl, GmacRxFlowControl); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* pass receive buffer (RAW synchronous mode) to tty layer return true if buffer available, otherwise false */
static bool rx_get_buf(struct slgt_info *info)
/* pass receive buffer (RAW synchronous mode) to tty layer return true if buffer available, otherwise false */ static bool rx_get_buf(struct slgt_info *info)
{ unsigned int i = info->rbuf_current; unsigned int count; if (!desc_complete(info->rbufs[i])) return false; count = desc_count(info->rbufs[i]); switch(info->params.mode) { case MGSL_MODE_MONOSYNC: case MGSL_MODE_BISYNC: if (desc_residue(info->rbufs[i])) count--; break; } DBGDATA(info, info->rbufs[i]....
robutest/uclinux
C++
GPL-2.0
60
/* Returns: lpfc_do_offline() return code if not zero -EIO reset not configured or error posting the event zero for success */
static int lpfc_selective_reset(struct lpfc_hba *phba)
/* Returns: lpfc_do_offline() return code if not zero -EIO reset not configured or error posting the event zero for success */ static int lpfc_selective_reset(struct lpfc_hba *phba)
{ struct completion online_compl; int status = 0; if (!phba->cfg_enable_hba_reset) return -EIO; status = lpfc_do_offline(phba, LPFC_EVT_OFFLINE); if (status != 0) return status; init_completion(&online_compl); lpfc_workq_post_event(phba, &status, &online_compl, LPFC_EVT_ONLINE); wait_for_completion...
robutest/uclinux
C++
GPL-2.0
60
/* Checks whether the specified ADC flag is set or not. */
FlagStatus ADC_GetFlagStatus(ADC_TypeDef *adc, ADCFLAG_TypeDef adc_flag)
/* Checks whether the specified ADC flag is set or not. */ FlagStatus ADC_GetFlagStatus(ADC_TypeDef *adc, ADCFLAG_TypeDef adc_flag)
{ return (adc_flag == ADC_IT_EOC) ? ((adc->ADSTA & ADC_SR_ADIF) ? SET : RESET) : ((adc->ADSTA & ADC_SR_ADWIF) ? SET : RESET); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* print an ipv4 or ipv6 address into a buffer dependend on address length. */
static char* bgp_vpn_ip_print(netdissect_options *ndo, const u_char *pptr, u_int addr_length)
/* print an ipv4 or ipv6 address into a buffer dependend on address length. */ static char* bgp_vpn_ip_print(netdissect_options *ndo, const u_char *pptr, u_int addr_length)
{ static char addr[sizeof("1234:5678:89ab:cdef:1234:5678:89ab:cdef")]; char *pos = addr; switch(addr_length) { case (sizeof(struct in_addr) << 3): ND_TCHECK2(pptr[0], sizeof(struct in_addr)); snprintf(pos, sizeof(addr), "%s", ipaddr_string(ndo, pptr)); break; case (sizeof(str...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* returns the number of bytes consumed, or negative value on error */
int ipath_parse_ushort(const char *str, unsigned short *valp)
/* returns the number of bytes consumed, or negative value on error */ int ipath_parse_ushort(const char *str, unsigned short *valp)
{ unsigned long val; char *end; int ret; if (!isdigit(str[0])) { ret = -EINVAL; goto bail; } val = simple_strtoul(str, &end, 0); if (val > 0xffff) { ret = -EINVAL; goto bail; } *valp = val; ret = end + 1 - str; if (ret == 0) ret = -EINVAL; bail: return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* omap_read_buf_dma_pref - read data from NAND controller into buffer @mtd: MTD device structure @buf: buffer to store date @len: number of bytes to read */
static void omap_read_buf_dma_pref(struct mtd_info *mtd, u_char *buf, int len)
/* omap_read_buf_dma_pref - read data from NAND controller into buffer @mtd: MTD device structure @buf: buffer to store date @len: number of bytes to read */ static void omap_read_buf_dma_pref(struct mtd_info *mtd, u_char *buf, int len)
{ if (len <= mtd->oobsize) omap_read_buf_pref(mtd, buf, len); else omap_nand_dma_transfer(mtd, buf, len, 0x0); }
robutest/uclinux
C++
GPL-2.0
60
/* Release chip lock and wake up anyone waiting on the device. */
static void nand_release_device(struct mtd_info *mtd)
/* Release chip lock and wake up anyone waiting on the device. */ static void nand_release_device(struct mtd_info *mtd)
{ struct nand_chip *chip = mtd_to_nand(mtd); chip->select_chip(mtd, -1); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Get the captured data for a sample sequence. */
unsigned long xADCDataGet(unsigned long ulBase, unsigned long *pulBuffer)
/* Get the captured data for a sample sequence. */ unsigned long xADCDataGet(unsigned long ulBase, unsigned long *pulBuffer)
{ unsigned long ulValid = 0; unsigned long ulWrite; xASSERT(ulBase == ADC_BASE); xASSERT(pulBuffer != 0); do { ulValid = (xHWREG(ulBase + ADC0_SC1A) & ADC0_SC1A_COCO_FLAG) >> 7; } while(!ulValid); ulWrite = 0; pulBuffer[ulWrite++] = xHWREG(ulBase + ADC0_RA); return ulWrit...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Attempt to initialise any uninitalised cards. Must be called with client_mutex. */
static void snd_soc_instantiate_cards(void)
/* Attempt to initialise any uninitalised cards. Must be called with client_mutex. */ static void snd_soc_instantiate_cards(void)
{ struct snd_soc_card *card; list_for_each_entry(card, &card_list, list) snd_soc_instantiate_card(card); }
robutest/uclinux
C++
GPL-2.0
60
/* Set up a new pi3usb9201 emulator. This should be called for each pi3usb9201 device that needs to be emulated. It registers it with the I2C emulation controller. */
static int pi3usb9201_emul_init(const struct emul *target, const struct device *parent)
/* Set up a new pi3usb9201 emulator. This should be called for each pi3usb9201 device that needs to be emulated. It registers it with the I2C emulation controller. */ static int pi3usb9201_emul_init(const struct emul *target, const struct device *parent)
{ const struct pi3usb9201_emul_cfg *cfg = target->cfg; struct pi3usb9201_emul_data *data = cfg->data; data->i2c = parent; data->cfg = cfg; LOG_INF("init"); pi3usb9201_emul_reset(target); return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Select VLC set for decoding from current quantizer, modifier and frame type. */
static RV34VLC* choose_vlc_set(int quant, int mod, int type)
/* Select VLC set for decoding from current quantizer, modifier and frame type. */ static RV34VLC* choose_vlc_set(int quant, int mod, int type)
{ if(mod == 2 && quant < 19) quant += 10; else if(mod && quant < 26) quant += 5; return type ? &inter_vlcs[rv34_quant_to_vlc_set[1][av_clip(quant, 0, 30)]] : &intra_vlcs[rv34_quant_to_vlc_set[0][av_clip(quant, 0, 30)]]; }
DC-SWAT/DreamShell
C++
null
404
/* atlx_irq_enable - Enable default interrupt generation settings @adapter: board private structure */
static void atlx_irq_enable(struct atlx_adapter *adapter)
/* atlx_irq_enable - Enable default interrupt generation settings @adapter: board private structure */ static void atlx_irq_enable(struct atlx_adapter *adapter)
{ iowrite32(IMR_NORMAL_MASK, adapter->hw.hw_addr + REG_IMR); ioread32(adapter->hw.hw_addr + REG_IMR); }
robutest/uclinux
C++
GPL-2.0
60
/* Scans the superblock list and finds the superblock of the file system mounted on the device given. Returns the superblock with an active reference and s_umount held exclusively or NULL if none was found. */
struct super_block* get_active_super(struct block_device *bdev)
/* Scans the superblock list and finds the superblock of the file system mounted on the device given. Returns the superblock with an active reference and s_umount held exclusively or NULL if none was found. */ struct super_block* get_active_super(struct block_device *bdev)
{ struct super_block *sb; if (!bdev) return NULL; spin_lock(&sb_lock); list_for_each_entry(sb, &super_blocks, s_list) { if (sb->s_bdev != bdev) continue; sb->s_count++; spin_unlock(&sb_lock); down_write(&sb->s_umount); if (sb->s_root) { spin_lock(&sb_lock); if (sb->s_count > S_BIAS) { atomi...
robutest/uclinux
C++
GPL-2.0
60
/* Schedule all required I/O operations. Do not wait for completion. */
static long madvise_willneed(struct vm_area_struct *vma, struct vm_area_struct **prev, unsigned long start, unsigned long end)
/* Schedule all required I/O operations. Do not wait for completion. */ static long madvise_willneed(struct vm_area_struct *vma, struct vm_area_struct **prev, unsigned long start, unsigned long end)
{ struct file *file = vma->vm_file; if (!file) return -EBADF; if (file->f_mapping->a_ops->get_xip_mem) { return 0; } *prev = vma; start = ((start - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; if (end > vma->vm_end) end = vma->vm_end; end = ((end - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; force_p...
robutest/uclinux
C++
GPL-2.0
60
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI PciOr16(IN UINTN Address, IN UINT16 OrData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ UINT16 EFIAPI PciOr16(IN UINTN Address, IN UINT16 OrData)
{ return PciCf8Or16 (Address, OrData); }
tianocore/edk2
C++
Other
4,240
/* This function effectively returns value of FDCAN_CCCR's INIT bit. */
int fdcan_get_init_state(uint32_t canport)
/* This function effectively returns value of FDCAN_CCCR's INIT bit. */ int fdcan_get_init_state(uint32_t canport)
{ return ((FDCAN_CCCR(canport) & FDCAN_CCCR_INIT) == FDCAN_CCCR_INIT); }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* param base Pointer to FLEXIO_SPI_Type structure. param handle FlexIO SPI eDMA handle pointer. */
void FLEXIO_SPI_MasterTransferAbortEDMA(FLEXIO_SPI_Type *base, flexio_spi_master_edma_handle_t *handle)
/* param base Pointer to FLEXIO_SPI_Type structure. param handle FlexIO SPI eDMA handle pointer. */ void FLEXIO_SPI_MasterTransferAbortEDMA(FLEXIO_SPI_Type *base, flexio_spi_master_edma_handle_t *handle)
{ assert(handle); EDMA_StopTransfer(handle->txHandle); EDMA_StopTransfer(handle->rxHandle); FLEXIO_SPI_EnableDMA(base, kFLEXIO_SPI_DmaAllEnable, false); handle->txInProgress = false; handle->rxInProgress = false; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set the slave select pins of the specified SPI port. The */
void xSPISSSet(unsigned long ulBase, unsigned long ulSSMode, unsigned long ulSlaveSel)
/* Set the slave select pins of the specified SPI port. The */ void xSPISSSet(unsigned long ulBase, unsigned long ulSSMode, unsigned long ulSlaveSel)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)); xASSERT((ulSlaveSel == SPI_SS_NONE) || (ulSlaveSel == SPI_SS0) || (ulSlaveSel == SPI_SS1) || (ulSlaveSel == SPI_SS0_SS1)); xHWREG(ulBase + SPI_SSR) |= ulSSMode; xHWREG(ulBase + SPI_SSR) &= ~SPI_SSR_SSR_M; xHWREG(ulBase + SPI_SSR)...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Returns the time entered by user, using Hyperterminal. */
uint32_t Time_Regulate(void)
/* Returns the time entered by user, using Hyperterminal. */ uint32_t Time_Regulate(void)
{ uint32_t Tmp_HH = 0xFF, Tmp_MM = 0xFF, Tmp_SS = 0xFF; printf("\r\n==============Time Settings====================================="); printf("\r\n Please Set Hours"); while (Tmp_HH == 0xFF) { Tmp_HH = USART_Scanf(23); } printf(": %d", Tmp_HH); printf("\r\n Please Set Minutes"); while (Tmp_MM ...
remotemcu/remcu-chip-sdks
C++
null
436
/* This routine prepares the mailbox command for enabling HBA asynchronous event support on a IOCB ring. */
void lpfc_config_async(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb, uint32_t ring)
/* This routine prepares the mailbox command for enabling HBA asynchronous event support on a IOCB ring. */ void lpfc_config_async(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb, uint32_t ring)
{ MAILBOX_t *mb; mb = &pmb->u.mb; memset(pmb, 0, sizeof (LPFC_MBOXQ_t)); mb->mbxCommand = MBX_ASYNCEVT_ENABLE; mb->un.varCfgAsyncEvent.ring = ring; mb->mbxOwner = OWN_HOST; return; }
robutest/uclinux
C++
GPL-2.0
60
/* tty_driver.write_room interface routine return number of characters the driver will accept to be written parameter: controller state structure return value: number of characters */
static int gigaset_write_room(struct cardstate *cs)
/* tty_driver.write_room interface routine return number of characters the driver will accept to be written parameter: controller state structure return value: number of characters */ static int gigaset_write_room(struct cardstate *cs)
{ unsigned bytes; bytes = cs->cmdbytes; return bytes < IF_WRITEBUF ? IF_WRITEBUF - bytes : 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Status interrupt vectors for a Z8530 that is in 'parked' mode. For machines with PCI Z85x30 cards, or level triggered interrupts (eg the MacII) we must clear the interrupt cause or die. */
static void z8530_status_clear(struct z8530_channel *chan)
/* Status interrupt vectors for a Z8530 that is in 'parked' mode. For machines with PCI Z85x30 cards, or level triggered interrupts (eg the MacII) we must clear the interrupt cause or die. */ static void z8530_status_clear(struct z8530_channel *chan)
{ u8 status=read_zsreg(chan, R0); if(status&TxEOM) write_zsctrl(chan, ERR_RES); write_zsctrl(chan, RES_EXT_INT); write_zsctrl(chan, RES_H_IUS); }
robutest/uclinux
C++
GPL-2.0
60
/* This function gets the FspSiliconInit UPD data pointer. */
VOID* EFIAPI GetFspSiliconInitUpdDataPointer(VOID)
/* This function gets the FspSiliconInit UPD data pointer. */ VOID* EFIAPI GetFspSiliconInitUpdDataPointer(VOID)
{ FSP_GLOBAL_DATA *FspData; FspData = GetFspGlobalDataPointer (); return FspData->SiliconInitUpdPtr; }
tianocore/edk2
C++
Other
4,240
/* Set the login details so they're available in the connection */
static CURLcode set_login(struct connectdata *conn)
/* Set the login details so they're available in the connection */ static CURLcode set_login(struct connectdata *conn)
{ CURLcode result = CURLE_OK; const char *setuser = CURL_DEFAULT_USER; const char *setpasswd = CURL_DEFAULT_PASSWORD; if((conn->handler->flags & PROTOPT_NEEDSPWD) && !conn->bits.user_passwd) ; else { setuser = ""; setpasswd = ""; } if(!conn->user) { conn->user = strdup(setuser); if(!co...
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Enables or disables the discontinuous mode on regular group channel for the specified ADC. */
void ADC_DiscModeCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
/* Enables or disables the discontinuous mode on regular group channel for the specified ADC. */ void ADC_DiscModeCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
{ assert_param(IS_ADC_ALL_PERIPH(ADCx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { ADCx->CR1 |= ADC_CR1_DISCEN; } else { ADCx->CR1 &= (uint32_t)(~ADC_CR1_DISCEN); } }
avem-labs/Avem
C++
MIT License
1,752
/* Perform basic hardware initialization at boot. This needs to be run from the very beginning. So the init priority has to be 0 (zero). */
static int viper_init(void)
/* Perform basic hardware initialization at boot. This needs to be run from the very beginning. So the init priority has to be 0 (zero). */ static int viper_init(void)
{ uint32_t data; data = sys_read32(LS_ICFG_PMON_LITE_CLK_CTRL); data |= PCIE_PMON_LITE_CLK_ENABLE; sys_write32(data, LS_ICFG_PMON_LITE_CLK_CTRL); data = sys_read32(LS_ICFG_PMON_LITE_SW_RESETN); data |= PCIE_PMON_LITE_SW_RESETN; sys_write32(data, LS_ICFG_PMON_LITE_SW_RESETN); return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* From section 5.6.2.2 of the ACPI 2.0 spec, I understand that the OSPM will only re-enable the interrupt that causes this event AFTER this method has returned, thereby enforcing serial access for the notification struct. */
static void ibm_handle_events(acpi_handle handle, u32 event, void *context)
/* From section 5.6.2.2 of the ACPI 2.0 spec, I understand that the OSPM will only re-enable the interrupt that causes this event AFTER this method has returned, thereby enforcing serial access for the notification struct. */ static void ibm_handle_events(acpi_handle handle, u32 event, void *context)
{ u8 detail = event & 0x0f; u8 subevent = event & 0xf0; struct notification *note = context; dbg("%s: Received notification %02x\n", __func__, event); if (subevent == 0x80) { dbg("%s: generationg bus event\n", __func__); acpi_bus_generate_proc_event(note->device, note->event, detail); acpi_bus_generate_netli...
robutest/uclinux
C++
GPL-2.0
60
/* Initialize the logical CPU number to SAPICID mapping */
void __init smp_build_cpu_map(void)
/* Initialize the logical CPU number to SAPICID mapping */ void __init smp_build_cpu_map(void)
{ int sapicid, cpu, i; int boot_cpu_id = hard_smp_processor_id(); for (cpu = 0; cpu < NR_CPUS; cpu++) { ia64_cpu_to_sapicid[cpu] = -1; } ia64_cpu_to_sapicid[0] = boot_cpu_id; cpus_clear(cpu_present_map); set_cpu_present(0, true); set_cpu_possible(0, true); for (cpu = 1, i = 0; i < smp_boot_data.cpu_count; i+...
EmcraftSystems/linux-emcraft
C++
Other
266
/* We can't address 8 and 16 bit words directly. Instead we have to read/write a 32bit word and mask/modify the data we actually want. */
static int bonito64_pcibios_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val)
/* We can't address 8 and 16 bit words directly. Instead we have to read/write a 32bit word and mask/modify the data we actually want. */ static int bonito64_pcibios_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *val)
{ u32 data = 0; if ((size == 2) && (where & 1)) return PCIBIOS_BAD_REGISTER_NUMBER; else if ((size == 4) && (where & 3)) return PCIBIOS_BAD_REGISTER_NUMBER; if (bonito64_pcibios_config_access(PCI_ACCESS_READ, bus, devfn, where, &data)) return -1; if (size == 1) *val = (data >> ((where & 3) << 3)...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns: a newly allocated string containing the requested identfier, or NULL if the #GVolume doesn't have this kind of identifier */
char* g_volume_get_identifier(GVolume *volume, const char *kind)
/* Returns: a newly allocated string containing the requested identfier, or NULL if the #GVolume doesn't have this kind of identifier */ char* g_volume_get_identifier(GVolume *volume, const char *kind)
{ GVolumeIface *iface; g_return_val_if_fail (G_IS_VOLUME (volume), NULL); g_return_val_if_fail (kind != NULL, NULL); iface = G_VOLUME_GET_IFACE (volume); if (iface->get_identifier == NULL) return NULL; return (* iface->get_identifier) (volume, kind); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Get number of memory blocks available in a Memory Pool. */
static uint32_t svcRtxMemoryPoolGetSpace(osMemoryPoolId_t mp_id)
/* Get number of memory blocks available in a Memory Pool. */ static uint32_t svcRtxMemoryPoolGetSpace(osMemoryPoolId_t mp_id)
{ EvrRtxMemoryPoolGetSpace(mp, 0U); return 0U; } EvrRtxMemoryPoolGetSpace(mp, mp->mp_info.max_blocks - mp->mp_info.used_blocks); return (mp->mp_info.max_blocks - mp->mp_info.used_blocks); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Creates a nonce and decrypts secured ZigBee GP payload. */
static gboolean zbee_gp_decrypt_payload(zbee_nwk_green_power_packet *packet, const gchar *enc_buffer, const gchar offset, guint8 *dec_buffer, guint payload_len, guint mic_len, guint8 *key)
/* Creates a nonce and decrypts secured ZigBee GP payload. */ static gboolean zbee_gp_decrypt_payload(zbee_nwk_green_power_packet *packet, const gchar *enc_buffer, const gchar offset, guint8 *dec_buffer, guint payload_len, guint mic_len, guint8 *key)
{ guint8 *key_buffer = key; guint8 nonce[ZBEE_SEC_CONST_NONCE_LEN]; zbee_gp_make_nonce(packet, nonce); if (zbee_sec_ccm_decrypt(key_buffer, nonce, enc_buffer, enc_buffer + offset, dec_buffer, offset, payload_len, mic_len)) { return TRUE; } return FALSE; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function returns the current value of the SysTick counter; this will be a value between the period - 1 and zero, inclusive. */
unsigned long SysTickValueGet(void)
/* This function returns the current value of the SysTick counter; this will be a value between the period - 1 and zero, inclusive. */ unsigned long SysTickValueGet(void)
{ return(HWREG(NVIC_ST_CURRENT)); }
watterott/WebRadio
C++
null
71
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */
gboolean _g_freedesktop_dbus_call_start_service_by_name_finish(_GFreedesktopDBus *proxy, guint *out_value, GAsyncResult *res, GError **error)
/* Returns: (skip): TRUE if the call succeded, FALSE if @error is set. */ gboolean _g_freedesktop_dbus_call_start_service_by_name_finish(_GFreedesktopDBus *proxy, guint *out_value, GAsyncResult *res, GError **error)
{ GVariant *_ret; _ret = g_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), res, error); if (_ret == NULL) goto _out; g_variant_get (_ret, "(u)", out_value); g_variant_unref (_ret); _out: return _ret != NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Send sysex message in pieces of wMaxPacketSize bytes. */
int line6_send_sysex_message(struct usb_line6 *line6, const char *buffer, int size)
/* Send sysex message in pieces of wMaxPacketSize bytes. */ int line6_send_sysex_message(struct usb_line6 *line6, const char *buffer, int size)
{ return line6_send_raw_message(line6, buffer, size + SYSEX_EXTRA_SIZE) - SYSEX_EXTRA_SIZE; }
robutest/uclinux
C++
GPL-2.0
60
/* Master sends single byte through the I2Cx peripheral according to the set of the upper layer. */
void I2C_MasterSendNullData(I2C_TypeDef *I2Cx, u8 *pBuf, u8 I2CCmd, u8 I2CStop, u8 I2CReSTR)
/* Master sends single byte through the I2Cx peripheral according to the set of the upper layer. */ void I2C_MasterSendNullData(I2C_TypeDef *I2Cx, u8 *pBuf, u8 I2CCmd, u8 I2CStop, u8 I2CReSTR)
{ assert_param(IS_I2C_ALL_PERIPH(I2Cx)); I2Cx->IC_DATA_CMD = *(pBuf) | (1 << 11) | (I2CReSTR << 10) | (I2CCmd << 8) | (I2CStop << 9); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Make the autofs mount point catatonic, no longer responsive to mount requests. Also closes the kernel pipe file descriptor. */
static int autofs_dev_ioctl_catatonic(struct file *fp, struct autofs_sb_info *sbi, struct autofs_dev_ioctl *param)
/* Make the autofs mount point catatonic, no longer responsive to mount requests. Also closes the kernel pipe file descriptor. */ static int autofs_dev_ioctl_catatonic(struct file *fp, struct autofs_sb_info *sbi, struct autofs_dev_ioctl *param)
{ autofs4_catatonic_mode(sbi); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* convert the MN10300 exception code into a UNIX signal number */
static int computeSignal(enum exception_code excep)
/* convert the MN10300 exception code into a UNIX signal number */ static int computeSignal(enum exception_code excep)
{ const struct excep_to_sig_map *map; for (map = excep_to_sig_map; map->signo; map++) if (map->excep == excep) return map->signo; return SIGHUP; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enables or disables the specified I2C software reset. */
void I2C_SoftwareResetCmd(I2C_TypeDef *I2Cx)
/* Enables or disables the specified I2C software reset. */ void I2C_SoftwareResetCmd(I2C_TypeDef *I2Cx)
{ assert_param(IS_I2C_ALL_PERIPH(I2Cx)); I2Cx->CR1 &= (uint32_t)~((uint32_t)I2C_CR1_PE); *(__IO uint32_t *)(uint32_t)I2Cx; I2Cx->CR1 |= I2C_CR1_PE; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns the state associated with a MPA connection or NULL otherwise. */
static mpa_state_t* get_mpa_state(conversation_t *conversation)
/* Returns the state associated with a MPA connection or NULL otherwise. */ static mpa_state_t* get_mpa_state(conversation_t *conversation)
{ if (conversation) { return (mpa_state_t*) conversation_get_proto_data(conversation, proto_iwarp_mpa); } else { return NULL; } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Writes a Port pin configuration to the hardware module. Writes out a given configuration of a Port pin configuration to the hardware module. */
void system_pinmux_pin_set_config(const uint8_t gpio_pin, const struct system_pinmux_config *const config)
/* Writes a Port pin configuration to the hardware module. Writes out a given configuration of a Port pin configuration to the hardware module. */ void system_pinmux_pin_set_config(const uint8_t gpio_pin, const struct system_pinmux_config *const config)
{ PortGroup *const port = system_pinmux_get_group_from_gpio_pin(gpio_pin); uint32_t pin_mask = (1UL << (gpio_pin % 32)); _system_pinmux_config(port, pin_mask, config); }
memfault/zero-to-main
C++
null
200
/* Enable on the air data whitening. the in-memory data will remain unwhitened. */
void radio_enable_whitening(void)
/* Enable on the air data whitening. the in-memory data will remain unwhitened. */ void radio_enable_whitening(void)
{ RADIO_PCNF1 |= RADIO_PCNF1_WHITEEN; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Copy active data rates based on adapter mode and status. */
static void copy_active_data_rates(struct lbs_private *priv, u8 *rates)
/* Copy active data rates based on adapter mode and status. */ static void copy_active_data_rates(struct lbs_private *priv, u8 *rates)
{ lbs_deb_enter(LBS_DEB_WEXT); if ((priv->connect_status != LBS_CONNECTED) && (priv->mesh_connect_status != LBS_CONNECTED)) memcpy(rates, lbs_bg_rates, MAX_RATES); else memcpy(rates, priv->curbssparams.rates, MAX_RATES); lbs_deb_leave(LBS_DEB_WEXT); }
robutest/uclinux
C++
GPL-2.0
60
/* @guid: GUID of the configuration table Return: pointer to configuration table or NULL */
static void* efi_st_get_config_table(const efi_guid_t *guid)
/* @guid: GUID of the configuration table Return: pointer to configuration table or NULL */ static void* efi_st_get_config_table(const efi_guid_t *guid)
{ size_t i; for (i = 0; i < systab.nr_tables; i++) { if (!guidcmp(guid, &systemtab->tables[i].guid)) return systemtab->tables[i].table; } return NULL; }
4ms/stm32mp1-baremetal
C++
Other
137