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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* o/ k/ K5 Q0 r& `7 g' G4 y
  1. [code]EDMA sample test application% v2 V0 |  W+ h5 ?. O7 g3 d
  2. /*
    * @' ~  [, h% o
  3. * edma_test.c6 i2 G" \* M* F7 [% L
  4. *4 ^2 x" k1 {, O! x, I) s, _/ j6 i% b
  5. * brief  EDMA3 Test Application
    7 m6 X0 j6 ^6 O) R4 r
  6. *+ h+ M+ w, \& c0 p
  7. *   This file contains EDMA3 Test code.) a* V5 L/ t  O" T# |0 l' A" d1 Z$ f
  8. *( y* r% i9 `- P
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE! H  d7 r) {; E7 Y) [3 P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT2 R" T. W; }3 F7 F. `/ l
  11. *         TO CHANGE.
    0 U! w# n* i! \9 p# w4 d, i0 H- I* h9 M
  12. *
    5 l2 j/ o7 K+ ]- I5 Q5 ^% l: ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/8 m" U2 T, ?; Q6 D: N9 V
  14. *
    8 K" K9 w3 D2 ]& J6 n
  15. * This program is free software; you can redistribute it and/or7 u* V/ S' u8 C. v/ B1 w9 z4 f
  16. * modify it under the terms of the GNU General Public License as$ |; i; U! S1 f1 Q- T1 M  {: w
  17. * published by the Free Software Foundation version 2.
    1 D# p3 O  X# S4 I2 {9 E
  18. *
    . b  d" e! V1 @3 E6 g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; O# y- M/ Z3 v( ]$ n, D2 o
  20. * kind, whether express or implied; without even the implied warranty' R1 p4 S. l- |! d% m8 \8 l$ R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    + D0 l. w  t9 H( Z
  22. * GNU General Public License for more details.2 }$ r$ M) I4 y7 z1 W7 V9 \
  23. */
    8 X7 p1 _  r. [4 d3 I9 c2 j" D# ]

  24. / Q. w# |' w7 G
  25. #include <linux/module.h>9 w3 o# B" K( k5 [
  26. #include <linux/init.h>( [- Z  D1 I7 Y5 u
  27. #include <linux/errno.h>
    1 N' \: C. g; C# {: j% M% ^  O+ b
  28. #include <linux/types.h>- Z9 L4 T! S, v
  29. #include <linux/interrupt.h>2 O" i4 }/ m+ K6 }4 f5 |
  30. #include <asm/io.h>
    8 `; F3 ?. G2 @3 M: Y8 ~- k7 W# M- j
  31. #include <linux/moduleparam.h>
    ' e# C/ v. k( j' k. q% a+ k
  32. #include <linux/sysctl.h>- s0 U- O7 R+ ]; s
  33. #include <linux/mm.h>/ J) {4 H  b6 v2 t
  34. #include <linux/dma-mapping.h>5 z3 J' u" f7 _) ]0 g. M7 W1 |8 K- R

  35. % K4 O$ U) g# Q
  36. #include <mach/memory.h>, V# m9 ]2 q. `
  37. #include <mach/hardware.h>
    ) Q0 B; P$ c( v( E) j" ]
  38. #include <mach/irqs.h>
    - @" O) g# J2 f, H' Y6 L
  39. #include <asm/hardware/edma.h>6 ^$ E- x4 T2 ]; p
  40. 3 z% s* p' V9 m. X
  41. #undef EDMA3_DEBUG
    & e0 y/ H* i6 X' o4 t4 i" l5 Z- [' v
  42. /*#define EDMA3_DEBUG*/# t0 H* X% c" Q# m

  43.   a& Y. R! k) r# x& v. {) }
  44. #ifdef EDMA3_DEBUG
    * U0 Q( F" B8 W; H3 Q3 @
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)3 n3 c9 |5 F) T+ n3 t* D4 S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    7 q' A" W# P7 Q2 W( ^! q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 X( |0 ^7 Q4 N# A& m3 v
  48. #else1 d2 ]2 J1 u; E. p6 D% c# _/ \: u
  49. #define DMA_PRINTK( x... )" s6 }9 K- e9 M- \. z2 u# O
  50. #define DMA_FN_IN
    . M/ L$ |2 V$ l+ @4 H1 C3 {
  51. #define DMA_FN_OUT0 ?+ N* e) Z/ j1 H7 N) [
  52. #endif3 }" ?7 {+ H' Y( o. ~5 X) c# @& l
  53. 5 ]0 l* A& y" e5 o0 d, m( P! b0 E
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)& y% Y- r+ H1 @, Q; M
  55. #define STATIC_SHIFT                3
    & p$ E7 }  O& X* Q
  56. #define TCINTEN_SHIFT               20
    2 k! t4 }8 F8 s' ?, C$ \4 }
  57. #define ITCINTEN_SHIFT              21" W- a" [! O3 x! E4 D; I
  58. #define TCCHEN_SHIFT                22
    ' C8 b, ^0 W+ M2 k+ b' w' m
  59. #define ITCCHEN_SHIFT               238 A& m; q1 I6 I9 P  k3 {- y8 ?/ Q
  60. / t' f% ^, g+ k% M8 B# o% q. B, k
  61. static volatile int irqraised1 = 0;
    " G6 F9 P1 M" Z' K! ]" z
  62. static volatile int irqraised2 = 0;( n  K+ G* w1 S2 k( u
  63. ( d/ E; ?9 k' W/ O8 O) Q: z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - s0 w3 i7 S+ _. _3 Q# a1 j) m# O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / P1 _# G) F! R* G8 ^9 E
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % w$ [. ?9 {/ A/ x

  67. . k; Y; `, H9 l8 f
  68. dma_addr_t dmaphyssrc1 = 0;
    ( J/ |( }. C5 h' }% ~& ?5 K7 }% t, P
  69. dma_addr_t dmaphyssrc2 = 0;% R, R5 e6 B8 }/ |5 h% m
  70. dma_addr_t dmaphysdest1 = 0;
    " U( J5 P& {& x4 i' r$ g1 ~! a
  71. dma_addr_t dmaphysdest2 = 0;
    : w2 _( F4 f( b1 F9 S% N5 Y  X

  72. / p$ I8 }3 Z: n9 G& U6 Y1 Z7 v
  73. char *dmabufsrc1 = NULL;
    + n  Q4 \$ M% _7 `: b
  74. char *dmabufsrc2 = NULL;
    2 ?( x) v% }  G0 ~/ I
  75. char *dmabufdest1 = NULL;; p, U  f" N# m7 J" w7 r0 h# L
  76. char *dmabufdest2 = NULL;
    * f4 ]7 J, ]* b# B: Z

  77. / D1 _+ \1 Z4 Y2 J' K
  78. static int acnt = 512;
    * X- h' c# a; @* r% B' f
  79. static int bcnt = 8;4 l/ n% U# r( u% f% o1 i
  80. static int ccnt = 8;
    + U) v0 P4 n& h/ N9 L* e$ x

  81. 9 r* H, g2 w( I( k, C/ j
  82. module_param(acnt, int, S_IRUGO);
    ! }  L; w2 T# V  O4 |
  83. module_param(bcnt, int, S_IRUGO);
    5 P7 z$ ?2 e" I$ ]5 [
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' f3 M! y% j) p9 }, K0 P

# |' V, M/ [# w  n" g* }      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用. _: T. k$ e! E7 D! H2 E
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 j( V5 Z# X/ ~6 X3 A; H; l     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: b5 |3 X7 K9 j: m' Z& P) w- G) |1 @$ v0 g: X! C* i' m
! P! w" r8 S; b
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 18:12 , Processed in 0.037818 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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