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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & j9 H& B; w" @  E4 S' Q- j
  1. [code]EDMA sample test application! J& Q& P% K0 ~3 r
  2. /** a" T2 l% B7 L+ R+ d+ J! j
  3. * edma_test.c
    6 |  a. f9 J9 E  Z7 |
  4. *
    * @$ o, v- ~" P. Q2 x# g! ?  y; d, a
  5. * brief  EDMA3 Test Application
    ( D2 }9 u8 G/ r$ m/ E
  6. *: j5 |4 E1 r9 T5 J# R
  7. *   This file contains EDMA3 Test code.6 A. a# ?* U9 Q5 D
  8. *
    % Z9 w- T6 G: E  G  z0 y2 H
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    7 n4 K# O" k4 s6 ?5 e1 x0 A5 n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 ?; [9 u* F2 d; ^
  11. *         TO CHANGE.; d. e( y4 V6 [8 _
  12. *) Z5 ]2 M1 ?$ n: \5 u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 c. V* @4 E! d
  14. *% l" N, J; D: Q5 h" ^0 T
  15. * This program is free software; you can redistribute it and/or4 O) J3 X9 I% A' W* [4 N3 W
  16. * modify it under the terms of the GNU General Public License as
    6 v: X/ y8 R5 S) N- n
  17. * published by the Free Software Foundation version 2.5 b# d+ l5 s4 Z) l- u
  18. *
    ! }' H% q! o$ T; v% r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # s( C" W. A% {/ D
  20. * kind, whether express or implied; without even the implied warranty# O* F; y  K& N4 Y5 {3 l: y8 @: \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the! ]: }6 [' R% s
  22. * GNU General Public License for more details.& `* B! b! n! a
  23. */% A- p7 C) K$ v- ]- P% _; m: g! b
  24. + K" V1 @, D. G/ x/ ~
  25. #include <linux/module.h>
    2 u, ~* s9 j' F4 P7 @
  26. #include <linux/init.h>
    - w5 F1 {  c0 Q" X! |% ?+ D
  27. #include <linux/errno.h>5 w) j/ h% q' a% T
  28. #include <linux/types.h>+ w5 Y$ C$ m! W  {! ]/ L
  29. #include <linux/interrupt.h>
    0 R2 f( Y6 u2 {
  30. #include <asm/io.h>2 H% N3 i" L8 P# ~8 ~+ t0 F; ?: |
  31. #include <linux/moduleparam.h>& N+ J7 }- t- R* X
  32. #include <linux/sysctl.h>
    # T8 `3 B( P: u
  33. #include <linux/mm.h>
    7 b& Q4 W+ B8 @& |; h3 c* _+ B
  34. #include <linux/dma-mapping.h>
    ; P$ H) j, K( p* N$ J0 H1 S4 ?
  35. 0 t0 W" q' d  {4 w* F: ?3 ~8 c" s
  36. #include <mach/memory.h>
    8 x, c( v( a2 k! l+ r1 k
  37. #include <mach/hardware.h>% y& j4 N/ P( E8 L" N. ^9 c
  38. #include <mach/irqs.h>2 @- \/ J5 P' ^& {. j8 Y3 \
  39. #include <asm/hardware/edma.h>
    * V2 Z) |/ F* g$ L7 M
  40. ) R2 A  k/ k$ b* Q) p3 ]' v0 x2 j
  41. #undef EDMA3_DEBUG2 |7 T( j" n1 Y$ k5 R) v
  42. /*#define EDMA3_DEBUG*/
    4 Y# S! ?* ^& q6 k+ E

  43. 2 T2 |: k) M; ~! j" ~" j! J% w/ `
  44. #ifdef EDMA3_DEBUG
    $ `# Y9 Y: u$ `% b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + [5 |  Y: |$ }; {" s* N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ X0 f- x9 Y) e" i1 R$ a" {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 a' `, j8 R! W# a6 n( S
  48. #else
    8 P9 H  {: `- H! i6 t) q
  49. #define DMA_PRINTK( x... )- _2 l2 g! a. _  R1 J' W$ G+ `; P; S/ F
  50. #define DMA_FN_IN
    ; T5 G5 d" j" T
  51. #define DMA_FN_OUT
    7 ~9 ^1 K$ V( r5 F9 ~
  52. #endif! @' [5 N* H- r/ s
  53. 1 ^# H$ D8 i2 o3 ~- G- i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% ^. c8 E9 Z! q" }
  55. #define STATIC_SHIFT                3. [+ _) v' b* E* w3 |9 W3 w
  56. #define TCINTEN_SHIFT               20
    3 ^! M8 @6 L5 P4 E* y! t- u3 _7 A
  57. #define ITCINTEN_SHIFT              21+ w( K9 D* `% Q
  58. #define TCCHEN_SHIFT                22
    ! E7 \! U3 M  A$ S# S
  59. #define ITCCHEN_SHIFT               23
    " z5 Q) ~; n0 y; h6 [* j
  60. 1 m/ [' N; x" c: m
  61. static volatile int irqraised1 = 0;3 f0 Q& q1 a( }" C$ S3 q
  62. static volatile int irqraised2 = 0;
    & ]+ a: C3 N, R9 _. E4 e

  63. ; c5 l/ ?: @, N7 C9 E: y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 l/ J/ g$ r3 s" S& |3 y9 n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  R7 i6 E" T4 n, {8 A! B  v6 w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 E" ~- M* V) Z' ~2 V& Z3 ]$ W
  67. ; y: L' A5 o: c" r9 d/ K( n
  68. dma_addr_t dmaphyssrc1 = 0;
      u4 P- R! K6 J5 K7 w6 B
  69. dma_addr_t dmaphyssrc2 = 0;
      m$ Q7 g2 X( p
  70. dma_addr_t dmaphysdest1 = 0;
    " X0 C  D2 w  ^6 I7 u
  71. dma_addr_t dmaphysdest2 = 0;
    6 W1 j3 }* z6 B$ M1 x5 j& G3 ?

  72. ) c/ f1 d& R2 E: h" z; ?3 N
  73. char *dmabufsrc1 = NULL;
    ! ^9 z+ }1 a$ s
  74. char *dmabufsrc2 = NULL;5 y( ~1 v: x3 s- r8 n; R# n" i' u# f; C
  75. char *dmabufdest1 = NULL;
    , h% K2 h' i5 t0 ]" T
  76. char *dmabufdest2 = NULL;
    : R" A, y, Y' X; Z

  77. 2 N7 L! B. p! q! ?1 k  ?, P9 C( O
  78. static int acnt = 512;
    9 v! |) V( @0 Z* \1 I: q5 |
  79. static int bcnt = 8;
    : Z$ T' @' {- n6 F, _8 J
  80. static int ccnt = 8;
    4 T% T0 s4 H' [8 c8 j
  81. 7 ^) d. A/ k2 ]. B. N
  82. module_param(acnt, int, S_IRUGO);( J5 P' ~6 U8 v
  83. module_param(bcnt, int, S_IRUGO);
    6 L% i# A, r+ L: r2 f2 z' y" p+ B
  84. module_param(ccnt, int, S_IRUGO);
复制代码
. s, D- N6 j0 }4 i

8 o+ p' V1 o8 E      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 D6 i5 W; e7 O: B" S- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。3 P1 C5 i3 s8 N" `2 J) |) i
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 Z# L+ }3 c- G/ v  i/ J
7 `) @% b: `8 V1 Z( Y5 Z6 f9 H2 \/ ~8 p0 \1 a9 D
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-21 04:39 , Processed in 0.041913 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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