OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 G7 A# L; r( W; Q9 d! w
  1. [code]EDMA sample test application5 R/ L) T/ J$ V, k5 @7 m1 ~6 J
  2. /*7 `$ r* O" V& l: Z% W0 d
  3. * edma_test.c0 l  q* w' s( B$ Q. L5 e
  4. *
      c2 p0 ^* W6 K- ]
  5. * brief  EDMA3 Test Application
    6 r# T/ Y* {3 p+ g
  6. *+ E4 u# t4 L9 E3 u
  7. *   This file contains EDMA3 Test code.
    4 h5 M. F9 H6 C* x7 a4 o3 a* F, `$ p
  8. *0 w) j& Z" a- i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ; T, ?: j/ t/ p4 c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      Z5 Q3 @( L6 w/ I
  11. *         TO CHANGE.
    9 s5 G7 y1 v/ c
  12. *
    + Y9 ~; z: t/ i2 [. x( d$ q6 M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 M* Y1 u9 L3 v/ \& W0 k
  14. *
    7 R9 ~5 k" h/ @  W4 T" {
  15. * This program is free software; you can redistribute it and/or
    4 B. u& W5 o2 Y+ Y- Y; ~% m7 u
  16. * modify it under the terms of the GNU General Public License as
    . K/ N" J+ F. F
  17. * published by the Free Software Foundation version 2.
    0 a. O2 j1 v& Y" Q+ O/ k
  18. *
    6 `6 a7 \; b( d+ Z& W0 L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( m1 [. g( j" s% C- }( h- X
  20. * kind, whether express or implied; without even the implied warranty
    - C: W& L) D/ T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ y6 R+ Z& J+ b/ ~  g1 H. `
  22. * GNU General Public License for more details.7 j- H: H( y6 {1 f, [! U3 ?9 S5 e
  23. */
    7 m* Y4 `) a, `7 H

  24. ' N5 J+ V" C& u2 [1 }* W
  25. #include <linux/module.h>
    ' y' O* o" E' e+ k
  26. #include <linux/init.h>5 V3 ~/ `( D, \' Z
  27. #include <linux/errno.h>
    3 o) C) A; @# d( u+ }
  28. #include <linux/types.h>
    5 b, [! v/ b, Q# c% z# R- V1 @
  29. #include <linux/interrupt.h>6 ^7 [. k% @( q6 B9 Z$ x4 B
  30. #include <asm/io.h>
    - y1 D* Z6 [/ {8 c
  31. #include <linux/moduleparam.h>
    / l2 E  u. G3 _, K: I* D# x
  32. #include <linux/sysctl.h>" h" R; p3 b) y5 y, g  q8 h( Q
  33. #include <linux/mm.h>
    , s$ u2 _" y( d- l- J
  34. #include <linux/dma-mapping.h>, u7 `. l1 w( k

  35.   T7 i* A1 G; |! K& X6 ^
  36. #include <mach/memory.h>! r: d, X3 }7 z- S/ b. M
  37. #include <mach/hardware.h>) I$ ]. ^, f5 Z6 x7 J; Y" t" `
  38. #include <mach/irqs.h>
    7 g5 R8 S. k& e% u# u" n  [
  39. #include <asm/hardware/edma.h>
    ) f! K3 ]; e* C. M3 Z) V0 \; m
  40. ' L- K( N0 L' @; Q. x; ]$ O6 F
  41. #undef EDMA3_DEBUG
    8 A0 w* K( C# M( h0 j$ h6 `
  42. /*#define EDMA3_DEBUG*/
    2 g$ y; m/ b9 F9 Q) f% v

  43. , j; O8 B1 ~+ [0 u
  44. #ifdef EDMA3_DEBUG
    6 M) i' I* M, @0 a+ L" w5 S8 U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      z# G7 C2 D/ R0 Y% J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 z* j% R+ T. W- e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ [- U' K9 _% G; C' t% U; X/ @
  48. #else& _0 O, n2 V8 d, r
  49. #define DMA_PRINTK( x... )( M1 {( `# {3 ~+ L
  50. #define DMA_FN_IN2 n$ i$ s. Z/ Y
  51. #define DMA_FN_OUT8 d' ?. \/ g' J
  52. #endif
    7 N; U; }. B* y) T6 F% C) K4 X$ x9 s
  53. $ G! @+ H3 ?5 I$ w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - ^, U- K  s8 C/ m" ?) s
  55. #define STATIC_SHIFT                3
    1 l- {" j7 L! ?/ }# b
  56. #define TCINTEN_SHIFT               20* H7 v" p. u& b6 ?7 n. q$ T
  57. #define ITCINTEN_SHIFT              21+ }4 n: T( y" c% c
  58. #define TCCHEN_SHIFT                22' H% I# T# v' f# ], ~: k, F
  59. #define ITCCHEN_SHIFT               23
    ' o6 G. _; n- g. f' A

  60. 3 V# v1 q7 S8 ~+ r3 O+ {& b8 e/ _
  61. static volatile int irqraised1 = 0;, M, e2 b) g* U3 r- X3 Q0 L; K! Y
  62. static volatile int irqraised2 = 0;% ^; V8 a. ]& f0 i4 V

  63. , I8 M0 o: B$ c5 m5 K* s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 c& |, ~2 l3 Y7 {) B9 l8 c+ z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 l2 s( p1 U% {3 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- n5 n) c! r% E/ R! J' t
  67. & @, L; K8 G9 B/ H
  68. dma_addr_t dmaphyssrc1 = 0;
    7 j2 s4 F$ R, W. X, d8 b. |# j
  69. dma_addr_t dmaphyssrc2 = 0;
    ! \) x- N0 J- }
  70. dma_addr_t dmaphysdest1 = 0;" m4 L0 H! C2 M: ?; G
  71. dma_addr_t dmaphysdest2 = 0;
    $ h! r3 s  o5 K. o
  72. 1 `; a' j: e& y. ~) @& c
  73. char *dmabufsrc1 = NULL;
    " u  q$ f3 [2 D, i
  74. char *dmabufsrc2 = NULL;/ s% a: b0 u; s! _7 r5 q
  75. char *dmabufdest1 = NULL;
    , \5 b1 U5 G8 [! s$ |3 B4 D" r# Q
  76. char *dmabufdest2 = NULL;
    . c% [3 ?+ Y+ |  U
  77. 4 H. u2 H- M- Y6 w3 Z) |7 J
  78. static int acnt = 512;% c  H+ d6 A# ~' d% `
  79. static int bcnt = 8;
    4 k- D- m) p( t3 l
  80. static int ccnt = 8;  E* F  w4 r# e) ]! k
  81. + x2 a  \, q& k
  82. module_param(acnt, int, S_IRUGO);
    5 |) T6 {$ i% g/ k6 P$ D2 F' Z
  83. module_param(bcnt, int, S_IRUGO);! R" f8 X! Z9 H  S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
( P: X- `0 \( o9 \% W; P

6 ~0 t% \! h1 x* V. _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 r) w/ o$ ]. ~4 A8 Z3 l) [
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. \6 h. N4 L3 _/ C/ O/ J     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 m# e7 ?& e. d6 @+ }* C- Q+ M* S) p: ?1 u6 a( ]5 R
. M0 M, c( `* g0 y% C- I  f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-3-4 19:13 , Processed in 0.037799 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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