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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 b) {9 L/ a+ ^
  1. [code]EDMA sample test application
    1 o' i2 X3 H8 Z, h) m
  2. /*
    4 j) @. `3 o/ T, x/ s0 D
  3. * edma_test.c0 {% `: D! U4 e1 f4 `( \% ^6 ^
  4. *) Y8 D' z' y- {5 }6 r. Z) O
  5. * brief  EDMA3 Test Application9 h3 W/ Y" \" v1 Q
  6. *
    . {( W3 _# ^/ A' T
  7. *   This file contains EDMA3 Test code.. h' B$ [' t$ t% L
  8. *
    1 T3 K) W% U2 f! Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& i! Q8 V9 {6 T! S& T
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT* P1 `8 g+ f: y( `6 d9 _9 a
  11. *         TO CHANGE.8 h' I3 Z4 C6 y! ^& F  E9 P; }9 T4 d
  12. *
    3 J4 R8 l3 c: f9 P
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: Z& ]9 y6 n' L1 o# ~
  14. *
    5 g7 Y) a4 t& P# I  q0 z1 t6 p- j
  15. * This program is free software; you can redistribute it and/or) }# [) o2 m9 T: b2 F% y* X( H
  16. * modify it under the terms of the GNU General Public License as7 l3 [+ k0 X+ h- g6 f% |- M4 I, n2 [
  17. * published by the Free Software Foundation version 2.
    ( C3 U# @/ A3 g) t7 u
  18. *
    : z0 C: j2 v$ D& m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / M# k5 }0 V$ D* }2 @1 @
  20. * kind, whether express or implied; without even the implied warranty: c- u( A" F4 }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; p. ]5 N( R) ~' Y% g. W  p
  22. * GNU General Public License for more details.6 w/ Y  r) ^6 ~# t* T4 g
  23. */2 t) ?* Y# }, q% g2 C9 D
  24. 8 i5 p% J$ f* M$ W6 q  n
  25. #include <linux/module.h>( Q7 i! h& P; [0 i9 s) I1 y
  26. #include <linux/init.h>/ K: S9 p& P" _" u& \8 ^
  27. #include <linux/errno.h># s5 Z" t7 d% H$ P1 D4 W
  28. #include <linux/types.h>: [, u; q" i$ o, H8 ]
  29. #include <linux/interrupt.h>% P4 o# X0 U* h; H4 ]
  30. #include <asm/io.h>' w4 [0 {6 ]0 P
  31. #include <linux/moduleparam.h>
    $ Q" t4 ~( n9 o
  32. #include <linux/sysctl.h>; I7 Q- ?$ n0 R# X' s* N, F2 b
  33. #include <linux/mm.h>+ d9 W% X& w8 z; B% ~
  34. #include <linux/dma-mapping.h>& J6 W, ]- L8 `; s- [
  35. ' t, {9 ?' B; k. a" H  L
  36. #include <mach/memory.h>
    ( v: ?( N! a: F" ?) n
  37. #include <mach/hardware.h>
    + w3 a6 E8 C5 H* V0 \' I  p# l( D: _
  38. #include <mach/irqs.h>
    8 g' j! D: {3 d3 ]. w" I" W
  39. #include <asm/hardware/edma.h># r( _' {' `+ Z' q5 n7 b8 r
  40. - S+ e% |, M1 O6 ^( }
  41. #undef EDMA3_DEBUG
    9 t- z1 d# s! ]# t, N
  42. /*#define EDMA3_DEBUG*/
    % }! E/ |, U+ _; r+ R! ?
  43. : c1 q. N. K9 B& m8 L, I
  44. #ifdef EDMA3_DEBUG5 r4 C, Q- G6 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); {2 _, S, o3 G# u# {$ D$ f
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 b/ m2 {0 C6 H  b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)$ X7 l; G; o; `1 I3 t( k) x+ h  z
  48. #else6 A) p+ |4 X0 b- J  n, U. x) J0 o
  49. #define DMA_PRINTK( x... )0 R" ]6 ~0 L0 P, B% m2 }
  50. #define DMA_FN_IN$ M3 ]5 E8 O5 Q9 l" C' ^
  51. #define DMA_FN_OUT
    # a/ [% o& V; Z$ c+ ]% C
  52. #endif
    7 [% a+ T6 B$ M5 T- C) z
  53. 6 J, ~, m+ @' C6 w: I- l( D2 U) Y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 H8 a/ I( Z. j& z
  55. #define STATIC_SHIFT                3  }' Z( U$ f, H) }! m; \5 k
  56. #define TCINTEN_SHIFT               20
    - y1 b, V- K7 p) y
  57. #define ITCINTEN_SHIFT              21
    + W* F& X- ]9 Y
  58. #define TCCHEN_SHIFT                226 s/ X% i4 Z5 E7 s3 l! M
  59. #define ITCCHEN_SHIFT               230 p- L! [& s! b$ V  i

  60. % s- D4 a9 I7 s- m( f+ l) i
  61. static volatile int irqraised1 = 0;4 h: E5 ^% M0 w! n  G
  62. static volatile int irqraised2 = 0;7 v/ i5 U. T9 _3 l
  63. " M8 |2 D5 v0 Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% K! x, R+ u. _3 B' Q% r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- B, f$ V+ }& q# m# q( i9 _  x3 _3 e! g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . K+ V( N  F  w1 Q% J7 j, q
  67. 4 d$ g' ]% @  k3 d& s# A
  68. dma_addr_t dmaphyssrc1 = 0;9 B1 {- L* @/ @" b$ U/ w% E7 h
  69. dma_addr_t dmaphyssrc2 = 0;8 |" B* ?% G' N2 h
  70. dma_addr_t dmaphysdest1 = 0;. {, a& y$ j  L9 l
  71. dma_addr_t dmaphysdest2 = 0;
    & H+ l- W8 X( ^$ H$ e- Z  D( D' j

  72. 4 L0 ^0 p3 v! G" [! v6 A
  73. char *dmabufsrc1 = NULL;
    , w- V# o3 g' V
  74. char *dmabufsrc2 = NULL;
    & O# }/ X. ~! L
  75. char *dmabufdest1 = NULL;
      o/ o: J+ ~4 Q
  76. char *dmabufdest2 = NULL;
    $ r' N- E3 u0 p3 V7 ~$ d5 ]

  77. + g. w. h* q3 ^. H& G, W
  78. static int acnt = 512;6 s  W" Y. ?3 }4 c( s; n
  79. static int bcnt = 8;* r. R4 ^0 w. u- L4 B+ O' ~6 i
  80. static int ccnt = 8;  ?- Z0 Q" Q8 N0 F. `5 k, T

  81. 6 s4 s$ i  @3 f6 g/ ~
  82. module_param(acnt, int, S_IRUGO);0 w/ n& `, L9 R, A4 g& I8 t1 J
  83. module_param(bcnt, int, S_IRUGO);! R/ y: m" T" b
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; a! y$ b( Z  _8 _! ]' Y
# {4 R8 Y5 D: G* f- [, W. _      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. z+ z- F% G  i6 O: garm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& Y8 [* ~0 F4 j
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 O: i/ p$ \+ [' |1 _' m& D% z3 H6 T

) N7 d; W: G0 }. O9 P% S
/ d) }, ^' P3 Y: H5 Q+ P3 w  l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-26 12:56 , Processed in 0.038577 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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