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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
8 S5 O; f2 r- r( i* ]
  1. [code]EDMA sample test application
    3 d: H+ m$ n% [( R* y
  2. /*
    4 l" G7 m, L# N# H
  3. * edma_test.c' F8 W1 U" G) H0 b! \& N
  4. *
    ) `1 S) }% L7 D5 O% F8 p) w
  5. * brief  EDMA3 Test Application
    " i$ ]. b/ W1 J! T) e& x. \. v( c
  6. *
    $ K- c+ L5 g4 m5 y
  7. *   This file contains EDMA3 Test code.8 ]5 \' ^5 u' S, k
  8. *
    : d$ \! e. j* F9 r! k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, N, M: k5 S% P2 m% M3 K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 o; ]* [* v5 P
  11. *         TO CHANGE.6 X6 C1 x+ [/ j6 ~
  12. *
    " {/ d- L. R2 b4 t! m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; M, o- w( T9 ~6 B* \
  14. *
    , u0 U( i$ [) Z  u6 n; I$ B
  15. * This program is free software; you can redistribute it and/or( F8 {( K& h+ f8 R9 o6 ]5 i4 r
  16. * modify it under the terms of the GNU General Public License as
    5 ?" X* c# N# L5 E0 {8 `2 U! x
  17. * published by the Free Software Foundation version 2.! @! O+ y2 {+ `  m: c" [1 |: Q
  18. *6 I. L3 E( ?) j( N: K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 s; t: T6 c! m. ^
  20. * kind, whether express or implied; without even the implied warranty
    : m  D( ?- |  Y: A6 b* g
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the( Q! W7 R5 _7 t7 z- P
  22. * GNU General Public License for more details.
    , R' H6 ]2 p5 v! R% P1 _5 m
  23. */' D1 ]+ U' R# _/ D! N3 M6 y
  24. ; N/ s! P/ s: [# J6 F
  25. #include <linux/module.h>1 z: Z3 _, ^- n. O+ E
  26. #include <linux/init.h>3 j7 W; H0 b/ b& n( z
  27. #include <linux/errno.h>
    4 C/ H1 {. L6 @" x) ~5 i
  28. #include <linux/types.h>' o& J% v3 z- r5 s+ }, p9 ?  M; j; e
  29. #include <linux/interrupt.h>
    7 A* D9 ~) `% v( A
  30. #include <asm/io.h>6 P# w: ?+ f; N0 w
  31. #include <linux/moduleparam.h>4 L# g% [4 c0 q' |9 V* o
  32. #include <linux/sysctl.h>5 {4 q( o4 U! p9 [' x
  33. #include <linux/mm.h>/ N/ _0 }# C% k: V% m/ f1 S
  34. #include <linux/dma-mapping.h>) U. I& V7 _5 [5 j$ \% C8 A# B

  35. 5 I9 L  T4 S5 L6 U- V
  36. #include <mach/memory.h>4 t( _1 j5 k7 u3 N+ }" x2 o6 i
  37. #include <mach/hardware.h>$ }  `7 ]. ?8 L( S( n
  38. #include <mach/irqs.h>
    . G& k- t0 ?6 V
  39. #include <asm/hardware/edma.h>! r/ ?$ T. N1 |' w; o) c8 a6 \! e
  40. 2 C$ b) S8 d' v! i7 q9 M' l
  41. #undef EDMA3_DEBUG
    2 `# g0 R) M) h- {1 Q$ h% ^0 d
  42. /*#define EDMA3_DEBUG*/
    ( _8 T5 ^/ D4 ~" u
  43. 7 x0 p% b8 ~' G+ @) S' T  }8 d
  44. #ifdef EDMA3_DEBUG, G4 m9 }$ h% }1 A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 L. Y- ^+ ^, @* q, h* g) e6 I
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)# _& I- B: l2 @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , j) _: ?/ p, \7 K
  48. #else
    : j# L1 E2 u, ~: ~' r2 S  ^  S
  49. #define DMA_PRINTK( x... )
    , \9 |3 M! M6 ^* N0 R/ P
  50. #define DMA_FN_IN! n3 \: G  L# C' C! b
  51. #define DMA_FN_OUT" d' H) y- |& |
  52. #endif4 V. D) U, Y( c, w) P

  53. # Y, U7 S9 q3 `' n' [* x6 u) P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / z0 ^. _) n8 G
  55. #define STATIC_SHIFT                3+ O' l5 o' ~" T$ C; A7 @# M% D
  56. #define TCINTEN_SHIFT               20
    $ Y7 V4 S# Z% r* r$ h+ b
  57. #define ITCINTEN_SHIFT              21$ L2 V$ I. k  b
  58. #define TCCHEN_SHIFT                22
    4 B# ~, v; u: |  ^
  59. #define ITCCHEN_SHIFT               23
    . I7 S- D, Z# R4 m: H7 V* A# w
  60. 0 v8 ~5 r. l) b- _8 _# y/ m
  61. static volatile int irqraised1 = 0;6 N$ O5 N5 ^' `% L' s% [
  62. static volatile int irqraised2 = 0;
    9 e+ N1 K* t7 w0 ?; P3 p4 N! i' \
  63. 3 M! h# E7 e: u* [- o" V3 x6 J) j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 }% g" I7 e5 u% J) s' y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      c2 A, s; Y" I' P7 {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. A0 h5 \$ j! J# p8 l- B* j

  67. 2 j( U: @0 A3 h3 X2 v7 w
  68. dma_addr_t dmaphyssrc1 = 0;, h( L7 L& q/ ~+ L; K
  69. dma_addr_t dmaphyssrc2 = 0;
      X: J- V3 T  a! k+ d
  70. dma_addr_t dmaphysdest1 = 0;* X" Z+ b  U2 ~4 G8 ~/ X: n7 N; |
  71. dma_addr_t dmaphysdest2 = 0;7 ^( v3 R4 }3 s. _3 j+ i

  72.   \1 Z& ^: `( I3 i  S- o
  73. char *dmabufsrc1 = NULL;  I& o( D! i' h% j, r
  74. char *dmabufsrc2 = NULL;
    $ H- Q+ U* i$ w5 Y, V- p( q
  75. char *dmabufdest1 = NULL;7 _4 e7 B: P# x6 [' {3 z! ~2 t
  76. char *dmabufdest2 = NULL;" @4 |, Q* _% p( M

  77. 3 O2 ^: U4 y  ~( c4 d/ ?
  78. static int acnt = 512;
    & B9 U  ]8 @! O, P4 t3 y4 @& n: n
  79. static int bcnt = 8;5 ^6 V+ a: q$ K0 d4 Z  M. i* g' @  \
  80. static int ccnt = 8;0 k1 g" B  ^6 d
  81. ( s. ?7 s: Z5 N4 t# S
  82. module_param(acnt, int, S_IRUGO);
    2 G! x/ z' }* @
  83. module_param(bcnt, int, S_IRUGO);
    ; n8 T( k+ ?5 c& M8 o" ^: A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* i) Q8 q9 S- r/ h6 d5 v9 `. W9 ]/ N* v. Q5 b
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 D3 W7 Q) o& a$ ^. N
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 w3 r. R; C6 E! i; h4 j3 \     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。9 ]/ s* u0 s! x$ r, H; J8 ~
1 w- \3 ^, R  ?$ g& l" B2 i, H" v  a5 L
/ F- V+ N) B0 J$ q' S$ v$ R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-11 05:51 , Processed in 0.038188 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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