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 maximum number of memory blocks in a Memory Pool. */
uint32_t osMemoryPoolGetCapacity(osMemoryPoolId_t mp_id)
/* Get maximum number of memory blocks in a Memory Pool. */ uint32_t osMemoryPoolGetCapacity(osMemoryPoolId_t mp_id)
{ struct cv2_mslab *mslab = (struct cv2_mslab *)mp_id; if (mslab == NULL) { return 0; } else { return mslab->z_mslab.info.num_blocks; } }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Install the SMBIOS table as a configuration table. */
efi_status_t efi_smbios_register(void)
/* Install the SMBIOS table as a configuration table. */ efi_status_t efi_smbios_register(void)
{ u64 dmi_addr = U32_MAX; efi_status_t ret; void *dmi; ret = efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS, EFI_RUNTIME_SERVICES_DATA, 1, &dmi_addr); if (ret != EFI_SUCCESS) { ret = efi_allocate_pages(EFI_ALLOCATE_ANY_PAGES, EFI_RUNTIME_SERVICES_DATA, 1, &dmi_addr); if (ret != EFI_SUCCESS) return ret; } assert(!(dmi_addr & 0xf)); dmi = (void *)(uintptr_t)dmi_addr; write_smbios_table(map_to_sysmem(dmi)); return efi_install_configuration_table(&smbios_guid, dmi); }
4ms/stm32mp1-baremetal
C++
Other
137
/* Set an interrupt handler for the specified interrput source. */
void ipc_set_handler(Ipc *p_ipc, enum ipc_interrupt_source source, void(*p_handler)(Ipc *, enum ipc_interrupt_source))
/* Set an interrupt handler for the specified interrput source. */ void ipc_set_handler(Ipc *p_ipc, enum ipc_interrupt_source source, void(*p_handler)(Ipc *, enum ipc_interrupt_source))
{ struct ipc_interrupt_handler *pSource; uint32_t i = 0; while (!(source & (1 << i))) { i++; } if (p_ipc == IPC0) { pSource = &(ipc_handler[0][i]); } else { pSource = &(ipc_handler[1][i]); } pSource->mask = source; pSource->handler = p_handler; }
remotemcu/remcu-chip-sdks
C++
null
436
/* This function retrieves the user-readable name of a driver in the form of a Unicode string. If the driver specified by This has a user-readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */
EFI_STATUS EFIAPI Ip6ComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
/* This function retrieves the user-readable name of a driver in the form of a Unicode string. If the driver specified by This has a user-readable name in the language specified by Language, then a pointer to the driver name is returned in DriverName, and EFI_SUCCESS is returned. If the driver specified by This does not support the language specified by Language, then EFI_UNSUPPORTED is returned. */ EFI_STATUS EFIAPI Ip6ComponentNameGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
{ return LookupUnicodeString2 ( Language, This->SupportedLanguages, mIp6DriverNameTable, DriverName, (BOOLEAN)(This == &gIp6ComponentName) ); }
tianocore/edk2
C++
Other
4,240
/* The Start() function is designed to be invoked from the EFI boot service ConnectController(). As a result, much of the error checking on the parameters to Start() has been moved into this common boot service. It is legal to call Start() from other locations, but the following calling restrictions must be followed or the system behavior will not be deterministic. */
EFI_STATUS EFIAPI IScsiIp4DriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
/* The Start() function is designed to be invoked from the EFI boot service ConnectController(). As a result, much of the error checking on the parameters to Start() has been moved into this common boot service. It is legal to call Start() from other locations, but the following calling restrictions must be followed or the system behavior will not be deterministic. */ EFI_STATUS EFIAPI IScsiIp4DriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
{ EFI_STATUS Status; Status = IScsiStart (This->DriverBindingHandle, ControllerHandle, IP_VERSION_4); if (Status == EFI_ALREADY_STARTED) { Status = EFI_SUCCESS; } return Status; }
tianocore/edk2
C++
Other
4,240
/* Enable the input direction of the specified GPIO. */
int32_t gpio_direction_input(gpio_desc *desc)
/* Enable the input direction of the specified GPIO. */ int32_t gpio_direction_input(gpio_desc *desc)
{ uint16_t pin; uint8_t port; gpio_get_portpin(desc, &pin, &port); return adi_gpio_InputEnable(port, pin, true); }
analogdevicesinc/EVAL-ADICUP3029
C++
Other
36
/* Does a software reset of the PHY by reading the PHY control register and setting/write the control register reset bit to the PHY. */
s32 igb_phy_sw_reset(struct e1000_hw *hw)
/* Does a software reset of the PHY by reading the PHY control register and setting/write the control register reset bit to the PHY. */ s32 igb_phy_sw_reset(struct e1000_hw *hw)
{ s32 ret_val = 0; u16 phy_ctrl; if (!(hw->phy.ops.read_reg)) goto out; ret_val = hw->phy.ops.read_reg(hw, PHY_CONTROL, &phy_ctrl); if (ret_val) goto out; phy_ctrl |= MII_CR_RESET; ret_val = hw->phy.ops.write_reg(hw, PHY_CONTROL, phy_ctrl); if (ret_val) goto out; udelay(1); out: return ret_val; }
robutest/uclinux
C++
GPL-2.0
60
/* Selects the data transfer direction in bi-directional mode for the specified SPI. */
void SPI_ConfigBidirectionalMode(SPI_Module *SPIx, uint16_t DataDirection)
/* Selects the data transfer direction in bi-directional mode for the specified SPI. */ void SPI_ConfigBidirectionalMode(SPI_Module *SPIx, uint16_t DataDirection)
{ assert_param(IS_SPI_PERIPH(SPIx)); assert_param(IS_SPI_BIDIRECTION(DataDirection)); if (DataDirection == SPI_BIDIRECTION_TX) { SPIx->CTRL1 |= SPI_BIDIRECTION_TX; } else { SPIx->CTRL1 &= SPI_BIDIRECTION_RX; } }
pikasTech/PikaPython
C++
MIT License
1,403
/* Disable interrupt according to the bitfield supplied. Disables only those interrupts specified in the bit mask in second argument. */
void synopGMAC_disable_interrupt(synopGMACdevice *gmacdev, u32 interrupts)
/* Disable interrupt according to the bitfield supplied. Disables only those interrupts specified in the bit mask in second argument. */ void synopGMAC_disable_interrupt(synopGMACdevice *gmacdev, u32 interrupts)
{ synopGMACClearBits(gmacdev->DmaBase, DmaInterrupt, interrupts); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set the TIMx's One Pulse Mode (output one pulse PWM mode). */
void RTIM_SetOnePulseOutputMode(RTIM_TypeDef *TIMx, u32 TIM_OPMode, u32 TrigerPolarity)
/* Set the TIMx's One Pulse Mode (output one pulse PWM mode). */ void RTIM_SetOnePulseOutputMode(RTIM_TypeDef *TIMx, u32 TIM_OPMode, u32 TrigerPolarity)
{ assert_param(IS_TIM_ONE_PULSE_TIM(TIMx)); assert_param(IS_TIM_OPM_MODE(TIM_OPMode)); assert_param(IS_TIM_OPM_ETP_MODE(TrigerPolarity)); TIMx->CR &= (u32)~(TIM_CR_OPM | TIM_CR_ETP); TIMx->CR |= TIM_OPMode | TrigerPolarity; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* The FreeBuffer() function frees memory that was allocated with AllocateBuffer(). */
EFI_STATUS EFIAPI RootBridgeIoFreeBuffer(IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, IN UINTN Pages, OUT VOID *HostAddress)
/* The FreeBuffer() function frees memory that was allocated with AllocateBuffer(). */ EFI_STATUS EFIAPI RootBridgeIoFreeBuffer(IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *This, IN UINTN Pages, OUT VOID *HostAddress)
{ EFI_STATUS Status; if (mIoMmu != NULL) { Status = mIoMmu->FreeBuffer ( mIoMmu, Pages, HostAddress ); return Status; } return gBS->FreePages ((EFI_PHYSICAL_ADDRESS)(UINTN)HostAddress, Pages); }
tianocore/edk2
C++
Other
4,240
/* IvSize must be 12, otherwise FALSE is returned. KeySize must be 16, 24 or 32, otherwise FALSE is returned. TagSize must be 12, 13, 14, 15, 16, otherwise FALSE is returned. */
BOOLEAN EFIAPI AeadAesGcmEncrypt(IN CONST UINT8 *Key, IN UINTN KeySize, IN CONST UINT8 *Iv, IN UINTN IvSize, IN CONST UINT8 *AData, IN UINTN ADataSize, IN CONST UINT8 *DataIn, IN UINTN DataInSize, OUT UINT8 *TagOut, IN UINTN TagSize, OUT UINT8 *DataOut, OUT UINTN *DataOutSize)
/* IvSize must be 12, otherwise FALSE is returned. KeySize must be 16, 24 or 32, otherwise FALSE is returned. TagSize must be 12, 13, 14, 15, 16, otherwise FALSE is returned. */ BOOLEAN EFIAPI AeadAesGcmEncrypt(IN CONST UINT8 *Key, IN UINTN KeySize, IN CONST UINT8 *Iv, IN UINTN IvSize, IN CONST UINT8 *AData, IN UINTN ADataSize, IN CONST UINT8 *DataIn, IN UINTN DataInSize, OUT UINT8 *TagOut, IN UINTN TagSize, OUT UINT8 *DataOut, OUT UINTN *DataOutSize)
{ CALL_CRYPTO_SERVICE (AeadAesGcmEncrypt, (Key, KeySize, Iv, IvSize, AData, ADataSize, DataIn, DataInSize, TagOut, TagSize, DataOut, DataOutSize), FALSE); }
tianocore/edk2
C++
Other
4,240
/* Initializes a Media instance and the associated physical interface */
unsigned char MEDSdcard_Initialize(Media *media, unsigned char mciID)
/* Initializes a Media instance and the associated physical interface */ unsigned char MEDSdcard_Initialize(Media *media, unsigned char mciID)
{ TRACE_INFO("MEDSdcard init\n\r"); if ( !SD_CARD_PRESENT( ) ) { return 0; } media->write = MEDSdcard_Write; media->read = MEDSdcard_Read; media->lock = 0; media->unlock = 0; media->handler = 0; media->flush = 0; media->blockSize = BLOCK_SIZE; media->baseAddress = 0; media->size = SD_GET_BLOCKNR(); media->mappedRD = 0; media->mappedWR = 0; media->protected = 0; media->removable = 1; media->state = MED_STATE_READY; media->transfer.data = 0; media->transfer.address = 0; media->transfer.length = 0; media->transfer.callback = 0; media->transfer.argument = 0; return 1; }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* Check to see if the serial timeout timer has run down. */
static int SerialTimeoutCheck(ISP_ENVIRONMENT *IspEnvironment)
/* Check to see if the serial timeout timer has run down. */ static int SerialTimeoutCheck(ISP_ENVIRONMENT *IspEnvironment)
{ if (IspEnvironment->serial_timeout_count == 0) { return 1; } return 0; }
microbuilder/LPC11U_LPC13U_CodeBase
C++
Other
54
/* Set Pending Interrupt. Sets the pending bit of an external interrupt. */
void drv_nvic_set_pending_irq(int32_t IRQn)
/* Set Pending Interrupt. Sets the pending bit of an external interrupt. */ void drv_nvic_set_pending_irq(int32_t IRQn)
{ NVIC->ISPR[0U] = (uint32_t)(1UL << (((uint32_t)(int32_t)IRQn) & 0x1FUL)); }
pikasTech/PikaPython
C++
MIT License
1,403
/* This function runs the PBKDF2 on the data with a given key. To obtain the PSK from the password, PBKDF2 is run on SSID (data) with password (key). */
uint8 pbkdf2_sha1(uint8 *key, uint8 key_len, uint8 *data, uint8 data_len, uint8 *digest)
/* This function runs the PBKDF2 on the data with a given key. To obtain the PSK from the password, PBKDF2 is run on SSID (data) with password (key). */ uint8 pbkdf2_sha1(uint8 *key, uint8 key_len, uint8 *data, uint8 data_len, uint8 *digest)
{ if ((key_len > 64) || (data_len > 32)) return 0; if (pbkdf2_sha1_f(key, key_len, data, data_len, 4096, 1, digest) == 0) { return 0; } return pbkdf2_sha1_f(key, key_len, data, data_len, 4096, 2, &digest[A_SHA_DIGEST_LEN]); }
remotemcu/remcu-chip-sdks
C++
null
436
/* This function only updates known header fields in-place and does not affect extra data after the QED header. */
static void qed_write_header(BDRVQEDState *s, BlockDriverCompletionFunc cb, void *opaque)
/* This function only updates known header fields in-place and does not affect extra data after the QED header. */ static void qed_write_header(BDRVQEDState *s, BlockDriverCompletionFunc cb, void *opaque)
{ int nsectors = (sizeof(QEDHeader) + BDRV_SECTOR_SIZE - 1) / BDRV_SECTOR_SIZE; size_t len = nsectors * BDRV_SECTOR_SIZE; QEDWriteHeaderCB *write_header_cb = gencb_alloc(sizeof(*write_header_cb), cb, opaque); write_header_cb->s = s; write_header_cb->nsectors = nsectors; write_header_cb->buf = qemu_blockalign(s->bs, len); write_header_cb->iov.iov_base = write_header_cb->buf; write_header_cb->iov.iov_len = len; qemu_iovec_init_external(&write_header_cb->qiov, &write_header_cb->iov, 1); bdrv_aio_readv(s->bs->file, 0, &write_header_cb->qiov, nsectors, qed_write_header_read_cb, write_header_cb); }
ve3wwg/teensy3_qemu
C++
Other
15
/* If this fails due to allocation or transmit congestion, assume the originator will repeat the sequence. */
static void fc_seq_ls_acc(struct fc_seq *)
/* If this fails due to allocation or transmit congestion, assume the originator will repeat the sequence. */ static void fc_seq_ls_acc(struct fc_seq *)
{ struct fc_seq *sp; struct fc_els_ls_acc *acc; struct fc_frame *fp; sp = fc_seq_start_next(req_sp); fp = fc_frame_alloc(fc_seq_exch(sp)->lp, sizeof(*acc)); if (fp) { acc = fc_frame_payload_get(fp, sizeof(*acc)); memset(acc, 0, sizeof(*acc)); acc->la_cmd = ELS_LS_ACC; fc_seq_send_last(sp, fp, FC_RCTL_ELS_REP, FC_TYPE_ELS); } }
robutest/uclinux
C++
GPL-2.0
60
/* Returns the last ADC conversion result data in dual mode. */
uint32_t ADC_GetDualModeConversionValue(void)
/* Returns the last ADC conversion result data in dual mode. */ uint32_t ADC_GetDualModeConversionValue(void)
{ return (*(__IO uint32_t *) ADDATA_ADDRESS); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Returns 1 if a card actually exists (i.e. the pos isn't all 0xff) or 0 otherwise */
static int mca_read_and_store_pos(unsigned char *pos)
/* Returns 1 if a card actually exists (i.e. the pos isn't all 0xff) or 0 otherwise */ static int mca_read_and_store_pos(unsigned char *pos)
{ int j; int found = 0; for (j = 0; j < 8; j++) { pos[j] = inb_p(MCA_POS_REG(j)); if (pos[j] != 0xff) { found = 1; } } return found; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Writes the current value of MM0. This function is only available on IA32 and X64. */
VOID EFIAPI AsmWriteMm0(IN UINT64 Value)
/* Writes the current value of MM0. This function is only available on IA32 and X64. */ VOID EFIAPI AsmWriteMm0(IN UINT64 Value)
{ __asm__ __volatile__ ( "movd %0, %%mm0" : : "m" (Value) ); }
tianocore/edk2
C++
Other
4,240
/* Set TP's max receive size. This is the limit that applies when receive coalescing is disabled. */
void t3_tp_set_max_rxsize(struct adapter *adap, unsigned int size)
/* Set TP's max receive size. This is the limit that applies when receive coalescing is disabled. */ void t3_tp_set_max_rxsize(struct adapter *adap, unsigned int size)
{ t3_write_reg(adap, A_TP_PARA_REG7, V_PMMAXXFERLEN0(size) | V_PMMAXXFERLEN1(size)); }
robutest/uclinux
C++
GPL-2.0
60
/* ppc440spe_desc_get_link - get the address of the descriptor that follows this one */
static u32 ppc440spe_desc_get_link(struct ppc440spe_adma_desc_slot *desc, struct ppc440spe_adma_chan *chan)
/* ppc440spe_desc_get_link - get the address of the descriptor that follows this one */ static u32 ppc440spe_desc_get_link(struct ppc440spe_adma_desc_slot *desc, struct ppc440spe_adma_chan *chan)
{ if (!desc->hw_next) return 0; return desc->hw_next->phys; }
robutest/uclinux
C++
GPL-2.0
60
/* Use @work to get the device object the work is to be done for, determine what is to be done and execute the appropriate run-time PM function. */
static void pm_runtime_work(struct work_struct *work)
/* Use @work to get the device object the work is to be done for, determine what is to be done and execute the appropriate run-time PM function. */ static void pm_runtime_work(struct work_struct *work)
{ struct device *dev = container_of(work, struct device, power.work); enum rpm_request req; spin_lock_irq(&dev->power.lock); if (!dev->power.request_pending) goto out; req = dev->power.request; dev->power.request = RPM_REQ_NONE; dev->power.request_pending = false; switch (req) { case RPM_REQ_NONE: break; case RPM_REQ_IDLE: __pm_runtime_idle(dev); break; case RPM_REQ_SUSPEND: __pm_runtime_suspend(dev, true); break; case RPM_REQ_RESUME: __pm_runtime_resume(dev, true); break; } out: spin_unlock_irq(&dev->power.lock); }
robutest/uclinux
C++
GPL-2.0
60
/* check ISR wrapper: Allow to determine interrupt source per line . */
uint32_t SYSCFG_GetPendingIT(uint32_t ITSourceLine)
/* check ISR wrapper: Allow to determine interrupt source per line . */ uint32_t SYSCFG_GetPendingIT(uint32_t ITSourceLine)
{ assert_param(IS_SYSCFG_ITLINE(ITSourceLine)); return (SYSCFG->IT_LINE_SR[(ITSourceLine >> 0x18)] & (ITSourceLine & 0x00FFFFFF)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param base Pointer to the FLEXIO_SPI_Type structure. param mask interrupt source The parameter can be any combination of the following values: arg kFLEXIO_SPI_RxFullInterruptEnable arg kFLEXIO_SPI_TxEmptyInterruptEnable */
void FLEXIO_SPI_DisableInterrupts(FLEXIO_SPI_Type *base, uint32_t mask)
/* param base Pointer to the FLEXIO_SPI_Type structure. param mask interrupt source The parameter can be any combination of the following values: arg kFLEXIO_SPI_RxFullInterruptEnable arg kFLEXIO_SPI_TxEmptyInterruptEnable */ void FLEXIO_SPI_DisableInterrupts(FLEXIO_SPI_Type *base, uint32_t mask)
{ if (mask & kFLEXIO_SPI_TxEmptyInterruptEnable) { FLEXIO_DisableShifterStatusInterrupts(base->flexioBase, 1 << base->shifterIndex[0]); } if (mask & kFLEXIO_SPI_RxFullInterruptEnable) { FLEXIO_DisableShifterStatusInterrupts(base->flexioBase, 1 << base->shifterIndex[1]); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Allocate buffer for ACL Data Package and fill in Header. */
static struct net_buf* acl_data_create(struct bt_hci_acl_hdr *le_hdr)
/* Allocate buffer for ACL Data Package and fill in Header. */ static struct net_buf* acl_data_create(struct bt_hci_acl_hdr *le_hdr)
{ struct net_buf *buf; struct bt_hci_acl_hdr *hdr; buf = bt_buf_get_tx(BT_BUF_ACL_OUT, K_FOREVER, NULL, 0); __ASSERT_NO_MSG(buf); hdr = net_buf_add(buf, sizeof(*hdr)); *hdr = *le_hdr; return buf; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* This API configure the settings of auxiliary sensor. */
static int8_t config_aux_settg(const struct bmi160_dev *dev)
/* This API configure the settings of auxiliary sensor. */ static int8_t config_aux_settg(const struct bmi160_dev *dev)
{ int8_t rslt; rslt = config_sec_if(dev); if (rslt == BMI160_OK) { rslt = bmi160_config_aux_mode(dev); } return rslt; }
eclipse-threadx/getting-started
C++
Other
310
/* Build a parallel protocol request message in our message buffer based on the input parameters. */
static void ahd_construct_ppr(struct ahd_softc *ahd, struct ahd_devinfo *devinfo, u_int period, u_int offset, u_int bus_width, u_int ppr_options)
/* Build a parallel protocol request message in our message buffer based on the input parameters. */ static void ahd_construct_ppr(struct ahd_softc *ahd, struct ahd_devinfo *devinfo, u_int period, u_int offset, u_int bus_width, u_int ppr_options)
{ if (period <= AHD_SYNCRATE_PACED) ppr_options |= MSG_EXT_PPR_PCOMP_EN; if (offset == 0) period = AHD_ASYNC_XFER_PERIOD; ahd->msgout_index += spi_populate_ppr_msg( ahd->msgout_buf + ahd->msgout_index, period, offset, bus_width, ppr_options); ahd->msgout_len += 8; if (bootverbose) { printf("(%s:%c:%d:%d): Sending PPR bus_width %x, period %x, " "offset %x, ppr_options %x\n", ahd_name(ahd), devinfo->channel, devinfo->target, devinfo->lun, bus_width, period, offset, ppr_options); } }
robutest/uclinux
C++
GPL-2.0
60
/* Writes and the current GDTR descriptor specified by Gdtr. This function is only available on IA-32 and X64. */
VOID EFIAPI InternalX86WriteGdtr(IN CONST IA32_DESCRIPTOR *Gdtr)
/* Writes and the current GDTR descriptor specified by Gdtr. This function is only available on IA-32 and X64. */ VOID EFIAPI InternalX86WriteGdtr(IN CONST IA32_DESCRIPTOR *Gdtr)
{ __asm__ __volatile__ ( "lgdt %0" : : "m" (*Gdtr) ); }
tianocore/edk2
C++
Other
4,240
/* Slot 0 isn't actually populated with a card connector but we initialize it anyway in case a future version has the slot populated or someone with good soldering skills has some free time. */
void __init gtwx5715_pci_preinit(void)
/* Slot 0 isn't actually populated with a card connector but we initialize it anyway in case a future version has the slot populated or someone with good soldering skills has some free time. */ void __init gtwx5715_pci_preinit(void)
{ set_irq_type(IXP4XX_GPIO_IRQ(INTA), IRQ_TYPE_LEVEL_LOW); set_irq_type(IXP4XX_GPIO_IRQ(INTB), IRQ_TYPE_LEVEL_LOW); ixp4xx_pci_preinit(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Locking Note: The rport lock is expected to be held before calling this routine. */
static void fc_rport_enter_logo(struct fc_rport_priv *)
/* Locking Note: The rport lock is expected to be held before calling this routine. */ static void fc_rport_enter_logo(struct fc_rport_priv *)
{ struct fc_lport *lport = rdata->local_port; struct fc_frame *fp; FC_RPORT_DBG(rdata, "Port entered LOGO state from %s state\n", fc_rport_state(rdata)); fc_rport_state_enter(rdata, RPORT_ST_LOGO); fp = fc_frame_alloc(lport, sizeof(struct fc_els_logo)); if (!fp) { fc_rport_error_retry(rdata, fp); return; } if (!lport->tt.elsct_send(lport, rdata->ids.port_id, fp, ELS_LOGO, fc_rport_logo_resp, rdata, 2 * lport->r_a_tov)) fc_rport_error_retry(rdata, NULL); else kref_get(&rdata->kref); }
robutest/uclinux
C++
GPL-2.0
60
/* USART IRQ Handler, handling RXBUFF and TXBUFE status. */
void USART_Handler(void)
/* USART IRQ Handler, handling RXBUFF and TXBUFE status. */ void USART_Handler(void)
{ uint32_t ul_status; ul_status = usart_get_status(BOARD_USART); if ((ul_status & US_CSR_RXBUFF) && (g_uc_state == STATE_RECEIVE)) { g_ul_recv_done = true; usart_disable_interrupt(BOARD_USART, US_IDR_RXBUFF); } if ((ul_status & US_CSR_TXBUFE) && (g_uc_state == STATE_TRANSMIT)) { g_ul_sent_done = true; usart_disable_interrupt(BOARD_USART, US_IDR_TXBUFE); } }
remotemcu/remcu-chip-sdks
C++
null
436
/* Returns 0 on success; -ve on an error. */
int uwb_rc_ie_setup(struct uwb_rc *uwb_rc)
/* Returns 0 on success; -ve on an error. */ int uwb_rc_ie_setup(struct uwb_rc *uwb_rc)
{ struct uwb_rc_evt_get_ie *ie_info = NULL; int capacity; capacity = uwb_rc_get_ie(uwb_rc, &ie_info); if (capacity < 0) return capacity; mutex_lock(&uwb_rc->ies_mutex); uwb_rc->ies = (struct uwb_rc_cmd_set_ie *)ie_info; uwb_rc->ies->rccb.bCommandType = UWB_RC_CET_GENERAL; uwb_rc->ies->rccb.wCommand = cpu_to_le16(UWB_RC_CMD_SET_IE); uwb_rc->ies_capacity = capacity; mutex_unlock(&uwb_rc->ies_mutex); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Activate DMA ping-pong cycle (used for memory-peripheral transfers). Prior to activating the DMA cycle, the channel and both descriptors must have been properly configured. The primary descriptor is always the first descriptor to be used by the DMA controller. */
void DMA_ActivatePingPong(unsigned int channel, bool useBurst, void *primDst, void *primSrc, unsigned int primNMinus1, void *altDst, void *altSrc, unsigned int altNMinus1)
/* Activate DMA ping-pong cycle (used for memory-peripheral transfers). Prior to activating the DMA cycle, the channel and both descriptors must have been properly configured. The primary descriptor is always the first descriptor to be used by the DMA controller. */ void DMA_ActivatePingPong(unsigned int channel, bool useBurst, void *primDst, void *primSrc, unsigned int primNMinus1, void *altDst, void *altSrc, unsigned int altNMinus1)
{ EFM_ASSERT(channel < DMA_CHAN_COUNT); EFM_ASSERT(primNMinus1 <= (_DMA_CTRL_N_MINUS_1_MASK >> _DMA_CTRL_N_MINUS_1_SHIFT)); EFM_ASSERT(altNMinus1 <= (_DMA_CTRL_N_MINUS_1_MASK >> _DMA_CTRL_N_MINUS_1_SHIFT)); DMA_Prepare(channel, dmaCycleCtrlPingPong, false, useBurst, altDst, altSrc, altNMinus1); DMA_Prepare(channel, dmaCycleCtrlPingPong, true, useBurst, primDst, primSrc, primNMinus1); DMA->CHENS = 1 << channel; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* PCD MSP Initialization This function configures the hardware resources used in this example. */
void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
/* PCD MSP Initialization This function configures the hardware resources used in this example. */ void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; if(hpcd->Instance==USB_OTG_FS) { __HAL_RCC_GPIOA_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_11|GPIO_PIN_12; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = GPIO_AF10_OTG_FS; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); __HAL_RCC_USB_OTG_FS_CLK_ENABLE(); } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Send SEND_CSD command to get CSD register content from Card. */
static status_t SD_SendCsd(sd_card_t *card)
/* Send SEND_CSD command to get CSD register content from Card. */ static status_t SD_SendCsd(sd_card_t *card)
{ assert(card); SDMMCHOST_TRANSFER content = {0}; SDMMCHOST_COMMAND command = {0}; status_t error = kStatus_Success; command.index = kSDMMC_SendCsd; command.argument = (card->relativeAddress << 16U); command.responseType = kCARD_ResponseTypeR2; content.command = &command; content.data = NULL; error = card->host.transfer(card->host.base, &content); if (kStatus_Success == error) { memcpy(card->rawCsd, command.response, sizeof(card->rawCsd)); SD_DecodeCsd(card, command.response); } else { error = kStatus_SDMMC_TransferFailed; SDMMC_LOG("\r\nError: send CMD9(get csd) failed with host error %d, response %x", error, command.response[0U]); } return error; }
nanoframework/nf-interpreter
C++
MIT License
293
/* At IO completion time the cums attached on the ordered extent record are inserted into the btree */
static int __btrfs_submit_bio_done(struct inode *inode, int rw, struct bio *bio, int mirror_num, unsigned long bio_flags)
/* At IO completion time the cums attached on the ordered extent record are inserted into the btree */ static int __btrfs_submit_bio_done(struct inode *inode, int rw, struct bio *bio, int mirror_num, unsigned long bio_flags)
{ struct btrfs_root *root = BTRFS_I(inode)->root; return btrfs_map_bio(root, rw, bio, mirror_num, 1); }
robutest/uclinux
C++
GPL-2.0
60
/* Initialize the ACC module. Where the input parameter */
void acc_init(Acc *p_acc, uint32_t ul_select_plus, uint32_t ul_select_minus, uint32_t ul_edge_type, uint32_t ul_invert)
/* Initialize the ACC module. Where the input parameter */ void acc_init(Acc *p_acc, uint32_t ul_select_plus, uint32_t ul_select_minus, uint32_t ul_edge_type, uint32_t ul_invert)
{ Assert(p_acc); p_acc->ACC_CR |= ACC_CR_SWRST; p_acc->ACC_MR = (((ul_select_plus) & ACC_MR_SELPLUS_Msk) | ((ul_select_minus) & ACC_MR_SELMINUS_Msk) | ((ul_edge_type) & ACC_MR_EDGETYP_Msk) | ((ul_invert) & ACC_MR_INV)) | ACC_MR_ACEN_EN; p_acc->ACC_ACR = (ACC_ACR_ISEL_HISP | ACC_ACR_HYST(ACC_ACR_HYST_50mv_max)); while (p_acc->ACC_ISR & (uint32_t) ACC_ISR_MASK); }
remotemcu/remcu-chip-sdks
C++
null
436
/* simple conversion of two-digit string with error checking */
static int cnvrt2(char *str, int *valp)
/* simple conversion of two-digit string with error checking */ static int cnvrt2(char *str, int *valp)
{ int val; if ((*str < '0') || (*str > '9')) return (-1); val = *str - '0'; ++str; if ((*str < '0') || (*str > '9')) return (-1); *valp = 10 * val + (*str - '0'); return (0); }
EmcraftSystems/u-boot
C++
Other
181
/* Fill in a next available MPU protection region with a specified mapping. If needed, this swaps out an existing mapping using a simple round-robin algorithm, which affects only MPU regions that have the priority above the barrier (i.e. all regions below barrier are locked). */
static void mpu_page_map(struct mm_struct *mm, unsigned long a, unsigned int s, unsigned int sz, unsigned int acs, unsigned int srd, unsigned int xn)
/* Fill in a next available MPU protection region with a specified mapping. If needed, this swaps out an existing mapping using a simple round-robin algorithm, which affects only MPU regions that have the priority above the barrier (i.e. all regions below barrier are locked). */ static void mpu_page_map(struct mm_struct *mm, unsigned long a, unsigned int s, unsigned int sz, unsigned int acs, unsigned int srd, unsigned int xn)
{ mpu_context_t *p = mpu_context_p(mm); unsigned int i = p->indx; unsigned int b = a & ~(s - 1); unsigned int t = 0x1 | sz<<1 | acs<<24 | srd<<8 | xn<<28; p->mpu_regs[i].base = b; p->mpu_regs[i].attr = t; mpu_region_write(i, b, t); p->indx = i == 7 ? p->barrier : i + 1; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Lets see what else we need to do here. Set up sp, gp? */
void nmi_dump(void)
/* Lets see what else we need to do here. Set up sp, gp? */ void nmi_dump(void)
{ void cont_nmi_dump(void); cont_nmi_dump(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return @port's bonding struct, or NULL if it can't be found. */
static struct bonding* __get_bond_by_port(struct port *port)
/* Return @port's bonding struct, or NULL if it can't be found. */ static struct bonding* __get_bond_by_port(struct port *port)
{ if (port->slave == NULL) { return NULL; } return bond_get_bond_by_slave(port->slave); }
robutest/uclinux
C++
GPL-2.0
60
/* Waits actively until the FLASHCALW is ready to run a new command. This is the default function assigned to */
void flashcalw_default_wait_until_ready(void)
/* Waits actively until the FLASHCALW is ready to run a new command. This is the default function assigned to */ void flashcalw_default_wait_until_ready(void)
{ while (!flashcalw_is_ready()) { } }
remotemcu/remcu-chip-sdks
C++
null
436
/* param base LPSPI peripheral address. param handle pointer to lpspi_master_handle_t structure which stores the transfer state. param count Number of bytes transferred so far by the non-blocking transaction. return status of status_t. */
status_t LPSPI_MasterTransferGetCount(LPSPI_Type *base, lpspi_master_handle_t *handle, size_t *count)
/* param base LPSPI peripheral address. param handle pointer to lpspi_master_handle_t structure which stores the transfer state. param count Number of bytes transferred so far by the non-blocking transaction. return status of status_t. */ status_t LPSPI_MasterTransferGetCount(LPSPI_Type *base, lpspi_master_handle_t *handle, size_t *count)
{ assert(handle); if (!count) { return kStatus_InvalidArgument; } if (handle->state != kLPSPI_Busy) { *count = 0; return kStatus_NoTransferInProgress; } size_t remainingByte; if (handle->rxData) { remainingByte = handle->rxRemainingByteCount; } else { remainingByte = handle->txRemainingByteCount; } *count = handle->totalByteCount - remainingByte; return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Add the locked dquot to the transaction. The dquot must be locked, and it cannot be associated with any transaction. */
void xfs_trans_dqjoin(xfs_trans_t *tp, xfs_dquot_t *dqp)
/* Add the locked dquot to the transaction. The dquot must be locked, and it cannot be associated with any transaction. */ void xfs_trans_dqjoin(xfs_trans_t *tp, xfs_dquot_t *dqp)
{ xfs_dq_logitem_t *lp; ASSERT(! XFS_DQ_IS_ADDEDTO_TRX(tp, dqp)); ASSERT(XFS_DQ_IS_LOCKED(dqp)); ASSERT(XFS_DQ_IS_LOGITEM_INITD(dqp)); lp = &dqp->q_logitem; (void) xfs_trans_add_item(tp, (xfs_log_item_t*)(lp)); dqp->q_transp = tp; }
robutest/uclinux
C++
GPL-2.0
60
/* Return Value: TRUE if short preamble; otherwise FALSE */
BOOL CARDbIsShortPreamble(PVOID pDeviceHandler)
/* Return Value: TRUE if short preamble; otherwise FALSE */ BOOL CARDbIsShortPreamble(PVOID pDeviceHandler)
{ PSDevice pDevice = (PSDevice) pDeviceHandler; if (pDevice->byPreambleType == 0) { return(FALSE); } return(TRUE); }
robutest/uclinux
C++
GPL-2.0
60
/* Set gate source for an '8254' counter subdevice channel. */
static int dio200_set_gate_src(struct dio200_subdev_8254 *subpriv, unsigned int counter_number, unsigned int gate_src)
/* Set gate source for an '8254' counter subdevice channel. */ static int dio200_set_gate_src(struct dio200_subdev_8254 *subpriv, unsigned int counter_number, unsigned int gate_src)
{ unsigned char byte; if (!subpriv->has_clk_gat_sce) return -1; if (counter_number > 2) return -1; if (gate_src > 7) return -1; subpriv->gate_src[counter_number] = gate_src; byte = GAT_SCE(subpriv->which, counter_number, gate_src); outb(byte, subpriv->gat_sce_iobase); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* After this function has been called the DAPM pins specified in the pins array will have their status updated to reflect the current state of the jack whenever the jack status is updated. */
int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count, struct snd_soc_jack_pin *pins)
/* After this function has been called the DAPM pins specified in the pins array will have their status updated to reflect the current state of the jack whenever the jack status is updated. */ int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count, struct snd_soc_jack_pin *pins)
{ int i; for (i = 0; i < count; i++) { if (!pins[i].pin) { printk(KERN_ERR "No name for pin %d\n", i); return -EINVAL; } if (!pins[i].mask) { printk(KERN_ERR "No mask for pin %d (%s)\n", i, pins[i].pin); return -EINVAL; } INIT_LIST_HEAD(&pins[i].list); list_add(&(pins[i].list), &jack->pins); } snd_soc_jack_report(jack, 0, 0); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Find out if PHY is in copper or serdes mode by looking at Expansion Reg 0x42 - "Operating Mode Status Register" */
static int BCM8482_is_serdes(struct tsec_private *priv)
/* Find out if PHY is in copper or serdes mode by looking at Expansion Reg 0x42 - "Operating Mode Status Register" */ static int BCM8482_is_serdes(struct tsec_private *priv)
{ u16 val; int serdes = 0; write_phy_reg(priv, MIIM_BCM54XX_EXP_SEL, MIIM_BCM54XX_EXP_SEL_ER | 0x42); val = read_phy_reg(priv, MIIM_BCM54XX_EXP_DATA); switch (val & 0x1f) { case 0x0d: case 0x0e: case 0x0f: case 0x12: case 0x13: case 0x16: serdes = 1; break; case 0x6: case 0x14: case 0x17: break; default: printf("ERROR, invalid PHY mode (0x%x\n)", val); break; } return serdes; }
EmcraftSystems/u-boot
C++
Other
181
/* Opens an endpoint of the Low Level Driver. */
USBD_StatusTypeDef USBD_LL_OpenEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr, uint8_t ep_type, uint16_t ep_mps)
/* Opens an endpoint of the Low Level Driver. */ USBD_StatusTypeDef USBD_LL_OpenEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr, uint8_t ep_type, uint16_t ep_mps)
{ HAL_PCD_EP_Open(pdev->pData, ep_addr, ep_mps, ep_type); return USBD_OK; }
STMicroelectronics/STM32CubeF4
C++
Other
789
/* Allocate new memory and then copy the Unicode string Source to Destination. */
VOID NewStringCpy(IN OUT CHAR16 **Dest, IN CHAR16 *Src)
/* Allocate new memory and then copy the Unicode string Source to Destination. */ VOID NewStringCpy(IN OUT CHAR16 **Dest, IN CHAR16 *Src)
{ if (*Dest != NULL) { FreePool (*Dest); } *Dest = AllocateCopyPool (StrSize (Src), Src); ASSERT (*Dest != NULL); }
tianocore/edk2
C++
Other
4,240
/* Function to create the next report to send back to the host at the next reporting interval. */
void CreateGenericHIDReport(uint8_t *DataArray)
/* Function to create the next report to send back to the host at the next reporting interval. */ void CreateGenericHIDReport(uint8_t *DataArray)
{ uint8_t CurrLEDMask = LEDs_GetLEDs(); DataArray[0] = ((CurrLEDMask & LEDS_LED1) ? 1 : 0); DataArray[1] = ((CurrLEDMask & LEDS_LED2) ? 1 : 0); DataArray[2] = ((CurrLEDMask & LEDS_LED3) ? 1 : 0); DataArray[3] = ((CurrLEDMask & LEDS_LED4) ? 1 : 0); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* param base pointer to FLEXIO_MCULCD_Type structure. param handle FlexIO MCULCD eDMA handle pointer. param count Number of count transferred so far by the eDMA transaction. retval kStatus_Success Get the transferred count Successfully. retval kStatus_NoTransferInProgress No transfer in process. */
status_t FLEXIO_MCULCD_TransferGetCountEDMA(FLEXIO_MCULCD_Type *base, flexio_mculcd_edma_handle_t *handle, size_t *count)
/* param base pointer to FLEXIO_MCULCD_Type structure. param handle FlexIO MCULCD eDMA handle pointer. param count Number of count transferred so far by the eDMA transaction. retval kStatus_Success Get the transferred count Successfully. retval kStatus_NoTransferInProgress No transfer in process. */ status_t FLEXIO_MCULCD_TransferGetCountEDMA(FLEXIO_MCULCD_Type *base, flexio_mculcd_edma_handle_t *handle, size_t *count)
{ assert(NULL != handle); assert(NULL != count); uint32_t state = handle->state; if ((uint32_t)kFLEXIO_MCULCD_StateIdle == state) { return kStatus_NoTransferInProgress; } else { *count = handle->dataCount - handle->remainingCount; if ((uint32_t)kFLEXIO_MCULCD_StateReadArray == state) { *count -= handle->minorLoopBytes * EDMA_GetRemainingMajorLoopCount(handle->rxDmaHandle->base, handle->rxDmaHandle->channel); } else { *count -= handle->minorLoopBytes * EDMA_GetRemainingMajorLoopCount(handle->txDmaHandle->base, handle->txDmaHandle->channel); } } return kStatus_Success; }
eclipse-threadx/getting-started
C++
Other
310
/* Deserializes the supplied (wire) buffer into suback data */
int MQTTDeserialize_suback(unsigned short *packetid, int maxcount, int *count, int grantedQoSs[], unsigned char *buf, int buflen)
/* Deserializes the supplied (wire) buffer into suback data */ int MQTTDeserialize_suback(unsigned short *packetid, int maxcount, int *count, int grantedQoSs[], unsigned char *buf, int buflen)
{ MQTTHeader header = {0}; unsigned char* curdata = buf; unsigned char* enddata = NULL; int rc = 0; int mylen; FUNC_ENTRY; header.byte = readChar(&curdata); if (header.bits.type != SUBACK) goto exit; curdata += (rc = MQTTPacket_decodeBuf(curdata, &mylen)); enddata = curdata + mylen; if (enddata - curdata < 2) goto exit; *packetid = readInt(&curdata); *count = 0; while (curdata < enddata) { if (*count > maxcount) { rc = -1; goto exit; } grantedQoSs[(*count)++] = readChar(&curdata); } rc = 1; exit: FUNC_EXIT_RC(rc); return rc; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Gets a data element from the SPI interface. */
void SPIDataRead(unsigned long ulBase, void *pulRData, unsigned long ulLen)
/* Gets a data element from the SPI interface. */ void SPIDataRead(unsigned long ulBase, void *pulRData, unsigned long ulLen)
{ unsigned long i; unsigned char ucBitLength = SPIBitLengthGet(ulBase); xASSERT((ulBase == SPI0_BASE) || (ulBase == SPI1_BASE)|| (ulBase == SPI2_BASE) ); for (i=0; i<ulLen; i++) { if (ucBitLength <= 8) { ((unsigned char*)pulRData)[i] = SPISingleDataReadWrite(ulBase, 0xFF); } else if (ucBitLength >= 8 && ucBitLength <= 16) { ((unsigned short*)pulRData)[i] = SPISingleDataReadWrite(ulBase, 0xFFFF); } else { ((unsigned long*)pulRData)[i] = SPISingleDataReadWrite(ulBase, 0xFFFFFF); } } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Get detailed information on the requested logical processor. */
EFI_STATUS MpServicesUnitTestGetProcessorInfo(IN MP_SERVICES MpServices, IN UINTN ProcessorNumber, OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer)
/* Get detailed information on the requested logical processor. */ EFI_STATUS MpServicesUnitTestGetProcessorInfo(IN MP_SERVICES MpServices, IN UINTN ProcessorNumber, OUT EFI_PROCESSOR_INFORMATION *ProcessorInfoBuffer)
{ return MpServices.Protocol->GetProcessorInfo (MpServices.Protocol, ProcessorNumber, ProcessorInfoBuffer); }
tianocore/edk2
C++
Other
4,240
/* s1 is either a simple 'name', or a 'name=value' pair. s2 is a 'name=value' pair. If the names match, return the value of s2, else NULL. */
static char * envmatch(char *s1, char *s2)
/* s1 is either a simple 'name', or a 'name=value' pair. s2 is a 'name=value' pair. If the names match, return the value of s2, else NULL. */ static char * envmatch(char *s1, char *s2)
{ while (*s1 == *s2++) if (*s1++ == '=') return s2; if (*s1 == '\0' && *(s2 - 1) == '=') return s2; return NULL; }
EmcraftSystems/u-boot
C++
Other
181
/* This is a stub for the status callback. The stub is here in case the upper layers forget to set the handler. */
static void StubStatusHandler(void *CallBackRef, u32 StatusEvent, unsigned ByteCount)
/* This is a stub for the status callback. The stub is here in case the upper layers forget to set the handler. */ static void StubStatusHandler(void *CallBackRef, u32 StatusEvent, unsigned ByteCount)
{ (void) CallBackRef; (void) StatusEvent; (void) ByteCount; Xil_AssertVoidAlways(); }
ua1arn/hftrx
C++
null
69
/* This function returns the TLS/SSL client random data currently used in the specified TLS connection. */
VOID EFIAPI TlsGetClientRandom(IN VOID *Tls, IN OUT UINT8 *ClientRandom)
/* This function returns the TLS/SSL client random data currently used in the specified TLS connection. */ VOID EFIAPI TlsGetClientRandom(IN VOID *Tls, IN OUT UINT8 *ClientRandom)
{ TLS_CONNECTION *TlsConn; TlsConn = (TLS_CONNECTION *)Tls; if ((TlsConn == NULL) || (TlsConn->Ssl == NULL) || (ClientRandom == NULL)) { return; } SSL_get_client_random (TlsConn->Ssl, ClientRandom, SSL3_RANDOM_SIZE); }
tianocore/edk2
C++
Other
4,240
/* Stops each SGE queue set's timer call back */
void t3_stop_sge_timers(struct adapter *adap)
/* Stops each SGE queue set's timer call back */ void t3_stop_sge_timers(struct adapter *adap)
{ int i; for (i = 0; i < SGE_QSETS; ++i) { struct sge_qset *q = &adap->sge.qs[i]; if (q->tx_reclaim_timer.function) del_timer_sync(&q->tx_reclaim_timer); if (q->rx_reclaim_timer.function) del_timer_sync(&q->rx_reclaim_timer); } }
robutest/uclinux
C++
GPL-2.0
60
/* param base RDC peripheral base address. param config Pointer to the structure to get the configuration. */
void RDC_GetHardwareConfig(RDC_Type *base, rdc_hardware_config_t *config)
/* param base RDC peripheral base address. param config Pointer to the structure to get the configuration. */ void RDC_GetHardwareConfig(RDC_Type *base, rdc_hardware_config_t *config)
{ assert(NULL != config); rdc_vir_reg_t vir; vir._u32 = base->VIR; *config = vir._vir; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Sets the content of the 'dbx' variable based on 'dbxDefault' variable content. */
EFI_STATUS EFIAPI EnrollDbxFromDefault(VOID)
/* Sets the content of the 'dbx' variable based on 'dbxDefault' variable content. */ EFI_STATUS EFIAPI EnrollDbxFromDefault(VOID)
{ EFI_STATUS Status; Status = EnrollFromDefault ( EFI_IMAGE_SECURITY_DATABASE1, EFI_DBX_DEFAULT_VARIABLE_NAME, &gEfiImageSecurityDatabaseGuid ); return Status; }
tianocore/edk2
C++
Other
4,240
/* Output a character in polled mode. Writes data to tx register. Waits for space if transmitter is full. */
static void uart_liteuart_poll_out(const struct device *dev, unsigned char c)
/* Output a character in polled mode. Writes data to tx register. Waits for space if transmitter is full. */ static void uart_liteuart_poll_out(const struct device *dev, unsigned char c)
{ while (litex_read8(UART_TXFULL_ADDR)) { } litex_write8(c, UART_RXTX_ADDR); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* pm8001_alloc_task - allocate a task structure for TMF */
static struct sas_task* pm8001_alloc_task(void)
/* pm8001_alloc_task - allocate a task structure for TMF */ static struct sas_task* pm8001_alloc_task(void)
{ struct sas_task *task = kzalloc(sizeof(*task), GFP_KERNEL); if (task) { INIT_LIST_HEAD(&task->list); spin_lock_init(&task->task_state_lock); task->task_state_flags = SAS_TASK_STATE_PENDING; init_timer(&task->timer); init_completion(&task->completion); } return task; }
robutest/uclinux
C++
GPL-2.0
60
/* Output a character in polled mode. Writes data to tx register if transmitter is not full. */
static void uart_sifive_poll_out(const struct device *dev, unsigned char c)
/* Output a character in polled mode. Writes data to tx register if transmitter is not full. */ static void uart_sifive_poll_out(const struct device *dev, unsigned char c)
{ volatile struct uart_sifive_regs_t *uart = DEV_UART(dev); while (uart->tx & TXDATA_FULL) { } uart->tx = (int)c; }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* RETURNS: 1 if attached SCSI device exists, 0 otherwise. */
int ata_scsi_offline_dev(struct ata_device *dev)
/* RETURNS: 1 if attached SCSI device exists, 0 otherwise. */ int ata_scsi_offline_dev(struct ata_device *dev)
{ if (dev->sdev) { scsi_device_set_state(dev->sdev, SDEV_OFFLINE); return 1; } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Resets a PHY block and optionally waits for the reset to complete. @mmd should be 0 for 10/100/1000 PHYs and the device address to reset for 10G PHYs. */
int t3_phy_reset(struct cphy *phy, int mmd, int wait)
/* Resets a PHY block and optionally waits for the reset to complete. @mmd should be 0 for 10/100/1000 PHYs and the device address to reset for 10G PHYs. */ int t3_phy_reset(struct cphy *phy, int mmd, int wait)
{ int err; unsigned int ctl; err = t3_mdio_change_bits(phy, mmd, MDIO_CTRL1, MDIO_CTRL1_LPOWER, MDIO_CTRL1_RESET); if (err || !wait) return err; do { err = t3_mdio_read(phy, mmd, MDIO_CTRL1, &ctl); if (err) return err; ctl &= MDIO_CTRL1_RESET; if (ctl) msleep(1); } while (ctl && --wait); return ctl ? -1 : 0; }
robutest/uclinux
C++
GPL-2.0
60
/* UART Wait for Transmit Data Buffer Not Full. Blocks until the transmit data FIFO is not empty and can accept the next data word. */
void uart_wait_send_ready(uint32_t uart)
/* UART Wait for Transmit Data Buffer Not Full. Blocks until the transmit data FIFO is not empty and can accept the next data word. */ void uart_wait_send_ready(uint32_t uart)
{ while (UART_FR(uart) & UART_FR_TXFF); }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Clear the Wakeup Flag. This is set when the processor receives a wakeup signal. */
void pwr_clear_wakeup_flag(void)
/* Clear the Wakeup Flag. This is set when the processor receives a wakeup signal. */ void pwr_clear_wakeup_flag(void)
{ PWR_CR |= PWR_CR_CWUF; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */
void Vector33_handler(void)
/* ISR handler for a specific vector index in the interrupt vector table for linking the actual interrupts vectors to the one in the user program's vector table. */ void Vector33_handler(void)
{ asm { LDX(VCT_USER_PROGRAM_VECTOR_TABLE_STARTADDR + (33 * 2)) JMP 0,X } }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Store this function in the HCD's struct pci_driver as remove(). */
void usb_hcd_pci_remove(struct pci_dev *dev)
/* Store this function in the HCD's struct pci_driver as remove(). */ void usb_hcd_pci_remove(struct pci_dev *dev)
{ struct usb_hcd *hcd; hcd = pci_get_drvdata(dev); if (!hcd) return; usb_remove_hcd(hcd); if (hcd->driver->flags & HCD_MEMORY) { iounmap(hcd->regs); release_mem_region(hcd->rsrc_start, hcd->rsrc_len); } else { release_region(hcd->rsrc_start, hcd->rsrc_len); } usb_put_hcd(hcd); pci_disable_device(dev); }
robutest/uclinux
C++
GPL-2.0
60
/* Writes the current value of MM5. This function is only available on IA32 and x64. */
VOID EFIAPI AsmWriteMm5(IN UINT64 Value)
/* Writes the current value of MM5. This function is only available on IA32 and x64. */ VOID EFIAPI AsmWriteMm5(IN UINT64 Value)
{ _asm { movq mm5, qword ptr [Value] emms } }
tianocore/edk2
C++
Other
4,240
/* Adjust the congestion window, and wake up the next task that has been sleeping due to congestion */
static void __xprt_put_cong(struct rpc_xprt *xprt, struct rpc_rqst *req)
/* Adjust the congestion window, and wake up the next task that has been sleeping due to congestion */ static void __xprt_put_cong(struct rpc_xprt *xprt, struct rpc_rqst *req)
{ if (!req->rq_cong) return; req->rq_cong = 0; xprt->cong -= RPC_CWNDSCALE; __xprt_lock_write_next_cong(xprt); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Routine to get the next Handle, when you are searching for register protocol notifies. */
IHANDLE* SmmGetNextLocateByRegisterNotify(IN OUT LOCATE_POSITION *Position, OUT VOID **Interface)
/* Routine to get the next Handle, when you are searching for register protocol notifies. */ IHANDLE* SmmGetNextLocateByRegisterNotify(IN OUT LOCATE_POSITION *Position, OUT VOID **Interface)
{ IHANDLE *Handle; PROTOCOL_NOTIFY *ProtNotify; PROTOCOL_INTERFACE *Prot; LIST_ENTRY *Link; Handle = NULL; *Interface = NULL; ProtNotify = Position->SearchKey; if (ProtNotify != NULL) { ASSERT (ProtNotify->Signature == PROTOCOL_NOTIFY_SIGNATURE); Position->SearchKey = NULL; Link = ProtNotify->Position->ForwardLink; if (Link != &ProtNotify->Protocol->Protocols) { Prot = CR (Link, PROTOCOL_INTERFACE, ByProtocol, PROTOCOL_INTERFACE_SIGNATURE); Handle = Prot->Handle; *Interface = Prot->Interface; } } return Handle; }
tianocore/edk2
C++
Other
4,240
/* gfs2_rgrp_dump - print out an rgrp @seq: The iterator @gl: The glock in question */
int gfs2_rgrp_dump(struct seq_file *seq, const struct gfs2_glock *gl)
/* gfs2_rgrp_dump - print out an rgrp @seq: The iterator @gl: The glock in question */ int gfs2_rgrp_dump(struct seq_file *seq, const struct gfs2_glock *gl)
{ const struct gfs2_rgrpd *rgd = gl->gl_object; if (rgd == NULL) return 0; gfs2_print_dbg(seq, " R: n:%llu f:%02x b:%u/%u i:%u\n", (unsigned long long)rgd->rd_addr, rgd->rd_flags, rgd->rd_free, rgd->rd_free_clone, rgd->rd_dinodes); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Start an SPI master blocking single item (frame) transfer. */
Ecode_t SPIDRV_MTransferSingleItemB(SPIDRV_Handle_t handle, uint32_t txValue, void *rxValue)
/* Start an SPI master blocking single item (frame) transfer. */ Ecode_t SPIDRV_MTransferSingleItemB(SPIDRV_Handle_t handle, uint32_t txValue, void *rxValue)
{ void *pRx; CORE_DECLARE_IRQ_STATE; uint32_t rxBuffer; if ( handle == NULL ) { return ECODE_EMDRV_SPIDRV_ILLEGAL_HANDLE; } if ( handle->initData.type == spidrvSlave ) { return ECODE_EMDRV_SPIDRV_MODE_ERROR; } CORE_ENTER_ATOMIC(); if ( handle->state != spidrvStateIdle ) { CORE_EXIT_ATOMIC(); return ECODE_EMDRV_SPIDRV_BUSY; } handle->state = spidrvStateTransferring; CORE_EXIT_ATOMIC(); if ( (pRx = rxValue) == NULL ) { pRx = &rxBuffer; } StartTransferDMA(handle, &txValue, pRx, 1, BlockingComplete); WaitForTransferCompletion(handle); return handle->transferStatus; }
eclipse-threadx/getting-started
C++
Other
310
/* Enables asynchronous callback generation for a given channel and type. Enables asynchronous callbacks for a given logical external interrupt channel and type. This must be called before an external interrupt channel will generate callback events. */
enum status_code extint_chan_enable_callback(const uint8_t channel, const enum extint_callback_type type)
/* Enables asynchronous callback generation for a given channel and type. Enables asynchronous callbacks for a given logical external interrupt channel and type. This must be called before an external interrupt channel will generate callback events. */ enum status_code extint_chan_enable_callback(const uint8_t channel, const enum extint_callback_type type)
{ if (type == EXTINT_CALLBACK_TYPE_DETECT) { Eic *const eic = _extint_get_eic_from_channel(channel); eic->INTENSET.reg = (1UL << channel); } else { Assert(false); return STATUS_ERR_INVALID_ARG; } return STATUS_OK; }
memfault/zero-to-main
C++
null
200
/* If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned. */
UINTN EFIAPI UnicodeVSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString, IN VA_LIST Marker)
/* If BufferSize is 0 or 1, then the output buffer is unmodified and 0 is returned. */ UINTN EFIAPI UnicodeVSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString, IN VA_LIST Marker)
{ ASSERT_UNICODE_BUFFER (StartOfBuffer); ASSERT_UNICODE_BUFFER (FormatString); return BasePrintLibSPrintMarker ((CHAR8 *)StartOfBuffer, BufferSize >> 1, FORMAT_UNICODE | OUTPUT_UNICODE, (CHAR8 *)FormatString, Marker, NULL); }
tianocore/edk2
C++
Other
4,240
/* Returns 1 if we correctly released the memory, or 0 if dma_release_coherent() should proceed with releasing memory from generic pools. */
int dma_release_from_coherent(struct device *dev, int order, void *vaddr)
/* Returns 1 if we correctly released the memory, or 0 if dma_release_coherent() should proceed with releasing memory from generic pools. */ int dma_release_from_coherent(struct device *dev, int order, void *vaddr)
{ struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL; if (mem && vaddr >= mem->virt_base && vaddr < (mem->virt_base + (mem->size << PAGE_SHIFT))) { int page = (vaddr - mem->virt_base) >> PAGE_SHIFT; bitmap_release_region(mem->bitmap, page, order); return 1; } return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Obtain the other device on the same cable, or if none is present NULL is returned */
struct ata_device* ata_dev_pair(struct ata_device *adev)
/* Obtain the other device on the same cable, or if none is present NULL is returned */ struct ata_device* ata_dev_pair(struct ata_device *adev)
{ struct ata_link *link = adev->link; struct ata_device *pair = &link->device[1 - adev->devno]; if (!ata_dev_enabled(pair)) return NULL; return pair; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Writes a block of data to remote CPU system address */
uint16_t IPCLtoRBlockWrite(volatile tIpcController *psController, uint32_t ulAddress, uint32_t ulShareAddress, uint16_t usLength, uint16_t usWordLength, uint16_t bBlock)
/* Writes a block of data to remote CPU system address */ uint16_t IPCLtoRBlockWrite(volatile tIpcController *psController, uint32_t ulAddress, uint32_t ulShareAddress, uint16_t usLength, uint16_t usWordLength, uint16_t bBlock)
{ uint16_t status; tIpcMessage sMessage; sMessage.ulcommand = IPC_BLOCK_WRITE; sMessage.uladdress = ulAddress; sMessage.uldataw1 = ((uint32_t)(usWordLength)<<16) + (uint32_t)usLength; sMessage.uldataw2 = ulShareAddress; status = IpcPut (psController, &sMessage, bBlock); return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Send data. This function can be used both for command responses like "OKAY" and for the data phase (the protocol doesn't describe any situation when the latter might be necessary, but does allow it) */
EFI_STATUS FastbootTransportUsbSend(IN UINTN BufferSize, IN CONST VOID *Buffer, IN EFI_EVENT *FatalErrorEvent)
/* Send data. This function can be used both for command responses like "OKAY" and for the data phase (the protocol doesn't describe any situation when the latter might be necessary, but does allow it) */ EFI_STATUS FastbootTransportUsbSend(IN UINTN BufferSize, IN CONST VOID *Buffer, IN EFI_EVENT *FatalErrorEvent)
{ return mUsbDevice->Send (1, BufferSize, Buffer); }
tianocore/edk2
C++
Other
4,240
/* The PWMA default IRQ, declared in StartUp code. */
void PWM0CH0_IRQHandler(void)
/* The PWMA default IRQ, declared in StartUp code. */ void PWM0CH0_IRQHandler(void)
{ unsigned long ulPWMStastus; unsigned long ulBase = PWMA_BASE; ulPWMStastus = xHWREG(ulBase + PWM_INTSTS) & 0x01010101; xHWREG(ulBase + PWM_INTSTS) = ulPWMStastus; if (g_pfnPWMHandlerCallbacks[0] != 0) { if(ulPWMStastus & 0x0101) { g_pfnPWMHandlerCallbacks[0](0, PWM_EVENT_PWM, ulPWMStastus, 0); } if((ulPWMStastus & 0x01010000)) { g_pfnPWMHandlerCallbacks[0](0, PWM_EVENT_CAP, (1 << PWM_CHANNEL0), 0); } } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Handler for new data events when using NAPI. This does not need any locking or protection from interrupts as data interrupts are off at this point and other adapter interrupts do not interfere. */
int t1_poll(struct napi_struct *napi, int budget)
/* Handler for new data events when using NAPI. This does not need any locking or protection from interrupts as data interrupts are off at this point and other adapter interrupts do not interfere. */ int t1_poll(struct napi_struct *napi, int budget)
{ struct adapter *adapter = container_of(napi, struct adapter, napi); int work_done = process_responses(adapter, budget); if (likely(work_done < budget)) { napi_complete(napi); writel(adapter->sge->respQ.cidx, adapter->regs + A_SG_SLEEPING); } return work_done; }
robutest/uclinux
C++
GPL-2.0
60
/* Set the clock rate of the specified I2C port. The */
void xI2CSlaveInit(unsigned long ulBase, unsigned char ucSlaveAddr, unsigned long ulGeneralCall)
/* Set the clock rate of the specified I2C port. The */ void xI2CSlaveInit(unsigned long ulBase, unsigned char ucSlaveAddr, unsigned long ulGeneralCall)
{ xASSERT((ulBase == I2C0_BASE)); xSysCtlPeripheralReset(xSYSCTL_PERIPH_I2C0); xHWREG(ulBase + I2C_CON) = I2C_CON_ENS1; xHWREG(ulBase + I2C_CON) = 0; xHWREG(ulBase + I2C_ADDR0) = (ucSlaveAddr << 1) | ulGeneralCall; xHWREG(ulBase + I2C_CON) = I2C_CON_ENS1; xHWREG(ulBase + I2C_CON) |= I2C_CON_AA; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This function is used to erase flash, and lock CPU when erase. */
IMAGE2_RAM_TEXT_SECTION void FLASH_EraseXIP(u32 EraseType, u32 Address)
/* This function is used to erase flash, and lock CPU when erase. */ IMAGE2_RAM_TEXT_SECTION void FLASH_EraseXIP(u32 EraseType, u32 Address)
{ FLASH_Write_Lock(); FLASH_Erase(EraseType, Address); Cache_Flush(); FLASH_Write_Unlock(); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This routine re-initialises and re-attaches a KS8695 ethernet device. */
static int ks8695_drv_resume(struct platform_device *pdev)
/* This routine re-initialises and re-attaches a KS8695 ethernet device. */ static int ks8695_drv_resume(struct platform_device *pdev)
{ struct net_device *ndev = platform_get_drvdata(pdev); struct ks8695_priv *ksp = netdev_priv(ndev); if (netif_running(ndev)) { ks8695_reset(ksp); ks8695_init_net(ksp); ks8695_set_multicast(ndev); netif_device_attach(ndev); } ksp->in_suspend = 0; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */
int main(void)
/* Main program entry point. This routine configures the hardware required by the application, then enters a loop to run the application tasks in sequence. */ int main(void)
{ SetupHardware(); LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY); GlobalInterruptEnable(); for (;;) { MassStorage_Task(); USB_USBTask(); } }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Check if the attribute header and payload can be accessed safely. */
int nla_ok(const struct nlattr *nla, int remaining)
/* Check if the attribute header and payload can be accessed safely. */ int nla_ok(const struct nlattr *nla, int remaining)
{ return remaining >= sizeof(*nla) && nla->nla_len >= sizeof(*nla) && nla->nla_len <= remaining; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Configure device MAC address and store it in NVMEM. The value of the MAC address configured through the API will be stored in CC3000 non volatile memory, thus preserved over resets. netapp_config_mac_adrress */
INT32 netapp_config_mac_adrress(UINT8 *mac)
/* Configure device MAC address and store it in NVMEM. The value of the MAC address configured through the API will be stored in CC3000 non volatile memory, thus preserved over resets. netapp_config_mac_adrress */ INT32 netapp_config_mac_adrress(UINT8 *mac)
{ return nvmem_set_mac_address(mac); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Read magnetometer device ID. This function reads the magnetometer hardware identification registers and returns these values to the addresses specified in the function parameters. */
static bool ak8975_device_id(sensor_hal_t *hal, sensor_data_t *data)
/* Read magnetometer device ID. This function reads the magnetometer hardware identification registers and returns these values to the addresses specified in the function parameters. */ static bool ak8975_device_id(sensor_hal_t *hal, sensor_data_t *data)
{ data->device.id = (uint32_t)sensor_bus_get(hal, AK8975_REG_WIA); data->device.version = 0; return true; }
memfault/zero-to-main
C++
null
200
/* return number of bytes in unsent transmit DMA buffers and the serial controller tx FIFO */
static unsigned int tbuf_bytes(struct slgt_info *info)
/* return number of bytes in unsent transmit DMA buffers and the serial controller tx FIFO */ static unsigned int tbuf_bytes(struct slgt_info *info)
{ unsigned int total_count = 0; unsigned int i = info->tbuf_current; unsigned int reg_value; unsigned int count; unsigned int active_buf_count = 0; do { count = desc_count(info->tbufs[i]); if (count) total_count += count; else if (!total_count) active_buf_count = info->tbufs[i].buf_count; if (++i == info->tbuf_count) i = 0; } while (i != info->tbuf_current); reg_value = rd_reg32(info, TDCSR); if (reg_value & BIT0) total_count += active_buf_count; total_count += (reg_value >> 8) & 0xff; if (info->tx_active) total_count++; return total_count; }
robutest/uclinux
C++
GPL-2.0
60
/* Get the tcplen (datalen + SYN/FIN) of a segment (by index) on the ooseq list */
static int tcp_oos_seg_tcplen(struct tcp_pcb *pcb, int seg_index)
/* Get the tcplen (datalen + SYN/FIN) of a segment (by index) on the ooseq list */ static int tcp_oos_seg_tcplen(struct tcp_pcb *pcb, int seg_index)
{ int num = 0; struct tcp_seg* seg = pcb->ooseq; while(seg != NULL) { if(num == seg_index) { return TCP_TCPLEN(seg); } num++; seg = seg->next; } fail(); return -1; }
ua1arn/hftrx
C++
null
69
/* If the position upon start is 0, then the Ascii Boolean will be set. This should be maintained and not changed for all operations with the same file. */
CHAR16* EFIAPI FileHandleReturnLine(IN EFI_FILE_HANDLE Handle, IN OUT BOOLEAN *Ascii)
/* If the position upon start is 0, then the Ascii Boolean will be set. This should be maintained and not changed for all operations with the same file. */ CHAR16* EFIAPI FileHandleReturnLine(IN EFI_FILE_HANDLE Handle, IN OUT BOOLEAN *Ascii)
{ CHAR16 *RetVal; UINTN Size; EFI_STATUS Status; Size = 0; RetVal = NULL; Status = FileHandleReadLine (Handle, RetVal, &Size, FALSE, Ascii); if (Status == EFI_BUFFER_TOO_SMALL) { RetVal = AllocateZeroPool (Size); Status = FileHandleReadLine (Handle, RetVal, &Size, FALSE, Ascii); } ASSERT_EFI_ERROR (Status); if (EFI_ERROR (Status) && (RetVal != NULL)) { FreePool (RetVal); RetVal = NULL; } return (RetVal); }
tianocore/edk2
C++
Other
4,240
/* Enables the PEC value calculation of the transferred bytes. */
void I2C_EnablePEC(I2C_T *i2c)
/* Enables the PEC value calculation of the transferred bytes. */ void I2C_EnablePEC(I2C_T *i2c)
{ i2c->CTRL1_B.PECEN = BIT_SET; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Start the PWM of the PWM module. The */
void PWMStart(unsigned long ulBase, unsigned long ulChannel)
/* Start the PWM of the PWM module. The */ void PWMStart(unsigned long ulBase, unsigned long ulChannel)
{ unsigned long ulChannelTemp; ulChannelTemp = ulChannel; xASSERT((ulBase == PWMA_BASE) || (ulBase == PWMB_BASE)); xASSERT(((ulChannelTemp >= 0) || (ulChannelTemp <= 5))); xHWREG(ulBase + PWM_CNTEN) |= (1 << (ulChannelTemp)); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* When in host mode this function will signal devices to leave the suspend state. This call should first be made with the */
void USBHostResume(unsigned long ulBase, tBoolean bStart)
/* When in host mode this function will signal devices to leave the suspend state. This call should first be made with the */ void USBHostResume(unsigned long ulBase, tBoolean bStart)
{ ASSERT(ulBase == USB0_BASE); if(bStart) { HWREGB(ulBase + USB_O_POWER) |= USB_POWER_RESUME; } else { HWREGB(ulBase + USB_O_POWER) &= ~USB_POWER_RESUME; } }
watterott/WebRadio
C++
null
71
/* This function shouldn't be called from interrupt context */
int ab4500_write(struct ab4500 *ab4500, unsigned char block, unsigned long addr, unsigned char data)
/* This function shouldn't be called from interrupt context */ int ab4500_write(struct ab4500 *ab4500, unsigned char block, unsigned long addr, unsigned char data)
{ struct spi_transfer xfer; struct spi_message msg; int err; unsigned long spi_data = block << 18 | addr << 10 | data; mutex_lock(&ab4500->lock); ab4500->tx_buf[0] = spi_data; ab4500->rx_buf[0] = 0; xfer.tx_buf = ab4500->tx_buf; xfer.rx_buf = NULL; xfer.len = sizeof(unsigned long); spi_message_init(&msg); spi_message_add_tail(&xfer, &msg); err = spi_sync(ab4500->spi, &msg); mutex_unlock(&ab4500->lock); return err; }
robutest/uclinux
C++
GPL-2.0
60
/* Refer to EMMC Electrical Standard Spec 5.1 Section 6.4 for details. */
EFI_STATUS EmmcPeimSetRca(IN EMMC_PEIM_HC_SLOT *Slot, IN UINT32 Rca)
/* Refer to EMMC Electrical Standard Spec 5.1 Section 6.4 for details. */ EFI_STATUS EmmcPeimSetRca(IN EMMC_PEIM_HC_SLOT *Slot, IN UINT32 Rca)
{ EMMC_COMMAND_BLOCK EmmcCmdBlk; EMMC_STATUS_BLOCK EmmcStatusBlk; EMMC_COMMAND_PACKET Packet; EFI_STATUS Status; ZeroMem (&EmmcCmdBlk, sizeof (EmmcCmdBlk)); ZeroMem (&EmmcStatusBlk, sizeof (EmmcStatusBlk)); ZeroMem (&Packet, sizeof (Packet)); Packet.EmmcCmdBlk = &EmmcCmdBlk; Packet.EmmcStatusBlk = &EmmcStatusBlk; Packet.Timeout = EMMC_TIMEOUT; EmmcCmdBlk.CommandIndex = EMMC_SET_RELATIVE_ADDR; EmmcCmdBlk.CommandType = EmmcCommandTypeAc; EmmcCmdBlk.ResponseType = EmmcResponceTypeR1; EmmcCmdBlk.CommandArgument = Rca << 16; Status = EmmcPeimExecCmd (Slot, &Packet); return Status; }
tianocore/edk2
C++
Other
4,240