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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; @) N1 L6 s6 W- j# ^
  1. [code]EDMA sample test application: V0 y( P! s7 ~* E% b+ }& ?- j
  2. /*
    8 j, R0 P6 q3 K- v
  3. * edma_test.c
    . r! M# k% T- \0 @. }& L. ^
  4. *
    5 ]8 ]& ^$ ]4 ?1 z
  5. * brief  EDMA3 Test Application
    2 y% P8 i! d2 ?5 F2 B/ F& U1 L- r
  6. *+ }& |5 E" Y3 u' f& i+ M! t  w
  7. *   This file contains EDMA3 Test code.
    4 ^! {3 T+ E1 `) V( J
  8. *
    3 N, t) K- D: A) [# Q: U' e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) w1 \; ]' ~# R, t# o. L
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    * D0 A* ~( M  a" U
  11. *         TO CHANGE.5 n3 l% d6 O9 W
  12. *
    ) B: O" U/ Q1 I* ^& ^( V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) E' j) H2 S; n6 A1 K0 o5 D
  14. *
    ; n, b1 }9 Y! T+ ?9 |
  15. * This program is free software; you can redistribute it and/or
    . _' \# r6 w6 h
  16. * modify it under the terms of the GNU General Public License as
    : e+ W$ V( S" d8 Y3 d
  17. * published by the Free Software Foundation version 2.
    9 S, g. l0 h6 y
  18. *) C7 X8 n, f' Z# A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ |7 }7 b, H# ?* B$ m
  20. * kind, whether express or implied; without even the implied warranty
    % N1 U( D/ y( c; }' E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- i) }' ~, @. b3 \8 q3 l- M6 D; Z2 n
  22. * GNU General Public License for more details.0 w6 I! h, |$ N$ y1 }5 T* A
  23. */! K7 N: I# j2 {( I+ V

  24. + _; Y( V: l! R7 a$ t  j3 r7 E
  25. #include <linux/module.h>
    & O: B. H8 [! ?; k
  26. #include <linux/init.h>5 j2 Y+ I2 C+ f
  27. #include <linux/errno.h>
    : `$ J. k0 j# f$ _+ \
  28. #include <linux/types.h>
    . f" z: I5 e: S2 t% D! `
  29. #include <linux/interrupt.h>
    5 C; Y% O( G( ~( v' V/ R" |9 M. B
  30. #include <asm/io.h>5 L' k- q/ m6 ?8 B# W+ d
  31. #include <linux/moduleparam.h>
    ; S0 p7 r+ f3 R* z, d8 F
  32. #include <linux/sysctl.h>
    9 [$ e5 l- d* t: t# X
  33. #include <linux/mm.h>. q) Z0 s4 I6 y3 f. B
  34. #include <linux/dma-mapping.h>+ T* d* G# W' c. p; l3 [
  35. 2 X. S' t  ]2 i0 w
  36. #include <mach/memory.h># I' y" T( g- W( T8 Q8 D$ A
  37. #include <mach/hardware.h>
    ; \! U7 Z, X7 k, d; j
  38. #include <mach/irqs.h># V4 i: f# M# D
  39. #include <asm/hardware/edma.h>
    $ g( D/ o6 |, J' C: W7 W  b( ]; p

  40. 6 J" I* B+ V& O- _" y( Q! _% `: F( ^
  41. #undef EDMA3_DEBUG
    % H) y& f7 D( g6 w1 t. \/ {
  42. /*#define EDMA3_DEBUG*/
    ' m( d$ @! `) z$ y4 f5 s1 I" B0 G
  43. - d- `0 j* T1 Q" L% o
  44. #ifdef EDMA3_DEBUG. q; N8 s1 o- X2 X9 ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! n3 _' a5 ^# v- e! }0 K
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 R* r# G6 i  J0 O" T! @. R1 S
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 i+ J# a4 T; t7 @( @
  48. #else% w6 O- L% D3 t# a3 O3 E
  49. #define DMA_PRINTK( x... )( B' E7 {4 y& t: ~
  50. #define DMA_FN_IN
    8 G" n* O8 Z9 c/ S& l7 m. ~+ X
  51. #define DMA_FN_OUT
    5 [  s$ I' J- W3 U/ L1 v
  52. #endif
    8 I6 v  j* B$ M2 _
  53. % Y6 W7 j$ _$ F; |7 W4 U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ ^# S2 z3 n( ^4 L3 A$ C% Q2 u
  55. #define STATIC_SHIFT                3
    + S' C0 }  O6 ~9 m9 U- \
  56. #define TCINTEN_SHIFT               20  w7 X* a/ V$ v. I7 ?
  57. #define ITCINTEN_SHIFT              21
    * A# p: y, [9 f$ }2 {' ~3 \
  58. #define TCCHEN_SHIFT                22; Y' r' C0 a) ^$ m7 `  ?
  59. #define ITCCHEN_SHIFT               23* H$ h! W+ D% I! R6 p' m* |

  60. ! a! N! n- R: U; z0 }" w
  61. static volatile int irqraised1 = 0;
    1 L/ X  b9 [7 P/ q- W8 K' O; Y5 R
  62. static volatile int irqraised2 = 0;
    3 J% X4 p; L+ D9 W2 g6 T2 J; y

  63. - n- d. p5 s: \! h; Y2 ~; N4 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; j7 a" T6 }$ a1 d( t" i
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* ]; M# |' \( S1 \2 p: E" u
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & u. n& Z% [% A1 j
  67. * r0 l* h! {" ~5 E. q& G/ h. D) z: ~
  68. dma_addr_t dmaphyssrc1 = 0;
    0 M' G* f0 }! H3 B9 {( Q
  69. dma_addr_t dmaphyssrc2 = 0;9 H( p' m; F8 q  X: p& c
  70. dma_addr_t dmaphysdest1 = 0;1 z6 n4 R( |, j$ V
  71. dma_addr_t dmaphysdest2 = 0;6 }* g0 q2 Q4 P7 V- L5 i. o
  72. / x. g9 X; c/ ]" e' B
  73. char *dmabufsrc1 = NULL;: r7 I# h; @* @! g& X" n) B
  74. char *dmabufsrc2 = NULL;, P3 z; J) O7 E2 s& c% S# q8 r
  75. char *dmabufdest1 = NULL;
    6 G9 T: F% y* B8 K9 M5 c
  76. char *dmabufdest2 = NULL;" I5 Y! L  E8 H4 E+ T  E! N" D2 c' ^

  77. & F- C4 y' z6 {9 y3 ?) k8 Z
  78. static int acnt = 512;5 k0 i$ d: P% i) A& r) n3 P
  79. static int bcnt = 8;
    ' N7 ?) J- s, J1 a, l1 F: e5 G
  80. static int ccnt = 8;
    + \  C4 ]2 a+ _9 f$ x/ T

  81. + b& i" y2 z5 W
  82. module_param(acnt, int, S_IRUGO);
      |. o+ U0 c  a- m* A. x
  83. module_param(bcnt, int, S_IRUGO);7 r6 v$ N2 g8 A& p4 Q$ R" R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% E# j6 X- S6 J7 N( v3 r
7 V; [+ L( O9 U7 @% h. ]8 r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: r9 Z# l; j) I" e6 X3 J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% I/ F$ E3 z. @2 p0 n( W
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) {& ~+ `* v) b; ?1 y1 l1 P

' A1 X0 y# `: S: P6 m) ], w( ^
. [1 X- a+ [1 U3 r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-31 17:55 , Processed in 0.044704 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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