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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
; k- x/ I" H$ k. t8 W: I
  1. [code]EDMA sample test application+ X8 r8 w6 U4 O9 I6 V
  2. /*
    8 u! w- r. L: n5 D! S. P
  3. * edma_test.c6 i, S7 H" \1 @6 F
  4. *
    , w/ J- e/ H$ Z1 M! f3 o0 T- k- J
  5. * brief  EDMA3 Test Application7 p9 v  z( V) [) e! V
  6. *
    6 |- ^2 s/ E: ^0 m5 M, r
  7. *   This file contains EDMA3 Test code.9 g; y6 N; }1 s
  8. *
    1 X/ b! ]7 [# l  I' E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% h6 W0 {4 N& G' S& m# M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 ?% N  ~& r6 o6 F2 }9 X* \
  11. *         TO CHANGE.. r* q6 T. P+ n: h7 J) }: |  |# t
  12. *
    1 J9 b8 W4 X9 L, ^- {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 s- T  d0 W, K/ y
  14. *
    ! ], ]8 A6 x' x9 X' O5 X9 k$ q
  15. * This program is free software; you can redistribute it and/or
    0 {0 b; T/ W- ?) P6 y, Z! O
  16. * modify it under the terms of the GNU General Public License as+ E, _9 c4 ^* H& A" p9 |
  17. * published by the Free Software Foundation version 2.; {" Z* `5 D/ B
  18. *9 X, E. p& c, p& ?0 T6 n% H5 y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 D* S& U; Q* Y
  20. * kind, whether express or implied; without even the implied warranty9 W9 S* F+ }6 {3 t; T0 b2 l4 `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, O. H" [, i: Z+ [9 l
  22. * GNU General Public License for more details.
    & \+ q) r6 z# Y8 l7 Q; \3 r
  23. */$ Z5 I, @0 w! G4 S

  24. 1 e' X/ E) U' r( E; C$ L
  25. #include <linux/module.h>- E: f( d! K1 @
  26. #include <linux/init.h>* J; j" a6 {) x- E' j) K: y+ z. f
  27. #include <linux/errno.h>- u3 L7 E' Q' v) O% k
  28. #include <linux/types.h>
    ; x9 i% V, [/ t8 T
  29. #include <linux/interrupt.h>
    ' [9 u& v9 _2 I$ X3 q; `" G
  30. #include <asm/io.h>
    6 A( t  i- ]3 J$ Q3 q
  31. #include <linux/moduleparam.h>
    0 e2 n0 s3 O+ ^% J5 w0 l
  32. #include <linux/sysctl.h>( t% I; n: F6 h3 U- v% F
  33. #include <linux/mm.h>+ N5 P9 I) Y( X
  34. #include <linux/dma-mapping.h>
    ) o. s" b7 z* B

  35. ( L4 D  a' ?7 j2 q3 G
  36. #include <mach/memory.h>0 z7 B$ A$ _1 c
  37. #include <mach/hardware.h>) I0 h: {1 V! N4 J$ h
  38. #include <mach/irqs.h># Z) s4 `; a1 P5 t$ y4 I
  39. #include <asm/hardware/edma.h>
    / ?! T4 ~4 K: k+ [/ G# }8 J( O2 O

  40. 5 \. F. L, A2 v, y; _( A2 P8 n- f
  41. #undef EDMA3_DEBUG7 O4 h% D. y- a
  42. /*#define EDMA3_DEBUG*/& A1 y. ~2 l+ |7 _

  43. 1 I2 Q; C- g& F8 M7 ]5 H1 \7 \
  44. #ifdef EDMA3_DEBUG& W+ [- l1 @: |! m6 d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 N; H0 W! G! E1 k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / ^8 @7 ]# C' }: h2 e: [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - u6 k2 @& L! N) s
  48. #else$ ]/ }1 ~. K( g& x* ~  L
  49. #define DMA_PRINTK( x... )
    6 Q7 [' K% Y. l6 t( u& Y/ \
  50. #define DMA_FN_IN
    % `% J5 z" K* v2 x2 `# d
  51. #define DMA_FN_OUT3 \8 f$ j* V" v0 N+ h: K
  52. #endif) ]* c3 {3 K: g' K# \
  53. ( Y1 D3 F. c* Z* k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , m3 i, E1 j* ~& s* L
  55. #define STATIC_SHIFT                3
    ; D+ h/ ~: [5 s! s" m/ a7 ]
  56. #define TCINTEN_SHIFT               207 u! ?6 R  C* v7 ?
  57. #define ITCINTEN_SHIFT              21+ _5 O" ^. c& _- x+ X: m8 }$ c" C
  58. #define TCCHEN_SHIFT                220 ?: M7 k, [8 w+ D: {7 v& B* r( |2 \( D
  59. #define ITCCHEN_SHIFT               23: z+ {$ y( F: `2 G! V  J0 d7 B
  60. . R2 i8 t! M* i0 g, w
  61. static volatile int irqraised1 = 0;
    ! n/ b$ Q& O3 [1 M7 ~1 h
  62. static volatile int irqraised2 = 0;
    ) M5 Y' T8 [/ |
  63. 5 P5 U7 `6 x5 w. z/ u' m8 L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 S% q! J& R  ?  s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 G/ b: @/ b/ M( D7 f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , E. K4 u6 z# T& y8 r
  67. & w0 a4 u  p, }4 u
  68. dma_addr_t dmaphyssrc1 = 0;6 f; g3 `+ f6 a( e4 S) L
  69. dma_addr_t dmaphyssrc2 = 0;0 L2 G! y9 b' r6 n+ C- g
  70. dma_addr_t dmaphysdest1 = 0;( z' a" e# w3 s: h0 v& h
  71. dma_addr_t dmaphysdest2 = 0;
    * F& f# F6 q2 r5 B: ^+ `  [2 H% O
  72. ) ?: O# Z& p( n
  73. char *dmabufsrc1 = NULL;* W- R6 G5 C% Y
  74. char *dmabufsrc2 = NULL;
    ! u. }3 ^& G1 |0 L9 F8 l
  75. char *dmabufdest1 = NULL;
    + ^& {' Z# f. z: R
  76. char *dmabufdest2 = NULL;# r6 o2 x4 }0 t+ P4 z9 h' F9 d! Y
  77. $ l# N" I  h* j  A# c% h; e
  78. static int acnt = 512;
      ?) \( _; A$ w# P1 |1 p3 c
  79. static int bcnt = 8;
    : i2 |* |$ \" u6 ^
  80. static int ccnt = 8;
    % x6 B& u4 B% M  j' c" C
  81. : s1 k) I  M2 p' Z1 j- D( O8 c' g
  82. module_param(acnt, int, S_IRUGO);
    ) b% i; x/ L( S) [
  83. module_param(bcnt, int, S_IRUGO);: s3 A5 r, w+ b; z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 ~. W' k7 ], x! m6 |; H
/ _, i, @5 ?/ p- E
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用2 j$ [7 @+ `. B( p$ F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; ]7 V( R* ^7 u$ D8 X1 M     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
* y( H5 p' U, C/ V* s! d- ]- ^1 p

! B+ K! g; x- Z- t) c, e3 c; w/ C: s
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-14 04:44 , Processed in 0.039974 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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