CN103279441A - USB-to-CF/SD driving method based on domestic embedded type operation system - Google Patents
USB-to-CF/SD driving method based on domestic embedded type operation system Download PDFInfo
- Publication number
- CN103279441A CN103279441A CN2013101892919A CN201310189291A CN103279441A CN 103279441 A CN103279441 A CN 103279441A CN 2013101892919 A CN2013101892919 A CN 2013101892919A CN 201310189291 A CN201310189291 A CN 201310189291A CN 103279441 A CN103279441 A CN 103279441A
- Authority
- CN
- China
- Prior art keywords
- usb
- card
- driving method
- equipment
- register
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Landscapes
- Storage Device Security (AREA)
- Stored Programmes (AREA)
Abstract
The invention provides a USB-to-CF/SD driving method based on a domestic embedded type operation system. The USB-to-CF/SD driving method based on the domestic embedded type operation system comprises a hand-held computer. A dragon chip processor is internally installed in the hand-held computer, the dragon chip processor is connected with a CF interface and an SD interface through a USB conversion chip, a ReWorks operation system is arranged inside the hand-held computer, and the specific achieving process of the USB-to-CF/SD driving method comprises the steps of completing detection of a CF/SD device, configuring the CF/SD device, completing storage of the CF/SD device, and completing hot-plug processing of the CF/SD device. Compared with the prior art, the USB-to-CF/SD driving method based on the domestic embedded type operation system is strong in practicability, high in safety performance, wide in application range of application and easy to popularize.
Description
Technical field
The present invention relates to field of computer technology, specifically a kind of USB based on homemade embedded OS changes the CF/SD driving method.
Background technology
The Godson series processors is the universal cpu that institute's independent research is calculated by the Chinese Academy of Sciences, and wherein Godson 1 series processors is towards Industry Control, consumer electronics Embedded Application such as (mobile phone/MP4/ palm PCs etc.).Godson processor itself is not supported CF or SD expansion, many special trade users such as military user etc. have the expansion equipment of a lot of CF interfaces, and the SD extension storage also all needs most users, so we adopt a USB host to expand a standard C F/SD interface.
The ReWorks embedded OS is the embedded real-time operating system that whole source codes were developed, had to the 32nd technological achievement based on " 95 ", " 15 " of science and technology group of China Electronics voluntarily, is applicable to plurality of target hardware environment (x86, mips).ReWorks operating system adopts object-oriented and Microkernel exploitation, has hard real-time cutting and scalability, and the VxWorks compatible layer is provided.
Still USB under the homemade embedded OS ReWorks is not changeed the research that CF/SD drives at present.
Summary of the invention
Technical assignment of the present invention is in the deficiencies in the prior art, provides a kind of and guarantees data security, changes the CF/SD driving method based on the USB of homemade embedded OS.
Technical scheme of the present invention realizes in the following manner, this a kind of USB based on homemade embedded OS changes the CF/SD driving method, comprise handheld computer, the built-in Godson processor of this handheld computer, described Godson processor is provided with the USB device controller, this USB device controller connects CF interface and SD interface by the USB conversion chip, and described handheld computer inside is provided with ReWorks operating system, and its specific implementation process is:
Step 1 is finished the detection of CF/SD equipment: ReWorks and by the classification of USB equipment USB equipment is identified, and the classification of USB equipment comprises three kinds of USB class, USB subclass and USB agreements;
Step 2, configuration CF/SD equipment: at first, drive the GPIO that transmission CF/SD signal is set in system, and distribute the IO port that addressing is used for it; Secondly, the property store space to the CF/SD card is configured;
Step 3, finish the CF/SD device storage: system is to CF/SD issue ATA instruction, request obtains the piece number of CF/SD card to driver according to the I/O of system, the LBA address that utilizes this piece number to calculate the CF card, these parameter values and ATA instruction are write in the corresponding registers by 8 modes, namely finish storing process one time.
Step 4 is finished the CF/SD equipment hot swap and is handled.
Driving in the described step 2 need be verified the value of its attributes section register, configuration status register, pin replacement register, socket copy register, if these values and default value do not match, then its value will be used as default.
ATA instruction set in the described step 3 is divided into 3 classes, could handle the data stream in the CF/SD buffer zone when the every class order in the described ATA instruction set all requires CF/SD to be stuck in to be in when receiving order busy condition not and request of data is arranged.
Parameter value refers in the described step 3: get piece number low 28, and the low bit register of the cylinder of corresponding CF/SD card, the high bit register of cylinder, sector register, equipment/head register successively.
The hot plug processing procedure refers in the described step 4: in the ReWorks system, system layer and application layer all will be handled the hot plug event, in system layer, will survey the hot plug event of CF/SD card on the one hand, distribute or free system resources, and drive CF/SD equipment; On the other hand, be with the hot plug event notice application layer promptly and accurately of storage card, application layer is then made corresponding processing according to the hot plug event.
The beneficial effect that the present invention compared with prior art produces is:
A kind of USB based on homemade embedded OS of the present invention changes the CF/SD driving method and realizes that based on homemade Godson processor and homemade ReWorks embedded OS the USB of handheld computer inside changes CF/SD and drives, practical, security performance is high, the scope of application is extensive, is easy to promote.
Description of drawings
Accompanying drawing 1 is system hardware block diagram of the present invention.
Embodiment
Below in conjunction with accompanying drawing a kind of USB based on homemade embedded OS provided by the present invention is changeed the CF/SD driving method and do following detailed description the in detail.
Structural drawing as shown in Figure 1, this a kind of USB based on homemade embedded OS changes the CF/SD driving method, comprise handheld computer, the built-in Godson processor of this handheld computer, this Godson processor is provided with lcd controller, SPI controller, UART controller, ethernet controller, USB device controller, unibus, sound card driving governor, GPIO interface, south bridge FLASH controller, DDR2 controller, and described lcd controller is connected with liquid crystal display; The SPI controller connects touch-screen by the touch-screen control chip; The UART controller connects RS232 interface and Big Dipper module by the serial ports conversion chip; Ethernet controller connects Ethernet card by network chip; The USB device controller connects USB interface, camera, connects CF interface and SD interface by the USB conversion chip; Unibus connects the power supply adaptor interface by the lithium battery conversion chip; The sound card driving governor connects loudspeaker, earphone, microphone by audio chip; GPIO interface connection matrix keyboard, security module; South bridge FLASH controller is inserted operating system by south bridge FLASH; The DDR2 controller connects the DDR2 internal memory, wherein RS232 interface, Ethernet interface, USB interface, power supply adaptor interface are the air plug interface, CF interface, SD interface, earphone and Mike are blocked by the wicket covering that is arranged on the handheld computer, this handheld computer inside is provided with ReWorks operating system, and its specific implementation process is:
The detection of step 1, CF/SD equipment.
ReWorks identifies USB equipment by the classification of USB equipment, the classification of USB equipment is from USB class, USB subclass and the definition of USB agreement three aspects, but it is many owing to device class in the reality, not all equipment can both be easy to find its device class, the method of a more convenient identification USB equipment is provided under the ReWorks, the ReWorks constant USBD_NOTIFY_ALL that gives a definition, this constant can represent all USB classes, USB subclass and USB agreement, can identify the plug of all USB kind equipments.It is as follows to survey (probe) function code:
static int mmc_bus_probe(struct device *dev)
{ struct mmc_driver *drv = to_mmc_driver(dev->driver);;
struct mmc_card *card = dev_to_mmc_card(dev);
return drv->probe(card); }
The configuration of step 2, CF/SD equipment.
Before CF/SD was sticked into capable storage operation, driver will carry out necessary configuration to it.At first, drive the GPIO that transmission CF/SD signal is set in system, and distribute the IO port that addressing is used for it.Under the Memory pattern, the IO port of CF/SD card and the 16 byte data pieces that are its common store space.Secondly, the property store space to the CF/SD card is configured.For guaranteeing correct use CF/SD card, driving need be verified the value of its attributes section register, configuration status register, pin replacement register, socket copy register, if these values and default value do not match, then its value to be used as default.
void Card_SetDevice(void)
{ Card_Dev_Config=Card_DevReg_DEV1+Card_DevReg_b5
+Card_DevReg_LBA+Card_DevReg_b7;
outportw(Card_Dev_Config,CARD_REG_DEVICE_HEAD); }
Step 3, CF/SD device storage function realize.
Realize the storage backup function of CF/SD, require the CF/SD card correctly to receive and responding system to its I/O request, system and then to CF/SD issue ATA instruction.The ATA instruction set is divided into 3 classes, and every class order could be handled the data stream in the CF/SD buffer zone when all requiring CF/SD to be stuck in to be in (BSY=0) state that is not in a hurry when receiving order and request of data (DRQ=1) is arranged.Request obtains the piece block of CF/SD card to driver according to the I/O of system, the LBA address that utilizes this piece number to calculate the CF card.That gets block hangs down 28, the cylinder of corresponding CF/SD card hangs down bit register, the high bit register of cylinder, sector register, equipment/head register successively, these parameter values and ATA instruction are write in the corresponding registers by 8 modes, namely finish storing process one time.
Int Card_Write_Sector (U16 * Buffer, U32 Sector, U8 count) // write one bunch
{ ……
If (! Card_Flag)/the * storage card is unavailable, return immediately */
return FALSE;
Card_WriteSetting (Sector, count); / * write the sector arrange */
do{ count--;
If (Card_IsBusy ())/* waiting facilities request msg transmission */
{ for (i=0; I<256; I++)/* writes 256 digital data continuously, namely sector */
Outportw (* (Buffer++), CF_REG_DATA); / * to data register write a digital data */
Buffer +=256; / * transfer the pointer * will write the data buffer/
}
……
return Status;
}
The processing of step 4, CF/SD equipment hot swap event.
One big characteristic of embedded memory device such as CF/SD can be accomplished plug and play exactly.In the ReWorks system, system layer and application layer all will be handled the hot plug event.In system layer, to survey the hot plug event of CF/SD card on the one hand, distribute or free system resources, and drive CF/SD equipment; On the other hand, be with the hot plug event notice application layer promptly and accurately of storage card.Application layer is then made corresponding processing according to the hot plug event.Adopt timer to survey the hot plug event of storage card, as shown in the table.
Table 1 storage card hot plug event
REG_FLAG | DETECT_FLAG | Event |
1 | 1 | The storage card card is extracted |
1 | 0 | No event, storage card is stuck in the slot |
0 | 0 | Storage card inserts |
0 | 1 | No event, the storage card card is not in slot |
In the ReWorks operating system, create CF/SD and drive in two steps: initialization CF/SD device drives and establishment installable file system.Initialization CF/SD device drives function name is ideDrv, and apparatus for establishing file system functions name is called usrIdeConfig.Be part of original code below:
If(ideDrv(IDE_INT_VEC,IDE_INT_VEC,type)==ERROR)
printf(“Could not initialize.\n”);
dosFsInit(NUM_DOSFS_FILES);
if(usrIdeConfig(drive,fileName)==ERROR)
……
After device driver was set up, application program just can be used basic I/O function access CF/SD card, and these functions comprise: create (), and open (), read (), write () and remove () function have made things convenient at the embedded system storing data files.
With the driver into BSP of ReWorks system that packs, the compiling system kernel, programming is inserted associated socket respectively with CF and SD card and is got final product to Godson handheld computer platform.
Claims (5)
1. the USB based on homemade embedded OS changes the CF/SD driving method, it is characterized in that: comprise handheld computer, the built-in Godson processor of this handheld computer, described Godson processor is provided with the USB device controller, this USB device controller connects CF interface and SD interface by the USB conversion chip, described handheld computer inside is provided with ReWorks operating system, and its specific implementation process is:
Step 1 is finished the detection of CF/SD equipment: ReWorks and by the classification of USB equipment USB equipment is identified, and the classification of USB equipment comprises three kinds of USB class, USB subclass and USB agreements;
Step 2, configuration CF/SD equipment: at first, drive the GPIO that transmission CF/SD signal is set in system, and distribute the IO port that addressing is used for it; Secondly, the property store space to the CF/SD card is configured;
Step 3, finish the CF/SD device storage: system is to CF/SD issue ATA instruction, request obtains the piece number of CF/SD card to driver according to the I/O of system, the LBA address that utilizes this piece number to calculate the CF card, these parameter values and ATA instruction are write in the corresponding registers by 8 modes, namely finish storing process one time;
Step 4 is finished the CF/SD equipment hot swap and is handled.
2. a kind of USB based on homemade embedded OS according to claim 1 changes the CF/SD driving method, it is characterized in that: the driving in the described step 2 need be verified the value of its attributes section register, configuration status register, pin replacement register, socket copy register, if these values and default value do not match, then its value to be used as default.
3. a kind of USB based on homemade embedded OS according to claim 2 changes the CF/SD driving method, it is characterized in that: the ATA instruction set in the described step 3 is divided into 3 classes, could handle the data stream in the CF/SD buffer zone when the every class order in the described ATA instruction set all requires CF/SD to be stuck in to be in when receiving order busy condition not and request of data is arranged.
4. a kind of USB based on homemade embedded OS according to claim 3 changes the CF/SD driving method, it is characterized in that: parameter value refers in the described step 3: get piece number low 28, and the low bit register of the cylinder of corresponding CF/SD card, the high bit register of cylinder, sector register, equipment/head register successively.
5. a kind of USB based on homemade embedded OS according to claim 4 changes the CF/SD driving method, it is characterized in that: the hot plug processing procedure refers in the described step 4: in the ReWorks system, system layer and application layer all will be handled the hot plug event, in system layer, to survey the hot plug event of CF/SD card on the one hand, distribute or free system resources, and drive CF/SD equipment; On the other hand, be with the hot plug event notice application layer promptly and accurately of storage card, application layer is then made corresponding processing according to the hot plug event.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310189291.9A CN103279441B (en) | 2013-05-21 | 2013-05-21 | A kind of USB based on domestic embedded OS turns CF/SD driving methods |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310189291.9A CN103279441B (en) | 2013-05-21 | 2013-05-21 | A kind of USB based on domestic embedded OS turns CF/SD driving methods |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103279441A true CN103279441A (en) | 2013-09-04 |
CN103279441B CN103279441B (en) | 2017-04-05 |
Family
ID=49061966
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310189291.9A Active CN103279441B (en) | 2013-05-21 | 2013-05-21 | A kind of USB based on domestic embedded OS turns CF/SD driving methods |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103279441B (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103984568A (en) * | 2014-04-25 | 2014-08-13 | 山东超越数控电子有限公司 | PCI (Peripheral Component Interconnection)-to-CF (Compact Flash) driving method |
CN108255750A (en) * | 2018-02-01 | 2018-07-06 | 山东超越数控电子股份有限公司 | A kind of implementation method of the crypto module interface based on domestic embedded platform |
CN111459867A (en) * | 2020-02-28 | 2020-07-28 | 广州广哈通信股份有限公司 | Method, device, converter and storage medium for converting USB (Universal Serial bus) into SMI (SMI) |
CN111984334A (en) * | 2020-08-17 | 2020-11-24 | 上海睿赛德电子科技有限公司 | Lightweight operating system kernel and drive separation method |
CN112905515A (en) * | 2021-03-15 | 2021-06-04 | 西安超越申泰信息科技有限公司 | Mainboard that has big dipper locate function based on explain why 421 treater of Shenwei |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030218238A1 (en) * | 2002-02-28 | 2003-11-27 | Hiroshi Kikuchi | Semiconductor device and electronic device |
CN1540530A (en) * | 2003-10-31 | 2004-10-27 | 港湾网络有限公司 | Method for implementing hot plug for CF card |
CN201444301U (en) * | 2009-08-03 | 2010-04-28 | 山东超越数控电子有限公司 | Device capable of unifying interfaces of multi-peripheral units to be one USB interface |
-
2013
- 2013-05-21 CN CN201310189291.9A patent/CN103279441B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20030218238A1 (en) * | 2002-02-28 | 2003-11-27 | Hiroshi Kikuchi | Semiconductor device and electronic device |
CN1540530A (en) * | 2003-10-31 | 2004-10-27 | 港湾网络有限公司 | Method for implementing hot plug for CF card |
CN201444301U (en) * | 2009-08-03 | 2010-04-28 | 山东超越数控电子有限公司 | Device capable of unifying interfaces of multi-peripheral units to be one USB interface |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103984568A (en) * | 2014-04-25 | 2014-08-13 | 山东超越数控电子有限公司 | PCI (Peripheral Component Interconnection)-to-CF (Compact Flash) driving method |
CN108255750A (en) * | 2018-02-01 | 2018-07-06 | 山东超越数控电子股份有限公司 | A kind of implementation method of the crypto module interface based on domestic embedded platform |
CN108255750B (en) * | 2018-02-01 | 2021-04-13 | 超越科技股份有限公司 | Method for realizing cipher module interface based on domestic embedded platform |
CN111459867A (en) * | 2020-02-28 | 2020-07-28 | 广州广哈通信股份有限公司 | Method, device, converter and storage medium for converting USB (Universal Serial bus) into SMI (SMI) |
CN111984334A (en) * | 2020-08-17 | 2020-11-24 | 上海睿赛德电子科技有限公司 | Lightweight operating system kernel and drive separation method |
CN112905515A (en) * | 2021-03-15 | 2021-06-04 | 西安超越申泰信息科技有限公司 | Mainboard that has big dipper locate function based on explain why 421 treater of Shenwei |
Also Published As
Publication number | Publication date |
---|---|
CN103279441B (en) | 2017-04-05 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107423169B (en) | Method and system for testing high speed peripheral device interconnection equipment | |
US9652351B2 (en) | System to detect charger and remote host for type-C connector | |
RU2628163C2 (en) | Systems and methods of procedure return address checking | |
WO2016153674A1 (en) | Selectively enabling first and second communication paths using a repeater | |
US9367510B2 (en) | Backplane controller for handling two SES sidebands using one SMBUS controller and handler controls blinking of LEDs of drives installed on backplane | |
US20170031694A1 (en) | System and method for remote system configuration managment | |
US7908417B2 (en) | Motherboard system, storage device for booting up thereof and connector | |
CN103279441A (en) | USB-to-CF/SD driving method based on domestic embedded type operation system | |
JP2015501048A5 (en) | ||
EP4141680A1 (en) | Debug data communication system for multiple chips | |
US10572667B2 (en) | Coordinating power management between virtual machines | |
CN104571333A (en) | Control computer based on 1553B bus | |
CN103942088A (en) | Method for acquiring using conditions of USB storage device of virtual machine | |
EP2990956B1 (en) | Usb device and method thereof for automatically recognizing microsoft windowing operating system version | |
US20140267096A1 (en) | Providing a hybrid touchpad in a computing device | |
US20160314086A1 (en) | Secure digital host controller virtualization | |
US12118363B2 (en) | Coordinated boot synchronization and startup of information handling system subsystems | |
US8566575B2 (en) | Computer apparatus and method for charging portable electronic device using the computer apparatus | |
TW201807589A (en) | Method and device capable of automatically identifying host operating system | |
US20150220112A1 (en) | First and Second Housing and A Mass Storage Device | |
US11803493B2 (en) | Systems and methods for management controller co-processor host to variable subsystem proxy | |
CN204028888U (en) | A kind of data storage device with USB principal and subordinate interface | |
TWI791699B (en) | Electronic device and method for processing instruction using the same | |
CN108132847A (en) | A kind of data processing method, the first electronic equipment and computer storage media | |
TWI728363B (en) | Integrated electronic apparatus for data access, data transmission and power management and method thereof |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CP01 | Change in the name or title of a patent holder | ||
CP01 | Change in the name or title of a patent holder |
Address after: 250100, No. 2877, fairway, Sun Town, Ji'nan hi tech Zone, Shandong Patentee after: SHANDONG CHAOYUE CNC ELECTRONICS Co.,Ltd. Address before: 250100, No. 2877, fairway, Sun Town, Ji'nan hi tech Zone, Shandong Patentee before: SHANDONG CHAOYUE NUMERICAL CONTROL ELECTRONIC Co.,Ltd. |