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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 a$ Y9 c7 G: S+ S7 ?6 _
  1. [code]EDMA sample test application& K8 O; p" t" M# }
  2. /*
    # U6 E2 W, B- `" K& D
  3. * edma_test.c5 X: _  _$ ~: g. X. D7 r
  4. *, M4 m& X4 M* R: q
  5. * brief  EDMA3 Test Application
    7 ?4 D$ L& H9 i/ k
  6. ** T$ t2 f+ f+ ?3 m% y. J7 f
  7. *   This file contains EDMA3 Test code.* _; k6 L% j% }) t. a6 D
  8. *$ M7 Z, r+ \* L
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 r( P/ T& d4 w# N0 t$ A3 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! j. g) `$ @( p) a( M" l
  11. *         TO CHANGE.
    , L% ~5 H) V; G2 r; k- ^8 ?
  12. *4 H5 s; b- E+ e+ f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 M/ F5 p+ L5 J1 s7 Z# K
  14. *
    7 o( C9 G- ]! D; L' e" o- N
  15. * This program is free software; you can redistribute it and/or
      U5 {  W; a8 b$ h
  16. * modify it under the terms of the GNU General Public License as
    8 _7 f7 f( B3 v) r0 O5 u. D' u- h
  17. * published by the Free Software Foundation version 2.' R  \+ z, x# t# `) O# r7 c4 {
  18. *
    + J* M+ g7 `8 W( V/ q+ A# e0 W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 y2 a% m& C$ o0 _
  20. * kind, whether express or implied; without even the implied warranty4 i7 j' O+ t% y- c: V- }& G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the: i" q+ C1 [  ~
  22. * GNU General Public License for more details.
    + d* q, B. H& I
  23. */. b7 ~' j" P' g6 V: q
  24.   S4 T- q1 `, ~' {/ A) P
  25. #include <linux/module.h>( c& _) x  B% z
  26. #include <linux/init.h>
    9 ^$ p! J/ l2 `9 e# l# e
  27. #include <linux/errno.h>
    $ _' F$ v: K4 K& ^/ Z
  28. #include <linux/types.h>
    & I, Q- I( g1 P# T1 G, P& C# z& p
  29. #include <linux/interrupt.h>
    # k0 f! @, M* N. K; J6 H
  30. #include <asm/io.h>
    $ W; k- N- }/ W1 m7 S
  31. #include <linux/moduleparam.h>6 @2 V) }! y9 K) \9 ]
  32. #include <linux/sysctl.h>
    - f! O( ?& L  Y
  33. #include <linux/mm.h>
    4 m& v- z1 k2 V8 F5 y
  34. #include <linux/dma-mapping.h>0 x$ x0 k3 f5 k
  35. 6 o1 m( a& X% n. |& x) G
  36. #include <mach/memory.h>
    6 D; Y3 B# i; T) V2 R. O+ O
  37. #include <mach/hardware.h>' J9 w0 s; _! j% ~! o( ^. F% P
  38. #include <mach/irqs.h>) h( H5 }- P9 n; g# n4 Y# \
  39. #include <asm/hardware/edma.h>, M% m9 `, F- h: l! \9 @0 G8 }

  40. . i* ]5 V3 g; }
  41. #undef EDMA3_DEBUG
    ( g9 O  o" Y/ }% x" S3 c; ]$ n0 x
  42. /*#define EDMA3_DEBUG*/
    0 Z; L3 r1 Z  _  S! v
  43. - J6 h, w2 D9 @! R
  44. #ifdef EDMA3_DEBUG0 k8 y7 B* [- Q4 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # _! z  M, P% z2 f& A0 r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; h# ?2 T* j. w7 m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& \8 u* @, P* ^, b8 d
  48. #else$ H/ r+ k, Z+ {3 T4 ?5 X
  49. #define DMA_PRINTK( x... )' t$ U( Y( T- i7 R' w& {
  50. #define DMA_FN_IN% K& z. R! L. y2 d0 A
  51. #define DMA_FN_OUT) [5 p/ o# y  N% H3 t& y
  52. #endif
    2 W: L" ?4 E- Q6 I( L* C% b$ P
  53. $ A$ y9 n% ~  Z9 G2 F9 p' t2 i$ ^
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! l. f8 S6 ^; _) l- q( v" ?
  55. #define STATIC_SHIFT                3
    5 X. f8 K5 b! X/ I* C
  56. #define TCINTEN_SHIFT               20" [& }; `. y& s6 `: K
  57. #define ITCINTEN_SHIFT              21, D) B0 O# h% j! m
  58. #define TCCHEN_SHIFT                22* T3 i* v+ L. n
  59. #define ITCCHEN_SHIFT               237 S' i# s( V% G
  60. 2 \6 q( Z" S* ~5 o7 u
  61. static volatile int irqraised1 = 0;
    3 `6 l6 I! A/ c( \
  62. static volatile int irqraised2 = 0;
    " u- ]) p9 l. i  M
  63. % o: H% r" V4 Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 a+ x) G' W4 e0 J9 B, P
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) T% k4 S: ^3 A7 g% y* B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      Q0 u: v1 v* F! X, ]9 v+ G7 W
  67.   H; C7 D. j- E  y- u& j0 r* w
  68. dma_addr_t dmaphyssrc1 = 0;5 @" s% ]& w, O1 |8 m, D3 B0 u4 L
  69. dma_addr_t dmaphyssrc2 = 0;
    0 Y3 t. t% T) g& p6 |( f7 G( J
  70. dma_addr_t dmaphysdest1 = 0;
    8 F5 r0 J8 ^$ G8 ^
  71. dma_addr_t dmaphysdest2 = 0;
    ; X! S0 @2 K& \, x, @8 k( E7 r
  72. ; U- W% R0 l) e7 ^1 O+ ?, p
  73. char *dmabufsrc1 = NULL;
    1 V6 X! c( R. C* W' H; V+ e- Z' r: b2 ^
  74. char *dmabufsrc2 = NULL;% u2 }9 m6 U& _4 B. Q; L
  75. char *dmabufdest1 = NULL;
    5 X% R8 f, Q$ l1 ?* k
  76. char *dmabufdest2 = NULL;
    6 C3 X6 C5 P2 J. [" I3 K
  77. + f& e! g& x5 t  I1 j3 X
  78. static int acnt = 512;
    & |1 [- T* v5 i6 _3 F1 d* F
  79. static int bcnt = 8;0 s2 Z+ f+ s% E  Z) n7 w
  80. static int ccnt = 8;$ W; _8 l; z. N* R) G/ P4 F# v
  81.   U5 M' ^/ w& h1 G# V
  82. module_param(acnt, int, S_IRUGO);7 r  u1 m( Q* v9 C" w, W/ O
  83. module_param(bcnt, int, S_IRUGO);1 y! L' s. m5 H
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ w# h4 ^) v7 v8 I4 Q( P, z. i/ f% U( X8 W. |
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
6 |( H! H+ I' H9 s. n0 U1 l9 yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 v" j& |; B+ w1 z9 d; O, L     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; _8 Q3 S: R' l) O, ?2 k
2 J: y" m/ x' l! M8 V% P8 F! [/ c$ u" U% c- d9 T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-21 02:21 , Processed in 0.048161 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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