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
/* returns 0 for non-Compaq ROM, 1 for Compaq ROM */
static int check_for_compaq_ROM(void __iomem *rom_start)
/* returns 0 for non-Compaq ROM, 1 for Compaq ROM */ static int check_for_compaq_ROM(void __iomem *rom_start)
{ u8 temp1, temp2, temp3, temp4, temp5, temp6; int result = 0; temp1 = readb(rom_start + 0xffea + 0); temp2 = readb(rom_start + 0xffea + 1); temp3 = readb(rom_start + 0xffea + 2); temp4 = readb(rom_start + 0xffea + 3); temp5 = readb(rom_start + 0xffea + 4); temp6 = readb(rom_start + 0xffea + 5); if ((temp1 == 'C') && (temp2 == 'O') && (temp3 == 'M') && (temp4 == 'P') && (temp5 == 'A') && (temp6 == 'Q')) { result = 1; } dbg ("%s - returned %d\n", __func__, result); return result; }
robutest/uclinux
C++
GPL-2.0
60
/* Q: is the scsi host lock sufficient ? */
static int sl82c105_qc_defer(struct ata_queued_cmd *qc)
/* Q: is the scsi host lock sufficient ? */ static int sl82c105_qc_defer(struct ata_queued_cmd *qc)
{ struct ata_host *host = qc->ap->host; struct ata_port *alt = host->ports[1 ^ qc->ap->port_no]; int rc; rc = ata_std_qc_defer(qc); if (rc != 0) return rc; if (alt && alt->qc_active) return ATA_DEFER_PORT; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* if object 'o' has a finalizer, remove it from 'allgc' list (must search the list to find it) and link it in 'finobj' list. */
void luaC_checkfinalizer(lua_State *L, GCObject *o, Table *mt)
/* if object 'o' has a finalizer, remove it from 'allgc' list (must search the list to find it) and link it in 'finobj' list. */ void luaC_checkfinalizer(lua_State *L, GCObject *o, Table *mt)
{ GCObject **p; if (issweepphase(g)) { makewhite(g, o); if (g->sweepgc == &o->next) g->sweepgc = sweeptolive(L, g->sweepgc); } else correctpointers(g, o); for (p = &g->allgc; *p != o; p = &(*p)->next) { } *p = o->next; o->next = g->finobj; g->finobj = o; l_setbit(o->marked, FINALIZEDBIT); } }
Nicholas3388/LuaNode
C++
Other
1,055
/* Command response callback function for sd_ble_gap_scan_start BLE command. Callback for decoding the output parameters and the command response return code. */
static uint32_t gap_scan_start_rsp_dec(const uint8_t *p_buffer, uint16_t length)
/* Command response callback function for sd_ble_gap_scan_start BLE command. Callback for decoding the output parameters and the command response return code. */ static uint32_t gap_scan_start_rsp_dec(const uint8_t *p_buffer, uint16_t length)
{ uint32_t result_code = 0; const uint32_t err_code = ble_gap_scan_start_rsp_dec(p_buffer, length, &result_code); APP_ERROR_CHECK(err_code); return result_code; }
labapart/polymcu
C++
null
201
/* Enable MAC address for PTP frame filtering. When enabled, uses MAC address (apart from MAC address 0) to filter the PTP frames when PTP is sent directly over Ethernet. */
void synopGMAC_TS_mac_addr_filt_enable(synopGMACdevice *gmacdev)
/* Enable MAC address for PTP frame filtering. When enabled, uses MAC address (apart from MAC address 0) to filter the PTP frames when PTP is sent directly over Ethernet. */ void synopGMAC_TS_mac_addr_filt_enable(synopGMACdevice *gmacdev)
{ synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSENMACADDR); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function returns the TLS/SSL master key material currently used in the specified TLS connection. */
EFI_STATUS EFIAPI TlsGetKeyMaterial(IN VOID *Tls, IN OUT UINT8 *KeyMaterial)
/* This function returns the TLS/SSL master key material currently used in the specified TLS connection. */ EFI_STATUS EFIAPI TlsGetKeyMaterial(IN VOID *Tls, IN OUT UINT8 *KeyMaterial)
{ CALL_CRYPTO_SERVICE (TlsGetKeyMaterial, (Tls, KeyMaterial), EFI_UNSUPPORTED); }
tianocore/edk2
C++
Other
4,240
/* SPI interrupt handler. This function is the SPI interrupt handler, it simple execute the callback function if there be one. */
void SPIIntHandler(void)
/* SPI interrupt handler. This function is the SPI interrupt handler, it simple execute the callback function if there be one. */ void SPIIntHandler(void)
{ if(g_pfnSPIHandlerCallbacks != 0) { g_pfnSPIHandlerCallbacks(0, 0, 0, 0); } else { while(1); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Translate the low bits of the PCI base to the resource type */
static unsigned int pci_calc_resource_flags(unsigned int flags)
/* Translate the low bits of the PCI base to the resource type */ static unsigned int pci_calc_resource_flags(unsigned int flags)
{ if (flags & PCI_BASE_ADDRESS_SPACE_IO) return IORESOURCE_IO; if (flags & PCI_BASE_ADDRESS_MEM_PREFETCH) return IORESOURCE_MEM | IORESOURCE_PREFETCH; return IORESOURCE_MEM; }
robutest/uclinux
C++
GPL-2.0
60
/* Clears the sequence number and current window. This qset must not be in the ASL or PZL. */
void qset_reset(struct whc *whc, struct whc_qset *qset)
/* Clears the sequence number and current window. This qset must not be in the ASL or PZL. */ void qset_reset(struct whc *whc, struct whc_qset *qset)
{ qset->reset = 0; qset->qh.status &= ~QH_STATUS_SEQ_MASK; qset->qh.cur_window = cpu_to_le32((1 << qset->max_burst) - 1); }
robutest/uclinux
C++
GPL-2.0
60
/* param base LPUART peripheral base address. param handle LPUART handle pointer. */
void LPUART_TransferAbortReceive(LPUART_Type *base, lpuart_handle_t *handle)
/* param base LPUART peripheral base address. param handle LPUART handle pointer. */ void LPUART_TransferAbortReceive(LPUART_Type *base, lpuart_handle_t *handle)
{ (void)base; assert(handle); if (!handle->rxRingBuffer) { LPUART_DisableInterrupts(base, kLPUART_RxDataRegFullInterruptEnable | kLPUART_RxOverrunInterruptEnable | kLPUART_IdleLineInterruptEnable); } handle->rxDataSize = 0U; handle->rxState = kLPUART_RxIdle; }
nanoframework/nf-interpreter
C++
MIT License
293
/* If the requested operation results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */
RETURN_STATUS EFIAPI SafeUintnAdd(IN UINTN Augend, IN UINTN Addend, OUT UINTN *Result)
/* If the requested operation results in an overflow or an underflow condition, then Result is set to UINTN_ERROR and RETURN_BUFFER_TOO_SMALL is returned. */ RETURN_STATUS EFIAPI SafeUintnAdd(IN UINTN Augend, IN UINTN Addend, OUT UINTN *Result)
{ RETURN_STATUS Status; if (Result == NULL) { return RETURN_INVALID_PARAMETER; } if ((Augend + Addend) >= Augend) { *Result = (Augend + Addend); Status = RETURN_SUCCESS; } else { *Result = UINTN_ERROR; Status = RETURN_BUFFER_TOO_SMALL; } return Status; }
tianocore/edk2
C++
Other
4,240
/* Check whether the RX ring buffer is full. @userData handle LPUART handle pointer. */
static bool LPUART_TransferIsRxRingBufferFull(LPUART_Type *base, lpuart_handle_t *handle)
/* Check whether the RX ring buffer is full. @userData handle LPUART handle pointer. */ static bool LPUART_TransferIsRxRingBufferFull(LPUART_Type *base, lpuart_handle_t *handle)
{ assert(NULL != handle); bool full; if (LPUART_TransferGetRxRingBufferLength(base, handle) == (handle->rxRingBufferSize - 1U)) { full = true; } else { full = false; } return full; }
eclipse-threadx/getting-started
C++
Other
310
/* Normally, the status interrupt is cleared by reading the controller status using */
void CANIntClear(uint32_t ui32Base, uint32_t ui32IntClr)
/* Normally, the status interrupt is cleared by reading the controller status using */ void CANIntClear(uint32_t ui32Base, uint32_t ui32IntClr)
{ ASSERT(_CANBaseValid(ui32Base)); ASSERT((ui32IntClr == CAN_INT_INTID_STATUS) || ((ui32IntClr >= 1) && (ui32IntClr <= 32))); if(ui32IntClr == CAN_INT_INTID_STATUS) { HWREG(ui32Base + CAN_O_STS); } else { while(HWREG(ui32Base + CAN_O_IF1CRQ) & CAN_IF1CRQ_BUSY) { } HWREG(ui32Base + CAN_O_IF1CMSK) = CAN_IF1CMSK_CLRINTPND; HWREG(ui32Base + CAN_O_IF1CRQ) = ui32IntClr & CAN_IF1CRQ_MNUM_M; while(HWREG(ui32Base + CAN_O_IF1CRQ) & CAN_IF1CRQ_BUSY) { } } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Reads data from the specified RTC Backup data Register. */
uint32_t RTC_ReadBackupRegister(uint32_t RTC_BKP_DR)
/* Reads data from the specified RTC Backup data Register. */ uint32_t RTC_ReadBackupRegister(uint32_t RTC_BKP_DR)
{ __IO uint32_t tmp = 0; assert_param(IS_RTC_BKP(RTC_BKP_DR)); tmp = RTC_BASE + 0x50; tmp += (RTC_BKP_DR * 4); return (*(__IO uint32_t *)tmp); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Pack integer 'n' with 'size' bytes and 'islittle' endianness. The final 'if' handles the case when 'size' is larger than the size of a Lua integer, correcting the extra sign-extension bytes if necessary (by default they would be zeros). */
static void packint(luaL_Buffer *b, lua_Unsigned n, int islittle, int size, int neg)
/* Pack integer 'n' with 'size' bytes and 'islittle' endianness. The final 'if' handles the case when 'size' is larger than the size of a Lua integer, correcting the extra sign-extension bytes if necessary (by default they would be zeros). */ static void packint(luaL_Buffer *b, lua_Unsigned n, int islittle, int size, int neg)
{ char *buff = luaL_prepbuffsize(b, size); int i; buff[islittle ? 0 : size - 1] = (char)(n & MC); for (i = 1; i < size; i++) { n >>= NB; buff[islittle ? i : size - 1 - i] = (char)(n & MC); } if (neg && size > SZINT) { for (i = SZINT; i < size; i++) buff[islittle ? i : size - 1 - i] = (char)MC; } luaL_addsize(b, size); }
Nicholas3388/LuaNode
C++
Other
1,055
/* Returns the name of an equivalent lua type for a SQL type. */
static const char* sqltypetolua(const SQLSMALLINT type)
/* Returns the name of an equivalent lua type for a SQL type. */ static const char* sqltypetolua(const SQLSMALLINT type)
{ case SQL_UNKNOWN_TYPE: case SQL_CHAR: case SQL_VARCHAR: case SQL_TYPE_DATE: case SQL_TYPE_TIME: case SQL_TYPE_TIMESTAMP: case SQL_DATE: case SQL_INTERVAL: case SQL_TIMESTAMP: case SQL_LONGVARCHAR: return "string"; case SQL_BIGINT: case SQL_TINYINT: case SQL_NUMERIC: case SQL_DECIMAL: case SQL_INTEGER: case SQL_SMALLINT: case SQL_FLOAT: case SQL_REAL: case SQL_DOUBLE: return "number"; case SQL_BINARY: case SQL_VARBINARY: case SQL_LONGVARBINARY: return "binary"; case SQL_BIT: return "boolean"; default: assert(0); return NULL; } }
DC-SWAT/DreamShell
C++
null
404
/* Configure the push button. Configure the PIOs as inputs and generate corresponding interrupt when pressed or released. */
static void configure_button(void)
/* Configure the push button. Configure the PIOs as inputs and generate corresponding interrupt when pressed or released. */ static void configure_button(void)
{ pmc_enable_periph_clk(PUSH_BUTTON_ID); pio_set_debounce_filter(PUSH_BUTTON_PIO, PUSH_BUTTON_PIN_MSK, 10); pio_handler_set(PUSH_BUTTON_PIO, PUSH_BUTTON_ID, PUSH_BUTTON_PIN_MSK, PUSH_BUTTON_ATTR, button_handler); NVIC_EnableIRQ((IRQn_Type)PUSH_BUTTON_ID); pio_enable_interrupt(PUSH_BUTTON_PIO, PUSH_BUTTON_PIN_MSK); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Read 'n' bytes from @src, where 'n' is the size of an address on the native machine. We return the number of bytes read, which should always be 'n'. We also have to be careful when reading from @src and writing to @dst, because they can be arbitrarily aligned. Return 'n' - the number of bytes read. */
static int dwarf_read_addr(unsigned long *src, unsigned long *dst)
/* Read 'n' bytes from @src, where 'n' is the size of an address on the native machine. We return the number of bytes read, which should always be 'n'. We also have to be careful when reading from @src and writing to @dst, because they can be arbitrarily aligned. Return 'n' - the number of bytes read. */ static int dwarf_read_addr(unsigned long *src, unsigned long *dst)
{ u32 val = get_unaligned(src); put_unaligned(val, dst); return sizeof(unsigned long *); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Writes a 16/32-bit data word to the remote CPU system address */
uint16_t IPCLtoRDataWrite(volatile tIpcController *psController, uint32_t ulAddress, uint32_t ulData, uint16_t usLength, uint16_t bBlock, uint32_t ulResponseFlag)
/* Writes a 16/32-bit data word to the remote CPU system address */ uint16_t IPCLtoRDataWrite(volatile tIpcController *psController, uint32_t ulAddress, uint32_t ulData, uint16_t usLength, uint16_t bBlock, uint32_t ulResponseFlag)
{ uint16_t status; tIpcMessage sMessage; sMessage.ulcommand = IPC_DATA_WRITE; sMessage.uladdress = ulAddress; sMessage.uldataw1 = ulResponseFlag |(uint32_t)usLength; sMessage.uldataw2 = ulData; status = IpcPut (psController, &sMessage, bBlock); return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Specify when a DMP interrupt should occur. A DMP interrupt can be configured to trigger on either of the two conditions below: */
int dmp_set_interrupt_mode(unsigned char mode)
/* Specify when a DMP interrupt should occur. A DMP interrupt can be configured to trigger on either of the two conditions below: */ int dmp_set_interrupt_mode(unsigned char mode)
{ const unsigned char regs_continuous[11] = {0xd8, 0xb1, 0xb9, 0xf3, 0x8b, 0xa3, 0x91, 0xb6, 0x09, 0xb4, 0xd9}; const unsigned char regs_gesture[11] = {0xda, 0xb1, 0xb9, 0xf3, 0x8b, 0xa3, 0x91, 0xb6, 0xda, 0xb4, 0xda}; switch (mode) { case DMP_INT_CONTINUOUS: return mpu_write_mem(CFG_FIFO_ON_EVENT, 11, (unsigned char*)regs_continuous); case DMP_INT_GESTURE: return mpu_write_mem(CFG_FIFO_ON_EVENT, 11, (unsigned char*)regs_gesture); default: return -1; } }
Luos-io/luos_engine
C++
MIT License
496
/* cx_driver_remove - Remove driver from device struct. @dev: device */
static int cx_driver_remove(struct device *dev)
/* cx_driver_remove - Remove driver from device struct. @dev: device */ static int cx_driver_remove(struct device *dev)
{ struct cx_dev *cx_dev = to_cx_dev(dev); struct cx_drv *cx_drv = cx_dev->driver; if (cx_drv->remove) cx_drv->remove(cx_dev); cx_dev->driver = NULL; return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* IOS 6. A3/A7 IOS 6. A3/A7 IOS 6. */
static guint8 elem_xmode(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset, guint len, ansi_a_shared_data_t *data_p)
/* IOS 6. A3/A7 IOS 6. A3/A7 IOS 6. */ static guint8 elem_xmode(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset, guint len, ansi_a_shared_data_t *data_p)
{ guint8 oct; guint32 curr_offset; curr_offset = offset; proto_tree_add_item(tree, hf_ansi_a_reserved_bits_8_fe, tvb, curr_offset, 1, ENC_BIG_ENDIAN); oct = tvb_get_guint8(tvb, curr_offset); proto_tree_add_item(tree, hf_ansi_a_xmode_tfo_mode, tvb, curr_offset, 1, ENC_BIG_ENDIAN); proto_item_append_text(data_p->elem_item, " - (%s)", (oct & 0x01) ? tfs_ansi_a_xmode_tfo_mode.true_string : tfs_ansi_a_xmode_tfo_mode.false_string); curr_offset++; EXTRANEOUS_DATA_CHECK(len, curr_offset - offset); return(curr_offset - offset); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* FDCAN MSP Initialization This function configures the hardware resources used in this example. */
void HAL_FDCAN_MspInit(FDCAN_HandleTypeDef *hfdcan)
/* FDCAN MSP Initialization This function configures the hardware resources used in this example. */ void HAL_FDCAN_MspInit(FDCAN_HandleTypeDef *hfdcan)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; if(hfdcan->Instance==FDCAN1) { PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_FDCAN1; PeriphClkInit.Fdcan1ClockSelection = RCC_FDCAN1CLKSOURCE_PLL1; if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) { Error_Handler(); } __HAL_RCC_FDCAN1_CLK_ENABLE(); __HAL_RCC_GPIOB_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_8|GPIO_PIN_9; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; GPIO_InitStruct.Alternate = GPIO_AF9_FDCAN1; HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Unlike notify_remote_via_evtchn(), this is safe to use across save/restore. Notifications on a broken connection are silently dropped. */
void notify_remote_via_irq(int irq)
/* Unlike notify_remote_via_evtchn(), this is safe to use across save/restore. Notifications on a broken connection are silently dropped. */ void notify_remote_via_irq(int irq)
{ int evtchn = evtchn_from_irq(irq); if (VALID_EVTCHN(evtchn)) notify_remote_via_evtchn(evtchn); }
robutest/uclinux
C++
GPL-2.0
60
/* Compute the hash for the msdos name corresponding to the dentry. Note: if the name is invalid, we leave the hash code unchanged so that the existing dentry can be used. The msdos fs routines will return ENOENT or EINVAL as appropriate. */
static int msdos_hash(struct dentry *dentry, struct qstr *qstr)
/* Compute the hash for the msdos name corresponding to the dentry. Note: if the name is invalid, we leave the hash code unchanged so that the existing dentry can be used. The msdos fs routines will return ENOENT or EINVAL as appropriate. */ static int msdos_hash(struct dentry *dentry, struct qstr *qstr)
{ struct fat_mount_options *options = &MSDOS_SB(dentry->d_sb)->options; unsigned char msdos_name[MSDOS_NAME]; int error; error = msdos_format_name(qstr->name, qstr->len, msdos_name, options); if (!error) qstr->hash = full_name_hash(msdos_name, MSDOS_NAME); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Reset a SCSI target (all LUNs of this target). */
int sym_reset_scsi_target(struct sym_hcb *np, int target)
/* Reset a SCSI target (all LUNs of this target). */ int sym_reset_scsi_target(struct sym_hcb *np, int target)
{ struct sym_tcb *tp; if (target == np->myaddr || (u_int)target >= SYM_CONF_MAX_TARGET) return -1; tp = &np->target[target]; tp->to_reset = 1; np->istat_sem = SEM; OUTB(np, nc_istat, SIGP|SEM); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Define the configuration of the line watermark . */
void DMA2D_LineWatermarkConfig(uint32_t DMA2D_LWatermarkConfig)
/* Define the configuration of the line watermark . */ void DMA2D_LineWatermarkConfig(uint32_t DMA2D_LWatermarkConfig)
{ assert_param(IS_DMA2D_LineWatermark(DMA2D_LWatermarkConfig)); DMA2D->LWR = (uint32_t)DMA2D_LWatermarkConfig; }
MaJerle/stm32f429
C++
null
2,036
/* Set period & pulse of the PWM channel, remain disabled. Make sure PWM clock is ON for writing registers. */
static rt_err_t pwm_device_set(struct rt_device_pwm *device, struct rt_pwm_configuration *configuration)
/* Set period & pulse of the PWM channel, remain disabled. Make sure PWM clock is ON for writing registers. */ static rt_err_t pwm_device_set(struct rt_device_pwm *device, struct rt_pwm_configuration *configuration)
{ struct pwm_device *pwm_device = (struct pwm_device *)device; uint32_t channel = configuration->channel; rt_err_t res; res = pwm_channel_period(device, channel, configuration->period); if (res == RT_EOK) { res = pwm_channel_pulse(device, channel, configuration->pulse); if (res == RT_EOK) { rt_pin_mode(pwmx_pin[channel], PIN_MODE_OUTPUT); pwm_channel_enable(device, channel, RT_FALSE); } } return res; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Generic function to wait 10 milli-seconds for configuration to complete and return success. */
s32 e1000e_get_cfg_done(struct e1000_hw *hw)
/* Generic function to wait 10 milli-seconds for configuration to complete and return success. */ s32 e1000e_get_cfg_done(struct e1000_hw *hw)
{ mdelay(10); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Clears the interrupt status flags in the interrupt controller. */
uint32_t BOARD_picIntClear(uint8_t flags)
/* Clears the interrupt status flags in the interrupt controller. */ uint32_t BOARD_picIntClear(uint8_t flags)
{ uint32_t status; status = BOARD_picWriteReg( BOARD_PIC_REG_INT_CLEAR, flags ); return status; }
remotemcu/remcu-chip-sdks
C++
null
436
/* RETURN VALUES: 0 - success. -EIO - i/o error. */
static int diIAGRead(struct inomap *imap, int, struct metapage **)
/* RETURN VALUES: 0 - success. -EIO - i/o error. */ static int diIAGRead(struct inomap *imap, int, struct metapage **)
{ struct inode *ipimap = imap->im_ipimap; s64 blkno; blkno = IAGTOLBLK(iagno, JFS_SBI(ipimap->i_sb)->l2nbperpage); *mpp = read_metapage(ipimap, blkno, PSIZE, 0); if (*mpp == NULL) { return -EIO; } return (0); }
robutest/uclinux
C++
GPL-2.0
60
/* configure the GPIO ports , V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */
void gpio_config(void)
/* configure the GPIO ports , V1.0.0, firmware for GD32F1x0(x=3,5) , V2.0.0, firmware for GD32F1x0(x=3,5,7,9) , V3.0.0, firmware update for GD32F1x0(x=3,5,7,9) */ void gpio_config(void)
{ rcu_periph_clock_enable(RCU_GPIOB); gpio_mode_set(GPIOB, GPIO_MODE_AF, GPIO_PUPD_NONE, GPIO_PIN_3); gpio_output_options_set(GPIOB, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ,GPIO_PIN_3); gpio_af_set(GPIOB, GPIO_AF_2, GPIO_PIN_3); }
liuxuming/trochili
C++
Apache License 2.0
132
/* @acb: The adapter which we are to shutdown. */
static void adapter_uninit_chip(struct AdapterCtlBlk *acb)
/* @acb: The adapter which we are to shutdown. */ static void adapter_uninit_chip(struct AdapterCtlBlk *acb)
{ DC395x_write8(acb, TRM_S1040_DMA_INTEN, 0); DC395x_write8(acb, TRM_S1040_SCSI_INTEN, 0); if (acb->config & HCC_SCSI_RESET) reset_scsi_bus(acb); DC395x_read8(acb, TRM_S1040_SCSI_INTSTATUS); }
robutest/uclinux
C++
GPL-2.0
60
/* Return the output level (high or low) of the selected comparator. */
uint8_t COMP_GetOutputLevel(uint32_t COMP_Selection)
/* Return the output level (high or low) of the selected comparator. */ uint8_t COMP_GetOutputLevel(uint32_t COMP_Selection)
{ uint8_t compout = 0x0; assert_param(IS_COMP_ALL_PERIPH(COMP_Selection)); if(COMP_Selection == COMP_Selection_COMP1) { if((COMP->CSR & COMP_CSR_CMP1OUT) != (uint8_t) RESET) { compout = (uint8_t) COMP_OutputLevel_High; } else { compout = (uint8_t) COMP_OutputLevel_Low; } } else { if((COMP->CSR & COMP_CSR_CMP2OUT) != (uint8_t) RESET) { compout = (uint8_t) COMP_OutputLevel_High; } else { compout = (uint8_t) COMP_OutputLevel_Low; } } return (uint8_t)(compout); }
avem-labs/Avem
C++
MIT License
1,752
/* Clear the I2C interrupt flag of the specified I2C port. The */
void I2CIntFlagClear(unsigned long ulBase)
/* Clear the I2C interrupt flag of the specified I2C port. The */ void I2CIntFlagClear(unsigned long ulBase)
{ xASSERT((ulBase == I2C0_BASE) || ((ulBase == I2C1_BASE))); xHWREGB(ulBase + I2C_STATUS) |= I2C_STATUS_IF; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Read temperature from the daughter board's on-board T&RH sensor. */
void CN0429_RdTemp(uint8_t *args)
/* Read temperature from the daughter board's on-board T&RH sensor. */ void CN0429_RdTemp(uint8_t *args)
{ int16_t temperature = 0; eSensorResult = pGasSensor->open(uiDefaultAddress); flushBuff(TXbuff, sizeof(TXbuff)); eSensorResult = pGasSensor->ReadTemperature(&temperature); if (eSensorResult != SENSOR_ERROR_NONE) { UART_TX("ERROR!" _EOS); } else { snprintf((char*) TXbuff, 256, "Temperature = %2.1f degC%s", (temperature / 100.0), _EOS); UART_TX((const char*) TXbuff); } pGasSensor->close(); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Read the specified image into an ABGR-format raster. */
int TIFFReadImageIter(TIFF *tif, uint32 rwidth, uint32 rheight, uint8 *raster, int stop)
/* Read the specified image into an ABGR-format raster. */ int TIFFReadImageIter(TIFF *tif, uint32 rwidth, uint32 rheight, uint8 *raster, int stop)
{ char emsg[1024]; TIFFImageIter img; int ok; if (TIFFImageIterBegin(&img, tif, stop, emsg)) { ok = TIFFImageIterGet(&img, raster, rwidth, img.height); TIFFImageIterEnd(&img); } else { TIFFErrorExt(tif->tif_clientdata, TIFFFileName(tif), emsg); ok = 0; } return (ok); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Update the packets statusbar to the current values */
void packets_bar_update(void)
/* Update the packets statusbar to the current values */ void packets_bar_update(void)
{ if (!cur_main_status_bar_) return; cur_main_status_bar_->updateCaptureStatistics(NULL); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Please refer to the official documentation for function purpose and expected parameters. */
int ph7_value_is_empty(ph7_value *pVal)
/* Please refer to the official documentation for function purpose and expected parameters. */ int ph7_value_is_empty(ph7_value *pVal)
{ return (pVal->iFlags & MEMOBJ_RES) ? TRUE : FALSE; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Checks if a BAR is configured and points to MMIO space. If so, return an error code. Otherwise return 0 */
static int ide_pci_check_iomem(struct pci_dev *dev, const struct ide_port_info *d, int bar)
/* Checks if a BAR is configured and points to MMIO space. If so, return an error code. Otherwise return 0 */ static int ide_pci_check_iomem(struct pci_dev *dev, const struct ide_port_info *d, int bar)
{ ulong flags = pci_resource_flags(dev, bar); if (!flags || pci_resource_len(dev, bar) == 0) return 0; if (flags & IORESOURCE_IO) return 0; return -EINVAL; }
robutest/uclinux
C++
GPL-2.0
60
/* Recursively refresh the style of the children. Go deeper until a not NULL style is found because the NULL styles are inherited from the parent */
static void refresh_children_style(lv_obj_t *obj)
/* Recursively refresh the style of the children. Go deeper until a not NULL style is found because the NULL styles are inherited from the parent */ static void refresh_children_style(lv_obj_t *obj)
{ uint32_t i; uint32_t child_cnt = lv_obj_get_child_count(obj); for(i = 0; i < child_cnt; i++) { lv_obj_t * child = obj->spec_attr->children[i]; lv_obj_invalidate(child); lv_obj_send_event(child, LV_EVENT_STYLE_CHANGED, NULL); lv_obj_invalidate(child); refresh_children_style(child); } }
arendst/Tasmota
C++
GNU General Public License v3.0
21,318
/* we need NOARP for IPv4 but we want neighbor solicitation for IPv6. Setting NOARP on the netdevice is no option because it also turns off neighbor solicitation. For IPv4 we install a neighbor_setup function. We don't want arp resolution but we want the hard header (packet socket will work e.g. tcpdump) */
static int qeth_l3_neigh_setup_noarp(struct neighbour *n)
/* we need NOARP for IPv4 but we want neighbor solicitation for IPv6. Setting NOARP on the netdevice is no option because it also turns off neighbor solicitation. For IPv4 we install a neighbor_setup function. We don't want arp resolution but we want the hard header (packet socket will work e.g. tcpdump) */ static int qeth_l3_neigh_setup_noarp(struct neighbour *n)
{ n->nud_state = NUD_NOARP; memcpy(n->ha, "FAKELL", 6); n->output = n->ops->connected_output; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Zero-length write. Return a list of NFSD's current listener transports. */
static ssize_t __write_ports_names(char *buf)
/* Zero-length write. Return a list of NFSD's current listener transports. */ static ssize_t __write_ports_names(char *buf)
{ if (nfsd_serv == NULL) return 0; return svc_xprt_names(nfsd_serv, buf, SIMPLE_TRANSACTION_LIMIT); }
robutest/uclinux
C++
GPL-2.0
60
/* Get the PDMA Current Source Address of a channel. */
unsigned long PDMACurrentSourceAddrGet(unsigned long ulChannelID)
/* Get the PDMA Current Source Address of a channel. */ unsigned long PDMACurrentSourceAddrGet(unsigned long ulChannelID)
{ xASSERT(xDMAChannelIDValid(ulChannelID)); return xHWREG(g_psDMAChannelAddress[ulChannelID] + PDMA_CSAR); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* If the journal init or create aborts, we need to mark the journal superblock as being NULL to prevent the journal destroy from writing back a bogus superblock. */
static void journal_fail_superblock(journal_t *journal)
/* If the journal init or create aborts, we need to mark the journal superblock as being NULL to prevent the journal destroy from writing back a bogus superblock. */ static void journal_fail_superblock(journal_t *journal)
{ struct buffer_head *bh = journal->j_sb_buffer; brelse(bh); journal->j_sb_buffer = NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* ‘c ’ Continue. addr is Address to resume. If addr is omitted, resume at current Address. */
VOID EFIAPI ContinueAtAddress(IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *PacketData)
/* ‘c ’ Continue. addr is Address to resume. If addr is omitted, resume at current Address. */ VOID EFIAPI ContinueAtAddress(IN EFI_SYSTEM_CONTEXT SystemContext, IN CHAR8 *PacketData)
{ if (PacketData[1] != '\0') { SystemContext.SystemContextX64->Rip = AsciiStrHexToUintn (&PacketData[1]); } }
tianocore/edk2
C++
Other
4,240
/* This function will clear feature for an usb device. */
rt_err_t rt_usbd_clear_feature(udevice_t device, rt_uint16_t value, rt_uint16_t index)
/* This function will clear feature for an usb device. */ rt_err_t rt_usbd_clear_feature(udevice_t device, rt_uint16_t value, rt_uint16_t index)
{ RT_ASSERT(device != RT_NULL); if (value == USB_FEATURE_DEV_REMOTE_WAKEUP) { LOG_D("clear feature remote wakeup"); } else if (value == USB_FEATURE_ENDPOINT_HALT) { LOG_D("clear feature stall"); dcd_ep_clear_stall(device->dcd, (rt_uint32_t)(index & 0xFF)); } return RT_EOK; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Draw window background and contents, including children, within clip. Note that when the DRAW event is sent to the window, the TFT clipping region is already set, so all TFT graphics functions called from the event handler will be subject to proper clipping automatically. */
static void win_draw_contents(struct win_window *win, const struct win_clip_region *clip)
/* Draw window background and contents, including children, within clip. Note that when the DRAW event is sent to the window, the TFT clipping region is already set, so all TFT graphics functions called from the event handler will be subject to proper clipping automatically. */ static void win_draw_contents(struct win_window *win, const struct win_clip_region *clip)
{ struct win_window *child; gfx_set_clipping(clip->NW.x, clip->NW.y, clip->SE.x, clip->SE.y); if (win->attributes.background) { gfx_draw_bitmap_tiled(win->attributes.background, clip->NW.x, clip->NW.y, clip->SE.x, clip->SE.y, clip->origin.x, clip->origin.y); } win_handle_event(win, WIN_EVENT_DRAW, clip); child = win->top_child; if (child != NULL) { do { child = child->prev_sibling; if (child->is_mapped) { win_draw_child(child, clip); } } while (child != win->top_child); } }
memfault/zero-to-main
C++
null
200
/* Perform basic hardware initialization at boot. This needs to be run from the very beginning. So the init priority has to be 0 (zero). */
static int viper_init(void)
/* Perform basic hardware initialization at boot. This needs to be run from the very beginning. So the init priority has to be 0 (zero). */ static int viper_init(void)
{ uint32_t key; uint32_t data; key = irq_lock(); data = sys_read32(LS_ICFG_PMON_LITE_CLK_CTRL); data |= PCIE_PMON_LITE_CLK_ENABLE; sys_write32(data, LS_ICFG_PMON_LITE_CLK_CTRL); data = sys_read32(LS_ICFG_PMON_LITE_SW_RESETN); data |= PCIE_PMON_LITE_SW_RESETN; sys_write32(data, LS_ICFG_PMON_LITE_SW_RESETN); irq_unlock(key); return 0; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* timer interrupt handler check the current position and update the period if necessary. */
static void emu8k_pcm_timer_func(unsigned long data)
/* timer interrupt handler check the current position and update the period if necessary. */ static void emu8k_pcm_timer_func(unsigned long data)
{ struct snd_emu8k_pcm *rec = (struct snd_emu8k_pcm *)data; int ptr, delta; spin_lock(&rec->timer_lock); ptr = emu8k_get_curpos(rec, 0); if (ptr < rec->last_ptr) delta = ptr + rec->buf_size - rec->last_ptr; else delta = ptr - rec->last_ptr; rec->period_pos += delta; rec->last_ptr = ptr; rec->timer.expires = jiffies + 1; add_timer(&rec->timer); if (rec->period_pos >= (int)rec->period_size) { rec->period_pos %= rec->period_size; spin_unlock(&rec->timer_lock); snd_pcm_period_elapsed(rec->substream); return; } spin_unlock(&rec->timer_lock); }
robutest/uclinux
C++
GPL-2.0
60
/* If Sha1Context is NULL, then return FALSE. If HashValue is NULL, then return FALSE. */
BOOLEAN EFIAPI Sha1Final(IN OUT VOID *Sha1Context, OUT UINT8 *HashValue)
/* If Sha1Context is NULL, then return FALSE. If HashValue is NULL, then return FALSE. */ BOOLEAN EFIAPI Sha1Final(IN OUT VOID *Sha1Context, OUT UINT8 *HashValue)
{ if ((Sha1Context == NULL) || (HashValue == NULL)) { return FALSE; } return (BOOLEAN)(SHA1_Final (HashValue, (SHA_CTX *)Sha1Context)); }
tianocore/edk2
C++
Other
4,240
/* Handles an incoming ATT error response for the specified discover-all-characteristics proc. */
static void ble_gattc_disc_all_chrs_err(struct ble_gattc_proc *proc, int status, uint16_t att_handle)
/* Handles an incoming ATT error response for the specified discover-all-characteristics proc. */ static void ble_gattc_disc_all_chrs_err(struct ble_gattc_proc *proc, int status, uint16_t att_handle)
{ ble_gattc_dbg_assert_proc_not_inserted(proc); if (status == BLE_HS_ATT_ERR(BLE_ATT_ERR_ATTR_NOT_FOUND)) { status = BLE_HS_EDONE; } ble_gattc_disc_all_chrs_cb(proc, status, att_handle, NULL); }
Nicholas3388/LuaNode
C++
Other
1,055
/* Set the SDRAM refresh value appropriately for the configured frequency. */
void s3c2410_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg)
/* Set the SDRAM refresh value appropriately for the configured frequency. */ void s3c2410_cpufreq_setrefresh(struct s3c_cpufreq_config *cfg)
{ struct s3c_cpufreq_board *board = cfg->board; unsigned long refresh; unsigned long refval; refresh = (cfg->freq.hclk / 100) * (board->refresh / 10); refresh = DIV_ROUND_UP(refresh, (1000 * 1000)); refresh = (1 << 11) + 1 - refresh; s3c_freq_dbg("%s: refresh value %lu\n", __func__, refresh); refval = __raw_readl(S3C2410_REFRESH); refval &= ~((1 << 12) - 1); refval |= refresh; __raw_writel(refval, S3C2410_REFRESH); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns the number of cpu's that have not responded. */
static int uv_examine_destinations(struct bau_target_nodemask *distribution)
/* Returns the number of cpu's that have not responded. */ static int uv_examine_destinations(struct bau_target_nodemask *distribution)
{ int sender; int i; int count = 0; sender = smp_processor_id(); for (i = 0; i < sizeof(struct bau_target_nodemask) * BITSPERBYTE; i++) { if (!bau_node_isset(i, distribution)) continue; count += uv_examine_destination(uv_bau_table_bases[i], sender); } return count; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* CAN Reset. The CAN peripheral and all its associated configuration registers are placed in the reset condition. The reset is effective via the RCC peripheral reset system. */
void can_reset(uint32_t canport)
/* CAN Reset. The CAN peripheral and all its associated configuration registers are placed in the reset condition. The reset is effective via the RCC peripheral reset system. */ void can_reset(uint32_t canport)
{ if (canport == CAN1) { rcc_peripheral_reset(&RCC_APB1RSTR, RCC_APB1RSTR_CAN1RST); rcc_peripheral_clear_reset(&RCC_APB1RSTR, RCC_APB1RSTR_CAN1RST); } else { rcc_peripheral_reset(&RCC_APB1RSTR, RCC_APB1RSTR_CAN2RST); rcc_peripheral_clear_reset(&RCC_APB1RSTR, RCC_APB1RSTR_CAN2RST); } }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Writes a half-word buffer to the FSMC NOR memory. */
NOR_Status NOR_WriteBuffer(uint16_t *pBuffer, uint32_t WriteAddr, uint32_t NumHalfwordToWrite)
/* Writes a half-word buffer to the FSMC NOR memory. */ NOR_Status NOR_WriteBuffer(uint16_t *pBuffer, uint32_t WriteAddr, uint32_t NumHalfwordToWrite)
{ NOR_Status status = NOR_ONGOING; do { status = NOR_WriteHalfWord(WriteAddr, *pBuffer++); WriteAddr = WriteAddr + 2; NumHalfwordToWrite--; } while((status == NOR_SUCCESS) && (NumHalfwordToWrite != 0)); return (status); }
avem-labs/Avem
C++
MIT License
1,752
/* Return the last hash value in the leaf. Stale entries are ok. */
xfs_dahash_t xfs_dir2_leafn_lasthash(xfs_dabuf_t *bp, int *count)
/* Return the last hash value in the leaf. Stale entries are ok. */ xfs_dahash_t xfs_dir2_leafn_lasthash(xfs_dabuf_t *bp, int *count)
{ xfs_dir2_leaf_t *leaf; leaf = bp->data; ASSERT(be16_to_cpu(leaf->hdr.info.magic) == XFS_DIR2_LEAFN_MAGIC); if (count) *count = be16_to_cpu(leaf->hdr.count); if (!leaf->hdr.count) return 0; return be32_to_cpu(leaf->ents[be16_to_cpu(leaf->hdr.count) - 1].hashval); }
robutest/uclinux
C++
GPL-2.0
60
/* Enable the write protection of the desired sectors, for the first 1 Mb of the FMC. */
void FMC_OPT_EnableWriteProtect(FMC_OPT_WRP_T wrp)
/* Enable the write protection of the desired sectors, for the first 1 Mb of the FMC. */ void FMC_OPT_EnableWriteProtect(FMC_OPT_WRP_T wrp)
{ FMC_STATUS_T status = FMC_COMPLETE; status = FMC_WaitForLastOperation(); if (status == FMC_COMPLETE) { *(__IO uint16_t *)(OPTCTRL_BYTE2_ADDRESS) &= (~(uint16_t)wrp); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Called to indicate a device has changed features. */
void netdev_features_change(struct net_device *dev)
/* Called to indicate a device has changed features. */ void netdev_features_change(struct net_device *dev)
{ call_netdevice_notifiers(NETDEV_FEAT_CHANGE, dev); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function performs a symmetric encryption or decryption operation. */
rt_err_t rt_hwcrypto_symmetric_crypt(struct rt_hwcrypto_ctx *ctx, hwcrypto_mode mode, rt_size_t length, const rt_uint8_t *in, rt_uint8_t *out)
/* This function performs a symmetric encryption or decryption operation. */ rt_err_t rt_hwcrypto_symmetric_crypt(struct rt_hwcrypto_ctx *ctx, hwcrypto_mode mode, rt_size_t length, const rt_uint8_t *in, rt_uint8_t *out)
{ struct hwcrypto_symmetric *symmetric_ctx; struct hwcrypto_symmetric_info symmetric_info; rt_err_t err; if (ctx == RT_NULL) { return -RT_EINVAL; } symmetric_ctx = (struct hwcrypto_symmetric *)ctx; if (symmetric_ctx->ops->crypt == RT_NULL) { return -RT_ERROR; } if (mode != HWCRYPTO_MODE_ENCRYPT && mode != HWCRYPTO_MODE_DECRYPT) { return -EINVAL; } symmetric_info.mode = mode; symmetric_info.in = in; symmetric_info.out = out; symmetric_info.length = length; err = symmetric_ctx->ops->crypt(symmetric_ctx, &symmetric_info); symmetric_ctx->flags &= ~(SYMMTRIC_MODIFY_KEY | SYMMTRIC_MODIFY_IV | SYMMTRIC_MODIFY_IVOFF); return err; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Calculate the maximum value which is a power of 2, but less the MemoryLength. */
UINT64 Power2MaxMemory(IN UINT64 MemoryAddress, IN UINT64 MemoryLength)
/* Calculate the maximum value which is a power of 2, but less the MemoryLength. */ UINT64 Power2MaxMemory(IN UINT64 MemoryAddress, IN UINT64 MemoryLength)
{ UINT64 Result; if (MemoryLength == 0) { return EFI_INVALID_PARAMETER; } Result = GetPowerOfTwo64 (MemoryLength); if (MemoryAddress == 0) { return Result; } while (CheckMtrrAlignment (MemoryAddress, Result) != 0) { Result = RShiftU64 (Result, 1); } return Result; }
tianocore/edk2
C++
Other
4,240
/* Get the peripheral clock speed for the Timer at base specified. */
uint32_t rcc_get_timer_clk_freq(uint32_t timer)
/* Get the peripheral clock speed for the Timer at base specified. */ uint32_t rcc_get_timer_clk_freq(uint32_t timer)
{ if (timer >= TIM2_BASE && timer <= TIM14_BASE) { uint8_t ppre1 = (RCC_CFGR >> RCC_CFGR_PPRE1_SHIFT) & RCC_CFGR_PPRE1_MASK; return (ppre1 == RCC_CFGR_PPRE_DIV_NONE) ? rcc_apb1_frequency : 2 * rcc_apb1_frequency; } else { uint8_t ppre2 = (RCC_CFGR >> RCC_CFGR_PPRE2_SHIFT) & RCC_CFGR_PPRE2_MASK; return (ppre2 == RCC_CFGR_PPRE_DIV_NONE) ? rcc_apb2_frequency : 2 * rcc_apb2_frequency; } }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* The constructor function caches the pointer of SMM Services Table. */
EFI_STATUS EFIAPI SmmCoreSmmServicesTableLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
/* The constructor function caches the pointer of SMM Services Table. */ EFI_STATUS EFIAPI SmmCoreSmmServicesTableLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
{ gSmst = &gSmmCoreSmst; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Function: IsFlashBusy Arguments: None. Description: Check status register WIP bit. If WIP bit = 1: return TRUE ( Busy ) = 0: return FALSE ( Ready ). Return Message: TRUE, FALSE */
bool IsFlashBusy(void)
/* Function: IsFlashBusy Arguments: None. Description: Check status register WIP bit. If WIP bit = 1: return TRUE ( Busy ) = 0: return FALSE ( Ready ). Return Message: TRUE, FALSE */ bool IsFlashBusy(void)
{ uint8_t gDataBuffer; MX25_RDSR( &gDataBuffer ); if( (gDataBuffer & FLASH_WIP_MASK) == FLASH_WIP_MASK ) return TRUE; else return FALSE; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Return: 0 if all went fine, else return appropriate error. */
static int ti_sci_cmd_get_device_resets(const struct ti_sci_handle *handle, u32 id, u32 *reset_state)
/* Return: 0 if all went fine, else return appropriate error. */ static int ti_sci_cmd_get_device_resets(const struct ti_sci_handle *handle, u32 id, u32 *reset_state)
{ return ti_sci_get_device_state(handle, id, NULL, reset_state, NULL, NULL); }
4ms/stm32mp1-baremetal
C++
Other
137
/* The underlying MTD device may cache data in hardware or in software. This function ensures the caches are flushed. Returns zero in case of success and a negative error code in case of failure. */
int ubi_sync(int ubi_num)
/* The underlying MTD device may cache data in hardware or in software. This function ensures the caches are flushed. Returns zero in case of success and a negative error code in case of failure. */ int ubi_sync(int ubi_num)
{ struct ubi_device *ubi; ubi = ubi_get_device(ubi_num); if (!ubi) return -ENODEV; if (ubi->mtd->sync) ubi->mtd->sync(ubi->mtd); ubi_put_device(ubi); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Enable DMA mode for transmission @rmtoll CR TXDMA LL_SWPMI_EnableDMAReq_TX. */
void LL_SWPMI_EnableDMAReq_TX(SWPMI_TypeDef *SWPMIx)
/* Enable DMA mode for transmission @rmtoll CR TXDMA LL_SWPMI_EnableDMAReq_TX. */ void LL_SWPMI_EnableDMAReq_TX(SWPMI_TypeDef *SWPMIx)
{ SET_BIT(SWPMIx->CR, SWPMI_CR_TXDMA); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Acquires semaphore then reads the PHY register at offset and stores the retrieved information in data. Release the acquired semaphore before exiting. */
s32 e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data)
/* Acquires semaphore then reads the PHY register at offset and stores the retrieved information in data. Release the acquired semaphore before exiting. */ s32 e1000e_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data)
{ return __e1000e_read_phy_reg_igp(hw, offset, data, false); }
robutest/uclinux
C++
GPL-2.0
60
/* @priv: Private driver data @reg: Register number to update @bic: Mask of bits to clear @set: Mask of bits to set */
static int rt5677_bic_or(struct rt5677_priv *priv, uint reg, uint bic, uint set)
/* @priv: Private driver data @reg: Register number to update @bic: Mask of bits to clear @set: Mask of bits to set */ static int rt5677_bic_or(struct rt5677_priv *priv, uint reg, uint bic, uint set)
{ uint old, new_value; int ret; old = rt5677_i2c_read(priv, reg); if (old < 0) return old; new_value = (old & ~bic) | (set & bic); if (old != new_value) { ret = rt5677_i2c_write(priv, reg, new_value); if (ret) return ret; } return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* An abort indicates that the current memory access cannot be completed, which occurs during an instruction prefetch. */
void rt_hw_trap_pabt(struct rt_hw_register *regs)
/* An abort indicates that the current memory access cannot be completed, which occurs during an instruction prefetch. */ void rt_hw_trap_pabt(struct rt_hw_register *regs)
{ rt_hw_show_register(regs); rt_kprintf("prefetch abort\n"); rt_hw_cpu_shutdown(); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Changes the state of the driver enable pin for the available serial port. This is only applicable for RS485 networks, which require an RS485 transceiver. */
static void TbxMbPortUartDriverEnable(tTbxMbUartPort port, uint8_t value)
/* Changes the state of the driver enable pin for the available serial port. This is only applicable for RS485 networks, which require an RS485 transceiver. */ static void TbxMbPortUartDriverEnable(tTbxMbUartPort port, uint8_t value)
{ if (port == TBX_MB_UART_PORT1) { if (value == TBX_ON) { HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_SET); } else { HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, GPIO_PIN_RESET); } } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Close the protocol opened for Redfish discovery. This function also destroy the network services. */
EFI_STATUS CloseProtocolService(IN EFI_DRIVER_BINDING_PROTOCOL *ThisBindingProtocol, IN EFI_HANDLE ControllerHandle, IN REDFISH_DISCOVER_REQUIRED_PROTOCOL *ThisRequiredProtocol, IN EFI_HANDLE DriverAgentHandle, IN EFI_HANDLE DriverControllerHandle)
/* Close the protocol opened for Redfish discovery. This function also destroy the network services. */ EFI_STATUS CloseProtocolService(IN EFI_DRIVER_BINDING_PROTOCOL *ThisBindingProtocol, IN EFI_HANDLE ControllerHandle, IN REDFISH_DISCOVER_REQUIRED_PROTOCOL *ThisRequiredProtocol, IN EFI_HANDLE DriverAgentHandle, IN EFI_HANDLE DriverControllerHandle)
{ EFI_STATUS Status; Status = gBS->CloseProtocol ( ControllerHandle, ThisRequiredProtocol->RequiredProtocolGuid, DriverAgentHandle, DriverControllerHandle ); if (!EFI_ERROR (Status)) { NetLibDestroyServiceChild ( ControllerHandle, ThisBindingProtocol->ImageHandle, ThisRequiredProtocol->RequiredServiceBindingProtocolGuid, ControllerHandle ); } return Status; }
tianocore/edk2
C++
Other
4,240
/* STUSB1602 sets the VCONN switch Current Limitation on CC (bit3-0 0x1E */
STUSB1602_StatusTypeDef STUSB1602_VCONN_Switch_Current_Limit_Set(uint8_t Addr, VCONN_Switch_Current_Limit_TypeDef curr_lim)
/* STUSB1602 sets the VCONN switch Current Limitation on CC (bit3-0 0x1E */ STUSB1602_StatusTypeDef STUSB1602_VCONN_Switch_Current_Limit_Set(uint8_t Addr, VCONN_Switch_Current_Limit_TypeDef curr_lim)
{ STUSB1602_StatusTypeDef status = STUSB1602_OK; STUSB1602_CC_VCONN_SWITCH_CTRL_RegTypeDef reg; STUSB1602_ReadReg(&reg.d8, Addr, STUSB1602_CC_VCONN_SWITCH_CTRL_REG, 1); reg.b.CC_VCONN_SWITCH_ILIM = curr_lim; status = STUSB1602_WriteReg(&reg.d8, Addr, STUSB1602_CC_VCONN_SWITCH_CTRL_REG, 1); return status; }
st-one/X-CUBE-USB-PD
C++
null
110
/* Get the filesystem statistics. Currently, we let this pass right through to the lower filesystem and take no action ourselves. */
static int ecryptfs_statfs(struct dentry *dentry, struct kstatfs *buf)
/* Get the filesystem statistics. Currently, we let this pass right through to the lower filesystem and take no action ourselves. */ static int ecryptfs_statfs(struct dentry *dentry, struct kstatfs *buf)
{ return vfs_statfs(ecryptfs_dentry_to_lower(dentry), buf); }
robutest/uclinux
C++
GPL-2.0
60
/* Enable Snapshot for Event messages. When enabled, snapshot is taken for event messages only (SYNC, Delay_Req, Pdelay_Req or Pdelay_Resp) When disabled, snapshot is taken for all messages except Announce, Management and Signaling. Reserved when "Advanced Time Stamp" is not selected */
void synopGMAC_TS_event_enable(synopGMACdevice *gmacdev)
/* Enable Snapshot for Event messages. When enabled, snapshot is taken for event messages only (SYNC, Delay_Req, Pdelay_Req or Pdelay_Resp) When disabled, snapshot is taken for all messages except Announce, Management and Signaling. Reserved when "Advanced Time Stamp" is not selected */ void synopGMAC_TS_event_enable(synopGMACdevice *gmacdev)
{ synopGMACSetBits(gmacdev->MacBase,GmacTSControl,GmacTSEVNTENA); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* updates the next hop the lifetime and the interface id for a given entry */
static int fib_upd_entry(fib_entry_t *entry, uint8_t *next_hop, size_t next_hop_size, uint32_t next_hop_flags, uint32_t lifetime)
/* updates the next hop the lifetime and the interface id for a given entry */ static int fib_upd_entry(fib_entry_t *entry, uint8_t *next_hop, size_t next_hop_size, uint32_t next_hop_flags, uint32_t lifetime)
{ universal_address_container_t *container = universal_address_add(next_hop, next_hop_size); if (container == NULL) { return -ENOMEM; } universal_address_rem(entry->next_hop); entry->next_hop = container; entry->next_hop_flags = next_hop_flags; if (lifetime != (uint32_t)FIB_LIFETIME_NO_EXPIRE) { fib_lifetime_to_absolute(lifetime, &entry->lifetime); } else { entry->lifetime = FIB_LIFETIME_NO_EXPIRE; } return 0; }
labapart/polymcu
C++
null
201
/* If 64-bit MMIO register operations are not supported, then ASSERT(). If Address is not aligned on a 64-bit boundary, then ASSERT(). If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */
UINT64 EFIAPI MmioBitFieldRead64(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
/* If 64-bit MMIO register operations are not supported, then ASSERT(). If Address is not aligned on a 64-bit boundary, then ASSERT(). If StartBit is greater than 63, then ASSERT(). If EndBit is greater than 63, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). */ UINT64 EFIAPI MmioBitFieldRead64(IN UINTN Address, IN UINTN StartBit, IN UINTN EndBit)
{ return BitFieldRead64 (MmioRead64 (Address), StartBit, EndBit); }
tianocore/edk2
C++
Other
4,240
/* @data - not used, needed to match interface Return: - byte read or 0 on error */
static u8 read_console(void *data)
/* @data - not used, needed to match interface Return: - byte read or 0 on error */ static u8 read_console(void *data)
{ int ch; ch = getc(); if (ch < 0) ch = 0; return ch; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Returns the maximum cache level implemented by the current CPU. */
UINT8 SmbiosProcessorGetMaxCacheLevel(VOID)
/* Returns the maximum cache level implemented by the current CPU. */ UINT8 SmbiosProcessorGetMaxCacheLevel(VOID)
{ CLIDR_DATA Clidr; UINT8 CacheLevel; UINT8 MaxCacheLevel; MaxCacheLevel = 0; Clidr.Data = ReadCLIDR (); if (CLIDR_GET_CACHE_TYPE (Clidr.Data, 1) == ClidrCacheTypeNone) { return 0; } for (CacheLevel = 1; CacheLevel <= MAX_ARM_CACHE_LEVEL; CacheLevel++) { if (CLIDR_GET_CACHE_TYPE (Clidr.Data, CacheLevel) == ClidrCacheTypeNone) { MaxCacheLevel = CacheLevel; break; } } return MaxCacheLevel; }
tianocore/edk2
C++
Other
4,240
/* Set the specified data holding register value for DAC channel2. */
void DAC_SetChannel2Data(uint32_t DAC_Align, uint16_t Data)
/* Set the specified data holding register value for DAC channel2. */ void DAC_SetChannel2Data(uint32_t DAC_Align, uint16_t Data)
{ assert_param(IS_DAC_ALIGN(DAC_Align)); assert_param(IS_DAC_DATA(Data)); *((__IO uint32_t *)(DAC_BASE + DHR12R2_Offset + DAC_Align)) = (uint32_t)Data; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Retrieve the amount of cycles to delay for the given amount of us. */
static uint32_t _get_cycles_for_us_internal(const uint16_t us, const uint32_t freq, const uint8_t power)
/* Retrieve the amount of cycles to delay for the given amount of us. */ static uint32_t _get_cycles_for_us_internal(const uint16_t us, const uint32_t freq, const uint8_t power)
{ switch (power) { case 9: return (us * (freq / 1000000) + 2) / 3; case 8: return (us * (freq / 100000) + 29) / 30; case 7: return (us * (freq / 10000) + 299) / 300; case 6: return (us * (freq / 1000) + 2999) / 3000; case 5: return (us * (freq / 100) + 29999) / 30000; case 4: return (us * (freq / 10) + 299999) / 300000; default: return (us * freq + 2999999) / 3000000; } }
eclipse-threadx/getting-started
C++
Other
310
/* SD MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_SD_MspDeInit(SD_HandleTypeDef *hsd)
/* SD MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_SD_MspDeInit(SD_HandleTypeDef *hsd)
{ if(hsd->Instance==SDMMC1) { __HAL_RCC_SDMMC1_CLK_DISABLE(); HAL_GPIO_DeInit(uSD_CMD_GPIO_Port, uSD_CMD_Pin); HAL_GPIO_DeInit(GPIOC, uSD_D2_Pin|uSD_D3_Pin|uSD_CLK_Pin|uSD_D1_Pin |uSD_D0_Pin); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Enable the assertion of SUPC interrupt signal when a supply monitor detection occurs. */
void supc_enable_monitor_interrupt(Supc *p_supc)
/* Enable the assertion of SUPC interrupt signal when a supply monitor detection occurs. */ void supc_enable_monitor_interrupt(Supc *p_supc)
{ p_supc->SUPC_SMMR |= SUPC_SMMR_SMIEN; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Queue specified RtkBuffer into a RtkQueue at list Head. */
void RtbQueueHead(IN OUT RTB_QUEUE_HEAD *RtkQueueHead, IN RTK_BUFFER *RtkBuffer)
/* Queue specified RtkBuffer into a RtkQueue at list Head. */ void RtbQueueHead(IN OUT RTB_QUEUE_HEAD *RtkQueueHead, IN RTK_BUFFER *RtkBuffer)
{ aos_mutex_lock(&RtkQueueHead->Lock, AOS_WAIT_FOREVER); ListAddToHead(&RtkBuffer->List, &RtkQueueHead->List); RtkQueueHead->QueueLen++; aos_mutex_unlock(&RtkQueueHead->Lock); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Write generic data through generic payload dta in/out register. */
static void gen_write_data(unsigned long gen_pld_data)
/* Write generic data through generic payload dta in/out register. */ static void gen_write_data(unsigned long gen_pld_data)
{ while (HW_MIPI_DSI_CMD_PKT_STATUS.B.GEN_PLD_W_FULL) ; HW_MIPI_DSI_GEN_PLD_DATA_WR(gen_pld_data); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Handle any Correctable Errors (CEs) that have occurred. Check for valid ERROR ADDRESS and process. */
static void amd64_handle_ce(struct mem_ctl_info *mci, struct err_regs *info)
/* Handle any Correctable Errors (CEs) that have occurred. Check for valid ERROR ADDRESS and process. */ static void amd64_handle_ce(struct mem_ctl_info *mci, struct err_regs *info)
{ struct amd64_pvt *pvt = mci->pvt_info; u64 sys_addr; if ((info->nbsh & K8_NBSH_VALID_ERROR_ADDR) == 0) { amd64_mc_printk(mci, KERN_ERR, "HW has no ERROR_ADDRESS available\n"); edac_mc_handle_ce_no_info(mci, EDAC_MOD_STR); return; } sys_addr = pvt->ops->get_error_address(mci, info); amd64_mc_printk(mci, KERN_ERR, "CE ERROR_ADDRESS= 0x%llx\n", sys_addr); pvt->ops->map_sysaddr_to_csrow(mci, info, sys_addr); }
robutest/uclinux
C++
GPL-2.0
60
/* Enables or disables the specified ADC DMA request. */
void ADC_DMACmd(ADC_TypeDef *ADCx, FunctionalState NewState)
/* Enables or disables the specified ADC DMA request. */ void ADC_DMACmd(ADC_TypeDef *ADCx, FunctionalState NewState)
{ assert_param(IS_ADC_DMA_PERIPH(ADCx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { ADCx->CFGR |= ADC_CFGR_DMAEN; } else { ADCx->CFGR &= ~(uint32_t)ADC_CFGR_DMAEN; } }
ajhc/demo-cortex-m3
C++
null
38
/* Description: A new incoming connection request is represented by @req, we need to label the new request_sock here and the stack will ensure the on-the-wire label will get preserved when a full sock is created once the connection handshake is complete. Returns zero on success, negative values on failure. */
int selinux_netlbl_inet_conn_request(struct request_sock *req, u16 family)
/* Description: A new incoming connection request is represented by @req, we need to label the new request_sock here and the stack will ensure the on-the-wire label will get preserved when a full sock is created once the connection handshake is complete. Returns zero on success, negative values on failure. */ int selinux_netlbl_inet_conn_request(struct request_sock *req, u16 family)
{ int rc; struct netlbl_lsm_secattr secattr; if (family != PF_INET) return 0; netlbl_secattr_init(&secattr); rc = security_netlbl_sid_to_secattr(req->secid, &secattr); if (rc != 0) goto inet_conn_request_return; rc = netlbl_req_setattr(req, &secattr); inet_conn_request_return: netlbl_secattr_destroy(&secattr); return rc; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Set SLCD automated character. Set automated character mode. */
enum status_code slcd_automated_char_set_config(struct slcd_automated_char_config *const config)
/* Set SLCD automated character. Set automated character mode. */ enum status_code slcd_automated_char_set_config(struct slcd_automated_char_config *const config)
{ if (!config) { return STATUS_ERR_INVALID_ARG; } SLCD->CMCFG.reg = SLCD_CMCFG_NSEG(config->seg_line_num) | (config->order << SLCD_CMCFG_DEC_Pos); SLCD->ACMCFG.reg = SLCD_ACMCFG_FCS(config->fc) | (config->mode << SLCD_ACMCFG_MODE_Pos) | SLCD_ACMCFG_STSEG(config->start_seg_line) | SLCD_ACMCFG_NDROW(config->row_digit_num) | SLCD_ACMCFG_NDIG(config->digit_num) | SLCD_ACMCFG_STEPS(config->scrolling_step) | SLCD_ACMCFG_NCOM(config->com_line_num); SLCD->CMDMASK.reg = SLCD_CMDMASK_SDMASK(config->data_mask); return STATUS_OK; }
memfault/zero-to-main
C++
null
200
/* Add constant 'v' to prototype's list of constants (field 'k'). Use scanner's table to cache position of constants in constant list and try to reuse constants. Because some values should not be used as keys (nil cannot be a key, integer keys can collapse with float keys), the caller must provide a useful 'key' for indexing the cache. Note that all functions share the same table, so entering or exiting a function can make some indices wrong. */
static int addk(FuncState *fs, TValue *key, TValue *v)
/* Add constant 'v' to prototype's list of constants (field 'k'). Use scanner's table to cache position of constants in constant list and try to reuse constants. Because some values should not be used as keys (nil cannot be a key, integer keys can collapse with float keys), the caller must provide a useful 'key' for indexing the cache. Note that all functions share the same table, so entering or exiting a function can make some indices wrong. */ static int addk(FuncState *fs, TValue *key, TValue *v)
{ k = cast_int(ivalue(idx)); if (k < fs->nk && ttypetag(&f->k[k]) == ttypetag(v) && luaV_rawequalobj(&f->k[k], v)) return k; } oldsize = f->sizek; k = fs->nk; setivalue(&val, k); luaH_finishset(L, fs->ls->h, key, idx, &val); luaM_growvector(L, f->k, k, f->sizek, TValue, MAXARG_Ax, "constants"); while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]); setobj(L, &f->k[k], v); fs->nk++; luaC_barrier(L, f, v); return k; }
Nicholas3388/LuaNode
C++
Other
1,055
/* The memory resource for the UMC device is acquired and the device registered with the system. */
int umc_device_register(struct umc_dev *umc)
/* The memory resource for the UMC device is acquired and the device registered with the system. */ int umc_device_register(struct umc_dev *umc)
{ int err; err = request_resource(umc->resource.parent, &umc->resource); if (err < 0) { dev_err(&umc->dev, "can't allocate resource range " "%016Lx to %016Lx: %d\n", (unsigned long long)umc->resource.start, (unsigned long long)umc->resource.end, err); goto error_request_resource; } err = device_register(&umc->dev); if (err < 0) goto error_device_register; return 0; error_device_register: release_resource(&umc->resource); error_request_resource: return err; }
robutest/uclinux
C++
GPL-2.0
60
/* Reads the base/extended device id from a device. Returns the 8/16-bit device ID. */
static u16 rio_get_device_id(struct rio_mport *port, u16 destid, u8 hopcount)
/* Reads the base/extended device id from a device. Returns the 8/16-bit device ID. */ static u16 rio_get_device_id(struct rio_mport *port, u16 destid, u8 hopcount)
{ u32 result; rio_mport_read_config_32(port, destid, hopcount, RIO_DID_CSR, &result); return RIO_GET_DID(port->sys_size, result); }
robutest/uclinux
C++
GPL-2.0
60
/* The memory space must be word-aligned. An assert will occur if asserts are turned on and the memory is not word-aligned. */
XStatus XEmac_SetSgRecvSpace(XEmac *InstancePtr, u32 *MemoryPtr, u32 ByteCount)
/* The memory space must be word-aligned. An assert will occur if asserts are turned on and the memory is not word-aligned. */ XStatus XEmac_SetSgRecvSpace(XEmac *InstancePtr, u32 *MemoryPtr, u32 ByteCount)
{ XASSERT_NONVOID(InstancePtr != NULL); XASSERT_NONVOID(MemoryPtr != NULL); XASSERT_NONVOID(ByteCount != 0); XASSERT_NONVOID(InstancePtr->IsReady == XCOMPONENT_IS_READY); if (!XEmac_mIsSgDma(InstancePtr)) { return XST_NOT_SGDMA; } return XDmaChannel_CreateSgList(&InstancePtr->RecvChannel, MemoryPtr, ByteCount); }
EmcraftSystems/u-boot
C++
Other
181
/* return the MAC address of the es module. */
ES_WIFI_Status_t ES_WIFI_GetMACAddress(ES_WIFIObject_t *Obj, uint8_t *mac)
/* return the MAC address of the es module. */ ES_WIFI_Status_t ES_WIFI_GetMACAddress(ES_WIFIObject_t *Obj, uint8_t *mac)
{ ES_WIFI_Status_t ret ; char *ptr; sprintf((char*)Obj->CmdData,"Z5\r"); ret = AT_ExecuteCommand(Obj, Obj->CmdData, Obj->CmdData); if(ret == ES_WIFI_STATUS_OK) { ptr = strtok((char *)(Obj->CmdData + 2), "\r\n"); ParseMAC(ptr, mac) ; } return ret; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Co-routines that are readied by an interrupt cannot be placed directly into the ready lists (there is no mutual exclusion). Instead they are placed in in the pending ready list in order that they can later be moved to the ready list by the co-routine scheduler. */
static void prvCheckPendingReadyList(void)
/* Co-routines that are readied by an interrupt cannot be placed directly into the ready lists (there is no mutual exclusion). Instead they are placed in in the pending ready list in order that they can later be moved to the ready list by the co-routine scheduler. */ static void prvCheckPendingReadyList(void)
{ while( listLIST_IS_EMPTY( &xPendingReadyCoRoutineList ) == pdFALSE ) { CRCB_t *pxUnblockedCRCB; portDISABLE_INTERRUPTS(); { pxUnblockedCRCB = ( CRCB_t * ) listGET_OWNER_OF_HEAD_ENTRY( (&xPendingReadyCoRoutineList) ); ( void ) uxListRemove( &( pxUnblockedCRCB->xEventListItem ) ); } portENABLE_INTERRUPTS(); ( void ) uxListRemove( &( pxUnblockedCRCB->xGenericListItem ) ); prvAddCoRoutineToReadyQueue( pxUnblockedCRCB ); } }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* Draws a single pixel at the specified location. */
void drawPixel(uint16_t x, uint16_t y, uint16_t color)
/* Draws a single pixel at the specified location. */ void drawPixel(uint16_t x, uint16_t y, uint16_t color)
{ if ((x < lcdGetWidth()) && (y < lcdGetHeight())) { lcdDrawPixel(x, y, color); } }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Check the CPU has an FPU the official way. */
static int __cpu_has_fpu(void)
/* Check the CPU has an FPU the official way. */ static int __cpu_has_fpu(void)
{ return ((cpu_get_fpu_id() & 0xff00) != FPIR_IMP_NONE); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Note: Powerquad has a hardware limitation, when using it for FIR increment calculation, the address of pSrc needs to be a continuous address. */
void arm_fir_f32(const arm_fir_instance_f32 *S, const float32_t *pSrc, float32_t *pDst, uint32_t blockSize)
/* Note: Powerquad has a hardware limitation, when using it for FIR increment calculation, the address of pSrc needs to be a continuous address. */ void arm_fir_f32(const arm_fir_instance_f32 *S, const float32_t *pSrc, float32_t *pDst, uint32_t blockSize)
{ assert(NULL != S); assert(NULL != pSrc); assert(NULL != pDst); uint32_t curOffset; PQ_SET_F32_CONFIG; curOffset = *(uint32_t *)(void *)(S->pState); if (curOffset == 0U) { PQ_FIR(POWERQUAD, pSrc, (int32_t)blockSize, &(S->pState[1]), (int32_t)S->numTaps, pDst, PQ_FIR_FIR); } else { _arm_fir_increment(pSrc, blockSize, &S->pState[1], S->numTaps, pDst, curOffset, sizeof(*pSrc)); } *(uint32_t *)(void *)(S->pState) = curOffset + blockSize; PQ_WaitDone(POWERQUAD); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set the Timer to Count Up. This has no effect if the timer is set to center aligned. */
void timer_direction_up(uint32_t timer_peripheral)
/* Set the Timer to Count Up. This has no effect if the timer is set to center aligned. */ void timer_direction_up(uint32_t timer_peripheral)
{ TIM_CR1(timer_peripheral) &= ~TIM_CR1_DIR_DOWN; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* This function creates an alias for a shell command or if Alias is NULL it will delete an existing alias. */
EFI_STATUS EFIAPI EfiShellSetAlias(IN CONST CHAR16 *Command, IN CONST CHAR16 *Alias, IN BOOLEAN Replace, IN BOOLEAN Volatile)
/* This function creates an alias for a shell command or if Alias is NULL it will delete an existing alias. */ EFI_STATUS EFIAPI EfiShellSetAlias(IN CONST CHAR16 *Command, IN CONST CHAR16 *Alias, IN BOOLEAN Replace, IN BOOLEAN Volatile)
{ if (ShellCommandIsOnAliasList ((Alias == NULL) ? Command : Alias)) { return (EFI_ACCESS_DENIED); } else if ((Command == NULL) || (*Command == CHAR_NULL) || (StrLen (Command) == 0)) { return (EFI_INVALID_PARAMETER); } else if ((EfiShellGetAlias (Command, NULL) != NULL) && !Replace) { return (EFI_ACCESS_DENIED); } else { return (InternalSetAlias (Command, Alias, Volatile)); } }
tianocore/edk2
C++
Other
4,240