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
/* Function for restore tail state entry action. Function for restore tail state entry action, which includes writing the tail section back from swap to the data page. */
static void state_restore_tail_entry_run(void)
/* Function for restore tail state entry action. Function for restore tail state entry action, which includes writing the tail section back from swap to the data page. */ static void state_restore_tail_entry_run(void)
{ const cmd_queue_element_t * p_cmd = &m_cmd_queue.cmd[m_cmd_queue.rp]; const pstorage_block_t cmd_block_id = p_cmd->storage_addr.block_id; const uint32_t tail_offset = (cmd_block_id + p_cmd->size + p_cmd->offset) % PSTORAGE_FLASH_PAGE_SIZE; flash_write((uint32_t *)(cmd_block_id + p_cmd->size + p_cmd->offset), (uint32_t *)(PSTORAGE_SWAP_ADDR + tail_offset), m_tail_word_size); }
labapart/polymcu
C++
null
201
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI PciSegmentWrite16(IN UINT64 Address, IN UINT16 Value)
/* If any reserved bits in Address are set, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ UINT16 EFIAPI PciSegmentWrite16(IN UINT64 Address, IN UINT16 Value)
{ UINTN Count; PCI_SEGMENT_INFO *SegmentInfo; SegmentInfo = GetPciSegmentInfo (&Count); return MmioWrite16 (PciSegmentLibGetEcamAddress (Address, SegmentInfo, Count), Value); }
tianocore/edk2
C++
Other
4,240
/* Enables the events that can trigger a DMA request. */
void TimerDMAEventSet(unsigned long ulBase, unsigned long ulDMAEvent)
/* Enables the events that can trigger a DMA request. */ void TimerDMAEventSet(unsigned long ulBase, unsigned long ulDMAEvent)
{ ASSERT(TimerBaseValid(ulBase)); HWREG(ulBase + TIMER_O_DMAEV) = ulDMAEvent; }
micropython/micropython
C++
Other
18,334
/* get network statistics for ifconfig and other user programs */
static struct net_device_stats* lcs_getstats(struct net_device *dev)
/* get network statistics for ifconfig and other user programs */ static struct net_device_stats* lcs_getstats(struct net_device *dev)
{ struct lcs_card *card; LCS_DBF_TEXT(4, trace, "netstats"); card = (struct lcs_card *) dev->ml_priv; return &card->stats; }
robutest/uclinux
C++
GPL-2.0
60
/* Get the bits in the HOST side IOINTCTL register. This function may be used to read the host side interrupt bits. */
uint32_t am_hal_ios_host_int_get(void)
/* Get the bits in the HOST side IOINTCTL register. This function may be used to read the host side interrupt bits. */ uint32_t am_hal_ios_host_int_get(void)
{ return AM_BFR(IOSLAVE, IOINTCTL, IOINT); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set a given number of pixels to the same color. Use this function to write a certain number of pixels to the same color within a set limit. */
void ili93xx_duplicate_pixel(const ili93xx_color_t color, uint32_t count)
/* Set a given number of pixels to the same color. Use this function to write a certain number of pixels to the same color within a set limit. */ void ili93xx_duplicate_pixel(const ili93xx_color_t color, uint32_t count)
{ Assert(count > 0); if (g_uc_device_type == DEVICE_TYPE_ILI9325) { LCD_IR(0); LCD_IR(ILI9325_GRAM_DATA_REG); } else if (g_uc_device_type == DEVICE_TYPE_ILI9341) { LCD_IR(ILI9341_CMD_MEMORY_WRITE); LCD_IR(0); LCD_IR(ILI9341_CMD_WRITE_MEMORY_CONTINUE); } while (count--) { LCD_WD((color >> 16) & 0xFF); LCD_WD((color >> 8) & 0xFF); LCD_WD(color & 0xFF); } }
remotemcu/remcu-chip-sdks
C++
null
436
/* __set_agg_ports_ready - set value of Ready bit in all ports of an aggregator @aggregator: the aggregator we're looking at @val: Should the ports' ready bit be set on or off */
static void __set_agg_ports_ready(struct aggregator *aggregator, int val)
/* __set_agg_ports_ready - set value of Ready bit in all ports of an aggregator @aggregator: the aggregator we're looking at @val: Should the ports' ready bit be set on or off */ static void __set_agg_ports_ready(struct aggregator *aggregator, int val)
{ struct port *port; for (port=aggregator->lag_ports; port; port=port->next_port_in_aggregator) { if (val) { port->sm_vars |= AD_PORT_READY; } else { port->sm_vars &= ~AD_PORT_READY; } } }
robutest/uclinux
C++
GPL-2.0
60
/* Constructor for RPN event when a missing GUIDED_SECTION_EXTRACTION_PROTOCOL appears... */
VOID CreateGuidedExtractionRpnEvent(IN CORE_SECTION_STREAM_NODE *ParentStream, IN CORE_SECTION_CHILD_NODE *ChildNode)
/* Constructor for RPN event when a missing GUIDED_SECTION_EXTRACTION_PROTOCOL appears... */ VOID CreateGuidedExtractionRpnEvent(IN CORE_SECTION_STREAM_NODE *ParentStream, IN CORE_SECTION_CHILD_NODE *ChildNode)
{ RPN_EVENT_CONTEXT *Context; Context = AllocatePool (sizeof (RPN_EVENT_CONTEXT)); ASSERT (Context != NULL); Context->ChildNode = ChildNode; Context->ParentStream = ParentStream; Context->ChildNode->Event = EfiCreateProtocolNotifyEvent ( Context->ChildNode->EncapsulationGuid, TPL_NOTIFY, NotifyGuidedExtraction, Context, &Context->Registration ); }
tianocore/edk2
C++
Other
4,240
/* Enables or disables the temperature sensor and Vrefint channel. */
void ADC_EnableTempSensorVrefint(FunctionalState Cmd)
/* Enables or disables the temperature sensor and Vrefint channel. */ void ADC_EnableTempSensorVrefint(FunctionalState Cmd)
{ assert_param(IS_FUNCTIONAL_STATE(Cmd)); if (Cmd != DISABLE) { ADC->CTRL2 |= CTRL2_TSVREFE_SET; } else { ADC->CTRL2 &= CTRL2_TSVREFE_RESET; } }
pikasTech/PikaPython
C++
MIT License
1,403
/* Configure the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz). */
void RTC_CalibOutputConfig(uint32_t RTC_CalibOutput)
/* Configure the Calibration Pinout (RTC_CALIB) Selection (1Hz or 512Hz). */ void RTC_CalibOutputConfig(uint32_t RTC_CalibOutput)
{ assert_param(IS_RTC_CALIB_OUTPUT(RTC_CalibOutput)); RTC->WPR = 0xFF; RTC->WPR = 0xCA; RTC->WPR = 0x53; RTC->CR &= (uint32_t)~(RTC_CR_COSEL); RTC->CR |= (uint32_t)RTC_CalibOutput; RTC->WPR = 0xFF; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Function for sense disabling for all pins for specified user. */
static void pins_sense_disable(app_gpiote_user_id_t user_id)
/* Function for sense disabling for all pins for specified user. */ static void pins_sense_disable(app_gpiote_user_id_t user_id)
{ uint32_t pin_no; for (pin_no = 0; pin_no < 32; pin_no++) { if ((mp_users[user_id].pins_mask & (1 << pin_no)) != 0) { NRF_GPIO->PIN_CNF[pin_no] &= ~GPIO_PIN_CNF_SENSE_Msk; NRF_GPIO->PIN_CNF[pin_no] |= GPIO_PIN_CNF_SENSE_Disabled << GPIO_PIN_CNF_SENSE_Pos; } } }
labapart/polymcu
C++
null
201
/* Return 1 meaning mf should be freed from _base_interrupt 0 means the mf is freed from this function. */
u8 mpt2sas_ctl_event_callback(struct MPT2SAS_ADAPTER *ioc, u8 msix_index, u32 reply)
/* Return 1 meaning mf should be freed from _base_interrupt 0 means the mf is freed from this function. */ u8 mpt2sas_ctl_event_callback(struct MPT2SAS_ADAPTER *ioc, u8 msix_index, u32 reply)
{ Mpi2EventNotificationReply_t *mpi_reply; mpi_reply = mpt2sas_base_get_reply_virt_addr(ioc, reply); mpt2sas_ctl_add_to_event_log(ioc, mpi_reply); return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Sets the I2C write-protected state to an EEPROM Area. Needs the I2C Password presentation to be effective. */
int32_t BSP_NFCTAG_WriteI2CProtectZonex(uint32_t Instance, const ST25DV_PROTECTION_ZONE Zone, const ST25DV_PROTECTION_CONF ReadWriteProtection)
/* Sets the I2C write-protected state to an EEPROM Area. Needs the I2C Password presentation to be effective. */ int32_t BSP_NFCTAG_WriteI2CProtectZonex(uint32_t Instance, const ST25DV_PROTECTION_ZONE Zone, const ST25DV_PROTECTION_CONF ReadWriteProtection)
{ UNUSED(Instance); return ST25DV_WriteI2CProtectZonex(&NfcTagObj, Zone, ReadWriteProtection); }
eclipse-threadx/getting-started
C++
Other
310
/* Return an LED selector register value based on an existing one, with the appropriate 2-bit state value set for the given LED number (0-3). */
static u8 pca955x_ledsel(u8 oldval, int led_num, int state)
/* Return an LED selector register value based on an existing one, with the appropriate 2-bit state value set for the given LED number (0-3). */ static u8 pca955x_ledsel(u8 oldval, int led_num, int state)
{ return (oldval & (~(0x3 << (led_num << 1)))) | ((state & 0x3) << (led_num << 1)); }
robutest/uclinux
C++
GPL-2.0
60
/* Same, but with spinlock protection... I call it safe, but it's only safe with respect to the hashbin, not its content. - Jean II */
void* hashbin_lock_find(hashbin_t *hashbin, long hashv, const char *name)
/* Same, but with spinlock protection... I call it safe, but it's only safe with respect to the hashbin, not its content. - Jean II */ void* hashbin_lock_find(hashbin_t *hashbin, long hashv, const char *name)
{ unsigned long flags = 0; irda_queue_t* entry; spin_lock_irqsave(&hashbin->hb_spinlock, flags); entry = (irda_queue_t* ) hashbin_find( hashbin, hashv, name ); spin_unlock_irqrestore(&hashbin->hb_spinlock, flags); return entry; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* _scsih_reprobe_lun - reprobing lun @sdev: scsi device struct @no_uld_attach: sdev->no_uld_attach flag setting */
static void _scsih_reprobe_lun(struct scsi_device *sdev, void *no_uld_attach)
/* _scsih_reprobe_lun - reprobing lun @sdev: scsi device struct @no_uld_attach: sdev->no_uld_attach flag setting */ static void _scsih_reprobe_lun(struct scsi_device *sdev, void *no_uld_attach)
{ int rc; sdev->no_uld_attach = no_uld_attach ? 1 : 0; sdev_printk(KERN_INFO, sdev, "%s raid component\n", sdev->no_uld_attach ? "hidding" : "exposing"); rc = scsi_device_reprobe(sdev); }
robutest/uclinux
C++
GPL-2.0
60
/* Put framebuffer to LCD controller. This function will output the complete framebuffer from RAM to the LCD controller. */
void gfx_mono_ssd1306_put_framebuffer(void)
/* Put framebuffer to LCD controller. This function will output the complete framebuffer from RAM to the LCD controller. */ void gfx_mono_ssd1306_put_framebuffer(void)
{ uint8_t page; for (page = 0; page < GFX_MONO_LCD_PAGES; page++) { ssd1306_set_page_address(page); ssd1306_set_column_address(0); gfx_mono_ssd1306_put_page(framebuffer + (page * GFX_MONO_LCD_WIDTH), page, 0, GFX_MONO_LCD_WIDTH); } }
memfault/zero-to-main
C++
null
200
/* 'safe_strcpy()' - Copy a string allowing for overlapping strings. */
static void safe_strcpy(char *dst, const char *src)
/* 'safe_strcpy()' - Copy a string allowing for overlapping strings. */ static void safe_strcpy(char *dst, const char *src)
{ while (*src) *dst++ = *src++; *dst = '\0'; }
DC-SWAT/DreamShell
C++
null
404
/* Returns 1 if there is overlap, otherwise 0. */
int tipc_subscr_overlap(struct subscription *sub, u32 found_lower, u32 found_upper)
/* Returns 1 if there is overlap, otherwise 0. */ int tipc_subscr_overlap(struct subscription *sub, u32 found_lower, u32 found_upper)
{ if (found_lower < sub->seq.lower) found_lower = sub->seq.lower; if (found_upper > sub->seq.upper) found_upper = sub->seq.upper; if (found_lower > found_upper) return 0; return 1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return value: 0 - Device is ready. 1 - Device NOT ready. */
static int scsi_eh_try_stu(struct scsi_cmnd *scmd)
/* Return value: 0 - Device is ready. 1 - Device NOT ready. */ static int scsi_eh_try_stu(struct scsi_cmnd *scmd)
{ static unsigned char stu_command[6] = {START_STOP, 0, 0, 0, 1, 0}; if (scmd->device->allow_restart) { int i, rtn = NEEDS_RETRY; for (i = 0; rtn == NEEDS_RETRY && i < 2; i++) rtn = scsi_send_eh_cmnd(scmd, stu_command, 6, scmd->device->request_queue->rq_timeout, 0); if (rtn == SUCCESS) return 0; } return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Enable DMA mode for reception @rmtoll CR RXDMA LL_SWPMI_EnableDMAReq_RX. */
void LL_SWPMI_EnableDMAReq_RX(SWPMI_TypeDef *SWPMIx)
/* Enable DMA mode for reception @rmtoll CR RXDMA LL_SWPMI_EnableDMAReq_RX. */ void LL_SWPMI_EnableDMAReq_RX(SWPMI_TypeDef *SWPMIx)
{ SET_BIT(SWPMIx->CR, SWPMI_CR_RXDMA); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Event handler for the library USB Control Request reception event. */
void EVENT_USB_Device_ControlRequest(void)
/* Event handler for the library USB Control Request reception event. */ void EVENT_USB_Device_ControlRequest(void)
{ CDC_Device_ProcessControlRequest(&VirtualSerial1_CDC_Interface); CDC_Device_ProcessControlRequest(&VirtualSerial2_CDC_Interface); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Change Logs: Date Author Notes quanzhao the first version */
rt_inline rt_uint32_t rt_cpu_icache_line_size(void)
/* Change Logs: Date Author Notes quanzhao the first version */ rt_inline rt_uint32_t rt_cpu_icache_line_size(void)
{ rt_uint32_t ctr; asm volatile ("mrc p15, 0, %0, c0, c0, 1" : "=r"(ctr)); return 4 << (ctr & 0xF); }
pikasTech/PikaPython
C++
MIT License
1,403
/* get the authorising vnode - this is the specified inode itself if it's a directory or it's the parent directory if the specified inode is a file or symlink */
static struct afs_vnode* afs_get_auth_inode(struct afs_vnode *vnode, struct key *key)
/* get the authorising vnode - this is the specified inode itself if it's a directory or it's the parent directory if the specified inode is a file or symlink */ static struct afs_vnode* afs_get_auth_inode(struct afs_vnode *vnode, struct key *key)
{ struct afs_vnode *auth_vnode; struct inode *auth_inode; _enter(""); if (S_ISDIR(vnode->vfs_inode.i_mode)) { auth_inode = igrab(&vnode->vfs_inode); ASSERT(auth_inode != NULL); } else { auth_inode = afs_iget(vnode->vfs_inode.i_sb, key, &vnode->status.parent, NULL, NULL); if (IS_ERR(auth_inode)) return ERR_CAST(auth_inode); } auth_vnode = AFS_FS_I(auth_inode); _leave(" = {%x}", auth_vnode->fid.vnode); return auth_vnode; }
robutest/uclinux
C++
GPL-2.0
60
/* Finds best matching videomode, smaller or greater in dimension. If more than 1 videomode is found, will return the videomode with the closest refresh rate. */
const struct fb_videomode* fb_find_nearest_mode(const struct fb_videomode *mode, struct list_head *head)
/* Finds best matching videomode, smaller or greater in dimension. If more than 1 videomode is found, will return the videomode with the closest refresh rate. */ const struct fb_videomode* fb_find_nearest_mode(const struct fb_videomode *mode, struct list_head *head)
{ struct list_head *pos; struct fb_modelist *modelist; struct fb_videomode *cmode, *best = NULL; u32 diff = -1, diff_refresh = -1; list_for_each(pos, head) { u32 d; modelist = list_entry(pos, struct fb_modelist, list); cmode = &modelist->mode; d = abs(cmode->xres - mode->xres) + abs(cmode->yres - mode->yres); if (diff > d) { diff = d; best = cmode; } else if (diff == d) { d = abs(cmode->refresh - mode->refresh); if (diff_refresh > d) { diff_refresh = d; best = cmode; } } } return best; }
robutest/uclinux
C++
GPL-2.0
60
/* Output a packet to the initialized dump file. */
void pcap_dump(u_char *user, const struct pcap_pkthdr *h, const u_char *sp)
/* Output a packet to the initialized dump file. */ void pcap_dump(u_char *user, const struct pcap_pkthdr *h, const u_char *sp)
{ register FILE *f; struct pcap_sf_pkthdr sf_hdr; f = (FILE *)user; sf_hdr.ts.tv_sec = h->ts.tv_sec; sf_hdr.ts.tv_usec = h->ts.tv_usec; sf_hdr.caplen = h->caplen; sf_hdr.len = h->len; (void)fwrite(&sf_hdr, sizeof(sf_hdr), 1, f); (void)fwrite(sp, h->caplen, 1, f); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* The WM831x has a user key preventing writes to particularly critical registers. This function locks those registers, preventing spurious writes. */
int wm831x_reg_unlock(struct wm831x *wm831x)
/* The WM831x has a user key preventing writes to particularly critical registers. This function locks those registers, preventing spurious writes. */ int wm831x_reg_unlock(struct wm831x *wm831x)
{ int ret; ret = wm831x_reg_write(wm831x, WM831X_SECURITY_KEY, 0x9716); if (ret == 0) { dev_vdbg(wm831x->dev, "Registers unlocked\n"); mutex_lock(&wm831x->io_lock); WARN_ON(!wm831x->locked); wm831x->locked = 0; mutex_unlock(&wm831x->io_lock); } return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* HRPWM Calibrate function enable or disable for specified unit. */
void HRPWM_CalibrateCmd(uint32_t u32Unit, en_functional_state_t enNewState)
/* HRPWM Calibrate function enable or disable for specified unit. */ void HRPWM_CalibrateCmd(uint32_t u32Unit, en_functional_state_t enNewState)
{ __IO uint32_t *CALCRx; DDL_ASSERT(IS_VALID_HRPWM_CAL_UNIT(u32Unit)); DDL_ASSERT(IS_FUNCTIONAL_STATE(enNewState)); CALCRx = (__IO uint32_t *)(((uint32_t)&CM_HRPWM->CALCR0) + 4UL * u32Unit); if (ENABLE == enNewState) { SET_REG32_BIT(*CALCRx, HRPWM_CALCR_CALEN); } else { CLR_REG32_BIT(*CALCRx, HRPWM_CALCR_CALEN); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get CNTP_TVAL This function returns the value of the PL1 Physical Timer Value Register (CNTP_TVAL). return CNTP_TVAL Register value */
static rt_uint32_t __get_cntp_tval(void)
/* Get CNTP_TVAL This function returns the value of the PL1 Physical Timer Value Register (CNTP_TVAL). return CNTP_TVAL Register value */ static rt_uint32_t __get_cntp_tval(void)
{ rt_uint32_t result; __get_cp(15, 0, result, 14, 2, 0); return result; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The callback function to free the net buffer list. */
VOID EFIAPI IScsiFreeNbufList(VOID *Arg)
/* The callback function to free the net buffer list. */ VOID EFIAPI IScsiFreeNbufList(VOID *Arg)
{ ASSERT (Arg != NULL); NetbufFreeList ((LIST_ENTRY *)Arg); FreePool (Arg); }
tianocore/edk2
C++
Other
4,240
/* Disables the device (putting it in lower power sleep mode) */
tsl2561Error_t tsl2561Disable(void)
/* Disables the device (putting it in lower power sleep mode) */ tsl2561Error_t tsl2561Disable(void)
{ if (!_tsl2561Initialised) tsl2561Init(); return tsl2561Write8(TSL2561_COMMAND_BIT | TSL2561_REGISTER_CONTROL, TSL2561_CONTROL_POWEROFF); }
microbuilder/LPC1343CodeBase
C++
Other
73
/* int getopt_long_only (int argc, char *__getopt_argv_const *argv, const char *options, const struct option *long_options, int *opt_index) { return _getopt_internal (argc, (char **) argv, options, long_options, opt_index, 1, 0); } */
int _getopt_long_only_r(int argc, char **argv, const char *options, const struct option *long_options, int *opt_index, struct _getopt_data *d)
/* int getopt_long_only (int argc, char *__getopt_argv_const *argv, const char *options, const struct option *long_options, int *opt_index) { return _getopt_internal (argc, (char **) argv, options, long_options, opt_index, 1, 0); } */ int _getopt_long_only_r(int argc, char **argv, const char *options, const struct option *long_options, int *opt_index, struct _getopt_data *d)
{ return _getopt_internal_r (argc, argv, options, long_options, opt_index, 1, d, 0); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Searches the Fv for a file by its type */
EFI_STATUS FvBufFindFileByType(IN VOID *Fv, IN EFI_FV_FILETYPE Type, OUT VOID **File)
/* Searches the Fv for a file by its type */ EFI_STATUS FvBufFindFileByType(IN VOID *Fv, IN EFI_FV_FILETYPE Type, OUT VOID **File)
{ EFI_STATUS Status; UINTN Key; EFI_FFS_FILE_HEADER *NextFile; Key = 0; while (TRUE) { Status = FvBufFindNextFile (Fv, &Key, (VOID **)&NextFile); if (EFI_ERROR (Status)) { return Status; } if (Type == NextFile->Type) { if (File != NULL) { *File = NextFile; } return EFI_SUCCESS; } } return EFI_NOT_FOUND; }
tianocore/edk2
C++
Other
4,240
/* If Length > 0 and Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 16-bit boundary, then ASSERT(). If Length is not aligned on a 16-bit boundary, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */
VOID* EFIAPI ScanMem16(IN CONST VOID *Buffer, IN UINTN Length, IN UINT16 Value)
/* If Length > 0 and Buffer is NULL, then ASSERT(). If Buffer is not aligned on a 16-bit boundary, then ASSERT(). If Length is not aligned on a 16-bit boundary, then ASSERT(). If Length is greater than (MAX_ADDRESS - Buffer + 1), then ASSERT(). */ VOID* EFIAPI ScanMem16(IN CONST VOID *Buffer, IN UINTN Length, IN UINT16 Value)
{ if (Length == 0) { return NULL; } ASSERT (Buffer != NULL); ASSERT (((UINTN)Buffer & (sizeof (Value) - 1)) == 0); ASSERT ((Length - 1) <= (MAX_ADDRESS - (UINTN)Buffer)); ASSERT ((Length & (sizeof (Value) - 1)) == 0); return (VOID *)InternalMemScanMem16 (Buffer, Length / sizeof (Value), Value); }
tianocore/edk2
C++
Other
4,240
/* Enable HART reception by enabling the demultiplexer that routes the AD5700 to the circuit inputs. To enable these multipliers the AD4111 GPIO0 must be driven high. */
int32_t cn0414_hart_enable(struct cn0414_dev *dev, uint8_t *arg)
/* Enable HART reception by enabling the demultiplexer that routes the AD5700 to the circuit inputs. To enable these multipliers the AD4111 GPIO0 must be driven high. */ int32_t cn0414_hart_enable(struct cn0414_dev *dev, uint8_t *arg)
{ int32_t ret; ad717x_st_reg *preg; NVIC_DisableIRQ(TMR0_INT); NVIC_DisableIRQ(HART_CD_INT); AD717X_ReadRegister(dev->ad4111_device, AD717X_GPIOCON_REG); preg = AD717X_GetReg(dev->ad4111_device, AD717X_GPIOCON_REG); preg->value |= AD4111_GPIOCON_REG_DATA0; ret = AD717X_WriteRegister(dev->ad4111_device, AD717X_GPIOCON_REG); mdelay(5); modem_rec_flag = false; NVIC_EnableIRQ(TMR0_INT); NVIC_EnableIRQ(HART_CD_INT); return ret; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Pixel draw with blending enabled and using alpha weight on color. */
int pixelColorWeight(SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color, Uint32 weight)
/* Pixel draw with blending enabled and using alpha weight on color. */ int pixelColorWeight(SDL_Surface *dst, Sint16 x, Sint16 y, Uint32 color, Uint32 weight)
{ Uint32 a; a = (color & (Uint32) 0x000000ff); a = ((a * weight) >> 8); return (pixelColor(dst, x, y, (color & (Uint32) 0xffffff00) | (Uint32) a)); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Gets the last frame number from the driver */
sl_status_t sl_usbd_core_get_device_frame_number(uint16_t *p_frame_nbr)
/* Gets the last frame number from the driver */ sl_status_t sl_usbd_core_get_device_frame_number(uint16_t *p_frame_nbr)
{ sli_usbd_device_t *p_dev; if (p_frame_nbr == NULL) { return SL_STATUS_INVALID_PARAMETER; } p_dev = &usbd_ptr->device; if (p_dev->state == SL_USBD_DEVICE_STATE_NONE) { *p_frame_nbr = 0; return SL_STATUS_INVALID_STATE; } sli_usbd_driver_get_frame_number(p_frame_nbr); return SL_STATUS_OK; }
nanoframework/nf-interpreter
C++
MIT License
293
/* param base Base address of the DMIC peripheral. param vadcb callback Pointer to store callback function.. retval None. */
void DMIC_HwvadDisableIntCallback(DMIC_Type *base, dmic_hwvad_callback_t vadcb)
/* param base Base address of the DMIC peripheral. param vadcb callback Pointer to store callback function.. retval None. */ void DMIC_HwvadDisableIntCallback(DMIC_Type *base, dmic_hwvad_callback_t vadcb)
{ uint32_t instance; instance = DMIC_GetInstance(base); (void)DisableIRQ(s_dmicHwvadIRQ[instance]); s_dmicHwvadCallback[instance] = NULL; NVIC_ClearPendingIRQ(s_dmicHwvadIRQ[instance]); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* aend character c with ZMODEM escape sequence encoding. */
void zsend_zdle_char(rt_uint16_t ch)
/* aend character c with ZMODEM escape sequence encoding. */ void zsend_zdle_char(rt_uint16_t ch)
{ rt_uint16_t res; res = ch & 0377; switch (res) { case 0377: zsend_byte(res); break; case ZDLE: zsend_byte(ZDLE); res ^= 0100; zsend_byte(res); break; case 021: case 023: case 0221: case 0223: zsend_byte(ZDLE); res ^= 0100; zsend_byte(res); break; default: zsend_byte(res); } }
armink/FreeModbus_Slave-Master-RTT-STM32
C++
Other
1,477
/* If there is no additional space for HOB creation, then ASSERT(). */
VOID EFIAPI BuildFv3Hob(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT32 AuthenticationStatus, IN BOOLEAN ExtractedFv, IN CONST EFI_GUID *FvName OPTIONAL, IN CONST EFI_GUID *FileName OPTIONAL)
/* If there is no additional space for HOB creation, then ASSERT(). */ VOID EFIAPI BuildFv3Hob(IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT32 AuthenticationStatus, IN BOOLEAN ExtractedFv, IN CONST EFI_GUID *FvName OPTIONAL, IN CONST EFI_GUID *FileName OPTIONAL)
{ EFI_HOB_FIRMWARE_VOLUME3 *Hob; Hob = CreateHob (EFI_HOB_TYPE_FV3, sizeof (EFI_HOB_FIRMWARE_VOLUME3)); ASSERT (Hob != NULL); if (Hob == NULL) { return; } Hob->BaseAddress = BaseAddress; Hob->Length = Length; Hob->AuthenticationStatus = AuthenticationStatus; Hob->ExtractedFv = ExtractedFv; if (ExtractedFv) { CopyGuid (&Hob->FvName, FvName); CopyGuid (&Hob->FileName, FileName); } }
tianocore/edk2
C++
Other
4,240
/* Returns the cause of channel specific DMA interrupt. This function returns the cause of interrupt */
dmacHw_INTERRUPT_STATUS_e dmacHw_getInterruptStatus(dmacHw_HANDLE_t handle)
/* Returns the cause of channel specific DMA interrupt. This function returns the cause of interrupt */ dmacHw_INTERRUPT_STATUS_e dmacHw_getInterruptStatus(dmacHw_HANDLE_t handle)
{ dmacHw_CBLK_t *pCblk = dmacHw_HANDLE_TO_CBLK(handle); dmacHw_INTERRUPT_STATUS_e status = dmacHw_INTERRUPT_STATUS_NONE; if (dmacHw_REG_INT_STAT_TRAN(pCblk->module) & ((0x00000001 << pCblk->channel))) { status |= dmacHw_INTERRUPT_STATUS_TRANS; } if (dmacHw_REG_INT_STAT_BLOCK(pCblk->module) & ((0x00000001 << pCblk->channel))) { status |= dmacHw_INTERRUPT_STATUS_BLOCK; } if (dmacHw_REG_INT_STAT_ERROR(pCblk->module) & ((0x00000001 << pCblk->channel))) { status |= dmacHw_INTERRUPT_STATUS_ERROR; } return status; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* kref_init - initialize object. @kref: object in question. */
void kref_init(struct kref *kref)
/* kref_init - initialize object. @kref: object in question. */ void kref_init(struct kref *kref)
{ kref_set(kref, 1); }
robutest/uclinux
C++
GPL-2.0
60
/* Move a descriptor, including any children, to the free list. */
static void txx9dmac_desc_put(struct txx9dmac_chan *dc, struct txx9dmac_desc *desc)
/* Move a descriptor, including any children, to the free list. */ static void txx9dmac_desc_put(struct txx9dmac_chan *dc, struct txx9dmac_desc *desc)
{ if (desc) { struct txx9dmac_desc *child; txx9dmac_sync_desc_for_cpu(dc, desc); spin_lock_bh(&dc->lock); list_for_each_entry(child, &desc->tx_list, desc_node) dev_vdbg(chan2dev(&dc->chan), "moving child desc %p to freelist\n", child); list_splice_init(&desc->tx_list, &dc->free_list); dev_vdbg(chan2dev(&dc->chan), "moving desc %p to freelist\n", desc); list_add(&desc->desc_node, &dc->free_list); spin_unlock_bh(&dc->lock); } }
robutest/uclinux
C++
GPL-2.0
60
/* fc_get_host_port_state() - Return the port state of the given Scsi_Host @shost: The SCSI host whose port state is to be determined */
void fc_get_host_port_state(struct Scsi_Host *shost)
/* fc_get_host_port_state() - Return the port state of the given Scsi_Host @shost: The SCSI host whose port state is to be determined */ void fc_get_host_port_state(struct Scsi_Host *shost)
{ struct fc_lport *lport = shost_priv(shost); mutex_lock(&lport->lp_mutex); if (!lport->link_up) fc_host_port_state(shost) = FC_PORTSTATE_LINKDOWN; else switch (lport->state) { case LPORT_ST_READY: fc_host_port_state(shost) = FC_PORTSTATE_ONLINE; break; default: fc_host_port_state(shost) = FC_PORTSTATE_OFFLINE; } mutex_unlock(&lport->lp_mutex); }
robutest/uclinux
C++
GPL-2.0
60
/* Return 0 on success, -1 if the cache mode was invalid. */
int bdrv_parse_cache_flags(const char *mode, int *flags)
/* Return 0 on success, -1 if the cache mode was invalid. */ int bdrv_parse_cache_flags(const char *mode, int *flags)
{ *flags &= ~BDRV_O_CACHE_MASK; if (!strcmp(mode, "off") || !strcmp(mode, "none")) { *flags |= BDRV_O_NOCACHE | BDRV_O_CACHE_WB; } else if (!strcmp(mode, "directsync")) { *flags |= BDRV_O_NOCACHE; } else if (!strcmp(mode, "writeback")) { *flags |= BDRV_O_CACHE_WB; } else if (!strcmp(mode, "unsafe")) { *flags |= BDRV_O_CACHE_WB; *flags |= BDRV_O_NO_FLUSH; } else if (!strcmp(mode, "writethrough")) { } else { return -1; } return 0; }
ve3wwg/teensy3_qemu
C
Other
15
/* USART Set Rx/Tx Mode. The mode can be selected as Rx only, Tx only or Rx+Tx. */
void usart_set_mode(uint32_t usart, uint32_t mode)
/* USART Set Rx/Tx Mode. The mode can be selected as Rx only, Tx only or Rx+Tx. */ void usart_set_mode(uint32_t usart, uint32_t mode)
{ uint32_t reg32; reg32 = USART_CR1(usart); reg32 = (reg32 & ~USART_MODE_MASK) | mode; USART_CR1(usart) = reg32; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Allocate a memory block from a memory pool and set memory block to zero. */
void* osPoolCAlloc(osPoolId pool_id)
/* Allocate a memory block from a memory pool and set memory block to zero. */ void* osPoolCAlloc(osPoolId pool_id)
{ mem = sysPoolAlloc(pool_id); } else { mem = __sysPoolAlloc(pool_id); } rt_clr_box(pool_id, mem); return mem; }
labapart/polymcu
C++
null
201
/* Set up the GDT and segment registers for -fstack-protector. Until we do this, we have to be careful not to call any stack-protected function, which is most of the kernel. */
static void __init xen_setup_stackprotector(void)
/* Set up the GDT and segment registers for -fstack-protector. Until we do this, we have to be careful not to call any stack-protected function, which is most of the kernel. */ static void __init xen_setup_stackprotector(void)
{ pv_cpu_ops.write_gdt_entry = xen_write_gdt_entry_boot; pv_cpu_ops.load_gdt = xen_load_gdt_boot; setup_stack_canary_segment(0); switch_to_new_gdt(0); pv_cpu_ops.write_gdt_entry = xen_write_gdt_entry; pv_cpu_ops.load_gdt = xen_load_gdt; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Enables or disables the analog watchdog on single/all regular or injected channels. */
void ADC_AnalogWatchdogCmd(ADC_TypeDef *ADCx, uint32_t ADC_AnalogWatchdog)
/* Enables or disables the analog watchdog on single/all regular or injected channels. */ void ADC_AnalogWatchdogCmd(ADC_TypeDef *ADCx, uint32_t ADC_AnalogWatchdog)
{ uint32_t tmpreg = 0; assert_param(IS_ADC_ALL_PERIPH(ADCx)); assert_param(IS_ADC_ANALOG_WATCHDOG(ADC_AnalogWatchdog)); tmpreg = ADCx->CFGR; tmpreg &= ~(uint32_t)(ADC_CFGR_AWD1SGL|ADC_CFGR_AWD1EN|ADC_CFGR_JAWD1EN); tmpreg |= ADC_AnalogWatchdog; ADCx->CFGR = tmpreg; }
ajhc/demo-cortex-m3
C++
null
38
/* This function translates the given JSON C Structure to JSON text. */
EFI_STATUS EFIAPI RestJsonStructureToJson(IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This, IN EFI_REST_JSON_STRUCTURE_HEADER *RestJSonHeader, OUT CHAR8 **ResourceRaw)
/* This function translates the given JSON C Structure to JSON text. */ EFI_STATUS EFIAPI RestJsonStructureToJson(IN EFI_REST_JSON_STRUCTURE_PROTOCOL *This, IN EFI_REST_JSON_STRUCTURE_HEADER *RestJSonHeader, OUT CHAR8 **ResourceRaw)
{ EFI_STATUS Status; REST_JSON_STRUCTURE_INSTANCE *Instance; if ((This == NULL) || (RestJSonHeader == NULL) || (ResourceRaw == NULL)) { return EFI_INVALID_PARAMETER; } if (IsListEmpty (&mRestJsonStructureList)) { return EFI_UNSUPPORTED; } Status = EFI_SUCCESS; Instance = (REST_JSON_STRUCTURE_INSTANCE *)GetFirstNode (&mRestJsonStructureList); while (TRUE) { Status = InterpreterEfiStructToInstance ( This, Instance, RestJSonHeader, ResourceRaw ); if (!EFI_ERROR (Status)) { break; } if (IsNodeAtEnd (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance)) { Status = EFI_UNSUPPORTED; break; } Instance = (REST_JSON_STRUCTURE_INSTANCE *)GetNextNode (&mRestJsonStructureList, &Instance->NextRestJsonStructureInstance); } return Status; }
tianocore/edk2
C++
Other
4,240
/* This function returns current integrated compression methods used by the specified TLS connection. */
EFI_STATUS EFIAPI TlsGetCurrentCompressionId(IN VOID *Tls, IN OUT UINT8 *CompressionId)
/* This function returns current integrated compression methods used by the specified TLS connection. */ EFI_STATUS EFIAPI TlsGetCurrentCompressionId(IN VOID *Tls, IN OUT UINT8 *CompressionId)
{ CALL_CRYPTO_SERVICE (TlsGetCurrentCompressionId, (Tls, CompressionId), EFI_UNSUPPORTED); }
tianocore/edk2
C++
Other
4,240
/* Returns driver specefic information like name, version etc.. to ethtool. */
static void vxge_ethtool_gdrvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
/* Returns driver specefic information like name, version etc.. to ethtool. */ static void vxge_ethtool_gdrvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
{ struct vxgedev *vdev; vdev = (struct vxgedev *)netdev_priv(dev); strlcpy(info->driver, VXGE_DRIVER_NAME, sizeof(VXGE_DRIVER_NAME)); strlcpy(info->version, DRV_VERSION, sizeof(DRV_VERSION)); strlcpy(info->fw_version, vdev->fw_version, VXGE_HW_FW_STRLEN); strlcpy(info->bus_info, pci_name(vdev->pdev), sizeof(info->bus_info)); info->regdump_len = sizeof(struct vxge_hw_vpath_reg) * vdev->no_of_vpath; info->n_stats = STAT_LEN; }
robutest/uclinux
C++
GPL-2.0
60
/* Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.ClearScreen(). It clears the ANSI terminal's display to the currently selected background color. */
EFI_STATUS EFIAPI TerminalConOutClearScreen(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This)
/* Implements EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.ClearScreen(). It clears the ANSI terminal's display to the currently selected background color. */ EFI_STATUS EFIAPI TerminalConOutClearScreen(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This)
{ EFI_STATUS Status; TERMINAL_DEV *TerminalDevice; TerminalDevice = TERMINAL_CON_OUT_DEV_FROM_THIS (This); TerminalDevice->OutputEscChar = TRUE; Status = This->OutputString (This, mClearScreenString); TerminalDevice->OutputEscChar = FALSE; if (EFI_ERROR (Status)) { return EFI_DEVICE_ERROR; } Status = This->SetCursorPosition (This, 0, 0); return Status; }
tianocore/edk2
C++
Other
4,240
/* ( * 1E9 / 3686400 => * 78125 / 288) */
unsigned long long sched_clock(void)
/* ( * 1E9 / 3686400 => * 78125 / 288) */ unsigned long long sched_clock(void)
{ unsigned long long v = cnt32_to_63(OSCR); v *= 78125<<1; do_div(v, 288<<1); return v; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* param config The pointer to module basic configuration, please refer to freq_measure_config_t. */
void FREQME_GetDefaultConfig(freq_measure_config_t *config)
/* param config The pointer to module basic configuration, please refer to freq_measure_config_t. */ void FREQME_GetDefaultConfig(freq_measure_config_t *config)
{ assert(config); (void)memset(config, 0, sizeof(*config)); config->operateMode = kFREQME_FreqMeasurementMode; config->operateModeAttribute.refClkScaleFactor = 0U; config->enableContinuousMode = false; config->startMeasurement = false; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Read key of 'type' into 'key' and return the current 'type' pointer. */
static char* key_get_info(const char *type, char **key)
/* Read key of 'type' into 'key' and return the current 'type' pointer. */ static char* key_get_info(const char *type, char **key)
{ size_t len; char *p, *str; if (*type == ',') type++; p = strchr(type, ':'); if (!p) { *key = NULL; return NULL; } len = p - type; str = g_malloc(len + 1); memcpy(str, type, len); str[len] = '\0'; *key = str; return ++p; }
ve3wwg/teensy3_qemu
C
Other
15
/* ib_register_event_handler() registers an event handler that will be called back when asynchronous IB events occur (as defined in chapter 11 of the InfiniBand Architecture Specification). This callback may occur in interrupt context. */
int ib_register_event_handler(struct ib_event_handler *event_handler)
/* ib_register_event_handler() registers an event handler that will be called back when asynchronous IB events occur (as defined in chapter 11 of the InfiniBand Architecture Specification). This callback may occur in interrupt context. */ int ib_register_event_handler(struct ib_event_handler *event_handler)
{ unsigned long flags; spin_lock_irqsave(&event_handler->device->event_handler_lock, flags); list_add_tail(&event_handler->list, &event_handler->device->event_handler_list); spin_unlock_irqrestore(&event_handler->device->event_handler_lock, flags); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Adjust pending gotos to outer level of a block. */
static void movegotosout(FuncState *fs, BlockCnt *bl)
/* Adjust pending gotos to outer level of a block. */ static void movegotosout(FuncState *fs, BlockCnt *bl)
{ Labeldesc *gt = &gl->arr[i]; if (reglevel(fs, gt->nactvar) > reglevel(fs, bl->nactvar)) gt->close |= bl->upval; gt->nactvar = bl->nactvar; } }
Nicholas3388/LuaNode
C++
Other
1,055
/* If the pointer to the HOB list is NULL, then ASSERT(). */
VOID* EFIAPI GetHobList(VOID)
/* If the pointer to the HOB list is NULL, then ASSERT(). */ VOID* EFIAPI GetHobList(VOID)
{ ASSERT (gHobList != NULL); return gHobList; }
tianocore/edk2
C++
Other
4,240
/* This function returns true if the IP header checksum bit is set in the extended status. Valid only when enhaced status available is set in RDES0 bit 0. This is valid only for Enhanced Descriptor. */
bool synopGMAC_ES_is_IP_header_error(synopGMACdevice *gmacdev, u32 ext_status)
/* This function returns true if the IP header checksum bit is set in the extended status. Valid only when enhaced status available is set in RDES0 bit 0. This is valid only for Enhanced Descriptor. */ bool synopGMAC_ES_is_IP_header_error(synopGMACdevice *gmacdev, u32 ext_status)
{ return ((ext_status & DescRxIpHeaderError) != 0); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Writes a byte to the LPC channel pool. */
void LPCByteWrite(unsigned long ulBase, unsigned long ulOffset, unsigned char ucData)
/* Writes a byte to the LPC channel pool. */ void LPCByteWrite(unsigned long ulBase, unsigned long ulOffset, unsigned char ucData)
{ ASSERT(ulBase == LPC0_BASE); ASSERT(ulOffset < (((HWREG(ulBase + LPC_O_STS) & LPC_STS_POOLSZ_M) >> 16) * 256)); HWREGB(ulBase + LPC_O_POOL + ulOffset) = ucData; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* mcount stub will be converted below for call Note: Just the last instruction is changed against nop */
static unsigned char __attribute__((aligned(8)))
/* mcount stub will be converted below for call Note: Just the last instruction is changed against nop */ static unsigned char __attribute__((aligned(8)))
{ 0x02, 0x40, 0x31, 0x10, 0x80, 0x05, 0xb0, 0x02, 0x00, 0x00, 0x42, 0x40, 0x05, 0x00, 0xc4, 0x00, 0x11, 0x48, 0x01, 0x02, 0x00, 0x21, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x50 }
EmcraftSystems/linux-emcraft
C++
Other
266
/* SDIF sync clock command function. This function will try to recovery the host while sending clock command failed. */
static status_t SDIF_SyncClockCommand(SDIF_Type *base)
/* SDIF sync clock command function. This function will try to recovery the host while sending clock command failed. */ static status_t SDIF_SyncClockCommand(SDIF_Type *base)
{ uint32_t syncTimeout = 10000U; uint32_t sendCommandRetry = 3U; do { if (SDIF_SetCommandRegister( base, (uint32_t)kSDIF_CmdUpdateClockRegisterOnly | (uint32_t)kSDIF_WaitPreTransferComplete, 0UL, syncTimeout) == kStatus_Success) { break; } (void)SDIF_Reset(base, kSDIF_ResetController, syncTimeout); sendCommandRetry--; } while (sendCommandRetry != 0U); if (sendCommandRetry == 0U) { return kStatus_Fail; } return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Reads and returns the 64-bit MSR specified by Index. No parameter checking is performed on Index, and some Index values may cause CPU exceptions. The caller must either guarantee that Index is valid, or the caller must set up exception handlers to catch the exceptions. This function is only available on IA-32 and X64. */
UINT64 EFIAPI AsmReadMsr64(IN UINT32 Index)
/* Reads and returns the 64-bit MSR specified by Index. No parameter checking is performed on Index, and some Index values may cause CPU exceptions. The caller must either guarantee that Index is valid, or the caller must set up exception handlers to catch the exceptions. This function is only available on IA-32 and X64. */ UINT64 EFIAPI AsmReadMsr64(IN UINT32 Index)
{ UINT64 Data; BOOLEAN Flag; Flag = FilterBeforeMsrRead (Index, &Data); if (Flag) { __asm__ __volatile__ ( "rdmsr" : "=A" (Data) : "c" (Index) ); } FilterAfterMsrRead (Index, &Data); return Data; }
tianocore/edk2
C++
Other
4,240
/* When @lch is a channel, any active transfer is paused and all pending hardware events are cleared. The current transfer may not be resumed, and the channel's Parameter RAM should be reinitialized before being reused. */
void edma_stop(unsigned channel)
/* When @lch is a channel, any active transfer is paused and all pending hardware events are cleared. The current transfer may not be resumed, and the channel's Parameter RAM should be reinitialized before being reused. */ void edma_stop(unsigned channel)
{ unsigned ctlr; ctlr = EDMA_CTLR(channel); channel = EDMA_CHAN_SLOT(channel); if (channel < edma_cc[ctlr]->num_channels) { int j = channel >> 5; unsigned int mask = BIT(channel & 0x1f); edma_shadow0_write_array(ctlr, SH_EECR, j, mask); edma_shadow0_write_array(ctlr, SH_ECR, j, mask); edma_shadow0_write_array(ctlr, SH_SECR, j, mask); edma_write_array(ctlr, EDMA_EMCR, j, mask); edma_dbg("EDMA: EER%d %08x\n", j, edma_shadow0_read_array(ctlr, SH_EER, j)); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If the function returns a 0 it means no conflicting procedure has been initiated. Otherwise it returns the appropriate BLE error code to send. */
uint8_t ble_ll_ctrl_proc_with_instant_initiated(struct ble_ll_conn_sm *connsm, uint8_t req_ctrl_proc)
/* If the function returns a 0 it means no conflicting procedure has been initiated. Otherwise it returns the appropriate BLE error code to send. */ uint8_t ble_ll_ctrl_proc_with_instant_initiated(struct ble_ll_conn_sm *connsm, uint8_t req_ctrl_proc)
{ uint8_t err; switch (connsm->cur_ctrl_proc) { case BLE_LL_CTRL_PROC_PHY_UPDATE: case BLE_LL_CTRL_PROC_CONN_UPDATE: case BLE_LL_CTRL_PROC_CONN_PARAM_REQ: case BLE_LL_CTRL_PROC_CHAN_MAP_UPD: if (req_ctrl_proc == connsm->cur_ctrl_proc) { err = BLE_ERR_LMP_COLLISION; } else if ((connsm->cur_ctrl_proc == BLE_LL_CTRL_PROC_CONN_UPDATE) && (req_ctrl_proc == BLE_LL_CTRL_PROC_CONN_PARAM_REQ)) { err = BLE_ERR_LMP_COLLISION; } else { err = BLE_ERR_DIFF_TRANS_COLL; } break; default: err = 0; } return err; }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* Clears or safeguards the OCREF6 signal on an external event. */
void TIM_ClearOC6Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear)
/* Clears or safeguards the OCREF6 signal on an external event. */ void TIM_ClearOC6Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear)
{ uint32_t tmpccmr3 = 0; assert_param(IS_TIM_LIST4_PERIPH(TIMx)); assert_param(IS_TIM_OCCLEAR_STATE(TIM_OCClear)); tmpccmr3 = TIMx->CCMR3; tmpccmr3 &= (uint32_t)~TIM_CCMR3_OC6CE; tmpccmr3 |= (uint32_t)(TIM_OCClear << 8); TIMx->CCMR3 = tmpccmr3; }
ajhc/demo-cortex-m3
C++
null
38
/* mraid_mm_dealloc_kioc - Return kioc to free pool @adp : Adapter softstate @kioc : uioc_t node to be returned to free pool */
static void mraid_mm_dealloc_kioc(mraid_mmadp_t *, uioc_t *)
/* mraid_mm_dealloc_kioc - Return kioc to free pool @adp : Adapter softstate @kioc : uioc_t node to be returned to free pool */ static void mraid_mm_dealloc_kioc(mraid_mmadp_t *, uioc_t *)
{ mm_dmapool_t *pool; unsigned long flags; if (kioc->pool_index != -1) { pool = &adp->dma_pool_list[kioc->pool_index]; spin_lock_irqsave(&pool->lock, flags); if (kioc->free_buf == 1) pci_pool_free(pool->handle, kioc->buf_vaddr, kioc->buf_paddr); else pool->in_use = 0; spin_unlock_irqrestore(&pool->lock, flags); } spin_lock_irqsave(&adp->kioc_pool_lock, flags); list_add(&kioc->list, &adp->kioc_pool); spin_unlock_irqrestore(&adp->kioc_pool_lock, flags); up(&adp->kioc_semaphore); return; }
robutest/uclinux
C++
GPL-2.0
60
/* This deletes a driver "instance". The device is de-registered with Card Services. If it has been released, all local data structures are freed. Otherwise, the structures will be freed when the device is released. */
static void spectrum_cs_detach(struct pcmcia_device *link)
/* This deletes a driver "instance". The device is de-registered with Card Services. If it has been released, all local data structures are freed. Otherwise, the structures will be freed when the device is released. */ static void spectrum_cs_detach(struct pcmcia_device *link)
{ struct orinoco_private *priv = link->priv; if (link->dev_node) orinoco_if_del(priv); spectrum_cs_release(link); free_orinocodev(priv); }
robutest/uclinux
C++
GPL-2.0
60
/* This function returns %0 in case of success, %-EINVAL if the UBI device number is invalid, and %-ENODEV if there is no such UBI device. */
int ubi_get_device_info(int ubi_num, struct ubi_device_info *di)
/* This function returns %0 in case of success, %-EINVAL if the UBI device number is invalid, and %-ENODEV if there is no such UBI device. */ int ubi_get_device_info(int ubi_num, struct ubi_device_info *di)
{ struct ubi_device *ubi; if (ubi_num < 0 || ubi_num >= UBI_MAX_DEVICES) return -EINVAL; ubi = ubi_get_device(ubi_num); if (!ubi) return -ENODEV; ubi_do_get_device_info(ubi, di); ubi_put_device(ubi); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* The NDR routines are for use by dcerpc subdissetors. They're primarily for making sure things are aligned properly according to the rules of NDR. */
int dissect_ndr_uint8(tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep, int hfindex, guint8 *pdata)
/* The NDR routines are for use by dcerpc subdissetors. They're primarily for making sure things are aligned properly according to the rules of NDR. */ int dissect_ndr_uint8(tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep, int hfindex, guint8 *pdata)
{ if (pdata) *pdata = 0; if (di->conformant_run) { return offset; } return dissect_dcerpc_uint8(tvb, offset, pinfo, tree, drep, hfindex, pdata); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Shifts the contents of the frame buffer up the specified number of pixels. */
void st7565ShiftFrameBuffer(uint8_t height)
/* Shifts the contents of the frame buffer up the specified number of pixels. */ void st7565ShiftFrameBuffer(uint8_t height)
{ if (height == 0) return; if (height >= 64) { st7565ClearScreen(); return; } uint8_t y, x; for (y = 0; y < 64; y++) { for (x = 0; x < 128; x++) { if (63 - y > height) { st7565GetPixel(x, y + height) ? st7565DrawPixel(x, y) : st7565ClearPixel(x, y); } else { st7565ClearPixel(x, y); } } } }
microbuilder/LPC1343CodeBase
C++
Other
73
/* This function queues the notification function of the event for future execution. */
static void efi_queue_event(struct efi_event *event)
/* This function queues the notification function of the event for future execution. */ static void efi_queue_event(struct efi_event *event)
{ struct efi_event *item = NULL; if (!event->notify_function) return; if (!efi_event_is_queued(event)) { list_for_each_entry(item, &efi_event_queue, queue_link) { if (item->notify_tpl < event->notify_tpl) { list_add_tail(&event->queue_link, &item->queue_link); event = NULL; break; } } if (event) list_add_tail(&event->queue_link, &efi_event_queue); } efi_process_event_queue(); }
4ms/stm32mp1-baremetal
C++
Other
137
/* gfs2_metatype_check_ii - Flag a metadata type consistency error and withdraw Returns: -1 if this call withdrew the machine, -2 if it was already withdrawn */
int gfs2_metatype_check_ii(struct gfs2_sbd *sdp, struct buffer_head *bh, u16 type, u16 t, const char *function, char *file, unsigned int line)
/* gfs2_metatype_check_ii - Flag a metadata type consistency error and withdraw Returns: -1 if this call withdrew the machine, -2 if it was already withdrawn */ int gfs2_metatype_check_ii(struct gfs2_sbd *sdp, struct buffer_head *bh, u16 type, u16 t, const char *function, char *file, unsigned int line)
{ int me; me = gfs2_lm_withdraw(sdp, "GFS2: fsid=%s: fatal: invalid metadata block\n" "GFS2: fsid=%s: bh = %llu (type: exp=%u, found=%u)\n" "GFS2: fsid=%s: function = %s, file = %s, line = %u\n", sdp->sd_fsname, sdp->sd_fsname, (unsigned long long)bh->b_blocknr, type, t, sdp->sd_fsname, function, file, line); return (me) ? -1 : -2; }
robutest/uclinux
C++
GPL-2.0
60
/* Reads the output data of specified GPIO port pin. */
bool GPIO_ReadOutputDataBit(GPIO_TypeDef *gpio, u16 pin)
/* Reads the output data of specified GPIO port pin. */ bool GPIO_ReadOutputDataBit(GPIO_TypeDef *gpio, u16 pin)
{ return (gpio->ODR & pin) ? Bit_SET : Bit_RESET; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Report additional information for an error in command-line arguments. */
void cmdarg_err_cont(const char *fmt,...)
/* Report additional information for an error in command-line arguments. */ void cmdarg_err_cont(const char *fmt,...)
{ va_list ap; va_start(ap, fmt); print_err_cont(fmt, ap); va_end(ap); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Sets the FIFO level at which interrupts are generated. */
void UARTFIFOLevelSet(unsigned long ulBase, unsigned long ulTxLevel, unsigned long ulRxLevel)
/* Sets the FIFO level at which interrupts are generated. */ void UARTFIFOLevelSet(unsigned long ulBase, unsigned long ulTxLevel, unsigned long ulRxLevel)
{ ASSERT(UARTBaseValid(ulBase)); ASSERT((ulTxLevel == UART_FIFO_TX1_8) || (ulTxLevel == UART_FIFO_TX2_8) || (ulTxLevel == UART_FIFO_TX4_8) || (ulTxLevel == UART_FIFO_TX6_8) || (ulTxLevel == UART_FIFO_TX7_8)); ASSERT((ulRxLevel == UART_FIFO_RX1_8) || (ulRxLevel == UART_FIFO_RX2_8) || (ulRxLevel == UART_FIFO_RX4_8) || (ulRxLevel == UART_FIFO_RX6_8) || (ulRxLevel == UART_FIFO_RX7_8)); HWREG(ulBase + UART_O_IFLS) = ulTxLevel | ulRxLevel; }
watterott/WebRadio
C++
null
71
/* See the documentation at the top of this file. */
static void vFLOPCheck2(void *pvParameters)
/* See the documentation at the top of this file. */ static void vFLOPCheck2(void *pvParameters)
{ volatile portFLOAT fVal1, fVal2, fResult; ( void ) pvParameters; for( ;; ) { fVal1 = ( portFLOAT ) -12340.5678; fVal2 = ( portFLOAT ) 23450.6789; fResult = fVal1 + fVal2; if( ( fResult > ( portFLOAT ) 11110.15 ) || ( fResult < ( portFLOAT ) 11110.05 ) ) { mainLATCH_ERROR(); } fResult = fVal1 / -fVal2; if( ( fResult > ( portFLOAT ) 0.53 ) || ( fResult < ( portFLOAT ) 0.51 ) ) { mainLATCH_ERROR(); } } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* This function adds the local private key (DER-encoded or PEM-encoded or PKCS#8 private key) into the specified TLS object for TLS negotiation. */
EFI_STATUS EFIAPI CryptoServiceTlsSetHostPrivateKey(IN VOID *Tls, IN VOID *Data, IN UINTN DataSize)
/* This function adds the local private key (DER-encoded or PEM-encoded or PKCS#8 private key) into the specified TLS object for TLS negotiation. */ EFI_STATUS EFIAPI CryptoServiceTlsSetHostPrivateKey(IN VOID *Tls, IN VOID *Data, IN UINTN DataSize)
{ return CALL_BASECRYPTLIB (TlsSet.Services.HostPrivateKey, TlsSetHostPrivateKey, (Tls, Data, DataSize), EFI_UNSUPPORTED); }
tianocore/edk2
C++
Other
4,240
/* *** The journal_head may be freed by this call! *** */
void journal_refile_buffer(journal_t *journal, struct journal_head *jh)
/* *** The journal_head may be freed by this call! *** */ void journal_refile_buffer(journal_t *journal, struct journal_head *jh)
{ struct buffer_head *bh = jh2bh(jh); jbd_lock_bh_state(bh); spin_lock(&journal->j_list_lock); __journal_refile_buffer(jh); jbd_unlock_bh_state(bh); journal_remove_journal_head(bh); spin_unlock(&journal->j_list_lock); __brelse(bh); }
robutest/uclinux
C++
GPL-2.0
60
/* cpuidle_add_sysfs - creates a sysfs instance for the target device @sysdev: the target device */
int cpuidle_add_sysfs(struct sys_device *sysdev)
/* cpuidle_add_sysfs - creates a sysfs instance for the target device @sysdev: the target device */ int cpuidle_add_sysfs(struct sys_device *sysdev)
{ int cpu = sysdev->id; struct cpuidle_device *dev; int error; dev = per_cpu(cpuidle_devices, cpu); error = kobject_init_and_add(&dev->kobj, &ktype_cpuidle, &sysdev->kobj, "cpuidle"); if (!error) kobject_uevent(&dev->kobj, KOBJ_ADD); return error; }
robutest/uclinux
C++
GPL-2.0
60
/* Sensing chain FIFO stop values memorization at threshold level.. */
int32_t lsm6dso_fifo_stop_on_wtm_get(stmdev_ctx_t *ctx, uint8_t *val)
/* Sensing chain FIFO stop values memorization at threshold level.. */ int32_t lsm6dso_fifo_stop_on_wtm_get(stmdev_ctx_t *ctx, uint8_t *val)
{ lsm6dso_fifo_ctrl2_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_FIFO_CTRL2, (uint8_t *)&reg, 1); *val = reg.stop_on_wtm; return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Set the read write pointer. Also expand the file size if necessary. */
static lv_fs_res_t fs_seek(lv_fs_drv_t *drv, void *file_p, uint32_t pos, lv_fs_whence_t whence)
/* Set the read write pointer. Also expand the file size if necessary. */ static lv_fs_res_t fs_seek(lv_fs_drv_t *drv, void *file_p, uint32_t pos, lv_fs_whence_t whence)
{ f_lseek(file_p, pos); return LV_FS_RES_OK; }
pikasTech/PikaPython
C++
MIT License
1,403
/* 6.5.3.4. FMS Status (Confirmed Service Id = 0) 6.5.3.4.1. Request Message Parameters */
static void dissect_ff_msg_fms_status_req(tvbuff_t *tvb, gint offset, guint32 length, packet_info *pinfo, proto_tree *tree)
/* 6.5.3.4. FMS Status (Confirmed Service Id = 0) 6.5.3.4.1. Request Message Parameters */ static void dissect_ff_msg_fms_status_req(tvbuff_t *tvb, gint offset, guint32 length, packet_info *pinfo, proto_tree *tree)
{ proto_tree *sub_tree; col_set_str(pinfo->cinfo, COL_INFO, "FMS Status Request"); if (!tree) { return; } if (length) { sub_tree = proto_tree_add_subtree(tree, tvb, offset, length, ett_ff_fms_status_req, NULL, "FMS Status Request"); proto_tree_add_item(sub_tree, hf_ff_unknown_data, tvb, offset, length, ENC_NA); } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* The caller must hold rcu lock or the tasklist lock. */
struct pid* session_of_pgrp(struct pid *pgrp)
/* The caller must hold rcu lock or the tasklist lock. */ struct pid* session_of_pgrp(struct pid *pgrp)
{ struct task_struct *p; struct pid *sid = NULL; p = pid_task(pgrp, PIDTYPE_PGID); if (p == NULL) p = pid_task(pgrp, PIDTYPE_PID); if (p != NULL) sid = task_session(p); return sid; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* set the format and rate to the chip. call the lowlevel function if defined (e.g. for AWACS). */
static void snd_pmac_pcm_set_format(struct snd_pmac *chip)
/* set the format and rate to the chip. call the lowlevel function if defined (e.g. for AWACS). */ static void snd_pmac_pcm_set_format(struct snd_pmac *chip)
{ out_le32(&chip->awacs->control, chip->control_mask | (chip->rate_index << 8)); out_le32(&chip->awacs->byteswap, chip->format == SNDRV_PCM_FORMAT_S16_LE ? 1 : 0); if (chip->set_format) chip->set_format(chip); }
robutest/uclinux
C++
GPL-2.0
60
/* enable or disable the EXMC NAND ECC function */
void exmc_nand_ecc_config(uint32_t exmc_nand_bank, ControlStatus newvalue)
/* enable or disable the EXMC NAND ECC function */ void exmc_nand_ecc_config(uint32_t exmc_nand_bank, ControlStatus newvalue)
{ if(ENABLE == newvalue) { EXMC_NPCTL(exmc_nand_bank) |= EXMC_NPCTL_ECCEN; } else { EXMC_NPCTL(exmc_nand_bank) &= ~EXMC_NPCTL_ECCEN; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* UART MSP Initialization This function configures the hardware resources used in this example. */
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
/* UART MSP Initialization This function configures the hardware resources used in this example. */ void HAL_UART_MspInit(UART_HandleTypeDef *huart)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(huart->Instance==USART1) { __HAL_RCC_USART1_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_9|GPIO_PIN_10; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = GPIO_AF7_USART1; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); HAL_NVIC_SetPriority(USART1_IRQn, 0, 0); HAL_NVIC_EnableIRQ(USART1_IRQn); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Re-compute the extended attribute hash value after an entry has changed. */
static void ext2_xattr_rehash(struct ext2_xattr_header *, struct ext2_xattr_entry *)
/* Re-compute the extended attribute hash value after an entry has changed. */ static void ext2_xattr_rehash(struct ext2_xattr_header *, struct ext2_xattr_entry *)
{ struct ext2_xattr_entry *here; __u32 hash = 0; ext2_xattr_hash_entry(header, entry); here = ENTRY(header+1); while (!IS_LAST_ENTRY(here)) { if (!here->e_hash) { hash = 0; break; } hash = (hash << BLOCK_HASH_SHIFT) ^ (hash >> (8*sizeof(hash) - BLOCK_HASH_SHIFT)) ^ le32_to_cpu(here->e_hash); here = EXT2_XATTR_NEXT(here); } header->h_hash = cpu_to_le32(hash); }
robutest/uclinux
C++
GPL-2.0
60
/* Manage the Master DRDY signal on INT1 pad.. */
int32_t lsm6dsl_sh_drdy_on_int1_set(stmdev_ctx_t *ctx, uint8_t val)
/* Manage the Master DRDY signal on INT1 pad.. */ int32_t lsm6dsl_sh_drdy_on_int1_set(stmdev_ctx_t *ctx, uint8_t val)
{ lsm6dsl_master_config_t master_config; int32_t ret; ret = lsm6dsl_read_reg(ctx, LSM6DSL_MASTER_CONFIG, (uint8_t*)&master_config, 1); if(ret == 0){ master_config.drdy_on_int1 = val; ret = lsm6dsl_write_reg(ctx, LSM6DSL_MASTER_CONFIG, (uint8_t*)&master_config, 1); } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Check the status of the Tx buffer of the specified SPI port. */
xtBoolean xSPIIsTxEmpty(unsigned long ulBase)
/* Check the status of the Tx buffer of the specified SPI port. */ xtBoolean xSPIIsTxEmpty(unsigned long ulBase)
{ xASSERT(ulBase == SPI0_BASE); return ((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_TX_EMPTY)? xtrue : xfalse); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Gets the default configuration of LPSR DIG LDO. */
void PMU_StaticGetLpsrDigLdoDefaultConfig(pmu_static_lpsr_dig_config_t *config)
/* Gets the default configuration of LPSR DIG LDO. */ void PMU_StaticGetLpsrDigLdoDefaultConfig(pmu_static_lpsr_dig_config_t *config)
{ assert(config != NULL); (void)memset(config, 0, sizeof(*config)); config->voltageStepTime = kPMU_LpsrDigVoltageStepInc50us; config->targetVoltage = kPMU_LpsrDigTargetStableVoltage1P0V; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Convert provided flags to status code, and clear any errors if present. */
static status_t LPI2C_SlaveCheckAndClearError(LPI2C_Type *base, uint32_t flags)
/* Convert provided flags to status code, and clear any errors if present. */ static status_t LPI2C_SlaveCheckAndClearError(LPI2C_Type *base, uint32_t flags)
{ status_t result = kStatus_Success; flags &= kSlaveErrorFlags; if (flags) { if (flags & kLPI2C_SlaveBitErrFlag) { result = kStatus_LPI2C_BitError; } else if (flags & kLPI2C_SlaveFifoErrFlag) { result = kStatus_LPI2C_FifoError; } else { assert(false); } LPI2C_SlaveClearStatusFlags(base, flags); } return result; }
nanoframework/nf-interpreter
C++
MIT License
293
/* Function for parsing command id and notification id. Used in the parse_get_notif_attrs_response state machine. UID and command ID will be received only once at the beginning of the first GATTC notification of a new attribute request for a given iOS notification. */
static ble_ancs_c_parse_state_t command_id_and_notif_parse(ble_ancs_c_t *p_ancs, const uint8_t *p_data_src, uint32_t *index)
/* Function for parsing command id and notification id. Used in the parse_get_notif_attrs_response state machine. UID and command ID will be received only once at the beginning of the first GATTC notification of a new attribute request for a given iOS notification. */ static ble_ancs_c_parse_state_t command_id_and_notif_parse(ble_ancs_c_t *p_ancs, const uint8_t *p_data_src, uint32_t *index)
{ ble_ancs_c_command_id_values_t command_id; command_id = (ble_ancs_c_command_id_values_t) p_data_src[(*index)++]; if(command_id != BLE_ANCS_COMMAND_ID_GET_NOTIF_ATTRIBUTES) { ANCS_LOG("[ANCS]: Invalid Command ID"); return DONE; } p_ancs->evt.attr.notif_uid = uint32_decode(&p_data_src[*index]); *index += sizeof(uint32_t); return ATTR_ID; }
labapart/polymcu
C++
null
201
/* Enables or disables the specified USIx UART interrupts. */
void USI_UARTINTConfig(USI_TypeDef *USIx, u32 USI_UARTIT, u32 newState)
/* Enables or disables the specified USIx UART interrupts. */ void USI_UARTINTConfig(USI_TypeDef *USIx, u32 USI_UARTIT, u32 newState)
{ assert_param(IS_ALL_USI_PERIPH(USIx)); assert_param(IS_USI_UART_IT(USI_UARTIT)); if (newState == ENABLE) { USIx->INTERRUPT_ENABLE |= USI_UARTIT; } else { USIx->INTERRUPT_ENABLE &= (u32)~USI_UARTIT; } }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Clean & invalidate the data cache within the specified region. */
void v7m_dma_flush_range(const void *start, const void *end)
/* Clean & invalidate the data cache within the specified region. */ void v7m_dma_flush_range(const void *start, const void *end)
{ u32 s = (u32)start, e = (u32)end; asm("dsb"); if (s & (L1_CACHE_BYTES - 1)) { DCCIMVAC(s); s = (s + L1_CACHE_BYTES) & ~(L1_CACHE_BYTES - 1); } if (e & (L1_CACHE_BYTES - 1)) { DCCIMVAC(e); e &= ~(L1_CACHE_BYTES - 1); } for ( ; s < e; s += L1_CACHE_BYTES) DCCIMVAC(s); asm("dsb"); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return temperature in degrees C of supplied voltage. The computation is based on a line running through 0 degrees K. We find the slope from the trimmed temperature calibration point. */
float am_hal_adc_volts_to_celsius(float fVoltage)
/* Return temperature in degrees C of supplied voltage. The computation is based on a line running through 0 degrees K. We find the slope from the trimmed temperature calibration point. */ float am_hal_adc_volts_to_celsius(float fVoltage)
{ float fTemp; float fCalibration_temp = priv_temp_trims.flt.fCalibrationTemperature; float fCalibration_voltage = priv_temp_trims.flt.fCalibrationVoltage; float fCalibration_offset = priv_temp_trims.flt.fCalibrationOffset; fTemp = fCalibration_temp; fTemp /= (fCalibration_voltage - fCalibration_offset); fTemp *= (fVoltage - fCalibration_offset); return fTemp - 273.15f; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Disable time stamp snapshot for IPV4 frames. When disabled, time stamp snapshot is not taken for IPV4 frames Reserved when "Advanced Time Stamp" is not selected */
void synopGMAC_TS_IPV4_disable(synopGMACdevice *gmacdev)
/* Disable time stamp snapshot for IPV4 frames. When disabled, time stamp snapshot is not taken for IPV4 frames Reserved when "Advanced Time Stamp" is not selected */ void synopGMAC_TS_IPV4_disable(synopGMACdevice *gmacdev)
{ synopGMACClearBits(gmacdev->MacBase, GmacTSControl, GmacTSIPV4ENA); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Function for handling the BLE_GATTS_EVT_WRITE event from the S110 SoftDevice. */
static void on_write(ble_dfu_t *p_dfu, ble_evt_t *p_ble_evt)
/* Function for handling the BLE_GATTS_EVT_WRITE event from the S110 SoftDevice. */ static void on_write(ble_dfu_t *p_dfu, ble_evt_t *p_ble_evt)
{ if (p_ble_evt->evt.gatts_evt.params.write.handle == p_dfu->dfu_pkt_handles.value_handle) { ble_dfu_evt_t ble_dfu_evt; ble_dfu_evt.ble_dfu_evt_type = BLE_DFU_PACKET_WRITE; ble_dfu_evt.evt.ble_dfu_pkt_write.len = p_ble_evt->evt.gatts_evt.params.write.len; ble_dfu_evt.evt.ble_dfu_pkt_write.p_data = p_ble_evt->evt.gatts_evt.params.write.data; p_dfu->evt_handler(p_dfu, &ble_dfu_evt); } }
labapart/polymcu
C++
null
201
/* This function will get the first network interface device with the flags in network interface device list. */
struct netdev* netdev_get_first_by_flags(uint16_t flags)
/* This function will get the first network interface device with the flags in network interface device list. */ struct netdev* netdev_get_first_by_flags(uint16_t flags)
{ rt_base_t level; rt_slist_t *node = RT_NULL; struct netdev *netdev = RT_NULL; if (netdev_list == RT_NULL) { return RT_NULL; } level = rt_hw_interrupt_disable(); for (node = &(netdev_list->list); node; node = rt_slist_next(node)) { netdev = rt_slist_entry(node, struct netdev, list); if (netdev && (netdev->flags & flags) != 0) { rt_hw_interrupt_enable(level); return netdev; } } rt_hw_interrupt_enable(level); return RT_NULL; }
pikasTech/PikaPython
C++
MIT License
1,403