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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' x2 `, ~" ~: E
  1. [code]EDMA sample test application
    " G4 K6 {2 @2 |( Y$ Y
  2. /*  c! U2 F8 \- B
  3. * edma_test.c
    ; l9 ^2 f9 }7 ?) C
  4. *
    $ w) H: J; S7 ]( F! u
  5. * brief  EDMA3 Test Application/ I2 |  _0 k6 N/ u2 y
  6. *
    4 ?7 U$ s1 @2 b/ r$ p+ u
  7. *   This file contains EDMA3 Test code.
    ) o" M& u  G; q: w  d! A- H4 X
  8. *5 `& R$ _, h' g. E! I/ ~( n2 K3 \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . ~' T/ f) E( @1 p6 _1 m6 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 c3 W6 ~/ Q. p" z: ^! g2 @
  11. *         TO CHANGE.
    ! x- l' R, M4 l9 h7 W
  12. *+ `* a  J( T7 Q1 N$ k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- J- b  d3 c6 {/ F0 t
  14. *& c+ z/ h/ h+ l* I
  15. * This program is free software; you can redistribute it and/or
    * R3 y) P+ L. \
  16. * modify it under the terms of the GNU General Public License as
    ! g! {0 v# B# u- q5 t, Z
  17. * published by the Free Software Foundation version 2.0 ?3 ?9 \! S) f! E: b* L# S9 u
  18. *1 Y4 K) |, g) I* j/ g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ }* j! h! W. l6 Q7 a* B5 s" U
  20. * kind, whether express or implied; without even the implied warranty
    * |# h9 D( Q2 y  ?6 u4 {: Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & e2 J6 L3 p- [0 S7 T2 j' v$ U, ?
  22. * GNU General Public License for more details.) A2 ^, D6 {, a) L) y8 f
  23. */
    $ }, k) a4 ~& m) G4 e* U: ?
  24. . O2 q& l8 o- L/ b# l3 [
  25. #include <linux/module.h>
    & s9 o7 O9 I. G; V& R% @, L* ?5 U
  26. #include <linux/init.h>( X' F* G/ p6 A7 h) G
  27. #include <linux/errno.h>( F8 K5 v; w9 |* N. I$ m1 D
  28. #include <linux/types.h>
    ( M2 T* Y0 r& @( f. n2 f8 @
  29. #include <linux/interrupt.h>* r9 p* ?9 A% c% s
  30. #include <asm/io.h>
    8 ]% {% u, B3 {6 `/ G+ T" f
  31. #include <linux/moduleparam.h>8 r$ z3 g* I2 l) J; D& ?  T
  32. #include <linux/sysctl.h>
    % o$ y# Q$ n' l/ i' W+ v
  33. #include <linux/mm.h>
    $ n* m) _) |7 C
  34. #include <linux/dma-mapping.h>
    ; x* r% g/ g+ k. ]
  35. 6 l- i; y; g( ?& |5 M
  36. #include <mach/memory.h>1 l+ U0 U5 `. o/ ~6 y8 ~
  37. #include <mach/hardware.h>  ?. B6 A1 e, e+ r5 S
  38. #include <mach/irqs.h>
    * |+ s0 Y$ j* h2 P
  39. #include <asm/hardware/edma.h>
    * u; S3 D6 j2 }9 k& z8 }6 r; ^, y8 n

  40. 1 a- k/ l* X5 n7 b
  41. #undef EDMA3_DEBUG
    2 t( m- R7 L) A7 N# I- r6 |( ~. a) O/ w
  42. /*#define EDMA3_DEBUG*/: X& R7 p' O) a+ [: T. O

  43. / H# K" K, _2 W' |5 t+ C- j# j- A" Y
  44. #ifdef EDMA3_DEBUG
    7 w6 R/ J5 J6 p; l5 C2 A/ K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & B& _9 d9 V8 z  M+ q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 q" I7 m% y4 D- z, u- f, [- a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 f# f9 R* g, k, g7 O
  48. #else- `: h6 a7 O* A/ C8 a
  49. #define DMA_PRINTK( x... ): h, `' i2 ]8 V3 Y' s4 _
  50. #define DMA_FN_IN7 n' }" N8 m: k+ y4 @
  51. #define DMA_FN_OUT! U; l; L# M* o2 q
  52. #endif% v# d6 C  N& S+ }$ L; U+ l

  53. 4 O. o! g; h2 u- L, t0 A+ k( g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) b% C2 n8 V% Y/ r; m6 p
  55. #define STATIC_SHIFT                3
    7 [  R# V, {& I2 b! o3 N. A) y
  56. #define TCINTEN_SHIFT               20( P  Y3 F% h% ~/ I8 h. N& I5 k
  57. #define ITCINTEN_SHIFT              216 f$ b' F" `  N* s6 W. }9 F
  58. #define TCCHEN_SHIFT                22
    + f0 `. {1 `* |5 F8 Z. g* R
  59. #define ITCCHEN_SHIFT               23% `) w& y6 s' i# Q
  60. * o) N4 U) q, r% Z3 j
  61. static volatile int irqraised1 = 0;' m2 N  W& _, Z9 J- I
  62. static volatile int irqraised2 = 0;; B- a' W: I6 f  g2 u
  63. ( z1 h& ?- p( V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" F; z* _+ F  @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( Z1 ]' a$ F9 f3 ]# C9 k) a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & ]8 O# R- {( K2 W& x- W1 U; H/ J

  67. 3 p: n7 O9 }8 f3 J0 @5 U- f7 m
  68. dma_addr_t dmaphyssrc1 = 0;, H0 A( Q% B3 s; Z  x$ a; _) |8 ]
  69. dma_addr_t dmaphyssrc2 = 0;
    2 b4 k+ s$ }' h; H
  70. dma_addr_t dmaphysdest1 = 0;
    # H' E! |/ l0 Z% c; n
  71. dma_addr_t dmaphysdest2 = 0;
    1 T1 _0 q( |8 W) F9 s; [7 i
  72. . ^6 s& n! o7 z5 g6 A6 F1 g# ]
  73. char *dmabufsrc1 = NULL;
    # b% ]( y4 E( |8 O2 K- n4 ^' F
  74. char *dmabufsrc2 = NULL;
    " ?- _6 @! ~6 `) l
  75. char *dmabufdest1 = NULL;
    1 g$ f: X* G. x# j9 B7 U/ T
  76. char *dmabufdest2 = NULL;' j/ n+ Z/ {' ^* r; T" r

  77. & v, V; f9 K, {1 a/ I
  78. static int acnt = 512;
    9 O' C7 r( k$ P% x5 z! P& _+ _  Y
  79. static int bcnt = 8;2 V) G* m  a* C! }1 E( D7 ^
  80. static int ccnt = 8;
    : j3 a1 A, p! B" Z6 z4 p. J4 i
  81. ' ~+ X" r9 C+ X2 O2 R* M  d( M8 k
  82. module_param(acnt, int, S_IRUGO);
    ! X  I4 X- F. c& Q, H
  83. module_param(bcnt, int, S_IRUGO);
    . F! k0 K4 K/ ^1 N( ]% J1 v
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" R7 R2 H3 ?4 J0 \3 ?2 M; f. ~8 }0 D( d' J8 t2 O
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' C9 H# C( ~% m) x! _. R! 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% a( D6 k" x6 B2 W- E     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! r2 b$ s1 |1 ?# W. s

  b. ~# T1 @9 k6 j1 C" H. m
$ f  N" a- L  E0 u5 R6 a
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 08:11 , Processed in 0.039444 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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