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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
, {: |6 X6 r- B) d0 c5 ?# c; ?7 q8 N
  1. [code]EDMA sample test application
    8 T8 e2 H1 G) w; S- q& @" c. n" y
  2. /*
    ( c: x3 b2 i% \* s
  3. * edma_test.c
    8 k" K& O& c4 l; U' j
  4. *- K! y5 r7 W: n3 h7 C
  5. * brief  EDMA3 Test Application
    / E( @. ~. ]; [) ^
  6. *
    ! c. J  R* W6 v0 k
  7. *   This file contains EDMA3 Test code.3 d+ `! L" K4 A2 a" _7 \$ k
  8. *! J. H2 W4 A2 M5 c* ?. l/ L% t2 p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE3 u1 I: }2 ^& z) ^9 V5 f6 s) R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' {* @; C. B2 s( A
  11. *         TO CHANGE.! h8 Q' w7 ^6 L6 g' C
  12. *
    ) O( P) c$ d/ X1 ^1 Z  T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 Q0 q! x7 n/ r7 T; Y8 e
  14. *2 ?- G; q! y9 X( }$ |* J$ v
  15. * This program is free software; you can redistribute it and/or
    0 D; H' @0 b% i5 V( @
  16. * modify it under the terms of the GNU General Public License as
    ! l" J/ u( I, ^: o$ @
  17. * published by the Free Software Foundation version 2.- m9 c- U; y' K( k6 v
  18. *
    3 ~' R8 D5 z; b" _& \- P% m) K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( \) a7 w7 A. g
  20. * kind, whether express or implied; without even the implied warranty+ _$ k: d) M0 Y' c8 F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  n, D# e# e$ U! O) ]
  22. * GNU General Public License for more details.
      l: Q! L$ _! C5 R* a6 h, j
  23. */* b* h8 X, d! i
  24. $ C1 v% _' r- n; U9 |0 j* C
  25. #include <linux/module.h>
    ( q0 g, D# ^' B( F( B
  26. #include <linux/init.h>
    - t. V0 p1 F6 D7 N( w. h% l
  27. #include <linux/errno.h>
    . q! f' N: P3 Y
  28. #include <linux/types.h>
    ( }  l- O$ r9 y8 p& Z# ]( T$ K
  29. #include <linux/interrupt.h>
    ; |; L/ p: o+ y; ^
  30. #include <asm/io.h>1 p" h" J3 _& [4 L5 \- R
  31. #include <linux/moduleparam.h>7 x  ^2 [6 B; p5 B
  32. #include <linux/sysctl.h>
    + i: Z0 _3 G* E
  33. #include <linux/mm.h>, v" ]1 a5 d; Z8 V4 ~* |
  34. #include <linux/dma-mapping.h>7 t* u) X2 U+ g2 U$ i8 N7 [
  35.   o. p8 f- K! F  @9 y& \2 Y7 b
  36. #include <mach/memory.h>
    , {  F/ f! f2 L  p! S5 d/ a
  37. #include <mach/hardware.h>& t4 \( K7 f2 J# ]4 A/ e4 W
  38. #include <mach/irqs.h>
    & B# n1 Q* n6 w: V' b$ Y
  39. #include <asm/hardware/edma.h>
    ( |' {% |5 I" r9 H9 w
  40. & T- ]6 ^5 I/ o. F2 H
  41. #undef EDMA3_DEBUG
    , K" ]0 J- _7 K4 G* l! j
  42. /*#define EDMA3_DEBUG*/7 [0 T# U3 g6 U! p( {$ C! o
  43. * I1 W5 p3 [# S
  44. #ifdef EDMA3_DEBUG6 G" h; {% P: u1 q0 j# z* \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' C+ M" E3 A7 r) s, N/ ^( ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( g: ]  N. X+ g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)% C/ H& U( [: f3 a
  48. #else
    ' f' w" v: C, f% O/ y5 a
  49. #define DMA_PRINTK( x... )! R2 x7 F! i; Z5 p! U3 S& A$ u
  50. #define DMA_FN_IN
    ' [/ g9 q, M. Z6 w  _+ C$ E7 ]. `3 a
  51. #define DMA_FN_OUT
    ) W0 w: A# V- H' h; x1 R/ Q
  52. #endif
    ) [4 T% x8 v0 e' s0 |5 L8 ?

  53. 7 F  E6 k; y6 O& h5 c, w
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)2 ]/ H- b+ L/ r
  55. #define STATIC_SHIFT                30 J% L: W) ^/ Z: n! B4 P& c
  56. #define TCINTEN_SHIFT               20
    1 D+ e8 k. z7 t$ _# M. d: P
  57. #define ITCINTEN_SHIFT              21
    + ]+ p% ?5 Z7 F% ]# c* U
  58. #define TCCHEN_SHIFT                22# n, u# d8 r6 _  @8 o8 P8 H4 v
  59. #define ITCCHEN_SHIFT               23$ b: n+ ^* ?8 K: R, }# n
  60. 2 ?2 C# {! Y: e- x7 U
  61. static volatile int irqraised1 = 0;0 a7 F2 w8 `7 Q3 X! f
  62. static volatile int irqraised2 = 0;
    : d/ P% ~0 v% F2 P+ b
  63. 8 O- T5 ^/ u8 |) r/ B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . t; M, C  b9 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& ^: n4 Z* C9 \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; `9 O( M; [9 D
  67. + `( h6 z0 ~8 @' E' s& ]8 q5 t7 z
  68. dma_addr_t dmaphyssrc1 = 0;
    $ {0 T* b0 w' W. L1 W/ w% T- @
  69. dma_addr_t dmaphyssrc2 = 0;/ X2 ~9 K( I, \7 Q
  70. dma_addr_t dmaphysdest1 = 0;
    8 z( R) X* Y& G( N/ q
  71. dma_addr_t dmaphysdest2 = 0;) [+ [7 |, d$ q: T, x; q

  72. , N" k, k1 d" w: E# V. t
  73. char *dmabufsrc1 = NULL;
    & b2 U1 R: j' \6 v& L) m
  74. char *dmabufsrc2 = NULL;
    8 _2 i# H; J. R
  75. char *dmabufdest1 = NULL;3 C9 L: R' r2 N* G5 K
  76. char *dmabufdest2 = NULL;
    # Z1 I3 r& E  z6 l# P. z5 u+ s

  77. . b3 O+ x: X/ M' c
  78. static int acnt = 512;& g* ]/ ?2 V$ @4 n
  79. static int bcnt = 8;
      B& \0 b4 E1 L
  80. static int ccnt = 8;" h5 N* c; \+ [9 a2 Q* Z1 n) D3 }4 w

  81. : |5 _, a5 ~3 H, ~
  82. module_param(acnt, int, S_IRUGO);
    ( w! Q2 M/ s! @5 D. H! R6 R2 q3 p7 T
  83. module_param(bcnt, int, S_IRUGO);
    2 Q1 I. F& _! S. D
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 H6 u9 w  w7 t/ E2 V6 o( E' [: L9 q4 E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) v2 g" A: ^& F# }
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
$ u- ^, m" _; Y) T! N+ @9 m6 s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: c+ T5 y% |2 R8 l7 m
5 L' h% h( N5 x8 M
. n% z9 Q3 n& @0 U% J
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-15 05:13 , Processed in 0.041110 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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