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 the source of the time base. The time source is configured to have 1ms time base with a dedicated Tick interrupt priority. */
__weak void ald_tick_init(uint32_t prio)
/* This function configures the source of the time base. The time source is configured to have 1ms time base with a dedicated Tick interrupt priority. */ __weak void ald_tick_init(uint32_t prio)
{ SysTick_Config(ald_cmu_get_sys_clock() / SYSTICK_INTERVAL_1MS); NVIC_SetPriority(SysTick_IRQn, prio); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param tcd Point to the TCD structure. param mask The mask of interrupt source to be set. Users need to use the defined edma_interrupt_enable_t type. */
void EDMA_TcdDisableInterrupts(edma_tcd_t *tcd, uint32_t mask)
/* param tcd Point to the TCD structure. param mask The mask of interrupt source to be set. Users need to use the defined edma_interrupt_enable_t type. */ void EDMA_TcdDisableInterrupts(edma_tcd_t *tcd, uint32_t mask)
{ assert(tcd != NULL); if (0U != (mask & (uint32_t)kEDMA_MajorInterruptEnable)) { tcd->CSR &= ~(uint16_t)DMA_CSR_INTMAJOR_MASK; } if (0U != (mask & (uint32_t)kEDMA_HalfInterruptEnable)) { tcd->CSR &= ~(uint16_t)DMA_CSR_INTHALF_MASK; } }
eclipse-threadx/getting-started
C++
Other
310
/* Must be called if skb_seq_read() was not called until it returned 0. */
void skb_abort_seq_read(struct skb_seq_state *st)
/* Must be called if skb_seq_read() was not called until it returned 0. */ void skb_abort_seq_read(struct skb_seq_state *st)
{ if (st->frag_data) kunmap_skb_frag(st->frag_data); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns true if @filename matches @pattern, false otherwise. */
static bool tomoyo_file_matches_pattern(const char *filename, const char *filename_end, const char *pattern, const char *pattern_end)
/* Returns true if @filename matches @pattern, false otherwise. */ static bool tomoyo_file_matches_pattern(const char *filename, const char *filename_end, const char *pattern, const char *pattern_end)
{ const char *pattern_start = pattern; bool first = true; bool result; while (pattern < pattern_end - 1) { if (*pattern++ != '\\' || *pattern++ != '-') continue; result = tomoyo_file_matches_pattern2(filename, filename_end, pattern_start, pattern - 2); if (first) result = !result; if (result) return false; first = false; pattern_start = pattern; } result = tomoyo_file_matches_pattern2(filename, filename_end, pattern_start, pattern_end); return first ? result : !result; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* ADC Calibration. The ADC must have been powered down for at least 2 ADC clock cycles, then powered on. before calibration starts */
void adc_calibration(uint32_t adc)
/* ADC Calibration. The ADC must have been powered down for at least 2 ADC clock cycles, then powered on. before calibration starts */ void adc_calibration(uint32_t adc)
{ ADC_CR2(adc) |= ADC_CR2_CAL; while (ADC_CR2(adc) & ADC_CR2_CAL); }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Slave fill up the TX FIFO with data. This is not a public API. */
static void LPSPI_SlaveTransferFillUpTxFifo(LPSPI_Type *base, lpspi_slave_handle_t *handle)
/* Slave fill up the TX FIFO with data. This is not a public API. */ static void LPSPI_SlaveTransferFillUpTxFifo(LPSPI_Type *base, lpspi_slave_handle_t *handle)
{ assert(handle != NULL); uint32_t wordToSend = 0U; uint8_t bytesEachWrite = handle->bytesEachWrite; bool isByteSwap = handle->isByteSwap; while (LPSPI_GetTxFifoCount(base) < (handle->fifoSize)) { if (handle->txRemainingByteCount < (size_t)bytesEachWrite) { handle->bytesEachWrite = (uint8_t)handle->txRemainingByteCount; bytesEachWrite = handle->bytesEachWrite; } wordToSend = LPSPI_CombineWriteData(handle->txData, bytesEachWrite, isByteSwap); handle->txData += bytesEachWrite; handle->txRemainingByteCount -= (size_t)bytesEachWrite; LPSPI_WriteData(base, wordToSend); if (handle->txRemainingByteCount == 0U) { break; } } }
eclipse-threadx/getting-started
C++
Other
310
/* Handle a fatal parser error, i.e. violating Well-Formedness constraints */
static void xmlFatalErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *msg)
/* Handle a fatal parser error, i.e. violating Well-Formedness constraints */ static void xmlFatalErrMsg(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *msg)
{ if ((ctxt != NULL) && (ctxt->disableSAX != 0) && (ctxt->instate == XML_PARSER_EOF)) return; if (ctxt != NULL) ctxt->errNo = error; __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_PARSER, error, XML_ERR_FATAL, NULL, 0, NULL, NULL, NULL, 0, 0, "%s", msg); if (ctxt != NULL) { ctxt->wellFormed = 0; if (ctxt->recovery == 0) ctxt->disableSAX = 1; } }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT32 EFIAPI AsmMsrBitFieldWrite32(IN UINT32 Index, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 Value)
/* If StartBit is greater than 31, then ASSERT(). If EndBit is greater than 31, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT32 EFIAPI AsmMsrBitFieldWrite32(IN UINT32 Index, IN UINTN StartBit, IN UINTN EndBit, IN UINT32 Value)
{ ASSERT (EndBit < sizeof (Value) * 8); ASSERT (StartBit <= EndBit); return (UINT32)AsmMsrBitFieldWrite64 (Index, StartBit, EndBit, Value); }
tianocore/edk2
C++
Other
4,240
/* this function is a POSIX compliant version, which cause the regular file referenced by fd to be truncated to a size of precisely length bytes. */
int ftruncate(int fd, off_t length)
/* this function is a POSIX compliant version, which cause the regular file referenced by fd to be truncated to a size of precisely length bytes. */ int ftruncate(int fd, off_t length)
{ int result; struct dfs_fd *d; d = fd_get(fd); if (d == NULL) { rt_set_errno(-EBADF); return -1; } if (length < 0) { fd_put(d); rt_set_errno(-EINVAL); return -1; } result = dfs_file_ftruncate(d, length); if (result < 0) { fd_put(d); rt_set_errno(result); return -1; } fd_put(d); return 0; }
pikasTech/PikaPython
C++
MIT License
1,403
/* This routine abuses get_user()/put_user() to reference pointers with at least a bit of error checking ... */
static void show_stacktrace(struct task_struct *task, const struct pt_regs *regs)
/* This routine abuses get_user()/put_user() to reference pointers with at least a bit of error checking ... */ static void show_stacktrace(struct task_struct *task, const struct pt_regs *regs)
{ const int field = 2 * sizeof(unsigned long); long stackdata; int i; unsigned long __user *sp = (unsigned long __user *)regs->regs[29]; printk("Stack :"); i = 0; while ((unsigned long) sp & (PAGE_SIZE - 1)) { if (i && ((i % (64 / field)) == 0)) printk("\n "); if (i > 39) { printk(" ..."); break; } if (__get_user(stackdata, sp++)) { printk(" (Bad stack address)"); break; } printk(" %0*lx", field, stackdata); i++; } printk("\n"); show_backtrace(task, regs); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* param base SAI base pointer. param handle SAI handle pointer. param callback Pointer to the user callback function. param userData User parameter passed to the callback function. */
void SAI_TransferRxCreateHandle(I2S_Type *base, sai_handle_t *handle, sai_transfer_callback_t callback, void *userData)
/* param base SAI base pointer. param handle SAI handle pointer. param callback Pointer to the user callback function. param userData User parameter passed to the callback function. */ void SAI_TransferRxCreateHandle(I2S_Type *base, sai_handle_t *handle, sai_transfer_callback_t callback, void *userData)
{ assert(handle); memset(handle, 0, sizeof(*handle)); s_saiHandle[SAI_GetInstance(base)][1] = handle; handle->callback = callback; handle->userData = userData; handle->base = base; s_saiRxIsr = SAI_TransferRxHandleIRQ; EnableIRQ(s_saiRxIRQ[SAI_GetInstance(base)]); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Validate System RAM used for decompressing the PEI and DXE firmware volumes when SEV-SNP is active. The PCDs SecValidatedStart and SecValidatedEnd are set in OvmfPkg/Include/Fdf/FvmainCompactScratchEnd.fdf.inc. */
VOID SecValidateSystemRam(VOID)
/* Validate System RAM used for decompressing the PEI and DXE firmware volumes when SEV-SNP is active. The PCDs SecValidatedStart and SecValidatedEnd are set in OvmfPkg/Include/Fdf/FvmainCompactScratchEnd.fdf.inc. */ VOID SecValidateSystemRam(VOID)
{ PHYSICAL_ADDRESS Start, End; if (IsSevGuest () && SevSnpIsEnabled ()) { Start = (EFI_PHYSICAL_ADDRESS)(UINTN)PcdGet32 (PcdOvmfSecValidatedStart); End = (EFI_PHYSICAL_ADDRESS)(UINTN)PcdGet32 (PcdOvmfSecValidatedEnd); MemEncryptSevSnpPreValidateSystemRam (Start, EFI_SIZE_TO_PAGES ((UINTN)(End - Start))); } }
tianocore/edk2
C++
Other
4,240
/* Unregisters an interrupt handler for the watchdog timer interrupt. */
void WatchdogIntUnregister(uint32_t ui32Base)
/* Unregisters an interrupt handler for the watchdog timer interrupt. */ void WatchdogIntUnregister(uint32_t ui32Base)
{ ASSERT((ui32Base == WATCHDOG0_BASE) || (ui32Base == WATCHDOG1_BASE)); IntDisable(INT_WATCHDOG); IntUnregister(INT_WATCHDOG); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* usb_hcd_end_port_resume - a root-hub port has stop sending a resume signal */
void usb_hcd_end_port_resume(struct usb_virt_bus *bus, int portnum)
/* usb_hcd_end_port_resume - a root-hub port has stop sending a resume signal */ void usb_hcd_end_port_resume(struct usb_virt_bus *bus, int portnum)
{ unsigned bit = 1 << portnum; if (bus->resuming_ports & bit) { bus->resuming_ports &= ~bit; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This is the entry point for Print DXE Driver. It installs the Print2 Protocol. */
EFI_STATUS EFIAPI PrintEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* This is the entry point for Print DXE Driver. It installs the Print2 Protocol. */ EFI_STATUS EFIAPI PrintEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; Status = gBS->InstallMultipleProtocolInterfaces ( &mPrintThunkHandle, &gEfiPrint2ProtocolGuid, &mPrint2Protocol, &gEfiPrint2SProtocolGuid, &mPrint2SProtocol, NULL ); ASSERT_EFI_ERROR (Status); return Status; }
tianocore/edk2
C++
Other
4,240
/* This function returns the flags representing the wake configuration for the Hibernation module. The return value is a combination of the following flags: */
uint32_t HibernateWakeGet(void)
/* This function returns the flags representing the wake configuration for the Hibernation module. The return value is a combination of the following flags: */ uint32_t HibernateWakeGet(void)
{ return(HWREG(HIB_CTL) & (HIBERNATE_WAKE_PIN | HIBERNATE_WAKE_RTC | HIBERNATE_WAKE_LOW_BAT)); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Return Value: TRUE if Reset Success; otherwise FALSE */
BOOL MACbSoftwareReset(DWORD_PTR dwIoBase)
/* Return Value: TRUE if Reset Success; otherwise FALSE */ BOOL MACbSoftwareReset(DWORD_PTR dwIoBase)
{ BYTE byData; WORD ww; VNSvOutPortB(dwIoBase+ MAC_REG_HOSTCR, 0x01); for (ww = 0; ww < W_MAX_TIMEOUT; ww++) { VNSvInPortB(dwIoBase + MAC_REG_HOSTCR, &byData); if ( !(byData & HOSTCR_SOFTRST)) break; } if (ww == W_MAX_TIMEOUT) return FALSE; return TRUE; }
robutest/uclinux
C++
GPL-2.0
60
/* Routine to read bytes from the Modem Management Controller. The implementation is complicated by a lack of address lines, which prevents decoding of the low-order bit. (code has just been moved in the above function) We start at the end because it is the way it should be! */
static void mmc_read(unsigned long ioaddr, u8 o, u8 *b, int n)
/* Routine to read bytes from the Modem Management Controller. The implementation is complicated by a lack of address lines, which prevents decoding of the low-order bit. (code has just been moved in the above function) We start at the end because it is the way it should be! */ static void mmc_read(unsigned long ioaddr, u8 o, u8 *b, int n)
{ o += n; b += n; while (n-- > 0) *(--b) = mmc_in(ioaddr, --o); }
robutest/uclinux
C++
GPL-2.0
60
/* param base LPUART peripheral base address. param data Start address of the data to write. param length Size of the data to write. */
void LPUART_WriteBlocking(LPUART_Type *base, const uint8_t *data, size_t length)
/* param base LPUART peripheral base address. param data Start address of the data to write. param length Size of the data to write. */ void LPUART_WriteBlocking(LPUART_Type *base, const uint8_t *data, size_t length)
{ assert(NULL != data); const uint8_t *dataAddress = data; size_t transferSize = length; while (0U != transferSize) { while (0U == (base->STAT & LPUART_STAT_TDRE_MASK)) { } base->DATA = *(dataAddress); dataAddress++; transferSize--; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Initializes the USARTx peripheral Clock according to the specified parameters in the USART_ClockInitStruct . */
void USART_ClockInit(USART_TypeDef *USARTx, USART_ClockInitTypeDef *USART_ClockInitStruct)
/* Initializes the USARTx peripheral Clock according to the specified parameters in the USART_ClockInitStruct . */ void USART_ClockInit(USART_TypeDef *USARTx, USART_ClockInitTypeDef *USART_ClockInitStruct)
{ uint32_t tmpreg = 0x00; assert_param(IS_USART_1236_PERIPH(USARTx)); assert_param(IS_USART_CLOCK(USART_ClockInitStruct->USART_Clock)); assert_param(IS_USART_CPOL(USART_ClockInitStruct->USART_CPOL)); assert_param(IS_USART_CPHA(USART_ClockInitStruct->USART_CPHA)); assert_param(IS_USART_LASTBIT(USART_ClockInitStruct->USART_LastBit)); tmpreg = USARTx->CR2; tmpreg &= (uint32_t)~((uint32_t)CR2_CLOCK_CLEAR_MASK); tmpreg |= (uint32_t)USART_ClockInitStruct->USART_Clock | USART_ClockInitStruct->USART_CPOL | USART_ClockInitStruct->USART_CPHA | USART_ClockInitStruct->USART_LastBit; USARTx->CR2 = (uint16_t)tmpreg; }
MaJerle/stm32f429
C++
null
2,036
/* We don't attempt any packet filtering. The card may have a SEEQ 8004 in which does not have the other ethernet address registers present... */
static void ether3_setmulticastlist(struct net_device *dev)
/* We don't attempt any packet filtering. The card may have a SEEQ 8004 in which does not have the other ethernet address registers present... */ static void ether3_setmulticastlist(struct net_device *dev)
{ priv(dev)->regs.config1 &= ~CFG1_RECVPROMISC; if (dev->flags & IFF_PROMISC) { priv(dev)->regs.config1 |= CFG1_RECVPROMISC; } else if (dev->flags & IFF_ALLMULTI || dev->mc_count) { priv(dev)->regs.config1 |= CFG1_RECVSPECBRMULTI; } else priv(dev)->regs.config1 |= CFG1_RECVSPECBROAD; ether3_outw(priv(dev)->regs.config1 | CFG1_LOCBUFMEM, REG_CONFIG1); }
robutest/uclinux
C++
GPL-2.0
60
/* Notes: The command must not belong to any lists. */
void scsi_host_put_command(struct Scsi_Host *shost, struct scsi_cmnd *cmd)
/* Notes: The command must not belong to any lists. */ void scsi_host_put_command(struct Scsi_Host *shost, struct scsi_cmnd *cmd)
{ struct request_queue *q = shost->uspace_req_q; struct request *rq = cmd->request; struct scsi_tgt_cmd *tcmd = rq->end_io_data; unsigned long flags; kmem_cache_free(scsi_tgt_cmd_cache, tcmd); spin_lock_irqsave(q->queue_lock, flags); __blk_put_request(q, rq); spin_unlock_irqrestore(q->queue_lock, flags); __scsi_put_command(shost, cmd, &shost->shost_gendev); }
robutest/uclinux
C++
GPL-2.0
60
/* reset USART V1.0.0, platform GD32F1x0(x=3,5) V2.0.0, platform GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */
void usart_deinit(uint32_t usart_periph)
/* reset USART V1.0.0, platform GD32F1x0(x=3,5) V2.0.0, platform GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */ void usart_deinit(uint32_t usart_periph)
{ switch(usart_periph){ case USART0: rcu_periph_reset_enable(RCU_USART0RST); rcu_periph_reset_disable(RCU_USART0RST); break; case USART1: rcu_periph_reset_enable(RCU_USART1RST); rcu_periph_reset_disable(RCU_USART1RST); break; default: break; } }
liuxuming/trochili
C++
Apache License 2.0
132
/* Gets the selected ADC Software start conversion Status. */
FlagStatus ADC_GetSoftwareStartConvStatus(ADC_TypeDef *ADCx)
/* Gets the selected ADC Software start conversion Status. */ FlagStatus ADC_GetSoftwareStartConvStatus(ADC_TypeDef *ADCx)
{ FlagStatus bitstatus = RESET; assert_param(IS_ADC_ALL_PERIPH(ADCx)); if ((ADCx->ADCR & ADCR_SWSTART_Set) != (uint32_t)RESET) { bitstatus = SET; } else { bitstatus = RESET; } return bitstatus; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Description: Process a user generated ADD message and add */
static int netlbl_mgmt_add(struct sk_buff *skb, struct genl_info *info)
/* Description: Process a user generated ADD message and add */ static int netlbl_mgmt_add(struct sk_buff *skb, struct genl_info *info)
{ struct netlbl_audit audit_info; if ((!info->attrs[NLBL_MGMT_A_DOMAIN]) || (!info->attrs[NLBL_MGMT_A_PROTOCOL]) || (info->attrs[NLBL_MGMT_A_IPV4ADDR] && info->attrs[NLBL_MGMT_A_IPV6ADDR]) || (info->attrs[NLBL_MGMT_A_IPV4MASK] && info->attrs[NLBL_MGMT_A_IPV6MASK]) || ((info->attrs[NLBL_MGMT_A_IPV4ADDR] != NULL) ^ (info->attrs[NLBL_MGMT_A_IPV4MASK] != NULL)) || ((info->attrs[NLBL_MGMT_A_IPV6ADDR] != NULL) ^ (info->attrs[NLBL_MGMT_A_IPV6MASK] != NULL))) return -EINVAL; netlbl_netlink_auditinfo(skb, &audit_info); return netlbl_mgmt_add_common(info, &audit_info); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This service enables discovery sections of a given type within a valid FFS file. Caller also can provide a SectionCheckHook to do additional checking. */
EFI_STATUS EFIAPI FfsFindSectionDataWithHook(IN EFI_SECTION_TYPE SectionType, IN FFS_CHECK_SECTION_HOOK SectionCheckHook, IN EFI_PEI_FILE_HANDLE FileHandle, OUT VOID **SectionData)
/* This service enables discovery sections of a given type within a valid FFS file. Caller also can provide a SectionCheckHook to do additional checking. */ EFI_STATUS EFIAPI FfsFindSectionDataWithHook(IN EFI_SECTION_TYPE SectionType, IN FFS_CHECK_SECTION_HOOK SectionCheckHook, IN EFI_PEI_FILE_HANDLE FileHandle, OUT VOID **SectionData)
{ EFI_FFS_FILE_HEADER *FfsFileHeader; UINT32 FileSize; EFI_COMMON_SECTION_HEADER *Section; FfsFileHeader = (EFI_FFS_FILE_HEADER *)(FileHandle); Section = (EFI_COMMON_SECTION_HEADER *)(FfsFileHeader + 1); FileSize = *(UINT32 *)(FfsFileHeader->Size) & 0x00FFFFFF; FileSize -= sizeof (EFI_FFS_FILE_HEADER); return FfsProcessSection ( SectionType, SectionCheckHook, Section, FileSize, SectionData ); }
tianocore/edk2
C++
Other
4,240
/* Like TIFFGetField, but return any default value if the tag is not present in the directory. */
int TIFFGetFieldDefaulted(TIFF *tif, uint32 tag,...)
/* Like TIFFGetField, but return any default value if the tag is not present in the directory. */ int TIFFGetFieldDefaulted(TIFF *tif, uint32 tag,...)
{ int ok; va_list ap; va_start(ap, tag); ok = TIFFVGetFieldDefaulted(tif, tag, ap); va_end(ap); return (ok); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This assumes the separate CPPI engine is responding to DMA requests from the usb core ... sequenced a bit differently from mentor dma. */
static int max_ep_writesize(struct musb *musb, struct musb_ep *ep)
/* This assumes the separate CPPI engine is responding to DMA requests from the usb core ... sequenced a bit differently from mentor dma. */ static int max_ep_writesize(struct musb *musb, struct musb_ep *ep)
{ if (can_bulk_split(musb, ep->type)) return ep->hw_ep->max_packet_sz_tx; else return ep->packet_sz; }
robutest/uclinux
C++
GPL-2.0
60
/* Ignore given number of bytes and then write an negative UDS response on the output channel. */
static int ignore_and_write_negative_response(struct upgrade_uds_t *self_p, size_t length, uint8_t service_id, uint8_t code)
/* Ignore given number of bytes and then write an negative UDS response on the output channel. */ static int ignore_and_write_negative_response(struct upgrade_uds_t *self_p, size_t length, uint8_t service_id, uint8_t code)
{ ignore(self_p, length); write_response(self_p, 2, 0x7f); chan_write(self_p->chout_p, &service_id, 1); chan_write(self_p->chout_p, &code, 1); return (0); }
eerimoq/simba
C++
Other
337
/* The Start() function is designed to be invoked from the EFI boot service ConnectController(). As a result, much of the error checking on the parameters to Start() has been moved into this common boot service. It is legal to call Start() from other locations, but the following calling restrictions must be followed, or the system behavior will not be deterministic. */
EFI_STATUS EFIAPI Dns6DriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
/* The Start() function is designed to be invoked from the EFI boot service ConnectController(). As a result, much of the error checking on the parameters to Start() has been moved into this common boot service. It is legal to call Start() from other locations, but the following calling restrictions must be followed, or the system behavior will not be deterministic. */ EFI_STATUS EFIAPI Dns6DriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
{ DNS_SERVICE *DnsSb; EFI_STATUS Status; Status = DnsCreateService (ControllerHandle, This->DriverBindingHandle, IP_VERSION_6, &DnsSb); if (EFI_ERROR (Status)) { return Status; } ASSERT (DnsSb != NULL); Status = gBS->SetTimer (DnsSb->Timer, TimerPeriodic, TICKS_PER_SECOND); if (EFI_ERROR (Status)) { goto ON_ERROR; } Status = gBS->InstallMultipleProtocolInterfaces ( &ControllerHandle, &gEfiDns6ServiceBindingProtocolGuid, &DnsSb->ServiceBinding, NULL ); if (EFI_ERROR (Status)) { goto ON_ERROR; } return EFI_SUCCESS; ON_ERROR: DnsDestroyService (DnsSb); return Status; }
tianocore/edk2
C++
Other
4,240
/* Returns: (transfer none): a NULL-terminated array of strings. The returned array belongs to GIO and must not be freed or modified. */
const gchar* const* g_vfs_get_supported_uri_schemes(GVfs *vfs)
/* Returns: (transfer none): a NULL-terminated array of strings. The returned array belongs to GIO and must not be freed or modified. */ const gchar* const* g_vfs_get_supported_uri_schemes(GVfs *vfs)
{ GVfsClass *class; g_return_val_if_fail (G_IS_VFS (vfs), NULL); class = G_VFS_GET_CLASS (vfs); return (* class->get_supported_uri_schemes) (vfs); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Registers an interrupt handler for the flash interrupt. */
void FlashIntRegister(void(*pfnHandler)(void))
/* Registers an interrupt handler for the flash interrupt. */ void FlashIntRegister(void(*pfnHandler)(void))
{ IntRegister(INT_FLASH_BLIZZARD, pfnHandler); IntEnable(INT_FLASH_BLIZZARD); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* HCD_Init De-Initialize the Host portion of the driver. */
USBH_StatusTypeDef USBH_DeInit(USBH_HandleTypeDef *phost)
/* HCD_Init De-Initialize the Host portion of the driver. */ USBH_StatusTypeDef USBH_DeInit(USBH_HandleTypeDef *phost)
{ DeInitStateMachine(phost); if(phost->pData != NULL) { phost->pActiveClass->pData = NULL; USBH_LL_Stop(phost); } return USBH_OK; }
labapart/polymcu
C++
null
201
/* This routine will shutdown a serial port; interrupts are disabled, and */
static void dz_shutdown(struct uart_port *uport)
/* This routine will shutdown a serial port; interrupts are disabled, and */ static void dz_shutdown(struct uart_port *uport)
{ struct dz_port *dport = to_dport(uport); struct dz_mux *mux = dport->mux; unsigned long flags; int irq_guard; u16 tmp; spin_lock_irqsave(&dport->port.lock, flags); dz_stop_tx(&dport->port); spin_unlock_irqrestore(&dport->port.lock, flags); irq_guard = atomic_add_return(-1, &mux->irq_guard); if (!irq_guard) { tmp = dz_in(dport, DZ_CSR); tmp &= ~(DZ_RIE | DZ_TIE); dz_out(dport, DZ_CSR, tmp); free_irq(dport->port.irq, mux); } }
robutest/uclinux
C++
GPL-2.0
60
/* block.c This file implements the low-level routines to read and decompress datablocks and metadata blocks. Read the metadata block length, this is stored in the first two bytes of the metadata block. */
static struct buffer_head* get_block_length(struct super_block *sb, u64 *cur_index, int *offset, int *length)
/* block.c This file implements the low-level routines to read and decompress datablocks and metadata blocks. Read the metadata block length, this is stored in the first two bytes of the metadata block. */ static struct buffer_head* get_block_length(struct super_block *sb, u64 *cur_index, int *offset, int *length)
{ struct squashfs_sb_info *msblk = sb->s_fs_info; struct buffer_head *bh; bh = sb_bread(sb, *cur_index); if (bh == NULL) return NULL; if (msblk->devblksize - *offset == 1) { *length = (unsigned char) bh->b_data[*offset]; put_bh(bh); bh = sb_bread(sb, ++(*cur_index)); if (bh == NULL) return NULL; *length |= (unsigned char) bh->b_data[0] << 8; *offset = 1; } else { *length = (unsigned char) bh->b_data[*offset] | (unsigned char) bh->b_data[*offset + 1] << 8; *offset += 2; } return bh; }
robutest/uclinux
C++
GPL-2.0
60
/* If there are zero parameters (if even argv is undefined) then assume a default value of "now" for argv. */
static int isDate(sqlite3_context *context, int argc, sqlite3_value **argv, DateTime *p)
/* If there are zero parameters (if even argv is undefined) then assume a default value of "now" for argv. */ static int isDate(sqlite3_context *context, int argc, sqlite3_value **argv, DateTime *p)
{ int i; const unsigned char *z; int eType; memset(p, 0, sizeof(*p)); if( argc==0 ){ return setDateTimeToCurrent(context, p); } if( (eType = sqlite3_value_type(argv[0]))==SQLITE_FLOAT || eType==SQLITE_INTEGER ){ p->iJD = (sqlite3_int64)(sqlite3_value_double(argv[0])*86400000.0 + 0.5); p->validJD = 1; }else{ z = sqlite3_value_text(argv[0]); if( !z || parseDateOrTime(context, (char*)z, p) ){ return 1; } } for(i=1; i<argc; i++){ z = sqlite3_value_text(argv[i]); if( z==0 || parseModifier(context, (char*)z, p) ) return 1; } return 0; }
DC-SWAT/DreamShell
C++
null
404
/* Base on the current formset info, clean the ConfigRequest string in browser storage. */
VOID CleanBrowserStorage(IN OUT FORM_BROWSER_FORMSET *FormSet)
/* Base on the current formset info, clean the ConfigRequest string in browser storage. */ VOID CleanBrowserStorage(IN OUT FORM_BROWSER_FORMSET *FormSet)
{ LIST_ENTRY *Link; FORMSET_STORAGE *Storage; Link = GetFirstNode (&FormSet->StorageListHead); while (!IsNull (&FormSet->StorageListHead, Link)) { Storage = FORMSET_STORAGE_FROM_LINK (Link); Link = GetNextNode (&FormSet->StorageListHead, Link); if (Storage->BrowserStorage->Type == EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER) { if ((Storage->ConfigRequest == NULL) || (Storage->BrowserStorage->ConfigRequest == NULL)) { continue; } RemoveConfigRequest (Storage, Storage->ConfigRequest); } else if ((Storage->BrowserStorage->Type == EFI_HII_VARSTORE_BUFFER) || (Storage->BrowserStorage->Type == EFI_HII_VARSTORE_NAME_VALUE)) { if (Storage->BrowserStorage->ConfigRequest != NULL) { FreePool (Storage->BrowserStorage->ConfigRequest); Storage->BrowserStorage->ConfigRequest = NULL; } Storage->BrowserStorage->Initialized = FALSE; } } }
tianocore/edk2
C++
Other
4,240
/* Parses advertisement data, providing length and location of the field in case matching data is found. */
static uint32_t adv_report_parse(uint8_t type, data_t *p_advdata, data_t *p_typedata)
/* Parses advertisement data, providing length and location of the field in case matching data is found. */ static uint32_t adv_report_parse(uint8_t type, data_t *p_advdata, data_t *p_typedata)
{ uint32_t index = 0; uint8_t * p_data; p_data = p_advdata->p_data; while (index < p_advdata->data_len) { uint8_t field_length = p_data[index]; uint8_t field_type = p_data[index+1]; if (field_type == type) { p_typedata->p_data = &p_data[index+2]; p_typedata->data_len = field_length-1; return NRF_SUCCESS; } index += field_length + 1; } return NRF_ERROR_NOT_FOUND; }
labapart/polymcu
C++
null
201
/* Reset the status of dma descriptors to ready state and re-initialize the hardware chain for later use */
static void gelic_card_reset_chain(struct gelic_card *card, struct gelic_descr_chain *chain, struct gelic_descr *start_descr)
/* Reset the status of dma descriptors to ready state and re-initialize the hardware chain for later use */ static void gelic_card_reset_chain(struct gelic_card *card, struct gelic_descr_chain *chain, struct gelic_descr *start_descr)
{ struct gelic_descr *descr; for (descr = start_descr; start_descr != descr->next; descr++) { gelic_descr_set_status(descr, GELIC_DESCR_DMA_CARDOWNED); descr->next_descr_addr = cpu_to_be32(descr->next->bus_addr); } chain->head = start_descr; chain->tail = (descr - 1); (descr - 1)->next_descr_addr = 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Don't call this function unless you are bound to the intf interface or you have locked the device! */
struct usb_host_interface* usb_altnum_to_altsetting(const struct usb_interface *intf, unsigned int altnum)
/* Don't call this function unless you are bound to the intf interface or you have locked the device! */ struct usb_host_interface* usb_altnum_to_altsetting(const struct usb_interface *intf, unsigned int altnum)
{ int i; for (i = 0; i < intf->num_altsetting; i++) { if (intf->altsetting[i].desc.bAlternateSetting == altnum) return &intf->altsetting[i]; } return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Fills each SPI_InitStruct member with its default value. */
void SPI_StructInit(SPI_InitTypeDef *SPI_InitStruct)
/* Fills each SPI_InitStruct member with its default value. */ void SPI_StructInit(SPI_InitTypeDef *SPI_InitStruct)
{ SPI_InitStruct->SPI_Mode = SPI_Mode_Slave; SPI_InitStruct->SPI_DataSize = SPI_DataSize_8b; SPI_InitStruct->SPI_DataWidth = SPI_DataWidth_8b; SPI_InitStruct->SPI_CPOL = SPI_CPOL_Low; SPI_InitStruct->SPI_CPHA = SPI_CPHA_1Edge; SPI_InitStruct->SPI_NSS = SPI_NSS_Soft; SPI_InitStruct->SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_2; SPI_InitStruct->SPI_FirstBit = SPI_FirstBit_MSB; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* RNG MSP Initialization This function configures the hardware resources used in this example. */
void HAL_RNG_MspInit(RNG_HandleTypeDef *hrng)
/* RNG MSP Initialization This function configures the hardware resources used in this example. */ void HAL_RNG_MspInit(RNG_HandleTypeDef *hrng)
{ __HAL_RCC_RNG_CLK_ENABLE(); } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Configures the tim Output Compare 3 Fast feature. */
void TIM_OC3FastConfig(TIM_TypeDef *tim, TIMOCFE_Typedef fast)
/* Configures the tim Output Compare 3 Fast feature. */ void TIM_OC3FastConfig(TIM_TypeDef *tim, TIMOCFE_Typedef fast)
{ MODIFY_REG(tim->CCMR2, TIM_CCMR2_OC3FEN, fast); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function will notity sof event to all of function. */
static rt_err_t _sof_notify(udevice_t device)
/* This function will notity sof event to all of function. */ static rt_err_t _sof_notify(udevice_t device)
{ struct rt_list_node *i; ufunction_t func; RT_ASSERT(device != RT_NULL); for (i=device->curr_cfg->func_list.next; i!=&device->curr_cfg->func_list; i=i->next) { func = (ufunction_t)rt_list_entry(i, struct ufunction, list); if(func->ops->sof_handler != RT_NULL) func->ops->sof_handler(func); } return RT_EOK; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Gets the current functional device address for an endpoint. */
uint32_t USBHostAddrGet(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Flags)
/* Gets the current functional device address for an endpoint. */ uint32_t USBHostAddrGet(uint32_t ui32Base, uint32_t ui32Endpoint, uint32_t ui32Flags)
{ ASSERT(ui32Base == USB0_BASE); ASSERT((ui32Endpoint == USB_EP_0) || (ui32Endpoint == USB_EP_1) || (ui32Endpoint == USB_EP_2) || (ui32Endpoint == USB_EP_3) || (ui32Endpoint == USB_EP_4) || (ui32Endpoint == USB_EP_5) || (ui32Endpoint == USB_EP_6) || (ui32Endpoint == USB_EP_7)); if (ui32Flags & USB_EP_HOST_OUT) { return (HWREGB(ui32Base + USB_O_TXFUNCADDR0 + (ui32Endpoint >> 1))); } else { return (HWREGB(ui32Base + USB_O_TXFUNCADDR0 + 4 + (ui32Endpoint >> 1))); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Helper function to dissect a Thermostat scheduling mode bitmask. */
static void dissect_zcl_thermostat_schedule_mode(proto_tree *tree, tvbuff_t *tvb, guint offset)
/* Helper function to dissect a Thermostat scheduling mode bitmask. */ static void dissect_zcl_thermostat_schedule_mode(proto_tree *tree, tvbuff_t *tvb, guint offset)
{ static const int *thermostat_schedule_modes[] = { &hf_zbee_zcl_thermostat_schedule_mode_heat, &hf_zbee_zcl_thermostat_schedule_mode_cool, NULL }; proto_tree_add_bitmask(tree, tvb, offset, hf_zbee_zcl_thermostat_schedule_mode_sequence, ett_zbee_zcl_thermostat_schedule_mode, thermostat_schedule_modes, ENC_NA); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* sk_alloc - All socket objects are allocated here @net: the applicable net namespace @family: protocol family @priority: for allocation (GFP_KERNEL, GFP_ATOMIC, etc) @prot: struct proto associated with this new sock instance */
struct sock* sk_alloc(struct net *net, int family, gfp_t priority, struct proto *prot)
/* sk_alloc - All socket objects are allocated here @net: the applicable net namespace @family: protocol family @priority: for allocation (GFP_KERNEL, GFP_ATOMIC, etc) @prot: struct proto associated with this new sock instance */ struct sock* sk_alloc(struct net *net, int family, gfp_t priority, struct proto *prot)
{ struct sock *sk; sk = sk_prot_alloc(prot, priority | __GFP_ZERO, family); if (sk) { sk->sk_family = family; sk->sk_prot = sk->sk_prot_creator = prot; sock_lock_init(sk); sock_net_set(sk, get_net(net)); atomic_set(&sk->sk_wmem_alloc, 1); } return sk; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set timer prescale value. This function is used to configure timer clock prescale value. MODE_COUNTER_CH0_RISING MODE_COUNTER_CH0_FALLING MODE_COUNTER_CH0_BOTHEDGE MODE_COUNTER_CH1_RISING MODE_COUNTER_CH1_FALLING MODE_COUNTER_CH1_BOTHEDGE */
void TimerPrescaleSet(unsigned long ulBase, unsigned long ulValue)
/* Set timer prescale value. This function is used to configure timer clock prescale value. MODE_COUNTER_CH0_RISING MODE_COUNTER_CH0_FALLING MODE_COUNTER_CH0_BOTHEDGE MODE_COUNTER_CH1_RISING MODE_COUNTER_CH1_FALLING MODE_COUNTER_CH1_BOTHEDGE */ void TimerPrescaleSet(unsigned long ulBase, unsigned long ulValue)
{ xASSERT((ulBase == TIMER0_BASE) || (ulBase == TIMER1_BASE) || (ulBase == TIMER2_BASE) || (ulBase == TIMER3_BASE) ); xHWREG(ulBase + TIMER_PR) = ulValue; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Compute the hash for the isofs name corresponding to the dentry. */
static int isofs_hashi_common(struct dentry *dentry, struct qstr *qstr, int ms)
/* Compute the hash for the isofs name corresponding to the dentry. */ static int isofs_hashi_common(struct dentry *dentry, struct qstr *qstr, int ms)
{ const char *name; int len; char c; unsigned long hash; len = qstr->len; name = qstr->name; if (ms) { while (len && name[len-1] == '.') len--; } hash = init_name_hash(); while (len--) { c = tolower(*name++); hash = partial_name_hash(c, hash); } qstr->hash = end_name_hash(hash); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* This API read fifo frame count from location 0Eh bit position 0 to 6. */
BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_fifo_frame_count(u8 *frame_count_u8)
/* This API read fifo frame count from location 0Eh bit position 0 to 6. */ BMA2x2_RETURN_FUNCTION_TYPE bma2x2_get_fifo_frame_count(u8 *frame_count_u8)
{ BMA2x2_RETURN_FUNCTION_TYPE com_rslt = ERROR; u8 data_u8 = BMA2x2_INIT_VALUE; if (p_bma2x2 == BMA2x2_NULL) { return E_BMA2x2_NULL_PTR; } else { com_rslt = p_bma2x2->BMA2x2_BUS_READ_FUNC( p_bma2x2->dev_addr, BMA2x2_FIFO_FRAME_COUNT_STAT_REG, &data_u8, BMA2x2_GEN_READ_WRITE_LENGTH); *frame_count_u8 = BMA2x2_GET_BITSLICE(data_u8, BMA2x2_FIFO_FRAME_COUNT_STAT); } return com_rslt; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* ReadPropertyConditional-ACK ::= SEQUENCE { listOfPReadAccessResults SEQUENCE OF ReadAccessResult OPTIONAL } */
static guint fReadPropertyConditionalAck(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset)
/* ReadPropertyConditional-ACK ::= SEQUENCE { listOfPReadAccessResults SEQUENCE OF ReadAccessResult OPTIONAL } */ static guint fReadPropertyConditionalAck(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset)
{ return fReadAccessResult(tvb, pinfo, tree, offset); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This function will ASSERT if: The local APIC is not globally enabled. The local APIC is not working under XAPIC mode. The local APIC is not software enabled. */
UINTN EFIAPI InternalX86GetApicBase(VOID)
/* This function will ASSERT if: The local APIC is not globally enabled. The local APIC is not working under XAPIC mode. The local APIC is not software enabled. */ UINTN EFIAPI InternalX86GetApicBase(VOID)
{ UINTN MsrValue; UINTN ApicBase; MsrValue = (UINTN)AsmReadMsr64 (27); ApicBase = MsrValue & 0xffffff000ULL; ASSERT ((MsrValue & BIT11) != 0); ASSERT ((MsrValue & BIT10) == 0); ASSERT ((MmioRead32 (ApicBase + APIC_SVR) & BIT8) != 0); return ApicBase; }
tianocore/edk2
C++
Other
4,240
/* Convert an encoded 1 byte transport value (5 bits mantissa, 3 bits exponent) to an uplink/downlink speed value */
static uint32_t deserialize_gw_speed(uint8_t value)
/* Convert an encoded 1 byte transport value (5 bits mantissa, 3 bits exponent) to an uplink/downlink speed value */ static uint32_t deserialize_gw_speed(uint8_t value)
{ return 0; } if (value == UINT8_MAX) { return MAX_SMARTGW_SPEED; } speed = (value >> 3) + 1; exp = value & 7; while (exp-- > 0) { speed *= 10; } return speed; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* when receiving completed, set RS bit in ENET_DMA_STAT register will immediately set */
void enet_rx_desc_immediate_receive_complete_interrupt(enet_descriptors_struct *desc)
/* when receiving completed, set RS bit in ENET_DMA_STAT register will immediately set */ void enet_rx_desc_immediate_receive_complete_interrupt(enet_descriptors_struct *desc)
{ desc->control_buffer_size &= ~ENET_RDES1_DINTC; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Pop a message referring to the current filter off the statusbar. */
void statusbar_pop_filter_msg(void)
/* Pop a message referring to the current filter off the statusbar. */ void statusbar_pop_filter_msg(void)
{ if (status_levels[STATUS_LEVEL_FILTER] > 0) { status_levels[STATUS_LEVEL_FILTER]--; } gtk_statusbar_pop(GTK_STATUSBAR(info_bar), filter_ctx); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Sets the initialization vector in the DES module. */
bool DESIVSet(uint32_t ui32Base, uint32_t *pui32IVdata)
/* Sets the initialization vector in the DES module. */ bool DESIVSet(uint32_t ui32Base, uint32_t *pui32IVdata)
{ ASSERT(ui32Base == DES_BASE); if ((HWREG(ui32Base + DES_O_CTRL) & DES_CTRL_CONTEXT) == 0) { return (false); } HWREG(ui32Base + DES_O_IV_L) = pui32IVdata[0]; HWREG(ui32Base + DES_O_IV_H) = pui32IVdata[1]; return (true); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns zero on success or %-ENOENT on failure. */
int blocking_notifier_chain_unregister(struct blocking_notifier_head *nh, struct notifier_block *n)
/* Returns zero on success or %-ENOENT on failure. */ int blocking_notifier_chain_unregister(struct blocking_notifier_head *nh, struct notifier_block *n)
{ int ret; if (unlikely(system_state == SYSTEM_BOOTING)) return notifier_chain_unregister(&nh->head, n); down_write(&nh->rwsem); ret = notifier_chain_unregister(&nh->head, n); up_write(&nh->rwsem); return ret; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Clear all the interrutp status bits, these bits are Write-Clean. */
VOID EhcAckAllInterrupt(IN USB2_HC_DEV *Ehc)
/* Clear all the interrutp status bits, these bits are Write-Clean. */ VOID EhcAckAllInterrupt(IN USB2_HC_DEV *Ehc)
{ EhcWriteOpReg (Ehc, EHC_USBSTS_OFFSET, USBSTS_INTACK_MASK); }
tianocore/edk2
C++
Other
4,240
/* Reads and returns the current value of performance counter specified by Index. This function is only available on IA-32 and X64. */
UINT64 EFIAPI AsmReadPmc(IN UINT32 Index)
/* Reads and returns the current value of performance counter specified by Index. This function is only available on IA-32 and X64. */ UINT64 EFIAPI AsmReadPmc(IN UINT32 Index)
{ UINT32 LowData; UINT32 HiData; __asm__ __volatile__ ( "rdpmc" : "=a" (LowData), "=d" (HiData) : "c" (Index) ); return (((UINT64)HiData) << 32) | LowData; }
tianocore/edk2
C++
Other
4,240
/* Converts a text device path node to Vendor defined VT100 device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextVenVt100(IN CHAR16 *TextDeviceNode)
/* Converts a text device path node to Vendor defined VT100 device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextVenVt100(IN CHAR16 *TextDeviceNode)
{ VENDOR_DEVICE_PATH *Vendor; Vendor = (VENDOR_DEVICE_PATH *)CreateDeviceNode ( MESSAGING_DEVICE_PATH, MSG_VENDOR_DP, (UINT16)sizeof (VENDOR_DEVICE_PATH) ); CopyGuid (&Vendor->Guid, &gEfiVT100Guid); return (EFI_DEVICE_PATH_PROTOCOL *)Vendor; }
tianocore/edk2
C++
Other
4,240
/* Creates the metatables for the objects and registers the driver open method. */
LUASQL_API int luaopen_luasql_postgres(lua_State *L)
/* Creates the metatables for the objects and registers the driver open method. */ LUASQL_API int luaopen_luasql_postgres(lua_State *L)
{ {"postgres", create_environment}, {NULL, NULL}, }; create_metatables (L); luaL_openlib (L, LUASQL_TABLENAME, driver, 0); luasql_set_info (L); return 1; }
DC-SWAT/DreamShell
C++
null
404
/* This takes in the register number and the System Context, and returns a pointer to the RegNumber-th register in gdb ordering It is, by default, set to find the register pointer of the ARM member */
UINTN* FindPointerToRegister(IN EFI_SYSTEM_CONTEXT SystemContext, IN UINTN RegNumber)
/* This takes in the register number and the System Context, and returns a pointer to the RegNumber-th register in gdb ordering It is, by default, set to find the register pointer of the ARM member */ UINTN* FindPointerToRegister(IN EFI_SYSTEM_CONTEXT SystemContext, IN UINTN RegNumber)
{ UINT8 *TempPtr; ASSERT (gRegisterOffsets[RegNumber] < 0xF00); TempPtr = ((UINT8 *)SystemContext.SystemContextArm) + gRegisterOffsets[RegNumber]; return (UINT32 *)TempPtr; }
tianocore/edk2
C++
Other
4,240
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
/* UART MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_UART_MspDeInit(UART_HandleTypeDef *huart)
{ if(huart->Instance==LPUART1) { __HAL_RCC_LPUART1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_3|GPIO_PIN_2); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Do any tidying up before marking online and running the idle loop */
static void __cpuinit sb1250_smp_finish(void)
/* Do any tidying up before marking online and running the idle loop */ static void __cpuinit sb1250_smp_finish(void)
{ extern void sb1250_clockevent_init(void); sb1250_clockevent_init(); local_irq_enable(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Handling for system calls applied via the various interfaces to a X.25 socket object. */
static int x25_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen)
/* Handling for system calls applied via the various interfaces to a X.25 socket object. */ static int x25_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen)
{ int opt; struct sock *sk = sock->sk; int rc = -ENOPROTOOPT; lock_kernel(); if (level != SOL_X25 || optname != X25_QBITINCL) goto out; rc = -EINVAL; if (optlen < sizeof(int)) goto out; rc = -EFAULT; if (get_user(opt, (int __user *)optval)) goto out; x25_sk(sk)->qbitincl = !!opt; rc = 0; out: unlock_kernel(); return rc; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return a register to the table so it can be used later. */
static void free_reg(compiler_state_t *, int)
/* Return a register to the table so it can be used later. */ static void free_reg(compiler_state_t *, int)
{ cstate->regused[n] = 0; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Sends a buffer of data bytes in non-blocking way. */
static void ECSPI_WriteNonBlocking(ECSPI_Type *base, uint32_t *buffer, size_t size)
/* Sends a buffer of data bytes in non-blocking way. */ static void ECSPI_WriteNonBlocking(ECSPI_Type *base, uint32_t *buffer, size_t size)
{ size_t i = 0U; for (i = 0U; i < size; i++) { if (buffer != NULL) { base->TXDATA = *buffer++; } else { ECSPI_WriteData(base, ECSPI_DUMMYDATA); } } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param base TDET peripheral base address param result Pointer to uint32_t where to write Status Register read value. Use tdet_status_flag_t to decode individual flags. return kStatus_Fail when Status Register reading is not allowed return kStatus_Success when result is written with the Status Register read value */
status_t TDET_GetStatusFlags(DIGTMP_Type *base, uint32_t *result)
/* param base TDET peripheral base address param result Pointer to uint32_t where to write Status Register read value. Use tdet_status_flag_t to decode individual flags. return kStatus_Fail when Status Register reading is not allowed return kStatus_Success when result is written with the Status Register read value */ status_t TDET_GetStatusFlags(DIGTMP_Type *base, uint32_t *result)
{ status_t status; if (result != NULL) { *result = base->SR; status = kStatus_Success; } else { status = kStatus_Fail; } return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param base SAI base pointer. param handle SAI eDMA handle pointer. */
void SAI_TransferTerminateReceive(I2S_Type *base, sai_handle_t *handle)
/* param base SAI base pointer. param handle SAI eDMA handle pointer. */ void SAI_TransferTerminateReceive(I2S_Type *base, sai_handle_t *handle)
{ assert(handle); SAI_TransferAbortReceive(base, handle); memset(handle->saiQueue, 0U, sizeof(handle->saiQueue)); memset(handle->transferSize, 0U, sizeof(handle->transferSize)); handle->queueUser = 0U; handle->queueDriver = 0U; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns: A newly allocated string that must be freed with g_free() */
gchar* g_unix_mount_guess_name(GUnixMountEntry *mount_entry)
/* Returns: A newly allocated string that must be freed with g_free() */ gchar* g_unix_mount_guess_name(GUnixMountEntry *mount_entry)
{ char *name; if (strcmp (mount_entry->mount_path, "/") == 0) name = g_strdup (_("Filesystem root")); else name = g_filename_display_basename (mount_entry->mount_path); return name; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Attempt the next step in loading the multicast lists. If this attempt fails to complete then it will be scheduled and this function called again later from elsewhere. */
static void mc32_reset_multicast_list(struct net_device *dev)
/* Attempt the next step in loading the multicast lists. If this attempt fails to complete then it will be scheduled and this function called again later from elsewhere. */ static void mc32_reset_multicast_list(struct net_device *dev)
{ do_mc32_set_multicast_list(dev,1); }
robutest/uclinux
C++
GPL-2.0
60
/* This function will turn on the OLED display, causing it to display the contents of its internal frame buffer. */
void OSRAMDisplayOn(void)
/* This function will turn on the OLED display, causing it to display the contents of its internal frame buffer. */ void OSRAMDisplayOn(void)
{ OSRAMWriteFirst(0x80); OSRAMWriteByte(0xad); OSRAMWriteByte(0x80); OSRAMWriteByte(0x8b); OSRAMWriteByte(0x80); OSRAMWriteFinal(0xaf); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Callback function which provided by user to remove one node in NetDestroyLinkList process. */
EFI_STATUS EFIAPI ArpDestroyChildEntryInHandleBuffer(IN LIST_ENTRY *Entry, IN VOID *Context)
/* Callback function which provided by user to remove one node in NetDestroyLinkList process. */ EFI_STATUS EFIAPI ArpDestroyChildEntryInHandleBuffer(IN LIST_ENTRY *Entry, IN VOID *Context)
{ ARP_INSTANCE_DATA *Instance; EFI_SERVICE_BINDING_PROTOCOL *ServiceBinding; if ((Entry == NULL) || (Context == NULL)) { return EFI_INVALID_PARAMETER; } Instance = NET_LIST_USER_STRUCT_S (Entry, ARP_INSTANCE_DATA, List, ARP_INSTANCE_DATA_SIGNATURE); ServiceBinding = (EFI_SERVICE_BINDING_PROTOCOL *)Context; return ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle); }
tianocore/edk2
C++
Other
4,240
/* Prevent the memory pages used for page table from been overwritten. */
STATIC VOID EnablePageTableProtection(IN UINTN PageTableBase, IN BOOLEAN Level4Paging)
/* Prevent the memory pages used for page table from been overwritten. */ STATIC VOID EnablePageTableProtection(IN UINTN PageTableBase, IN BOOLEAN Level4Paging)
{ PAGE_TABLE_POOL *HeadPool; PAGE_TABLE_POOL *Pool; UINT64 PoolSize; EFI_PHYSICAL_ADDRESS Address; if (mPageTablePool == NULL) { return; } HeadPool = mPageTablePool; Pool = HeadPool; do { Address = (EFI_PHYSICAL_ADDRESS)(UINTN)Pool; PoolSize = Pool->Offset + EFI_PAGES_TO_SIZE (Pool->FreePages); while (PoolSize > 0) { SetPageTablePoolReadOnly (PageTableBase, Address, Level4Paging); Address += PAGE_TABLE_POOL_UNIT_SIZE; PoolSize -= PAGE_TABLE_POOL_UNIT_SIZE; } Pool = Pool->NextPool; } while (Pool != HeadPool); }
tianocore/edk2
C++
Other
4,240
/* tps65218_toggle_fseal() - Perform the sequence that toggles the FSEAL bit. */
int tps65218_toggle_fseal(void)
/* tps65218_toggle_fseal() - Perform the sequence that toggles the FSEAL bit. */ int tps65218_toggle_fseal(void)
{ if (tps65218_reg_write(TPS65218_PROT_LEVEL_NONE, TPS65218_PASSWORD, 0xb1, TPS65218_MASK_ALL_BITS)) return -EBADE; if (tps65218_reg_write(TPS65218_PROT_LEVEL_NONE, TPS65218_PASSWORD, 0xfe, TPS65218_MASK_ALL_BITS)) return -EBADE; if (tps65218_reg_write(TPS65218_PROT_LEVEL_NONE, TPS65218_PASSWORD, 0xa3, TPS65218_MASK_ALL_BITS)) return -EBADE; return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Set the callback that gets the Source Rp value from the Device Policy Manager. */
void usbc_set_policy_cb_get_src_rp(const struct device *dev, const policy_cb_get_src_rp_t policy_cb_get_src_rp)
/* Set the callback that gets the Source Rp value from the Device Policy Manager. */ void usbc_set_policy_cb_get_src_rp(const struct device *dev, const policy_cb_get_src_rp_t policy_cb_get_src_rp)
{ struct usbc_port_data *data = dev->data; data->policy_cb_get_src_rp = policy_cb_get_src_rp; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This comparator searches for the next bulk IN or OUT endpoint within the current interface, aborting the search if another interface descriptor is found before the required endpoint. */
uint8_t DComp_NextMIDIStreamingDataEndpoint(void *CurrentDescriptor)
/* This comparator searches for the next bulk IN or OUT endpoint within the current interface, aborting the search if another interface descriptor is found before the required endpoint. */ uint8_t DComp_NextMIDIStreamingDataEndpoint(void *CurrentDescriptor)
{ USB_Descriptor_Header_t* Header = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Header_t); if (Header->Type == DTYPE_Endpoint) { USB_Descriptor_Endpoint_t* Endpoint = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Endpoint_t); if ((Endpoint->Attributes & EP_TYPE_MASK) == EP_TYPE_BULK) return DESCRIPTOR_SEARCH_Found; } else if (Header->Type == DTYPE_Interface) { return DESCRIPTOR_SEARCH_Fail; } return DESCRIPTOR_SEARCH_NotFound; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* This function will check if the specified TLS handshake was done. */
BOOLEAN EFIAPI CryptoServiceTlsInHandshake(IN VOID *Tls)
/* This function will check if the specified TLS handshake was done. */ BOOLEAN EFIAPI CryptoServiceTlsInHandshake(IN VOID *Tls)
{ return CALL_BASECRYPTLIB (Tls.Services.InHandshake, TlsInHandshake, (Tls), FALSE); }
tianocore/edk2
C++
Other
4,240
/* Event handler for the USB device Start Of Frame event. */
void EVENT_USB_Device_StartOfFrame(void)
/* Event handler for the USB device Start Of Frame event. */ void EVENT_USB_Device_StartOfFrame(void)
{ HID_Device_MillisecondElapsed(&Generic_HID_Interface); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* 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==TIM1) { __HAL_RCC_TIM1_CLK_DISABLE(); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Adds the driver structure to the list of registered drivers Returns a negative value on error, otherwise 0. If no error occurred, the driver remains registered even if no device was claimed during registration. */
int tc_register_driver(struct tc_driver *tdrv)
/* Adds the driver structure to the list of registered drivers Returns a negative value on error, otherwise 0. If no error occurred, the driver remains registered even if no device was claimed during registration. */ int tc_register_driver(struct tc_driver *tdrv)
{ return driver_register(&tdrv->driver); }
robutest/uclinux
C++
GPL-2.0
60
/* Disable channel and remove it from the map of used channels. This is the alternative API, which requires the caller to store the mask of used channels. */
void ppi_remove_channel(uint32_t *chan_map, uint8_t chan_num)
/* Disable channel and remove it from the map of used channels. This is the alternative API, which requires the caller to store the mask of used channels. */ void ppi_remove_channel(uint32_t *chan_map, uint8_t chan_num)
{ ppi_disable_channels(PPI_CH(chan_num)); *chan_map &= ~(PPI_CH(chan_num)); }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Check the received packet using the destination port. */
BOOLEAN PxeBcCheckByDestPort(IN EFI_PXE_BASE_CODE_MODE *Mode, IN VOID *Session, IN OUT UINT16 *DestPort, IN UINT16 OpFlags)
/* Check the received packet using the destination port. */ BOOLEAN PxeBcCheckByDestPort(IN EFI_PXE_BASE_CODE_MODE *Mode, IN VOID *Session, IN OUT UINT16 *DestPort, IN UINT16 OpFlags)
{ UINT16 Port; if (Mode->UsingIpv6) { Port = ((EFI_UDP6_SESSION_DATA *)Session)->DestinationPort; } else { Port = ((EFI_UDP4_SESSION_DATA *)Session)->DestinationPort; } if ((OpFlags & EFI_PXE_BASE_CODE_UDP_OPFLAGS_ANY_DEST_PORT) != 0) { if (DestPort != NULL) { *DestPort = Port; } return TRUE; } else if ((DestPort != NULL) && (*DestPort == Port)) { return TRUE; } return FALSE; }
tianocore/edk2
C++
Other
4,240
/* Process some data. This handles the simple case where no context is required. */
process_data_simple_main(j_decompress_ptr cinfo, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
/* Process some data. This handles the simple case where no context is required. */ process_data_simple_main(j_decompress_ptr cinfo, JSAMPARRAY output_buf, JDIMENSION *out_row_ctr, JDIMENSION out_rows_avail)
{ my_main_ptr mainp = (my_main_ptr) cinfo->main; JDIMENSION rowgroups_avail; if (! mainp->buffer_full) { if (! (*cinfo->coef->decompress_data) (cinfo, mainp->buffer)) return; mainp->buffer_full = TRUE; } rowgroups_avail = (JDIMENSION) cinfo->min_DCT_v_scaled_size; (*cinfo->post->post_process_data) (cinfo, mainp->buffer, &mainp->rowgroup_ctr, rowgroups_avail, output_buf, out_row_ctr, out_rows_avail); if (mainp->rowgroup_ctr >= rowgroups_avail) { mainp->buffer_full = FALSE; mainp->rowgroup_ctr = 0; } }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Reads a register from an external ULPI-connected USB PHY. */
uint8_t USBULPIRegRead(uint32_t ui32Base, uint8_t ui8Reg)
/* Reads a register from an external ULPI-connected USB PHY. */ uint8_t USBULPIRegRead(uint32_t ui32Base, uint8_t ui8Reg)
{ ASSERT(ui32Base == USB0_BASE); HWREGB(ui32Base + USB_O_ULPIREGADDR) = ui8Reg; HWREGB(ui32Base + USB_O_ULPIREGCTL) = USB_ULPIREGCTL_RDWR | USB_ULPIREGCTL_REGACC; while ((HWREGB(ui32Base + USB_O_ULPIREGCTL) & USB_ULPIREGCTL_REGCMPLT) == 0) { } HWREGB(ui32Base + USB_O_ULPIREGCTL) = 0; return (HWREGB(ui32Base + USB_O_ULPIREGDATA)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* If we get a read error, return FALSE with *err and *err_info set appropriately. */
gboolean wtap_read_bytes_or_eof(FILE_T fh, void *buf, unsigned int count, int *err, gchar **err_info)
/* If we get a read error, return FALSE with *err and *err_info set appropriately. */ gboolean wtap_read_bytes_or_eof(FILE_T fh, void *buf, unsigned int count, int *err, gchar **err_info)
{ int bytes_read; bytes_read = file_read(buf, count, fh); if (bytes_read < 0 || (guint)bytes_read != count) { *err = file_error(fh, err_info); if (*err == 0 && bytes_read > 0) *err = WTAP_ERR_SHORT_READ; return FALSE; } return TRUE; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Returns: TRUE if the stream can be truncated, FALSE otherwise. */
gboolean g_seekable_can_truncate(GSeekable *seekable)
/* Returns: TRUE if the stream can be truncated, FALSE otherwise. */ gboolean g_seekable_can_truncate(GSeekable *seekable)
{ GSeekableIface *iface; g_return_val_if_fail (G_IS_SEEKABLE (seekable), FALSE); iface = G_SEEKABLE_GET_IFACE (seekable); return (* iface->can_truncate) (seekable); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Selects the specified I2C NACK position in master receiver mode. This function is useful in I2C Master Receiver mode when the number of data to be received is equal to 2. In this case, this function should be called (with parameter I2C_NACKPosition_Next) before data reception starts,as described in the 2-byte reception procedure recommended in Reference Manual in Section: Master receiver. */
void I2CNACKPositionConfig(unsigned long ulBase, unsigned long ulNACKPosition)
/* Selects the specified I2C NACK position in master receiver mode. This function is useful in I2C Master Receiver mode when the number of data to be received is equal to 2. In this case, this function should be called (with parameter I2C_NACKPosition_Next) before data reception starts,as described in the 2-byte reception procedure recommended in Reference Manual in Section: Master receiver. */ void I2CNACKPositionConfig(unsigned long ulBase, unsigned long ulNACKPosition)
{ xASSERT((ulBase == I2C1_BASE) || (ulBase == I2C2_BASE)); xASSERT((ulNACKPosition == I2C_NACKPOS_NEXT) || (ulNACKPosition == I2C_NACKPOS_CURRENT)); xHWREG(ulBase + I2C_CR1) &= ~I2C_CR1_POS; xHWREG(ulBase + I2C_CR1) |= ulNACKPosition; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Get the status of a codec GPIO pin */
enum wm97xx_gpio_status wm97xx_get_gpio(struct wm97xx *wm, u32 gpio)
/* Get the status of a codec GPIO pin */ enum wm97xx_gpio_status wm97xx_get_gpio(struct wm97xx *wm, u32 gpio)
{ u16 status; enum wm97xx_gpio_status ret; mutex_lock(&wm->codec_mutex); status = wm97xx_reg_read(wm, AC97_GPIO_STATUS); if (status & gpio) ret = WM97XX_GPIO_HIGH; else ret = WM97XX_GPIO_LOW; mutex_unlock(&wm->codec_mutex); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* set the percentage of blocks at which to start culling */
static int cachefiles_daemon_bcull(struct cachefiles_cache *, char *)
/* set the percentage of blocks at which to start culling */ static int cachefiles_daemon_bcull(struct cachefiles_cache *, char *)
{ unsigned long bcull; _enter(",%s", args); if (!*args) return -EINVAL; bcull = simple_strtoul(args, &args, 10); if (args[0] != '%' || args[1] != '\0') return -EINVAL; if (bcull <= cache->bstop_percent || bcull >= cache->brun_percent) return cachefiles_daemon_range_error(cache, args); cache->bcull_percent = bcull; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Disables the interrupt mask for a specific port pin. */
void gpioIntDisable(uint32_t portNum, uint32_t bitPos)
/* Disables the interrupt mask for a specific port pin. */ void gpioIntDisable(uint32_t portNum, uint32_t bitPos)
{ if (!_gpioInitialised) gpioInit(); switch (portNum) { case 0: GPIO_GPIO0IE &= ~(0x1<<bitPos); break; case 1: GPIO_GPIO1IE &= ~(0x1<<bitPos); break; case 2: GPIO_GPIO2IE &= ~(0x1<<bitPos); break; case 3: GPIO_GPIO3IE &= ~(0x1<<bitPos); break; default: break; } return; }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Obtains the base address of the flash memory available to the user program. This is basically the last address in the flashLayout table converted to the physical address on the last page, because this is where the address will be in. */
blt_addr FlashGetUserProgBaseAddress(void)
/* Obtains the base address of the flash memory available to the user program. This is basically the last address in the flashLayout table converted to the physical address on the last page, because this is where the address will be in. */ blt_addr FlashGetUserProgBaseAddress(void)
{ blt_addr end_address_global; blt_addr end_address_physical_page_window; blt_addr end_address_physical_page_last; end_address_global = FLASH_END_ADDRESS + 1; end_address_physical_page_window = FlashGetPhysAddr(end_address_global); end_address_physical_page_last = end_address_physical_page_window + FLASH_PAGE_SIZE; return end_address_physical_page_last; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* This functions is used to reset the EZRadio device by applying shutdown and releasing it. After this function */
void ezradio_reset(void)
/* This functions is used to reset the EZRadio device by applying shutdown and releasing it. After this function */ void ezradio_reset(void)
{ USTIMER_Init(); ezradio_hal_AssertShutdown(); USTIMER_Delay( 10u ); ezradio_hal_DeassertShutdown(); USTIMER_Delay( 100u ); ezradio_comm_ClearCTS(); USTIMER_DeInit(); }
remotemcu/remcu-chip-sdks
C++
null
436
/* RETURNS: ID of the new group, NULL on failure. */
void* devres_open_group(struct device *dev, void *id, gfp_t gfp)
/* RETURNS: ID of the new group, NULL on failure. */ void* devres_open_group(struct device *dev, void *id, gfp_t gfp)
{ struct devres_group *grp; unsigned long flags; grp = kmalloc(sizeof(*grp), gfp); if (unlikely(!grp)) return NULL; grp->node[0].release = &group_open_release; grp->node[1].release = &group_close_release; INIT_LIST_HEAD(&grp->node[0].entry); INIT_LIST_HEAD(&grp->node[1].entry); set_node_dbginfo(&grp->node[0], "grp<", 0); set_node_dbginfo(&grp->node[1], "grp>", 0); grp->id = grp; if (id) grp->id = id; spin_lock_irqsave(&dev->devres_lock, flags); add_dr(dev, &grp->node[0]); spin_unlock_irqrestore(&dev->devres_lock, flags); return grp->id; }
robutest/uclinux
C++
GPL-2.0
60
/* uio_unregister_device - unregister a industrial IO device @info: UIO device capabilities */
void uio_unregister_device(struct uio_info *info)
/* uio_unregister_device - unregister a industrial IO device @info: UIO device capabilities */ void uio_unregister_device(struct uio_info *info)
{ struct uio_device *idev; if (!info || !info->uio_dev) return; idev = info->uio_dev; uio_free_minor(idev); if (info->irq >= 0) free_irq(info->irq, idev); uio_dev_del_attributes(idev); dev_set_drvdata(idev->dev, NULL); device_destroy(uio_class->class, MKDEV(uio_major, idev->minor)); kfree(idev); uio_class_destroy(); return; }
robutest/uclinux
C++
GPL-2.0
60
/* WWDG MSP Initialization This function configures the hardware resources used in this example. */
void HAL_WWDG_MspInit(WWDG_HandleTypeDef *hwwdg)
/* WWDG MSP Initialization This function configures the hardware resources used in this example. */ void HAL_WWDG_MspInit(WWDG_HandleTypeDef *hwwdg)
{ if(hwwdg->Instance==WWDG1) { __HAL_RCC_WWDG1_CLK_ENABLE(); HAL_NVIC_SetPriority(WWDG1_IRQn, 0, 0); HAL_NVIC_EnableIRQ(WWDG1_IRQn); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Register address automatically incremented during a multiple byte access with a serial interface (I2C or SPI).. */
int32_t lps22hb_auto_add_inc_set(stmdev_ctx_t *ctx, uint8_t val)
/* Register address automatically incremented during a multiple byte access with a serial interface (I2C or SPI).. */ int32_t lps22hb_auto_add_inc_set(stmdev_ctx_t *ctx, uint8_t val)
{ lps22hb_ctrl_reg2_t ctrl_reg2; int32_t ret; ret = lps22hb_read_reg(ctx, LPS22HB_CTRL_REG2, (uint8_t*)&ctrl_reg2, 1); if(ret == 0){ ctrl_reg2.if_add_inc = val; ret = lps22hb_write_reg(ctx, LPS22HB_CTRL_REG2, (uint8_t*)&ctrl_reg2, 1); } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Get the length of a particular PDU (+6 bytes for the frame) */
static guint get_aol_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
/* Get the length of a particular PDU (+6 bytes for the frame) */ static guint get_aol_pdu_len(packet_info *pinfo _U_, tvbuff_t *tvb, int offset, void *data _U_)
{ guint16 plen; plen = tvb_get_ntohs(tvb,offset+3); return plen + 6; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Set GPIO Pin Mode. Sets the Pin Direction and Analog/Digital Mode, and Output Pin Pullup, for a set of GPIO pins on a given GPIO port. */
void gpio_mode_setup(uint32_t gpioport, uint8_t mode, uint8_t pull_up_down, uint16_t gpios)
/* Set GPIO Pin Mode. Sets the Pin Direction and Analog/Digital Mode, and Output Pin Pullup, for a set of GPIO pins on a given GPIO port. */ void gpio_mode_setup(uint32_t gpioport, uint8_t mode, uint8_t pull_up_down, uint16_t gpios)
{ uint16_t i; uint32_t moder, pupd; moder = GPIO_MODER(gpioport); pupd = GPIO_PUPDR(gpioport); for (i = 0; i < 16; i++) { if (!((1 << i) & gpios)) { continue; } moder &= ~GPIO_MODE_MASK(i); moder |= GPIO_MODE(i, mode); pupd &= ~GPIO_PUPD_MASK(i); pupd |= GPIO_PUPD(i, pull_up_down); } GPIO_MODER(gpioport) = moder; GPIO_PUPDR(gpioport) = pupd; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Returns which value to write to the control register. For 10/100, the value is slightly different */
static uint mii_cr_init(uint mii_reg, struct tsec_private *priv)
/* Returns which value to write to the control register. For 10/100, the value is slightly different */ static uint mii_cr_init(uint mii_reg, struct tsec_private *priv)
{ if (priv->flags & TSEC_GIGABIT) return MIIM_CONTROL_INIT; else return MIIM_CR_INIT; }
EmcraftSystems/u-boot
C++
Other
181