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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 r, o9 O+ p7 y7 ?7 W
  1. [code]EDMA sample test application9 u4 X, a8 T5 G" `6 J' f) J; R
  2. /*% B5 Q! q7 @  P7 e; q  b2 I9 i
  3. * edma_test.c6 N( ?7 F+ ?( T. K
  4. *
    ) Y8 ^+ i) W3 ^/ Y# a! n9 h1 `: H* \
  5. * brief  EDMA3 Test Application
    - A# m9 J: w5 v( x* A
  6. *; j/ i& a/ g% x4 Z- i. t( l
  7. *   This file contains EDMA3 Test code.4 A0 J2 n) b- A, c& Q# [
  8. *1 p& q1 W: M* t0 A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 O: K" |- }* V+ A$ @. C
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 d/ l: U+ O" V/ ?0 N
  11. *         TO CHANGE.$ E7 O5 m4 C; J+ x/ n
  12. *; r$ g' R# X% j+ g0 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 ?. a* D) m: H0 x
  14. *( u1 u: M6 V$ g% ~
  15. * This program is free software; you can redistribute it and/or1 l+ J9 ^9 b' s4 e* V+ `
  16. * modify it under the terms of the GNU General Public License as
    % K# u! ~: `* @( a4 `, Q
  17. * published by the Free Software Foundation version 2.
    ! E7 Q2 |* W, R
  18. *) N, B6 q+ S: Z* i5 {# x4 R2 w( ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! f) N) H+ P! J. P
  20. * kind, whether express or implied; without even the implied warranty* L* h* {* q7 s( Z/ M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ U3 c& x. V- U  R1 V1 w( c" j( V3 y
  22. * GNU General Public License for more details.' o- v, A" G5 j) u/ N
  23. */
    1 t9 H  \5 B2 L- v% W1 [4 U5 |# U- h

  24.   f; I4 z7 y/ g9 S
  25. #include <linux/module.h>
    8 P/ h* a9 ^' f8 l: I1 g8 e
  26. #include <linux/init.h>9 T1 c4 `/ T; L6 a; ]$ P( j2 d3 d
  27. #include <linux/errno.h>
    % o% A; H6 F+ p
  28. #include <linux/types.h>
    ; Y, A  ]' H* W: B
  29. #include <linux/interrupt.h>
    ' V- o- R) H9 E1 D; N! C4 K. c
  30. #include <asm/io.h>
    $ }8 J& I" b- _4 ?$ f
  31. #include <linux/moduleparam.h>
      I% z4 U. s7 P! d
  32. #include <linux/sysctl.h>
    ' y  B" F) P" V. l5 P
  33. #include <linux/mm.h>
    . ?% b3 n4 I7 z, q+ d4 r4 Q2 H
  34. #include <linux/dma-mapping.h>
    - o2 v+ x# D5 ~) g! F
  35. + m# v" y' }1 i' B( J+ P
  36. #include <mach/memory.h>
    0 z: D/ c) X0 |$ D1 g
  37. #include <mach/hardware.h>: F5 j8 N) ^- M
  38. #include <mach/irqs.h>
    9 Y& H7 M" w/ n& w
  39. #include <asm/hardware/edma.h>
    , |' {* k3 l8 V

  40. 6 X; c: r* B  ^3 Z% l) v
  41. #undef EDMA3_DEBUG
    $ u* R* m% `# u
  42. /*#define EDMA3_DEBUG*/( j7 P- ]' F! N! ~( @8 ~0 D

  43. . I$ O( g1 w0 u7 v  S9 @/ S
  44. #ifdef EDMA3_DEBUG4 n, \) |3 T- H- w* |0 }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  ]$ R  R# f  Z" M8 D* m9 M! j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . |8 w+ b: W7 V0 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 s# W8 g( `7 \9 P8 H: q
  48. #else
    ) d7 c  ]8 l) ^- e. v) l: k2 p
  49. #define DMA_PRINTK( x... ); J2 F9 ^! ]! d7 n
  50. #define DMA_FN_IN
    * c% V% ^5 R9 i  @( d+ J
  51. #define DMA_FN_OUT* j; @# z& `+ J
  52. #endif
    3 Z( F+ Y  \& A. Y( P- o

  53. $ |! d" J3 ]9 {0 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    3 M* }1 f& I8 N
  55. #define STATIC_SHIFT                3/ t: k8 q) X* S! b6 {+ N$ O
  56. #define TCINTEN_SHIFT               205 U5 J8 x8 d  ~- O! a7 p* K
  57. #define ITCINTEN_SHIFT              21% F' u1 ^( w0 Y8 u9 a! K
  58. #define TCCHEN_SHIFT                22. w/ j6 |: w9 `% v
  59. #define ITCCHEN_SHIFT               232 \5 K( P5 \4 P& l5 S
  60. ' w" o0 f8 j' A2 ?$ C! j4 b
  61. static volatile int irqraised1 = 0;% S6 J9 D0 V% y$ D/ N: g
  62. static volatile int irqraised2 = 0;  E; y3 T8 a" m. T
  63. : V. K8 d$ _6 D3 V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- @# c/ u# b7 T9 `" L) [4 G; o
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 o% _1 v3 `0 P, {5 _" z! C4 g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 ]! a3 q, Q4 V( i4 K

  67. . B& n" @. J7 g* c2 h4 o) \9 H6 M
  68. dma_addr_t dmaphyssrc1 = 0;& {% Y* ?7 q' n( I$ b  w5 U0 m2 `1 V
  69. dma_addr_t dmaphyssrc2 = 0;, Y5 o! V9 x9 e0 t5 p) t
  70. dma_addr_t dmaphysdest1 = 0;
    8 r& o8 X6 S9 g* b8 A: [* v
  71. dma_addr_t dmaphysdest2 = 0;; f" Y7 }! P5 L9 N2 b! k
  72. 1 q5 ~) ]9 F8 ^
  73. char *dmabufsrc1 = NULL;
    & Y5 n1 F+ ~! }, I
  74. char *dmabufsrc2 = NULL;/ O. k& O. H, N- b9 e7 E6 f
  75. char *dmabufdest1 = NULL;) E: Y) H5 [( @2 i1 P& `8 f2 h* I+ b
  76. char *dmabufdest2 = NULL;
    + c+ v; N. }" z
  77. 8 b. T/ v2 v  \2 j; ^
  78. static int acnt = 512;0 l' C; @& L2 [0 J4 z& A8 p1 J# h' ?
  79. static int bcnt = 8;
    ( A' P2 b$ g- e, ]/ I6 n" @
  80. static int ccnt = 8;' H' X4 T5 I5 c
  81. # q$ y9 {6 K' ]% n7 D+ F
  82. module_param(acnt, int, S_IRUGO);
    5 T4 ~; z5 x! ?" R' u3 D; N
  83. module_param(bcnt, int, S_IRUGO);
    : Q, g! g: \4 d' |
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ u% D* M  M$ V; R. p1 B$ z* g
8 o1 a. s% w7 F4 G& V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( P1 V5 }5 g7 L' D; q* e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 s8 K4 ~. P- E* J
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 B- @- ^2 y0 u) x, f, q1 W8 B9 y' w5 e
9 T" o% m! x% y% L: x; K5 Z( ]
0 T9 Z6 P, k+ y% }+ Z) ?! p, D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 05:17 , Processed in 0.037138 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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