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
/* Get state of the modem control input lines */
static u_int atmel_get_mctrl(struct uart_port *port)
/* Get state of the modem control input lines */ static u_int atmel_get_mctrl(struct uart_port *port)
{ unsigned int status, ret = 0; status = UART_GET_CSR(port); if (!(status & ATMEL_US_DCD)) ret |= TIOCM_CD; if (!(status & ATMEL_US_CTS)) ret |= TIOCM_CTS; if (!(status & ATMEL_US_DSR)) ret |= TIOCM_DSR; if (!(status & ATMEL_US_RI)) ret |= TIOCM_RI; return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Invoked when AER root service driver is unloaded. */
static void __exit aer_service_exit(void)
/* Invoked when AER root service driver is unloaded. */ static void __exit aer_service_exit(void)
{ pcie_port_service_unregister(&aerdriver); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns the MSS value of a TCP connection according to the socket descriptor. getmssvalue */
UINT16 CC3000_EXPORT() getmssvalue(INT32 sd)
/* Returns the MSS value of a TCP connection according to the socket descriptor. getmssvalue */ UINT16 CC3000_EXPORT() getmssvalue(INT32 sd)
{ UINT8 *ptr, *args; UINT16 ret; ptr = tSLInformation.pucTxCommandBuffer; args = (ptr + HEADERS_SIZE_CMD); args = UINT32_TO_STREAM(args, sd); hci_command_send(HCI_CMND_GETMSSVALUE, ptr, SOCKET_GET_MSS_VALUE_PARAMS_LEN); SimpleLinkWaitEvent(HCI_EVNT_GETMSSVALUE, &ret); return ret; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* counts length of the variable length encoded field */
static int count_vle_bytes(tvbuff_t *tvb, int offset)
/* counts length of the variable length encoded field */ static int count_vle_bytes(tvbuff_t *tvb, int offset)
{ int byte_count = 1; if(tvb_get_guint8(tvb, offset) & 0x80) byte_count = 2; if(tvb_get_guint8(tvb, offset+1) & 0x80) byte_count = 4; return byte_count; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Function: MX25_EXSO Arguments: None. Description: The EXSO instruction is for exiting the secured OTP mode. Return Message: FlashOperationSuccess */
ReturnMsg MX25_EXSO(void)
/* Function: MX25_EXSO Arguments: None. Description: The EXSO instruction is for exiting the secured OTP mode. Return Message: FlashOperationSuccess */ ReturnMsg MX25_EXSO(void)
{ CS_Low(); SendByte( FLASH_CMD_EXSO, SIO ); CS_High(); return FlashOperationSuccess; }
remotemcu/remcu-chip-sdks
C++
null
436
/* To find the BlockName in the string with same value. */
EFI_STATUS FindSameBlockElement(IN EFI_STRING String, IN EFI_STRING BlockName, IN UINT8 *Buffer, OUT BOOLEAN *Found, IN UINTN BufferLen)
/* To find the BlockName in the string with same value. */ EFI_STATUS FindSameBlockElement(IN EFI_STRING String, IN EFI_STRING BlockName, IN UINT8 *Buffer, OUT BOOLEAN *Found, IN UINTN BufferLen)
{ EFI_STRING BlockPtr; UINTN Length; UINT8 *TempBuffer; EFI_STATUS Status; TempBuffer = NULL; *Found = FALSE; BlockPtr = StrStr (String, BlockName); while (BlockPtr != NULL) { BlockPtr += StrLen (BlockName); Status = GetValueOfNumber (BlockPtr, &TempBuffer, &Length); i...
tianocore/edk2
C++
Other
4,240
/* Clear the I2C time out flag of the specified I2C port. The */
void I2CTimeoutFlagClear(unsigned long ulBase)
/* Clear the I2C time out flag of the specified I2C port. The */ void I2CTimeoutFlagClear(unsigned long ulBase)
{ xASSERT((ulBase == I2C0_BASE)); xHWREG(ulBase + I2C_TOC) |= I2C_TOC_TIF; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* this function is a POSIX compliant version, which will get file status. */
int fstat(int fildes, struct stat *buf)
/* this function is a POSIX compliant version, which will get file status. */ int fstat(int fildes, struct stat *buf)
{ struct dfs_fd *d; d = fd_get(fildes); if (d == NULL) { rt_set_errno(-EBADF); return -1; } buf->st_dev = 0; buf->st_mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | S_IWGRP | S_IWOTH; if (d->type == FT_DIRECTORY) { buf->st_mode &= ~...
pikasTech/PikaPython
C++
MIT License
1,403
/* param base FLEXSPI peripheral base address. param clockSource clockSource of type #flexspi_read_sample_clock_t */
void FLEXSPI_UpdateRxSampleClock(FLEXSPI_Type *base, flexspi_read_sample_clock_t clockSource)
/* param base FLEXSPI peripheral base address. param clockSource clockSource of type #flexspi_read_sample_clock_t */ void FLEXSPI_UpdateRxSampleClock(FLEXSPI_Type *base, flexspi_read_sample_clock_t clockSource)
{ uint32_t mcr0Val; while (!FLEXSPI_GetBusIdleStatus(base)) { } mcr0Val = base->MCR0; mcr0Val &= ~FLEXSPI_MCR0_RXCLKSRC_MASK; mcr0Val |= FLEXSPI_MCR0_RXCLKSRC(clockSource); base->MCR0 = mcr0Val; FLEXSPI_SoftwareReset(base); }
eclipse-threadx/getting-started
C++
Other
310
/* Sets the pin mode and configures the pin for use by ADC */
void PinTypeADC(unsigned long ulPin, unsigned long ulPinMode)
/* Sets the pin mode and configures the pin for use by ADC */ void PinTypeADC(unsigned long ulPin, unsigned long ulPinMode)
{ PinConfigSet(ulPin,PIN_STRENGTH_2MA,PIN_TYPE_ANALOG); }
micropython/micropython
C++
Other
18,334
/* Event handler for the CCID_PC_to_RDR_IccPowerOff message. This message is sent to the device whenever an application at the host wants to send a power off signal to a slot. */
uint8_t CALLBACK_CCID_IccPowerOff(USB_ClassInfo_CCID_Device_t *const CCIDInterfaceInfo, const uint8_t slot, uint8_t *const error)
/* Event handler for the CCID_PC_to_RDR_IccPowerOff message. This message is sent to the device whenever an application at the host wants to send a power off signal to a slot. */ uint8_t CALLBACK_CCID_IccPowerOff(USB_ClassInfo_CCID_Device_t *const CCIDInterfaceInfo, const uint8_t slot, uint8_t *const error)
{ if (slot < CCID_Interface.Config.TotalSlots) { *error = CCID_ERROR_NO_ERROR; return CCID_COMMANDSTATUS_PROCESSEDWITHOUTERROR | CCID_ICCSTATUS_NOICCPRESENT; } else { *error = CCID_ERROR_SLOT_NOT_FOUND; return CCID_COMMANDSTATUS_FAILED | CCID_ICCSTATUS_NOICCPRESENT; } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Check if device state is unclear according to sense data. */
BOOLEAN IsDeviceStateUnclear(IN ATAPI_REQUEST_SENSE_DATA *SenseData, IN UINTN SenseCounts)
/* Check if device state is unclear according to sense data. */ BOOLEAN IsDeviceStateUnclear(IN ATAPI_REQUEST_SENSE_DATA *SenseData, IN UINTN SenseCounts)
{ ATAPI_REQUEST_SENSE_DATA *SensePtr; UINTN Index; BOOLEAN Unclear; Unclear = FALSE; SensePtr = SenseData; for (Index = 0; Index < SenseCounts; Index++) { if (SensePtr->sense_key == 0x06) { Unclear = TRUE; break; } SensePtr++; } return Uncle...
tianocore/edk2
C++
Other
4,240
/* SVM polynomial instance init function. Classes are integer used as output of the function (instead of having -1,1 as class values). */
void arm_svm_polynomial_init_f32(arm_svm_polynomial_instance_f32 *S, uint32_t nbOfSupportVectors, uint32_t vectorDimension, float32_t intercept, const float32_t *dualCoefficients, const float32_t *supportVectors, const int32_t *classes, int32_t degree, float32_t coef0, float32_t gamma)
/* SVM polynomial instance init function. Classes are integer used as output of the function (instead of having -1,1 as class values). */ void arm_svm_polynomial_init_f32(arm_svm_polynomial_instance_f32 *S, uint32_t nbOfSupportVectors, uint32_t vectorDimension, float32_t intercept, const float32_t *dualCoefficients, c...
{ S->nbOfSupportVectors = nbOfSupportVectors; S->vectorDimension = vectorDimension; S->intercept = intercept; S->dualCoefficients = dualCoefficients; S->supportVectors = supportVectors; S->classes = classes; S->degree = degree; S->coef0 = coef0; S->gamma = gamma; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Allocate space for PRD table using ata_port_start(). Set PRD table address for PTERADD. (PRD Transfer End Read) */
static int scc_port_start(struct ata_port *ap)
/* Allocate space for PRD table using ata_port_start(). Set PRD table address for PTERADD. (PRD Transfer End Read) */ static int scc_port_start(struct ata_port *ap)
{ void __iomem *mmio = ap->ioaddr.bmdma_addr; int rc; rc = ata_port_start(ap); if (rc) return rc; out_be32(mmio + SCC_DMA_PTERADD, ap->prd_dma); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Deinitialize the SAIx peripheral registers to their default reset values. */
void SAI_DeInit(SAI_TypeDef *SAIx)
/* Deinitialize the SAIx peripheral registers to their default reset values. */ void SAI_DeInit(SAI_TypeDef *SAIx)
{ assert_param(IS_SAI_PERIPH(SAIx)); RCC_APB2PeriphResetCmd(RCC_APB2Periph_SAI1, ENABLE); RCC_APB2PeriphResetCmd(RCC_APB2Periph_SAI1, DISABLE); }
MaJerle/stm32f429
C++
null
2,036
/* This reads all available data from the mux's fifo and pushes the data to the tty layer. */
static void mux_read(struct uart_port *port)
/* This reads all available data from the mux's fifo and pushes the data to the tty layer. */ static void mux_read(struct uart_port *port)
{ int data; struct tty_struct *tty = port->state->port.tty; __u32 start_count = port->icount.rx; while(1) { data = __raw_readl(port->membase + IO_DATA_REG_OFFSET); if (MUX_STATUS(data)) continue; if (MUX_EOFIFO(data)) break; port->icount.rx++; if (MUX_BREAK(data)) { port->icount.brk++; if(uart...
robutest/uclinux
C++
GPL-2.0
60
/* For the prep_fn to work correctly we have to initialize the ALUA state for the device. */
static int alua_initialize(struct scsi_device *sdev, struct alua_dh_data *h)
/* For the prep_fn to work correctly we have to initialize the ALUA state for the device. */ static int alua_initialize(struct scsi_device *sdev, struct alua_dh_data *h)
{ int err; err = alua_std_inquiry(sdev, h); if (err != SCSI_DH_OK) goto out; err = alua_vpd_inquiry(sdev, h); if (err != SCSI_DH_OK) goto out; err = alua_rtpg(sdev, h); if (err != SCSI_DH_OK) goto out; out: return err; }
robutest/uclinux
C++
GPL-2.0
60
/* I2C Enable ACK. Enables acking of own 7/10 bit address */
void i2c_enable_ack(uint32_t i2c)
/* I2C Enable ACK. Enables acking of own 7/10 bit address */ void i2c_enable_ack(uint32_t i2c)
{ I2C_CR1(i2c) |= I2C_CR1_ACK; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Implements Simple File System Protocol interface function OpenVolume(). */
EFI_STATUS EFIAPI FatOpenVolume(IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This, OUT EFI_FILE_PROTOCOL **File)
/* Implements Simple File System Protocol interface function OpenVolume(). */ EFI_STATUS EFIAPI FatOpenVolume(IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This, OUT EFI_FILE_PROTOCOL **File)
{ EFI_STATUS Status; FAT_VOLUME *Volume; FAT_IFILE *IFile; Volume = VOLUME_FROM_VOL_INTERFACE (This); FatAcquireLock (); Status = FatOpenDirEnt (NULL, &Volume->RootDirEnt); if (EFI_ERROR (Status)) { goto Done; } Status = FatAllocateIFile (Volume->Root, &IFile); if (!EFI_ERROR (Status)) { ...
tianocore/edk2
C++
Other
4,240
/* ADC Enable Analog Watchdog for Injected Conversions. The analog watchdog allows the monitoring of an analog signal between two threshold levels. The thresholds must be preset. Comparison is done before data alignment takes place, so the thresholds are left-aligned. */
void adc_enable_analog_watchdog_injected(uint32_t adc)
/* ADC Enable Analog Watchdog for Injected Conversions. The analog watchdog allows the monitoring of an analog signal between two threshold levels. The thresholds must be preset. Comparison is done before data alignment takes place, so the thresholds are left-aligned. */ void adc_enable_analog_watchdog_injected(uint32...
{ ADC_CFGR1(adc) |= ADC_CFGR1_JAWD1EN; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Returns 1 if some data has been received and can be read from an USART; otherwise returns 0. */
unsigned char USART_IsDataAvailable(AT91S_USART *usart)
/* Returns 1 if some data has been received and can be read from an USART; otherwise returns 0. */ unsigned char USART_IsDataAvailable(AT91S_USART *usart)
{ if ((usart->US_CSR & AT91C_US_RXRDY) != 0) { return 1; } else { return 0; } }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* unix_connect() Returns a socket connected to a local unix socket. Returns -1 on failure. */
int unix_connect(char *)
/* unix_connect() Returns a socket connected to a local unix socket. Returns -1 on failure. */ int unix_connect(char *)
{ struct sockaddr_un sun; int s; if (uflag) { if ((s = unix_bind(unix_dg_tmp_socket)) < 0) return (-1); } else { if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) return (-1); } (void)fcntl(s, F_SETFD, 1); memset(&sun, 0, sizeof(struct sockaddr_un)); sun.sun_family = AF_UNIX; if (strlcpy(sun.sun_path, p...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Set pulse value for when the solenoid needs to pulse before reaching hold value. */
int32_t cn0415_pulse_set_val(struct cn0415_dev *dev, uint8_t *args)
/* Set pulse value for when the solenoid needs to pulse before reaching hold value. */ int32_t cn0415_pulse_set_val(struct cn0415_dev *dev, uint8_t *args)
{ dev->pulse_val = atof((char *)args); dev->param_array[PULSE_VAL_INT] = dev->pulse_val; dev->param_array[PULSE_VAL_DEC] = (uint32_t)(dev->pulse_val * 10000) % 10000; return flash_write(dev->param_array, FLASH_PARAM_SIZE); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Put Magnetometer in power down mode or not. */
void LSM303C_MagLowPower(uint16_t Mode)
/* Put Magnetometer in power down mode or not. */ void LSM303C_MagLowPower(uint16_t Mode)
{ uint8_t ctrl = 0x00; ctrl = MAGNETO_IO_Read(LSM303C_CTRL_REG3_M); ctrl &= ~(LSM303C_MAG_SELECTION_MODE); ctrl |= (uint8_t)Mode; MAGNETO_IO_Write(LSM303C_CTRL_REG3_M, ctrl); }
eclipse-threadx/getting-started
C++
Other
310
/* p is at least 6 bytes before the end of page */
static struct nilfs_dir_entry* nilfs_next_entry(struct nilfs_dir_entry *p)
/* p is at least 6 bytes before the end of page */ static struct nilfs_dir_entry* nilfs_next_entry(struct nilfs_dir_entry *p)
{ return (struct nilfs_dir_entry *)((char *)p + le16_to_cpu(p->rec_len)); }
robutest/uclinux
C++
GPL-2.0
60
/* If 32-bit MMIO register operations are not supported, then ASSERT(). */
UINT32 EFIAPI MmioWrite32(IN UINTN Address, IN UINT32 Value)
/* If 32-bit MMIO register operations are not supported, then ASSERT(). */ UINT32 EFIAPI MmioWrite32(IN UINTN Address, IN UINT32 Value)
{ ASSERT ((Address & 3) == 0); return (UINT32)MmioWriteWorker (Address, SMM_IO_UINT32, Value); }
tianocore/edk2
C++
Other
4,240
/* This function processes frames that has received and timers that has expired during sending an I pdu (refer to data_req_handler). frames queue by llc_rcv function (llc_mac.c) and timers queue by timer callback functions(llc_c_ac.c). */
static int llc_backlog_rcv(struct sock *sk, struct sk_buff *skb)
/* This function processes frames that has received and timers that has expired during sending an I pdu (refer to data_req_handler). frames queue by llc_rcv function (llc_mac.c) and timers queue by timer callback functions(llc_c_ac.c). */ static int llc_backlog_rcv(struct sock *sk, struct sk_buff *skb)
{ int rc = 0; struct llc_sock *llc = llc_sk(sk); if (likely(llc_backlog_type(skb) == LLC_PACKET)) { if (likely(llc->state > 1)) rc = llc_conn_rcv(sk, skb); else goto out_kfree_skb; } else if (llc_backlog_type(skb) == LLC_EVENT) { if (likely(llc->state > 1)) rc = llc_conn_state_process(sk, skb); els...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Removes a source from its #GMainContext, if any, and mark it as destroyed. The source cannot be subsequently added to another context. It is safe to call this on sources which have already been removed from their context. */
void g_source_destroy(GSource *source)
/* Removes a source from its #GMainContext, if any, and mark it as destroyed. The source cannot be subsequently added to another context. It is safe to call this on sources which have already been removed from their context. */ void g_source_destroy(GSource *source)
{ GMainContext *context; g_return_if_fail (source != NULL); context = source->context; if (context) g_source_destroy_internal (source, context, FALSE); else source->flags &= ~G_HOOK_FLAG_ACTIVE; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This API gets the status of Accel offset compensation. */
uint16_t bma4_get_offset_comp(uint8_t *offset_en, struct bma4_dev *dev)
/* This API gets the status of Accel offset compensation. */ uint16_t bma4_get_offset_comp(uint8_t *offset_en, struct bma4_dev *dev)
{ uint16_t rslt = 0; uint8_t data = 0; if (dev == NULL) { rslt |= BMA4_E_NULL_PTR; } else { rslt |= bma4_read_regs(BMA4_NV_CONFIG_ADDR, &data, 1, dev); if (rslt == BMA4_OK) { *offset_en = BMA4_GET_BITSLICE(data, BMA4_NV_ACCEL_OFFSET); } } return rslt; ...
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* If 32-bit MMIO register operations are not supported, then ASSERT(). */
UINT32 EFIAPI S3MmioAnd32(IN UINTN Address, IN UINT32 AndData)
/* If 32-bit MMIO register operations are not supported, then ASSERT(). */ UINT32 EFIAPI S3MmioAnd32(IN UINTN Address, IN UINT32 AndData)
{ return InternalSaveMmioWrite32ValueToBootScript (Address, MmioAnd32 (Address, AndData)); }
tianocore/edk2
C++
Other
4,240
/* Read then Measure and log an EFI Secure variable, and extend the measurement result into PCR. */
EFI_STATUS ReadAndMeasureSecureVariable(IN CHAR16 *VarName, IN EFI_GUID *VendorGuid, OUT UINTN *VarSize, OUT VOID **VarData)
/* Read then Measure and log an EFI Secure variable, and extend the measurement result into PCR. */ EFI_STATUS ReadAndMeasureSecureVariable(IN CHAR16 *VarName, IN EFI_GUID *VendorGuid, OUT UINTN *VarSize, OUT VOID **VarData)
{ return ReadAndMeasureVariable ( 7, EV_EFI_VARIABLE_DRIVER_CONFIG, VarName, VendorGuid, VarSize, VarData ); }
tianocore/edk2
C++
Other
4,240
/* The function is used to disable smartcard interface UART mode. */
void SCUART_Close(SC_T *sc)
/* The function is used to disable smartcard interface UART mode. */ void SCUART_Close(SC_T *sc)
{ sc->INTEN = 0UL; sc->UARTCTL = 0UL; sc->CTL = 0UL; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns: a signed 32-bit/4-byte value read from the @stream or %0 if an error occurred. */
gint32 g_data_input_stream_read_int32(GDataInputStream *stream, GCancellable *cancellable, GError **error)
/* Returns: a signed 32-bit/4-byte value read from the @stream or %0 if an error occurred. */ gint32 g_data_input_stream_read_int32(GDataInputStream *stream, GCancellable *cancellable, GError **error)
{ gint32 v; g_return_val_if_fail (G_IS_DATA_INPUT_STREAM (stream), 0); if (read_data (stream, &v, 4, cancellable, error)) { switch (stream->priv->byte_order) { case G_DATA_STREAM_BYTE_ORDER_BIG_ENDIAN: v = GINT32_FROM_BE (v); break; case G_DATA_STREAM_BYTE_ORDER_LITTLE_ENDIAN: v = GINT32_FRO...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* unregister_ftrace_event - remove a no longer used event @event: the event to remove */
int unregister_ftrace_event(struct trace_event *event)
/* unregister_ftrace_event - remove a no longer used event @event: the event to remove */ int unregister_ftrace_event(struct trace_event *event)
{ down_write(&trace_event_mutex); __unregister_ftrace_event(event); up_write(&trace_event_mutex); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Report an error when trying to open or create a file. "err" is assumed to be an error code from Wiretap; positive values are UNIX-style errnos, so this can be used for open failures not from Wiretap as long as the failure code is just an errno. */
void report_open_failure(const char *filename, int err, gboolean for_writing)
/* Report an error when trying to open or create a file. "err" is assumed to be an error code from Wiretap; positive values are UNIX-style errnos, so this can be used for open failures not from Wiretap as long as the failure code is just an errno. */ void report_open_failure(const char *filename, int err, gboolean for...
{ (*report_open_failure_func)(filename, err, for_writing); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Returns the value of an OPTI system board configuration register. */
static u8 opti_syscfg(u8 reg)
/* Returns the value of an OPTI system board configuration register. */ static u8 opti_syscfg(u8 reg)
{ unsigned long flags; u8 r; local_irq_save(flags); outb(reg, 0x22); r = inb(0x24); local_irq_restore(flags); return r; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* We cheat and only decode instructions that access memory. If the instruction is not found we dump the instruction in hex. */
VOID DisassembleInstruction(IN UINT8 **OpCodePtr, IN BOOLEAN Thumb, IN BOOLEAN Extended, IN OUT UINT32 *ItBlock, OUT CHAR8 *Buf, OUT UINTN Size)
/* We cheat and only decode instructions that access memory. If the instruction is not found we dump the instruction in hex. */ VOID DisassembleInstruction(IN UINT8 **OpCodePtr, IN BOOLEAN Thumb, IN BOOLEAN Extended, IN OUT UINT32 *ItBlock, OUT CHAR8 *Buf, OUT UINTN Size)
{ if (Thumb) { DisassembleThumbInstruction ((UINT16 **)OpCodePtr, Buf, Size, ItBlock, Extended); } else { DisassembleArmInstruction ((UINT32 **)OpCodePtr, Buf, Size, Extended); } }
tianocore/edk2
C++
Other
4,240
/* The PWM external fault brake default IRQ, declared in start up code. */
void FBIntHandler(void)
/* The PWM external fault brake default IRQ, declared in start up code. */ void FBIntHandler(void)
{ unsigned long ulPWMStastus; unsigned long ulBase = PWMA_BASE; ulPWMStastus = xHWREG(ulBase + PWM_PIIR) & 0x30000; xHWREG(ulBase + PWM_PIIR) = ulPWMStastus; if (g_pfnFBHandlerCallbacks[0] != 0) { if(ulPWMStastus != 0) { g_pfnFBHandlerCallbacks[0](0, PWM_EVENT_FB, ulP...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* It's possible for a queue to register a prepare_request callback which is invoked before the request is handed to the request_fn. The goal of the function is to prepare a request for I/O, it can be used to build a cdb from the request data for instance. */
void blk_queue_prep_rq(struct request_queue *q, prep_rq_fn *pfn)
/* It's possible for a queue to register a prepare_request callback which is invoked before the request is handed to the request_fn. The goal of the function is to prepare a request for I/O, it can be used to build a cdb from the request data for instance. */ void blk_queue_prep_rq(struct request_queue *q, prep_rq_fn ...
{ q->prep_rq_fn = pfn; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Detects if Clock Modulation feature supported on current processor. */
BOOLEAN EFIAPI ClockModulationSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
/* Detects if Clock Modulation feature supported on current processor. */ BOOLEAN EFIAPI ClockModulationSupport(IN UINTN ProcessorNumber, IN REGISTER_CPU_FEATURE_INFORMATION *CpuInfo, IN VOID *ConfigData OPTIONAL)
{ CLOCK_MODULATION_CONFIG_DATA *CmConfigData; if (CpuInfo->CpuIdVersionInfoEdx.Bits.ACPI == 1) { CmConfigData = (CLOCK_MODULATION_CONFIG_DATA *)ConfigData; ASSERT (CmConfigData != NULL); AsmCpuid ( CPUID_THERMAL_POWER_MANAGEMENT, &CmConfigData[ProcessorNumber].ThermalPowerManagementEax.Uint...
tianocore/edk2
C++
Other
4,240
/* Clears the designated bits in a 16-bit data word at the remote CPU system address */
uint16_t IPCLtoRClearBits(volatile tIpcController *psController, uint32_t ulAddress, uint32_t ulMask, uint16_t usLength, uint16_t bBlock)
/* Clears the designated bits in a 16-bit data word at the remote CPU system address */ uint16_t IPCLtoRClearBits(volatile tIpcController *psController, uint32_t ulAddress, uint32_t ulMask, uint16_t usLength, uint16_t bBlock)
{ uint16_t status; tIpcMessage sMessage; sMessage.ulcommand = IPC_CLEAR_BITS; sMessage.uladdress = ulAddress; sMessage.uldataw1 = (uint32_t)usLength; sMessage.uldataw2 = ulMask; status = IpcPut (psController, &sMessage, bBlock); return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Note: To use this routine, must call RTMPInitTimer before. */
void RTMPSetTimer(struct rt_ralink_timer *pTimer, unsigned long Value)
/* Note: To use this routine, must call RTMPInitTimer before. */ void RTMPSetTimer(struct rt_ralink_timer *pTimer, unsigned long Value)
{ if (pTimer->Valid) { pTimer->TimerValue = Value; pTimer->State = FALSE; if (pTimer->PeriodicType == TRUE) { pTimer->Repeat = TRUE; RTMP_SetPeriodicTimer(&pTimer->TimerObj, Value); } else { pTimer->Repeat = FALSE; RTMP_OS_Add_Timer(&pTimer->TimerObj, Value); } } else { DBGPRINT_ERR(("RTMPSetT...
robutest/uclinux
C++
GPL-2.0
60
/* Returns: a pointer to the found character or NULL. */
gchar* g_utf8_find_prev_char(const char *str, const char *p)
/* Returns: a pointer to the found character or NULL. */ gchar* g_utf8_find_prev_char(const char *str, const char *p)
{ for (--p; p >= str; --p) { if ((*p & 0xc0) != 0x80) return (gchar *)p; } return NULL; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Releases ownership of a doorbell message range. Returns 0 if the request has been satisfied. */
int rio_release_outb_dbell(struct rio_dev *rdev, struct resource *res)
/* Releases ownership of a doorbell message range. Returns 0 if the request has been satisfied. */ int rio_release_outb_dbell(struct rio_dev *rdev, struct resource *res)
{ int rc = release_resource(res); kfree(res); return rc; }
robutest/uclinux
C++
GPL-2.0
60
/* Similar to klist_iter_init(), but starts the action off with */
void klist_iter_init_node(struct klist *k, struct klist_iter *i, struct klist_node *n)
/* Similar to klist_iter_init(), but starts the action off with */ void klist_iter_init_node(struct klist *k, struct klist_iter *i, struct klist_node *n)
{ i->i_klist = k; i->i_cur = n; if (n) kref_get(&n->n_ref); }
robutest/uclinux
C++
GPL-2.0
60
/* Converts a text device path node to Parallel Port device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextParallelPort(IN CHAR16 *TextDeviceNode)
/* Converts a text device path node to Parallel Port device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextParallelPort(IN CHAR16 *TextDeviceNode)
{ return ConvertFromTextAcpi (TextDeviceNode, 0x0401); }
tianocore/edk2
C++
Other
4,240
/* Adds the task to the list running through its css_set if necessary. Has to be after the task is visible on the task list in case we race with the first call to cgroup_iter_start() - to guarantee that the new task ends up on its list. */
void cgroup_post_fork(struct task_struct *child)
/* Adds the task to the list running through its css_set if necessary. Has to be after the task is visible on the task list in case we race with the first call to cgroup_iter_start() - to guarantee that the new task ends up on its list. */ void cgroup_post_fork(struct task_struct *child)
{ if (use_task_css_set_links) { write_lock(&css_set_lock); task_lock(child); if (list_empty(&child->cg_list)) list_add(&child->cg_list, &child->cgroups->tasks); task_unlock(child); write_unlock(&css_set_lock); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Retrieves the current value for a given parameter in the parameter table. */
uint8_t V2Params_GetParameterValue(const uint8_t ParamID)
/* Retrieves the current value for a given parameter in the parameter table. */ uint8_t V2Params_GetParameterValue(const uint8_t ParamID)
{ ParameterItem_t* const ParamInfo = V2Params_GetParamFromTable(ParamID); if (ParamInfo == NULL) return 0; return ParamInfo->ParamValue; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Disables the basic one pulse signal generation on the designed output. */
void HRTIM_SimpleOnePulseStop(HRTIM_TypeDef *HRTIMx, uint32_t TimerIdx, uint32_t OnePulseChannel)
/* Disables the basic one pulse signal generation on the designed output. */ void HRTIM_SimpleOnePulseStop(HRTIM_TypeDef *HRTIMx, uint32_t TimerIdx, uint32_t OnePulseChannel)
{ assert_param(IS_HRTIM_TIMER_OUTPUT(TimerIdx, OnePulseChannel)); HRTIMx->HRTIM_COMMON.DISR |= OnePulseChannel; __HRTIM_DISABLE(HRTIMx, TimerIdxToTimerId[TimerIdx]); }
remotemcu/remcu-chip-sdks
C++
null
436
/* If the requested operation results in an overflow or an underflow condition, then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeUint8Sub(IN UINT8 Minuend, IN UINT8 Subtrahend, OUT UINT8 *Result)
/* If the requested operation results in an overflow or an underflow condition, then Result is set to UINT8_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeUint8Sub(IN UINT8 Minuend, IN UINT8 Subtrahend, OUT UINT8 *Result)
{ RETURN_STATUS Status; if (Result == NULL) { return RETURN_INVALID_PARAMETER; } if (Minuend >= Subtrahend) { *Result = (UINT8)(Minuend - Subtrahend); Status = RETURN_SUCCESS; } else { *Result = UINT8_ERROR; Status = RETURN_BUFFER_TOO_SMALL; } return Status; }
tianocore/edk2
C++
Other
4,240
/* Converts a SCSI device path structure to its string representative. */
VOID DevPathToTextScsi(IN OUT POOL_PRINT *Str, IN VOID *DevPath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
/* Converts a SCSI device path structure to its string representative. */ VOID DevPathToTextScsi(IN OUT POOL_PRINT *Str, IN VOID *DevPath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
{ SCSI_DEVICE_PATH *Scsi; Scsi = DevPath; UefiDevicePathLibCatPrint (Str, L"Scsi(0x%x,0x%x)", Scsi->Pun, Scsi->Lun); }
tianocore/edk2
C++
Other
4,240
/* This function sets the direction of specified GPIO signal as input. It returns 0 if direction of GPIO signals is set as input otherwise it returns negative error value. */
static int xgpio_dir_in(struct gpio_chip *gc, unsigned int gpio)
/* This function sets the direction of specified GPIO signal as input. It returns 0 if direction of GPIO signals is set as input otherwise it returns negative error value. */ static int xgpio_dir_in(struct gpio_chip *gc, unsigned int gpio)
{ unsigned long flags; struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); struct xgpio_instance *chip = container_of(mm_gc, struct xgpio_instance, mmchip); spin_lock_irqsave(&chip->gpio_lock, flags); chip->gpio_dir |= (1 << gpio); out_be32(mm_gc->regs + XGPIO_TRI_OFFSET, chip->gpio_dir); spin_unlock_ir...
robutest/uclinux
C++
GPL-2.0
60
/* Level triggered interrupts on GPIO lines can only be cleared when the interrupt condition disappears. */
static void ixp4xx_irq_unmask(unsigned int irq)
/* Level triggered interrupts on GPIO lines can only be cleared when the interrupt condition disappears. */ static void ixp4xx_irq_unmask(unsigned int irq)
{ if (!(ixp4xx_irq_edge & (1 << irq))) ixp4xx_irq_ack(irq); if ((cpu_is_ixp46x() || cpu_is_ixp43x()) && irq >= 32) *IXP4XX_ICMR2 |= (1 << (irq - 32)); else *IXP4XX_ICMR |= (1 << irq); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* If no format string is specified the Format must be NULL. */
VOID EFIAPI Dump12Chars(IN CONST CHAR16 *Format OPTIONAL, IN UINT8 *Ptr)
/* If no format string is specified the Format must be NULL. */ VOID EFIAPI Dump12Chars(IN CONST CHAR16 *Format OPTIONAL, IN UINT8 *Ptr)
{ Print ( (Format != NULL) ? Format : L"%c%c%c%c%c%c%c%c%c%c%c%c", Ptr[0], Ptr[1], Ptr[2], Ptr[3], Ptr[4], Ptr[5], Ptr[6], Ptr[7], Ptr[8], Ptr[9], Ptr[10], Ptr[11] ); }
tianocore/edk2
C++
Other
4,240
/* Network device is taken down. Usually this is done by "ifconfig irda0 down" */
static int stir_net_close(struct net_device *netdev)
/* Network device is taken down. Usually this is done by "ifconfig irda0 down" */ static int stir_net_close(struct net_device *netdev)
{ struct stir_cb *stir = netdev_priv(netdev); netif_stop_queue(netdev); kthread_stop(stir->thread); kfree(stir->fifo_status); usb_kill_urb(stir->rx_urb); kfree(stir->io_buf); usb_free_urb(stir->rx_urb); kfree_skb(stir->rx_buff.skb); if (stir->irlap) irlap_close(stir->irlap); stir->irlap = NULL; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Delay a given number of microseconds. The mcu is put in EM1 during the delay. */
Ecode_t USTIMER_Delay(uint32_t usec)
/* Delay a given number of microseconds. The mcu is put in EM1 during the delay. */ Ecode_t USTIMER_Delay(uint32_t usec)
{ uint64_t totalTicks; totalTicks = ( ( (uint64_t)freq * usec ) + 500000 ) / 1000000; while ( totalTicks > 65000 ) { DelayTicksEM1( 65000 ); totalTicks -= 65000; } DelayTicksEM1( (uint16_t)totalTicks ); return ECODE_EMDRV_USTIMER_OK; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Draw horizontal line without blending. Just stores the color value (including the alpha component) without blending. Function should only be used for 32 bit target surfaces. */
int hlineRGBAStore(SDL_Surface *dst, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
/* Draw horizontal line without blending. Just stores the color value (including the alpha component) without blending. Function should only be used for 32 bit target surfaces. */ int hlineRGBAStore(SDL_Surface *dst, Sint16 x1, Sint16 x2, Sint16 y, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
{ return (hlineColorStore(dst, x1, x2, y, ((Uint32) r << 24) | ((Uint32) g << 16) | ((Uint32) b << 8) | (Uint32) a)); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* pm_runtime_remove - Prepare for removing a device from device hierarchy. @dev: Device object being removed from device hierarchy. */
void pm_runtime_remove(struct device *dev)
/* pm_runtime_remove - Prepare for removing a device from device hierarchy. @dev: Device object being removed from device hierarchy. */ void pm_runtime_remove(struct device *dev)
{ __pm_runtime_disable(dev, false); if (dev->power.runtime_status == RPM_ACTIVE) pm_runtime_set_suspended(dev); }
robutest/uclinux
C++
GPL-2.0
60
/* Calculate the CRC32 value and start with the previously calculated CRC as initial value. */
uint32_t CRC_CRC32_AccumulateData(uint8_t u8DataWidth, const void *pvData, uint32_t u32Len)
/* Calculate the CRC32 value and start with the previously calculated CRC as initial value. */ uint32_t CRC_CRC32_AccumulateData(uint8_t u8DataWidth, const void *pvData, uint32_t u32Len)
{ uint32_t u32CrcValue = 0UL; if ((pvData != NULL) && (u32Len != 0UL)) { DDL_ASSERT(IS_CRC_DATA_WIDTH(u8DataWidth)); if (CRC_DATA_WIDTH_32BIT == u8DataWidth) { (void)CRC_WriteData32((const uint32_t *)pvData, u32Len); } else if (CRC_DATA_WIDTH_16BIT == u8DataWidth) { ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function needs to be called at device initialization and before updating to a set of newly-generated stats. This will ensure that no stale values stick around in case the guest reports a subset of the supported statistics. */
static void reset_stats(VirtIOBalloon *dev)
/* This function needs to be called at device initialization and before updating to a set of newly-generated stats. This will ensure that no stale values stick around in case the guest reports a subset of the supported statistics. */ static void reset_stats(VirtIOBalloon *dev)
{ int i; for (i = 0; i < VIRTIO_BALLOON_S_NR; dev->stats[i++] = -1); }
ve3wwg/teensy3_qemu
C++
Other
15
/* Reset I2C to same state as after a HW reset. */
void I2C_Reset(I2C_TypeDef *i2c)
/* Reset I2C to same state as after a HW reset. */ void I2C_Reset(I2C_TypeDef *i2c)
{ i2c->CTRL = _I2C_CTRL_RESETVALUE; i2c->CLKDIV = _I2C_CLKDIV_RESETVALUE; i2c->SADDR = _I2C_SADDR_RESETVALUE; i2c->SADDRMASK = _I2C_SADDRMASK_RESETVALUE; i2c->IEN = _I2C_IEN_RESETVALUE; i2c->IFC = _I2C_IFC_MASK; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* The user Entry Point for module SdDxe. The user code starts with this function. */
EFI_STATUS EFIAPI InitializeSdDxe(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The user Entry Point for module SdDxe. The user code starts with this function. */ EFI_STATUS EFIAPI InitializeSdDxe(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ EFI_STATUS Status; Status = EfiLibInstallDriverBindingComponentName2 ( ImageHandle, SystemTable, &gSdDxeDriverBinding, ImageHandle, &gSdDxeComponentName, &gSdDxeComponentName2 ); ASSERT_EFI_ERROR (Status); return Statu...
tianocore/edk2
C++
Other
4,240
/* Return the output level (high or low) during calibration of the selected OPAMP. */
uint32_t OPAMP_GetOutputLevel(uint32_t OPAMP_Selection)
/* Return the output level (high or low) during calibration of the selected OPAMP. */ uint32_t OPAMP_GetOutputLevel(uint32_t OPAMP_Selection)
{ uint32_t opampout = 0x0; assert_param(IS_OPAMP_ALL_PERIPH(OPAMP_Selection)); if ((*(__IO uint32_t *) (OPAMP_BASE + OPAMP_Selection) & (OPAMP_CSR_OUTCAL)) != 0) { opampout = OPAMP_OutputLevel_High; } else { opampout = OPAMP_OutputLevel_Low; } return (uint32_t)(opampout); }
ajhc/demo-cortex-m3
C++
null
38
/* igbvf_alloc_queues - Allocate memory for all rings @adapter: board private structure to initialize */
static int __devinit igbvf_alloc_queues(struct igbvf_adapter *adapter)
/* igbvf_alloc_queues - Allocate memory for all rings @adapter: board private structure to initialize */ static int __devinit igbvf_alloc_queues(struct igbvf_adapter *adapter)
{ struct net_device *netdev = adapter->netdev; adapter->tx_ring = kzalloc(sizeof(struct igbvf_ring), GFP_KERNEL); if (!adapter->tx_ring) return -ENOMEM; adapter->rx_ring = kzalloc(sizeof(struct igbvf_ring), GFP_KERNEL); if (!adapter->rx_ring) { kfree(adapter->tx_ring); return -ENOMEM; } netif_napi_add(netd...
robutest/uclinux
C++
GPL-2.0
60
/* Called from the terminal layer when this line discipline is being shut down, either because of a close or becsuse of a discipline change. The function will not be called while other ldisc methods are in progress. */
static void n_tty_close(struct tty_struct *tty)
/* Called from the terminal layer when this line discipline is being shut down, either because of a close or becsuse of a discipline change. The function will not be called while other ldisc methods are in progress. */ static void n_tty_close(struct tty_struct *tty)
{ n_tty_flush_buffer(tty); if (tty->read_buf) { kfree(tty->read_buf); tty->read_buf = NULL; } if (tty->echo_buf) { kfree(tty->echo_buf); tty->echo_buf = NULL; } }
robutest/uclinux
C++
GPL-2.0
60
/* Select an interface to send the packet generated in the IP4 driver itself, that is, not by the requests of IP4 child's consumer. Such packets include the ICMP echo replies, and other ICMP error packets. */
IP4_INTERFACE* Ip4SelectInterface(IN IP4_SERVICE *IpSb, IN IP4_ADDR Dst, IN IP4_ADDR Src)
/* Select an interface to send the packet generated in the IP4 driver itself, that is, not by the requests of IP4 child's consumer. Such packets include the ICMP echo replies, and other ICMP error packets. */ IP4_INTERFACE* Ip4SelectInterface(IN IP4_SERVICE *IpSb, IN IP4_ADDR Dst, IN IP4_ADDR Src)
{ IP4_INTERFACE *IpIf; IP4_INTERFACE *Selected; LIST_ENTRY *Entry; IpIf = Ip4FindNet (IpSb, Dst); if ((IpIf != NULL) && (IpIf->Ip != IP4_ALLZERO_ADDRESS)) { return IpIf; } IpIf = Ip4FindInterface (IpSb, Src); if ((IpIf != NULL) && (IpIf->Ip != IP4_ALLZERO_ADDRESS)) { return IpIf; } Sel...
tianocore/edk2
C++
Other
4,240
/* This optional function does a "fast" set of critical region protection to the value specified by pval. See the documentation for */
void sys_arch_unprotect(sys_prot_t pval)
/* This optional function does a "fast" set of critical region protection to the value specified by pval. See the documentation for */ void sys_arch_unprotect(sys_prot_t pval)
{ ( void ) pval; vPortExitCritical(); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* Set the exchange_id flags returned by the server. */
static void nfsd4_set_ex_flags(struct nfs4_client *new, struct nfsd4_exchange_id *clid)
/* Set the exchange_id flags returned by the server. */ static void nfsd4_set_ex_flags(struct nfs4_client *new, struct nfsd4_exchange_id *clid)
{ new->cl_exchange_flags |= EXCHGID4_FLAG_USE_NON_PNFS; new->cl_exchange_flags |= EXCHGID4_FLAG_SUPP_MOVED_REFER; clid->flags = new->cl_exchange_flags; }
robutest/uclinux
C++
GPL-2.0
60
/* Serial polling receive data routine, This function will receive data in a continuous loop by one by one byte. */
rt_size_t _serial_poll_rx(struct rt_device *dev, rt_off_t pos, void *buffer, rt_size_t size)
/* Serial polling receive data routine, This function will receive data in a continuous loop by one by one byte. */ rt_size_t _serial_poll_rx(struct rt_device *dev, rt_off_t pos, void *buffer, rt_size_t size)
{ struct rt_serial_device *serial; rt_size_t getc_size; int getc_element; rt_uint8_t *getc_buffer; RT_ASSERT(dev != RT_NULL); serial = (struct rt_serial_device *)dev; RT_ASSERT(serial != RT_NULL); getc_buffer = (rt_uint8_t *)buffer; getc_size = size; while(size) { get...
pikasTech/PikaPython
C++
MIT License
1,403
/* Disable Receive buffer full interrupt @rmtoll IER RXBFIE LL_SWPMI_DisableIT_RXBF. */
void LL_SWPMI_DisableIT_RXBF(SWPMI_TypeDef *SWPMIx)
/* Disable Receive buffer full interrupt @rmtoll IER RXBFIE LL_SWPMI_DisableIT_RXBF. */ void LL_SWPMI_DisableIT_RXBF(SWPMI_TypeDef *SWPMIx)
{ CLEAR_BIT(SWPMIx->IER, SWPMI_IER_RXBFIE); }
remotemcu/remcu-chip-sdks
C++
null
436
/* What's not entirely clear is "which" field represents the key field. Some might argue L3-DDR, others ARM, others IVA. This code is simple and just uses the ARM rates. */
long omap2_round_to_table_rate(struct clk *clk, unsigned long rate)
/* What's not entirely clear is "which" field represents the key field. Some might argue L3-DDR, others ARM, others IVA. This code is simple and just uses the ARM rates. */ long omap2_round_to_table_rate(struct clk *clk, unsigned long rate)
{ const struct prcm_config *ptr; long highest_rate; long sys_ck_rate; sys_ck_rate = clk_get_rate(sclk); highest_rate = -EINVAL; for (ptr = rate_table; ptr->mpu_speed; ptr++) { if (!(ptr->flags & cpu_mask)) continue; if (ptr->xtal_speed != sys_ck_rate) continue; highest_rate = ptr->mpu_speed; if (ptr...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Clears the given bit(s) in a register in the Si7021 device. */
uint32_t SI7210_regClearBits(uint8_t addr, uint8_t mask)
/* Clears the given bit(s) in a register in the Si7021 device. */ uint32_t SI7210_regClearBits(uint8_t addr, uint8_t mask)
{ uint8_t value; uint32_t status; status = SI7210_regRead( addr, &value ); if( status != SI7210_OK ) { return status; } value &= ~mask; status = SI7210_regWrite( addr, value ); return status; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Set ENET system configuration. This function reset the ethernet module and set the phy selection. It should be called before any other ethernet operation. */
static void ENET_SetSYSControl(enet_mii_mode_t miiMode)
/* Set ENET system configuration. This function reset the ethernet module and set the phy selection. It should be called before any other ethernet operation. */ static void ENET_SetSYSControl(enet_mii_mode_t miiMode)
{ SYSCON->PRESETCTRL[2] = SYSCON_PRESETCTRL_ETH_RST_MASK; SYSCON->PRESETCTRL[2] &= ~SYSCON_PRESETCTRL_ETH_RST_MASK; SYSCON->ETHPHYSEL = (SYSCON->ETHPHYSEL & ~SYSCON_ETHPHYSEL_PHY_SEL_MASK) | SYSCON_ETHPHYSEL_PHY_SEL(miiMode); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Compute the number of samples needed for the given channels. */
static int compute_num_samples(const enum sensor_channel *channels, size_t num_channels)
/* Compute the number of samples needed for the given channels. */ static int compute_num_samples(const enum sensor_channel *channels, size_t num_channels)
{ int num_samples = 0; for (size_t i = 0; i < num_channels; ++i) { num_samples += SENSOR_CHANNEL_3_AXIS(channels[i]) ? 3 : 1; } return num_samples; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Drop a reference on the passed journal_head. If it fell to zero then try to release the journal_head from the buffer_head. */
void journal_put_journal_head(struct journal_head *jh)
/* Drop a reference on the passed journal_head. If it fell to zero then try to release the journal_head from the buffer_head. */ void journal_put_journal_head(struct journal_head *jh)
{ struct buffer_head *bh = jh2bh(jh); jbd_lock_bh_journal_head(bh); J_ASSERT_JH(jh, jh->b_jcount > 0); --jh->b_jcount; if (!jh->b_jcount && !jh->b_transaction) { __journal_remove_journal_head(bh); __brelse(bh); } jbd_unlock_bh_journal_head(bh); }
robutest/uclinux
C++
GPL-2.0
60
/* param base CSI peripheral base address. param mask The interrupts to enable, pass in as OR'ed value of ref _csi_interrupt_enable. */
void CSI_EnableInterrupts(CSI_Type *base, uint32_t mask)
/* param base CSI peripheral base address. param mask The interrupts to enable, pass in as OR'ed value of ref _csi_interrupt_enable. */ void CSI_EnableInterrupts(CSI_Type *base, uint32_t mask)
{ base->CSICR1 |= (mask & CSI_CSICR1_INT_EN_MASK); base->CSICR3 |= (mask & CSI_CSICR3_INT_EN_MASK); base->CSICR18 |= ((mask & CSI_CSICR18_INT_EN_MASK) >> 6U); }
eclipse-threadx/getting-started
C++
Other
310
/* 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==USART1) { __HAL_RCC_USART1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOA, GPIO_PIN_10|GPIO_PIN_9); HAL_NVIC_DisableIRQ(USART1_IRQn); } }
eclipse-threadx/getting-started
C++
Other
310
/* VmbusGetChannelInfo - Get the device info for the specified device object */
static void VmbusGetChannelInfo(struct hv_device *DeviceObject, struct hv_device_info *DeviceInfo)
/* VmbusGetChannelInfo - Get the device info for the specified device object */ static void VmbusGetChannelInfo(struct hv_device *DeviceObject, struct hv_device_info *DeviceInfo)
{ GetChannelInfo(DeviceObject, DeviceInfo); }
robutest/uclinux
C++
GPL-2.0
60
/* If we are going to release inode from memory, we truncate last inode extent to proper length. We could use drop_inode() but it's called under inode_lock and thus we cannot mark inode dirty there. We use clear_inode() but we have to make sure to write inode as it's not written automatically. */
void udf_clear_inode(struct inode *inode)
/* If we are going to release inode from memory, we truncate last inode extent to proper length. We could use drop_inode() but it's called under inode_lock and thus we cannot mark inode dirty there. We use clear_inode() but we have to make sure to write inode as it's not written automatically. */ void udf_clear_inode(...
{ struct udf_inode_info *iinfo = UDF_I(inode); if (iinfo->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB && inode->i_size != iinfo->i_lenExtents) { printk(KERN_WARNING "UDF-fs (%s): Inode %lu (mode %o) has " "inode size %llu different from extent lenght %llu. " "Filesystem need not be standards compliant.\n", ...
robutest/uclinux
C++
GPL-2.0
60
/* Like eval_quad_bezier, computes the coordinates of the point which resides at */
static void cubic_bezier_eval(const cubic_bezier_t *c, vg_lite_float_t t, vg_lite_float_t *x, vg_lite_float_t *y)
/* Like eval_quad_bezier, computes the coordinates of the point which resides at */ static void cubic_bezier_eval(const cubic_bezier_t *c, vg_lite_float_t t, vg_lite_float_t *x, vg_lite_float_t *y)
{ const vg_lite_float_t omt = 1.0 - t; const vg_lite_float_t omt2 = omt * omt; const vg_lite_float_t omt3 = omt * omt2; const vg_lite_float_t t2 = t * t; const vg_lite_float_t t3 = t * t2; *x = omt3 * c->X0 + 3.0 * t * omt2 * c->X1 + 3.0 * t2 * omt * c->X2 + t3 * c->X3; *y = omt3 * c->Y0 + 3...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Handle Alert message recorded in BufferIn. If BufferIn is NULL and BufferInSize is zero, TLS session has errors and the response packet needs to be Alert message based on error type. */
EFI_STATUS EFIAPI CryptoServiceTlsHandleAlert(IN VOID *Tls, IN UINT8 *BufferIn OPTIONAL, IN UINTN BufferInSize OPTIONAL, OUT UINT8 *BufferOut OPTIONAL, IN OUT UINTN *BufferOutSize)
/* Handle Alert message recorded in BufferIn. If BufferIn is NULL and BufferInSize is zero, TLS session has errors and the response packet needs to be Alert message based on error type. */ EFI_STATUS EFIAPI CryptoServiceTlsHandleAlert(IN VOID *Tls, IN UINT8 *BufferIn OPTIONAL, IN UINTN BufferInSize OPTIONAL, OUT UINT8 ...
{ return CALL_BASECRYPTLIB (Tls.Services.HandleAlert, TlsHandleAlert, (Tls, BufferIn, BufferInSize, BufferOut, BufferOutSize), EFI_UNSUPPORTED); }
tianocore/edk2
C++
Other
4,240
/* Select the SCK pin as the source of baud rate for the USART synchronous slave modes. */
static void usart_set_sync_slave_baudrate(Usart *p_usart)
/* Select the SCK pin as the source of baud rate for the USART synchronous slave modes. */ static void usart_set_sync_slave_baudrate(Usart *p_usart)
{ p_usart->US_MR = (p_usart->US_MR & ~US_MR_USCLKS_Msk) | US_MR_USCLKS_SCK | US_MR_SYNC; }
remotemcu/remcu-chip-sdks
C++
null
436
/* This functions needs to act like a macro to avoid pipeline reloads in the loops below. Use always_inline. This gains us about 160KiB/s and the bloat appears to be zero bytes (da830). */
__attribute__((always_inline))
/* This functions needs to act like a macro to avoid pipeline reloads in the loops below. Use always_inline. This gains us about 160KiB/s and the bloat appears to be zero bytes (da830). */ __attribute__((always_inline))
{ u32 buf_reg_val; writel(data, &ds->regs->dat1); while ((buf_reg_val = readl(&ds->regs->buf)) & SPIBUF_RXEMPTY_MASK) ; return buf_reg_val; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Clear registers related with errors in the HTE */
static void hte_clear_error_regs(void)
/* Clear registers related with errors in the HTE */ static void hte_clear_error_regs(void)
{ u32 tmp; tmp = msg_port_read(HTE, 0x000200a1); tmp |= (1 << 8); msg_port_write(HTE, 0x000200a1, tmp); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Command response callback function for sd_ble_gatts_characteristic_add BLE command. Callback for decoding the output parameters and the command response return code. */
static uint32_t gatts_characteristic_add_rsp_dec(const uint8_t *p_buffer, uint16_t length)
/* Command response callback function for sd_ble_gatts_characteristic_add BLE command. Callback for decoding the output parameters and the command response return code. */ static uint32_t gatts_characteristic_add_rsp_dec(const uint8_t *p_buffer, uint16_t length)
{ uint32_t result_code; const uint32_t err_code = ble_gatts_characteristic_add_rsp_dec( p_buffer, length, (uint16_t * *)&mp_out_params[0], &result_code); APP_ERROR_CHECK(err_code); return result_code; }
labapart/polymcu
C++
null
201
/* Write a value in a register of the device through BUS. */
int32_t NFC_IO_WriteReg16(uint16_t DevAddr, uint16_t Reg, uint8_t *pData, uint16_t Length)
/* Write a value in a register of the device through BUS. */ int32_t NFC_IO_WriteReg16(uint16_t DevAddr, uint16_t Reg, uint8_t *pData, uint16_t Length)
{ int32_t ret = -8; uint32_t hal_error = HAL_OK; if (HAL_I2C_Mem_Write(&hI2cHandler, (uint8_t)DevAddr, (uint16_t)Reg, I2C_MEMADD_SIZE_16BIT, (uint8_t *)pData, Length, 0x1000) == HAL_OK) { ret = 0; } else { hal_error = HAL_I2C_GetError(&hI2cHandler); ...
eclipse-threadx/getting-started
C++
Other
310
/* Figure out if BCM5482 is in serdes or copper mode and determine link configuration accordingly */
static uint mii_parse_BCM5482_sr(uint mii_reg, struct tsec_private *priv)
/* Figure out if BCM5482 is in serdes or copper mode and determine link configuration accordingly */ static uint mii_parse_BCM5482_sr(uint mii_reg, struct tsec_private *priv)
{ if (BCM8482_is_serdes(priv)) { mii_parse_BCM5482_serdes_sr(priv); priv->flags |= TSEC_FIBER; } else { mii_parse_sr(mii_reg, priv); mii_reg = read_phy_reg(priv, MIIM_BCM54xx_AUXSTATUS); mii_parse_BCM54xx_sr(mii_reg, priv); } return 0; }
EmcraftSystems/u-boot
C++
Other
181
/* This function is a callback from heap_insert() and is used to order the heap. In this case we order the heap in descending task start time. */
static int started_after(void *p1, void *p2)
/* This function is a callback from heap_insert() and is used to order the heap. In this case we order the heap in descending task start time. */ static int started_after(void *p1, void *p2)
{ struct task_struct *t1 = p1; struct task_struct *t2 = p2; return started_after_time(t1, &t2->start_time, t2); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function handles External line 0 interrupt request. */
void EXTI0_IRQHandler(void)
/* This function handles External line 0 interrupt request. */ void EXTI0_IRQHandler(void)
{ HAL_GPIO_EXTI_IRQHandler(WAKEUP_BUTTON_PIN); }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Returns pointer to "struct tomoyo_domain_info" if found, NULL otherwise. */
struct tomoyo_domain_info* tomoyo_find_domain(const char *domainname)
/* Returns pointer to "struct tomoyo_domain_info" if found, NULL otherwise. */ struct tomoyo_domain_info* tomoyo_find_domain(const char *domainname)
{ struct tomoyo_domain_info *domain; struct tomoyo_path_info name; name.name = domainname; tomoyo_fill_path_info(&name); list_for_each_entry(domain, &tomoyo_domain_list, list) { if (!domain->is_deleted && !tomoyo_pathcmp(&name, domain->domainname)) return domain; } return NULL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Snoop PTP packet for version 2 format When set the PTP packets are snooped using the version 2 format. */
void synopGMAC_TS_pkt_snoop_ver2(synopGMACdevice *gmacdev)
/* Snoop PTP packet for version 2 format When set the PTP packets are snooped using the version 2 format. */ void synopGMAC_TS_pkt_snoop_ver2(synopGMACdevice *gmacdev)
{ synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSVER2ENA); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns true if the zone does not have enough inactive anon pages, meaning some active anon pages need to be deactivated. */
static int inactive_anon_is_low(struct zone *zone, struct scan_control *sc)
/* Returns true if the zone does not have enough inactive anon pages, meaning some active anon pages need to be deactivated. */ static int inactive_anon_is_low(struct zone *zone, struct scan_control *sc)
{ int low; if (scanning_global_lru(sc)) low = inactive_anon_is_low_global(zone); else low = mem_cgroup_inactive_anon_is_low(sc->mem_cgroup); return low; }
robutest/uclinux
C++
GPL-2.0
60
/* Clear the slave select pins of the specified SPI port. The */
void SPISSClear(unsigned long ulBase, unsigned long ulSlaveSel)
/* Clear the slave select pins of the specified SPI port. The */ void SPISSClear(unsigned long ulBase, unsigned long ulSlaveSel)
{ xASSERT(ulBase == SPI0_BASE); xASSERT((ulSlaveSel == SPI_SS_NONE) || (ulSlaveSel == SPI_SS0)); xHWREG(ulBase + SPI_SSR) &= ~ulSlaveSel; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Configure the SX8651 device to stop generating IT on given INT pin connected to MCU as EXTI. */
int32_t SX8651_DisableIT(SX8651_Object_t *pObj)
/* Configure the SX8651 device to stop generating IT on given INT pin connected to MCU as EXTI. */ int32_t SX8651_DisableIT(SX8651_Object_t *pObj)
{ (void)(pObj); return SX8651_OK; }
eclipse-threadx/getting-started
C++
Other
310
/* SC_Itf_SetDataRateAndClockFrequency Set the Clock and data Rate of the Interface This is Optional function & user implementable. */
uint8_t SC_Itf_SetDataRateAndClockFrequency(uint32_t dwClockFrequency, uint32_t dwDataRate)
/* SC_Itf_SetDataRateAndClockFrequency Set the Clock and data Rate of the Interface This is Optional function & user implementable. */ uint8_t SC_Itf_SetDataRateAndClockFrequency(uint32_t dwClockFrequency, uint32_t dwDataRate)
{ if ((dwDataRate == USBD_CCID_DEFAULT_DATA_RATE) && (dwClockFrequency == USBD_CCID_DEFAULT_CLOCK_FREQ)) { return SLOT_NO_ERROR; } return SLOTERROR_CMD_NOT_SUPPORTED; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* This comparator searches for the next Isochronous Endpoint descriptor within the current interface, aborting the search if another interface descriptor is found before the next endpoint. */
uint8_t DComp_NextAudioInterfaceDataEndpoint(void *CurrentDescriptor)
/* This comparator searches for the next Isochronous Endpoint descriptor within the current interface, aborting the search if another interface descriptor is found before the next endpoint. */ uint8_t DComp_NextAudioInterfaceDataEndpoint(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_ISOCHRONOUS) retur...
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* This function is only for special cases such as the 'ferr', and temporary use for normal devices until they are converted to qdev. */
qemu_irq isa_get_irq(ISADevice *dev, int isairq)
/* This function is only for special cases such as the 'ferr', and temporary use for normal devices until they are converted to qdev. */ qemu_irq isa_get_irq(ISADevice *dev, int isairq)
{ assert(!dev || ISA_BUS(qdev_get_parent_bus(DEVICE(dev))) == isabus); if (isairq < 0 || isairq > 15) { hw_error("isa irq %d invalid", isairq); } return isabus->irqs[isairq]; }
ve3wwg/teensy3_qemu
C++
Other
15
/* this function is a POSIX compliant version, which will make a directory */
int mkdir(const char *path, mode_t mode)
/* this function is a POSIX compliant version, which will make a directory */ int mkdir(const char *path, mode_t mode)
{ int result; struct stat stat; struct dfs_file file; if (path == NULL) { rt_set_errno(-EBADF); return -1; } if (path && dfs_file_lstat(path, &stat) == 0) { rt_set_errno(-EEXIST); return -1; } dfs_file_init(&file); result = dfs_file_open(&file,...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* SRC (8bit) = SRC DST (8bit) = SRC */
void transfer8x4_copy_c(uint8_t *const dst, const uint8_t *const src, const uint32_t stride)
/* SRC (8bit) = SRC DST (8bit) = SRC */ void transfer8x4_copy_c(uint8_t *const dst, const uint8_t *const src, const uint32_t stride)
{ uint32_t j; for (j = 0; j < 4; j++) { uint32_t *d= (uint32_t*)(dst + j*stride); const uint32_t *s = (const uint32_t*)(src + j*stride); *(d+0) = *(s+0); *(d+1) = *(s+1); } }
DC-SWAT/DreamShell
C++
null
404
/* param base LPSPI peripheral address. param handle pointer to lpspi_master_handle_t structure which stores the transfer state. */
void LPSPI_MasterTransferAbort(LPSPI_Type *base, lpspi_master_handle_t *handle)
/* param base LPSPI peripheral address. param handle pointer to lpspi_master_handle_t structure which stores the transfer state. */ void LPSPI_MasterTransferAbort(LPSPI_Type *base, lpspi_master_handle_t *handle)
{ assert(handle != NULL); LPSPI_DisableInterrupts(base, (uint32_t)kLPSPI_AllInterruptEnable); LPSPI_Reset(base); handle->state = (uint8_t)kLPSPI_Idle; handle->txRemainingByteCount = 0; handle->rxRemainingByteCount = 0; }
eclipse-threadx/getting-started
C++
Other
310