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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
3 q9 J6 U5 U+ V" Y. q$ y0 W
  1. [code]EDMA sample test application
    * o9 o% @- E2 H  {
  2. /*% `5 t+ Q1 \5 z6 U5 w
  3. * edma_test.c7 C; n9 H1 ^4 x2 a* q# G
  4. *7 Y: D' y0 Y# X3 E0 A  i0 x
  5. * brief  EDMA3 Test Application
    " U& V9 n+ n' [1 C6 [! ]
  6. *
    , M1 G3 m. s, u1 B- h
  7. *   This file contains EDMA3 Test code.. n2 l3 P8 B* l3 I/ D$ a+ c. ~  E( q
  8. *5 P4 V1 {9 o7 [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    & d- \8 f4 [" z7 Q4 u. x
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 j; v6 R( X+ ^, [9 g( D: K$ g& i
  11. *         TO CHANGE.$ m7 K( {! L  ]# w' f8 B
  12. *# s( d7 `' X9 N4 c- Q) x- U% W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/( e# q7 ~1 V/ H- K( s% o/ n
  14. *" c* @4 i& G! n$ f/ A
  15. * This program is free software; you can redistribute it and/or
    2 ?( m! c# o1 [: |; p; W, ^
  16. * modify it under the terms of the GNU General Public License as' {+ Y. L3 l2 R  O1 D% l
  17. * published by the Free Software Foundation version 2.1 Q$ g7 \/ }2 X* K- V
  18. *
      G+ R* g6 B  ~! E" n6 y  F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    $ s% S3 s0 n2 p
  20. * kind, whether express or implied; without even the implied warranty4 }' f. O& d' C3 l2 B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : Z/ `4 i; U! O, f
  22. * GNU General Public License for more details.& `; `$ E  V+ Y( b
  23. */  g7 }- T1 m# s+ S

  24. ( j) Z* @( v7 S/ Q* ]
  25. #include <linux/module.h>
    ( @5 ?0 ?1 ^% r& s5 |* m
  26. #include <linux/init.h>- b5 o$ p2 f9 c- t& S
  27. #include <linux/errno.h>* a- h3 t; C3 w; G* z! f3 i1 [) Y( o7 J
  28. #include <linux/types.h>& R) h; P* w" i' Q5 h+ {# z# v1 N
  29. #include <linux/interrupt.h>7 q5 q5 [4 T5 W( |
  30. #include <asm/io.h>0 @) R* V5 r3 |* ^9 {! i  G% u
  31. #include <linux/moduleparam.h>
    2 t5 z# F( W+ l1 L, Z. s8 r4 ?
  32. #include <linux/sysctl.h>6 ~8 w5 o6 E4 q8 u9 Z7 X
  33. #include <linux/mm.h>8 N- N' z% v! R# l& E* O$ {
  34. #include <linux/dma-mapping.h>
    ( C" g  [$ N6 T' }9 M* Y

  35. 1 ]" g6 t6 c% l2 ]! d
  36. #include <mach/memory.h>, R8 b2 [1 L0 d8 `: u8 `
  37. #include <mach/hardware.h>
      P3 o  M- k$ P0 x) v: p+ M
  38. #include <mach/irqs.h>
    & }' f  }0 w* h, C4 K+ T
  39. #include <asm/hardware/edma.h># C) S7 T8 `3 J3 U  K

  40. * u5 n* ~- w- p- e4 S, I( r: X
  41. #undef EDMA3_DEBUG) ^, ]# H$ Q6 \7 S' H/ \
  42. /*#define EDMA3_DEBUG*/
    & C% k9 t! G4 t1 b5 h
  43. $ C, }' T9 ]) y# d( I' p
  44. #ifdef EDMA3_DEBUG' j$ q! p0 c5 p" a& m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 _8 ~, y4 ?& v/ m2 _1 s# u3 N
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 [# P9 }( R- D% N- z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 E: Q2 Q8 T. F" O, k0 F
  48. #else
    7 U& r1 X* w5 ]
  49. #define DMA_PRINTK( x... )
    7 Z: R0 H# r! z* d7 L& \9 R
  50. #define DMA_FN_IN0 S# z; X4 r0 p" c
  51. #define DMA_FN_OUT
    . O5 X6 I; m$ p$ R2 h
  52. #endif
    7 J4 m3 o+ W$ b' H
  53. 5 w. D9 m: g2 O0 S& P1 F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    - t( y2 s- ^$ e7 I8 _
  55. #define STATIC_SHIFT                3! U* r4 X* i+ n" Y5 C9 L/ a) J/ k
  56. #define TCINTEN_SHIFT               20) D8 z; x  P# p- }! |& A$ P# I. v
  57. #define ITCINTEN_SHIFT              217 G6 X6 q: Q! H/ u
  58. #define TCCHEN_SHIFT                22% H- l' c+ X& z+ O
  59. #define ITCCHEN_SHIFT               23
    , r5 I* D- P/ @4 D6 b1 t
  60. 6 {/ }3 F6 |2 A! {+ h
  61. static volatile int irqraised1 = 0;8 E/ y+ G5 l, ~/ J) W- U% ?
  62. static volatile int irqraised2 = 0;! [! O7 i, r" q7 l9 W) I+ ]
  63. 2 D/ E# n' Y1 D) L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 s" z4 e8 N# W( C" i- r
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' H9 M) M5 e, M- ]* A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % Y2 c$ i, q! H: Q8 G9 L
  67. 8 l$ M9 M6 c+ J/ ]2 e0 T
  68. dma_addr_t dmaphyssrc1 = 0;2 j- g- i+ y+ }$ q( |: z
  69. dma_addr_t dmaphyssrc2 = 0;# O# `6 s5 x4 X) w  F3 J" O! o  |* F# _4 s
  70. dma_addr_t dmaphysdest1 = 0;
    2 r4 p7 F9 p! E9 w
  71. dma_addr_t dmaphysdest2 = 0;) j2 V1 k- R( I, D2 v2 k3 D
  72. + m  z" N: R: |* \: D  C9 R
  73. char *dmabufsrc1 = NULL;# j* S1 S5 X: z# B$ y
  74. char *dmabufsrc2 = NULL;
    ) u$ x' `- Q( O4 |1 A# G% K
  75. char *dmabufdest1 = NULL;
    5 t+ b# ]: q7 c0 m' w
  76. char *dmabufdest2 = NULL;
    # E+ y# C% Q5 P1 K0 U) D
  77. " w2 D* @) T+ o2 |. e, Z* `0 _
  78. static int acnt = 512;
    ; _4 P: f" h, G
  79. static int bcnt = 8;
    3 ^" W3 h/ S9 O7 I/ T
  80. static int ccnt = 8;* c4 W3 k$ K" e! n( {

  81. ) r3 E) m2 F, a  t' J( S' N3 B
  82. module_param(acnt, int, S_IRUGO);
    & G0 c% r& q7 m$ M. d3 N/ x3 G9 S
  83. module_param(bcnt, int, S_IRUGO);& ?1 D6 Q' T$ k* z! N
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ @+ c& K* ?$ p! d8 p. _
  p) _" ]8 p8 h' y: l* x
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: V# Z2 N: F, U5 T$ O1 uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
) Y/ f4 o- f( h3 C2 |1 p( X. N  T     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' d5 v/ l$ \3 E2 g+ u

; j/ x7 j8 b/ V: p6 i. X7 I: ?; m( o/ s! ~5 ]) N$ D* d3 P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-15 20:37 , Processed in 0.039999 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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