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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  e- T: l4 _; a' q' u! ?* ~9 t' [
  1. [code]EDMA sample test application# `4 i" }/ |, v5 Y2 a
  2. /*! L5 l) v2 w4 G* ?) j
  3. * edma_test.c4 o4 x: ~+ A- F
  4. *
    ; p2 J5 Q5 N2 o6 }! R5 K9 O' R
  5. * brief  EDMA3 Test Application
    0 N! A' {3 x: Z
  6. *
    & J& g: l5 E( h  ~8 ^; N( b
  7. *   This file contains EDMA3 Test code., }" I7 ?6 q1 t# k& e
  8. *: o9 ]) A( R7 c' |
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 G3 c3 R) Q/ |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 T8 `+ O! B/ P6 [! a% u  f# C/ d$ h
  11. *         TO CHANGE.
    , p; j/ s: P" S( H0 d/ n
  12. *
    & a4 j2 Q4 q% I: A5 N5 ]
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ! ~* N  k7 i' g8 w
  14. *
    / N. u; K8 I+ B. o0 }2 t8 T4 ^
  15. * This program is free software; you can redistribute it and/or
    $ S9 D0 g+ q- ~# V" b. C
  16. * modify it under the terms of the GNU General Public License as! }4 M( p9 F0 ?& k8 H8 u
  17. * published by the Free Software Foundation version 2.
    ( k2 g9 }. s# V5 G
  18. *
    : p' v1 E% \# _% N3 \
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 @! Z# b( w) @. q5 q9 _0 P( S
  20. * kind, whether express or implied; without even the implied warranty
    8 L, d  r7 \) `1 |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 `" n- p0 I* G0 P4 b+ h0 B
  22. * GNU General Public License for more details.
    % `5 t& x" A7 q0 U
  23. */
    8 i) h# E% w( i7 y
  24. + z! a+ _2 \4 K/ S
  25. #include <linux/module.h>
    ( {+ ]- M  V* E! E
  26. #include <linux/init.h>+ c! M" E1 k+ b. {0 [$ T# V- a
  27. #include <linux/errno.h>
    + l- G( ]2 m$ b; @% v  B
  28. #include <linux/types.h>/ B+ D% a: [( x0 G1 y, x: h. Q
  29. #include <linux/interrupt.h>
    , n- P9 W2 z: L3 t
  30. #include <asm/io.h>5 q8 ]. Q  ~1 H  |/ O. _3 f$ o9 }
  31. #include <linux/moduleparam.h>
    6 `3 p9 T2 C8 j$ d
  32. #include <linux/sysctl.h>
    & d& }) ~" W- C! E$ c7 z
  33. #include <linux/mm.h>
    ! g4 e) k; b/ e$ _
  34. #include <linux/dma-mapping.h>/ ^# C" L; l* t" X' V
  35. ! d; g( T1 j2 A0 p8 |
  36. #include <mach/memory.h>$ S  s0 z* b% o# L& k8 R# O
  37. #include <mach/hardware.h>, v% U% Z7 B# g3 C
  38. #include <mach/irqs.h>
    2 H8 b6 `5 q, Y! ]  p/ H. E
  39. #include <asm/hardware/edma.h>
    . n& K- p, Z: R; n: @1 p
  40. & }0 q7 p+ [7 T# I
  41. #undef EDMA3_DEBUG# T0 k6 o: Y/ X: [4 ?) I! A
  42. /*#define EDMA3_DEBUG*/
    1 E9 h8 D8 {# a# Y" w

  43. 0 J4 N: E2 J+ u: [. i5 X+ h
  44. #ifdef EDMA3_DEBUG
    , o# X" w* d* O. `9 K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! f1 j$ J. D1 t9 h  s6 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 A9 Z  l+ a, |9 K: t1 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( F( I, G1 K$ F4 W
  48. #else
    & Y" Q& @" [. B# h7 ~
  49. #define DMA_PRINTK( x... )7 I  H9 \$ E$ r  Y1 p
  50. #define DMA_FN_IN: J( P% T% q9 v& p1 p
  51. #define DMA_FN_OUT( q6 s' ?2 c2 D
  52. #endif
    ; G( g. E0 n$ q8 c6 C

  53. + E8 ?# M* I2 m% Y* H- G, ^* y( }1 V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + H- g( g* w/ ?4 p! V2 T" M
  55. #define STATIC_SHIFT                3+ i0 t5 `5 E$ s5 D4 n" m$ J: s( l
  56. #define TCINTEN_SHIFT               209 S, {% V) Y6 y8 E4 N- w
  57. #define ITCINTEN_SHIFT              21
    / M5 P8 s! n! @' M' F- l
  58. #define TCCHEN_SHIFT                228 T% X! R8 V7 @6 d, B: E# @
  59. #define ITCCHEN_SHIFT               23
    ! B2 u' Q6 a( x4 }' E/ T

  60. / t* ^+ S+ \4 C  I
  61. static volatile int irqraised1 = 0;
    " V- e% N" {( ]( ^2 K
  62. static volatile int irqraised2 = 0;; u: L6 D; P$ }
  63. 1 d6 i4 O/ N& p
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! x- z5 |6 j0 J8 B& m* n
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" ]  N, u. M! \8 O. F9 i
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ c/ ~! d  X- E% t) n

  67. 4 l8 }: f5 @( \  }
  68. dma_addr_t dmaphyssrc1 = 0;
      _" t  z0 M8 r$ |; W
  69. dma_addr_t dmaphyssrc2 = 0;: f9 @5 }& u% K% w4 F
  70. dma_addr_t dmaphysdest1 = 0;) F! D8 Z# G/ b
  71. dma_addr_t dmaphysdest2 = 0;
    & U& k8 B% ~% k7 W6 O/ d& y
  72. ' F7 Z) R/ [% G
  73. char *dmabufsrc1 = NULL;4 o1 q* g& u+ C1 o& G+ K: A
  74. char *dmabufsrc2 = NULL;
    $ G  i8 ^, b2 X0 I
  75. char *dmabufdest1 = NULL;1 m& N1 g/ L! ~
  76. char *dmabufdest2 = NULL;
    + [/ Z! x7 b. w
  77. ! j- F+ J6 n6 x+ o1 r3 G* B* D1 l5 B. Z
  78. static int acnt = 512;# T3 W6 T5 Q4 \8 T
  79. static int bcnt = 8;
    * Y; R! Y: q! R; ?3 V* I
  80. static int ccnt = 8;! t8 k% L/ F5 d  K
  81.   k0 N, Q5 v" D' S1 x+ {2 a% v  h
  82. module_param(acnt, int, S_IRUGO);
    ! O& y' `1 Q; d& v% R* S
  83. module_param(bcnt, int, S_IRUGO);0 R% V6 U' T- e; z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, t/ g' Q3 g  S! }# [1 l
6 b3 W3 p2 G# w" j! m+ P0 O' ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 V) ~: R. d+ d$ W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 z; b8 n. K6 @7 v$ a     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。7 Z+ J9 Q) m/ G' {

* M1 V, N6 v% _8 R; i* U$ {* @3 l# p. [, ?% }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-22 19:57 , Processed in 0.040527 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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