Changes for page API контроллеров AZ®
Last modified by Max on 2025/03/02 15:18
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -15,6 +15,7 @@ 15 15 * 177224 - Primary Boot Register (BOOT1) 16 16 * 177226 - Alternate Boot Register (BOOT2) 17 17 18 + 18 18 The CSR register accepts commands in bits D0-D5 and the interrupt enable bit in bit D6, all write only, always zero is read. In bit D7, the readiness bit is read. One in it means that the previous command has been executed and the controller is ready for exchange. Zero means that the controller is busy executing the previous operation, the other registers are disabled, access to any of them will cause Trap to 4. If the execution of the previous command caused an error, bit D15 is set simultaneously with bit D7. 19 19 \\Writing to registers is done only in words; byte writing is not allowed. 20 20 \\All data exchange is conducted via DR. For commands with a single-word argument, this argument should be sent to DR, and then the command should be sent to CSR. For commands exchanging with the controller buffer, on the contrary, the command should be issued and only after it a data block of a certain length should be received or transmitted. ... ... @@ -74,9 +74,9 @@ 74 74 Note on the reset command. In fact, it is instantaneous - if the controller is not busy executing an operation that cannot be interrupted, specifically - SD data exchange. While the SD data exchange is in progress, the controller does not accept any commands and the reset command can be skipped. Therefore, if the controller is busy (bit D7 is zero), the reset command is issued again. This happens quite rarely (for example, double-clicking Ctrl/C when rewriting), usually, during normal operations, the wait for writing or reading is performed in a special place and, upon completion of this operation, not a reset is performed, but completely different actions. 75 75 76 76 77 -== 001: Selectdevice==78 +== **001: Выбор устройства** == 78 78 79 - Thecontrollersupportsup to32pseudo disks.The"deviceselection"commandselectsoneofthemfor operation.Commandcode001.Toselectadevice,youshouldsendthenumber of the drive you are going to work with to the data register(177222)andthensendthecode001totheCSR.Thecommandisexecutedinstantly,i.e.duringthetimetheCPUsendsthe"deviceselection"code.WhenattemptingtoselectanAZdiskthatisnot assigned an image file,anerroris returned in bitD15oftheCSRregister.80 +Контроллер поддерживает до 32х псевдодисков. Команда "выбор устройства" выбирает для работы один из них. Код команды 001. Для выбора устройства следует переслать в регистр данных (177222) номер накопителя, с которым собираемся работать и затем послать в CSR код 001. Команда выполняется мгновенно, т.е. за время, пока ЦП пересылает код "выбор устройства". ПРи попытке выбрать диск AZ, которому не назначен файл-образ, в бите D15 регистра CSR возвращается ошибка. 80 80 81 81 Пример программы: 82 82 ... ... @@ -83,22 +83,24 @@ 83 83 {{code language="assembler"}} 84 84 ;....................... 85 85 86 -SetUni = 001; Symbolicnameof the command87 - ; " Deviceselection"87 +SetUni = 001; Символическое наименование команды 88 + ; "Выбор устройства" 88 88 89 -; TheaddressCSR+2=DRremained in R3 from the previous fragment90 +; От предыдущего фрагмента в R3 остался адрес CSR+2=DR 90 90 91 -; We assume that in R0 in bits 0-3 there is the number of the 92 -; device, the remaining bits are zeros, the procedure for ;calculating this number is not shown. 92 +; Считаем, что в R0 в битах 0-3 находится номер 93 +; устройства, остальные биты - нули, процедура 94 +; вычисления этого номера не показана. 93 93 94 - MOV R0,@R3; Let'ssendtoDRthenumberof diskAZ,with95 - ; whichwearegoing to work with96 + MOV R0,@R3; Перешлем в DR номер диска AZ, с 97 + ; с которым собираемся работать 96 96 97 - MOV #SetUni,-(R3); and send the command "Drive selection", with the correction of the address in R3, which 98 -; now points to CSR again. 99 + MOV #SetUni,-(R3); и пошлем команду "Выбор 100 +; накопителя", с исправлением адреса в R3, который 101 +; теперь снова указывает на CSR. 99 99 100 - TST (R3)+; Let'scheckforanerror and again101 - ; movetheaddressinR3toDR103 + TST (R3)+; Проверим на ошибку и опять 104 + ; передвинем адрес в R3 на DR 102 102 BMI ERR2 103 103 104 104 ;........................ ... ... @@ -105,67 +105,64 @@ 105 105 {{/code}} 106 106 107 107 108 -== 002: Setblocknumber,lowbitsofblocknumber==111 +== **002: Установка номера блока, младшие биты номера блока** == 109 109 110 -The controller provides the machine with QBUS as disks AZ0 - AZ7 file-images of the DSK type on the micro-SD card. The size of these file-images and, accordingly, pseudo-disks, can be any, up to 4G each. Addressing on these pseudo-disks is direct - the block number received via QBUS, after shifting, is used as an offset from the beginning of the corresponding file-image. In fact, this is something like LBA on a PC. 111 -\\There are PDP-11 operating systems that support such disks - RSX-11, DIAMS, and some others. However, the most common OS - RT-11 - uses a WORD (16 bits) for the block number, and the code 0177777 is used in some places for special purposes and is not suitable as a disk size, so disks with a maximum number of blocks of 0177776, i.e. 65534 blocks (33553408 bytes or 32767 K bytes), can be used for RT-11. Therefore, there are two commands for setting the block number: to set the low-order bits of the block number - code 002 and to set the high-order bits of the block number - code 012. If the block number fits into 16 bits (for RT-11 - always), it is enough to use the command to set the low-order bits of the block number, the high-order bits are cleared. If the number does not fit into 16 digits, then first the lower bits must be output, and then the higher ones. If you try to immediately transmit the higher bits without first transmitting the lower ones, an error is returned. If the transmitted address goes beyond the file-image boundary, an error is also returned, no matter at what stage - either when transmitting the lower 16 bits of the block number, or when transmitting the higher ones. 113 +Контроллер предоставляет машинке с МПИ в качестве дисков AZ0 - AZ7 файл-образы типа DSK на карточке микро-SD. Размер этих файл-образов и, соответственно, псевдодисков, может быть любым, вплоть до 4Г каждый. Адресация на этих псевдодисках прямая - полученный по МПИ номер блока, после сдвига, используется в качестве смещения от начала соответствующего файл-образа. Фактически, это нечто, вроде LBA на PC. 114 +\\Существуют операционные системы PDP-11, поддерживающие такие диски - RSX-11, ДИАМС, еще что-то. Однако, самая распространенная ОС - RT-11 - использует для номера блока СЛОВО (16 бит), причем код 0177777 кое-где используется в специальных целях и как размер диска не годится, поэтому для RT-11 могут быть использованы диски с максимальным числом блоков 0177776, т.е. 65534 блока (33553408 байт или 32767 К байт). Поэтому команды установки номера блока две: установить младшие биты номера блока - код 002 и установить старшие биты номера блока - код 012. Если номер блока помещается в 16 разрядов (для RT-11 - всегда), достаточно использовать команду установки младших битов номера блока, старшие биты при этом очищаются. Если номер не помещается в 16 разрядов, то сначала надо выдавать младшие биты, а потом старшие. Если попытаться сразу передать старшие биты без предварительной передачи младших, выдается ошибка. Если переданный адрес выходит за границу файл-образа, также выдается ошибка, не важно, на каком этапе - хоть при передаче младших 16 битов номера блока, хоть при передаче старших. 115 +\\Для выполнения этих действий следует переслать требуемую часть битов номера блока в DR и затем переслать в CSR код команды, после чего следует проверить на ошибку. Команды мгновенные, т.е. выполняются за один цикл обращения по МПИ. 116 +\\Пример программы в 16-разрядном варианте: 112 112 113 - 114 -To perform these actions, you must send the required part of the block number bits to DR and then send the command code to CSR, after which you must check for an error. The commands are instantaneous, i.e. they are executed in one QBUS access cycle. 115 -\\Example of a program - 16-bit version block number: 116 - 117 117 {{code language="assembler"}} 118 118 ;....................................... 119 119 120 -SetBlk=002; Symbolicnameof the command121 -; " Setthelower16bitsofthe block number"121 +SetBlk=002; Символическое наименование команды 122 +; "Установить младшие 16 разрядов номера блока" 122 122 123 -; TheaddressDR124 -; (177222) remained in R3 from the previous fragment125 -; WeassumethatthecelllabeledBLCURcontainsthe16-126 -; bitdiskaddress(theblocknumber to be127 -; inputoroutput).Theprocedureforobtainingthis number is not128 -; shown124 +; От предыдущего фрагмента в R3 остался адрес DR 125 +; (177222) 126 +; Считаем, что в ячейке с меткой BLCUR находится 16- 127 +; разрядный дисковый адрес (номер блока, подлежащего 128 +; вводу или выводу). Процедура получения этого номера не 129 +; показана 129 129 130 - MOV BLCUR,@R3; Weplacetheblock number to be exchanged inDR.131 - 131 + MOV BLCUR,@R3; Помещаем в DR номер блока, 132 + ; подлежащего обмену. 132 132 133 - MOV #SetBlk,-(R3); Wesendthecommand to theCSR134 -; donotforgetthatthe address inR3willdecreaseby135 -; 2 beforesendingand will remain so134 + MOV #SetBlk,-(R3); Посылаем команду в CSR 135 +; не забываем, адрес в R3 перед пересылкой уменьшится на 136 +; 2 и таким останется 136 136 137 - TST @R3; Wecheckfor an error138 + TST @R3; Проверяем на ошибку 138 138 139 139 BMI ERR3 140 140 141 -; Inthe32-bitversion,thesameactionsshould be142 -; repeatforthesenior16bits(actually,143 -; senior7,therestshouldbe zeros,becausethe maximum144 -; sizeofapseudo disk is4G)ofthe disk address.142 +; В 32-разрядном варианте те же действия следует 143 +; повторить для старших 16 разрядов (на самом деле, 144 +; старших 7, остальные должны быть нулями, ибо максимум 145 +; размера псевдодиска - 4Г) дискового адреса. 145 145 146 -; NotethatinR3theCSRaddress remains,andnot147 -; DR, asinthetwoprevious fragments.Thisis done148 -; on purpose.147 +; Обратите внимание, что в R3 остался адрес CSR, а не 148 +; DR, как в двух предыдущих фрагментах. Это сделано 149 +; специально. 149 149 150 150 ;....................................... 151 151 {{/code}} 152 152 153 153 154 -== 003: OpenHFSTable of Contents==155 +== **003: Открыть оглавление HFS** == 155 155 156 -Sequence of actions: 157 +Последовательность действий 158 +\\• [[сбросить контроллер>>doc:||anchor="H000:A042143144043E44143A43E43D44244043E43B43B435440430"]] 159 +• подать в CSR команду "Принять блок данных в буфер" и передать пословно всю строку с полным текстом пути (Full Path) к требуемому оглавлению. Строка должна завершаться нулевым байтом (0х00) и быть не длиннее 384 байт (192 слов). 160 +• переслать в CSR код команды "Открыть оглавление" 161 +• дождаться ее окончания (команда длительная) 162 +• проверить на ошибку 157 157 158 -• reset the controller 159 -• send the command "Accept data block to buffer" to the CSR and transmit the entire line with the full path text (Full Path) to the required table of contents word by word. The line must end with a zero byte (0x00) and be no longer than 384 bytes (192 words). 160 -• send the "Open table of contents" command code to the CSR 161 -• wait for it to finish (the command is long) 162 -• check for errors 164 +[[**//Пример утилиты - AZDIR//**>>url:https://forum.maxiol.com/index.php?s=&showtopic=5605&view=findpost&p=59418]] 163 163 164 -[[Example utility - AZDIR>>url:https://forum.maxiol.com/index.php?s=&showtopic=5605&view=findpost&p=59418]] 165 165 167 +Пример программы: 166 166 167 -Example program: 168 - 169 169 {{code language="assembler"}} 170 170 ;............................. 171 171 AZ$CSR = 177220 ... ... @@ -173,44 +173,46 @@ 173 173 OpnDir = 003 174 174 175 175 MOV #AZ$CSR,R3 176 -; The DirPtr cell contains a pointer to the beginning of the field with Full 177 -; Path. We assume that the string is terminated by three zero 178 -; bytes in order to recognize the end of the transfer of the 179 -; string word by word by zero. Indeed, if the number of 180 -; characters in the string is even, then the next two bytes of zeros 181 -; form a zero word; if it is odd, then one zero 182 -; will go away with the last character of the string, and the zero 183 -; word is formed by the second and third zero bytes, 184 -; ending the string. That is, such an end of the string, 185 -; transferred word by word, is quite reliable. 176 + 177 +; Ячейка DirPtr содержит указатель на начало поля с Full 178 +; Path. Считаем, что строка завершается тремя нулевыми 179 +; байтами, чтобы распознать по нулю окончание пересылки 180 +; строки пословно. Действительно, если количество 181 +; символов в строке четное, то следующие два байта нулей 182 +; образуют нулевое слово; если же нечетное, то один ноль 183 +; уйдет вместе с последним символом строки, а нулевое 184 +; слово образуют второй и третий нулевые байты, 185 +; оканчивающие строку. То есть, такое окончание строки, 186 +; передаваемой пословно, вполне надежно. 186 186 MOV DirPtr,R2 187 187 188 - MOV #WrBuf,(R3)+; Weissuethe"Writeto189 - ; buffer"commandandtransmit the string190 -11$: MOV (R2)+,@R3; wordbyword,191 - BNE 11$ ; untilzeroissent,189 + MOV #WrBuf,(R3)+; Подаем команду "Запись в 190 + ; буфер" и передаем строку 191 +11$: MOV (R2)+,@R3; пословно, до тех пор, 192 + BNE 11$ ; пока не перешлется ноль 192 192 193 - MOV #OpnDir,-(R3); Weissuethe"Open194 - ; table of contents"command194 + MOV #OpnDir,-(R3); Подаем команду "Открыть 195 + ; оглавление" 195 195 196 -12$: TSTB @R3; andwaitforthecontroller to197 - BPL 12$; execute it,198 - TST @R3; afterwhichwecheckfor an error.199 - BMI Err10; Error-->197 +12$: TSTB @R3; и ждем, когда контроллер ее 198 + BPL 12$; выполнит, 199 + TST @R3; после чего проверяем на ошибку. 200 + BMI Err10; Ошибка --> 200 200 ;............................. 201 201 {{/code}} 202 202 203 -== 004: Mountadisk==204 +== **004: Монтировать диск** == 204 204 205 -Sequence of actions: 206 -• Reset the controller 207 -• Send a line to the controller with a record similar to the lines describing the disks in the AZ.INI file 208 -• Issue the "Mount disk" command 209 -• Wait for it to finish (the command is long) 210 -• Check for errors 211 -The selected AZnn drive MUST NOT have a disk mounted. If it is mounted, the old disk should be unmounted before mounting a new one - command 014 206 +Порядок действий: 207 +• [[Сбросить контроллер>>doc:||anchor="H000:A042143144043E44143A43E43D44244043E43B43B435440430"]] 208 +• Переслать в контроллер строку с записью, подобной строкам описания дисков в файле AZ.INI 209 +• Выдать команду "Монтировать диск" 210 +• Дождаться ее окончания (команда длительная) 211 +• Проверить на ошибки 212 +На выбранный накопитель AZnn НЕ ДОЛЖЕН быть смонтирован диск. Если он таки смонтирован, перед монтированием туда нового диска следует размонтировать старый - команда 014 213 + 212 212 213 - Exampleprogram:215 +Пример программы: 214 214 215 215 {{code language="assembler"}} 216 216 ;.................. ... ... @@ -220,20 +220,20 @@ 220 220 MOV #AZ$CSR,R3 221 221 222 222 20$: CLR @R3; 223 - TSTB @R3; Resetthe controller225 + TSTB @R3; Сбросим контроллер 224 224 BPL 20$; 225 225 226 - MOV #WrBuf,(R3)+; Senditastring227 - MOV #MDTXT,R2; withtheassignment command228 + MOV #WrBuf,(R3)+; Перешлем в него строку 229 + MOV #MDTXT,R2; с командой назначения 228 228 MOV #MDLEN/2,R1; 229 229 21$: MOV (R2)+,@R3; 230 230 SOB R1,21$; 231 231 232 - MOV #AZMNT,-(R3); andpassitto233 -22$: TSTB @R3 ; execution234 + MOV #AZMNT,-(R3); и отдадим ее на 235 +22$: TSTB @R3 ; исполнение 234 234 BPL 22$ ; 235 235 236 - TST @R3; thencheckforanerror238 + TST @R3; после чего проверим на ошибку 237 237 BMI Err11; 238 238 ;......................... 239 239 ... ... @@ -242,57 +242,57 @@ 242 242 ;.................. 243 243 {{/code}} 244 244 245 - Inthisfragment,the51SYS_DS.DSKimage file is mounted on the AZ4 disk,locatedintheSYSTEMfolder,whichislocatedintheDISKSfolder,whichislocatedintheroot directory of the micro-SDcard.247 +В этом фрагменте на диск AZ4 монтируется файл-образ 51SYS_DS.DSK, лежащий в папке SYSTEM, которая лежит в папке DISKS, лежащей в корневом оглавлении карточки микро-SD. 246 246 247 247 248 -== 005: Readingblockintobuffer==250 +== **005: Чтение блока в буфер** == 249 249 250 - Thecontrollerhasabuilt-inbufferfor256words(512bytes).In fact,thisispartoftheSTM32microcontroller's RAM,allocatedinitsprogramforthisbuffer.Allexchangeinthemaincommandblockgoesthroughthis buffer.251 -\\ TheAZdiskmemoryisrepresentedasa set of blocks, each512bytesin size.SuchablockistheonlyavailableunitforexchangingdatawithAZdisks.Theblocksarenumberedfromzero to65533forthe16-bitversionorupto8388607forthe32-bitversion-thisiswhenusingAZdrivesofthe maximum permissible capacity.Noonepreventsyoufromusingdrivesof a smaller capacity-theactualsizeofthedrive is equal to the size of the file-imagemountedonthisdrive.Anerrorwillberegisteredifyoutryto access beyond the file-image.252 -\\ Command005 -readingablockfromMicroSDtothe buffer. Fromthepseudo-diskAZn,previouslyselectedbythe command"Selectdevice",theblockwhosenumberistransmittedbythecommand(commands) "Setblocknumber"isstartedfor reading.Long-term command.253 -\\ In fact,ablockfromaMicroSDcardisread in about500-800µs.Duringthistime,thecontrollergoesintoastatethatduringthediscussionofthe project was called"I think,pleasedonot interfere."Namely,fortheentiretimeofitsexecution,alldevice registers are disabled,exceptforCSR,inwhichzeroisreadaslongasthecontrollerisbusyexecuting this command.Aftertheblockisread,theremainingcontrollerregistersare connected to the QBUS,bitD7 (ready)isset inCSRand,ifbitD6 (interruptenable)wasset inCSR,aninterruptwithvector0174is generated.254 -\\ Anexamplewithoutinterruptions is trivial:252 +У контроллера имеется [[встроенный буфер на 256 слов (512 байт).>>doc:||anchor="H411443444435440430"]] Фактически, это часть оперативной памяти микроконтроллера STM32, выделенная в его программе под этот буфер. Весь обмен в основном блоке команд идет через этот буфер. 253 +\\Память дисков AZ представлена, как набор блоков объемом 512 байт каждый. Такой блок - единственная доступная единица для обмена данными с дисками AZ. Блоки пронумерованы от нуля до 65533 для 16-разрядного варианта или до 8388607 для 32-разрядного - это при использовании накопителей AZ максимально допустимой емкости. Никто не мешает использовать накопители меньшей емкости - фактический размер накопителя равен размеру файл-образа, смонтированного на этот накопитель. При попытке обратиться за пределы файл-образа будет зарегистрирована ошибка. 254 +\\Команда 005 - чтение блока с MicroSD в [[буфер>>doc:||anchor="Micro"]]. С псевдодиска AZn, выбранного ранее командой "Выбор устройства" запускается на чтение блок, номер которого передан командой (командами) "Установка номера блока". Команда длительного действия. 255 +\\Фактически, блок с карточки MicroSD читается, примерно, 500-800 мкс. На это время контроллер переходит в состояние, которое во время обсуждения проекта получило название "Думаю, прошу не мешать." А именно, на все время ее исполнения отключаются все регистры устройства, кроме CSR, в котором считывается ноль до тех пор, пока контроллер занят исполнением этой команды. По окончании считывания блока к МПИ подключаются остальные регистры контроллера, взводится бит D7 (готовность) в CSR и, если был установлен бит D6 (разрешение прерываний) в CSR, вырабатывается прерывание с вектором 0174. 256 +\\Пример без прерываний тривиален: 255 255 256 256 {{code language="assembler"}} 257 257 ;................................... 258 258 259 -CmdRea=005; symbolic name of the "Read block" command 261 +CmdRea=005; символическое наименование команды "Читать 262 +; блок" 260 260 261 -; InR3wehavetheCSRaddressleftfromthe previous fragment.262 -; Wesendthereadcommandcode there264 +; В R3 у нас от предыдущего фрагмента остался адрес CSR. 265 +; Пересылаем туда код команды чтения 263 263 MOV #CmdRea,@R3 264 -2$: TSTB @R3 Let'schecktheready bit265 - BPL 2$; Notready->wegoto check again266 -; once267 - TST @R3; Let'scheckfor an error267 +2$: TSTB @R3 ; Проверим бит готовности 268 + BPL 2$; Не готово -> уходим проверять еще 269 + ; раз 270 + TST @R3; Проверим на ошибку 268 268 BMI ERR4 269 -; Hereagain,unlikethefragmentsofpp. 3.1and270 -; 3.2, wehavetheCSRaddress left in R3,notDR.272 +; Здесь у нас опять, в отличие от фрагментов пп. 3.1 и 273 +; 3.2, в R3 остался адрес CSR, а не DR. 271 271 272 272 ;................................... 273 273 {{/code}} 274 274 275 275 276 -== 006: Writeblockfrombuffertodisk==279 +== **006: Записать блок из буфера на диск** == 277 277 278 -Command code 006. The buffer contents are written to the selected pseudo-disk at the specified disk address (block number). Before writing, checks are performed (1) "was there a write to the buffer?", if not, an error is returned and (2) "is the buffer completely filled?", if not (for the last shortened block of the file), the rest of the buffer is cleared with zeros. Then the block is written to the media. The operation is lengthy, after it is started the controller, as with reading, goes into the "I think, please do not interfere" state. And just as with reading, you must wait for the end of this operation, by the same means as with reading. 281 +Код команды 006. Содержимое буфера пишется на выбранный псевдодиск по заданному дисковомк адресу (номеру блока). Перед записью выполняются проверки (1) "была ли запись в буфер?", если нет, выдается ошибка и (2) "заполнен ли буфер полностью?", если нет (для последнего укороченного блока файла), остаток буфера очищается нулями. Далее производится запись блока на носитель. Операция длительная, после ее запуска контроллер, как и при чтении переходит в состояние "Думаю, прошу не мешать". И так же, как и при чтении окончания этой операции надо дождаться, теми же средствами, как и при чтении. 282 +\\Пример программы без прерываний: 279 279 280 - 281 -Example of a program without interrupts: 282 - 283 283 {{code language="assembler"}} 284 284 ;............................................................... 285 285 286 -CmdWri=006; symbolicnameofthe"Write287 -; block"command287 +CmdWri=006; символическое наименование команды "Писать 288 + ; блок" 288 288 289 -; InR3wehavetheDRaddressleftoverfrom the previous fragment.290 -; Wecorrectitto theCSRandsendthe291 -; write command code there290 +; В R3 у нас от предыдущего фрагмента остался адрес DR. 291 +; Исправляем его на CSR и пересылаем туда код команды 292 +; записи 292 292 MOV #CmdWri,-(R3) 293 -5$: TSTB @R3 ; Let's check the ready bit 294 - BPL 5$; Not ready -> we go and check again once 295 - TST @R3; Let's check for an error 294 +5$: TSTB @R3 ; Проверим бит готовности 295 + BPL 5$; Не готово -> уходим проверять еще 296 + ; раз 297 + TST @R3; Проверим на ошибку 296 296 BMI ERR5 297 297 298 298 ;.................................................................... ... ... @@ -299,73 +299,73 @@ 299 299 {{/code}} 300 300 301 301 302 -== 007: Getdisksize==304 +== **007: Получить размер псевдодиска** == 303 303 304 - Therearetwocommandsforobtaining the size of a pseudo-disk,i.e.theAZnfile-imagemountedonthe selected pseudo-drive.305 -\\ IftheOSbeing used(oraprogramworkingwithdiskswithout an OS)canworkwithlarge(morethan32M)disks,youshouldusethecommand with thecode017.Thesequence of actions:resetthecontroller(command000),selectthedrive(p. 3.2)andsendthecode017to the CSR,andthen,withoutanywaiting,readfromDRfirstthe lower word,andthenthehigherwordofthesizeofthe selected drive(image file).306 -\\ IftheOSyouareusingcannotworkwithdiskslarger than32M(RT-11),youshouldusethe007command-getthepseudo-disksizewithalimit of up to32M.Thesteps are similar:resetthe controller,selectthe disk,sendthe007 code to theCSRandreadonewordofthe pseudo-disk size fromDR.Ifthesizeoftheimagefilemountedontheselectedpseudo-driveis larger than65534blocks,thecontrollerreturnsthenumber65534instead of this "large" size.Weremindyouthat the number65535isusedinsomeplacesforspecialpurposesandcannotbe the disk size.307 -\\ Wealsoremindyouthatiftheimagefileis not mounted on this drive,thesequenceofactionswill not work(command001selectdevice)andtheprogramexecutionwillsimplynotreachthis point.Therefore,thesecommandsdonotprovidefor errors.306 +Есть две команды получения размера псевдодиска, т.е. смонтированного на выбранный псевдопривод AZn файл-образа. 307 +\\Если используемая ОС (или программа, работающая с дисками без ОС) умеет работать с большими (больше 32М) дисками, следует пользоваться [[командой с кодом 017>>doc:||anchor="H017:A041F43E43B44344743844244C44043043743C43544043F44143543243443E43443844143A4302C43143E43B44C44843E439"]]. Последовательность действий: сбросить контроллер (команда 000), выбрать накопитель (п. 3.2) и переслать в CSR код 017, а затем, без каких-либо ожиданий, считать из DR сначала младшее, и следом за ним старшее слово размера выбранного накопителя (файл-образа). 308 +\\Если используемая ОС не умеет работать с дисками бОльшими, чем 32М (RT-11), следует пользоваться командой 007 - получить размер псевдодиска с ограничением до 32М. Действия похожие: сбрасываем контроллер, выбираем диск, посылаем в CSR код 007 и считываем из DR одно слово размера псевдодиска. Если размер файл-образа, смонтированного на выбранный псевдопривод, больше 65534 блоков, вместо этого "большого" размера, контроллер возвращает число 65534. Напоминаем, что число 65535 кое-где используется в специальных целях и не может быть размером диска. 309 +\\Также напоминаем, что если на этот накопитель не смонтирован файл-образ, последовательность действий не пройдет (команда 001 выбор устройства) и исполнение программы до этого места просто не дойдет. Поэтому ошибок у этих команд не предусмотрено. 308 308 309 - Exampleofaprogram with"small"disks311 +Пример программы с "малыми" дисками 310 310 311 311 {{code language="assembler"}} 312 312 ;...................................... 313 313 314 -GetSiz=007; Getthe"small"disksize316 +GetSiz=007; Получить "малый" размер диска 315 315 316 -; Fromfragment3.2 (diskselection)wehaveinR3317 -; DR address(177222)318 +; От фрагмента 3.2 (выбор диска) у нас в R3 остался 319 +; адрес DR (177222) 318 318 319 - MOV #GetSiz,-(R3); sendthe command320 - TST (R3)+; returntheaddress inR3backtoDR321 + MOV #GetSiz,-(R3); пошлем команду 322 + TST (R3)+; вернем адрес в R3 назад, на DR 321 321 MOV @R3,DskSiz 322 322 ;...................................... 323 323 {{/code}} 324 324 325 -== 010: Allownetworkoperation==327 +== **010: Разрешить работу сети** == 326 326 327 -Command code 010. Having completed the sequence of actions for transferring the next portion of data, and expecting that the next request will not follow immediately, you can "utilize" the processor time of the STM32 microcontroller, which is the basis of AZ - occupy it with servicing the network. In the same RT-11, this can be done before exiting the AZ driver, before the .DRFIN macro command, which completes the execution of the input-output request. 328 -\\Indeed, the I/O operation is completed, the CPU program in the system will prepare a new portion of data for output, or figure out (based on the previously read data) where it should read something else, or generally think about something of its own. smile.gif In other words, after the I/O request is completed, there is a fairly high probability that there will be a pause in working with the AZ disks. So, the time of this pause can be given to servicing the network. To do this, before executing the .DRFIN macro in RT-11 or its analogue in other OS, you should send code 110 (enable network plus enable interrupts) to the CSR. 329 +Код команды 010. Закончив последовательность действий по передаче очередной порции данных, и ожидая, что следующий запрос последует не сразу же, можно "утилизировать" процессорное время микроконтроллера STM32, составляющего основу AZ - занять его обслуживанием сети. В той же RT-11 это можно сделать перед выходом из драйвера AZ, перед макрокомандой .DRFIN, завершающей исполнение запроса ввода-вывода. 330 +\\Действительно, операция ввода-вывода завершена, программа ЦП в системе будет готовить новую порцию данных для вывода, или соображать (на основании предыдущих прочитанных данных), где ей еще что-то прочитать, или вообще размышлять о чем-то своём. [[image:https://forum.maxiol.com/style_emoticons/default/smile.gif||alt="smile.gif"]] Другими словами, после окончания запроса ввода-вывода, довольно высока вероятность того, что последует пауза в работе с дисками AZ. Вот, время этой паузы и можно отдать на обслуживание сети. Для этого, перед исполнением макрокоманды .DRFIN в RT-11 или ее аналога в других ОС следует отправить в CSR код 110 (разрешить сеть плюс разрешить прерывания). 331 +\\Прерывание в этом случае не произойдет, оно активируется только по завершении "длительных" операций, которые переводят контроллер в состояние "Думаю, прошу не мешать", а установленный в "1" триггер разрешения прерываний, кроме этого, разрешает еще и работу сети, если она активирована. При запуске следующей операции ввода-вывода действия в п. 3.1 (сброс контроллера) сбросят и этот триггер, после чего программа обслуживания сети, обнаружив сброс этого триггера, прекратит (приостановит) свою работу и вернет управление основной программе обслуживания дисков AZ. Максимум, что можно заметить со стороны ЦП - это небольшая (10-20 мкс) задержка исполнения команды сброса, но это вполне умеренная плата за сетевые возможности. 332 + 329 329 334 +== **011: Получить таблицу назначений приводов AZn** == 330 330 331 -In this case, the interrupt will not occur, it is activated only upon completion of "long" operations that transfer the controller to the "Thinking, please do not interfere" state, and the interrupt enable trigger set to "1" also enables network operation if it is activated. When the next input-output operation is started, the actions in paragraph 3.1 (controller reset) will also reset this trigger, after which the network service program, having detected the reset of this trigger, will stop (suspend) its work and return control to the main disk service program AZ. The maximum that can be noticed from the CPU side is a small (10-20 µs) delay in executing the reset command, but this is a very reasonable price for network capabilities. 336 +Код команды 011. Получив эту команду, контроллер переключается с буфера для блока на свою внутреннюю таблицу назначений (32 строки по 140 байт каждая)* . Перед выдачей этой команды следует сбросить контроллер. После выдачи этой команды следует выдать команду 015 (чтение буфера), но в этом случае будет читаться не буфер, а та самая таблица, последовательно, слово за словом. 337 +\\* начиная с версии v17, длина имени файла уже не 130 байт, а 386 байт (последнее слово - нулевое, для окончания строки) 332 332 333 - ==011:GetAZn driveassignmenttable==339 +[[**//пример утилиты AZSMNT//**>>url:https://forum.maxiol.com/index.php?s=&showtopic=5605&view=findpost&p=59420]] 334 334 335 -Command code 011. Upon receiving this command, the controller switches from the block buffer to its internal assignment table (32 lines of 140 bytes each)*. Before issuing this command, the controller should be reset. After issuing this command, command 015 (read buffer) should be issued, but in this case it will not be the buffer that is read, but the same table, sequentially, word by word. 336 -\\* starting with v17, the file name length is no longer 130 bytes, but 386 bytes (the last word is zero, to end the line) 337 337 338 - [[AZSMNTutility example>>url:https://forum.maxiol.com/index.php?s=&showtopic=5605&view=findpost&p=59420]]342 +Пример программы: 339 339 340 - 341 -Example program: 342 - 343 343 {{code language="assembler"}} 344 344 ;................................... 345 -AZ$CSR = 177220; C ontroller CSR346 -RdBuf = 012; Command"Readfromcontrollermemory"347 -RdTbl = 011; Command"Readassignmenttable"348 -TblSiz = 1120.; Tablelengthinbytes(decimal)346 +AZ$CSR = 177220; CSR контроллера 347 +RdBuf = 012; Команда "Читать из памяти контроллера" 348 +RdTbl = 011; Команда "Читать таблицу назначений" 349 +TblSiz = 1120.; Длина таблицы в байтах (десятичная) 349 349 350 -; We assume that R2 contains the address of the first word of the 351 -; memory area for the assignment table. We do not show the procedure for obtaining this address. 351 +; Считаем, что в R2 находится адрес первого слова 352 +; области памяти для таблицы назначений. Процедуру 353 +; получения этого адреса не показываем. 352 352 353 - MOV #AZ$CSR,R3; Preparingthe controllerCSR355 + MOV #AZ$CSR,R3; Готовим CSR контроллера 354 354 10$: CLR @R3; 355 - TSTB @R3; Resetthe controller357 + TSTB @R3; Сбросим контроллер 356 356 BPL 10$; 357 357 358 - MOV #RdTbl,@R3; Command"Transfer359 - ; table"360 + MOV #RdTbl,@R3; Команда "Передать 361 + ; таблицу" 360 360 361 - MOV #RdBuf,(R3+); Command"Readfrom362 -; controllermemory.Atthesametime,move the address inR3363 -; totheDRofthe controller(177222).363 + MOV #RdBuf,(R3+); Команда "Читать из 364 +; памяти контроллера. Одновременно передвинем адрес в R3 365 +; на DR контроллера (177222). 364 364 365 - MOV #TblSiz/2,R1; Preparetheword counter367 + MOV #TblSiz/2,R1; Готовим счетчик слов 366 366 367 -11$: MOV @R3,(R2)+; Sendthecurrent word368 -SOB R1,11$; andrepeat560times369 +11$: MOV @R3,(R2)+; Перешлем текущее слово 370 + SOB R1,11$; и повторим 560 раз 369 369 ;................................... 370 370 {{/code}} 371 371