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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % K) ~  j% ]! M7 ^
  1. [code]EDMA sample test application
    $ q. S: b$ }1 ]# L6 W. ~8 F4 C# W
  2. /*' T' @: F7 z( u- Q7 l
  3. * edma_test.c
    6 d& t$ @& P9 h
  4. *
    4 I6 X6 T9 r% a1 Q3 {) b5 L
  5. * brief  EDMA3 Test Application' x4 C  q. X, A; i. S0 e! j% l  [' _
  6. *
    , m* f% w: j, k& ^
  7. *   This file contains EDMA3 Test code.
    " @6 N9 g% a% _- n* B
  8. *
    3 R- i% b3 L: @( {3 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    2 K3 q. C4 {0 d2 u- y" \. }0 B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 a% M: m3 L* u) Q6 c- j5 Q
  11. *         TO CHANGE.
    * o5 N/ q/ E7 y
  12. *
    $ X  t7 _: I/ W8 g3 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    & M+ H% B; R% m" [3 k. m
  14. *
    + y! Z" L" w$ B: B8 y" C
  15. * This program is free software; you can redistribute it and/or
    , |: u& R1 E3 w  l: Z
  16. * modify it under the terms of the GNU General Public License as
    & V( }: H+ V4 ?
  17. * published by the Free Software Foundation version 2.
    ; U5 \5 o! p* k, }
  18. *4 I+ \: x  i- w7 K! q" A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ [3 ]% V9 K6 Y+ Q
  20. * kind, whether express or implied; without even the implied warranty: E* d. j5 w! N8 x; T& F& R9 z1 o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3 V( n% \) M/ e
  22. * GNU General Public License for more details.- j7 T# ^' p! D/ K: g/ D$ E
  23. */
    0 B' N5 M+ h- }: Z
  24. & g4 z3 j* q  t5 K3 h# G6 z
  25. #include <linux/module.h>8 [8 v8 K: R+ x: E3 ~5 ~8 G+ J
  26. #include <linux/init.h>
    3 g0 a) J/ \! V& c5 ]! v6 q, j+ U) u# c
  27. #include <linux/errno.h>
    ' k  e- B0 ^+ D4 o
  28. #include <linux/types.h>
    5 V/ A  T: n- y1 n( M( C! u; b5 b
  29. #include <linux/interrupt.h>
    $ }& d5 P  q) B+ Y! L( a' b: r
  30. #include <asm/io.h>
    7 G% z, o1 M$ C/ T$ u, v
  31. #include <linux/moduleparam.h>
    % X4 W; L( N! s8 o- Q% a
  32. #include <linux/sysctl.h>; R# B3 ^0 b  t3 d2 ?: m5 _( r: v# O
  33. #include <linux/mm.h>9 s( a( v$ O1 q  R1 n0 ^
  34. #include <linux/dma-mapping.h>
    : ^5 M2 g$ A6 t9 e7 S/ N5 J
  35. ' m, P: f/ P: _
  36. #include <mach/memory.h>
    % f, f) y; l1 ]/ W5 J
  37. #include <mach/hardware.h>! h: g# C/ l! h6 L9 E# N9 S
  38. #include <mach/irqs.h>
    ! X+ [$ V( Z& |7 v9 M& \+ }5 y
  39. #include <asm/hardware/edma.h>
    $ m4 z5 Y- k( K' c  f  w
  40. ) }0 t, o, g- a# J% }
  41. #undef EDMA3_DEBUG
    ; n% B( z3 Q6 u1 Q/ {  G/ X
  42. /*#define EDMA3_DEBUG*/
    4 H) J2 z( i, x* D
  43. ; [6 |0 g, _/ W( i( [
  44. #ifdef EDMA3_DEBUG
    . ^9 m  I* B4 t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 R$ U# _1 |: {3 W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" y- l' _# ^/ J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)4 ]6 ^0 t* a+ @* A4 h6 \) h- `
  48. #else/ v. ?+ w) A1 x
  49. #define DMA_PRINTK( x... )
    4 |% z" f* {1 ^# ]$ X1 }
  50. #define DMA_FN_IN* n1 P8 \7 F+ o* M, ~
  51. #define DMA_FN_OUT$ Z$ I- q0 d6 P$ C
  52. #endif7 n* L' M- M0 _  d  g5 X
  53. : M' {3 _1 l4 H; C! `& o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 X1 z+ P" f3 D' |; }
  55. #define STATIC_SHIFT                3. G- c/ P) x* G3 m, _
  56. #define TCINTEN_SHIFT               20& G9 {2 t& k4 R
  57. #define ITCINTEN_SHIFT              21
    8 F; E! T) B/ U+ B4 K
  58. #define TCCHEN_SHIFT                226 z7 W' B6 z  }
  59. #define ITCCHEN_SHIFT               23
    ! r8 ~# }+ q; d6 ^, E$ i" v; Y2 {

  60. ) e& h* B, ~0 ?9 e1 y0 L
  61. static volatile int irqraised1 = 0;  r  b# R* k; m: J$ ~0 i
  62. static volatile int irqraised2 = 0;
    + W, H8 H: h0 [1 N7 Y! d2 x3 f1 v
  63. ; p7 \; @. G6 b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 Q9 r. c- @0 A: A# A; \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ C6 D9 I3 T% _( }- \. W  T5 F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, t4 I4 H1 S+ b- {% @1 C7 F

  67. 9 c6 ?4 U( Z- k
  68. dma_addr_t dmaphyssrc1 = 0;$ e6 N! k# z. l( M* [
  69. dma_addr_t dmaphyssrc2 = 0;! K  K  H& f0 L  |- [8 U
  70. dma_addr_t dmaphysdest1 = 0;
    2 m$ c- ~4 ]; N+ M, ]5 @8 L0 Q
  71. dma_addr_t dmaphysdest2 = 0;" o1 E9 Z& G0 f% q( j( N2 x
  72. 8 S: }; O; t* c' ~3 }9 W" g" g8 V
  73. char *dmabufsrc1 = NULL;$ O" _1 {8 J' n9 z+ h
  74. char *dmabufsrc2 = NULL;0 R5 \# k3 z$ }8 p7 o' B
  75. char *dmabufdest1 = NULL;. S, ]" }! f7 a& h" F/ v
  76. char *dmabufdest2 = NULL;
    / o  e: g! n2 k$ c1 B

  77. * U9 O! ^; e* ?9 B5 [+ `! N
  78. static int acnt = 512;
    - b* w+ P8 i" K! `5 `
  79. static int bcnt = 8;2 A- e, p- a# _+ I' `
  80. static int ccnt = 8;
    2 {, D9 C& {+ k' \1 }: T  ?
  81. + W" _" u; W: L: W( ^- w, w! s# |
  82. module_param(acnt, int, S_IRUGO);
    $ z1 V3 A- M! ]* `  \; [0 U- x- B
  83. module_param(bcnt, int, S_IRUGO);
    - t# r& f  \" w+ i1 k8 r
  84. module_param(ccnt, int, S_IRUGO);
复制代码
+ T2 e( x1 y  T; g0 j
9 J& g) b8 l. N2 w1 W
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# J4 r% J, W  b% }. E$ H7 B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* b# @0 O. h) ]2 N7 o4 M% {1 |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
8 X1 x; [; n) D3 P( [) ?5 Z& [2 ~# y( e7 [7 V
( |6 p2 M; J- H9 p) A6 f* G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-24 05:57 , Processed in 0.038484 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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