Date:2011-01-15 02:10:46 (13 years 2 months ago)
Author:Bas Wijnen
Commit:f4cac9b3a5de0406fe850396e017b9aecf865722
Message:lists and bugfixes

Files: devices.hhp (3 diffs)
invoke.ccp (2 diffs)
iris.hhp (1 diff)
mips/nanonote/Makefile.arch (3 diffs)
mips/nanonote/board.ccp (3 diffs)
mips/nanonote/jz4740.hhp (1 diff)
mips/nanonote/sdram-setup.ccp (3 diffs)
mips/nanonote/sdram-setup.ld (1 diff)
mips/nanonote/server/usb-server.ccp (3 diffs)
mips/nanonote/threadlist.S (1 diff)
source/sd+mmc.ccp (10 diffs)

Change Details

devices.hhp
3737        enum request:
3838            LOCK_RO = 0x2001
3939            UNLOCK_RO
40            SET_CHANGE_CB
4041            NUM
4142    template <typename _T> //
4243    struct Locker : public _Locker_base, public _T:
...... 
4647        // Release a read-only lock.
4748        void unlock_ro ():
4849            _T::call (CAP_MASTER_DIRECT | UNLOCK_RO)
50        // Register a callback when the backing store is changed.
51        // The cb is invoked with data[0] set to the position of the first change and data[1] set to the length of the changed part.
52        // The accuracy of this is not guaranteed. Servers which only want to provide an event should set data[0] == 0, data[1] == ~0.
53        // The change invoke must happen before this function's reply is sent.
54        void set_change_cb (Listitem cb):
55            _T::ocall (cb, CAP_MASTER_DIRECT | SET_CHANGE_CB)
4956        Locker ():
5057        Locker (Cap c) : _T (c):
5158
...... 
130137    struct _WBlock : public Block:
131138        _WBlock (Cap c = Cap ()) : Block (c):
132139        enum request:
133            TRUNCATE = _Block::ID
134            SET_BLOCK
140            TRUNCATE = _WString::TRUNCATE
141            SET_BLOCK = _WString::ID
135142            ID
136143        /// Set the size of the block. This setting may have a limited range, or not be supported at all.
137144        void truncate (Num size):
invoke.ccp
320320                        dpanic (0x43311992, "out of memory creating caps")
321321                        reply_num (Iris::ERR_OUT_OF_MEMORY)
322322                    return
323                case CAPTYPE_LIST:
324                    kList *ret = mem->alloc_list ()
325                    if ret:
326                        reply_cap (CAPTYPE_LIST | CAP_MASTER, (unsigned)ret, &ret->refs)
327                    else:
328                        dpanic (0x13311995, "out of memory creating list")
329                        reply_num (Iris::ERR_OUT_OF_MEMORY)
330                    return
331                case CAPTYPE_LISTITEM:
332                    kListitem *ret = mem->alloc_listitem ()
333                    if ret:
334                        reply_cap (CAPTYPE_LISTITEM | CAP_MASTER, (unsigned)ret, &ret->refs)
335                    else:
336                        dpanic (0x13311997, "out of memory creating list")
337                        reply_num (Iris::ERR_OUT_OF_MEMORY)
338                    return
323339                default:
324340                    dpanic (0, "invalid create type")
325341                    reply_num (Iris::ERR_INVALID_ARGUMENT)
...... 
873889                    return
874890                item = item->next_item
875891            if !item:
876                reply_num (0)
892                reply_num (~0)
877893                return
878894            reply_cap (CAPTYPE_LISTITEM | Iris::Listitem::LIST, (unsigned)item, &item->refs)
879895            return
iris.hhp
496496            GET_INFO
497497            SET_INFO
498498            GET_CAP
499        // Get the next listitem from the given one. Use this to loop over all listitems.
499500        Listitem get_next (Listitem current = Listitem ()):
500501            iocall (current, CAP_MASTER_DIRECT | GET_NEXT)
502            if recv.data[0].l:
503                return Cap ()
501504            return get_arg ()
505        // Set the callback. This is called when an item is removed from the list.
506        // When called, data[0] is 0 when the list is now empty; 1 otherwise. data[1] is the removed item's info.
502507        void set_cb (Cap cb):
503508            ocall (cb, CAP_MASTER_DIRECT | SET_CB)
509        // Add an item to the front of the list.
504510        void add_item (Listitem item):
505511            ocall (item, CAP_MASTER_DIRECT | ADD_ITEM)
512        // Return item info.
506513        Num get_info (Listitem item):
507514            return ocall (item, CAP_MASTER_DIRECT | GET_INFO)
515        // Set item info.
508516        void set_info (Listitem item, Num info):
509517            ocall (item, CAP_MASTER_DIRECT | SET_INFO, info)
518        // Get item capability.
510519        Cap get_cap (Listitem item):
511520            iocall (item, CAP_MASTER_DIRECT | GET_CAP)
512521            return get_arg ()
mips/nanonote/Makefile.arch
1515# You should have received a copy of the GNU General Public License
1616# along with this program. If not, see <http://www.gnu.org/licenses/>.
1717
18start_load = 0x80600000
18start_load = 0x80400000
1919load = 0x80000000
2020# Uncomment one of these to select the boot method for the image.
2121#UDC_BOOT = yes
...... 
2727arch_headers = mips/arch.hh mips/nanonote/jz4740.hh mips/nanonote/board.hh mips/nand.hh
2828udc_boot_programs = udc
2929sd_boot_programs = sd+mmc partition fat
30unbrick_boot_programs = nand usb-mass-storage
30unbrick_boot_programs = nand sd+mmc usb-mass-storage
3131standard_boot_programs = bootinit
3232
33programs = init gpio lcd bsquare ball buzzer metronome elfrun alarm rtc gui test boot booter $(udc_boot_programs) $(sd_boot_programs) $(unbrick_boot_programs) $(standard_boot_programs)
33# use sort to remove duplicates.
34programs = $(sort init gpio lcd bsquare ball buzzer metronome elfrun alarm rtc gui test boot booter $(udc_boot_programs) $(sd_boot_programs) $(unbrick_boot_programs) $(standard_boot_programs))
3435
3536ARCH_CPPFLAGS = -I. -Imips -Imips/nanonote -Wa,-mips32 -DNANONOTE -DUSE_SERIAL
3637CROSS = mipsel-linux-gnu-
...... 
5657    cd fs && tar cvf ../$@ uimage init.config $(addsuffix .elf,$(programs)) --dereference
5758else
5859ifneq ($(UNBRICK),)
59boot_threads = $(standard_boot_programs) $(unbrick_boot_programs)
60boot_threads = $(standard_boot_programs) $(unbrick_boot_programs) sd+mmc
6061ARCH_CXXFLAGS = -DNUM_THREADS=3
6162BOOT_CPPFLAGS = -DUNBRICK
6263all: mips/start.raw
mips/nanonote/board.ccp
2323void board_init ():
2424    pll_init ()
2525    cpm_stop_all ()
26    #ifndef NDEBUG
27    cpm_start_uart0 ()
28    gpio_as_uart0 ()
29    #endif
3026    // Timer interrupts and buzzer.
3127    cpm_start_tcu ()
3228    // sdram memory.
...... 
4238    // buzzer.
4339    gpio_as_pwm4 ()
4440    // Set up memory.
45    setup_sdram ()
41    //setup_sdram ()
4642    // Use some gpio pins for lcd.
4743    gpio_as_gpio (2, (1 << 21) | (1 << 22) | (1 << 23))
4844    gpio_as_output (2, (1 << 21) | (1 << 22) | (1 << 23))
...... 
6662    tcu_unmask_full_match_irq (0)
6763    tcu_start_counter (0)
6864    #ifndef NDEBUG
69    // Set up uart.
70    UART0_IER = 0
71    UART0_FCR = 0
72    UART0_MCR = 0
73    UART0_SIRCR = 0
74    UART0_UACR = 0
75    UART0_UMR = 16
76    UART0_LCR = UARTLCR_WLEN_8 | UARTLCR_STOP1 | UARTLCR_DLAB
77    unsigned const baud = 57600
78    unsigned uart_div = 12000000 / 16 / baud
79    UART0_DLHR = (uart_div >> 8) & 0xff
80    UART0_DLLR = uart_div & 0xff
81    UART0_LCR = UARTLCR_WLEN_8 | UARTLCR_STOP1
82    UART0_FCR = UARTFCR_UUE | UARTFCR_FE | UARTFCR_RFLS | UARTFCR_TFLS
65    setup_uart ()
8366    kdebug ("\n\nSerial port initialized\n")
8467    #endif
8568
mips/nanonote/jz4740.hhp
37013701    dbg_log_num (EMC_RTCOR, 8)
37023702    dbg_log ("\n")
37033703    #endif
3704
3705static void setup_uart ():
3706    #ifndef NDEBUG
3707    // Set up uart.
3708    cpm_start_uart0 ()
3709    gpio_as_uart0 ()
3710    UART0_IER = 0
3711    UART0_FCR = 0
3712    UART0_MCR = 0
3713    UART0_SIRCR = 0
3714    UART0_UACR = 0
3715    UART0_UMR = 16
3716    UART0_LCR = UARTLCR_WLEN_8 | UARTLCR_STOP1 | UARTLCR_DLAB
3717    unsigned const baud = 57600
3718    unsigned uart_div = 12000000 / 16 / baud
3719    UART0_DLHR = (uart_div >> 8) & 0xff
3720    UART0_DLLR = uart_div & 0xff
3721    UART0_LCR = UARTLCR_WLEN_8 | UARTLCR_STOP1
3722    UART0_FCR = UARTFCR_UUE | UARTFCR_FE | UARTFCR_RFLS | UARTFCR_TFLS
3723    #endif
37043724#endif
37053725
37063726#endif
mips/nanonote/sdram-setup.ccp
1818
1919// This runs like the kernel. In particular, it doesn't want userspace declarations.
2020#define __KERNEL__
21#define dbg_log(x) do {} while (0)
2221#define dbg_log_char(x) do {} while (0)
22#define dbg_log(x) do {} while (0)
2323#define dbg_log_num(...) do {} while (0)
24
2425#include "jz4740.hh"
2526
27void kdebug (unsigned ch):
28    while !(UART0_LSR & UARTLSR_TDRQ):
29    UART0_TDR = ch
30    while !(UART0_LSR & UARTLSR_TEMT):
31
2632asm volatile (".set noreorder\n"
2733        "\t.globl __start\n"
2834        "\t.text\n"
2935        "__start:\n"
30        "\tla $sp, 0x80004000\n"
36        "\tnop\n"
3137        "__hack_label:\n"
3238        "\tmove $a0, $ra\n"
3339        "\tbal 1f\n"
...... 
3541        "\t.word _gp\n"
3642        "1:\n"
3743        "\tlw $gp, 0($ra)\n"
44        "\tla $sp, stack + 0x100\n"
3845        "\tla $t9, start_cpp\n"
3946        "\tmove $ra, $a0\n"
4047        "\tjr $t9\n"
...... 
4350
4451extern "C":
4552    void start_cpp ()
53    char stack[0x100]
4654
4755void start_cpp ():
48    setup_sdram ()
56    //setup_uart ()
57    //kdebug ('.')
58    //setup_sdram ()
59    //kdebug ('!')
4960    // everything is ok now: return to boot loader to load stage 2.
mips/nanonote/sdram-setup.ld
22ENTRY(__start)
33MEMORY
44{
5    ram : ORIGIN = 0x80002000 , LENGTH = 0x100000
5    ram : ORIGIN = 0x80002000 , LENGTH = 0x2000
66}
77
88SECTIONS
mips/nanonote/server/usb-server.ccp
225225            disconnect ()
226226
227227void data::request (requests r, unsigned data):
228    std::cerr << shevek::ostring ("requesting %08x with data %08x\n", r, data)
228229    if usb_control_msg (handle, USB_ENDPOINT_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, r, (data >> 16) & 0xffff, data & 0xffff, NULL, 0, timeout) < 0:
229230        std::cerr << "unable to send control message to NanoNote: " << usb_strerror () << ".\n"
230231        usb_release_interface (handle, 0)
...... 
232233        handle = NULL
233234
234235void data::send_file (unsigned address, unsigned size, char const *data):
236    std::cerr << shevek::ostring ("setting data address to 0x%08x\n", address)
235237    request (VR_SET_DATA_ADDRESS, address)
236238    char const *ptr = data
237239    while ptr - data < size:
...... 
292294    request (VR_PROGRAM_START1, STAGE1_ENTRY)
293295    usleep (100)
294296    std::ostringstream stage2
295    usb_release_interface (handle, 0)
296297    file.close ()
297298    file.open (filename.c_str ())
298299    stage2 << file.rdbuf ()
mips/nanonote/threadlist.S
7474
7575    .balign 0x1000
7676thread1:
77    .incbin "fs/nand.elf"
77    .incbin "fs/sd+mmc.elf"
7878
7979    .balign 0x1000
8080thread2:
source/sd+mmc.ccp
6868        return read_block_size
6969    unsigned get_block_bits ():
7070        return hc ? 9 : csd.read_bl_len > csd.write_bl_len ? csd.read_bl_len : csd.write_bl_len
71    void fill_page (Iris::Page page, Iris::Num address, unsigned size, unsigned offset)
7271    void write_page (Iris::Page page, Iris::Num address, unsigned size, unsigned offset)
72    void read_page (Iris::Page page, Iris::Num address, unsigned size, unsigned offset)
7373    void wait_write ()
74    void add_cb (Iris::Listitem item):
75        cb_list.add_item (item)
7476    private:
77    void set_block (unsigned block)
78    unsigned current_block_num
79    bool dirty
80    unsigned *current_block
7581    unsigned rca
7682    bool have_sdmem, have_io
7783    bool hc
...... 
7985    CSD csd
8086    unsigned num_blocks, read_block_size
8187    Iris::Page buffer_page
88    Iris::List cb_list
8289    static unsigned const buffer = 0x15000
8390
8491bool Mmc::send (unsigned cmd, unsigned arg, Response_type response_type, unsigned *response):
...... 
129136            d = MSC_RES
130137            cid.year = 2000 + (d >> 4 & 0xff)
131138            cid.month = d & 0xf
139            #if 1
140            Iris::debug ("CID: mid=%x, oid=%x %x, pnm=%x %x %x %x %x, prv=%x, psn=%x, year=%x, month=%x\n", cid.mid, cid.oid[0], cid.oid[1], cid.pnm[0], cid.pnm[1], cid.pnm[2], cid.pnm[3], cid.pnm[4], cid.prv, cid.psn, cid.year, cid.month)
141            #endif
132142        else:
133143            // Header (8) 1.0 1.0
134144            // Read out csd.
...... 
175185                    num_blocks >>= 9 - csd.read_bl_len
176186                else:
177187                    num_blocks <<= csd.read_bl_len - 9
188            #if 1
189            Iris::debug ("CSD: size=%x<<%x, r/w len=%x/%x, %s, %s, %s\n", csd.c_size, csd.c_size_mult, csd.read_bl_len, csd.write_bl_len, csd.copy ? "copy" : "no copy", csd.perm_write_protect ? "fixed write protect" : "no fixed write protect", csd.tmp_write_protect ? "write protect" : "no write protect")
190            #endif
191        unsigned c_size
192        unsigned c_size_mult
193        unsigned read_bl_len, write_bl_len
194        bool copy
195        bool perm_write_protect
196        bool tmp_write_protect
178197    else if response_type != NONE:
179198        unsigned r = MSC_RES
180199        if response_type == R3:
...... 
203222    return true
204223
205224void Mmc::reset ():
225    current_block_num = ~0
226    dirty = false
227    cb_list = Iris::my_memory.create_list ()
228    current_block = (unsigned *)(buffer + PAGE_SIZE)
206229    // Create a buffer to use for data transfer.
207230    buffer_page = Iris::my_memory.create_page ()
208231    Iris::my_memory.map (buffer_page, buffer)
...... 
348371        kdebug (" = ")
349372        kdebug_num (num_blocks * read_block_size)
350373        kdebug ("\n")
374        // Set up buffer memory.
375        for unsigned i = 0; i < 1 << csd.write_bl_len; i += PAGE_SIZE:
376            Iris::Page p = Iris::my_memory.create_page ()
377            p.set_flags (Iris::Page::PAYING | Iris::Page::FRAME)
378            Iris::my_memory.map (p, (unsigned)current_block + i)
379            Iris::free_cap (p)
380        Iris::Listitem item = cb_list.get_next ()
381        while item.code != Iris::Cap ().code:
382            Iris::Cap c = cb_list.get_cap (item)
383            c.invoke (0, ~0)
384            Iris::free_cap (c)
385            Iris::Listitem nextitem = cb_list.get_next (item);
386            Iris::free_cap (item)
387            item = nextitem
351388
352389void Mmc::release ():
353390    kdebug ("mmc release\n")
...... 
355392    have_sdmem = false
356393    have_io = false
357394    read_block_size = 0
395    if num_blocks != 0:
396        for unsigned i = 0; i < 1 << csd.write_bl_len; i += PAGE_SIZE:
397            Iris::Page p = Iris::my_memory.mapping ((void *)((unsigned)current_block + i))
398            Iris::my_memory.destroy (p)
399            Iris::free_cap (p)
400        if dirty:
401            Iris::debug ("Warning: sd/mmc card removed before data was written to it")
402        current_block_num = ~0
403        dirty = false
358404    num_blocks = 0
405    Iris::Listitem item = cb_list.get_next ()
406    while item.code != Iris::Cap ().code:
407        Iris::Cap c = cb_list.get_cap (item)
408        c.invoke (0, ~0)
409        Iris::free_cap (c)
410        Iris::Listitem nextitem = cb_list.get_next (item);
411        Iris::free_cap (item)
412        item = nextitem
359413
360414void Mmc::interrupt ():
361415    kdebug ("mmc interrupt\n")
362416
363void Mmc::fill_page (Iris::Page page, Iris::Num address, unsigned size, unsigned offset):
364    if address.h:
365        Iris::panic (0, "page too high: not supported")
417void Mmc::set_block (unsigned block):
418    if current_block_num == block:
366419        return
367    //kdebug ("smc get page ")
368    //kdebug_num (address.l)
369    //kdebug ("+")
370    //kdebug_num (size)
371    //kdebug ("@")
372    //kdebug_num (offset)
373    //kdebug ("\n")
374    unsigned blockmask = ~((1 << 9) - 1)
375    unsigned p = address.l & blockmask
376    size &= blockmask
377    offset &= ~PAGE_MASK
378    if size + offset > PAGE_SIZE:
379        size = PAGE_SIZE - offset
380    page.set_flags (Iris::Page::PAYING | Iris::Page::FRAME)
381    page.share (buffer_page)
382    buffer_page.set_flags (Iris::Page::PAYING | Iris::Page::FRAME)
420    if dirty && current_block_num != ~0:
421        MSC_NOB = 1
422        MSC_BLKLEN = 1 << csd.write_bl_len
423        if !send (24, (current_block_num << csd.write_bl_len), WR_DATA):
424            Iris::panic (0, "unable to send data")
425        MSC_IMASK = ~MSC_IMASK_TXFIFO_WR_REQ
426        for unsigned a = 0; a < 1 << csd.write_bl_len; a += 4:
427            while MSC_STAT & MSC_STAT_DATA_FIFO_FULL:
428                Iris::register_interrupt (IRQ_MSC)
429                Iris::wait_for_interrupt (IRQ_MSC)
430            MSC_TXFIFO = current_block[a >> 2]
431        MSC_IMASK = ~0
432        MSC_IREG = MSC_IREG_DATA_TRAN_DONE
433        //kdebug ("done writing page\n")
434    current_block_num = block
435    dirty = false
383436    MSC_NOB = 1
384437    MSC_BLKLEN = 1 << 9
385    for unsigned a = 0; a < size; a += 1 << 9:
386        //kdebug_num (a)
387        //kdebug ("/")
388        //kdebug_num (size)
389        //kdebug (" ==> ")
390        if !send (17, p + a, RD_DATA):
438    for unsigned a = 0; a < 1 << csd.write_bl_len; a += 1 << 9:
439        if !send (17, (block << csd.write_bl_len) + a, RD_DATA):
391440            Iris::panic (0, "unable to request data")
392441        MSC_IMASK = ~MSC_IMASK_RXFIFO_RD_REQ
393442        for unsigned aa = 0; aa < 1 << 9; aa += 4:
394443            while MSC_STAT & MSC_STAT_DATA_FIFO_EMPTY:
395444                Iris::register_interrupt (IRQ_MSC)
396445                Iris::wait_for_interrupt (IRQ_MSC)
397            *(unsigned *)(buffer + a + aa + offset) = MSC_RXFIFO
398            //unsigned d = *(unsigned *)(buffer + a + aa + offset)
399            //if (aa & 0x3f) == 0:
400                //kdebug ("\n")
401            //for unsigned i = 0; i < 4; ++i:
402                //kdebug (" ")
403                //kdebug_num (d >> (8 * i), 2)
404        //kdebug ("\n")
446            current_block[(a + aa) >> 2] = MSC_RXFIFO
405447        MSC_IMASK = ~0
406448        MSC_IREG = MSC_IREG_DATA_TRAN_DONE
407449    //kdebug ("done filling page\n")
408450
451void Mmc::read_page (Iris::Page page, Iris::Num address, unsigned size, unsigned offset):
452    if address.value () >> (csd.write_bl_len + 32):
453        Iris::panic (address.h, "page too high: not supported")
454    unsigned block = address.value () >> csd.write_bl_len
455    unsigned start_pos = address.l & (1 << csd.write_bl_len) - 1
456    set_block (block)
457    unsigned blockmask = ~((1 << 9) - 1)
458    size &= blockmask
459    offset &= ~PAGE_MASK & ~3
460    if size + offset > PAGE_SIZE:
461        size = PAGE_SIZE - offset
462    page.share (buffer_page)
463    buffer_page.set_flags (Iris::Page::PAYING | Iris::Page::FRAME)
464    for unsigned i = 0; i < size; i += 4:
465        ((unsigned *)buffer)[(offset + i) >> 2] = current_block[(start_pos + i) >> 2]
466
409467void Mmc::write_page (Iris::Page page, Iris::Num address, unsigned size, unsigned offset):
410    if address.h:
411        Iris::panic (1, "page too high: not supported")
412        return
468    if address.value () >> (csd.write_bl_len + 32):
469        Iris::panic (address.h, "page too high: not supported")
470    unsigned block = address.value () >> csd.write_bl_len
471    unsigned start_pos = address.l & (1 << csd.write_bl_len) - 1
472    set_block (block)
413473    unsigned blockmask = ~((1 << 9) - 1)
414    unsigned p = address.l & blockmask
415474    size &= blockmask
416    offset &= ~PAGE_MASK
475    offset &= ~PAGE_MASK & ~3
417476    if size + offset > PAGE_SIZE:
418477        size = PAGE_SIZE - offset
419478    page.share (buffer_page)
420479    buffer_page.set_flags (Iris::Page::PAYING | Iris::Page::FRAME)
421    MSC_NOB = 1
422    MSC_BLKLEN = 1 << 9
423    for unsigned a = 0; a < size; a += 1 << 9:
424        //kdebug_num (a)
425        //kdebug ("/")
426        //kdebug_num (size)
427        //kdebug ("\n")
428        if !send (24, p + a, WR_DATA):
429            Iris::panic (0, "unable to send data")
430        MSC_IMASK = ~MSC_IMASK_TXFIFO_WR_REQ
431        for unsigned aa = 0; aa < 1 << 9; aa += 4:
432            while MSC_STAT & MSC_STAT_DATA_FIFO_FULL:
433                Iris::register_interrupt (IRQ_MSC)
434                Iris::wait_for_interrupt (IRQ_MSC)
435            MSC_TXFIFO = *(unsigned *)(buffer + a + aa + offset)
436        MSC_IMASK = ~0
437        MSC_IREG = MSC_IREG_DATA_TRAN_DONE
438    //kdebug ("done writing page\n")
480    for unsigned i = 0; i < size; i += 4:
481        current_block[(start_pos + i) >> 2] = ((unsigned *)buffer)[(offset + i) >> 2]
482    dirty = true
439483
440484void Mmc::wait_write ():
441485    MSC_IMASK = ~MSC_IMASK_PRG_DONE
...... 
473517        mmc.detect ()
474518
475519    cap = Iris::my_receiver.create_capability (REQUEST)
476    Iris::my_parent.provide_capability <Iris::WString> (cap.copy ())
520    Iris::my_parent.provide_capability <Iris::WBlock> (cap.copy ())
477521    Iris::free_cap (cap)
478522
479523    Iris::my_parent.init_done ()
...... 
496540                //kdebug ("\n")
497541                switch Iris::recv.data[0].l:
498542                    case Iris::Block::GET_SIZE:
543                        Iris::debug ("get size\n")
499544                        unsigned long long size = mmc.get_num_blocks () * mmc.get_read_block_size ()
500545                        Iris::recv.reply.invoke (size)
501546                        break
502547                    case Iris::Block::GET_ALIGN_BITS:
548                        Iris::debug ("get align bits\n")
503549                        Iris::recv.reply.invoke (9)
504550                        break
505551                    case Iris::Block::GET_BLOCK:
552                        //Iris::debug ("get block\n")
506553                        Iris::Cap reply = Iris::get_reply ()
507554                        Iris::Page page = Iris::get_arg ()
508                        mmc.fill_page (page, Iris::recv.data[1], Iris::recv.data[0].h >> 16, Iris::recv.data[0].h & 0xffff)
555                        mmc.read_page (page, Iris::recv.data[1], Iris::recv.data[0].h >> 16, Iris::recv.data[0].h & 0xffff)
509556                        reply.invoke ()
510557                        Iris::free_cap (page)
511558                        Iris::free_cap (reply)
512559                        break
513560                    case Iris::WBlock::SET_BLOCK:
561                        Iris::debug ("set block\n")
514562                        Iris::Cap reply = Iris::get_reply ()
515563                        Iris::Page page = Iris::get_arg ()
516564                        mmc.write_page (page, Iris::recv.data[1], Iris::recv.data[0].h >> 16, Iris::recv.data[0].h & 0xffff)
...... 
519567                        Iris::free_cap (reply)
520568                        mmc.wait_write ()
521569                        break
522                    case Iris::WString::TRUNCATE:
570                    case Iris::Block::SET_CHANGE_CB:
571                        Iris::debug ("set change cb\n")
572                        Iris::Listitem item = Iris::get_arg ()
573                        Iris::Cap reply = Iris::get_reply ()
574                        mmc.add_cb (item)
575                        reply.invoke ()
576                        Iris::free_cap (item)
577                        Iris::free_cap (reply)
578                        break
579                    case Iris::WBlock::TRUNCATE:
580                        Iris::debug ("truncate\n")
523581                        // Fall through: don't support resizing.
524582                    default:
525583                        Iris::panic (0, "unexpected event for sd+mmc")

Archive Download the corresponding diff file

Branches:
master



interactive