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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; H' ]4 i4 O' k% D- L
  1. [code]EDMA sample test application
    8 C: `3 B, @" z6 C# G4 q5 ]
  2. /*  Z! u3 M5 N% _7 B# N
  3. * edma_test.c; a. k- N2 Q) }& `* M
  4. *
    " t3 Z$ K8 C8 I" T* P5 [+ I- c" {
  5. * brief  EDMA3 Test Application
    3 K3 p  s  F; W/ Q9 O- J
  6. *" m; s3 M$ T( ~/ T* }% L1 _7 L6 J
  7. *   This file contains EDMA3 Test code.: y0 L/ e. u9 E( _
  8. *
    4 I1 H5 C% M9 f5 R3 S+ }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & |9 B9 t4 S# L  `* L6 P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 e  q+ _. @! U1 L# t
  11. *         TO CHANGE.
    * x2 b- `" U: W0 T9 V5 a1 Y
  12. *
    / }  H! H- R0 S) k$ v+ _) L( t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " o! i( O; {5 ]' O  @4 m2 x
  14. *; ~# p' G/ H8 Y& I8 G- T
  15. * This program is free software; you can redistribute it and/or
    0 r, A( v9 ^9 \. x3 \! y& x
  16. * modify it under the terms of the GNU General Public License as
    ' ^4 }/ \" i  B* R- f
  17. * published by the Free Software Foundation version 2.5 K5 t' Y$ K' J* _
  18. *, S  a0 Q/ K" j) t* a1 e8 v, |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 O6 Y& A+ _8 u4 E1 G* Y" q& q: B
  20. * kind, whether express or implied; without even the implied warranty8 E  m+ F! Z/ O2 c: q: q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the2 [4 k' D) M4 N$ P9 g
  22. * GNU General Public License for more details.5 c0 Q2 O4 I' }1 `2 _; |# p* b
  23. */8 F3 x2 a' M* B7 t& [( X7 V
  24. # B9 g' N$ v. R! K, P
  25. #include <linux/module.h>4 G2 z- X, u. K* s. H+ V
  26. #include <linux/init.h>3 T" B6 {1 L/ F( G) U' I9 G$ k3 W
  27. #include <linux/errno.h>. n$ i+ T- C& \! H  Y( T2 E' [( G
  28. #include <linux/types.h>
    4 D+ N1 W% p4 h" C/ E
  29. #include <linux/interrupt.h>2 H" P6 w/ X' y  b! [( _: Z* W
  30. #include <asm/io.h>
    & k( R! B6 N5 ?( L
  31. #include <linux/moduleparam.h>
    " a/ D! j: H* G5 B! q& z$ z
  32. #include <linux/sysctl.h>
    9 Q9 J6 g; e/ K: F. a' Y
  33. #include <linux/mm.h>
    / g3 T+ l- @  ]0 V9 M
  34. #include <linux/dma-mapping.h>
    1 y! |' q0 k* @/ f* A" ~
  35. 6 s- _2 p; C! d4 A( |) `
  36. #include <mach/memory.h>  K/ P! j+ V1 c$ T. D- Z( R' B
  37. #include <mach/hardware.h>
    * c. o$ n- u! J3 H3 t
  38. #include <mach/irqs.h>
    ; Y, X* X! }# D& t  ^
  39. #include <asm/hardware/edma.h>
    / L2 I. P; D# ]. k4 n

  40. + v# y  _3 R1 f) E
  41. #undef EDMA3_DEBUG
      }7 V' P2 K& Q0 E9 f% d  J
  42. /*#define EDMA3_DEBUG*/* w1 _3 \2 b& x) v* p  Z, {/ \
  43. 0 u  c' A0 e, O9 L) M  X
  44. #ifdef EDMA3_DEBUG
    , J- V+ R3 z* Z$ d0 V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * l' ^5 g2 d. _# W; o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); I1 F  u9 d, y" t! ]- g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 ]! S! j# |8 x! ~- J1 l
  48. #else% x$ P8 P3 f  ~$ O" w
  49. #define DMA_PRINTK( x... ), k, [9 Y: \1 C, O) k/ z2 |% B  @
  50. #define DMA_FN_IN# p9 M  B- h4 ~4 G- ?: l, f
  51. #define DMA_FN_OUT& N$ f" F: i* E6 C- o
  52. #endif: K9 A$ V5 b% c/ F. r8 k, q6 C

  53. ! D% }& F3 u% R; D* L! C; H) \$ Z' ?) f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 |( L: Y, i! S8 a+ h* U
  55. #define STATIC_SHIFT                3
    . R+ i: c1 C& V7 T6 ]; D
  56. #define TCINTEN_SHIFT               20) V! ]& s; z5 l, D6 s% }/ I1 C& |
  57. #define ITCINTEN_SHIFT              21( F$ l0 [2 w4 z8 r6 _, N9 P) }0 f4 l
  58. #define TCCHEN_SHIFT                221 K' [5 O, U% ]/ P
  59. #define ITCCHEN_SHIFT               23/ o# b6 m" U% p/ ~
  60. / l8 C# b4 i, Y1 R9 h2 N/ q
  61. static volatile int irqraised1 = 0;5 c1 y! g7 p% B) s7 j
  62. static volatile int irqraised2 = 0;
    0 ^( G: Y6 s5 ~3 f9 n
  63. 7 q3 `+ ~) v2 W# d& W5 t7 \- C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! Y7 g. U! W% U2 U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* n6 {1 f. E8 ^. r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 |2 a0 q! s6 W) P- c

  67. 4 R* u/ \' T+ p1 T
  68. dma_addr_t dmaphyssrc1 = 0;
    7 h, y$ ?2 ~7 ^
  69. dma_addr_t dmaphyssrc2 = 0;# m' Y$ i* v7 w# h) O5 h/ G
  70. dma_addr_t dmaphysdest1 = 0;9 I4 T6 Y- {6 r( l
  71. dma_addr_t dmaphysdest2 = 0;
    - F2 ^1 S' S4 T: d2 a- T' c2 G
  72. ; ]& N6 ~: c0 E: W' \
  73. char *dmabufsrc1 = NULL;: _, L6 }) ^- I9 R( R
  74. char *dmabufsrc2 = NULL;/ q, k& [! a1 E# N$ ?
  75. char *dmabufdest1 = NULL;- Z/ R( m9 j3 t# L5 ~$ n) X6 a
  76. char *dmabufdest2 = NULL;
    $ b. B0 a8 h, U" }, r! H+ U. a

  77. & `- B) P) h9 e. F/ Y
  78. static int acnt = 512;# q2 B- t: x& c- @/ s
  79. static int bcnt = 8;
    # R; I; W  t6 k$ x8 @5 D7 Q* F
  80. static int ccnt = 8;  S) @8 k* s  `4 ~" e) N
  81.   m: W7 \: t+ v  V8 l7 Z5 V2 a
  82. module_param(acnt, int, S_IRUGO);" G; U4 Q9 w+ K
  83. module_param(bcnt, int, S_IRUGO);  [7 s: x$ X4 o& s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" {" ]5 I1 [) m# U% [/ `

# J9 T  a, h/ f. ^- z  _5 `      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 q7 j# T9 Q8 N: N- C/ G  x6 p+ `% {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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; d; l1 j3 g3 C1 z  P( o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; T) d5 G% ?3 |" Z
% P. f+ {" q' _8 F# j/ X8 f0 N: V7 B4 [  L$ Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 16:51 , Processed in 0.039796 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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