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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ' G5 i* `3 ?3 F- q- X/ o
  1. [code]EDMA sample test application
    ( [% L+ e6 ]6 P7 P
  2. /*
    / m0 F7 Z+ n' e- l8 c* E' N! y
  3. * edma_test.c
    + J9 K4 Y& I6 }7 I
  4. *2 e( @; l, H. d0 q
  5. * brief  EDMA3 Test Application
    ) C! ^7 p( P6 Q! `
  6. *
    0 {' e1 Q' y, @7 O; H" T8 v
  7. *   This file contains EDMA3 Test code.: k' X% F) t" ]+ x9 e& M* [2 x
  8. *. [4 v) H" u9 k  I( k0 e0 ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ w' c9 ^6 ]) @& X5 ~- K$ P6 M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 v$ C6 u. A# V. H  L
  11. *         TO CHANGE.
    * L+ D# _( K3 Q. D8 O& z9 Q4 m
  12. *
    ; b7 X0 i( K* X) }6 q& w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
      e, ], X  B/ c& ^+ d/ I# e, e8 p8 d' C
  14. *  o7 ^0 j- j6 F4 o9 O4 Y
  15. * This program is free software; you can redistribute it and/or9 L' w8 Y- a& g' k6 p$ w
  16. * modify it under the terms of the GNU General Public License as
    1 G0 O* \: J7 c
  17. * published by the Free Software Foundation version 2.
    4 I2 v5 v# Y) M8 v% S2 M
  18. *' [+ ?0 B  F6 G' G8 J( F. B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' E) J$ }9 Y3 P8 ?
  20. * kind, whether express or implied; without even the implied warranty
    ! V0 q& W$ ]9 \0 R! x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # _. W* W) S+ r: j# S2 R  z
  22. * GNU General Public License for more details.4 \+ y) w6 ?/ T; ?7 c0 q$ s
  23. *// m: N* a3 S! O# T

  24. 0 M! j. g& ^8 g
  25. #include <linux/module.h>: M/ R. f$ V3 X( t5 |
  26. #include <linux/init.h>; }3 g4 d* l- _9 [2 A, K8 @5 X+ ^
  27. #include <linux/errno.h>' a3 z6 o9 G% c& a9 V) H
  28. #include <linux/types.h>
    + ^: G  U& _& o0 u2 n" ?/ x5 o
  29. #include <linux/interrupt.h>  p: e7 J& I( t- b+ C( J) K
  30. #include <asm/io.h>
    " R  q1 g1 ?! d9 G5 W$ }7 c
  31. #include <linux/moduleparam.h>
    8 x& W7 R* G0 }2 K
  32. #include <linux/sysctl.h>
    $ Y- m) G# W) c/ j9 F
  33. #include <linux/mm.h>
    " [" z% {3 R6 q5 v3 S$ ]+ [; {1 ^, N
  34. #include <linux/dma-mapping.h>
    . G; z; O+ M/ M
  35. 8 H; l+ B. F8 X! F! J. U$ ?
  36. #include <mach/memory.h>/ ?; _' W# |/ k/ U( C8 r; w9 f
  37. #include <mach/hardware.h>
    6 z+ P9 ~# V% s1 X
  38. #include <mach/irqs.h>
    # j6 V0 k# m7 O
  39. #include <asm/hardware/edma.h>/ _. w! ~, B; e; S8 V
  40. 7 n& @6 _3 Y' K6 J
  41. #undef EDMA3_DEBUG! X7 Q" B% V: ]( O! A
  42. /*#define EDMA3_DEBUG*/
    3 k- h! b& C: M$ u
  43. 4 j. @4 }; Y' O3 J: Z  t
  44. #ifdef EDMA3_DEBUG
    ; i  Z  c' T/ ]* G' v9 g6 A5 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 c4 f5 t% l- ^: P, G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 [7 }* ~2 H# l( Z+ M+ b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 S( b# n2 Z' y2 P3 v$ v$ S
  48. #else
    3 H+ m( G8 I. ?. {7 Y: b6 S
  49. #define DMA_PRINTK( x... )
    & N4 K% q8 G7 w& H$ a' I0 g3 Y9 b
  50. #define DMA_FN_IN4 D8 @  L5 U4 W
  51. #define DMA_FN_OUT. P6 o$ w* a, c* _# n" P. Y1 o
  52. #endif3 H3 z/ r) @. E; c

  53. ' j3 H. l! `- W7 @1 T8 K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 n1 V3 |/ p; G7 k' f
  55. #define STATIC_SHIFT                3
    . J8 c0 k% d! Z( M% |' L: n5 [
  56. #define TCINTEN_SHIFT               20
    , ?3 x/ S: w7 U
  57. #define ITCINTEN_SHIFT              21
    5 S$ D0 i. f1 a( Q' `3 F
  58. #define TCCHEN_SHIFT                22
    ; l9 \6 k( e8 k- T$ d" V  v
  59. #define ITCCHEN_SHIFT               23- o4 p+ S" `7 P- b
  60. - u' l' Z' v" ~5 S" F
  61. static volatile int irqraised1 = 0;
      C( N& {' b5 N! s' ^8 N" b
  62. static volatile int irqraised2 = 0;; y; |8 b# C6 [7 f2 ]% ^

  63. % ]6 m9 z1 E! E8 I5 v& v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. H* F2 g% M7 S2 s- w9 L( J1 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 P9 `5 g+ F2 ^5 y, N) a- \: {; g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* v6 S! d- G6 y

  67.   g8 Z! }2 h  _& v0 V
  68. dma_addr_t dmaphyssrc1 = 0;* ]% ~; j1 Z& }3 L4 u
  69. dma_addr_t dmaphyssrc2 = 0;
    % k& r  a2 ^: j; G
  70. dma_addr_t dmaphysdest1 = 0;
    ; e4 Q8 L% S: |& q7 B  J
  71. dma_addr_t dmaphysdest2 = 0;
    6 n# B5 t9 B& q4 d& x/ B

  72. " }: N9 H% V" K" @
  73. char *dmabufsrc1 = NULL;
    6 [2 A% A. y1 F
  74. char *dmabufsrc2 = NULL;
    5 k  y; t" ]7 T, m6 @7 o5 l
  75. char *dmabufdest1 = NULL;
    , ]9 @% Y0 G4 S% q4 h
  76. char *dmabufdest2 = NULL;% g4 r1 z: {. @0 t" P6 z9 ]

  77. ' v' S$ c  P) l! S* D8 I; f* x
  78. static int acnt = 512;7 V# R* L( ~+ `( Q
  79. static int bcnt = 8;
    6 W+ |% G" F  _8 j: X. R: S
  80. static int ccnt = 8;6 o. x6 [; F, B3 |- c- l; B
  81. 1 t) G) }' b% |9 h7 }  J/ S
  82. module_param(acnt, int, S_IRUGO);2 K, L; J" E+ `  V9 N7 ^; Z! E
  83. module_param(bcnt, int, S_IRUGO);
    5 @0 M2 j* w+ P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 ?; G+ `9 o  ~1 I  j! r
5 e9 C' j  ^# H& s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 l( M2 D% N4 f- n  P
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, u# W/ g$ V% t3 F1 F( T9 C
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 B3 V& I) h) Y1 o
, v# N' r7 r" r$ ?( \- F* z0 r

) @- l0 z6 ~  ~& h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-10 18:38 , Processed in 0.039008 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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