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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! m$ w) R0 b; @, h6 F2 N" B
  1. [code]EDMA sample test application" c4 Q% U" X. A) @( ^
  2. /*$ @8 a1 X# n2 u; D4 y2 ^9 _
  3. * edma_test.c
    ) e- p& `) r; M# e5 Q
  4. *
    9 y, d4 U' O" h7 \9 f
  5. * brief  EDMA3 Test Application
    , g* y* x, t- g7 I6 B' c. G
  6. *
    # v( l8 z( U; o# _8 G% R7 k* m: C. W# F
  7. *   This file contains EDMA3 Test code.* S) e+ X/ Y4 T8 C! l
  8. *5 H' c1 s1 _7 g' V3 w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % c- _5 C9 }4 e& ?2 q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 Q3 c& {6 m3 A# f9 ~( c
  11. *         TO CHANGE.
    ; L' o( G0 E9 N' D% o' ~
  12. *
    7 M6 d! F) D. K2 S  w' M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( f: ^6 g' p: k
  14. *
    , _" q" \- r- u/ P3 o, \3 u
  15. * This program is free software; you can redistribute it and/or
    # w/ ~9 K' ]# E9 U# B" q. g' a
  16. * modify it under the terms of the GNU General Public License as
    $ m3 J3 V8 q! M* Q
  17. * published by the Free Software Foundation version 2.: a9 @8 j1 N+ q0 Q* B
  18. *( i+ L7 G7 v4 T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; o% _0 P1 Q, h! }3 A* C
  20. * kind, whether express or implied; without even the implied warranty" `6 o" N1 S( z6 F  M
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 k; \+ Z/ P* l9 U: z$ e0 O
  22. * GNU General Public License for more details.- c  @* {, p2 X4 G6 X  b. a5 G
  23. */
    , S0 ?( A1 R: S1 _* w/ f/ G5 \$ b& \2 E/ k
  24. ' f8 b1 X. V# Z9 E
  25. #include <linux/module.h>
    # }! {! [) G9 p$ L* H
  26. #include <linux/init.h>
    4 A  h$ \9 O  p4 ]2 V( Y0 j
  27. #include <linux/errno.h>6 ^# i! D5 I$ m; n- q) O8 I/ c
  28. #include <linux/types.h>
    + H' C  O" u- H9 p7 d/ A; ]
  29. #include <linux/interrupt.h>5 L4 `  J) e( F- S# Z5 q
  30. #include <asm/io.h>
    3 A) x, X. T' g1 t- s* U) P4 O
  31. #include <linux/moduleparam.h>
    6 z- ]# a: x3 C' v& t
  32. #include <linux/sysctl.h>
    $ u1 X  \' [3 Y  I/ }7 w4 d/ b! _
  33. #include <linux/mm.h># u" [; e/ y8 C" \! Z9 H
  34. #include <linux/dma-mapping.h>' J3 M% f0 i% M; v% @
  35. / q5 v/ i6 S4 }' `$ I) I6 V
  36. #include <mach/memory.h>; p! L4 A3 R4 V- w9 t) ~/ \* d
  37. #include <mach/hardware.h>
    ) s% n, |- T" F( u! ]
  38. #include <mach/irqs.h>
    5 ]' V! O6 f. n0 n* T- [
  39. #include <asm/hardware/edma.h>( _+ }" Q* `/ g& |" N

  40. ( I: e. t6 s8 R
  41. #undef EDMA3_DEBUG& t( V- `! K- e9 t, C
  42. /*#define EDMA3_DEBUG*/
    , Y2 t, g1 S/ k3 ~1 \* U" v$ O

  43. 7 }. y2 Y5 t2 X+ H+ K/ \
  44. #ifdef EDMA3_DEBUG
    6 w0 k) m5 ]/ a+ R# S2 u9 N! t$ M/ u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * M- [' f& S+ Z5 a' ?# I5 Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). e2 Q5 ]2 O8 G5 P& u8 A$ @7 j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    2 h! r/ b% Y: l6 I6 U. D5 z
  48. #else
      w4 k1 O' w3 v$ O$ r
  49. #define DMA_PRINTK( x... )
    1 N9 r/ c2 H' V$ o
  50. #define DMA_FN_IN( a- q3 f& R, `* O; S* F% ~, O% Y( J) R
  51. #define DMA_FN_OUT
    , f5 n$ V. E- o4 f4 \
  52. #endif& T7 ^) V! ~2 n) }0 P
  53. 4 T4 N; D+ J/ f; ^0 m# ~0 L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + B- _, U0 h# u. u
  55. #define STATIC_SHIFT                3
    3 W1 I1 Q2 r. ]2 Z, l) x4 T
  56. #define TCINTEN_SHIFT               208 g( d# S. A$ j" T
  57. #define ITCINTEN_SHIFT              210 C* _0 Z' X! g/ T; ^
  58. #define TCCHEN_SHIFT                22
    0 S& f1 a" ^6 b. i4 U+ {
  59. #define ITCCHEN_SHIFT               23
    ) `1 {4 i$ ~, y0 A

  60. 6 f2 S6 ]4 I7 C) v; {6 g
  61. static volatile int irqraised1 = 0;
    " Y% T, N' n- P, t
  62. static volatile int irqraised2 = 0;
    6 Y3 [8 U' y$ e" a9 p0 O
  63. # }" M* h, h! z# c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & d, h" ]+ O  q: h' D8 w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# O0 O4 l- f" q& s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' r* w9 x4 [" p5 U; ?. ~
  67. & A! G6 N( f6 Q5 i5 @8 q8 x9 ?
  68. dma_addr_t dmaphyssrc1 = 0;
    8 S3 s  |+ L* |9 f: Y8 J8 E  p2 Q" K% q
  69. dma_addr_t dmaphyssrc2 = 0;
    4 R! m1 L* G6 G. h
  70. dma_addr_t dmaphysdest1 = 0;
    7 @) E$ J% c$ m. z
  71. dma_addr_t dmaphysdest2 = 0;2 P# k9 H* O5 [9 q
  72. ( f3 N& T  j7 J) ?8 K  z
  73. char *dmabufsrc1 = NULL;
    % R" D' t( |+ E& W8 a
  74. char *dmabufsrc2 = NULL;' V" y( U( ~+ p
  75. char *dmabufdest1 = NULL;
    8 L6 `1 S( @6 \# U
  76. char *dmabufdest2 = NULL;  B" L6 a/ R& g8 W, M

  77. * |# s1 s  J: a% A! t+ l" `+ ^
  78. static int acnt = 512;' B+ ~+ Q# a7 F" Y9 H
  79. static int bcnt = 8;3 D( p7 D2 ?5 y6 s
  80. static int ccnt = 8;
    . j- l% @0 k$ M/ \) B8 x, S6 _
  81. 3 P4 @9 @; N. b. ~
  82. module_param(acnt, int, S_IRUGO);
    : o8 \: A; _3 n
  83. module_param(bcnt, int, S_IRUGO);+ F0 N/ z" G  Z+ D; B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
0 S& D7 I" J3 g' [

. U$ o9 l9 M5 s: k3 p$ E4 z& w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# x% j/ x! |! B. S9 C5 a3 J  w
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) q+ A+ |9 N- _+ c! M
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 e- M* @; E& W
0 Y2 j6 z# X! j+ ?+ h/ i+ V( E' l2 E0 G: ~! b- N! |# p% e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-10-5 23:25 , Processed in 0.065059 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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