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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ X& U- d# Q4 q/ \3 a# f
  1. [code]EDMA sample test application
    & h4 k& I  u. d( [( D* c
  2. /*
    ) f* x- _7 h: f$ g1 P- F
  3. * edma_test.c
    3 u& i/ e- m/ M3 {: c+ \
  4. *
    & e& T, T4 r, t
  5. * brief  EDMA3 Test Application% o0 H4 s; y7 L
  6. *7 Q5 F. v6 F0 X# ~, C) M$ f# y6 R. v
  7. *   This file contains EDMA3 Test code.
    3 T( F; e' t, G5 a5 @( q! [
  8. *
    3 Z( f/ b! z' D" J# S
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / Z- l  f: p) D, b3 _! V$ S3 k- a  ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! x4 l0 p. V: {: J. e" F' ~3 f- K
  11. *         TO CHANGE.
    1 Z, J* c% k2 g- Z, D8 G( w* H9 o
  12. *
    . D" U( T) ?+ K8 J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& y) s1 O% K; w4 k) x9 J- O+ w
  14. *- O1 Q3 L6 A8 P6 d% K
  15. * This program is free software; you can redistribute it and/or
    + {( E, y0 l5 U/ R
  16. * modify it under the terms of the GNU General Public License as: Z# z$ k+ P$ g& C# A9 Q
  17. * published by the Free Software Foundation version 2.
    ; v& a% ]0 J, y$ X
  18. *
    ' x5 w/ R% k. n. u, T4 c4 @: S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 v" z9 a  Z! G' X( D( i0 F
  20. * kind, whether express or implied; without even the implied warranty
    % `% y/ z; C) Q2 V6 r6 z; c1 d
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 H, l/ {, L) m! Q1 `
  22. * GNU General Public License for more details.2 k- k# R5 z* Z. l. v9 n, x
  23. */
    $ `) ]6 b% q  m) S& l& ~, n6 g2 j/ p
  24. 7 |& H- z) ]) r% `+ D4 k4 |
  25. #include <linux/module.h>% p+ ]  H+ @! k, x! W6 p
  26. #include <linux/init.h>
    ( B. f% w6 i- Q/ f
  27. #include <linux/errno.h>/ A+ S7 P- I7 {" f: {, q
  28. #include <linux/types.h>- `6 B* S" M$ w& a" E
  29. #include <linux/interrupt.h>& A5 ?! s, W/ _2 P4 }' ^( |3 ^
  30. #include <asm/io.h>! ~* }% P& z7 U3 `, k0 q5 X5 H) e  t
  31. #include <linux/moduleparam.h>8 B0 ^4 R+ O6 N9 z
  32. #include <linux/sysctl.h>) z# _/ X' F6 K, g9 D/ s$ w+ C
  33. #include <linux/mm.h>; N, }" [5 ^' i; J
  34. #include <linux/dma-mapping.h>0 O9 ]) t' V" s! y6 k5 b
  35. 4 `5 v6 T' d# t# a# V  C0 N
  36. #include <mach/memory.h>2 o! |3 T8 Q; h4 P- ^: L
  37. #include <mach/hardware.h>
    : M; e- s0 }' `) K& T: C
  38. #include <mach/irqs.h>8 P: ~  M2 w( m4 E
  39. #include <asm/hardware/edma.h>* p9 s8 n9 Z# t; u- I
  40. 7 J1 |1 q  g- R' g
  41. #undef EDMA3_DEBUG" D$ ^' ]- k% p) q3 K; J
  42. /*#define EDMA3_DEBUG*/
    1 K7 P/ h0 j5 K5 L% |' P

  43. ! `6 X+ y! w3 p. r/ L  J3 x
  44. #ifdef EDMA3_DEBUG" p; V3 F1 @( C1 }' A/ w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! H0 n$ a: P2 h* h$ M& D) U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- k6 T9 E' T  O$ }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 n2 u0 c" y% d. }4 V4 ]' `' E* Z
  48. #else0 g- ?  W3 I3 a5 e" ^( ]" G0 B( E
  49. #define DMA_PRINTK( x... ); T/ N; g3 k) n7 p+ [
  50. #define DMA_FN_IN0 y# l/ x5 b8 Q2 O
  51. #define DMA_FN_OUT8 X+ Z  a+ R$ [( R! I8 n# {3 C
  52. #endif* q# @5 f0 D; d$ y
  53. $ E% F7 x2 g3 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      |, ^& Z3 A7 r  \! d# ?
  55. #define STATIC_SHIFT                3$ n+ {; i5 o* r! N2 K' A
  56. #define TCINTEN_SHIFT               20; }/ ?. [5 q' x( O3 S7 `' ^
  57. #define ITCINTEN_SHIFT              21
    7 _" P; r( |8 {
  58. #define TCCHEN_SHIFT                22. A9 s/ L! m1 J! B3 d. H: B
  59. #define ITCCHEN_SHIFT               23* Z) M! Z( c2 j& d# V

  60. 7 J+ M! J- ^* @7 F4 a' u
  61. static volatile int irqraised1 = 0;! Y& T9 s7 X+ c* Y
  62. static volatile int irqraised2 = 0;7 l6 P; k0 z  ]  H) d

  63. 5 y( o, G1 o5 G1 v% l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . E/ N5 T4 X" H- y9 l  b) N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' }* s$ r4 F- u( |: y6 f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . B0 H# }. o: E

  67. 7 t! G! p" g) E( t
  68. dma_addr_t dmaphyssrc1 = 0;
    ' I9 C0 W; K# U. F, ^
  69. dma_addr_t dmaphyssrc2 = 0;
    3 b: o; ?2 W) q7 j; A3 N# ]7 a
  70. dma_addr_t dmaphysdest1 = 0;; L, g1 [% B" L4 {$ {. P! P
  71. dma_addr_t dmaphysdest2 = 0;! Z) v+ h- u/ r: t. s& M
  72. " {% t9 ]6 \4 L9 k3 A
  73. char *dmabufsrc1 = NULL;
    6 F) ]2 P7 [& K6 h2 f
  74. char *dmabufsrc2 = NULL;5 Y+ [( e- g5 Y8 r( c. F) r! L
  75. char *dmabufdest1 = NULL;0 i$ V2 o# Q6 x$ K
  76. char *dmabufdest2 = NULL;+ d! ^% G1 U; n/ E/ M: t" M

  77. + d+ y% [# m! D$ h, I$ v
  78. static int acnt = 512;7 @) }6 }/ c, M2 ?# u( f: q" K, q
  79. static int bcnt = 8;! m% ]8 ], p, \9 n0 F& ^6 p
  80. static int ccnt = 8;& |, J6 ^4 N- F8 k* F6 Y; E

  81. 8 U# K+ K& g# I; K6 w* ~
  82. module_param(acnt, int, S_IRUGO);# b# _+ u1 ]% L) t, H
  83. module_param(bcnt, int, S_IRUGO);' \9 T3 z& S& J* D4 Z8 X
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) e) u! Y# ^+ r4 [* E' y; a4 J

) Z" R( j' O& l' Z' q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, H9 Q- e% g% P( K" darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 K1 M$ P  n0 T' U( F* \+ z+ H; ]. F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! Q" ~) u- D' @  F; n
& d& J" x$ @. R8 s- D5 B: Z1 k0 i8 _, M: Y: M  P& |9 K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-25 15:05 , Processed in 0.039060 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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