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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 v2 L, M; H$ ~
  1. [code]EDMA sample test application
    / U: d+ `2 e9 e& p1 t( [& v
  2. /*( q" K* p8 ?+ a2 l' H8 a  E
  3. * edma_test.c
    & w: Y# J. C8 K( \$ |
  4. *
    3 `: W/ h2 N1 o1 `
  5. * brief  EDMA3 Test Application2 k7 R8 N9 q' b# Q8 `* M2 E
  6. *) e1 [* P* _" F( g
  7. *   This file contains EDMA3 Test code.. N! G( K! q. j
  8. *
    0 D. X) G  _1 Q' t( R8 i2 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 q' ?! W+ n1 R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# x5 n$ c# @  T3 D8 F, z
  11. *         TO CHANGE.
    0 ?; n& S# ^% ?' @2 ~- u5 Q% y
  12. *6 J$ R) [# j/ C5 ]/ G" z. q+ G
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/4 g. s4 w1 ]' E+ V* i
  14. *) k6 X& F( z4 ~
  15. * This program is free software; you can redistribute it and/or
    & q: O5 q6 L$ a0 x9 C% C( R, T
  16. * modify it under the terms of the GNU General Public License as5 u$ y, W. L: ?3 Z; O
  17. * published by the Free Software Foundation version 2.5 X8 s+ k! A9 N& t8 n2 H* Z
  18. *
    7 q* s/ f1 L1 ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / z+ j% }/ {, z9 W+ K6 s
  20. * kind, whether express or implied; without even the implied warranty3 N$ y- ~; c5 r2 ~) P, Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 C' ?* A! {: q1 j. e# e/ \
  22. * GNU General Public License for more details.- J6 A1 r+ d- T
  23. */
    % i% I! a  V. f2 N

  24. " G4 u6 o3 {' @2 w) [4 d# c
  25. #include <linux/module.h>
    . [5 `5 O+ U9 w$ \* L, U
  26. #include <linux/init.h>- B; D1 e) W) A! M" ]5 Q- ~7 C
  27. #include <linux/errno.h>0 U3 B3 r" ~/ A! c
  28. #include <linux/types.h>
    1 P0 n! X0 _6 Y+ w
  29. #include <linux/interrupt.h>( e7 ?7 W9 o4 [% y7 Y2 g, W1 L
  30. #include <asm/io.h>
    & _! [. m+ ?3 Q: v( @4 h' w% O
  31. #include <linux/moduleparam.h>9 m9 i" S: }% Q7 o, W8 v* U9 j
  32. #include <linux/sysctl.h>
    2 h- l3 c9 [3 x) O0 d
  33. #include <linux/mm.h>2 U* v; D' F! w, A) `. o
  34. #include <linux/dma-mapping.h># O/ S2 ^6 m; A& e- [) ~

  35. * E$ k7 V9 s3 a4 ~% j/ a
  36. #include <mach/memory.h>, Q0 a* l- I# g7 `* c$ Q
  37. #include <mach/hardware.h>
    ; Z& K# w! Q) p, Q
  38. #include <mach/irqs.h>' S0 x/ R# s- b) u# p1 F
  39. #include <asm/hardware/edma.h>
      `. b* _  R6 G- H5 M: e; P
  40. 7 D) f$ U0 @( f" C! Y" W& `
  41. #undef EDMA3_DEBUG
    . d, Q( B' n+ v% e( R5 U7 y9 N7 f9 j
  42. /*#define EDMA3_DEBUG*/
    & N. p- a5 n) p/ o7 t/ O2 P
  43. ( f. Y' ?# S- y+ E% V
  44. #ifdef EDMA3_DEBUG
    7 L, E/ _: n- s% Y3 Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) S# t- t! Q6 d8 M0 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " D" V- |' j0 x; B1 H2 A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 g0 D; {- `0 U$ I
  48. #else
    4 w; o1 t; S0 \$ F) e
  49. #define DMA_PRINTK( x... )1 G8 b) R0 U9 ]+ B6 A6 i# g  _4 n9 q
  50. #define DMA_FN_IN
    9 @  O; M3 J3 C
  51. #define DMA_FN_OUT
    7 K0 j4 d; B. q7 W
  52. #endif
    ! X- S) b4 b6 T1 H* Z+ W' j

  53. " q$ M& T" x# \$ U# I0 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : h* Y5 P, H8 n9 B/ w3 q8 s
  55. #define STATIC_SHIFT                3
    1 h7 [2 b; c5 c1 C' Z, `* v
  56. #define TCINTEN_SHIFT               20$ T/ t! U/ N: T5 z
  57. #define ITCINTEN_SHIFT              21
    " _; ~. e( T; _0 G1 }
  58. #define TCCHEN_SHIFT                225 o, ]3 I& V. [  w3 L" ?$ v6 q2 e0 |
  59. #define ITCCHEN_SHIFT               23$ E! }$ p$ _! L5 b) R  P; f
  60. + y8 C. f4 H2 B! ^4 {( S  X& B! k
  61. static volatile int irqraised1 = 0;
    % S0 S4 q5 {5 J$ p5 }
  62. static volatile int irqraised2 = 0;
    # r! Q9 c' U! _" j
  63. ) m% O- |6 x$ L' K& {' I" o4 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, B% w8 P  @$ y/ B/ ~2 a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 |( P1 H; ~! Q, a0 A) C5 p# }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 c$ C' j% \, D" {* W7 Z
  67. ! a) C, I8 P; m% H$ A# T/ e
  68. dma_addr_t dmaphyssrc1 = 0;- p( n9 ?! E" K
  69. dma_addr_t dmaphyssrc2 = 0;
    ) ~- e* `* k$ I5 S
  70. dma_addr_t dmaphysdest1 = 0;" G# @5 B3 a# r' E5 `- p3 z
  71. dma_addr_t dmaphysdest2 = 0;5 u! y7 Y* v7 H" e
  72. : }# k  [1 m& X* O9 H
  73. char *dmabufsrc1 = NULL;
    0 O  ^$ Q. C) B% r) A% r8 Z
  74. char *dmabufsrc2 = NULL;) Q' t$ y3 F( h8 }
  75. char *dmabufdest1 = NULL;
    + d: V, ]& b% ]( }2 X+ |. ^2 s+ f3 k
  76. char *dmabufdest2 = NULL;+ J' o9 m6 @5 p/ A' k8 [, y/ K
  77. 3 ?  Q  o- \4 j1 J9 f0 v" D
  78. static int acnt = 512;
    ; }  f/ m7 C. H( J( d
  79. static int bcnt = 8;: ~3 x3 _4 Q9 p! ]- o% f- }
  80. static int ccnt = 8;! I2 d( T7 }0 T

  81. ! ~3 l  Z5 ^' {. S4 a; D
  82. module_param(acnt, int, S_IRUGO);  A/ f' w/ k4 Z7 O* S
  83. module_param(bcnt, int, S_IRUGO);
    ( o: l3 |( U; X, s; |
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 e& z" t7 ]5 _0 p4 `5 O4 s8 P& r* o1 p2 m* D) S/ g
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 K# E% v& @) v& d+ earm-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( {9 N) x1 s) I, k/ o* U, O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, E( ]6 C6 \; r9 D# S! C# J; G
+ J0 o5 {8 z! ^* d% ^
, C2 E7 l' V7 ~6 j& ^1 P$ j$ u& f
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 04:54 , Processed in 0.038470 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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