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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 I7 ]. _, |' ~8 _' ]9 T, A9 F
  1. [code]EDMA sample test application
    5 a& a6 I( u( c' P' G4 z% L1 N
  2. /*( S1 ~% B8 W8 N2 v0 g4 g% x. h
  3. * edma_test.c
    0 h, r& X; L/ D, e# K4 u8 [) P# P/ h
  4. *
    ! i' K4 s3 x4 d( T* C( c
  5. * brief  EDMA3 Test Application( V: d% A' x; ?7 k. Z
  6. *
    ( i9 e- N: A& U  u4 U
  7. *   This file contains EDMA3 Test code.$ Q- C) \7 Z" j  t
  8. ** [. {8 O8 b+ q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % H4 i3 [4 M( f& x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT; M! z; g; n3 m5 h$ m: B
  11. *         TO CHANGE.- @5 Y. w* T6 z7 c( |: X7 ?. e- L
  12. *
    9 H$ ^! i2 c7 {" r% g
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 G  U! ~3 v$ ]( ~
  14. *
    1 b$ q$ f. f. B" n5 o4 j7 E+ v' m
  15. * This program is free software; you can redistribute it and/or
    $ z. @4 h$ w; l2 ^6 z) h: e
  16. * modify it under the terms of the GNU General Public License as
    . V  T4 P1 q" a4 R6 k
  17. * published by the Free Software Foundation version 2.
    9 K9 P7 H% ~  L! `. g& ~
  18. *! ?4 O* M- J1 T
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - J0 ^' V  A: |0 \2 C0 o# b3 i
  20. * kind, whether express or implied; without even the implied warranty
    ! |' H+ P( X2 @! f: ^
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- t1 T5 D4 K+ k% |7 r
  22. * GNU General Public License for more details.
    + P% _: ?" |8 Y: v4 w+ E
  23. */7 q' s3 L  [4 I; I
  24. ( l1 t$ c; i1 i# e% E
  25. #include <linux/module.h>2 o* ~; d7 Y* {; T9 r) |
  26. #include <linux/init.h>
    , K4 g: g( b$ c) l, j( R
  27. #include <linux/errno.h>
    ( D8 J7 D1 n: |( y
  28. #include <linux/types.h>$ N4 K; ^6 W) v' W- g0 w
  29. #include <linux/interrupt.h>; J* O( f- y& t* Y9 w' ^$ w. {0 R
  30. #include <asm/io.h>  O5 d+ g% |+ V4 {
  31. #include <linux/moduleparam.h>
    ( t( p1 `2 u( Q. C4 L9 q
  32. #include <linux/sysctl.h>
    4 Y$ f, ]: W, V( C- N
  33. #include <linux/mm.h>
    2 j9 P' B* @" C: {
  34. #include <linux/dma-mapping.h>
    % S" {2 S) {8 D% s  z# r4 P/ \9 m

  35. - Z6 b+ n  C& O
  36. #include <mach/memory.h>& q. k8 g/ i* p/ q8 K: D
  37. #include <mach/hardware.h>* v1 d4 ^, N2 C1 E( \5 e9 h
  38. #include <mach/irqs.h>/ O& ^: z' s. }) j' ~
  39. #include <asm/hardware/edma.h>
    : c$ R7 [/ ?4 }6 v

  40. 0 l( w2 e9 R8 {* W' Y) K4 o
  41. #undef EDMA3_DEBUG
    8 W4 Y4 V( b3 z/ A+ S5 {
  42. /*#define EDMA3_DEBUG*/
    : T  ]/ x- S8 j4 H

  43. - G  c- F* e9 _
  44. #ifdef EDMA3_DEBUG
    " {  E% Z4 p; }' l; I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % G1 [+ q3 F  |3 D/ ]! S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 G* Z. G% o( L, b$ X6 l/ J
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 b: |; `$ U0 x2 J% T0 C8 x
  48. #else
    5 O0 `* L0 Z9 G; z$ i# p
  49. #define DMA_PRINTK( x... )
    % m/ e, m" s% w* Y; @, I  Q, W
  50. #define DMA_FN_IN
    8 Z8 s( ^5 ?8 Y+ C& \4 K0 |6 A
  51. #define DMA_FN_OUT3 Y  n, J2 [+ Z% V% m4 K/ U
  52. #endif" K$ Q" w, G1 I( Y  m
  53. 9 G: q& x/ E$ v$ K2 p
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ P8 n6 Z$ \7 k( T
  55. #define STATIC_SHIFT                3/ W6 k( k8 P4 C: }8 U- w+ y% h
  56. #define TCINTEN_SHIFT               20
    $ a7 {1 E( F& c! m% i. R
  57. #define ITCINTEN_SHIFT              21# ~8 x1 R2 C) [3 O2 f6 h5 ?( n) P
  58. #define TCCHEN_SHIFT                22
    # D! {4 u* p( \% e9 U" o+ m
  59. #define ITCCHEN_SHIFT               23
    , o/ ]* `, L  I8 m2 y; Y: G' h
  60. 6 d! Y0 Q9 x) q+ P% S, [2 F
  61. static volatile int irqraised1 = 0;
    3 b  b+ `5 k4 b; C
  62. static volatile int irqraised2 = 0;
    & X. q% _( W: g% @( |; w
  63. / c5 T( C% P7 f8 D2 x! `7 m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & G, l) E% X! i* {" q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! O: K+ U7 j" T$ d3 s# B/ D5 ^' p7 Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ |- A6 z) @& G  `5 O
  67. 9 ~* o) G% o3 }; ?. K; L9 y
  68. dma_addr_t dmaphyssrc1 = 0;
    1 d: t3 A! o3 A. d3 H
  69. dma_addr_t dmaphyssrc2 = 0;
    3 _- Q8 F% \6 A' z0 J! W
  70. dma_addr_t dmaphysdest1 = 0;
    - ?: W1 j% ^# U" I0 ~
  71. dma_addr_t dmaphysdest2 = 0;
    ( w& g5 P' \: y1 \8 V' E
  72. ; I2 G1 W8 g$ o* T8 A% k
  73. char *dmabufsrc1 = NULL;
    4 Q( T$ p8 v& }8 L  R
  74. char *dmabufsrc2 = NULL;* [1 C" A3 f1 h# u8 t3 h" Y
  75. char *dmabufdest1 = NULL;
    4 Z0 P% S* }0 `, ?% C6 q4 a; P- w
  76. char *dmabufdest2 = NULL;
    ; a! H) K% W" S  m/ y' Q, Y0 Z

  77. ! o& o% d7 J! A- N5 R
  78. static int acnt = 512;
    ; @" q, B- C) l2 E. A
  79. static int bcnt = 8;" y# z1 n$ Q7 g+ p
  80. static int ccnt = 8;
    ; s9 p+ C# W) A, c3 X* E  g6 E
  81. 9 Q' \( Q  \- \. Y
  82. module_param(acnt, int, S_IRUGO);* \! j' D9 j3 w% c: F
  83. module_param(bcnt, int, S_IRUGO);
    % M4 m* X6 e- F- e) S) m1 l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) x" f6 @/ {' a' u
9 C( l6 S# |0 t" U) ^* A/ G
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) |1 k+ L. i, ]. T8 @) E% [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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
5 s9 S8 E2 F& P# J8 H5 ], n9 O     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。; M% E* r4 [, l9 o/ \) T

: u9 g+ e. X8 ~, F; v7 a. j% V& t6 v; `  a0 n' n2 H, p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-7 01:03 , Processed in 0.040803 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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