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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . J  Q) E# x- m8 t0 w( {$ e# @
  1. [code]EDMA sample test application$ g( t/ A# p# Q" r2 R
  2. /*6 r; i, i$ w0 m. r: H& K/ o
  3. * edma_test.c
    " S6 A0 i5 |( G1 z
  4. *
    8 b, A: S- j) t, T. c6 H- ~
  5. * brief  EDMA3 Test Application, a, Q. Y, ^$ T- V9 [' k) m% j) W
  6. *
    , Y! l5 L0 n& d
  7. *   This file contains EDMA3 Test code.7 Y( {8 P  Y! ~* h6 W5 [
  8. *
    1 f( m3 ]6 q; m# M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 G, @8 ^/ p; W& A3 @4 J, r' ^5 G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# o7 @" x' s7 X  g' R
  11. *         TO CHANGE.
    3 V0 w0 n" U2 \( ]& ^# V, J! H( J
  12. *
    ! ~) `+ ?% n# l: N3 \5 q1 s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; u9 d- L3 F0 l( k+ M  x
  14. *
    - B; [) Y+ U9 E4 f8 `6 ~
  15. * This program is free software; you can redistribute it and/or
    0 v( f% h# p* g2 L& x
  16. * modify it under the terms of the GNU General Public License as
    2 J' v( M6 q/ o
  17. * published by the Free Software Foundation version 2.
      _$ x: ?3 ^- A/ i' U
  18. */ Z1 @; ^8 T0 S4 u) O1 c6 S
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! p$ `0 M! W' t1 X; R3 P8 J
  20. * kind, whether express or implied; without even the implied warranty
      v! w3 ]* l" h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! l# q, V' k+ P9 ]9 I- p* U1 J
  22. * GNU General Public License for more details.
    1 ], r7 A8 p: \2 U
  23. */
    : ~+ J( q  t9 N# e. Y

  24. & |9 H4 }/ Q# r3 W9 L6 |4 \/ ?& e
  25. #include <linux/module.h>
    ( [+ D  h7 X4 Q- A, _
  26. #include <linux/init.h>
    8 H" l, ~+ h$ F
  27. #include <linux/errno.h>
    * {% f" y0 g) c! w: [
  28. #include <linux/types.h>- m! f7 k& R+ s$ n
  29. #include <linux/interrupt.h>$ x' t  a. c9 F1 x0 _4 ?+ ^' i# J/ U" S
  30. #include <asm/io.h>) r3 p" u; h0 ~! X/ @( s
  31. #include <linux/moduleparam.h>
    5 y) Y6 J+ X7 U' s: _  A4 S$ l7 ~
  32. #include <linux/sysctl.h>4 D5 }  u+ Y' w0 j; X
  33. #include <linux/mm.h>& `6 h  T4 u0 C. M+ N% h8 F( c
  34. #include <linux/dma-mapping.h>7 Q* i- `) ^6 Q  g

  35. $ h+ o; C7 x  l
  36. #include <mach/memory.h>) {% h7 V- e/ M: a$ ~
  37. #include <mach/hardware.h>8 Q' ^0 k) h+ k
  38. #include <mach/irqs.h>
    ; c' z2 E% o& s: T9 S$ b8 ~$ `6 F
  39. #include <asm/hardware/edma.h>$ [, G# j* D4 w7 V% t8 x9 g
  40. ; j4 N/ ]8 @0 A3 T0 ~
  41. #undef EDMA3_DEBUG
    , s& Y7 r* |0 ^, C* m9 Q# i8 I, q
  42. /*#define EDMA3_DEBUG*/
    ' U$ S( L! r" x# D5 O

  43. 0 C0 u+ b4 N1 w
  44. #ifdef EDMA3_DEBUG# g: N' a- ]* z9 {
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ t+ i3 r+ R7 ~% _! K" T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; {, g' ?0 B- ]2 d! H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + ^) w- S; s3 e. m* i
  48. #else$ L$ {4 X6 x+ w" ?9 z( N4 Z
  49. #define DMA_PRINTK( x... )! g3 u0 [6 h. _3 v- z( D& f
  50. #define DMA_FN_IN
    4 ^8 {* C: I, P
  51. #define DMA_FN_OUT
    & b5 a! t( V% f6 d  I
  52. #endif3 b* Y! c7 J7 y$ i
  53. 8 X. n$ \. `0 y+ \
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; H" w6 X" _8 _# P
  55. #define STATIC_SHIFT                3# x( q6 W/ M" n! `, D# n$ T
  56. #define TCINTEN_SHIFT               20
    / M; W* U) f0 @1 X7 j2 h
  57. #define ITCINTEN_SHIFT              210 g; b8 d4 D; R) |1 v# `
  58. #define TCCHEN_SHIFT                22- G8 Y, m2 C3 c, |; w
  59. #define ITCCHEN_SHIFT               23& S6 m* r# r) W: c) E

  60. " K/ t. Q: K) f% ]
  61. static volatile int irqraised1 = 0;" v2 X/ s4 G7 L! @
  62. static volatile int irqraised2 = 0;* y0 \+ T# D: e' C& n6 F; r

  63. 9 {/ G8 N! b6 d3 K, _+ C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 ?3 U& [1 p8 ]% K& |5 @! \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 |4 o, Z' O( m1 V" P0 H- G) P. j6 r
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 r; J/ e- x  d$ \7 G. b

  67. + `6 B4 z3 h# n0 p* E$ x
  68. dma_addr_t dmaphyssrc1 = 0;1 X. o  C: y2 V8 `* h
  69. dma_addr_t dmaphyssrc2 = 0;7 k  y) R9 i. C+ F% t# |2 I
  70. dma_addr_t dmaphysdest1 = 0;
    7 k: X3 O  a1 T9 N
  71. dma_addr_t dmaphysdest2 = 0;
    ( [% q; D1 X' ^6 h

  72. % D0 }6 U% ~- B  V2 w
  73. char *dmabufsrc1 = NULL;' d% L8 j6 n4 q- Z
  74. char *dmabufsrc2 = NULL;
    9 l( u3 R; a2 N- O; [; G% Y
  75. char *dmabufdest1 = NULL;3 D; g" z& ~9 b; i- P9 ]+ A. k; ^
  76. char *dmabufdest2 = NULL;
    0 g  i3 ]) r9 t8 g1 E9 E
  77. ) F" Y7 ?; g+ b0 j. E) V6 B& ^
  78. static int acnt = 512;) d3 {- w$ j9 v* n3 k
  79. static int bcnt = 8;! n5 b$ ?8 D0 l6 E$ q! e3 t
  80. static int ccnt = 8;
    . i5 V# j) ]' y
  81. 1 }" Y0 c$ i; X, W6 @0 d
  82. module_param(acnt, int, S_IRUGO);3 A- J# S! B# j3 Q7 O% x/ _! n
  83. module_param(bcnt, int, S_IRUGO);1 t! Q7 B: E% [& y8 S
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ D4 z7 {% Z  ^  b+ T& W
9 j, O( H4 ?6 Y+ y' F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ D+ |/ Q/ X- m6 e8 x% 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。# N4 i) I; ^( t% J  g
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  ?; Z- V/ B% ^8 |0 u# b
/ |% r- d* H2 e+ S' T  k: A; n* E* c
( ]# j9 f5 G: E* _4 q$ `' Z% h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 06:21 , Processed in 0.040190 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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