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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% s- g7 f8 a1 u; [. n8 Y7 t8 j
  1. [code]EDMA sample test application5 L! A$ }( |' s! b  w
  2. /*
    3 ~1 O3 o+ d/ s7 d1 o  _" `
  3. * edma_test.c- u; U2 C+ }8 T) W; ]8 Y& r9 n
  4. *
    5 Z; R0 i4 L; p3 X/ a4 e
  5. * brief  EDMA3 Test Application0 M7 o1 l7 @* s0 F& e8 Q" ^( m- y7 H
  6. *
    ) j$ J2 w1 L) I8 f7 ?3 @
  7. *   This file contains EDMA3 Test code.: z- {) i. g0 Z2 o
  8. *6 N& b" \" k  A" G: p  ^! @2 t, P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ Z5 ?7 _' j0 G( E  s+ X0 c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# r- j: g) _5 ^
  11. *         TO CHANGE." V' }3 B  _$ A+ x
  12. *. P8 {+ d7 Y: @2 f. d9 g5 T) f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , Y$ [$ o/ j! Y4 R% `4 T
  14. *
    # H7 P0 C2 Y" ^; X
  15. * This program is free software; you can redistribute it and/or
    7 R, w) b& J" L! f* t
  16. * modify it under the terms of the GNU General Public License as8 ]! t& b) I- h0 Y
  17. * published by the Free Software Foundation version 2.9 i+ z. w# U. H6 v  m. {: i
  18. *
    / R+ T6 c; K1 B9 i+ L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 u8 m" g3 Z' f& S
  20. * kind, whether express or implied; without even the implied warranty( Q" W2 }9 ~0 J- C
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : a: c$ V" ~# H; t4 K) `1 k
  22. * GNU General Public License for more details.# k' a6 V/ V3 E$ R; ^  H
  23. */0 [, D, _/ p9 G' H: Y0 O8 C
  24. 3 Y' P2 I5 ~$ t
  25. #include <linux/module.h>- t" z0 z2 h2 ?/ b
  26. #include <linux/init.h># H: F$ M- K# ], T5 }
  27. #include <linux/errno.h>
    7 e7 @! W, q" u( ?1 c- o: h, X1 g
  28. #include <linux/types.h>
    , L4 s+ }% l- w) F8 O# c0 Q3 S" u' _
  29. #include <linux/interrupt.h>
    3 I- k3 q( w* v$ i: f2 Y8 ^& S1 |
  30. #include <asm/io.h>
    2 R0 v/ n3 m6 N9 N/ _( D- p
  31. #include <linux/moduleparam.h>0 p; g# S: D! h' x+ Y
  32. #include <linux/sysctl.h>
    8 @$ K5 ]7 z* j' C$ y' |& T; Y
  33. #include <linux/mm.h>
    4 ?$ G  p5 G4 v% ~+ Y0 S# f
  34. #include <linux/dma-mapping.h>0 _% `$ }- Y8 d5 `! r: R6 h3 n0 q  z
  35. 5 ?1 l) s0 U0 [" ~  `
  36. #include <mach/memory.h>
    - y* ~. T) X, z
  37. #include <mach/hardware.h>. u' [/ O# u7 ~) @: @" K# j
  38. #include <mach/irqs.h>
    3 i& g7 }- b, r5 o9 V* h8 i
  39. #include <asm/hardware/edma.h>
    4 x0 j4 U8 o. U/ Y+ e0 o

  40. $ Q8 t7 }" P: Q9 N! ?* k8 t/ Q0 ]
  41. #undef EDMA3_DEBUG
    7 i" O+ C+ }. ?! b9 O7 ?; r
  42. /*#define EDMA3_DEBUG*/
    4 I/ T3 C* Q& d

  43. # h) M# r1 C1 A! f/ N
  44. #ifdef EDMA3_DEBUG5 y+ L9 w7 c6 O( Q$ I& `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + h  B! i% X( A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 }2 H* K3 G5 \: w. p" `4 y& X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). W. B9 L8 |; `4 t! X" t9 V# X" M
  48. #else/ E9 M5 }2 N( V# A  V2 _  t
  49. #define DMA_PRINTK( x... ). l0 `% F6 D. F
  50. #define DMA_FN_IN
    - S' D) g" W* E1 \3 [% U; _9 a! W
  51. #define DMA_FN_OUT! Y( p% _" V) J  e7 f& Y6 _
  52. #endif
    , }; U2 {; s* f( h" H. ]! |; D

  53. 6 k& r* m5 H& n. x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    4 e7 c; o: y( G: X$ o+ y1 s9 Y4 ?
  55. #define STATIC_SHIFT                3: a* ?% c6 u& V7 h7 f( r' v
  56. #define TCINTEN_SHIFT               201 G- B& u4 w4 M- J2 `! J/ N
  57. #define ITCINTEN_SHIFT              21- s# y7 f! W! ?* J
  58. #define TCCHEN_SHIFT                22
    $ [% Q' G# M" L! h
  59. #define ITCCHEN_SHIFT               23
    4 R0 d( c$ j, v: I) m
  60. " f. K$ ]8 v0 |- F+ E  o
  61. static volatile int irqraised1 = 0;
    * s# v! X7 J, t. M( q& j' e; a
  62. static volatile int irqraised2 = 0;
    8 Y9 O9 w) U3 _# R+ A
  63. 1 p' Q$ B0 J0 `- k( _# |9 c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 e# `0 I6 e* X% E4 Q1 f% I1 L- O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 z1 U# U$ v# }7 O) @- }
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% d& Q6 x- I9 P* D
  67. 6 }( H1 P8 p2 y* b5 `( B9 c- H
  68. dma_addr_t dmaphyssrc1 = 0;
    ( x8 I% L1 @! d" |+ i: l8 o9 X
  69. dma_addr_t dmaphyssrc2 = 0;; d) P: }0 a* U$ s" U
  70. dma_addr_t dmaphysdest1 = 0;
    : s/ k( B) m# m( R' ?9 l
  71. dma_addr_t dmaphysdest2 = 0;
    " L/ d- j% C: I6 v, G. k
  72. # J; F5 M& l$ u; }! S# `  E4 G# @! n
  73. char *dmabufsrc1 = NULL;: r" n& H) |8 \# J  B
  74. char *dmabufsrc2 = NULL;, |* m2 T' o* S/ Z  e. m+ w- B
  75. char *dmabufdest1 = NULL;
    ! [0 ~0 Q+ K" b; @+ H% b
  76. char *dmabufdest2 = NULL;5 t" ^& h9 |- C$ H6 f: a( `. o0 K
  77. 9 A4 p% M8 G( l5 T' z$ ?
  78. static int acnt = 512;
    * l# P4 N/ ~; p6 H* l  ~1 W
  79. static int bcnt = 8;
    7 w( ]0 N4 u3 N# t+ F, [
  80. static int ccnt = 8;) Z, Q$ t  w* |; b9 _

  81. 4 J( I5 I: S3 e; i/ x
  82. module_param(acnt, int, S_IRUGO);
    , h. m/ z6 F, E  \! \9 n' a$ ^
  83. module_param(bcnt, int, S_IRUGO);
    8 Z9 N" D8 H' {3 A5 a4 [* O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% V! K. }6 A" O$ c* K& y0 {
2 Y2 J" Y5 P  F: v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. W) {' d' s: w) j' Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ L$ q4 R" S  w     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 L% Q* p5 R! k3 {2 e5 C0 |( A, l
4 [, \' m; o) V" d, b% S/ |% ]8 a

) N, }% q- m+ F8 `, |/ ^2 a& P% Z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-2 16:56 , Processed in 0.040151 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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