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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
2 h5 N# C6 X( N( f# w
  1. [code]EDMA sample test application
    8 G* p* B, }" c- Z$ Q
  2. /*
    6 P4 c2 f% I' i3 p5 y+ O# Z
  3. * edma_test.c
    ) P3 m0 l6 d" ?1 s
  4. *& V) Z* H- X, f& {/ T9 I2 q
  5. * brief  EDMA3 Test Application
    / b' N+ B  A: g# _& S
  6. *
    , u+ G. ]" f& E  B' |
  7. *   This file contains EDMA3 Test code., ~/ y, ~( M- q6 _+ y) O
  8. *$ V6 C6 }# ]  `3 A& o# r  I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( E2 j0 k$ r" \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT8 P* g- v; L) j& ~/ W1 S2 V
  11. *         TO CHANGE., E0 F' P' M+ B8 X" m' ~. J* X
  12. *
    + ]- j7 U) T; S# b5 S5 ~5 B
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : e6 T( U( m& y6 x  c$ O
  14. *
    - c; O2 q6 X  Q5 k/ ]
  15. * This program is free software; you can redistribute it and/or
    5 X5 P5 a! s# X2 P: }+ I0 P
  16. * modify it under the terms of the GNU General Public License as- l3 i" I* g- v& g$ d8 [. e5 t9 Y% s6 |
  17. * published by the Free Software Foundation version 2.
    ! O4 }! `- P2 @3 o' I+ K
  18. *
    & I4 V, S- w5 g: Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
      V! n% R& W' h0 \+ y; h- R
  20. * kind, whether express or implied; without even the implied warranty
    : ^! P7 h, A. n% \& V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) C9 `& X0 ]1 M) R1 {" s  E, ]
  22. * GNU General Public License for more details.
    5 d% H, s. U' g
  23. */7 J2 o1 K5 r6 D. f7 |* C

  24. 1 a% S+ y7 q% I7 i
  25. #include <linux/module.h>
    9 y. m6 G# N) Q! j4 S5 I# |
  26. #include <linux/init.h>
    5 S5 t1 Q8 M. [; v+ m
  27. #include <linux/errno.h>
    ! s. H( n; s1 H& E! p+ r
  28. #include <linux/types.h>
    5 R: `% x6 ^! W4 g# ?# y+ P  b
  29. #include <linux/interrupt.h>
    5 \3 l& A5 D* p4 e& i0 Q
  30. #include <asm/io.h>; n9 Z5 N9 S2 A/ h3 d4 |+ {
  31. #include <linux/moduleparam.h>
    * S! o- `0 q% I- t; Y5 d
  32. #include <linux/sysctl.h>
    ( P- _+ u  R, \
  33. #include <linux/mm.h>
    ( s+ Z0 H4 e& \4 r6 {/ k/ s
  34. #include <linux/dma-mapping.h>
    1 R" [1 R; I: J, a( b
  35. 1 _, ^3 ^* ]* |3 f
  36. #include <mach/memory.h>
    ) q7 |$ g( y* @. q% l3 P
  37. #include <mach/hardware.h>  \% V! L1 n3 x  B1 w; w
  38. #include <mach/irqs.h>+ a  _# @, q* J( }5 }5 h
  39. #include <asm/hardware/edma.h># D/ y. K5 {3 E" C
  40. ) y/ V& T8 M% R7 j
  41. #undef EDMA3_DEBUG
    ! n1 k' m  B7 e! `' ^
  42. /*#define EDMA3_DEBUG*/2 C$ J8 F# _1 t
  43. 3 m+ D7 u: |5 i# I
  44. #ifdef EDMA3_DEBUG4 G4 x6 u" x. M2 f+ Z+ P/ M! K! h
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    8 |0 l; R3 Y7 ]& P  K0 F; A2 i, j: i8 q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( [9 z. y2 z1 ^% \' t6 V! y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      w1 g$ T) Z( |3 C
  48. #else
    % s* G- f4 d7 H" d9 ]' H! d* |
  49. #define DMA_PRINTK( x... )
    : b6 f% x) n8 o- O4 B3 O
  50. #define DMA_FN_IN
    ; K7 i1 t; R! q9 }; J
  51. #define DMA_FN_OUT% U  K9 Q- D/ m" B. J
  52. #endif6 b* J3 k1 Q$ I1 ~
  53. : N+ q9 O: I/ i" T% O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% `# C1 `" w+ B+ J6 b+ K* f
  55. #define STATIC_SHIFT                3
    3 {5 o9 o* }' V2 X* V$ s; d# m
  56. #define TCINTEN_SHIFT               20
    9 Q6 `, Q* P: o& h
  57. #define ITCINTEN_SHIFT              21+ J9 v. y9 V; S# V
  58. #define TCCHEN_SHIFT                22
    + {( d( t2 }8 N% R) L+ K1 _
  59. #define ITCCHEN_SHIFT               23
    $ g, n. \7 x# c$ d8 S6 B1 I

  60. ( ~7 D) z7 w  b
  61. static volatile int irqraised1 = 0;
    4 z+ O# n, ~- |. J$ U4 C; s
  62. static volatile int irqraised2 = 0;
    ' T. L- l+ M7 c( d8 t- L7 q! R

  63. 7 i7 n& y4 A! |, F1 g" f
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; o) Y# H" Z* E; H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! L3 s/ A% V$ x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * w8 f- Q3 I" C& d% }$ M+ u, n" e

  67. 4 X( x5 A+ d: k% A3 |: Q
  68. dma_addr_t dmaphyssrc1 = 0;" v" d: C. {" L5 t" ]; F' i$ N
  69. dma_addr_t dmaphyssrc2 = 0;9 G6 Y1 M7 K- ]/ I; o
  70. dma_addr_t dmaphysdest1 = 0;
    ; B$ o4 B8 r. ?, f+ F% a3 L6 o
  71. dma_addr_t dmaphysdest2 = 0;( d* i% J7 Z# r) y8 T) A" _

  72. ( V4 O! y0 G1 m. X
  73. char *dmabufsrc1 = NULL;3 t3 S# z" X2 O* v6 `7 K  W+ _
  74. char *dmabufsrc2 = NULL;8 ^5 W1 o4 p5 c
  75. char *dmabufdest1 = NULL;
    : u, s: C9 Y) G5 A
  76. char *dmabufdest2 = NULL;
    : c" v0 J6 x! A8 G

  77. ! |" x" v5 |2 m- h
  78. static int acnt = 512;
    1 c% J* b9 P4 u: I; W9 k
  79. static int bcnt = 8;
    " M. P% l3 R5 G7 w1 K
  80. static int ccnt = 8;& w" K  v8 D: Q7 H7 c' u

  81. " K6 Y! |. e6 E' J4 h/ b3 R6 m
  82. module_param(acnt, int, S_IRUGO);
    " S5 `. A5 S1 x& k: d1 H1 ]+ m( ~* {
  83. module_param(bcnt, int, S_IRUGO);
    0 I+ t" r" h" ?. m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- F8 ]0 F" y) ?' Z
# P: z$ u4 n( p# A$ T* d5 x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用& w5 n/ f$ W" B9 T) N# K4 h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. `" p7 d: m& Z: r; @# f) A     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! Z3 Z& r3 {* o4 g) r
! z; n2 G; z  e; u, L, w9 T- [& q, |& L9 t7 }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 06:01 , Processed in 0.039198 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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