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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 Z: W4 p. j! O1 u3 v+ _
  1. [code]EDMA sample test application4 ?% b* ~# V3 ^, o! s# s
  2. /*+ _, i! [6 h/ U2 @( t! Q+ u5 |1 A# p
  3. * edma_test.c8 n6 F3 k8 L" k) L, J! W$ O
  4. *
    9 X/ c" C) L4 O, H) Q. [
  5. * brief  EDMA3 Test Application
    7 @8 |7 M9 m+ X5 b6 v( ~& D
  6. *0 l9 Z4 C$ I+ z$ U
  7. *   This file contains EDMA3 Test code.
    + B- X1 j0 \* t+ `2 i4 x6 W5 w
  8. *+ `! k# C7 l3 v1 M* Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ! \4 ]. s1 a& U# A7 e: A9 w1 D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 y( V0 A* T9 \
  11. *         TO CHANGE.
    , Q& q: V* |9 |1 i
  12. *
    ; r) t3 M  r1 @( N/ F" y% m& _8 [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) t9 _0 B, N- ]8 G
  14. *; m* w1 }( C) \5 L
  15. * This program is free software; you can redistribute it and/or: s% b; F8 b1 K# ]; {4 ]
  16. * modify it under the terms of the GNU General Public License as
    7 J/ `/ \6 M* n  N1 _
  17. * published by the Free Software Foundation version 2.* a" s% Z9 H4 m- ~
  18. *
    # ?. _& ]" S6 r
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    + P7 Z! ?# |& O  m! U! w
  20. * kind, whether express or implied; without even the implied warranty
    , L# F, p/ t4 s, {- a3 Q) {6 V- P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the5 y2 q4 ^, Z7 w. r8 n( m$ K0 _
  22. * GNU General Public License for more details.* J  l5 }3 V! }# L; h
  23. */
    5 ?) l7 ~, |0 A# D8 L+ [
  24. - n) ~, [. T0 G0 [
  25. #include <linux/module.h>  F5 z" v3 D/ i0 E' L! t  ?9 M
  26. #include <linux/init.h>0 I8 O( C/ w+ S4 ~" D/ M
  27. #include <linux/errno.h>
    6 k7 j' J4 \3 F: L& P0 U
  28. #include <linux/types.h>
    9 I* r: m& x; h% n0 i/ z* v$ V+ K
  29. #include <linux/interrupt.h>
    # _! }7 |; A1 i3 \, z
  30. #include <asm/io.h>
    ! M* V0 w" \* S/ u' O5 u1 B* o6 @
  31. #include <linux/moduleparam.h>
    3 Z& Z) q: D5 h. A9 M  @8 R: V3 s
  32. #include <linux/sysctl.h>
    $ a& t5 E) j7 Z+ D+ o1 @0 G1 x
  33. #include <linux/mm.h>
    ) n  s; n. d! U2 z. y" D
  34. #include <linux/dma-mapping.h>0 |$ l- {! ?$ i4 ~7 |

  35. 9 Y& m4 v' M8 {7 N+ n0 C0 _0 M
  36. #include <mach/memory.h>
    " h' e7 V/ a- \& [8 a: w0 B
  37. #include <mach/hardware.h>
    6 }8 n; m% L9 [8 R" R2 L
  38. #include <mach/irqs.h>
    , G- x5 _2 z8 m* X+ n) z
  39. #include <asm/hardware/edma.h>
    - v2 h+ V1 l+ ?# j/ e$ f3 g
  40. 5 f+ X& F; m: ?5 C4 j. j
  41. #undef EDMA3_DEBUG4 {( O2 r- {. l; c& u1 S
  42. /*#define EDMA3_DEBUG*/& @6 u$ c* q) W) k! z

  43. 2 i& B/ o) b5 ~( b+ Z9 k! B
  44. #ifdef EDMA3_DEBUG0 z8 z: ], J' D: n& {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , {) V! r; P9 W) k$ c9 f& N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 i2 v! M; S+ Z' g. z/ b% u2 _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    9 o6 \9 `6 C( G1 k+ a5 K
  48. #else: s; z- T: z! e& V; D
  49. #define DMA_PRINTK( x... )
    0 H7 A: K7 M/ D. v7 N- F) p
  50. #define DMA_FN_IN
    - r+ |5 L; |/ T* y% X
  51. #define DMA_FN_OUT
    & k& m+ i& T) D0 T( O) w
  52. #endif' E9 Z1 t+ A' @. i& t3 Y8 d4 w, s

  53. ; J# E# I8 I  Q# d0 a3 e: X
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ' A6 V+ w* O0 c5 U! E. U( W. U+ h7 Q
  55. #define STATIC_SHIFT                3$ A( U/ A: t) ]
  56. #define TCINTEN_SHIFT               20
    + V5 {2 M/ O) w  _, W0 F6 `% [
  57. #define ITCINTEN_SHIFT              21
    : l! {* `/ t" {  S, v: a4 _( Z; A
  58. #define TCCHEN_SHIFT                22
    + W7 ]/ T- X# L9 j8 i6 x# _
  59. #define ITCCHEN_SHIFT               23( K# i0 t6 A3 e# H
  60. % }) |' w  K4 V! e5 p4 R7 ^
  61. static volatile int irqraised1 = 0;
    ! h( Z: Z1 f6 Y4 V
  62. static volatile int irqraised2 = 0;  y/ R  @2 Z) w9 G
  63. . ]9 V) H0 Q+ ~7 b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % |5 m' v; X* Q  x: |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);2 T$ t6 q' K2 H4 K7 Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' R- i$ {% A! ]* G+ p- ?

  67. 6 s9 s1 L0 z( v
  68. dma_addr_t dmaphyssrc1 = 0;
    9 W% U/ _. |+ p2 }
  69. dma_addr_t dmaphyssrc2 = 0;/ I5 e* C5 k4 l# R+ e7 x6 o, Z
  70. dma_addr_t dmaphysdest1 = 0;
    / \/ m/ o& U3 L3 N* k
  71. dma_addr_t dmaphysdest2 = 0;. N7 s1 o" r# B" S& d

  72. 4 f5 w. |) Z7 ?; C) A2 n
  73. char *dmabufsrc1 = NULL;; q8 G# y, l* R/ ~# Y! s0 M4 z; }
  74. char *dmabufsrc2 = NULL;, q& e0 Y9 B; D
  75. char *dmabufdest1 = NULL;
    , x5 h( m6 C& ^
  76. char *dmabufdest2 = NULL;
    0 P; U# V( J% {5 {* O3 h$ D" d
  77. " g. x2 t5 ^6 y* G+ c9 F9 H/ ?
  78. static int acnt = 512;
      G. G4 V# s# W$ y  l
  79. static int bcnt = 8;# m9 n5 [5 Y! j) l- R
  80. static int ccnt = 8;* P* V( ^9 p! \- _+ e
  81. 1 N$ s4 F& `7 y  g, T
  82. module_param(acnt, int, S_IRUGO);9 T: `+ g& _4 L, [' a
  83. module_param(bcnt, int, S_IRUGO);
    5 u3 t- {6 A4 ^0 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 @8 C7 i* K. l. j+ ~) ~4 Q. O' x: b9 I# V  ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ p* }' _6 [: i/ I0 p
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 Q/ R  Q- e. n( h5 A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 [4 r! u, {* q/ F( h

7 X1 X3 o3 D" i4 x* ^* O# d! j# [2 t( {
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-7 01:14 , Processed in 0.041281 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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