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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 I4 _% m& U- ^
  1. [code]EDMA sample test application- i$ X- K. T3 L  l  {1 ~" L
  2. /*) J1 h2 Z! ?+ {+ d& T5 C4 u
  3. * edma_test.c" F. a8 ]- y9 g# G7 T+ ?* H
  4. *- u  B. i" r" l9 ]
  5. * brief  EDMA3 Test Application/ I( J0 @8 {8 q6 X/ U( q6 m
  6. *; \0 l6 F% N# W$ {: Q, `! _
  7. *   This file contains EDMA3 Test code.$ F: g) o$ O& a6 L
  8. *
    : @1 x; ]: b& N3 [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 ?* h8 E7 p& i! h$ u; j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , R5 l3 N. \; ~& f" q  V5 [
  11. *         TO CHANGE.
    ! S" w4 b$ _3 x; Z" Q9 n  r5 g2 B6 r
  12. *! b2 E2 q/ @" @% Y" L4 A
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! Q  |+ N  F, n0 S% q$ \6 y- F  o6 Z  c
  14. *, F) R8 ?1 d- J; p3 p* p. N" @
  15. * This program is free software; you can redistribute it and/or% ]- p7 C* W. G6 |3 @
  16. * modify it under the terms of the GNU General Public License as. d. }9 O. l) l6 {  \+ T
  17. * published by the Free Software Foundation version 2.
    2 E% V# b7 F  [/ x  F7 `- e  [
  18. ** w4 s; }+ i. |$ I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any1 B; X6 c* }; A, j5 T
  20. * kind, whether express or implied; without even the implied warranty) W; u, }$ z; R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* V. ]# s- Q4 q% i
  22. * GNU General Public License for more details.& }, N" r& R# f# i. A
  23. */  B  }4 R: C( }  d& Q2 y- N  y: |& c
  24. 9 i0 I% r( b, M) h' P- A& y
  25. #include <linux/module.h>
    % I+ Q# B, S) ]$ ~* n. G1 e
  26. #include <linux/init.h>! u9 [9 A# }% W+ W  ?' H- B" [
  27. #include <linux/errno.h>
    " E) W5 n" X/ M0 {, N
  28. #include <linux/types.h>' Y0 q9 \: F& p) p. x
  29. #include <linux/interrupt.h>, S, L0 C  J2 {* }8 Q
  30. #include <asm/io.h>; c( J0 P9 Z6 e9 c: s$ j
  31. #include <linux/moduleparam.h>0 m. m$ e- O! o( ^; |
  32. #include <linux/sysctl.h>
    ; ^! o$ n* J3 T% t" m7 V9 A" T
  33. #include <linux/mm.h>
    ) h* Q" q" l, O
  34. #include <linux/dma-mapping.h>
    / Z# q* ^( I3 H

  35. , D& g# e' g3 h" P. t
  36. #include <mach/memory.h>' c- T. ^5 L% C' T8 V
  37. #include <mach/hardware.h>
    " o/ ~/ H4 R' v7 l
  38. #include <mach/irqs.h>, ^5 a2 J' j8 h; M- p  {
  39. #include <asm/hardware/edma.h>" H  M% k* m' A/ n
  40. 9 I6 |* z2 X" T" g
  41. #undef EDMA3_DEBUG
    6 h  d, @. D' ~, ?" |6 e  M
  42. /*#define EDMA3_DEBUG*/8 \$ v  w1 B) W

  43.   B& Q1 Z- y6 H: ^" v6 e
  44. #ifdef EDMA3_DEBUG. j2 c2 z5 o" D% i
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% N. n* `2 f2 r6 r) d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) `( }& `0 U/ X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). p+ D* t, F1 t5 f4 ]9 F
  48. #else5 @( w8 y3 W  ~0 B/ i2 |
  49. #define DMA_PRINTK( x... )
    ' N6 q2 D; f- X0 e2 c% n
  50. #define DMA_FN_IN
      h, P% p& @9 N  S& Z$ T
  51. #define DMA_FN_OUT9 v. N+ H5 X9 i# d+ H% e, B& {
  52. #endif! z4 H) N0 n- t: b6 U: C" y# H2 {

  53. 3 J& s2 m/ H6 U( z2 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), z# P( Y+ t: K
  55. #define STATIC_SHIFT                3
    3 W% H' V5 Y# X6 ~7 r8 w8 G7 r# V) d! F
  56. #define TCINTEN_SHIFT               20; g: E) `3 S) |7 ^0 a* |# L
  57. #define ITCINTEN_SHIFT              21! X# W$ p% Y7 W) x: W3 |
  58. #define TCCHEN_SHIFT                22
    3 b( i  o. H3 _2 f9 {
  59. #define ITCCHEN_SHIFT               23% S4 Y  V4 Q: r6 M
  60. 8 [9 Q9 A4 M2 O1 c
  61. static volatile int irqraised1 = 0;: e3 P0 m" R& C
  62. static volatile int irqraised2 = 0;
    4 P6 x1 T- \/ o$ F2 k: r7 q" r! f
  63. + h' u) J" C' U* ]0 n1 y+ V$ \) ^
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* g7 L6 p; D' z0 \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 G3 f) U) _/ ~  Z1 h# [, T
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : e" \. A7 R$ P4 C( H
  67. $ _# e/ R6 X/ Q& T
  68. dma_addr_t dmaphyssrc1 = 0;: |" m- P) p( Y3 n$ G8 L! q  f, y+ k
  69. dma_addr_t dmaphyssrc2 = 0;
    9 `9 n* o' M* E9 U
  70. dma_addr_t dmaphysdest1 = 0;  A/ w& |" H$ l4 E  t; a
  71. dma_addr_t dmaphysdest2 = 0;
    3 a5 A. O: E0 y# j/ o( q/ p
  72. 6 U( R. l9 T3 X1 ~8 J  K! W# }
  73. char *dmabufsrc1 = NULL;
    0 v, o9 W7 O# y* A* G) A
  74. char *dmabufsrc2 = NULL;
    % y8 M1 a! s) @4 J
  75. char *dmabufdest1 = NULL;
    8 z  C8 a0 a- f9 Q) r& y
  76. char *dmabufdest2 = NULL;
    ' @0 `' @7 t  E, [) u

  77. % f. k6 T1 t! m! B/ V6 n
  78. static int acnt = 512;
    3 J; l5 b' f/ a$ b: f
  79. static int bcnt = 8;
    5 b, o3 }$ K# r* y1 `1 ]
  80. static int ccnt = 8;  k/ t/ N7 l1 d5 G( h: L5 {
  81. - a  }& K* o, Y
  82. module_param(acnt, int, S_IRUGO);& w, p" a6 d7 H' a" x! ~/ I
  83. module_param(bcnt, int, S_IRUGO);
    2 d: _) T* p9 r; D+ S& l  a' A
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ a3 L! q9 y. \( E
& H( b! w/ I6 W; H9 U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ x+ N  B2 ^" k' \/ @, ]% Z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* K0 [1 a, S% ?. F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& s/ U9 K3 n9 O5 [: L5 z
7 u* x% [7 U& i5 y  X) Z2 h3 k/ R
; t% o9 f" H' [( Y( l# A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-24 10:28 , Processed in 0.040281 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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