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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; l' p7 ?- ^6 K( }( p8 y" _$ ^
  1. [code]EDMA sample test application
    % S0 b. |8 u& `7 e5 |& E9 q" d
  2. /*
    8 d, W  X8 D2 g  i$ Z) r
  3. * edma_test.c
    # P! N) ?* w$ U$ j
  4. *2 x- h# o+ e7 h' Y
  5. * brief  EDMA3 Test Application
    ! t, y9 Q7 S* l1 I" c
  6. *9 ^, g: Q# b7 L8 H. C- z
  7. *   This file contains EDMA3 Test code.$ Q# a7 y+ ^' {- {6 L7 b! o
  8. *: `2 L& a5 E" \: ?8 L, w+ v
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! \0 }9 x- e0 g  F  c* F3 [( J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " g! p+ S% {( ?$ Y% O0 Q# U
  11. *         TO CHANGE.
    ; Y# `1 h" Y' e- g" K
  12. *
    - q4 O/ o* v6 n# R6 r; d- n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 G, d7 o9 y/ {, \: x+ \$ _8 g
  14. *( A) X0 G5 `5 W; U  ]- b; o' m
  15. * This program is free software; you can redistribute it and/or5 ]0 w! t% @1 p$ C7 |
  16. * modify it under the terms of the GNU General Public License as
    8 W5 ?. `$ }# r! o7 C9 D2 W
  17. * published by the Free Software Foundation version 2.
    1 H3 H: L/ j' r1 _7 z
  18. *
    ! J. u( i! E: N3 h  g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ h6 z! `4 o( c1 ?$ Y% V8 r4 ~
  20. * kind, whether express or implied; without even the implied warranty
    . y1 B7 v) F5 p$ }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & Y. J# Z/ ^# B- g" j4 R
  22. * GNU General Public License for more details.
    / W) W% O) d' B( I
  23. */
    $ {/ V& h% _: I9 \) T
  24. ; S1 `5 A$ V4 L, V
  25. #include <linux/module.h>& A  Z% e& w  `, F+ M3 m  E
  26. #include <linux/init.h>
    ' G( @; ?1 C+ G/ x$ [7 u0 }
  27. #include <linux/errno.h>0 _( E1 z6 D1 p% V# e
  28. #include <linux/types.h>, C/ e, i# K5 v3 K
  29. #include <linux/interrupt.h>/ o+ l! }5 W% c; Y# M0 ~8 l' G4 U" \. V
  30. #include <asm/io.h>
    # u7 Q' E; }+ E
  31. #include <linux/moduleparam.h>
      H$ e8 U$ ]. N2 _
  32. #include <linux/sysctl.h>
    ( H  U, J0 z- s" x  u
  33. #include <linux/mm.h>
    7 s& [% D. a( r" Z+ A6 c
  34. #include <linux/dma-mapping.h># c) ^$ v* N. O5 |3 I" |! F
  35. $ y! ?1 r# u) Z' N( X
  36. #include <mach/memory.h>
    8 ]6 u8 V) B- R' P! e9 I
  37. #include <mach/hardware.h>
    " n7 t- e. F( `4 Z9 u6 x
  38. #include <mach/irqs.h>9 k  F2 c/ g+ \, B
  39. #include <asm/hardware/edma.h>' Q9 M! c# b' V8 d/ u- A
  40. : ]- |1 S! K8 v! e& U
  41. #undef EDMA3_DEBUG
    6 z% s, n4 \: H/ [% b$ l8 D1 D
  42. /*#define EDMA3_DEBUG*/
    " S' B9 F$ y: }$ o! v
  43. 3 V) q% v, e: R
  44. #ifdef EDMA3_DEBUG$ L# q7 M/ V. c; ~3 f0 T2 Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' B; q: b/ y# [2 }3 y$ u, c
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); ?8 G4 x, k& g: _  e4 [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * C1 Z% r/ I7 b6 M1 \1 a8 ^2 i  g5 l
  48. #else) R" e5 W% z% R
  49. #define DMA_PRINTK( x... ): E/ C3 @& D, v
  50. #define DMA_FN_IN
    4 m& v: J3 |0 I
  51. #define DMA_FN_OUT$ ^5 R% V! x: g1 p1 C3 D+ }
  52. #endif0 i) b8 K: a2 L
  53.   ~- X7 q- L7 S3 s# }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ! r% Y9 ]& j- }8 P
  55. #define STATIC_SHIFT                3
    + a3 {. S* a# k8 b% H0 H
  56. #define TCINTEN_SHIFT               20
    & b$ u- a" Y( Q- z5 D- D- H+ W  i$ g- j8 _
  57. #define ITCINTEN_SHIFT              211 p4 F7 w5 E+ Q; q1 b5 n
  58. #define TCCHEN_SHIFT                22
    ; b2 d- b, g1 v9 ^
  59. #define ITCCHEN_SHIFT               23
    ) m2 M3 @, v7 E8 |/ Z0 Y- G- L$ t9 ~

  60.   c) t9 O0 h/ F4 P- q# H
  61. static volatile int irqraised1 = 0;$ P) z; l( I* A% Z$ U9 [
  62. static volatile int irqraised2 = 0;2 D6 f1 M2 [7 ^1 V0 Z: a0 X
  63. $ c6 R  Y7 K: ~. r& l' Y& Z7 R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 ?4 B/ d  \* ]4 {' B' Q( E
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      u; F* z' y7 X  Y! m1 f( k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* H0 I* Y  `; B% M3 Z. S

  67. 7 i2 l: n0 u. A/ @) }
  68. dma_addr_t dmaphyssrc1 = 0;1 s7 e3 n. b1 A" c- s
  69. dma_addr_t dmaphyssrc2 = 0;
    4 M9 |8 }6 g  h
  70. dma_addr_t dmaphysdest1 = 0;- v' }/ ^9 m( t( {# `7 S5 @
  71. dma_addr_t dmaphysdest2 = 0;
    1 @) b- b0 }2 E+ H: F" F( H
  72. 6 Q3 \8 _! J* O5 H& H; \8 n
  73. char *dmabufsrc1 = NULL;
    . w3 \/ B3 A# w2 l, D/ S
  74. char *dmabufsrc2 = NULL;
    # F# ]6 j4 Z4 y
  75. char *dmabufdest1 = NULL;3 t0 }# a- M$ P% J) R' S9 v: j
  76. char *dmabufdest2 = NULL;
    ) J3 C; ?- K; ^" @  @
  77. ( f, X- z8 y+ v4 {* ~6 k9 i
  78. static int acnt = 512;2 P* f, r( C; `% m) h8 R
  79. static int bcnt = 8;$ i- R. D% v! b4 h! B, w9 @1 E
  80. static int ccnt = 8;  A3 C- ]# ~! u/ ~( f
  81. : G& C6 ]+ I8 |1 W
  82. module_param(acnt, int, S_IRUGO);
    % r2 x: S" U5 y) @% m. Y1 V+ {
  83. module_param(bcnt, int, S_IRUGO);3 q# u* e4 t+ u& x' |. u% o0 H2 Q
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: Z* w9 \2 a& o( V
4 T% ~  W9 E: S; C5 D      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- R2 d+ m# [9 r4 f) `6 r! O
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# p0 L( a' P( N* \3 s     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 }, g& h  s5 _4 @& \
5 P8 c( l- w- B: n* [$ z8 h) k4 O5 u- g# ^$ K
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 07:51 , Processed in 0.039045 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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