Lines Matching refs:hw
302 #define hermes_read_reg(hw, off) ((hw)->io_space ? \ argument
303 inw((hw)->iobase + ( (off) << (hw)->reg_spacing )) : \
304 readw((hw)->iobase + ( (off) << (hw)->reg_spacing )))
305 #define hermes_write_reg(hw, off, val) ((hw)->io_space ? \ argument
306 outw_p((val), (hw)->iobase + ( (off) << (hw)->reg_spacing )) : \
307 writew((val), (hw)->iobase + ( (off) << (hw)->reg_spacing )))
309 #define hermes_read_regn(hw, name) (hermes_read_reg((hw), HERMES_##name)) argument
310 #define hermes_write_regn(hw, name, val) (hermes_write_reg((hw), HERMES_##name, (val))) argument
313 void hermes_struct_init(hermes_t *hw, ulong address, int io_space, int reg_spacing);
314 int hermes_init(hermes_t *hw);
315 int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0, hermes_response_t *resp);
316 int hermes_allocate(hermes_t *hw, u16 size, u16 *fid);
318 int hermes_bap_pread(hermes_t *hw, int bap, void *buf, unsigned len,
320 int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, unsigned len,
322 int hermes_bap_pwrite_pad(hermes_t *hw, int bap, const void *buf,
324 int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned buflen,
326 int hermes_write_ltv(hermes_t *hw, int bap, u16 rid,
331 static inline int hermes_present(hermes_t *hw) in hermes_present() argument
333 return hermes_read_regn(hw, SWSUPPORT0) == HERMES_MAGIC; in hermes_present()
336 static inline void hermes_set_irqmask(hermes_t *hw, u16 events) in hermes_set_irqmask() argument
338 hw->inten = events; in hermes_set_irqmask()
339 hermes_write_regn(hw, INTEN, events); in hermes_set_irqmask()
342 static inline int hermes_enable_port(hermes_t *hw, int port) in hermes_enable_port() argument
344 return hermes_docmd_wait(hw, HERMES_CMD_ENABLE | (port << 8), in hermes_enable_port()
348 static inline int hermes_disable_port(hermes_t *hw, int port) in hermes_disable_port() argument
350 return hermes_docmd_wait(hw, HERMES_CMD_DISABLE | (port << 8), in hermes_disable_port()
356 static inline int hermes_inquire(hermes_t *hw, u16 rid) in hermes_inquire() argument
358 return hermes_docmd_wait(hw, HERMES_CMD_INQUIRE, rid, NULL); in hermes_inquire()
365 static inline void hermes_read_words(struct hermes *hw, int off, void *buf, unsigned count) in hermes_read_words() argument
367 off = off << hw->reg_spacing;; in hermes_read_words()
369 if (hw->io_space) { in hermes_read_words()
370 insw(hw->iobase + off, buf, count); in hermes_read_words()
380 *p++ = cpu_to_le16(readw(hw->iobase + off)); in hermes_read_words()
385 static inline void hermes_write_words(struct hermes *hw, int off, const void *buf, unsigned count) in hermes_write_words() argument
387 off = off << hw->reg_spacing;; in hermes_write_words()
389 if (hw->io_space) { in hermes_write_words()
390 outsw(hw->iobase + off, buf, count); in hermes_write_words()
400 writew(le16_to_cpu(*p++), hw->iobase + off); in hermes_write_words()
405 static inline void hermes_clear_words(struct hermes *hw, int off, unsigned count) in hermes_clear_words() argument
409 off = off << hw->reg_spacing;; in hermes_clear_words()
411 if (hw->io_space) { in hermes_clear_words()
413 outw(0, hw->iobase + off); in hermes_clear_words()
416 writew(0, hw->iobase + off); in hermes_clear_words()
420 #define HERMES_READ_RECORD(hw, bap, rid, buf) \ argument
421 (hermes_read_ltv((hw),(bap),(rid), sizeof(*buf), NULL, (buf)))
422 #define HERMES_WRITE_RECORD(hw, bap, rid, buf) \ argument
423 (hermes_write_ltv((hw),(bap),(rid),HERMES_BYTES_TO_RECLEN(sizeof(*buf)),(buf)))
425 static inline int hermes_read_wordrec(hermes_t *hw, int bap, u16 rid, u16 *word) in hermes_read_wordrec() argument
430 err = HERMES_READ_RECORD(hw, bap, rid, &rec); in hermes_read_wordrec()
435 static inline int hermes_write_wordrec(hermes_t *hw, int bap, u16 rid, u16 word) in hermes_write_wordrec() argument
438 return HERMES_WRITE_RECORD(hw, bap, rid, &rec); in hermes_write_wordrec()