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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * u9 t1 @  q% F6 g* f
  1. [code]EDMA sample test application& @5 R/ P4 e+ ?, c4 C0 W
  2. /*
    ) ?' r$ u; q& [- d( O% g. o. e
  3. * edma_test.c9 D/ K+ ^+ k9 c/ b$ ]" M
  4. *
      j) c# E. b: ]: `% c( ]
  5. * brief  EDMA3 Test Application
    ) @9 q+ A8 T  F( N5 V5 f  m2 [
  6. *! J! D) g, l/ s( o8 u4 j
  7. *   This file contains EDMA3 Test code.
    & w+ a6 [$ ^! E( J8 g+ F- e
  8. *
    . A# y% E6 y1 G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& M9 n* B- _8 i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 k" [! q: i0 k- P8 I7 O
  11. *         TO CHANGE.
    & {7 x4 S7 T# T+ d& O
  12. *$ @8 K* H. e7 P/ B/ R* k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : _; Z$ A; d6 o/ T' _' S( x
  14. *
      ~$ r# t7 R8 e4 I$ g
  15. * This program is free software; you can redistribute it and/or
    9 s  H# n. _9 A+ F+ r  [+ B
  16. * modify it under the terms of the GNU General Public License as7 k* G1 E! @: D% v
  17. * published by the Free Software Foundation version 2.; |) O4 g6 T- e* J, E
  18. *
    . D  ~% ]% d; q8 J& D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 u% U5 x/ ^" r+ U
  20. * kind, whether express or implied; without even the implied warranty- ~8 Y% R  `2 H3 s: \
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , @. K* Y$ o" D1 s; Y; ?7 ^# B) c
  22. * GNU General Public License for more details.7 x7 L5 I0 F4 w  f* F6 ~8 a) f
  23. */3 y# f% ?1 J3 Q  N, I4 R
  24. # M  K, H. z; Q+ J1 P1 O
  25. #include <linux/module.h>0 @7 X$ ~2 G% c5 s+ j
  26. #include <linux/init.h>+ w$ K3 a. W5 B  T4 D1 e6 s9 q
  27. #include <linux/errno.h>
    % A6 p( a( }4 Y) Q& l3 |" ~
  28. #include <linux/types.h>
    * G9 t; j. r7 y3 q8 @
  29. #include <linux/interrupt.h>
    1 ^" U- Z. T( Q2 p3 ?& o
  30. #include <asm/io.h>0 N6 i5 L9 p1 F3 g0 Z
  31. #include <linux/moduleparam.h>
    7 _2 H* P  |, K
  32. #include <linux/sysctl.h>0 c3 B0 X( x# Q9 r7 R( a
  33. #include <linux/mm.h>) p8 K" Q/ |, r/ I9 s
  34. #include <linux/dma-mapping.h>4 {( V: e2 k- H0 L# n
  35. 8 W0 K- y* b( m( l, u, Z* t
  36. #include <mach/memory.h>
    ( P+ O1 }" w, |. U( P% ?2 L
  37. #include <mach/hardware.h>
    4 X9 F$ {0 T. P; y0 L" B+ u
  38. #include <mach/irqs.h>
    0 e  x" ~+ U. l" r* H) B# q
  39. #include <asm/hardware/edma.h>
    6 b4 X2 J4 D2 `! V: K- G/ ?' D

  40. 7 ]6 E$ i2 U* h6 L
  41. #undef EDMA3_DEBUG
    " W  `) W6 g0 r# \
  42. /*#define EDMA3_DEBUG*/& [* J2 C) ~) [5 m
  43. , O3 b" J4 G1 V1 Q! _3 i& _5 k
  44. #ifdef EDMA3_DEBUG9 s  S7 n6 m7 |  w! j1 j. Y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) v7 y- A2 t, s. Q! `4 |
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)& y3 j/ u. q6 G4 W8 d8 v
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 l3 l- E) |! A0 X# e/ H
  48. #else
    : T0 |3 x: n4 L; a" R
  49. #define DMA_PRINTK( x... )2 w) c- Z; ~2 \# l( I; a
  50. #define DMA_FN_IN
    7 Y2 s0 g4 n. P; f+ J/ x
  51. #define DMA_FN_OUT
      S/ V$ P- m- `2 l7 s. _' p/ [+ @5 C
  52. #endif* I- P" c( R  E1 X3 T+ H
  53. 8 b# m7 \8 T! S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % ^6 F* w: m$ J" _9 @
  55. #define STATIC_SHIFT                3) n" d6 i' ~0 y- P& _! @3 z% u
  56. #define TCINTEN_SHIFT               20
    6 k- C9 ^! J8 e3 J. r& u
  57. #define ITCINTEN_SHIFT              21+ `5 ^% U1 c2 H. V# m
  58. #define TCCHEN_SHIFT                22
      s4 ^  q' X8 C! E/ H  A1 X
  59. #define ITCCHEN_SHIFT               23
    - u. J, |# c! [' i+ @
  60. 1 s) u1 R7 @4 W5 x
  61. static volatile int irqraised1 = 0;. i+ O1 k4 K, k/ q( U, }* B4 J) {
  62. static volatile int irqraised2 = 0;3 @0 y0 p+ R( E% X

  63. . H1 N* d1 C. n' B  x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - V& ^( N2 q  j: w
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 G/ e1 j& a, L# ~; h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 o% g. }" o2 A
  67. 3 L- e* F  i) C2 ?8 r1 h
  68. dma_addr_t dmaphyssrc1 = 0;. N" i, k8 E2 i) C
  69. dma_addr_t dmaphyssrc2 = 0;
    9 [+ R( {$ b$ U4 j0 Y5 {+ b0 e
  70. dma_addr_t dmaphysdest1 = 0;
    ( A4 H$ \& v: t: u; l) [! O* v
  71. dma_addr_t dmaphysdest2 = 0;) j- ^- v& j* o- Y7 _/ r

  72. ) z" S$ \& E/ O
  73. char *dmabufsrc1 = NULL;
    4 l% s5 ~# U8 S5 {9 q. I  A. G9 y
  74. char *dmabufsrc2 = NULL;- @  ]( o7 z% y# p! T& [4 `
  75. char *dmabufdest1 = NULL;$ k  ~2 @. v7 l" `
  76. char *dmabufdest2 = NULL;5 e' Z1 S9 S, ~! s
  77. 6 k* Z9 u/ D3 D4 o  u1 e, i3 t; J
  78. static int acnt = 512;
      w- J1 ?6 Y+ v* \: J; |. ~
  79. static int bcnt = 8;
    " t' ]6 D$ N+ u3 m
  80. static int ccnt = 8;
    ' X9 j/ J* o9 [7 }0 B
  81. 4 B0 d6 Q  B" V% Q+ J2 V) R
  82. module_param(acnt, int, S_IRUGO);
    7 H; Q) z" d1 ~: V) E% g8 S3 c
  83. module_param(bcnt, int, S_IRUGO);- a9 \. h  B" T
  84. module_param(ccnt, int, S_IRUGO);
复制代码

. l# |( k, C- S/ B& a1 }
4 T6 o4 q- s# G) _% d      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, l8 m' N3 i6 u! M/ O6 [9 f5 Earm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* {& p; [/ L0 n6 V% |$ O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' l" B9 i$ P7 O6 ~0 i/ Z8 p

$ ^) W8 H0 X3 n' r! d, z+ l4 A8 R' F, l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则


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

GMT+8, 2026-1-10 02:13 , Processed in 0.034758 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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