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
/* Chose preferred mode according to line number of TV format */
static void intel_tv_chose_preferred_modes(struct drm_connector *connector, struct drm_display_mode *mode_ptr)
/* Chose preferred mode according to line number of TV format */ static void intel_tv_chose_preferred_modes(struct drm_connector *connector, struct drm_display_mode *mode_ptr)
{ struct intel_output *intel_output = to_intel_output(connector); const struct tv_mode *tv_mode = intel_tv_mode_find(intel_output); if (tv_mode->nbr_end < 480 && mode_ptr->vdisplay == 480) mode_ptr->type |= DRM_MODE_TYPE_PREFERRED; else if (tv_mode->nbr_end > 480) { if (tv_mode->progressive == true && tv_mode->...
robutest/uclinux
C++
GPL-2.0
60
/* Determins if the specified Generic Clock channel is locked. */
bool system_gclk_chan_is_locked(const uint8_t channel)
/* Determins if the specified Generic Clock channel is locked. */ bool system_gclk_chan_is_locked(const uint8_t channel)
{ bool locked; system_interrupt_enter_critical_section(); locked = GCLK->PCHCTRL[channel].bit.WRTLOCK; system_interrupt_leave_critical_section(); return locked; }
memfault/zero-to-main
C++
null
200
/* Returns a newly built URI or NULL in case of error */
URI* uri_parse_raw(const char *str, int raw)
/* Returns a newly built URI or NULL in case of error */ URI* uri_parse_raw(const char *str, int raw)
{ if (raw) { uri->cleanup |= 2; } ret = uri_parse_into(uri, str); if (ret) { uri_free(uri); return(NULL); } } return(uri); }
ve3wwg/teensy3_qemu
C++
Other
15
/* Defines the length of the delay which is applied after a conversion or a sequence of conversion. */
void ADC_DelaySelectionConfig(ADC_TypeDef *ADCx, uint8_t ADC_DelayLength)
/* Defines the length of the delay which is applied after a conversion or a sequence of conversion. */ void ADC_DelaySelectionConfig(ADC_TypeDef *ADCx, uint8_t ADC_DelayLength)
{ uint32_t tmpreg = 0; assert_param(IS_ADC_ALL_PERIPH(ADCx)); assert_param(IS_ADC_DELAY_LENGTH(ADC_DelayLength)); tmpreg = ADCx->CR2; tmpreg &= CR2_DELS_RESET; tmpreg |= ADC_DelayLength; ADCx->CR2 = tmpreg; }
avem-labs/Avem
C++
MIT License
1,752
/* If both RegsiteredData and InputData is NULL, then ASSERT(). */
BOOLEAN IsKeyRegistered(IN EFI_KEY_DATA *RegsiteredData, IN EFI_KEY_DATA *InputData)
/* If both RegsiteredData and InputData is NULL, then ASSERT(). */ BOOLEAN IsKeyRegistered(IN EFI_KEY_DATA *RegsiteredData, IN EFI_KEY_DATA *InputData)
{ ASSERT (RegsiteredData != NULL && InputData != NULL); if ((RegsiteredData->Key.ScanCode != InputData->Key.ScanCode) || (RegsiteredData->Key.UnicodeChar != InputData->Key.UnicodeChar)) { return FALSE; } return TRUE; }
tianocore/edk2
C++
Other
4,240
/* set the configuration value to the connected device */
usbh_status usbh_setcfg(usbh_host *puhost, uint16_t config_index)
/* set the configuration value to the connected device */ usbh_status usbh_setcfg(usbh_host *puhost, uint16_t config_index)
{ usbh_status status = USBH_BUSY; usbh_control *usb_ctl = &puhost->control; if (CTL_IDLE == usb_ctl->ctl_state) { usb_ctl->setup.req = (usb_req) { .bmRequestType = USB_TRX_OUT | USB_RECPTYPE_DEV | USB_REQTYPE_STRD, .bRequest = USB_SET_CONFIGURATION, .wValue ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param base ENET peripheral base address. param mask ENET interrupts to disables. This is a logical OR of both enumeration :: enet_dma_interrupt_enable_t and enet_mac_interrupt_enable_t. */
void ENET_DisableInterrupts(ENET_Type *base, uint32_t mask)
/* param base ENET peripheral base address. param mask ENET interrupts to disables. This is a logical OR of both enumeration :: enet_dma_interrupt_enable_t and enet_mac_interrupt_enable_t. */ void ENET_DisableInterrupts(ENET_Type *base, uint32_t mask)
{ uint32_t interrupt = mask & 0xFFFFU; uint8_t index; if (interrupt != 0U) { for (index = 0; index < ENET_RING_NUM_MAX; index++) { if ((ENET_ABNORM_INT_MASK & interrupt) != 0U) { interrupt |= ENET_DMA_CH_DMA_CHX_INT_EN_AIE_MASK; } ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Initiates a read packet operation without sending a STOP condition when done. This is the non-blocking equivalent of i2c_master_read_packet_wait_no_stop. */
enum status_code i2c_master_read_packet_job_no_stop(struct i2c_master_module *const module, struct i2c_master_packet *const packet)
/* Initiates a read packet operation without sending a STOP condition when done. This is the non-blocking equivalent of i2c_master_read_packet_wait_no_stop. */ enum status_code i2c_master_read_packet_job_no_stop(struct i2c_master_module *const module, struct i2c_master_packet *const packet)
{ Assert(module); Assert(module->hw); Assert(packet); if (module->buffer_remaining > 0) { return STATUS_BUSY; } module->send_stop = false; module->send_nack = true; return _i2c_master_read_packet(module, packet); }
memfault/zero-to-main
C++
null
200
/* get MAC's input Port return : PA or PB */
int cfm_get_mac_input(struct s_smc *smc)
/* get MAC's input Port return : PA or PB */ int cfm_get_mac_input(struct s_smc *smc)
{ return((smc->mib.fddiSMTCF_State == SC10_C_WRAP_B || smc->mib.fddiSMTCF_State == SC5_THRU_B) ? PB : PA) ; }
robutest/uclinux
C++
GPL-2.0
60
/* This function will judge the object is system object or not. Normally, the system object is a static object and the type of object set to RT_Object_Class_Static. */
rt_bool_t rt_object_is_systemobject(rt_object_t object)
/* This function will judge the object is system object or not. Normally, the system object is a static object and the type of object set to RT_Object_Class_Static. */ rt_bool_t rt_object_is_systemobject(rt_object_t object)
{ RT_ASSERT(object != RT_NULL); if (object->type & RT_Object_Class_Static) return RT_TRUE; return RT_FALSE; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Add a route entry to the route table. It is the help function for EfiIp6Routes. */
EFI_STATUS Ip6AddRoute(IN OUT IP6_ROUTE_TABLE *RtTable, IN EFI_IPv6_ADDRESS *Destination, IN UINT8 PrefixLength, IN EFI_IPv6_ADDRESS *GatewayAddress)
/* Add a route entry to the route table. It is the help function for EfiIp6Routes. */ EFI_STATUS Ip6AddRoute(IN OUT IP6_ROUTE_TABLE *RtTable, IN EFI_IPv6_ADDRESS *Destination, IN UINT8 PrefixLength, IN EFI_IPv6_ADDRESS *GatewayAddress)
{ LIST_ENTRY *ListHead; LIST_ENTRY *Entry; IP6_ROUTE_ENTRY *Route; ListHead = &RtTable->RouteArea[PrefixLength]; NET_LIST_FOR_EACH (Entry, ListHead) { Route = NET_LIST_USER_STRUCT (Entry, IP6_ROUTE_ENTRY, Link); if (NetIp6IsNetEqual (Destination, &Route->Destination, PrefixLength) && ...
tianocore/edk2
C++
Other
4,240
/* Create and start the heartbeat timer for the TCP driver. */
EFI_STATUS TcpCreateTimer(VOID)
/* Create and start the heartbeat timer for the TCP driver. */ EFI_STATUS TcpCreateTimer(VOID)
{ EFI_STATUS Status; Status = EFI_SUCCESS; if (mTcpTimer.RefCnt == 0) { Status = gBS->CreateEvent ( EVT_TIMER | EVT_NOTIFY_SIGNAL, TPL_NOTIFY, TcpTicking, NULL, &mTcpTimer.TimerEvent ); ...
tianocore/edk2
C++
Other
4,240
/* This is called once the reference count for the object reaches 0. We forward the call to the device's release method, which should handle actually freeing the structure. */
static void device_release(struct kobject *kobj)
/* This is called once the reference count for the object reaches 0. We forward the call to the device's release method, which should handle actually freeing the structure. */ static void device_release(struct kobject *kobj)
{ struct device *dev = to_dev(kobj); struct device_private *p = dev->p; if (dev->release) dev->release(dev); else if (dev->type && dev->type->release) dev->type->release(dev); else if (dev->class && dev->class->dev_release) dev->class->dev_release(dev); else WARN(1, KERN_ERR "Device '%s' does not have a r...
robutest/uclinux
C++
GPL-2.0
60
/* Requests the bootloader to erase the specified range of memory on the target. The bootloader aligns this range to hardware specified erase blocks. */
static bool XcpLoaderClearMemory(uint32_t address, uint32_t len)
/* Requests the bootloader to erase the specified range of memory on the target. The bootloader aligns this range to hardware specified erase blocks. */ static bool XcpLoaderClearMemory(uint32_t address, uint32_t len)
{ bool result = false; assert(len > 0); assert(xcpSettings.transport != NULL); if ( (len > 0) && (xcpSettings.transport != NULL) && (xcpConnected) ) { result = true; if (!XcpLoaderSendCmdSetMta(address)) { result = false; } if (result) { if (!XcpLoaderSendCmdProgramClear(le...
feaser/openblt
C++
GNU General Public License v3.0
601
/* BTW remember: "addr" is allowed to be not aligned in IP options! */
void ip_rt_get_source(u8 *addr, struct rtable *rt)
/* BTW remember: "addr" is allowed to be not aligned in IP options! */ void ip_rt_get_source(u8 *addr, struct rtable *rt)
{ __be32 src; struct fib_result res; if (rt->fl.iif == 0) src = rt->rt_src; else if (fib_lookup(dev_net(rt->u.dst.dev), &rt->fl, &res) == 0) { src = FIB_RES_PREFSRC(res); fib_res_put(&res); } else src = inet_select_addr(rt->u.dst.dev, rt->rt_gateway, RT_SCOPE_UNIVERSE); memcpy(addr, &src, 4); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Description: This is the hashing function for the domain hash table, it returns the correct bucket number for the domain. The caller is responsibile for calling the rcu_read_lock() functions. */
static u32 netlbl_domhsh_hash(const char *key)
/* Description: This is the hashing function for the domain hash table, it returns the correct bucket number for the domain. The caller is responsibile for calling the rcu_read_lock() functions. */ static u32 netlbl_domhsh_hash(const char *key)
{ u32 iter; u32 val; u32 len; for (iter = 0, val = 0, len = strlen(key); iter < len; iter++) val = (val << 4 | (val >> (8 * sizeof(u32) - 4))) ^ key[iter]; return val & (rcu_dereference(netlbl_domhsh)->size - 1); }
EmcraftSystems/linux-emcraft
C++
Other
266
/* Return with the pointer of the previous node after 'n_act' */
void* lv_ll_get_prev(const lv_ll_t *ll_p, const void *n_act)
/* Return with the pointer of the previous node after 'n_act' */ void* lv_ll_get_prev(const lv_ll_t *ll_p, const void *n_act)
{ void * prev = NULL; if(ll_p != NULL) { const lv_ll_node_t * n_act_d = n_act; memcpy(&prev, n_act_d + LL_PREV_P_OFFSET(ll_p), sizeof(void *)); } return prev; }
RavenSystem/esp-homekit-devices
C++
Other
2,577
/* Reset Timer Counter. This function is used to reset timer counter. */
void TimerReset(unsigned long ulBase)
/* Reset Timer Counter. This function is used to reset timer counter. */ void TimerReset(unsigned long ulBase)
{ xASSERT((ulBase == TIMER0_BASE) || (ulBase == TIMER1_BASE) || (ulBase == TIMER2_BASE) || (ulBase == TIMER3_BASE) ); xHWREG(ulBase + TIMER_TCR) |= TCR_CNT_RST; xHWREG(ulBase + TIMER_TCR) &= ~TCR_CNT_RST; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Initialize the DMA Channel for a single buffer transfer. */
void dmac_channel_single_buf_transfer_init(Dmac *p_dmac, uint32_t ul_num, dma_transfer_descriptor_t *p_desc)
/* Initialize the DMA Channel for a single buffer transfer. */ void dmac_channel_single_buf_transfer_init(Dmac *p_dmac, uint32_t ul_num, dma_transfer_descriptor_t *p_desc)
{ Assert(p_dmac); Assert(ul_num<=3); Assert(p_desc); p_dmac->DMAC_EBCISR; dmac_channel_set_source_addr(p_dmac, ul_num, p_desc->ul_source_addr); dmac_channel_set_destination_addr(p_dmac, ul_num, p_desc->ul_destination_addr); dmac_channel_set_descriptor_addr(p_dmac, ul_num, 0); dmac_channel_set_ctrlA(p_dmac, u...
remotemcu/remcu-chip-sdks
C++
null
436
/* It is important to ensure that processes don't try to take locks on non-contiguous ranges of pages as that might deadlock. This function should be called before attempting to wait on a locked nfs_page. It will complete the I/O if the page index 'index' is not contiguous with the existing list of pages in 'desc'. */
void nfs_pageio_cond_complete(struct nfs_pageio_descriptor *desc, pgoff_t index)
/* It is important to ensure that processes don't try to take locks on non-contiguous ranges of pages as that might deadlock. This function should be called before attempting to wait on a locked nfs_page. It will complete the I/O if the page index 'index' is not contiguous with the existing list of pages in 'desc'. */...
{ if (!list_empty(&desc->pg_list)) { struct nfs_page *prev = nfs_list_entry(desc->pg_list.prev); if (index != prev->wb_index + 1) nfs_pageio_doio(desc); } }
robutest/uclinux
C++
GPL-2.0
60
/* Get GPIO port mask register of the specified GPIO pin(s). */
long GPIOPortMaskGet(unsigned long ulPort)
/* Get GPIO port mask register of the specified GPIO pin(s). */ long GPIOPortMaskGet(unsigned long ulPort)
{ unsigned long ulPortBase; unsigned long ulPinMask; xASSERT(GPIOBaseValid(ulPort)); ulPortBase = GPIOToPortGet(ulPort); ulPinMask = xHWREG(ulPortBase + PORT_GPCHR); ulPinMask = ulPinMask << 16; ulPinMask |= xHWREG(ulPortBase + PORT_GPCLR); return ulPinMask; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Set the display top left drawing limit. Use this function to set the top left limit of the drawing limit box. */
void ili9325_set_top_left_limit(ili9325_coord_t x, ili9325_coord_t y)
/* Set the display top left drawing limit. Use this function to set the top left limit of the drawing limit box. */ void ili9325_set_top_left_limit(ili9325_coord_t x, ili9325_coord_t y)
{ limit_start_x = x; limit_start_y = y; ili9325_send_draw_limits(false); }
remotemcu/remcu-chip-sdks
C++
null
436
/* Checks whether the specified I2C interrupt has occurred or not. */
ITStatus I2C_GetITStatus(I2C_TypeDef *I2Cx, uint32_t I2C_IT)
/* Checks whether the specified I2C interrupt has occurred or not. */ ITStatus I2C_GetITStatus(I2C_TypeDef *I2Cx, uint32_t I2C_IT)
{ ITStatus bitstatus = RESET; uint32_t enablestatus = 0; assert_param(IS_I2C_ALL_PERIPH(I2Cx)); assert_param(IS_I2C_GET_IT(I2C_IT)); enablestatus = (uint32_t)(((I2C_IT & ITEN_MASK) >> 16) & (I2Cx->CR2)) ; I2C_IT &= FLAG_MASK; if (((I2Cx->SR1 & I2C_IT) != (uint32_t)RESET) && enablestatus) { bitstatus...
MaJerle/stm32f429
C++
null
2,036
/* The callback argument specifies a function that returns a whitespace string or NULL before and after each element. If MXML_NO_CALLBACK is specified, whitespace will only be added before MXML_TEXT nodes with leading whitespace and before attribute names inside opening element tags. */
char* mxmlSaveAllocString(mxml_node_t *node, mxml_save_cb_t cb)
/* The callback argument specifies a function that returns a whitespace string or NULL before and after each element. If MXML_NO_CALLBACK is specified, whitespace will only be added before MXML_TEXT nodes with leading whitespace and before attribute names inside opening element tags. */ char* mxmlSaveAllocString(mxml_...
{ int bytes; char *s; size_t bs = 8192; s = malloc(bs); bytes = mxmlSaveString(node, s, bs, cb); if (bytes <= 0) { free(s); return (NULL); } if (bytes < (int)bs - 1) { return s; } free(s); if ((s = malloc(bytes + 1)) == NULL) { return (NULL); } mxmlSaveString(node, s, bytes + ...
DC-SWAT/DreamShell
C++
null
404
/* If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT(). */
VOID* EFIAPI InvalidateDataCacheRange(IN VOID *Address, IN UINTN Length)
/* If Length is greater than (MAX_ADDRESS - Address + 1), then ASSERT(). */ VOID* EFIAPI InvalidateDataCacheRange(IN VOID *Address, IN UINTN Length)
{ ASSERT (Length <= MAX_ADDRESS - (UINTN)Address + 1); return Address; }
tianocore/edk2
C++
Other
4,240
/* omap_enable_ecc - This function enables the hardware ecc functionality @mtd: MTD device structure @mode: Read/Write mode */
static void omap_enable_hwecc(struct mtd_info *mtd, int32_t mode)
/* omap_enable_ecc - This function enables the hardware ecc functionality @mtd: MTD device structure @mode: Read/Write mode */ static void omap_enable_hwecc(struct mtd_info *mtd, int32_t mode)
{ struct nand_chip *chip = mtd->priv; uint32_t val, dev_width = (chip->options & NAND_BUSWIDTH_16) >> 1; switch (mode) { case NAND_ECC_READ: case NAND_ECC_WRITE: writel(ECCCLEAR | ECCRESULTREG1, &gpmc_cfg->ecc_control); writel(ECCSIZE1 | ECCSIZE0 | ECCSIZE0SEL, &gpmc_cfg->ecc_size_config); val = (dev_widt...
EmcraftSystems/u-boot
C++
Other
181
/* Read Status Register. The RDSR instruction is for reading Status Register Bits. */
enum status_code mx25v_read_status(uint8_t *value)
/* Read Status Register. The RDSR instruction is for reading Status Register Bits. */ enum status_code mx25v_read_status(uint8_t *value)
{ enum status_code status; uint8_t tx_buf[1] = {MX25V_CMD_RDSR}; _mx25v_chip_select(); status = spi_write_buffer_wait(&_mx25v_spi, tx_buf, 1); if (status != STATUS_OK) { return STATUS_ERR_IO; } status = spi_read_buffer_wait(&_mx25v_spi, value, 1, 0); if (status != STATUS_OK) { return STATUS_ERR_IO; } _mx2...
memfault/zero-to-main
C++
null
200
/* ibmvfc_relogin - Log back into the specified device @sdev: scsi device struct */
static void ibmvfc_relogin(struct scsi_device *sdev)
/* ibmvfc_relogin - Log back into the specified device @sdev: scsi device struct */ static void ibmvfc_relogin(struct scsi_device *sdev)
{ struct ibmvfc_host *vhost = shost_priv(sdev->host); struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); struct ibmvfc_target *tgt; list_for_each_entry(tgt, &vhost->targets, queue) { if (rport == tgt->rport) { ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT); break; } } ibmvfc_reinit_h...
robutest/uclinux
C++
GPL-2.0
60
/* Enables the SysTick counter. This will start the SysTick counter. If an interrupt handler has been registered, it will be called when the SysTick counter rolls over. */
void xSysTickEnable(void)
/* Enables the SysTick counter. This will start the SysTick counter. If an interrupt handler has been registered, it will be called when the SysTick counter rolls over. */ void xSysTickEnable(void)
{ xHWREG(NVIC_ST_CTRL) |= NVIC_ST_CTRL_CLK_SRC | NVIC_ST_CTRL_ENABLE; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* Get the target settings for the bus mode. */
VOID EmmcGetTargetBusMode(IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 SlotIndex, IN EMMC_EXT_CSD *ExtCsd, OUT SD_MMC_BUS_SETTINGS *BusMode)
/* Get the target settings for the bus mode. */ VOID EmmcGetTargetBusMode(IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 SlotIndex, IN EMMC_EXT_CSD *ExtCsd, OUT SD_MMC_BUS_SETTINGS *BusMode)
{ BusMode->BusTiming = EmmcGetTargetBusTiming (Private, SlotIndex, ExtCsd); BusMode->BusWidth = EmmcGetTargetBusWidth (Private, SlotIndex, ExtCsd, BusMode->BusTiming); BusMode->ClockFreq = EmmcGetTargetClockFreq (Private, SlotIndex, ExtCsd, BusMode->BusTiming); BusMode->DriverStrength = EmmcGetT...
tianocore/edk2
C++
Other
4,240
/* NCH DRX information This is a variable length element used to pass a radio interface information element from BSC to BTS. */
static int dissect_rsl_ie_nch_drx(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
/* NCH DRX information This is a variable length element used to pass a radio interface information element from BSC to BTS. */ static int dissect_rsl_ie_nch_drx(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset, gboolean is_mandatory)
{ proto_tree *ie_tree; guint8 ie_id; if (is_mandatory == FALSE) { ie_id = tvb_get_guint8(tvb, offset); if (ie_id != RSL_IE_NCH_DRX_INF) return offset; } ie_tree = proto_tree_add_subtree(tree, tvb, offset, 2, ett_ie_nch_drx, NULL, "NCH DRX information IE"); proto_...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Set a new heartbeat value for the watchdog device. If the heartbeat value is incorrect we keep the old value and return -EINVAL. If successful we return 0. */
static int wdtpci_set_heartbeat(int t)
/* Set a new heartbeat value for the watchdog device. If the heartbeat value is incorrect we keep the old value and return -EINVAL. If successful we return 0. */ static int wdtpci_set_heartbeat(int t)
{ if (t < 1 || t > 65535) return -EINVAL; heartbeat = t; wd_heartbeat = t * 100; return 0; }
robutest/uclinux
C++
GPL-2.0
60
/* Internal function to draw horizontal line of RGBA color with alpha blending. */
int _HLineAlpha(SDL_Surface *dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)
/* Internal function to draw horizontal line of RGBA color with alpha blending. */ int _HLineAlpha(SDL_Surface *dst, Sint16 x1, Sint16 x2, Sint16 y, Uint32 color)
{ return (filledRectAlpha(dst, x1, y, x2, y, color)); }
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* This is called to free all resources allocated by @gaudio_setup(). */
void gaudio_cleanup(void)
/* This is called to free all resources allocated by @gaudio_setup(). */ void gaudio_cleanup(void)
{ if (the_card) { gaudio_close_snd_dev(the_card); the_card = NULL; } }
robutest/uclinux
C++
GPL-2.0
60
/* Read the value of a specific register in the controller. Use this function to get the value of a specific register in the display controller. */
uint8_t hx8347a_read_register(uint8_t address)
/* Read the value of a specific register in the controller. Use this function to get the value of a specific register in the display controller. */ uint8_t hx8347a_read_register(uint8_t address)
{ uint8_t value; hx8347a_select_register(address); hx8347a_select_chip(); hx8347a_send_byte(HX8347A_START_READREG); value = hx8347a_read_byte(); hx8347a_deselect_chip(); return value; }
remotemcu/remcu-chip-sdks
C++
null
436
/* 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; }
4ms/stm32mp1-baremetal
C++
Other
137
/* Copy a string of all phone-numbers of an interface to user space. This might sleep and must be called with the isdn semaphore down. */
int isdn_net_getphones(isdn_net_ioctl_phone *phone, char __user *phones)
/* Copy a string of all phone-numbers of an interface to user space. This might sleep and must be called with the isdn semaphore down. */ int isdn_net_getphones(isdn_net_ioctl_phone *phone, char __user *phones)
{ isdn_net_dev *p = isdn_net_findif(phone->name); int inout = phone->outgoing & 1; int more = 0; int count = 0; isdn_net_phone *n; if (!p) return -ENODEV; inout &= 1; for (n = p->local->phone[inout]; n; n = n->next) { if (more) { put_user(' ', phones++); count++; } if (copy_to_user(phones, n->num,...
robutest/uclinux
C++
GPL-2.0
60
/* Enable or disable the specified analog watchdog interrupts. */
void ADC_AWD_IntCmd(CM_ADC_TypeDef *ADCx, uint16_t u16IntType, en_functional_state_t enNewState)
/* Enable or disable the specified analog watchdog interrupts. */ void ADC_AWD_IntCmd(CM_ADC_TypeDef *ADCx, uint16_t u16IntType, en_functional_state_t enNewState)
{ DDL_ASSERT(IS_ADC_UNIT(ADCx)); DDL_ASSERT(IS_ADC_AWD_INT(u16IntType)); DDL_ASSERT(IS_FUNCTIONAL_STATE(enNewState)); static uint16_t u16AWDIntSeq = 0U; if (enNewState == ENABLE) { SET_REG16_BIT(ADCx->AWDCR, u16IntType | ADC_AWDCR_AWDIEN); u16AWDIntSeq |= u16IntType; } else { ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* This I2C function sends a command to the device. */
uint8_t sha204p_send_command(uint8_t count, uint8_t *command)
/* This I2C function sends a command to the device. */ uint8_t sha204p_send_command(uint8_t count, uint8_t *command)
{ return sha204p_send(SHA204_I2C_PACKET_FUNCTION_NORMAL, count, command); }
remotemcu/remcu-chip-sdks
C++
null
436
/* adds a new prototype into list of prototypes */
static Proto* addprototype(LexState *ls)
/* adds a new prototype into list of prototypes */ static Proto* addprototype(LexState *ls)
{ int oldsize = f->sizep; luaM_growvector(L, f->p, fs->np, f->sizep, Proto *, MAXARG_Bx, "functions"); while (oldsize < f->sizep) f->p[oldsize++] = NULL; } f->p[fs->np++] = clp = luaF_newproto(L); luaC_objbarrier(L, f, clp); return clp; }
opentx/opentx
C++
GNU General Public License v2.0
2,025
/* Closes the open data log file on the Dataflash's FAT formatted partition */
void CloseLogFile(void)
/* Closes the open data log file on the Dataflash's FAT formatted partition */ void CloseLogFile(void)
{ f_sync(&TempLogFile); f_close(&TempLogFile); }
prusa3d/Prusa-Firmware-Buddy
C++
Other
1,019
/* user call this function to send data to cdc device */
void usb_host_cdc_senddata(uint8_t *data, uint16_t length)
/* user call this function to send data to cdc device */ void usb_host_cdc_senddata(uint8_t *data, uint16_t length)
{ if (CDC_TxParam.CDCState == CDC_IDLE) { CDC_TxParam.pRxTxBuff = data; CDC_TxParam.DataLength = length; CDC_TxParam.CDCState = CDC_SEND_DATA; } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Retrieves the current module status. Checks the status of the module and returns it as a bitmask of status flags. */
uint32_t dac_get_status(struct dac_module *const module_inst)
/* Retrieves the current module status. Checks the status of the module and returns it as a bitmask of status flags. */ uint32_t dac_get_status(struct dac_module *const module_inst)
{ Assert(module_inst); Assert(module_inst->hw); Dac *const dac_module = module_inst->hw; uint8_t intflags = dac_module->INTFLAG.reg; uint32_t status_flags = 0; if (intflags & DAC_INTFLAG_EMPTY) { status_flags |= DAC_STATUS_CHANNEL_0_EMPTY; } if (intflags & DAC_INTFLAG_UNDERRUN) { status_flags |= DAC_STATUS_...
memfault/zero-to-main
C++
null
200
/* Finish a raw "set table" operation, where 'slot' is where the value should have been (the result of a previous "get table"). Beware: when using this function you probably need to check a GC barrier and invalidate the TM cache. */
void luaH_finishset(lua_State *L, Table *t, const TValue *key, const TValue *slot, TValue *value)
/* Finish a raw "set table" operation, where 'slot' is where the value should have been (the result of a previous "get table"). Beware: when using this function you probably need to check a GC barrier and invalidate the TM cache. */ void luaH_finishset(lua_State *L, Table *t, const TValue *key, const TValue *slot, TVa...
{ if (isabstkey(slot)) luaH_newkey(L, t, key, value); else setobj2t(L, cast(TValue *, slot), value); }
Nicholas3388/LuaNode
C++
Other
1,055
/* brief Gets the slave transfer status during a non-blocking transfer. param base The I3C peripheral base address. param handle Pointer to i2c_slave_handle_t structure. param count Pointer to a value to hold the number of bytes transferred. May be NULL if the count is not required. retval #kStatus_Success retval #kSta...
status_t I3C_SlaveTransferGetCount(I3C_Type *base, i3c_slave_handle_t *handle, size_t *count)
/* brief Gets the slave transfer status during a non-blocking transfer. param base The I3C peripheral base address. param handle Pointer to i2c_slave_handle_t structure. param count Pointer to a value to hold the number of bytes transferred. May be NULL if the count is not required. retval #kStatus_Success retval #kSta...
{ assert(NULL != handle); if (NULL == count) { return kStatus_InvalidArgument; } if (!handle->isBusy) { *count = 0; return kStatus_NoTransferInProgress; } *count = handle->transferredCount; return kStatus_Success; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Writes a value on the given register and updates the register cache. The cached values are used for the cached-read and the suspend/resume. */
void snd_ac97_write_cache(struct snd_ac97 *ac97, unsigned short reg, unsigned short value)
/* Writes a value on the given register and updates the register cache. The cached values are used for the cached-read and the suspend/resume. */ void snd_ac97_write_cache(struct snd_ac97 *ac97, unsigned short reg, unsigned short value)
{ if (!snd_ac97_valid_reg(ac97, reg)) return; mutex_lock(&ac97->reg_mutex); ac97->regs[reg] = value; ac97->bus->ops->write(ac97, reg, value); set_bit(reg, ac97->reg_accessed); mutex_unlock(&ac97->reg_mutex); }
robutest/uclinux
C++
GPL-2.0
60
/* Change Logs: Date Author Notes Bernard The first version */
int tcgetattr(int fd, struct termios *tio)
/* Change Logs: Date Author Notes Bernard The first version */ int tcgetattr(int fd, struct termios *tio)
{ if (ioctl(fd, TCGETA, tio)) return -1; return 0; }
pikasTech/PikaPython
C++
MIT License
1,403
/* Converts an ucs4 string into an utf8 string. */
enum CRStatus cr_utils_ucs4_str_to_utf8(const guint32 *a_in, gulong *a_in_len, guchar **a_out, gulong *a_out_len)
/* Converts an ucs4 string into an utf8 string. */ enum CRStatus cr_utils_ucs4_str_to_utf8(const guint32 *a_in, gulong *a_in_len, guchar **a_out, gulong *a_out_len)
{ enum CRStatus status = CR_OK; g_return_val_if_fail (a_in && a_in_len && a_out && a_out_len, CR_BAD_PARAM_ERROR); status = cr_utils_ucs4_str_len_as_utf8 (a_in, &a_in[*a_out_len - 1], ...
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* This is basically a NAK. (single clock pulse, data high) */
static void sht15_end_transmission(struct sht15_data *data)
/* This is basically a NAK. (single clock pulse, data high) */ static void sht15_end_transmission(struct sht15_data *data)
{ gpio_direction_output(data->pdata->gpio_data, 1); ndelay(SHT15_TSU); gpio_set_value(data->pdata->gpio_sck, 1); ndelay(SHT15_TSCKH); gpio_set_value(data->pdata->gpio_sck, 0); ndelay(SHT15_TSCKL); }
robutest/uclinux
C++
GPL-2.0
60
/* Gets the interrupt status for a PWM module. */
unsigned long PWMIntStatus(unsigned long ulBase, tBoolean bMasked)
/* Gets the interrupt status for a PWM module. */ unsigned long PWMIntStatus(unsigned long ulBase, tBoolean bMasked)
{ ASSERT((ulBase == PWM0_BASE) || (ulBase == PWM1_BASE)); if(bMasked == true) { return(HWREG(ulBase + PWM_O_ISC)); } else { return(HWREG(ulBase + PWM_O_RIS)); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* compute BRG and DIV bits to setup spi clock based on main input clock rate that was specified in platform data structure according to au1550 datasheet: psc_tempclk = psc_mainclk / (2 << DIV) spiclk = psc_tempclk / (2 * (BRG + 1)) BRG valid range is 4..63 DIV valid range is 0..3 */
static u32 au1550_spi_baudcfg(struct au1550_spi *hw, unsigned speed_hz)
/* compute BRG and DIV bits to setup spi clock based on main input clock rate that was specified in platform data structure according to au1550 datasheet: psc_tempclk = psc_mainclk / (2 << DIV) spiclk = psc_tempclk / (2 * (BRG + 1)) BRG valid range is 4..63 DIV valid range is 0..3 */ static u32 au1550_spi_baudcfg(stru...
{ u32 mainclk_hz = hw->pdata->mainclk_hz; u32 div, brg; for (div = 0; div < 4; div++) { brg = mainclk_hz / speed_hz / (4 << div); if (brg < (4 + 1)) { brg = (4 + 1); break; } if (brg <= (63 + 1)) break; } if (div == 4) { div = 3; brg = (63 + 1); } brg--; return PSC_SPICFG_SET_BAUD(brg) | PS...
robutest/uclinux
C++
GPL-2.0
60
/* Configures User push-button in GPIO or EXTI Line Mode. */
void UserButton_Init(void)
/* Configures User push-button in GPIO or EXTI Line Mode. */ void UserButton_Init(void)
{ USER_BUTTON_GPIO_CLK_ENABLE(); LL_GPIO_SetPinMode(USER_BUTTON_GPIO_PORT, USER_BUTTON_PIN, LL_GPIO_MODE_INPUT); LL_GPIO_SetPinPull(USER_BUTTON_GPIO_PORT, USER_BUTTON_PIN, LL_GPIO_PULL_NO); USER_BUTTON_SYSCFG_SET_EXTI(); USER_BUTTON_EXTI_LINE_ENABLE(); USER_BUTTON_EXTI_FALLING_TRIG_ENABLE(); NVIC_EnableIR...
STMicroelectronics/STM32CubeF4
C++
Other
789
/* ssp_set_clkdiv - set SSP clock divider @div: serial clock rate divider */
static void ssp_set_scr(struct ssp_device *ssp, u32 div)
/* ssp_set_clkdiv - set SSP clock divider @div: serial clock rate divider */ static void ssp_set_scr(struct ssp_device *ssp, u32 div)
{ u32 sscr0 = ssp_read_reg(ssp, SSCR0); if (cpu_is_pxa25x() && ssp->type == PXA25x_SSP) { sscr0 &= ~0x0000ff00; sscr0 |= ((div - 2)/2) << 8; } else { sscr0 &= ~0x000fff00; sscr0 |= (div - 1) << 8; } ssp_write_reg(ssp, SSCR0, sscr0); }
robutest/uclinux
C++
GPL-2.0
60
/* The attach() and detach() entry points are used to create and destroy "instances" of the driver, where each instance represents everything needed to manage one actual PCMCIA card. */
static void elsa_cs_detach(struct pcmcia_device *p_dev)
/* The attach() and detach() entry points are used to create and destroy "instances" of the driver, where each instance represents everything needed to manage one actual PCMCIA card. */ static void elsa_cs_detach(struct pcmcia_device *p_dev)
{ local_info_t *info = link->priv; dev_dbg(&link->dev, "elsa_cs_detach(0x%p)\n", link); info->busy = 1; elsa_cs_release(link); kfree(info); }
robutest/uclinux
C++
GPL-2.0
60
/* Reloads IWDG counter with value defined in the reload register (write access to IWDG_PR and IWDG_RLR registers disabled). */
void IWDG_ReloadCounter(void)
/* Reloads IWDG counter with value defined in the reload register (write access to IWDG_PR and IWDG_RLR registers disabled). */ void IWDG_ReloadCounter(void)
{ IWDG->KR = KR_KEY_RELOAD; }
MaJerle/stm32f429
C++
null
2,036
/* Clear the adapter's interrupt flag. Clear system interrupt enable (SINTEN): disable adapter to system interrupts. */
static void tms380tr_disable_interrupts(struct net_device *dev)
/* Clear the adapter's interrupt flag. Clear system interrupt enable (SINTEN): disable adapter to system interrupts. */ static void tms380tr_disable_interrupts(struct net_device *dev)
{ SIFWRITEB(0, SIFACL); return; }
robutest/uclinux
C++
GPL-2.0
60
/* GMAC programmed with the back off limit value. */
void synopGMAC_back_off_limit(synopGMACdevice *gmacdev, u32 value)
/* GMAC programmed with the back off limit value. */ void synopGMAC_back_off_limit(synopGMACdevice *gmacdev, u32 value)
{ u32 data; data = synopGMACReadReg(gmacdev->MacBase, GmacConfig); data &= (~GmacBackoffLimit); data |= value; synopGMACWriteReg(gmacdev->MacBase, GmacConfig, data); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* USB Device Initialize Function Called by the User to initialize USB Return Value: None */
void USBD_Init(void)
/* USB Device Initialize Function Called by the User to initialize USB Return Value: None */ void USBD_Init(void)
{ RCC->APB1ENR |= (1 << 23); USBD_IntrEna(); USB_CONNECT_OFF(); }
ARMmbed/DAPLink
C++
Apache License 2.0
2,140
/* Clear interrupts of a channel. Interrupts that are not specified by the interrupt mask are not affected. */
void XAxiVdma_ChannelIntrClear(XAxiVdma_Channel *Channel, u32 IntrType)
/* Clear interrupts of a channel. Interrupts that are not specified by the interrupt mask are not affected. */ void XAxiVdma_ChannelIntrClear(XAxiVdma_Channel *Channel, u32 IntrType)
{ if ((IntrType & XAXIVDMA_IXR_ALL_MASK) == 0) { PRINTF( "Clear intr with null intr mask value %x\r\n", (unsigned int)IntrType); return; } XAxiVdma_WriteReg(Channel->ChanBase, XAXIVDMA_SR_OFFSET, IntrType & XAXIVDMA_IXR_ALL_MASK); return; }
ua1arn/hftrx
C++
null
69
/* lis3l02dq_spi_write_reg_8() - write single byte to a register @dev: device associated with child of actual device (iio_dev or iio_trig) @reg_address: the address of the register to be writen @val: the value to write */
int lis3l02dq_spi_write_reg_8(struct device *dev, u8 reg_address, u8 *val)
/* lis3l02dq_spi_write_reg_8() - write single byte to a register @dev: device associated with child of actual device (iio_dev or iio_trig) @reg_address: the address of the register to be writen @val: the value to write */ int lis3l02dq_spi_write_reg_8(struct device *dev, u8 reg_address, u8 *val)
{ int ret; struct spi_message msg; struct iio_dev *indio_dev = dev_get_drvdata(dev); struct lis3l02dq_state *st = iio_dev_get_devdata(indio_dev); struct spi_transfer xfer = { .tx_buf = st->tx, .bits_per_word = 8, .len = 2, .cs_change = 1, }; mutex_lock(&st->buf_lock); st->tx[0] = LIS3L02DQ_WRITE_REG(reg...
robutest/uclinux
C++
GPL-2.0
60
/* Disables the RTC in the Hibernation module. After calling this function the RTC features of the Hibernation module will not be available. */
void HibernateRTCDisable(void)
/* Disables the RTC in the Hibernation module. After calling this function the RTC features of the Hibernation module will not be available. */ void HibernateRTCDisable(void)
{ HWREG(HIB_CTL) &= ~HIB_CTL_RTCEN; }
watterott/WebRadio
C++
null
71
/* When ARM7TDMI comes across an instruction which it cannot handle, it takes the undefined instruction trap. */
void rt_hw_trap_udef(struct rt_hw_register *regs)
/* When ARM7TDMI comes across an instruction which it cannot handle, it takes the undefined instruction trap. */ void rt_hw_trap_udef(struct rt_hw_register *regs)
{ rt_hw_show_register(regs); rt_kprintf("undefined instruction\n"); rt_kprintf("thread - %s stack:\n", rt_current_thread->name); rt_hw_backtrace((rt_uint32_t *)regs->fp, (rt_uint32_t)rt_current_thread->entry); rt_hw_cpu_shutdown(); }
pikasTech/PikaPython
C++
MIT License
1,403
/* Should only be called when port is inactive (i.e. SSIEN = 0), although can be called multiple times by upper layers. */
int imx_ssi_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
/* Should only be called when port is inactive (i.e. SSIEN = 0), although can be called multiple times by upper layers. */ int imx_ssi_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
{ struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; int ret; if (cpu_dai->id == IMX_DAI_SSI0 || cpu_dai->id == IMX_DAI_SSI2) { if (SSI1_SCR & SSI_SCR_SSIEN) { printk(KERN_WARNING "Warning ssi already enabled\n"); return 0; } } else { if (SSI2_SC...
robutest/uclinux
C++
GPL-2.0
60
/* Return: 0 - Not busy (The request stacking driver should dispatch request) 1 - Busy (The request stacking driver should stop dispatching request) */
int blk_lld_busy(struct request_queue *q)
/* Return: 0 - Not busy (The request stacking driver should dispatch request) 1 - Busy (The request stacking driver should stop dispatching request) */ int blk_lld_busy(struct request_queue *q)
{ if (q->lld_busy_fn) return q->lld_busy_fn(q); return 0; }
EmcraftSystems/linux-emcraft
C++
Other
266
/* vmbus_match - Attempt to match the specified device to the specified driver */
static int vmbus_match(struct device *device, struct device_driver *driver)
/* vmbus_match - Attempt to match the specified device to the specified driver */ static int vmbus_match(struct device *device, struct device_driver *driver)
{ int match = 0; struct driver_context *driver_ctx = driver_to_driver_context(driver); struct device_context *device_ctx = device_to_device_context(device); DPRINT_ENTER(VMBUS_DRV); if (memcmp(&device_ctx->class_id, &driver_ctx->class_id, sizeof(struct hv_guid)) == 0) { struct vmbus_driver_context *vmbus_dr...
robutest/uclinux
C++
GPL-2.0
60
/* Initialize master decompression control and select active modules. This is performed at the start of jpeg_start_decompress. */
jinit_master_decompress(j_decompress_ptr cinfo)
/* Initialize master decompression control and select active modules. This is performed at the start of jpeg_start_decompress. */ jinit_master_decompress(j_decompress_ptr cinfo)
{ my_master_ptr master; master = (my_master_ptr) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, SIZEOF(my_decomp_master)); cinfo->master = &master->pub; master->pub.prepare_for_output_pass = prepare_for_output_pass; master->pub.finish_output_pass = finish_output_pass; master->pub...
alibaba/AliOS-Things
C++
Apache License 2.0
4,536
/* Return the 'mask' address the i'th CS entry. This function is needed because there number of DCSM registers on Rev E and prior vs Rev F and later is different. */
static u32 amd64_get_dct_mask(struct amd64_pvt *pvt, int dct, int csrow)
/* Return the 'mask' address the i'th CS entry. This function is needed because there number of DCSM registers on Rev E and prior vs Rev F and later is different. */ static u32 amd64_get_dct_mask(struct amd64_pvt *pvt, int dct, int csrow)
{ if (dct == 0) return pvt->dcsm0[amd64_map_to_dcs_mask(pvt, csrow)]; else return pvt->dcsm1[amd64_map_to_dcs_mask(pvt, csrow)]; }
robutest/uclinux
C++
GPL-2.0
60
/* Executes a MONITOR instruction with the register state specified by Eax, Ecx and Edx. Returns Eax. This function is only available on IA-32 and X64. */
UINTN EFIAPI AsmMonitor(IN UINTN Eax, IN UINTN Ecx, IN UINTN Edx)
/* Executes a MONITOR instruction with the register state specified by Eax, Ecx and Edx. Returns Eax. This function is only available on IA-32 and X64. */ UINTN EFIAPI AsmMonitor(IN UINTN Eax, IN UINTN Ecx, IN UINTN Edx)
{ __asm__ __volatile__ ( "monitor" : : "a" (Eax), "c" (Ecx), "d" (Edx) ); return Eax; }
tianocore/edk2
C++
Other
4,240
/* Clear the I2C time out flag of the specified I2C port. The */
void I2CTimeoutFlagClear(unsigned long ulBase)
/* Clear the I2C time out flag of the specified I2C port. The */ void I2CTimeoutFlagClear(unsigned long ulBase)
{ xASSERT((ulBase == I2C0_BASE)); xHWREG(ulBase + I2C_O_TOC) |= I2C_TOC_TIF; }
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* SD MSP De-Initialization This function freeze the hardware resources used in this example. */
void HAL_SD_MspDeInit(SD_HandleTypeDef *hsd)
/* SD MSP De-Initialization This function freeze the hardware resources used in this example. */ void HAL_SD_MspDeInit(SD_HandleTypeDef *hsd)
{ if(hsd->Instance==SDMMC1) { __HAL_RCC_SDMMC1_CLK_DISABLE(); HAL_GPIO_DeInit(GPIOC, GPIO_PIN_12|GPIO_PIN_11|GPIO_PIN_10|GPIO_PIN_9 |GPIO_PIN_8); HAL_GPIO_DeInit(GPIOD, GPIO_PIN_2); HAL_NVIC_DisableIRQ(SDMMC1_IRQn); } }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Set the De-bounce sampling cycle. 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 GPIODebounceTimeSet(unsigned long ulClockSource, unsigned long ulDebounceClk)
/* Set the De-bounce sampling cycle. 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 GPIODebounceTimeSet(unsigned long ulClockSource, unsigned lon...
{ xASSERT((ulClockSource == GPIO_DBCLKSRC_HCLK) || (ulClockSource == GPIO_DBCLKSRC_10K)); xASSERT(ulDebounceClk<=15); xHWREG(GPIO_PORTA_BASE + GPIO_DBNCECON) = ((ulClockSource & 1) ? (xHWREG(GPIO_PORTA_BASE + GPIO_DBNCECON) | GPIO_DBNCECON_DBCLKSRC) : ...
coocox/cox
C++
Berkeley Software Distribution (BSD)
104
/* retrn the MAC address of the es module. */
ES_WIFI_Status_t ES_WIFI_GetMACAddress(ES_WIFIObject_t *Obj, uint8_t *mac)
/* retrn the MAC address of the es module. */ ES_WIFI_Status_t ES_WIFI_GetMACAddress(ES_WIFIObject_t *Obj, uint8_t *mac)
{ ES_WIFI_Status_t ret ; char *ptr; LOCK_WIFI(); sprintf((char*)Obj->CmdData,"Z5\r"); ret = AT_ExecuteCommand(Obj, Obj->CmdData, Obj->CmdData); if(ret == ES_WIFI_STATUS_OK) { ptr = strtok((char *)(Obj->CmdData + 2), "\r\n"); ParseMAC(ptr, mac) ; } UNLOCK_WIFI(); return ret; }
eclipse-threadx/getting-started
C++
Other
310
/* Loads data to Hashcrypt engine INDATA register. This function writes desired number of bytes starting from the src address to the dst address. Dst address does not increment (destination is peripheral module register INDATA). Src address increments to load consecutive words. */
__STATIC_INLINE void hashcrypt_load_data(HASHCRYPT_Type *base, uint32_t *src, size_t size)
/* Loads data to Hashcrypt engine INDATA register. This function writes desired number of bytes starting from the src address to the dst address. Dst address does not increment (destination is peripheral module register INDATA). Src address increments to load consecutive words. */ __STATIC_INLINE void hashcrypt_load_d...
{ uint32_t __attribute__((aligned(4))) inAlign[HASHCRYPT_AES_BLOCK_SIZE / sizeof(uint32_t)]; uint32_t *in; uint8_t i; in = src; if ((0U != ((uint32_t)in & 3U))) { for (i = 0; i < ((uint32_t)size / 4U); i++) { inAlign[i] = hashcrypt_get_word_from_unaligned((uint8_t *)&...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Command response callback function for sd_ble_gattc_descriptors_discover BLE command. Callback for decoding the command response return code. */
static uint32_t gattc_descriptors_discover_rsp_dec(const uint8_t *p_buffer, uint16_t length)
/* Command response callback function for sd_ble_gattc_descriptors_discover BLE command. Callback for decoding the command response return code. */ static uint32_t gattc_descriptors_discover_rsp_dec(const uint8_t *p_buffer, uint16_t length)
{ uint32_t result_code; const uint32_t err_code = ble_gattc_descriptors_discover_rsp_dec(p_buffer, length, &result_code); APP_ERROR_CHECK(err_code); return result_code; }
labapart/polymcu
C++
null
201
/* This grabs the session lock to make sure no one is in xmit_task/queuecommand, and then sets suspend to prevent new commands from being queued. This only needs to be called by offload drivers that need to sync a path like ep disconnect with the iscsi_queuecommand/xmit_task. To start IO again libiscsi will call iscsi_...
void iscsi_suspend_queue(struct iscsi_conn *conn)
/* This grabs the session lock to make sure no one is in xmit_task/queuecommand, and then sets suspend to prevent new commands from being queued. This only needs to be called by offload drivers that need to sync a path like ep disconnect with the iscsi_queuecommand/xmit_task. To start IO again libiscsi will call iscsi_...
{ spin_lock_bh(&conn->session->lock); set_bit(ISCSI_SUSPEND_BIT, &conn->suspend_tx); spin_unlock_bh(&conn->session->lock); }
robutest/uclinux
C++
GPL-2.0
60
/* ocfs2_plock() can only be safely called if ocfs2_stack_supports_plocks() returned true */
int ocfs2_plock(struct ocfs2_cluster_connection *conn, u64 ino, struct file *file, int cmd, struct file_lock *fl)
/* ocfs2_plock() can only be safely called if ocfs2_stack_supports_plocks() returned true */ int ocfs2_plock(struct ocfs2_cluster_connection *conn, u64 ino, struct file *file, int cmd, struct file_lock *fl)
{ WARN_ON_ONCE(active_stack->sp_ops->plock == NULL); if (active_stack->sp_ops->plock) return active_stack->sp_ops->plock(conn, ino, file, cmd, fl); return -EOPNOTSUPP; }
robutest/uclinux
C++
GPL-2.0
60
/* Register SNAP clients. We don't yet use this for IP. */
struct datalink_proto* register_snap_client(const unsigned char *desc, int(*rcvfunc)(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *))
/* Register SNAP clients. We don't yet use this for IP. */ struct datalink_proto* register_snap_client(const unsigned char *desc, int(*rcvfunc)(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *))
{ struct datalink_proto *proto = NULL; spin_lock_bh(&snap_lock); if (find_snap_client(desc)) goto out; proto = kmalloc(sizeof(*proto), GFP_ATOMIC); if (proto) { memcpy(proto->type, desc, 5); proto->rcvfunc = rcvfunc; proto->header_length = 5 + 3; proto->request = snap_request; list_add_rcu(&proto->no...
EmcraftSystems/linux-emcraft
C++
Other
266
/* Analyse the changes in an effect, and tell if we need to send a periodic parameter effect */
static int need_period_modifier(struct iforce *iforce, struct ff_effect *old, struct ff_effect *new)
/* Analyse the changes in an effect, and tell if we need to send a periodic parameter effect */ static int need_period_modifier(struct iforce *iforce, struct ff_effect *old, struct ff_effect *new)
{ if (new->type != FF_PERIODIC) { dev_warn(&iforce->dev->dev, "bad effect type in %s\n", __func__); return 0; } return (old->u.periodic.period != new->u.periodic.period || old->u.periodic.magnitude != new->u.periodic.magnitude || old->u.periodic.offset != new->u.periodic.offset || old->u.periodic.phase...
robutest/uclinux
C++
GPL-2.0
60
/* Adds or substract one hour from the current time. */
void RTC_DayLightSavingConfig(uint32_t RTC_DayLightSaving, uint32_t RTC_StoreOperation)
/* Adds or substract one hour from the current time. */ void RTC_DayLightSavingConfig(uint32_t RTC_DayLightSaving, uint32_t RTC_StoreOperation)
{ assert_param(IS_RTC_DAYLIGHT_SAVING(RTC_DayLightSaving)); assert_param(IS_RTC_STORE_OPERATION(RTC_StoreOperation)); RTC->WPR = 0xCA; RTC->WPR = 0x53; RTC->CR &= (uint32_t)~(RTC_CR_BCK); RTC->CR |= (uint32_t)(RTC_DayLightSaving | RTC_StoreOperation); RTC->WPR = 0xFF; }
MaJerle/stm32f429
C++
null
2,036
/* Perform I2C read operation for mipi camera sensor. */
static int32_t mipi_sensor_read_reg(uint32_t i2c_base, uint16_t reg, uint8_t *pval)
/* Perform I2C read operation for mipi camera sensor. */ static int32_t mipi_sensor_read_reg(uint32_t i2c_base, uint16_t reg, uint8_t *pval)
{ int ret = 0; struct imx_i2c_request rq = {0}; reg = ((reg & 0x00FF) << 8) | ((reg & 0xFF00) >> 8); rq.ctl_addr = i2c_base; rq.dev_addr = MIPI_SENSOR_ADDR; rq.reg_addr = reg; rq.reg_addr_sz = 2; rq.buffer_sz = 1; rq.buffer = pval; ret = i2c_xfer(&rq, I2C_READ); return ret; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Clears bits as per the enabled bit positions in the mask. */
VOID XhcClearR32Bit(IN OUT UINTN Register, IN UINT32 BitMask)
/* Clears bits as per the enabled bit positions in the mask. */ VOID XhcClearR32Bit(IN OUT UINTN Register, IN UINT32 BitMask)
{ UINT32 RegisterValue; RegisterValue = MmioRead32 (Register); RegisterValue &= ~BitMask; MmioWrite32 (Register, RegisterValue); }
tianocore/edk2
C++
Other
4,240
/* A thread sleeps then puts data on the lifo. */
static void test_thread_put_timeout(void *p1, void *p2, void *p3)
/* A thread sleeps then puts data on the lifo. */ static void test_thread_put_timeout(void *p1, void *p2, void *p3)
{ uint32_t timeout = *((uint32_t *)p2); k_msleep(timeout); k_lifo_put((struct k_lifo *)p1, get_scratch_packet()); }
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* pm8001_task_prep_ssp - the dispatcher function,prepare ssp data for ssp task @pm8001_ha: our hba card information @ccb: the ccb which attached to ssp task */
static int pm8001_task_prep_ssp(struct pm8001_hba_info *pm8001_ha, struct pm8001_ccb_info *ccb)
/* pm8001_task_prep_ssp - the dispatcher function,prepare ssp data for ssp task @pm8001_ha: our hba card information @ccb: the ccb which attached to ssp task */ static int pm8001_task_prep_ssp(struct pm8001_hba_info *pm8001_ha, struct pm8001_ccb_info *ccb)
{ return PM8001_CHIP_DISP->ssp_io_req(pm8001_ha, ccb); }
robutest/uclinux
C++
GPL-2.0
60
/* Enables or disables the TIM peripheral Main Outputs. */
void TIM_CtrlPWMOutputs(TIM_TypeDef *TIMx, FunctionalState NewState)
/* Enables or disables the TIM peripheral Main Outputs. */ void TIM_CtrlPWMOutputs(TIM_TypeDef *TIMx, FunctionalState NewState)
{ assert_param(IS_TIM_LIST4_PERIPH(TIMx)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { TIMx->BDTR |= TIM_BDTR_MOE; } else { TIMx->BDTR &= (uint16_t)~TIM_BDTR_MOE; } }
MaJerle/stm32f429
C++
null
2,036
/* USBH_CtlReceiveData Receives the Device Response to the Setup Packet. */
USBH_Status USBH_CtlReceiveData(USB_OTG_CORE_HANDLE *pdev, uint8_t *buff, uint16_t length, uint8_t hc_num)
/* USBH_CtlReceiveData Receives the Device Response to the Setup Packet. */ USBH_Status USBH_CtlReceiveData(USB_OTG_CORE_HANDLE *pdev, uint8_t *buff, uint16_t length, uint8_t hc_num)
{ pdev->host.hc[hc_num].ep_is_in = 1; pdev->host.hc[hc_num].data_pid = HC_PID_DATA1; pdev->host.hc[hc_num].xfer_buff = buff; pdev->host.hc[hc_num].xfer_len = length; HCD_SubmitRequest (pdev , hc_num); return USBH_OK; }
MaJerle/stm32f429
C++
null
2,036
/* print_macaddr - print MAC address registers and MAC address in eeprom */
static void print_macaddr(struct eth_device *dev)
/* print_macaddr - print MAC address registers and MAC address in eeprom */ static void print_macaddr(struct eth_device *dev)
{ puts("Current MAC Address in MAC: "); ulong addrl = smc911x_get_mac_csr(dev, ADDRL); ulong addrh = smc911x_get_mac_csr(dev, ADDRH); printf("%02x:%02x:%02x:%02x:%02x:%02x\n", (u8)(addrl), (u8)(addrl >> 8), (u8)(addrl >> 16), (u8)(addrl >> 24), (u8)(addrh), (u8)(addrh >> 8)); puts("Current MAC Address in E...
EmcraftSystems/u-boot
C++
Other
181
/* libc/string/strncpy.c Writes exactly n bytes, copying from source or adding nulls */
char* strncpy(char *dest, const char *src, size_t n)
/* libc/string/strncpy.c Writes exactly n bytes, copying from source or adding nulls */ char* strncpy(char *dest, const char *src, size_t n)
{ char * tmp = dest; while (n) { if ((*tmp = *src) != 0) src++; tmp++; n--; } return dest; }
xboot/xboot
C++
MIT License
779
/* If you allocate hid_device through hid_allocate_device, you should ever free by this function. */
void hid_destroy_device(struct hid_device *hdev)
/* If you allocate hid_device through hid_allocate_device, you should ever free by this function. */ void hid_destroy_device(struct hid_device *hdev)
{ hid_remove_device(hdev); put_device(&hdev->dev); }
robutest/uclinux
C++
GPL-2.0
60
/* Returns: (transfer none): the default #GIcon for @appinfo or NULL if there is no default icon. */
GIcon* g_app_info_get_icon(GAppInfo *appinfo)
/* Returns: (transfer none): the default #GIcon for @appinfo or NULL if there is no default icon. */ GIcon* g_app_info_get_icon(GAppInfo *appinfo)
{ GAppInfoIface *iface; g_return_val_if_fail (G_IS_APP_INFO (appinfo), NULL); iface = G_APP_INFO_GET_IFACE (appinfo); return (* iface->get_icon) (appinfo); }
seemoo-lab/nexmon
C++
GNU General Public License v3.0
2,330
/* Send notifications to all registered drivers that a device was removed. */
void i2o_driver_notify_device_remove_all(struct i2o_device *i2o_dev)
/* Send notifications to all registered drivers that a device was removed. */ void i2o_driver_notify_device_remove_all(struct i2o_device *i2o_dev)
{ int i; struct i2o_driver *drv; for (i = 0; i < i2o_max_drivers; i++) { drv = i2o_drivers[i]; if (drv) i2o_driver_notify_device_remove(drv, i2o_dev); } }
robutest/uclinux
C++
GPL-2.0
60
/* Sync up the MTRR values for all processors. */
VOID EFIAPI LoadMtrrData(EFI_PHYSICAL_ADDRESS MtrrTable)
/* Sync up the MTRR values for all processors. */ VOID EFIAPI LoadMtrrData(EFI_PHYSICAL_ADDRESS MtrrTable)
{ MTRR_SETTINGS *MtrrSettings; MtrrSettings = (MTRR_SETTINGS *)(UINTN)MtrrTable; MtrrSetAllMtrrs (MtrrSettings); }
tianocore/edk2
C++
Other
4,240
/* Select the RTC output source to output on the Tamper pin. */
void BAKPR_ConfigRTCOutput(BAKPR_RTC_OUTPUT_SOURCE_T soure)
/* Select the RTC output source to output on the Tamper pin. */ void BAKPR_ConfigRTCOutput(BAKPR_RTC_OUTPUT_SOURCE_T soure)
{ if (soure == BAKPR_RTC_OUTPUT_SOURCE_NONE) { BAKPR->CLKCAL = RESET; } else if (soure == BAKPR_RTC_OUTPUT_SOURCE_CALIBRATION_CLOCK) { BAKPR->CLKCAL_B.CALCOEN = BIT_SET; } else if (soure == BAKPR_RTC_OUTPUT_SOURCE_ALARM) { BAKPR->CLKCAL_B.ASPOEN = BIT_SET; } ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* param base LPUART peripheral base address. param handle LPUART handle pointer. param ringBuffer Start address of ring buffer for background receiving. Pass NULL to disable the ring buffer. param ringBufferSize size of the ring buffer. */
void LPUART_TransferStartRingBuffer(LPUART_Type *base, lpuart_handle_t *handle, uint8_t *ringBuffer, size_t ringBufferSize)
/* param base LPUART peripheral base address. param handle LPUART handle pointer. param ringBuffer Start address of ring buffer for background receiving. Pass NULL to disable the ring buffer. param ringBufferSize size of the ring buffer. */ void LPUART_TransferStartRingBuffer(LPUART_Type *base, lpuart_handle_t *handle...
{ assert(NULL != handle); assert(NULL != ringBuffer); handle->rxRingBuffer = ringBuffer; handle->rxRingBufferSize = ringBufferSize; handle->rxRingBufferHead = 0U; handle->rxRingBufferTail = 0U; LPUART_EnableInterrupts( base, (uint32_t)kLPUART_RxDataRegFullInterruptEnable | (uint3...
eclipse-threadx/getting-started
C++
Other
310
/* Remove neighbour from x25_neigh_list. If it was there. Caller must hold x25_neigh_list_lock. */
static void __x25_remove_neigh(struct x25_neigh *nb)
/* Remove neighbour from x25_neigh_list. If it was there. Caller must hold x25_neigh_list_lock. */ static void __x25_remove_neigh(struct x25_neigh *nb)
{ skb_queue_purge(&nb->queue); x25_stop_t20timer(nb); if (nb->node.next) { list_del(&nb->node); x25_neigh_put(nb); } }
EmcraftSystems/linux-emcraft
C++
Other
266
/* unuse_mm Reverses the effect of use_mm, i.e. releases the specified mm context which was earlier taken on by the calling kernel thread (Note: this routine is intended to be called only from a kernel thread context) */
void unuse_mm(struct mm_struct *mm)
/* unuse_mm Reverses the effect of use_mm, i.e. releases the specified mm context which was earlier taken on by the calling kernel thread (Note: this routine is intended to be called only from a kernel thread context) */ void unuse_mm(struct mm_struct *mm)
{ struct task_struct *tsk = current; task_lock(tsk); tsk->mm = NULL; enter_lazy_tlb(mm, tsk); task_unlock(tsk); }
robutest/uclinux
C++
GPL-2.0
60
/* Set the row address for a NAND flash memory device using the Cadence NAND controller. */
static void row_address_set(struct cadence_nand_params *params, uint32_t *local_row_address, uint32_t page_set)
/* Set the row address for a NAND flash memory device using the Cadence NAND controller. */ static void row_address_set(struct cadence_nand_params *params, uint32_t *local_row_address, uint32_t page_set)
{ uint32_t block_number = 0; block_number = ((page_set) / (params->npages_per_block)); *local_row_address = 0; *local_row_address |= ROW_VAL_SET((params->page_size_bit) - 1, 0, ((page_set) % (params->npages_per_block))); *local_row_address |= ROW_VAL_SET((params->block_size_bit) - 1, (params->page_size_bi...
zephyrproject-rtos/zephyr
C++
Apache License 2.0
9,573
/* Read a series of dx_leaf blocks. This expects all buffer_head pointers to be NULL on function entry. */
static int ocfs2_read_dx_leaves(struct inode *dir, u64 start, int num, struct buffer_head **dx_leaf_bhs)
/* Read a series of dx_leaf blocks. This expects all buffer_head pointers to be NULL on function entry. */ static int ocfs2_read_dx_leaves(struct inode *dir, u64 start, int num, struct buffer_head **dx_leaf_bhs)
{ int ret; ret = ocfs2_read_blocks(INODE_CACHE(dir), start, num, dx_leaf_bhs, 0, ocfs2_validate_dx_leaf); if (ret) mlog_errno(ret); return ret; }
robutest/uclinux
C++
GPL-2.0
60
/* Programs the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY. */
FLASH_Status FLASH_OB_UserConfig(uint8_t OB_IWDG, uint8_t OB_STOP, uint8_t OB_STDBY)
/* Programs the FLASH User Option Byte: IWDG_SW / RST_STOP / RST_STDBY. */ FLASH_Status FLASH_OB_UserConfig(uint8_t OB_IWDG, uint8_t OB_STOP, uint8_t OB_STDBY)
{ FLASH_Status status = FLASH_COMPLETE; assert_param(IS_OB_IWDG_SOURCE(OB_IWDG)); assert_param(IS_OB_STOP_SOURCE(OB_STOP)); assert_param(IS_OB_STDBY_SOURCE(OB_STDBY)); status = FLASH_WaitForLastOperation(FLASH_ER_PRG_TIMEOUT); if(status == FLASH_COMPLETE) { FLASH->CR |= FLASH_CR_OPTPG; OB->USER =...
avem-labs/Avem
C++
MIT License
1,752
/* SPI MSP Initialization This function configures the hardware resources used in this example. */
void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
/* SPI MSP Initialization This function configures the hardware resources used in this example. */ void HAL_SPI_MspInit(SPI_HandleTypeDef *hspi)
{ GPIO_InitTypeDef GPIO_InitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; if(hspi->Instance==SPI1) { PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_SPI1; PeriphClkInit.Spi1ClockSelection = RCC_SPI1CLKSOURCE_SYSCLK; if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) { ...
RT-Thread/rt-thread
C++
Apache License 2.0
9,535
/* Disables Source address filtering. When disabled GMAC forwards the received frames with updated SAMatch bit in RxStatus. */
void synopGMAC_src_addr_filter_disable(synopGMACdevice *gmacdev)
/* Disables Source address filtering. When disabled GMAC forwards the received frames with updated SAMatch bit in RxStatus. */ void synopGMAC_src_addr_filter_disable(synopGMACdevice *gmacdev)
{ synopGMACClearBits(gmacdev -> MacBase, GmacFrameFilter, GmacSrcAddrFilter); return; }
RT-Thread/rt-thread
C++
Apache License 2.0
9,535