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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 3 G, ^( I4 r8 J
  1. [code]EDMA sample test application  w; w6 A: B; E% M( E9 `
  2. /*! u  E( T5 \  g# e1 S2 `* G: k
  3. * edma_test.c# B3 |/ @7 p5 }( `: f/ L
  4. *
    : \: R+ w) `0 o2 p
  5. * brief  EDMA3 Test Application
    2 p3 I+ P4 p' v6 E! |! g0 Z
  6. *
    : v' e/ z3 N  I* L* y
  7. *   This file contains EDMA3 Test code.1 n) e) F3 ]8 @+ N$ H5 p' {
  8. *2 P! `- F1 _. P; b% g( k. y* B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " \6 c2 S3 D* |# b9 i* Z7 z: [, u! C  F
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    6 j2 {/ O3 v' S% Z
  11. *         TO CHANGE.0 K: E, d4 s- D, W7 A9 _8 L/ u
  12. *
    ' q9 t3 d! m5 i! G4 y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # q9 v& X% a; @- z
  14. *3 S$ K1 _9 y/ [9 H
  15. * This program is free software; you can redistribute it and/or( l8 R: g1 N6 |* J" u+ r! k4 H; J
  16. * modify it under the terms of the GNU General Public License as* H7 z( m5 \* J0 P
  17. * published by the Free Software Foundation version 2.2 \* i- |0 S8 F/ m+ t8 a
  18. *2 x; G  |  l% N: [% v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any" h6 y( T/ R9 h% s
  20. * kind, whether express or implied; without even the implied warranty2 ~# U. A& c7 F' _; D6 i) f/ B9 h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 {+ F& ^( v) O0 U' X
  22. * GNU General Public License for more details.
    2 ~7 ~" g) r+ {
  23. */
    0 ?/ K# a  y& ~

  24. ( b3 M" G7 q, B2 N
  25. #include <linux/module.h>
    ( i) P2 {- c1 s7 n5 j/ i
  26. #include <linux/init.h>
    / l6 Z! _$ ]3 a, P: C* r, f( N5 N
  27. #include <linux/errno.h>
    7 q+ ?; \3 B4 K4 Z7 U
  28. #include <linux/types.h>
    % B# B  _, ^: |( F# Z" a9 ~
  29. #include <linux/interrupt.h>
    $ X+ F) Z# j: t" u0 t. k6 o
  30. #include <asm/io.h>
    4 C# x3 L4 k; ~+ B
  31. #include <linux/moduleparam.h>$ f6 v5 R/ |7 D9 C
  32. #include <linux/sysctl.h>
    . x  p. s* W, \% `6 g# @; V1 A5 A
  33. #include <linux/mm.h>) y9 H1 a' _4 {# {  ~
  34. #include <linux/dma-mapping.h>
    5 Q* W9 a) O7 p4 e; x
  35. ! `' [* y  t; `! b) P4 l
  36. #include <mach/memory.h>
    / {* }9 [. ?9 z% K( A9 A
  37. #include <mach/hardware.h>4 |" F( A% ^0 F6 Q! Y: K' _# `
  38. #include <mach/irqs.h>- O5 t0 h; @0 n2 Y
  39. #include <asm/hardware/edma.h>. s% S, j0 }! g

  40.   ^% B! S7 b! Z6 \+ U4 X; I0 X
  41. #undef EDMA3_DEBUG% {* r2 V4 [4 d- V$ y4 E! Z1 Y
  42. /*#define EDMA3_DEBUG*/
    1 @' w) q) ^" Z
  43. * I% W' ~4 t9 h8 ^6 O/ L" Y. i' ~
  44. #ifdef EDMA3_DEBUG
    + g3 b; y% `) O) y: k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ u2 `& {+ X: h3 m0 C4 A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 S/ b- {: T5 l0 I, n7 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 v% D  V/ J- r( J5 h
  48. #else2 i3 p5 d5 ]7 x. D! T
  49. #define DMA_PRINTK( x... ). |% u$ y8 L" B+ U8 t0 w' m' m# r
  50. #define DMA_FN_IN0 ~# N5 u3 w' b$ t! \( V
  51. #define DMA_FN_OUT  g4 Y4 y. A8 D. G8 G
  52. #endif
    # Z& j1 z7 O$ Y: C

  53. ! N1 b5 I* c, Q. K0 }
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % |) |) h, m* h$ z$ V' b. P- l
  55. #define STATIC_SHIFT                3  x+ L. e8 M! a' _6 l8 s
  56. #define TCINTEN_SHIFT               20
      P, d, i/ N& S8 O& @/ ~
  57. #define ITCINTEN_SHIFT              21
    * T% i& [7 c0 ]' D7 D6 y0 K
  58. #define TCCHEN_SHIFT                22
    - J. B0 b* |- F- a; N. {8 k+ J
  59. #define ITCCHEN_SHIFT               233 G3 s" u! D* M' @! Q

  60. & O* I9 M1 o& j- C9 ~2 }2 j3 u
  61. static volatile int irqraised1 = 0;
    + P( |5 U3 R0 g0 t6 n( @
  62. static volatile int irqraised2 = 0;
    & m4 _+ O9 W0 O+ q" `- u, d

  63. $ A$ _- a( G+ f, W- E% T
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & c' n  s1 ~( p3 h8 T! S
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 G8 R5 z8 a6 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' c  L! r* a( s4 v/ V
  67.   v5 O$ I/ I) g) W8 [. _# Y
  68. dma_addr_t dmaphyssrc1 = 0;3 n; l* U, \7 p- ^' P. j
  69. dma_addr_t dmaphyssrc2 = 0;( d* t0 G2 ?! s
  70. dma_addr_t dmaphysdest1 = 0;4 B/ v+ t  F) H! r$ g
  71. dma_addr_t dmaphysdest2 = 0;
    + K9 c$ z: i3 P3 k5 @) G
  72. : y5 f4 ]/ h' G3 I
  73. char *dmabufsrc1 = NULL;
    - f+ A5 j* h1 S  s, G
  74. char *dmabufsrc2 = NULL;
    1 a4 w3 Q9 V# R. V* o1 J0 b) V
  75. char *dmabufdest1 = NULL;
    0 m9 x& E7 a2 S, ^
  76. char *dmabufdest2 = NULL;4 ?' v# F! w4 N4 w

  77. / ]' Z% ?! T* m
  78. static int acnt = 512;
    2 k' u& y0 t- ?
  79. static int bcnt = 8;* r/ J3 W7 H- w# S' k# P  ?
  80. static int ccnt = 8;3 O- e, v3 G! r. I8 w

  81. 5 Z  O% }3 n  N; I
  82. module_param(acnt, int, S_IRUGO);
    & ^# @# \# I0 a( Q5 A$ V% {4 w
  83. module_param(bcnt, int, S_IRUGO);
    0 a; v9 x+ C4 w* h* k. E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* K  S2 D9 n" S( w+ m: G, X
) S$ [% o+ Y$ }7 O3 d# v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ y& t0 k4 N- P; Z. A- 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% K+ y  {; L# m* H" w$ P; G  a: `
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( |0 d8 o8 E2 k) q. ^6 ?, k

* J" q$ Z5 A7 q! `. }% K7 s4 {3 N9 A! }% h$ C& y0 i
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 01:27 , Processed in 0.042404 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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