OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 }" P- {' _# C) Q
  1. [code]EDMA sample test application
    ' O- E: `) S8 x+ H: k9 `
  2. /*; C/ ]' M3 p3 f" n- }# h& R
  3. * edma_test.c+ n  a4 i# {5 I. v# Q
  4. *! O# ~# x9 l' |/ s$ n
  5. * brief  EDMA3 Test Application
    ( T1 V* i% x. `/ B/ q
  6. *& A" w: l9 y; d6 U' f
  7. *   This file contains EDMA3 Test code.2 M1 @7 t$ s" S
  8. *" e- c8 h6 k, \6 G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# x. M2 o' h( p/ b( X$ Y5 J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    9 C1 i* f3 ]4 {5 ]
  11. *         TO CHANGE.
    " e* G! n0 n9 j+ I( w- e5 n3 L4 D
  12. *; {* d# w( n0 C& W0 z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 K3 E2 b5 u2 z+ P- q0 x+ |
  14. *) n" T2 C6 s0 P, k9 C
  15. * This program is free software; you can redistribute it and/or4 r! T. U: J- V, Z# d& @' v% _( r
  16. * modify it under the terms of the GNU General Public License as
    & h; D, ?/ B! D2 C% a+ G4 A
  17. * published by the Free Software Foundation version 2.
    : E" Q1 w5 S8 E+ j
  18. *! k# r7 P: S' n, {( s4 b5 J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ S$ ]! W9 _1 I7 Y: L
  20. * kind, whether express or implied; without even the implied warranty
    3 N& ~4 l- d9 O, {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& V- N. D/ l8 D+ o% x+ _
  22. * GNU General Public License for more details.
      \! ?6 b; d( N# Q2 Y
  23. */
    - Y$ {! r! p* f
  24. - n7 |2 I8 F' e' q: y! n9 L
  25. #include <linux/module.h>
    2 |7 D' @! U/ @9 |9 @  e8 @
  26. #include <linux/init.h>* [; G4 U1 R/ X4 v  o/ z- e0 N; H
  27. #include <linux/errno.h>1 X3 M) p3 N: Z$ J9 n9 b
  28. #include <linux/types.h>6 B* w2 ^( Z# e$ S5 j
  29. #include <linux/interrupt.h>
    9 l; ?6 l, S* c8 h* n
  30. #include <asm/io.h>) i7 T/ N" b9 w* v: P9 h! J$ i
  31. #include <linux/moduleparam.h>
    $ Q. p7 {1 b8 M4 Q6 A
  32. #include <linux/sysctl.h>, k1 N( _- ]0 P% Q: ], t0 {7 ^7 X2 O  Z
  33. #include <linux/mm.h>
    & y- w" s+ P2 M
  34. #include <linux/dma-mapping.h>
    ; ]8 ?) u- F* }+ J0 ]
  35. ' i( n  W% Q! {* T
  36. #include <mach/memory.h>
    / \8 C" L3 H) @) X2 T  K0 G5 W2 f
  37. #include <mach/hardware.h>* C3 o) ^+ y3 x) N* @; [
  38. #include <mach/irqs.h>
    5 c7 e9 p8 U" [6 V
  39. #include <asm/hardware/edma.h>
    / k2 s  e3 D0 q  C- l- g+ F, l+ N8 c2 j

  40. ( v, d( ~) s) n' g8 N! F
  41. #undef EDMA3_DEBUG3 M3 T1 j1 J2 |, f. M: @5 o% Z
  42. /*#define EDMA3_DEBUG*/
    ' U8 Y+ X* d, O6 ]2 A
  43. % _2 f; k- A! c3 W7 X' w3 i
  44. #ifdef EDMA3_DEBUG
    / Y* F- ?: ]& ^4 L! Q$ N) u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " G9 C2 s* ^% K4 v/ h4 U2 [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) b  E# H" {. v; o7 c) B
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 e' F# [- t, G5 T: C; w, f
  48. #else! }4 x) S8 A) Z* @. |( J6 p6 e% b
  49. #define DMA_PRINTK( x... )
    2 s' A- V. ~" c/ W
  50. #define DMA_FN_IN( {, `$ r8 B; ^4 \. `/ o. W* ^
  51. #define DMA_FN_OUT+ j, c) Q2 m: ]
  52. #endif
    " e7 h8 a* |9 z
  53. ! k, h+ }0 |& q! i: |7 C
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 V6 x$ V4 `0 ~3 T9 l2 t
  55. #define STATIC_SHIFT                3# w, E5 g% Y, w2 C+ }: G3 \# v
  56. #define TCINTEN_SHIFT               20/ B; G9 c! t3 f  K' S$ Y, b1 [7 q
  57. #define ITCINTEN_SHIFT              21
    2 x2 Y2 N2 ?0 N5 {& H9 T& x/ m& c
  58. #define TCCHEN_SHIFT                221 }1 n9 F% Y  [( i0 j8 @
  59. #define ITCCHEN_SHIFT               23( S+ J  |4 U, ~

  60. / q' |# ~; ]1 X7 e
  61. static volatile int irqraised1 = 0;! a9 A4 ?8 a& `5 p
  62. static volatile int irqraised2 = 0;
    : q5 G# z( x  L  c
  63. ) c0 K; J+ ^- X0 t+ U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) `( T! x  F) Y0 O$ H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) H( C0 S  S1 U" l( _9 ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 k* C, W; v1 [3 I3 V( z

  67. & M8 P8 ~+ m3 n7 N$ H  W
  68. dma_addr_t dmaphyssrc1 = 0;1 y$ ]6 v1 R6 }3 Q
  69. dma_addr_t dmaphyssrc2 = 0;# w5 X& j4 N! _  h4 \5 I0 b/ R
  70. dma_addr_t dmaphysdest1 = 0;
    , d) m, @# {6 o/ ~& l! m" t
  71. dma_addr_t dmaphysdest2 = 0;
    ; L" k5 h$ i6 I3 a

  72. ( u1 Y- k6 [* l
  73. char *dmabufsrc1 = NULL;# x5 S' z  f1 g: p$ i
  74. char *dmabufsrc2 = NULL;
    , i+ n; g9 ~1 |2 \
  75. char *dmabufdest1 = NULL;
    : N# i, h* d. l  }+ y
  76. char *dmabufdest2 = NULL;
    # P& \5 M  V% w9 n

  77. . b7 D6 h& N) p' `
  78. static int acnt = 512;
    ! W( X6 v" c2 `5 d* I
  79. static int bcnt = 8;
    3 Y) n& E5 k9 a7 Y" |
  80. static int ccnt = 8;' `/ i# g# E; s' }

  81. 8 Z! g5 [3 ?3 i
  82. module_param(acnt, int, S_IRUGO);4 S0 ^3 r; }/ N. ~  ~, C
  83. module_param(bcnt, int, S_IRUGO);" T$ `$ d9 E+ ~
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: O1 N2 N' L% M/ |5 S4 }% }& R/ O+ Q$ q8 G1 a- Z0 x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用  \& H. R: V" X: `1 ?9 D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 ~* Y8 M7 m8 A: Y3 t3 p# I) c* ^: q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。$ u3 [/ f3 f3 X$ a4 _
: L: g1 S1 k; `1 N, _! e

8 y/ t$ f' @, Z0 F* `- J+ }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-27 06:27 , Processed in 0.038517 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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