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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ) f0 q' d8 L1 R& [# ^
  1. [code]EDMA sample test application, c9 B; M- y' q' M# D8 f
  2. /*5 B; P( I/ g9 G% z5 X/ _  @
  3. * edma_test.c
    7 D/ o0 H- r4 a; w$ X0 c# e4 C5 x' X
  4. *
    # o1 ~3 Z- S  t( O% X0 w
  5. * brief  EDMA3 Test Application
    ; h! n8 S* M' l/ j0 @6 Z
  6. *
    : M8 t4 G+ H5 Y4 ]- Y& X
  7. *   This file contains EDMA3 Test code.
    , D0 x/ v" Z, t6 [
  8. *
    ; I. e2 A% z8 O9 H- I1 Z" ]0 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE# P" m: R/ V3 Z! S0 T4 p4 p+ i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - X. r" H( o; p0 e
  11. *         TO CHANGE.6 b& j" |9 @  H8 S9 p( \
  12. *
    1 d7 p8 i: S. c5 n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 m. m$ e% T' _( M- [  _
  14. *4 l9 {& @: y9 ]; q7 e
  15. * This program is free software; you can redistribute it and/or
    , e6 D" S9 g1 {' ~# |0 I/ \
  16. * modify it under the terms of the GNU General Public License as, x, f. X$ \- T6 e
  17. * published by the Free Software Foundation version 2.  Y- G' T/ z) V# e2 {( L) b
  18. *
      g$ e! P6 R. x8 y/ C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ; P# R" |2 U7 l* e: U- v
  20. * kind, whether express or implied; without even the implied warranty  I* M) W* y+ e) m7 |* q* ^' p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- r1 s0 |" n6 f" X" \0 `" F
  22. * GNU General Public License for more details.
    & U% b' K2 X! k7 T& Q
  23. */& `2 |; G$ f! i( [" c

  24. 5 u! o4 B) g/ U  z% i" w: ^1 ~; t
  25. #include <linux/module.h>
    # ?: q, Q: s8 C* M! @" K
  26. #include <linux/init.h>- G6 i& V& R: q
  27. #include <linux/errno.h>: r  r* K  s* f, i! R
  28. #include <linux/types.h>
      C% n+ S; W! ~; {) L2 E- [
  29. #include <linux/interrupt.h>
    % a2 }. O3 k, A! i8 k
  30. #include <asm/io.h>
    + U: l9 O, k0 P9 Q8 e5 u3 ^
  31. #include <linux/moduleparam.h>+ }0 y' k: e6 r, t3 K) \; S
  32. #include <linux/sysctl.h>
    1 I) Z: h# E- W8 J1 r! l
  33. #include <linux/mm.h>, }$ {+ ~. t  j
  34. #include <linux/dma-mapping.h>+ |  N1 U8 L8 c' D

  35. ! ^8 _+ V! O$ Q" i3 ]! @6 g$ D9 y
  36. #include <mach/memory.h>
    $ ^, _% i) y- y- ?8 m; }
  37. #include <mach/hardware.h>) ?+ z7 X5 v$ \1 f& N$ ]6 M# \, S
  38. #include <mach/irqs.h>, {7 B$ @* K$ p& Q! U6 x, A% s. v2 f
  39. #include <asm/hardware/edma.h>
    ) x+ J+ A' d8 \. ]! ?* Z# O

  40. 8 p7 _( v- O) d# n( ~) S6 @1 n& B
  41. #undef EDMA3_DEBUG
    . Y& A7 I4 _( b" C, |, q$ f8 H
  42. /*#define EDMA3_DEBUG*/
    " @. [, K8 t6 K+ V' Z0 W! r

  43. 5 j5 f: h, e% n6 r
  44. #ifdef EDMA3_DEBUG
    2 X* B- V& r* V, E5 ]/ j5 ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ a* v7 P/ G9 d: }% U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - J  S+ d4 v9 u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! ^3 F& r* z3 x9 d1 s' g
  48. #else
    ( S2 F) M% c) Z0 t, A
  49. #define DMA_PRINTK( x... )
    1 a$ `8 z9 _0 M9 f- w: e( S, ~
  50. #define DMA_FN_IN
    $ {; q6 \( `2 [
  51. #define DMA_FN_OUT( [" a7 ]. G' L- q' p
  52. #endif' J' g4 F; ^: n$ n
  53.   A+ I' \+ Z; T7 K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): Z" _2 w3 e' d" j; N# E) @% j
  55. #define STATIC_SHIFT                3
    6 e% W2 l& ]) Z" q; s8 c
  56. #define TCINTEN_SHIFT               205 b% G) G7 c) L, i; |. u9 Q% {) e2 E
  57. #define ITCINTEN_SHIFT              21; _$ ]% ~1 b3 I. S: R8 Y
  58. #define TCCHEN_SHIFT                22
    ' F  k. n$ U1 a. N
  59. #define ITCCHEN_SHIFT               23
    $ e3 l, ^; V2 x1 i3 Q

  60. - j2 d1 M/ }% v
  61. static volatile int irqraised1 = 0;
    6 Y' O. @9 i8 S
  62. static volatile int irqraised2 = 0;6 Y& E' w! ?- F; T( v7 T# i
  63. & [6 k5 n+ ^1 S. ]% k+ {/ F* P) V
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% [8 M0 ]. d/ H6 z5 A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ F3 ~; o8 c& F+ n# ^. o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 F& `8 B3 j( w& g% a
  67. $ ]& l  y# F" T& g. ?6 m
  68. dma_addr_t dmaphyssrc1 = 0;, T0 ]3 _$ o4 Q
  69. dma_addr_t dmaphyssrc2 = 0;8 _9 ]) l  [. T: s/ f
  70. dma_addr_t dmaphysdest1 = 0;" }: s) r) p1 I0 U! G- }
  71. dma_addr_t dmaphysdest2 = 0;/ l4 `; J# q7 g  `+ F

  72. 7 q9 J5 \9 x/ J7 b6 G, U- G
  73. char *dmabufsrc1 = NULL;$ @: w" P# H! }" |
  74. char *dmabufsrc2 = NULL;
    9 F  K% N2 r. T( V
  75. char *dmabufdest1 = NULL;
    * \( }4 |+ k, \
  76. char *dmabufdest2 = NULL;# A' c1 N6 m6 Q$ ^+ E; A
  77. , y$ u' x4 D' K0 `4 d/ ~
  78. static int acnt = 512;
    1 u2 _" X) {& Z5 [% [5 Z
  79. static int bcnt = 8;
    - v9 G: f% d, ]/ x  q- u. h
  80. static int ccnt = 8;
    ' r6 l9 B# Q4 t$ Q9 @0 W( i; V4 z

  81. - g* y; g9 ?, o/ w# n7 Y4 O
  82. module_param(acnt, int, S_IRUGO);) w3 i: z. L$ L" K. `( H! {
  83. module_param(bcnt, int, S_IRUGO);4 W3 u3 I; P* C6 T  n/ t, Y  p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' M  r  \" z' a! b# w* A/ i

7 b7 h) f5 v: Y& F5 M7 c! x1 S      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用; d% M1 c3 F0 i: J; |2 s( C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) _) e- s/ b! t     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
1 ?& w5 l" L: S( \9 F: D( _4 ?" F: H- C5 W0 j8 X4 j5 [

2 g) i& D+ \  g1 j: Y, l1 P2 K% m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-10 15:17 , Processed in 0.040845 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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