Skip to content

Commit 050ff78

Browse files
Reinhardt Peng(彭成名)Reinhardt Peng(彭成名)
authored andcommitted
up-to-date EG915U spi nor flash &EG915UEUABR01A01V02M08_OCPU_QPY
1 parent b630050 commit 050ff78

File tree

2 files changed

+182
-92
lines changed

2 files changed

+182
-92
lines changed

en-us/api/pythonStdlib.md

Lines changed: 91 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ b'\xb3\xc9Y\x1b\xe9'
204204

205205

206206

207-
##### Initialize SD card driver(SPI mode)
207+
##### Register storage device - SPI - SD card
208208

209209
At present, it is only supported by ec600n / ec800n platforms.
210210

@@ -233,49 +233,7 @@ Initialize SD card and communicate with SD card. Use SPI communication mode.
233233

234234

235235

236-
##### Mount file system
237-
238-
> **uos.mount(vfs_obj, path)**
239-
240-
Mount the underlying file system to VFS.
241-
242-
* Parameters
243-
244-
|Parameter | parameter type | parameter description|
245-
| ------- | ---------- | ---------------- |
246-
| vfs_ Obj | VFS object | file system object|
247-
|Path | str | root directory of file system|
248-
249-
* Return Value
250-
251-
* None
252-
253-
* Example
254-
255-
```python
256-
>>> cdev = uos.VfsFat(1, 0, 4, 1)
257-
>>> uos.mount(cdev, '/sd')
258-
```
259-
260-
-SD card usage example(SPI mode)
261-
262-
At present, it is only supported by ec600n / ec800n platforms.
263-
264-
```python
265-
>>> cdev = uos.VfsFat(1, 0, 4, 1)
266-
>>> uos.mount(cdev, '/sd')
267-
>>> f = open('/sd/test.txt','w+')
268-
>>> f.write('0123456')
269-
>>> f.close()
270-
>>> uos.listdir('/sd')
271-
>>> f = open('/sd/test.txt','r')
272-
>>> f.read()
273-
>>> f.close()
274-
```
275-
276-
277-
278-
##### Initialize SD card driver(SDIO mode)
236+
##### Register storage device - SDIO - SD card
279237

280238
At present,it is only supported by EC600U/EC200U platforms.
281239

@@ -306,7 +264,7 @@ Return vfs object if the execution is successful, otherwise report error.
306264
>>> udev = VfsSd("sd_fs")
307265
```
308266

309-
##### Set detection pin
267+
###### Set detection pin
310268

311269
> **set_det(vfs_obj.GPIOn,mode)**
312270
@@ -332,7 +290,7 @@ Return 0 if the execution is successful, otherwise return -1.
332290
>>> udev.set_det(udev.GPIO10,0)#Use gpio10 as the card detection pin, insert the SD card, the detection port is low level, plug out the SD card, the detection port is high level(the actual use depends on the hardware).
333291
```
334292

335-
##### Setting the card insertion and removal callback function
293+
###### Setting the card insertion and removal callback function
336294

