type stringclasses 5
values | content stringlengths 9 163k |
|---|---|
functions | else if (pchRcvDataFrame[iDataIdx] ==
MSG2AP_INST_DEBUG_DATA) {
iSensorData
= print_mcu_debug(pchRcvDataFrame + iDataIdx+1,
&iDataIdx, iLength);
if (iSensorData) {
pr_err("[SSP]: %s - Mcu data frame3 error %d\n",
__func__, iSensorData);
kfree(sensorsdata);
return ERROR;
} |
functions | else if (pchRcvDataFrame[iDataIdx] ==
MSG2AP_INST_LIBRARY_DATA) {
ssp_sensorhub_handle_data(data,
pchRcvDataFrame, iDataIdx, iLength);
break;
#endif
} |
functions | void initialize_function_pointer(struct ssp_data *data)
{
data->get_sensor_data[ACCELEROMETER_SENSOR] = get_3axis_sensordata;
data->get_sensor_data[GYROSCOPE_SENSOR] = get_3axis_sensordata;
data->get_sensor_data[GEOMAGNETIC_SENSOR] = get_3axis_sensordata;
data->get_sensor_data[PRESSURE_SENSOR] = get_pressure_sensor... |
includes |
#include <linux/kernel.h> |
includes | #include <linux/module.h> |
includes |
#include <linux/i2c.h> |
includes | #include <linux/init.h> |
includes | #include <linux/time.h> |
includes | #include <linux/interrupt.h> |
includes | #include <linux/delay.h> |
includes | #include <linux/errno.h> |
includes | #include <linux/err.h> |
includes | #include <linux/platform_device.h> |
includes | #include <linux/clk.h> |
includes | #include <linux/cpufreq.h> |
includes | #include <linux/slab.h> |
includes | #include <linux/io.h> |
includes |
#include <asm/irq.h> |
includes |
#include <plat/regs-iic.h> |
includes | #include <plat/iic.h> |
defines |
#define freq_to_i2c(_n) container_of(_n, struct s3c24xx_i2c, freq_transition) |
defines |
#define S3C24XX_DEV_PM_OPS (&s3c24xx_i2c_dev_pm_ops) |
defines | #define S3C24XX_DEV_PM_OPS NULL |
structs | struct s3c24xx_i2c {
spinlock_t lock;
wait_queue_head_t wait;
unsigned int suspended:1;
struct i2c_msg *msg;
unsigned int msg_num;
unsigned int msg_idx;
unsigned int msg_ptr;
unsigned int tx_setup;
unsigned int irq;
enum s3c24xx_i2c_state state;
unsigned long clkrate;
void __iomem *regs;
stru... |
functions | int s3c24xx_i2c_is2440(struct s3c24xx_i2c *i2c)
{
struct platform_device *pdev = to_platform_device(i2c->dev);
enum s3c24xx_i2c_type type;
type = platform_get_device_id(pdev)->driver_data;
return type == TYPE_S3C2440 || type == TYPE_S3C2440_HDMIPHY;
} |
functions | int s3c24xx_i2c_is2440_hdmiphy(struct s3c24xx_i2c *i2c)
{
struct platform_device *pdev = to_platform_device(i2c->dev);
enum s3c24xx_i2c_type type;
type = platform_get_device_id(pdev)->driver_data;
return type == TYPE_S3C2440_HDMIPHY;
} |
functions | void s3c24xx_i2c_master_complete(struct s3c24xx_i2c *i2c, int ret)
{
dev_dbg(i2c->dev, "master_complete %d\n", ret);
i2c->msg_ptr = 0;
i2c->msg = NULL;
i2c->msg_idx++;
i2c->msg_num = 0;
if (ret)
i2c->msg_idx = ret;
wake_up(&i2c->wait);
} |
functions | void s3c24xx_i2c_disable_ack(struct s3c24xx_i2c *i2c)
{
unsigned long tmp;
tmp = readl(i2c->regs + S3C2410_IICCON);
writel(tmp & ~S3C2410_IICCON_ACKEN, i2c->regs + S3C2410_IICCON);
} |
functions | void s3c24xx_i2c_enable_ack(struct s3c24xx_i2c *i2c)
{
unsigned long tmp;
tmp = readl(i2c->regs + S3C2410_IICCON);
writel(tmp | S3C2410_IICCON_ACKEN, i2c->regs + S3C2410_IICCON);
} |
functions | void s3c24xx_i2c_disable_irq(struct s3c24xx_i2c *i2c)
{
unsigned long tmp;
tmp = readl(i2c->regs + S3C2410_IICCON);
writel(tmp & ~S3C2410_IICCON_IRQEN, i2c->regs + S3C2410_IICCON);
} |
functions | void s3c24xx_i2c_enable_irq(struct s3c24xx_i2c *i2c)
{
unsigned long tmp;
tmp = readl(i2c->regs + S3C2410_IICCON);
writel(tmp | S3C2410_IICCON_IRQEN, i2c->regs + S3C2410_IICCON);
} |
functions | void s3c24xx_i2c_message_start(struct s3c24xx_i2c *i2c,
struct i2c_msg *msg)
{
unsigned int addr = (msg->addr & 0x7f) << 1;
unsigned long stat;
unsigned long iiccon;
stat = 0;
stat |= S3C2410_IICSTAT_TXRXEN;
if (msg->flags & I2C_M_RD) {
stat |= S3C2410_IICSTAT_MASTER_RX;
addr |= 1;
} |
functions | void s3c24xx_i2c_stop(struct s3c24xx_i2c *i2c, int ret)
{
unsigned long iicstat = readl(i2c->regs + S3C2410_IICSTAT);
dev_dbg(i2c->dev, "STOP\n");
/* stop the transfer */
iicstat &= ~S3C2410_IICSTAT_START;
writel(iicstat, i2c->regs + S3C2410_IICSTAT);
i2c->state = STATE_STOP;
s3c24xx_i2c_master_complete(i2c,... |
functions | int is_lastmsg(struct s3c24xx_i2c *i2c)
{
return i2c->msg_idx >= (i2c->msg_num - 1);
} |
functions | int is_msglast(struct s3c24xx_i2c *i2c)
{
return i2c->msg_ptr == i2c->msg->len-1;
} |
functions | int is_msgend(struct s3c24xx_i2c *i2c)
{
return i2c->msg_ptr >= i2c->msg->len;
} |
functions | int i2c_s3c_irq_nextbyte(struct s3c24xx_i2c *i2c, unsigned long iicstat)
{
unsigned long tmp;
unsigned char byte;
int ret = 0;
switch (i2c->state) {
case STATE_IDLE:
dev_err(i2c->dev, "%s: called in STATE_IDLE\n", __func__);
goto out;
case STATE_STOP:
dev_err(i2c->dev, "%s: called in STATE_STOP\n", __fun... |
functions | irqreturn_t s3c24xx_i2c_irq(int irqno, void *dev_id)
{
struct s3c24xx_i2c *i2c = dev_id;
unsigned long status;
unsigned long tmp;
status = readl(i2c->regs + S3C2410_IICSTAT);
if (status & S3C2410_IICSTAT_ARBITR) {
/* deal with arbitration loss */
dev_err(i2c->dev, "deal with arbitration loss\n");
} |
functions | int s3c24xx_i2c_set_master(struct s3c24xx_i2c *i2c)
{
unsigned long iicstat;
int timeout = 400;
/* if hang-up of HDMIPHY occured reduce timeout
* The controller will work after reset, so waiting
* 400 ms will cause unneccessary system hangup
*/
if (s3c24xx_i2c_is2440_hdmiphy(i2c))
timeout = 10;
while (ti... |
functions | int s3c24xx_i2c_doxfer(struct s3c24xx_i2c *i2c,
struct i2c_msg *msgs, int num)
{
unsigned long iicstat, timeout;
int spins = 20;
int ret;
if (i2c->suspended)
return -EIO;
ret = s3c24xx_i2c_set_master(i2c);
if (ret != 0) {
dev_err(i2c->dev, "cannot get bus (error %d)\n", ret);
ret = -EAGAIN;
got... |
functions | int s3c24xx_i2c_xfer(struct i2c_adapter *adap,
struct i2c_msg *msgs, int num)
{
struct s3c24xx_i2c *i2c = (struct s3c24xx_i2c *)adap->algo_data;
int retry;
int ret;
clk_enable(i2c->clk);
for (retry = 0; retry < adap->retries; retry++) {
ret = s3c24xx_i2c_doxfer(i2c, msgs, num);
if (ret != -EAGAIN) {
... |
functions | u32 s3c24xx_i2c_func(struct i2c_adapter *adap)
{
return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL | I2C_FUNC_PROTOCOL_MANGLING;
} |
functions | int s3c24xx_i2c_calcdivisor(unsigned long clkin, unsigned int wanted,
unsigned int *div1, unsigned int *divs)
{
unsigned int calc_divs = clkin / wanted;
unsigned int calc_div1;
if (calc_divs > (16*16))
calc_div1 = 512;
else
calc_div1 = 16;
calc_divs += calc_div1-1;
calc_divs /= calc_div1;
if (calc_... |
functions | int s3c24xx_i2c_clockrate(struct s3c24xx_i2c *i2c, unsigned int *got)
{
struct s3c2410_platform_i2c *pdata = i2c->dev->platform_data;
unsigned long clkin = clk_get_rate(i2c->clk);
unsigned int divs, div1;
unsigned long target_frequency;
u32 iiccon;
int freq;
i2c->clkrate = clkin;
clkin /= 1000; /* clkin now i... |
functions | int s3c24xx_i2c_cpufreq_transition(struct notifier_block *nb,
unsigned long val, void *data)
{
struct s3c24xx_i2c *i2c = freq_to_i2c(nb);
unsigned long flags;
unsigned int got;
int delta_f;
int ret;
delta_f = clk_get_rate(i2c->clk) - i2c->clkrate;
/* if we're post-change and the input clock has slowed d... |
functions | int s3c24xx_i2c_register_cpufreq(struct s3c24xx_i2c *i2c)
{
i2c->freq_transition.notifier_call = s3c24xx_i2c_cpufreq_transition;
return cpufreq_register_notifier(&i2c->freq_transition,
CPUFREQ_TRANSITION_NOTIFIER);
} |
functions | void s3c24xx_i2c_deregister_cpufreq(struct s3c24xx_i2c *i2c)
{
cpufreq_unregister_notifier(&i2c->freq_transition,
CPUFREQ_TRANSITION_NOTIFIER);
} |
functions | int s3c24xx_i2c_register_cpufreq(struct s3c24xx_i2c *i2c)
{
return 0;
} |
functions | void s3c24xx_i2c_deregister_cpufreq(struct s3c24xx_i2c *i2c)
{
} |
functions | int s3c24xx_i2c_init(struct s3c24xx_i2c *i2c)
{
unsigned long iicon = S3C2410_IICCON_IRQEN | S3C2410_IICCON_ACKEN;
struct s3c2410_platform_i2c *pdata;
unsigned int freq;
/* get the plafrom data */
pdata = i2c->dev->platform_data;
/* inititalise the gpio */
if (pdata->cfg_gpio)
pdata->cfg_gpio(to_platform_d... |
functions | int wait_for_i2c_idle(struct platform_device *pdev)
{
struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev);
unsigned long iicstat;
int timeout = 400;
printk("[zsb] i2c->regs : 0x%x\n", i2c->regs);
while (timeout-- > 0) {
iicstat = readl(i2c->regs + S3C2410_IICSTAT);
if (!(iicstat & S3C2410_IICSTAT_BUSBUSY... |
functions | int s3c24xx_i2c_probe(struct platform_device *pdev)
{
struct s3c24xx_i2c *i2c;
struct s3c2410_platform_i2c *pdata;
struct resource *res;
int ret;
pdata = pdev->dev.platform_data;
if (!pdata) {
dev_err(&pdev->dev, "no platform data\n");
return -EINVAL;
} |
functions | int s3c24xx_i2c_remove(struct platform_device *pdev)
{
struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev);
s3c24xx_i2c_deregister_cpufreq(i2c);
i2c_del_adapter(&i2c->adap);
free_irq(i2c->irq, i2c);
clk_disable(i2c->clk);
clk_put(i2c->clk);
iounmap(i2c->regs);
release_resource(i2c->ioarea);
kfree(i2c->io... |
functions | int s3c24xx_i2c_suspend_noirq(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev);
i2c->suspended = 1;
return 0;
} |
functions | int s3c24xx_i2c_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev);
i2c->suspended = 0;
clk_enable(i2c->clk);
s3c24xx_i2c_init(i2c);
clk_disable(i2c->clk);
return 0;
} |
functions | __init i2c_adap_s3c_init(void)
{
return platform_driver_register(&s3c24xx_i2c_driver);
} |
functions | __exit i2c_adap_s3c_exit(void)
{
platform_driver_unregister(&s3c24xx_i2c_driver);
} |
includes |
#include <linux/kernel.h> |
includes | #include <linux/module.h> |
includes | #include <linux/types.h> |
includes | #include <linux/fs.h> |
includes | #include <linux/errno.h> |
includes | #include <linux/init.h> |
includes | #include <linux/miscdevice.h> |
includes | #include <linux/watchdog.h> |
includes | #include <linux/of.h> |
includes | #include <linux/of_device.h> |
includes | #include <linux/io.h> |
includes | #include <linux/uaccess.h> |
includes | #include <linux/slab.h> |
defines |
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
defines |
#define DRIVER_NAME "riowd" |
defines | #define PFX DRIVER_NAME ": " |
defines |
#define WDTO_INDEX 0x05 |
structs | struct riowd {
void __iomem *regs;
spinlock_t lock;
}; |
functions | void riowd_writereg(struct riowd *p, u8 val, int index)
{
unsigned long flags;
spin_lock_irqsave(&p->lock, flags);
writeb(index, p->regs + 0);
writeb(val, p->regs + 1);
spin_unlock_irqrestore(&p->lock, flags);
} |
functions | int riowd_open(struct inode *inode, struct file *filp)
{
nonseekable_open(inode, filp);
return 0;
} |
functions | int riowd_release(struct inode *inode, struct file *filp)
{
return 0;
} |
functions | long riowd_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
static const struct watchdog_info info = {
.options = WDIOF_SETTIMEOUT,
.firmware_version = 1,
.identity = DRIVER_NAME,
} |
functions | ssize_t riowd_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
struct riowd *p = riowd_device;
if (count) {
riowd_writereg(p, riowd_timeout, WDTO_INDEX);
return 1;
} |
functions | __devinit riowd_probe(struct platform_device *op)
{
struct riowd *p;
int err = -EINVAL;
if (riowd_device)
goto out;
err = -ENOMEM;
p = kzalloc(sizeof(*p), GFP_KERNEL);
if (!p)
goto out;
spin_lock_init(&p->lock);
p->regs = of_ioremap(&op->resource[0], 0, 2, DRIVER_NAME);
if (!p->regs) {
pr_err("Cannot... |
functions | __devexit riowd_remove(struct platform_device *op)
{
struct riowd *p = dev_get_drvdata(&op->dev);
misc_deregister(&riowd_miscdev);
of_iounmap(&op->resource[0], p->regs, 2);
kfree(p);
return 0;
} |
includes |
#include <sys/types.h> |
includes | #include <sys/socket.h> |
includes | #include <sys/ioctl.h> |
includes | #include <netinet/in.h> |
includes | #include <unistd.h> |
includes | #include <string.h> |
includes | #include <arpa/inet.h> |
includes | #include <net/if.h> |
includes | #include <errno.h> |
includes | #include <features.h> |
includes | #include <netpacket/packet.h> |
includes | #include <net/ethernet.h> |
includes | #include <asm/types.h> |
includes | #include <linux/if_packet.h> |
includes | #include <linux/if_ether.h> |
functions | int read_interface(char *interface, int *ifindex, u_int32_t *addr, unsigned char *arp)
{
int fd;
struct ifreq ifr;
struct sockaddr_in *our_ip;
memset(&ifr, 0, sizeof(struct ifreq));
if((fd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW)) >= 0) {
ifr.ifr_addr.sa_family = AF_INET;
strcpy(ifr.ifr_name, interface);
i... |
functions | int listen_socket(unsigned int ip, int port, char *inf)
{
struct ifreq interface;
int fd;
struct sockaddr_in addr;
int n = 1;
DEBUG(LOG_INFO, "Opening listen socket on 0x%08x:%d %s\n", ip, port, inf);
if ((fd = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) {
DEBUG(LOG_ERR, "socket call failed: %s", strerror(e... |
functions | int raw_socket(int ifindex)
{
int fd;
struct sockaddr_ll sock;
DEBUG(LOG_INFO, "Opening raw socket on ifindex %d\n", ifindex);
if ((fd = socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_IP))) < 0) {
DEBUG(LOG_ERR, "socket call failed: %s", strerror(errno));
return -1;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.