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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! i- G( q; O* t( ?3 z
  1. [code]EDMA sample test application
    - @" u9 b) h0 {1 K- |& D( c
  2. /*4 l6 q/ B4 [4 a( Z6 r, a4 d
  3. * edma_test.c
    + D; _; D! k  {: I* y7 L, F! _5 |
  4. *8 [+ a, P) M# I4 g
  5. * brief  EDMA3 Test Application
    2 e1 M, z  u+ p
  6. *
    ( \/ K) D) Z+ D
  7. *   This file contains EDMA3 Test code.
    5 |; |; k4 r' c: {7 {+ q
  8. *
    . O! A' F- Q( h$ M5 }- e5 m" B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 n- f. B8 x! ^: S1 L) m. v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 V4 s; {$ U) b; a7 ?  f: E
  11. *         TO CHANGE.
    6 y: W0 g- z/ a' }1 X
  12. *+ Y- Q+ Y7 B* s' c1 H4 G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 [/ y$ [1 @% h/ b) B' F
  14. *
    . R- \  A5 W9 V  f
  15. * This program is free software; you can redistribute it and/or
      }4 _+ _8 {5 y- A
  16. * modify it under the terms of the GNU General Public License as
    , S: L4 h7 z  X+ l% ^
  17. * published by the Free Software Foundation version 2.6 a3 T* ], k0 T. A
  18. *$ B6 ?& Z$ |: F8 f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . H/ I. v' K% J+ M+ C% x
  20. * kind, whether express or implied; without even the implied warranty
    , L  [& _, r/ \! H+ T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 E: o+ y- K7 l: C
  22. * GNU General Public License for more details.
    : o4 r+ L! ?5 u& }
  23. */2 G5 J& S3 Z1 i1 Y; |

  24. & }. O: _, }, f; x2 F
  25. #include <linux/module.h>* Q; U: z: c( u
  26. #include <linux/init.h>
    % u& t3 x8 }5 o  n9 }
  27. #include <linux/errno.h>8 y- h. X  y/ N
  28. #include <linux/types.h>- b  W: S' q8 [# L1 {
  29. #include <linux/interrupt.h>
    5 G8 P# E$ [4 R% H
  30. #include <asm/io.h>9 v6 ?! X4 L. z- J) N
  31. #include <linux/moduleparam.h>' K! Y; Y' w5 e
  32. #include <linux/sysctl.h>
    - k, D% t+ }( D( Y
  33. #include <linux/mm.h>
    $ U2 w5 [& o3 C9 ?0 N
  34. #include <linux/dma-mapping.h>  W$ \: {1 L* ~6 n: ?

  35. ; `5 m6 S0 Y4 s4 O' i# l
  36. #include <mach/memory.h>" U* J6 \" {% m9 q8 B/ _  [1 S
  37. #include <mach/hardware.h>
    : i: r8 |! G( a9 z
  38. #include <mach/irqs.h>' K4 J9 G$ F! p
  39. #include <asm/hardware/edma.h>/ R: M0 w) k6 L& H7 w0 ~8 X

  40. ! w  M6 l% S+ r6 L& l
  41. #undef EDMA3_DEBUG! Z9 D$ ^  @" z3 \2 j6 O2 v
  42. /*#define EDMA3_DEBUG*/7 O$ ?8 k7 C+ n) w! a& ?9 r; N
  43. 9 u; E" a4 w8 u. {; k2 q
  44. #ifdef EDMA3_DEBUG
    % X% T) m( F' w  C! \  o6 O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . B9 c" K1 U( ^8 Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' [# l0 J* M) y6 O+ [/ H: V% u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ F) t0 b3 B0 _
  48. #else
    & U3 g. z, N: K1 D9 Z  R7 `/ C0 j$ H* V
  49. #define DMA_PRINTK( x... )% x5 G. b- [/ B" [) \% v
  50. #define DMA_FN_IN
      Q% y8 U6 S; J
  51. #define DMA_FN_OUT
    9 g+ `4 ~9 q: g& f' {( w4 ^4 ~
  52. #endif/ s8 c& e5 {7 G9 r

  53. 4 {. `3 |/ B. X1 v! g  G( q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 f/ b+ M' y3 m1 C
  55. #define STATIC_SHIFT                3
    , i7 p- K4 S# ^0 _- k; ~) B: {
  56. #define TCINTEN_SHIFT               209 p7 R6 E1 |' V! E& o
  57. #define ITCINTEN_SHIFT              21
      N, y* y8 N3 V% ^) @$ e
  58. #define TCCHEN_SHIFT                22
    % {, A9 f; s( M1 r; q5 L, `- V% T, V
  59. #define ITCCHEN_SHIFT               23$ n; }& h1 z# p, _9 i# K, E
  60. ; E0 W- F# o) k7 x; f
  61. static volatile int irqraised1 = 0;0 ]/ y: v" k7 K. K) S
  62. static volatile int irqraised2 = 0;
    1 P( ^1 [2 P, H6 c, m6 h

  63. 1 Z  n! {& m: V$ }" k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 [! v1 U6 n8 A0 f1 A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% F& ]2 C3 V% J2 N: M) R
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 |" j+ T7 g) K7 h

  67. % {. R: f# h; E9 P' R& V
  68. dma_addr_t dmaphyssrc1 = 0;0 y$ }: ^0 n' W: Z- G' ~3 A/ |
  69. dma_addr_t dmaphyssrc2 = 0;
    6 ]- D- e3 B; M! m3 H2 b
  70. dma_addr_t dmaphysdest1 = 0;. b# o" S; Q. b6 ^  n8 N
  71. dma_addr_t dmaphysdest2 = 0;
    3 w' ~* \3 l# t

  72. 9 m1 [& a2 C% u: W' M6 G  [
  73. char *dmabufsrc1 = NULL;
    . T) P0 v+ y+ I" e1 p: o
  74. char *dmabufsrc2 = NULL;4 N; d& `) L. D2 C
  75. char *dmabufdest1 = NULL;
    . u2 D6 h* R8 `8 T- b, H
  76. char *dmabufdest2 = NULL;
    7 N* F( h9 ~& I7 [8 A6 V0 T2 E& J- |
  77. : y0 _9 h+ O, P( U
  78. static int acnt = 512;
    : _! e# L. K2 Y* ~: o
  79. static int bcnt = 8;
    8 d, L- ?5 E1 a! X' n
  80. static int ccnt = 8;
    0 x! ]% ~9 e! i; n& a2 i# m
  81. 0 z% h" a% e& `& T
  82. module_param(acnt, int, S_IRUGO);
    . X. m4 b7 }6 f  C  H
  83. module_param(bcnt, int, S_IRUGO);# H- Q" ^, E5 {9 l; p7 W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) {0 H- N, ?6 U4 Y: M0 Q4 ?5 U5 r! i$ U" u
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. p2 s* W. @% Y* ]; V" c0 carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, }+ ^7 U: n9 i7 O$ f" d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。  l; E7 r3 T2 ]' l8 N
5 M5 K. {# P' f2 A, o( H5 C. F* I: Y
' j( O  [8 ^9 H- \! s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-29 11:06 , Processed in 0.045584 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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