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
/* Save time not doing access_ok. copy_*_user will make this work in any case. */
int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode)
/* Save time not doing access_ok. copy_*_user will make this work in any case. */ int verify_iovec(struct msghdr *m, struct iovec *iov, struct sockaddr *address, int mode)
{ int size, err, ct; if (m->msg_namelen) { if (mode == VERIFY_READ) { err = move_addr_to_kernel(m->msg_name, m->msg_namelen, address); if (err < 0) return err; } m->msg_name = address; } else { m->msg_name = NULL; } size = m->msg_iovlen * sizeof(struct iovec); if (copy_from_user(iov, m->msg_iov, size)) return -EFAULT; m->msg_iov = iov; err = 0; for (ct = 0; ct < m->msg_iovlen; ct++) { err += iov[ct].iov_len; if (err < 0) return -EMSGSIZE; } return err; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Description: Add a new address entry to the list pointed to by @head. On success zero is returned, otherwise a negative value is returned. The caller is responsible for calling the necessary locking functions. */
int netlbl_af4list_add(struct netlbl_af4list *entry, struct list_head *head)
/* Description: Add a new address entry to the list pointed to by @head. On success zero is returned, otherwise a negative value is returned. The caller is responsible for calling the necessary locking functions. */ int netlbl_af4list_add(struct netlbl_af4list *entry, struct list_head *head)
{ struct netlbl_af4list *iter; iter = netlbl_af4list_search(entry->addr, head); if (iter != NULL && iter->addr == entry->addr && iter->mask == entry->mask) return -EEXIST; list_for_each_entry_rcu(iter, head, list) if (iter->valid && ntohl(entry->mask) > ntohl(iter->mask)) { __list_add_rcu(&entry->list, iter->list.prev, &iter->list); return 0; } list_add_tail_rcu(&entry->list, head); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return additional info field value for input value */
static unsigned char uint_additional_info(uint64_t val)
/* Return additional info field value for input value */ static unsigned char uint_additional_info(uint64_t val)
{ if (val < CBOR_UINT8_FOLLOWS) { return val; } else if (val <= 0xff) { return CBOR_UINT8_FOLLOWS; } else if (val <= 0xffff) { return CBOR_UINT16_FOLLOWS; } else if (val <= 0xffffffffL) { return CBOR_UINT32_FOLLOWS; } return CBOR_UINT64_FOLLOWS; }
labapart/polymcu
C++
null
201
/* Initialize the app in low power: now PB0 push button has been pressed once, the application switches in low power mode: Stop LCD controller, stop LCD backlight, stop QTouch acquisition, switch SAM4L in power scaling PS1 mode. SAM4L is in RUN mode. */
void app_init_lowpower(void)
/* Initialize the app in low power: now PB0 push button has been pressed once, the application switches in low power mode: Stop LCD controller, stop LCD backlight, stop QTouch acquisition, switch SAM4L in power scaling PS1 mode. SAM4L is in RUN mode. */ void app_init_lowpower(void)
{ lcdca_disable(); touch_sensors_deinit(); board_init(); ioport_set_pin_level(LCD_BL_GPIO, IOPORT_PIN_LEVEL_LOW); sysclk_disable_peripheral_clock(CATB); sysclk_disable_peripheral_clock(PDCA); sysclk_disable_peripheral_clock(LCDCA); ui_set_mcu_status(POWER_SCALING_PS1, SLEEP_MODE_RUN, 12000000, CPU_SRC_RC4M); app_switch_power_scaling(ui_get_power_scaling_mcu_status()); ui_bm_send_mcu_status(); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Parameter name profileAndLevel Parameter description This is a nonCollapsing GenericParameter Parameter identifier value 0 Parameter status Mandatory Parameter type unsignedMax. Shall be in the range 0..255. H245: unsignedMax INTEGER(0..65535), */
static int dissect_mp4ves_par_profile(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, void *data)
/* Parameter name profileAndLevel Parameter description This is a nonCollapsing GenericParameter Parameter identifier value 0 Parameter status Mandatory Parameter type unsignedMax. Shall be in the range 0..255. H245: unsignedMax INTEGER(0..65535), */ static int dissect_mp4ves_par_profile(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree _U_, void *data)
{ int offset = 0; guint16 lvl; const gchar *p = NULL; asn1_ctx_t *actx; if (data == NULL) return 0; actx = get_asn1_ctx(data); DISSECTOR_ASSERT(actx); lvl = tvb_get_ntohs(tvb, offset); p = try_val_to_str(lvl, VALS(mp4ves_level_indication_vals)); if (p) { proto_item_append_text(actx->created_item, " - profileAndLevel %s", p); } offset += 2; return offset; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Master sends single byte through the USIx peripheral according to the set of the upper layer. */
void USI_I2C_MasterSend(USI_TypeDef *USIx, u8 *pBuf, u8 I2CCmd, u8 I2CStop, u8 I2CReSTR)
/* Master sends single byte through the USIx peripheral according to the set of the upper layer. */ void USI_I2C_MasterSend(USI_TypeDef *USIx, u8 *pBuf, u8 I2CCmd, u8 I2CStop, u8 I2CReSTR)
{ assert_param(IS_USI_I2C_ALL_PERIPH(USIx)); USIx->TX_FIFO_WRITE = *(pBuf) | (I2CReSTR << 10) | (I2CCmd << 8) | (I2CStop << 9); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* If Map is NULL, then ASSERT(). If the address of Map->Used is NULL, then ASSERT(). If the address of Map->Recycled is NULl, then ASSERT(). */
VOID EFIAPI NetMapInit(IN OUT NET_MAP *Map)
/* If Map is NULL, then ASSERT(). If the address of Map->Used is NULL, then ASSERT(). If the address of Map->Recycled is NULl, then ASSERT(). */ VOID EFIAPI NetMapInit(IN OUT NET_MAP *Map)
{ ASSERT (Map != NULL); InitializeListHead (&Map->Used); InitializeListHead (&Map->Recycled); Map->Count = 0; }
tianocore/edk2
C++
Other
4,240
/* Function for handling the BLE_GATTS_EVT_WRITE event from the S110 SoftDevice. */
static void on_write(ble_nus_t *p_nus, ble_evt_t *p_ble_evt)
/* Function for handling the BLE_GATTS_EVT_WRITE event from the S110 SoftDevice. */ static void on_write(ble_nus_t *p_nus, ble_evt_t *p_ble_evt)
{ ble_gatts_evt_write_t * p_evt_write = &p_ble_evt->evt.gatts_evt.params.write; if ( (p_evt_write->handle == p_nus->rx_handles.cccd_handle) && (p_evt_write->len == 2) ) { if (ble_srv_is_notification_enabled(p_evt_write->data)) { p_nus->is_notification_enabled = true; } else { p_nus->is_notification_enabled = false; } } else if ( (p_evt_write->handle == p_nus->tx_handles.value_handle) && (p_nus->data_handler != NULL) ) { p_nus->data_handler(p_nus, p_evt_write->data, p_evt_write->len); } else { } }
labapart/polymcu
C++
null
201
/* Copy the local and remote xprt addresses to the rqstp structure */
void svc_xprt_copy_addrs(struct svc_rqst *rqstp, struct svc_xprt *xprt)
/* Copy the local and remote xprt addresses to the rqstp structure */ void svc_xprt_copy_addrs(struct svc_rqst *rqstp, struct svc_xprt *xprt)
{ struct sockaddr *sin; memcpy(&rqstp->rq_addr, &xprt->xpt_remote, xprt->xpt_remotelen); rqstp->rq_addrlen = xprt->xpt_remotelen; sin = (struct sockaddr *)&xprt->xpt_local; switch (sin->sa_family) { case AF_INET: rqstp->rq_daddr.addr = ((struct sockaddr_in *)sin)->sin_addr; break; case AF_INET6: rqstp->rq_daddr.addr6 = ((struct sockaddr_in6 *)sin)->sin6_addr; break; } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This file is part of the Simba project. */
int mock_write_crc_32(uint32_t crc, const void *buf_p, size_t size, uint32_t res)
/* This file is part of the Simba project. */ int mock_write_crc_32(uint32_t crc, const void *buf_p, size_t size, uint32_t res)
{ harness_mock_write("crc_32(crc)", &crc, sizeof(crc)); harness_mock_write("crc_32(buf_p)", buf_p, size); harness_mock_write("crc_32(size)", &size, sizeof(size)); harness_mock_write("crc_32(): return (res)", &res, sizeof(res)); return (0); }
eerimoq/simba
C++
Other
337
/* Reads the status of the security session open register. */
int32_t BSP_NFCTAG_ReadI2CSecuritySession_Dyn(uint32_t Instance, ST25DV_I2CSSO_STATUS *const pSession)
/* Reads the status of the security session open register. */ int32_t BSP_NFCTAG_ReadI2CSecuritySession_Dyn(uint32_t Instance, ST25DV_I2CSSO_STATUS *const pSession)
{ UNUSED(Instance); return ST25DV_ReadI2CSecuritySession_Dyn(&NfcTagObj, pSession); }
eclipse-threadx/getting-started
C++
Other
310
/* platform_recover - recover the platform from a failure to suspend devices. */
static void platform_recover(int platform_mode)
/* platform_recover - recover the platform from a failure to suspend devices. */ static void platform_recover(int platform_mode)
{ if (platform_mode && hibernation_ops && hibernation_ops->recover) hibernation_ops->recover(); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* gameport_destroy_port() completes deregistration process and removes port from the system */
static void gameport_destroy_port(struct gameport *gameport)
/* gameport_destroy_port() completes deregistration process and removes port from the system */ static void gameport_destroy_port(struct gameport *gameport)
{ struct gameport *child; child = gameport_get_pending_child(gameport); if (child) { gameport_remove_pending_events(child); put_device(&child->dev); } if (gameport->parent) { gameport->parent->child = NULL; gameport->parent = NULL; } if (gameport->registered) { device_del(&gameport->dev); gameport->registered = 0; } list_del_init(&gameport->node); gameport_remove_pending_events(gameport); put_device(&gameport->dev); }
robutest/uclinux
C++
GPL-2.0
60
/* Get a buffer for the dir/attr block, fill in the contents. */
int xfs_da_read_buf(xfs_trans_t *trans, xfs_inode_t *dp, xfs_dablk_t bno, xfs_daddr_t mappedbno, xfs_dabuf_t **bpp, int whichfork)
/* Get a buffer for the dir/attr block, fill in the contents. */ int xfs_da_read_buf(xfs_trans_t *trans, xfs_inode_t *dp, xfs_dablk_t bno, xfs_daddr_t mappedbno, xfs_dabuf_t **bpp, int whichfork)
{ return xfs_da_do_buf(trans, dp, bno, &mappedbno, bpp, whichfork, 1, (inst_t *)__return_address); }
robutest/uclinux
C++
GPL-2.0
60
/* Write data to TCP socket This function is used to transmit a message to another socket. send */
INT16 CC3000_EXPORT() send(INT32 sd, const void *buf, INT32 len, INT32 flags)
/* Write data to TCP socket This function is used to transmit a message to another socket. send */ INT16 CC3000_EXPORT() send(INT32 sd, const void *buf, INT32 len, INT32 flags)
{ return(simple_link_send(sd, buf, len, flags, NULL, 0, HCI_CMND_SEND)); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* param base The LPI2C peripheral base address. param handle Pointer to the LPI2C master driver handle. param count Number of bytes transferred so far by the non-blocking transaction. retval #kStatus_Success retval #kStatus_NoTransferInProgress There is not a DMA transaction currently in progress. */
status_t LPI2C_MasterTransferGetCountEDMA(LPI2C_Type *base, lpi2c_master_edma_handle_t *handle, size_t *count)
/* param base The LPI2C peripheral base address. param handle Pointer to the LPI2C master driver handle. param count Number of bytes transferred so far by the non-blocking transaction. retval #kStatus_Success retval #kStatus_NoTransferInProgress There is not a DMA transaction currently in progress. */ status_t LPI2C_MasterTransferGetCountEDMA(LPI2C_Type *base, lpi2c_master_edma_handle_t *handle, size_t *count)
{ assert(handle); if (!count) { return kStatus_InvalidArgument; } if (!handle->isBusy) { *count = 0; return kStatus_NoTransferInProgress; } uint32_t remaining = handle->transfer.dataSize; if (EDMA_GetNextTCDAddress(handle->tx) == 0) { if (handle->transfer.direction == kLPI2C_Write) { remaining = (uint32_t)handle->nbytes * EDMA_GetRemainingMajorLoopCount(handle->tx->base, handle->tx->channel); } else { remaining = (uint32_t)handle->nbytes * EDMA_GetRemainingMajorLoopCount(handle->rx->base, handle->rx->channel); } } *count = handle->transfer.dataSize - remaining; return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Change Logs: Date Author Notes Meco Man first version */
static int init(void)
/* Change Logs: Date Author Notes Meco Man first version */ static int init(void)
{ sfud_dev = rt_sfud_flash_find_by_dev_name("W25Q64"); if (RT_NULL == sfud_dev) { return -1; } w25q64.blk_size = sfud_dev->chip.erase_gran; w25q64.len = sfud_dev->chip.capacity; return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Closes an endpoint of the Low Level Driver. */
USBD_StatusTypeDef USBD_LL_CloseEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
/* Closes an endpoint of the Low Level Driver. */ USBD_StatusTypeDef USBD_LL_CloseEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
{ HAL_PCD_EP_Close(pdev->pData, ep_addr); return USBD_OK; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Forces or releases Low Speed AHB peripheral reset. */
void RCC_AHBPeriphResetCmd(u32 ahb_periph, FunctionalState state)
/* Forces or releases Low Speed AHB peripheral reset. */ void RCC_AHBPeriphResetCmd(u32 ahb_periph, FunctionalState state)
{ (state) ? (RCC->AHBRSTR |= ahb_periph) : (RCC->AHBRSTR &= ~ahb_periph); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This function will return a 32 bit mask that will be used to check for byte lane failures. */
uint32_t byte_lane_mask(struct mrc_params *mrc_params)
/* This function will return a 32 bit mask that will be used to check for byte lane failures. */ uint32_t byte_lane_mask(struct mrc_params *mrc_params)
{ uint32_t j; uint32_t ret_val = 0x00; for (j = 0; j < MAX_BYTE_LANES; j += NUM_BYTE_LANES) ret_val |= (1 << ((j / NUM_BYTE_LANES) * NUM_BYTE_LANES)); if (mrc_params->channel_width == X16) ret_val |= (ret_val << 2); return ret_val; }
4ms/stm32mp1-baremetal
C++
Other
137
/* If 8-bit operations are not supported, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */
UINT8 EFIAPI BitFieldWrite8(IN UINT8 Operand, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 Value)
/* If 8-bit operations are not supported, then ASSERT(). If StartBit is greater than 7, then ASSERT(). If EndBit is greater than 7, then ASSERT(). If EndBit is less than StartBit, then ASSERT(). If Value is larger than the bitmask value range specified by StartBit and EndBit, then ASSERT(). */ UINT8 EFIAPI BitFieldWrite8(IN UINT8 Operand, IN UINTN StartBit, IN UINTN EndBit, IN UINT8 Value)
{ ASSERT (EndBit < 8); ASSERT (StartBit <= EndBit); return BitFieldAndThenOr8 (Operand, StartBit, EndBit, 0, Value); }
tianocore/edk2
C++
Other
4,240
/* Before the @wusbhc structure put()s the reference it owns for port->wusb_dev , it needs to lock @wusbhc->mutex. */
static void wusbhc_devconnect_acked_work(struct work_struct *work)
/* Before the @wusbhc structure put()s the reference it owns for port->wusb_dev , it needs to lock @wusbhc->mutex. */ static void wusbhc_devconnect_acked_work(struct work_struct *work)
{ struct wusb_dev *wusb_dev = container_of(work, struct wusb_dev, devconnect_acked_work); struct wusbhc *wusbhc = wusb_dev->wusbhc; mutex_lock(&wusbhc->mutex); wusbhc_devconnect_acked(wusbhc, wusb_dev); mutex_unlock(&wusbhc->mutex); wusb_dev_put(wusb_dev); }
robutest/uclinux
C++
GPL-2.0
60
/* USBH_CtlSendSetup Sends the Setup Packet to the Device. */
USBH_Status USBH_CtlSendSetup(USB_OTG_CORE_HANDLE *pdev, uint8_t *buff, uint8_t hc_num)
/* USBH_CtlSendSetup Sends the Setup Packet to the Device. */ USBH_Status USBH_CtlSendSetup(USB_OTG_CORE_HANDLE *pdev, uint8_t *buff, uint8_t hc_num)
{ pdev->host.hc[hc_num].ep_is_in = 0; pdev->host.hc[hc_num].data_pid = HC_PID_SETUP; pdev->host.hc[hc_num].xfer_buff = buff; pdev->host.hc[hc_num].xfer_len = USBH_SETUP_PKT_SIZE; return (USBH_Status)HCD_SubmitRequest (pdev , hc_num); }
MaJerle/stm32f429
C++
null
2,036
/* Enroll signature into DB/DBX/DBT without KEK's authentication. The SignatureOwner GUID will be Private->SignatureGUID. */
EFI_STATUS EnrollSignatureDatabase(IN SECUREBOOT_CONFIG_PRIVATE_DATA *Private, IN CHAR16 *VariableName)
/* Enroll signature into DB/DBX/DBT without KEK's authentication. The SignatureOwner GUID will be Private->SignatureGUID. */ EFI_STATUS EnrollSignatureDatabase(IN SECUREBOOT_CONFIG_PRIVATE_DATA *Private, IN CHAR16 *VariableName)
{ UINT16 *FilePostFix; EFI_STATUS Status; UINTN NameLength; if ((Private->FileContext->FileName == NULL) || (Private->FileContext->FHandle == NULL) || (Private->SignatureGUID == NULL)) { return EFI_INVALID_PARAMETER; } Status = SetSecureBootMode (CUSTOM_SECURE_BOOT_MODE); if (EFI_ERROR (Status)) { return Status; } NameLength = StrLen (Private->FileContext->FileName); if (NameLength <= 4) { return EFI_INVALID_PARAMETER; } FilePostFix = Private->FileContext->FileName + NameLength - 4; if (IsDerEncodeCertificate (FilePostFix)) { return EnrollX509toSigDB (Private, VariableName); } else if (IsAuthentication2Format (Private->FileContext->FHandle)) { return EnrollAuthentication2Descriptor (Private, VariableName); } else { return EnrollImageSignatureToSigDB (Private, VariableName); } }
tianocore/edk2
C++
Other
4,240
/* copy an event to input queue: return zero if enqueued */
int snd_seq_oss_readq_put_event(struct seq_oss_readq *q, union evrec *ev)
/* copy an event to input queue: return zero if enqueued */ int snd_seq_oss_readq_put_event(struct seq_oss_readq *q, union evrec *ev)
{ unsigned long flags; spin_lock_irqsave(&q->lock, flags); if (q->qlen >= q->maxlen - 1) { spin_unlock_irqrestore(&q->lock, flags); return -ENOMEM; } memcpy(&q->q[q->tail], ev, sizeof(*ev)); q->tail = (q->tail + 1) % q->maxlen; q->qlen++; if (waitqueue_active(&q->midi_sleep)) wake_up(&q->midi_sleep); spin_unlock_irqrestore(&q->lock, flags); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* These functions take a string in UTF8, ASCII or multibyte form and a mask of permissible ASN1 string types. It then works out the minimal type (using the order Printable < IA5 < T61 < BMP < Universal < UTF8) and creates a string of the correct type with the supplied data. Yes this is horrible: it has to be :-( The 'ncopy' form checks minimum and maximum size limits too. */
int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len, int inform, unsigned long mask)
/* These functions take a string in UTF8, ASCII or multibyte form and a mask of permissible ASN1 string types. It then works out the minimal type (using the order Printable < IA5 < T61 < BMP < Universal < UTF8) and creates a string of the correct type with the supplied data. Yes this is horrible: it has to be :-( The 'ncopy' form checks minimum and maximum size limits too. */ int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len, int inform, unsigned long mask)
{ return ASN1_mbstring_ncopy(out, in, len, inform, mask, 0, 0); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Decrypts the len-bytes in the specified data-array, using the specified 256- bit (32 bytes) key. The results are written back into the same array. */
bool UtilCryptoAes256Decrypt(uint8_t *data, uint32_t len, uint8_t const *key)
/* Decrypts the len-bytes in the specified data-array, using the specified 256- bit (32 bytes) key. The results are written back into the same array. */ bool UtilCryptoAes256Decrypt(uint8_t *data, uint32_t len, uint8_t const *key)
{ bool result = false; aes256_context ctx; assert(data != NULL); assert(key != NULL); if ( (data != NULL) && (key != NULL) && ((len % 16u) == 0) ) { aes256_init(&ctx, key); for (uint32_t i = 0; i < (len / 16u); i++) { aes256_decrypt_ecb(&ctx, &data[i * 16u]); } aes256_done(&ctx); result = true; } return result; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Possibly called several times to iterate over an sk_buff and copy data out of it. */
size_t xdr_skb_read_bits(struct xdr_skb_reader *desc, void *to, size_t len)
/* Possibly called several times to iterate over an sk_buff and copy data out of it. */ size_t xdr_skb_read_bits(struct xdr_skb_reader *desc, void *to, size_t len)
{ if (len > desc->count) len = desc->count; if (unlikely(skb_copy_bits(desc->skb, desc->offset, to, len))) return 0; desc->count -= len; desc->offset += len; return len; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* I2C Send Stop Condition. After the current byte transfer this will initiate a stop condition if in Master mode, or simply release the bus if in Slave mode. */
void i2c_send_stop(uint32_t i2c)
/* I2C Send Stop Condition. After the current byte transfer this will initiate a stop condition if in Master mode, or simply release the bus if in Slave mode. */ void i2c_send_stop(uint32_t i2c)
{ I2C_CR2(i2c) |= I2C_CR2_STOP; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Note: The transfer buffer associated with the urb is not freed unless the URB_FREE_BUFFER transfer flag is set. */
void usb_free_urb(struct urb *urb)
/* Note: The transfer buffer associated with the urb is not freed unless the URB_FREE_BUFFER transfer flag is set. */ void usb_free_urb(struct urb *urb)
{ if (urb) kref_put(&urb->kref, urb_destroy); }
robutest/uclinux
C++
GPL-2.0
60
/* Return 1 if ok, 0 if not found. */
static int udf_find_anchor(struct super_block *sb, struct kernel_lb_addr *fileset)
/* Return 1 if ok, 0 if not found. */ static int udf_find_anchor(struct super_block *sb, struct kernel_lb_addr *fileset)
{ sector_t lastblock; struct udf_sb_info *sbi = UDF_SB(sb); lastblock = udf_scan_anchors(sb, sbi->s_last_block, fileset); if (lastblock) goto out; UDF_SET_FLAG(sb, UDF_FLAG_VARCONV); lastblock = udf_scan_anchors(sb, udf_variable_to_fixed(sbi->s_last_block), fileset); if (lastblock) goto out; lastblock = udf_scan_anchors(sb, sbi->s_last_block, fileset); if (!lastblock) { UDF_CLEAR_FLAG(sb, UDF_FLAG_VARCONV); return 0; } out: sbi->s_last_block = lastblock; return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Receive a sequence of bytes from a USART in SPI mode device. All bytes sent out on usart bus are sent as value 0. */
uint32_t usart_spi_read_packet(Usart *p_usart, uint8_t *data, size_t len)
/* Receive a sequence of bytes from a USART in SPI mode device. All bytes sent out on usart bus are sent as value 0. */ uint32_t usart_spi_read_packet(Usart *p_usart, uint8_t *data, size_t len)
{ uint32_t val; uint32_t i = 0; while(len) { usart_putchar(p_usart, CONFIG_USART_SPI_DUMMY); usart_getchar(p_usart, &val); data[i] = (uint8_t)(val & 0xFF); i++; len--; } return 0; }
memfault/zero-to-main
C++
null
200
/* Sends a data byte through the I2Cx peripheral. */
void I2C_SendData(I2C_TypeDef *I2Cx, uint8_t Data)
/* Sends a data byte through the I2Cx peripheral. */ void I2C_SendData(I2C_TypeDef *I2Cx, uint8_t Data)
{ assert_param(IS_I2C_ALL_PERIPH(I2Cx)); I2Cx->TXDR = (uint8_t)Data; }
ajhc/demo-cortex-m3
C++
null
38
/* Scan PDR for the record with the specified RECORD_ID. If it's not found, return NULL. */
static const struct pdr* hermes_find_pdr(const struct pdr *first_pdr, u32 record_id, const void *end)
/* Scan PDR for the record with the specified RECORD_ID. If it's not found, return NULL. */ static const struct pdr* hermes_find_pdr(const struct pdr *first_pdr, u32 record_id, const void *end)
{ const struct pdr *pdr = first_pdr; end -= sizeof(struct pdr); while (((void *) pdr <= end) && (pdr_id(pdr) != PDI_END)) { if (pdr_len(pdr) < 2) return NULL; if (pdr_id(pdr) == record_id) return pdr; pdr = (struct pdr *) pdr->next; } return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Put mfxstm32l152 Device in Low Power standby mode. */
int32_t MFXSTM32L152_LowPower(MFXSTM32L152_Object_t *pObj)
/* Put mfxstm32l152 Device in Low Power standby mode. */ int32_t MFXSTM32L152_LowPower(MFXSTM32L152_Object_t *pObj)
{ int32_t ret = MFXSTM32L152_OK; uint8_t tmp = MFXSTM32L152_STANDBY; if (mfxstm32l152_write_reg(&pObj->Ctx, MFXSTM32L152_REG_ADR_SYS_CTRL, &tmp, 1) != MFXSTM32L152_OK) { ret = MFXSTM32L152_ERROR; } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* fnic_get_mac() - get assigned data MAC address for FIP code. @lport: local port. */
static u8* fnic_get_mac(struct fc_lport *lport)
/* fnic_get_mac() - get assigned data MAC address for FIP code. @lport: local port. */ static u8* fnic_get_mac(struct fc_lport *lport)
{ struct fnic *fnic = lport_priv(lport); return fnic->data_src_addr; }
robutest/uclinux
C++
GPL-2.0
60
/* Assert scsi device event asynchronously, given an event type. */
void sdev_evt_send_simple(struct scsi_device *sdev, enum scsi_device_event evt_type, gfp_t gfpflags)
/* Assert scsi device event asynchronously, given an event type. */ void sdev_evt_send_simple(struct scsi_device *sdev, enum scsi_device_event evt_type, gfp_t gfpflags)
{ struct scsi_event *evt = sdev_evt_alloc(evt_type, gfpflags); if (!evt) { sdev_printk(KERN_ERR, sdev, "event %d eaten due to OOM\n", evt_type); return; } sdev_evt_send(sdev, evt); }
robutest/uclinux
C++
GPL-2.0
60
/* (There is no need for locking when walking the policy list, as elements in the list are never deleted, nor does the list change.) */
int ima_match_policy(struct inode *inode, enum ima_hooks func, int mask)
/* (There is no need for locking when walking the policy list, as elements in the list are never deleted, nor does the list change.) */ int ima_match_policy(struct inode *inode, enum ima_hooks func, int mask)
{ struct ima_measure_rule_entry *entry; list_for_each_entry(entry, ima_measure, list) { bool rc; rc = ima_match_rules(entry, inode, func, mask); if (rc) return entry->action; } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Returns a pointer to an SMBIOS structure or NULL if none found. */
static void __iomem* get_subsequent_smbios_entry(void __iomem *smbios_start, void __iomem *smbios_table, void __iomem *curr)
/* Returns a pointer to an SMBIOS structure or NULL if none found. */ static void __iomem* get_subsequent_smbios_entry(void __iomem *smbios_start, void __iomem *smbios_table, void __iomem *curr)
{ u8 bail = 0; u8 previous_byte = 1; void __iomem *p_temp; void __iomem *p_max; if (!smbios_table || !curr) return NULL; p_max = smbios_start + readw(smbios_table + ST_LENGTH); p_temp = curr; p_temp += readb(curr + SMBIOS_GENERIC_LENGTH); while ((p_temp < p_max) && !bail) { if (!previous_byte && !(readb(p_temp))) bail = 1; previous_byte = readb(p_temp); p_temp++; } if (p_temp < p_max) return p_temp; else return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* 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
/* Start the IO functionality use and disable the AF for selected IO pin(s). */
void stmpe811_IO_Start(uint16_t DeviceAddr, uint32_t IO_Pin)
/* Start the IO functionality use and disable the AF for selected IO pin(s). */ void stmpe811_IO_Start(uint16_t DeviceAddr, uint32_t IO_Pin)
{ uint8_t mode; mode = IOE_Read(DeviceAddr, STMPE811_REG_SYS_CTRL2); mode &= ~(STMPE811_IO_FCT | STMPE811_ADC_FCT); IOE_Write(DeviceAddr, STMPE811_REG_SYS_CTRL2, mode); stmpe811_IO_DisableAF(DeviceAddr, (uint8_t)IO_Pin); }
eclipse-threadx/getting-started
C++
Other
310
/* Returns true on successful queue/dequeue, false on failure. */
static int fifo_enqueue(struct ilo_hwinfo *hw, char *fifobar, int entry)
/* Returns true on successful queue/dequeue, false on failure. */ static int fifo_enqueue(struct ilo_hwinfo *hw, char *fifobar, int entry)
{ struct fifo *fifo_q = FIFOBARTOHANDLE(fifobar); unsigned long flags; int ret = 0; spin_lock_irqsave(&hw->fifo_lock, flags); if (!(fifo_q->fifobar[(fifo_q->tail + 1) & fifo_q->imask] & ENTRY_MASK_O)) { fifo_q->fifobar[fifo_q->tail & fifo_q->imask] |= (entry & ENTRY_MASK_NOSTATE) | fifo_q->merge; fifo_q->tail += 1; ret = 1; } spin_unlock_irqrestore(&hw->fifo_lock, flags); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Returns the interrupt number for a given USB module. */
static uint32_t _USBIntNumberGet(uint32_t ui32Base)
/* Returns the interrupt number for a given USB module. */ static uint32_t _USBIntNumberGet(uint32_t ui32Base)
{ uint32_t ui32Int; if(CLASS_IS_BLIZZARD) { ui32Int = INT_USB0_BLIZZARD; } else { ui32Int = 0; } return(ui32Int); }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Called to do the PIO mode setup. We use a shared helper for this as the DMA setup must also adjust the PIO timing information. */
static void atiixp_set_piomode(struct ata_port *ap, struct ata_device *adev)
/* Called to do the PIO mode setup. We use a shared helper for this as the DMA setup must also adjust the PIO timing information. */ static void atiixp_set_piomode(struct ata_port *ap, struct ata_device *adev)
{ atiixp_set_pio_timing(ap, adev, adev->pio_mode - XFER_PIO_0); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* find_iova - find's an iova for a given pfn @iovad - iova domain in question. pfn - page frame number This function finds and returns an iova belonging to the given doamin which matches the given pfn. */
struct iova* find_iova(struct iova_domain *iovad, unsigned long pfn)
/* find_iova - find's an iova for a given pfn @iovad - iova domain in question. pfn - page frame number This function finds and returns an iova belonging to the given doamin which matches the given pfn. */ struct iova* find_iova(struct iova_domain *iovad, unsigned long pfn)
{ unsigned long flags; struct rb_node *node; spin_lock_irqsave(&iovad->iova_rbtree_lock, flags); node = iovad->rbroot.rb_node; while (node) { struct iova *iova = container_of(node, struct iova, node); if ((pfn >= iova->pfn_lo) && (pfn <= iova->pfn_hi)) { spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags); return iova; } if (pfn < iova->pfn_lo) node = node->rb_left; else if (pfn > iova->pfn_lo) node = node->rb_right; } spin_unlock_irqrestore(&iovad->iova_rbtree_lock, flags); return NULL; }
robutest/uclinux
C++
GPL-2.0
60
/* Receive a sequence of bytes from a USART in SPI mode device. All bytes sent out on usart bus are sent as value 0. */
uint32_t usart_spi_read_packet(volatile avr32_usart_t *p_usart, uint8_t *data, size_t len)
/* Receive a sequence of bytes from a USART in SPI mode device. All bytes sent out on usart bus are sent as value 0. */ uint32_t usart_spi_read_packet(volatile avr32_usart_t *p_usart, uint8_t *data, size_t len)
{ uint32_t val; uint32_t i = 0; while(len) { usart_putchar(p_usart, CONFIG_USART_SPI_DUMMY); val = usart_getchar(p_usart); data[i] = (uint8_t)(val & 0xFF); i++; len--; } return 0; }
memfault/zero-to-main
C++
null
200
/* get the PWM frequency of the PWM module. The */
unsigned long xPWMFrequencyGet(unsigned long ulBase, unsigned long ulChannel)
/* get the PWM frequency of the PWM module. The */ unsigned long xPWMFrequencyGet(unsigned long ulBase, unsigned long ulChannel)
{ return PWMFrequencyGet(ulBase, ulChannel); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* get max lun of the mass storage device */
static usbh_status usbh_msc_maxlun_get(usbh_host *uhost, uint8_t *maxlun)
/* get max lun of the mass storage device */ static usbh_status usbh_msc_maxlun_get(usbh_host *uhost, uint8_t *maxlun)
{ usbh_status status = USBH_BUSY; if (uhost->control.ctl_state == CTL_IDLE) { uhost->control.setup.req = (usb_req) { .bmRequestType = USB_TRX_IN | USB_REQTYPE_CLASS | USB_RECPTYPE_ITF, .bRequest = BBB_GET_MAX_LUN, .wValue = 0U, .wIndex = 0U, .wLength = 1U }; usbh_ctlstate_config (uhost, maxlun, 1U); } status = usbh_ctl_handler (uhost); return status; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Configures, when the DMAy Streamx is disabled, the double buffer mode and the current memory target. */
void DMA_DoubleBufferModeConfig(DMA_Stream_TypeDef *DMAy_Streamx, uint32_t Memory1BaseAddr, uint32_t DMA_CurrentMemory)
/* Configures, when the DMAy Streamx is disabled, the double buffer mode and the current memory target. */ void DMA_DoubleBufferModeConfig(DMA_Stream_TypeDef *DMAy_Streamx, uint32_t Memory1BaseAddr, uint32_t DMA_CurrentMemory)
{ assert_param(IS_DMA_ALL_PERIPH(DMAy_Streamx)); assert_param(IS_DMA_CURRENT_MEM(DMA_CurrentMemory)); if (DMA_CurrentMemory != DMA_Memory_0) { DMAy_Streamx->CR |= (uint32_t)(DMA_SxCR_CT); } else { DMAy_Streamx->CR &= ~(uint32_t)(DMA_SxCR_CT); } DMAy_Streamx->M1AR = Memory1BaseAddr; }
MaJerle/stm32f429
C++
null
2,036
/* Created on: 15 feb. 2019 Author: Daniel Mårtensson Take the diagonal of matrix A and insert it into into vector B. A size row x column and B size column x 1 */
void mdiag(double *A, double *B, int row, int column)
/* Created on: 15 feb. 2019 Author: Daniel Mårtensson Take the diagonal of matrix A and insert it into into vector B. A size row x column and B size column x 1 */ void mdiag(double *A, double *B, int row, int column)
{ for(int j = 0; j < column; j++){ if(i == j){ *B = *A; B++; A++; }else{ A++; } } } }
DanielMartensson/EmbeddedLapack
C++
MIT License
129
/* This routine will send a VM_CloseAll (shutdown) request to the adapter. */
int aac_send_shutdown(struct aac_dev *dev)
/* This routine will send a VM_CloseAll (shutdown) request to the adapter. */ int aac_send_shutdown(struct aac_dev *dev)
{ struct fib * fibctx; struct aac_close *cmd; int status; fibctx = aac_fib_alloc(dev); if (!fibctx) return -ENOMEM; aac_fib_init(fibctx); cmd = (struct aac_close *) fib_data(fibctx); cmd->command = cpu_to_le32(VM_CloseAll); cmd->cid = cpu_to_le32(0xffffffff); status = aac_fib_send(ContainerCommand, fibctx, sizeof(struct aac_close), FsaNormal, -2, 1, NULL, NULL); if (status >= 0) aac_fib_complete(fibctx); if (status != -ERESTARTSYS) aac_fib_free(fibctx); return status; }
robutest/uclinux
C++
GPL-2.0
60
/* Sets the RTC control register hour format to PM (12h) Requires unlocking backup domain write protection (PWR_CR_DBP) */
void rtc_set_pm_format(void)
/* Sets the RTC control register hour format to PM (12h) Requires unlocking backup domain write protection (PWR_CR_DBP) */ void rtc_set_pm_format(void)
{ RTC_CR |= RTC_CR_FMT; }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* The PWMA default IRQ, declared in StartUp code. */
void PWM0CH4_IRQHandler(void)
/* The PWMA default IRQ, declared in StartUp code. */ void PWM0CH4_IRQHandler(void)
{ unsigned long ulPWMStastus; unsigned long ulBase = PWMA_BASE; ulPWMStastus = xHWREG(ulBase + PWM_INTSTS) & 0x10101010; xHWREG(ulBase + PWM_INTSTS) = ulPWMStastus; if (g_pfnPWMHandlerCallbacks[0] != 0) { if(ulPWMStastus & 0x1010) { g_pfnPWMHandlerCallbacks[0](0, PWM_EVENT_PWM, ulPWMStastus, 0); } if((ulPWMStastus & 0x10100000)) { g_pfnPWMHandlerCallbacks[0](0, PWM_EVENT_CAP, (1 << PWM_CHANNEL4), 0); } } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Unimplemented driver function handler. This routine is called in the API to set the sensor error status and return a status indicating a function call failure when a driver has been invoked to run an interface that's not implemented in the driver. */
static bool sensor_driver_unimpl(sensor_t *sensor)
/* Unimplemented driver function handler. This routine is called in the API to set the sensor error status and return a status indicating a function call failure when a driver has been invoked to run an interface that's not implemented in the driver. */ static bool sensor_driver_unimpl(sensor_t *sensor)
{ sensor->err = SENSOR_ERR_FUNCTION; return false; }
memfault/zero-to-main
C++
null
200
/* n_hdlc_buf_list_init - initialize specified HDLC buffer list @list - pointer to buffer list */
static void n_hdlc_buf_list_init(struct n_hdlc_buf_list *list)
/* n_hdlc_buf_list_init - initialize specified HDLC buffer list @list - pointer to buffer list */ static void n_hdlc_buf_list_init(struct n_hdlc_buf_list *list)
{ memset(list, 0, sizeof(*list)); spin_lock_init(&list->spinlock); }
robutest/uclinux
C++
GPL-2.0
60
/* hashes the mac address in a mac descriptor with a XOR function */
UINT32 ixEthDBEntryXORHash(void *entry)
/* hashes the mac address in a mac descriptor with a XOR function */ UINT32 ixEthDBEntryXORHash(void *entry)
{ MacDescriptor *descriptor = (MacDescriptor *) entry; return ixEthDBKeyXORHash(descriptor->macAddress); }
EmcraftSystems/u-boot
C++
Other
181
/* Creates a new current UUID, and rotates the old current UUID into the bitmap slot. Causes an incremental resync upon next connect. */
void drbd_uuid_new_current(struct drbd_conf *mdev) __must_hold(local)
/* Creates a new current UUID, and rotates the old current UUID into the bitmap slot. Causes an incremental resync upon next connect. */ void drbd_uuid_new_current(struct drbd_conf *mdev) __must_hold(local)
{ u64 val; dev_info(DEV, "Creating new current UUID\n"); D_ASSERT(mdev->ldev->md.uuid[UI_BITMAP] == 0); mdev->ldev->md.uuid[UI_BITMAP] = mdev->ldev->md.uuid[UI_CURRENT]; get_random_bytes(&val, sizeof(u64)); _drbd_uuid_set(mdev, UI_CURRENT, val); }
robutest/uclinux
C++
GPL-2.0
60
/* Close the cursor on top of the stack. Return 1 */
static int cur_close(lua_State *L)
/* Close the cursor on top of the stack. Return 1 */ static int cur_close(lua_State *L)
{ conn_data *conn; cur_data *cur = (cur_data *)luaL_checkudata(L, 1, LUASQL_CURSOR_SQLITE); luaL_argcheck(L, cur != NULL, 1, LUASQL_PREFIX"cursor expected"); if (cur->closed) { lua_pushboolean(L, 0); return 1; } cur->closed = 1; sqlite3_finalize(cur->sql_vm); lua_rawgeti (L, LUA_REGISTRYINDEX, cur->conn); conn = lua_touserdata (L, -1); conn->cur_counter--; luaL_unref(L, LUA_REGISTRYINDEX, cur->conn); luaL_unref(L, LUA_REGISTRYINDEX, cur->colnames); luaL_unref(L, LUA_REGISTRYINDEX, cur->coltypes); lua_pushboolean(L, 1); return 1; }
DC-SWAT/DreamShell
C++
null
404
/* The callback should return 0 if the device doesn't match and non-zero if it does. If the callback returns non-zero, this function will return to the caller and not iterate over any more devices. */
struct device* driver_find_device(struct device_driver *drv, struct device *start, void *data, int(*match)(struct device *dev, void *data))
/* The callback should return 0 if the device doesn't match and non-zero if it does. If the callback returns non-zero, this function will return to the caller and not iterate over any more devices. */ struct device* driver_find_device(struct device_driver *drv, struct device *start, void *data, int(*match)(struct device *dev, void *data))
{ struct klist_iter i; struct device *dev; if (!drv) return NULL; klist_iter_init_node(&drv->p->klist_devices, &i, (start ? &start->p->knode_driver : NULL)); while ((dev = next_device(&i))) if (match(dev, data) && get_device(dev)) break; klist_iter_exit(&i); return dev; }
robutest/uclinux
C++
GPL-2.0
60
/* Retrieve the DMA Flush List given nasid, widget, and device. This list is needed to implement the WAR - Flush DMA data on PIO Reads. */
static u64 sal_get_device_dmaflush_list(u64 nasid, u64 widget_num, u64 device_num, u64 address)
/* Retrieve the DMA Flush List given nasid, widget, and device. This list is needed to implement the WAR - Flush DMA data on PIO Reads. */ static u64 sal_get_device_dmaflush_list(u64 nasid, u64 widget_num, u64 device_num, u64 address)
{ struct ia64_sal_retval ret_stuff; ret_stuff.status = 0; ret_stuff.v0 = 0; SAL_CALL_NOLOCK(ret_stuff, (u64) SN_SAL_IOIF_GET_DEVICE_DMAFLUSH_LIST, (u64) nasid, (u64) widget_num, (u64) device_num, (u64) address, 0, 0, 0); return ret_stuff.status; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Generates a write-1 cycle and samples the level. Only call if dev->bus_master->touch_bit is NULL */
static u8 w1_read_bit(struct w1_master *dev)
/* Generates a write-1 cycle and samples the level. Only call if dev->bus_master->touch_bit is NULL */ static u8 w1_read_bit(struct w1_master *dev)
{ int result; dev->bus_master->write_bit(dev->bus_master->data, 0); w1_delay(6); dev->bus_master->write_bit(dev->bus_master->data, 1); w1_delay(9); result = dev->bus_master->read_bit(dev->bus_master->data); w1_delay(55); return result & 0x1; }
robutest/uclinux
C++
GPL-2.0
60
/* Fills in VA API reference picture lists from the FFmpeg reference picture list. */
static void fill_vaapi_RefPicList(VAPictureH264 RefPicList[32], Picture *ref_list, unsigned int ref_count)
/* Fills in VA API reference picture lists from the FFmpeg reference picture list. */ static void fill_vaapi_RefPicList(VAPictureH264 RefPicList[32], Picture *ref_list, unsigned int ref_count)
{ unsigned int i, n = 0; for (i = 0; i < ref_count; i++) if (ref_list[i].reference) fill_vaapi_pic(&RefPicList[n++], &ref_list[i], 0); for (; n < 32; n++) init_vaapi_pic(&RefPicList[n]); }
DC-SWAT/DreamShell
C++
null
404
/* Converts a generic hardware text device path node to Hardware device path structure. */
EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextHardwarePath(IN CHAR16 *TextDeviceNode)
/* Converts a generic hardware text device path node to Hardware device path structure. */ EFI_DEVICE_PATH_PROTOCOL* DevPathFromTextHardwarePath(IN CHAR16 *TextDeviceNode)
{ return DevPathFromTextGenericPath (HARDWARE_DEVICE_PATH, TextDeviceNode); }
tianocore/edk2
C++
Other
4,240
/* Return the USB host speed from the low level driver. */
USBH_SpeedTypeDef USBH_LL_GetSpeed(USBH_HandleTypeDef *phost)
/* Return the USB host speed from the low level driver. */ USBH_SpeedTypeDef USBH_LL_GetSpeed(USBH_HandleTypeDef *phost)
{ case 0: speed = USBH_SPEED_HIGH; break; case 1: speed = USBH_SPEED_FULL; break; case 2: speed = USBH_SPEED_LOW; break; default: speed = USBH_SPEED_FULL; break; } return speed; }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* param base Pointer to FLEXIO_I2C_Type structure param baudRate_Bps the baud rate value in HZ param srcClock_Hz source clock in HZ */
void FLEXIO_I2C_MasterSetBaudRate(FLEXIO_I2C_Type *base, uint32_t baudRate_Bps, uint32_t srcClock_Hz)
/* param base Pointer to FLEXIO_I2C_Type structure param baudRate_Bps the baud rate value in HZ param srcClock_Hz source clock in HZ */ void FLEXIO_I2C_MasterSetBaudRate(FLEXIO_I2C_Type *base, uint32_t baudRate_Bps, uint32_t srcClock_Hz)
{ uint16_t timerDiv = 0; FLEXIO_Type *flexioBase = base->flexioBase; timerDiv = (uint16_t)((srcClock_Hz / baudRate_Bps) / 2U - 1U); flexioBase->TIMCMP[base->timerIndex[1]] = timerDiv; base->baudrate = srcClock_Hz / (2U * ((uint32_t)timerDiv + 1U)); }
eclipse-threadx/getting-started
C++
Other
310
/* Mconsole stack trace Added by Allan Graves, Jeff Dike Dumps a stacks registers to the linux console. Usage stack <pid>. */
void mconsole_stack(struct mc_request *req)
/* Mconsole stack trace Added by Allan Graves, Jeff Dike Dumps a stacks registers to the linux console. Usage stack <pid>. */ void mconsole_stack(struct mc_request *req)
{ char *ptr = req->request.data; int pid_requested= -1; struct task_struct *to = NULL; ptr += strlen("stack"); ptr = skip_spaces(ptr); if (sscanf(ptr, "%d", &pid_requested) == 0) { mconsole_reply(req, "Please specify a pid", 1, 0); return; } to = find_task_by_pid_ns(pid_requested, &init_pid_ns); if ((to == NULL) || (pid_requested == 0)) { mconsole_reply(req, "Couldn't find that pid", 1, 0); return; } with_console(req, stack_proc, to); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Event handler for the library USB Control Request reception event. */
void EVENT_USB_Device_ControlRequest(void)
/* Event handler for the library USB Control Request reception event. */ void EVENT_USB_Device_ControlRequest(void)
{ HID_Device_ProcessControlRequest(&Mouse_HID_Interface); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* Deinitializes the DCMI registers to their default reset values. */
void DCMI_DeInit(void)
/* Deinitializes the DCMI registers to their default reset values. */ void DCMI_DeInit(void)
{ DCMI->CR = 0x0; DCMI->IER = 0x0; DCMI->ICR = 0x1F; DCMI->ESCR = 0x0; DCMI->ESUR = 0x0; DCMI->CWSTRTR = 0x0; DCMI->CWSIZER = 0x0; }
MaJerle/stm32f429
C++
null
2,036
/* param base ACMP peripheral base address. param config Pointer to filter configuration structure. */
void ACMP_SetFilterConfig(CMP_Type *base, const acmp_filter_config_t *config)
/* param base ACMP peripheral base address. param config Pointer to filter configuration structure. */ void ACMP_SetFilterConfig(CMP_Type *base, const acmp_filter_config_t *config)
{ assert(NULL != config); uint32_t tmp32 = (base->C0 & (~(CMP_C0_FILTER_CNT_MASK | CMP_C0_FPR_MASK | CMP_C0_SE_MASK | CMP_C0_CFx_MASK))); if (config->enableSample) { tmp32 |= CMP_C0_SE_MASK; } tmp32 |= (CMP_C0_FILTER_CNT(config->filterCount) | CMP_C0_FPR(config->filterPeriod)); base->C0 = tmp32; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Record the DAI format for use in hw_params(). */
static int atmel_ssc_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
/* Record the DAI format for use in hw_params(). */ static int atmel_ssc_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
{ struct atmel_ssc_info *ssc_p = &ssc_info[cpu_dai->id]; ssc_p->daifmt = fmt; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Read and unescape given number of frame bytes from the transport channel. */
static ssize_t read_bytes(struct xbee_driver_t *self_p, uint8_t *buf_p, size_t size)
/* Read and unescape given number of frame bytes from the transport channel. */ static ssize_t read_bytes(struct xbee_driver_t *self_p, uint8_t *buf_p, size_t size)
{ ssize_t res; size_t i; uint8_t byte; for (i = 0; i < size; i++) { res = read_byte(self_p, &byte); if (res != sizeof(byte)) { return (res); } if (byte == FRAME_DELIMITER) { return (-EPROTO); } else if (byte == ESCAPE) { res = read_byte(self_p, &byte); if (res != sizeof(byte)) { return (res); } byte ^= 0x20; if ((byte != FRAME_DELIMITER) && (byte != ESCAPE) && (byte != XON) && (byte != XOFF)) { return (-EPROTO); } } buf_p[i] = byte; } return (size); }
eerimoq/simba
C++
Other
337
/* Enables or disables the selected DAC channel wave generation. */
void DAC_WaveGenerationEnable(uint32_t DAC_Wave, FunctionalState Cmd)
/* Enables or disables the selected DAC channel wave generation. */ void DAC_WaveGenerationEnable(uint32_t DAC_Wave, FunctionalState Cmd)
{ __IO uint32_t tmp = 0; assert_param(IS_DAC_WAVE(DAC_Wave)); assert_param(IS_FUNCTIONAL_STATE(Cmd)); tmp=DAC->CTRL; tmp&=~(3<<6); if (Cmd != DISABLE) { tmp |= DAC_Wave; } else { tmp&=~(3<<6); } DAC->CTRL =tmp; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* translate ns coding of SPD timing values into 10 ps unit values */
unsigned short NSto10PS(unsigned char spd_byte)
/* translate ns coding of SPD timing values into 10 ps unit values */ unsigned short NSto10PS(unsigned char spd_byte)
{ return (spd_byte * 100); }
EmcraftSystems/u-boot
C++
Other
181
/* if bssid != NULL its looking for a beacon frame */
int attack_check(unsigned char *bssid, char *essid, unsigned char *capa, struct wif *wi)
/* if bssid != NULL its looking for a beacon frame */ int attack_check(unsigned char *bssid, char *essid, unsigned char *capa, struct wif *wi)
{ int ap_chan=0, iface_chan=0; iface_chan = wi_get_channel(wi); if(iface_chan == -1 && !opt.ignore_negative_one) { PCT; printf("Couldn't determine current channel for %s, you should either force the operation with --ignore-negative-one or apply a kernel patch\n", wi_get_ifname(wi)); return -1; } if(bssid != NULL) { ap_chan = wait_for_beacon(bssid, capa, essid); if(ap_chan < 0) { PCT; printf("No such BSSID available.\n"); return -1; } if((ap_chan != iface_chan) && (iface_chan != -1 || !opt.ignore_negative_one)) { PCT; printf("%s is on channel %d, but the AP uses channel %d\n", wi_get_ifname(wi), iface_chan, ap_chan); return -1; } } return 0; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* OIS chain on aux interface power on mode.. */
int32_t lsm6dso_aux_pw_on_ctrl_set(stmdev_ctx_t *ctx, lsm6dso_ois_on_t val)
/* OIS chain on aux interface power on mode.. */ int32_t lsm6dso_aux_pw_on_ctrl_set(stmdev_ctx_t *ctx, lsm6dso_ois_on_t val)
{ lsm6dso_ctrl7_g_t reg; int32_t ret; ret = lsm6dso_read_reg(ctx, LSM6DSO_CTRL7_G, (uint8_t *)&reg, 1); if (ret == 0) { reg.ois_on_en = (uint8_t)val & 0x01U; reg.ois_on = (uint8_t)val & 0x01U; ret = lsm6dso_write_reg(ctx, LSM6DSO_CTRL7_G, (uint8_t *)&reg, 1); } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Set the contents of a G_TYPE_BOOLEAN #GValue to @v_boolean. */
void g_value_set_boolean(GValue *value, gboolean v_boolean)
/* Set the contents of a G_TYPE_BOOLEAN #GValue to @v_boolean. */ void g_value_set_boolean(GValue *value, gboolean v_boolean)
{ g_return_if_fail (G_VALUE_HOLDS_BOOLEAN (value)); value->data[0].v_int = v_boolean != FALSE; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* ibmvscsi_reset_host - Reset the connection to the server @hostdata: struct ibmvscsi_host_data to reset */
static void ibmvscsi_reset_host(struct ibmvscsi_host_data *hostdata)
/* ibmvscsi_reset_host - Reset the connection to the server @hostdata: struct ibmvscsi_host_data to reset */ static void ibmvscsi_reset_host(struct ibmvscsi_host_data *hostdata)
{ scsi_block_requests(hostdata->host); atomic_set(&hostdata->request_limit, 0); purge_requests(hostdata, DID_ERROR); if ((ibmvscsi_ops->reset_crq_queue(&hostdata->queue, hostdata)) || (ibmvscsi_ops->send_crq(hostdata, 0xC001000000000000LL, 0)) || (vio_enable_interrupts(to_vio_dev(hostdata->dev)))) { atomic_set(&hostdata->request_limit, -1); dev_err(hostdata->dev, "error after reset\n"); } scsi_unblock_requests(hostdata->host); }
robutest/uclinux
C++
GPL-2.0
60
/* Clears a Stall condition on an endpoint of the Low Level Driver. */
USBD_StatusTypeDef USBD_LL_ClearStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
/* Clears a Stall condition on an endpoint of the Low Level Driver. */ USBD_StatusTypeDef USBD_LL_ClearStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
{ HAL_PCD_EP_ClrStall(pdev->pData, ep_addr); return USBD_OK; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Description: This workqueue function is called to complete a READ request. The function verifies the transferred integrity metadata and then calls the original bio end_io function. */
static void bio_integrity_verify_fn(struct work_struct *work)
/* Description: This workqueue function is called to complete a READ request. The function verifies the transferred integrity metadata and then calls the original bio end_io function. */ static void bio_integrity_verify_fn(struct work_struct *work)
{ struct bio_integrity_payload *bip = container_of(work, struct bio_integrity_payload, bip_work); struct bio *bio = bip->bip_bio; int error; error = bio_integrity_verify(bio); bio->bi_end_io = bip->bip_end_io; bio_endio(bio, error); }
robutest/uclinux
C++
GPL-2.0
60
/* This function sets the attributes for the memory region specified by BaseAddress and Length from their current attributes to the attributes specified by Attributes. */
EFI_STATUS SmmSetMemoryAttributesEx(IN UINTN PageTableBase, IN PAGING_MODE PagingMode, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes)
/* This function sets the attributes for the memory region specified by BaseAddress and Length from their current attributes to the attributes specified by Attributes. */ EFI_STATUS SmmSetMemoryAttributesEx(IN UINTN PageTableBase, IN PAGING_MODE PagingMode, IN EFI_PHYSICAL_ADDRESS BaseAddress, IN UINT64 Length, IN UINT64 Attributes)
{ EFI_STATUS Status; BOOLEAN IsModified; Status = ConvertMemoryPageAttributes (PageTableBase, PagingMode, BaseAddress, Length, Attributes, TRUE, &IsModified); if (!EFI_ERROR (Status)) { if (IsModified) { FlushTlbForAll (); } } return Status; }
tianocore/edk2
C++
Other
4,240
/* Set the counter mode (selection of the LPTIM counter clock source). */
void LPTIM_SetCounterMode(LPTIM_Module *LPTIMx, uint32_t CounterMode)
/* Set the counter mode (selection of the LPTIM counter clock source). */ void LPTIM_SetCounterMode(LPTIM_Module *LPTIMx, uint32_t CounterMode)
{ MODIFY_REG(LPTIMx->CFG, LPTIM_CFG_CNTMEN, CounterMode); }
pikasTech/PikaPython
C++
MIT License
1,403
/* IRQ11 (GPIO11 through 27) handler. We enter here with the irq_controller_lock held, and IRQs disabled. Decode the IRQ and call the handler. */
static void sa1100_high_gpio_handler(unsigned int irq, struct irq_desc *desc)
/* IRQ11 (GPIO11 through 27) handler. We enter here with the irq_controller_lock held, and IRQs disabled. Decode the IRQ and call the handler. */ static void sa1100_high_gpio_handler(unsigned int irq, struct irq_desc *desc)
{ unsigned int mask; mask = GEDR & 0xfffff800; do { GEDR = mask; irq = IRQ_GPIO11; mask >>= 11; do { if (mask & 1) generic_handle_irq(irq); mask >>= 1; irq++; } while (mask); mask = GEDR & 0xfffff800; } while (mask); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* spider_net_free_chain - free descriptor chain @card: card structure @chain: address of chain */
static void spider_net_free_chain(struct spider_net_card *card, struct spider_net_descr_chain *chain)
/* spider_net_free_chain - free descriptor chain @card: card structure @chain: address of chain */ static void spider_net_free_chain(struct spider_net_card *card, struct spider_net_descr_chain *chain)
{ struct spider_net_descr *descr; descr = chain->ring; do { descr->bus_addr = 0; descr->hwdescr->next_descr_addr = 0; descr = descr->next; } while (descr != chain->ring); dma_free_coherent(&card->pdev->dev, chain->num_desc, chain->hwring, chain->dma_addr); }
robutest/uclinux
C++
GPL-2.0
60
/* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param volume volume value, support 0 ~ 100, 0 is mute, 100 is the maximum volume value. return kStatus_Success is success, else configure failed. */
status_t HAL_CODEC_SGTL5000_SetVolume(void *handle, uint32_t playChannel, uint32_t volume)
/* param handle codec handle. param channel audio codec play channel, can be a value or combine value of _codec_play_channel. param volume volume value, support 0 ~ 100, 0 is mute, 100 is the maximum volume value. return kStatus_Success is success, else configure failed. */ status_t HAL_CODEC_SGTL5000_SetVolume(void *handle, uint32_t playChannel, uint32_t volume)
{ assert(handle != NULL); if (playChannel & (kCODEC_PlayChannelHeadphoneLeft | kCODEC_PlayChannelHeadphoneRight)) { return SGTL_SetVolume((sgtl_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)), kSGTL_ModuleHP, volume); } if (playChannel & (kCODEC_PlayChannelLineOutLeft | kCODEC_PlayChannelLineOutRight)) { return SGTL_SetVolume((sgtl_handle_t *)((uint32_t)(((codec_handle_t *)handle)->codecDevHandle)), kSGTL_ModuleLineOut, volume); } return kStatus_CODEC_NotSupport; }
eclipse-threadx/getting-started
C++
Other
310
/* Allocates the number of 4KB pages of type 'MemoryType' and returns a pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */
VOID* EFIAPI AllocatePeiAccessiblePages(IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages)
/* Allocates the number of 4KB pages of type 'MemoryType' and returns a pointer to the allocated buffer. The buffer returned is aligned on a 4KB boundary. If Pages is 0, then NULL is returned. If there is not enough memory remaining to satisfy the request, then NULL is returned. */ VOID* EFIAPI AllocatePeiAccessiblePages(IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages)
{ EFI_STATUS Status; EFI_PHYSICAL_ADDRESS Memory; if (Pages == 0) { return NULL; } Status = gBS->AllocatePages (AllocateAnyPages, MemoryType, Pages, &Memory); if (EFI_ERROR (Status)) { return NULL; } return (VOID *)(UINTN)Memory; }
tianocore/edk2
C++
Other
4,240
/* Request the current RSSI for the current connected AP, the response received in wifi_cb M2M_WIFI_RESP_CURRENT_RSSI */
NMI_API sint8 m2m_wifi_req_curr_rssi(void)
/* Request the current RSSI for the current connected AP, the response received in wifi_cb M2M_WIFI_RESP_CURRENT_RSSI */ NMI_API sint8 m2m_wifi_req_curr_rssi(void)
{ sint8 ret = M2M_SUCCESS; ret = hif_send(M2M_REQ_GROUP_WIFI, M2M_WIFI_REQ_CURRENT_RSSI, NULL, 0, NULL,0, 0); return ret; }
remotemcu/remcu-chip-sdks
C++
null
436
/* Initialization function for the floating-point IIR lattice filter. */
void arm_iir_lattice_init_f32(arm_iir_lattice_instance_f32 *S, uint16_t numStages, float32_t *pkCoeffs, float32_t *pvCoeffs, float32_t *pState, uint32_t blockSize)
/* Initialization function for the floating-point IIR lattice filter. */ void arm_iir_lattice_init_f32(arm_iir_lattice_instance_f32 *S, uint16_t numStages, float32_t *pkCoeffs, float32_t *pvCoeffs, float32_t *pState, uint32_t blockSize)
{ S->numStages = numStages; S->pkCoeffs = pkCoeffs; S->pvCoeffs = pvCoeffs; memset(pState, 0, (numStages + blockSize) * sizeof(float32_t)); S->pState = pState; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Change Logs: Date Author Notes huijie.feng first version Set CNTFRQ This function assigns the given value to PL1 Physical Timer Counter Frequency Register (CNTFRQ). */
static void __set_cntfrq(rt_uint32_t value)
/* Change Logs: Date Author Notes huijie.feng first version Set CNTFRQ This function assigns the given value to PL1 Physical Timer Counter Frequency Register (CNTFRQ). */ static void __set_cntfrq(rt_uint32_t value)
{ __set_cp(15, 0, value, 14, 0, 0); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Note that it is illegal to call synchronize_srcu_expedited() from the corresponding SRCU read-side critical section; doing so will result in deadlock. However, it is perfectly legal to call synchronize_srcu_expedited() on one srcu_struct from some other srcu_struct's read-side critical section. */
void synchronize_srcu_expedited(struct srcu_struct *sp)
/* Note that it is illegal to call synchronize_srcu_expedited() from the corresponding SRCU read-side critical section; doing so will result in deadlock. However, it is perfectly legal to call synchronize_srcu_expedited() on one srcu_struct from some other srcu_struct's read-side critical section. */ void synchronize_srcu_expedited(struct srcu_struct *sp)
{ __synchronize_srcu(sp, synchronize_sched_expedited); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* ZigBee Device Profile dissector for the direct join response. */
void dissect_zbee_zdp_rsp_mgmt_direct_join(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* ZigBee Device Profile dissector for the direct join response. */ void dissect_zbee_zdp_rsp_mgmt_direct_join(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{ guint offset = 0; guint8 status; status = zdp_parse_status(tree, tvb, &offset); zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status)); zdp_dump_excess(tvb, offset, pinfo, tree); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Called when the peer device is polling for the line settings */
static int ircomm_param_poll(void *instance, irda_param_t *param, int get)
/* Called when the peer device is polling for the line settings */ static int ircomm_param_poll(void *instance, irda_param_t *param, int get)
{ struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; IRDA_ASSERT(self != NULL, return -1;); IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); if (!get) { ircomm_param_request(self, IRCOMM_DTE, TRUE); } return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Reset the TX & RX, and clear the PDC counter. */
static void usart_clear(void)
/* Reset the TX & RX, and clear the PDC counter. */ static void usart_clear(void)
{ usart_reset_rx(BOARD_USART); usart_reset_tx(BOARD_USART); g_st_packet.ul_addr = 0; g_st_packet.ul_size = 0; g_st_nextpacket.ul_addr = 0; g_st_nextpacket.ul_size = 0; pdc_rx_init(g_p_pdc, &g_st_packet, &g_st_nextpacket); usart_enable_tx(BOARD_USART); usart_enable_rx(BOARD_USART); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Convert a UNIX timestamp to a date in a given time zone. The provided UNIX timestamp is converted to the corresponding time in the provided time zone. */
void calendar_timestamp_to_date_tz(uint32_t timestamp, int8_t hour, uint8_t min, struct calendar_date *date_out)
/* Convert a UNIX timestamp to a date in a given time zone. The provided UNIX timestamp is converted to the corresponding time in the provided time zone. */ void calendar_timestamp_to_date_tz(uint32_t timestamp, int8_t hour, uint8_t min, struct calendar_date *date_out)
{ if (hour >= 0) { calendar_timestamp_to_date((timestamp + (SECS_PER_HOUR * hour) + (SECS_PER_MINUTE * min)), date_out); } else { calendar_timestamp_to_date((timestamp + (SECS_PER_HOUR * hour) - (SECS_PER_MINUTE * min)), date_out); } }
memfault/zero-to-main
C++
null
200
/* Fills each TIM_BDTRInitStruct member with its default value. */
void TIM_BDTRStructInit(TIM_BDTRInitTypeDef *TIM_BDTRInitStruct)
/* Fills each TIM_BDTRInitStruct member with its default value. */ void TIM_BDTRStructInit(TIM_BDTRInitTypeDef *TIM_BDTRInitStruct)
{ TIM_BDTRInitStruct->TIM_OSSRState = TIM_OSSRState_Disable; TIM_BDTRInitStruct->TIM_OSSIState = TIM_OSSIState_Disable; TIM_BDTRInitStruct->TIM_LOCKLevel = TIM_LOCKLevel_OFF; TIM_BDTRInitStruct->TIM_DeadTime = 0x00; TIM_BDTRInitStruct->TIM_Break = TIM_Break_Disable; TIM_BDTRInitStruct->TIM_BreakPolarity = TIM_BreakPolarity_Low; TIM_BDTRInitStruct->TIM_AutomaticOutput = TIM_AutomaticOutput_Disable; }
gcallipo/RadioDSP-Stm32f103
C++
Common Creative - Attribution 3.0
51
/* 16-bit registers on the ADT7462 are low-byte first. The data sheet says that the low byte must be read before the high byte. */
static int adt7462_read_word_data(struct i2c_client *client, u8 reg)
/* 16-bit registers on the ADT7462 are low-byte first. The data sheet says that the low byte must be read before the high byte. */ static int adt7462_read_word_data(struct i2c_client *client, u8 reg)
{ u16 foo; foo = i2c_smbus_read_byte_data(client, reg); foo |= ((u16)i2c_smbus_read_byte_data(client, reg + 1) << 8); return foo; }
robutest/uclinux
C++
GPL-2.0
60
/* Open 485 mode on the specified UART. The */
void UART485Config(unsigned long ulBase, unsigned long ulBaud, unsigned long ul485Config, unsigned long ulUARTConfig)
/* Open 485 mode on the specified UART. The */ void UART485Config(unsigned long ulBase, unsigned long ulBaud, unsigned long ul485Config, unsigned long ulUARTConfig)
{ xASSERT(UARTBaseValid(ulBase)); xUARTConfigSet(ulBase, ulBaud, ulUARTConfig); UARTEnable485(ulBase); xHWREG(ulBase + UART_ALT_CSR) &= 0xFFFFFF00; xHWREG(ulBase + UART_ALT_CSR) |= ul485Config; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* This routine wraps the actual SLI3 or SLI4 hba stop port routine from the API jump table function pointer from the lpfc_hba struct. */
void lpfc_stop_port(struct lpfc_hba *phba)
/* This routine wraps the actual SLI3 or SLI4 hba stop port routine from the API jump table function pointer from the lpfc_hba struct. */ void lpfc_stop_port(struct lpfc_hba *phba)
{ phba->lpfc_stop_port(phba); }
robutest/uclinux
C++
GPL-2.0
60
/* Backup function for HDiskImage. Only a few fields need to be backup. This is for making the Disk buffer refresh as few as possible. */
EFI_STATUS HDiskImageBackup(VOID)
/* Backup function for HDiskImage. Only a few fields need to be backup. This is for making the Disk buffer refresh as few as possible. */ EFI_STATUS HDiskImageBackup(VOID)
{ SHELL_FREE_NON_NULL (HDiskImageBackupVar.Name); HDiskImageBackupVar.Name = CatSPrint (NULL, L"%s", HDiskImage.Name); if (HDiskImageBackupVar.Name == NULL) { return EFI_OUT_OF_RESOURCES; } HDiskImageBackupVar.Offset = HDiskImage.Offset; HDiskImageBackupVar.Size = HDiskImage.Size; return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* Software reset - can be called from any contect. */
static int isp116x_sw_reset(struct isp116x *isp116x)
/* Software reset - can be called from any contect. */ static int isp116x_sw_reset(struct isp116x *isp116x)
{ int retries = 15; unsigned long flags; int ret = 0; spin_lock_irqsave(&isp116x->lock, flags); isp116x_write_reg16(isp116x, HCSWRES, HCSWRES_MAGIC); isp116x_write_reg32(isp116x, HCCMDSTAT, HCCMDSTAT_HCR); while (--retries) { mdelay(1); if (!(isp116x_read_reg32(isp116x, HCCMDSTAT) & HCCMDSTAT_HCR)) break; } if (!retries) { ERR("Software reset timeout\n"); ret = -ETIME; } spin_unlock_irqrestore(&isp116x->lock, flags); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Disbles or disables the SMC NAND ECC feature. */
void SMC_DisableNANDECC(SMC_BANK_NAND_T bank)
/* Disbles or disables the SMC NAND ECC feature. */ void SMC_DisableNANDECC(SMC_BANK_NAND_T bank)
{ if (bank == SMC_BANK2_NAND) { SMC_Bank2->CTRL2_B.ECCEN = BIT_RESET; } else if (bank == SMC_BANK3_NAND) { SMC_Bank3->CTRL3_B.ECCEN = BIT_RESET; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535