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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! |8 a- p: @# h8 x/ F: o
  1. [code]EDMA sample test application
    0 B; w1 K! N+ E7 K1 ^/ x6 Z2 G
  2. /*' E1 f. K" m7 `8 e2 Z. C
  3. * edma_test.c3 k6 L9 j5 h5 J8 f' ?
  4. *7 ^) x5 G' q+ u5 B& f* ^2 M: D
  5. * brief  EDMA3 Test Application0 `0 j9 G5 k& P/ m
  6. *
    ( c  c/ f* k4 {3 Y; @
  7. *   This file contains EDMA3 Test code.
    0 _. E6 @- k% c  a' d! K$ n( J4 y  |
  8. *
    * i5 `, |. j7 k( n* l9 A, E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " S# _! J9 y' j! w! d
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ' n) P  V4 x  ?* L3 w: Z; W" n
  11. *         TO CHANGE.
    ! W- R- c  j+ L" n
  12. *: C  v. w4 i) P3 [
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// w) D- h" b/ E* g& b) v) O
  14. *8 r/ H( Y, N. j- M* Z/ s
  15. * This program is free software; you can redistribute it and/or" g  ]  t) X5 E1 ?' ]. O: X
  16. * modify it under the terms of the GNU General Public License as
    : a5 K; z' I# h9 x3 |6 V
  17. * published by the Free Software Foundation version 2.
    ( I5 N3 L+ ~3 g
  18. *
    " V5 y) t( s9 w; `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 m8 u. H3 |: N/ T
  20. * kind, whether express or implied; without even the implied warranty
    : o- ]% g9 T* M! E  M# ]
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% q: w" t: v. Z
  22. * GNU General Public License for more details.7 a- `) T; {! x# l) F* T
  23. */- P$ q: s: _$ t* j2 L0 Y

  24.   S9 |* c6 `* M
  25. #include <linux/module.h>
    ! S5 A, [. d$ ]4 q% w
  26. #include <linux/init.h>$ C" E2 X# \! u) D8 B7 a
  27. #include <linux/errno.h>
    + ^7 a, I, F. h
  28. #include <linux/types.h>
    ; m& g) K9 x( M* d
  29. #include <linux/interrupt.h>
    6 Y% w4 n/ b5 E" u6 s+ ~: a
  30. #include <asm/io.h>" m  G7 d& V& P% Y+ q
  31. #include <linux/moduleparam.h>0 _6 [2 W4 w+ V
  32. #include <linux/sysctl.h>  z8 [6 _0 F% z8 |; V
  33. #include <linux/mm.h>! x) B$ _. J  @! z
  34. #include <linux/dma-mapping.h>$ R, t+ n: I$ }, r$ A

  35. . K" K+ w: U) {2 I5 |' c* q" S* ?
  36. #include <mach/memory.h>
    * f- l8 a/ \3 e8 a6 t5 d7 N
  37. #include <mach/hardware.h>
    9 N) S9 s. Z' N5 T/ e
  38. #include <mach/irqs.h>
    $ x. R" d9 q) g! Y) ~+ q" v
  39. #include <asm/hardware/edma.h>
    : l2 b% }3 B) q  T+ C% B
  40. : r/ W0 q4 ]* U/ L
  41. #undef EDMA3_DEBUG
    ) P- G7 |5 T! O3 C" ~( Z% D) I6 s" D
  42. /*#define EDMA3_DEBUG*/  X  J3 |' \0 y( C; }6 g0 p9 i  g

  43. 2 a7 w2 O& N# n' j& U* F
  44. #ifdef EDMA3_DEBUG
    0 d0 N. ]! G  i8 b7 y
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 t; c4 F" W: N( _- l) H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 B5 k" y9 v, F& P% O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)3 i5 f! s5 z* v* X- d$ Y, h' Y
  48. #else- c# B5 c/ p6 P9 Y0 F$ m/ D( r
  49. #define DMA_PRINTK( x... )
    % q; r  C$ W* B2 Q
  50. #define DMA_FN_IN, v6 J% H/ f. E; P( f1 M5 l
  51. #define DMA_FN_OUT
    4 V( ?& r4 F) h- |6 b
  52. #endif5 s; f1 j! H" l' ~% ?5 F3 U

  53. 8 h1 i7 `: S# m: M7 O/ \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " |# }7 p, i2 ?) Q& P+ M
  55. #define STATIC_SHIFT                3
    1 J: v) \$ [8 O, L# Y
  56. #define TCINTEN_SHIFT               20" o6 a% d( x: s. ?3 ~( H% M
  57. #define ITCINTEN_SHIFT              219 Y# a" f4 U3 @8 b
  58. #define TCCHEN_SHIFT                224 b& y) w; q( n. s& D! b. ^
  59. #define ITCCHEN_SHIFT               23
    $ C! n9 I3 ^' K
  60. 9 j$ \" H& O+ R8 p% A
  61. static volatile int irqraised1 = 0;* h; M, j% x9 B0 S
  62. static volatile int irqraised2 = 0;
    2 W* U2 f6 S" a8 a
  63. . F" R. G$ u/ j  d: |( v3 Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- |9 p, x4 P+ G3 M0 l( A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 v* N4 N: o% S# R2 P- `' x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & j) l7 [4 a: b
  67. ' v0 {. w: x* `" \* g5 o
  68. dma_addr_t dmaphyssrc1 = 0;$ N( l: `0 l6 [. x$ o) M0 W4 c
  69. dma_addr_t dmaphyssrc2 = 0;3 N. l' c9 v# l
  70. dma_addr_t dmaphysdest1 = 0;; t( |' I$ m8 S6 v& {' o
  71. dma_addr_t dmaphysdest2 = 0;- |) i4 w* ~" u2 w; `% c+ H; T3 K1 {

  72. ; z3 R' \2 c  p/ m# o
  73. char *dmabufsrc1 = NULL;" x7 `0 B% U3 T% G& c; p* C# y
  74. char *dmabufsrc2 = NULL;; m3 N8 @) g6 M
  75. char *dmabufdest1 = NULL;* L' C. N" m" ~, f; W8 [8 S
  76. char *dmabufdest2 = NULL;2 @# w, m. ]( i- ~% E
  77. 2 J$ @: }( m# H  m0 X. W2 L+ i
  78. static int acnt = 512;
    ' v  G1 S: m" Y# A6 Q9 p- X6 E, W* P
  79. static int bcnt = 8;6 B' k! L5 H) U3 I: D2 ]
  80. static int ccnt = 8;
    ( U2 B  |+ |5 Q8 {5 j
  81. 9 Z8 M2 {0 \* ?2 ~8 \% h
  82. module_param(acnt, int, S_IRUGO);
    * x/ E( I; @! A$ {
  83. module_param(bcnt, int, S_IRUGO);
    ' P! R5 D) L* _3 g7 W5 n: C% @
  84. module_param(ccnt, int, S_IRUGO);
复制代码

9 D4 @$ ?' o  N: p
9 E7 d8 q+ g; D  W( f5 U4 q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) v: S% [, Q3 W% J
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 z+ x/ B' C$ s. N0 e( @8 r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" e3 ~$ J% b7 W  r; _+ \
+ v' I9 B8 M/ q  j1 i; L- r
* P; O5 o% I! g4 j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-10 08:12 , Processed in 0.071799 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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