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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . l. ~: U# A+ O. W- V
  1. [code]EDMA sample test application  m* \7 p% J5 P1 d
  2. /*
    & l/ ?6 L' R1 k. C; q8 I2 `) Z: ]; g4 v
  3. * edma_test.c
    , A4 p. x* u# _/ x+ ?
  4. *$ g# y2 F0 q* ]" K
  5. * brief  EDMA3 Test Application: q5 T5 ]. Y$ }1 j  X- q
  6. *
    7 F, w, q' M$ J  N( V! s- C
  7. *   This file contains EDMA3 Test code.
    ; G# [/ L6 A. u7 r6 x
  8. *
    : Z7 W8 B2 O, I0 b8 U( ]( u3 e" U/ p
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ |3 z6 R! X+ f( e% J8 n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT' Q3 v2 T0 z) m: k& y- h
  11. *         TO CHANGE., c1 t& W* ]( [
  12. *6 N% s/ L/ h4 x1 F) q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/) F+ C0 E! J' m% }  q) `
  14. *
    4 w  y& m# P1 R5 q0 x+ @
  15. * This program is free software; you can redistribute it and/or) V3 `) o; ^+ B
  16. * modify it under the terms of the GNU General Public License as+ @$ z  G& C8 {0 l* [! H7 U
  17. * published by the Free Software Foundation version 2.
    , j5 {/ p: p. f. C
  18. *
    / w; s; o- w$ ?1 l7 G9 ?7 n; b3 |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ B6 R2 s, N$ H. V
  20. * kind, whether express or implied; without even the implied warranty+ l3 _7 a+ n) y' Q. r) P
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# g7 s$ q3 U3 O$ f/ Z$ [
  22. * GNU General Public License for more details.
    9 b( B$ K7 h: ~! w7 B3 b$ E
  23. */8 M6 S9 x' A" D6 Y0 }+ u

  24. ! s/ r& ?: d/ I7 E; B& M6 ]
  25. #include <linux/module.h>
    - n1 {* D* b& }' p( K8 p1 R
  26. #include <linux/init.h>
    * w6 ?2 ?) _' n1 R
  27. #include <linux/errno.h>
    - a  ]6 g8 ~' j! Q
  28. #include <linux/types.h>
    3 z1 j9 k# [6 q5 H" ^& r
  29. #include <linux/interrupt.h>5 s% F) Z, I8 x8 }
  30. #include <asm/io.h>9 @& j- j* E. q# c
  31. #include <linux/moduleparam.h>" e% l4 C+ X9 `0 V' ]/ @1 j& C
  32. #include <linux/sysctl.h>
    " p/ E: b: ]% |$ v4 k6 h
  33. #include <linux/mm.h>
      d: b; W6 Z( P
  34. #include <linux/dma-mapping.h>0 I4 Z& e  {5 z0 J
  35. 2 K, {; U1 u" Z; ?2 T0 q
  36. #include <mach/memory.h>
    " V; O. j: U4 h8 X
  37. #include <mach/hardware.h>
    1 c( t3 \* z# J$ H8 @0 |7 ]* k
  38. #include <mach/irqs.h>
    ) o* r% n) t7 u7 k
  39. #include <asm/hardware/edma.h>
    % u3 X7 e& f7 H; u3 K) q
  40. - k* N& j' ~4 E2 y
  41. #undef EDMA3_DEBUG# T  T' a( T8 d+ c1 s9 k6 C
  42. /*#define EDMA3_DEBUG*/9 M, |/ `  B; C7 J% c

  43. 8 [* r* o8 ^/ u% J0 X& }" a
  44. #ifdef EDMA3_DEBUG) Q- G  |. ]3 n3 V7 h/ Q7 @  |  Q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) V: Z0 P7 s# I- ]3 s+ ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); P4 z/ i# ^  w2 s$ x8 ^
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ; V2 K  }+ Z! h+ X2 M8 a
  48. #else
    4 p! v! e* J  G
  49. #define DMA_PRINTK( x... )
    7 ?# Q  G& T' Y# f
  50. #define DMA_FN_IN
    0 }) t0 _  L4 y
  51. #define DMA_FN_OUT
    9 t( a8 j* ~/ B* ?. M4 J9 q% o
  52. #endif1 Z$ g4 ^7 U# H

  53. ) b) j0 m  ]* Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% i$ X% D- k- r0 y
  55. #define STATIC_SHIFT                3) q: I0 z- c6 K5 t  O4 ]
  56. #define TCINTEN_SHIFT               20$ V1 N* ~9 J4 n/ z' U, [
  57. #define ITCINTEN_SHIFT              21( X1 ?% L( u9 b$ m/ X: e9 k
  58. #define TCCHEN_SHIFT                22
    8 j. v( y5 t+ i0 E8 s
  59. #define ITCCHEN_SHIFT               23: u% E: j" q# a# e% F
  60. 1 }0 v" W, q8 s4 t$ |# Q
  61. static volatile int irqraised1 = 0;  f+ n. [0 b/ E
  62. static volatile int irqraised2 = 0;
    * N( H% C8 A7 g5 O% Z- \3 ]
  63. 9 d3 A5 B' V: o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) \& T& L& A' Y, R8 C4 W; E  K$ V/ {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 U/ T+ K0 g  d5 e  p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 S+ u4 w7 F& k1 n

  67. * q7 v6 @& S4 e* v( q/ T- F
  68. dma_addr_t dmaphyssrc1 = 0;
    * x3 ^' ]: W. \" m( N: U7 k% K
  69. dma_addr_t dmaphyssrc2 = 0;! ~4 r/ a+ u- F$ z+ T+ j* G
  70. dma_addr_t dmaphysdest1 = 0;+ P$ a, z9 p6 @8 k9 M
  71. dma_addr_t dmaphysdest2 = 0;
    ; P% v  Q* ^. j9 y7 B* L

  72. . L+ ]$ i$ L  V+ N5 O
  73. char *dmabufsrc1 = NULL;# y" h$ a2 L! K5 U- ^: W' G% {
  74. char *dmabufsrc2 = NULL;( V) f: s, \3 s2 e" H. T
  75. char *dmabufdest1 = NULL;
    8 k  K5 L0 ^) H2 {+ z- o' ]
  76. char *dmabufdest2 = NULL;# t' H3 S' |  h1 d
  77. - d5 u+ e) F. ?& f1 i
  78. static int acnt = 512;
    6 M$ l* ^) m: E( \
  79. static int bcnt = 8;
    , C. [5 N% o- u+ K; m( c8 c
  80. static int ccnt = 8;( y, \* c; q% e: U
  81.   V: I5 M$ a0 ?; G) ^! u
  82. module_param(acnt, int, S_IRUGO);
    ! i; u4 I0 V/ X# n9 M& m4 n: B
  83. module_param(bcnt, int, S_IRUGO);2 k3 I! M) A! x- D8 H3 E! |
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ b% G' O2 ^' I. G3 V4 d0 ]) O$ ]* p/ J. @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 k$ H' r4 I, ~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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。, ^# e/ w  ]0 I# [  F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% h( ~! x) Q1 K) e

7 c( `/ V5 j6 Z2 ?/ z5 J) Y( {% t$ e+ b8 |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-17 04:47 , Processed in 0.041491 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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