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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / I" O  r* i) h  w
  1. [code]EDMA sample test application
    % M9 ]) @! V/ U
  2. /*8 K1 k9 j4 n. U8 u
  3. * edma_test.c
    ) r4 ?$ a& J/ F5 n8 l2 R, i
  4. *5 j  c, q0 R( t5 t
  5. * brief  EDMA3 Test Application
    - G* i2 R+ }7 a( k/ r  b, i5 X
  6. *7 D# I5 P* o  Y5 r6 g8 j2 K
  7. *   This file contains EDMA3 Test code.
    : T3 Y% u2 f2 e* n6 c! n* l6 I" w
  8. *+ M# z5 y2 j; E; q" _4 K( G3 a3 l
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ Z3 t- i% H. B5 @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" e* E' @" {; v
  11. *         TO CHANGE.
    # M9 b) t$ j+ a. u4 @- e" M( v7 w
  12. *
    / M4 z* ]( e6 u7 r" l$ q1 U6 ]8 W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - B+ ^. |& ^, _) e
  14. *
    ; s1 u1 z4 y) D% X" P$ [& @( Y" Y
  15. * This program is free software; you can redistribute it and/or( M  [  p5 E7 `& s, y
  16. * modify it under the terms of the GNU General Public License as6 x$ w4 H, _- T6 i# S( R7 M% {# g5 U0 ?
  17. * published by the Free Software Foundation version 2.
    ! y$ J& r+ Y7 O5 f
  18. *) M- O$ C4 f' t3 e" r, A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' Z- W3 h1 Y/ r. {. H. m+ }/ D
  20. * kind, whether express or implied; without even the implied warranty
    7 M' h  W- F- F2 g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" g$ Q( N! P" a( U8 w, B; ]
  22. * GNU General Public License for more details.; r  l6 x4 A) _0 L6 V3 W! E
  23. */: ]8 L7 Y. O( x2 I' T! p3 J% c
  24. 0 r0 G+ i  t+ s
  25. #include <linux/module.h>
    6 Y1 Q( D" }+ g
  26. #include <linux/init.h>
    * D+ }/ `& D2 o1 ~
  27. #include <linux/errno.h>
    - o$ l% X- y# X" l7 j5 A& n1 q
  28. #include <linux/types.h>
    / a2 o2 J* I* V( ^  d% |9 L
  29. #include <linux/interrupt.h>& F! J2 @) S; \) C5 m
  30. #include <asm/io.h>
    3 m% o5 J5 _2 @- f, W& j* v+ N+ h
  31. #include <linux/moduleparam.h>/ P$ G3 P- s' N2 D' ?# k5 G
  32. #include <linux/sysctl.h>7 x2 u: X4 c) L* E) M4 Z. p; `
  33. #include <linux/mm.h># z5 h9 @% e8 z' J
  34. #include <linux/dma-mapping.h>2 j! u7 y' p& [( H* {* c0 M* S3 Q: j
  35. 1 }1 U) r$ P1 P2 ?! p; S/ W" _
  36. #include <mach/memory.h>
    ' i! t9 U% Q) A4 s* K/ p: p. o
  37. #include <mach/hardware.h>. {2 [& v' G$ o5 R
  38. #include <mach/irqs.h>: v$ D6 K/ N4 E- |+ {' |
  39. #include <asm/hardware/edma.h># o2 `7 [9 M; h: I8 M, v# o
  40. ) W1 {9 J. Z0 M" w
  41. #undef EDMA3_DEBUG
    ) F+ [3 h+ a# g4 w3 g6 i8 b4 I
  42. /*#define EDMA3_DEBUG*/
    ! T$ E3 [% o0 @6 z+ z" X

  43. * x3 @1 {* Z" @1 k/ k: C0 s' ^
  44. #ifdef EDMA3_DEBUG
    , J3 a0 C2 h6 j  A- z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / x+ H! P2 B; N8 w" S, H. z2 H4 r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - [  S1 k4 W& a- B9 }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). M8 n& \, r* ]9 {- _" V
  48. #else
    . F) U4 u7 j4 {- J* ^  U) W! I
  49. #define DMA_PRINTK( x... )3 M- G) T4 v" }' D1 G$ j
  50. #define DMA_FN_IN. C3 M! _2 B+ B  b
  51. #define DMA_FN_OUT
    : |; y4 m& B! N/ v9 p5 O: W. m7 m
  52. #endif
    0 E6 M7 E  Q4 Z1 ^! q! @
  53. 0 N+ h( A# h2 D" c& L0 A
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      Y, g5 p1 k/ [1 g
  55. #define STATIC_SHIFT                3
    1 N: l- p) {( s
  56. #define TCINTEN_SHIFT               206 P/ O+ a) U3 r- F9 q
  57. #define ITCINTEN_SHIFT              21
    ; j4 Z' {! N/ p2 s0 j
  58. #define TCCHEN_SHIFT                22
    ' o+ z: R9 N& z. S
  59. #define ITCCHEN_SHIFT               23/ ~  L* Q4 N7 `8 j
  60. % M, C7 ~6 P9 G3 g/ u
  61. static volatile int irqraised1 = 0;
    7 f6 j4 G$ }% p6 j6 F' w6 v& _
  62. static volatile int irqraised2 = 0;
    + [0 n: |, A. n# K$ L4 t

  63. / z( k" x0 l6 s" K) i
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & ^5 W. h8 [& D! W8 z) j" z) p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , Y& ^! b1 \+ h) {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 n3 M6 b8 w3 F; q9 Y- i9 x- M! H
  67. 1 v: U& o0 P9 ?/ I- Y+ c% Y
  68. dma_addr_t dmaphyssrc1 = 0;
    * r  k9 g/ R, @' V) H) f2 J% [+ Z4 N0 C
  69. dma_addr_t dmaphyssrc2 = 0;
    7 f2 r2 L6 \+ o( h
  70. dma_addr_t dmaphysdest1 = 0;
    5 X& c. ^+ V# y% z
  71. dma_addr_t dmaphysdest2 = 0;
    9 [7 \% f' B9 {
  72. 3 B7 ]: p4 l3 m% [* Z6 B0 @0 x) t% ]. C/ w
  73. char *dmabufsrc1 = NULL;% H1 x3 e( N+ ?8 j) T# C5 a. s: I
  74. char *dmabufsrc2 = NULL;; s, S# ^- Z2 Y- m6 M' @
  75. char *dmabufdest1 = NULL;
    9 Y3 Z4 Q3 h2 Y/ k
  76. char *dmabufdest2 = NULL;
    # W5 |, k: B$ [& g2 Z) z
  77. ; |! a. m) t# |6 w5 [
  78. static int acnt = 512;
    " B( c' E1 ]4 t3 m# t$ `
  79. static int bcnt = 8;
    . ]" }8 u$ S9 R2 {1 V
  80. static int ccnt = 8;' {8 C- ]2 s( J2 M/ k8 |6 Z* Y

  81. & F3 X6 Q& V1 S% z0 e
  82. module_param(acnt, int, S_IRUGO);+ a$ C* u; L) P8 O5 T3 b
  83. module_param(bcnt, int, S_IRUGO);
    ( z4 h- U+ \  _( U6 I9 E/ _: k8 Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 D' |7 `- z- w. j# n+ t" J

3 `; ?3 ?- N+ d* m, F$ h  x) L3 y0 n. K$ Q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ w6 ^* R  z4 v2 E$ R. I! e/ jarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 ~$ c. K* O' ~# B  a5 G) |4 Q) s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* S8 z9 B; D# K& P- M8 @5 J
/ H( l' h9 i  ^3 B- ]8 }2 H
  V- Y* _6 ~. O8 B: T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-9 21:29 , Processed in 0.042058 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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