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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 K( U' x5 J) e0 u7 n, [
  1. [code]EDMA sample test application/ x5 g: @) k- z( e+ A# l. z: P
  2. /*
    6 [9 y4 {9 x0 h
  3. * edma_test.c
    5 G* w/ X5 Q0 c5 @  |
  4. *
    ) W4 `4 i' y! s. q
  5. * brief  EDMA3 Test Application
    % R9 \' ~. E2 [$ R" H( b# P) {' ^6 q
  6. *3 {8 n& @) `' B) Y* }
  7. *   This file contains EDMA3 Test code.# M6 t" z( y: o
  8. *- Y/ v4 T) c' I2 t; O% i% {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE7 X( d6 F/ Q  ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% T8 c) g# d7 `( m4 r4 J6 q
  11. *         TO CHANGE.7 L1 \- r7 v3 t, R# J. g
  12. *
    6 c" M7 N9 y" \7 P) x! T
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - q1 o3 ^5 M0 ]
  14. *
    $ D. @. k, f- Z3 p. d! W( ]4 w
  15. * This program is free software; you can redistribute it and/or
    4 y7 D: k$ _2 M5 H4 R1 {* ]+ P
  16. * modify it under the terms of the GNU General Public License as
    5 R0 P4 {2 |" i- G- h, }
  17. * published by the Free Software Foundation version 2.
      ?% m& h+ P' E) j- M9 W8 Z* {/ {
  18. *
    9 A! ^% p2 S2 e
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any5 ]+ f/ }! h  h. W/ \& Z
  20. * kind, whether express or implied; without even the implied warranty
    4 T" n4 K7 [* p+ G! O- S/ z/ Z+ Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) U/ }+ l# C; F+ x0 I3 @4 F
  22. * GNU General Public License for more details.6 W+ M3 H& P3 u. o" V5 b- l
  23. */
    / t( [4 @6 y9 k" g. E; s+ R
  24. 6 a9 g% X) i/ k) S$ R' c% j
  25. #include <linux/module.h>
    & a7 f$ m& V' o. f5 j
  26. #include <linux/init.h>
    ) @, k5 M2 d% M7 q& f4 r5 E
  27. #include <linux/errno.h>0 ]) R# c! L# H2 S+ `' r- a
  28. #include <linux/types.h>
    . e! y3 ^9 T! d  x
  29. #include <linux/interrupt.h>, @5 M0 t3 s: @& r9 R7 t, B
  30. #include <asm/io.h>- C# y  Y$ \" O4 ^% C6 Z5 ]
  31. #include <linux/moduleparam.h>8 \( D2 Z: M) G* x$ M& @5 v& U
  32. #include <linux/sysctl.h>
    ' N8 j6 P- h2 Q& v( m+ U+ u- n
  33. #include <linux/mm.h>
    - O% p+ t5 u: c
  34. #include <linux/dma-mapping.h>. {4 O- P. i: g& L) D
  35. ( Q# O- W5 O0 N1 |
  36. #include <mach/memory.h>
    % b: ~. B. i* r0 F% ~
  37. #include <mach/hardware.h>1 L" L+ _' R- Z" p9 h
  38. #include <mach/irqs.h>
    " E3 V" a2 ~) B( M+ A. K
  39. #include <asm/hardware/edma.h>. @) r$ y8 X7 j

  40. , M3 m( D* `7 ?% J- A; f
  41. #undef EDMA3_DEBUG# I: E- b) p7 m8 t7 k
  42. /*#define EDMA3_DEBUG*/( B$ `& t/ V6 P9 S: E

  43. : [; {- ^) L& f" ~, Z2 j- J6 E
  44. #ifdef EDMA3_DEBUG! d& g( `/ G0 q+ [! b
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 W+ j2 D5 a% g+ I, P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    . l: A& U% B( n+ \! H' U
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)# I+ J# M) Z. a( y
  48. #else$ q. b5 g, f+ `1 G1 `
  49. #define DMA_PRINTK( x... )
    4 s0 {- j7 R5 w& F
  50. #define DMA_FN_IN, v6 u4 V4 J, o% [8 Q
  51. #define DMA_FN_OUT
    ! l4 w4 n7 W- d, a3 ?# D& z& U: y( l
  52. #endif
    9 W  {: `" e% ~7 J

  53. 1 l( `7 {. n, A  R% _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" j2 M3 z1 N/ r
  55. #define STATIC_SHIFT                3: u$ U& O& |. |
  56. #define TCINTEN_SHIFT               200 a1 z- f! }0 a& D. P* E
  57. #define ITCINTEN_SHIFT              21
    6 x1 `/ f1 Z, A  J1 o, c) U/ f
  58. #define TCCHEN_SHIFT                22) n& h4 k+ m8 b
  59. #define ITCCHEN_SHIFT               23% ?# P* f+ p! `5 j- M" ~
  60. 2 F0 @5 ~0 d: W6 l
  61. static volatile int irqraised1 = 0;
    5 f/ U8 A6 ?$ k/ c+ X
  62. static volatile int irqraised2 = 0;  m* ?' x6 [; t& R" U9 k

  63. / f6 j' s+ ]; e' g( w% }
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 b% b$ E  S0 X4 @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' K# F6 P0 _" ^& f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 s, ?4 z6 _7 [, }; w

  67. $ g; j! |; m  W3 r! N
  68. dma_addr_t dmaphyssrc1 = 0;
    , u$ r" J& y7 d7 C' d+ o
  69. dma_addr_t dmaphyssrc2 = 0;
    8 B6 |, R/ u0 R
  70. dma_addr_t dmaphysdest1 = 0;+ u6 O$ P/ s) j3 E
  71. dma_addr_t dmaphysdest2 = 0;
    / r2 t( S9 U* g' w" A5 Z# t9 f8 {
  72. 7 Q% E" R# j: U5 |% k) A8 i
  73. char *dmabufsrc1 = NULL;
    & f% Y! g# G# r! Y  }1 d
  74. char *dmabufsrc2 = NULL;1 L0 O( v% E1 }* O
  75. char *dmabufdest1 = NULL;* \. d4 T' O. q- q0 ?' I
  76. char *dmabufdest2 = NULL;
    0 c8 D6 W2 ?2 g- I) @% K& Y; X
  77. - y% o, ]( f* u' R- F# B" n
  78. static int acnt = 512;
    ; c' h6 S$ Y1 V; }4 A# o- i0 p
  79. static int bcnt = 8;, Z! V+ R) \4 k! m" ~" b# n! l
  80. static int ccnt = 8;$ [! a) y; \% \; X7 w
  81.   i* C& p2 z3 n* t
  82. module_param(acnt, int, S_IRUGO);1 \- A# T# t5 X4 u& ]8 I8 A8 R& e$ V% {
  83. module_param(bcnt, int, S_IRUGO);
    # O/ E/ I4 L2 o! X- o# F0 i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

7 u4 f/ a* [7 N. A8 j3 _$ b1 R/ g" u( A' t- b, V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用0 a6 L9 B0 l' \( K; p5 _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 ]% O+ K) e- s- X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: J% b9 x; v8 b2 J5 o4 X; Q* K

1 F, ^: X' O. G- ~4 t* L$ b. ]2 g+ a; H5 Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 05:34 , Processed in 0.036867 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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