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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / V. L, j1 j0 b  w( M' v, f
  1. [code]EDMA sample test application
    2 K4 G( T. p3 B- h7 p! P" m
  2. /*
    + L; g7 |' I# B0 Q* x0 v% Q! P4 t# L
  3. * edma_test.c6 y  e9 |7 O5 w  ^
  4. *8 e1 U; P. {+ }
  5. * brief  EDMA3 Test Application* x6 S/ @; A4 u
  6. *! ]9 R1 X6 U% }0 h" b6 f
  7. *   This file contains EDMA3 Test code.0 v* m/ {8 m% E" r1 [+ B$ y- {  ~' S$ o
  8. *. C7 ]8 m) M! V! ~" t2 p1 P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , C, a: R& {- }1 w# X/ j% Z( t+ a
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( D7 }. \# ?8 g) a7 X1 @9 J4 N
  11. *         TO CHANGE.
    9 p& O4 O6 B! O* C! _0 |4 |
  12. *
    & B2 h& m* R: W2 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( ?: w. R. X  [6 r9 P
  14. *
    9 |5 f! k) y. O! s
  15. * This program is free software; you can redistribute it and/or
    9 S; S) a  b% S1 X+ y1 M3 B3 u0 v
  16. * modify it under the terms of the GNU General Public License as: _0 p$ a4 x1 R7 v; d
  17. * published by the Free Software Foundation version 2.! Z. u4 l* q; @3 a8 \2 }* i& s
  18. */ z  a/ L. C" `, z1 U
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - {% R! E. N# f8 f
  20. * kind, whether express or implied; without even the implied warranty
    " Z6 @' h; @# H
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 x+ ^- t" _/ Z8 h
  22. * GNU General Public License for more details.2 A( E% }% a, s& x" {5 Q
  23. */" B" i! T# L+ E$ ]2 G; |. E

  24. 5 P1 I; c  [$ t  ]+ m9 [
  25. #include <linux/module.h>
    % E" o& w5 d. N# r/ u1 _
  26. #include <linux/init.h>
    0 i7 z- a7 [& S! s1 ?  e0 l; h4 f
  27. #include <linux/errno.h>
    . M! y- D$ x+ _  J
  28. #include <linux/types.h>  W% H, _' B; }3 e: V4 m" Y, r+ I' `
  29. #include <linux/interrupt.h>& P$ m: ~9 S. x1 n, [
  30. #include <asm/io.h>+ r9 R+ F9 c- z, P8 K" B& V! E
  31. #include <linux/moduleparam.h>6 Z& O, Q2 V, k& B5 o- }
  32. #include <linux/sysctl.h>% T2 s9 e& d  G, ^) U- k
  33. #include <linux/mm.h>) v3 g: \# d' H( `% @. v
  34. #include <linux/dma-mapping.h>
    ; z2 o9 C6 \! H3 R% X6 P- R

  35. # ^& H8 F; j6 Y6 P+ {
  36. #include <mach/memory.h>
    . N* j- z$ {2 i' [8 T/ k0 r3 `
  37. #include <mach/hardware.h>6 L- D/ r! ]2 q; `, I& E' F% O
  38. #include <mach/irqs.h>
    : `% b5 f. T! _% N) g7 g
  39. #include <asm/hardware/edma.h>4 g) ^' ^! {* {, N, y5 {

  40. 5 @# Y; x* {  T+ O
  41. #undef EDMA3_DEBUG! j7 i$ y+ t0 E
  42. /*#define EDMA3_DEBUG*/0 @) w- I; L! p8 C2 Z# W9 e1 l

  43. - V& n- X9 N9 x- @2 v
  44. #ifdef EDMA3_DEBUG
    4 X2 v. C- A3 M0 |& a3 r
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    - b6 Y9 [& f) s+ d, A) O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 g* Q' O9 I9 a; ~3 O. g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! u7 E! P7 b. m- b
  48. #else
    % U* ?  h1 g; S3 G5 D
  49. #define DMA_PRINTK( x... )
    - T0 D& n/ _' J+ V
  50. #define DMA_FN_IN
    7 R( L3 m2 P& J6 I! a
  51. #define DMA_FN_OUT
    " [2 q; w  @3 g: i/ v. w4 c
  52. #endif
    3 E' p# g  u2 U7 v/ h

  53. ) ]# R& `& D6 \1 _
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    2 v3 A: C; m( L& C
  55. #define STATIC_SHIFT                3
    / \. K7 c; }  [# |
  56. #define TCINTEN_SHIFT               20; [0 I7 b% N! @0 r; P9 [
  57. #define ITCINTEN_SHIFT              21: y( j* ]& x$ A0 I6 q" X7 |. C9 t
  58. #define TCCHEN_SHIFT                22* U: S7 y' [9 ?4 \- i: F$ M
  59. #define ITCCHEN_SHIFT               23% m* a; b! R1 R8 D

  60. / L  W$ _6 q1 E! M, G$ q; [5 m
  61. static volatile int irqraised1 = 0;4 Q" V3 g- B5 u, @% J
  62. static volatile int irqraised2 = 0;
    4 u0 L) }: G) W0 Y4 E$ W- C
  63. . M# U' D0 F+ H/ L) S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 l) p9 w8 v! Y, l& `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( @5 J; t3 e" b2 J. T& w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 D, V+ I7 J. D8 A( x# R* I6 w
  67. ! X( k1 d2 S  v) H
  68. dma_addr_t dmaphyssrc1 = 0;% R- O8 f. B; {9 c
  69. dma_addr_t dmaphyssrc2 = 0;
    . ^8 m8 x  r$ k  w! R9 N6 Q
  70. dma_addr_t dmaphysdest1 = 0;
    ; y; I) h! r1 g& w- _  t( [
  71. dma_addr_t dmaphysdest2 = 0;" `  z& g% _% i( G- o

  72. $ E: y- ?1 z1 K5 P  y) {
  73. char *dmabufsrc1 = NULL;
      l' [* Y9 y/ V
  74. char *dmabufsrc2 = NULL;
    ; O% @+ |7 u5 f' Y7 U. c
  75. char *dmabufdest1 = NULL;, @3 F4 O. [* Q" F" N
  76. char *dmabufdest2 = NULL;& M$ u2 e9 e/ b  I6 F

  77. 0 A& t8 _1 n( @4 L
  78. static int acnt = 512;! c& s" q9 x) A6 A8 A8 P' v
  79. static int bcnt = 8;4 F3 h, T2 [6 I0 y* j( P
  80. static int ccnt = 8;
    : ]+ h0 X' P" O
  81. 3 k( {! j6 c3 t+ `0 n
  82. module_param(acnt, int, S_IRUGO);
    + c5 G. \' r* U& h
  83. module_param(bcnt, int, S_IRUGO);
    % I  i/ V1 ]( O  g9 Y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" r# p( W& D6 `9 R, H' g
# k0 \7 F4 Y/ C  b5 W9 T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ t5 R; n: b1 O7 K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 U! j  F) w* h& o, K$ C; n. N     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; L4 @) S4 n6 m+ P: _) L8 g; y9 f) z8 L  P4 c2 r
8 z& O  L) `/ h; R: Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-21 16:18 , Processed in 0.038627 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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