Example #1
0
/*
 * Loads the SRAM contents.
 * Context: user.
 */
static void sram_load(struct exi_device *dev)
{
	struct gcnrtc_drvdata *drvdata = exi_get_drvdata(dev);
	struct gcn_sram *sram = &drvdata->sram;
	u32 req;

	exi_dev_take(dev);

	/* select the SRAM device */
	exi_dev_select(dev);

	/* send the appropriate command */
	req = 0x20000100;
	exi_dev_write(dev, &req, sizeof(req));

	/* read the SRAM data */
	exi_dev_read(dev, sram, sizeof(*sram));

	/* deselect the SRAM device */
	exi_dev_deselect(dev);

	exi_dev_give(dev);

	return;
}
Example #2
0
/*
 * Gets the hardware clock date and time.
 * Context: user.
 */
static unsigned long rtc_get_time(struct exi_device *dev)
{
	unsigned long a = 0;

	/* select the RTC device */
	if (exi_dev_select(dev) == 0) {
		/* send the appropriate command */
		a = 0x20000000;
		exi_dev_write(dev, &a, sizeof(a));

		/* read the time and date value */
		exi_dev_read(dev, &a, sizeof(a));

		/* deselect the RTC device */
		exi_dev_deselect(dev);
	}

	return a;
}
Example #3
0
/*
 * Loads the SRAM contents.
 * Context: user.
 */
static void sram_load(struct exi_device *dev)
{
	struct rtc_private *priv = exi_get_drvdata(dev);
	struct gcn_sram *sram = &priv->sram;
	u32 req;

	/* select the SRAM device */
	if (exi_dev_select(dev) == 0) {
		/* send the appropriate command */
		req = 0x20000100;
		exi_dev_write(dev, &req, sizeof(req));

		/* read the SRAM data */
		exi_dev_read(dev, sram, sizeof(*sram));

		/* deselect the SRAM device */
		exi_dev_deselect(dev);
	}

	return;
}
Example #4
0
/*
 * Gets the hardware clock date and time.
 * Context: user.
 */
static unsigned long gcnrtc_read_time(struct exi_device *dev)
{
	unsigned long a = 0;

	exi_dev_take(dev);

	/* select the SRAM device */
	exi_dev_select(dev);

	/* send the appropriate command */
	a = 0x20000000;
	exi_dev_write(dev, &a, sizeof(a));

	/* read the time and date value */
	exi_dev_read(dev, &a, sizeof(a));

	/* deselect the RTC device */
	exi_dev_deselect(dev);

	exi_dev_give(dev);

	return a;
}