OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 9260|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 [9 n" N: J4 H) @* c! S9 |# t
  1. [code]EDMA sample test application
    / v6 D  l2 ?& k& ?2 A% L
  2. /*
    ' w* E- K; P7 N1 F0 l0 f6 s
  3. * edma_test.c; Z  K& a7 G# a, ]. s$ O
  4. *
    9 m2 ~& ^! U$ o0 X, O) ]
  5. * brief  EDMA3 Test Application
    5 G* V3 f  V/ q( e) Z6 c
  6. *
    ' h! e8 p6 Q& y& q+ m* T+ N
  7. *   This file contains EDMA3 Test code.
    1 R7 L, k2 ~- n: f! l* F# p
  8. *
    / d  E7 ~( _: g+ J9 w  @$ S& c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 ]  Q; ?3 ~2 ?' J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT/ k& T5 J: [( P7 L
  11. *         TO CHANGE.; p3 n4 A( c9 M% {) b
  12. *
    / ?3 ^& B6 `; l. z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ A# r# y: n7 d; n
  14. *0 g3 n' Z5 U- A
  15. * This program is free software; you can redistribute it and/or
    5 _( j2 L: P4 L6 C" y. @6 ?
  16. * modify it under the terms of the GNU General Public License as& f3 Z( H) F5 z
  17. * published by the Free Software Foundation version 2.
    1 D4 p; [* y) T0 _9 a
  18. *. t2 ^3 C$ F& `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    1 V5 j5 |7 l0 T! B! ?1 W/ ]! K
  20. * kind, whether express or implied; without even the implied warranty! h0 }. |8 X7 v9 `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ R8 h, z0 N. W, h+ u9 h( ^! g
  22. * GNU General Public License for more details., B1 b# ^1 i/ n2 `, `6 U( J
  23. */
    % v  T8 O' H- @' J: S: r
  24. ( c$ W6 r" l" t7 g4 m  s
  25. #include <linux/module.h>" @. [3 N. z3 q  M
  26. #include <linux/init.h>0 N" l2 k8 E& c) T' v
  27. #include <linux/errno.h>
    # f7 ^2 Q3 d- H: Q. F
  28. #include <linux/types.h>
    6 q- _' n2 E3 Q/ u, z
  29. #include <linux/interrupt.h>
    2 m: C* R2 ]2 M  g
  30. #include <asm/io.h>
    2 V7 R- q: |; K6 ]4 w  r
  31. #include <linux/moduleparam.h>! `0 U# s$ i' X# h
  32. #include <linux/sysctl.h>
    * ?' r( r$ x0 o
  33. #include <linux/mm.h>
    / o* Z- S# U8 i! U* x
  34. #include <linux/dma-mapping.h>
    + R: i' z% m' Q7 o) b

  35. / a, s; s0 G$ U/ `. G
  36. #include <mach/memory.h>
    9 s* {1 C" U9 s
  37. #include <mach/hardware.h>0 e* L6 ~; O3 U
  38. #include <mach/irqs.h>
    # Z2 V/ l5 k$ k6 Y" s1 G) p
  39. #include <asm/hardware/edma.h>6 F1 R! _" q) v! Z, G' ?
  40. % ^+ H/ n# x/ {3 r* x+ O( z) ~2 q
  41. #undef EDMA3_DEBUG
    7 w1 V3 \/ g- ^9 d& L  O) W6 i7 ^0 `
  42. /*#define EDMA3_DEBUG*/% r, J; S: `% S1 }5 a
  43. 1 `7 y( Y1 H! ]5 X7 o& ?
  44. #ifdef EDMA3_DEBUG6 i/ j5 w/ b! G4 w# K& T: j3 c' x% @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 v1 u# S! n# R9 R* u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 V) }9 i2 b2 f* n& E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : ?0 ~8 R3 p. G1 c; z" m( n2 R
  48. #else' t7 [6 C3 i. J% c+ h) Z, j
  49. #define DMA_PRINTK( x... )
    0 W( v5 J5 q6 ?3 t
  50. #define DMA_FN_IN: h: k) h1 x6 |' j5 M9 o+ Q8 x% n
  51. #define DMA_FN_OUT4 t# b6 u% G. @! y
  52. #endif
    ; z2 ]4 L6 m3 d$ o

  53. ) s( v: _# h/ T; {& M! q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; w8 g1 O# C0 J) e
  55. #define STATIC_SHIFT                3
    * _  }, S2 m* y! Z' s9 t/ O  }$ z& a
  56. #define TCINTEN_SHIFT               20& N2 J+ o( Y7 K# H2 ?
  57. #define ITCINTEN_SHIFT              21
    4 E7 J1 _/ H5 H
  58. #define TCCHEN_SHIFT                22
    , ]" W5 p  N; P$ c8 V2 P
  59. #define ITCCHEN_SHIFT               23, f6 K; _3 Y1 T+ k  g

  60. . l0 y$ t3 n: p* F3 N
  61. static volatile int irqraised1 = 0;$ u4 k; y. n+ w- }
  62. static volatile int irqraised2 = 0;3 B  F+ o  k3 k( r6 h0 x( R( [

  63. 8 x; E8 h& [& n* ^! y/ x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 I1 N$ I( Y* W4 m# d8 t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * Z3 [' s' w% N* ?, f9 |9 d+ w$ G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  _' x9 y* d/ ^  x" e6 F. }
  67. 2 o* y0 n$ X$ [- l
  68. dma_addr_t dmaphyssrc1 = 0;* H7 L; T7 ]: j% h$ D" L
  69. dma_addr_t dmaphyssrc2 = 0;
    $ q' v* w, E4 x, Q
  70. dma_addr_t dmaphysdest1 = 0;
    4 o4 C4 D* o5 h: s; U
  71. dma_addr_t dmaphysdest2 = 0;: }2 f5 W: e; ?4 P4 }

  72. 9 G0 L: Y- g! [: u
  73. char *dmabufsrc1 = NULL;/ B* b4 f; g: o! c
  74. char *dmabufsrc2 = NULL;% b* U2 R) F1 I
  75. char *dmabufdest1 = NULL;5 H$ c/ S  Y! [, L* a7 Z3 t
  76. char *dmabufdest2 = NULL;
      U+ P1 P8 |7 Z8 H
  77. 7 g0 c8 k' h+ O% c- J
  78. static int acnt = 512;
    * M% \. U7 _0 n# x  f* O2 r
  79. static int bcnt = 8;2 K# W% x! j3 T- b2 D
  80. static int ccnt = 8;2 j+ X) A# X. s: s  m0 A; o

  81. 9 ^5 ^9 r3 r; [9 q* ]
  82. module_param(acnt, int, S_IRUGO);) u4 N  Y: c! A' i" g3 I+ L5 _" y
  83. module_param(bcnt, int, S_IRUGO);( R6 P9 _+ N1 f! i4 X* p7 h
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ n4 |8 j! g+ }4 t: t0 t; n: s3 W* F( E/ M% H& q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用4 c3 @9 f: P0 N" ]' ^5 R
arm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 x4 H$ v. u0 ?     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 m; ]$ O3 y. {* y# [6 n2 B5 o& y

- J8 Y/ ?/ H3 L* q& P8 L7 Y0 J, B1 Y  s1 S  ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2025-12-14 04:50 , Processed in 0.047024 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表