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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ! C% s$ R! O/ f2 Y
  1. [code]EDMA sample test application- N  b# {5 m/ h1 w+ f6 I
  2. /*
    ! l; ?+ L: e" Z5 V5 n
  3. * edma_test.c2 w5 [. y3 D: j1 V
  4. *- c  C1 f" Z' F& S1 t
  5. * brief  EDMA3 Test Application
    5 `& G5 ^5 ]( O6 t' O# O
  6. *4 d1 x. a5 W8 `- X$ I
  7. *   This file contains EDMA3 Test code.; r* ?9 B. `! M! t3 U; G
  8. *% z8 r8 L; A9 |5 ]  l$ D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    # c) b& \) Q1 q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 h/ ]- U" g9 ~% a) Z. o6 s
  11. *         TO CHANGE.
    4 J1 Q$ W3 E0 X, g% K: K
  12. *0 H: N7 m2 S4 M: k$ p, z% T( F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/; m3 t; i- {3 `, ]" Q' G6 M: H
  14. *' H9 H! c5 L1 ~, d$ K5 U- C6 u- [* A
  15. * This program is free software; you can redistribute it and/or6 G+ C. |6 ~. d$ `) W. {% B2 B
  16. * modify it under the terms of the GNU General Public License as' x0 q# {% b0 }" V8 T, y$ ~
  17. * published by the Free Software Foundation version 2., K' g' a: N% b( ~
  18. *
    $ [# T) b; e' C8 T, n3 G
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . ]; k3 |! Y" Z- W5 S8 F8 T
  20. * kind, whether express or implied; without even the implied warranty
    3 u  Q' u- {7 b" [) I" g% s4 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    " m  V, B( C2 V. x' A
  22. * GNU General Public License for more details.
    / p1 g; @% ~+ E5 Z! m& H9 n
  23. */6 t7 b! m6 T4 K' c
  24. 9 e: ~% e0 ]$ R' ~5 d2 L; F" w
  25. #include <linux/module.h>
    ( j# G5 O% @4 f2 y0 v$ I% I
  26. #include <linux/init.h>
    . S* Y  x0 v; |8 T( j# O: i1 e
  27. #include <linux/errno.h>! E: d+ p2 _- m$ o7 H9 a
  28. #include <linux/types.h>1 o/ H+ ^4 l( U; x
  29. #include <linux/interrupt.h>' `0 `! @1 h: K. V5 _1 u3 p5 K5 c* F
  30. #include <asm/io.h>0 e" {* _, [6 U5 r
  31. #include <linux/moduleparam.h>8 V" e) }: R' _) ^5 R& f1 j$ @
  32. #include <linux/sysctl.h>1 E: V9 X7 i( O+ @4 o
  33. #include <linux/mm.h>
    ) s2 {. P9 I  p& A$ F' q) E
  34. #include <linux/dma-mapping.h>3 O; y: Z- Y6 g
  35. + H* D2 M* j! D% C. R
  36. #include <mach/memory.h>
    ! ?' n8 d/ h7 I3 S8 ~. o
  37. #include <mach/hardware.h>
    % v- Q. J' ?, L, [* Q3 z
  38. #include <mach/irqs.h>; P8 x) u2 N2 ^5 b
  39. #include <asm/hardware/edma.h>6 e: M7 o+ W6 P3 Z# o

  40. 8 ~6 K5 \) J$ b1 R8 q( F8 ]' q7 e& H" ?
  41. #undef EDMA3_DEBUG
    , Z  j$ C4 G& d& p* Y' O+ N; R- j- l
  42. /*#define EDMA3_DEBUG*/+ o- U  p$ j/ v2 y7 `/ {$ P2 x

  43. , y/ @2 P. l# H8 y8 s
  44. #ifdef EDMA3_DEBUG
    $ A9 E' F) m# R: s9 @  x* X6 E: S  G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * m9 m- C7 F6 w0 `8 g1 \& {" S  b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)% B! N5 [! W! w0 \3 w
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , e0 s  o' j& Z( c( l
  48. #else
    ) Y2 W* U7 ^+ k8 r. E2 V
  49. #define DMA_PRINTK( x... )
    , K' s, C9 x7 f8 m, O" ]7 B) p
  50. #define DMA_FN_IN
    # y3 X+ V. u+ B
  51. #define DMA_FN_OUT
    ; B" _: |' q2 a$ p9 Y
  52. #endif) @( B% R& w# ~

  53. ) \' }# k$ A. d# v! w1 B- G& b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% R( B! G3 x0 h+ M
  55. #define STATIC_SHIFT                3% f- e: P( H2 @0 b% ^3 h
  56. #define TCINTEN_SHIFT               20
    ! Z( _# G1 n# {+ h" V5 v
  57. #define ITCINTEN_SHIFT              21
    4 _( S9 i' R4 B+ q! s
  58. #define TCCHEN_SHIFT                22
    : a3 U% C% N' k. \  p
  59. #define ITCCHEN_SHIFT               238 y6 n* H1 D/ p* J" f; o, x

  60. , `7 M5 {1 p# t- Q9 e
  61. static volatile int irqraised1 = 0;' L8 k# `% [. x8 J' E  c
  62. static volatile int irqraised2 = 0;4 _9 E: n# [; \

  63. ) Z2 d# G# @) i' d0 ?. }. x+ C
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & K8 Z1 i$ M- Z6 E. \1 m
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 L5 l: Q. |6 ~8 U7 F8 d+ r8 F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 \) m, n  H, }4 d7 u

  67. 7 @4 K6 @9 x$ {% E& A4 A3 S! P/ s, z7 {
  68. dma_addr_t dmaphyssrc1 = 0;1 c  Y3 n7 A- W: n
  69. dma_addr_t dmaphyssrc2 = 0;8 i9 x! ]* f, v5 J* |
  70. dma_addr_t dmaphysdest1 = 0;
    8 E# G, b9 Z5 J, `+ S; |+ |
  71. dma_addr_t dmaphysdest2 = 0;
    9 s4 }- k9 r: z1 v5 T  W8 N3 w3 ~

  72. % |1 k& x1 k& @6 @
  73. char *dmabufsrc1 = NULL;$ F) k( d4 H0 z5 I( f# _; O4 `
  74. char *dmabufsrc2 = NULL;. D+ W- S% |: v2 F' a! b
  75. char *dmabufdest1 = NULL;! X- L2 R# H/ S; T  m& n& N
  76. char *dmabufdest2 = NULL;
    + I7 }. Y9 ?" ]( K2 U* c
  77. 8 ]' X2 h$ g" W4 `' T
  78. static int acnt = 512;9 A# x5 e6 W: `0 e2 |" n) V
  79. static int bcnt = 8;
    9 E& h' c8 a8 @9 W$ N6 o" v
  80. static int ccnt = 8;
    / {0 N3 p- e2 J# g& ~5 ]
  81. , {7 V2 x5 N. f0 E2 Q
  82. module_param(acnt, int, S_IRUGO);
    " p8 V# y9 Z' P. j' F7 u" o
  83. module_param(bcnt, int, S_IRUGO);3 q8 X- M' c$ @4 H# F' J
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 m  v* r. b' o% n. _$ k2 |5 ~" E
# i' I; W& `9 ]  v
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 c' O; x! u# `1 G/ parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& \/ L' \* J# N$ `5 S+ c/ d% {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& B) `* Z! c5 h) C6 x4 M2 R7 c

6 {* N+ g, z) H  m9 \+ b' L# D' x1 N" r% z# W2 H) X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 05:07 , Processed in 0.044396 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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