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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 S% Z( E. g; a: x! q' l
  1. [code]EDMA sample test application+ k; m, p# n! f. H/ L& U9 v, q
  2. /*
    ' S  S6 V6 n9 \# n1 g
  3. * edma_test.c! z; Y9 G* J3 u6 D( K. D  c
  4. *. F" Z  b  U9 m, Z( E2 T; c
  5. * brief  EDMA3 Test Application4 V8 {5 R8 S& R7 w" w/ d9 }5 [
  6. *
    ! ?% f+ ]5 Z5 `" L3 \) W! |- p
  7. *   This file contains EDMA3 Test code.  z9 Y. T; x0 ^
  8. *# U1 }9 j; Y" l( y& m8 u- [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 ?7 c0 Y( g1 C- M5 v& |' \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 n7 ~9 C- Y2 X2 v- S/ z; f
  11. *         TO CHANGE.
    1 e* l3 R" t/ T0 \, l& l# I, ]
  12. *
    9 c& ?, C# E$ `7 _; V( c, ~. w
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 G7 b' g8 Y8 }, R  ?) @1 X
  14. *$ ]6 o) l+ x7 I- t; ^
  15. * This program is free software; you can redistribute it and/or" A3 e5 w  ~4 R  C  [' Z
  16. * modify it under the terms of the GNU General Public License as# d0 R" L# L9 ~6 f0 T
  17. * published by the Free Software Foundation version 2.( u. Q9 G( d+ E" f$ M
  18. *  p- R' o, G* v/ {! v9 @) R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 R/ k  x+ q% l6 B
  20. * kind, whether express or implied; without even the implied warranty
    5 W& b$ m0 ^- m: u: U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ U% K. S4 C! k$ c( G) q  K
  22. * GNU General Public License for more details.) B' {) v# O; j; `- X
  23. */: D1 p: c0 s# S) B5 ~( R7 s$ \) o

  24. ( K) [& ^( m" S/ }& }$ o9 i- E
  25. #include <linux/module.h>
    % ^+ J& V& |" r% @
  26. #include <linux/init.h>
    + q# X& m8 z* f3 B- b; ]; H
  27. #include <linux/errno.h>
    , g( s" {" b. x  [
  28. #include <linux/types.h>
    4 Y+ F- f) q3 q1 y. p
  29. #include <linux/interrupt.h>  I7 ^3 c% P0 A. v6 w
  30. #include <asm/io.h>; J6 A5 z4 \! ^7 m( u: X, O
  31. #include <linux/moduleparam.h>" j& x& t  i* H& Y1 Q
  32. #include <linux/sysctl.h>$ h" f3 {( C8 C& x( D, @  r, H' d
  33. #include <linux/mm.h>+ ^& O7 s3 I& I  }
  34. #include <linux/dma-mapping.h>
    % \# j" G3 O- h8 o: ^& k) }. @

  35. 9 L+ r  h7 W0 L, \8 }
  36. #include <mach/memory.h>; j2 p' h1 @1 _7 N
  37. #include <mach/hardware.h>
    ) x) m9 Y6 K$ m; i& R+ Q+ _
  38. #include <mach/irqs.h>
    8 u- b1 ^9 }  h$ l5 y
  39. #include <asm/hardware/edma.h>
    + `& o- @# r& g; l
  40. ( d* b4 M# f) h' k1 V% i' L
  41. #undef EDMA3_DEBUG, @* H; Q( o7 n
  42. /*#define EDMA3_DEBUG*/  E8 r- `. q3 N+ H, I
  43. " m9 n; \+ S7 ?
  44. #ifdef EDMA3_DEBUG
    ; C) @& J. h9 H3 f6 n/ d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    2 x' }& f. u3 ?; e
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% W' \/ G9 p7 t4 A* a6 W
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 ?( J. W4 n( m% l7 A- t
  48. #else) q% L* ]/ p" h' G$ G2 e4 N; G0 P
  49. #define DMA_PRINTK( x... )/ p% B  g$ s5 ~
  50. #define DMA_FN_IN6 c: u& Z6 c2 P0 F
  51. #define DMA_FN_OUT0 u" }' s4 k# j6 {
  52. #endif3 D" L3 T" N/ I5 s/ U; s3 l! I8 @

  53. 7 k# z: W3 e3 h2 ?6 f) _# \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# i& ^9 U* q1 H/ j. U
  55. #define STATIC_SHIFT                3
    - D+ r* f; M- P  j% Y5 @- I  l! d
  56. #define TCINTEN_SHIFT               208 A3 K5 l+ D& m4 [
  57. #define ITCINTEN_SHIFT              21
    & _" m4 \9 g2 {; f& {
  58. #define TCCHEN_SHIFT                22
    8 ]0 _( {+ o( u, Z# V
  59. #define ITCCHEN_SHIFT               23
    / q3 z8 G1 x) ~3 j" |$ [

  60. 0 F/ r$ s: w5 ^, P
  61. static volatile int irqraised1 = 0;
    " H; m/ p' D  a1 Y2 m
  62. static volatile int irqraised2 = 0;; \; L) F- P2 k* I# b

  63. ! A4 r; v8 d9 N" G2 w6 l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 H6 W1 `2 s- d0 K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! F! l+ \. z  n( w( I* U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  O0 V8 t3 U; r; G. \
  67. 4 n* l; B. n9 N5 M: L% G  P
  68. dma_addr_t dmaphyssrc1 = 0;9 o  ^5 x6 B9 [3 w
  69. dma_addr_t dmaphyssrc2 = 0;
    % f: }# m6 h4 C4 W
  70. dma_addr_t dmaphysdest1 = 0;$ h: I* Y. X1 E0 b! x1 s5 g# s
  71. dma_addr_t dmaphysdest2 = 0;
    , {; h/ z/ t. z  O9 W7 K3 @* v
  72. 9 K& a1 v# p0 Z* m
  73. char *dmabufsrc1 = NULL;
    " ~. ]1 r. n+ |* q
  74. char *dmabufsrc2 = NULL;
    : U8 Y  B, s& l& O  Z
  75. char *dmabufdest1 = NULL;- [9 ?7 `- C, E( E4 x$ c- _
  76. char *dmabufdest2 = NULL;+ \& o' n5 c6 p: O
  77. & C* I. c* b' G& n- G+ ?
  78. static int acnt = 512;( l1 U. c; `8 F. ]9 g
  79. static int bcnt = 8;+ N2 L& K0 y3 w# I1 r" L) u; i4 z
  80. static int ccnt = 8;* h7 ]! u  \# m# g: x9 q% }

  81. + T( E0 g, |" U7 D* g( u
  82. module_param(acnt, int, S_IRUGO);
    7 h* ~$ h- J& r) T& X4 W* _
  83. module_param(bcnt, int, S_IRUGO);
    $ g5 c# }* c+ c* p
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" V7 ~2 B$ b7 `+ V# M

( Q4 X8 x6 H* b8 C      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: Q  e1 o5 M1 Iarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
1 `$ t4 B. H+ X     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。5 u; }7 n0 w9 X4 k1 S  `4 [
' |' n" F5 y2 d/ I0 n6 l& S

5 @" [  i( A! ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 18:56 , Processed in 0.039598 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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