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
/* Count the number of nodes in a branch with at least one compatible property. */
EFI_STATUS EFIAPI FdtCountCompatNodeInBranch(IN CONST VOID *Fdt, IN INT32 FdtBranch, IN CONST COMPATIBILITY_INFO *CompatNamesInfo, OUT UINT32 *NodeCount)
/* Count the number of nodes in a branch with at least one compatible property. */ EFI_STATUS EFIAPI FdtCountCompatNodeInBranch(IN CONST VOID *Fdt, IN INT32 FdtBranch, IN CONST COMPATIBILITY_INFO *CompatNamesInfo, OUT UINT32 *NodeCount)
{ return FdtCountCondNodeInBranch ( Fdt, FdtBranch, FdtNodeIsCompatible, CompatNamesInfo, NodeCount ); }
tianocore/edk2
C++
Other
4,240
/* Enables or disables the High Speed APB (APB2) peripheral clock. */
void RCC_APB2PeriphClockCmd(uint32_t RCC_APB2Periph, FunctionalState NewState)
/* Enables or disables the High Speed APB (APB2) peripheral clock. */ void RCC_APB2PeriphClockCmd(uint32_t RCC_APB2Periph, FunctionalState NewState)
{ assert_param(IS_RCC_APB2_PERIPH(RCC_APB2Periph)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { RCC->APB2ENR |= RCC_APB2Periph; } else { RCC->APB2ENR &= ~RCC_APB2Periph; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Put a string ('\0'-terminated) to the serial port. */
void serial_puts(const char *s)
/* Put a string ('\0'-terminated) to the serial port. */ void serial_puts(const char *s)
{ while (*s) serial_putc(*s++); }
EmcraftSystems/u-boot
C++
Other
181
/* Select The Timer counter capture detect edge. This function is to select The Timer counter capture detect edge. */
void xTimerCaptureEdgeSelect(unsigned long ulBase, unsigned long ulChannel, unsigned long ulEdge)
/* Select The Timer counter capture detect edge. This function is to select The Timer counter capture detect edge. */ void xTimerCaptureEdgeSelect(unsigned long ulBase, unsigned long ulChannel, unsigned long ulEdge)
{ (void) ulChannel; xASSERT((ulBase == TIMER0_BASE) || (ulBase == TIMER1_BASE) || (ulBase == TIMER2_BASE) || (ulBase == TIMER3_BASE) ); xASSERT(ulChannel == xTIMER_CHANNEL1); if (ulEdge != 0) { TimerCaptureCfg(ulBase, TIMER_CAP_CH_0, ulEdge); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Fills each DAC_InitStruct member with its default value. */
void DAC_StructInit(DAC_InitTypeDef *DAC_InitStruct)
/* Fills each DAC_InitStruct member with its default value. */ void DAC_StructInit(DAC_InitTypeDef *DAC_InitStruct)
{ DAC_InitStruct->DAC_Trigger = DAC_Trigger_None; DAC_InitStruct->DAC_WaveGeneration = DAC_WaveGeneration_None; DAC_InitStruct->DAC_LFSRUnmask_TriangleAmplitude = DAC_LFSRUnmask_Bit0; DAC_InitStruct->DAC_Buffer_Switch = DAC_BufferSwitch_Enable; }
remotemcu/remcu-chip-sdks
C++
null
436
/* onenand_block_isbad - Check whether the block at the given offset is bad */
int onenand_block_isbad(struct mtd_info *mtd, loff_t ofs)
/* onenand_block_isbad - Check whether the block at the given offset is bad */ int onenand_block_isbad(struct mtd_info *mtd, loff_t ofs)
{ int ret; if (ofs > mtd->size) return -EINVAL; onenand_get_device(mtd, FL_READING); ret = onenand_block_isbad_nolock(mtd,ofs, 0); onenand_release_device(mtd); return ret; }
EmcraftSystems/u-boot
C++
Other
181
/* Set the specified Signal Flags of an active thread. */
int32_t osSignalSet(osThreadId thread_id, int32_t signals)
/* Set the specified Signal Flags of an active thread. */ int32_t osSignalSet(osThreadId thread_id, int32_t signals)
{ return isrSignalSet(thread_id, signals); } else { return __svcSignalSet(thread_id, signals); } }
ajhc/demo-cortex-m3
C++
null
38
/* Ring the door bell to notify XHCI there is a transaction to be executed. */
EFI_STATUS EFIAPI XhcRingDoorBell(IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId, IN UINT8 Dci)
/* Ring the door bell to notify XHCI there is a transaction to be executed. */ EFI_STATUS EFIAPI XhcRingDoorBell(IN USB_XHCI_INSTANCE *Xhc, IN UINT8 SlotId, IN UINT8 Dci)
{ if (SlotId == 0) { XhcWriteDoorBellReg (Xhc, 0, 0); } else { XhcWriteDoorBellReg (Xhc, SlotId * sizeof (UINT32), Dci); } return EFI_SUCCESS; }
tianocore/edk2
C++
Other
4,240
/* If 64-bit I/O port operations are not supported, then ASSERT(). */
UINT64 EFIAPI IoRead64(IN UINTN Port)
/* If 64-bit I/O port operations are not supported, then ASSERT(). */ UINT64 EFIAPI IoRead64(IN UINTN Port)
{ ASSERT ((Port & 7) == 0); return IoReadWorker (Port, EfiCpuIoWidthUint64); }
tianocore/edk2
C++
Other
4,240
/* Open the serial port that we'll be communicating with the Freakduino (sniffer) through. */
static int serial_open(char *portname)
/* Open the serial port that we'll be communicating with the Freakduino (sniffer) through. */ static int serial_open(char *portname)
{ int FD_com; struct termios term; FD_com = open(portname, O_RDONLY | O_NOCTTY | O_NDELAY); if(FD_com == -1) { printf("serial_open: Unable to open %s.\n", portname); } else { cfsetspeed(&term, BAUDRATE); term.c_cflag &= ~PARENB; term.c_cflag &= ~CSTOPB; term.c_cflag &= ~CSIZE; term.c_cflag |= CS8; term.c_cflag |= (CLOCAL | CREAD); tcsetattr(FD_com, TCSANOW, &term); } return(FD_com); }
microbuilder/LPC1343CodeBase
C++
Other
73
/* Returns -ENODATA if the data object was missing from the message. */
int pkcs7_get_content_data(const struct pkcs7_message *pkcs7, const void **_data, size_t *_data_len, size_t *_headerlen)
/* Returns -ENODATA if the data object was missing from the message. */ int pkcs7_get_content_data(const struct pkcs7_message *pkcs7, const void **_data, size_t *_data_len, size_t *_headerlen)
{ if (!pkcs7->data) return -ENODATA; *_data = pkcs7->data; *_data_len = pkcs7->data_len; if (_headerlen) *_headerlen = pkcs7->data_hdrlen; return 0; }
4ms/stm32mp1-baremetal
C++
Other
137
/* pnp_unregister_card_driver - unregisters a PnP card driver from the PnP Layer @drv: pointer to the driver to unregister */
void pnp_unregister_card_driver(struct pnp_card_driver *drv)
/* pnp_unregister_card_driver - unregisters a PnP card driver from the PnP Layer @drv: pointer to the driver to unregister */ void pnp_unregister_card_driver(struct pnp_card_driver *drv)
{ spin_lock(&pnp_lock); list_del(&drv->global_list); spin_unlock(&pnp_lock); pnp_unregister_driver(&drv->link); }
robutest/uclinux
C++
GPL-2.0
60
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */
void GPIOPinTypeWakeLow(uint32_t ui32Port, uint8_t ui8Pins)
/* The pin(s) are specified using a bit-packed byte, where each bit that is set identifies the pin to be accessed, and where bit 0 of the byte represents GPIO port pin 0, bit 1 represents GPIO port pin 1, and so on. */ void GPIOPinTypeWakeLow(uint32_t ui32Port, uint8_t ui8Pins)
{ ASSERT(_GPIOBaseValid(ui32Port)); GPIODirModeSet(ui32Port, ui8Pins, GPIO_DIR_MODE_IN); GPIOPadConfigSet(ui32Port, ui8Pins, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_WAKE_LOW); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Copy of sock_queue_rcv_skb (from sock.h) without bh_lock_sock() (its already held when this is called) which also allows data and other data to be queued to a socket. */
static __inline__ int dn_queue_skb(struct sock *sk, struct sk_buff *skb, int sig, struct sk_buff_head *queue)
/* Copy of sock_queue_rcv_skb (from sock.h) without bh_lock_sock() (its already held when this is called) which also allows data and other data to be queued to a socket. */ static __inline__ int dn_queue_skb(struct sock *sk, struct sk_buff *skb, int sig, struct sk_buff_head *queue)
{ int err; int skb_len; if (atomic_read(&sk->sk_rmem_alloc) + skb->truesize >= (unsigned)sk->sk_rcvbuf) { err = -ENOMEM; goto out; } err = sk_filter(sk, skb); if (err) goto out; skb_len = skb->len; skb_set_owner_r(skb, sk); skb_queue_tail(queue, skb); if (!sock_flag(sk, SOCK_DEAD)) sk->sk_data_ready(sk, skb_len); out: return err; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Read the tap / double tap source register.. */
int32_t lsm6dsl_tap_src_get(stmdev_ctx_t *ctx, lsm6dsl_tap_src_t *val)
/* Read the tap / double tap source register.. */ int32_t lsm6dsl_tap_src_get(stmdev_ctx_t *ctx, lsm6dsl_tap_src_t *val)
{ int32_t ret; ret = lsm6dsl_read_reg(ctx, LSM6DSL_TAP_SRC, (uint8_t*) val, 1); return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Functions prefixed with "h_" are protocol callbacks. They can be called from interrupt context. Return value of 0 means that request processing is still ongoing, while special error value of -EAGAIN means that current request is finished (and request processor should come back some time later). */
static int h_memstick_read_dev_id(struct memstick_dev *card, struct memstick_request **mrq)
/* Functions prefixed with "h_" are protocol callbacks. They can be called from interrupt context. Return value of 0 means that request processing is still ongoing, while special error value of -EAGAIN means that current request is finished (and request processor should come back some time later). */ static int h_memstick_read_dev_id(struct memstick_dev *card, struct memstick_request **mrq)
{ struct ms_id_register id_reg; if (!(*mrq)) { memstick_init_req(&card->current_mrq, MS_TPC_READ_REG, NULL, sizeof(struct ms_id_register)); *mrq = &card->current_mrq; return 0; } else { if (!(*mrq)->error) { memcpy(&id_reg, (*mrq)->data, sizeof(id_reg)); card->id.match_flags = MEMSTICK_MATCH_ALL; card->id.type = id_reg.type; card->id.category = id_reg.category; card->id.class = id_reg.class; dev_dbg(&card->dev, "if_mode = %02x\n", id_reg.if_mode); } complete(&card->mrq_complete); return -EAGAIN; } }
robutest/uclinux
C++
GPL-2.0
60
/* Gets the direction and mode of a pin. */
unsigned long xGPIODirModeGet(unsigned long ulPort, unsigned long ulPin)
/* Gets the direction and mode of a pin. */ unsigned long xGPIODirModeGet(unsigned long ulPort, unsigned long ulPin)
{ unsigned long ulBits; xASSERT(GPIOBaseValid(ulPort)); for(ulBits=0; ulBits<16; ulBits++) { if(ulPin & (1 << ulBits)) { break; } } return((xHWREG(ulPort + GPIO_PMD) & (3 << (ulBits * 2))) >> (ulBits * 2)); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Announces that a buffer were filled and request the next */
static void buffer_filled(struct em28xx *dev, struct em28xx_dmaqueue *dma_q, struct em28xx_buffer *buf)
/* Announces that a buffer were filled and request the next */ static void buffer_filled(struct em28xx *dev, struct em28xx_dmaqueue *dma_q, struct em28xx_buffer *buf)
{ em28xx_isocdbg("[%p/%d] wakeup\n", buf, buf->vb.i); buf->vb.state = VIDEOBUF_DONE; buf->vb.field_count++; do_gettimeofday(&buf->vb.ts); dev->isoc_ctl.vid_buf = NULL; list_del(&buf->vb.queue); wake_up(&buf->vb.done); }
robutest/uclinux
C++
GPL-2.0
60
/* Calculate gas resistance from raw gas resitance value and gas range BME680 datasheet. */
static uint32_t bme680_convert_gas(bme680_sensor_t *dev, uint16_t gas, uint8_t gas_range)
/* Calculate gas resistance from raw gas resitance value and gas range BME680 datasheet. */ static uint32_t bme680_convert_gas(bme680_sensor_t *dev, uint16_t gas, uint8_t gas_range)
{ if (!dev) return 0; bme680_calib_data_t* cd = &dev->calib_data; float var1 = (1340.0 + 5.0 * cd->range_sw_err) * lookup_table[gas_range][0]; return var1 * lookup_table[gas_range][1] / (gas - 512.0 + var1); }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI PciRead16(IN UINTN Address)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ UINT16 EFIAPI PciRead16(IN UINTN Address)
{ return PciCf8Read16 (Address); }
tianocore/edk2
C++
Other
4,240
/* Clears the SPIx CRC Error (CRCERR) interrupt pending bit. */
void SPI_ClearITPendingBit(SPI_TypeDef *SPIx, uint8_t SPI_IT)
/* Clears the SPIx CRC Error (CRCERR) interrupt pending bit. */ void SPI_ClearITPendingBit(SPI_TypeDef *SPIx, uint8_t SPI_IT)
{ uint16_t itpos = 0; assert_param(IS_SPI_ALL_PERIPH(SPIx)); assert_param(IS_SPI_CLEAR_IT(SPI_IT)); itpos = 0x01 << (SPI_IT & 0x0F); SPIx->SR = (uint16_t)~itpos; }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* cp210x_set_config_single Convenience function for calling cp210x_set_config on single data values without requiring an integer pointer */
static int cp210x_set_config_single(struct usb_serial_port *port, u8 request, unsigned int data)
/* cp210x_set_config_single Convenience function for calling cp210x_set_config on single data values without requiring an integer pointer */ static int cp210x_set_config_single(struct usb_serial_port *port, u8 request, unsigned int data)
{ return cp210x_set_config(port, request, &data, 2); }
robutest/uclinux
C++
GPL-2.0
60
/* schedules a packet to be sent after given milliseconds */
static void _mdns_schedule_tx_packet(mdns_tx_packet_t *packet, uint32_t ms_after)
/* schedules a packet to be sent after given milliseconds */ static void _mdns_schedule_tx_packet(mdns_tx_packet_t *packet, uint32_t ms_after)
{ if (!packet) { return; } packet->send_at = (xTaskGetTickCount() * portTICK_PERIOD_MS) + ms_after; packet->next = NULL; if (!_mdns_server->tx_queue_head || _mdns_server->tx_queue_head->send_at > packet->send_at) { packet->next = _mdns_server->tx_queue_head; _mdns_server->tx_queue_head = packet; return; } mdns_tx_packet_t * q = _mdns_server->tx_queue_head; while (q->next && q->next->send_at <= packet->send_at) { q = q->next; } packet->next = q->next; q->next = packet; }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* param base DCP peripheral base address param handle Handle used for this request. param ciphertext Input cipher text to decrypt param plaintext Output plain text param size Size of input and output data in bytes. Must be multiple of 16 bytes. param iv Input initial vector to combine with the first input block. return Status from decrypt operation */
status_t DCP_AES_DecryptCbc(DCP_Type *base, dcp_handle_t *handle, const uint8_t *ciphertext, uint8_t *plaintext, size_t size, const uint8_t iv[16])
/* param base DCP peripheral base address param handle Handle used for this request. param ciphertext Input cipher text to decrypt param plaintext Output plain text param size Size of input and output data in bytes. Must be multiple of 16 bytes. param iv Input initial vector to combine with the first input block. return Status from decrypt operation */ status_t DCP_AES_DecryptCbc(DCP_Type *base, dcp_handle_t *handle, const uint8_t *ciphertext, uint8_t *plaintext, size_t size, const uint8_t iv[16])
{ status_t completionStatus = kStatus_Fail; dcp_work_packet_t dcpWork = {0}; do { completionStatus = DCP_AES_DecryptCbcNonBlocking(base, handle, &dcpWork, ciphertext, plaintext, size, iv); } while (completionStatus == kStatus_DCP_Again); if (completionStatus != kStatus_Success) { return completionStatus; } return DCP_WaitForChannelComplete(base, handle); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Dark space is the space which is not always usable - it depends on which nodes are written in which order. E.g., if an LEB has only 512 free bytes, it is dark space, because it cannot fit a large data node. So UBIFS cannot count on this LEB and treat these 512 bytes as usable because it is not true if, for example, only big chunks of uncompressible data will be written to the FS. */
static int calc_dark(struct ubifs_info *c, int spc)
/* Dark space is the space which is not always usable - it depends on which nodes are written in which order. E.g., if an LEB has only 512 free bytes, it is dark space, because it cannot fit a large data node. So UBIFS cannot count on this LEB and treat these 512 bytes as usable because it is not true if, for example, only big chunks of uncompressible data will be written to the FS. */ static int calc_dark(struct ubifs_info *c, int spc)
{ ubifs_assert(!(spc & 7)); if (spc < c->dark_wm) return spc; if (spc - c->dark_wm < MIN_WRITE_SZ) return spc - MIN_WRITE_SZ; return c->dark_wm; }
EmcraftSystems/u-boot
C++
Other
181
/* Set the duty cycle of the specified channel. */
void pwmout_write(pwmout_t *obj, float percent)
/* Set the duty cycle of the specified channel. */ void pwmout_write(pwmout_t *obj, float percent)
{ u32 ccrx; if (percent < (float)0.0) { percent = 0.0; } else if (percent > (float)1.0) { percent = 1.0; } obj->pulse = (percent * obj->period); ccrx = (u32)(obj->pulse * 40 / (prescaler + 1)) & 0x0000ffff; RTIM_CCRxSet(PWM_TIM[obj->pwm_idx >>BIT_PWM_TIM_IDX_SHIFT], ccrx, obj->pwm_idx & (~BIT_PWM_TIM_IDX_FLAG)); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Message: VersionMessage Opcode: 0x0098 Type: RegistrationAndManagement Direction: pbx2dev VarLength: no */
static void handle_VersionMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
/* Message: VersionMessage Opcode: 0x0098 Type: RegistrationAndManagement Direction: pbx2dev VarLength: no */ static void handle_VersionMessage(ptvcursor_t *cursor, packet_info *pinfo _U_)
{ ptvcursor_add(cursor, hf_skinny_version, 16, ENC_ASCII|ENC_NA); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Gets the transfer mode for a uDMA channel control structure. */
unsigned long uDMAChannelModeGet(unsigned long ulChannelStructIndex)
/* Gets the transfer mode for a uDMA channel control structure. */ unsigned long uDMAChannelModeGet(unsigned long ulChannelStructIndex)
{ tDMAControlTable *pControlTable; unsigned long ulControl; ASSERT((ulChannelStructIndex & 0xffff) < 64); ASSERT(HWREG(UDMA_CTLBASE) != 0); ulChannelStructIndex &= 0x3f; pControlTable = (tDMAControlTable *)HWREG(UDMA_CTLBASE); ulControl = (pControlTable[ulChannelStructIndex].ulControl & UDMA_CHCTL_XFERMODE_M); if(((ulControl & ~UDMA_MODE_ALT_SELECT) == UDMA_MODE_MEM_SCATTER_GATHER) || ((ulControl & ~UDMA_MODE_ALT_SELECT) == UDMA_MODE_PER_SCATTER_GATHER)) { ulControl &= ~UDMA_MODE_ALT_SELECT; } return(ulControl); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Deserializes the supplied (wire) buffer into unsubscribe data */
int MQTTDeserialize_unsubscribe(unsigned char *dup, unsigned short *packetid, int maxcount, int *count, MQTTString topicFilters[], unsigned char *buf, int len)
/* Deserializes the supplied (wire) buffer into unsubscribe data */ int MQTTDeserialize_unsubscribe(unsigned char *dup, unsigned short *packetid, int maxcount, int *count, MQTTString topicFilters[], unsigned char *buf, int len)
{ MQTTHeader header = {0}; unsigned char* curdata = buf; unsigned char* enddata = NULL; int rc = 0; int mylen = 0; FUNC_ENTRY; header.byte = readChar(&curdata); if (header.bits.type != UNSUBSCRIBE) goto exit; *dup = header.bits.dup; curdata += (rc = MQTTPacket_decodeBuf(curdata, &mylen)); enddata = curdata + mylen; *packetid = readInt(&curdata); *count = 0; while (curdata < enddata) { if (!readMQTTLenString(&topicFilters[*count], &curdata, enddata)) goto exit; (*count)++; } rc = 1; exit: FUNC_EXIT_RC(rc); return rc; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Initialize the Message Info used by the main dissector Data are linked to a TCAP transaction */
struct camelsrt_info_t* camelsrt_razinfo(void)
/* Initialize the Message Info used by the main dissector Data are linked to a TCAP transaction */ struct camelsrt_info_t* camelsrt_razinfo(void)
{ struct camelsrt_info_t *p_camelsrt_info ; camelsrt_global_current++; if(camelsrt_global_current==MAX_CAMEL_INSTANCE){ camelsrt_global_current=0; } p_camelsrt_info=&camelsrt_global_info[camelsrt_global_current]; memset(p_camelsrt_info,0,sizeof(struct camelsrt_info_t)); p_camelsrt_info->opcode=255; return p_camelsrt_info; }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Now socket state including sk->sk_err is changed only under lock, hence we may omit checks after joining wait queue. We check receive queue before schedule() only as optimization; it is very likely that release_sock() added new data. */
int sk_wait_data(struct sock *sk, long *timeo)
/* Now socket state including sk->sk_err is changed only under lock, hence we may omit checks after joining wait queue. We check receive queue before schedule() only as optimization; it is very likely that release_sock() added new data. */ int sk_wait_data(struct sock *sk, long *timeo)
{ int rc; DEFINE_WAIT(wait); prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); set_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); rc = sk_wait_event(sk, timeo, !skb_queue_empty(&sk->sk_receive_queue)); clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); finish_wait(sk->sk_sleep, &wait); return rc; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* The following are the status flags for device mode: */
uint32_t USBEndpointStatus(uint32_t ui32Base, uint32_t ui32Endpoint)
/* The following are the status flags for device mode: */ uint32_t USBEndpointStatus(uint32_t ui32Base, uint32_t ui32Endpoint)
{ uint32_t ui32Status; ASSERT(ui32Base == USB0_BASE); ASSERT((ui32Endpoint == USB_EP_0) || (ui32Endpoint == USB_EP_1) || (ui32Endpoint == USB_EP_2) || (ui32Endpoint == USB_EP_3) || (ui32Endpoint == USB_EP_4) || (ui32Endpoint == USB_EP_5) || (ui32Endpoint == USB_EP_6) || (ui32Endpoint == USB_EP_7)); ui32Status = HWREGH(ui32Base + EP_OFFSET(ui32Endpoint) + USB_O_TXCSRL1); ui32Status |= ((HWREGH(ui32Base + EP_OFFSET(ui32Endpoint) + USB_O_RXCSRL1)) << USB_RX_EPSTATUS_SHIFT); return (ui32Status); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* The originating slot should not be part of any active DMA transfer. Its link is set to 0xffff. */
void edma_unlink(unsigned from)
/* The originating slot should not be part of any active DMA transfer. Its link is set to 0xffff. */ void edma_unlink(unsigned from)
{ unsigned ctlr; ctlr = EDMA_CTLR(from); from = EDMA_CHAN_SLOT(from); if (from >= edma_cc[ctlr]->num_slots) return; edma_parm_or(ctlr, PARM_LINK_BCNTRLD, from, 0xffff); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* tipc_nametbl_publish_rsv - publish port name using a reserved name type */
int tipc_nametbl_publish_rsv(u32 ref, unsigned int scope, struct tipc_name_seq const *seq)
/* tipc_nametbl_publish_rsv - publish port name using a reserved name type */ int tipc_nametbl_publish_rsv(u32 ref, unsigned int scope, struct tipc_name_seq const *seq)
{ int res; atomic_inc(&rsv_publ_ok); res = tipc_publish(ref, scope, seq); atomic_dec(&rsv_publ_ok); return res; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* This function disables the timestamping. When disabled timestamp is not added to tx and receive frames and timestamp generator is suspended. */
void synopGMAC_TS_disable(synopGMACdevice *gmacdev)
/* This function disables the timestamping. When disabled timestamp is not added to tx and receive frames and timestamp generator is suspended. */ void synopGMAC_TS_disable(synopGMACdevice *gmacdev)
{ synopGMACClearBits(gmacdev->MacBase, GmacInterruptMask, GmacTSIntMask); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set socket send and receive buffer size limits. */
static void xs_udp_set_buffer_size(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize)
/* Set socket send and receive buffer size limits. */ static void xs_udp_set_buffer_size(struct rpc_xprt *xprt, size_t sndsize, size_t rcvsize)
{ struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xprt); transport->sndsize = 0; if (sndsize) transport->sndsize = sndsize + 1024; transport->rcvsize = 0; if (rcvsize) transport->rcvsize = rcvsize + 1024; xs_udp_do_set_buffer_size(xprt); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Attribute read call back for the Value V4 attribute. */
static ssize_t read_value_v4(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset)
/* Attribute read call back for the Value V4 attribute. */ static ssize_t read_value_v4(struct bt_conn *conn, const struct bt_gatt_attr *attr, void *buf, uint16_t len, uint16_t offset)
{ const uint8_t *value = attr->user_data; return bt_gatt_attr_read(conn, attr, buf, len, offset, value, sizeof(value_v4_value)); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Clear the external trigger valid edge flag(EXTTRIGCF). @rmtoll ICR EXTTRIGCF LPTIM_ClearFlag_EXTTRIG. */
void LPTIM_ClearFlag_EXTTRIG(LPTIM_Module *LPTIMx)
/* Clear the external trigger valid edge flag(EXTTRIGCF). @rmtoll ICR EXTTRIGCF LPTIM_ClearFlag_EXTTRIG. */ void LPTIM_ClearFlag_EXTTRIG(LPTIM_Module *LPTIMx)
{ SET_BIT(LPTIMx->INTCLR, LPTIM_INTCLR_EXTRIGCF); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Clear receive CRC error flag @rmtoll ICR CRXBERF LL_SWPMI_ClearFlag_RXBER. */
void LL_SWPMI_ClearFlag_RXBER(SWPMI_TypeDef *SWPMIx)
/* Clear receive CRC error flag @rmtoll ICR CRXBERF LL_SWPMI_ClearFlag_RXBER. */ void LL_SWPMI_ClearFlag_RXBER(SWPMI_TypeDef *SWPMIx)
{ WRITE_REG(SWPMIx->ICR, SWPMI_ICR_CRXBERF); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Note: The background color is controlled by the shell command cls. */
EFI_STATUS EFIAPI ShellPrintEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR16 *Format,...)
/* Note: The background color is controlled by the shell command cls. */ EFI_STATUS EFIAPI ShellPrintEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR16 *Format,...)
{ VA_LIST Marker; EFI_STATUS RetVal; if (Format == NULL) { return (EFI_INVALID_PARAMETER); } VA_START (Marker, Format); RetVal = InternalShellPrintWorker (Col, Row, Format, Marker); VA_END (Marker); return (RetVal); }
tianocore/edk2
C++
Other
4,240
/* Deinitializes the SYSCFG registers to their default reset values. */
void SYSCFG_DeInit(void)
/* Deinitializes the SYSCFG registers to their default reset values. */ void SYSCFG_DeInit(void)
{ SYSCFG->CFGR &= SYSCFG_CFGR_MEM_MODE; SYSCFG->EXTICR[0] = 0; SYSCFG->EXTICR[1] = 0; SYSCFG->EXTICR[2] = 0; SYSCFG->EXTICR[3] = 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Select nominal frequency of external crystal for HFCLK. This register has to match the actual crystal used in design to enable correct behaviour. */
void clock_set_xtal_freq(enum clock_xtal_freq freq)
/* Select nominal frequency of external crystal for HFCLK. This register has to match the actual crystal used in design to enable correct behaviour. */ void clock_set_xtal_freq(enum clock_xtal_freq freq)
{ CLOCK_XTALFREQ = freq; } /**@}
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */
UINT32 EFIAPI PciOr32(IN UINTN Address, IN UINT32 OrData)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 32-bit boundary, then ASSERT(). */ UINT32 EFIAPI PciOr32(IN UINTN Address, IN UINT32 OrData)
{ return PciCf8Or32 (Address, OrData); }
tianocore/edk2
C++
Other
4,240
/* Gets the RTC module alarm time value in standard format */
void XMC_RTC_GetAlarmStdFormat(struct tm *const stdtime)
/* Gets the RTC module alarm time value in standard format */ void XMC_RTC_GetAlarmStdFormat(struct tm *const stdtime)
{ XMC_RTC_ALARM_t alarm; alarm.raw0 = RTC->ATIM0; alarm.raw1 = RTC->ATIM1; stdtime->tm_sec = (int8_t)alarm.seconds; stdtime->tm_min = (int8_t)alarm.minutes; stdtime->tm_hour = (int8_t)alarm.hours; stdtime->tm_mday = ((int8_t)alarm.days + (int8_t)1); stdtime->tm_mon = (int8_t)alarm.month; stdtime->tm_year = (int32_t)alarm.year - (int32_t)XMC_RTC_YEAR_OFFSET; }
feaser/openblt
C++
GNU General Public License v3.0
601
/* Set the callback for the LCDCA 'beginning of frame' interrupt. */
void lcdca_set_callback(lcdca_callback_t callback, uint8_t irq_line, uint8_t irq_level)
/* Set the callback for the LCDCA 'beginning of frame' interrupt. */ void lcdca_set_callback(lcdca_callback_t callback, uint8_t irq_line, uint8_t irq_level)
{ lcdca_callback_pointer = callback; NVIC_ClearPendingIRQ((IRQn_Type)irq_line); NVIC_SetPriority((IRQn_Type)irq_line, irq_level); NVIC_EnableIRQ((IRQn_Type)irq_line); lcdca_enable_interrupt(); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Machine checks for the channel subsystem must be enabled after the channel subsystem is initialized */
static int __init crw_machine_check_init(void)
/* Machine checks for the channel subsystem must be enabled after the channel subsystem is initialized */ static int __init crw_machine_check_init(void)
{ struct task_struct *task; task = kthread_run(crw_collect_info, NULL, "kmcheck"); if (IS_ERR(task)) return PTR_ERR(task); ctl_set_bit(14, 28); return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Stalls the CPU for the number of microseconds specified by MicroSeconds. */
UINTN EFIAPI MicroSecondDelay(IN UINTN MicroSeconds)
/* Stalls the CPU for the number of microseconds specified by MicroSeconds. */ UINTN EFIAPI MicroSecondDelay(IN UINTN MicroSeconds)
{ UINT64 TimerTicks64; UINT64 SystemCounterVal; TimerTicks64 = DivU64x32 ( MULT_U64_X_N ( MicroSeconds, GetPlatformTimerFreq () ), 1000000U ); SystemCounterVal = ArmGenericTimerGetSystemCount (); TimerTicks64 += SystemCounterVal; while (SystemCounterVal < TimerTicks64) { SystemCounterVal = ArmGenericTimerGetSystemCount (); } return MicroSeconds; }
tianocore/edk2
C++
Other
4,240
/* RTC Set Operational from the Off state. Power up the backup domain clocks, enable write access to the backup domain, select the clock source, clear the RTC registers and enable the RTC. */
void rtc_awake_from_off(enum rcc_osc clock_source)
/* RTC Set Operational from the Off state. Power up the backup domain clocks, enable write access to the backup domain, select the clock source, clear the RTC registers and enable the RTC. */ void rtc_awake_from_off(enum rcc_osc clock_source)
{ uint32_t reg32; rcc_periph_clock_enable(RCC_PWR); rcc_periph_clock_enable(RCC_BKP); pwr_disable_backup_domain_write_protect(); rcc_set_rtc_clock_source(clock_source); RTC_CRH = 0; RTC_CRL = 0; rcc_enable_rtc_clock(); rtc_enter_config_mode(); RTC_PRLH = 0; RTC_PRLL = 0; RTC_CNTH = 0; RTC_CNTL = 0; RTC_ALRH = 0xFFFF; RTC_ALRL = 0xFFFF; rtc_exit_config_mode(); RTC_CRL &= ~RTC_CRL_RSF; while ((reg32 = (RTC_CRL & RTC_CRL_RSF)) == 0); }
libopencm3/libopencm3
C++
GNU General Public License v3.0
2,931
/* Extract device path for given HII handle and class guid. */
CHAR16* BmmExtractDevicePathFromHiiHandle(IN EFI_HII_HANDLE Handle)
/* Extract device path for given HII handle and class guid. */ CHAR16* BmmExtractDevicePathFromHiiHandle(IN EFI_HII_HANDLE Handle)
{ EFI_STATUS Status; EFI_HANDLE DriverHandle; ASSERT (Handle != NULL); if (Handle == NULL) { return NULL; } Status = gHiiDatabase->GetPackageListHandle (gHiiDatabase, Handle, &DriverHandle); if (EFI_ERROR (Status)) { return NULL; } return ConvertDevicePathToText (DevicePathFromHandle (DriverHandle), FALSE, FALSE); }
tianocore/edk2
C++
Other
4,240
/* Set the PWM unit clock divisor. Set the binary divisor used to predivide the system clock down for use as the timing reference for the PWM module. */
void rcc_set_pwm_divisor(enum pwm_clkdiv div)
/* Set the PWM unit clock divisor. Set the binary divisor used to predivide the system clock down for use as the timing reference for the PWM module. */ void rcc_set_pwm_divisor(enum pwm_clkdiv div)
{ uint32_t reg32; reg32 = SYSCTL_RCC; reg32 &= ~SYSCTL_RCC_PWMDIV_MASK; reg32 |= (div & SYSCTL_RCC_PWMDIV_MASK); SYSCTL_RCC = reg32; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Config the ETH DMA Tx Descriptor Own bit. */
void ETH_ConfigDMATxDescOwnBit(ETH_DMADescConfig_T *DMATxDesc)
/* Config the ETH DMA Tx Descriptor Own bit. */ void ETH_ConfigDMATxDescOwnBit(ETH_DMADescConfig_T *DMATxDesc)
{ DMATxDesc->Status |= ETH_DMATXDESC_OWN; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* returns the status as in the dmac_cmd_status field of the descriptor */
static int spider_net_get_descr_status(struct spider_net_hw_descr *hwdescr)
/* returns the status as in the dmac_cmd_status field of the descriptor */ static int spider_net_get_descr_status(struct spider_net_hw_descr *hwdescr)
{ return hwdescr->dmac_cmd_status & SPIDER_NET_DESCR_IND_PROC_MASK; }
robutest/uclinux
C++
GPL-2.0
60
/* Check whether the ITflag is set or reset. */
uint16_t TMR_ReadIntFlag(TMR_T *tmr, TMR_INT_T flag)
/* Check whether the ITflag is set or reset. */ uint16_t TMR_ReadIntFlag(TMR_T *tmr, TMR_INT_T flag)
{ if (((tmr->STS & flag) != RESET ) && ((tmr->DIEN & flag) != RESET)) { return SET; } else { return RESET; } }
pikasTech/PikaPython
C++
MIT License
1,403
/* css_sch_is_valid() - check if a subchannel is valid @schib: subchannel information block for the subchannel */
int css_sch_is_valid(struct schib *schib)
/* css_sch_is_valid() - check if a subchannel is valid @schib: subchannel information block for the subchannel */ int css_sch_is_valid(struct schib *schib)
{ if ((schib->pmcw.st == SUBCHANNEL_TYPE_IO) && !schib->pmcw.dnv) return 0; if ((schib->pmcw.st == SUBCHANNEL_TYPE_MSG) && !schib->pmcw.w) return 0; return 1; }
robutest/uclinux
C++
GPL-2.0
60
/* Convert numeric IP address into decimal dotted ASCII representation. returns ptr to static buffer; not reentrant! */
char* netdev_ip4addr_ntoa(const ip4_addr_t *addr)
/* Convert numeric IP address into decimal dotted ASCII representation. returns ptr to static buffer; not reentrant! */ char* netdev_ip4addr_ntoa(const ip4_addr_t *addr)
{ static char str[IP4ADDR_STRLEN_MAX]; return netdev_ip4addr_ntoa_r(addr, str, IP4ADDR_STRLEN_MAX); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* param base Key Manager peripheral address. param select select source for Master key. param lock setting for lock Master key. return status of Master key control operation */
status_t KEYMGR_MasterKeyControll(KEY_MANAGER_Type *base, keymgr_select_t select, keymgr_lock_t lock)
/* param base Key Manager peripheral address. param select select source for Master key. param lock setting for lock Master key. return status of Master key control operation */ status_t KEYMGR_MasterKeyControll(KEY_MANAGER_Type *base, keymgr_select_t select, keymgr_lock_t lock)
{ if ((select != (uint8_t)(KEYMGR_SEL_UDF)) && (select != (uint8_t)(KEYMGR_SEL_PUF))) { return kStatus_InvalidArgument; } base->MASTER_KEY_CTRL &= ~KEY_MANAGER_MASTER_KEY_CTRL_SELECT_MASK; base->MASTER_KEY_CTRL |= KEY_MANAGER_MASTER_KEY_CTRL_SELECT(select) | KEY_MANAGER_MASTER_KEY_CTRL_LOCK(lock); return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Get Absolute threshold of touch judgement for specified channel. */
u32 CapTouch_GetChAbsThres(CAPTOUCH_TypeDef *CapTouch, u8 Channel)
/* Get Absolute threshold of touch judgement for specified channel. */ u32 CapTouch_GetChAbsThres(CAPTOUCH_TypeDef *CapTouch, u8 Channel)
{ assert_param(IS_CAPTOUCH_ALL_PERIPH(CapTouch)); assert_param(IS_CT_CHANNEL(Channel)); return CapTouch->CT_CH[Channel].ATHR & BIT_CT_CHX_TOUCH_ATHRES; }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Initializes the HRTIMx timer in basic output compare mode. */
void HRTIM_SimpleOC_Init(HRTIM_TypeDef *HRTIMx, uint32_t TimerIdx, HRTIM_BaseInitTypeDef *HRTIM_BaseInitStruct)
/* Initializes the HRTIMx timer in basic output compare mode. */ void HRTIM_SimpleOC_Init(HRTIM_TypeDef *HRTIMx, uint32_t TimerIdx, HRTIM_BaseInitTypeDef *HRTIM_BaseInitStruct)
{ assert_param(IS_HRTIM_TIMERINDEX(TimerIdx)); assert_param(IS_HRTIM_MODE(HRTIM_BaseInitStruct->Mode)); HRTIM_TimingUnitBase_Config(HRTIMx, TimerIdx, HRTIM_BaseInitStruct); }
remotemcu/remcu-chip-sdks
C++
null
436
/* param base Ctimer peripheral base address param cb_func callback function param cb_type callback function type, singular or multiple */
void CTIMER_RegisterCallBack(CTIMER_Type *base, ctimer_callback_t *cb_func, ctimer_callback_type_t cb_type)
/* param base Ctimer peripheral base address param cb_func callback function param cb_type callback function type, singular or multiple */ void CTIMER_RegisterCallBack(CTIMER_Type *base, ctimer_callback_t *cb_func, ctimer_callback_type_t cb_type)
{ uint32_t index = CTIMER_GetInstance(base); s_ctimerCallback[index] = cb_func; ctimerCallbackType[index] = cb_type; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Gets the captured data for a sample sequence using software oversampling. */
void ADCSoftwareOversampleDataGet(unsigned long ulBase, unsigned long ulSequenceNum, unsigned long *pulBuffer, unsigned long ulCount)
/* Gets the captured data for a sample sequence using software oversampling. */ void ADCSoftwareOversampleDataGet(unsigned long ulBase, unsigned long ulSequenceNum, unsigned long *pulBuffer, unsigned long ulCount)
{ unsigned long ulIdx, ulAccum; ASSERT((ulBase == ADC0_BASE) || (ulBase == ADC1_BASE)); ASSERT(ulSequenceNum < 3); ASSERT(((ulSequenceNum == 0) && (ulCount < (8 >> g_pucOversampleFactor[ulSequenceNum]))) || (ulCount < (4 >> g_pucOversampleFactor[ulSequenceNum]))); ulBase += ADC_SEQ + (ADC_SEQ_STEP * ulSequenceNum); while(ulCount--) { ulAccum = 0; for(ulIdx = 1 << g_pucOversampleFactor[ulSequenceNum]; ulIdx; ulIdx--) { ulAccum += HWREG(ulBase + ADC_SSFIFO); } *pulBuffer++ = ulAccum >> g_pucOversampleFactor[ulSequenceNum]; } }
watterott/WebRadio
C++
null
71
/* Rename an interface to a specified new name. */
static int process_rename(int skfd, char *ifname, char *newname)
/* Rename an interface to a specified new name. */ static int process_rename(int skfd, char *ifname, char *newname)
{ char retname[IFNAMSIZ+1]; int len; char * star; len = strlen(newname); star = strchr(newname, '*'); if((len + (star != NULL)) > IFNAMSIZ) { fprintf(stderr, "Error: Interface name `%s' too long.\n", newname); return(-1); } if(if_set_name(skfd, ifname, newname, retname) < 0) { fprintf(stderr, "Error: cannot change name of %s to %s: %s\n", ifname, newname, strerror(errno)); return(-1); } printf("%s\n", retname); return(0); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* parse long timers list and copy those that will expire in the current short timer period */
static void _select_long_timers(void)
/* parse long timers list and copy those that will expire in the current short timer period */ static void _select_long_timers(void)
{ xtimer_t *select_list_start = long_list_head; xtimer_t *select_list_last = NULL; while (long_list_head) { if ((long_list_head->long_target <= _long_cnt) && _this_high_period(long_list_head->target)) { select_list_last = long_list_head; long_list_head = long_list_head->next; } else { break; } } if (select_list_last) { select_list_last->next = NULL; } if (timer_list_head) { if (select_list_last) { timer_list_head = _merge_lists(timer_list_head, select_list_start); } else { } } else { if (select_list_last) { timer_list_head = select_list_start; } } }
labapart/polymcu
C++
null
201
/* Fills each RTC_TimeStruct member with its default value (Time = 00h:00min:00sec). */
void RTC_TimeStructInit(RTC_TimeTypeDef *RTC_TimeStruct)
/* Fills each RTC_TimeStruct member with its default value (Time = 00h:00min:00sec). */ void RTC_TimeStructInit(RTC_TimeTypeDef *RTC_TimeStruct)
{ RTC_TimeStruct->RTC_H12 = RTC_H12_AM; RTC_TimeStruct->RTC_Hours = 0; RTC_TimeStruct->RTC_Minutes = 0; RTC_TimeStruct->RTC_Seconds = 0; }
remotemcu/remcu-chip-sdks
C++
null
436
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */
UINT16 EFIAPI PciWrite16(IN UINTN Address, IN UINT16 Value)
/* If Address > 0x0FFFFFFF, then ASSERT(). If Address is not aligned on a 16-bit boundary, then ASSERT(). */ UINT16 EFIAPI PciWrite16(IN UINTN Address, IN UINT16 Value)
{ return PciCf8Write16 (Address, Value); }
tianocore/edk2
C++
Other
4,240
/* The function is used to Enable frequency clock output and set its divider value. */
void SysCtlFreqDividerOutputEnable(xtBoolean bEnable, unsigned char u8Divider)
/* The function is used to Enable frequency clock output and set its divider value. */ void SysCtlFreqDividerOutputEnable(xtBoolean bEnable, unsigned char u8Divider)
{ xASSERT(u8Divider<=15); if(bEnable) { xHWREG(SYSCLK_FRQDIV) &= ~SYSCLK_FRQDIV_FSEL_M; xHWREG(SYSCLK_FRQDIV) |= u8Divider; xHWREG(SYSCLK_FRQDIV) |= SYSCLK_FRQDIV_FDIV_EN; SysCtlPeripheralEnable(SYSCTL_PERIPH_FDIV); } else { xHWREG(SYSCLK_FRQDIV) &= ~SYSCLK_FRQDIV_FDIV_EN; SysCtlPeripheralDisable(SYSCTL_PERIPH_FDIV); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Software reset. Restore the default values in user registers.. */
int32_t iis2mdc_reset_set(stmdev_ctx_t *ctx, uint8_t val)
/* Software reset. Restore the default values in user registers.. */ int32_t iis2mdc_reset_set(stmdev_ctx_t *ctx, uint8_t val)
{ iis2mdc_cfg_reg_a_t reg; int32_t ret; ret = iis2mdc_read_reg(ctx, IIS2MDC_CFG_REG_A, (uint8_t *) &reg, 1); if (ret == 0) { reg.soft_rst = val; ret = iis2mdc_write_reg(ctx, IIS2MDC_CFG_REG_A, (uint8_t *) &reg, 1); } return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Set up the measurement and comparison timers for calibration. */
static void setup_tc_channels(void)
/* Set up the measurement and comparison timers for calibration. */ static void setup_tc_channels(void)
{ struct tc_config config; tc_get_config_defaults(&config); config.counter_size = TC_COUNTER_SIZE_32BIT; config.clock_prescaler = TC_CLOCK_PRESCALER_DIV1; config.wave_generation = TC_WAVE_GENERATION_NORMAL_FREQ; config.enable_capture_on_channel[0] = true; tc_init(&tc_calib, CONF_TC_MEASUREMENT, &config); config.counter_size = TC_COUNTER_SIZE_16BIT; config.clock_source = REFERENCE_CLOCK; config.enable_capture_on_channel[0] = false; config.counter_16_bit.compare_capture_channel[0] = (1 << CALIBRATION_RESOLUTION); tc_init(&tc_comp, CONF_TC_REFERENCE, &config); }
memfault/zero-to-main
C++
null
200
/* Puts the processor into deep-sleep mode. This function places the processor into deep-sleep mode; it will not return until the processor returns to run mode. */
void SysCtlDeepSleep(void)
/* Puts the processor into deep-sleep mode. This function places the processor into deep-sleep mode; it will not return until the processor returns to run mode. */ void SysCtlDeepSleep(void)
{ xHWREG(NVIC_SYS_CTRL) |= NVIC_SYS_CTRL_SLEEPDEEP; SysCtlPowerDownEnable(1); xCPUwfi(); xHWREG(NVIC_SYS_CTRL) &= ~(NVIC_SYS_CTRL_SLEEPDEEP); SysCtlPowerDownEnable(0); }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Check whether this value represents an NEC data bit 1. */
static bool nec_bit_one_if(rmt_item32_t *item)
/* Check whether this value represents an NEC data bit 1. */ static bool nec_bit_one_if(rmt_item32_t *item)
{ if((item->level0 == RMT_RX_ACTIVE_LEVEL && item->level1 != RMT_RX_ACTIVE_LEVEL) && nec_check_in_range(item->duration0, NEC_BIT_ONE_HIGH_US, NEC_BIT_MARGIN) && nec_check_in_range(item->duration1, NEC_BIT_ONE_LOW_US, NEC_BIT_MARGIN)) { return true; } return false; }
retro-esp32/RetroESP32
C++
Creative Commons Attribution Share Alike 4.0 International
581
/* This is the unlink() entry in the inode_operations structure for regular HFS directories. The purpose is to delete an existing file, given the inode for the parent directory and the name (and its length) of the existing file. */
static int hfs_unlink(struct inode *dir, struct dentry *dentry)
/* This is the unlink() entry in the inode_operations structure for regular HFS directories. The purpose is to delete an existing file, given the inode for the parent directory and the name (and its length) of the existing file. */ static int hfs_unlink(struct inode *dir, struct dentry *dentry)
{ struct inode *inode; int res; inode = dentry->d_inode; res = hfs_cat_delete(inode->i_ino, dir, &dentry->d_name); if (res) return res; drop_nlink(inode); hfs_delete_inode(inode); inode->i_ctime = CURRENT_TIME_SEC; mark_inode_dirty(inode); return res; }
robutest/uclinux
C++
GPL-2.0
60
/* 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_ALLOCATE_TYPE AllocType; EFI_PHYSICAL_ADDRESS Memory; EFI_HOB_HANDOFF_INFO_TABLE *PhitHob; if (Pages == 0) { return NULL; } AllocType = AllocateAnyPages; PhitHob = (EFI_HOB_HANDOFF_INFO_TABLE *)GetHobList (); if (PhitHob->EfiFreeMemoryTop <= MAX_UINT32) { AllocType = AllocateMaxAddress; Memory = MAX_UINT32; } Status = gBS->AllocatePages (AllocType, MemoryType, Pages, &Memory); if (EFI_ERROR (Status)) { return NULL; } return (VOID *)(UINTN)Memory; }
tianocore/edk2
C++
Other
4,240
/* For Guests, device memory can be used as normal memory, so we cast away the __iomem to quieten sparse. */
static void* lguest_map(unsigned long phys_addr, unsigned long pages)
/* For Guests, device memory can be used as normal memory, so we cast away the __iomem to quieten sparse. */ static void* lguest_map(unsigned long phys_addr, unsigned long pages)
{ return (__force void *)ioremap_cache(phys_addr, PAGE_SIZE*pages); }
robutest/uclinux
C++
GPL-2.0
60
/* Disable the FLASH Prefetch Buffer. Note carefully the clock restrictions under which the prefetch buffer may be set to disabled. See the reference manual for details. */
void flash_prefetch_buffer_disable(void)
/* Disable the FLASH Prefetch Buffer. Note carefully the clock restrictions under which the prefetch buffer may be set to disabled. See the reference manual for details. */ void flash_prefetch_buffer_disable(void)
{ FLASH_ACR &= ~FLASH_ACR_PRFTBE; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* Lookup real service by <proto,addr,port> in the real service table. */
struct ip_vs_dest* ip_vs_lookup_real_service(int af, __u16 protocol, const union nf_inet_addr *daddr, __be16 dport)
/* Lookup real service by <proto,addr,port> in the real service table. */ struct ip_vs_dest* ip_vs_lookup_real_service(int af, __u16 protocol, const union nf_inet_addr *daddr, __be16 dport)
{ unsigned hash; struct ip_vs_dest *dest; hash = ip_vs_rs_hashkey(af, daddr, dport); read_lock(&__ip_vs_rs_lock); list_for_each_entry(dest, &ip_vs_rtable[hash], d_list) { if ((dest->af == af) && ip_vs_addr_equal(af, &dest->addr, daddr) && (dest->port == dport) && ((dest->protocol == protocol) || dest->vfwmark)) { read_unlock(&__ip_vs_rs_lock); return dest; } } read_unlock(&__ip_vs_rs_lock); return NULL; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Initializes the timer Stamp adapter module for a timer basic operation. */
void HAL_TimeStampInit(hal_time_stamp_handle_t halTimeStampHandle, hal_time_stamp_config_t *halTimeStampConfig)
/* Initializes the timer Stamp adapter module for a timer basic operation. */ void HAL_TimeStampInit(hal_time_stamp_handle_t halTimeStampHandle, hal_time_stamp_config_t *halTimeStampConfig)
{ hal_time_stamp_handle_struct_t *halTimeStampState = halTimeStampHandle; assert(halTimeStampHandle); halTimeStampState->timeStampInstance = halTimeStampConfig->instance; halTimeStampState->timeStampClock_Hz = halTimeStampConfig->srcClock_Hz; HAL_HWTimeStampInit(halTimeStampHandle); }
eclipse-threadx/getting-started
C++
Other
310
/* Enable interrupts on the WaveLAN hardware. (called by wv_hw_reset()) */
static void wv_ints_on(struct net_device *dev)
/* Enable interrupts on the WaveLAN hardware. (called by wv_hw_reset()) */ static void wv_ints_on(struct net_device *dev)
{ net_local *lp = netdev_priv(dev); unsigned long ioaddr = dev->base_addr; lp->hacr |= HACR_INTRON; hacr_write(ioaddr, lp->hacr); }
robutest/uclinux
C++
GPL-2.0
60
/* DMA callback function for FLEXIO SPI receive transfer. */
static void FLEXIO_SPI_RxDMACallback(dma_handle_t *handle, void *param)
/* DMA callback function for FLEXIO SPI receive transfer. */ static void FLEXIO_SPI_RxDMACallback(dma_handle_t *handle, void *param)
{ flexio_spi_master_dma_private_handle_t *spiPrivateHandle = (flexio_spi_master_dma_private_handle_t *)param; FLEXIO_SPI_EnableDMA(spiPrivateHandle->base, kFLEXIO_SPI_RxDmaEnable, false); DMA_DisableInterrupts(handle->base, handle->channel); spiPrivateHandle->handle->rxInProgress = false; if ((spiPrivateHandle->handle->txInProgress == false) && (spiPrivateHandle->handle->rxInProgress == false)) { if (spiPrivateHandle->handle->callback) { (spiPrivateHandle->handle->callback)(spiPrivateHandle->base, spiPrivateHandle->handle, kStatus_Success, spiPrivateHandle->handle->userData); } } }
labapart/polymcu
C++
null
201
/* Convenience function to produce an ATA read/write sectors command Use cmd=0x20 for read, cmd=0x30 for write */
static void usbat_pack_ata_sector_cmd(unsigned char *buf, unsigned char thistime, u32 sector, unsigned char cmd)
/* Convenience function to produce an ATA read/write sectors command Use cmd=0x20 for read, cmd=0x30 for write */ static void usbat_pack_ata_sector_cmd(unsigned char *buf, unsigned char thistime, u32 sector, unsigned char cmd)
{ buf[0] = 0; buf[1] = thistime; buf[2] = sector & 0xFF; buf[3] = (sector >> 8) & 0xFF; buf[4] = (sector >> 16) & 0xFF; buf[5] = 0xE0 | ((sector >> 24) & 0x0F); buf[6] = cmd; }
robutest/uclinux
C++
GPL-2.0
60
/* Enables or disables the discontinuous mode for injected group channel for the specified ADC. */
void ADC_InjectedDiscModeCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
/* Enables or disables the discontinuous mode for injected group channel for the specified ADC. */ void ADC_InjectedDiscModeCmd(ADC_TypeDef *ADCx, FunctionalState NewState)
{ assert_param(IS_ADC_ALL_PERIPH(ADCx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { ADCx->CR1 |= CR1_JDISCEN_Set; } else { ADCx->CR1 &= CR1_JDISCEN_Reset; } }
gcallipo/RadioDSP-Stm32f103
C++
Common Creative - Attribution 3.0
51
/* Clear the GO_BUSY bit to stop a SPI data transfer. */
void SPIBitGoBusyClear(unsigned long ulBase)
/* Clear the GO_BUSY bit to stop a SPI data transfer. */ void SPIBitGoBusyClear(unsigned long ulBase)
{ xASSERT(ulBase == SPI0_BASE); xHWREG(ulBase + SPI_CNTRL) &= ~SPI_CNTRL_GO_BUSY; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Change Logs: Date Author Notes bernard the first version */
int main(void)
/* Change Logs: Date Author Notes bernard the first version */ int main(void)
{ printf("hello rt-thread\n"); return 0; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Read data from or Write data to USB Endpoint. */
int32_t USBD_EndpointTransfer(uint8_t ep_addr, uint8_t *data, uint32_t num)
/* Read data from or Write data to USB Endpoint. */ int32_t USBD_EndpointTransfer(uint8_t ep_addr, uint8_t *data, uint32_t num)
{ return ARM_DRIVER_ERROR; } if ((USB0_state & USBD_DRIVER_POWERED) == 0U) { return ARM_DRIVER_ERROR; } ptr_dqh = &dQH[EP_IDX(ep_addr)]; if (ptr_dqh->ep_active != 0U) { return ARM_DRIVER_ERROR_BUSY; } ptr_dqh->ep_active = 1U; ptr_dqh->data = data; ptr_dqh->num = num; ptr_dqh->num_transferred_total = 0U; ptr_dqh->num_transferring = 0U; USBD_HW_EndpointTransfer(ep_addr); return ARM_DRIVER_OK; }
labapart/polymcu
C++
null
201
/* brief Return Frequency of External Clock return Frequency of External Clock. If no external clock is used returns 0. */
static uint32_t GetExtClkFreq(void)
/* brief Return Frequency of External Clock return Frequency of External Clock. If no external clock is used returns 0. */ static uint32_t GetExtClkFreq(void)
{ return ((ANACTRL->XO32M_CTRL & ANACTRL_XO32M_CTRL_ENABLE_SYSTEM_CLK_OUT_MASK) != 0UL) ? CLK_CLK_IN : 0U; }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Ends control endpoint IN request (completes usb request), and puts control endpoint into status state */
static void ep0_end_in_req(struct pxa_ep *ep, struct pxa27x_request *req)
/* Ends control endpoint IN request (completes usb request), and puts control endpoint into status state */ static void ep0_end_in_req(struct pxa_ep *ep, struct pxa27x_request *req)
{ set_ep0state(ep->dev, IN_STATUS_STAGE); ep_end_in_req(ep, req); }
robutest/uclinux
C++
GPL-2.0
60
/* Scroll up/down for the number of specified lines. */
void ili93xx_scroll(int32_t ul_lines)
/* Scroll up/down for the number of specified lines. */ void ili93xx_scroll(int32_t ul_lines)
{ if (g_uc_device_type == DEVICE_TYPE_ILI9325) { ili93xx_write_register_word(ILI9325_VERTICAL_SCROLL_CTRL, ul_lines); } else if (g_uc_device_type == DEVICE_TYPE_ILI9341) { uint8_t paratable[2]; paratable[0] = (ul_lines >> 8) & 0xFF; paratable[1] = ul_lines & 0xFF; ili93xx_write_register(ILI9341_CMD_VERT_SCROLL_START_ADDRESS, paratable, 2); } }
remotemcu/remcu-chip-sdks
C++
null
436
/* Displays the given string on the LCD-Display of newer machines. lcd_print() disables/enables the timer-based led work queue to avoid a race condition while writing the CMD/DATA register pair. */
int lcd_print(const char *str)
/* Displays the given string on the LCD-Display of newer machines. lcd_print() disables/enables the timer-based led work queue to avoid a race condition while writing the CMD/DATA register pair. */ int lcd_print(const char *str)
{ int i; if (!led_func_ptr || lcd_info.model != DISPLAY_MODEL_LCD) return 0; if (led_wq) cancel_delayed_work_sync(&led_task); strlcpy(lcd_text, str, sizeof(lcd_text)); gsc_writeb(lcd_info.reset_cmd1, LCD_CMD_REG); udelay(lcd_info.min_cmd_delay); for (i=0; i < lcd_info.lcd_width; i++) { if (str && *str) gsc_writeb(*str++, LCD_DATA_REG); else gsc_writeb(' ', LCD_DATA_REG); udelay(lcd_info.min_cmd_delay); } if (led_wq) { queue_delayed_work(led_wq, &led_task, 0); } return lcd_info.lcd_width; }
robutest/uclinux
C++
GPL-2.0
60
/* Wait for the current command string to execute */
static void dbri_cmdwait(struct snd_dbri *dbri)
/* Wait for the current command string to execute */ static void dbri_cmdwait(struct snd_dbri *dbri)
{ int maxloops = MAXLOOPS; unsigned long flags; spin_lock_irqsave(&dbri->lock, flags); while ((--maxloops) > 0 && (sbus_readl(dbri->regs + REG0) & D_P)) { spin_unlock_irqrestore(&dbri->lock, flags); msleep_interruptible(1); spin_lock_irqsave(&dbri->lock, flags); } spin_unlock_irqrestore(&dbri->lock, flags); if (maxloops == 0) printk(KERN_ERR "DBRI: Chip never completed command buffer\n"); else dprintk(D_CMD, "Chip completed command buffer (%d)\n", MAXLOOPS - maxloops - 1); }
robutest/uclinux
C++
GPL-2.0
60
/* Prevent relocation from stomping on a firmware provided FDT blob. */
unsigned long board_get_usable_ram_top(unsigned long total_size)
/* Prevent relocation from stomping on a firmware provided FDT blob. */ unsigned long board_get_usable_ram_top(unsigned long total_size)
{ if ((gd->ram_top - fw_dtb_pointer) > SZ_64M) return gd->ram_top; return fw_dtb_pointer & ~0xffff; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Supports 1 byte write to TWL RTC registers. */
static int twl_rtc_write_u8(u8 data, u8 reg)
/* Supports 1 byte write to TWL RTC registers. */ static int twl_rtc_write_u8(u8 data, u8 reg)
{ int ret; ret = twl_i2c_write_u8(TWL_MODULE_RTC, data, (rtc_reg_map[reg])); if (ret < 0) pr_err("twl_rtc: Could not write TWL" "register %X - error %d\n", reg, ret); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* UART MSP Initialization This function configures the hardware resources used in this example. */
void HAL_UART_MspInit(UART_HandleTypeDef *huart)
/* UART MSP Initialization This function configures the hardware resources used in this example. */ void HAL_UART_MspInit(UART_HandleTypeDef *huart)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; if(huart->Instance==USART2) { PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART2; PeriphClkInit.Usart2ClockSelection = RCC_USART2CLKSOURCE_PCLK1; if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) { Error_Handler(); } __HAL_RCC_USART2_CLK_ENABLE(); __HAL_RCC_GPIOA_CLK_ENABLE(); GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3; GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; GPIO_InitStruct.Alternate = GPIO_AF7_USART2; HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* send the setup packet to the USB device */
usbh_status usbh_ctlsetup_send(usb_core_driver *pudev, uint8_t *buf, uint8_t pp_num)
/* send the setup packet to the USB device */ usbh_status usbh_ctlsetup_send(usb_core_driver *pudev, uint8_t *buf, uint8_t pp_num)
{ usb_pipe *pp = &pudev->host.pipe[pp_num]; pp->DPID = PIPE_DPID_SETUP; pp->xfer_buf = buf; pp->xfer_len = USB_SETUP_PACKET_LEN; return (usbh_status)usbh_request_submit (pudev, pp_num); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This is the concatenation of target port identifier and logical unit identifier as per SAM-2...SAM-4 annex A. */
static ssize_t sbp2_sysfs_ieee1394_id_show(struct device *dev, struct device_attribute *attr, char *buf)
/* This is the concatenation of target port identifier and logical unit identifier as per SAM-2...SAM-4 annex A. */ static ssize_t sbp2_sysfs_ieee1394_id_show(struct device *dev, struct device_attribute *attr, char *buf)
{ struct scsi_device *sdev = to_scsi_device(dev); struct sbp2_logical_unit *lu; if (!sdev) return 0; lu = sdev->hostdata; return sprintf(buf, "%016llx:%06x:%04x\n", (unsigned long long)lu->tgt->guid, lu->tgt->directory_id, lu->lun); }
robutest/uclinux
C++
GPL-2.0
60
/* In this version we simply downsample each component independently. */
sep_downsample(j_compress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_index, JSAMPIMAGE output_buf, JDIMENSION out_row_group_index)
/* In this version we simply downsample each component independently. */ sep_downsample(j_compress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION in_row_index, JSAMPIMAGE output_buf, JDIMENSION out_row_group_index)
{ my_downsample_ptr downsample = (my_downsample_ptr)cinfo->downsample; int ci; jpeg_component_info* compptr; JSAMPARRAY in_ptr, out_ptr; for (ci = 0, compptr = cinfo->comp_info; ci < cinfo->num_components; ci++, compptr++) { in_ptr = input_buf[ci] + in_row_index; out_ptr = output_buf[ci] + (out_row_group_index * compptr->v_samp_factor); (*downsample->methods[ci]) (cinfo, compptr, in_ptr, out_ptr); } }
nanoframework/nf-interpreter
C++
MIT License
293
/* fills all descriptors in the rx chain: allocates skbs and iommu-maps them. returns 0 on success, < 0 on failure */
static int gelic_card_fill_rx_chain(struct gelic_card *card)
/* fills all descriptors in the rx chain: allocates skbs and iommu-maps them. returns 0 on success, < 0 on failure */ static int gelic_card_fill_rx_chain(struct gelic_card *card)
{ struct gelic_descr *descr = card->rx_chain.head; int ret; do { if (!descr->skb) { ret = gelic_descr_prepare_rx(card, descr); if (ret) goto rewind; } descr = descr->next; } while (descr != card->rx_chain.head); return 0; rewind: gelic_card_release_rx_chain(card); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* param pll Which PLL of targeting PFD to be operated. param pfd Which PFD clock to enable. */
void CLOCK_DeinitPfd(clock_pll_t pll, clock_pfd_t pfd)
/* param pll Which PLL of targeting PFD to be operated. param pfd Which PFD clock to enable. */ void CLOCK_DeinitPfd(clock_pll_t pll, clock_pfd_t pfd)
{ volatile uint32_t *pfdCtrl = NULL; switch (pll) { case kCLOCK_PllSys2: { pfdCtrl = &ANADIG_PLL->SYS_PLL2_PFD; break; } case kCLOCK_PllSys3: { pfdCtrl = &ANADIG_PLL->SYS_PLL3_PFD; break; } default: { assert(false); break; } } *pfdCtrl |= ((uint32_t)ANADIG_PLL_SYS_PLL2_PFD_PFD0_DIV1_CLKGATE_MASK << (8UL * (uint32_t)pfd)); }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Erase All FLASH. This performs all operations necessary to erase all sectors in the FLASH memory. */
void flash_erase_all_sectors(uint32_t program_size)
/* Erase All FLASH. This performs all operations necessary to erase all sectors in the FLASH memory. */ void flash_erase_all_sectors(uint32_t program_size)
{ flash_wait_for_last_operation(); flash_set_program_size(program_size); FLASH_CR |= FLASH_CR_MER; FLASH_CR |= FLASH_CR_STRT; flash_wait_for_last_operation(); FLASH_CR &= ~FLASH_CR_MER; }
insane-adding-machines/unicore-mx
C++
GNU General Public License v3.0
50
/* This function is used to set a timer for a time sometime in the future. The function */
void timer_set(struct timer *t, clock_time_t interval)
/* This function is used to set a timer for a time sometime in the future. The function */ void timer_set(struct timer *t, clock_time_t interval)
{ t->interval = interval; t->start = clock_time(); }
apopple/Pandaboard-FreeRTOS
C++
null
25
/* The example of the function of read and write. */
void M25PxxReadWrite(void)
/* The example of the function of read and write. */ void M25PxxReadWrite(void)
{ unsigned long i; unsigned short ulID; xSysCtlClockSet(50000000, xSYSCTL_OSC_MAIN | xSYSCTL_XTAL_12MHZ); UartInit(); M25PxxInit(10000000); ulID = M25PxxIDcodeGet(); i = ulID; UartPrintfNumber(ulID); UartPrintfChar('\n'); UartPrintfChar('\r'); for(i = 0; i < Length; i++) { ucWriteData[i] = i; } M25PxxChipErase(); M25PxxWrite(ucWriteData, 100, Length); SysCtlDelay(50000000); M25PxxDataRead(ucReadData, 100, Length); for(i = 0; i < Length; i++) { UartPrintfChar(ucReadData[i]); } }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Serializes a 0-length packet into the supplied buffer, ready for writing to a socket */
int mqtt_serialize_zero(unsigned char *buf, int buflen, unsigned char packettype)
/* Serializes a 0-length packet into the supplied buffer, ready for writing to a socket */ int mqtt_serialize_zero(unsigned char *buf, int buflen, unsigned char packettype)
{ mqtt_header_t header = {0}; int rc = -1; unsigned char *ptr = buf; FUNC_ENTRY; if (buflen < 2) { rc = MQTTPACKET_BUFFER_TOO_SHORT; goto exit; } header.byte = 0; header.bits.type = packettype; mqtt_write_char(&ptr, header.byte); ptr += mqtt_packet_encode(ptr, 0); rc = ptr - buf; exit: FUNC_EXIT_RC(rc); return rc; }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* This function exports keying material using the mechanism described in RFC 5705. */
EFI_STATUS EFIAPI TlsGetExportKey(IN VOID *Tls, IN CONST VOID *Label, IN CONST VOID *Context, IN UINTN ContextLen, OUT VOID *KeyBuffer, IN UINTN KeyBufferLen)
/* This function exports keying material using the mechanism described in RFC 5705. */ EFI_STATUS EFIAPI TlsGetExportKey(IN VOID *Tls, IN CONST VOID *Label, IN CONST VOID *Context, IN UINTN ContextLen, OUT VOID *KeyBuffer, IN UINTN KeyBufferLen)
{ CALL_CRYPTO_SERVICE ( TlsGetExportKey, (Tls, Label, Context, ContextLen, KeyBuffer, KeyBufferLen), EFI_UNSUPPORTED ); }
tianocore/edk2
C++
Other
4,240