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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 g; j( u# w0 w; f* V# ^
  1. [code]EDMA sample test application
    / G  K, N* q, b
  2. /*8 u4 X' u; W2 s+ [
  3. * edma_test.c
    * ^3 ?: J0 D# Q! s* @: I, B1 j
  4. *) {8 \4 X4 Y. B5 m! O" Q
  5. * brief  EDMA3 Test Application5 F; H, h0 o2 ~" x. h& @: {
  6. *" d+ p1 h) h' V
  7. *   This file contains EDMA3 Test code.6 V' [' e7 F' F# Z% x3 x3 P
  8. *
    ' A. A( w5 R7 s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( t7 Z+ W& y3 i  c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 o; h8 H: `3 t7 ?" Y
  11. *         TO CHANGE.. |) x% X9 N8 ]
  12. *, n& s1 v: E. l' v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 s; W8 E9 B; H+ R
  14. *
    ; z8 [& u' ?, h2 R0 j4 a
  15. * This program is free software; you can redistribute it and/or
    . C0 f/ O% W4 R+ N; a% w
  16. * modify it under the terms of the GNU General Public License as
    + V. F# }0 B7 [" y7 d- r/ M7 ?
  17. * published by the Free Software Foundation version 2.
    6 G3 k& B  {2 {
  18. *0 W& k: w. f1 \& a7 {' n
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 H/ @3 T/ W, c: X7 A" e
  20. * kind, whether express or implied; without even the implied warranty
    $ \8 {  c' V. L5 P" x* g9 d- n. T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " [8 F" a5 E( Y7 ^8 w* K
  22. * GNU General Public License for more details.' S/ V3 N) F8 s4 r$ Z
  23. */2 D) F: }  E5 q1 c' a- [/ W! c

  24. 4 ]' Y2 Q6 w( Z- s
  25. #include <linux/module.h>
      J" G" Y9 j2 n0 i$ X9 [
  26. #include <linux/init.h>3 Z  e+ y, Y% D, i- F1 f+ L
  27. #include <linux/errno.h>
    1 o* C+ R8 |* C
  28. #include <linux/types.h>* f* X, W5 ~3 X) x) {1 |7 k& w$ X
  29. #include <linux/interrupt.h>
    5 N1 b8 G  D! |4 `& U
  30. #include <asm/io.h>
    + I! ]$ c. x% H* `
  31. #include <linux/moduleparam.h>/ h) R: l1 w6 c
  32. #include <linux/sysctl.h>
    / f- Z, N# ?& W+ ^" E: e2 x% `
  33. #include <linux/mm.h>$ p& b1 Y( ~2 C1 R+ @9 h! q
  34. #include <linux/dma-mapping.h>5 a9 b5 e$ E6 r7 O
  35. ) P6 x  I4 s+ C  x: A" k) x* ^
  36. #include <mach/memory.h>
    ! N# ]; c( Q- q/ S4 Y
  37. #include <mach/hardware.h>
    , ]+ T1 Y8 o1 T2 U
  38. #include <mach/irqs.h>
    1 \4 Q; U8 D, `8 I
  39. #include <asm/hardware/edma.h>
    ' W2 }2 w% o3 L9 s9 E
  40. , ^4 Y. d; `! g
  41. #undef EDMA3_DEBUG5 O" y- z* S! P9 F/ l' r4 d# R
  42. /*#define EDMA3_DEBUG*/
    4 u  `, b  Y2 O8 L. B! r
  43. + l& q% `" s. b1 z
  44. #ifdef EDMA3_DEBUG
    3 Y5 u! A! |# f% ~( a, w4 l0 q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! t2 y! w/ i# D, t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 q  l% x) m- E. V0 X/ c, n3 H$ Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) l6 h7 H! x. `: ~$ I
  48. #else! O. X1 `1 f2 O' k: S1 C
  49. #define DMA_PRINTK( x... )
    8 g" G# u* T+ C7 [
  50. #define DMA_FN_IN1 t/ p; x$ m  v6 J4 K& z' F: L
  51. #define DMA_FN_OUT
    + I5 a9 ^2 R4 r! t7 V" G. I
  52. #endif
    5 \* f4 b/ X1 |0 X- V

  53. 1 \/ ]) P) O9 ~: c1 m/ v) N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 A2 a1 t+ L/ ?. A. c  L$ a0 `& ~! A
  55. #define STATIC_SHIFT                3
    ; B0 v" y( r& L1 w
  56. #define TCINTEN_SHIFT               20
    ) o( U. X  c( v( b8 Q
  57. #define ITCINTEN_SHIFT              21) z" G. t9 C+ \" b7 Q) a9 w* y7 ^7 U
  58. #define TCCHEN_SHIFT                224 f! \: U! Q  s( k2 W/ \
  59. #define ITCCHEN_SHIFT               23
    0 F1 Y1 J9 [/ T* h) `$ S2 E* p
  60. 9 J0 H5 w( B5 d9 p; R- G, o
  61. static volatile int irqraised1 = 0;) w/ p0 {- {4 _# }6 A- |7 s4 ?5 u
  62. static volatile int irqraised2 = 0;$ t; w1 O, W6 }- g: |) z( ?& o

  63. , V( h# T2 j, ]1 f- y7 v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ J; v1 S7 r3 n- \: j7 Q& X2 v: D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ X: n% A7 H* B/ F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ F$ z* r. B, |* E7 G  Z* X
  67. 4 W! b% V+ E. v( ]  o
  68. dma_addr_t dmaphyssrc1 = 0;: U0 d5 p3 u7 g+ p) D2 r
  69. dma_addr_t dmaphyssrc2 = 0;
    - F, `! `3 U7 x# e8 Y
  70. dma_addr_t dmaphysdest1 = 0;
    2 |! ^5 j$ k% K( a2 Q$ s
  71. dma_addr_t dmaphysdest2 = 0;
    ) ?; j, l: P; r

  72. " Y1 r# T; z: F/ R( }
  73. char *dmabufsrc1 = NULL;
    * c# Y8 c! z7 K7 f+ j. ]; K* E
  74. char *dmabufsrc2 = NULL;
    1 @; v) ]6 X7 p$ W/ n$ a+ [5 A9 H
  75. char *dmabufdest1 = NULL;# M) c3 z; G6 K! s3 o
  76. char *dmabufdest2 = NULL;
    2 w- L% K7 |$ x6 h! u

  77. 0 [: p' w& g7 W4 R. U
  78. static int acnt = 512;
    ! R7 J( H2 D7 Q# E% V; F+ i
  79. static int bcnt = 8;" M# U% _9 f! ^# y& Z
  80. static int ccnt = 8;
    ' _: v* ~! x$ e
  81. , o7 e+ ]5 R* d; ~3 [# g, }% d& L
  82. module_param(acnt, int, S_IRUGO);
    * @) S# K! ]8 D; ]8 K
  83. module_param(bcnt, int, S_IRUGO);8 b8 z3 P0 n* B. l) b, [* v, s6 Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 C  H) q4 K, |

, f' t( Q9 O7 }0 k3 ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 P+ \' B% r; P4 q! [$ ?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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 t; Q- h4 v/ k5 K( ]     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 A$ V2 e" B% t% B

1 n7 a8 z5 w8 d% V1 q4 A
. A( }. c9 w1 p: g! ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-12 16:36 , Processed in 0.036696 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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