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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . S& Y" i" ^9 i  q5 N1 }! Q' k1 i
  1. [code]EDMA sample test application
    % e0 e( n8 f$ g2 w. Q/ Q0 S
  2. /*
    " O& k* o# A) O; O4 B
  3. * edma_test.c6 O7 b0 W( e! H) q
  4. *
      _* f% F! b' q
  5. * brief  EDMA3 Test Application' _8 l1 |, }, q* n; r3 f" d- [
  6. *! s$ z; C/ k% q& B5 w, D' {
  7. *   This file contains EDMA3 Test code.6 U9 x8 ^3 }$ u, W! Z  k3 |
  8. *
    ! w4 j7 J- C0 Z6 ^8 t$ \$ \+ M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 t9 P) b- N& K2 X7 S* p) }1 I( a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      c$ R3 Q& {* n3 ]; `; u
  11. *         TO CHANGE.: H. p' [0 ?3 D! W5 y% X
  12. *
    / w6 n. o$ g- ]+ `' V) f/ n5 h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: g, U5 W  d4 _3 w
  14. *
    - W% f, O/ x3 z& n% r
  15. * This program is free software; you can redistribute it and/or! A' @. p- Q8 |! i- f# p) T
  16. * modify it under the terms of the GNU General Public License as
    % s% t2 @4 q  ]3 ~
  17. * published by the Free Software Foundation version 2.
    5 [  S& K+ G$ U7 H  T$ q
  18. *
    9 T* k/ |! A1 M! O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 k' Y8 ^% f# ?) q3 I7 i& ?# t) O
  20. * kind, whether express or implied; without even the implied warranty# Q+ r& I4 F2 x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" S# L- T# t# @! |8 X) v5 @8 {
  22. * GNU General Public License for more details.
      J1 G/ F! a. L6 K
  23. */
    / a6 T$ ~  t) Q4 ~, R* Z3 t

  24. " G" j5 Z4 n' @" D0 Z2 p% [4 e
  25. #include <linux/module.h>
    3 x1 Y- N3 g* u2 ?  p+ |+ _( p% |" g+ p
  26. #include <linux/init.h>
    3 q, R9 B( u; e/ j
  27. #include <linux/errno.h>
    $ o5 K( y9 Q4 E/ ^* m1 d. V
  28. #include <linux/types.h>
    # T& ]0 E; V) ]5 f: A0 F7 L
  29. #include <linux/interrupt.h>2 N( M) P1 [/ s" G, V
  30. #include <asm/io.h>  Q2 q2 j& R' Z" o$ H2 r
  31. #include <linux/moduleparam.h>! m# q/ k) B/ r8 ^6 d3 l: t. W
  32. #include <linux/sysctl.h>6 v: z. q: s' s8 V" T
  33. #include <linux/mm.h>( b; U1 S2 E3 B1 g' s5 {- c
  34. #include <linux/dma-mapping.h>4 V# s/ e+ r  c1 \9 }  p, {
  35. ' g* ~& x6 q6 q7 O
  36. #include <mach/memory.h>' r. r% N# \* z6 s) A- h
  37. #include <mach/hardware.h>
    0 a3 C) B( ^( L5 |" d, e6 A
  38. #include <mach/irqs.h>
    7 Q+ q. u3 ?9 `  l/ q. \7 [
  39. #include <asm/hardware/edma.h>: a; a1 o; H9 U* l+ ], D9 H$ d

  40. * r- P! v% K; R
  41. #undef EDMA3_DEBUG
    . {9 F0 O% [; f4 H3 N# Q
  42. /*#define EDMA3_DEBUG*/# b3 F1 L: n- h

  43. 6 x  a6 @2 d& z( _+ D
  44. #ifdef EDMA3_DEBUG7 n3 T2 z, e4 s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + ^' s: k) ]( v) E" V, J$ N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), ]1 P8 N6 N& h, ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); N' a2 Q6 R! q3 r
  48. #else$ E5 q# ], m* Q2 m) t3 b2 s9 g
  49. #define DMA_PRINTK( x... ), Z. C. ]7 e8 [- T1 N' u* r
  50. #define DMA_FN_IN
    0 S3 e( L! m+ F6 D
  51. #define DMA_FN_OUT8 k! S; L% t  L
  52. #endif
    $ a) N; O7 \8 s, U$ q

  53. 9 ~  |( B  n: q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); U4 n- e2 F- K. g$ W! x; ~9 v
  55. #define STATIC_SHIFT                3: J! G" g/ h* j1 e- \
  56. #define TCINTEN_SHIFT               205 D' G- |& y) q
  57. #define ITCINTEN_SHIFT              218 f$ t1 P* u4 ]# n3 J: x- H9 Y' ]. n
  58. #define TCCHEN_SHIFT                22
    . ?& K/ |  j  _7 X
  59. #define ITCCHEN_SHIFT               238 F/ z/ v: x* V4 S1 r+ i

  60. 5 t. y0 M- h5 o  f. n/ C
  61. static volatile int irqraised1 = 0;
    1 j* M' n1 \/ Y( x
  62. static volatile int irqraised2 = 0;
    9 |% S9 }2 {/ K0 `+ I  I
  63. : a4 V& h) j; u, D* N
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! g  r+ ]  \" G. Y1 p/ H9 j
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + A2 k$ E+ Y: ]$ N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! T7 @  R2 A9 ?9 W$ l5 l
  67. 3 t8 r6 J1 c% T/ \& c' f4 E7 x* Y
  68. dma_addr_t dmaphyssrc1 = 0;0 u8 X0 I( G, z) Q& U% t
  69. dma_addr_t dmaphyssrc2 = 0;
    ( J. T& s) `  t0 G5 P
  70. dma_addr_t dmaphysdest1 = 0;
    ' j- {- Z; C. j: c5 c
  71. dma_addr_t dmaphysdest2 = 0;
    . Y! `3 S4 [- N% G5 R, O
  72. 4 u( p" A9 T8 d' R
  73. char *dmabufsrc1 = NULL;, d7 q$ @3 A' x. f/ H! m
  74. char *dmabufsrc2 = NULL;
    1 p  w6 ^& N/ b1 ~
  75. char *dmabufdest1 = NULL;
    % R$ R5 p/ _8 y- d
  76. char *dmabufdest2 = NULL;' N* r/ k( ]. k2 h1 J
  77. ! m/ ?* W5 d9 x! i# P5 e+ Q: P
  78. static int acnt = 512;
    5 g$ f. }, h! ^
  79. static int bcnt = 8;
    4 |! b0 P: `0 U, h
  80. static int ccnt = 8;, w7 o5 `+ D/ C0 G8 V8 J
  81.   b7 Z  w/ \) o, d/ K- I
  82. module_param(acnt, int, S_IRUGO);1 b* x7 b+ k0 z* O' N
  83. module_param(bcnt, int, S_IRUGO);/ H0 }  X0 x& _5 T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 h  T3 {8 a. r& e. m7 ^( g! |- l, j, |! H
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ J2 H$ M1 C/ _) x( ~7 _5 z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ U: {+ ~+ i' X
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ ?3 B" O8 b% t+ e( V# d1 Y
0 C, b1 y9 V- [( Q
: P; D. n6 _* ]4 v4 p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-1 15:39 , Processed in 0.048418 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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