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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ k, T9 T, D- N* X& C) s; M
  1. [code]EDMA sample test application2 L+ j4 F1 i4 t6 M7 Z  O* I
  2. /*8 C* ]5 }0 C" l; c- S0 s$ r
  3. * edma_test.c0 ^9 C- v4 X: C+ `/ N$ q0 K: Q
  4. *; r! l! I1 S) E5 G( |
  5. * brief  EDMA3 Test Application
    ; P1 h, x1 X: b: V6 ]
  6. *4 a" e3 ^, W5 n$ C/ y
  7. *   This file contains EDMA3 Test code.
    4 O: ^4 `/ E$ _/ ]2 y
  8. *, J* S2 b( v, a# V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      v* N4 |' j; {: b' M% h2 Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' n/ T' x1 g; Z. j: ^
  11. *         TO CHANGE.
    1 f' ~2 \& U6 D8 i7 T* D
  12. *
    - N3 p' a1 i1 F  ~$ a$ ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , D7 y3 Q( H7 Z. n6 A
  14. *5 h/ A6 c8 ]% ]) M  `/ D$ e# F# o8 D/ q
  15. * This program is free software; you can redistribute it and/or
    6 i4 V& G9 G5 w
  16. * modify it under the terms of the GNU General Public License as7 U1 v' [" Z" _+ F  P! ~
  17. * published by the Free Software Foundation version 2.8 D3 ]7 {1 d6 ?0 z
  18. *
    3 E6 y% L/ C* k0 Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; l- Z' L! Q% e$ ?7 q6 d3 D
  20. * kind, whether express or implied; without even the implied warranty  l9 e3 l6 x. v$ c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , L' j8 m9 A3 s$ f% {- C
  22. * GNU General Public License for more details.! K3 V5 g* @6 U4 P) @
  23. */
    6 d9 K  ^9 I2 J! E

  24. . R/ e" l/ t# V: r- v% Q
  25. #include <linux/module.h>
    0 H: H  Z3 V9 |# Z! Y
  26. #include <linux/init.h>, C5 T; f0 X3 {/ n. Z9 I" d* Q
  27. #include <linux/errno.h>9 J: b. I% y2 S" I
  28. #include <linux/types.h>
    9 X1 F- T- b- t; j% G; k' T
  29. #include <linux/interrupt.h>
    4 T& y! ^/ p3 K" F  Y8 J
  30. #include <asm/io.h>7 u- S, ]3 s- M0 ^$ b9 n3 W0 f4 B
  31. #include <linux/moduleparam.h>1 N3 v. x) h$ o
  32. #include <linux/sysctl.h>
    ( R- R9 k- J5 h8 t2 Y/ h
  33. #include <linux/mm.h>$ r  G) L. r7 [6 ?# j% U+ X7 }
  34. #include <linux/dma-mapping.h>
    * t4 Q. i' I1 I3 F+ G" C; i: O
  35. & P5 _: R6 l+ \4 ]: O
  36. #include <mach/memory.h>
    ' O# H" D+ _9 h9 ~, L8 s/ {
  37. #include <mach/hardware.h>
    $ p, d/ H& G2 n0 v0 S' Z3 H
  38. #include <mach/irqs.h>' I, K2 `8 E7 d/ W6 @+ x
  39. #include <asm/hardware/edma.h>1 G+ g  F  I: Y" p" U$ X1 c
  40. $ l: F5 n, j$ q$ a+ r# ?- a
  41. #undef EDMA3_DEBUG
    0 P4 Q  G8 Z$ l( }3 u9 m
  42. /*#define EDMA3_DEBUG*/
    % K2 W, L0 I, y+ D! Z' c
  43. 6 s; @9 ]5 b% X$ o
  44. #ifdef EDMA3_DEBUG
    ' L: Y; V+ o: P4 ?; a! {5 |! y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 ^9 a* o8 F! r0 }3 r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): q: k: a, ^0 ~7 R. m% Q' K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # g3 l7 p" S4 q3 ^& a2 k
  48. #else
    9 J+ S4 Q2 P* l6 ]% C! Q
  49. #define DMA_PRINTK( x... )1 W% s2 R+ l- E8 l
  50. #define DMA_FN_IN3 ^7 l0 l  S, @  W6 U5 M
  51. #define DMA_FN_OUT
    1 f0 `0 Q& G; i! {7 d7 s: a
  52. #endif2 `5 L3 s* \% B2 B' x
  53. 1 K9 c0 Q% J4 |% F- V! o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - f5 Y' a% j: T1 r0 V3 c0 Z
  55. #define STATIC_SHIFT                3
    ! H4 `" a( t* _2 [% `
  56. #define TCINTEN_SHIFT               203 N6 @; F7 k8 T  P- E4 [! u( E$ _' v
  57. #define ITCINTEN_SHIFT              21
    ! C, _9 v& E$ ]8 v) J5 {
  58. #define TCCHEN_SHIFT                22& n3 O; n# O$ G! w/ i. I5 a
  59. #define ITCCHEN_SHIFT               231 W- Q/ y2 O0 f$ S4 K3 B, A
  60. 8 f$ m2 S! g9 k% B
  61. static volatile int irqraised1 = 0;
    1 V9 P3 w  M% W2 W( f* d1 F
  62. static volatile int irqraised2 = 0;
    ; E! Q0 u$ r$ l3 t( A1 O
  63. ! w9 G  ]  S- b1 `0 Y/ o; q( Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: _! ?% C9 P9 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 M( \% \9 V. H- w# I( u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; m  l% T2 b  c+ _: M1 K! X

  67. - O: Q# H- `! g6 A( Z
  68. dma_addr_t dmaphyssrc1 = 0;
    4 |5 n' {) D# Z" ?) P) @( U# i1 {
  69. dma_addr_t dmaphyssrc2 = 0;3 ^4 @; C, e& \& D( n' }1 A: U
  70. dma_addr_t dmaphysdest1 = 0;
    7 N4 H: }: F% G; I2 J! B2 Y
  71. dma_addr_t dmaphysdest2 = 0;/ Z- x& r  e0 K! e  Z  j+ Y3 d( O

  72.   x9 x# r5 R9 }/ h5 S
  73. char *dmabufsrc1 = NULL;+ J, d7 a0 {, v+ Z
  74. char *dmabufsrc2 = NULL;
    , _& B! D# X$ c+ U5 G( d9 q
  75. char *dmabufdest1 = NULL;( M: z8 x. `6 O9 D
  76. char *dmabufdest2 = NULL;. b4 @1 T9 _* J/ g/ t5 B
  77. 9 W6 B  j! A5 r8 O
  78. static int acnt = 512;
    ' [8 N+ m( |; A( y% g7 }  ^
  79. static int bcnt = 8;" U0 ]2 @& {- ~: k6 a1 l) Q" T
  80. static int ccnt = 8;/ r1 J  ~0 o4 [

  81.   W) k. Z, ?( u
  82. module_param(acnt, int, S_IRUGO);
    ; I! J1 e$ u( b
  83. module_param(bcnt, int, S_IRUGO);4 T0 j6 G/ `4 I5 w# f2 ?* S; i
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 V, D" W$ P. {/ q9 e6 m7 t% w) H) \

8 ?* `: J9 O7 N5 o( Q! U      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
" z- ]2 Y" Z# o0 x5 i' o4 H7 Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: w- ~. i9 C' b! N7 h  h# F     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 T5 C8 t+ J) H
, [+ Y4 u. x( e
# G  d& C! }- _: z; W
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 13:51 , Processed in 0.039275 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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