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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. V- P$ S7 D+ A, |
  1. [code]EDMA sample test application
    ' \) ~; s, \. l( |5 O
  2. /*5 d3 i6 |( H. X; Z
  3. * edma_test.c; b8 L# n' Y* s
  4. *
      X! o3 E) v9 S9 ^( r
  5. * brief  EDMA3 Test Application
    9 ]- _: E# {, o: j
  6. *5 e( z7 V/ H' m9 K
  7. *   This file contains EDMA3 Test code.$ y& x( K. G+ H: e! h2 W4 L. T: J
  8. *) w2 _4 X8 E- z  a
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    + e7 E' B+ l6 t: N8 J. @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! R! o. ]0 x8 s6 m
  11. *         TO CHANGE.- ~) w+ Y) }* J8 P+ @/ f9 S
  12. *
    + {8 u. P9 w; V, H) v2 p3 f5 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 c( v' ]6 f& K+ e
  14. *
    4 e$ ^! b: P% \6 ~
  15. * This program is free software; you can redistribute it and/or
    & p! `2 G9 h; @6 N- g0 B
  16. * modify it under the terms of the GNU General Public License as
    # A; s3 E4 g2 B2 Q
  17. * published by the Free Software Foundation version 2.# ~5 f! c) B" p( b
  18. *% K2 k! F1 j5 G$ [0 R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: F" I9 J) g7 ~
  20. * kind, whether express or implied; without even the implied warranty
    : c5 D' l3 ~) }5 F- N6 @& r3 t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( {  B+ V( s; V: X. H% ?/ d5 z& Z
  22. * GNU General Public License for more details.* r( a# m& d5 \: r& a
  23. */, q6 L- ?/ i" Z% I: F8 h# o
  24. / Q; r1 Z- Y/ U; w. m
  25. #include <linux/module.h>) N3 L( ]* F* j' L6 A
  26. #include <linux/init.h>- |2 N6 x# J6 ]/ ~8 i$ p* ^3 s
  27. #include <linux/errno.h>, I5 m% I1 V, M$ w
  28. #include <linux/types.h>
    * h) ]  v2 y5 t
  29. #include <linux/interrupt.h>
    " X+ G! `0 m2 s( e2 ^4 O, ^
  30. #include <asm/io.h>
    * _! F& l+ r4 u0 r9 h" `
  31. #include <linux/moduleparam.h>
    - ?2 @( y5 V$ X& S3 D# u3 p
  32. #include <linux/sysctl.h>
    , k: g- Y( t7 X0 F, u
  33. #include <linux/mm.h>  C6 H$ J2 p$ L* D2 H
  34. #include <linux/dma-mapping.h>
    ; l7 a1 z  O( H* g
  35. 6 Z1 e% j! b' ~" {* z4 [$ [
  36. #include <mach/memory.h>
    * \) I1 Q" W3 x2 o3 Z
  37. #include <mach/hardware.h>( N# b  _0 S+ r9 K5 r$ m( c
  38. #include <mach/irqs.h>
      D% [$ V" `. I4 R3 o' x
  39. #include <asm/hardware/edma.h>3 b) D; ]7 G" ]& N6 K) y( |
  40. ) n/ i: ]2 Z4 N" E+ J/ W3 n
  41. #undef EDMA3_DEBUG
    : M' O3 _/ ]3 o" d
  42. /*#define EDMA3_DEBUG*/
    $ Y0 R1 s" |1 V9 P$ I7 N

  43. 7 K' c- G) s" {  b8 r
  44. #ifdef EDMA3_DEBUG0 U; E% L) L, o# Q+ U+ p
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      ]& a) q; j4 P+ q' A% f3 \6 T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 p" T' N# {( o' |8 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * v! |  ?) P$ a$ f
  48. #else2 J6 P/ w$ y* d0 d+ c/ W
  49. #define DMA_PRINTK( x... )$ `! j0 E7 m) O8 s2 g
  50. #define DMA_FN_IN) h' l8 j/ O/ I) t& M
  51. #define DMA_FN_OUT
    # ~( {( f% c7 s$ f' R- C
  52. #endif
    3 G$ o# r8 n' z% o/ ~

  53. # Y; }3 a- r7 @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# _$ N6 w/ t5 c/ U
  55. #define STATIC_SHIFT                3, B# ~& Z- q, P; W8 y# q+ L, A( D
  56. #define TCINTEN_SHIFT               209 c" B; N' A# t  A5 N
  57. #define ITCINTEN_SHIFT              214 L) Q+ a) Y. g4 t( h( R5 r: Q
  58. #define TCCHEN_SHIFT                22
    ( U8 `( H. A# U% [- r
  59. #define ITCCHEN_SHIFT               23
    : a+ S( T$ H. W
  60. # g9 J+ v9 y4 x9 b( N  E6 p2 h- C2 _+ K) W
  61. static volatile int irqraised1 = 0;
    8 q; @# W; m: Z3 \
  62. static volatile int irqraised2 = 0;. \! ~$ t4 B* j$ D

  63. # J* |4 f, w5 ?* E
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / ]- l* u" X: E0 b' b8 b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% p0 d5 C9 s' j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / c8 u  \- w* J& h! S  ?0 R! U

  67. " p# t# p; j- @/ V+ T9 [
  68. dma_addr_t dmaphyssrc1 = 0;
    7 ^5 i5 i3 j2 @; y) O
  69. dma_addr_t dmaphyssrc2 = 0;; W# u2 Z0 ]& r2 w
  70. dma_addr_t dmaphysdest1 = 0;& }- q: I' r  y3 I; L
  71. dma_addr_t dmaphysdest2 = 0;. v# k* t3 [+ C9 Q3 a  Y

  72. 5 _/ X7 u- U  z8 i% T% n
  73. char *dmabufsrc1 = NULL;
    6 r) n* W7 j" \, v: ~
  74. char *dmabufsrc2 = NULL;" D6 f, [% r1 ?5 l2 w1 [
  75. char *dmabufdest1 = NULL;
    9 G/ J, [( L" u2 e
  76. char *dmabufdest2 = NULL;" Z6 H1 z' ~( C( e4 _1 E# f

  77. ; }$ Q! ?3 N0 t: g
  78. static int acnt = 512;
    : W$ s) @; p2 K6 F- `% U) S
  79. static int bcnt = 8;4 t) U. c+ c" Q- s% Q
  80. static int ccnt = 8;
    % G( v/ L( d  @  _4 f9 x+ l7 ^

  81. ) I9 o8 i7 }$ ?  ?% A- ~% d
  82. module_param(acnt, int, S_IRUGO);0 Y9 O3 S4 @8 f8 b7 m' s6 s
  83. module_param(bcnt, int, S_IRUGO);
    3 g! D5 S( ]4 I: X2 [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, ~6 |7 x1 Q2 I4 D" U2 w! Z
" e  z/ s0 @9 z- B
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) d, ]  C% q! Q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 s# P0 X1 {+ Q9 ?- h% @
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。4 t! o# t' X2 `; F# a

0 G. R  H8 k: w! H0 h* k" I. F3 h! X: w" K% F& \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-31 03:05 , Processed in 0.037550 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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