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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 ^5 a2 k. k# L+ w3 V) C
  1. [code]EDMA sample test application
    - t+ w# H, f& J$ l" {, U
  2. /*
    2 \8 A5 L) J+ i. z
  3. * edma_test.c
    * u1 s* R4 i2 V! X3 Y& j. R# i
  4. *
    $ W) C; c9 x/ b7 o8 `
  5. * brief  EDMA3 Test Application
    , }+ i/ o/ `  v1 |( m, L8 |: I
  6. *8 w" L4 a+ x* _
  7. *   This file contains EDMA3 Test code.
    0 g  F( i8 w1 k8 Y$ P# n
  8. *; i  e; R$ W4 a8 g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ' n  o0 J! x1 q$ r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 o' R: h' p/ C  G# Q
  11. *         TO CHANGE.7 `! R8 f2 n; n' C! t0 D
  12. *
    5 V, O( g2 U3 f$ h! B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    + G5 X/ P8 k( m9 [) K. a0 o0 g' ~9 m
  14. *
    : n, Y+ U' r0 Y! x$ n4 Q% d
  15. * This program is free software; you can redistribute it and/or
    ( A, @) d, N6 _) Q) \! _
  16. * modify it under the terms of the GNU General Public License as3 w" j; l$ B/ e; a* W% i. M" j
  17. * published by the Free Software Foundation version 2.1 t. q, }  B. m' v$ H! E& w
  18. *, T7 o) l1 k6 b. J3 d' y2 Y( O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' v! f: o: `. t) |0 z4 E9 l
  20. * kind, whether express or implied; without even the implied warranty; ]7 j7 G8 B( E+ X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" B( y% R6 W9 `" V8 t" p
  22. * GNU General Public License for more details.2 l3 W& |! |; w% _+ l+ t" E" q5 r
  23. */& i2 b, O( i. |& I& k: W% [3 @% p9 e0 N
  24. , z9 \8 I( E- L0 t$ U& Y- [
  25. #include <linux/module.h>
    3 c7 W1 |- x6 I. S
  26. #include <linux/init.h># g! V) [7 z% U4 D( x
  27. #include <linux/errno.h>( @* @3 v+ i5 i# ^( s1 q  X
  28. #include <linux/types.h>* m6 v2 C7 b; S/ ~
  29. #include <linux/interrupt.h>$ s" Z, P9 l  t- `) n0 v! k
  30. #include <asm/io.h>' Z! d# e& F5 H$ R( B! O
  31. #include <linux/moduleparam.h>; R$ g8 {" C2 H, A
  32. #include <linux/sysctl.h>2 v) X3 m! T1 k0 g% [
  33. #include <linux/mm.h>
    1 p$ n( N# L, B  X! K0 D
  34. #include <linux/dma-mapping.h>4 t; K: K( H# M$ A; ]/ K& m

  35. 7 d) f1 G' f* g' |$ R
  36. #include <mach/memory.h>
    5 S5 l; x3 s  q+ _) L7 E. b
  37. #include <mach/hardware.h>- @  k$ s3 y. y6 g2 }
  38. #include <mach/irqs.h>
    1 ]4 y* m; Y; B0 @
  39. #include <asm/hardware/edma.h>; b+ S0 W( B* X- A% ~: I

  40. 8 ?1 H8 J4 z; q0 w9 |0 [
  41. #undef EDMA3_DEBUG2 H8 q7 S2 A, f/ s8 B; w
  42. /*#define EDMA3_DEBUG*/" \  |. B  W, ~9 H( t/ g

  43. ( Y7 P1 x* l6 |) l2 ]
  44. #ifdef EDMA3_DEBUG
    ! L6 K4 B1 h0 U+ b4 a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ {1 v9 M" K" h( V) \! ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; ^5 y7 t; C* v. f; ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      Q% D* S7 J  c+ _# `) B. B
  48. #else- S, S) T3 m8 O9 @
  49. #define DMA_PRINTK( x... )' F$ V) z: [6 D, ]: z- P
  50. #define DMA_FN_IN
    4 {4 \# k; a% M7 y( W* u
  51. #define DMA_FN_OUT
    $ J0 y0 v; R/ d" O5 ~3 q* g
  52. #endif
    # D- T+ l( A- T5 C" h; t
  53. # G0 h3 H6 v, S: E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 p* p4 Y& ^" Y- T0 f
  55. #define STATIC_SHIFT                30 |4 [( z( c/ u7 j% ^3 a$ s! }! R
  56. #define TCINTEN_SHIFT               208 H  V  g2 b( y
  57. #define ITCINTEN_SHIFT              21) T, p' Z) w3 B
  58. #define TCCHEN_SHIFT                22
    - e7 s) N3 O, `
  59. #define ITCCHEN_SHIFT               23- r. w5 w3 b$ K# N6 W9 k/ U* U9 Q* E

  60.   T' A1 j7 A7 F2 r( n: ?& j% a5 K
  61. static volatile int irqraised1 = 0;
    . k3 r- q) r1 Q% r) Q) _- Q1 Q
  62. static volatile int irqraised2 = 0;- Y2 e; |1 ?' w, j& E5 I% L" c# s  q$ e
  63. % f5 t) t$ N1 G# Z6 m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , }+ {  C5 b2 t6 h  P# _3 W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 H' `/ `0 r7 i+ \& N7 y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ M: _8 w; n! Z2 x/ ?4 w; w

  67. 3 ]" j% P- M  S% {, e  i
  68. dma_addr_t dmaphyssrc1 = 0;3 p4 X3 Q3 U2 H: w- |8 a2 `' f
  69. dma_addr_t dmaphyssrc2 = 0;
    3 D0 X0 ?3 u+ N9 y& I
  70. dma_addr_t dmaphysdest1 = 0;
    - t& f) x) T& a
  71. dma_addr_t dmaphysdest2 = 0;
    : Q  {5 [( r6 \% G: H  c5 O
  72. % O5 o  y2 A' ~: u$ h! |
  73. char *dmabufsrc1 = NULL;+ ]" z$ C8 ^3 Y; p) Q
  74. char *dmabufsrc2 = NULL;
    / F/ ]$ Z6 A- z- c  O) ^0 D5 P
  75. char *dmabufdest1 = NULL;, @# d# a9 z5 Q2 A9 J6 K, u
  76. char *dmabufdest2 = NULL;
    0 `4 M1 r& b* J# Y
  77. * X. H1 K  U. H% A+ L
  78. static int acnt = 512;4 i0 Z( g% a$ T
  79. static int bcnt = 8;
    / T' M# q8 A  [5 q  Z
  80. static int ccnt = 8;
    9 T' x; O$ s* Q2 b3 r

  81. ) W3 l, T6 k, H# m
  82. module_param(acnt, int, S_IRUGO);, z  `" E5 J: \8 `& ^
  83. module_param(bcnt, int, S_IRUGO);
    5 r/ A8 B& ]0 K. R4 L+ V+ Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# z* Y  G% ]& E- ?7 h
  o& L  Z( |" w. i! `% p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! m: M5 b$ S# ?, t
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 z: |, ^# L$ ?& M* ^5 l     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: I( {& z5 U2 o( s' V) g6 [
, E# u* m" a' O; l9 E- P* T
0 q# d8 y9 ~* g' R  j4 w( M' q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-26 21:16 , Processed in 0.039933 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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