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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 h0 e, f* j, s
  1. [code]EDMA sample test application8 i8 H3 x$ B  [  C! c/ W
  2. /*
    * {4 O/ B1 W, |2 h" o! d9 g$ @
  3. * edma_test.c# u/ E9 [5 O6 F
  4. *4 D9 O7 N( O/ X. F4 X! G
  5. * brief  EDMA3 Test Application
    # n# X" N: \6 ^( @0 g" A4 w
  6. *
    3 W; ~% w, Z: M- `6 @  k
  7. *   This file contains EDMA3 Test code.
    2 ?: k& f0 n8 Y2 D/ @) j% i* ]
  8. *# ^+ y# Y, {3 ~7 C& @6 U
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    3 @2 O2 o* w# U2 C$ Z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 U5 I% L2 c9 s" D% u6 p1 r) c
  11. *         TO CHANGE.
    ; }- ?1 S: M: W0 i8 R3 D/ e* Z
  12. *
    ' t( ^" v" z4 u, \9 z( Q- x
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 O; b; q! c- S9 ]$ c( B
  14. *
    . z' P6 |1 l0 U- l5 M. s$ @: u
  15. * This program is free software; you can redistribute it and/or
    / N5 T3 _0 h7 {$ ^0 s; i$ m. D
  16. * modify it under the terms of the GNU General Public License as
    # [5 n" P5 Z' W. \
  17. * published by the Free Software Foundation version 2.
    % g! a( a/ F# c4 ]& ^! V9 m
  18. *3 f1 l. L  F' e3 w) m
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . l" B8 V" H) {/ A, Z7 s; }
  20. * kind, whether express or implied; without even the implied warranty3 `  w% c4 N) m5 `
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4 {% |0 \  D7 Y% {0 Y/ y
  22. * GNU General Public License for more details.: `! u) b' S+ j( j! i: g7 Z
  23. */2 |2 i* j  z6 h1 S2 S9 w5 S
  24. ) C4 _% ]- Q8 f$ L' ]. d3 ~
  25. #include <linux/module.h>
    ) j: J3 `5 W5 o! A
  26. #include <linux/init.h>
    & z( s# Z6 g2 X: A+ N
  27. #include <linux/errno.h>) J" W. B( g  `8 J; j
  28. #include <linux/types.h>" Y3 E1 ]! N5 U
  29. #include <linux/interrupt.h>
    5 r9 A) l" s2 ]6 P0 y$ e; k+ p
  30. #include <asm/io.h>
    6 T# W  t2 @+ k6 T# q6 M3 N1 V
  31. #include <linux/moduleparam.h>
    : ?/ \6 t. S3 l
  32. #include <linux/sysctl.h>
    4 u, {4 ^7 r1 T
  33. #include <linux/mm.h>! i6 r4 _( B# ~) V8 ^5 W& D
  34. #include <linux/dma-mapping.h>
    8 W$ T' @- b8 p/ H- h' [

  35. 4 Z/ C2 n- {6 b' R# f
  36. #include <mach/memory.h>
    0 V% R' l* k8 R% u. W0 P3 s" I
  37. #include <mach/hardware.h>
    5 t5 {- `0 d  M
  38. #include <mach/irqs.h>" t. }6 K- e; D& i
  39. #include <asm/hardware/edma.h>0 ]- R! x$ {& O- x7 T
  40. # ~, o2 k) T" G, x3 t
  41. #undef EDMA3_DEBUG" o( ~0 u( ~2 ~) w% N. [" I; _  E
  42. /*#define EDMA3_DEBUG*/
    - f0 Z4 Z3 C! F7 [$ D6 s
  43. / S$ @7 A, }) y4 ?0 j/ T
  44. #ifdef EDMA3_DEBUG* \) `. i. V7 m# K* t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ f- u! U: M7 S) O1 A' M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)7 [- [* Z8 c1 b! e& G7 \# c8 G
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 Z; T3 G" V2 m0 z1 Z. r
  48. #else: E; w, E8 s9 ?6 o8 C4 {) `
  49. #define DMA_PRINTK( x... )7 ]  O0 `+ ]. n. r- D1 k* S+ D/ |" t' e
  50. #define DMA_FN_IN
    7 h; x. o1 |" Q( ]
  51. #define DMA_FN_OUT
    % L2 f8 j$ @7 C: l
  52. #endif7 n. j4 K8 R. j. H+ `1 C
  53. & l% ~# }4 n- q8 l6 M7 H3 k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)  U3 C& P  G  D9 Y
  55. #define STATIC_SHIFT                3. Q8 N( c( Q1 V
  56. #define TCINTEN_SHIFT               205 |8 ?- H: C; Y! v
  57. #define ITCINTEN_SHIFT              21% @5 Y) h( p' W  L$ U
  58. #define TCCHEN_SHIFT                22% u2 Z6 a# E. C+ e/ X
  59. #define ITCCHEN_SHIFT               23% o1 `6 H  c, L
  60. ' S) H' B1 D) v" T# {# ?9 E
  61. static volatile int irqraised1 = 0;
    ; b, X  W7 k, i# [. p% R$ F
  62. static volatile int irqraised2 = 0;
    $ A) w% Z! e. n
  63. - F: H. L7 ]: s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 T4 Z# G  a9 y, _+ p7 @# J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; J" m4 ?; \7 W5 i5 I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . c4 L7 `- k" W6 t

  67. 5 n6 W. g! u# k& A$ b6 U* f
  68. dma_addr_t dmaphyssrc1 = 0;
    ) K3 y; H% f* O' `
  69. dma_addr_t dmaphyssrc2 = 0;
    : R" z( y/ n8 ?% l
  70. dma_addr_t dmaphysdest1 = 0;# g& L, R, a1 [  ]- G  y+ @
  71. dma_addr_t dmaphysdest2 = 0;
    1 a) P+ O' ?, |9 @5 P
  72. ; H% K6 X) c7 l
  73. char *dmabufsrc1 = NULL;
    + [6 Z, }  ?- G; _& P
  74. char *dmabufsrc2 = NULL;
    4 @0 L' Q  c( {% S1 j6 L
  75. char *dmabufdest1 = NULL;
    - h+ ]: G& S; o9 P6 I5 i
  76. char *dmabufdest2 = NULL;
    * M3 a  }8 o: r5 `4 r
  77. ) D; _1 p- m0 j7 g) A6 S  }
  78. static int acnt = 512;
    7 t( y' C- B1 c+ R$ i) a- t, P
  79. static int bcnt = 8;
    / n# g. I; x* D% W
  80. static int ccnt = 8;
      ?+ p9 j2 x) v$ ]- G

  81. ' e7 ^# d+ W; U- }, Y& W5 ]4 ?
  82. module_param(acnt, int, S_IRUGO);
    0 R' x1 b9 c; n3 n7 Y: B
  83. module_param(bcnt, int, S_IRUGO);4 R. Z+ N  _2 ?) c" T9 l* J4 ^
  84. module_param(ccnt, int, S_IRUGO);
复制代码
4 ~5 H: g2 w! t
( @$ T" J7 o8 ^, M& s2 n9 b
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, Q1 I8 w2 c0 I9 B
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
( {/ W, i9 r2 u+ Q( [9 a# o  t0 f# Q( _     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ A5 O; |/ M' C1 V- t  K

( q5 Y$ ?# n$ o$ Y# \: N( I! A
0 W4 ?* c" O! W+ t2 ^, Z: A5 h
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-2 13:25 , Processed in 0.039632 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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