1 #include <lwk/driver.h>
2 #include <lwk/console.h>
3 #include <lwk/string.h>
5 #include <rca/rca_l0.h>
7 /** Template event heder with static fields filled in. */
8 static rs_event_t ev_hdr = {0};
10 /** Set when L0 console has been initialized. */
11 static int initialized = 0;
14 * Writes a message to the Cray L0 console.
16 static void l0_write(struct console *con, const char *str)
19 unsigned int n = strlen(str);
23 ch_send_data(L0RCA_CH_CON_UP, &ev_hdr, (void *)str, n))
26 /* either error or we are done */
31 /* some bytes were sent, point to the remaining data */
36 /* busy wait if the buf is full */
40 /* if error, give up and spin forever */
48 * Cray L0 console device.
50 static struct console l0_console = {
51 .name = "Cray RCA L0 Console",
56 * Initializes the Cray XT L0 console.
58 void l0_console_init(void)
61 printk(KERN_ERR "RCA L0 console already initialized.\n");
65 /* Read the configuration information provided by the L0 */
68 /* Setup the event template to use for outgoing events */
69 ev_hdr.ev_id = ec_console_log;
70 ev_hdr.ev_gen = RCA_MKSVC(
75 ev_hdr.ev_src = ev_hdr.ev_gen;
76 ev_hdr.ev_priority = RCA_LOG_DEBUG;
78 /* Timestamp, len & data is filled at the time of sending event */
80 /* Register with the Cray RCA subsystem */
81 register_ch_up(L0RCA_CH_CON_UP, NULL, 0, -1);
83 /* Register the L0 console with the LWK */
84 console_register(&l0_console);
88 driver_init(l0_console_init);