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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 s7 r0 V  d  U+ \+ `* v2 D* c
  1. [code]EDMA sample test application. y9 r7 ?' N1 ^& i4 h. Z& c7 C% j
  2. /*! l' ~" z, u, q: n
  3. * edma_test.c/ D, `' P. o6 [3 U
  4. *
    ' D. ~- Q5 Z. H4 t8 m2 M" V
  5. * brief  EDMA3 Test Application
    3 w( D# y) P; o4 o0 _/ \
  6. *
    " Z1 p. c, R1 i& r+ P2 K% O
  7. *   This file contains EDMA3 Test code.
    ( H. p3 Z4 n4 i/ [/ d2 n. o2 h' _
  8. *
    2 l: D3 n9 S5 H& T& c  n3 z! I  ~
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    . x+ p2 d$ d) X, ^  F- h2 m2 g
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# j. l1 z* m1 L' E
  11. *         TO CHANGE.
    - a3 {% V/ g. p  K. K
  12. *! G% r0 i, T  F' ], I5 C
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/& y3 ~/ [5 r( p+ z: Q
  14. *
    2 c" r3 ]( L8 S3 |
  15. * This program is free software; you can redistribute it and/or
    % q. w* _# f/ u$ T% F
  16. * modify it under the terms of the GNU General Public License as; h( O* |* y3 L/ m/ n5 a8 x
  17. * published by the Free Software Foundation version 2." b+ d8 e* C1 `  X: V! W
  18. *
    + R+ w6 |7 N7 `0 A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' X0 O  a% M; t# J3 \2 z1 x9 c' I* U
  20. * kind, whether express or implied; without even the implied warranty2 Y' }" P, Y1 A/ X  t* R* k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    5 S6 z. }% L) l2 e" r9 t, Z
  22. * GNU General Public License for more details.
    ( C$ x% b7 u) a. h5 ^( e
  23. *// w" q- j1 Q7 y4 g
  24. % }9 Q: O" d% S& s
  25. #include <linux/module.h>7 w0 t; F& J8 P9 t% Z
  26. #include <linux/init.h>; O& S, q3 t! c; z- c3 z" g
  27. #include <linux/errno.h>7 y1 Z! {( R  \4 h( ^+ T( Q
  28. #include <linux/types.h>
    % P5 ~0 ~9 \4 f3 C& a0 @' n
  29. #include <linux/interrupt.h>3 Z% n4 l" j! }/ h
  30. #include <asm/io.h>7 x. X) D0 _( [
  31. #include <linux/moduleparam.h>% H" S- n& N9 S( B3 m( X8 o# O0 V
  32. #include <linux/sysctl.h>
    5 k) N6 C7 ]9 `4 _$ X
  33. #include <linux/mm.h>% u, x+ C; {! j* a6 U( `+ W
  34. #include <linux/dma-mapping.h>
    , ^2 a1 t% ^) @: _' j' d2 i7 m. H
  35. / w1 i( H6 }- t3 _
  36. #include <mach/memory.h>
    ' A$ `& e, M2 A) }& B4 V7 o  s# k
  37. #include <mach/hardware.h>
    . p8 |) K0 G. d1 b
  38. #include <mach/irqs.h>
    8 S3 y, M4 F9 Y$ n4 u& b) k
  39. #include <asm/hardware/edma.h>4 K5 f  c/ y  m' E4 G5 k

  40. & Q) z$ T  {7 q* q% v; a
  41. #undef EDMA3_DEBUG
    % t' Z) `4 q: y# F
  42. /*#define EDMA3_DEBUG*/' U+ ?5 w( m; G; B( q
  43. 3 z; J! o. h1 N; {* j% M
  44. #ifdef EDMA3_DEBUG
    , X: f2 W* S) B; E! U5 G( N9 A
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 v% {  B6 u& z4 E/ d. ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__), F) x! f# Y: A
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - d" a" g. I* e
  48. #else* M5 x" z( P# r) c' e
  49. #define DMA_PRINTK( x... )
    9 i+ L+ U  E. [) ?3 z2 I
  50. #define DMA_FN_IN
    : M- K# T2 Z8 u% L4 N. \
  51. #define DMA_FN_OUT
    + [! U1 N8 {3 ?* `7 {
  52. #endif
    $ T% T5 }  T6 {7 M
  53. 4 c) e5 P) X  [* H( B& V
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 \' P% A- [9 x3 D& r
  55. #define STATIC_SHIFT                3
    " ?+ C: A4 {% y7 ^
  56. #define TCINTEN_SHIFT               208 m  {. y, L: x. U% A  A# f6 v+ g
  57. #define ITCINTEN_SHIFT              215 \! z, F0 H4 @' V2 x9 |: M. x/ j8 N
  58. #define TCCHEN_SHIFT                22
    , `. B& V; z9 B6 e) T9 I1 H
  59. #define ITCCHEN_SHIFT               232 G3 B% x/ x$ Y7 t7 u) }) Q3 M

  60. / c3 H# X# W1 [! i7 E6 Y+ P
  61. static volatile int irqraised1 = 0;
    9 r$ ~) M" G# X# v
  62. static volatile int irqraised2 = 0;
    % @, m8 i# j" T# d+ _

  63. ' J6 {' }! y0 C. w$ O# _2 k3 {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & e- ]7 `2 F' P* |4 j/ B( F
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      H, D9 w$ j/ |/ y' J
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / {* t: ~  I+ b. t2 @9 u
  67. ) n. s5 G: {" L( Q! ?  j
  68. dma_addr_t dmaphyssrc1 = 0;+ I2 c/ ~" Y. Q$ m8 j5 }# I3 l
  69. dma_addr_t dmaphyssrc2 = 0;
      _7 ^: c" {/ }' u( Q5 z
  70. dma_addr_t dmaphysdest1 = 0;! X* \& I7 p# Z
  71. dma_addr_t dmaphysdest2 = 0;, x; q, \$ M+ H

  72. # J* z/ x& Y: U8 q, n3 [
  73. char *dmabufsrc1 = NULL;( k1 M" Y4 O" c# X( Y5 {8 j& n0 C
  74. char *dmabufsrc2 = NULL;
    $ Z8 q- Y6 T9 O4 y4 u2 B7 K
  75. char *dmabufdest1 = NULL;
    ! }/ I2 S, O# r) J* h
  76. char *dmabufdest2 = NULL;. j, U2 \$ ]  ~: m/ p; m9 C1 s& ^! G
  77. + g  @! f6 \, k: Y% |4 N
  78. static int acnt = 512;, ]: I2 s( x' Q. n: W6 z3 ]+ C
  79. static int bcnt = 8;$ w" A: S/ U" M& }0 m0 W# Z4 l: U0 ]
  80. static int ccnt = 8;
    ; M. q! C  `6 E7 T1 I4 ?
  81. * k& s4 h7 J! j0 K1 f! ~6 [
  82. module_param(acnt, int, S_IRUGO);
    4 H* j& R: v7 N2 P. o# o
  83. module_param(bcnt, int, S_IRUGO);+ _" `8 s* w2 M/ n
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) H. Q9 v8 q$ j. g2 T
0 t; w3 m5 n- h7 |. E# w      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! R  M, t" M9 R& T! n' B) Yarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。% {3 b2 R+ s' R7 y- I! U
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
. ^- c. X# K* ]* y: j# h  E2 W( Q- m
  R. [6 `3 k3 k  |5 A- T4 W, A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-11 11:40 , Processed in 0.040818 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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