OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 Q2 O; h: s7 E- {. k, o
  1. [code]EDMA sample test application+ I# Y3 a( L8 T* ?6 g
  2. /*
    " R1 b+ }" H$ `  z' n0 A
  3. * edma_test.c; |4 A6 ?' M6 [# B$ B& k. `
  4. *
    , V& j, ^; y& Q$ T% l  S- |% N
  5. * brief  EDMA3 Test Application; T' S6 B( D6 S# k' ~3 y7 ]: Y
  6. *4 t' A/ W! k! k: G4 O- }- ?" i
  7. *   This file contains EDMA3 Test code.' p0 O% `9 B1 j/ e8 }0 H1 L
  8. *: F+ c- Q& N9 F" i1 A- S! m  j
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE5 @  Q2 K9 W  c
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    " ~0 Q; p4 S" Z+ @+ N+ e1 r- M, R: N
  11. *         TO CHANGE.
    + _2 b1 o+ ^  v( X- m
  12. ** d: a, ~9 k6 x. }! h+ C$ K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    3 e- B, m4 d" U* j2 G
  14. *
    8 r7 \# O7 t* x  f( B
  15. * This program is free software; you can redistribute it and/or
    2 E0 X) J' @. K  Q( F5 i
  16. * modify it under the terms of the GNU General Public License as. D+ t  I3 h: }7 O/ |
  17. * published by the Free Software Foundation version 2.
    " F. ]% g; d+ d& F1 {# w( W
  18. *
    ( p  o3 M( s2 G, O5 m  @0 U0 p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 h+ @8 R+ |0 A) e$ t2 O: ^/ ]
  20. * kind, whether express or implied; without even the implied warranty: }0 p% e+ l2 r% r% t
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the4 o  V# y2 k2 Z" c3 A5 A
  22. * GNU General Public License for more details.
    2 ~/ y2 {! m! B8 x0 E
  23. */' a/ Q( j7 m( ~% ^2 ]5 U2 ]# y! ?) c

  24. % C3 V3 l0 V/ z
  25. #include <linux/module.h>' o3 c: i% f3 {
  26. #include <linux/init.h>" Q! v' t# @1 m' p5 m% y
  27. #include <linux/errno.h>
    ( C$ _7 R$ R6 W; v6 a8 N8 R
  28. #include <linux/types.h>
    " [! `5 G. K" r8 j
  29. #include <linux/interrupt.h>- q# b7 O/ ^& J
  30. #include <asm/io.h>
    ( o7 N1 _5 b/ S/ j) u# {6 t: w. Y" h
  31. #include <linux/moduleparam.h>. ?; K8 g; S4 x9 u$ {
  32. #include <linux/sysctl.h>
    - M2 R1 [6 {# a# T. ]/ P  B1 I( T* X' k
  33. #include <linux/mm.h>
    ' j0 l: {; r. G" S) E& Y
  34. #include <linux/dma-mapping.h>
    7 @# m, w* r( m! D4 z; w

  35. ; f( [& X* v8 F
  36. #include <mach/memory.h>
    0 v8 G. ?5 B* r9 W
  37. #include <mach/hardware.h>% c1 v9 E' U9 R7 F: _. K
  38. #include <mach/irqs.h>  G! b9 _( ~8 L0 y
  39. #include <asm/hardware/edma.h>4 t& h: u1 j! ]7 n# H
  40. 4 r  P! m& k' H+ [4 i, X/ s
  41. #undef EDMA3_DEBUG' h. K/ D+ L4 i
  42. /*#define EDMA3_DEBUG*/
    . U2 S' h1 R/ n/ r, X7 ^

  43. 6 W* i3 P  \5 V" m9 F! K3 T
  44. #ifdef EDMA3_DEBUG. W9 u- ~. o7 i0 n& V& G, }' E( l" D; D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& k9 u+ \" w# J5 j0 P7 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " l- c) s) j, A5 `. |7 u1 f& J) F* n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    0 j  ?+ E# o: K
  48. #else
      b0 |; P- G9 S3 w  d: ?# o
  49. #define DMA_PRINTK( x... )& B' D" Q1 O0 E, Q
  50. #define DMA_FN_IN
    2 O$ G6 T) o: y
  51. #define DMA_FN_OUT
    ! _/ d2 \5 f$ H  ]6 m. K
  52. #endif
    * b' N. M" |' T2 S9 p
  53. " O; K) F/ _3 r& Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % J/ }$ h0 W1 u' k- ]
  55. #define STATIC_SHIFT                3+ ~. M# o) y9 _; [
  56. #define TCINTEN_SHIFT               209 c, C$ E( [. k' d/ f. P& U, z) m' K
  57. #define ITCINTEN_SHIFT              212 t9 v6 h0 h) Z- _+ T- t! J6 }) R
  58. #define TCCHEN_SHIFT                22
      f2 g1 x5 J& g( D
  59. #define ITCCHEN_SHIFT               23( _& k! S" h7 K" I" n
  60. 8 _; u/ w" R% y% N5 l& d
  61. static volatile int irqraised1 = 0;
    6 C  I2 y& [9 r2 }. _) E
  62. static volatile int irqraised2 = 0;
    ; {, G( A( x8 q

  63. 5 j6 h# \% J( x0 T  m: [
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 s5 e9 G0 Q2 _# G) U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 h4 ?3 G6 [# P$ ]/ d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' w2 ]9 j3 p& Y" }

  67. / ?4 @% e% Q* L4 c1 u$ `
  68. dma_addr_t dmaphyssrc1 = 0;
    # m. `9 P" M8 K; z
  69. dma_addr_t dmaphyssrc2 = 0;- _$ q. T( g: \7 i4 l( w
  70. dma_addr_t dmaphysdest1 = 0;+ {/ g9 F4 H7 k+ z
  71. dma_addr_t dmaphysdest2 = 0;
    " x8 A8 C5 g; x% e1 P  g

  72. 9 O7 p+ m5 ^' s
  73. char *dmabufsrc1 = NULL;
    8 P1 H1 Q, v6 \+ d: A
  74. char *dmabufsrc2 = NULL;9 L: \% X) E* M' B
  75. char *dmabufdest1 = NULL;/ j+ k+ g$ o4 ?  f
  76. char *dmabufdest2 = NULL;
    . t0 e: N) H2 q4 t  ^3 N) c

  77. 3 \8 \6 U0 A2 c; {
  78. static int acnt = 512;6 T# d* J/ v" V
  79. static int bcnt = 8;8 N! D% H) m' H7 \
  80. static int ccnt = 8;' W. E: C& {2 s* O0 d' ~/ d: c9 q4 O" @

  81. - w2 ~. r% @/ B; {
  82. module_param(acnt, int, S_IRUGO);
    ) k3 _/ O$ d7 b1 x! T7 y- ^/ H
  83. module_param(bcnt, int, S_IRUGO);; U) ~3 h( y* t4 R4 i/ u* @1 b9 k( d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 {% b+ \0 {( f/ y
8 s- n' U( g* k8 h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
, @2 Z* b. R: ]. i* k1 m# ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
' P- z$ F9 B' o     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ O- F9 F3 A4 B$ S8 x1 z, m, ^# W3 h! ]7 R2 v5 s

. M$ O) U+ ]/ r; ~0 u8 e( [; K# p
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-23 19:25 , Processed in 0.041817 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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