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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - I  |+ |2 k5 j- i, N
  1. [code]EDMA sample test application$ t+ _3 f( q6 n  f4 X  R. g
  2. /*
    & a6 i8 O" e: L# v8 G3 G: ]
  3. * edma_test.c
    . F" @0 J4 q7 e8 v
  4. *
    / t, @; X1 [- d
  5. * brief  EDMA3 Test Application
    6 b5 d* Q& Y$ ^; s+ j% w) s8 Y7 d( k
  6. *
    ! w- S- r8 u: N: ~# b  G! T7 [
  7. *   This file contains EDMA3 Test code.; O9 Z6 Y. g0 U
  8. *6 s" m4 T# }, B  F8 `$ A
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    - q' {" M% ]/ o, f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 U% N2 t0 ?' p: v! O$ ^) ]
  11. *         TO CHANGE.: k' d2 @! [9 o8 S) I
  12. *& T' [$ P4 L; b6 M# {- N+ B5 g6 l
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( D, v, E) _: N6 u% l
  14. *; s( t  `8 O) p0 H5 |3 O$ z4 L+ s
  15. * This program is free software; you can redistribute it and/or1 @. M3 n- H$ w5 `
  16. * modify it under the terms of the GNU General Public License as  ]% [2 A) _/ k7 U. |
  17. * published by the Free Software Foundation version 2.9 g1 T; D" ^+ ^
  18. *
    ' P" B3 k0 k/ h* I+ S1 I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  a  x. E* N9 T' q2 E1 l! C5 W
  20. * kind, whether express or implied; without even the implied warranty
    ; H: `# b6 m) B. i! E1 Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the- k, L7 v5 O, E0 p8 T; d1 J0 {
  22. * GNU General Public License for more details.- i: L1 F/ M3 _- I
  23. */
    ! A2 r0 Z, U" Q: ]" A
  24. % |7 p- _- c/ D; A
  25. #include <linux/module.h>
    3 O' w, ?+ c$ `/ A1 U" d3 ?0 @
  26. #include <linux/init.h>
    - R8 d( V  F) {7 t/ R0 p0 L! @& y
  27. #include <linux/errno.h>" B; k" X& e' y" @
  28. #include <linux/types.h>, T" L; E+ S4 l1 }- A, F$ R8 F# f
  29. #include <linux/interrupt.h>
    : n" V% i: t4 k, C% J; [3 W
  30. #include <asm/io.h>; s, p  C) R' T/ N7 v6 a
  31. #include <linux/moduleparam.h>
    " m/ ]5 }+ B; f+ E" _1 P9 [
  32. #include <linux/sysctl.h>7 U6 ~6 T# [3 Z! B
  33. #include <linux/mm.h>
      G$ e' w$ R$ N
  34. #include <linux/dma-mapping.h>
    " K: X% U, N' g1 a

  35. 2 I; F3 w5 j9 f) C- c  s9 v
  36. #include <mach/memory.h>
    / a% R# c7 c: P; Q* ~7 E& r0 {0 B
  37. #include <mach/hardware.h>
    ) b" s6 k4 a- Y4 d4 M
  38. #include <mach/irqs.h>
    6 i5 z  S! ^* F; n2 o$ u
  39. #include <asm/hardware/edma.h>$ U# C1 j. U: ?

  40. - @$ o$ i$ V" ?, W+ e. P
  41. #undef EDMA3_DEBUG
    ( Z; V7 \8 Y' ]  m% V
  42. /*#define EDMA3_DEBUG*/
    ' P5 p: |1 k" c; i% o; |* F

  43. % i& |4 D' c9 L3 _5 [2 b
  44. #ifdef EDMA3_DEBUG2 i, x3 B4 t: U. I; L, R0 D" L! u
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) A' M9 r4 e2 A2 K, D+ }& j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) g* }" b. t! L. Y& F  ^  k* N: F4 p
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); {1 @8 v5 m4 }7 V7 S; a3 u
  48. #else. e8 B" i* Q. j& I( {; g
  49. #define DMA_PRINTK( x... ). t7 u3 @) W! o$ E) g. s% V% e
  50. #define DMA_FN_IN5 I/ s" v4 B. P+ X6 m$ c
  51. #define DMA_FN_OUT
    9 F. ~' g6 y) r9 x' J1 ?4 e6 r. n6 F
  52. #endif
    0 K# S: j& n  v4 i% k
  53. & H+ s" ~9 j# y
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    / E6 t+ h/ E+ ^5 X) U
  55. #define STATIC_SHIFT                35 G% d9 N8 B, }6 {. d0 p" c( n
  56. #define TCINTEN_SHIFT               20
    3 z3 t; B" K% ^7 L5 \. c# O
  57. #define ITCINTEN_SHIFT              21
    4 o1 l" S8 ^, E* k: C: W3 h. t
  58. #define TCCHEN_SHIFT                222 q9 R) @2 [% z  A
  59. #define ITCCHEN_SHIFT               231 a' Z( U. F8 h1 q6 n. l- D% d

  60. ( a7 p$ X* W3 U1 y) Q
  61. static volatile int irqraised1 = 0;  W. m8 h# |* p$ _5 s4 v9 @% Y
  62. static volatile int irqraised2 = 0;1 r, K: a6 V' q
  63. 7 D" g5 O/ k: t4 \$ g; b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , Y7 _* O5 [6 K9 l; a6 Y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 B. H. O$ i1 T: w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 Z3 Y. I; \- V. [* ]. i

  67. 7 @! u) H$ E2 p5 ^8 }- y& H7 E
  68. dma_addr_t dmaphyssrc1 = 0;7 y  O7 w% R1 k. q( G9 U
  69. dma_addr_t dmaphyssrc2 = 0;
    , Z9 R% b' y2 z# C- ~3 t
  70. dma_addr_t dmaphysdest1 = 0;0 ^- Z" x2 w7 D0 L) w6 V
  71. dma_addr_t dmaphysdest2 = 0;
    6 k" b! k( x) N) U' ]+ W2 W

  72. 5 `# Q2 u# B5 [
  73. char *dmabufsrc1 = NULL;$ v& {/ Y8 p' N. h7 ~3 f
  74. char *dmabufsrc2 = NULL;' A3 P, ~$ q# E2 h8 e1 p5 f, A) s
  75. char *dmabufdest1 = NULL;( V5 c0 E; q4 _9 K9 B7 G" v3 N
  76. char *dmabufdest2 = NULL;
    . |: m6 O1 S5 c0 @2 c4 \
  77. 7 s; W6 \8 _$ D. y: K9 E
  78. static int acnt = 512;" O( w  s! I5 b  h9 X
  79. static int bcnt = 8;0 s$ ]$ k& ~: X5 `  t
  80. static int ccnt = 8;3 w  A7 l1 |9 d* S( |. q- N

  81. 7 O3 r1 T! C% M1 d! C% y
  82. module_param(acnt, int, S_IRUGO);4 b( ?& t7 r0 |: E0 W
  83. module_param(bcnt, int, S_IRUGO);. v9 q2 C! X! L4 N9 F7 Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
! ?: T2 U, r% W* j

6 l/ P1 P* v4 A" L* J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& \' z, m2 U8 b% K
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 C7 @* E; f: U2 U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# \; D# x7 y' U8 l! A; k7 \
1 h3 W% s( S! L/ N) Z: g# o/ {# r5 ?
3 F' ]: f6 T) w+ e1 y! A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-30 23:48 , Processed in 0.046570 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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