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
/* Low pass filter 2 on 6D function selection.. */
int32_t lsm6dso_xl_lp2_on_6d_set(lsm6dso_ctx_t *ctx, uint8_t val)
/* Low pass filter 2 on 6D function selection.. */ int32_t lsm6dso_xl_lp2_on_6d_set(lsm6dso_ctx_t *ctx, uint8_t val)
{ lsm6dso_ctrl8_xl_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_CTRL8_XL, (uint8_t*)&reg, 1); if (ret == 0) { reg.low_pass_on_6d = val; ret = lsm6dso_write_reg(ctx, LSM6DSO_CTRL8_XL, (uint8_t*)&reg, 1); } return ret; }
alexander-g-dean/ESF
C++
null
41
/* Inputs : str - unused, ints - array of integer parameters with ints equal to the number of ints. */
void __init t128_setup(char *str, int *ints)
/* Inputs : str - unused, ints - array of integer parameters with ints equal to the number of ints. */ void __init t128_setup(char *str, int *ints)
{ overrides[commandline_current].address = ints[1]; overrides[commandline_current].irq = ints[2]; for (i = 0; i < NO_BASES; ++i) if (bases[i].address == ints[1]) { bases[i].noauto = 1; break; } ++commandline_current; } }
robutest/uclinux
C++
GPL-2.0
60
/* This function registers or unregisters a function which will be called whenever a new ACPI table is installed. */
EFI_STATUS EFIAPI RegisterNotify(IN BOOLEAN Register, IN EFI_ACPI_NOTIFICATION_FN Notification)
/* This function registers or unregisters a function which will be called whenever a new ACPI table is installed. */ EFI_STATUS EFIAPI RegisterNotify(IN BOOLEAN Register, IN EFI_ACPI_NOTIFICATION_FN Notification)
{ if (Notification == NULL) { return EFI_INVALID_PARAMETER; } if (Register) { SdtRegisterNotify (Notification); return EFI_SUCCESS; } else { return SdtUnregisterNotify (Notification); } }
tianocore/edk2
C++
Other
4,240
/* This function sets a session ID to be used when the TLS/SSL connection is to be established. */
EFI_STATUS EFIAPI TlsSetSessionId(IN VOID *Tls, IN UINT8 *SessionId, IN UINT16 SessionIdLen)
/* This function sets a session ID to be used when the TLS/SSL connection is to be established. */ EFI_STATUS EFIAPI TlsSetSessionId(IN VOID *Tls, IN UINT8 *SessionId, IN UINT16 SessionIdLen)
{ TLS_CONNECTION *TlsConn; SSL_SESSION *Session; TlsConn = (TLS_CONNECTION *)Tls; Session = NULL; if ((TlsConn == NULL) || (TlsConn->Ssl == NULL) || (SessionId == NULL)) { return EFI_INVALID_PARAMETER; } Session = SSL_get_session (TlsConn->Ssl); if (Session == NULL) { return EFI_UNSUPPORTED; } SSL_SESSION_set1_id (Session, (const unsigned char *)SessionId, SessionIdLen); return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Check next character in a string and decide if the character is part of the command or not */
bool lv_txt_is_cmd(lv_txt_cmd_state_t *state, uint32_t c)
/* Check next character in a string and decide if the character is part of the command or not */ bool lv_txt_is_cmd(lv_txt_cmd_state_t *state, uint32_t c)
{ bool ret = false; if(c == (uint32_t)LV_TXT_COLOR_CMD[0]) { if(*state == LV_TXT_CMD_STATE_WAIT) { *state = LV_TXT_CMD_STATE_PAR; ret = true; } else if(*state == LV_TXT_CMD_STATE_PAR) { *state = LV_TXT_CMD_STATE_WAIT; } else if(*state == LV_TXT_CMD_STATE_IN) { *state = LV_TXT_CMD_STATE_WAIT; ret = true; } } if(*state == LV_TXT_CMD_STATE_PAR) { if(c == ' ') { *state = LV_TXT_CMD_STATE_IN; } ret = true; } return ret; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Decodes the escape sequences and copies the result into the destination buffer. */
static uint16_t _decode_copy(uint8_t *puc_dest, uint8_t *puc_orig, uint16_t us_size)
/* Decodes the escape sequences and copies the result into the destination buffer. */ static uint16_t _decode_copy(uint8_t *puc_dest, uint8_t *puc_orig, uint16_t us_size)
{ uint16_t i = 0; uint16_t j = 0; while (i < us_size) { if (puc_orig[i] == ESCMARK) { if (puc_orig[i + 1] == ESC_MSGMARK) { puc_dest[j++] = MSGMARK; i += 2; } else if (puc_orig[i + 1] == ESC_ESCMARK) { puc_dest[j++] = ESCMARK; i += 2; } else { return (uint16_t)USI_STATUS_FORMAT_ERROR; } } else { puc_dest[j++] = puc_orig[i]; i++; } } return(j); }
remotemcu/remcu-chip-sdks
C++
null
436
/* This function set HCLK clock source and HCLK clock divider. */
void CLK_SetHCLK(uint32_t u32ClkSrc, uint32_t u32ClkDiv)
/* This function set HCLK clock source and HCLK clock divider. */ void CLK_SetHCLK(uint32_t u32ClkSrc, uint32_t u32ClkDiv)
{ uint32_t u32HIRCSTB; u32HIRCSTB = CLK->STATUS & CLK_STATUS_HIRCSTB_Msk; CLK->PWRCTL |= CLK_PWRCTL_HIRCEN_Msk; CLK_WaitClockReady(CLK_STATUS_HIRCSTB_Msk); CLK->CLKSEL0 = (CLK->CLKSEL0 & (~CLK_CLKSEL0_HCLKSEL_Msk)) | CLK_CLKSEL0_HCLKSEL_HIRC; CLK->CLKDIV0 = (CLK->CLKDIV0 & (~CLK_CLKDIV0_HCLKDIV_Msk)) | u32ClkDiv; CLK->CLKSEL0 = (CLK->CLKSEL0 & (~CLK_CLKSEL0_HCLKSEL_Msk)) | u32ClkSrc; SystemCoreClockUpdate(); if(u32HIRCSTB == 0UL) { CLK->PWRCTL &= ~CLK_PWRCTL_HIRCEN_Msk; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Hybrid window filtering, see blocks 36 and 49 of the G.728 specification. */
static void do_hybrid_window(int order, int n, int non_rec, float *out, float *hist, float *out2, const float *window)
/* Hybrid window filtering, see blocks 36 and 49 of the G.728 specification. */ static void do_hybrid_window(int order, int n, int non_rec, float *out, float *hist, float *out2, const float *window)
{ int i; float buffer1[order + 1]; float buffer2[order + 1]; float work[order + n + non_rec]; apply_window(work, window, hist, order + n + non_rec); convolve(buffer1, work + order , n , order); convolve(buffer2, work + order + n, non_rec, order); for (i=0; i <= order; i++) { out2[i] = out2[i] * 0.5625 + buffer1[i]; out [i] = out2[i] + buffer2[i]; } *out *= 257./256.; }
DC-SWAT/DreamShell
C++
null
404
/* Converts a text device path node to EMMC (Embedded MMC) device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextEmmc(IN CHAR16 *TextDeviceNode)
/* Converts a text device path node to EMMC (Embedded MMC) device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextEmmc(IN CHAR16 *TextDeviceNode)
{ CHAR16 *SlotNumberStr; EMMC_DEVICE_PATH *Emmc; SlotNumberStr = GetNextParamStr (&TextDeviceNode); Emmc = (EMMC_DEVICE_PATH *)CreateDeviceNode ( MESSAGING_DEVICE_PATH, MSG_EMMC_DP, (UINT16)sizeof (EMMC_DEVICE_PATH) ); Emmc->SlotNumber = (UINT8)Strtoi (SlotNumberStr); return (EFI_DEVICE_PATH_PROTOCOL *)Emmc; }
tianocore/edk2
C++
Other
4,240
/* Get/Set controller mode: Possible values: 0 = Fan always on 1 = Open loop, Voltage is set according to speed, not regulated. 2 = Closed loop, RPM for all fans regulated by fan1 tachometer */
static ssize_t get_enable(struct device *dev, struct device_attribute *devattr, char *buf)
/* Get/Set controller mode: Possible values: 0 = Fan always on 1 = Open loop, Voltage is set according to speed, not regulated. 2 = Closed loop, RPM for all fans regulated by fan1 tachometer */ static ssize_t get_enable(struct device *dev, struct device_attribute *devattr, char *buf)
{ struct max6650_data *data = max6650_update_device(dev); int mode = (data->config & MAX6650_CFG_MODE_MASK) >> 4; int sysfs_modes[4] = {0, 1, 2, 1}; return sprintf(buf, "%d\n", sysfs_modes[mode]); }
robutest/uclinux
C++
GPL-2.0
60
/* Disables access to the RTC and backup registers. */
void SysCtlBackupAccessDisable(void)
/* Disables access to the RTC and backup registers. */ void SysCtlBackupAccessDisable(void)
{ xHWREG(PWR_CR) &= ~PWR_CR_DBP; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Return value: Number of page frames actually allocated */
static unsigned long preallocate_image_pages(unsigned long nr_pages, gfp_t mask)
/* Return value: Number of page frames actually allocated */ static unsigned long preallocate_image_pages(unsigned long nr_pages, gfp_t mask)
{ unsigned long nr_alloc = 0; while (nr_pages > 0) { struct page *page; page = alloc_image_page(mask); if (!page) break; memory_bm_set_bit(&copy_bm, page_to_pfn(page)); if (PageHighMem(page)) alloc_highmem++; else alloc_normal++; nr_pages--; nr_alloc++; } return nr_alloc; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Waits for a Flash operation on Bank1 to complete or a TIMEOUT to occur. */
FLASH_Status FLASH_WaitForLastBank1Operation(uint32_t Timeout)
/* Waits for a Flash operation on Bank1 to complete or a TIMEOUT to occur. */ FLASH_Status FLASH_WaitForLastBank1Operation(uint32_t Timeout)
{ FLASH_Status status = FLASH_COMPLETE; status = FLASH_GetBank1Status(); while((status == FLASH_FLAG_BANK1_BSY) && (Timeout != 0x00)) { status = FLASH_GetBank1Status(); Timeout--; } if(Timeout == 0x00 ) { status = FLASH_TIMEOUT; } return status; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Adjusts the Internal High Speed oscillator (HSI) calibration value. */
void RCC_AdjustHSICalibrationValue(uint8_t HSICalibrationValue)
/* Adjusts the Internal High Speed oscillator (HSI) calibration value. */ void RCC_AdjustHSICalibrationValue(uint8_t HSICalibrationValue)
{ uint32_t tmpreg = 0; assert_param(IS_RCC_CALIBRATION_VALUE(HSICalibrationValue)); tmpreg = RCC->CR; tmpreg &= CR_HSITRIM_Mask; tmpreg |= (uint32_t)((HSICalibrationValue&0x3f)<< 8); RCC->CR = tmpreg; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* CRC MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_CRC_MspDeInit(CRC_HandleTypeDef *hcrc)
/* CRC MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_CRC_MspDeInit(CRC_HandleTypeDef *hcrc)
{ if(hcrc->Instance==CRC) { __HAL_RCC_CRC_CLK_DISABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Handle Bulk In/Out Endpoint Events. The function handles Bulk In/Out endpoint events. It is used for endpoints that do In and Out functionality on the same endpoint number. It dispatches events to appropriate In or Out event handlers. */
void USBD_CDC_ACM_EP_BULK_Event(uint32_t event)
/* Handle Bulk In/Out Endpoint Events. The function handles Bulk In/Out endpoint events. It is used for endpoints that do In and Out functionality on the same endpoint number. It dispatches events to appropriate In or Out event handlers. */ void USBD_CDC_ACM_EP_BULK_Event(uint32_t event)
{ if (event & USBD_EVT_OUT) { USBD_CDC_ACM_EP_BULKOUT_Event(event); } if (event & USBD_EVT_IN) { USBD_CDC_ACM_EP_BULKIN_Event(event); } }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Computes a cycle count for a given time in nanoseconds. */
static uint32_t LPI2C_GetCyclesForWidth(uint32_t sourceClock_Hz, uint32_t width_ns, uint32_t maxCycles, uint32_t prescaler)
/* Computes a cycle count for a given time in nanoseconds. */ static uint32_t LPI2C_GetCyclesForWidth(uint32_t sourceClock_Hz, uint32_t width_ns, uint32_t maxCycles, uint32_t prescaler)
{ assert(sourceClock_Hz > 0); assert(prescaler > 0); uint32_t busCycle_ns = 1000000 / (sourceClock_Hz / prescaler / 1000); uint32_t cycles = 0; while ((((cycles + 1) * busCycle_ns) < width_ns) && (cycles + 1 < maxCycles)) { ++cycles; } if ((cycles == 0) && (busCycle_ns <= (width_ns * 10))) { cycles = 1; } return cycles; }
nanoframework/nf-interpreter
C++
MIT License
293
/* Exit from Hybrid sleep and deep Power down function. */
void HBI_ExitHSAndDPD(void)
/* Exit from Hybrid sleep and deep Power down function. */ void HBI_ExitHSAndDPD(void)
{ int32_t i32TimeOutCnt = HBI_TIMEOUT; HBI->CMD = HBI_CMD_EXIT_HS_PD; g_HBI_i32ErrCode = 0; while (HBI->CMD != HBI_CMD_HRAM_IDLE) { if (i32TimeOutCnt-- <= 0) { g_HBI_i32ErrCode = HBI_TIMEOUT_ERR; break; } } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set the fields of structure stc_tmr6_buf_config_t to default values. */
int32_t TMR6_BufFuncStructInit(stc_tmr6_buf_config_t *pstcBufConfig)
/* Set the fields of structure stc_tmr6_buf_config_t to default values. */ int32_t TMR6_BufFuncStructInit(stc_tmr6_buf_config_t *pstcBufConfig)
{ int32_t i32Ret = LL_ERR_INVD_PARAM; if (NULL != pstcBufConfig) { pstcBufConfig->u32BufNum = TMR6_BUF_SINGLE; pstcBufConfig->u32BufTransCond = TMR6_BUF_TRANS_INVD; i32Ret = LL_OK; } return i32Ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Find the private data that the group previously attached to this event when the group added the event to the notification queue (fsnotify_add_notify_event) */
struct fsnotify_event_private_data* fsnotify_remove_priv_from_event(struct fsnotify_group *group, struct fsnotify_event *event)
/* Find the private data that the group previously attached to this event when the group added the event to the notification queue (fsnotify_add_notify_event) */ struct fsnotify_event_private_data* fsnotify_remove_priv_from_event(struct fsnotify_group *group, struct fsnotify_event *event)
{ struct fsnotify_event_private_data *lpriv; struct fsnotify_event_private_data *priv = NULL; assert_spin_locked(&event->lock); list_for_each_entry(lpriv, &event->private_data_list, event_list) { if (lpriv->group == group) { priv = lpriv; list_del(&priv->event_list); break; } } return priv; }
robutest/uclinux
C++
GPL-2.0
60
/* Initialize the timer systems of the Freescale Kinetis MCU */
void __init kinetis_timer_init(void)
/* Initialize the timer systems of the Freescale Kinetis MCU */ void __init kinetis_timer_init(void)
{ kinetis_clock_init(); clocksource_tmr_init(); clockevents_tmr_init(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Disable the specified ADC regular channel external trigger. */
void ADC_DisableExternalTrigConv(ADC_T *adc)
/* Disable the specified ADC regular channel external trigger. */ void ADC_DisableExternalTrigConv(ADC_T *adc)
{ adc->CTRL2_B.REGEXTTRGEN = BIT_RESET; }
pikasTech/PikaPython
C++
MIT License
1,403
/* THIS SOFTWARE IS PROVIDED "AS IS", WITH ABSOLUTELY NO WARRANTY, REAL OR IMPLIED. */
struct fp_ext* fp_fsin(struct fp_ext *dest, struct fp_ext *src)
/* THIS SOFTWARE IS PROVIDED "AS IS", WITH ABSOLUTELY NO WARRANTY, REAL OR IMPLIED. */ struct fp_ext* fp_fsin(struct fp_ext *dest, struct fp_ext *src)
{ uprint("fsin\n"); fp_monadic_check(dest, src); return dest; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Callback function for events from the Identity Manager module. */
static void im_evt_handler(im_evt_t const *p_event)
/* Callback function for events from the Identity Manager module. */ static void im_evt_handler(im_evt_t const *p_event)
{ switch (p_event->evt_id) { case IM_EVT_BONDED_PEER_CONNECTED: local_db_apply_in_evt(p_event->conn_handle); if (gscm_service_changed_ind_needed(p_event->conn_handle)) { ble_conn_state_user_flag_set(p_event->conn_handle, m_gcm.flag_id_service_changed_pending, true); } break; default: break; } }
labapart/polymcu
C++
null
201
/* The channel must also be enabled using uDMAChannelEnable() after calling this function. The transfer will not begin until the channel has been set up and enabled. Note that the channel is automatically disabled after the transfer is completed, meaning that uDMAChannelEnable() must be called again after setting up the next transfer. */
void DMAChannelTransferSet(unsigned long ulChannelID, void *pvSrcAddr, void *pvDstAddr, unsigned long ulTransferSize)
/* The channel must also be enabled using uDMAChannelEnable() after calling this function. The transfer will not begin until the channel has been set up and enabled. Note that the channel is automatically disabled after the transfer is completed, meaning that uDMAChannelEnable() must be called again after setting up the next transfer. */ void DMAChannelTransferSet(unsigned long ulChannelID, void *pvSrcAddr, void *pvDstAddr, unsigned long ulTransferSize)
{ xASSERT(xDMAChannelIDValid(ulChannelID)); xHWREG(g_psDMAChannel[ulChannelID]) &= ~DMA_CCR1_EN; xHWREG(g_psDMAChannel[ulChannelID] + 0x8) = (unsigned long)pvSrcAddr; xHWREG(g_psDMAChannel[ulChannelID] + 0xC) = (unsigned long)pvDstAddr; xHWREG(g_psDMAChannel[ulChannelID] + 0x4) = ulTransferSize; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* device_pm_init - Initialize the PM-related part of a device object. @dev: Device object being initialized. */
void device_pm_init(struct device *dev)
/* device_pm_init - Initialize the PM-related part of a device object. @dev: Device object being initialized. */ void device_pm_init(struct device *dev)
{ dev->power.status = DPM_ON; pm_runtime_init(dev); }
robutest/uclinux
C++
GPL-2.0
60
/* Return codes pointer to the driver internal queue element for mailbox command. */
LPFC_MBOXQ_t* lpfc_mbox_get(struct lpfc_hba *phba)
/* Return codes pointer to the driver internal queue element for mailbox command. */ LPFC_MBOXQ_t* lpfc_mbox_get(struct lpfc_hba *phba)
{ LPFC_MBOXQ_t *mbq = NULL; struct lpfc_sli *psli = &phba->sli; list_remove_head((&psli->mboxq), mbq, LPFC_MBOXQ_t, list); if (mbq) psli->mboxq_cnt--; return mbq; }
robutest/uclinux
C++
GPL-2.0
60
/* Write data in the corresponding row and select it. */
void DotMatrixRunRow(unsigned char ucRow)
/* Write data in the corresponding row and select it. */ void DotMatrixRunRow(unsigned char ucRow)
{ unsigned char i, j, p, ucData; xGPIOSPinWrite(sA0, 1); xGPIOSPinWrite(sA1, 0); for(i = 0; i < 8; i++) { for(j = 0; j < 3; j++) { ucData = dots[g_ucPageIndex][ucRow][i][2-j]; for(p = 0; p < 8; p++) { if(ucData & 0x80) { xGPIOSPinWrite(sD7, 1); } else { xGPIOSPinWrite(sD7, 0); } ucData = ucData << 1; xGPIOSPinWrite(sD6, 0); xGPIOSPinWrite(sD6, 1); } } } xGPIOSPinWrite(sA1, 1); xGPIOSPinWrite(sA1, 0); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Most of the work here is just handed off to the libfc routine. */
static struct fc_seq * fcoe_elsct_send(struct fc_lport *, u32 did, struct fc_frame *, unsigned int op, void(*resp)(struct fc_seq *, struct fc_frame *, void *), void *, u32 timeout)
/* Most of the work here is just handed off to the libfc routine. */ static struct fc_seq * fcoe_elsct_send(struct fc_lport *, u32 did, struct fc_frame *, unsigned int op, void(*resp)(struct fc_seq *, struct fc_frame *, void *), void *, u32 timeout)
{ struct fcoe_port *port = lport_priv(lport); struct fcoe_interface *fcoe = port->fcoe; struct fcoe_ctlr *fip = &fcoe->ctlr; struct fc_frame_header *fh = fc_frame_header_get(fp); switch (op) { case ELS_FLOGI: case ELS_FDISC: return fc_elsct_send(lport, did, fp, op, fcoe_flogi_resp, fip, timeout); case ELS_LOGO: if (ntoh24(fh->fh_d_id) != FC_FID_FLOGI) break; return fc_elsct_send(lport, did, fp, op, fcoe_logo_resp, lport, timeout); } return fc_elsct_send(lport, did, fp, op, resp, arg, timeout); }
robutest/uclinux
C++
GPL-2.0
60
/* When ARM7TDMI comes across an instruction which it cannot handle, it takes the undefined instruction trap. */
void rt_hw_trap_udef(struct rt_hw_register *regs)
/* When ARM7TDMI comes across an instruction which it cannot handle, it takes the undefined instruction trap. */ void rt_hw_trap_udef(struct rt_hw_register *regs)
{ rt_kprintf("undefined instruction\n"); rt_hw_show_register(regs); if (rt_thread_self() != RT_NULL) rt_kprintf("Current Thread: %s\n", rt_thread_self()->parent.name); rt_hw_cpu_shutdown(); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* set the percentage of files at which to stop culling */
static int cachefiles_daemon_frun(struct cachefiles_cache *, char *)
/* set the percentage of files at which to stop culling */ static int cachefiles_daemon_frun(struct cachefiles_cache *, char *)
{ unsigned long frun; _enter(",%s", args); if (!*args) return -EINVAL; frun = simple_strtoul(args, &args, 10); if (args[0] != '%' || args[1] != '\0') return -EINVAL; if (frun <= cache->fcull_percent || frun >= 100) return cachefiles_daemon_range_error(cache, args); cache->frun_percent = frun; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Adjust the pool head position to make sure the Guard page is adjavent to pool tail or pool head. */
VOID* AdjustPoolHeadA(IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN NoPages, IN UINTN Size)
/* Adjust the pool head position to make sure the Guard page is adjavent to pool tail or pool head. */ VOID* AdjustPoolHeadA(IN EFI_PHYSICAL_ADDRESS Memory, IN UINTN NoPages, IN UINTN Size)
{ if ((Memory == 0) || ((PcdGet8 (PcdHeapGuardPropertyMask) & BIT7) != 0)) { return (VOID *)(UINTN)Memory; } Size = ALIGN_VALUE (Size, 8); return (VOID *)(UINTN)(Memory + EFI_PAGES_TO_SIZE (NoPages) - Size); }
tianocore/edk2
C++
Other
4,240
/* Upcall function for touch panel activity. This function is call from TOUCH driver every time pen state is changed (up/down) or is moved. There is translation to emWin structure done. */
void LCD_TOUCH_Upcall(TOUCH_Pos_TypeDef *pos)
/* Upcall function for touch panel activity. This function is call from TOUCH driver every time pen state is changed (up/down) or is moved. There is translation to emWin structure done. */ void LCD_TOUCH_Upcall(TOUCH_Pos_TypeDef *pos)
{ static GUI_PID_STATE gui_pos; if(pos->x < LCD_GetXSize()) gui_pos.x = pos->x; else gui_pos.x = LCD_GetXSize()-1; if(pos->y < LCD_GetYSize()) gui_pos.y = pos->y; else gui_pos.y = LCD_GetYSize()-1; gui_pos.Pressed = pos->pen; GUI_TOUCH_StoreStateEx(&gui_pos); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Collect processes when the error hit a file mapped page. */
static void collect_procs_file(struct page *page, struct list_head *to_kill, struct to_kill **tkc)
/* Collect processes when the error hit a file mapped page. */ static void collect_procs_file(struct page *page, struct list_head *to_kill, struct to_kill **tkc)
{ struct vm_area_struct *vma; struct task_struct *tsk; struct prio_tree_iter iter; struct address_space *mapping = page->mapping; read_lock(&tasklist_lock); spin_lock(&mapping->i_mmap_lock); for_each_process(tsk) { pgoff_t pgoff = page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT); if (!task_early_kill(tsk)) continue; vma_prio_tree_foreach(vma, &iter, &mapping->i_mmap, pgoff, pgoff) { if (vma->vm_mm == tsk->mm) add_to_kill(tsk, page, vma, to_kill, tkc); } } spin_unlock(&mapping->i_mmap_lock); read_unlock(&tasklist_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* Function for Timer 1 initialization. Initializes Timer 1 peripheral, creates event and interrupt every 2 seconds, by configuring CC to timer overflow value, we create events at even number of seconds for example, events are created at 2,4,6 ... seconds. This event can be used to stop Timer 0 with Timer1->Event_Compare triggering Timer 0 TASK_STOP through PPI. */
static void timer1_init(void)
/* Function for Timer 1 initialization. Initializes Timer 1 peripheral, creates event and interrupt every 2 seconds, by configuring CC to timer overflow value, we create events at even number of seconds for example, events are created at 2,4,6 ... seconds. This event can be used to stop Timer 0 with Timer1->Event_Compare triggering Timer 0 TASK_STOP through PPI. */ static void timer1_init(void)
{ nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG; timer_cfg.frequency = NRF_TIMER_FREQ_31250Hz; ret_code_t err_code = nrf_drv_timer_init(&timer1, &timer_cfg, timer_event_handler); APP_ERROR_CHECK(err_code); nrf_drv_timer_extended_compare(&timer1, NRF_TIMER_CC_CHANNEL0, 0xFFFFUL, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, false); }
remotemcu/remcu-chip-sdks
C++
null
436
/* sys_sched_setaffinity - set the cpu affinity of a process @pid: pid of the process @len: length in bytes of the bitmask pointed to by user_mask_ptr @user_mask_ptr: user-space pointer to the new cpu mask */
SYSCALL_DEFINE3(sched_setaffinity, pid_t, pid, unsigned int, len, unsigned long __user *, user_mask_ptr)
/* sys_sched_setaffinity - set the cpu affinity of a process @pid: pid of the process @len: length in bytes of the bitmask pointed to by user_mask_ptr @user_mask_ptr: user-space pointer to the new cpu mask */ SYSCALL_DEFINE3(sched_setaffinity, pid_t, pid, unsigned int, len, unsigned long __user *, user_mask_ptr)
{ cpumask_var_t new_mask; int retval; if (!alloc_cpumask_var(&new_mask, GFP_KERNEL)) return -ENOMEM; retval = get_user_cpu_mask(user_mask_ptr, len, new_mask); if (retval == 0) retval = sched_setaffinity(pid, new_mask); free_cpumask_var(new_mask); return retval; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set the callback that requests the use of a new set of Sources Caps if they're available. */
void usbc_set_policy_cb_change_src_caps(const struct device *dev, const policy_cb_change_src_caps_t cb)
/* Set the callback that requests the use of a new set of Sources Caps if they're available. */ void usbc_set_policy_cb_change_src_caps(const struct device *dev, const policy_cb_change_src_caps_t cb)
{ struct usbc_port_data *data = dev->data; data->policy_change_src_caps = cb; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This function will mask oldest entry in FIFO as released making space for another received frame. This function can be used if fdcan_receive was called using release = false. If used in other case, then messages can get lost. */
void fdcan_release_fifo(uint32_t canport, uint8_t fifo_id)
/* This function will mask oldest entry in FIFO as released making space for another received frame. This function can be used if fdcan_receive was called using release = false. If used in other case, then messages can get lost. */ void fdcan_release_fifo(uint32_t canport, uint8_t fifo_id)
{ unsigned pending_frames, get_index; get_index = (FDCAN_RXFIS(canport, fifo_id) >> FDCAN_RXFIFO_GI_SHIFT) & FDCAN_RXFIFO_GI_SHIFT; pending_frames = (FDCAN_RXFIS(canport, fifo_id) >> FDCAN_RXFIFO_FL_SHIFT) & FDCAN_RXFIFO_FL_SHIFT; if (pending_frames) { FDCAN_RXFIA(canport, fifo_id) |= get_index << FDCAN_RXFIFO_AI_SHIFT; } }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Perform hardware setup to enable ticks from timer 1, */
static void prvSetupTimerInterrupt(void)
/* Perform hardware setup to enable ticks from timer 1, */ static void prvSetupTimerInterrupt(void)
{ const unsigned short usReloadValue = ( unsigned short ) ( ( ( configPER_CLOCK_HZ / configTICK_RATE_HZ ) / 32UL ) - 1UL ); TMCSR0_CNTE = 0; TMCSR0_CSL = 0x2; TMCSR0_MOD = 0; TMCSR0_RELD = 1; TMCSR0_UF = 0; TMRLR0 = usReloadValue; TMCSR0_INTE = 1; TMCSR0_CNTE = 1; TMCSR0_TRG = 1; PORTEN = 0x3; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* fc_flush_work - Flush a fc_host's workqueue. @shost: Pointer to Scsi_Host bound to fc_host. */
static void fc_flush_work(struct Scsi_Host *shost)
/* fc_flush_work - Flush a fc_host's workqueue. @shost: Pointer to Scsi_Host bound to fc_host. */ static void fc_flush_work(struct Scsi_Host *shost)
{ if (!fc_host_work_q(shost)) { printk(KERN_ERR "ERROR: FC host '%s' attempted to flush work, " "when no workqueue created.\n", shost->hostt->name); dump_stack(); return; } flush_workqueue(fc_host_work_q(shost)); }
robutest/uclinux
C++
GPL-2.0
60
/* Refer to SD Host Controller Simplified spec 3.0 Section 3.3 for details. */
EFI_STATUS SdMmcHcInitPowerVoltage(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 Slot, IN SD_MMC_HC_SLOT_CAP Capability)
/* Refer to SD Host Controller Simplified spec 3.0 Section 3.3 for details. */ EFI_STATUS SdMmcHcInitPowerVoltage(IN EFI_PCI_IO_PROTOCOL *PciIo, IN UINT8 Slot, IN SD_MMC_HC_SLOT_CAP Capability)
{ EFI_STATUS Status; UINT8 MaxVoltage; UINT8 HostCtrl2; if (Capability.Voltage33 != 0) { MaxVoltage = 0x0E; } else if (Capability.Voltage30 != 0) { MaxVoltage = 0x0C; } else if (Capability.Voltage18 != 0) { MaxVoltage = 0x0A; HostCtrl2 = BIT3; Status = SdMmcHcOrMmio (PciIo, Slot, SD_MMC_HC_HOST_CTRL2, sizeof (HostCtrl2), &HostCtrl2); gBS->Stall (5000); if (EFI_ERROR (Status)) { return Status; } } else { ASSERT (FALSE); return EFI_DEVICE_ERROR; } Status = SdMmcHcPowerControl (PciIo, Slot, MaxVoltage); return Status; }
tianocore/edk2
C++
Other
4,240
/* Rport is going offline. Awaiting FC-4 offline completion callback. */
static void bfa_fcs_rport_sm_fc4_offline(struct bfa_fcs_rport_s *rport, enum rport_event event)
/* Rport is going offline. Awaiting FC-4 offline completion callback. */ static void bfa_fcs_rport_sm_fc4_offline(struct bfa_fcs_rport_s *rport, enum rport_event event)
{ bfa_trc(rport->fcs, rport->pwwn); bfa_trc(rport->fcs, rport->pid); bfa_trc(rport->fcs, event); switch (event) { case RPSM_EVENT_FC4_OFFLINE: bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_offline); bfa_rport_offline(rport->bfa_rport); break; case RPSM_EVENT_SCN: case RPSM_EVENT_LOGO_IMP: case RPSM_EVENT_LOGO_RCVD: case RPSM_EVENT_ADDRESS_CHANGE: break; case RPSM_EVENT_DELETE: bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend); break; default: bfa_assert(0); } }
robutest/uclinux
C++
GPL-2.0
60
/* Send netlink message with control over sendmsg() message header. */
int nl_sendmsg(struct nl_sock *sk, struct nl_msg *msg, struct msghdr *hdr)
/* Send netlink message with control over sendmsg() message header. */ int nl_sendmsg(struct nl_sock *sk, struct nl_msg *msg, struct msghdr *hdr)
{ struct nl_cb *cb; int ret; nlmsg_set_src(msg, &sk->s_local); cb = sk->s_cb; if (cb->cb_set[NL_CB_MSG_OUT]) if (nl_cb_call(cb, NL_CB_MSG_OUT, msg) != NL_OK) return 0; ret = sendmsg(sk->s_fd, hdr, 0); if (ret < 0) return -nl_syserr2nlerr(errno); NL_DBG(4, "sent %d bytes\n", ret); return ret; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* param base ENET_QOS peripheral base address. param config The ENET_QOS AVB feature configuration structure. param queueIndex ENET_QOS queue index. */
void ENET_QOS_AVBConfigure(ENET_QOS_Type *base, const enet_qos_cbs_config_t *config, uint8_t queueIndex)
/* param base ENET_QOS peripheral base address. param config The ENET_QOS AVB feature configuration structure. param queueIndex ENET_QOS queue index. */ void ENET_QOS_AVBConfigure(ENET_QOS_Type *base, const enet_qos_cbs_config_t *config, uint8_t queueIndex)
{ assert(config != NULL); base->MTL_QUEUE[queueIndex].MTL_TXQX_ETS_CTRL |= ENET_QOS_MTL_TXQX_ETS_CTRL_AVALG_MASK; base->MTL_QUEUE[queueIndex].MTL_TXQX_SNDSLP_CRDT = config->sendSlope; base->MTL_QUEUE[queueIndex].MTL_TXQX_QNTM_WGHT = config->idleSlope; base->MTL_QUEUE[queueIndex].MTL_TXQX_HI_CRDT = config->highCredit; base->MTL_QUEUE[queueIndex].MTL_TXQX_LO_CRDT = config->lowCredit; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Initialize an instance of the native simulator CPU emulator and return a pointer to it. That pointer should be passed to all subsequent calls to this module. */
void* nce_init(void)
/* Initialize an instance of the native simulator CPU emulator and return a pointer to it. That pointer should be passed to all subsequent calls to this module. */ void* nce_init(void)
{ struct nce_status_t *this; this = calloc(1, sizeof(struct nce_status_t)); if (this == NULL) { nsi_print_error_and_exit(NO_MEM_ERR); } this->cpu_halted = true; this->terminate = false; NSI_SAFE_CALL(pthread_cond_init(&this->cond_cpu, NULL)); NSI_SAFE_CALL(pthread_mutex_init(&this->mtx_cpu, NULL)); return (void *)this; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* set the opcode in TFTP message: RRQ / WRQ / DATA / ACK / ERROR */
void tftp_set_opcode(char *buffer, tftp_opcode opcode)
/* set the opcode in TFTP message: RRQ / WRQ / DATA / ACK / ERROR */ void tftp_set_opcode(char *buffer, tftp_opcode opcode)
{ buffer[0] = 0; buffer[1] = (u8_t)opcode; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* This function returns 0 if successfull, or a negative error code. */
int __devinit snd_hda_build_pcms(struct hda_bus *bus)
/* This function returns 0 if successfull, or a negative error code. */ int __devinit snd_hda_build_pcms(struct hda_bus *bus)
{ struct hda_codec *codec; list_for_each_entry(codec, &bus->codec_list, list) { int err = snd_hda_codec_build_pcms(codec); if (err < 0) return err; } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* sscanf - Unformat a buffer into a list of arguments @buf: input buffer @fmt: formatting of buffer ...: resulting arguments */
int sscanf(const char *buf, const char *fmt,...)
/* sscanf - Unformat a buffer into a list of arguments @buf: input buffer @fmt: formatting of buffer ...: resulting arguments */ int sscanf(const char *buf, const char *fmt,...)
{ va_list args; int i; va_start(args, fmt); i = vsscanf(buf, fmt, args); va_end(args); return i; }
robutest/uclinux
C++
GPL-2.0
60
/* create a new Lua closure, push it in the stack, and initialize its upvalues. Note that the closure is not cached if prototype is already black (which means that 'cache' was already cleared by the GC). */
static void pushclosure(lua_State *L, Proto *p, UpVal **encup, StkId base, StkId ra)
/* create a new Lua closure, push it in the stack, and initialize its upvalues. Note that the closure is not cached if prototype is already black (which means that 'cache' was already cleared by the GC). */ static void pushclosure(lua_State *L, Proto *p, UpVal **encup, StkId base, StkId ra)
{ int nup = p->sizeupvalues; Upvaldesc *uv = p->upvalues; int i; LClosure *ncl = luaF_newLclosure(L, nup); ncl->p = p; setclLvalue(L, ra, ncl); for (i = 0; i < nup; i++) { if (uv[i].instack) ncl->upvals[i] = luaF_findupval(L, base + uv[i].idx); else ncl->upvals[i] = encup[uv[i].idx]; ncl->upvals[i]->refcount++; } }
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* callback function used by ssl_association_info() to traverse the SSL associations. */
static void ssl_association_info_(const gchar *table _U_, gpointer handle, gpointer user_data)
/* callback function used by ssl_association_info() to traverse the SSL associations. */ static void ssl_association_info_(const gchar *table _U_, gpointer handle, gpointer user_data)
{ ssl_association_info_callback_data_t* data = (ssl_association_info_callback_data_t*)user_data; const int l = (const int)strlen(data->str); g_snprintf(data->str+l, SSL_ASSOC_MAX_LEN-l, "'%s' %s\n", dissector_handle_get_short_name((dissector_handle_t)handle), data->table_protocol); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Process SENSE PGID request result for single path. */
static void snid_callback(struct ccw_device *cdev, void *data, int rc)
/* Process SENSE PGID request result for single path. */ static void snid_callback(struct ccw_device *cdev, void *data, int rc)
{ struct ccw_request *req = &cdev->private->req; if (rc == 0) cdev->private->pgid_valid_mask |= req->lpm; else if (rc != -EACCES) goto err; req->lpm >>= 1; snid_do(cdev); return; err: snid_done(cdev, rc); }
robutest/uclinux
C++
GPL-2.0
60
/* Gets the direction and mode of a pin. */
unsigned long GPIODirModeGet(unsigned long ulPort, unsigned char ucPin)
/* Gets the direction and mode of a pin. */ unsigned long GPIODirModeGet(unsigned long ulPort, unsigned char ucPin)
{ unsigned long ulDir, ulAFSEL; ASSERT(GPIOBaseValid(ulPort)); ASSERT(ucPin < 8); ucPin = 1 << ucPin; ulDir = HWREG(ulPort + GPIO_O_DIR); ulAFSEL = HWREG(ulPort + GPIO_O_AFSEL); return(((ulDir & ucPin) ? 1 : 0) | ((ulAFSEL & ucPin) ? 2 : 0)); }
watterott/WebRadio
C++
null
71
/* Registers callback for the specified callback type. Associates the given callback function with the specified callback type. To enable the callback, the */
enum status_code rtc_calendar_register_callback(struct rtc_module *const module, rtc_calendar_callback_t callback, enum rtc_calendar_callback callback_type)
/* Registers callback for the specified callback type. Associates the given callback function with the specified callback type. To enable the callback, the */ enum status_code rtc_calendar_register_callback(struct rtc_module *const module, rtc_calendar_callback_t callback, enum rtc_calendar_callback callback_type)
{ enum status_code status = STATUS_OK; if (callback_type == RTC_CALENDAR_CALLBACK_OVERFLOW) { status = STATUS_OK; } else if (callback_type > RTC_NUM_OF_ALARMS) { status = STATUS_ERR_INVALID_ARG; } if (status == STATUS_OK) { module->callbacks[callback_type] = callback; module->registered_callback |= (1 << callback_type); } return status; }
memfault/zero-to-main
C++
null
200
/* If the reservation cannot be found and the DRP IE is from a peer attempting to establish a new reservation, create a new reservation and add it to the list. */
struct uwb_rsv* uwb_rsv_find(struct uwb_rc *rc, struct uwb_dev *src, struct uwb_ie_drp *drp_ie)
/* If the reservation cannot be found and the DRP IE is from a peer attempting to establish a new reservation, create a new reservation and add it to the list. */ struct uwb_rsv* uwb_rsv_find(struct uwb_rc *rc, struct uwb_dev *src, struct uwb_ie_drp *drp_ie)
{ struct uwb_rsv *rsv; list_for_each_entry(rsv, &rc->reservations, rc_node) { if (uwb_rsv_match(rsv, src, drp_ie)) return rsv; } if (uwb_ie_drp_owner(drp_ie)) return uwb_rsv_new_target(rc, src, drp_ie); return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Check the status of the Rx buffer of the specified SPI port. */
xtBoolean SPIIsRxFull(unsigned long ulBase)
/* Check the status of the Rx buffer of the specified SPI port. */ xtBoolean SPIIsRxFull(unsigned long ulBase)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE)||(ulBase == SPI3_BASE) ); return ((xHWREG(ulBase + SPI_CNTRL) & SPI_CNTRL_RX_FULL)? xtrue : xfalse); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Returns -1 in case of error, 0 otherwise */
int xmlBufSetInputBaseCur(xmlBufPtr buf, xmlParserInputPtr input, size_t base, size_t cur)
/* Returns -1 in case of error, 0 otherwise */ int xmlBufSetInputBaseCur(xmlBufPtr buf, xmlParserInputPtr input, size_t base, size_t cur)
{ if ((input == NULL) || (buf == NULL) || (buf->error)) return(-1); CHECK_COMPAT(buf) input->base = &buf->content[base]; input->cur = input->base + cur; input->end = &buf->content[buf->use]; return(0); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This code deviates from the documented sequence as follows: */
int main()
/* This code deviates from the documented sequence as follows: */ int main()
{ addr64 lscsa_ea; lscsa_ea.ui[0] = spu_readch(SPU_RdSigNotify1); lscsa_ea.ui[1] = spu_readch(SPU_RdSigNotify2); save_event_mask(); save_tag_mask(); set_event_mask(); set_tag_mask(); build_dma_list(lscsa_ea); save_upper_240kb(lscsa_ea); save_fpcr(); save_decr(); save_srr0(); enqueue_putllc(lscsa_ea); spill_regs_to_mem(lscsa_ea); enqueue_sync(lscsa_ea); set_tag_update(); read_tag_status(); read_llar_status(); save_complete(); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Open LIN mode on the specified UART. The */
void xUARTLINConfig(unsigned long ulBase, unsigned long ulBaud, unsigned long ulConfig)
/* Open LIN mode on the specified UART. The */ void xUARTLINConfig(unsigned long ulBase, unsigned long ulBaud, unsigned long ulConfig)
{ UARTLINConfig(ulBase, ulBaud, ulConfig); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* "memset" on IO memory space. This needs to be optimized. */
void _memset_io(void __iomem *dst, int c, size_t count)
/* "memset" on IO memory space. This needs to be optimized. */ void _memset_io(void __iomem *dst, int c, size_t count)
{ while (count) { count--; writeb(c, dst); dst++; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* It returns 0 if conversion is successful and *res is set to the converted value, otherwise it returns -EINVAL and *res is set to 0. */
int strict_strtol(const char *cp, unsigned int base, long *res)
/* It returns 0 if conversion is successful and *res is set to the converted value, otherwise it returns -EINVAL and *res is set to 0. */ int strict_strtol(const char *cp, unsigned int base, long *res)
{ int ret; if (*cp == '-') { ret = strict_strtoul(cp + 1, base, (unsigned long *)res); if (!ret) *res = -(*res); } else { ret = strict_strtoul(cp, base, (unsigned long *)res); } return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Checks whether the LCD start of new frame flag is set or not. */
FlagStatus LCD_GetFlagStatus(void)
/* Checks whether the LCD start of new frame flag is set or not. */ FlagStatus LCD_GetFlagStatus(void)
{ FlagStatus status = RESET; if ((LCD->CR3 & (uint8_t)LCD_CR3_SOF) != (uint8_t)RESET) { status = SET; } else { status = RESET; } return status; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Calculate block index based on data buffer pointer and validate it. */
static int buffer_to_index_validate(const struct channel_config *ch_conf, const uint8_t *buffer, size_t *size)
/* Calculate block index based on data buffer pointer and validate it. */ static int buffer_to_index_validate(const struct channel_config *ch_conf, const uint8_t *buffer, size_t *size)
{ size_t block_index; uint8_t *expected; block_index = (buffer - ch_conf->blocks_ptr) / ch_conf->block_size; expected = buffer_from_index_validate(ch_conf, block_index, size, false); if (expected == NULL || expected != buffer) { LOG_ERR("Pointer invalid"); return -EINVAL; } return block_index; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Routine to be called from a workqueue. This routine increments the global variable */
void critical_rtn(struct k_work *unused)
/* Routine to be called from a workqueue. This routine increments the global variable */ void critical_rtn(struct k_work *unused)
{ volatile uint32_t x; ARG_UNUSED(unused); x = critical_var; critical_var = x + 1; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* param base SAI base pointer. param handle Pointer to the sai_handle_t structure which stores the transfer state. param count Bytes count sent. retval kStatus_Success Succeed get the transfer count. retval kStatus_NoTransferInProgress There is not a non-blocking transaction currently in progress. */
status_t SAI_TransferGetSendCount(I2S_Type *base, sai_handle_t *handle, size_t *count)
/* param base SAI base pointer. param handle Pointer to the sai_handle_t structure which stores the transfer state. param count Bytes count sent. retval kStatus_Success Succeed get the transfer count. retval kStatus_NoTransferInProgress There is not a non-blocking transaction currently in progress. */ status_t SAI_TransferGetSendCount(I2S_Type *base, sai_handle_t *handle, size_t *count)
{ assert(handle != NULL); status_t status = kStatus_Success; uint32_t queueDriverIndex = handle->queueDriver; if (handle->state != (uint32_t)kSAI_Busy) { status = kStatus_NoTransferInProgress; } else { *count = (handle->transferSize[queueDriverIndex] - handle->saiQueue[queueDriverIndex].dataSize); } return status; }
eclipse-threadx/getting-started
C++
Other
310
/* Returns the size of the ITS Group node. */
STATIC UINT32 GetItsGroupNodeSize(IN CONST CM_ARM_ITS_GROUP_NODE *Node)
/* Returns the size of the ITS Group node. */ STATIC UINT32 GetItsGroupNodeSize(IN CONST CM_ARM_ITS_GROUP_NODE *Node)
{ ASSERT (Node != NULL); return (UINT32)(sizeof (EFI_ACPI_6_0_IO_REMAPPING_ITS_NODE) + (Node->ItsIdCount * sizeof (UINT32))); }
tianocore/edk2
C++
Other
4,240
/* Before you start, select your target, on the right of the "Load" button */
int main(void)
/* Before you start, select your target, on the right of the "Load" button */ int main(void)
{ if (TM_USB_HIDDEVICE_GetStatus() == TM_USB_HIDDEVICE_Status_Connected) { TM_DISCO_LedOn(LED_GREEN); if (TM_DISCO_ButtonPressed() && already == 0) { already = 1; Keyboard.L_GUI = TM_USB_HIDDEVICE_Button_Pressed; Keyboard.Key1 = 0x15; TM_USB_HIDDEVICE_KeyboardSend(&Keyboard); } else if (!TM_DISCO_ButtonPressed() && already == 1) { already = 0; Keyboard.L_GUI = TM_USB_HIDDEVICE_Button_Released; Keyboard.Key1 = 0x00; TM_USB_HIDDEVICE_KeyboardSend(&Keyboard); } } else { TM_DISCO_LedOff(LED_GREEN); } } }
MaJerle/stm32f429
C++
null
2,036
/* Computes the 32-bit CRC of a given data word(32-bit). */
uint32_t CRC32_CalcCrc(uint32_t Data)
/* Computes the 32-bit CRC of a given data word(32-bit). */ uint32_t CRC32_CalcCrc(uint32_t Data)
{ CRC->CRC32DAT = Data; return (CRC->CRC32DAT); }
pikasTech/PikaPython
C++
MIT License
1,403
/* gcov_iter_start - reset file iterator to starting position @iter: file iterator */
void gcov_iter_start(struct gcov_iterator *iter)
/* gcov_iter_start - reset file iterator to starting position @iter: file iterator */ void gcov_iter_start(struct gcov_iterator *iter)
{ int i; iter->record = 0; iter->function = 0; iter->type = 0; iter->count = 0; iter->num_types = 0; for (i = 0; i < GCOV_COUNTERS; i++) { if (counter_active(iter->info, i)) { iter->type_info[iter->num_types].ctr_type = i; iter->type_info[iter->num_types++].offset = 0; } } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return: 0 on success or a negative error code on failure. */
int mipi_dsi_dcs_soft_reset(struct mipi_dsi_device *dsi)
/* Return: 0 on success or a negative error code on failure. */ int mipi_dsi_dcs_soft_reset(struct mipi_dsi_device *dsi)
{ ssize_t err; err = mipi_dsi_dcs_write(dsi, MIPI_DCS_SOFT_RESET, NULL, 0); if (err < 0) return err; return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Wi-Fi no operating system layer callback. Callback function passed to radio module to be called when a ESP8266 event occurs. */
void adi_wifi_NoosCallback(void *pCBParam, uint32_t Event, void *pArg)
/* Wi-Fi no operating system layer callback. Callback function passed to radio module to be called when a ESP8266 event occurs. */ void adi_wifi_NoosCallback(void *pCBParam, uint32_t Event, void *pArg)
{ switch(Event){ case ADI_UART_EVENT_RX_DATA: gbEventHappened = 1u; break; case ADI_UART_EVENT_HW_ERROR_DETECTED: gnHardwareError = (uint32_t) pArg; break; default: break; } }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Returns: a string containing the file system type. */
const gchar* g_unix_mount_point_get_fs_type(GUnixMountPoint *mount_point)
/* Returns: a string containing the file system type. */ const gchar* g_unix_mount_point_get_fs_type(GUnixMountPoint *mount_point)
{ g_return_val_if_fail (mount_point != NULL, NULL); return mount_point->filesystem_type; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Write a data buffer to internal Flash. Note that we need for this function to reside in RAM since it will be used to self-upgrade U-boot in internal Flash. */
u32 __attribute__((section(".ramcode")))
/* Write a data buffer to internal Flash. Note that we need for this function to reside in RAM since it will be used to self-upgrade U-boot in internal Flash. */ u32 __attribute__((section(".ramcode")))
{ iap_commands[0] = IAP_CMD_PREP_SECTORS; iap_commands[1] = start; iap_commands[2] = end; lpc178x_iap_entry(iap_commands, iap_results); return iap_results[0]; }
EmcraftSystems/u-boot
C++
Other
181
/* Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
VOID* EFIAPI AllocateReservedPool(IN UINTN AllocationSize)
/* Allocates the number bytes specified by AllocationSize of type EfiReservedMemoryType and returns a pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */ VOID* EFIAPI AllocateReservedPool(IN UINTN AllocationSize)
{ VOID *Buffer; Buffer = InternalAllocatePool (EfiReservedMemoryType, AllocationSize); if (Buffer != NULL) { MemoryProfileLibRecord ( (PHYSICAL_ADDRESS)(UINTN)RETURN_ADDRESS (0), MEMORY_PROFILE_ACTION_LIB_ALLOCATE_RESERVED_POOL, EfiReservedMemoryType, Buffer, AllocationSize, NULL ); } return Buffer; }
tianocore/edk2
C++
Other
4,240
/* There is just one file remaining in the Host. */
__init int init_pagetables(struct page **switcher_page, unsigned int pages)
/* There is just one file remaining in the Host. */ __init int init_pagetables(struct page **switcher_page, unsigned int pages)
{ unsigned int i; for_each_possible_cpu(i) { switcher_pte_page(i) = (pte_t *)get_zeroed_page(GFP_KERNEL); if (!switcher_pte_page(i)) { free_switcher_pte_pages(); return -ENOMEM; } populate_switcher_pte_page(i, switcher_page, pages); } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Get the I2C wake-up flag of the specified I2C port. The */
xtBoolean I2CWakeupStatusGet(unsigned long ulBase)
/* Get the I2C wake-up flag of the specified I2C port. The */ xtBoolean I2CWakeupStatusGet(unsigned long ulBase)
{ return xHWREG(ulBase + I2C_WKSTS_I2CWKF) ? 1 : 0; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Lock a surface to directly access the pixels */
int SDL_LockSurface(SDL_Surface *surface)
/* Lock a surface to directly access the pixels */ int SDL_LockSurface(SDL_Surface *surface)
{ if ( ! surface->locked ) { if ( surface->flags & (SDL_HWSURFACE|SDL_ASYNCBLIT) ) { SDL_VideoDevice *video = current_video; SDL_VideoDevice *this = current_video; if ( video->LockHWSurface(this, surface) < 0 ) { return(-1); } } if ( surface->flags & SDL_RLEACCEL ) { SDL_UnRLESurface(surface, 1); surface->flags |= SDL_RLEACCEL; } surface->pixels = (Uint8 *)surface->pixels + surface->offset; } ++surface->locked; return(0); }
DC-SWAT/DreamShell
C++
null
404
/* LPRCNT module can work in two mode.this is LPRCNT mode and calibration mode . */
void LPRCNT_CompInit(LPRCNT_COMP_InitType *COMP_InitStruct)
/* LPRCNT module can work in two mode.this is LPRCNT mode and calibration mode . */ void LPRCNT_CompInit(LPRCNT_COMP_InitType *COMP_InitStruct)
{ uint32_t Temp ; Temp = LPRCNT->CAL3; Temp &= (~LPRCNT_CAL3_CMP_HYSEL); Temp |= COMP_InitStruct->Hyst; Temp &= (~LPRCNT_CAL3_CMP_INMSEL); Temp |= COMP_InitStruct->InmSel; Temp |= COMP_InitStruct->LowPoweMode; LPRCNT->CAL3 = Temp; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This file is part of the Simba project. */
int mock_write_spiffs_probe_fs(struct spiffs_config_t *config_p, int32_t res)
/* This file is part of the Simba project. */ int mock_write_spiffs_probe_fs(struct spiffs_config_t *config_p, int32_t res)
{ harness_mock_write("spiffs_probe_fs(config_p)", config_p, sizeof(*config_p)); harness_mock_write("spiffs_probe_fs(): return (res)", &res, sizeof(res)); return (0); }
eerimoq/simba
C++
Other
337
/* Exit a program without cleaning up files. If your system doesn't provide this, it is best to avoid linking with subroutines that require it (exit, system). */
void _exit(int n)
/* Exit a program without cleaning up files. If your system doesn't provide this, it is best to avoid linking with subroutines that require it (exit, system). */ void _exit(int n)
{ printf("#! exit %i: resetting\n", n); reboot(n); while(1); }
labapart/polymcu
C++
null
201
/* Given the 'reg' portion of a ModRM byte, and a register block, return a pointer into the block that addresses the relevant register. @highbyte_regs specifies whether to decode AH,CH,DH,BH. */
static void* decode_register(u8 modrm_reg, unsigned long *regs, int highbyte_regs)
/* Given the 'reg' portion of a ModRM byte, and a register block, return a pointer into the block that addresses the relevant register. @highbyte_regs specifies whether to decode AH,CH,DH,BH. */ static void* decode_register(u8 modrm_reg, unsigned long *regs, int highbyte_regs)
{ void *p; p = &regs[modrm_reg]; if (highbyte_regs && modrm_reg >= 4 && modrm_reg < 8) p = (unsigned char *)&regs[modrm_reg & 3] + 1; return p; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* ADC MSP Initialization This function configures the hardware resources used in this example. */
void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)
/* ADC MSP Initialization This function configures the hardware resources used in this example. */ void HAL_ADC_MspInit(ADC_HandleTypeDef *hadc)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(hadc->Instance==ADC1) { __HAL_RCC_ADC1_CLK_ENABLE(); __HAL_RCC_GPIOC_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_0|GPIO_PIN_1; GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* returns: 0 on success Negative error code on failure */
static int overlay_update_local_references(void *fdto, uint32_t delta)
/* returns: 0 on success Negative error code on failure */ static int overlay_update_local_references(void *fdto, uint32_t delta)
{ int fixups; fixups = fdt_path_offset(fdto, "/__local_fixups__"); if (fixups < 0) { if (fixups == -FDT_ERR_NOTFOUND) return 0; return fixups; } return overlay_update_local_node_references(fdto, 0, fixups, delta); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* driver_create_file - create sysfs file for driver. @drv: driver. @attr: driver attribute descriptor. */
int driver_create_file(struct device_driver *drv, const struct driver_attribute *attr)
/* driver_create_file - create sysfs file for driver. @drv: driver. @attr: driver attribute descriptor. */ int driver_create_file(struct device_driver *drv, const struct driver_attribute *attr)
{ int error; if (drv) error = sysfs_create_file(&drv->p->kobj, &attr->attr); else error = -EINVAL; return error; }
robutest/uclinux
C++
GPL-2.0
60
/* This API configure the interrupt PIN setting for tap interrupt. */
static int8_t config_tap_int_settg(const struct bmi160_int_settg *int_config, const struct bmi160_acc_tap_int_cfg *tap_int_cfg, const struct bmi160_dev *dev)
/* This API configure the interrupt PIN setting for tap interrupt. */ static int8_t config_tap_int_settg(const struct bmi160_int_settg *int_config, const struct bmi160_acc_tap_int_cfg *tap_int_cfg, const struct bmi160_dev *dev)
{ int8_t rslt; rslt = set_intr_pin_config(int_config, dev); if (rslt == BMI160_OK) { rslt = map_feature_interrupt(int_config, dev); if (rslt == BMI160_OK) { rslt = config_tap_data_src(tap_int_cfg, dev); if (rslt == BMI160_OK) { rslt = config_tap_param(int_config, tap_int_cfg, dev); } } } return rslt; }
eclipse-threadx/getting-started
C++
Other
310
/* Add a Wireless Protocol selector to a mapping */
static int mapping_addiwproto(struct if_mapping *ifnode, int *active, char *pos, size_t len, struct add_extra *extra, int linenum)
/* Add a Wireless Protocol selector to a mapping */ static int mapping_addiwproto(struct if_mapping *ifnode, int *active, char *pos, size_t len, struct add_extra *extra, int linenum)
{ extra = extra; if(len >= sizeof(ifnode->iwproto)) { fprintf(stderr, "Wireless Protocol too long at line %d\n", linenum); return(-1); } memcpy(ifnode->iwproto, string, len + 1); ifnode->active[SELECT_IWPROTO] = 1; active[SELECT_IWPROTO] = 1; if(verbose) fprintf(stderr, "Parsing : Added Wireless Protocol `%s' from line %d.\n", ifnode->iwproto, linenum); return(0); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Gets the current interrupt status of the Hibernation module. */
uint32_t HibernateIntStatus(bool bMasked)
/* Gets the current interrupt status of the Hibernation module. */ uint32_t HibernateIntStatus(bool bMasked)
{ if(bMasked == true) { return(HWREG(HIB_MIS)); } else { return(HWREG(HIB_RIS)); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* RETURNS: An appropriate -ERRNO error value on error, or zero for success. */
int pci_set_mwi(struct pci_dev *dev)
/* RETURNS: An appropriate -ERRNO error value on error, or zero for success. */ int pci_set_mwi(struct pci_dev *dev)
{ int rc; u16 cmd; rc = pci_set_cacheline_size(dev); if (rc) return rc; pci_read_config_word(dev, PCI_COMMAND, &cmd); if (! (cmd & PCI_COMMAND_INVALIDATE)) { dev_dbg(&dev->dev, "enabling Mem-Wr-Inval\n"); cmd |= PCI_COMMAND_INVALIDATE; pci_write_config_word(dev, PCI_COMMAND, cmd); } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* userData handle LPUART handle pointer. return Length of received data in RX ring buffer. */
size_t LPUART_TransferGetRxRingBufferLength(LPUART_Type *base, lpuart_handle_t *handle)
/* userData handle LPUART handle pointer. return Length of received data in RX ring buffer. */ size_t LPUART_TransferGetRxRingBufferLength(LPUART_Type *base, lpuart_handle_t *handle)
{ assert(NULL != handle); size_t size; size_t tmpRxRingBufferSize = handle->rxRingBufferSize; uint16_t tmpRxRingBufferTail = handle->rxRingBufferTail; uint16_t tmpRxRingBufferHead = handle->rxRingBufferHead; if (tmpRxRingBufferTail > tmpRxRingBufferHead) { size = ((size_t)tmpRxRingBufferHead + tmpRxRingBufferSize - (size_t)tmpRxRingBufferTail); } else { size = ((size_t)tmpRxRingBufferHead - (size_t)tmpRxRingBufferTail); } return size; }
eclipse-threadx/getting-started
C++
Other
310
/* Clears or safeguards the OCREF4 signal on an external event. */
void TIM_ClearOC4Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear)
/* Clears or safeguards the OCREF4 signal on an external event. */ void TIM_ClearOC4Ref(TIM_TypeDef *TIMx, uint16_t TIM_OCClear)
{ uint16_t tmpccmr2 = 0; assert_param(IS_TIM_123458_PERIPH(TIMx)); assert_param(IS_TIM_OCCLEAR_STATE(TIM_OCClear)); tmpccmr2 = TIMx->CCMR2; tmpccmr2 &= CCMR_OC24CE_Reset; tmpccmr2 |= (uint16_t)(TIM_OCClear << 8); TIMx->CCMR2 = tmpccmr2; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return Value: returns pointer to cmd block or NULL if no blocks are available */
static struct pmcraid_cmd* pmcraid_get_free_cmd(struct pmcraid_instance *pinstance)
/* Return Value: returns pointer to cmd block or NULL if no blocks are available */ static struct pmcraid_cmd* pmcraid_get_free_cmd(struct pmcraid_instance *pinstance)
{ struct pmcraid_cmd *cmd = NULL; unsigned long lock_flags; spin_lock_irqsave(&pinstance->free_pool_lock, lock_flags); if (!list_empty(&pinstance->free_cmd_pool)) { cmd = list_entry(pinstance->free_cmd_pool.next, struct pmcraid_cmd, free_list); list_del(&cmd->free_list); } spin_unlock_irqrestore(&pinstance->free_pool_lock, lock_flags); if (cmd != NULL) pmcraid_reinit_cmdblk(cmd); return cmd; }
robutest/uclinux
C++
GPL-2.0
60
/* Enables or disables the PEC value calculation of the transferred bytes. */
void I2C_ComputePec(I2C_Module *I2Cx, FunctionalState Cmd)
/* Enables or disables the PEC value calculation of the transferred bytes. */ void I2C_ComputePec(I2C_Module *I2Cx, FunctionalState Cmd)
{ assert_param(IS_I2C_PERIPH(I2Cx)); assert_param(IS_FUNCTIONAL_STATE(Cmd)); if (Cmd != DISABLE) { I2Cx->CTRL1 |= CTRL1_PECEN_SET; } else { I2Cx->CTRL1 &= CTRL1_PECEN_RESET; } }
pikasTech/PikaPython
C++
MIT License
1,403
/* Compare two strings 'ls' x 'rs', returning an integer smaller-equal- -larger than zero if 'ls' is smaller-equal-larger than 'rs'. Stripped down version for NodeMCU without locales support */
static int l_strcmp(const TString *ls, const TString *rs)
/* Compare two strings 'ls' x 'rs', returning an integer smaller-equal- -larger than zero if 'ls' is smaller-equal-larger than 'rs'. Stripped down version for NodeMCU without locales support */ static int l_strcmp(const TString *ls, const TString *rs)
{ return 0; } else { size_t ll = tsslen(ls); size_t lr = tsslen(rs); size_t lm = ll<lr ? ll : lr; int s = memcmp(l, r, lm); return s ? s : (lr == lm ? (ll == lm ? 0 : 1) : -1); } }
nodemcu/nodemcu-firmware
C++
MIT License
7,566
/* Converts a text device path node to USB smart card device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbSmartCard(IN CHAR16 *TextDeviceNode)
/* Converts a text device path node to USB smart card device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextUsbSmartCard(IN CHAR16 *TextDeviceNode)
{ USB_CLASS_TEXT UsbClassText; UsbClassText.ClassExist = FALSE; UsbClassText.Class = USB_CLASS_SMART_CARD; UsbClassText.SubClassExist = TRUE; return ConvertFromTextUsbClass (TextDeviceNode, &UsbClassText); }
tianocore/edk2
C++
Other
4,240
/* This is useful for such things as Map names which can only be letters and numbers. */
BOOLEAN IsNumberLetterOnly(IN CONST CHAR16 *String, IN CONST UINTN Len)
/* This is useful for such things as Map names which can only be letters and numbers. */ BOOLEAN IsNumberLetterOnly(IN CONST CHAR16 *String, IN CONST UINTN Len)
{ UINTN Count; for (Count = 0; Count < Len && String != NULL && *String != CHAR_NULL; String++, Count++) { if (!(((*String >= L'a') && (*String <= L'z')) || ((*String >= L'A') && (*String <= L'Z')) || ((*String >= L'0') && (*String <= L'9'))) ) { return (FALSE); } } return (TRUE); }
tianocore/edk2
C++
Other
4,240
/* Enables a PCI driver to access PCI controller registers in the PCI root bridge I/O space. */
EFI_STATUS EFIAPI RootBridgeIoIoWrite(IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width, IN UINT64 Address, IN UINTN Count, IN VOID *Buffer)
/* Enables a PCI driver to access PCI controller registers in the PCI root bridge I/O space. */ EFI_STATUS EFIAPI RootBridgeIoIoWrite(IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width, IN UINT64 Address, IN UINTN Count, IN VOID *Buffer)
{ EFI_STATUS Status; PCI_ROOT_BRIDGE_INSTANCE *RootBridge; Status = RootBridgeIoCheckParameter ( This, IoOperation, Width, Address, Count, Buffer ); if (EFI_ERROR (Status)) { return Status; } RootBridge = ROOT_BRIDGE_FROM_THIS (This); return mCpuIo->Io.Write ( mCpuIo, (EFI_CPU_IO_PROTOCOL_WIDTH)Width, TO_HOST_ADDRESS (Address, RootBridge->Io.Translation), Count, Buffer ); }
tianocore/edk2
C++
Other
4,240
/* The hash bucket lock must be held when this is called. Afterwards, the */
static void wake_futex(struct futex_q *q)
/* The hash bucket lock must be held when this is called. Afterwards, the */ static void wake_futex(struct futex_q *q)
{ struct task_struct *p = q->task; get_task_struct(p); plist_del(&q->list, &q->list.plist); smp_wmb(); q->lock_ptr = NULL; wake_up_state(p, TASK_NORMAL); put_task_struct(p); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Disables the flash ready interrupt source on the EEFC peripheral. */
void EFC_DisableFrdyIt(AT91S_EFC *pEfc)
/* Disables the flash ready interrupt source on the EEFC peripheral. */ void EFC_DisableFrdyIt(AT91S_EFC *pEfc)
{ pEfc->EFC_FMR &= ~AT91C_EFC_FRDY; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* See "mss_ace.h" for details of how to use this function. */
void ACE_enable_comp_fall_irq(comparator_id_t comp_id)
/* See "mss_ace.h" for details of how to use this function. */ void ACE_enable_comp_fall_irq(comparator_id_t comp_id)
{ ASSERT( comp_id < NB_OF_COMPARATORS ); ACE->COMP_IRQ_EN |= (FIRST_FALL_IRQ_MASK << (uint32_t)comp_id); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* ATA reset will clear the 16 bits mode in the control register, we need to reprogram it */
static void sl82c105_resetproc(ide_drive_t *drive)
/* ATA reset will clear the 16 bits mode in the control register, we need to reprogram it */ static void sl82c105_resetproc(ide_drive_t *drive)
{ struct pci_dev *dev = to_pci_dev(drive->hwif->dev); u32 val; pci_read_config_dword(dev, 0x40, &val); val |= (CTRL_P1F16 | CTRL_P0F16); pci_write_config_dword(dev, 0x40, val); }
robutest/uclinux
C++
GPL-2.0
60
/* We have transfered a single byte (PIO mode?) and need to update the count of bytes remaining (total_xfer_length) and update the sg entry to either point to next byte in the current sg entry, or of already at the end to point to the start of the next sg entry */
static void sg_subtract_one(struct ScsiReqBlk *srb)
/* We have transfered a single byte (PIO mode?) and need to update the count of bytes remaining (total_xfer_length) and update the sg entry to either point to next byte in the current sg entry, or of already at the end to point to the start of the next sg entry */ static void sg_subtract_one(struct ScsiReqBlk *srb)
{ sg_update_list(srb, srb->total_xfer_length - 1); }
robutest/uclinux
C++
GPL-2.0
60