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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 k/ [. `$ N5 X& h
  1. [code]EDMA sample test application+ h' ]! M8 G/ N8 _* o6 j+ K0 |( U- R
  2. /*
    3 M- [( ?1 @: j1 X# x
  3. * edma_test.c
    " r* l( B$ g7 h5 n' |! u
  4. *8 [8 u/ H0 b; W$ p# k
  5. * brief  EDMA3 Test Application
    $ |, V# U- W6 V3 E& V" A
  6. *. u9 p$ G' s. f: k' I+ d% z
  7. *   This file contains EDMA3 Test code.' m# \) o5 R% P3 E4 E
  8. *
    ! {# a% Q( P/ [3 \8 T0 e7 H$ U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, x- j0 [% z1 d1 O4 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 s. A* w0 U. F& G% H6 m' `: |/ V
  11. *         TO CHANGE./ o" N  G  U# g/ U% i
  12. *
    . I% V1 j* y9 c7 Z- m1 D! E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " r/ M# {8 v, t+ _0 R; X9 Z$ v; @
  14. *1 e- N* v, r! _* Y
  15. * This program is free software; you can redistribute it and/or
    + ~( i' g, I. w+ {) E
  16. * modify it under the terms of the GNU General Public License as( [1 F1 ^/ N" v0 Q% V
  17. * published by the Free Software Foundation version 2.& z1 l, L/ Y" K) o
  18. *: B3 N- Q, t, I' F3 y1 h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any- H" _; l/ [  J: ]: F
  20. * kind, whether express or implied; without even the implied warranty
    & F; c# M% i9 }8 R+ V9 k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ e, L! l2 Q8 ~( z9 I$ \6 Y
  22. * GNU General Public License for more details., R/ z+ d7 P5 u% S# K# B& S0 F; Z
  23. */
    2 {  f# X: d) B% n- t

  24. , c5 u8 f5 D0 v# e2 Y/ }
  25. #include <linux/module.h>
    ; H% s5 C: Z( N8 V3 P4 t
  26. #include <linux/init.h>2 O4 t# d: Y8 _+ N# n, I+ r
  27. #include <linux/errno.h>0 C4 p2 U9 s, p; Q0 E
  28. #include <linux/types.h>% Z# n! S0 Q, g6 Q7 i
  29. #include <linux/interrupt.h>- X. H- ]9 D1 M9 Q& A' b
  30. #include <asm/io.h>
    ( T) v! V8 ?4 R- j, q0 S
  31. #include <linux/moduleparam.h>
    0 o. G+ S3 o( C' O3 E
  32. #include <linux/sysctl.h>* {  [0 O$ [8 x$ Z
  33. #include <linux/mm.h>7 ~0 Z( Y( H& t, q& r
  34. #include <linux/dma-mapping.h># T" c) [+ m+ H2 w1 a/ j
  35. 3 v# H5 J; V6 ~& j
  36. #include <mach/memory.h>
    , A+ E# c' K7 G* j# }" @7 V! v
  37. #include <mach/hardware.h>% C2 m4 |# d" E7 H5 u
  38. #include <mach/irqs.h>" ]: b, @0 y% g# d5 O: x: n1 d) A
  39. #include <asm/hardware/edma.h>7 `7 ^9 x) o$ P* a$ P; S
  40. : X2 c% ^: }. l4 b4 \: P
  41. #undef EDMA3_DEBUG" w/ h! i+ g' W/ i& o6 n
  42. /*#define EDMA3_DEBUG*/* e% s9 }) ^! T; l/ a' H$ R
  43. " A' v9 k" G" w
  44. #ifdef EDMA3_DEBUG
    ' v, t" x: B, k2 g  N8 c; L" q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* T. k: h3 L0 W8 C" [: ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 ]( u: K* @, G' A+ H. L& F+ D' l
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 V$ c0 U3 R/ Z$ Q/ _8 L/ u
  48. #else" v' }/ s! i( h' |  J3 ], i
  49. #define DMA_PRINTK( x... )
    ' S; T4 }' h9 J  B, M5 s
  50. #define DMA_FN_IN8 {3 t4 D$ ]5 g( E! _; }4 j
  51. #define DMA_FN_OUT, E& l* h6 c# b' T) c
  52. #endif6 G9 x5 s8 V" @! n5 d& M
  53. 5 o4 a$ S0 a- @! z1 [4 d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # Y' D% g/ i' p
  55. #define STATIC_SHIFT                3! E( P, R6 |& i. a/ l* {4 J
  56. #define TCINTEN_SHIFT               202 E2 ?( `1 s* k2 o$ t7 ^: O4 B
  57. #define ITCINTEN_SHIFT              21$ I! c0 n* Y' G
  58. #define TCCHEN_SHIFT                223 E! S+ z2 X/ v) t8 @
  59. #define ITCCHEN_SHIFT               23
    % t( }8 o( z2 I" G9 K$ v' y

  60.   a- x  g  ]) V0 B4 i- M7 m4 h
  61. static volatile int irqraised1 = 0;
    $ a8 I- n2 P; v" K" a+ N- Y
  62. static volatile int irqraised2 = 0;
    - K  n  H- M$ u  M5 y2 Z1 ]! E

  63. ' m& p9 }' J9 R0 q) u4 q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! J! n% M$ Y  E6 Q+ [
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! N* I0 ^% R9 V# G( q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! a: ?5 ?8 C. [$ i5 [" h
  67. " X1 _8 U8 `* ]
  68. dma_addr_t dmaphyssrc1 = 0;
    ' d* q' R/ Z' g+ j) K
  69. dma_addr_t dmaphyssrc2 = 0;
    & z8 @$ L9 {" |* `* @$ ^" D9 T
  70. dma_addr_t dmaphysdest1 = 0;0 @4 B. a& D. X+ A% K$ ^
  71. dma_addr_t dmaphysdest2 = 0;7 A2 s( _' K- e, s

  72. / `" N6 E/ C6 M( C
  73. char *dmabufsrc1 = NULL;
    - a) h4 [3 l' ^4 U7 {/ J8 g
  74. char *dmabufsrc2 = NULL;" {7 |  i! b- b$ @( i! K2 d4 P: D
  75. char *dmabufdest1 = NULL;
    ) m4 M% ?+ n* E6 w9 D
  76. char *dmabufdest2 = NULL;
    8 e+ v1 e8 J  _0 N3 [
  77. . O; S6 c, ~* D" \3 u
  78. static int acnt = 512;+ m& x3 @; ~' N2 M1 h
  79. static int bcnt = 8;- A  k% X: p6 R1 M/ o4 E) Y: r3 G6 R3 ~
  80. static int ccnt = 8;. ^- w' D1 J: h5 t- |8 N* D

  81. : ?1 |8 m* x1 A7 U- {
  82. module_param(acnt, int, S_IRUGO);( _- a' Z7 q/ H% z
  83. module_param(bcnt, int, S_IRUGO);5 `1 P0 H) e0 l* m  [( F  i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 m1 I  g. f, R) k
# k+ L) N. H! z! g/ W2 ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, V+ A2 B4 e+ g
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  e( d( G$ E' s4 v
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, l% R( F0 f. ?: s$ n

6 O, ?  U: F1 H: N) A
9 U5 S7 A+ {0 c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-21 19:06 , Processed in 0.040499 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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