8/10/2019 Como hacer un nuevo Driver en MQX.pdf
1/36
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the
Energy Efficient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore and Symphony aretrademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack,
ColdFire+, CoreNet, Flexis, Kinetis, MagniV, MXC, Platform in a Package, Processor Expert, QorIQ
Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQaand Xtrinsic are trademarks of Freescale Semiconductor, Inc. All other product or service names are
the property of their respective owners. 2011 Freescale Semiconductor, Inc.
TM
July 2014
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
2/36
TM 2Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCoreand Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,
MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
Qu es un driver para un dispositivo?
Capa de software que interacta con el hardware
Contiene rutinas especficas para controlar el hardware
Ventajas ofrecidas por un driver:
Se puede usar para aplicaciones portables
Desarrollo ms rpido
Cdigo reutilizable
Simplificar la aplicacin
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
3/36
TM 3Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCoreand Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,
MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
MQX proporciona varios drivers de dispositivos que la aplicacin
puede utilizar:
I2C
UART
SPI
RTC Flash
SD card
y muchos ms!
Estos drivers se incluyen en el BSP(Board Support Package).
BSP es una capa de software con todo el cdigo de inicializacin,
drivers, configuracin necesaria para que aparezca un MCU / MPU.
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
4/36
TM 4Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCoreand Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,
MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
Mtodo uniforme para
comunicarse con los
controladores de
dispositivo I/O
Ocultar funcionesespecficas del
controlador
Software de aplicacin
I/O Subsistema
Drivers de dispositivo
Manejo de
interrupciones
I/O Dispositivo HW
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
5/36
TM 5Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,
MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
Para evitar memorizar todas esas funciones para cadadriver, MQX implementa un subsistema de E / S, lo que
nos es proporciona un mtodo uniforme para llamar a los
drivers, esto es, usar el mismo API para todas las
llamadas de los drivers. Tambin esto ayuda al momento
de desarrollar una aplicacin a no preocuparse acerca dela funcionalidad del driver o lo que debera llamar, ya que
la API es muy sencilla. Slo se tiene que memorizar
algunas funciones y stas se llevarn a cabo de la misma
manera en todos los drivers.
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
6/36
TM 6Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,
MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
El subsistema de E / S ofrece tambin la portabilidad entrediferentes RTOS u OS ya que la API utilizada es
compatible con POSIX, esto significa que la convencin de
nomenclatura utilizada para las funciones es la que se
utiliza en UNIX.
Aplicacin
Install()
fopen()
read()
write()
ioctl()
fclose()
Driver_install()
Driver_open()
Driver_read ()
Driver_write ()
Driver_ioctl ()
Driver_close ()
DispositivoI/O
Subsistema
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
7/36
TM 7Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,
MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
Driver para dispositivo MQX I/O oferece diferentesservicios para interactuar con la aplicacin.
Algunos de estos servicios son opcionales.
Depende del driver cmo se implementan estos servicios.
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
8/36
TM 8Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,
MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
El driver MQX del dispositivo se instala a travs de:
_io_device_install
Todos los drivers MQX de un dispositivo, deben contener lossiguientes servicios:
_io_device_open
_io_device_close
_io_device_read
_io_device_write
_io_device_ioctl
Tenga en cuenta que dispositivo debe ser reemplazado por elnombre de la familia de dispositivos tales como:
_io_null_xxx
_io_rng_xxx
_io_ttya_xxx
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
9/36
TM 9Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,
MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
Install (Necesario):
Parmetros:
Identificador: El nombre del driver
Inicializacin especfica del driver
Usualmente llamado en la inicializacin BSP
Instalacin del driver para MQX
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
10/36
TM 10Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,
MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
Open (Necesario):
Parmetros:
Manejo de archivos
Nombre abierto
Banderas
Asignar memoria para los buffer del driver
Configurar el dispositivo especfico
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
11/36
TM 11Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,
MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
Close (Necesario):
Parmetros:
Manejo de archivos
Libera la memoria asignada
Cierra otros drivers utilizados
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
12/36
TM 12Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,
MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
Read (Opcional):
Parmetros
Manejo de archivos
Puntero al buffer
La cantidad de datos que se deben leer (en bytes)
Llevar a cabo las acciones necesarias para recuperar los
datos del dispositivo
Poder llamar otros drivers
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
13/36
TM 13Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,
MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
Write (Opcional):
Parmetros
Manejo de archivos
Puntero al buffer de datos
La cantidad de datos que se escriben (en bytes)
Llevar a cabo las acciones necesarias para recuperar los
datos del dispositivo
Poder usar otros drivers
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
14/36
TM 14Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
IOCTL (Opcional):
Parmetros:
Manejo de archivos
Comando a ejecutar
Puntero para comandar parmetros
Usualmente implementa los comandos gety set
Ofrece diferentes opciones de configuracin para el driver
Acciones especficas para el driver
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
15/36
TM 15Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
Freescale MQX incluye un BSP que soportafunciones y perifricos comnmente usados. Sinembargo en aplicaciones muy especficas puedeser necesario el desarrollo o modificacin de unoo varios Drivers.
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
16/36
TM 16Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
MQX incluye algunos I/O device drivers quepueden ser tiles al momento de desarrollar unnuevo Driver.
Estos Drivers estn localizados en la siguientedireccin:
C:\Freescale\Freescale_MQX_4_1\mqx\source\io
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
17/36
TM 17Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
NULL device driver es un I/O driver que NO realizaninguna funcin pero permite entender y realizaruna comunicacin bsica con el I/O subsistema.
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
18/36
TM 18Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
Con el fin de elaborar un nuevo driver, es posible tomar el io_null
driver y modificarlo. Para ello copiar y pegar la carpeta io_null;
aparecer una carpeta llamada io_null copia, la cual ser lacarpeta donde se crear el nuevo driver:
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
19/36
TM 19Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
Cambiar el nombre de la carpeta io_null copia por el
deseado, en este caso ser motorcd:
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
20/36
TM 20Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
Dentro de la carpeta se encontrarn 3 archivos, a los cuales
posteriormente se les debe cambiar el nombre, quitando
solamente null y renombrando con motorcd en este
caso:
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
21/36
TM 21Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
El archivo io_motorcd.c se debe modificar desde un editor de
texto, donde las palabras null se sustituirn por motorcd, las
lneas a modificar son:
Ojo, dentro del archivo se encuentra la funcin NULL, la cual es
una palabra reservada y no se debe modificar.
CDIGO ORIGINAL CDIGO NUEVO PARA DRIVER
#include "io_null.h"
#include "ionulprv.h"
_mqx_uint _io_null_install_io_null_open,
_io_null_close,
_io_null_read,
_io_null_write,
_io_null_ioctl,
_mqx_int _io_null_open
_mqx_int _io_null_close_mqx_int _io_null_read
_mqx_int _io_null_write
_mqx_int _io_null_ioctl
#include "io_motorcd.h"
#include "iomotorcdprv.h"
_mqx_uint _io_motorcd_install_io_motorcd_open,
_io_motorcd_close,
_io_motorcd_read,
_io_motorcd_write,
_io_motorcd_ioctl,
_mqx_int _io_motorcd_open
_mqx_int _io_motorcd_close_mqx_int _io_motorcd_read
_mqx_int _io_motorcd_write
_mqx_int _io_motorcd_ioctl
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
22/36
TM 22Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
El archivo io_motorcd.h se debe modificar desde un editor de
texto, donde las palabras null se sustituirn por motorcd, las
lneas a modificar son:
CDIGO ORIGINAL CDIGO NUEVO PARA EL DRIVER
#ifndef __io_null_h__
#define
__io_null_h__extern_mqx_uint
_io_null_install(char *);
#ifndef __io_null_h__
#define
__io_null_h__extern_mqx_uint
_io_null_install(char *);
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
23/36
TM 23Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
El archivo io_motorcdprv.h se debe modificar desde un editor de
texto, donde las palabras null se sustituirn por motorcd, las
lneas a modificar son:
CDIGO ORIGINAL CDIGO NUEVO PARA EL DRIVER
#ifndef __ionulprv_h__
#define __ionulprv_h__extern _mqx_int
_io_null_open(MQX_FILE_PTR, char *,
char *);
extern _mqx_int
_io_null_close(MQX_FILE_PTR);
extern _mqx_int _io_null_read
(MQX_FILE_PTR, char *, _mqx_int);
extern _mqx_int
_io_null_write(MQX_FILE_PTR, char *,
_mqx_int);
extern _mqx_int
_io_null_ioctl(MQX_FILE_PTR,
_mqx_uint, void *);
#ifndef __iomotorcdprv_h__
#define __iomotorcdprv_h__extern _mqx_int
_io_motorcd_open(MQX_FILE_PTR, char
*, char *);
extern _mqx_int
_io_motorcd_close(MQX_FILE_PTR);
extern _mqx_int _io_null_read
(MQX_FILE_PTR, char *, _mqx_int);
extern _mqx_int
_io_motorcd_write(MQX_FILE_PTR, char
*, _mqx_int);
extern _mqx_int
_io_motorcd_ioctl(MQX_FILE_PTR,
_mqx_uint, void *);
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
24/36
TM 24Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
Modificar el archivo .bat utilizando un editor de texto. Este archivo
se encuentra en la siguiente direccin:
C:\Freescale\Freescale_MQX_4_1\mqx\build\bat:
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
25/36
TM 25Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
Dentro del archivo .bat agregar la siguiente lnea:
copy"%ROOTDIR%\mqx\source\io\io_motorcd\io_motorcd.h""%OUTPUTDIR%\io_motorcd.h:
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
26/36
TM 26
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
Abrir CodeWarrior y arrastrar a la carpeta Generic_IO_Drivers
dentro de la carpeta bsp de la tarjeta a utilizar io_motorcd en la
carpeta bsp de la tarjeta en la que vamos a trabajar:
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
27/36
TM 27
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
Al arrastrar la carpeta anteriormente mencionada, aparecer una
ventana en donde vamos a seleccionar copy files and folders:
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
28/36
TM 28
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
Eliminar la carpeta antes pegada y pegarla de nuevo, esta vez
seleccionamos Linkto files and folders y MQX_ROOT_DIR
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
29/36
TM 29
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
Dar click derecho sobre la carpeta bsp y seleccionar properties
C/C++ build Settings Arm Ltd Windows GCC Assembler Directories:
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
30/36
TM 30
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
Agregar el driver dando click en new y escribiendo motorcd
como se muestra a continuacin:
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
31/36
TM 31
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
Hacer lo mismo en Arm Ltd Windows GCC Compiler:
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
32/36
TM 32
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
1. Crear un nuevo proyecto MQX.
2. Abrir los archivos main.h y main.c
3. Agregar la librera motorcd_.h en el archivo main.h:
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
33/36
TM 33
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
#include"main.h"
voidMain_task(uint32_t initial_data)
{
FILE_PTR motorcd__file; /* pointer to a file device structure*/
uint8_t data[10];
if(IO_OK !=_io_motorcd__install("motorcd_:"))
{
printf("Error opening motorcd_ driver\n");
}
if(NULL == (motorcd__file = fopen("motorcd_:", NULL )))
{
printf("Opening motorcd_ device driver failed.\n");
_mqx_exit(-1);
}
if(write(motorcd__file, data, 4 ) != 4)
{
printf("Writing to motorcd_ driver failed.\n");
_mqx_exit(-1);
}
else
{
printf("Writing to motorcd_ driver success.\n");
}
fclose(motorcd__file);
printf ("motorcd_ driver working\n");
mqx_exit(0);
}
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
34/36
TM 34
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
Compilar y verificar el cdigo,
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
35/36
TM 35
Freescale, the Freescale logo, AltiVec, C-5, CodeTEST, CodeWarrior, ColdFire, C-Ware, the Energy Eff icient Solutions logo, mobileGT, PowerQUICC, QorIQ, StarCore
and Symphony are trademarks of Freescale Semiconductor, Inc., Reg. U.S. Pat. & Tm. Off. Airfast, BeeKit, BeeStack, ColdFire+, CoreNet, Flexis, Kinetis, MagniV,MXC, Platform in a Package, Processor Expert, QorIQ Qonverge, Qorivva, QUICC Engine, Ready Play, SafeAssure, SMARTMOS, TurboLink, VortiQa and Xtrinsic aretrademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. 2011 Freescale Semiconductor, Inc.
8/10/2019 Como hacer un nuevo Driver en MQX.pdf
36/36
TM
Top Related