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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 F5 }% E, j2 F
  1. [code]EDMA sample test application
    * k- r  p, B5 i; T0 a
  2. /*
    ) B+ r7 d2 s! O0 F
  3. * edma_test.c+ ?1 ~% Y1 f9 G* ^( G% B; [" y
  4. *
    ) c  [3 ]5 M# B3 d
  5. * brief  EDMA3 Test Application' n5 ]0 p& x* F" p+ J, c9 M4 B
  6. *
    , V$ X7 p( c: v1 e( t7 ]+ }- D
  7. *   This file contains EDMA3 Test code.: u3 P3 U3 M. x& k* ~) }. S, ~, c
  8. *
    % i4 _- a3 ]8 \) x- ~! N& y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& L, Y* |+ \) q( j& ]+ L" e, P: v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 V0 Y, A. ]1 h% L' `( Z  V
  11. *         TO CHANGE.7 |; e+ V8 k: @
  12. *8 Q% s. Y* X2 t% N) Y" U9 K0 G! \( g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/! O& u  @, ~( D2 r5 [0 p
  14. *5 O, G, B4 x' l; {. E
  15. * This program is free software; you can redistribute it and/or2 I3 x, J! ^! U
  16. * modify it under the terms of the GNU General Public License as2 w; y6 f, W4 ]; i+ R
  17. * published by the Free Software Foundation version 2." o( W$ {- R# \4 I( q; A
  18. *2 }: z: c* ?5 h* w8 j
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 w. n, y% p  x/ C* J$ w
  20. * kind, whether express or implied; without even the implied warranty
    6 ^, B  W9 Z' A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 t% d2 L6 H: F$ Y  i9 D: S1 o" P
  22. * GNU General Public License for more details.3 A+ p! t/ ?3 b1 O& d; ?
  23. */
    7 N; U7 V) K' G# e# D- I

  24. % l* ^. w$ q! e$ z& k- Q* j5 S& P
  25. #include <linux/module.h>6 j) e" S/ T$ K+ T- l+ n4 p, v: h# e
  26. #include <linux/init.h>" n5 e1 P5 L' P. V' M
  27. #include <linux/errno.h>
    9 Z: Q) A. N8 y  \# r% G" d
  28. #include <linux/types.h>2 G7 \* B+ A8 `+ }: ]
  29. #include <linux/interrupt.h>
    * h% J* x/ r( v: g9 p
  30. #include <asm/io.h>. ^9 J: ]1 d/ n) t2 K, t
  31. #include <linux/moduleparam.h>: `2 h. e1 C( K& ^7 G" w4 ~
  32. #include <linux/sysctl.h>
    + E0 Y- b& x1 V* P
  33. #include <linux/mm.h>
    ( \, L* f* b4 j
  34. #include <linux/dma-mapping.h>
    8 o9 r# [7 h5 ^- V1 ^! `, M7 V$ Y) j
  35. 4 w2 @# Z  C/ {& @0 Z
  36. #include <mach/memory.h>
    # l  {+ [6 u6 U
  37. #include <mach/hardware.h>7 ~& K/ P" D" J# u7 E3 ^
  38. #include <mach/irqs.h>8 ]( R% `- L4 _9 F/ z  X, f
  39. #include <asm/hardware/edma.h>' x0 `/ _3 B, m6 x
  40. % J0 Z; \! T: H0 p
  41. #undef EDMA3_DEBUG
    $ Y( i$ l4 _! E
  42. /*#define EDMA3_DEBUG*/
    5 C% V) c/ m; G$ ?4 S, R  Q* Y

  43. / I9 A. N- P; G* f/ a' w
  44. #ifdef EDMA3_DEBUG3 m0 I' \/ v3 s% z5 N7 ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS). N6 b0 }& g( C2 ~$ M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! n: D5 H. _. A; |$ r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) K& i5 U# A( S" W# [/ g
  48. #else- ]! N- k* u1 u/ g9 z% H, B
  49. #define DMA_PRINTK( x... )8 n- a6 K6 o. l, w( ^' ^1 Q4 y
  50. #define DMA_FN_IN
    * c6 V) q4 ?- x' Y
  51. #define DMA_FN_OUT
    ( _, @. V$ @) M" ^7 [; J' F
  52. #endif" w4 I5 t" M, {

  53. * G6 E9 d; T$ ]# l+ o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % }$ c) O) o4 T$ q+ [
  55. #define STATIC_SHIFT                3
    0 _' h( z# G; n3 w, {( q
  56. #define TCINTEN_SHIFT               209 V4 w- L& g* b* F) I  n3 i' U; w
  57. #define ITCINTEN_SHIFT              21/ M2 w& Y3 F/ s3 }! C
  58. #define TCCHEN_SHIFT                22
    . n3 ]1 P! Y* |' n
  59. #define ITCCHEN_SHIFT               23" ?5 k! f+ F% }8 T8 ?9 {! g

  60. 0 ~# ]) {  m, b
  61. static volatile int irqraised1 = 0;$ o; a+ i7 L& N. A
  62. static volatile int irqraised2 = 0;
    6 d8 v9 \" _9 ~% ~
  63. / W3 F9 `, S# y- z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' e' ^7 N9 x) O2 D; G6 s) E! w" _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 W' [; S! R9 l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * H# O3 ~* }5 U/ }2 _8 k$ {& ~/ B" x
  67. , V9 w' f0 ~( O+ h3 G: a. m, p0 J6 j
  68. dma_addr_t dmaphyssrc1 = 0;/ F9 c' K7 X$ Z/ {! |4 ]+ y
  69. dma_addr_t dmaphyssrc2 = 0;7 c3 ?# w) j" C# Q7 c! i
  70. dma_addr_t dmaphysdest1 = 0;5 ~, l: V( j& L2 P, A! v
  71. dma_addr_t dmaphysdest2 = 0;
    6 l4 f8 E+ [. P1 L1 N5 w2 m

  72. 1 r) ^; x6 t/ o
  73. char *dmabufsrc1 = NULL;
    3 m9 Y* I: D7 M, i
  74. char *dmabufsrc2 = NULL;
    , I/ L; ~# v0 j8 G
  75. char *dmabufdest1 = NULL;7 w6 R* D$ Y1 ^# q9 m
  76. char *dmabufdest2 = NULL;+ d0 s* B9 g' ]1 G
  77. 7 E( s  Y0 ]# z1 e
  78. static int acnt = 512;
    ) @' z: n* E  @! B! K8 X$ G
  79. static int bcnt = 8;# C3 Z4 H3 u$ N8 d9 Z7 M( u
  80. static int ccnt = 8;. O  i- [( V' J- h$ K, R$ ~
  81. * C' N, e' ]8 m; ^/ K6 T- J" x
  82. module_param(acnt, int, S_IRUGO);# Z# m, `! n  n# x3 e# V  e4 z! w
  83. module_param(bcnt, int, S_IRUGO);
    8 v! S! U5 q$ N6 L& _8 Q; c
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# S1 J0 C$ W* `/ V/ d! Q, M$ e) G/ h: [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 h5 d" c% p( U  v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  `; h5 `+ j3 R- Q. {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
0 l5 @' s. l: S/ a! X5 L: x0 i) N" h

4 L5 {4 U* b" |* u: T; v* b; @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 04:49 , Processed in 0.039301 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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