OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; Z6 l; @1 e( J; q2 d: L# j
  1. [code]EDMA sample test application9 @% K; u+ y. \6 O/ O! M4 A
  2. /*
    . D4 m% q" B4 O/ O7 k, l* ?$ R! P
  3. * edma_test.c: o0 z# v$ L: S! t6 Z
  4. *- G2 f# M! j, W9 U2 c, u
  5. * brief  EDMA3 Test Application4 e7 Y& ~: C* |8 Q. ~  n4 Z
  6. *8 p- E7 o  c9 Z$ v' R
  7. *   This file contains EDMA3 Test code.
    " [' T6 L. a' ]+ }# ]9 c- `$ g
  8. *
    # G2 I9 T% ~0 ^7 b* v1 m. s: l; ?
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 F" T  E$ Z' k& Z! o
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 s9 F5 ~0 l  F2 u
  11. *         TO CHANGE.
    + x8 _( U4 w* N
  12. *
    & e+ p( y* C8 |1 E- u1 v
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 C8 M+ A' j+ V- |% C
  14. *- r* |! ~: D! w4 B6 i
  15. * This program is free software; you can redistribute it and/or- Y! v9 [' K6 I0 Q- B
  16. * modify it under the terms of the GNU General Public License as
    9 d+ ~* j1 i3 u# r* Y  m1 H
  17. * published by the Free Software Foundation version 2.4 H8 F$ ]) x$ L& s5 J
  18. *
    $ U' z, v# t' H9 w5 h
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 F4 x' d% R) I' {. ?
  20. * kind, whether express or implied; without even the implied warranty
    ; ?; o; N% {6 J- Y( ^" c4 w0 N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 @3 v, E: O! O, a4 n
  22. * GNU General Public License for more details.
    # e5 O. p0 }" w- d; n  E
  23. */( f4 g) e0 D( f. o
  24. & j5 y; Z3 B4 x7 a- ^: Q6 p
  25. #include <linux/module.h>$ ^5 a# r4 k1 E4 c8 T  d
  26. #include <linux/init.h>/ V( u. R) B; ~% Q
  27. #include <linux/errno.h>2 V3 C/ u6 @  ~, d; f% H' o% a, |
  28. #include <linux/types.h>9 _! \4 D: }4 {/ |2 i& }7 n4 Y& g' n
  29. #include <linux/interrupt.h>
    ( n" U1 ^! _" x# S- }3 A
  30. #include <asm/io.h>6 N" C; U; V' f- U) N# f+ l
  31. #include <linux/moduleparam.h>
    ( E& d+ F  R6 v5 p) w
  32. #include <linux/sysctl.h>
    4 I+ O3 ^/ }6 l* E+ e7 r, ^
  33. #include <linux/mm.h>
    9 a( _. v3 G. p4 O
  34. #include <linux/dma-mapping.h>
    5 D; c% Q3 D' b' v' v) q

  35. & R! C1 W7 E, |- S
  36. #include <mach/memory.h>& H7 z* ?( s+ e7 P& Y
  37. #include <mach/hardware.h># B4 M6 ]/ `& \; |$ N
  38. #include <mach/irqs.h>8 M# a! o" L1 i& v! O' A
  39. #include <asm/hardware/edma.h>
    + I6 C5 ^7 @! q- f

  40. # f1 H* Q& w8 L" \5 N- v. j
  41. #undef EDMA3_DEBUG* x- q$ Q5 x1 o, L& n) u
  42. /*#define EDMA3_DEBUG*/6 a3 x4 J" @, `  J. w

  43. ' s( P9 p. w, U
  44. #ifdef EDMA3_DEBUG9 y; Z# M  y3 Y* G8 W$ q$ Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    & V7 W3 J- c# p! V0 `( q: E+ y9 u+ U  g
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : H. v4 i0 Y$ Z9 W) A1 g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 ^0 W: r- `/ H7 d% f
  48. #else" [) {/ L- H5 b1 S5 j
  49. #define DMA_PRINTK( x... )
    2 ?& Z( B& I% n) b8 E( \  u! Q
  50. #define DMA_FN_IN& ^: S8 P7 T; a9 w. Q! X
  51. #define DMA_FN_OUT5 N9 X+ N$ l' D6 D+ x( g/ `6 G
  52. #endif
    * Z9 d8 {5 k4 v) @. P& T1 b
  53. 3 A  U) f$ y4 y- j  ~
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 r+ i" N/ @" f5 F
  55. #define STATIC_SHIFT                3
    ; t) X6 ^+ B7 ]* Z- M
  56. #define TCINTEN_SHIFT               201 E+ z# I' L7 H8 w! C0 U4 |1 n
  57. #define ITCINTEN_SHIFT              21% X) i1 m5 }# Q8 K$ Z
  58. #define TCCHEN_SHIFT                221 h0 h8 }4 ~. G. `7 N& u% s
  59. #define ITCCHEN_SHIFT               23$ T/ S4 i# n! @1 Z% Y
  60. % Y& K" u7 t- s+ [- D
  61. static volatile int irqraised1 = 0;
    5 ~1 L0 U; I" F  C: A% O. S6 B! S
  62. static volatile int irqraised2 = 0;
    ( R9 P! Y1 |$ n" r# Q3 P  l/ ^$ N
  63. , `# Q% a: ?1 N( s) `' Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) x' `3 `$ z5 q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : c4 x7 n: V' K; ], Q) T& \7 h
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ q/ d( }$ L- X

  67. ' Q% Y) y5 S9 E1 g/ U+ r1 F7 n
  68. dma_addr_t dmaphyssrc1 = 0;
    & n" d# l8 G1 ?: B# ~: n4 \
  69. dma_addr_t dmaphyssrc2 = 0;; `) L0 J6 A6 `
  70. dma_addr_t dmaphysdest1 = 0;
    * v! ?8 U; d) v$ Z  ^& T
  71. dma_addr_t dmaphysdest2 = 0;
    ( \  b* f8 R) [! l
  72. " M  Y  r0 ^/ p# u9 I  N
  73. char *dmabufsrc1 = NULL;
    5 L' `0 L0 @' T' K  D( j6 y
  74. char *dmabufsrc2 = NULL;
    2 Y8 x% }& D( ?# D' J. m0 M
  75. char *dmabufdest1 = NULL;
    ; W7 Z2 ^6 r9 T. \; b0 m
  76. char *dmabufdest2 = NULL;
    . G$ M6 G( \; f$ x2 ^0 I$ n( z
  77. 7 @+ g# S$ @( }6 u0 |0 |: w( N
  78. static int acnt = 512;
      ?2 J! d1 k0 A' H4 o
  79. static int bcnt = 8;
    " M0 ~, `  Q) Q' \" p- u
  80. static int ccnt = 8;' x8 K6 Q: A! d$ i5 c- \5 s+ k

  81. ' j+ F4 F" Q, X" T
  82. module_param(acnt, int, S_IRUGO);* ^, N- y! ?. Y: j, h
  83. module_param(bcnt, int, S_IRUGO);5 z- `: }# F# \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  h( t* ~! k: m! d6 v: u3 W
8 S& z' s+ g4 [2 U: s! v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用- S; V0 N- I, S; f9 A7 w: Q3 J
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# r/ m( h6 u8 o; c. |; |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# F1 {) ], ^0 o( v1 ]) l  [" ^' Q5 W" U+ b' G' m' e( L9 C0 O

& m$ W1 l: v2 P9 z+ T+ H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

点击跳转“创龙科技服务通”

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

GMT+8, 2026-2-26 19:02 , Processed in 0.040088 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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