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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
  A5 K# {; L$ ~) {4 m
  1. [code]EDMA sample test application) ?% U8 v% Y2 p2 z+ p6 ~  w
  2. /*& Z+ M1 |" ?) Y0 C0 s
  3. * edma_test.c2 w& ^  b2 h; K4 F8 u, @3 e! v
  4. *
    7 w. k, g; R7 `0 y& W
  5. * brief  EDMA3 Test Application0 L/ a2 _4 K( a* \
  6. *  Y1 `5 ~# S+ }
  7. *   This file contains EDMA3 Test code.
    ) c) h4 t1 L: |1 ^
  8. *7 `1 X; u4 ]. L9 H# H& T# r7 n+ {* _
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 q8 s: |4 P$ a/ j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    / x% D, g# |2 R2 ^# g
  11. *         TO CHANGE., {! a6 O. s+ c/ A$ s
  12. *+ ?, u$ B6 K4 m/ a, i  d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, p( H# P/ O: T/ Y
  14. *
    , a4 `: [) G0 ^+ C
  15. * This program is free software; you can redistribute it and/or' ?5 `1 u- l. _
  16. * modify it under the terms of the GNU General Public License as
    # x4 x$ S& t2 i' G: I+ c
  17. * published by the Free Software Foundation version 2.
    : ^2 K1 s1 y) v# B. d8 C, N( L
  18. *, \( `5 g4 ~% b6 s; ?6 Z
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - I' z/ ~0 q0 w, e, o
  20. * kind, whether express or implied; without even the implied warranty6 b, w/ J4 J4 N) T' ]+ G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! |! N) `3 O3 }" d# R
  22. * GNU General Public License for more details.
    5 y( P% v/ U2 W2 D
  23. */
    7 x3 m2 F+ ^) Z' x+ J8 }
  24. ; t' }, c, n% U
  25. #include <linux/module.h>' o7 P1 l6 W/ Y: a' v2 v5 E- c" z2 t
  26. #include <linux/init.h>
    / Z8 L) I8 o( u. w" d9 H
  27. #include <linux/errno.h>
    : t4 k% F" ~- V- Z- b5 S% |* I( k
  28. #include <linux/types.h>
    . H8 S  A& D7 D6 W
  29. #include <linux/interrupt.h>1 ~$ V. F& a' c6 _" B
  30. #include <asm/io.h>% @! G8 l' f7 v2 n' s6 N; C
  31. #include <linux/moduleparam.h>
    $ y/ x) N* J3 T% }* u
  32. #include <linux/sysctl.h>$ L1 x7 `7 C, U% V/ W" A; p; h
  33. #include <linux/mm.h>
    * S' }5 V9 _. J. _/ U" F
  34. #include <linux/dma-mapping.h>
    / G- p! s( x. M6 t" i
  35. 9 R' T$ \1 D! D; C5 M0 O. ~
  36. #include <mach/memory.h>
    ; T0 C) P' N5 g$ B
  37. #include <mach/hardware.h>
    8 f  Z  G% N) f. Y2 t
  38. #include <mach/irqs.h>
    * N. ]7 b$ r$ r
  39. #include <asm/hardware/edma.h>0 o% }! l* G8 ^

  40. & V' r8 y  |  `
  41. #undef EDMA3_DEBUG
    0 R3 v: |  [) ]5 j0 u4 m
  42. /*#define EDMA3_DEBUG*/
    9 l- r: A% _! _, f; }

  43. $ e& ?. G& k. u# I
  44. #ifdef EDMA3_DEBUG1 O2 ^. ~; D: t% k$ i8 v0 s
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    / N% T  N5 @6 P: q" R8 b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " {  t. s' c8 d: V" ?; Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , D( i0 ?: R  S$ A
  48. #else
    ; b" R) e4 N" M) D6 F
  49. #define DMA_PRINTK( x... )
    " M+ l2 v& f" h$ n, j
  50. #define DMA_FN_IN1 l) p( _: ^& z- Z- M4 b" _' G
  51. #define DMA_FN_OUT
    8 z# h5 |+ b  G# I, `3 W$ X
  52. #endif4 m) }" t! Y: W2 K1 ~
  53. 5 |3 a# q  L  y  T" E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)! ^( M3 d- F) i$ n7 G
  55. #define STATIC_SHIFT                3
    - F1 l# [! c: k1 z4 F. I3 C" c4 {1 D
  56. #define TCINTEN_SHIFT               20. |) ^" Y; C) g6 h! J' E
  57. #define ITCINTEN_SHIFT              21" c' r* q% k0 n. o) ~; l2 i2 S4 ~! ~
  58. #define TCCHEN_SHIFT                221 g: K6 [: h: }' I6 [; j
  59. #define ITCCHEN_SHIFT               23
    1 F  T) d4 s# _( z9 G
  60. ; l1 z% e3 M( O0 M5 E
  61. static volatile int irqraised1 = 0;
    + Z; r6 U* R! J6 |5 s7 y3 i
  62. static volatile int irqraised2 = 0;
    7 P+ w2 q, ^5 j# l& P
  63. 8 Z4 ?% B! K5 c+ v- q* z4 W
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* E- z! l' y: K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" s# Z# Z8 h& S3 Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# a" v9 F0 ^: M  o
  67. ! v& x; [7 E) t2 [7 Z
  68. dma_addr_t dmaphyssrc1 = 0;
    4 a: V2 u4 i0 e( }2 E3 K
  69. dma_addr_t dmaphyssrc2 = 0;% v9 N( K, F; }1 g$ |
  70. dma_addr_t dmaphysdest1 = 0;8 Z$ J2 W( i. D9 L* B/ i1 }1 t
  71. dma_addr_t dmaphysdest2 = 0;" X* \/ ]- V3 I5 V# }

  72. ' ?( Z# c9 w1 V; J4 ?8 D8 ]
  73. char *dmabufsrc1 = NULL;
    $ C- h7 T& q  L
  74. char *dmabufsrc2 = NULL;
    6 t. G( \$ X& [  k
  75. char *dmabufdest1 = NULL;
    ( K: V9 u1 _* s; P- D
  76. char *dmabufdest2 = NULL;' d8 L9 G5 z% ^- X1 r' U8 J
  77. 4 t' f3 [, [7 L0 _1 X- b0 a
  78. static int acnt = 512;
    - s6 x7 h3 C5 B, V% j
  79. static int bcnt = 8;  ?' j3 ]3 F* ~7 J( h3 L
  80. static int ccnt = 8;- G7 k6 f$ `; Y
  81. ( e! Y& d* T% d
  82. module_param(acnt, int, S_IRUGO);0 q2 z1 B. P. h! b$ r+ I8 N; M# M
  83. module_param(bcnt, int, S_IRUGO);
    % o; ]) q, U5 }; H  J" s2 F- f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
& b+ Z- i4 Y0 L& O# A

; @) E. U$ Z( H# p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, J, ~3 s1 Z% j0 ?/ ]1 p: d& L9 U
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 K4 }7 _: h" z% l+ U! O0 H) u     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: i/ `/ m( @0 O

' V5 `, v" [9 D" h% `6 m0 }- ^0 n( E1 i  u: f) X6 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 18:56 , Processed in 0.038964 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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