337295
> **set_callback(fun)**
338296
@@ -380,6 +338,93 @@ def call_back(para):
380338
udev.set_callback(call_back)
381339
```
382340

341+
342+
343+
##### **Register storage device - SPI NOR FLASH**
344+
345+
At present,it is only supported by EG915U platforms.
346+
347+
> uos.VfsLfs1(readsize,progsize,lookahead,pname,spi_port,spi_clk)
348+
349+
Initialize spi nor flash and Plug-in nor flash communication. Use SPI communication mode.
350+
351+
* Parameter
352+
353+
| Parameter | Type | Description |
354+
| --------- | ---- | ------------------------------------------------------------ |
355+
| readsize | int | Reserved, not used yet |
356+
| progsize | int | Reserved, not used yet |
357+
| lookahead | int | Reserved, not used yet |
358+
| pname | str | Fixed to "ext_fs". Subsequent expansion |
359+
| spi_port | int | Supported ports refer to the SPI chapter description |
360+
| spi_clk | int | clock frequency:<br />EG915U:0:6.25M 1:12.5M 2:25M 3:50M 4:3.125M 5:1.5625M 6:781.25K |
361+
362+
* Return value
363+
364+
VfsLfs1 object will be returned if successful, and OSError 19 will be returned if failed.
365+
366+
* Example
367+
368+
```python
369+
>>>ldev = uos.VfsLfs1(32, 32, 32, "ext_fs",1,0)
370+
>>>uos.mount(ldev,'/ext')
371+
>>>f = open('/ext/test.txt','w+')
372+
>>>f.write('hello world!!!')
373+
>>>f.close()
374+
375+
>>>uos.listdir('ext')
376+
377+
>>>f = open('/ext/test.txt','r')
378+
>>>f.read()
379+
>>>f.close()
380+
381+
```
382+
383+
384+
385+
386+
##### Mount file system
387+
388+
> **uos.mount(vfs_obj, path)**
389+
390+
Mount the underlying file system to VFS.
391+
392+
* Parameters
393+
394+
| Parameter | parameter type | parameter description |
395+
| --------- | -------------- | ----------------------------- |
396+
| vfs_ Obj | VFS object | file system object |
397+
| Path | str | root directory of file system |
398+
399+
* Return Value
400+
401+
* None
402+
403+
* Example
404+
405+
```python
406+
>>> cdev = uos.VfsFat(1, 0, 4, 1)
407+
>>> uos.mount(cdev, '/sd')
408+
```
409+
410+
-SD card usage example(SPI mode)
411+
412+
At present, it is only supported by ec600n / ec800n platforms.
413+
414+
```python
415+
>>> cdev = uos.VfsFat(1, 0, 4, 1)
416+
>>> uos.mount(cdev, '/sd')
417+
>>> f = open('/sd/test.txt','w+')
418+
>>> f.write('0123456')
419+
>>> f.close()
420+
>>> uos.listdir('/sd')
421+
>>> f = open('/sd/test.txt','r')
422+
>>> f.read()
423+
>>> f.close()
424+
```
425+
426+
427+
383428
#### gc - Control the Garbage Collector
384429

385430
This module provides an interface to the optional garbage collector. This module implements a subset of the corresponding [CPython](https://docs.micropython.org/en/latest/reference/glossary.html#term-CPython) module, as described below. For more information, refer to the original CPython documentation: [gc](https://docs.python.org/3.5/library/gc.html#module-gc)

zh-cn/api/pythonStdlib.md

Lines changed: 91 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ b'\xb3\xc9Y\x1b\xe9'
201201

202202

203203

204-
##### 初始化SD卡驱动(SPI接口)
204+
##### 注册存储设备 - SPI - SD卡
205205

206206
目前仅EC600N/EC800N平台支持。
207207

@@ -230,49 +230,7 @@ b'\xb3\xc9Y\x1b\xe9'
230230

231231

232232

233-
##### 挂载文件系统
234-
235-
> **uos.mount(vfs_obj, path)**
236-
237-
挂载底层文件系统到VFS。
238-
239-
* 参数
240-
241-
| 参数 | 参数类型 | 参数说明 |
242-
| ------- | ---------- | ---------------- |
243-
| vfs_obj | vfs object | 文件系统对象 |
244-
| path | str | 文件系统的根目录 |
245-
246-
* 返回值
247-
248-
无。
249-
250-
* 示例
251-
252-
```python
253-
>>> cdev = uos.VfsFat(1, 0, 4, 1)
254-
>>> uos.mount(cdev, '/sd')
255-
```
256-
257-
- SD卡(SPI接口)使用示例
258-
259-
目前仅EC600N/EC800N平台支持。
260-
261-
```python
262-
>>> cdev = uos.VfsFat(1, 0, 4, 1)
263-
>>> uos.mount(cdev, '/sd')
264-
>>> f = open('/sd/test.txt','w+')
265-
>>> f.write('0123456')
266-
>>> f.close()
267-
>>> uos.listdir('/sd')
268-
>>> f = open('/sd/test.txt','r')
269-
>>> f.read()
270-
>>> f.close()
271-
```
272-
273-
274-
275-
##### 初始化SD卡驱动(SDIO接口)
233+
##### 注册存储设备 - SDIO - SD卡
276234

277235
目前仅EC600U/EC200U平台支持。
278236

@@ -304,7 +262,7 @@ b'\xb3\xc9Y\x1b\xe9'
304262
>>> udev = VfsSd("sd_fs")
305263
```
306264

