(a) Change STM_SetTrBuf in the dotted line part to STM_SetTrFunc.
STM_SetTrFunc(b_stm, decodeFunc, read_buf);
This causes decodeFunc to be invoked each time the server function STM_ExecServer tries to transfer stream B data.
(b) “decodeFunc” is as follows.
Uint8 read_buf [READBUF_SIZE];
Sint32 decodeFunc (void * obj, StmHn stm, Sint32 nsct) | * / * / * / * / * / |
| / * Conversion from number of sectors to number of words (called before transfer starts) nlongword = STM_SctToWord (stm, nsct) / 2; | * / |
src = STM_StartTrans (stm, & dadr); / * Start transfer | * / |
buffer = (Uint8 *) obj; / * The third argument of STM_SetTrFunc is passed to obj | * / |
for (i = 0; i | * / * / |
(c) Must be transferred in units of sectors. (d) If data transfer has not been completed when decodeFunc ends, (-1) must be returned. In this case, other streams cannot be transferred until the data transfer is completed. Once you ’ve transferred the data, Returns the number of transferred sectors. During this time, do not call STM_StartTrans.