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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ l" t9 i' s2 h
  1. [code]EDMA sample test application/ S) E4 r" y; f
  2. /*1 V; Y: n  k/ K, n4 `2 H
  3. * edma_test.c8 c1 O1 q# Q" u' H5 n
  4. *
    - L- l4 G! H5 E; x1 @) n
  5. * brief  EDMA3 Test Application
    " b, @* U: _4 C4 ]% v: K: t  T
  6. *
    8 i% R; D% m$ @; @
  7. *   This file contains EDMA3 Test code.
    0 z' e5 h) `  }" g3 U! L: P, D- _
  8. *
    ) s% H, B0 p7 b! F" T5 p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 Z8 `. A8 o9 \; E. R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT& V5 n, j) H+ m, Y+ T1 c+ J
  11. *         TO CHANGE.# ?* f9 O% p3 ?1 Z6 P( W( d/ ^& F
  12. *
    . s  b8 U3 Q8 ^5 O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 I2 t5 B3 X, p# U, A
  14. *
    % e# e" h9 [8 D
  15. * This program is free software; you can redistribute it and/or
    8 S. v0 {9 E* u7 u
  16. * modify it under the terms of the GNU General Public License as" r$ o; |" M0 R( r/ L  E
  17. * published by the Free Software Foundation version 2./ Z! T. v9 O0 T) k% T- o4 l
  18. *; K  L* N- ?2 [
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 i; V0 t5 D. t1 w; i5 x* o3 n2 k
  20. * kind, whether express or implied; without even the implied warranty
    . J+ g9 T- w0 i/ T
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      e( N! \3 n0 b8 w& S! P
  22. * GNU General Public License for more details.; U2 V! \7 X% S/ d# d
  23. */  R& Z3 i9 ^$ V8 D

  24. 8 f% W5 [# x- i3 v  q& h  r
  25. #include <linux/module.h>4 e. l$ J7 \' h+ D) f. C5 w
  26. #include <linux/init.h>
    9 {: z+ x# g& Z- g/ _* E& D
  27. #include <linux/errno.h>) R: a3 _+ B1 n" i" H
  28. #include <linux/types.h>0 g4 U" x1 q4 G. F1 O. s: U+ X
  29. #include <linux/interrupt.h>
    # D% Z- u$ l4 P" ~1 s0 b
  30. #include <asm/io.h>* L1 z1 V4 N3 o$ C+ Y5 x, s( K% `2 n
  31. #include <linux/moduleparam.h>6 e$ I  o/ K! g% {; p5 Y5 z$ V# J; ]
  32. #include <linux/sysctl.h># ?# r5 m/ e. K! _
  33. #include <linux/mm.h>
      p0 S( |0 E0 e9 y+ m8 w
  34. #include <linux/dma-mapping.h>
    0 y; p7 g9 c0 t1 I' X& K4 V& e# P

  35. ) _) C7 ]7 p. Y" P& `
  36. #include <mach/memory.h>( p3 B4 N1 K1 t! {
  37. #include <mach/hardware.h>$ l+ U+ E; O# E+ A
  38. #include <mach/irqs.h>
    , N$ i$ L2 _0 O8 j) O1 m/ s1 `4 w
  39. #include <asm/hardware/edma.h>; Y( K, ?+ d3 d9 d

  40. # \! c; f7 F/ b# H
  41. #undef EDMA3_DEBUG! B) z/ V+ g3 ^# Y2 n
  42. /*#define EDMA3_DEBUG*/
    * L: @, E2 D" [* c

  43.   I# Z% u0 Y3 l- |* B- Y
  44. #ifdef EDMA3_DEBUG
    , b1 v2 U  O) q5 O% d% }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + z. N* z8 N* Q' a8 }$ v/ o
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    - d  w$ p' o3 m  {- }# A1 Q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - c0 ?1 y7 w- v9 e& i
  48. #else
    7 h. O* X/ H* K) v# P) s
  49. #define DMA_PRINTK( x... )' t) B" j7 n1 }, f
  50. #define DMA_FN_IN& _, h, G6 ~$ ?, o3 {, \: p. H
  51. #define DMA_FN_OUT
      [/ _$ W7 y; ]+ b, X. P; N8 S2 T
  52. #endif& u* m6 f2 @$ _% C; W2 @; ?
  53. # r/ J0 K) E! r9 l
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      N, a! _- s& s/ s
  55. #define STATIC_SHIFT                3
    ! [+ P& h' T3 L
  56. #define TCINTEN_SHIFT               20
    ! f& \8 R0 o0 N4 A1 M8 |
  57. #define ITCINTEN_SHIFT              21
    & x4 v3 o2 G! s
  58. #define TCCHEN_SHIFT                22# l7 z( h0 }3 F; q
  59. #define ITCCHEN_SHIFT               23' e; r* n# B/ n- `- g
  60. 3 c8 y$ f) J* f. o. O' ]
  61. static volatile int irqraised1 = 0;' M7 x5 ~7 Y: C; w0 S5 |6 f
  62. static volatile int irqraised2 = 0;
    ) J5 B( p0 ~' Q: `2 ]* T
  63. # ]9 k: o( |5 j) @9 V' I# u/ Q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ A% |( x$ L: u7 g4 A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 d( W4 |/ {$ h; M" N& n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - `4 u% o) y/ i5 r+ `

  67. 7 h0 G- e  N" \/ T" _% a
  68. dma_addr_t dmaphyssrc1 = 0;4 P. Z; b& ?+ f! |8 h
  69. dma_addr_t dmaphyssrc2 = 0;" P2 G5 P) h7 e4 F( D8 `) {
  70. dma_addr_t dmaphysdest1 = 0;
    5 Z- K7 P; |0 {
  71. dma_addr_t dmaphysdest2 = 0;
    5 X" _3 P5 H  r9 f, n7 f

  72. 3 w5 h6 l6 H- P) E3 {+ ~
  73. char *dmabufsrc1 = NULL;6 y$ D( H( B9 R( t
  74. char *dmabufsrc2 = NULL;4 H* o8 a0 d* N
  75. char *dmabufdest1 = NULL;+ p- ^  a+ o/ X3 p5 M$ l  m9 o
  76. char *dmabufdest2 = NULL;1 v" b' J* ^6 u4 W
  77.   Q. d3 f- c6 K' p" X% L; B  B
  78. static int acnt = 512;8 c  b3 h) g5 U! G" Y% H% Q! N" a
  79. static int bcnt = 8;
      G: W: m+ D8 C' \) Q3 \2 F
  80. static int ccnt = 8;
    * a) i& Z/ ?4 k0 l

  81. " ^  H% f1 i: {6 W- T+ ?7 s
  82. module_param(acnt, int, S_IRUGO);
    ! ]" J7 e- D# r4 `' `, x" a
  83. module_param(bcnt, int, S_IRUGO);" p( r9 j7 n: ?4 r
  84. module_param(ccnt, int, S_IRUGO);
复制代码

6 U: V  G( G# Y; R' V% M. T! V: S9 ^
: p7 ~. @: C8 q" Q8 I+ l      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. v8 ~6 ]6 s! \$ o9 qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 g2 N( P/ q/ v4 _. w1 x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! q4 t. [3 o/ ?- h$ m% o

/ U) o7 _" e4 _! R; w! J7 w* l& g) x5 G" V' u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 23:57 , Processed in 0.036980 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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