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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; H' u; J4 k! e5 z  g7 W8 f
  1. [code]EDMA sample test application* \( U+ \+ {) I2 j. m9 s% u
  2. /*, `; h: B. d2 A
  3. * edma_test.c/ [4 ^9 m# m  N) w
  4. *
    7 N1 |( O2 _9 D" G# M, m/ X3 ~
  5. * brief  EDMA3 Test Application9 D. D2 {3 ^2 |* a) N& ?
  6. *& q! F( s$ l* Z& u7 l
  7. *   This file contains EDMA3 Test code.
    / O2 A8 M" D3 g' E( k
  8. *% k& S* Z& ~& w8 M3 W- N- s* c
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / ^: T# L7 O- X
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    $ G8 b+ V$ ~0 `  W6 i* S
  11. *         TO CHANGE.
    ; E  u% ?& {) r' e
  12. */ d, R8 x$ O4 S% {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( H7 r* F1 H) K9 Y
  14. *
    - J( h8 x2 d2 ^# b* S
  15. * This program is free software; you can redistribute it and/or* s3 [$ N- J8 j+ Y1 _5 t" e0 @
  16. * modify it under the terms of the GNU General Public License as; @' u. K8 V3 A' D& f
  17. * published by the Free Software Foundation version 2.7 U( {4 x2 n1 q" N3 p5 E3 ?
  18. *6 r& r* W6 B9 ]" u: ]; @
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 V: j: j; t$ R: N6 E
  20. * kind, whether express or implied; without even the implied warranty9 F& [; R( ^1 ]7 S  z
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& f8 K$ V" S: l1 o8 v
  22. * GNU General Public License for more details.
    9 U4 F4 Y7 a4 M6 U# p7 B9 P
  23. */
    ; h2 J1 l& A# O$ J9 a5 Q6 E
  24. $ O8 t! Y& ?8 s1 s: y- a% T
  25. #include <linux/module.h>
    $ R, H" o/ F8 ]. F
  26. #include <linux/init.h>
    0 |2 m! ]0 a# p  J- E  P0 q
  27. #include <linux/errno.h>! `2 v" V0 T* Y  i2 E3 P1 h) d1 S/ D
  28. #include <linux/types.h>2 Y" y; N# r& R0 k3 m# C/ U
  29. #include <linux/interrupt.h>
    ' O5 H9 Z7 y( L; O  ]9 ]7 |$ W
  30. #include <asm/io.h>* L- j2 I6 a4 D+ a& v
  31. #include <linux/moduleparam.h>
    ' U7 x: Z- t2 q, Q( g
  32. #include <linux/sysctl.h>
    6 W# a0 t( B7 d  @- U' N0 o: z9 [
  33. #include <linux/mm.h>
      z5 w" q& A& L1 d
  34. #include <linux/dma-mapping.h>
    + f  g! l: g4 a" k* e+ a; J

  35. " L( q' J) q( k6 Q
  36. #include <mach/memory.h>  L; g6 r3 Z5 w- y% z
  37. #include <mach/hardware.h>9 n) X' r  I# w+ E+ C3 a0 @- x
  38. #include <mach/irqs.h>
    # l3 M5 Z8 M/ G2 I( i+ H3 m
  39. #include <asm/hardware/edma.h>& c; @) t" l) O. x& x  T

  40. - R6 N  c, s  _0 B9 T7 q/ C
  41. #undef EDMA3_DEBUG4 Q# ^' V; g6 ?) ~/ C' V( k
  42. /*#define EDMA3_DEBUG*/
    / ?) p: ]& k2 |. P
  43. . ?6 [* C  `  @
  44. #ifdef EDMA3_DEBUG1 |5 b1 j/ \! S3 J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : c( k9 Z, b$ F1 F4 K# e# m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    2 T, P* S' u4 O) n- l0 I
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 L) m. m, Q7 N9 [+ n! k
  48. #else# b" E& r4 B- g0 K+ T  [, n* C
  49. #define DMA_PRINTK( x... )
    7 w5 B3 ?2 M9 ]2 \7 `  x" Y
  50. #define DMA_FN_IN
    % S3 D; R8 t% D6 W& p( [4 O1 S0 s1 j
  51. #define DMA_FN_OUT# Q! a2 ^( I& d  b; P
  52. #endif
    " G& M) f( H# u( H% R: F  q

  53.   p- v$ O$ ~" d7 a- [- @
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)) v# ^) e' ?8 V: Y
  55. #define STATIC_SHIFT                3' T& T1 ~  h1 [: n
  56. #define TCINTEN_SHIFT               208 R& f; \; S# ]; l
  57. #define ITCINTEN_SHIFT              21
    1 `9 ?; i" s% K" N1 c' ^3 }
  58. #define TCCHEN_SHIFT                22
    ( c8 v+ ~3 D7 \
  59. #define ITCCHEN_SHIFT               23, k, U. L9 J! D
  60. " @) f$ S& x- c1 |0 S! g
  61. static volatile int irqraised1 = 0;; @/ I) |$ M' k' d* k9 K
  62. static volatile int irqraised2 = 0;- m% d% H! _  B8 l4 F, I
  63. 3 ~5 w& o$ }, B+ R
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! o$ g& _8 X. l2 _
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 o& P. i) @  G9 l* z& [: o9 N
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , B  ~6 [1 p/ B% x7 S0 b* d! Z

  67. 9 M9 X; H( V$ ]* U/ V3 X
  68. dma_addr_t dmaphyssrc1 = 0;% x' [3 T" w- f* ^7 @$ s
  69. dma_addr_t dmaphyssrc2 = 0;! v3 P0 ~. k+ ~# _- M' n" d- ^
  70. dma_addr_t dmaphysdest1 = 0;
    : O' [4 p: ^6 O$ s
  71. dma_addr_t dmaphysdest2 = 0;+ w" G- E7 M$ O7 Z8 H
  72. * z' ^, D* ]  U- d; r3 L
  73. char *dmabufsrc1 = NULL;4 l! b! E& G* ]. n4 G0 j
  74. char *dmabufsrc2 = NULL;
    + V- r/ U, T0 o+ u# L. h
  75. char *dmabufdest1 = NULL;& @0 Y) m" h' ?+ D6 e/ n) T. W
  76. char *dmabufdest2 = NULL;
    : ~  Y; R( Q/ v

  77. ! B+ j- G; X$ _. _5 X. [& V% v9 G% T
  78. static int acnt = 512;7 o, i# X3 T/ W# v
  79. static int bcnt = 8;
    7 h3 M& _( {) E- w, q3 g
  80. static int ccnt = 8;
    7 r) L  J, O$ g" \2 R7 I: Y6 i9 }

  81. 0 W8 e- q$ I$ z, w" _& L; j
  82. module_param(acnt, int, S_IRUGO);. s  @* `+ B" u
  83. module_param(bcnt, int, S_IRUGO);
    # R2 M. r7 f& x# ~. D3 g" z' a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) ^# V4 z2 C' R5 h. L' r7 {) S" _- ^; p+ I/ Y: q+ X# K
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 P7 E+ m' p2 U6 ]
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) p/ G+ v' h" ^% q- z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. ]1 v8 x4 U7 f' W6 b# V  [" n7 g3 P7 m. K/ [3 I
: G7 {& M- t/ B" @  R3 T. f$ |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-14 06:50 , Processed in 0.038622 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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