docstring
stringlengths
22
576
signature
stringlengths
9
317
prompt
stringlengths
57
886
code
stringlengths
20
1.36k
repository
stringclasses
49 values
language
stringclasses
2 values
license
stringclasses
9 values
stars
int64
15
21.3k
/* This function configures system clock at maximum frequency with HSI as clock source of the PLL. */
ErrorStatus LL_PLL_ConfigSystemClock_HSI(LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct, LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct)
/* This function configures system clock at maximum frequency with HSI as clock source of the PLL. */ ErrorStatus LL_PLL_ConfigSystemClock_HSI(LL_UTILS_PLLInitTypeDef *UTILS_PLLInitStruct, LL_UTILS_ClkInitTypeDef *UTILS_ClkInitStruct)
{ ErrorStatus status = SUCCESS; uint32_t pllfreq = 0U; if(UTILS_PLL_IsBusy() == SUCCESS) { pllfreq = UTILS_GetPLLOutputFrequency(HSI_VALUE, UTILS_PLLInitStruct); if(LL_RCC_HSI_IsReady() != 1U) { LL_RCC_HSI_Enable(); while (LL_RCC_HSI_IsReady() != 1U) { } } LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSI, UTILS_PLLInitStruct->PLLM, UTILS_PLLInitStruct->PLLN, UTILS_PLLInitStruct->PLLP); status = UTILS_EnablePLLAndSwitchSystem(pllfreq, UTILS_ClkInitStruct); } else { status = ERROR; } return status; }
ua1arn/hftrx
C++
null
69
/* ADC Set the Sample Time for All Channels. The sampling time can be selected in ADC clock cycles from 1.5 to 239.5, same for all channels. */
void adc_set_sample_time_on_all_channels(uint32_t adc, uint8_t time)
/* ADC Set the Sample Time for All Channels. The sampling time can be selected in ADC clock cycles from 1.5 to 239.5, same for all channels. */ void adc_set_sample_time_on_all_channels(uint32_t adc, uint8_t time)
{ uint8_t i; uint32_t reg32 = 0; for (i = 0; i <= 9; i++) { reg32 |= (time << (i * 3)); } ADC_SMPR2(adc) = reg32; for (i = 10; i <= 17; i++) { reg32 |= (time << ((i - 10) * 3)); } ADC_SMPR1(adc) = reg32; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Skip forward the specified number of bytes in the file. Currently implemented as a wrapper around file_seek(), but if, for example, we ever add support for reading sequentially from a pipe, this could instead just skip forward by reading the bytes in question. */
gboolean file_skip(FILE_T file, gint64 delta, int *err)
/* Skip forward the specified number of bytes in the file. Currently implemented as a wrapper around file_seek(), but if, for example, we ever add support for reading sequentially from a pipe, this could instead just skip forward by reading the bytes in question. */ gboolean file_skip(FILE_T file, gint64 delta, int *err)
{ if (file_seek(file, delta, SEEK_CUR, err) == -1) return FALSE; return TRUE; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Hand back a free slot if we changed our mind. */
static void via_dmablit_release_slot(drm_via_blitq_t *blitq)
/* Hand back a free slot if we changed our mind. */ static void via_dmablit_release_slot(drm_via_blitq_t *blitq)
{ unsigned long irqsave; spin_lock_irqsave(&blitq->blit_lock, irqsave); blitq->num_free++; spin_unlock_irqrestore(&blitq->blit_lock, irqsave); DRM_WAKEUP( &blitq->busy_queue ); }
robutest/uclinux
C++
GPL-2.0
60
/* Calculate Synchronous Transfer Register value from SDTR code. */
static uchar calc_sync_xfer(unsigned int period, unsigned int offset, unsigned int fast, const struct sx_period *sx_table)
/* Calculate Synchronous Transfer Register value from SDTR code. */ static uchar calc_sync_xfer(unsigned int period, unsigned int offset, unsigned int fast, const struct sx_period *sx_table)
{ uchar result; if (offset && fast) { fast = STR_FSS; period *= 2; } else { fast = 0; } period *= 4; result = sx_table[round_period(period,sx_table)].reg_value; result |= (offset < OPTIMUM_SX_OFF) ? offset : OPTIMUM_SX_OFF; result |= fast; return result; }
robutest/uclinux
C++
GPL-2.0
60
/* Selects the clock source to output on MCO pin. */
void RCC_MCOConfig(uint8_t RCC_MCO)
/* Selects the clock source to output on MCO pin. */ void RCC_MCOConfig(uint8_t RCC_MCO)
{ assert_param(IS_RCC_MCO(RCC_MCO)); RCC->CFGR &= 0xF8FFFFFF; RCC->CFGR |= (RCC_MCO<<24); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param base USART peripheral base address. param handle USART handle pointer. param count Sent bytes count. retval kStatus_NoTransferInProgress No receive in progress. retval kStatus_InvalidArgument Parameter is invalid. retval kStatus_Success Get successfully through the parameter */
status_t USART_TransferGetSendCountDMA(USART_Type *base, usart_dma_handle_t *handle, uint32_t *count)
/* param base USART peripheral base address. param handle USART handle pointer. param count Sent bytes count. retval kStatus_NoTransferInProgress No receive in progress. retval kStatus_InvalidArgument Parameter is invalid. retval kStatus_Success Get successfully through the parameter */ status_t USART_TransferGetSendCountDMA(USART_Type *base, usart_dma_handle_t *handle, uint32_t *count)
{ assert(NULL != handle); assert(NULL != handle->txDmaHandle); assert(NULL != count); if ((uint8_t)kUSART_TxIdle == handle->txState) { return kStatus_NoTransferInProgress; } *count = handle->txDataSizeAll - DMA_GetRemainingBytes(handle->txDmaHandle->base, handle->txDmaHandle->channel); return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function has no effect on non-periodic transfers */
static void dwc2_hc_set_even_odd_frame(struct dwc2_hsotg *hsotg, struct dwc2_host_chan *chan, u32 *hcchar)
/* This function has no effect on non-periodic transfers */ static void dwc2_hc_set_even_odd_frame(struct dwc2_hsotg *hsotg, struct dwc2_host_chan *chan, u32 *hcchar)
{ if (chan->ep_type == USB_ENDPOINT_XFER_INT || chan->ep_type == USB_ENDPOINT_XFER_ISOC) { if (!(dwc2_hcd_get_frame_number(hsotg) & 0x1)) *hcchar |= HCCHAR_ODDFRM; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Cancel all queued packets in the transmission queue. */
static void tms380tr_cancel_tx_queue(struct net_local *tp)
/* Cancel all queued packets in the transmission queue. */ static void tms380tr_cancel_tx_queue(struct net_local *tp)
{ TPL *tpl; if(tp->TransmitCommandActive) return; for(;;) { tpl = tp->TplBusy; if(!tpl->BusyFlag) break; tp->TplBusy = tpl->NextTPLPtr; tms380tr_write_tpl_status(tpl, 0); tpl->BusyFlag = 0; printk(KERN_INFO "Cancel tx (%08lXh).\n", (unsigned long)tpl); if (tpl->DMABuff) dma_unmap_single(tp->pdev, tpl->DMABuff, tpl->Skb->len, DMA_TO_DEVICE); dev_kfree_skb_any(tpl->Skb); } return; }
robutest/uclinux
C++
GPL-2.0
60
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */
int main(void)
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */ int main(void)
{ SetupHardware(); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); GlobalInterruptEnable(); while (RunBootloader) { uint8_t BytesReceived = PRNT_Device_BytesReceived(&TextOnly_Printer_Interface); if (BytesReceived) { LEDs_SetAllLEDs(LEDMASK_USB_BUSY); while (BytesReceived--) { int16_t ReceivedByte = PRNT_Device_ReceiveByte(&TextOnly_Printer_Interface); ParseIntelHEXByte(ReceivedByte); } LEDs_SetAllLEDs(LEDMASK_USB_READY); } PRNT_Device_USBTask(&TextOnly_Printer_Interface); USB_USBTask(); } _delay_us(1000); USB_Detach(); MagicBootKey = MAGIC_BOOT_KEY; wdt_enable(WDTO_250MS); for (;;); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* This function fetches the SSID the device is connected to. */
int32_t getDeviceSSID(void)
/* This function fetches the SSID the device is connected to. */ int32_t getDeviceSSID(void)
{ uint16_t len = 32; uint16_t config_opt = SL_WLAN_AP_OPT_SSID; if (GET_STATUS_BIT(nF_ControlBlock.Status, AppStatusBits_IpAcquired) && GET_STATUS_BIT(nF_ControlBlock.Status, AppStatusBits_Connection)) { } else if ( GET_STATUS_BIT(nF_ControlBlock.Status, AppStatusBits_IpAcquired) && GET_STATUS_BIT(nF_ControlBlock.Status, AppStatusBits_IpLeased)) { } else { return (-1); } return (0); }
nanoframework/nf-interpreter
C++
MIT License
293
/* Puts string into buffer, replacing each occurrence of character from @esc with usual octal escape. Returns 0 in case of success, -1 - in case of overflow. */
int seq_escape(struct seq_file *m, const char *s, const char *esc)
/* Puts string into buffer, replacing each occurrence of character from @esc with usual octal escape. Returns 0 in case of success, -1 - in case of overflow. */ int seq_escape(struct seq_file *m, const char *s, const char *esc)
{ char *end = m->buf + m->size; char *p; char c; for (p = m->buf + m->count; (c = *s) != '\0' && p < end; s++) { if (!strchr(esc, c)) { *p++ = c; continue; } if (p + 3 < end) { *p++ = '\\'; *p++ = '0' + ((c & 0300) >> 6); *p++ = '0' + ((c & 070) >> 3); *p++ = '0' + (c & 07); continue; } m->count = m->size; return -1; } m->count = p - m->buf; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* param base Pointer to the FLEXIO_SPI_Type structure. param handle Pointer to the flexio_spi_master_handle_t structure to store the transfer state. */
void FLEXIO_SPI_MasterTransferAbort(FLEXIO_SPI_Type *base, flexio_spi_master_handle_t *handle)
/* param base Pointer to the FLEXIO_SPI_Type structure. param handle Pointer to the flexio_spi_master_handle_t structure to store the transfer state. */ void FLEXIO_SPI_MasterTransferAbort(FLEXIO_SPI_Type *base, flexio_spi_master_handle_t *handle)
{ assert(handle); FLEXIO_SPI_DisableInterrupts(base, kFLEXIO_SPI_RxFullInterruptEnable); FLEXIO_SPI_DisableInterrupts(base, kFLEXIO_SPI_TxEmptyInterruptEnable); handle->state = kFLEXIO_SPI_Idle; handle->rxRemainingBytes = 0; handle->txRemainingBytes = 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Unlock the Option Byte Access This enables write access to the option bytes. It is locked by default on reset. */
void flash_unlock_option_bytes(void)
/* Unlock the Option Byte Access This enables write access to the option bytes. It is locked by default on reset. */ void flash_unlock_option_bytes(void)
{ FLASH_CR |= FLASH_CR_OPTLOCK; FLASH_OPTKEYR = FLASH_OPTKEYR_KEY1; FLASH_OPTKEYR = FLASH_OPTKEYR_KEY2; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Function for computing the difference between two RTC1 counter values. */
static __INLINE uint32_t ticks_diff_get(uint32_t ticks_now, uint32_t ticks_old)
/* Function for computing the difference between two RTC1 counter values. */ static __INLINE uint32_t ticks_diff_get(uint32_t ticks_now, uint32_t ticks_old)
{ return ((ticks_now - ticks_old) & MAX_RTC_COUNTER_VAL); }
labapart/polymcu
C++
null
201
/* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
/* ADC MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_ADC_MspDeInit(ADC_HandleTypeDef *hadc)
{ if(hadc->Instance==ADC1) { __HAL_RCC_ADC_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOC, GPIO_PIN_0|GPIO_PIN_1); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_0|GPIO_PIN_1|GPIO_PIN_4); HAL_GPIO_DeInit(GPIOB, GPIO_PIN_0); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function is to clean some useless data before submit changes. */
VOID CleanUselessBeforeSubmit(IN BMM_CALLBACK_DATA *Private)
/* This function is to clean some useless data before submit changes. */ VOID CleanUselessBeforeSubmit(IN BMM_CALLBACK_DATA *Private)
{ UINT16 Index; if (Private->BmmPreviousPageId != FORM_BOOT_DEL_ID) { for (Index = 0; Index < BootOptionMenu.MenuNumber; Index++) { if (Private->BmmFakeNvData.BootOptionDel[Index] && !Private->BmmFakeNvData.BootOptionDelMark[Index]) { Private->BmmFakeNvData.BootOptionDel[Index] = FALSE; Private->BmmOldFakeNVData.BootOptionDel[Index] = FALSE; } } } if (Private->BmmPreviousPageId != FORM_DRV_DEL_ID) { for (Index = 0; Index < DriverOptionMenu.MenuNumber; Index++) { if (Private->BmmFakeNvData.DriverOptionDel[Index] && !Private->BmmFakeNvData.DriverOptionDelMark[Index]) { Private->BmmFakeNvData.DriverOptionDel[Index] = FALSE; Private->BmmOldFakeNVData.DriverOptionDel[Index] = FALSE; } } } }
tianocore/edk2
C++
Other
4,240
/* Function to get the common name from the X509 format certificate. The buffer is callee allocated and should be freed by the caller. */
EFI_STATUS GetCommonNameFromX509(IN EFI_SIGNATURE_LIST *ListEntry, IN EFI_SIGNATURE_DATA *DataEntry, OUT CHAR16 **BufferToReturn)
/* Function to get the common name from the X509 format certificate. The buffer is callee allocated and should be freed by the caller. */ EFI_STATUS GetCommonNameFromX509(IN EFI_SIGNATURE_LIST *ListEntry, IN EFI_SIGNATURE_DATA *DataEntry, OUT CHAR16 **BufferToReturn)
{ EFI_STATUS Status; CHAR8 *CNBuffer; UINTN CNBufferSize; Status = EFI_SUCCESS; CNBuffer = NULL; CNBuffer = AllocateZeroPool (256); if (CNBuffer == NULL) { Status = EFI_OUT_OF_RESOURCES; goto ON_EXIT; } CNBufferSize = 256; X509GetCommonName ( (UINT8 *)DataEntry + sizeof (EFI_GUID), ListEntry->SignatureSize - sizeof (EFI_GUID), CNBuffer, &CNBufferSize ); *BufferToReturn = AllocateZeroPool (256 * sizeof (CHAR16)); if (*BufferToReturn == NULL) { Status = EFI_OUT_OF_RESOURCES; goto ON_EXIT; } AsciiStrToUnicodeStrS (CNBuffer, *BufferToReturn, 256); ON_EXIT: SECUREBOOT_FREE_NON_NULL (CNBuffer); return Status; }
tianocore/edk2
C++
Other
4,240
/* Switch to a new mode. The parameters for it has been check already by omapfb_check_var. */
static int omapfb_set_par(struct fb_info *fbi)
/* Switch to a new mode. The parameters for it has been check already by omapfb_check_var. */ static int omapfb_set_par(struct fb_info *fbi)
{ struct omapfb_plane_struct *plane = fbi->par; struct omapfb_device *fbdev = plane->fbdev; int r = 0; omapfb_rqueue_lock(fbdev); set_fb_fix(fbi, 0); r = ctrl_change_mode(fbi); omapfb_rqueue_unlock(fbdev); return r; }
robutest/uclinux
C++
GPL-2.0
60
/* Changing to a different IDT is very rare: we keep the IDT up-to-date every time it is written, so we can simply loop through all entries and tell the Host about them. */
static void lguest_load_idt(const struct desc_ptr *desc)
/* Changing to a different IDT is very rare: we keep the IDT up-to-date every time it is written, so we can simply loop through all entries and tell the Host about them. */ static void lguest_load_idt(const struct desc_ptr *desc)
{ unsigned int i; struct desc_struct *idt = (void *)desc->address; for (i = 0; i < (desc->size+1)/8; i++) kvm_hypercall3(LHCALL_LOAD_IDT_ENTRY, i, idt[i].a, idt[i].b); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function is the main entry of usb hub thread, it is in charge of processing all messages received from the usb message buffer. */
static void rt_usbh_hub_thread_entry(void *parameter)
/* This function is the main entry of usb hub thread, it is in charge of processing all messages received from the usb message buffer. */ static void rt_usbh_hub_thread_entry(void *parameter)
{ uhcd_t hcd = (uhcd_t)parameter; while(1) { struct uhost_msg msg; if (rt_mq_recv(hcd->usb_mq, &msg, sizeof(struct uhost_msg), RT_WAITING_FOREVER) < 0) continue; switch (msg.type) { case USB_MSG_CONNECT_CHANGE: rt_usbh_hub_port_change(msg.content.hub); break; case USB_MSG_CALLBACK: msg.content.cb.function(msg.content.cb.context); break; default: break; } } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Unlocks the FLASH control register and program memory access. */
void FLASH_Unlock(void)
/* Unlocks the FLASH control register and program memory access. */ void FLASH_Unlock(void)
{ if((FLASH->CR & FLASH_CR_LOCK) != RESET) { FLASH->KEYR = FLASH_FKEY1; FLASH->KEYR = FLASH_FKEY2; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return a(x) multiplied by b(x) modulo p(x), where p(x) is the CRC polynomial, reflected. For speed, this requires that a not be zero. */
z_crc_t multmodp(z_crc_t a, z_crc_t b)
/* Return a(x) multiplied by b(x) modulo p(x), where p(x) is the CRC polynomial, reflected. For speed, this requires that a not be zero. */ z_crc_t multmodp(z_crc_t a, z_crc_t b)
{ z_crc_t m, p; m = (z_crc_t)1 << 31; p = 0; for (;;) { if (a & m) { p ^= b; if ((a & (m - 1)) == 0) break; } m >>= 1; b = b & 1 ? (b >> 1) ^ POLY : b >> 1; } return p; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Extracts an integer sub-field from an int with a given mask */
guint zbee_get_bit_field(guint input, guint mask)
/* Extracts an integer sub-field from an int with a given mask */ guint zbee_get_bit_field(guint input, guint mask)
{ if (mask == 0) return 0; while (!(mask & 0x1)) { input >>= 1; mask >>=1; } return (input & mask); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Translate date/time from Dos format to tm_unz (readable more easilty) */
void unz64local_DosDateToTmuDate(ZPOS64_T ulDosDate, tm_unz *ptm)
/* Translate date/time from Dos format to tm_unz (readable more easilty) */ void unz64local_DosDateToTmuDate(ZPOS64_T ulDosDate, tm_unz *ptm)
{ ZPOS64_T uDate; uDate = (ZPOS64_T)(ulDosDate>>16); ptm->tm_mday = (uInt)(uDate&0x1f) ; ptm->tm_mon = (uInt)((((uDate)&0x1E0)/0x20)-1) ; ptm->tm_year = (uInt)(((uDate&0x0FE00)/0x0200)+1980) ; ptm->tm_hour = (uInt) ((ulDosDate &0xF800)/0x800); ptm->tm_min = (uInt) ((ulDosDate&0x7E0)/0x20) ; ptm->tm_sec = (uInt) (2*(ulDosDate&0x1f)) ; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Returns 0 on success or negative error code on failure. */
static int __init i2o_proc_fs_create(void)
/* Returns 0 on success or negative error code on failure. */ static int __init i2o_proc_fs_create(void)
{ struct i2o_controller *c; i2o_proc_dir_root = proc_mkdir("i2o", NULL); if (!i2o_proc_dir_root) return -1; list_for_each_entry(c, &i2o_controllers, list) i2o_proc_iop_add(i2o_proc_dir_root, c); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* get_power_status - get power status of a slot @hotplug_slot: slot to get status @value: pointer to store status */
static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
/* get_power_status - get power status of a slot @hotplug_slot: slot to get status @value: pointer to store status */ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
{ int retval, level; struct slot *slot = (struct slot *)hotplug_slot->private; retval = rtas_get_power_level (slot->power_domain, &level); if (!retval) *value = level; return retval; }
robutest/uclinux
C++
GPL-2.0
60
/* Reset USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */
void USBD_ResetEP(U32 EPNum)
/* Reset USB Device Endpoint Parameters: EPNum: Device Endpoint Number EPNum.0..3: Address EPNum.7: Dir Return Value: None */ void USBD_ResetEP(U32 EPNum)
{ ep_buffer_t *desc = get_desc(EPNum); EPNum &= EPNUM_MASK; MXC_USB->ep[EPNum] |= MXC_F_USB_EP_DT; if (ep_info[EPNum].type == MXC_S_USB_EP_DIR_OUT) { desc = get_desc(EPNum); desc->buf0_address = (uint32_t)ep_buffer[EPNum]; desc->buf0_desc = sizeof(ep_buffer[EPNum]); MXC_USB->out_owner = (1 << EPNum); } }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Callback function when the received packet is freed. Check Ip6OnFrameReceived for information. */
VOID EFIAPI Ip6RecycleFrame(IN VOID *Context)
/* Callback function when the received packet is freed. Check Ip6OnFrameReceived for information. */ VOID EFIAPI Ip6RecycleFrame(IN VOID *Context)
{ EFI_MANAGED_NETWORK_RECEIVE_DATA *RxData; RxData = (EFI_MANAGED_NETWORK_RECEIVE_DATA *)Context; gBS->SignalEvent (RxData->RecycleEvent); }
tianocore/edk2
C++
Other
4,240
/* This function will initilize the usb class driver related data structure, and it should be invoked in the usb system initialization. */
rt_err_t rt_usbh_class_driver_init(void)
/* This function will initilize the usb class driver related data structure, and it should be invoked in the usb system initialization. */ rt_err_t rt_usbh_class_driver_init(void)
{ if (_driver_list_created == RT_FALSE) { rt_list_init(&_driver_list); _driver_list_created = RT_TRUE; } return RT_EOK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* hw_free callback: clean up the buffer description table and release the buffer */
static int snd_via82xx_hw_free(struct snd_pcm_substream *substream)
/* hw_free callback: clean up the buffer description table and release the buffer */ static int snd_via82xx_hw_free(struct snd_pcm_substream *substream)
{ struct via82xx_modem *chip = snd_pcm_substream_chip(substream); struct viadev *viadev = substream->runtime->private_data; clean_via_table(viadev, substream, chip->pci); snd_pcm_lib_free_pages(substream); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* TIM_Base MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim_base)
/* TIM_Base MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef *htim_base)
{ if(htim_base->Instance==TIM6) { __HAL_RCC_TIM6_CLK_DISABLE(); } else if(htim_base->Instance==TIM10) { __HAL_RCC_TIM10_CLK_DISABLE(); } else if(htim_base->Instance==TIM11) { __HAL_RCC_TIM11_CLK_DISABLE(); } else if(htim_base->Instance==TIM13) { __HAL_RCC_TIM13_CLK_DISABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Delete and RTA entry from the saved table given to us by the configuration program. */
static int RIORemoveFromSavedTable(struct rio_info *p, struct Map *pMap)
/* Delete and RTA entry from the saved table given to us by the configuration program. */ static int RIORemoveFromSavedTable(struct rio_info *p, struct Map *pMap)
{ int entry; for (entry = 0; entry < TOTAL_MAP_ENTRIES; entry++) { if (p->RIOSavedTable[entry].RtaUniqueNum == pMap->RtaUniqueNum) { memset(&p->RIOSavedTable[entry], 0, sizeof(struct Map)); } } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* MSS_UART_get_tx_status. See mss_uart.h for details of how to use this function. */
uint8_t MSS_UART_get_tx_status(mss_uart_instance_t *this_uart)
/* MSS_UART_get_tx_status. See mss_uart.h for details of how to use this function. */ uint8_t MSS_UART_get_tx_status(mss_uart_instance_t *this_uart)
{ uint8_t status = MSS_UART_TX_BUSY; ASSERT((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)); if((this_uart == &g_mss_uart0) || (this_uart == &g_mss_uart1)) { status = this_uart->hw_reg->LSR; this_uart->status |= status; status &= (MSS_UART_THRE | MSS_UART_TEMT); } return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get GPIOs logic state. Get logic level of GPIO given by GPIO number according to MUX list. Reading a GPIO value is possible even if the port is not muxed for GPIO. */
bool gpio_get(uint32_t gpio)
/* Get GPIOs logic state. Get logic level of GPIO given by GPIO number according to MUX list. Reading a GPIO value is possible even if the port is not muxed for GPIO. */ bool gpio_get(uint32_t gpio)
{ uint32_t port = GPIO(gpio / 32); return !!(GPIO_PDIR(port) & GPIO_OFFSET(gpio)); }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Returns a pointer to the normalized value (dst) or NULL if no conversion is needed. */
static xmlChar* xmlAttrNormalizeSpace(const xmlChar *src, xmlChar *dst)
/* Returns a pointer to the normalized value (dst) or NULL if no conversion is needed. */ static xmlChar* xmlAttrNormalizeSpace(const xmlChar *src, xmlChar *dst)
{ if ((src == NULL) || (dst == NULL)) return(NULL); while (*src == 0x20) src++; while (*src != 0) { if (*src == 0x20) { while (*src == 0x20) src++; if (*src != 0) *dst++ = 0x20; } else { *dst++ = *src++; } } *dst = 0; if (dst == src) return(NULL); return(dst); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Set given termios to defaults appropriate for communicating with serial port devices. */
static void native_tty_termios_defaults_set(struct termios *ter)
/* Set given termios to defaults appropriate for communicating with serial port devices. */ static void native_tty_termios_defaults_set(struct termios *ter)
{ ter->c_lflag &= ~(ICANON | ISIG | ECHO); ter->c_oflag &= ~(OPOST | ONLCR); ter->c_iflag &= ~(IXON | IXOFF | IXANY); ter->c_cc[VMIN] = 0; ter->c_cc[VTIME] = 0; ter->c_iflag &= ~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL); ter->c_cflag |= CREAD | CLOCAL; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Set baud rate and characteristics (115200 8N1) and map to GPIO */
void uart_init()
/* Set baud rate and characteristics (115200 8N1) and map to GPIO */ void uart_init()
{ register unsigned int r; *AUX_ENABLE |=1; *AUX_MU_CNTL = 0; *AUX_MU_LCR = 3; *AUX_MU_MCR = 0; *AUX_MU_IER = 0; *AUX_MU_IIR = 0xc6; *AUX_MU_BAUD = 270; r=*GPFSEL1; r&=~((7<<12)|(7<<15)); r|=(2<<12)|(2<<15); *GPFSEL1 = r; *GPPUD = 0; r=150; while(r--) { asm volatile("nop"); } *GPPUDCLK0 = (1<<14)|(1<<15); r=150; while(r--) { asm volatile("nop"); } *GPPUDCLK0 = 0; *AUX_MU_CNTL = 3; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Allocate buffer for sysex message and prepare header. */
char* line6_alloc_sysex_buffer(struct usb_line6 *line6, int code1, int code2, int size)
/* Allocate buffer for sysex message and prepare header. */ char* line6_alloc_sysex_buffer(struct usb_line6 *line6, int code1, int code2, int size)
{ char *buffer = kmalloc(size + SYSEX_EXTRA_SIZE, GFP_KERNEL); if (!buffer) { dev_err(line6->ifcdev, "out of memory\n"); return NULL; } buffer[0] = LINE6_SYSEX_BEGIN; memcpy(buffer + 1, line6_midi_id, sizeof(line6_midi_id)); buffer[sizeof(line6_midi_id) + 1] = code1; buffer[sizeof(line6_midi_id) + 2] = code2; buffer[sizeof(line6_midi_id) + 3 + size] = LINE6_SYSEX_END; return buffer; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns a pointer to an RX FIFO element in message RAM */
struct fdcan_rx_fifo_element* fdcan_get_rxfifo_addr(uint32_t canport, unsigned fifo_id, unsigned element_id)
/* Returns a pointer to an RX FIFO element in message RAM */ struct fdcan_rx_fifo_element* fdcan_get_rxfifo_addr(uint32_t canport, unsigned fifo_id, unsigned element_id)
{ struct fdcan_rx_fifo_element *rxfifo = (struct fdcan_rx_fifo_element *) (CAN_MSG_BASE + FDCAN_RXFIFO_OFFSET(canport, fifo_id) + (element_id * fdcan_get_fifo_element_size(canport, fifo_id)) ); return rxfifo; }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Notify the system that the SMM FTW driver is ready. */
VOID FtwNotifySmmReady(VOID)
/* Notify the system that the SMM FTW driver is ready. */ VOID FtwNotifySmmReady(VOID)
{ EFI_HANDLE FtwHandle; EFI_STATUS Status; FtwHandle = NULL; Status = gBS->InstallProtocolInterface ( &FtwHandle, &gEfiSmmFaultTolerantWriteProtocolGuid, EFI_NATIVE_INTERFACE, NULL ); ASSERT_EFI_ERROR (Status); }
tianocore/edk2
C++
Other
4,240
/* Convert grayscale to RGB: just duplicate the graylevel three times. This is provided to support applications that don't want to cope with grayscale as a separate case. */
gray_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
/* Convert grayscale to RGB: just duplicate the graylevel three times. This is provided to support applications that don't want to cope with grayscale as a separate case. */ gray_rgb_convert(j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, JSAMPARRAY output_buf, int num_rows)
{ register JSAMPROW inptr, outptr; register JDIMENSION col; JDIMENSION num_cols = cinfo->output_width; while (--num_rows >= 0) { inptr = input_buf[0][input_row++]; outptr = *output_buf++; for (col = 0; col < num_cols; col++) { outptr[RGB_RED] = outptr[RGB_GREEN] = outptr[RGB_BLUE] = inptr[col]; outptr += RGB_PIXELSIZE; } } }
nanoframework/nf-interpreter
C++
MIT License
293
/* Sets Control Line State for the USB CDC ACM Virtual COM Port. The function is a callback function that forwards USB CDC ACM request to set desired control line state to the Virtual COM Port. */
__WEAK int32_t USBD_CDC_ACM_SetControlLineState(uint16_t ctrl_bmp)
/* Sets Control Line State for the USB CDC ACM Virtual COM Port. The function is a callback function that forwards USB CDC ACM request to set desired control line state to the Virtual COM Port. */ __WEAK int32_t USBD_CDC_ACM_SetControlLineState(uint16_t ctrl_bmp)
{ control_line_state = ctrl_bmp; return (USBD_CDC_ACM_PortSetControlLineState(ctrl_bmp)); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* get the transmit/receive address of current descriptor, or current buffer, or descriptor table */
uint32_t enet_current_desc_address_get(enet_desc_reg_enum addr_get)
/* get the transmit/receive address of current descriptor, or current buffer, or descriptor table */ uint32_t enet_current_desc_address_get(enet_desc_reg_enum addr_get)
{ uint32_t reval = 0U; reval = REG32((ENET) + (uint32_t)addr_get); return reval; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Given the bank number this function selects one of the four banks. */
void enc28j60_lwip_select_bank(uint32_t spiHandle, uint8_t bankNumber)
/* Given the bank number this function selects one of the four banks. */ void enc28j60_lwip_select_bank(uint32_t spiHandle, uint8_t bankNumber)
{ NATIVE_PROFILE_HAL_DRIVERS_ETHERNET(); uint8_t byteData = 0; bankNumber &= 0x3; enc28j60_lwip_read_spi(spiHandle, ENC28J60_SPI_READ_CONTROL_REGISTER_OPCODE, ENC28J60_ECON1, &byteData, 1, 0); byteData &= 0xFC; byteData |= bankNumber; enc28j60_lwip_write_spi(spiHandle, ENC28J60_SPI_WRITE_CONTROL_REGISTER_OPCODE, ENC28J60_ECON1, byteData); }
nanoframework/nf-interpreter
C++
MIT License
293
/* Checks the unique counts of other tasks to ensure they are still operational. Returns pdTRUE if an error is detected, otherwise pdFALSE. */
static portBASE_TYPE prvCheckOtherTasksAreStillRunning(void)
/* Checks the unique counts of other tasks to ensure they are still operational. Returns pdTRUE if an error is detected, otherwise pdFALSE. */ static portBASE_TYPE prvCheckOtherTasksAreStillRunning(void)
{ portBASE_TYPE xErrorHasOccurred = pdFALSE; if( xAreIntegerMathsTaskStillRunning() != pdTRUE ) { xErrorHasOccurred = pdTRUE; } if( xArePollingQueuesStillRunning() != pdTRUE ) { xErrorHasOccurred = pdTRUE; } return xErrorHasOccurred; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Returns the most recent received data by the I2Cx peripheral. */
void I2C_ReadCmd(I2C_TypeDef *I2Cx)
/* Returns the most recent received data by the I2Cx peripheral. */ void I2C_ReadCmd(I2C_TypeDef *I2Cx)
{ assert_param(IS_I2C_ALL_PERIPH(I2Cx)); I2Cx->IC_DATA_CMD = CMD_READ; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* PARAMETER erp pointer to the currently created default ERP RETURN VALUES erp_new contens was possibly modified */
static struct dasd_ccw_req* dasd_3990_erp_inspect(struct dasd_ccw_req *erp)
/* PARAMETER erp pointer to the currently created default ERP RETURN VALUES erp_new contens was possibly modified */ static struct dasd_ccw_req* dasd_3990_erp_inspect(struct dasd_ccw_req *erp)
{ struct dasd_ccw_req *erp_new = NULL; char *sense; erp_new = dasd_3990_erp_inspect_alias(erp); if (erp_new) return erp_new; sense = dasd_get_sense(&erp->refers->irb); if (!sense) erp_new = dasd_3990_erp_control_check(erp); else if (sense[27] & DASD_SENSE_BIT_0) { erp_new = dasd_3990_erp_inspect_24(erp, sense); } else { erp_new = dasd_3990_erp_inspect_32(erp, sense); } return erp_new; }
robutest/uclinux
C++
GPL-2.0
60
/* Return 0 if card is not busy, 1 if it is */
static int imx_usdhc_card_busy(const struct device *dev)
/* Return 0 if card is not busy, 1 if it is */ static int imx_usdhc_card_busy(const struct device *dev)
{ const struct usdhc_config *cfg = dev->config; return (USDHC_GetPresentStatusFlags(cfg->base) & (kUSDHC_Data0LineLevelFlag | kUSDHC_Data1LineLevelFlag | kUSDHC_Data2LineLevelFlag | kUSDHC_Data3LineLevelFlag)) ? 0 : 1; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 for details. */
EFI_STATUS SdPeimSendTuningBlk(IN SD_PEIM_HC_SLOT *Slot)
/* Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 for details. */ EFI_STATUS SdPeimSendTuningBlk(IN SD_PEIM_HC_SLOT *Slot)
{ SD_COMMAND_BLOCK SdCmdBlk; SD_STATUS_BLOCK SdStatusBlk; SD_COMMAND_PACKET Packet; EFI_STATUS Status; UINT8 TuningBlock[64]; ZeroMem (&SdCmdBlk, sizeof (SdCmdBlk)); ZeroMem (&SdStatusBlk, sizeof (SdStatusBlk)); ZeroMem (&Packet, sizeof (Packet)); Packet.SdCmdBlk = &SdCmdBlk; Packet.SdStatusBlk = &SdStatusBlk; Packet.Timeout = SD_TIMEOUT; SdCmdBlk.CommandIndex = SD_SEND_TUNING_BLOCK; SdCmdBlk.CommandType = SdCommandTypeAdtc; SdCmdBlk.ResponseType = SdResponseTypeR1; SdCmdBlk.CommandArgument = 0; Packet.InDataBuffer = TuningBlock; Packet.InTransferLength = sizeof (TuningBlock); Status = SdPeimExecCmd (Slot, &Packet); return Status; }
tianocore/edk2
C++
Other
4,240
/* Inserts an item into vector_desc list so that the list is sorted with an incrementing cpu.intno value. */
static void insert_vector_desc(struct vector_desc_t *to_insert)
/* Inserts an item into vector_desc list so that the list is sorted with an incrementing cpu.intno value. */ static void insert_vector_desc(struct vector_desc_t *to_insert)
{ struct vector_desc_t *vd = vector_desc_head; struct vector_desc_t *prev = NULL; while (vd != NULL) { if (vd->cpu > to_insert->cpu) { break; } if (vd->cpu == to_insert->cpu && vd->intno >= to_insert->intno) { break; } prev = vd; vd = vd->next; } if ((vector_desc_head == NULL) || (prev == NULL)) { to_insert->next = vd; vector_desc_head = to_insert; } else { prev->next = to_insert; to_insert->next = vd; } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Find the best AP. Used from association worker. */
static int lbs_find_best_network_ssid(struct lbs_private *priv, uint8_t *out_ssid, uint8_t *out_ssid_len, uint8_t preferred_mode, uint8_t *out_mode)
/* Find the best AP. Used from association worker. */ static int lbs_find_best_network_ssid(struct lbs_private *priv, uint8_t *out_ssid, uint8_t *out_ssid_len, uint8_t preferred_mode, uint8_t *out_mode)
{ int ret = -1; struct bss_descriptor *found; lbs_deb_enter(LBS_DEB_SCAN); priv->scan_ssid_len = 0; lbs_scan_networks(priv, 1); if (priv->surpriseremoved) goto out; found = lbs_find_best_ssid_in_list(priv, preferred_mode); if (found && (found->ssid_len > 0)) { memcpy(out_ssid, &found->ssid, IEEE80211_MAX_SSID_LEN); *out_ssid_len = found->ssid_len; *out_mode = found->mode; ret = 0; } out: lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* HBN set ldo11 all voltage out, not include dcdc11. */
BL_Err_Type ATTR_TCM_SECTION HBN_Set_Ldo11_All_Vout(HBN_LDO_LEVEL_Type ldoLevel)
/* HBN set ldo11 all voltage out, not include dcdc11. */ BL_Err_Type ATTR_TCM_SECTION HBN_Set_Ldo11_All_Vout(HBN_LDO_LEVEL_Type ldoLevel)
{ uint32_t tmpVal; HBN_RTC_MISC_Type rtcMiscCfg; CHECK_PARAM(IS_HBN_LDO_LEVEL_TYPE(ldoLevel)); tmpVal = BL_RD_REG(HBN_BASE, HBN_GLB); tmpVal = BL_SET_REG_BITS_VAL(tmpVal, HBN_SW_LDO11_AON_VOUT_SEL, ldoLevel); tmpVal = BL_SET_REG_BITS_VAL(tmpVal, HBN_SW_LDO11_RT_VOUT_SEL, ldoLevel); BL_WR_REG(HBN_BASE, HBN_GLB, tmpVal); HBN_Get_RTC_Misc_Cfg(&rtcMiscCfg); rtcMiscCfg.ldo11RtcVoutSelRtc = ldoLevel; HBN_Set_RTC_Misc_Cfg(&rtcMiscCfg); return SUCCESS; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Check if I2C is ready to send next byt. */
bool _i2c_s_sync_is_byte_sent(const struct _i2c_s_sync_device *const device)
/* Check if I2C is ready to send next byt. */ bool _i2c_s_sync_is_byte_sent(const struct _i2c_s_sync_device *const device)
{ return hri_sercomi2cs_get_interrupt_DRDY_bit(device->hw); }
eclipse-threadx/getting-started
C++
Other
310
/* This function returns the current TPL. There is no EFI service to directly retrieve the current TPL. Instead, the RaiseTPL() function is used to raise the TPL to TPL_HIGH_LEVEL. This will return the current TPL. The TPL level can then immediately be restored back to the current TPL level with a call to RestoreTPL(). */
EFI_TPL EFIAPI EfiGetCurrentTpl(VOID)
/* This function returns the current TPL. There is no EFI service to directly retrieve the current TPL. Instead, the RaiseTPL() function is used to raise the TPL to TPL_HIGH_LEVEL. This will return the current TPL. The TPL level can then immediately be restored back to the current TPL level with a call to RestoreTPL(). */ EFI_TPL EFIAPI EfiGetCurrentTpl(VOID)
{ EFI_TPL Tpl; Tpl = gBS->RaiseTPL (TPL_HIGH_LEVEL); gBS->RestoreTPL (Tpl); return Tpl; }
tianocore/edk2
C++
Other
4,240
/* Write data to the buffer if there is space. Whether there is space or not, the buffer pointer is incremented. */
static void append_data(char **ptrp, char *end, const void *data, int size)
/* Write data to the buffer if there is space. Whether there is space or not, the buffer pointer is incremented. */ static void append_data(char **ptrp, char *end, const void *data, int size)
{ char *ptr = *ptrp; *ptrp += size; if (*ptrp > end) return; memcpy(ptr, data, size); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Collect processes when the error hit an anonymous page. */
static void collect_procs_anon(struct page *page, struct list_head *to_kill, struct to_kill **tkc)
/* Collect processes when the error hit an anonymous page. */ static void collect_procs_anon(struct page *page, struct list_head *to_kill, struct to_kill **tkc)
{ struct vm_area_struct *vma; struct task_struct *tsk; struct anon_vma *av; read_lock(&tasklist_lock); av = page_lock_anon_vma(page); if (av == NULL) goto out; for_each_process (tsk) { if (!task_early_kill(tsk)) continue; list_for_each_entry (vma, &av->head, anon_vma_node) { if (!page_mapped_in_vma(page, vma)) continue; if (vma->vm_mm == tsk->mm) add_to_kill(tsk, page, vma, to_kill, tkc); } } page_unlock_anon_vma(av); out: read_unlock(&tasklist_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* USBH_BulkSendData Sends the Bulk Packet to the device. */
USBH_StatusTypeDef USBH_BulkSendData(USBH_HandleTypeDef *phost, uint8_t *buff, uint16_t length, uint8_t pipe_num, uint8_t do_ping)
/* USBH_BulkSendData Sends the Bulk Packet to the device. */ USBH_StatusTypeDef USBH_BulkSendData(USBH_HandleTypeDef *phost, uint8_t *buff, uint16_t length, uint8_t pipe_num, uint8_t do_ping)
{ if(phost->device.speed != USBH_SPEED_HIGH) { do_ping = 0; } USBH_LL_SubmitURB (phost, pipe_num, 0, USBH_EP_BULK, USBH_PID_DATA, buff, length, do_ping); return USBH_OK; }
micropython/micropython
C++
Other
18,334
/* We only need to hook operations that are MMU writes. We hook these so that we can use lazy MMU mode to batch these operations. We could probably improve the performance of the host code if we used some of the information here to simplify processing of batched writes. */
static void kvm_set_pte(pte_t *ptep, pte_t pte)
/* We only need to hook operations that are MMU writes. We hook these so that we can use lazy MMU mode to batch these operations. We could probably improve the performance of the host code if we used some of the information here to simplify processing of batched writes. */ static void kvm_set_pte(pte_t *ptep, pte_t pte)
{ kvm_mmu_write(ptep, pte_val(pte)); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Check hardware register for wait status. Returns 1 if device is ready, 0 if it is still busy. */
static int nand_davinci_dev_ready(struct mtd_info *mtd)
/* Check hardware register for wait status. Returns 1 if device is ready, 0 if it is still busy. */ static int nand_davinci_dev_ready(struct mtd_info *mtd)
{ struct davinci_nand_info *info = to_davinci_nand(mtd); return davinci_nand_readl(info, NANDFSR_OFFSET) & BIT(0); }
robutest/uclinux
C++
GPL-2.0
60
/* param base SPDIF base pointer. param handle SPDIF eDMA handle pointer. param count Bytes count sent by SPDIF. retval kStatus_Success Succeed get the transfer count. retval kStatus_NoTransferInProgress There is no non-blocking transaction in progress. */
status_t SPDIF_TransferGetSendCountEDMA(SPDIF_Type *base, spdif_edma_handle_t *handle, size_t *count)
/* param base SPDIF base pointer. param handle SPDIF eDMA handle pointer. param count Bytes count sent by SPDIF. retval kStatus_Success Succeed get the transfer count. retval kStatus_NoTransferInProgress There is no non-blocking transaction in progress. */ status_t SPDIF_TransferGetSendCountEDMA(SPDIF_Type *base, spdif_edma_handle_t *handle, size_t *count)
{ assert(handle); status_t status = kStatus_Success; if (handle->state != kSPDIF_Busy) { status = kStatus_NoTransferInProgress; } else { *count = (handle->transferSize[handle->queueDriver] - (uint32_t)handle->nbytes * EDMA_GetRemainingMajorLoopCount(handle->dmaRightHandle->base, handle->dmaRightHandle->channel)); } return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* return The current MCG_Lite mode or error code. */
mcglite_mode_t CLOCK_GetMode(void)
/* return The current MCG_Lite mode or error code. */ mcglite_mode_t CLOCK_GetMode(void)
{ mcglite_mode_t mode; switch (MCG_S_CLKST_VAL) { case kMCGLITE_ClkSrcHirc: mode = kMCGLITE_ModeHirc48M; break; case kMCGLITE_ClkSrcLirc: if (kMCGLITE_Lirc2M == MCG_C2_IRCS_VAL) { mode = kMCGLITE_ModeLirc2M; } else { mode = kMCGLITE_ModeLirc8M; } break; case kMCGLITE_ClkSrcExt: mode = kMCGLITE_ModeExt; break; default: mode = kMCGLITE_ModeError; break; } return mode; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Register the char encoding handler, surprising, isn't it ? */
void xmlRegisterCharEncodingHandler(xmlCharEncodingHandlerPtr handler)
/* Register the char encoding handler, surprising, isn't it ? */ void xmlRegisterCharEncodingHandler(xmlCharEncodingHandlerPtr handler)
{ xmlEncodingErr(XML_I18N_NO_HANDLER, "xmlRegisterCharEncodingHandler: NULL handler !\n", NULL); return; } if (nbCharEncodingHandler >= MAX_ENCODING_HANDLERS) { xmlEncodingErr(XML_I18N_EXCESS_HANDLER, "xmlRegisterCharEncodingHandler: Too many handler registered, see %s\n", "MAX_ENCODING_HANDLERS"); return; } handlers[nbCharEncodingHandler++] = handler; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* libc/string/strncat.c Appends no more than n bytes from one string to another */
char* strncat(char *dest, const char *src, size_t n)
/* libc/string/strncat.c Appends no more than n bytes from one string to another */ char* strncat(char *dest, const char *src, size_t n)
{ char * tmp = dest; if (n) { while (*dest) dest++; while ((*dest++ = *src++) != 0) { if (--n == 0) { *dest = '\0'; break; } } } return tmp; }
xboot/xboot
C++
MIT License
779
/* @sdata: mesh interface in which mesh beacons are going to be updated */
void mesh_accept_plinks_update(struct ieee80211_sub_if_data *sdata)
/* @sdata: mesh interface in which mesh beacons are going to be updated */ void mesh_accept_plinks_update(struct ieee80211_sub_if_data *sdata)
{ bool free_plinks; free_plinks = mesh_plink_availables(sdata); if (free_plinks != sdata->u.mesh.accepting_plinks) ieee80211_mesh_housekeeping_timer((unsigned long) sdata); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Prevent the PCI layer from seeing the resources allocated to this device if it is the host bridge by marking it as such. These resources are of no consequence to the PCI layer (they are handled elsewhere). */
static void __devinit emma2rh_pci_host_fixup(struct pci_dev *dev)
/* Prevent the PCI layer from seeing the resources allocated to this device if it is the host bridge by marking it as such. These resources are of no consequence to the PCI layer (they are handled elsewhere). */ static void __devinit emma2rh_pci_host_fixup(struct pci_dev *dev)
{ int i; if (PCI_SLOT(dev->devfn) == EMMA2RH_PCI_HOST_SLOT) { dev->class &= 0xff; dev->class |= PCI_CLASS_BRIDGE_HOST << 8; for (i = 0; i < PCI_NUM_RESOURCES; i++) { dev->resource[i].start = 0; dev->resource[i].end = 0; dev->resource[i].flags = 0; } } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Remove the first sample from the sample queue. */
static void sample_queue_pop(HintSampleQueue *queue)
/* Remove the first sample from the sample queue. */ static void sample_queue_pop(HintSampleQueue *queue)
{ if (queue->len <= 0) return; if (queue->samples[0].own_data) av_free(queue->samples[0].data); queue->len--; memmove(queue->samples, queue->samples + 1, sizeof(HintSample)*queue->len); }
DC-SWAT/DreamShell
C++
null
404
/* This function prepares the state before issuing the class specific commands. */
USBH_StatusTypeDef USBH_CDC_GetLineCoding(USBH_HandleTypeDef *phost, CDC_LineCodingTypeDef *linecoding)
/* This function prepares the state before issuing the class specific commands. */ USBH_StatusTypeDef USBH_CDC_GetLineCoding(USBH_HandleTypeDef *phost, CDC_LineCodingTypeDef *linecoding)
{ CDC_HandleTypeDef *CDC_Handle = (CDC_HandleTypeDef *) phost->pActiveClass->pData; if ((phost->gState == HOST_CLASS) || (phost->gState == HOST_CLASS_REQUEST)) { *linecoding = CDC_Handle->LineCoding; return USBH_OK; } else { return USBH_FAIL; } }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* retrieves the Egress tagging status for one VLAN ID */
IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBEgressVlanEntryTaggingEnabledGet(IxEthDBPortId portID, IxEthDBVlanId vlanID, BOOL *enabled)
/* retrieves the Egress tagging status for one VLAN ID */ IX_ETH_DB_PUBLIC IxEthDBStatus ixEthDBEgressVlanEntryTaggingEnabledGet(IxEthDBPortId portID, IxEthDBVlanId vlanID, BOOL *enabled)
{ IX_ETH_DB_CHECK_PORT(portID); IX_ETH_DB_CHECK_SINGLE_NPE(portID); IX_ETH_DB_CHECK_FEATURE(portID, IX_ETH_DB_VLAN_QOS); IX_ETH_DB_CHECK_REFERENCE(enabled); IX_ETH_DB_CHECK_VLAN_ID(vlanID); *enabled = ((ixEthDBPortInfo[portID].transmitTaggingInfo[VLAN_SET_OFFSET(vlanID)] & (1 << VLAN_SET_MASK(vlanID))) != 0); return IX_ETH_DB_SUCCESS; }
EmcraftSystems/u-boot
C++
Other
181
/* We point the receive handler at this function when idle. Instead of processing the frames we get to throw them away. */
void z8530_null_rx(struct z8530_channel *c, struct sk_buff *skb)
/* We point the receive handler at this function when idle. Instead of processing the frames we get to throw them away. */ void z8530_null_rx(struct z8530_channel *c, struct sk_buff *skb)
{ dev_kfree_skb_any(skb); }
robutest/uclinux
C++
GPL-2.0
60
/* Get the SPI interrupt flag of the specified SPI port. */
xtBoolean SPIIntFlagGet(unsigned long ulBase, unsigned long ulIntFlags)
/* Get the SPI interrupt flag of the specified SPI port. */ xtBoolean SPIIntFlagGet(unsigned long ulBase, unsigned long ulIntFlags)
{ xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE)||(ulBase == SPI3_BASE) ); return ((xHWREG(ulBase + SPI_STATUS) & ulIntFlags) ? xtrue : xfalse); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Enables interrupts and triggers for the specified PWM generator block. */
void PWMGenIntTrigEnable(uint32_t ui32Base, uint32_t ui32Gen, uint32_t ui32IntTrig)
/* Enables interrupts and triggers for the specified PWM generator block. */ void PWMGenIntTrigEnable(uint32_t ui32Base, uint32_t ui32Gen, uint32_t ui32IntTrig)
{ ASSERT(ui32Base == PWM0_BASE); ASSERT(_PWMGenValid(ui32Gen)); ASSERT((ui32IntTrig & ~(PWM_INT_CNT_ZERO | PWM_INT_CNT_LOAD | PWM_INT_CNT_AU | PWM_INT_CNT_AD | PWM_INT_CNT_BU | PWM_INT_CNT_BD | PWM_TR_CNT_ZERO | PWM_TR_CNT_LOAD | PWM_TR_CNT_AU | PWM_TR_CNT_AD | PWM_TR_CNT_BU | PWM_TR_CNT_BD)) == 0); HWREG(PWM_GEN_BADDR(ui32Base, ui32Gen) + PWM_O_X_INTEN) |= ui32IntTrig; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns 0 in case of success, -1 in case of error */
int xmlDelEncodingAlias(const char *alias)
/* Returns 0 in case of success, -1 in case of error */ int xmlDelEncodingAlias(const char *alias)
{ if (!strcmp(xmlCharEncodingAliases[i].alias, alias)) { xmlFree((char *) xmlCharEncodingAliases[i].name); xmlFree((char *) xmlCharEncodingAliases[i].alias); xmlCharEncodingAliasesNb--; memmove(&xmlCharEncodingAliases[i], &xmlCharEncodingAliases[i + 1], sizeof(xmlCharEncodingAlias) * (xmlCharEncodingAliasesNb - i)); return(0); } } return(-1); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function will find specified name object from object container. */
rt_object_t rt_object_find(const char *name, rt_uint8_t type)
/* This function will find specified name object from object container. */ rt_object_t rt_object_find(const char *name, rt_uint8_t type)
{ struct rt_object *object; struct rt_list_node *node; struct rt_object_information *information; extern volatile rt_uint8_t rt_interrupt_nest; if ((name == RT_NULL) || (type > RT_Object_Class_Unknown)) return RT_NULL; if (rt_interrupt_nest != 0) RT_ASSERT(0); rt_enter_critical(); information = &rt_object_container[type]; for (node = information->object_list.next; node != &(information->object_list); node = node->next) { object = rt_list_entry(node, struct rt_object, list); if (rt_strncmp(object->name, name, RT_NAME_MAX) == 0) { rt_exit_critical(); return object; } } rt_exit_critical(); return RT_NULL; }
armink/FreeModbus_Slave-Master-RTT-STM32
C++
Other
1,477
/* Show and set the number of grat ARP to send after a failover event. */
static ssize_t bonding_show_n_grat_arp(struct device *d, struct device_attribute *attr, char *buf)
/* Show and set the number of grat ARP to send after a failover event. */ static ssize_t bonding_show_n_grat_arp(struct device *d, struct device_attribute *attr, char *buf)
{ struct bonding *bond = to_bond(d); return sprintf(buf, "%d\n", bond->params.num_grat_arp); }
robutest/uclinux
C++
GPL-2.0
60
/* Apparently the disk->capacity attribute is off by 1 sector for all disk drives. We add the one here, but it should really be done in sd.c. Even if it gets fixed there, this will still work. */
static int imm_biosparam(struct scsi_device *sdev, struct block_device *dev, sector_t capacity, int ip[])
/* Apparently the disk->capacity attribute is off by 1 sector for all disk drives. We add the one here, but it should really be done in sd.c. Even if it gets fixed there, this will still work. */ static int imm_biosparam(struct scsi_device *sdev, struct block_device *dev, sector_t capacity, int ip[])
{ ip[0] = 0x40; ip[1] = 0x20; ip[2] = ((unsigned long) capacity + 1) / (ip[0] * ip[1]); if (ip[2] > 1024) { ip[0] = 0xff; ip[1] = 0x3f; ip[2] = ((unsigned long) capacity + 1) / (ip[0] * ip[1]); } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Turn on/off any Nagle-like algorithm. This means that packets are generally sent as soon as possible and no unnecessary delays are introduced, at the cost of more packets in the network. Expects an integer boolean flag. */
static int sctp_setsockopt_nodelay(struct sock *sk, char __user *optval, unsigned int optlen)
/* Turn on/off any Nagle-like algorithm. This means that packets are generally sent as soon as possible and no unnecessary delays are introduced, at the cost of more packets in the network. Expects an integer boolean flag. */ static int sctp_setsockopt_nodelay(struct sock *sk, char __user *optval, unsigned int optlen)
{ int val; if (optlen < sizeof(int)) return -EINVAL; if (get_user(val, (int __user *)optval)) return -EFAULT; sctp_sk(sk)->nodelay = (val == 0) ? 0 : 1; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Save stack trace to the given array of MAX_TRACE size. */
static int __save_stack_trace(unsigned long *trace)
/* Save stack trace to the given array of MAX_TRACE size. */ static int __save_stack_trace(unsigned long *trace)
{ struct stack_trace stack_trace; stack_trace.max_entries = MAX_TRACE; stack_trace.nr_entries = 0; stack_trace.entries = trace; stack_trace.skip = 2; save_stack_trace(&stack_trace); return stack_trace.nr_entries; }
robutest/uclinux
C++
GPL-2.0
60
/* This function handles continuation of receiving data. It is invoked from interrupt handler. */
s32 SlaveRecvData(XIicPs *InstancePtr)
/* This function handles continuation of receiving data. It is invoked from interrupt handler. */ s32 SlaveRecvData(XIicPs *InstancePtr)
{ u32 StatusReg; u32 BaseAddr; Xil_AssertNonvoid(InstancePtr != NULL); BaseAddr = InstancePtr->Config.BaseAddress; StatusReg = XIicPs_ReadReg(BaseAddr, XIICPS_SR_OFFSET); while (((StatusReg & XIICPS_SR_RXDV_MASK)!=0x0U) && (InstancePtr->RecvByteCount > 0)) { XIicPs_RecvByte(InstancePtr); StatusReg = XIicPs_ReadReg(BaseAddr, XIICPS_SR_OFFSET); } return InstancePtr->RecvByteCount; } /** @}
ua1arn/hftrx
C++
null
69
/* Does the partition: Pivot P is at the top of the stack. precondition: a <= P == a <= a, so it only needs to do the partition from lo + 1 to up - 2. Pos-condition: a <= a == P <= a returns 'i'. */
static IdxT partition(lua_State *L, IdxT lo, IdxT up)
/* Does the partition: Pivot P is at the top of the stack. precondition: a <= P == a <= a, so it only needs to do the partition from lo + 1 to up - 2. Pos-condition: a <= a == P <= a returns 'i'. */ static IdxT partition(lua_State *L, IdxT lo, IdxT up)
{ while ((void)lua_geti(L, 1, ++i), sort_comp(L, -1, -2)) { if (l_unlikely(i == up - 1)) luaL_error(L, "invalid order function for sorting"); lua_pop(L, 1); } while ((void)lua_geti(L, 1, --j), sort_comp(L, -3, -1)) { if (l_unlikely(j < i)) luaL_error(L, "invalid order function for sorting"); lua_pop(L, 1); } if (j < i) { lua_pop(L, 1); set2(L, up - 1, i); return i; } set2(L, i, j); } }
Nicholas3388/LuaNode
C++
Other
1,055
/* Check if IO range is illegal in current partition. */
static status_t MMC_CheckIORange(mmc_card_t *card, uint32_t startBlock, uint32_t blockCount)
/* Check if IO range is illegal in current partition. */ static status_t MMC_CheckIORange(mmc_card_t *card, uint32_t startBlock, uint32_t blockCount)
{ status_t error = kStatus_Success; switch (card->currentPartition) { case kMMC_AccessPartitionUserAera: { if ((startBlock + blockCount) > (card->userPartitionBlocks)) { error = kStatus_InvalidArgument; } break; } case kMMC_AccessPartitionBoot1: case kMMC_AccessPartitionBoot2: { if ((startBlock + blockCount) > card->bootPartitionBlocks) { error = kStatus_InvalidArgument; } break; } default: error = kStatus_InvalidArgument; break; } return error; }
labapart/polymcu
C++
null
201
/* To avoid this we can shift the randomness by 1 bit. */
static unsigned long mmap_rnd(void)
/* To avoid this we can shift the randomness by 1 bit. */ static unsigned long mmap_rnd(void)
{ unsigned long rnd = 0; if (current->flags & PF_RANDOMIZE) { if (is_32bit_task()) rnd = (long)(get_random_int() % (1<<(22-PAGE_SHIFT))); else rnd = (long)(get_random_int() % (1<<(29-PAGE_SHIFT))); } return (rnd << PAGE_SHIFT) * 2; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns the last ADC conversion result data in dual mode. */
u32 ADC_GetDualModeConversionValue()
/* Returns the last ADC conversion result data in dual mode. */ u32 ADC_GetDualModeConversionValue()
{ return (*(vu32*)ADC1_BASE); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Return 0 on exception, a value greater than N if too long */
long __strnlen_user(const char __user *s, long n)
/* Return 0 on exception, a value greater than N if too long */ long __strnlen_user(const char __user *s, long n)
{ long res = 0; char c; while (1) { if (res>n) return n+1; if (__get_user(c, s)) return 0; if (!c) return res+1; res++; s++; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Configure timer capture function. This function is used to configure timer capture function. */
void TimerCounterCfg(unsigned long ulBase, unsigned long ulCfg)
/* Configure timer capture function. This function is used to configure timer capture function. */ void TimerCounterCfg(unsigned long ulBase, unsigned long ulCfg)
{ xASSERT((ulBase == TIMER0_BASE) || (ulBase == TIMER1_BASE) || (ulBase == TIMER2_BASE) || (ulBase == TIMER3_BASE) ); xASSERT( (ulCfg & ~BIT_MASK(32, 2, 0)) == 0 ); xHWREG(ulBase + TIMER_CTCR) = ulCfg; xHWREG(ulBase + TIMER_CCR) = 0x00; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* True iff the two stmt lists load the same value from the packet into the accumulator. */
static int eq_slist(struct slist *x, struct slist *y)
/* True iff the two stmt lists load the same value from the packet into the accumulator. */ static int eq_slist(struct slist *x, struct slist *y)
{ for (;;) { while (x && x->s.code == NOP) x = x->next; while (y && y->s.code == NOP) y = y->next; if (x == 0) return y == 0; if (y == 0) return x == 0; if (x->s.code != y->s.code || x->s.k != y->s.k) return 0; x = x->next; y = y->next; } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* set the percentage of files at which to stop allocating */
static int cachefiles_daemon_fstop(struct cachefiles_cache *, char *)
/* set the percentage of files at which to stop allocating */ static int cachefiles_daemon_fstop(struct cachefiles_cache *, char *)
{ unsigned long fstop; _enter(",%s", args); if (!*args) return -EINVAL; fstop = simple_strtoul(args, &args, 10); if (args[0] != '%' || args[1] != '\0') return -EINVAL; if (fstop < 0 || fstop >= cache->fcull_percent) return cachefiles_daemon_range_error(cache, args); cache->fstop_percent = fstop; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This function clears the wake-up interrupt flag to clear the interrupt it gives. */
int32_t can_ctrl_clear_wake_flag(struct can_ctrl_dev *dev)
/* This function clears the wake-up interrupt flag to clear the interrupt it gives. */ int32_t can_ctrl_clear_wake_flag(struct can_ctrl_dev *dev)
{ int32_t ret; uint32_t data; ret = can_ctrl_sfr_word_read(dev, CAN_CTRL_REG_INT, &data); if(ret != 0) return ret; data &= ~INT_WAKIF_MODE(true); return can_ctrl_sfr_byte_write(dev, (CAN_CTRL_REG_INT + 1), *(((uint8_t *)&data) + 1)); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* This function returns the TLS/SSL client random data currently used in the specified TLS connection. */
VOID EFIAPI CryptoServiceTlsGetClientRandom(IN VOID *Tls, IN OUT UINT8 *ClientRandom)
/* This function returns the TLS/SSL client random data currently used in the specified TLS connection. */ VOID EFIAPI CryptoServiceTlsGetClientRandom(IN VOID *Tls, IN OUT UINT8 *ClientRandom)
{ CALL_VOID_BASECRYPTLIB (TlsGet.Services.ClientRandom, TlsGetClientRandom, (Tls, ClientRandom)); }
tianocore/edk2
C++
Other
4,240
/* Disable DMA mode for transmission @rmtoll CR TXDMA LL_SWPMI_DisableDMAReq_TX. */
void LL_SWPMI_DisableDMAReq_TX(SWPMI_TypeDef *SWPMIx)
/* Disable DMA mode for transmission @rmtoll CR TXDMA LL_SWPMI_DisableDMAReq_TX. */ void LL_SWPMI_DisableDMAReq_TX(SWPMI_TypeDef *SWPMIx)
{ CLEAR_BIT(SWPMIx->CR, SWPMI_CR_TXDMA); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Fill a no_client_port connection with a client port number */
void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport)
/* Fill a no_client_port connection with a client port number */ void ip_vs_conn_fill_cport(struct ip_vs_conn *cp, __be16 cport)
{ if (ip_vs_conn_unhash(cp)) { spin_lock(&cp->lock); if (cp->flags & IP_VS_CONN_F_NO_CPORT) { atomic_dec(&ip_vs_conn_no_cport_cnt); cp->flags &= ~IP_VS_CONN_F_NO_CPORT; cp->cport = cport; } spin_unlock(&cp->lock); ip_vs_conn_hash(cp); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Compute the hash value for two given address/port pairs if the match has a wildcard address 2 and port 2. */
static guint conversation_hash_no_addr2_or_port2(gconstpointer v)
/* Compute the hash value for two given address/port pairs if the match has a wildcard address 2 and port 2. */ static guint conversation_hash_no_addr2_or_port2(gconstpointer v)
{ const conversation_key *key = (const conversation_key *)v; guint hash_val; address tmp_addr; hash_val = 0; tmp_addr.len = 4; hash_val = add_address_to_hash(hash_val, &key->addr1); tmp_addr.data = &key->port1; hash_val = add_address_to_hash(hash_val, &tmp_addr); hash_val += ( hash_val << 3 ); hash_val ^= ( hash_val >> 11 ); hash_val += ( hash_val << 15 ); return hash_val; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If the conversion results in an overflow or an underflow condition, then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeUint64ToInt8(IN UINT64 Operand, OUT INT8 *Result)
/* If the conversion results in an overflow or an underflow condition, then Result is set to INT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeUint64ToInt8(IN UINT64 Operand, OUT INT8 *Result)
{ RETURN_STATUS Status; if (Result == NULL) { return RETURN_INVALID_PARAMETER; } if (Operand <= MAX_INT8) { *Result = (INT8)Operand; Status = RETURN_SUCCESS; } else { *Result = INT8_ERROR; Status = RETURN_BUFFER_TOO_SMALL; } return Status; }
tianocore/edk2
C++
Other
4,240
/* Generates a Software interrupt on selected EXTI line. */
void EXTI_GenerateSWInterrupt(uint32_t EXTI_Line)
/* Generates a Software interrupt on selected EXTI line. */ void EXTI_GenerateSWInterrupt(uint32_t EXTI_Line)
{ assert_param(IS_EXTI_LINE(EXTI_Line)); EXTI->SWIER |= EXTI_Line; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* get the auxiliary data for an FSDEF index record - this is the index structure version number of the netfs for which this version is created */
static uint16_t fscache_fsdef_netfs_get_aux(const void *cookie_netfs_data, void *buffer, uint16_t bufmax)
/* get the auxiliary data for an FSDEF index record - this is the index structure version number of the netfs for which this version is created */ static uint16_t fscache_fsdef_netfs_get_aux(const void *cookie_netfs_data, void *buffer, uint16_t bufmax)
{ const struct fscache_netfs *netfs = cookie_netfs_data; unsigned dlen; _enter("{%s.%u},", netfs->name, netfs->version); dlen = sizeof(uint32_t); if (dlen > bufmax) return 0; memcpy(buffer, &netfs->version, dlen); return dlen; }
robutest/uclinux
C++
GPL-2.0
60
/* param config transceiver configurations. param bitWidth audio data bitWidth. param mode audio data channel. param saiChannelMask channel mask value to enable. */
void SAI_GetDSPConfig(sai_transceiver_t *config, sai_frame_sync_len_t frameSyncWidth, sai_word_width_t bitWidth, sai_mono_stereo_t mode, uint32_t saiChannelMask)
/* param config transceiver configurations. param bitWidth audio data bitWidth. param mode audio data channel. param saiChannelMask channel mask value to enable. */ void SAI_GetDSPConfig(sai_transceiver_t *config, sai_frame_sync_len_t frameSyncWidth, sai_word_width_t bitWidth, sai_mono_stereo_t mode, uint32_t saiChannelMask)
{ assert(NULL != config); assert(saiChannelMask != 0U); SAI_GetCommonConfig(config, bitWidth, mode, saiChannelMask); switch (frameSyncWidth) { case kSAI_FrameSyncLenOneBitClk: config->frameSync.frameSyncWidth = 1U; break; default: assert(false); break; } config->frameSync.frameSyncEarly = false; config->frameSync.frameSyncPolarity = kSAI_PolarityActiveHigh; }
eclipse-threadx/getting-started
C++
Other
310
/* This method block the program to wait for a message transmission. It waits either until the message is acknowledged or 5 seconds. */
int32_t can_ctrl_wait_tx(struct can_ctrl_dev *dev, bool *scs)
/* This method block the program to wait for a message transmission. It waits either until the message is acknowledged or 5 seconds. */ int32_t can_ctrl_wait_tx(struct can_ctrl_dev *dev, bool *scs)
{ int32_t ret; uint32_t data = 0; uint32_t timeout = 5000; *scs = true; do { ret = can_ctrl_sfr_word_read(dev, CAN_CTRL_REG_FIFOCON(dev->tx_fifo_nr), &data); if(ret != SUCCESS) return ret; timeout--; mdelay(1); } while(((data & FIFOCON_TXREQ_MODE(WORD_MASK)) != 0) && timeout); if(!timeout) *scs = false; return ret; }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Disable interrupt mode for the selected IO pin(s). */
int32_t MFXSTM32L152_IO_DisablePinIT(MFXSTM32L152_Object_t *pObj, uint32_t IO_Pin)
/* Disable interrupt mode for the selected IO pin(s). */ int32_t MFXSTM32L152_IO_DisablePinIT(MFXSTM32L152_Object_t *pObj, uint32_t IO_Pin)
{ int32_t ret = MFXSTM32L152_OK; if (MFXSTM32L152_reg24_setPinValue(pObj, MFXSTM32L152_REG_ADR_IRQ_GPI_SRC1, IO_Pin, 0) != MFXSTM32L152_OK) { ret = MFXSTM32L152_ERROR; } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* For the RuntimeDxe version of this lib, convert internal pointer addresses to virtual addresses. */
STATIC VOID EFIAPI VariablePolicyLibVirtualAddressCallback(IN EFI_EVENT Event, IN VOID *Context)
/* For the RuntimeDxe version of this lib, convert internal pointer addresses to virtual addresses. */ STATIC VOID EFIAPI VariablePolicyLibVirtualAddressCallback(IN EFI_EVENT Event, IN VOID *Context)
{ gRT->ConvertPointer (0, (VOID **)&mPolicyTable); gRT->ConvertPointer (0, (VOID **)&mGetVariableHelper); mIsVirtualAddrConverted = TRUE; }
tianocore/edk2
C++
Other
4,240
/* I2C State Monitoring Functions. Checks whether the last I2Cx Event is equal to the one passed as parameter. */
ErrorStatus I2C_CheckEvent(I2C_Module *I2Cx, uint32_t I2C_EVENT)
/* I2C State Monitoring Functions. Checks whether the last I2Cx Event is equal to the one passed as parameter. */ ErrorStatus I2C_CheckEvent(I2C_Module *I2Cx, uint32_t I2C_EVENT)
{ uint32_t lastevent = 0; uint32_t flag1 = 0, flag2 = 0; ErrorStatus status = ERROR; assert_param(IS_I2C_PERIPH(I2Cx)); assert_param(IS_I2C_EVT(I2C_EVENT)); flag1 = I2Cx->STS1; flag2 = I2Cx->STS2; flag2 = flag2 << 16; lastevent = (flag1 | flag2) & FLAG_MASK; if ((lastevent & I2C_EVENT) == I2C_EVENT) { status = SUCCESS; } else { status = ERROR; } return status; }
pikasTech/PikaPython
C++
MIT License
1,403