LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "McMullan, Jason" <jason.mcmullan@timesys.com>
To: <jmasel@arabellasw.com>
Cc: PPC_LINUX <linuxppc-embedded@ozlabs.org>
Subject: Re: Arabella Resource Manager
Date: Thu, 19 May 2005 09:32:32 -0400
Date: Thu, 19 May 2005 09:26:25 -0400	[thread overview]
Message-ID: <1116509554.9050.127.camel@jmcmullan.timesys> (raw)
In-Reply-To: <E1DYPVW-0000vS-00@gold.webfusion.co.uk>

[-- Attachment #1: Type: text/plain, Size: 1525 bytes --]

Interesting code, but not generic enough.
What would be nicer would be an API like the following, that can be
easily extended, and work for more than just PQ (and ppc, for that
matter)

enum bres_type {
	BRES_TYPE_CLOCK = 0,
	BRES_TYPE_PIN,
	BRES_TYPE_CPM_SRAM,
	...
	BRES_TYPE_MAX,
}

struct bres_pool {
	struct resource *pool;
	int (*set)(int id, ...);
	int (*clear)(int id);
};

/* Board setup will set up the available regions
 * into this array, similar as to how the PCI 
 * system sets up the iomem areas.
 */
struct bres_pool *board_resource[BRES_TYPE_MAX];

/* Request a resource out of the available pools
 */
int bres_request(enum bres_type type, const struct resource *req);

/* Free a requested resource 
 * This also calls the 'clear' function of the pool.
 */
int bres_release(enum bres_type type, const struct resource *res);


/* After request completes, you can 'instance'
 * the resource.
 */

/* Wire a pin
 * pin is the same as you requested in the resource
 * pin type is defined in either the board or SoC CPU headers
 *  (ie CPM_PB17_SDL)
 */
static inline int bres_pin_wire_as(int pin, int pin_type)
{  return board_resource[BRES_TYPE_PIN].instance(pin, pin_type); }

/* Wire a clock
 */
static inline int bres_clock_wire_as(int clock, int clock_target,
			int multiplier, int divider)
{  return board_resource[BRES_TYPE_CLOCK].instance(pin, pin_type); }

...etc....



-- 
Jason McMullan <jason.mcmullan@timesys.com>
TimeSys Corporation


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2005-05-19 13:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-18 15:26 Arabella Resource Manager Jonathan Masel
2005-05-19 13:23 ` Pantelis Antoniou
2005-05-19 13:32 ` McMullan, Jason [this message]
2005-05-19 16:37   ` Jonathan Masel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1116509554.9050.127.camel@jmcmullan.timesys \
    --to=jason.mcmullan@timesys.com \
    --cc=jmasel@arabellasw.com \
    --cc=linuxppc-embedded@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox