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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " c, l# A7 H4 T& i2 Y& X: B, M0 F* s
  1. [code]EDMA sample test application
    " D1 b. L* m5 C$ I: u9 z0 N. w
  2. /*
    - V  H9 k8 v) n' P4 H3 w- ]* V
  3. * edma_test.c4 i% U6 ^! _% u+ i3 M# {/ |8 U+ n9 h8 F
  4. *
    8 s5 U5 p' C  |" U* U1 L% G
  5. * brief  EDMA3 Test Application
    ' Z2 q( A5 ~  ?; o
  6. *+ f" ^- @2 O& l& h6 {( S
  7. *   This file contains EDMA3 Test code.
    3 ?4 l8 I. O. h2 w9 l0 N; Z3 O# b
  8. *
    ) P& q4 Y0 o; }, s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' b) O4 |$ c" n6 V  D
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT+ I" L+ F# c: m  ]( o4 K8 e) r
  11. *         TO CHANGE.
    / u( y/ Y  ^% _- C
  12. *, s! U! w& e: x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 q) {& H0 a# n, t8 @. X7 ]
  14. *
    4 q, d9 N, S! t
  15. * This program is free software; you can redistribute it and/or) k8 A, ?9 ~! Y4 o% V: Q5 g; X
  16. * modify it under the terms of the GNU General Public License as
    ) S  j4 I, A+ |- c4 w' J5 L
  17. * published by the Free Software Foundation version 2.; U3 m+ d- A7 j' i6 D) o
  18. *- S  U9 W+ g/ m* h- C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any2 j" D, b5 C: ~4 b
  20. * kind, whether express or implied; without even the implied warranty
    ( ^. F6 I1 n1 E, h" M7 k
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the* C  x& L' {5 ^8 \7 h
  22. * GNU General Public License for more details.
    : m0 D% O; R* \; U/ \5 ^
  23. */
    0 [  ^- p# q0 {0 i$ D+ A

  24. ! r/ c3 c) {- e4 G2 [( `
  25. #include <linux/module.h>
    3 M) h, l$ H0 M" G9 N% W
  26. #include <linux/init.h>
    2 A0 p8 d% {- M' C' q
  27. #include <linux/errno.h>
    $ v% e# Q+ Z) {
  28. #include <linux/types.h>
    0 m6 z1 O) u$ l2 L1 ]
  29. #include <linux/interrupt.h>! w& [$ ]6 s( d8 g
  30. #include <asm/io.h>1 L2 L& T* D8 o+ n
  31. #include <linux/moduleparam.h>! W. l9 u& c) O3 j7 Y& z
  32. #include <linux/sysctl.h>
    + G* l+ U* i( L% A
  33. #include <linux/mm.h>
    7 P: I5 P: ^  ^
  34. #include <linux/dma-mapping.h>/ t! n' R6 S& X: {6 q' a  _

  35. * c, F; |5 A& P) r
  36. #include <mach/memory.h>
    % e% t/ e9 K  n; ?
  37. #include <mach/hardware.h>
    ' |% r& N0 v4 F9 y4 \* z0 e
  38. #include <mach/irqs.h>
    9 ^% f: R  `* J" |4 ]( r; W  d* V
  39. #include <asm/hardware/edma.h>( `5 m" ~- a1 F# X
  40. # j  z+ _2 @3 L) {, ?) ^# V+ G
  41. #undef EDMA3_DEBUG
    ! S! L5 e9 k1 f: q
  42. /*#define EDMA3_DEBUG*/0 K( a, ^4 q; c- |7 u
  43. * B! N2 t7 H, ]& v+ V3 g' Z( X7 _
  44. #ifdef EDMA3_DEBUG, e( `/ l  _6 f- j/ F0 E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)0 j+ L6 v2 k. J4 Z& _! i0 q7 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 I, L) p7 x8 D- V) K: B. M, C
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 c* {" u( h5 K7 A- Z* i# `
  48. #else: j5 V( Z0 Y1 B: l+ I
  49. #define DMA_PRINTK( x... )
    2 i" D+ l" o% P& C
  50. #define DMA_FN_IN% T  F7 B- s% \) ~1 q5 ^& v
  51. #define DMA_FN_OUT
    " l* L, v3 L3 {% `! S/ a6 {
  52. #endif9 E6 S. H4 K6 z3 Q, \
  53. , A) X. w' T2 q0 M# ]1 N
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    7 z' x* C' q, Y* E% P, Q" L# W, P
  55. #define STATIC_SHIFT                3$ K: F+ t4 |/ O9 x3 J
  56. #define TCINTEN_SHIFT               20- ^$ O$ `% c, D+ ~+ n0 P* c
  57. #define ITCINTEN_SHIFT              210 ]. N8 D( W2 s/ k4 ?* d
  58. #define TCCHEN_SHIFT                22
    6 Y# q# I+ \( e
  59. #define ITCCHEN_SHIFT               232 `& l" q5 O& M: m
  60. ! w" ~" @1 n/ _: g) ^: T9 R6 E
  61. static volatile int irqraised1 = 0;5 I% w$ v# V3 }( }
  62. static volatile int irqraised2 = 0;
    $ v# e' G+ ~6 B, y& F
  63. ; M# Q! _1 N0 W: U* }  o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 I/ q: X2 ~/ ?
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 k' a! F: p7 P4 O# I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 n6 H; ^# r1 m

  67. 4 ]% F# b! \8 C% C3 [
  68. dma_addr_t dmaphyssrc1 = 0;9 T! `2 A& M& S; f1 y, I' S# j
  69. dma_addr_t dmaphyssrc2 = 0;' l/ H( ^% B* ^7 W
  70. dma_addr_t dmaphysdest1 = 0;- G2 w% a1 H- Z. r3 h+ p- @4 m
  71. dma_addr_t dmaphysdest2 = 0;2 t+ }9 V0 }; j% j1 X- t' ?
  72. ( H, b" q+ w  a" ~* i
  73. char *dmabufsrc1 = NULL;
    $ Z* `9 t" \1 S( n+ D$ g; b3 n
  74. char *dmabufsrc2 = NULL;* q8 d5 L& j/ s# o7 Y
  75. char *dmabufdest1 = NULL;
    # t5 ~  D! V; w3 g3 Y
  76. char *dmabufdest2 = NULL;) l: X4 R% N3 X1 B
  77. ( x5 S0 M) i, n7 B
  78. static int acnt = 512;
    ) m4 X1 C  @" T! w
  79. static int bcnt = 8;1 O' w/ s- E- {8 }
  80. static int ccnt = 8;- E" n; C/ K4 E

  81. ! x- Z  {' u; X  C6 Z2 M) f) K
  82. module_param(acnt, int, S_IRUGO);
    ' v1 ~! O5 [' J) Q6 q4 {
  83. module_param(bcnt, int, S_IRUGO);: _. n6 v- c1 {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

5 k( O# F6 w0 r$ i+ C7 {$ P6 Z3 L
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: R6 D( z& p$ @6 t$ b- C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 J9 }: P& H) q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% j1 r6 A% {* }) F; f2 H1 e0 X$ d: z- s' }

, P; Y* E; j8 f4 e
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 21:05 , Processed in 0.039223 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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