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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % L! d1 K" q2 q$ H
  1. [code]EDMA sample test application
    4 _: F# z6 p' P
  2. /*
    + [0 ]( }8 I  w+ X2 ^: x& o
  3. * edma_test.c
    9 B7 e' o  ]# Q8 `3 B. O
  4. *
    & B7 c# h: N) Y4 r5 C
  5. * brief  EDMA3 Test Application
    5 O3 _- j' G3 A* I" c
  6. *# W9 w" j* M! ?0 h
  7. *   This file contains EDMA3 Test code.
    0 J* P9 f! e1 G1 e, f. n
  8. *- b9 V& j' r0 |9 R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ( q2 g7 d  a4 V2 L  K6 Z/ G7 G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 W# G) t! y5 X# y7 B+ |
  11. *         TO CHANGE.
    2 a6 C5 d8 c1 X: L8 b+ e7 m
  12. *4 x# |' j3 \3 d
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 W: {" y# ~+ v( Y( K2 a, f# t
  14. *4 @, r0 A; b, h& J) P" M
  15. * This program is free software; you can redistribute it and/or& E) q7 O: \; |! g7 d8 ]4 m0 J
  16. * modify it under the terms of the GNU General Public License as
    1 p" b; X3 N$ K8 P  H; X+ L
  17. * published by the Free Software Foundation version 2.
    6 Z; i9 M5 `! ^2 T1 f$ [
  18. *+ c* [; i- W$ U5 I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 a) D/ m% b$ |) P+ r
  20. * kind, whether express or implied; without even the implied warranty
    $ E/ t9 ^" L: s, e' d$ i! i  q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the. O: }" G7 u1 ?9 ~% A: o5 O- y) T
  22. * GNU General Public License for more details.( m) {  r8 ]1 N. F, H, A
  23. */
    6 D8 S7 J" y5 L/ Q4 w% e' H( Y
  24. , E! F  L3 v% I3 @8 Z6 Z" B
  25. #include <linux/module.h>8 m# c; x& A0 N8 r$ ?2 |
  26. #include <linux/init.h>1 _& Z6 k1 B& ^# h& D2 G4 m6 v% f
  27. #include <linux/errno.h>
    + B* w7 R9 O% g2 ~
  28. #include <linux/types.h>  x6 n7 |- `2 e/ L" N
  29. #include <linux/interrupt.h>
    & q6 k4 u7 H0 r* H# L  B6 {& l8 i
  30. #include <asm/io.h>* P  Y2 p' Z+ t0 ?% ]
  31. #include <linux/moduleparam.h>+ L6 [2 m1 _* [7 i& k
  32. #include <linux/sysctl.h>! x7 p7 P: x9 z. p. `) P
  33. #include <linux/mm.h>
    3 I  d) U  Q/ a7 G" e2 N, |% s
  34. #include <linux/dma-mapping.h>, [( p: d+ A  G( |% I7 |' P5 S
  35. ! `" O& ~9 P0 x6 D% M+ k. u  r" a
  36. #include <mach/memory.h>
    ; d+ V9 M) W3 ?' W4 F# J
  37. #include <mach/hardware.h>; K+ {  J$ N2 L$ f* A
  38. #include <mach/irqs.h>6 q- M* Q$ t# q: N, j, y
  39. #include <asm/hardware/edma.h>
    ' L2 n/ r9 W( Q" {6 A$ p

  40. & [( r) Z. u# S& S/ w5 d* N* I
  41. #undef EDMA3_DEBUG
    ; O5 G0 g; W) e' o7 t/ H
  42. /*#define EDMA3_DEBUG*/% T( }) t% g1 Q/ F9 }4 z' S

  43. * F% n) ?6 p, V4 n3 J: b7 v
  44. #ifdef EDMA3_DEBUG" n% F: U1 X2 [8 y0 J
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)- s  ~3 \, f6 o/ {. Z& c& A- ^+ A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) g$ b' @- @; _8 \" c2 U5 N
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : g  Q$ @: f+ V/ ?! h9 N
  48. #else
      ]/ f2 E4 ~. M% e+ [
  49. #define DMA_PRINTK( x... )
    ! w, o0 N1 \7 r- a' S1 t
  50. #define DMA_FN_IN
    : v  M3 q% y* F2 f
  51. #define DMA_FN_OUT0 d, F! S& F* v* b+ v8 S) [" l( C
  52. #endif
    5 _' M& i" h( B) s$ m7 c9 R0 q

  53. * p4 [- H" h; f# x- ^, ?1 N3 x
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). b8 ^; M# y; l  R
  55. #define STATIC_SHIFT                3
    . Q  _+ w- u5 t7 s1 Q
  56. #define TCINTEN_SHIFT               20+ N0 V$ p# S% {+ l9 `& I# S. X! b) T
  57. #define ITCINTEN_SHIFT              210 M: J: h: y' e, {4 L. ]
  58. #define TCCHEN_SHIFT                22
    8 H$ d9 o* v) r$ Q5 c) x
  59. #define ITCCHEN_SHIFT               235 Q1 a- p, G3 {# v

  60. . l5 f/ m1 Z* S/ W
  61. static volatile int irqraised1 = 0;: x, w: M" ^/ X; w
  62. static volatile int irqraised2 = 0;
    3 |' R! h$ a$ G: M

  63. 3 h. {. K  q5 A! N. b# {
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: h: t, i/ g, I2 ^/ ^5 b
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) @; F  `  u, {6 ~6 R8 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: ~" B3 ~; _; Y/ k& _5 p' L
  67. ! i, N7 w6 X$ z4 d' |* B4 I
  68. dma_addr_t dmaphyssrc1 = 0;+ t& l( G2 Y% o! Y) d
  69. dma_addr_t dmaphyssrc2 = 0;+ i; Z5 h( ]. |
  70. dma_addr_t dmaphysdest1 = 0;4 v1 n/ ^- G" B1 z, @2 G" G
  71. dma_addr_t dmaphysdest2 = 0;
    8 L. y6 a- G2 C+ K3 o

  72. 2 O% X& Y) j, A; J, l# J
  73. char *dmabufsrc1 = NULL;
    , j- m. }7 @7 e8 ^9 z- V
  74. char *dmabufsrc2 = NULL;
    " ?* _  O7 q; A
  75. char *dmabufdest1 = NULL;/ }) X8 o2 N# }/ D) o
  76. char *dmabufdest2 = NULL;; u- z- Q& A4 F) r) v1 [% ]1 ^

  77. - v7 A7 b) f! ^4 C5 C
  78. static int acnt = 512;. S( _  N1 B/ a3 z: o
  79. static int bcnt = 8;
    * m1 T* t# |: p  n* ?7 C' H. H
  80. static int ccnt = 8;; y( Q- `" Z6 W' _& C6 H4 s

  81. * }* V1 {7 X% y* {
  82. module_param(acnt, int, S_IRUGO);+ A" [3 M4 d( ]8 ^' h
  83. module_param(bcnt, int, S_IRUGO);. {# k% T7 \1 d
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; |/ F2 i6 c! y7 P0 N

5 n, i, v9 N0 W8 U& n      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
- l$ q$ q: h: L2 G. T( s: b: C5 Parm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 [4 Y& m+ W) M6 g     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& `+ n! e* c1 T* U5 M4 v3 w
) g. u' R* I9 @) z# t
* d# ]: R% Z& Z5 X  A3 _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-9 19:18 , Processed in 0.040131 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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