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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( ?2 ~. f. M9 [2 k; N( M- M4 A3 B
  1. [code]EDMA sample test application* K: q5 w) u4 m: L0 G
  2. /*
    9 r! x$ B& p7 g
  3. * edma_test.c- M) m5 _; y4 ]1 o7 X2 t
  4. *2 a; r) O" ~3 a% E# j
  5. * brief  EDMA3 Test Application/ O# z' f4 [2 C( I3 T( y0 O* ]
  6. *
    ( B1 _7 `4 r0 f$ }4 S9 `( Z% O4 U
  7. *   This file contains EDMA3 Test code.
    8 N* F+ p$ G0 i, o) h% o* E
  8. *
    9 _; B0 U2 j- B5 t
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    * I0 s! i) }9 }$ B2 N* w
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 I+ n8 [. E9 @' |* ~* `8 F) W) c- ]
  11. *         TO CHANGE.# w$ }; ~5 _2 E; Y
  12. *
    0 I/ G# s4 h$ ^. K* T+ `3 ?9 ?1 F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; b: B% P' i6 o& [) Y2 W8 {! X: @
  14. *1 i# ^! Z( @# M$ _% E& J; I% G& D
  15. * This program is free software; you can redistribute it and/or
    5 V) T6 x  ^% F7 `
  16. * modify it under the terms of the GNU General Public License as
    - y) J6 a! E# W& j. D& \
  17. * published by the Free Software Foundation version 2.
    $ s, z, K  ^) H- y/ l- T
  18. *1 w) X4 S7 E$ Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ `# I& p5 j) _0 k% ~; f* J9 A
  20. * kind, whether express or implied; without even the implied warranty
    4 k; y, t8 k% G8 \. O6 r3 a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. X; u- r9 M6 t" E) u6 m
  22. * GNU General Public License for more details.
    & ]7 z+ l$ I/ `0 L4 p1 x" r
  23. */: l  S  Z7 m) ~8 V) N# D
  24. . E2 m7 u, q- y+ e* L9 C" z
  25. #include <linux/module.h>. J7 D. s2 k- X6 a  J
  26. #include <linux/init.h>
    2 F) S; `6 u, U) B  m
  27. #include <linux/errno.h>8 S% g2 k' C. J# F9 g' E
  28. #include <linux/types.h>0 T1 ?) ?0 e0 o: |$ g
  29. #include <linux/interrupt.h>
    3 i0 y" i* b( |/ t
  30. #include <asm/io.h>
    + I% H; W7 g8 U" n0 X5 M% p
  31. #include <linux/moduleparam.h>
    / M( V& `- K* [0 X" j4 [
  32. #include <linux/sysctl.h>, q0 Z4 E; N% [2 v1 u9 `) A
  33. #include <linux/mm.h>. n* _( ?9 z1 c. t/ x
  34. #include <linux/dma-mapping.h>4 w& X5 O% u0 r9 v# Q  I

  35. 9 n% ~' \0 y1 l' y
  36. #include <mach/memory.h>5 I7 [1 Z( T- J7 ]# Y7 k
  37. #include <mach/hardware.h>
    * b$ Q- @5 {! X
  38. #include <mach/irqs.h>+ J3 o' _, L; _, Q* Y5 A) X4 Z" r
  39. #include <asm/hardware/edma.h>/ s, R- r; b( v7 t9 o1 |
  40. ) ~6 S/ z8 L( P) r
  41. #undef EDMA3_DEBUG- N/ D1 Q3 l9 k8 m$ i
  42. /*#define EDMA3_DEBUG*/
    5 B% Q$ {. a: ~2 S. b( N, J( @
  43. 7 S" \; V1 m- g& j% ^
  44. #ifdef EDMA3_DEBUG( i- j, b+ [4 W8 O9 z% R4 [
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 A' R% \0 P! A6 r. H1 F
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ \' q' b9 l0 y! G' n! f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    $ @9 A2 l% n4 ~, H+ {& f, [  i
  48. #else# \, i* d5 A# x$ @1 D7 Z5 E
  49. #define DMA_PRINTK( x... )
    4 q* A; {0 |6 r' {3 l7 Z$ G& k$ V
  50. #define DMA_FN_IN5 J2 k& ?1 @. c; P' d+ Q
  51. #define DMA_FN_OUT2 K6 {# D" q( w3 P
  52. #endif7 h; @6 P+ n) B

  53. + J- t6 V( c; h  ]- m4 z
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % H2 P5 x$ U" w! C/ z6 ]
  55. #define STATIC_SHIFT                3
    " y" w" Y; q" I
  56. #define TCINTEN_SHIFT               20
    : T( \# n7 Y7 E' Y% G6 Z
  57. #define ITCINTEN_SHIFT              217 y/ t1 E8 {  P1 F" A9 z3 V
  58. #define TCCHEN_SHIFT                22
    * v- j- n0 z$ X$ H
  59. #define ITCCHEN_SHIFT               23$ X' ]! r/ o2 r/ u: r% ~

  60. 6 A. Z6 E8 `" U; F& N
  61. static volatile int irqraised1 = 0;/ G/ J! _) {5 y
  62. static volatile int irqraised2 = 0;' B+ K( W4 J; C0 E9 e. x
  63. 1 P. G$ j# j/ g7 S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ a! {9 e" Q  }$ j. V+ p7 c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 {; G2 D" p) i6 T$ h0 U5 j' x% U/ L) o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: ~' k$ P2 C4 d
  67. . n8 U- z- Y5 u6 t
  68. dma_addr_t dmaphyssrc1 = 0;
    & y$ H/ {* {' B3 n; E4 F" o1 B$ e
  69. dma_addr_t dmaphyssrc2 = 0;  h# `# Z* p& |7 r3 v2 c
  70. dma_addr_t dmaphysdest1 = 0;- k. q5 _+ W  T- Z
  71. dma_addr_t dmaphysdest2 = 0;- j% J( w8 q0 K: ^; }2 `

  72. 6 G- T( @0 v5 E1 L7 N' [! J9 c+ ?6 N
  73. char *dmabufsrc1 = NULL;
    % n9 o  U% B8 h* u* ]
  74. char *dmabufsrc2 = NULL;
    ( C6 l5 p1 W3 p
  75. char *dmabufdest1 = NULL;' m0 l' M7 Z+ k0 l, F: M
  76. char *dmabufdest2 = NULL;
    / B3 x, D( Q3 U2 _) K3 e6 c

  77. ' D& [! O6 l* }5 c' d
  78. static int acnt = 512;
    $ g* s) ?9 m3 U1 ^8 i3 q
  79. static int bcnt = 8;  U5 J: j2 f% P
  80. static int ccnt = 8;0 j, `: ^) @& O  h* l
  81. 6 A. Y" `: k4 A* T
  82. module_param(acnt, int, S_IRUGO);/ N/ y2 [# x6 R# [
  83. module_param(bcnt, int, S_IRUGO);) a( a; G+ u, i4 p
  84. module_param(ccnt, int, S_IRUGO);
复制代码

& E6 N% V% o# \' x* ]+ A! Y1 t7 y$ G8 G3 K2 \, ]
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, W) e/ E4 s, W# uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
4 o" o& n  e- ~; ?9 g; }% t# d! e! o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 o$ r/ w2 B: s2 l3 X" a) P! i) u% ?
8 y6 ?: e. o2 }$ h7 `3 I# H9 ]' `0 e- F& U, T! b; H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-20 20:00 , Processed in 0.040510 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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