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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 |: ^) Z4 W4 P8 A/ b; _7 f3 P
  1. [code]EDMA sample test application
    $ |' a% H3 [. |
  2. /*  q& s9 M! _3 T+ s0 Y6 B
  3. * edma_test.c
    # G# o8 d  P/ I! n* M  t
  4. *
    " a. r$ V9 r, `2 u7 Y2 O
  5. * brief  EDMA3 Test Application
    : x. s6 Q* H: y6 ^0 @" J/ s
  6. *
    * X$ \, _' d6 I0 O' q) J% C- T6 ~
  7. *   This file contains EDMA3 Test code.
    * r! S1 U: T( a/ b1 R- }) t, W# Y4 W9 R
  8. */ B* B) H; b4 K( ]8 S( Y" R+ W) v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) H/ o4 H' r$ M5 E% M) f2 Y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  t6 r! F% c) I  h' J- m+ f
  11. *         TO CHANGE.
    $ L# ^2 Y5 B7 f  x
  12. *' i! ]. l* j3 a3 h9 ^. `
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    * c' m# P, \; d- c
  14. *
    8 l4 J% O+ g5 T$ |& x+ U7 O2 R
  15. * This program is free software; you can redistribute it and/or
    * b0 P7 o7 x* P6 x  l- ?) C) _
  16. * modify it under the terms of the GNU General Public License as9 P& W8 I+ ~# b, @" |! F, M# r
  17. * published by the Free Software Foundation version 2.1 E  J! `1 `  o0 ?* ?; P' C( Q
  18. *
    3 r1 u0 d2 m6 _3 |% H- \  B# Q& E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) o% [! d5 \, N$ Q: Z
  20. * kind, whether express or implied; without even the implied warranty
    * w( i% _1 b0 G, B: m' m9 I. R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( P& M" l. S" n: o) d% R! b& Q
  22. * GNU General Public License for more details.
    / J2 \6 z0 i0 d1 j* Z% V
  23. */
    4 B) v* a1 p6 W! q  R: e; n

  24. 5 c+ Z# e9 Z& Q8 S) F& e
  25. #include <linux/module.h>: F% P- K/ y$ d1 P
  26. #include <linux/init.h>) ?+ U5 ]$ D# m8 H( f' l& G
  27. #include <linux/errno.h>+ f. r7 @# [. J
  28. #include <linux/types.h>3 {  M, `) T0 `) L4 B+ r) U
  29. #include <linux/interrupt.h>
    - }1 G4 |; B) ?  W" ~
  30. #include <asm/io.h>
    4 ~8 }* P! R1 [5 `9 r* `6 p' w
  31. #include <linux/moduleparam.h>
    . Q( }% J; ]* v- y
  32. #include <linux/sysctl.h>
    ; H6 H9 H) S, b# x3 @
  33. #include <linux/mm.h>
    ( }' d9 J$ O) b, F" |% m5 J4 b
  34. #include <linux/dma-mapping.h>% y3 n5 E$ O" \0 T: P  @. B
  35. ( F7 P( U5 g( W
  36. #include <mach/memory.h>) G# p' s5 K0 c1 k, D
  37. #include <mach/hardware.h>
    6 n& a0 k1 G$ F+ ?4 O9 n) b& e% @# ?
  38. #include <mach/irqs.h>5 I7 P6 R, x0 y+ l1 n* p3 D
  39. #include <asm/hardware/edma.h>
    ' `! O8 y2 g1 y, Y

  40.   F  I) ?- }. F1 q; C5 Y+ j
  41. #undef EDMA3_DEBUG
    5 p3 G6 e, |/ G  f
  42. /*#define EDMA3_DEBUG*/. n7 i* |4 B* j4 a1 G

  43. 9 k( g; K: J$ ]+ N/ W% ~
  44. #ifdef EDMA3_DEBUG
    $ H7 U2 i' W8 ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - E4 A5 [- X% Z. B3 ]* _2 m& t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / m1 N2 }3 |! y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 H' `7 E) _" i% w9 `+ q: o5 a
  48. #else
    1 q6 j1 E5 {. V" t( K7 c) c- a/ J
  49. #define DMA_PRINTK( x... )
      u& @/ I' k1 p* R
  50. #define DMA_FN_IN; G! C# F  [: v5 L, q! k" M
  51. #define DMA_FN_OUT( I- V9 v$ O. y9 v+ }+ W
  52. #endif1 i6 F  n5 Y3 B( z6 ^2 v

  53. $ W/ \2 W" L; s+ W6 e3 A4 \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( s$ a2 w3 S& V
  55. #define STATIC_SHIFT                3' d- T7 ^4 J  L8 L
  56. #define TCINTEN_SHIFT               20
    6 X* ?% ~7 E1 G/ O
  57. #define ITCINTEN_SHIFT              21
    & R$ ~7 J) z, r  r. b5 ^- g
  58. #define TCCHEN_SHIFT                22
    # {3 O3 t8 B/ @3 s
  59. #define ITCCHEN_SHIFT               23, g! i3 G0 a& o( a  J6 D  z- Q

  60. % i5 s7 J2 G7 e/ J7 J1 K" X5 M8 g
  61. static volatile int irqraised1 = 0;
    ) z1 C3 T0 E& C: ]0 r% b& W
  62. static volatile int irqraised2 = 0;: k( e- m* ^/ u1 X2 z: r

  63. 2 w! C  s  u" g' F# v  U0 ~  i& b3 ]: u2 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 b  ^* g/ k7 p$ i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ C/ M4 ~8 R' k  r( n6 J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( O2 K) b& G( M/ v- j/ q, |

  67. + o  c& X& @1 W- Z! y3 ]$ J
  68. dma_addr_t dmaphyssrc1 = 0;3 z5 e( f8 V/ ~# O. X) y
  69. dma_addr_t dmaphyssrc2 = 0;- X& r) c8 L3 W: U- L
  70. dma_addr_t dmaphysdest1 = 0;8 N& {! o- |& k3 y9 r8 P
  71. dma_addr_t dmaphysdest2 = 0;9 W; A0 f' S* Y  f+ |2 X6 l

  72. " l9 L: k& c) ?; t) v/ t4 R
  73. char *dmabufsrc1 = NULL;5 v& v/ G, r, ?  e3 m; u
  74. char *dmabufsrc2 = NULL;
    2 g: t) F/ x' L
  75. char *dmabufdest1 = NULL;
    5 D, F9 Y& ]. K1 t
  76. char *dmabufdest2 = NULL;
    9 }# o, N% ?  A5 v/ ?# f
  77. # {4 m* X  i9 Y- F6 _
  78. static int acnt = 512;/ q6 d" U2 C  I
  79. static int bcnt = 8;
    / c+ r5 N( ]+ E; w9 `4 B  g. I# g7 f, u( k( ^
  80. static int ccnt = 8;" k# K$ T" q& c5 V5 u% b. [( X3 a

  81. 9 _  @# t" L7 K9 `  a
  82. module_param(acnt, int, S_IRUGO);9 |( Z: H, m2 Z4 [: F
  83. module_param(bcnt, int, S_IRUGO);
    : e1 o6 o5 I4 S. W/ M# A. x$ j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# p, G. M7 ?8 f. {$ W
4 |, v, P& A5 _4 Y. X0 t3 m+ }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- W. M4 `+ E' Varm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 b- n& T0 |8 M5 x, M5 l) S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. m! o# l% \0 L- v4 c$ t

9 R! z  [. V- Y( o1 X' J9 _
5 X, G9 z& V* p$ c. N
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 18:07 , Processed in 0.041199 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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