307-
##### 设置检测管脚
265+
###### 设置检测管脚
308266

309267
> **set_det(vfs_obj.GPIOn,mode)**
310268
@@ -330,7 +288,7 @@ b'\xb3\xc9Y\x1b\xe9'
330288
>>> udev.set_det(udev.GPIO10,0)#使用GPIO10作为卡检测管脚,sd卡插上,检测口为低电平,sd卡取出,检测口为高电平(实际使用根据硬件)
331289
```
332290

333-
##### 设置插拔卡回调函数
291+
###### 设置插拔卡回调函数
334292

335293
> **set_callback(fun)**
336294
@@ -378,6 +336,93 @@ def call_back(para):
378336
udev.set_callback(call_back)
379337
```
380338

339+
340+
341+
##### **注册存储设备 - SPI NOR FLASH**
342+
343+
目前仅EG915U支持
344+
345+
> uos.VfsLfs1(readsize,progsize,lookahead,pname,spi_port,spi_clk)
346+
347+
初始化spi nor flash,和外挂nor flash通信。使用SPI通信方式。
348+
349+
* 参数
350+
351+
| 参数 | 参数类型 | 参数说明 |
352+
| --------- | -------- | ------------------------------------------------------------ |
353+
| readsize | int | 预留,暂未使用 |
354+
| progsize | int | 预留,暂未使用 |
355+
| lookahead | int | 预留,暂未使用 |
356+
| pname | str | 固定为“ext_fs”。后续扩展 |
357+
| spi_port | int | 支持的端口参照SPI章节说明 |
358+
| spi_clk | int | 时钟频率:<br />EG915U:0:6.25M 1:12.5M 2:25M 3:50M 4:3.125M 5:1.5625M 6:781.25K |
359+
360+
* 返回值
361+
362+
成功则返回VfsLfs1 object,失败则 OSError 19。
363+
364+
* 示例
365+
366+
```python
367+
>>>ldev = uos.VfsLfs1(32, 32, 32, "ext_fs",1,0)
368+
>>>uos.mount(ldev,'/ext')
369+
>>>f = open('/ext/test.txt','w+')
370+
>>>f.write('hello world!!!')
371+
>>>f.close()
372+
373+
>>>uos.listdir('ext')
374+
375+
>>>f = open('/ext/test.txt','r')
376+
>>>f.read()
377+
>>>f.close()
378+
379+
```
380+
381+
382+
383+
384+
##### 挂载文件系统
385+
386+
> **uos.mount(vfs_obj, path)**
387+
388+
挂载底层文件系统到VFS。
389+
390+
* 参数
391+
392+
| 参数 | 参数类型 | 参数说明 |
393+
| ------- | ---------- | ---------------- |
394+
| vfs_obj | vfs object | 文件系统对象 |
395+
| path | str | 文件系统的根目录 |
396+
397+
* 返回值
398+
399+
无。
400+
401+
* 示例
402+
403+
```python
404+
>>> cdev = uos.VfsFat(1, 0, 4, 1)
405+
>>> uos.mount(cdev, '/sd')
406+
```
407+
408+
- SD卡(SPI接口)使用示例
409+
410+
目前仅EC600N/EC800N平台支持。
411+
412+
```python
413+
>>> cdev = uos.VfsFat(1, 0, 4, 1)
414+
>>> uos.mount(cdev, '/sd')
415+
>>> f = open('/sd/test.txt','w+')
416+
>>> f.write('0123456')
417+
>>> f.close()
418+
>>> uos.listdir('/sd')
419+
>>> f = open('/sd/test.txt','r')
420+
>>> f.read()
421+
>>> f.close()
422+
```
423+
424+
425+
381426
#### gc - 内存碎片回收
382427

383428
gc 模块实现内存垃圾回收机制,该模块实现了CPython模块相应模块的子集。更多信息请参阅阅CPython文档:[gc](https://docs.python.org/3.5/library/gc.html#module-gc)

0 commit comments

Comments
 (0)