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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
& R# [, C6 y7 i! ?. w% v# F. |. K
  1. [code]EDMA sample test application6 F; L5 c; ^) ~) j+ I( v( F1 K
  2. /*
    3 {" l1 s0 W" \, Z/ Z) w' N2 Q; ^
  3. * edma_test.c
    4 ?/ G5 _& \$ `5 F
  4. *
    ( t; M. p  K( {  l$ J
  5. * brief  EDMA3 Test Application% p+ q- Y* r- c
  6. *. O" T" D8 e  x" d+ d- g7 m4 w
  7. *   This file contains EDMA3 Test code./ n, J/ O6 i0 _
  8. *( r3 @1 [* g- ?6 z/ a! `) X3 @3 t/ w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * s* ?7 P# f! `- u- F6 F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 R* e4 B2 V; c6 |
  11. *         TO CHANGE.
    ) g4 Y% U: h" Y. k/ M! \2 k
  12. *
    + Z& _2 S- D% J# h" x$ v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: B% z- ^9 ~/ r" ~- x5 k, C
  14. *
    " l: W9 {3 r+ s" P
  15. * This program is free software; you can redistribute it and/or2 l- p% i  g6 Y) z+ o( G
  16. * modify it under the terms of the GNU General Public License as
    1 V: I" L  G, I) x% }5 J' N
  17. * published by the Free Software Foundation version 2.
    5 J% `# z/ A/ B" }; L+ s9 D
  18. *
    ' E9 h: f, k5 Y# L
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 ~4 s+ _  ]/ B1 H5 @" ?- G: b
  20. * kind, whether express or implied; without even the implied warranty
    7 \& i# z& S' s  W  A  |! Y6 U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8 v7 Y* x# Y4 D: x+ Q, A
  22. * GNU General Public License for more details.
    ; @2 L$ g0 d- H! m( B
  23. */) K, g4 u  m) w3 U/ t
  24. + K/ L7 C' S$ h/ @
  25. #include <linux/module.h># ]+ m. y. U" ?3 Z* S3 w& [1 \2 t
  26. #include <linux/init.h>
    8 y) C# j# ~5 ^+ [7 X3 P  H
  27. #include <linux/errno.h>
    ! R; H" [8 X& U
  28. #include <linux/types.h>! T/ Z+ b) F' F+ M9 N; ^
  29. #include <linux/interrupt.h>
    $ {8 l' ]( v) N/ U
  30. #include <asm/io.h>
    9 j/ O% }" f2 N
  31. #include <linux/moduleparam.h>% }* b* `' o9 K# e5 B- E0 e+ W
  32. #include <linux/sysctl.h>  u. V8 g0 M! |4 u. c
  33. #include <linux/mm.h>, q: \" z% H, h$ ~+ l0 v5 z
  34. #include <linux/dma-mapping.h>3 z$ N; k4 g, g6 B% f

  35. ' j- h. P4 G3 \8 U* }0 h
  36. #include <mach/memory.h>
    5 W5 \% S' |0 e; z5 X, T0 E) v
  37. #include <mach/hardware.h>
    2 o* n8 r1 @* K  E
  38. #include <mach/irqs.h>; e. M( K  Q. P2 J
  39. #include <asm/hardware/edma.h>5 c4 A  z/ T) a

  40. 2 n, i) Z9 p9 X7 W) t, ]0 `
  41. #undef EDMA3_DEBUG
    $ v! u8 w+ C0 i8 P+ B% q# H7 x7 V
  42. /*#define EDMA3_DEBUG*/
      f3 D0 r2 i' P+ x' c2 M$ `7 x

  43. 8 H) [" {/ s/ W, t2 I/ E4 `
  44. #ifdef EDMA3_DEBUG) _& P0 U% y' c" w' l1 _8 J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 E7 O$ S" @3 i# V, X, w5 X. F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 u! s; o: d8 p: R, q4 N! {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): _1 F# S* ^/ _/ ]8 j9 n1 U
  48. #else
    & D$ p8 b3 Q; }  O+ P9 b% A
  49. #define DMA_PRINTK( x... )
    & ^! ]7 c9 [$ b& M7 @$ v
  50. #define DMA_FN_IN* t6 a  \9 `0 Y! \4 D
  51. #define DMA_FN_OUT
    - b+ O% p/ {- a/ Y1 b1 Q4 u
  52. #endif/ J, H5 q9 G' Y+ e3 T, D) W
  53. ) y7 t  r3 X+ Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ t- e5 k6 r( u9 z
  55. #define STATIC_SHIFT                3' q: d' v) b/ P( e7 H
  56. #define TCINTEN_SHIFT               20
    ! C, I/ X) v, |+ E2 F
  57. #define ITCINTEN_SHIFT              218 f5 A& v; N2 I. U! q* p# t1 a
  58. #define TCCHEN_SHIFT                22
    , t8 {( R- g, w# y+ `& L0 V
  59. #define ITCCHEN_SHIFT               233 Z, m+ n: {, B# ^8 Z$ t1 u

  60. , r9 a* G  z2 U; a0 a. x. q
  61. static volatile int irqraised1 = 0;
    8 |, N3 D1 p( g
  62. static volatile int irqraised2 = 0;
    1 R8 q$ P$ \# P

  63. ; L% {6 ]4 }( r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 }2 F+ R! e) ^% _  f7 I5 R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 ^' F6 h' A, p0 i+ [4 {" q4 W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' W( K7 f  ^: t0 V
  67. * L6 g! n5 g! l9 p5 I1 O' O+ E" f4 Z
  68. dma_addr_t dmaphyssrc1 = 0;' X+ y  ~$ k2 [
  69. dma_addr_t dmaphyssrc2 = 0;1 s' R+ G% |) j" E5 E$ n3 ]% G
  70. dma_addr_t dmaphysdest1 = 0;
    1 B) z  A1 i" B6 C
  71. dma_addr_t dmaphysdest2 = 0;
    $ d9 B3 H8 L; r' {9 N! k+ \! c

  72. ) f! J0 Q, l! r; c( f
  73. char *dmabufsrc1 = NULL;3 ?; U' X$ e* r5 X& Z0 o
  74. char *dmabufsrc2 = NULL;
    * H( g% W- s% q7 e2 V+ B9 f
  75. char *dmabufdest1 = NULL;1 q- d/ D: E; \/ `9 B+ y' O
  76. char *dmabufdest2 = NULL;
    5 X, e5 i8 A# M$ }7 f
  77. & k- U0 E9 A+ t" h. x& H
  78. static int acnt = 512;" U% T, E6 Z1 r* p
  79. static int bcnt = 8;. `" X) a8 F  ~  I1 \: k
  80. static int ccnt = 8;8 I* D- Y( R  W
  81. ' S9 H2 c0 U; N( B5 X8 D; t
  82. module_param(acnt, int, S_IRUGO);/ Z8 W: l1 y0 r9 X
  83. module_param(bcnt, int, S_IRUGO);# ?4 M, i5 c5 O
  84. module_param(ccnt, int, S_IRUGO);
复制代码
: T# r. n( b6 `; u. j# ?3 I( G
7 n  p) y8 Y8 O+ d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 K# ~2 Q4 Q" z
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. y/ a5 h8 F9 p& N' z  O' _  p" s
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。) Y' x6 K' }! y  p+ n8 w2 c
% r9 e" e  I3 e8 N( C

- L: S. N0 b+ p1 J- A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-1 12:24 , Processed in 0.037421 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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