OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 V1 s0 v: h8 d* s( P
  1. [code]EDMA sample test application" T+ r2 X1 A8 K' {+ |1 ^$ }% o$ M
  2. /*6 E- g1 N1 h' |( [8 `
  3. * edma_test.c9 t" A4 ]$ @; M) z2 w8 J/ p
  4. *% t  K% `% X; c) I
  5. * brief  EDMA3 Test Application
    & R2 r4 B) j9 M$ n& s! O  d
  6. *, g/ b# X. n& u& J. W/ o
  7. *   This file contains EDMA3 Test code.
    % D) _9 _! j  v- X4 e3 j3 q
  8. *
    # t3 C# A' W0 X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 \5 D6 d; P! I. g) a4 |8 e7 I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    8 j9 L2 q' j) a- W( c6 i6 O
  11. *         TO CHANGE.
    : E( I' M% {% C( t8 Z1 _
  12. *2 {( x0 O& I1 u2 v  k  W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ) X* J) P, q2 T5 o+ [  B
  14. *  ?2 i' \3 o4 r, r" X
  15. * This program is free software; you can redistribute it and/or
    ' z  F' i& A. v; \5 r1 }+ j  l0 H
  16. * modify it under the terms of the GNU General Public License as' M, O3 V' e/ f' j1 l( ^; h
  17. * published by the Free Software Foundation version 2.
    7 D0 S3 Z9 v8 ]
  18. *
      E& S. @8 y. O! b) R: v; {% I0 n* A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ {2 j0 I/ Z9 R& b! U
  20. * kind, whether express or implied; without even the implied warranty
    6 e  F& n, \# @+ ?: X6 Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 b2 ~6 {$ ^3 j4 c. p  \
  22. * GNU General Public License for more details.
    0 M- M0 S- g5 n. L% ^$ I, T, m
  23. */
    ; e( K! z) E4 f+ l2 [

  24. 5 u' K( y9 x* B$ g8 S
  25. #include <linux/module.h>
    8 I: F! ]9 X( \& e; E+ T% y9 e5 x
  26. #include <linux/init.h>
    - ^$ a. x1 r0 R4 U7 E
  27. #include <linux/errno.h>9 i2 s$ M# d4 X' b
  28. #include <linux/types.h>6 L% Z; O( `8 M- |' {! D: ^( ~
  29. #include <linux/interrupt.h>
    / |* N- p% B0 D: ]9 m  _" U5 ^
  30. #include <asm/io.h>
    ; r' T+ t' _8 X* o% @2 i2 X6 F
  31. #include <linux/moduleparam.h>) N8 e5 e1 j# O7 N! t) \, M/ G  w" d
  32. #include <linux/sysctl.h>
    ; [! P3 R5 ^( b2 J7 n
  33. #include <linux/mm.h>
    % [8 ~. l+ a" X/ f& D2 c
  34. #include <linux/dma-mapping.h>6 l# w+ Q( q6 H9 X" Y7 I" U

  35. 3 f8 m) q0 J: j) s& e
  36. #include <mach/memory.h>
      k' h2 z& W4 C; r: H% x6 t
  37. #include <mach/hardware.h>
    % X7 z$ [! M; ~" Z
  38. #include <mach/irqs.h>
    2 ^# e0 k3 x9 F% p' m( u0 b0 {) y
  39. #include <asm/hardware/edma.h>
    # s$ V$ d% w; ?" _
  40. , f& X- G2 u& s5 n/ R+ p
  41. #undef EDMA3_DEBUG
    + m3 y3 q. r) g1 z  F% R
  42. /*#define EDMA3_DEBUG*/* E+ N9 e5 `/ j: o

  43. " M0 |, q+ N0 b, ]- H/ d
  44. #ifdef EDMA3_DEBUG5 h( T# }# N2 n; V1 l
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! V9 M  H: G  X3 D3 N& Y5 J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  H8 T7 V& h) k; k7 x# R& K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* z$ A0 }* |& P# u) ^+ {
  48. #else4 [" c! M/ f/ Z8 q8 U
  49. #define DMA_PRINTK( x... ), D8 ]; o" c  q$ F7 W3 A
  50. #define DMA_FN_IN
    ; H$ K8 \" Q7 \8 R! E" W5 d" N9 }
  51. #define DMA_FN_OUT4 q9 v) }( @/ _# W& f5 |
  52. #endif
    : d, ~9 X  g- k: m' {

  53. ) y* M( m% g4 Z1 F, D3 s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)" i. ^4 h) b0 X" B' u0 x
  55. #define STATIC_SHIFT                3
    9 ~' M" z! R3 R+ V# g
  56. #define TCINTEN_SHIFT               207 h9 P& Y  `2 {
  57. #define ITCINTEN_SHIFT              21
    / h  D/ \/ H2 t1 X4 {. @8 m
  58. #define TCCHEN_SHIFT                22: W' z" X) n# o' F
  59. #define ITCCHEN_SHIFT               23
    ! {% ?" a# v- K5 R3 G- P

  60. . ^5 {8 s4 A& m  h( v
  61. static volatile int irqraised1 = 0;
    3 q! W- w. E( k) s
  62. static volatile int irqraised2 = 0;3 M, V6 o1 C+ [

  63. . V" J) V# [% L6 \
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 X+ M6 o! W0 Y0 V- _# a& ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - ]5 c$ u! v& P; M" k
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , ?) ~/ y' h& `6 W

  67. / j+ N3 G- x' Z5 D- O& i
  68. dma_addr_t dmaphyssrc1 = 0;
    $ a. w: t9 R9 Y) y% b
  69. dma_addr_t dmaphyssrc2 = 0;
    % w' ~$ q; ?6 \8 v, Q
  70. dma_addr_t dmaphysdest1 = 0;, _! _- y7 d+ h( ?5 L+ C- P
  71. dma_addr_t dmaphysdest2 = 0;
    6 D$ ^; x" f2 @4 a3 [
  72. 5 P. V! X1 @9 n3 K. C
  73. char *dmabufsrc1 = NULL;6 ]  [$ w8 w+ N8 G6 @( Q: x& n
  74. char *dmabufsrc2 = NULL;
    # C+ V/ ?8 b6 w) R9 K1 d3 _% y
  75. char *dmabufdest1 = NULL;
    1 D8 t! |6 ~& m
  76. char *dmabufdest2 = NULL;
    : `' e3 @6 S" p

  77. + }5 F9 q# J4 z
  78. static int acnt = 512;8 r" ~& z. c' D: r, X
  79. static int bcnt = 8;* [, ], z  `$ a! x! c5 P% u
  80. static int ccnt = 8;2 m9 V& [1 p* O+ {$ L1 P, |

  81. 7 S3 ^3 l  j0 B# J" Q  `2 {
  82. module_param(acnt, int, S_IRUGO);
    5 Y3 `' E; l8 J. f! _. Z+ V; o3 f
  83. module_param(bcnt, int, S_IRUGO);
    ; m: N/ |$ x" h+ R; ~' u8 ~0 P
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 P/ D4 A; ^9 ]7 ]4 x0 o! ]
0 g+ \' ?* X1 K% f' h' j
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 S$ ]2 |* f, Y! d( e; }5 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. K: k$ P0 K, Z2 g6 x8 _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- P2 `2 T, ~8 U* [1 w/ [& m
" W* q" L; A/ I& M6 c
- b$ C; L; Q+ @
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 22:42 , Processed in 0.044570 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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