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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* J  \7 \9 r. ~' K
  1. [code]EDMA sample test application2 H/ D, W( L5 [0 H) c" i4 y6 d( |
  2. /*$ s8 B6 y: w7 {8 t0 ^
  3. * edma_test.c
    1 n0 ]! a* b3 C1 ]4 f2 i6 E! I& |
  4. *. ^+ s) R, y' A% l
  5. * brief  EDMA3 Test Application
    0 I2 d( `, F  V: f+ M4 j6 t4 T
  6. *
    $ T& x' l- q. ^
  7. *   This file contains EDMA3 Test code.3 t5 ]+ g- ]/ G( n) |, z! x
  8. *
    * b$ N6 m- k7 s7 y0 @7 B$ b/ E1 C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( T1 Q$ p; Y$ [) h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 T, o6 t9 A" [0 t, [; a) Y
  11. *         TO CHANGE.4 D7 T& c1 ?- X
  12. *, t& D8 \. p) x) j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 k8 C9 [, O, h) `* G9 k* R4 ^
  14. *2 n9 c6 s& V( g3 ^8 c( L( K/ P: V
  15. * This program is free software; you can redistribute it and/or
    . i! I" k( B) u: Z1 ?
  16. * modify it under the terms of the GNU General Public License as
    , y% \, |8 p7 T  H  {+ ]6 o$ u
  17. * published by the Free Software Foundation version 2.3 x- U2 G8 M3 B! Y& ?% m8 q
  18. *) M8 I" D8 v4 d* u& w% q, q7 N0 S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 \+ x- N3 X# z9 f; u# }  _
  20. * kind, whether express or implied; without even the implied warranty5 e) D- P/ z: f1 Y0 u$ h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 e/ H1 ]7 `( O" w( L
  22. * GNU General Public License for more details.
    % E( m( j  c" F. ]
  23. */# }1 {' t: ]$ b% [; ?
  24. ( R, r+ r2 Q% b
  25. #include <linux/module.h>
    0 l% R  W- u  W+ X3 u2 ]( _
  26. #include <linux/init.h>
    - T2 L& O# ~5 f2 X% H: z5 m6 G* d
  27. #include <linux/errno.h>
    ; i' d4 H) {1 y- g7 a
  28. #include <linux/types.h>2 P. m: ~7 o0 h! k
  29. #include <linux/interrupt.h>
    & z) l+ O6 m# v3 K( R- Y0 H7 N$ m
  30. #include <asm/io.h>  w  n2 N  d& s% s. j5 ?6 E- G( C
  31. #include <linux/moduleparam.h>- M) S" k) U$ q7 V* e! O8 d
  32. #include <linux/sysctl.h>/ d7 p2 Q1 i, y, D0 D( J
  33. #include <linux/mm.h>8 }% R, B! W. W, c3 u
  34. #include <linux/dma-mapping.h>" C4 o' O7 b1 R# ^
  35. 3 E: r$ g9 ~! Z' p7 f# D' a$ Q
  36. #include <mach/memory.h>1 [$ \; R9 B6 O+ u( \% U
  37. #include <mach/hardware.h>3 B- ?  d9 a, c
  38. #include <mach/irqs.h>
    9 @0 K+ p- ?( ]% ^3 X5 H" x
  39. #include <asm/hardware/edma.h>5 U* v0 \# _; ~5 F) j) F& F

  40. % n: X0 s0 W* b& g9 @' m- L% _
  41. #undef EDMA3_DEBUG2 }0 S( W5 e6 X( I9 w( W9 h
  42. /*#define EDMA3_DEBUG*/6 q1 G# t% r/ x& R" S
  43. # Q% A8 J  R, `$ v/ N7 a
  44. #ifdef EDMA3_DEBUG
    8 v* n* ~! F( r+ d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)7 `, O  A& |* `
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 C" i  R) u8 a! Z5 {+ s* j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__), S3 c$ ?0 Z8 ^4 z0 Z
  48. #else9 w* _4 H- `% S% j
  49. #define DMA_PRINTK( x... )
    1 W" A% |7 O8 M
  50. #define DMA_FN_IN
    2 S- }. ~) g5 D8 J2 d! ]9 k  s
  51. #define DMA_FN_OUT
    8 B$ P* E5 k' Z8 C( t: m' ]" g. g
  52. #endif
    ) C) e- K& Y$ ~! \1 S" h
  53. . v6 K# T' F6 f3 t; |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); r3 b- W" Y  p8 |. r2 r
  55. #define STATIC_SHIFT                3
    # n0 ~( I- y' `, A! g
  56. #define TCINTEN_SHIFT               20; {8 o$ v  E4 Y$ q, L: C( c+ R/ H9 N: l
  57. #define ITCINTEN_SHIFT              21
    3 O; ^5 j1 d1 E& |+ _' g- ]- E3 t" y
  58. #define TCCHEN_SHIFT                22
    . G/ c) J& _1 L& v& Z( N
  59. #define ITCCHEN_SHIFT               23
    . B! [/ w* O  V3 ]+ T

  60. ; [: o7 z! A9 `9 R: W
  61. static volatile int irqraised1 = 0;9 M. U6 Y: E1 ~2 w3 z  a' a* Z
  62. static volatile int irqraised2 = 0;
    # ]$ \- r( A: U; ^: G8 J

  63. & i, F4 w; V0 e! e9 W# m: U0 v  v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' c/ ]" j) M: a" ^* P+ c8 M8 V8 @6 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - }: c% m2 e5 i+ B5 \$ f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , L$ J, `  H% A/ X/ X# f$ _
  67. . y0 t3 q' l% i% b) m5 N
  68. dma_addr_t dmaphyssrc1 = 0;
    ' I! l3 g& c8 d" K* r
  69. dma_addr_t dmaphyssrc2 = 0;
    ! g1 Q8 K0 s% N
  70. dma_addr_t dmaphysdest1 = 0;3 ]$ j2 I; `. A4 m" u
  71. dma_addr_t dmaphysdest2 = 0;" p; v1 U: {  t- Q* s/ K* @

  72. 6 `9 u1 |0 C! t
  73. char *dmabufsrc1 = NULL;
    8 t5 w. P/ x1 N0 C: E& i  c
  74. char *dmabufsrc2 = NULL;
    : i: c; m' G2 A3 b
  75. char *dmabufdest1 = NULL;
    # d: ~$ d3 ]' Y) O" I3 H$ ?2 L- P
  76. char *dmabufdest2 = NULL;5 l& _! U; `/ S  b
  77. % S1 l9 J9 G% |# k; {' e7 L
  78. static int acnt = 512;7 f9 a) S0 ^- l
  79. static int bcnt = 8;  C1 a/ h; x; C, R9 J3 X5 v# y
  80. static int ccnt = 8;
    7 F* N, B! k+ r0 f3 s
  81. 7 |1 @7 A' L+ B+ p8 B  _
  82. module_param(acnt, int, S_IRUGO);
    8 J$ {5 K1 ^+ _6 g
  83. module_param(bcnt, int, S_IRUGO);
    4 V( t, t( ^. w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
9 c/ {4 J! R( i8 o3 B. P

0 f0 f$ t/ e2 n; {9 G( ?1 ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# b  g0 e. o: W& V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% ^' v9 w* Y/ G) X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ E* o+ Q9 v# }
+ M- Q, G1 Z1 U

( c/ l) v1 }( `- e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-25 08:49 , Processed in 0.040305 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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